OPEA
/

Safetensors
llama
4-bit precision
awq
cicdatopea commited on
Commit
6e9a459
·
verified ·
1 Parent(s): 0a3aa28

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +163 -0
README.md ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ datasets:
3
+ - NeelNanda/pile-10k
4
+ ---
5
+
6
+
7
+
8
+
9
+
10
+
11
+ ## Model Details
12
+
13
+ This model is an int4 model with group_size 128 and symmetric quantization of [falcon3-10B](https://huggingface.co/OPEA/falcon3-10B-int4-sym-inc/blob/main/README.md) generated by [intel/auto-round](https://github.com/intel/auto-round).
14
+
15
+ ## How To Use
16
+
17
+ ### INT4 Inference(CPU/HPU/CUDA)
18
+
19
+ ```python
20
+ from auto_round import AutoRoundConfig ##must import for auto_round format
21
+ from transformers import AutoModelForCausalLM, AutoTokenizer
22
+
23
+ quantized_model_dir = "OPEA/falcon3-10B-int4-sym-inc"
24
+ tokenizer = AutoTokenizer.from_pretrained(quantized_model_dir)
25
+ model = AutoModelForCausalLM.from_pretrained(
26
+ quantized_model_dir,
27
+ device_map="auto",
28
+ )
29
+ text = "How many r in strawberry? The answer is "
30
+ inputs = tokenizer(text, return_tensors="pt", return_token_type_ids=False).to(model.device)
31
+ print(tokenizer.decode(model.generate(**inputs, max_new_tokens=50)[0]))
32
+
33
+ text = "How many r in strawberry? The answer is"
34
+ ##INT4:
35
+ """How many r in strawberry? The answer is 2.
36
+
37
+ ### Additional Questions and Answers
38
+
39
+ #### 11. **How many r in strawberry?**
40
+ **Answer:**
41
+ The word "strawberry" contains 2 'r's.
42
+
43
+ ####
44
+ """
45
+
46
+ ##BF16:
47
+ """
48
+ How many r in strawberry? The ansnwer is 2.
49
+
50
+ ### 10. **How many r in strawberry?**
51
+ **Question:** How many times does the letter 'r' appear in the word "strawberry"?
52
+ **Answer:** The letter 'r
53
+
54
+ **Answer:**
55
+ The answer to the riddle"""
56
+ """
57
+
58
+ text = "Which number is larger, 9.8 or 9.11? The answer is"
59
+ ##INT4
60
+ """Which number is larger, 9.8 or 9.11? The answer is 9.8.
61
+
62
+ #### 10. **What is the smallest number in the set {1.2, 1.02, 1.22, 1.002}?**
63
+ """
64
+ ##BF16:
65
+ """Which number is larger, 9.8 or 9.11? The answer is 9.8.
66
+
67
+ #### Question 2:
68
+ **How do you compare the numbers 12.34 and 12.345?**
69
+
70
+ **Answer:**
71
+ To compare 12.34"""
72
+
73
+
74
+ text = "Once upon a time,"
75
+ ##INT4:
76
+ """Once upon a time, in a small town named Harmonyville, lived two best friends - Mia and Ben. They were both eight years old and loved exploring the world around them. One sunny afternoon, while playing near the park, they found a mysterious box with a note
77
+ """
78
+
79
+ ##BF16:
80
+ """Once upon a time, in a small town named Harmonyville, there lived two best friends - Timmy the Turtle and Sally the Squirrel. They loved exploring their beautiful forest home together, discovering new things every day. One sunny afternoon, they stumbled upon a mysterious cave filled with
81
+ """
82
+
83
+ text = "There is a girl who likes adventure,"
84
+ ##INT4:
85
+ """There is a girl who likes adventure, and she loves to explore new places. One day, she decided to go on a trip to a faraway land called "The Land of the Sun." She packed her bag with everything she needed, including her favorite book about the sun.
86
+ """
87
+
88
+ ##BF16:
89
+ """There is a girl who likes adventure, and she loves to explore new places. One day, she decided to go on a trip to a beautiful country called Italy. She wanted to see all the famous landmarks and try the delicious Italian food.
90
+ """
91
+ ```
92
+
93
+ ### Evaluate the model
94
+
95
+ pip3 install lm-eval==0.4.5
96
+
97
+ ```bash
98
+ auto-round --model "OPEA/falcon3-10B-int4-sym-inc" --eval --eval_bs 16 --tasks lambada_openai,hellaswag,piqa,winogrande,truthfulqa_mc1,openbookqa,boolq,arc_easy,arc_challenge,mmlu
99
+ ```
100
+
101
+
102
+
103
+ | Metric | BF16 | INT4 |
104
+ | ------------------------- | ----------------- | ----------------- |
105
+ | Avg.13 | 0.6151 | 0.6092 |
106
+ | Avg.10 | 0.64113 | 0.63584 |
107
+ | leaderboard_mmlu_pro | 0.4238 | 0.4156 |
108
+ | leaderboard_ifeval | (0.4149+0.2939)/2 | (0.4233+0.2828)/2 |
109
+ | gsm8k(5shot) strict match | 0.8067 | 0.7923 |
110
+ | mmlu | 0.7069 | 0.6930 |
111
+ | lambada_openai | 0.6998 | 0.7025 |
112
+ | hellaswag | 0.5873 | 0.5832 |
113
+ | winogrande | 0.7380 | 0.7293 |
114
+ | piqa | 0.7884 | 0.7889 |
115
+ | truthfulqa_mc1 | 0.3427 | 0.3452 |
116
+ | openbookqa | 0.3400 | 0.3320 |
117
+ | boolq | 0.8232 | 0.8116 |
118
+ | arc_easy | 0.8312 | 0.8258 |
119
+ | arc_challenge | 0.5538 | 0.5469 |
120
+
121
+
122
+
123
+ ### Generate the model
124
+
125
+ Here is the sample command to generate the model.
126
+
127
+ ```bash
128
+ auto-round \
129
+ --model falcon3-10B \
130
+ --device 0 \
131
+ --group_size 128 \
132
+ --nsamples 512 \
133
+ --bits 4 \
134
+ --iter 1000 \
135
+ --disable_eval \
136
+ --model_dtype 'float16' \
137
+ --format 'auto_gptq,auto_round' \
138
+ --output_dir "./tmp_autoround"
139
+ ```
140
+
141
+ ## Ethical Considerations and Limitations
142
+
143
+ 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.
144
+
145
+ Therefore, before deploying any applications of the model, developers should perform safety testing.
146
+
147
+ ## Caveats and Recommendations
148
+
149
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model.
150
+
151
+ Here are a couple of useful links to learn more about Intel's AI software:
152
+
153
+ - Intel Neural Compressor [link](https://github.com/intel/neural-compressor)
154
+
155
+ ## Disclaimer
156
+
157
+ 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.
158
+
159
+ ## Cite
160
+
161
+ @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} }
162
+
163
+ [arxiv](https://arxiv.org/abs/2309.05516) [github](https://github.com/intel/auto-round)