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.
-
MMTensorReader–Store-specific reader for
ObjectStorageMMReferenceobjects. -
MMTensorReservation–Bytes reserved from an
MMTensorMemoryBudget, returned by the last holder. -
MMTensorTransportError–Raised when an external multimodal tensor bundle cannot be used.
-
MultiStoreMMReader–Dispatch object-storage tensor references to the configured backend.
-
ObjectStorageMMReader–Shared validation, error hiding, digest, and decode flow for object stores.
-
ObjectStorageMMReference–Reference to one processed multimodal tensor bundle in object storage.
-
ReleasingStream–Iterate
streamand releasereservationsonce it's done with.
Functions:
-
decode_mm_tensor_bundle–Decode one SafeTensors bundle whose digest has been verified.
-
parse_object_storage_uri–Parse
<scheme>://<container_or_bucket>/<key>and reject traversal. -
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.
MultiStoreMMReader
¶
Dispatch object-storage tensor references to the configured backend.
ObjectStorageMMReader
¶
Bases: ABC
Shared validation, error hiding, digest, and decode flow for object stores.
Methods:
-
read–Fetch, bound, verify, and decode one referenced tensor bundle.
-
validate–Validate a reference and return its server-approved container and key.
_fetch_bytes(container, key, reference, unavailable)
abstractmethod
¶
Fetch and bound the raw payload bytes from the backing object store.
read(reference)
¶
Fetch, bound, verify, and decode one referenced tensor bundle.
A missing, inaccessible or mismatched object raises the same error, so a caller can't learn about objects it doesn't already know.
validate(reference)
¶
Validate a reference and return its server-approved container and key.
ObjectStorageMMReference
¶
Bases: BaseMMTensorReference
Reference to one processed multimodal tensor bundle in object storage.
Attributes:
uri = Field(min_length=1, max_length=2048)
class-attribute
instance-attribute
¶
Object storage URI (e.g. s3://bucket/key or az://container/blob).
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.
parse_object_storage_uri(uri, *, scheme, store_name, uri_example, allow_empty_key=False)
¶
Parse <scheme>://<container_or_bucket>/<key> and reject traversal.
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.