PTQ-Level Efficiency, QAT-Level Accuracy | 训练后量化的效率,量化感知训练的精度
add acc data
wenhuach21d11d6a8e77a4
diff --git a/README.md b/README.mdindex 3b73b5331..b1298aa3a 100644--- a/README.md+++ b/README.md@@ -40,8 +40,8 @@ model = AutoModelForCausalLM.from_pretrained(model_name, low_cpu_mem_usage=True, torch_dtype="auto", trust_remote_code=True)tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)-autoround = round(model, tokenizer, num_bits=4, group_size=128, scheme="asym")-fake_qdq_model = autoround.quantize()+autoround = AutoRound(model, tokenizer, num_bits=4, group_size=128, scheme="asym")+fake_qdq_model,weight_config = autoround.quantize() ##scale,zp info are saved in weight config dict## export to gpu# packed_folder = "./tmp_autoround_packed"@@ -104,28 +104,29 @@ Consider increasing tuning steps and adjusting the learning rate based on a scal## Known Issues-Auto Rounding may encounter random issues with Qwen models.+CPU kernel will be supported soon++Random issues in tuning Qwen models. ChatGlm-V1 is not supported+-ChatGlm-V1 is not supported-We are working on exporting the quantized model to HF format-Cpu kernel will be supported soon## Validated Models-[//]: # ()-[//]: # (| W4G128 | MMLU | Lamb. | Hella. | Wino. | Piqa | Truth. | Open. | Boolq | RTE | ARC-e | ARC-c. | AVG. |)-[//]: # (|-----------------------------|------|-------|--------|-------|------|--------|-------|-------|-----|-------|--------|------|)-[//]: # (| | | | | | | | | | | | | |)+| W4G128 | MMLU | Lamb. | Hella. | Wino. | Piqa | Truth. | Open. | Boolq | RTE | ARC-e | ARC-c. | AVG. |+|-------------------------------------------------|-------|-------|--------|-------|-------|--------|-------|-------|-------|-------|--------|-------|+| mistralai/Mixtral-8x7B-v0.1 FP16 | 69.83 | 78.44 | 64.89 | 76.40 | 82.43 | 34.15 | 35.40 | 84.98 | 71.12 | 84.22 | 56.91 | 67.16 |+| mistralai/Mixtral-8x7B-v0.1 Signround+ | 68.90 | 78.11 | 64.31 | 74.27 | 82.10 | 30.97 | 34.20 | 84.57 | 67.87 | 83.96 | 56.57 | 65.98 |+| mistralai/Mixtral-8x7B-v0.1 Signround+ iter800 | 68.84 | 77.99 | 64.18 | 75.30 | 81.82 | 31.21 | 35.80 | 85.41 | 68.95 | 83.75 | 55.38 | 66.24 |+| microsoft/phi-2 | 56.40 | 62.78 | 55.83 | 75.77 | 78.67 | 31.21 | 40.40 | 83.36 | 62.45 | 80.05 | 52.90 | 61.80 |+| microsoft/phi-2 Signround+ | 54.57 | 61.32 | 55.04 | 76.48 | 78.89 | 29.74 | 40.60 | 83.24 | 66.43 | 79.76 | 52.30 | 61.67 |+-[//]: # (| mistralai/Mixtral-8x7B-v0.1 | | | | | | | | | | | | |)-[//]: # (|-----------------------------|------|-------|--------|-------|------|--------|-------|-------|-----|-------|--------|------|)-[//]: # (| microsoft/phi-2 | | | | | | | | | | | | |)For a fair comparison, we utilized 512 samples from Pile-10k for all methods during calibration. Due to memory constraints, we maintained the original sequence length of 512 for AWQ, while for GPTQ and our approach, a sequence length of 2048 is used. We have enalbed act-order and true-seqential in GPTQ, and the notation GPTQ* indicates that we adjusted the random seed or data preprocessing to address issues related to the non-positive definite Hessian matrix or other issues.diff --git a/auto_round/autoround.py b/auto_round/autoround.pyindex 4e95388da..05fd2da2b 100644--- a/auto_round/autoround.py+++ b/auto_round/autoround.py@@ -23,6 +23,7 @@ fh_formatter = logging.Formatter('%(asctime)s %(levelname)s %(filename)s L%(line"%Y-%m-%d %H:%M:%S")fh.setFormatter(fh_formatter)logger.addHandler(fh)+import copyimport timefrom collections import UserDict