vllm.multimodal.media ¶
Modules:
| Name | Description |
|---|---|
audio | |
base | |
image | |
video | |
__all__ module-attribute ¶
__all__ = [
"MediaIO",
"MediaWithBytes",
"AudioEmbeddingMediaIO",
"AudioMediaIO",
"ImageEmbeddingMediaIO",
"ImageMediaIO",
"VideoMediaIO",
]
AudioEmbeddingMediaIO ¶
Source code in vllm/multimodal/media/audio.py
__init__ ¶
encode_base64 ¶
load_base64 ¶
load_bytes ¶
Source code in vllm/multimodal/media/audio.py
load_file ¶
Source code in vllm/multimodal/media/audio.py
AudioMediaIO ¶
Bases: MediaIO[tuple[NDArray, float]]
Source code in vllm/multimodal/media/audio.py
ImageEmbeddingMediaIO ¶
Source code in vllm/multimodal/media/image.py
__init__ ¶
encode_base64 ¶
load_base64 ¶
load_bytes ¶
Source code in vllm/multimodal/media/image.py
load_file ¶
Source code in vllm/multimodal/media/image.py
ImageMediaIO ¶
Source code in vllm/multimodal/media/image.py
__init__ ¶
__init__(image_mode: str = 'RGB', **kwargs) -> None
Source code in vllm/multimodal/media/image.py
_convert_image_mode ¶
_convert_image_mode(
image: Image | MediaWithBytes[Image],
) -> Image
Convert image mode with custom background color.
Source code in vllm/multimodal/media/image.py
encode_base64 ¶
Source code in vllm/multimodal/media/image.py
load_base64 ¶
load_base64(
media_type: str, data: str
) -> MediaWithBytes[Image]
load_bytes ¶
load_bytes(data: bytes) -> MediaWithBytes[Image]
load_file ¶
load_file(filepath: Path) -> MediaWithBytes[Image]
MediaIO ¶
Source code in vllm/multimodal/media/base.py
MediaWithBytes dataclass ¶
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 modality.
Source code in vllm/multimodal/media/base.py
VideoMediaIO ¶
Bases: MediaIO[tuple[NDArray, dict[str, Any]]]
Source code in vllm/multimodal/media/video.py
__init__ ¶
__init__(
image_io: ImageMediaIO, num_frames: int = 32, **kwargs
) -> None