kimleang123 lbourdois commited on
Commit
2696a15
·
verified ·
1 Parent(s): d16e146

Improve language tag (#1)

Browse files

- Improve language tag (2546e9f085356892f51f44a57c9157b52ba19a66)


Co-authored-by: Loïck BOURDOIS <[email protected]>

Files changed (1) hide show
  1. README.md +168 -156
README.md CHANGED
@@ -1,157 +1,169 @@
1
- ---
2
- base_model:
3
- - Qwen/Qwen2.5-72B-Instruct
4
- license: other
5
- license_name: qwen
6
- license_link: https://huggingface.co/Qwen/Qwen2.5-72B-Instruct/blob/main/LICENSE
7
- language:
8
- - en
9
- pipeline_tag: text-generation
10
- tags:
11
- - bnb-my-repo
12
- - chat
13
- library_name: transformers
14
- ---
15
- # Qwen/Qwen2.5-72B-Instruct (Quantized)
16
-
17
- ## Description
18
- This model is a quantized version of the original model [`Qwen/Qwen2.5-72B-Instruct`](https://huggingface.co/Qwen/Qwen2.5-72B-Instruct).
19
-
20
- It's quantized using the BitsAndBytes library to 4-bit using the [bnb-my-repo](https://huggingface.co/spaces/bnb-community/bnb-my-repo) space.
21
-
22
- ## Quantization Details
23
- - **Quantization Type**: int4
24
- - **bnb_4bit_quant_type**: nf4
25
- - **bnb_4bit_use_double_quant**: True
26
- - **bnb_4bit_compute_dtype**: bfloat16
27
- - **bnb_4bit_quant_storage**: bfloat16
28
-
29
-
30
-
31
- # 📄 Original Model Information
32
-
33
-
34
-
35
- # Qwen2.5-72B-Instruct
36
- <a href="https://chat.qwenlm.ai/" target="_blank" style="margin: 2px;">
37
- <img alt="Chat" src="https://img.shields.io/badge/%F0%9F%92%9C%EF%B8%8F%20Qwen%20Chat%20-536af5" style="display: inline-block; vertical-align: middle;"/>
38
- </a>
39
-
40
- ## Introduction
41
-
42
- Qwen2.5 is the latest series of Qwen large language models. For Qwen2.5, we release a number of base language models and instruction-tuned language models ranging from 0.5 to 72 billion parameters. Qwen2.5 brings the following improvements upon Qwen2:
43
-
44
- - Significantly **more knowledge** and has greatly improved capabilities in **coding** and **mathematics**, thanks to our specialized expert models in these domains.
45
- - Significant improvements in **instruction following**, **generating long texts** (over 8K tokens), **understanding structured data** (e.g, tables), and **generating structured outputs** especially JSON. **More resilient to the diversity of system prompts**, enhancing role-play implementation and condition-setting for chatbots.
46
- - **Long-context Support** up to 128K tokens and can generate up to 8K tokens.
47
- - **Multilingual support** for over 29 languages, including Chinese, English, French, Spanish, Portuguese, German, Italian, Russian, Japanese, Korean, Vietnamese, Thai, Arabic, and more.
48
-
49
- **This repo contains the instruction-tuned 72B Qwen2.5 model**, which has the following features:
50
- - Type: Causal Language Models
51
- - Training Stage: Pretraining & Post-training
52
- - Architecture: transformers with RoPE, SwiGLU, RMSNorm, and Attention QKV bias
53
- - Number of Parameters: 72.7B
54
- - Number of Paramaters (Non-Embedding): 70.0B
55
- - Number of Layers: 80
56
- - Number of Attention Heads (GQA): 64 for Q and 8 for KV
57
- - Context Length: Full 131,072 tokens and generation 8192 tokens
58
- - Please refer to [this section](#processing-long-texts) for detailed instructions on how to deploy Qwen2.5 for handling long texts.
59
-
60
- For more details, please refer to our [blog](https://qwenlm.github.io/blog/qwen2.5/), [GitHub](https://github.com/QwenLM/Qwen2.5), and [Documentation](https://qwen.readthedocs.io/en/latest/).
61
-
62
- ## Requirements
63
-
64
- The code of Qwen2.5 has been in the latest Hugging face `transformers` and we advise you to use the latest version of `transformers`.
65
-
66
- With `transformers<4.37.0`, you will encounter the following error:
67
- ```
68
- KeyError: 'qwen2'
69
- ```
70
-
71
- ## Quickstart
72
-
73
- Here provides a code snippet with `apply_chat_template` to show you how to load the tokenizer and model and how to generate contents.
74
-
75
- ```python
76
- from transformers import AutoModelForCausalLM, AutoTokenizer
77
-
78
- model_name = "Qwen/Qwen2.5-72B-Instruct"
79
-
80
- model = AutoModelForCausalLM.from_pretrained(
81
- model_name,
82
- torch_dtype="auto",
83
- device_map="auto"
84
- )
85
- tokenizer = AutoTokenizer.from_pretrained(model_name)
86
-
87
- prompt = "Give me a short introduction to large language model."
88
- messages = [
89
- {"role": "system", "content": "You are Qwen, created by Alibaba Cloud. You are a helpful assistant."},
90
- {"role": "user", "content": prompt}
91
- ]
92
- text = tokenizer.apply_chat_template(
93
- messages,
94
- tokenize=False,
95
- add_generation_prompt=True
96
- )
97
- model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
98
-
99
- generated_ids = model.generate(
100
- **model_inputs,
101
- max_new_tokens=512
102
- )
103
- generated_ids = [
104
- output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
105
- ]
106
-
107
- response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
108
- ```
109
-
110
- ### Processing Long Texts
111
-
112
- The current `config.json` is set for context length up to 32,768 tokens.
113
- To handle extensive inputs exceeding 32,768 tokens, we utilize [YaRN](https://arxiv.org/abs/2309.00071), a technique for enhancing model length extrapolation, ensuring optimal performance on lengthy texts.
114
-
115
- For supported frameworks, you could add the following to `config.json` to enable YaRN:
116
- ```json
117
- {
118
- ...,
119
- "rope_scaling": {
120
- "factor": 4.0,
121
- "original_max_position_embeddings": 32768,
122
- "type": "yarn"
123
- }
124
- }
125
- ```
126
-
127
- For deployment, we recommend using vLLM.
128
- Please refer to our [Documentation](https://qwen.readthedocs.io/en/latest/deployment/vllm.html) for usage if you are not familar with vLLM.
129
- Presently, vLLM only supports static YARN, which means the scaling factor remains constant regardless of input length, **potentially impacting performance on shorter texts**.
130
- We advise adding the `rope_scaling` configuration only when processing long contexts is required.
131
-
132
- ## Evaluation & Performance
133
-
134
- Detailed evaluation results are reported in this [📑 blog](https://qwenlm.github.io/blog/qwen2.5/).
135
-
136
- For requirements on GPU memory and the respective throughput, see results [here](https://qwen.readthedocs.io/en/latest/benchmark/speed_benchmark.html).
137
-
138
- ## Citation
139
-
140
- If you find our work helpful, feel free to give us a cite.
141
-
142
- ```
143
- @misc{qwen2.5,
144
- title = {Qwen2.5: A Party of Foundation Models},
145
- url = {https://qwenlm.github.io/blog/qwen2.5/},
146
- author = {Qwen Team},
147
- month = {September},
148
- year = {2024}
149
- }
150
-
151
- @article{qwen2,
152
- title={Qwen2 Technical Report},
153
- author={An Yang and Baosong Yang and Binyuan Hui and Bo Zheng and Bowen Yu and Chang Zhou and Chengpeng Li and Chengyuan Li and Dayiheng Liu and Fei Huang and Guanting Dong and Haoran Wei and Huan Lin and Jialong Tang and Jialin Wang and Jian Yang and Jianhong Tu and Jianwei Zhang and Jianxin Ma and Jin Xu and Jingren Zhou and Jinze Bai and Jinzheng He and Junyang Lin and Kai Dang and Keming Lu and Keqin Chen and Kexin Yang and Mei Li and Mingfeng Xue and Na Ni and Pei Zhang and Peng Wang and Ru Peng and Rui Men and Ruize Gao and Runji Lin and Shijie Wang and Shuai Bai and Sinan Tan and Tianhang Zhu and Tianhao Li and Tianyu Liu and Wenbin Ge and Xiaodong Deng and Xiaohuan Zhou and Xingzhang Ren and Xinyu Zhang and Xipin Wei and Xuancheng Ren and Yang Fan and Yang Yao and Yichang Zhang and Yu Wan and Yunfei Chu and Yuqiong Liu and Zeyu Cui and Zhenru Zhang and Zhihao Fan},
154
- journal={arXiv preprint arXiv:2407.10671},
155
- year={2024}
156
- }
 
 
 
 
 
 
 
 
 
 
 
 
157
  ```
 
1
+ ---
2
+ base_model:
3
+ - Qwen/Qwen2.5-72B-Instruct
4
+ license: other
5
+ license_name: qwen
6
+ license_link: https://huggingface.co/Qwen/Qwen2.5-72B-Instruct/blob/main/LICENSE
7
+ language:
8
+ - zho
9
+ - eng
10
+ - fra
11
+ - spa
12
+ - por
13
+ - deu
14
+ - ita
15
+ - rus
16
+ - jpn
17
+ - kor
18
+ - vie
19
+ - tha
20
+ - ara
21
+ pipeline_tag: text-generation
22
+ tags:
23
+ - bnb-my-repo
24
+ - chat
25
+ library_name: transformers
26
+ ---
27
+ # Qwen/Qwen2.5-72B-Instruct (Quantized)
28
+
29
+ ## Description
30
+ This model is a quantized version of the original model [`Qwen/Qwen2.5-72B-Instruct`](https://huggingface.co/Qwen/Qwen2.5-72B-Instruct).
31
+
32
+ It's quantized using the BitsAndBytes library to 4-bit using the [bnb-my-repo](https://huggingface.co/spaces/bnb-community/bnb-my-repo) space.
33
+
34
+ ## Quantization Details
35
+ - **Quantization Type**: int4
36
+ - **bnb_4bit_quant_type**: nf4
37
+ - **bnb_4bit_use_double_quant**: True
38
+ - **bnb_4bit_compute_dtype**: bfloat16
39
+ - **bnb_4bit_quant_storage**: bfloat16
40
+
41
+
42
+
43
+ # 📄 Original Model Information
44
+
45
+
46
+
47
+ # Qwen2.5-72B-Instruct
48
+ <a href="https://chat.qwenlm.ai/" target="_blank" style="margin: 2px;">
49
+ <img alt="Chat" src="https://img.shields.io/badge/%F0%9F%92%9C%EF%B8%8F%20Qwen%20Chat%20-536af5" style="display: inline-block; vertical-align: middle;"/>
50
+ </a>
51
+
52
+ ## Introduction
53
+
54
+ Qwen2.5 is the latest series of Qwen large language models. For Qwen2.5, we release a number of base language models and instruction-tuned language models ranging from 0.5 to 72 billion parameters. Qwen2.5 brings the following improvements upon Qwen2:
55
+
56
+ - Significantly **more knowledge** and has greatly improved capabilities in **coding** and **mathematics**, thanks to our specialized expert models in these domains.
57
+ - Significant improvements in **instruction following**, **generating long texts** (over 8K tokens), **understanding structured data** (e.g, tables), and **generating structured outputs** especially JSON. **More resilient to the diversity of system prompts**, enhancing role-play implementation and condition-setting for chatbots.
58
+ - **Long-context Support** up to 128K tokens and can generate up to 8K tokens.
59
+ - **Multilingual support** for over 29 languages, including Chinese, English, French, Spanish, Portuguese, German, Italian, Russian, Japanese, Korean, Vietnamese, Thai, Arabic, and more.
60
+
61
+ **This repo contains the instruction-tuned 72B Qwen2.5 model**, which has the following features:
62
+ - Type: Causal Language Models
63
+ - Training Stage: Pretraining & Post-training
64
+ - Architecture: transformers with RoPE, SwiGLU, RMSNorm, and Attention QKV bias
65
+ - Number of Parameters: 72.7B
66
+ - Number of Paramaters (Non-Embedding): 70.0B
67
+ - Number of Layers: 80
68
+ - Number of Attention Heads (GQA): 64 for Q and 8 for KV
69
+ - Context Length: Full 131,072 tokens and generation 8192 tokens
70
+ - Please refer to [this section](#processing-long-texts) for detailed instructions on how to deploy Qwen2.5 for handling long texts.
71
+
72
+ For more details, please refer to our [blog](https://qwenlm.github.io/blog/qwen2.5/), [GitHub](https://github.com/QwenLM/Qwen2.5), and [Documentation](https://qwen.readthedocs.io/en/latest/).
73
+
74
+ ## Requirements
75
+
76
+ The code of Qwen2.5 has been in the latest Hugging face `transformers` and we advise you to use the latest version of `transformers`.
77
+
78
+ With `transformers<4.37.0`, you will encounter the following error:
79
+ ```
80
+ KeyError: 'qwen2'
81
+ ```
82
+
83
+ ## Quickstart
84
+
85
+ Here provides a code snippet with `apply_chat_template` to show you how to load the tokenizer and model and how to generate contents.
86
+
87
+ ```python
88
+ from transformers import AutoModelForCausalLM, AutoTokenizer
89
+
90
+ model_name = "Qwen/Qwen2.5-72B-Instruct"
91
+
92
+ model = AutoModelForCausalLM.from_pretrained(
93
+ model_name,
94
+ torch_dtype="auto",
95
+ device_map="auto"
96
+ )
97
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
98
+
99
+ prompt = "Give me a short introduction to large language model."
100
+ messages = [
101
+ {"role": "system", "content": "You are Qwen, created by Alibaba Cloud. You are a helpful assistant."},
102
+ {"role": "user", "content": prompt}
103
+ ]
104
+ text = tokenizer.apply_chat_template(
105
+ messages,
106
+ tokenize=False,
107
+ add_generation_prompt=True
108
+ )
109
+ model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
110
+
111
+ generated_ids = model.generate(
112
+ **model_inputs,
113
+ max_new_tokens=512
114
+ )
115
+ generated_ids = [
116
+ output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
117
+ ]
118
+
119
+ response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
120
+ ```
121
+
122
+ ### Processing Long Texts
123
+
124
+ The current `config.json` is set for context length up to 32,768 tokens.
125
+ To handle extensive inputs exceeding 32,768 tokens, we utilize [YaRN](https://arxiv.org/abs/2309.00071), a technique for enhancing model length extrapolation, ensuring optimal performance on lengthy texts.
126
+
127
+ For supported frameworks, you could add the following to `config.json` to enable YaRN:
128
+ ```json
129
+ {
130
+ ...,
131
+ "rope_scaling": {
132
+ "factor": 4.0,
133
+ "original_max_position_embeddings": 32768,
134
+ "type": "yarn"
135
+ }
136
+ }
137
+ ```
138
+
139
+ For deployment, we recommend using vLLM.
140
+ Please refer to our [Documentation](https://qwen.readthedocs.io/en/latest/deployment/vllm.html) for usage if you are not familar with vLLM.
141
+ Presently, vLLM only supports static YARN, which means the scaling factor remains constant regardless of input length, **potentially impacting performance on shorter texts**.
142
+ We advise adding the `rope_scaling` configuration only when processing long contexts is required.
143
+
144
+ ## Evaluation & Performance
145
+
146
+ Detailed evaluation results are reported in this [📑 blog](https://qwenlm.github.io/blog/qwen2.5/).
147
+
148
+ For requirements on GPU memory and the respective throughput, see results [here](https://qwen.readthedocs.io/en/latest/benchmark/speed_benchmark.html).
149
+
150
+ ## Citation
151
+
152
+ If you find our work helpful, feel free to give us a cite.
153
+
154
+ ```
155
+ @misc{qwen2.5,
156
+ title = {Qwen2.5: A Party of Foundation Models},
157
+ url = {https://qwenlm.github.io/blog/qwen2.5/},
158
+ author = {Qwen Team},
159
+ month = {September},
160
+ year = {2024}
161
+ }
162
+
163
+ @article{qwen2,
164
+ title={Qwen2 Technical Report},
165
+ author={An Yang and Baosong Yang and Binyuan Hui and Bo Zheng and Bowen Yu and Chang Zhou and Chengpeng Li and Chengyuan Li and Dayiheng Liu and Fei Huang and Guanting Dong and Haoran Wei and Huan Lin and Jialong Tang and Jialin Wang and Jian Yang and Jianhong Tu and Jianwei Zhang and Jianxin Ma and Jin Xu and Jingren Zhou and Jinze Bai and Jinzheng He and Junyang Lin and Kai Dang and Keming Lu and Keqin Chen and Kexin Yang and Mei Li and Mingfeng Xue and Na Ni and Pei Zhang and Peng Wang and Ru Peng and Rui Men and Ruize Gao and Runji Lin and Shijie Wang and Shuai Bai and Sinan Tan and Tianhang Zhu and Tianhao Li and Tianyu Liu and Wenbin Ge and Xiaodong Deng and Xiaohuan Zhou and Xingzhang Ren and Xinyu Zhang and Xipin Wei and Xuancheng Ren and Yang Fan and Yang Yao and Yichang Zhang and Yu Wan and Yunfei Chu and Yuqiong Liu and Zeyu Cui and Zhenru Zhang and Zhihao Fan},
166
+ journal={arXiv preprint arXiv:2407.10671},
167
+ year={2024}
168
+ }
169
  ```