vllm.multimodal.registry
DummyInputsBuilderFactory
¶
Constructs a
BaseDummyInputsBuilder
instance from the context.
Source code in vllm/multimodal/registry.py
MultiModalProcessorFactory
¶
Constructs a
BaseMultiModalProcessor
instance from the context.
Source code in vllm/multimodal/registry.py
__call__
¶
__call__(
info: _I,
dummy_inputs: BaseDummyInputsBuilder[_I],
*,
cache: Optional[ProcessingCache] = None,
) -> BaseMultiModalProcessor[_I]
MultiModalRegistry
¶
A registry that dispatches data processing according to the model.
Source code in vllm/multimodal/registry.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 |
|
_processor_factories
instance-attribute
¶
_processor_factories = ClassRegistry[
Module, _ProcessorFactories
]()
__init__
¶
_get_model_cls
¶
_get_model_cls(model_config: ModelConfig)
create_input_mapper
¶
create_input_mapper(model_config: ModelConfig)
Source code in vllm/multimodal/registry.py
create_processor
¶
create_processor(
model_config: ModelConfig,
*,
tokenizer: Optional[AnyTokenizer] = None,
disable_cache: Optional[bool] = None,
) -> BaseMultiModalProcessor[BaseProcessingInfo]
Create a multi-modal processor for a specific model and tokenizer.
Source code in vllm/multimodal/registry.py
get_decoder_dummy_data
¶
get_decoder_dummy_data(
model_config: ModelConfig,
seq_len: int,
mm_counts: Optional[Mapping[str, int]] = None,
) -> DummyDecoderData
Create dummy data for profiling the memory usage of a model.
The model is identified by model_config
.
Source code in vllm/multimodal/registry.py
get_encoder_dummy_data
¶
get_encoder_dummy_data(
model_config: ModelConfig,
seq_len: int,
mm_counts: Optional[Mapping[str, int]] = None,
) -> DummyEncoderData
Create dummy data for profiling the memory usage of a model.
The model is identified by model_config
.
Source code in vllm/multimodal/registry.py
get_max_multimodal_tokens
¶
get_max_multimodal_tokens(model_config: ModelConfig) -> int
Get the maximum number of multi-modal tokens for profiling the memory usage of a model.
Source code in vllm/multimodal/registry.py
get_max_tokens_by_modality
¶
get_max_tokens_by_modality(
model_config: ModelConfig,
) -> Mapping[str, int]
Get the maximum number of tokens from each modality for profiling the memory usage of a model.
Source code in vllm/multimodal/registry.py
get_max_tokens_per_item_by_modality
¶
get_max_tokens_per_item_by_modality(
model_config: ModelConfig,
) -> Mapping[str, int]
Get the maximum number of tokens per data item from each modality based on underlying model configuration.
Source code in vllm/multimodal/registry.py
get_max_tokens_per_item_by_nonzero_modality
¶
get_max_tokens_per_item_by_nonzero_modality(
model_config: ModelConfig,
) -> Mapping[str, int]
Get the maximum number of tokens per data item from each modality based
on underlying model configuration, excluding modalities that user
explicitly disabled via limit_mm_per_prompt
.
Note
This is currently directly used only in V1 for profiling the memory usage of a model.
Source code in vllm/multimodal/registry.py
get_mm_limits_per_prompt
¶
get_mm_limits_per_prompt(
model_config: ModelConfig,
) -> Mapping[str, int]
Get the maximum number of multi-modal input instances for each modality that are allowed per prompt for a model class.
Source code in vllm/multimodal/registry.py
has_processor
¶
has_processor(model_config: ModelConfig) -> bool
Source code in vllm/multimodal/registry.py
init_mm_limits_per_prompt
¶
init_mm_limits_per_prompt(
model_config: ModelConfig,
) -> None
Source code in vllm/multimodal/registry.py
register_processor
¶
register_processor(
processor: MultiModalProcessorFactory[_I],
*,
info: ProcessingInfoFactory[_I],
dummy_inputs: DummyInputsBuilderFactory[_I],
)
Register a multi-modal processor to a model class. The processor is constructed lazily, hence a factory method should be passed.
When the model receives multi-modal data, the provided function is invoked to transform the data into a dictionary of model inputs.
Source code in vllm/multimodal/registry.py
ProcessingInfoFactory
¶
Constructs a
BaseMultiModalProcessor
instance from the context.
Source code in vllm/multimodal/registry.py
_ProcessorFactories
dataclass
¶
Source code in vllm/multimodal/registry.py
__init__
¶
__init__(
info: ProcessingInfoFactory[_I],
processor: MultiModalProcessorFactory[_I],
dummy_inputs: DummyInputsBuilderFactory[_I],
) -> None
build_processor
¶
build_processor(
ctx: InputProcessingContext,
*,
cache: Optional[ProcessingCache] = None,
)