OPEA
/

Safetensors
sys-lpot-val commited on
Commit
14dbc89
1 Parent(s): c863feb

upload auto_gptq formt

Browse files
.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
+ tokenizer.json filter=lfs diff=lfs merge=lfs -text
37
+ vocab.json filter=lfs diff=lfs merge=lfs -text
38
+ added_tokens.json filter=lfs diff=lfs merge=lfs -text
39
+ config.json filter=lfs diff=lfs merge=lfs -text
40
+ generation_config.json filter=lfs diff=lfs merge=lfs -text
41
+ quantize_config.json filter=lfs diff=lfs merge=lfs -text
42
+ special_tokens_map.json filter=lfs diff=lfs merge=lfs -text
43
+ tokenizer_config.json filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -1,3 +1,158 @@
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-1.5B-Instruct](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
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-1.5B-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! What kind of adventure does she like?
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 them directly:
66
+ ##1. Start with the numbers: 9.11 and 9.8.
67
+ ##2. Compare their digits from left to
68
+
69
+
70
+ ##prompt = "Once upon a time,"
71
+ ##once upon a time, there was a young girl named Lily who lived in a small village nestled among the rolling hills of England. She had always been fascinated by nature and the beauty of the world around her.One day, while exploring the woods near\
72
+
73
+ ##prompt = "请介绍一下阿里巴巴公司"
74
+ ##阿里巴巴集团是一家全球领先的电子商务和科技企业,成立于1999年。阿里巴巴集团总部位于中国杭州,并在全球范围内拥有超过20个运营中心。
75
+ ##阿里巴巴集团的业务范围包括:
76
+ ##1. 电子商务:阿里巴巴集团是全球
77
+
78
+ ```
79
+
80
+ ### Evaluate the model
81
+
82
+ pip3 install lm-eval==0.4.2
83
+
84
+ ```bash
85
+ git clone https://github.com/intel/auto-round
86
+ cd auto-round
87
+ python -m auto_round --model "OPEA/Qwen2.5-1.5B-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
88
+ ```
89
+
90
+ | Metric | BF16 | INT4(group_size 128) | INT4(group_size 32) |
91
+ |:-------------- | :----: | :----: |:------:|
92
+ | Avg | 0.5646 | 0.5668 | 0.5699 |
93
+ | mmlu | 0.6010 | 0.5876 | 0.5924 |
94
+ | cmmlu | 0.6497 | 0.6146 | 0.6259 |
95
+ | ceval-valid | 0.6597 | 0.6382 | 0.6404 |
96
+ | lambada_openai | 0.6095 | 0.5886 | 0.6082 |
97
+ | hellaswag | 0.5082 | 0.4985 | 0.5012 |
98
+ | winogrande | 0.6298 | 0.6204 | 0.6409 |
99
+ | piqa | 0.7633 | 0.7519 | 0.7650 |
100
+ | truthfulqa_mc1 | 0.3109 | 0.3158 | 0.3060 |
101
+ | openbookqa | 0.3160 | 0.2940 | 0.3020 |
102
+ | boolq | 0.7789 | 0.7703 | 0.7681 |
103
+ | arc_easy | 0.7677 | 0.7660 | 0.7681 |
104
+ | arc_challenge | 0.4343 | 0.4454 | 0.4360 |
105
+ | gsm8k 5 shots | 0.3101 | 0.4776 | 0.4519 |
106
+
107
+
108
+
109
+
110
+
111
+ ### Reproduce the model
112
+
113
+ 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.
114
+
115
+ ```bash
116
+ git clone https://github.com/intel/auto-round
117
+ cd auto-round
118
+ python -m auto_round \
119
+ --model_name Qwen/Qwen2.5-1.5B-Instruct \
120
+ --device 0 \
121
+ --group_size 128 \
122
+ --nsamples 512 \
123
+ --bits 4 \
124
+ --iter 1000 \
125
+ --disable_eval \
126
+ --model_dtype "float16" \
127
+ --format 'auto_round' \
128
+ --output_dir "./tmp_autoround"
129
+ ```
130
+
131
+
132
+
133
+ ## Ethical Considerations and Limitations
134
+
135
+ 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.
136
+
137
+ Therefore, before deploying any applications of the model, developers should perform safety testing.
138
+
139
+ ## Caveats and Recommendations
140
+
141
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model.
142
+
143
+ Here are a couple of useful links to learn more about Intel's AI software:
144
+
145
+ * Intel Neural Compressor [link](https://github.com/intel/neural-compressor)
146
+ * Intel Extension for Transformers [link](https://github.com/intel/intel-extension-for-transformers)
147
+
148
+ ## Disclaimer
149
+
150
+ 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.
151
+
152
+
153
+
154
+ ## Cite
155
+
156
+ @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} }
157
+
158
+ [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:a818cfe3a54f21beb9769e3cfc4332d71f31a205411fc8260470669899ce9f66
3
+ size 1368
generation_config.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0dc30d5b7f022dcbfaaef3e55340642208a3b0436214346caf1c522c009f699d
3
+ size 242
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:3aea79517e9780575f7fd4c1969b48d99f8762c225280b799ddd6188f6c6c924
3
+ size 1151050488
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