lbourdois commited on
Commit
b5fecdd
·
verified ·
1 Parent(s): a09a354

Improve language tag

Browse files

Hi! As the model is multilingual, this is a PR to add other languages than English to the language tag to improve the referencing. Note that 29 languages are announced in the README, but only 13 are explicitly listed. I was therefore only able to add these 13 languages.

Files changed (1) hide show
  1. README.md +146 -134
README.md CHANGED
@@ -1,135 +1,147 @@
1
- ---
2
- license: apache-2.0
3
- license_link: https://huggingface.co/Qwen/Qwen2.5-7B-Instruct/blob/main/LICENSE
4
- language:
5
- - en
6
- pipeline_tag: text-generation
7
- base_model: Qwen/Qwen2.5-7B
8
- tags:
9
- - chat
10
- library_name: transformers
11
- ---
12
-
13
- # Qwen2.5-7B-Instruct
14
- <a href="https://chat.qwenlm.ai/" target="_blank" style="margin: 2px;">
15
- <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;"/>
16
- </a>
17
-
18
- ## Introduction
19
-
20
- 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:
21
-
22
- - Significantly **more knowledge** and has greatly improved capabilities in **coding** and **mathematics**, thanks to our specialized expert models in these domains.
23
- - 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.
24
- - **Long-context Support** up to 128K tokens and can generate up to 8K tokens.
25
- - **Multilingual support** for over 29 languages, including Chinese, English, French, Spanish, Portuguese, German, Italian, Russian, Japanese, Korean, Vietnamese, Thai, Arabic, and more.
26
-
27
- **This repo contains the instruction-tuned 7B Qwen2.5 model**, which has the following features:
28
- - Type: Causal Language Models
29
- - Training Stage: Pretraining & Post-training
30
- - Architecture: transformers with RoPE, SwiGLU, RMSNorm, and Attention QKV bias
31
- - Number of Parameters: 7.61B
32
- - Number of Paramaters (Non-Embedding): 6.53B
33
- - Number of Layers: 28
34
- - Number of Attention Heads (GQA): 28 for Q and 4 for KV
35
- - Context Length: Full 131,072 tokens and generation 8192 tokens
36
- - Please refer to [this section](#processing-long-texts) for detailed instructions on how to deploy Qwen2.5 for handling long texts.
37
-
38
- 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/).
39
-
40
- ## Requirements
41
-
42
- The code of Qwen2.5 has been in the latest Hugging face `transformers` and we advise you to use the latest version of `transformers`.
43
-
44
- With `transformers<4.37.0`, you will encounter the following error:
45
- ```
46
- KeyError: 'qwen2'
47
- ```
48
-
49
- ## Quickstart
50
-
51
- Here provides a code snippet with `apply_chat_template` to show you how to load the tokenizer and model and how to generate contents.
52
-
53
- ```python
54
- from transformers import AutoModelForCausalLM, AutoTokenizer
55
-
56
- model_name = "Qwen/Qwen2.5-7B-Instruct"
57
-
58
- model = AutoModelForCausalLM.from_pretrained(
59
- model_name,
60
- torch_dtype="auto",
61
- device_map="auto"
62
- )
63
- tokenizer = AutoTokenizer.from_pretrained(model_name)
64
-
65
- prompt = "Give me a short introduction to large language model."
66
- messages = [
67
- {"role": "system", "content": "You are Qwen, created by Alibaba Cloud. You are a helpful assistant."},
68
- {"role": "user", "content": prompt}
69
- ]
70
- text = tokenizer.apply_chat_template(
71
- messages,
72
- tokenize=False,
73
- add_generation_prompt=True
74
- )
75
- model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
76
-
77
- generated_ids = model.generate(
78
- **model_inputs,
79
- max_new_tokens=512
80
- )
81
- generated_ids = [
82
- output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
83
- ]
84
-
85
- response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
86
- ```
87
-
88
- ### Processing Long Texts
89
-
90
- The current `config.json` is set for context length up to 32,768 tokens.
91
- 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.
92
-
93
- For supported frameworks, you could add the following to `config.json` to enable YaRN:
94
- ```json
95
- {
96
- ...,
97
- "rope_scaling": {
98
- "factor": 4.0,
99
- "original_max_position_embeddings": 32768,
100
- "type": "yarn"
101
- }
102
- }
103
- ```
104
-
105
- For deployment, we recommend using vLLM.
106
- Please refer to our [Documentation](https://qwen.readthedocs.io/en/latest/deployment/vllm.html) for usage if you are not familar with vLLM.
107
- Presently, vLLM only supports static YARN, which means the scaling factor remains constant regardless of input length, **potentially impacting performance on shorter texts**.
108
- We advise adding the `rope_scaling` configuration only when processing long contexts is required.
109
-
110
- ## Evaluation & Performance
111
-
112
- Detailed evaluation results are reported in this [📑 blog](https://qwenlm.github.io/blog/qwen2.5/).
113
-
114
- For requirements on GPU memory and the respective throughput, see results [here](https://qwen.readthedocs.io/en/latest/benchmark/speed_benchmark.html).
115
-
116
- ## Citation
117
-
118
- If you find our work helpful, feel free to give us a cite.
119
-
120
- ```
121
- @misc{qwen2.5,
122
- title = {Qwen2.5: A Party of Foundation Models},
123
- url = {https://qwenlm.github.io/blog/qwen2.5/},
124
- author = {Qwen Team},
125
- month = {September},
126
- year = {2024}
127
- }
128
-
129
- @article{qwen2,
130
- title={Qwen2 Technical Report},
131
- 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},
132
- journal={arXiv preprint arXiv:2407.10671},
133
- year={2024}
134
- }
 
 
 
 
 
 
 
 
 
 
 
 
135
  ```
 
1
+ ---
2
+ license: apache-2.0
3
+ license_link: https://huggingface.co/Qwen/Qwen2.5-7B-Instruct/blob/main/LICENSE
4
+ language:
5
+ - zho
6
+ - eng
7
+ - fra
8
+ - spa
9
+ - por
10
+ - deu
11
+ - ita
12
+ - rus
13
+ - jpn
14
+ - kor
15
+ - vie
16
+ - tha
17
+ - ara
18
+ pipeline_tag: text-generation
19
+ base_model: Qwen/Qwen2.5-7B
20
+ tags:
21
+ - chat
22
+ library_name: transformers
23
+ ---
24
+
25
+ # Qwen2.5-7B-Instruct
26
+ <a href="https://chat.qwenlm.ai/" target="_blank" style="margin: 2px;">
27
+ <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;"/>
28
+ </a>
29
+
30
+ ## Introduction
31
+
32
+ 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:
33
+
34
+ - Significantly **more knowledge** and has greatly improved capabilities in **coding** and **mathematics**, thanks to our specialized expert models in these domains.
35
+ - 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.
36
+ - **Long-context Support** up to 128K tokens and can generate up to 8K tokens.
37
+ - **Multilingual support** for over 29 languages, including Chinese, English, French, Spanish, Portuguese, German, Italian, Russian, Japanese, Korean, Vietnamese, Thai, Arabic, and more.
38
+
39
+ **This repo contains the instruction-tuned 7B Qwen2.5 model**, which has the following features:
40
+ - Type: Causal Language Models
41
+ - Training Stage: Pretraining & Post-training
42
+ - Architecture: transformers with RoPE, SwiGLU, RMSNorm, and Attention QKV bias
43
+ - Number of Parameters: 7.61B
44
+ - Number of Paramaters (Non-Embedding): 6.53B
45
+ - Number of Layers: 28
46
+ - Number of Attention Heads (GQA): 28 for Q and 4 for KV
47
+ - Context Length: Full 131,072 tokens and generation 8192 tokens
48
+ - Please refer to [this section](#processing-long-texts) for detailed instructions on how to deploy Qwen2.5 for handling long texts.
49
+
50
+ 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/).
51
+
52
+ ## Requirements
53
+
54
+ The code of Qwen2.5 has been in the latest Hugging face `transformers` and we advise you to use the latest version of `transformers`.
55
+
56
+ With `transformers<4.37.0`, you will encounter the following error:
57
+ ```
58
+ KeyError: 'qwen2'
59
+ ```
60
+
61
+ ## Quickstart
62
+
63
+ Here provides a code snippet with `apply_chat_template` to show you how to load the tokenizer and model and how to generate contents.
64
+
65
+ ```python
66
+ from transformers import AutoModelForCausalLM, AutoTokenizer
67
+
68
+ model_name = "Qwen/Qwen2.5-7B-Instruct"
69
+
70
+ model = AutoModelForCausalLM.from_pretrained(
71
+ model_name,
72
+ torch_dtype="auto",
73
+ device_map="auto"
74
+ )
75
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
76
+
77
+ prompt = "Give me a short introduction to large language model."
78
+ messages = [
79
+ {"role": "system", "content": "You are Qwen, created by Alibaba Cloud. You are a helpful assistant."},
80
+ {"role": "user", "content": prompt}
81
+ ]
82
+ text = tokenizer.apply_chat_template(
83
+ messages,
84
+ tokenize=False,
85
+ add_generation_prompt=True
86
+ )
87
+ model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
88
+
89
+ generated_ids = model.generate(
90
+ **model_inputs,
91
+ max_new_tokens=512
92
+ )
93
+ generated_ids = [
94
+ output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
95
+ ]
96
+
97
+ response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
98
+ ```
99
+
100
+ ### Processing Long Texts
101
+
102
+ The current `config.json` is set for context length up to 32,768 tokens.
103
+ 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.
104
+
105
+ For supported frameworks, you could add the following to `config.json` to enable YaRN:
106
+ ```json
107
+ {
108
+ ...,
109
+ "rope_scaling": {
110
+ "factor": 4.0,
111
+ "original_max_position_embeddings": 32768,
112
+ "type": "yarn"
113
+ }
114
+ }
115
+ ```
116
+
117
+ For deployment, we recommend using vLLM.
118
+ Please refer to our [Documentation](https://qwen.readthedocs.io/en/latest/deployment/vllm.html) for usage if you are not familar with vLLM.
119
+ Presently, vLLM only supports static YARN, which means the scaling factor remains constant regardless of input length, **potentially impacting performance on shorter texts**.
120
+ We advise adding the `rope_scaling` configuration only when processing long contexts is required.
121
+
122
+ ## Evaluation & Performance
123
+
124
+ Detailed evaluation results are reported in this [📑 blog](https://qwenlm.github.io/blog/qwen2.5/).
125
+
126
+ For requirements on GPU memory and the respective throughput, see results [here](https://qwen.readthedocs.io/en/latest/benchmark/speed_benchmark.html).
127
+
128
+ ## Citation
129
+
130
+ If you find our work helpful, feel free to give us a cite.
131
+
132
+ ```
133
+ @misc{qwen2.5,
134
+ title = {Qwen2.5: A Party of Foundation Models},
135
+ url = {https://qwenlm.github.io/blog/qwen2.5/},
136
+ author = {Qwen Team},
137
+ month = {September},
138
+ year = {2024}
139
+ }
140
+
141
+ @article{qwen2,
142
+ title={Qwen2 Technical Report},
143
+ 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},
144
+ journal={arXiv preprint arXiv:2407.10671},
145
+ year={2024}
146
+ }
147
  ```