Fix GPTQ model loading in Transformers backend (#25770)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Co-authored-by: Isotr0py <mozf@mail2.sysu.edu.cn>
This commit is contained in:
@@ -109,6 +109,7 @@ class AutoWeightsLoader:
|
||||
skip_prefixes: Optional[list[str]] = None,
|
||||
skip_substrs: Optional[list[str]] = None,
|
||||
ignore_unexpected_prefixes: Optional[list[str]] = None,
|
||||
ignore_unexpected_suffixes: Optional[list[str]] = None,
|
||||
) -> None:
|
||||
super().__init__()
|
||||
|
||||
@@ -116,6 +117,7 @@ class AutoWeightsLoader:
|
||||
self.skip_prefixes = skip_prefixes or []
|
||||
self.skip_substrs = skip_substrs or []
|
||||
self.ignore_unexpected_prefixes = ignore_unexpected_prefixes or []
|
||||
self.ignore_unexpected_suffixes = ignore_unexpected_suffixes or []
|
||||
# update default skip_substrs
|
||||
self.skip_substrs += self.ROTARY_EMBEDS_UNUSED_WEIGHTS
|
||||
|
||||
@@ -149,8 +151,9 @@ class AutoWeightsLoader:
|
||||
or any(substr in qualname for substr in self.skip_substrs))
|
||||
|
||||
def _can_ignore_unexpected(self, qualname: str) -> bool:
|
||||
return any(
|
||||
qualname.startswith(p) for p in self.ignore_unexpected_prefixes)
|
||||
iup = (qualname.startswith(p) for p in self.ignore_unexpected_prefixes)
|
||||
ius = (qualname.endswith(s) for s in self.ignore_unexpected_suffixes)
|
||||
return any(iup) or any(ius)
|
||||
|
||||
def _load_param(
|
||||
self,
|
||||
|
||||
Reference in New Issue
Block a user