Upload README.md
Browse files
README.md
ADDED
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: other
|
3 |
+
language:
|
4 |
+
- en
|
5 |
+
pipeline_tag: text-generation
|
6 |
+
inference: false
|
7 |
+
tags:
|
8 |
+
- transformers
|
9 |
+
- gguf
|
10 |
+
- imatrix
|
11 |
+
- QwQ-32B-Preview
|
12 |
+
---
|
13 |
+
Quantizations of https://huggingface.co/Qwen/QwQ-32B-Preview
|
14 |
+
|
15 |
+
|
16 |
+
### Inference Clients/UIs
|
17 |
+
* [llama.cpp](https://github.com/ggerganov/llama.cpp)
|
18 |
+
* [KoboldCPP](https://github.com/LostRuins/koboldcpp)
|
19 |
+
* [ollama](https://github.com/ollama/ollama)
|
20 |
+
* [jan](https://github.com/janhq/jan)
|
21 |
+
* [text-generation-webui](https://github.com/oobabooga/text-generation-webui)
|
22 |
+
* [GPT4All](https://github.com/nomic-ai/gpt4all)
|
23 |
+
---
|
24 |
+
|
25 |
+
# From original readme
|
26 |
+
|
27 |
+
## Introduction
|
28 |
+
|
29 |
+
**QwQ-32B-Preview** is an experimental research model developed by the Qwen Team, focused on advancing AI reasoning capabilities. As a preview release, it demonstrates promising analytical abilities while having several important limitations:
|
30 |
+
|
31 |
+
1. **Language Mixing and Code-Switching**: The model may mix languages or switch between them unexpectedly, affecting response clarity.
|
32 |
+
2. **Recursive Reasoning Loops**: The model may enter circular reasoning patterns, leading to lengthy responses without a conclusive answer.
|
33 |
+
3. **Safety and Ethical Considerations**: The model requires enhanced safety measures to ensure reliable and secure performance, and users should exercise caution when deploying it.
|
34 |
+
4. **Performance and Benchmark Limitations**: The model excels in math and coding but has room for improvement in other areas, such as common sense reasoning and nuanced language understanding.
|
35 |
+
|
36 |
+
**Specification**:
|
37 |
+
- Type: Causal Language Models
|
38 |
+
- Training Stage: Pretraining & Post-training
|
39 |
+
- Architecture: transformers with RoPE, SwiGLU, RMSNorm, and Attention QKV bias
|
40 |
+
- Number of Parameters: 32.5B
|
41 |
+
- Number of Paramaters (Non-Embedding): 31.0B
|
42 |
+
- Number of Layers: 64
|
43 |
+
- Number of Attention Heads (GQA): 40 for Q and 8 for KV
|
44 |
+
- Context Length: Full 32,768 tokens
|
45 |
+
|
46 |
+
For more details, please refer to our [blog](https://qwenlm.github.io/blog/qwq-32b-preview/). You can also check Qwen2.5 [GitHub](https://github.com/QwenLM/Qwen2.5), and [Documentation](https://qwen.readthedocs.io/en/latest/).
|
47 |
+
|
48 |
+
## Requirements
|
49 |
+
|
50 |
+
The code of Qwen2.5 has been in the latest Hugging face `transformers` and we advise you to use the latest version of `transformers`.
|
51 |
+
|
52 |
+
With `transformers<4.37.0`, you will encounter the following error:
|
53 |
+
```
|
54 |
+
KeyError: 'qwen2'
|
55 |
+
```
|
56 |
+
|
57 |
+
## Quickstart
|
58 |
+
|
59 |
+
Here provides a code snippet with `apply_chat_template` to show you how to load the tokenizer and model and how to generate contents.
|
60 |
+
|
61 |
+
```python
|
62 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
63 |
+
|
64 |
+
model_name = "Qwen/QwQ-32B-Preview"
|
65 |
+
|
66 |
+
model = AutoModelForCausalLM.from_pretrained(
|
67 |
+
model_name,
|
68 |
+
torch_dtype="auto",
|
69 |
+
device_map="auto"
|
70 |
+
)
|
71 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
72 |
+
|
73 |
+
prompt = "How many r in strawberry."
|
74 |
+
messages = [
|
75 |
+
{"role": "system", "content": "You are a helpful and harmless assistant. You are Qwen developed by Alibaba. You should think step-by-step."},
|
76 |
+
{"role": "user", "content": prompt}
|
77 |
+
]
|
78 |
+
text = tokenizer.apply_chat_template(
|
79 |
+
messages,
|
80 |
+
tokenize=False,
|
81 |
+
add_generation_prompt=True
|
82 |
+
)
|
83 |
+
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
|
84 |
+
|
85 |
+
generated_ids = model.generate(
|
86 |
+
**model_inputs,
|
87 |
+
max_new_tokens=512
|
88 |
+
)
|
89 |
+
generated_ids = [
|
90 |
+
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
|
91 |
+
]
|
92 |
+
|
93 |
+
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
94 |
+
```
|