RichardErkhov
commited on
Commit
•
947580e
1
Parent(s):
aeec0a0
uploaded readme
Browse files
README.md
ADDED
@@ -0,0 +1,122 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
Quantization made by Richard Erkhov.
|
2 |
+
|
3 |
+
[Github](https://github.com/RichardErkhov)
|
4 |
+
|
5 |
+
[Discord](https://discord.gg/pvy7H8DZMG)
|
6 |
+
|
7 |
+
[Request more models](https://github.com/RichardErkhov/quant_request)
|
8 |
+
|
9 |
+
|
10 |
+
Qwen1.5-MoE-A2.7B-Chat - GGUF
|
11 |
+
- Model creator: https://huggingface.co/Qwen/
|
12 |
+
- Original model: https://huggingface.co/Qwen/Qwen1.5-MoE-A2.7B-Chat/
|
13 |
+
|
14 |
+
|
15 |
+
| Name | Quant method | Size |
|
16 |
+
| ---- | ---- | ---- |
|
17 |
+
| [Qwen1.5-MoE-A2.7B-Chat.Q2_K.gguf](https://huggingface.co/RichardErkhov/Qwen_-_Qwen1.5-MoE-A2.7B-Chat-gguf/blob/main/Qwen1.5-MoE-A2.7B-Chat.Q2_K.gguf) | Q2_K | 5.49GB |
|
18 |
+
| [Qwen1.5-MoE-A2.7B-Chat.IQ3_XS.gguf](https://huggingface.co/RichardErkhov/Qwen_-_Qwen1.5-MoE-A2.7B-Chat-gguf/blob/main/Qwen1.5-MoE-A2.7B-Chat.IQ3_XS.gguf) | IQ3_XS | 6.07GB |
|
19 |
+
| [Qwen1.5-MoE-A2.7B-Chat.IQ3_S.gguf](https://huggingface.co/RichardErkhov/Qwen_-_Qwen1.5-MoE-A2.7B-Chat-gguf/blob/main/Qwen1.5-MoE-A2.7B-Chat.IQ3_S.gguf) | IQ3_S | 6.37GB |
|
20 |
+
| [Qwen1.5-MoE-A2.7B-Chat.Q3_K_S.gguf](https://huggingface.co/RichardErkhov/Qwen_-_Qwen1.5-MoE-A2.7B-Chat-gguf/blob/main/Qwen1.5-MoE-A2.7B-Chat.Q3_K_S.gguf) | Q3_K_S | 6.37GB |
|
21 |
+
| [Qwen1.5-MoE-A2.7B-Chat.IQ3_M.gguf](https://huggingface.co/RichardErkhov/Qwen_-_Qwen1.5-MoE-A2.7B-Chat-gguf/blob/main/Qwen1.5-MoE-A2.7B-Chat.IQ3_M.gguf) | IQ3_M | 6.46GB |
|
22 |
+
| [Qwen1.5-MoE-A2.7B-Chat.Q3_K.gguf](https://huggingface.co/RichardErkhov/Qwen_-_Qwen1.5-MoE-A2.7B-Chat-gguf/blob/main/Qwen1.5-MoE-A2.7B-Chat.Q3_K.gguf) | Q3_K | 6.93GB |
|
23 |
+
| [Qwen1.5-MoE-A2.7B-Chat.Q3_K_M.gguf](https://huggingface.co/RichardErkhov/Qwen_-_Qwen1.5-MoE-A2.7B-Chat-gguf/blob/main/Qwen1.5-MoE-A2.7B-Chat.Q3_K_M.gguf) | Q3_K_M | 6.93GB |
|
24 |
+
| [Qwen1.5-MoE-A2.7B-Chat.Q3_K_L.gguf](https://huggingface.co/RichardErkhov/Qwen_-_Qwen1.5-MoE-A2.7B-Chat-gguf/blob/main/Qwen1.5-MoE-A2.7B-Chat.Q3_K_L.gguf) | Q3_K_L | 7.21GB |
|
25 |
+
| [Qwen1.5-MoE-A2.7B-Chat.IQ4_XS.gguf](https://huggingface.co/RichardErkhov/Qwen_-_Qwen1.5-MoE-A2.7B-Chat-gguf/blob/main/Qwen1.5-MoE-A2.7B-Chat.IQ4_XS.gguf) | IQ4_XS | 7.4GB |
|
26 |
+
| [Qwen1.5-MoE-A2.7B-Chat.Q4_0.gguf](https://huggingface.co/RichardErkhov/Qwen_-_Qwen1.5-MoE-A2.7B-Chat-gguf/blob/main/Qwen1.5-MoE-A2.7B-Chat.Q4_0.gguf) | Q4_0 | 7.59GB |
|
27 |
+
| [Qwen1.5-MoE-A2.7B-Chat.IQ4_NL.gguf](https://huggingface.co/RichardErkhov/Qwen_-_Qwen1.5-MoE-A2.7B-Chat-gguf/blob/main/Qwen1.5-MoE-A2.7B-Chat.IQ4_NL.gguf) | IQ4_NL | 7.68GB |
|
28 |
+
| [Qwen1.5-MoE-A2.7B-Chat.Q4_K_S.gguf](https://huggingface.co/RichardErkhov/Qwen_-_Qwen1.5-MoE-A2.7B-Chat-gguf/blob/main/Qwen1.5-MoE-A2.7B-Chat.Q4_K_S.gguf) | Q4_K_S | 8.11GB |
|
29 |
+
| [Qwen1.5-MoE-A2.7B-Chat.Q4_K.gguf](https://huggingface.co/RichardErkhov/Qwen_-_Qwen1.5-MoE-A2.7B-Chat-gguf/blob/main/Qwen1.5-MoE-A2.7B-Chat.Q4_K.gguf) | Q4_K | 8.84GB |
|
30 |
+
| [Qwen1.5-MoE-A2.7B-Chat.Q4_K_M.gguf](https://huggingface.co/RichardErkhov/Qwen_-_Qwen1.5-MoE-A2.7B-Chat-gguf/blob/main/Qwen1.5-MoE-A2.7B-Chat.Q4_K_M.gguf) | Q4_K_M | 8.84GB |
|
31 |
+
| [Qwen1.5-MoE-A2.7B-Chat.Q4_1.gguf](https://huggingface.co/RichardErkhov/Qwen_-_Qwen1.5-MoE-A2.7B-Chat-gguf/blob/main/Qwen1.5-MoE-A2.7B-Chat.Q4_1.gguf) | Q4_1 | 8.41GB |
|
32 |
+
| [Qwen1.5-MoE-A2.7B-Chat.Q5_0.gguf](https://huggingface.co/RichardErkhov/Qwen_-_Qwen1.5-MoE-A2.7B-Chat-gguf/blob/main/Qwen1.5-MoE-A2.7B-Chat.Q5_0.gguf) | Q5_0 | 9.22GB |
|
33 |
+
| [Qwen1.5-MoE-A2.7B-Chat.Q5_K_S.gguf](https://huggingface.co/RichardErkhov/Qwen_-_Qwen1.5-MoE-A2.7B-Chat-gguf/blob/main/Qwen1.5-MoE-A2.7B-Chat.Q5_K_S.gguf) | Q5_K_S | 9.46GB |
|
34 |
+
| [Qwen1.5-MoE-A2.7B-Chat.Q5_K.gguf](https://huggingface.co/RichardErkhov/Qwen_-_Qwen1.5-MoE-A2.7B-Chat-gguf/blob/main/Qwen1.5-MoE-A2.7B-Chat.Q5_K.gguf) | Q5_K | 10.09GB |
|
35 |
+
| [Qwen1.5-MoE-A2.7B-Chat.Q5_K_M.gguf](https://huggingface.co/RichardErkhov/Qwen_-_Qwen1.5-MoE-A2.7B-Chat-gguf/blob/main/Qwen1.5-MoE-A2.7B-Chat.Q5_K_M.gguf) | Q5_K_M | 10.09GB |
|
36 |
+
| [Qwen1.5-MoE-A2.7B-Chat.Q5_1.gguf](https://huggingface.co/RichardErkhov/Qwen_-_Qwen1.5-MoE-A2.7B-Chat-gguf/blob/main/Qwen1.5-MoE-A2.7B-Chat.Q5_1.gguf) | Q5_1 | 10.04GB |
|
37 |
+
| [Qwen1.5-MoE-A2.7B-Chat.Q6_K.gguf](https://huggingface.co/RichardErkhov/Qwen_-_Qwen1.5-MoE-A2.7B-Chat-gguf/blob/main/Qwen1.5-MoE-A2.7B-Chat.Q6_K.gguf) | Q6_K | 11.89GB |
|
38 |
+
| [Qwen1.5-MoE-A2.7B-Chat.Q8_0.gguf](https://huggingface.co/RichardErkhov/Qwen_-_Qwen1.5-MoE-A2.7B-Chat-gguf/blob/main/Qwen1.5-MoE-A2.7B-Chat.Q8_0.gguf) | Q8_0 | 14.18GB |
|
39 |
+
|
40 |
+
|
41 |
+
|
42 |
+
|
43 |
+
Original model description:
|
44 |
+
---
|
45 |
+
license: other
|
46 |
+
license_name: tongyi-qianwen
|
47 |
+
license_link: >-
|
48 |
+
https://huggingface.co/Qwen/Qwen1.5-MoE-A2.7B-Chat/blob/main/LICENSE
|
49 |
+
language:
|
50 |
+
- en
|
51 |
+
pipeline_tag: text-generation
|
52 |
+
tags:
|
53 |
+
- chat
|
54 |
+
---
|
55 |
+
|
56 |
+
# Qwen1.5-MoE-A2.7B-Chat
|
57 |
+
|
58 |
+
|
59 |
+
## Introduction
|
60 |
+
|
61 |
+
Qwen1.5-MoE is a transformer-based MoE decoder-only language model pretrained on a large amount of data.
|
62 |
+
|
63 |
+
For more details, please refer to our [blog post](https://qwenlm.github.io/blog/qwen-moe/) and [GitHub repo](https://github.com/QwenLM/Qwen1.5).
|
64 |
+
|
65 |
+
## Model Details
|
66 |
+
Qwen1.5-MoE employs Mixture of Experts (MoE) architecture, where the models are upcycled from dense language models. For instance, `Qwen1.5-MoE-A2.7B` is upcycled from `Qwen-1.8B`. It has 14.3B parameters in total and 2.7B activated parameters during runtime, while achieching comparable performance to `Qwen1.5-7B`, it only requires 25% of the training resources. We also observed that the inference speed is 1.74 times that of `Qwen1.5-7B`.
|
67 |
+
|
68 |
+
## Training details
|
69 |
+
We pretrained the models with a large amount of data, and we post-trained the models with both supervised finetuning and direct preference optimization.
|
70 |
+
|
71 |
+
## Requirements
|
72 |
+
The code of Qwen1.5-MoE has been in the latest Hugging face transformers and we advise you to build from source with command `pip install git+https://github.com/huggingface/transformers`, or you might encounter the following error:
|
73 |
+
```
|
74 |
+
KeyError: 'qwen2_moe'.
|
75 |
+
```
|
76 |
+
|
77 |
+
## Quickstart
|
78 |
+
|
79 |
+
Here provides a code snippet with `apply_chat_template` to show you how to load the tokenizer and model and how to generate contents.
|
80 |
+
|
81 |
+
```python
|
82 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
83 |
+
device = "cuda" # the device to load the model onto
|
84 |
+
|
85 |
+
model = AutoModelForCausalLM.from_pretrained(
|
86 |
+
"Qwen/Qwen1.5-MoE-A2.7B-Chat",
|
87 |
+
torch_dtype="auto",
|
88 |
+
device_map="auto"
|
89 |
+
)
|
90 |
+
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen1.5-MoE-A2.7B-Chat")
|
91 |
+
|
92 |
+
prompt = "Give me a short introduction to large language model."
|
93 |
+
messages = [
|
94 |
+
{"role": "system", "content": "You are a helpful assistant."},
|
95 |
+
{"role": "user", "content": prompt}
|
96 |
+
]
|
97 |
+
text = tokenizer.apply_chat_template(
|
98 |
+
messages,
|
99 |
+
tokenize=False,
|
100 |
+
add_generation_prompt=True
|
101 |
+
)
|
102 |
+
model_inputs = tokenizer([text], return_tensors="pt").to(device)
|
103 |
+
|
104 |
+
generated_ids = model.generate(
|
105 |
+
model_inputs.input_ids,
|
106 |
+
max_new_tokens=512
|
107 |
+
)
|
108 |
+
generated_ids = [
|
109 |
+
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
|
110 |
+
]
|
111 |
+
|
112 |
+
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
113 |
+
```
|
114 |
+
|
115 |
+
For quantized models, we advise you to use the GPTQ correspondents, namely `Qwen1.5-MoE-A2.7B-Chat-GPTQ-Int4`.
|
116 |
+
|
117 |
+
|
118 |
+
## Tips
|
119 |
+
|
120 |
+
* If you encounter code switching or other bad cases, we advise you to use our provided hyper-parameters in `generation_config.json`.
|
121 |
+
*
|
122 |
+
|