[EPD][Model Loader] Skip language-model checkpoint shards for --mm-encoder-only (#58086)

Signed-off-by: grYe99 <guorongye99@gmail.com>
Co-authored-by: grYe99 <guorongye99@gmail.com>
Co-authored-by: Cursor Agent <cursoragent@cursor.com>
This commit is contained in:
GuorongYe
2026-09-24 00:41:15 -07:00
committed by GitHub
co-authored by grYe99 Cursor Agent
parent c3f5270270
commit 1291bdb85e
5 changed files with 483 additions and 14 deletions
+6 -2
View File
@@ -78,11 +78,15 @@ class WeightsMapper:
orig_to_new_suffix={**self.orig_to_new_suffix, **other.orig_to_new_suffix},
)
def _map_name(self, key: str) -> str | None:
"""Map a weight name (backward-compatible wrapper that discards shard_id)."""
def map_name(self, key: str) -> str | None:
"""Map a weight name; returns ``None`` if the weight should be ignored."""
result = self._map_name_with_shard(key)
return result[0] if result is not None else None
def _map_name(self, key: str) -> str | None:
"""Backward-compatible alias for :meth:`map_name`."""
return self.map_name(key)
def _map_name_with_shard(self, key: str) -> tuple[str, ShardIds | None] | None:
"""Map a weight name and extract any shard_id metadata.