sys-lpot-val
commited on
Commit
•
98b3137
1
Parent(s):
c92fc0a
upload gptq format
Browse files- .gitattributes +8 -0
- README.md +156 -3
- added_tokens.json +3 -0
- config.json +3 -0
- generation_config.json +3 -0
- merges.txt +0 -0
- model.safetensors +3 -0
- quantize_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 |
+
added_tokens.json filter=lfs diff=lfs merge=lfs -text
|
37 |
+
config.json filter=lfs diff=lfs merge=lfs -text
|
38 |
+
generation_config.json filter=lfs diff=lfs merge=lfs -text
|
39 |
+
quantize_config.json filter=lfs diff=lfs merge=lfs -text
|
40 |
+
special_tokens_map.json filter=lfs diff=lfs merge=lfs -text
|
41 |
+
tokenizer_config.json filter=lfs diff=lfs merge=lfs -text
|
42 |
+
tokenizer.json filter=lfs diff=lfs merge=lfs -text
|
43 |
+
vocab.json filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
@@ -1,3 +1,156 @@
|
|
1 |
-
---
|
2 |
-
license: apache-2.0
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
datasets:
|
4 |
+
- NeelNanda/pile-10k
|
5 |
+
---
|
6 |
+
|
7 |
+
## Model Details
|
8 |
+
|
9 |
+
This model is an int4 model with group_size 128 with quantized lm-head of [Qwen/Qwen2.5-14B-Instruct](https://huggingface.co/Qwen/Qwen2.5-14B-Instruct) generated by [intel/auto-round](https://github.com/intel/auto-round), auto-round is needed to run this model
|
10 |
+
|
11 |
+
## How To Use
|
12 |
+
|
13 |
+
### INT4 Inference
|
14 |
+
|
15 |
+
|
16 |
+
|
17 |
+
```python
|
18 |
+
##git clone https://github.com/intel/auto-round.git
|
19 |
+
##cd auto-round && pip install -vvv --no-build-isolation -e .
|
20 |
+
from auto_round import AutoHfQuantizer ##must import
|
21 |
+
import torch
|
22 |
+
from transformers import AutoModelForCausalLM,AutoTokenizer
|
23 |
+
quantized_model_dir = "OPEA/Qwen2.5-14B-Instruct-int4-inc"
|
24 |
+
tokenizer = AutoTokenizer.from_pretrained(quantized_model_dir)
|
25 |
+
|
26 |
+
model = AutoModelForCausalLM.from_pretrained(
|
27 |
+
quantized_model_dir,
|
28 |
+
torch_dtype='auto',
|
29 |
+
device_map="auto",
|
30 |
+
)
|
31 |
+
|
32 |
+
##import habana_frameworks.torch.core as htcore ## uncommnet it for HPU
|
33 |
+
##import habana_frameworks.torch.hpu as hthpu ## uncommnet it for HPU
|
34 |
+
##model = model.to(torch.bfloat16).to("hpu") ## uncommnet it for HPU
|
35 |
+
|
36 |
+
prompt = "There is a girl who likes adventure,"
|
37 |
+
messages = [
|
38 |
+
{"role": "system", "content": "You are a helpful assistant."},
|
39 |
+
{"role": "user", "content": prompt}
|
40 |
+
]
|
41 |
+
|
42 |
+
text = tokenizer.apply_chat_template(
|
43 |
+
messages,
|
44 |
+
tokenize=False,
|
45 |
+
add_generation_prompt=True
|
46 |
+
)
|
47 |
+
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
|
48 |
+
|
49 |
+
generated_ids = model.generate(
|
50 |
+
model_inputs.input_ids,
|
51 |
+
max_new_tokens=50, ##change this to align with the official usage
|
52 |
+
do_sample=False ##change this to align with the official usage
|
53 |
+
)
|
54 |
+
generated_ids = [
|
55 |
+
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
|
56 |
+
]
|
57 |
+
|
58 |
+
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
59 |
+
print(response)
|
60 |
+
|
61 |
+
##prompt = "There is a girl who likes adventure,"
|
62 |
+
##That's great! Adventure can be a wonderful way to explore the world, challenge oneself, and discover new things. What kind of adventures does she enjoy? Perhaps she likes hiking, traveling to new places, trying new activities, or maybe something else entirely
|
63 |
+
|
64 |
+
##prompt = "Which one is bigger, 9.11 or 9.8"
|
65 |
+
##To determine which number is larger between 9.11 and 9.8, you can compare the digits in each place value:
|
66 |
+
##- The whole number part of both numbers is 9.
|
67 |
+
##- For the decimal part:
|
68 |
+
## - 9
|
69 |
+
|
70 |
+
##prompt = "Once upon a time,"
|
71 |
+
##Once upon a time, in a far-off land, there was a kingdom surrounded by lush green forests, sparkling rivers, and rolling hills. The people of this kingdom lived in harmony with nature and each other, under the wise rule of their king.
|
72 |
+
|
73 |
+
##prompt = "请介绍一下阿里巴巴公司"
|
74 |
+
##阿里巴巴集团创立于1999年,是以贸易作为发展起点,以数据作为核心驱动,并以技术作为基础支撑的公司。阿里巴巴集团业务包括核心电商、云计算、数字媒体及娱乐、创新项目四大板块。阿里巴巴
|
75 |
+
|
76 |
+
```
|
77 |
+
|
78 |
+
### Evaluate the model
|
79 |
+
|
80 |
+
pip3 install lm-eval==0.4.2
|
81 |
+
|
82 |
+
```bash
|
83 |
+
git clone https://github.com/intel/auto-round
|
84 |
+
cd auto-round
|
85 |
+
python -m auto_round --model "OPEA/Qwen2.5-7B-Instruct-int4-inc" --eval --eval_bs 16 --tasks lambada_openai,hellaswag,piqa,winogrande,truthfulqa_mc1,openbookqa,boolq,arc_easy,arc_challenge,mmlu,gsm8k,cmmlu,ceval-valid
|
86 |
+
```
|
87 |
+
|
88 |
+
| Metric | BF16 | INT4 |
|
89 |
+
|:-------------- | :----: | :----: |
|
90 |
+
| Avg | 0.7271 | 0.7221 |
|
91 |
+
| mmlu | 0.7891 | 0.7812 |
|
92 |
+
| cmmlu | 0.8378 | 0.8257 |
|
93 |
+
| ceval-valid | 0.8351 | 0.8276 |
|
94 |
+
| lambada_openai | 0.7343 | 0.7227 |
|
95 |
+
| hellaswag | 0.6562 | 0.6509 |
|
96 |
+
| winogrande | 0.7616 | 0.7585 |
|
97 |
+
| piqa | 0.8139 | 0.8128 |
|
98 |
+
| truthfulqa_mc1 | 0.5153 | 0.5116 |
|
99 |
+
| openbookqa | 0.3700 | 0.3620 |
|
100 |
+
| boolq | 0.8801 | 0.8801 |
|
101 |
+
| arc_easy | 0.8573 | 0.8548 |
|
102 |
+
| arc_challenge | 0.6067 | 0.6084 |
|
103 |
+
| gsm8k 5 shots | 0.7953 | 0.7908 |
|
104 |
+
|
105 |
+
|
106 |
+
|
107 |
+
|
108 |
+
|
109 |
+
### Reproduce the model
|
110 |
+
|
111 |
+
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.
|
112 |
+
|
113 |
+
```bash
|
114 |
+
git clone https://github.com/intel/auto-round
|
115 |
+
cd auto-round
|
116 |
+
python -m auto_round \
|
117 |
+
--model_name Qwen/Qwen2.5-14B-Instruct \
|
118 |
+
--device 0 \
|
119 |
+
--group_size 128 \
|
120 |
+
--nsamples 512 \
|
121 |
+
--bits 4 \
|
122 |
+
--iter 1000 \
|
123 |
+
--disable_eval \
|
124 |
+
--model_dtype "float16" \
|
125 |
+
--format 'auto_round' \
|
126 |
+
--output_dir "./tmp_autoround"
|
127 |
+
```
|
128 |
+
|
129 |
+
|
130 |
+
|
131 |
+
## Ethical Considerations and Limitations
|
132 |
+
|
133 |
+
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.
|
134 |
+
|
135 |
+
Therefore, before deploying any applications of the model, developers should perform safety testing.
|
136 |
+
|
137 |
+
## Caveats and Recommendations
|
138 |
+
|
139 |
+
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model.
|
140 |
+
|
141 |
+
Here are a couple of useful links to learn more about Intel's AI software:
|
142 |
+
|
143 |
+
* Intel Neural Compressor [link](https://github.com/intel/neural-compressor)
|
144 |
+
* Intel Extension for Transformers [link](https://github.com/intel/intel-extension-for-transformers)
|
145 |
+
|
146 |
+
## Disclaimer
|
147 |
+
|
148 |
+
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.
|
149 |
+
|
150 |
+
|
151 |
+
|
152 |
+
## Cite
|
153 |
+
|
154 |
+
@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} }
|
155 |
+
|
156 |
+
[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:58b54bbe36fc752f79a24a271ef66a0a0830054b4dfad94bde757d851968060b
|
3 |
+
size 605
|
config.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:89dacb213381240bde9b7a008be9115f745592becf66e0ba94fac63d9b68a245
|
3 |
+
size 1369
|
generation_config.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:519a8db66fcfd0d18731eb75169ff8393a6f9c479fd50142fb5ee2580bb9ae64
|
3 |
+
size 243
|
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:a9df1122608ae250335f374bb372dc41e9f09c1a33bd27217414960d80221118
|
3 |
+
size 9992417800
|
quantize_config.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:40a1be12405e831fd26943690d41ea6d85bc4d452305943a8389fc54bba336c9
|
3 |
+
size 559
|
special_tokens_map.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:76862e765266b85aa9459767e33cbaf13970f327a0e88d1c65846c2ddd3a1ecd
|
3 |
+
size 613
|
tokenizer.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:9c5ae00e602b8860cbd784ba82a8aa14e8feecec692e7076590d014d7b7fdafa
|
3 |
+
size 11421896
|
tokenizer_config.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:7e88129d9769a0b14b1587a7d5e829fe93ac0e1511636471fdfc0811951418e6
|
3 |
+
size 7306
|
vocab.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:ca10d7e9fb3ed18575dd1e277a2579c16d108e32f27439684afa0e10b1440910
|
3 |
+
size 2776833
|