vllm-project/vllm · error · NotImplementedError

{pooling_type}

Error message

{pooling_type}

What it means

Raised as NotImplementedError in PoolerConfig.__post_init__ when pooling_type is a string that is neither in SEQ_POOLING_TYPES ('CLS','LAST','MEAN') nor TOK_POOLING_TYPES ('ALL','STEP'). The Literal typing should catch bad strings at pydantic validation, but this branch guards direct object construction or bypassed validation.

Source

Thrown at vllm/config/pooler.py:160

                    "Cannot set both `pooling_type` and `tok_pooling_type`"
                )

            if pooling_type in SEQ_POOLING_TYPES:
                logger.debug(
                    "Resolved `pooling_type=%r` to `seq_pooling_type=%r`.",
                    pooling_type,
                    pooling_type,
                )
                self.seq_pooling_type = pooling_type  # type: ignore[assignment]
            elif pooling_type in TOK_POOLING_TYPES:
                logger.debug(
                    "Resolved `pooling_type=%r` to `tok_pooling_type=%r`.",
                    pooling_type,
                    pooling_type,
                )
                self.tok_pooling_type = pooling_type  # type: ignore[assignment]
            else:
                raise NotImplementedError(pooling_type)

    def get_seq_pooling_type(self) -> SequencePoolingType:
        if self.seq_pooling_type is None:
            raise ValueError(
                "seq_pooling_type is not set; it should be resolved by"
                " ModelConfig before calling get_seq_pooling_type()"
            )
        return self.seq_pooling_type

    def get_tok_pooling_type(self) -> TokenPoolingType:
        if self.tok_pooling_type is None:
            raise ValueError(
                "tok_pooling_type is not set; it should be resolved by"
                " ModelConfig before calling get_tok_pooling_type()"
            )
        return self.tok_pooling_type

    def compute_hash(self) -> str:

View on GitHub (pinned to c794754062)

Solutions

  1. Use one of the supported values: for sequence pooling 'CLS' | 'LAST' | 'MEAN'; for token pooling 'ALL' | 'STEP'.
  2. Use uppercase exactly — values are case-sensitive Literals.
  3. Set the more specific seq_pooling_type / tok_pooling_type field if unsure which category applies.

Example fix

# before
PoolerConfig(pooling_type='mean')

# after
PoolerConfig(pooling_type='MEAN')
Defensive patterns

Strategy: validation

Validate before calling

SEQ = {"CLS", "LAST", "MEAN"}
TOK = {"ALL", "STEP"}

def is_valid_pooling_type(v: str) -> bool:
    return v in SEQ | TOK

assert is_valid_pooling_type(user_value.upper()), f"unsupported pooling_type {user_value!r}"

Type guard

from typing import Literal, TypeGuard
from vllm.config.pooler import SequencePoolingType, TokenPoolingType

def is_seq_pooling_type(v: str) -> TypeGuard[SequencePoolingType]:
    return v in ("CLS", "LAST", "MEAN")

Prevention

When it happens

Trigger: Building PoolerConfig with pooling_type='AVG', 'max', 'mean_pooling', or any other unsupported value outside the two Literal sets.

Common situations: Misspelled or case-mismatched pooling names ('mean' vs 'MEAN', 'last_token' vs 'LAST'); configs ported from other frameworks using their pooling vocabulary.

Related errors


AI-assisted analysis of vllm-project/vllm@c794754062 (2026-08-14). Data as JSON: /api/errors/6e7da76c31be1105. Report an issue: GitHub.