Skip to content

Commit 2858830

Browse files
[Bugfix] Prioritize dtype in root config before checking text config (#17629)
Signed-off-by: DarkLight1337 <[email protected]>
1 parent d6484ef commit 2858830

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

vllm/config.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2954,10 +2954,12 @@ def _get_and_verify_dtype(
29542954
) -> torch.dtype:
29552955
# NOTE: getattr(config, "torch_dtype", torch.float32) is not correct
29562956
# because config.torch_dtype can be None.
2957-
config_dtype = getattr(config.get_text_config(), "torch_dtype", None)
2957+
config_dtype = getattr(config, "torch_dtype", None)
29582958

2959-
# Fallback for multi-modal models if the root config
2959+
# Fallbacks for multi-modal models if the root config
29602960
# does not define torch_dtype
2961+
if config_dtype is None:
2962+
config_dtype = getattr(config.get_text_config(), "torch_dtype", None)
29612963
if config_dtype is None and hasattr(config, "vision_config"):
29622964
config_dtype = getattr(config.vision_config, "torch_dtype", None)
29632965

0 commit comments

Comments
 (0)