Volko76 lbourdois commited on
Commit
5c7d335
·
verified ·
1 Parent(s): a352389

Improve language tag (#1)

Browse files

- Improve language tag (88cbdcc7c24cdb774197d6f6a5cfd81043422654)


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

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