sys-lpot-val
commited on
Commit
•
ee9e320
1
Parent(s):
3969fc0
upload autogptq format
Browse files- .gitattributes +8 -0
- README.md +145 -3
- added_tokens.json +3 -0
- config.json +3 -0
- generation_config.json +3 -0
- merges.txt +0 -0
- model.safetensors +3 -0
- quantization_config.json +3 -0
- special_tokens_map.json +3 -0
- tokenizer.json +3 -0
- tokenizer_config.json +3 -0
- vocab.json +3 -0
.gitattributes
CHANGED
@@ -33,3 +33,11 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
+
vocab.json filter=lfs diff=lfs merge=lfs -text
|
37 |
+
added_tokens.json filter=lfs diff=lfs merge=lfs -text
|
38 |
+
config.json filter=lfs diff=lfs merge=lfs -text
|
39 |
+
generation_config.json filter=lfs diff=lfs merge=lfs -text
|
40 |
+
quantization_config.json filter=lfs diff=lfs merge=lfs -text
|
41 |
+
special_tokens_map.json filter=lfs diff=lfs merge=lfs -text
|
42 |
+
tokenizer_config.json filter=lfs diff=lfs merge=lfs -text
|
43 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
@@ -1,3 +1,145 @@
|
|
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-7B) 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 = "OPEA/Qwen2-7B-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年9月8日由马云在杭州创立的,阿里巴巴集团主要经营业务包括:淘宝网、天猫、聚划算、全球速卖通、阿里巴巴国际交易市场、1688、阿里
|
37 |
+
##"88+99等于多少? 88+99=187 \n 计算: (1) 1 2 + 1 3 + 1 4 + 1 5 + 1 6 + 1 7 + 1 8"
|
38 |
+
##Once upon a time, there was a little girl named Emily who loved to read books. She would spend hours lost in the pages of her favorite stories, imagining herself in the worlds she read about. One day, Emily stumbled upon a book called "The Enchanted Forest
|
39 |
+
##There is a girl who likes adventure, and she is always looking for new experiences. She is a bit of a thrill-seeker, and she loves to push herself to the limit. She is also a bit of a free spirit, and she loves to explore new places and try new things
|
40 |
+
```
|
41 |
+
|
42 |
+
### Intel Gaudi-2 INT4 Inference
|
43 |
+
docker image with Gaudi Software Stack is recommended. More details can be found in [Gaudi Guide](https://docs.habana.ai/en/latest/).
|
44 |
+
```python
|
45 |
+
import habana_frameworks.torch.core as htcore
|
46 |
+
import habana_frameworks.torch.hpu as hthpu
|
47 |
+
|
48 |
+
from auto_round.auto_quantizer import AutoHfQuantizer
|
49 |
+
|
50 |
+
from transformers import AutoModelForCausalLM,AutoTokenizer
|
51 |
+
quantized_model_dir = "Intel/Qwen2-7B-int4-inc"
|
52 |
+
tokenizer = AutoTokenizer.from_pretrained(quantized_model_dir)
|
53 |
+
model = AutoModelForCausalLM.from_pretrained(quantized_model_dir).to('hpu').to(bfloat16)
|
54 |
+
text = "下面我来介绍一下阿里巴巴公司,"
|
55 |
+
text = "9.8和9.11哪个大?"
|
56 |
+
text = "Once upon a time,"
|
57 |
+
text = "There is a girl who likes adventure,"
|
58 |
+
inputs = tokenizer(text, return_tensors="pt").to(model.device)
|
59 |
+
print(tokenizer.decode(model.generate(**inputs, max_new_tokens=50, do_sample=False)[0]))
|
60 |
+
##下面我来介绍一下阿里巴巴公司,阿里巴巴公司是1999年9月8日由马云在杭州创立的,阿里巴巴集团主要经营业务包括:淘宝网、天猫、聚划算、全球速卖通、阿里巴巴国际交易市场、1688、阿里
|
61 |
+
##9.8和9.11哪个大? 9.8和9.11哪个大? 解:9.8>9.11; 答:9.8大. 阅读下面的文字,完成下列各题。 ①“中国式现代化”是习近平
|
62 |
+
##Once upon a time, there was a little girl named Emily who loved to read books. She would spend hours lost in the pages of her favorite stories, imagining herself in the worlds she read about. One day, Emily stumbled upon a book called "The Enchanted Forest
|
63 |
+
##There is a girl who likes adventure, and she is always looking for new experiences. She is a bit of a thrill-seeker, and she loves to push herself to the limit. She is also a bit of a free spirit, and she loves to explore new places and try new things
|
64 |
+
```
|
65 |
+
|
66 |
+
### Evaluate the model
|
67 |
+
|
68 |
+
pip3 install lm-eval==0.4.2
|
69 |
+
|
70 |
+
```bash
|
71 |
+
git clone https://github.com/intel/auto-round
|
72 |
+
cd auto-round/examples/language-modeling
|
73 |
+
python3 eval_042/evluation.py --model_name "OPEA/Qwen2-7B-int4-inc" --eval_bs 16 --tasks lambada_openai,hellaswag,piqa,winogrande,truthfulqa_mc1,openbookqa,boolq,arc_easy,arc_challenge,mmlu,gsm8k,cmmlu,ceval-valid
|
74 |
+
```
|
75 |
+
|
76 |
+
| Metric | BF16 | INT4 |
|
77 |
+
| -------------- | ------ | ------ |
|
78 |
+
| Avg | 0.6655 | 0.6624 |
|
79 |
+
| mmlu | 0.6706 | 0.6650 |
|
80 |
+
| cmmlu | 0.8310 | 0.8151 |
|
81 |
+
| ceval-valid | 0.8232 | 0.8053 |
|
82 |
+
| lambada_openai | 0.7182 | 0.7254 |
|
83 |
+
| hellaswag | 0.5823 | 0.5758 |
|
84 |
+
| winogrande | 0.7222 | 0.7174 |
|
85 |
+
| piqa | 0.7911 | 0.7905 |
|
86 |
+
| truthfulqa_mc1 | 0.3647 | 0.3599 |
|
87 |
+
| openbookqa | 0.3520 | 0.3420 |
|
88 |
+
| boolq | 0.8183 | 0.8168 |
|
89 |
+
| arc_easy | 0.7660 | 0.7643 |
|
90 |
+
| arc_challenge | 0.4505 | 0.4625 |
|
91 |
+
| gsm8k 5 shots | 0.7619 | 0.7710 |
|
92 |
+
|
93 |
+
|
94 |
+
|
95 |
+
|
96 |
+
|
97 |
+
### Reproduce the model
|
98 |
+
|
99 |
+
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.
|
100 |
+
|
101 |
+
```bash
|
102 |
+
git clone https://github.com/intel/auto-round
|
103 |
+
cd auto-round/examples/language-modeling
|
104 |
+
pip install -r requirements.txt
|
105 |
+
python3 main.py \
|
106 |
+
--model_name Qwen/Qwen2-7B \
|
107 |
+
--device 0 \
|
108 |
+
--group_size 128 \
|
109 |
+
--nsamples 512 \
|
110 |
+
--bits 4 \
|
111 |
+
--iter 1000 \
|
112 |
+
--disable_eval \
|
113 |
+
--model_dtype "float16" \
|
114 |
+
--deployment_device 'auto_round' \
|
115 |
+
--output_dir "./tmp_autoround"
|
116 |
+
```
|
117 |
+
|
118 |
+
|
119 |
+
|
120 |
+
## Ethical Considerations and Limitations
|
121 |
+
|
122 |
+
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.
|
123 |
+
|
124 |
+
Therefore, before deploying any applications of the model, developers should perform safety testing.
|
125 |
+
|
126 |
+
## Caveats and Recommendations
|
127 |
+
|
128 |
+
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model.
|
129 |
+
|
130 |
+
Here are a couple of useful links to learn more about Intel's AI software:
|
131 |
+
|
132 |
+
* Intel Neural Compressor [link](https://github.com/intel/neural-compressor)
|
133 |
+
* Intel Extension for Transformers [link](https://github.com/intel/intel-extension-for-transformers)
|
134 |
+
|
135 |
+
## Disclaimer
|
136 |
+
|
137 |
+
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.
|
138 |
+
|
139 |
+
|
140 |
+
|
141 |
+
## Cite
|
142 |
+
|
143 |
+
@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} }
|
144 |
+
|
145 |
+
[arxiv](https://arxiv.org/abs/2309.05516) [github](https://github.com/intel/auto-round)
|
added_tokens.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6a475432c61f8d6154d10d28c37671a36e5717daf3d15002a988968fee54a500
|
3 |
+
size 80
|
config.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7193fd4a3dc7f11dbc0a33553d20189c75afb77ed5d4821f1deb02548f17c9f0
|
3 |
+
size 1332
|
generation_config.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1da841bfb122715961bd07547f3374f0c0b77285c361ba96fef2060525e92f65
|
3 |
+
size 117
|
merges.txt
ADDED
The diff for this file is too large to render.
See raw diff
|
|
model.safetensors
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:1e862995baefeb5e7281c07fa1011889b579e73bd2d9804faa30034845c1ac70
|
3 |
+
size 5573365008
|
quantization_config.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:0df196524a2e6590d35777715a51ddd57937bbe1ec7211c3e69e4c0d401ddba1
|
3 |
+
size 505
|
special_tokens_map.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:daf48284de8f4779b1dbf20963a68180002fba2a34a5da72292380c5d9fb6af2
|
3 |
+
size 370
|
tokenizer.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a12e3ba5d5e0ad173cf7b408ab8534c6be8cbc6a146714e9c7dc8cf2346603b1
|
3 |
+
size 7028043
|
tokenizer_config.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:4e62068fb28973242bbf2f9b3ff52400ceb4dead2c61f9a29d2119413363f2b9
|
3 |
+
size 1303
|
vocab.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ca10d7e9fb3ed18575dd1e277a2579c16d108e32f27439684afa0e10b1440910
|
3 |
+
size 2776833
|