File tree 2 files changed +5
-1
lines changed
2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change 18
18
"model.decoder.layers" ,
19
19
"gpt_neox.layers" ,
20
20
"model.layers" ,
21
+ # modules loaded by AutoModel vs AutoModelForCausalLM have different prefixes
22
+ "h" ,
23
+ "decoder.layers" ,
24
+ "layers" ,
21
25
]
22
26
23
27
GPTQ_CONFIG = "quantize_config.json"
Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ def get_block_name_with_pattern(model: nn.Module):
72
72
modules_names = [n for n , _ in model .named_modules ()]
73
73
for pattern_candidate in BLOCK_PATTERNS :
74
74
pattern_candidate = pattern_candidate
75
- if any (pattern_candidate in name for name in modules_names ):
75
+ if any (name . startswith ( pattern_candidate ) for name in modules_names ):
76
76
return pattern_candidate
77
77
raise ValueError ("Block pattern could not be match. Pass `block_name_to_quantize` argument in `quantize_model`" )
78
78
You can’t perform that action at this time.
0 commit comments