OPEA
/

Safetensors
qwen2
4-bit precision
intel/auto-round
sys-lpot-val commited on
Commit
2b3d2ef
·
1 Parent(s): 588f8fe

update to autogptq full sym

Browse files

Signed-off-by: sys-lpot-val <sys_lpot_val@intel.com>

.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
+ config.json filter=lfs diff=lfs merge=lfs -text
37
+ generation_config.json filter=lfs diff=lfs merge=lfs -text
38
+ quantize_config.json filter=lfs diff=lfs merge=lfs -text
39
+ special_tokens_map.json filter=lfs diff=lfs merge=lfs -text
40
+ tokenizer_config.json filter=lfs diff=lfs merge=lfs -text
41
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
42
+ vocab.json filter=lfs diff=lfs merge=lfs -text
43
+ added_tokens.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 of [Qwen/Qwen2.5-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-7B-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-7B-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 sounds exciting! What kind of adventures does she enjoy? Is there something specific you'd like to plan or discuss related to her love for adventure?
63
+
64
+ ##prompt = "Which one is bigger, 9.11 or 9.8"
65
+ ##The number 9.8 is bigger than 9.11. When comparing decimal numbers, you can look at each digit from left to right. Both numbers start with 9, but the second digit after the decimal point is 1 in
66
+
67
+
68
+ ##prompt = "Once upon a time,"
69
+ ##Once upon a time, in a land filled with wonder and magic, there lived a young girl named Elara. She had bright eyes that sparkled like the stars on a clear night and hair as golden as the sun-kissed fields of wheat
70
+
71
+ ##prompt = "请介绍一下阿里巴巴公司"
72
+ ##阿里巴巴集团是一家总部位于中国杭州的全球领先的电子商务和科技公司,成立于1999年。阿里巴巴集团旗下的业务涵盖了电子商务、零售、金融、物流、云计算等多个领域。
73
+ ##阿里巴巴集团的主要业务包括:
74
+ ##1. 电子商务:
75
+
76
+ ```
77
+
78
+ ### Evaluate the model
79
+
80
+ pip3 install lm-eval==0.4.4
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.6872 | 0.6863 |
91
+ | mmlu | 0.7178 | 0.7131 |
92
+ | cmmlu | 0.8018 | 0.7899 |
93
+ | ceval-valid | 0.7949 | 0.7741 |
94
+ | lambada_openai | 0.6978 | 0.6936 |
95
+ | hellaswag | 0.6203 | 0.6152 |
96
+ | winogrande | 0.7080 | 0.7056 |
97
+ | piqa | 0.7943 | 0.7851 |
98
+ | truthfulqa_mc1 | 0.4786 | 0.4798 |
99
+ | openbookqa | 0.3480 | 0.3560 |
100
+ | boolq | 0.8636 | 0.8590 |
101
+ | arc_easy | 0.8182 | 0.8215 |
102
+ | arc_challenge | 0.5273 | 0.5307 |
103
+ | gsm8k 5 shots | 0.7635 | 0.7983 |
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-7B-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:3c52ecbe1642da156bdabaa7a3e2c953e1936d46395a43d5c39440a2eb9e33a4
3
+ size 1368
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:62ca0e9fe1fb798b1ab90832bfc38363c7c8cbe9a24382298f6d78318d95e5f2
3
+ size 5577916464
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:913950e4971737031da511cdd1b410daae4566f62eb845b3975bca5a102323d8
3
+ size 11421995
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