[Cherry-Pick][Loader]Fix bug in MTP weight loading #5744 (#5746)

* fix mtp

* fix

---------

Co-authored-by: Jiang-Jia-Jun <163579578+Jiang-Jia-Jun@users.noreply.github.com>
This commit is contained in:
bukejiyu
2025-12-25 14:21:23 +08:00
committed by GitHub
parent 47ffaa41b1
commit e627e13808
4 changed files with 23 additions and 46 deletions
+7
View File
@@ -166,6 +166,13 @@ class WeightsMapper:
return self._map_name(weight_name)
def remap_weight_keys(weights_iterator, mapper: dict):
return (
(next((key.replace(k, v) for k, v in mapper.items() if k in key), key), value)
for key, value in weights_iterator
)
def process_weights_before_loading(
*, skip_prefixes: Optional[List[str]] = None, mapper: Optional[WeightsMapper] = None
):