[CI Bug] Fix ValueError: There is no module or parameter named 'model.vision_tower.vision_model' (#45478)

Signed-off-by: yewentao256 <zhyanwentao@126.com>
This commit is contained in:
Wentao Ye
2026-06-13 02:38:37 -07:00
committed by GitHub
parent 9261dbbc55
commit 96fa5cdd9e
2 changed files with 10 additions and 6 deletions
+8
View File
@@ -44,6 +44,7 @@ class WeightsMapper:
If a key maps to a value of `None`, the corresponding weight is ignored."""
orig_to_new_renamings: list[Any] = field(default_factory=list)
orig_to_new_regex: Mapping[re.Pattern, str | None] = field(default_factory=dict)
orig_to_new_substr: Mapping[str, str | None] = field(default_factory=dict)
orig_to_new_prefix: Mapping[str, str | None] = field(default_factory=dict)
@@ -52,6 +53,10 @@ class WeightsMapper:
def __or__(self, other: "WeightsMapper") -> "WeightsMapper":
"""Combine two `WeightsMapper`s by merging their mappings."""
return WeightsMapper(
orig_to_new_renamings=[
*self.orig_to_new_renamings,
*other.orig_to_new_renamings,
],
orig_to_new_regex={**self.orig_to_new_regex, **other.orig_to_new_regex},
orig_to_new_substr={**self.orig_to_new_substr, **other.orig_to_new_substr},
orig_to_new_prefix={**self.orig_to_new_prefix, **other.orig_to_new_prefix},
@@ -59,6 +64,9 @@ class WeightsMapper:
)
def _map_name(self, key: str) -> str | None:
for renaming in self.orig_to_new_renamings:
key, _ = renaming.rename_source_key(key)
for pattern, new_key in self.orig_to_new_regex.items():
if pattern.search(key):
if new_key is None: