mav23 commited on
Commit
ac7fc45
1 Parent(s): d23e815

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. .gitattributes +1 -0
  2. README.md +171 -0
  3. qwen2-72b-instruct.Q4_0.gguf +3 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ qwen2-72b-instruct.Q4_0.gguf filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,171 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ license_name: tongyi-qianwen
4
+ license_link: https://huggingface.co/Qwen/Qwen2-72B-Instruct/blob/main/LICENSE
5
+ language:
6
+ - en
7
+ pipeline_tag: text-generation
8
+ base_model: Qwen/Qwen2-72B
9
+ tags:
10
+ - chat
11
+ new_version: Qwen/Qwen2.5-72B-Instruct
12
+ ---
13
+
14
+ # Qwen2-72B-Instruct
15
+
16
+ ## Introduction
17
+
18
+ Qwen2 is the new series of Qwen large language models. For Qwen2, we release a number of base language models and instruction-tuned language models ranging from 0.5 to 72 billion parameters, including a Mixture-of-Experts model. This repo contains the instruction-tuned 72B Qwen2 model.
19
+
20
+ Compared with the state-of-the-art opensource language models, including the previous released Qwen1.5, Qwen2 has generally surpassed most opensource models and demonstrated competitiveness against proprietary models across a series of benchmarks targeting for language understanding, language generation, multilingual capability, coding, mathematics, reasoning, etc.
21
+
22
+ Qwen2-72B-Instruct supports a context length of up to 131,072 tokens, enabling the processing of extensive inputs. Please refer to [this section](#processing-long-texts) for detailed instructions on how to deploy Qwen2 for handling long texts.
23
+
24
+ For more details, please refer to our [blog](https://qwenlm.github.io/blog/qwen2/), [GitHub](https://github.com/QwenLM/Qwen2), and [Documentation](https://qwen.readthedocs.io/en/latest/).
25
+ <br>
26
+
27
+ ## Model Details
28
+ Qwen2 is a language model series including decoder language models of different model sizes. For each size, we release the base language model and the aligned chat model. It is based on the Transformer architecture with SwiGLU activation, attention QKV bias, group query attention, etc. Additionally, we have an improved tokenizer adaptive to multiple natural languages and codes.
29
+
30
+ ## Training details
31
+ We pretrained the models with a large amount of data, and we post-trained the models with both supervised finetuning and direct preference optimization.
32
+
33
+
34
+ ## Requirements
35
+ The code of Qwen2 has been in the latest Hugging face transformers and we advise you to install `transformers>=4.37.0`, or you might encounter the following error:
36
+ ```
37
+ KeyError: 'qwen2'
38
+ ```
39
+
40
+ ## Quickstart
41
+
42
+ Here provides a code snippet with `apply_chat_template` to show you how to load the tokenizer and model and how to generate contents.
43
+
44
+ ```python
45
+ from transformers import AutoModelForCausalLM, AutoTokenizer
46
+ device = "cuda" # the device to load the model onto
47
+
48
+ model = AutoModelForCausalLM.from_pretrained(
49
+ "Qwen/Qwen2-72B-Instruct",
50
+ torch_dtype="auto",
51
+ device_map="auto"
52
+ )
53
+ tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2-72B-Instruct")
54
+
55
+ prompt = "Give me a short introduction to large language model."
56
+ messages = [
57
+ {"role": "system", "content": "You are a helpful assistant."},
58
+ {"role": "user", "content": prompt}
59
+ ]
60
+ text = tokenizer.apply_chat_template(
61
+ messages,
62
+ tokenize=False,
63
+ add_generation_prompt=True
64
+ )
65
+ model_inputs = tokenizer([text], return_tensors="pt").to(device)
66
+
67
+ generated_ids = model.generate(
68
+ model_inputs.input_ids,
69
+ max_new_tokens=512
70
+ )
71
+ generated_ids = [
72
+ output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
73
+ ]
74
+
75
+ response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
76
+ ```
77
+
78
+ ### Processing Long Texts
79
+
80
+ 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.
81
+
82
+ For deployment, we recommend using vLLM. You can enable the long-context capabilities by following these steps:
83
+
84
+ 1. **Install vLLM**: You can install vLLM by running the following command.
85
+
86
+ ```bash
87
+ pip install "vllm>=0.4.3"
88
+ ```
89
+
90
+ Or you can install vLLM from [source](https://github.com/vllm-project/vllm/).
91
+
92
+ 2. **Configure Model Settings**: After downloading the model weights, modify the `config.json` file by including the below snippet:
93
+ ```json
94
+ {
95
+ "architectures": [
96
+ "Qwen2ForCausalLM"
97
+ ],
98
+ // ...
99
+ "vocab_size": 152064,
100
+
101
+ // adding the following snippets
102
+ "rope_scaling": {
103
+ "factor": 4.0,
104
+ "original_max_position_embeddings": 32768,
105
+ "type": "yarn"
106
+ }
107
+ }
108
+ ```
109
+ This snippet enable YARN to support longer contexts.
110
+
111
+ 3. **Model Deployment**: Utilize vLLM to deploy your model. For instance, you can set up an openAI-like server using the command:
112
+
113
+ ```bash
114
+ python -m vllm.entrypoints.openai.api_server --served-model-name Qwen2-72B-Instruct --model path/to/weights
115
+ ```
116
+
117
+ Then you can access the Chat API by:
118
+
119
+ ```bash
120
+ curl http://localhost:8000/v1/chat/completions \
121
+ -H "Content-Type: application/json" \
122
+ -d '{
123
+ "model": "Qwen2-72B-Instruct",
124
+ "messages": [
125
+ {"role": "system", "content": "You are a helpful assistant."},
126
+ {"role": "user", "content": "Your Long Input Here."}
127
+ ]
128
+ }'
129
+ ```
130
+
131
+ For further usage instructions of vLLM, please refer to our [Github](https://github.com/QwenLM/Qwen2).
132
+
133
+ **Note**: 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.
134
+
135
+ ## Evaluation
136
+
137
+ We briefly compare Qwen2-72B-Instruct with similar-sized instruction-tuned LLMs, including our previous Qwen1.5-72B-Chat. The results are shown as follows:
138
+
139
+ | Datasets | Llama-3-70B-Instruct | Qwen1.5-72B-Chat | **Qwen2-72B-Instruct** |
140
+ | :--- | :---: | :---: | :---: |
141
+ | _**English**_ | | | |
142
+ | MMLU | 82.0 | 75.6 | **82.3** |
143
+ | MMLU-Pro | 56.2 | 51.7 | **64.4** |
144
+ | GPQA | 41.9 | 39.4 | **42.4** |
145
+ | TheroemQA | 42.5 | 28.8 | **44.4** |
146
+ | MT-Bench | 8.95 | 8.61 | **9.12** |
147
+ | Arena-Hard | 41.1 | 36.1 | **48.1** |
148
+ | IFEval (Prompt Strict-Acc.) | 77.3 | 55.8 | **77.6** |
149
+ | _**Coding**_ | | | |
150
+ | HumanEval | 81.7 | 71.3 | **86.0** |
151
+ | MBPP | **82.3** | 71.9 | 80.2 |
152
+ | MultiPL-E | 63.4 | 48.1 | **69.2** |
153
+ | EvalPlus | 75.2 | 66.9 | **79.0** |
154
+ | LiveCodeBench | 29.3 | 17.9 | **35.7** |
155
+ | _**Mathematics**_ | | | |
156
+ | GSM8K | **93.0** | 82.7 | 91.1 |
157
+ | MATH | 50.4 | 42.5 | **59.7** |
158
+ | _**Chinese**_ | | | |
159
+ | C-Eval | 61.6 | 76.1 | **83.8** |
160
+ | AlignBench | 7.42 | 7.28 | **8.27** |
161
+
162
+ ## Citation
163
+
164
+ If you find our work helpful, feel free to give us a cite.
165
+
166
+ ```
167
+ @article{qwen2,
168
+ title={Qwen2 Technical Report},
169
+ year={2024}
170
+ }
171
+ ```
qwen2-72b-instruct.Q4_0.gguf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e5a632b14bed4f0988e4c3e6ba1ab8b4adc07c8fe2b0958e5793f7f3f105556f
3
+ size 41231735968