[Bugfix][Multimodal] Bound renderer warmup to the prefill token budget (#55448)
Signed-off-by: Luca Motz <luca.motz@icloud.com> Co-authored-by: OpenAI Codex <codex@openai.com>
This commit is contained in:
@@ -29,7 +29,12 @@ from .processing import (
|
||||
)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from vllm.config import ModelConfig, ObservabilityConfig, VllmConfig
|
||||
from vllm.config import (
|
||||
ModelConfig,
|
||||
ObservabilityConfig,
|
||||
SchedulerConfig,
|
||||
VllmConfig,
|
||||
)
|
||||
from vllm.model_executor.models.interfaces import SupportsMultiModal
|
||||
|
||||
logger = init_logger(__name__)
|
||||
@@ -243,6 +248,7 @@ class MultiModalRegistry:
|
||||
*,
|
||||
cache: BaseMultiModalProcessorCache | None = None,
|
||||
processor: BaseMultiModalProcessor | None = None,
|
||||
scheduler_config: "SchedulerConfig | None" = None,
|
||||
) -> MultiModalInput:
|
||||
"""
|
||||
Create dummy data for profiling the memory usage of a model.
|
||||
@@ -250,6 +256,8 @@ class MultiModalRegistry:
|
||||
The model is identified by `model_config`.
|
||||
"""
|
||||
seq_len = model_config.max_model_len
|
||||
if scheduler_config is not None and scheduler_config.enable_chunked_prefill:
|
||||
seq_len = min(seq_len, scheduler_config.max_num_batched_tokens)
|
||||
|
||||
if processor is None:
|
||||
processor = self.create_processor(model_config, cache=cache)
|
||||
|
||||
@@ -246,19 +246,16 @@ class BaseRenderer(ABC, Generic[_T]):
|
||||
*,
|
||||
log_prefix: str,
|
||||
) -> None:
|
||||
from vllm.multimodal.processing import TimingContext
|
||||
|
||||
model_config = self.model_config
|
||||
mm_config = model_config.get_multimodal_config()
|
||||
mm_limits = {k: v for k, v in processor.info.allowed_mm_limits.items() if v > 0}
|
||||
|
||||
start_time = time.perf_counter()
|
||||
processor_inputs = processor.dummy_inputs.get_dummy_processor_inputs(
|
||||
seq_len=model_config.max_model_len,
|
||||
_ = mm_registry.get_dummy_mm_inputs(
|
||||
model_config,
|
||||
mm_counts=dict.fromkeys(mm_limits, 1),
|
||||
mm_options=mm_config.limit_per_prompt,
|
||||
processor=processor,
|
||||
scheduler_config=self.config.scheduler_config,
|
||||
)
|
||||
_ = processor.apply(processor_inputs, timing_ctx=TimingContext(enabled=False))
|
||||
|
||||
elapsed = time.perf_counter() - start_time
|
||||
logger.info("%s warmup completed in %.3fs", log_prefix, elapsed)
|
||||
|
||||
Reference in New Issue
Block a user