[Bugfix][Config] Keep pydantic validation for fields with a TYPE_CHECKING Literal alias (#46220)

Signed-off-by: Ting Sun <suntcrick@gmail.com>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
This commit is contained in:
Ting SUN
2026-06-24 12:25:50 +00:00
committed by GitHub
co-authored by mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent 160c80a34c
commit f1a6703edd
3 changed files with 6 additions and 4 deletions
+3 -1
View File
@@ -14,8 +14,10 @@ DEFAULT_SAFETENSORS_PREFETCH_BLOCK_SIZE = 16 * 1024 * 1024
SafetensorsLoadStrategy: TypeAlias = Literal["lazy", "eager", "prefetch", "torchao"]
if TYPE_CHECKING:
from vllm.model_executor.model_loader import LoadFormats
from vllm.model_executor.model_loader.tensorizer import TensorizerConfig
else:
LoadFormats = str
TensorizerConfig = Any
logger = init_logger(__name__)
@@ -25,7 +27,7 @@ logger = init_logger(__name__)
class LoadConfig:
"""Configuration for loading the model weights."""
load_format: str = "auto"
load_format: str | LoadFormats = "auto"
"""
The format of the model weights to load.
+1 -1
View File
@@ -69,7 +69,7 @@ else:
me_models = LazyLoader("model_executor", globals(), "vllm.model_executor.models")
LoadConfig = Any
ParallelConfig = Any
QuantizationMethods = Any
QuantizationMethods = str
LogitsProcessor = Any
logger = init_logger(__name__)
+2 -2
View File
@@ -127,8 +127,8 @@ if TYPE_CHECKING:
from vllm.v1.executor import Executor
else:
Executor = Any
QuantizationMethods = Any
LoadFormats = Any
QuantizationMethods = str
LoadFormats = str
UsageContext = Any