Skip to content

Commit 2539582

Browse files
authored
Fix torch awq (#4503)
* fix glm4.7-flash * fix awq
1 parent 7e451e0 commit 2539582

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

lmdeploy/pytorch/config.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,9 @@ def from_config(cls, hf_config: Any):
631631
if quant_method == 'awq':
632632
bits = quant_config.get('bits', 4)
633633
group_size = quant_config.get('group_size', 128)
634+
if quant_dtype is None:
635+
# awq does not need a quant dtype, this is just a placeholder
636+
quant_dtype = 'bfloat16'
634637
elif quant_method == 'smooth_quant':
635638
if quant_dtype is None:
636639
quant_dtype = 'int8'

lmdeploy/pytorch/models/utils/model.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ def update_quant_config(cls, quant_config: QuantizationConfig):
8080
"""Update quant config."""
8181
if quant_config is None:
8282
return
83+
if getattr(quant_config, 'ignored_layers', None) is None:
84+
return quant_config
8385
ignored_layers = [cls.rename_weight(name) for name in quant_config.ignored_layers]
8486

8587
added_ignore_layers = set()

0 commit comments

Comments
 (0)