Skip to content

Commit 3f562b8

Browse files
committed
feat: support auto-round for llm
- support llm with quantization method == "auto-round" Change-Id: Ia5aff85769162a8264cd8b4bbcf5e3bb9a769699
1 parent 007c0be commit 3f562b8

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

python/llm/LlmConverter.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,8 @@ def init_config(self):
344344
def init_quantization(self):
345345
c = self.model_info.config
346346
self.quantization_config = getattr(self.llm_config, c.quantization_config, None)
347+
if self.quantization_config is None:
348+
self.quantization_config = getattr(self.config, c.quantization_config, None)
347349
if self.quantization_config:
348350
self.quant_mode = self.quantization_config["quant_method"]
349351
self.q_group_size = self.quantization_config["group_size"]
@@ -355,6 +357,15 @@ def init_quantization(self):
355357
if self.quantize != "w4f16":
356358
print("Warning: AWQ only support w4f16 quantize, change quantize to w4f16")
357359
self.quantize = "w4f16"
360+
if self.quant_mode == "auto-round":
361+
packing_format = self.quantization_config.get("packing_format",
362+
"auto_round:auto_gptq")
363+
if packing_format == "auto_round:auto_gptq":
364+
self.quant_mode = "gptq"
365+
elif packing_format == "auto_round:auto_awq":
366+
self.quant_mode = "awq"
367+
else:
368+
raise NotImplementedError(f"Not support packing_format: {packing_format}")
358369

359370
if self.q_group_size < 0:
360371
self.q_group_size = 0

0 commit comments

Comments
 (0)