vllm.multimodal.tensor_transport
¶
Shared contracts for externally stored multimodal tensor bundles.
Classes:
-
BaseMMTensorReference–Common metadata for one externally stored tensor bundle.
-
MMTensorMemoryBudget–Bytes one API server may hold for referenced multimodal tensors.
-
MMTensorReservation–Bytes reserved from an
MMTensorMemoryBudget, returned by the last holder. -
MMTensorTransportError–Raised when an external multimodal tensor bundle cannot be used.
-
ReleasingStream–Iterate
streamand releasereservationsonce it's done with.
Functions:
-
decode_mm_tensor_bundle–Decode one SafeTensors bundle whose digest has been verified.
-
run_in_read_slot–Run
fninexecutorwhile holding a slot ofsemaphore. -
validate_mm_tensor_request_size–Check and return the total declared size of one request's objects.
BaseMMTensorReference
¶
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.