Skip to content

vllm.v1.outputs

Classes:

Functions:

AsyncModelRunnerOutput

Bases: ABC

Methods:

get_kv_connector_output() abstractmethod

Get the underlying kv_connector_output.

When get_output() fails, this is used to salvage the step's KV output instead of losing it with the failure.

get_output() abstractmethod

Get the ModelRunnerOutput for this async output.

This is a blocking call that waits until the results are ready, which might involve copying device tensors to the host. This method should only be called once per AsyncModelRunnerOutput.

LogprobsTensors

Bases: NamedTuple

Methods:

  • cat –

    Concatenate flattened logprob tensors.

  • empty_cpu –

    Create empty LogprobsTensors on CPU.

  • filter –

    Filter the logprobs tensors with the given bool mask.

cat(tensors, cu_num_generated_tokens=None) staticmethod

Concatenate flattened logprob tensors.

empty_cpu(num_positions, num_tokens_per_position) staticmethod

Create empty LogprobsTensors on CPU.

filter(mask)

Filter the logprobs tensors with the given bool mask.

ModelRunnerOutput dataclass

Methods:

with_ec_conn_output(output, ec_connector_output) staticmethod

Return output carrying ec_connector_output.

The shared empty output is copied rather than written to, so callers must use the return value.

with_ec_conn_output_only(ec_connector_output) staticmethod

Return an otherwise-empty output carrying ec_connector_output.

with_kv_conn_output_only(kv_connector_output) staticmethod

Return ModelRunnerOutput containing the provided KVConnectorOutput, otherwise empty. Returns None if kv_connector_output is passed as None.

SamplingMaskLists

Bases: NamedTuple

CSR sampling masks; a request slice may contain multiple positions.

make_empty_encoder_model_runner_output(scheduler_output)

Create a ModelRunnerOutput stub that contains the correct per-request bookkeeping but no generated data yet.