Skip to content

PTQ-Level Efficiency, QAT-Level Accuracy | 训练后量化的效率,量化感知训练的精度

support INC API (#255)

WeiweiZhang111b99d29d1af
diff --git a/auto_round/export/export_to_autoround/export.py b/auto_round/export/export_to_autoround/export.py
index fd185028a..f5fc540a7 100644
--- a/auto_round/export/export_to_autoround/export.py
+++ b/auto_round/export/export_to_autoround/export.py
@@ -278,6 +278,8 @@ def save_quantized_as_autoround(output_dir, inplace=True, backend="auto_round:ex
if hasattr(model, "config"):
model.config.quantization_config = quantization_config
+ if output_dir is None:
+ return model
tokenizer = kwargs["tokenizer"]
if tokenizer is not None:
tokenizer.save_pretrained(output_dir)
diff --git a/auto_round/export/export_to_awq/export.py b/auto_round/export/export_to_awq/export.py
index 8ae65bca3..00de4a5c9 100644
--- a/auto_round/export/export_to_awq/export.py
+++ b/auto_round/export/export_to_awq/export.py
@@ -112,7 +112,8 @@ def save_quantized_as_autoawq(output_dir, inplace=True, **kwargs):
quant_config["bits"] = bits
quant_config["group_size"] = group_size
quant_config["zero_point"] = not sym
-
+ if output_dir is None:
+ return compressed_model
save_quantized(compressed_model, save_dir=output_dir, quant_config=quant_config)
return compressed_model