Skip to content

vllm.multimodal.tensor_transport

Shared contracts for externally stored multimodal tensor bundles.

Classes:

Functions:

BaseMMTensorReference

Bases: BaseModel

Common metadata for one externally stored tensor bundle.

Attributes:

  • digest (str) –

    Lowercase hex SHA-256 of the object bytes.

digest = Field(pattern='^[0-9a-f]{64}$') class-attribute instance-attribute

Lowercase hex SHA-256 of the object bytes.

MMTensorMemoryBudget

Bytes one API server may hold for referenced multimodal tensors.

Requests wait in arrival order until their reservation fits. All methods must be called from the event loop thread.

MMTensorReservation

Bytes reserved from an MMTensorMemoryBudget, returned by the last holder.

MMTensorTransportError

Bases: VLLMUnprocessableEntityError

Raised when an external multimodal tensor bundle cannot be used.

ReleasingStream

Bases: AsyncIterator[_T]

Iterate stream and release reservations once it's done with.

That's when the stream ends or fails, when it's closed, or when it's dropped without ever being iterated, which an async generator's finally would miss.

decode_mm_tensor_bundle(payload, *, location)

Decode one SafeTensors bundle whose digest has been verified.

run_in_read_slot(semaphore, fn, reservation=None, executor=None) async

Run fn in executor while holding a slot of semaphore.

The slot, and a hold on reservation, are released only when fn returns, even if the caller is cancelled first, because the executor thread keeps running.

validate_mm_tensor_request_size(references, max_nbytes)

Check and return the total declared size of one request's objects.