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