vllm.multimodal.media.base
¶
Classes:
-
MediaDecodedBudget–Thread-safe decoded-media byte accumulator for one request.
-
MediaIO–Configuration values can be user-provided either by --media-io-kwargs or
-
MediaWithBytes–Wrapper that couples a media object with its original encoded bytes.
MediaDecodedBudget
¶
Thread-safe decoded-media byte accumulator for one request.
Methods:
MediaIO
¶
Configuration values can be user-provided either by --media-io-kwargs or by the runtime API field "media_io_kwargs". Ensure proper validation and error handling.
Methods:
-
get_max_bytes–Return the maximum encoded payload size accepted by this media IO.
-
load_base64–List of media types:
-
merge_kwargs–Merge config-level kwargs and request-level kwargs.
get_max_bytes()
¶
Return the maximum encoded payload size accepted by this media IO.
load_base64(media_type, data)
abstractmethod
¶
List of media types: https://www.iana.org/assignments/media-types/media-types.xhtml
merge_kwargs(default_kwargs, runtime_kwargs)
classmethod
¶
Merge config-level kwargs and request-level kwargs.
By default this performs a shallow merge where runtime kwargs override keys in default kwargs. Subclasses may override to apply modality- specific behavior.
MediaWithBytes
dataclass
¶
Bases: Generic[_T]
Wrapper that couples a media object with its original encoded bytes.
This ensures the raw bytes and media object remain synchronized, preventing cache corruption from in-place modifications.
The wrapper delegates attribute access to the underlying media object, making it behave transparently like the wrapped type (e.g., PIL.Image).
NOTE: Currently, this wrapper is used only for the image and video modalities.
Methods:
-
__array__–Allow np.array(obj) to return np.array(obj.media).
-
__getattr__–Delegate attribute access to the underlying media object.
-
__getitem__–Allow obj[i] to index obj.media (e.g. video tuples).
-
__iter__–Allow unpacking obj to unpack obj.media (e.g. video tuples).
Attributes:
-
io_config(dict[str, Any] | None) –Decode settings that altered the media relative to
original_bytes
io_config = None
class-attribute
instance-attribute
¶
Decode settings that altered the media relative to original_bytes
(e.g. image_mode conversion), so they participate in cache hashing.
__array__(*args, **kwargs)
¶
Allow np.array(obj) to return np.array(obj.media).
__getattr__(name)
¶
Delegate attribute access to the underlying media object.
__getitem__(index)
¶
Allow obj[i] to index obj.media (e.g. video tuples).
__iter__()
¶
Allow unpacking obj to unpack obj.media (e.g. video tuples).