A high-throughput and memory-efficient inference and serving engine for LLMs
[CI Bug] Fix `ValueError: There is no module or parameter named 'model.vision_tower.vision_model'` (#45478)
Signed-off-by: yewentao256 <zhyanwentao@126.com>
Wentao Ye committed
Jun 13, 2026 at 05:38 UTC
96fa5cdd9e7a6be0148718ee594da9f33d3edef0
2 files changed
+10
-6
vllm/model_executor/models/transformers/base.py
+2
-6
@@ -303,17 +303,13 @@ class Base(
303
- Any quantization config specific mappings
304
"""
305
self.hf_to_vllm_mapper = WeightsMapper()
306
+ orig_to_new_renamings = self.hf_to_vllm_mapper.orig_to_new_renamings
307
orig_to_new_regex = self.hf_to_vllm_mapper.orig_to_new_regex
308
309
for mapping in get_model_conversion_mapping(self.model):
310
# Handle weights which have been renamed in Transformers
311
if isinstance(mapping, WeightRenaming):
311
- # Recompile using regex (Transformers used re)
312
- compiled_sources = re.compile(
313
- mapping.compiled_sources.pattern, mapping.compiled_sources.flags
314
- )
315
- target_pattern = mapping.target_patterns[0]
316
- orig_to_new_regex[compiled_sources] = target_pattern
312
+ orig_to_new_renamings.append(mapping)
313
# TODO: Handle WeightConverter to enable layer merging
314
315
# Handle unexpected weights which should be ignored
vllm/model_executor/models/utils.py
+8
@@ -44,6 +44,7 @@ class WeightsMapper:
44
45
If a key maps to a value of `None`, the corresponding weight is ignored."""
46
47
+ orig_to_new_renamings: list[Any] = field(default_factory=list)
48
orig_to_new_regex: Mapping[re.Pattern, str | None] = field(default_factory=dict)
49
orig_to_new_substr: Mapping[str, str | None] = field(default_factory=dict)
50
orig_to_new_prefix: Mapping[str, str | None] = field(default_factory=dict)
@@ -52,6 +53,10 @@ class WeightsMapper:
53
def __or__(self, other: "WeightsMapper") -> "WeightsMapper":
54
"""Combine two `WeightsMapper`s by merging their mappings."""
55
return WeightsMapper(
56
+ orig_to_new_renamings=[
57
+ *self.orig_to_new_renamings,
58
+ *other.orig_to_new_renamings,
59
+ ],
60
orig_to_new_regex={**self.orig_to_new_regex, **other.orig_to_new_regex},
61
orig_to_new_substr={**self.orig_to_new_substr, **other.orig_to_new_substr},
62
orig_to_new_prefix={**self.orig_to_new_prefix, **other.orig_to_new_prefix},
@@ -59,6 +64,9 @@ class WeightsMapper:
64
)
65
66
def _map_name(self, key: str) -> str | None:
67
+ for renaming in self.orig_to_new_renamings:
68
+ key, _ = renaming.rename_source_key(key)
69
+
70
for pattern, new_key in self.orig_to_new_regex.items():
71
if pattern.search(key):
72
if new_key is None: