cicdatopea commited on
Commit
db0e3e3
·
verified ·
1 Parent(s): 10bca14

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +177 -0
README.md ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ datasets:
3
+ - NeelNanda/pile-10k
4
+ base_model:
5
+ - deepseek-ai/DeepSeek-V3
6
+ ---
7
+ ## Model Details
8
+
9
+ This model is an int4 model with group_size 128 and and symmetric quantization of [deepseek-ai/DeepSeek-V3](https://huggingface.co/deepseek-ai/DeepSeek-V3) generated by [intel/auto-round](https://github.com/intel/auto-round) algorithm. **Please note that loading the model in Transformers can be quite slow. Consider using an alternative serving framework for better performance.** Due to limited GPU resources, we have only tested a few prompts on a CPU backend using QBits . If you found this model not perform well, **you can explore a quantized model in AWQ format with different hyperparameters generated via AutoRound** which will be uploaded soon
10
+
11
+ ## How To Use
12
+
13
+ ### INT4 Inference(CPU/CUDA)
14
+
15
+ ````python
16
+ from transformers import AutoModelForCausalLM, AutoTokenizer,GenerationConfig
17
+ import torch
18
+ quantized_model_dir = "OPEA/DeepSeek-V3-int4-sym-gptq-inc-preview"
19
+
20
+ model = AutoModelForCausalLM.from_pretrained(
21
+ quantized_model_dir,
22
+ torch_dtype=torch.float16,
23
+ trust_remote_code=True,
24
+ )
25
+
26
+ tokenizer = AutoTokenizer.from_pretrained(quantized_model_dir,trust_remote_code=True)
27
+ prompt = "There is a girl who likes adventure,"
28
+ messages = [
29
+ {"role": "system", "content": "You are a helpful assistant."},
30
+ {"role": "user", "content": prompt}
31
+ ]
32
+ text = tokenizer.apply_chat_template(
33
+ messages,
34
+ tokenize=False,
35
+ add_generation_prompt=True
36
+ )
37
+ model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
38
+
39
+ generated_ids = model.generate(
40
+ model_inputs.input_ids,
41
+ max_new_tokens=200, ##change this to align with the official usage
42
+ do_sample=False ##change this to align with the official usage
43
+ )
44
+ generated_ids = [
45
+ output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
46
+ ]
47
+
48
+ response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
49
+ print(response)
50
+
51
+
52
+ ## The following result is infercenced on CPU with qbits backend
53
+ prompt = "9.11和9.8哪个数字大"
54
+
55
+ ##INT4
56
+ """要比较 **9.11** 和 **9.8** 的大小,可以按照以下步骤进行:
57
+
58
+ 1. **比较整数部分**:
59
+ - 两个数的整数部分都是 **9**,所以整数部分相同。
60
+
61
+ 2. **比较小数部分**:
62
+ - **9.11** 的小数部分是 **0.11**
63
+ - **9.8** 的小数部分是 **0.8**(即 **0.80**)
64
+
65
+ 3. **分析小数部分**:
66
+ - **0.80** 大于 **0.11**
67
+
68
+ 因此,**9.8** 大于 **9.11**。
69
+
70
+ 最终答案:\boxed{9.8}
71
+
72
+ """
73
+
74
+ prompt = "strawberry中有几个r?"
75
+ ##INT4
76
+ """
77
+ ### 第一步:理解问题
78
+
79
+ 首先,我需要明确问题的含义。问题是:“strawberry中有几个r?”。这里的“strawberry”是一个英文单词,意思是“草莓”。问题问的是这个单 词中有多少个字母“r”。
80
+
81
+ ### 第二步:分解单词
82
+
83
+ 为了找出“strawberry”中有多少个“r”,我需要将这个单词分解成单个字母。让我们逐个字母来看:
84
+
85
+ - s
86
+ - t
87
+ - r
88
+ - a
89
+ - w
90
+ - b
91
+ - e
92
+ - r
93
+ - r
94
+ - y
95
+
96
+ ### 第三步:识别字母“r”
97
+
98
+ 现在,我需要找出这些字母中哪些是“r”。让我们逐一检查:
99
+
100
+ 1. s - 不是r
101
+ 2. t - 不是r
102
+ 3. r - 是r
103
+ 4. a - 不是r
104
+ 5. w - 不是r
105
+ 6. b - 不是r
106
+ 7. e - 不是r
107
+ 8. r - 是r
108
+ """
109
+
110
+ prompt = "strawberry中有几个r?"
111
+ ##INT4
112
+ """The word "strawberry" contains **3 "r"s.
113
+ """
114
+
115
+ prompt = "There is a girl who likes adventure,"
116
+ ##INT4:
117
+ """That's wonderful! A girl who loves adventure is likely curious, brave, and eager to explore the world around her. Here are some ideas to fuel her adventurous spirit:
118
+
119
+ ### **Outdoor Adventures**
120
+
121
+ - **Hiking:** Explore local trails, national parks, or mountains.
122
+ - **Camping:** Spend a night under the stars and connect with nature.
123
+ - **Rock Climbing:** Challenge herself with bouldering or climbing walls.
124
+ - **Kayaking/Canoeing:** Paddle through rivers, lakes, or even the ocean.
125
+ - **Zip-lining:** Soar through the treetops for an adrenaline rush.
126
+
127
+ ### **Travel Adventures**
128
+
129
+ - **Road Trips:** Plan a journey to new cities or scenic destinations.
130
+ - **Backpacking:** Travel light and explore different cultures and landscapes.
131
+ - **Volunteer Abroad:** Combine adventure with helping others in a new country.
132
+
133
+ ### **Creative Adventures**
134
+
135
+ - **Photography:** Capture the beauty
136
+ """
137
+
138
+ prompt = "Please give a brief introduction of DeepSeek company."
139
+ ##INT4:
140
+ """DeepSeek Artificial Intelligence Co., Ltd. (referred to as "DeepSeek" or "深度求索") , founded in 2023, is a Chinese company dedicated to making AGI a reality"""
141
+
142
+
143
+ ````
144
+
145
+ ### Evaluate the model
146
+
147
+ we have no enough resource to evaluate the model
148
+
149
+ ### Generate the model
150
+
151
+ need 200G GPU memory, details will updated later
152
+
153
+
154
+
155
+ ## Ethical Considerations and Limitations
156
+
157
+ 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.
158
+
159
+ Therefore, before deploying any applications of the model, developers should perform safety testing.
160
+
161
+ ## Caveats and Recommendations
162
+
163
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model.
164
+
165
+ Here are a couple of useful links to learn more about Intel's AI software:
166
+
167
+ - Intel Neural Compressor [link](https://github.com/intel/neural-compressor)
168
+
169
+ ## Disclaimer
170
+
171
+ 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.
172
+
173
+ ## Cite
174
+
175
+ @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} }
176
+
177
+ [arxiv](https://arxiv.org/abs/2309.05516) [github](https://github.com/intel/auto-round)