Triangle104 lbourdois commited on
Commit
b05590d
·
verified ·
1 Parent(s): ea7743d

Improve language tag (#1)

Browse files

- Improve language tag (2d09b3b1cee51718e6c96669c8fcbc55be4b4e6e)


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

Files changed (1) hide show
  1. README.md +178 -166
README.md CHANGED
@@ -1,166 +1,178 @@
1
- ---
2
- license: apache-2.0
3
- license_link: https://huggingface.co/Qwen/Qwen2.5-32B-Instruct/blob/main/LICENSE
4
- language:
5
- - en
6
- pipeline_tag: text-generation
7
- base_model: Qwen/Qwen2.5-32B-Instruct
8
- tags:
9
- - chat
10
- - llama-cpp
11
- - gguf-my-repo
12
- library_name: transformers
13
- ---
14
-
15
- # Triangle104/Qwen2.5-32B-Instruct-Q5_K_S-GGUF
16
- This model was converted to GGUF format from [`Qwen/Qwen2.5-32B-Instruct`](https://huggingface.co/Qwen/Qwen2.5-32B-Instruct) using llama.cpp via the ggml.ai's [GGUF-my-repo](https://huggingface.co/spaces/ggml-org/gguf-my-repo) space.
17
- Refer to the [original model card](https://huggingface.co/Qwen/Qwen2.5-32B-Instruct) for more details on the model.
18
-
19
- ---
20
- Model Details:
21
- -
22
- 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:
23
-
24
- Significantly more knowledge and has greatly improved capabilities in coding and mathematics, thanks to our specialized expert models in these domains.
25
- 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.
26
- Long-context Support up to 128K tokens and can generate up to 8K tokens.
27
- Multilingual support for over 29 languages, including Chinese, English, French, Spanish, Portuguese, German, Italian, Russian, Japanese, Korean, Vietnamese, Thai, Arabic, and more.
28
-
29
- This repo contains the instruction-tuned 32B Qwen2.5 model, which has the following features:
30
-
31
- Type: Causal Language Models
32
- Training Stage: Pretraining & Post-training
33
- Architecture: transformers with RoPE, SwiGLU, RMSNorm, and Attention QKV bias
34
- Number of Parameters: 32.5B
35
- Number of Paramaters (Non-Embedding): 31.0B
36
- Number of Layers: 64
37
- Number of Attention Heads (GQA): 40 for Q and 8 for KV
38
- Context Length: Full 131,072 tokens and generation 8192 tokens
39
- Please refer to this section for detailed instructions on how to deploy Qwen2.5 for handling long texts.
40
-
41
- For more details, please refer to our blog, GitHub, and Documentation.
42
- Requirements
43
-
44
- The code of Qwen2.5 has been in the latest Hugging face transformers and we advise you to use the latest version of transformers.
45
-
46
- With transformers<4.37.0, you will encounter the following error:
47
-
48
- KeyError: 'qwen2'
49
-
50
- Quickstart
51
-
52
- Here provides a code snippet with apply_chat_template to show you how to load the tokenizer and model and how to generate contents.
53
-
54
- from transformers import AutoModelForCausalLM, AutoTokenizer
55
-
56
- model_name = "Qwen/Qwen2.5-32B-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
- Processing Long Texts
88
-
89
- The current config.json is set for context length up to 32,768 tokens. To handle extensive inputs exceeding 32,768 tokens, we utilize YaRN, a technique for enhancing model length extrapolation, ensuring optimal performance on lengthy texts.
90
-
91
- For supported frameworks, you could add the following to config.json to enable YaRN:
92
-
93
- {
94
- ...,
95
- "rope_scaling": {
96
- "factor": 4.0,
97
- "original_max_position_embeddings": 32768,
98
- "type": "yarn"
99
- }
100
- }
101
-
102
- For deployment, we recommend using vLLM. Please refer to our Documentation for usage if you are not familar with vLLM. Presently, vLLM only supports static YARN, which means the scaling factor remains constant regardless of input length, potentially impacting performance on shorter texts. We advise adding the rope_scaling configuration only when processing long contexts is required.
103
- Evaluation & Performance
104
-
105
- Detailed evaluation results are reported in this 📑 blog.
106
-
107
- For requirements on GPU memory and the respective throughput, see results here.
108
- Citation
109
-
110
- If you find our work helpful, feel free to give us a cite.
111
-
112
- @misc{qwen2.5,
113
- title = {Qwen2.5: A Party of Foundation Models},
114
- url = {https://qwenlm.github.io/blog/qwen2.5/},
115
- author = {Qwen Team},
116
- month = {September},
117
- year = {2024}
118
- }
119
-
120
- @article{qwen2,
121
- title={Qwen2 Technical Report},
122
- 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},
123
- journal={arXiv preprint arXiv:2407.10671},
124
- year={2024}
125
- }
126
-
127
- ---
128
- ## Use with llama.cpp
129
- Install llama.cpp through brew (works on Mac and Linux)
130
-
131
- ```bash
132
- brew install llama.cpp
133
-
134
- ```
135
- Invoke the llama.cpp server or the CLI.
136
-
137
- ### CLI:
138
- ```bash
139
- llama-cli --hf-repo Triangle104/Qwen2.5-32B-Instruct-Q5_K_S-GGUF --hf-file qwen2.5-32b-instruct-q5_k_s.gguf -p "The meaning to life and the universe is"
140
- ```
141
-
142
- ### Server:
143
- ```bash
144
- llama-server --hf-repo Triangle104/Qwen2.5-32B-Instruct-Q5_K_S-GGUF --hf-file qwen2.5-32b-instruct-q5_k_s.gguf -c 2048
145
- ```
146
-
147
- Note: You can also use this checkpoint directly through the [usage steps](https://github.com/ggerganov/llama.cpp?tab=readme-ov-file#usage) listed in the Llama.cpp repo as well.
148
-
149
- Step 1: Clone llama.cpp from GitHub.
150
- ```
151
- git clone https://github.com/ggerganov/llama.cpp
152
- ```
153
-
154
- Step 2: Move into the llama.cpp folder and build it with `LLAMA_CURL=1` flag along with other hardware-specific flags (for ex: LLAMA_CUDA=1 for Nvidia GPUs on Linux).
155
- ```
156
- cd llama.cpp && LLAMA_CURL=1 make
157
- ```
158
-
159
- Step 3: Run inference through the main binary.
160
- ```
161
- ./llama-cli --hf-repo Triangle104/Qwen2.5-32B-Instruct-Q5_K_S-GGUF --hf-file qwen2.5-32b-instruct-q5_k_s.gguf -p "The meaning to life and the universe is"
162
- ```
163
- or
164
- ```
165
- ./llama-server --hf-repo Triangle104/Qwen2.5-32B-Instruct-Q5_K_S-GGUF --hf-file qwen2.5-32b-instruct-q5_k_s.gguf -c 2048
166
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ license_link: https://huggingface.co/Qwen/Qwen2.5-32B-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-32B-Instruct
20
+ tags:
21
+ - chat
22
+ - llama-cpp
23
+ - gguf-my-repo
24
+ library_name: transformers
25
+ ---
26
+
27
+ # Triangle104/Qwen2.5-32B-Instruct-Q5_K_S-GGUF
28
+ This model was converted to GGUF format from [`Qwen/Qwen2.5-32B-Instruct`](https://huggingface.co/Qwen/Qwen2.5-32B-Instruct) using llama.cpp via the ggml.ai's [GGUF-my-repo](https://huggingface.co/spaces/ggml-org/gguf-my-repo) space.
29
+ Refer to the [original model card](https://huggingface.co/Qwen/Qwen2.5-32B-Instruct) for more details on the model.
30
+
31
+ ---
32
+ Model Details:
33
+ -
34
+ 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:
35
+
36
+ Significantly more knowledge and has greatly improved capabilities in coding and mathematics, thanks to our specialized expert models in these domains.
37
+ 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.
38
+ Long-context Support up to 128K tokens and can generate up to 8K tokens.
39
+ Multilingual support for over 29 languages, including Chinese, English, French, Spanish, Portuguese, German, Italian, Russian, Japanese, Korean, Vietnamese, Thai, Arabic, and more.
40
+
41
+ This repo contains the instruction-tuned 32B Qwen2.5 model, which has the following features:
42
+
43
+ Type: Causal Language Models
44
+ Training Stage: Pretraining & Post-training
45
+ Architecture: transformers with RoPE, SwiGLU, RMSNorm, and Attention QKV bias
46
+ Number of Parameters: 32.5B
47
+ Number of Paramaters (Non-Embedding): 31.0B
48
+ Number of Layers: 64
49
+ Number of Attention Heads (GQA): 40 for Q and 8 for KV
50
+ Context Length: Full 131,072 tokens and generation 8192 tokens
51
+ Please refer to this section for detailed instructions on how to deploy Qwen2.5 for handling long texts.
52
+
53
+ For more details, please refer to our blog, GitHub, and Documentation.
54
+ Requirements
55
+
56
+ The code of Qwen2.5 has been in the latest Hugging face transformers and we advise you to use the latest version of transformers.
57
+
58
+ With transformers<4.37.0, you will encounter the following error:
59
+
60
+ KeyError: 'qwen2'
61
+
62
+ Quickstart
63
+
64
+ Here provides a code snippet with apply_chat_template to show you how to load the tokenizer and model and how to generate contents.
65
+
66
+ from transformers import AutoModelForCausalLM, AutoTokenizer
67
+
68
+ model_name = "Qwen/Qwen2.5-32B-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
+ Processing Long Texts
100
+
101
+ The current config.json is set for context length up to 32,768 tokens. To handle extensive inputs exceeding 32,768 tokens, we utilize YaRN, a technique for enhancing model length extrapolation, ensuring optimal performance on lengthy texts.
102
+
103
+ For supported frameworks, you could add the following to config.json to enable YaRN:
104
+
105
+ {
106
+ ...,
107
+ "rope_scaling": {
108
+ "factor": 4.0,
109
+ "original_max_position_embeddings": 32768,
110
+ "type": "yarn"
111
+ }
112
+ }
113
+
114
+ For deployment, we recommend using vLLM. Please refer to our Documentation for usage if you are not familar with vLLM. Presently, vLLM only supports static YARN, which means the scaling factor remains constant regardless of input length, potentially impacting performance on shorter texts. We advise adding the rope_scaling configuration only when processing long contexts is required.
115
+ Evaluation & Performance
116
+
117
+ Detailed evaluation results are reported in this 📑 blog.
118
+
119
+ For requirements on GPU memory and the respective throughput, see results here.
120
+ Citation
121
+
122
+ If you find our work helpful, feel free to give us a cite.
123
+
124
+ @misc{qwen2.5,
125
+ title = {Qwen2.5: A Party of Foundation Models},
126
+ url = {https://qwenlm.github.io/blog/qwen2.5/},
127
+ author = {Qwen Team},
128
+ month = {September},
129
+ year = {2024}
130
+ }
131
+
132
+ @article{qwen2,
133
+ title={Qwen2 Technical Report},
134
+ 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},
135
+ journal={arXiv preprint arXiv:2407.10671},
136
+ year={2024}
137
+ }
138
+
139
+ ---
140
+ ## Use with llama.cpp
141
+ Install llama.cpp through brew (works on Mac and Linux)
142
+
143
+ ```bash
144
+ brew install llama.cpp
145
+
146
+ ```
147
+ Invoke the llama.cpp server or the CLI.
148
+
149
+ ### CLI:
150
+ ```bash
151
+ llama-cli --hf-repo Triangle104/Qwen2.5-32B-Instruct-Q5_K_S-GGUF --hf-file qwen2.5-32b-instruct-q5_k_s.gguf -p "The meaning to life and the universe is"
152
+ ```
153
+
154
+ ### Server:
155
+ ```bash
156
+ llama-server --hf-repo Triangle104/Qwen2.5-32B-Instruct-Q5_K_S-GGUF --hf-file qwen2.5-32b-instruct-q5_k_s.gguf -c 2048
157
+ ```
158
+
159
+ Note: You can also use this checkpoint directly through the [usage steps](https://github.com/ggerganov/llama.cpp?tab=readme-ov-file#usage) listed in the Llama.cpp repo as well.
160
+
161
+ Step 1: Clone llama.cpp from GitHub.
162
+ ```
163
+ git clone https://github.com/ggerganov/llama.cpp
164
+ ```
165
+
166
+ Step 2: Move into the llama.cpp folder and build it with `LLAMA_CURL=1` flag along with other hardware-specific flags (for ex: LLAMA_CUDA=1 for Nvidia GPUs on Linux).
167
+ ```
168
+ cd llama.cpp && LLAMA_CURL=1 make
169
+ ```
170
+
171
+ Step 3: Run inference through the main binary.
172
+ ```
173
+ ./llama-cli --hf-repo Triangle104/Qwen2.5-32B-Instruct-Q5_K_S-GGUF --hf-file qwen2.5-32b-instruct-q5_k_s.gguf -p "The meaning to life and the universe is"
174
+ ```
175
+ or
176
+ ```
177
+ ./llama-server --hf-repo Triangle104/Qwen2.5-32B-Instruct-Q5_K_S-GGUF --hf-file qwen2.5-32b-instruct-q5_k_s.gguf -c 2048
178
+ ```