vllm.benchmarks.mm_processor
¶
Benchmark multimodal processor latency.
This benchmark measures the latency of the mm processor module using multimodal prompts from datasets. MM processor stats are automatically enabled.
Run
vllm bench mm-processor \
--model
Functions:
-
add_cli_args–Add CLI arguments for the multimodal processor benchmark.
-
benchmark_multimodal_processor–Run the multimodal processor benchmark.
-
calculate_mm_processor_metrics–Calculate aggregate metrics from stats by stage.
-
collect_mm_processor_stats–Collect multimodal processor timing stats.
-
get_timing_stats_from_engine–Get all multimodal timing stats from the LLM engine.
-
main–Main entry point for the multimodal processor benchmark.
-
validate_args–Validate command-line arguments for mm_processor benchmark.
add_cli_args(parser)
¶
Add CLI arguments for the multimodal processor benchmark.
benchmark_multimodal_processor(args)
¶
Run the multimodal processor benchmark.
calculate_mm_processor_metrics(stats_by_stage, selected_percentiles, *, unit='ms')
¶
Calculate aggregate metrics from stats by stage.
collect_mm_processor_stats(llm_engine)
¶
Collect multimodal processor timing stats. Returns a dictionary mapping stage names to lists of timing values (in seconds).
get_timing_stats_from_engine(llm_engine)
¶
Get all multimodal timing stats from the LLM engine.
Collects both preprocessing stats (HF processor, hashing, cache lookup, prompt update) and encoder forward pass timing, merged by request_id.
Parameters:
Returns:
-
dict[str, dict[str, float]]–Dictionary mapping request_id to merged stats dict containing
-
dict[str, dict[str, float]]–both preprocessing and encoder timing metrics.
Example
{ 'request-123': { 'get_mm_hashes_secs': 0.02, 'get_cache_missing_items_secs': 0.01, 'apply_hf_processor_secs': 0.45, 'merge_mm_kwargs_secs': 0.01, 'apply_prompt_updates_secs': 0.03, 'preprocessor_total_secs': 0.51, 'encoder_forward_secs': 0.23, 'num_encoder_calls': 1 } }
main(args)
¶
Main entry point for the multimodal processor benchmark.
validate_args(args)
¶
Validate command-line arguments for mm_processor benchmark.