@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / da511d54d8
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 15, 07:15 UTC

Fix CompilationConfig repr (#19091)

Signed-off-by: rzou <zou3519@gmail.com>

Richard Zou committed Jun 6, 2025 at 04:23 UTC da511d54d881385cdee45979fee5a5c1c39cdf3c
2 files changed +33 -15
tests/test_config.py
+13
@@ -6,6 +6,7 @@ from typing import Literal, Union
6
7 import pytest
8
9 +from vllm.compilation.backends import VllmBackend
10 from vllm.config import (LoadConfig, ModelConfig, PoolerConfig, VllmConfig,
11 config, get_field)
12 from vllm.model_executor.layers.pooler import PoolingType
@@ -44,6 +45,18 @@ def test_config(test_config, expected_error):
45 config(test_config)
46
47
48 +def test_compile_config_repr_succeeds():
49 + # setup: VllmBackend mutates the config object
50 + config = VllmConfig()
51 + backend = VllmBackend(config)
52 + backend.configure_post_pass()
53 +
54 + # test that repr(config) succeeds
55 + val = repr(config)
56 + assert 'VllmConfig' in val
57 + assert 'inductor_passes' in val
58 +
59 +
60 def test_get_field():
61
62 @dataclass
vllm/config.py
+20 -15
@@ -648,7 +648,7 @@ class ModelConfig:
648 def maybe_pull_model_tokenizer_for_s3(self, model: str,
649 tokenizer: str) -> None:
650 """Pull model/tokenizer from S3 to temporary directory when needed.
651 -
651 +
652 Args:
653 model: Model name or path
654 tokenizer: Tokenizer name or path
@@ -1370,9 +1370,9 @@ class ModelConfig:
1370 def is_encoder_decoder(self) -> bool:
1371 """Extract the HF encoder/decoder model flag."""
1372 """
1373 - For Mllama, VLLM overrides HF's is_encoder_decoder flag and sets it to
1373 + For Mllama, VLLM overrides HF's is_encoder_decoder flag and sets it to
1374 True to enable cross-attention
1375 - Neuron needs all multimodal data to be in the decoder and does not
1375 + Neuron needs all multimodal data to be in the decoder and does not
1376 need to explicitly enable cross-attention
1377 """
1378 if (current_platform.is_neuron()
@@ -1794,7 +1794,7 @@ class ParallelConfig:
1794 """Global rank in distributed setup."""
1795
1796 enable_multimodal_encoder_data_parallel: bool = False
1797 - """ Use data parallelism instead of tensor parallelism for vision encoder.
1797 + """ Use data parallelism instead of tensor parallelism for vision encoder.
1798 Only support LLama4 for now"""
1799
1800 @property
@@ -2272,9 +2272,9 @@ class DeviceConfig:
2272
2273 device: SkipValidation[Union[Device, torch.device]] = "auto"
2274 """Device type for vLLM execution.
2275 - This parameter is deprecated and will be
2276 - removed in a future release.
2277 - It will now be set automatically based
2275 + This parameter is deprecated and will be
2276 + removed in a future release.
2277 + It will now be set automatically based
2278 on the current platform."""
2279 device_type: str = field(init=False)
2280 """Device type from the current platform. This is set in
@@ -4007,19 +4007,24 @@ class CompilationConfig:
4007
4008 def __repr__(self) -> str:
4009 exclude = {
4010 - "static_forward_context",
4011 - "enabled_custom_ops",
4012 - "disabled_custom_ops",
4013 - "compilation_time",
4014 - "bs_to_padded_graph_size",
4015 - "pass_config",
4016 - "traced_files",
4010 + "static_forward_context": True,
4011 + "enabled_custom_ops": True,
4012 + "disabled_custom_ops": True,
4013 + "compilation_time": True,
4014 + "bs_to_padded_graph_size": True,
4015 + "pass_config": True,
4016 + "traced_files": True,
4017 + "inductor_compile_config": {
4018 + "post_grad_custom_post_pass": True,
4019 + },
4020 }
4021 # The cast to string is necessary because Pydantic is mocked in docs
4022 # builds and sphinx-argparse doesn't know the return type of decode()
4023 return str(
4024 TypeAdapter(CompilationConfig).dump_json(
4022 - self, exclude=exclude, exclude_unset=True).decode())
4025 + self,
4026 + exclude=exclude, # type: ignore[arg-type]
4027 + exclude_unset=True).decode())
4028
4029 __str__ = __repr__
4030