Update README.md
Browse files
README.md
CHANGED
@@ -1,3 +1,122 @@
|
|
1 |
-
---
|
2 |
-
license: apache-2.0
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
datasets:
|
4 |
+
- NeelNanda/pile-10k
|
5 |
+
---
|
6 |
+
|
7 |
+
---
|
8 |
+
license: apache-2.0
|
9 |
+
datasets:
|
10 |
+
- NeelNanda/pile-10k
|
11 |
+
|
12 |
+
## Model Details
|
13 |
+
|
14 |
+
This model is an int4 model with group_size 128 with quantized lm-head of [Qwen/Qwen2-7B](https://huggingface.co/Qwen/Qwen2.5-1.5B-Instruct) generated by [intel/auto-round](https://github.com/intel/auto-round), auto-round is needed to run this model
|
15 |
+
|
16 |
+
## How To Use
|
17 |
+
|
18 |
+
### INT4 Inference
|
19 |
+
|
20 |
+
|
21 |
+
|
22 |
+
```python
|
23 |
+
##git clone https://github.com/intel/auto-round.git
|
24 |
+
##cd auto-round && pip install -vvv --no-build-isolation -e .
|
25 |
+
from auto_round.auto_quantizer import AutoHfQuantizer
|
26 |
+
from transformers import AutoModelForCausalLM,AutoTokenizer
|
27 |
+
quantized_model_dir = "Intel/Qwen2.5-1.5B-Instruct-int4-inc"
|
28 |
+
tokenizer = AutoTokenizer.from_pretrained(quantized_model_dir)
|
29 |
+
model = AutoModelForCausalLM.from_pretrained(quantized_model_dir, device_map="auto")
|
30 |
+
text = "下面我来介绍一下阿里巴巴公司,"
|
31 |
+
text = "88+99等于多少?"
|
32 |
+
text = "Once upon a time,"
|
33 |
+
text = "There is a girl who likes adventure,"
|
34 |
+
inputs = tokenizer(text, return_tensors="pt").to(model.device)
|
35 |
+
print(tokenizer.decode(model.generate(**inputs, max_new_tokens=50, do_sample=False)[0]))
|
36 |
+
##下面我来介绍一下阿里巴巴公司,阿里巴巴集团是一家全球领先的电子商务和数字技术公司。它成立于1999年,总部位于中国杭州,并在全球拥有超过20个办公室和超过3万名员工。阿里巴巴集团的业务包括在线零售、云计算、金融服务、物流
|
37 |
+
##88+99等于多少?!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
38 |
+
##Once upon a time, there was a young girl named Lily who loved to explore the world around her. She would often wander through fields and forests, looking for new places to visit and things to discover.One day, while she was wandering in a nearby forest, she stumbled
|
39 |
+
##There is a girl who likes adventure, and she has been exploring the world for many years. She has visited every country in Europe, climbed mountains all over the world, and even sailed across oceans on her own. However, she still feels that there are more places to explore.One day
|
40 |
+
```
|
41 |
+
|
42 |
+
### Evaluate the model
|
43 |
+
|
44 |
+
pip3 install lm-eval==0.4.2
|
45 |
+
|
46 |
+
```bash
|
47 |
+
git clone https://github.com/intel/auto-round
|
48 |
+
cd auto-round/examples/language-modeling
|
49 |
+
python3 eval_042/evluation.py --model_name "Intel/Qwen2.5-1.5B-Instruct-int4-inc" --eval_bs 16 --tasks lambada_openai,hellaswag,piqa,winogrande,truthfulqa_mc1,truthfulqa_mc2,openbookqa,boolq,arc_easy,arc_challenge,mmlu,gsm8k,cmmlu,ceval-valid
|
50 |
+
```
|
51 |
+
|
52 |
+
| Metric | BF16 | INT4 |
|
53 |
+
| -------------- | ------ | ------ |
|
54 |
+
| Avg | 0.5575 | 0.5618 |
|
55 |
+
| mmlu | 0.6010 | 0.5924 |
|
56 |
+
| cmmlu | 0.6497 | 0.6259 |
|
57 |
+
| ceval-valid | 0.6597 | 0.6404 |
|
58 |
+
| lambada_openai | 0.6095 | 0.5924 |
|
59 |
+
| hellaswag | 0.5082 | 0.5012 |
|
60 |
+
| winogrande | 0.6298 | 0.6409 |
|
61 |
+
| piqa | 0.7633 | 0.7650 |
|
62 |
+
| truthfulqa_mc1 | 0.3109 | 0.3060 |
|
63 |
+
| truthfulqa_mc2 | 0.4663 | 0.4563 |
|
64 |
+
| openbookqa | 0.3160 | 0.3020 |
|
65 |
+
| boolq | 0.7789 | 0.7709 |
|
66 |
+
| arc_easy | 0.7677 | 0.7681 |
|
67 |
+
| arc_challenge | 0.4343 | 0.4360 |
|
68 |
+
| gsm8k 5 shots | 0.3101 | 0.4519 |
|
69 |
+
|
70 |
+
|
71 |
+
|
72 |
+
|
73 |
+
|
74 |
+
### Reproduce the model
|
75 |
+
|
76 |
+
Here is the sample command to reproduce the model. We observed a larger accuracy drop in Chinese tasks and recommend using a high-quality Chinese dataset for calibration. However, we did not achieve better accuracy with some public datasets.
|
77 |
+
|
78 |
+
```bash
|
79 |
+
git clone https://github.com/intel/auto-round
|
80 |
+
cd auto-round/examples/language-modeling
|
81 |
+
pip install -r requirements.txt
|
82 |
+
python3 main.py \
|
83 |
+
--model_name Qwen/Qwen2.5-1.5B-Instruct \
|
84 |
+
--device 0 \
|
85 |
+
--group_size 32 \
|
86 |
+
--nsamples 512 \
|
87 |
+
--bits 4 \
|
88 |
+
--iter 1000 \
|
89 |
+
--disable_eval \
|
90 |
+
--model_dtype "float16" \
|
91 |
+
--deployment_device 'auto_round' \
|
92 |
+
--output_dir "./tmp_autoround"
|
93 |
+
```
|
94 |
+
|
95 |
+
|
96 |
+
|
97 |
+
## Ethical Considerations and Limitations
|
98 |
+
|
99 |
+
The model can produce factually incorrect output, and should not be relied on to produce factually accurate information. Because of the limitations of the pretrained model and the finetuning datasets, it is possible that this model could generate lewd, biased or otherwise offensive outputs.
|
100 |
+
|
101 |
+
Therefore, before deploying any applications of the model, developers should perform safety testing.
|
102 |
+
|
103 |
+
## Caveats and Recommendations
|
104 |
+
|
105 |
+
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model.
|
106 |
+
|
107 |
+
Here are a couple of useful links to learn more about Intel's AI software:
|
108 |
+
|
109 |
+
* Intel Neural Compressor [link](https://github.com/intel/neural-compressor)
|
110 |
+
* Intel Extension for Transformers [link](https://github.com/intel/intel-extension-for-transformers)
|
111 |
+
|
112 |
+
## Disclaimer
|
113 |
+
|
114 |
+
The license on this model does not constitute legal advice. We are not responsible for the actions of third parties who use this model. Please consult an attorney before using this model for commercial purposes.
|
115 |
+
|
116 |
+
|
117 |
+
|
118 |
+
## Cite
|
119 |
+
|
120 |
+
@article{cheng2023optimize, title={Optimize weight rounding via signed gradient descent for the quantization of llms}, author={Cheng, Wenhua and Zhang, Weiwei and Shen, Haihao and Cai, Yiyang and He, Xin and Lv, Kaokao and Liu, Yi}, journal={arXiv preprint arXiv:2309.05516}, year={2023} }
|
121 |
+
|
122 |
+
[arxiv](https://arxiv.org/abs/2309.05516) [github](https://github.com/intel/auto-round)
|