hzhwcmhf commited on
Commit
fbc0ca8
1 Parent(s): d233ae7

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +103 -0
README.md ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ license_link: https://huggingface.co/Qwen/QwQ-32B-Preview/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
+ library_name: transformers
11
+ ---
12
+
13
+ # QwQ-32B-Preview
14
+
15
+ ## Introduction
16
+
17
+ **QwQ-32B-Preview** is an experimental version developed by the Qwen Team as part of our efforts to create a reasoning model. It currently has the following limitations:
18
+
19
+ 1. **Code Switching**: There may be instances of mixed languages in responses.
20
+ 2. **Endless Repetition**: For certain complex logical problems, the model might engage in repetitive reasoning without reaching a answer.
21
+ 3. **Safety Concerns**: The model's safety measures need further enhancement to ensure reliable and secure performance.
22
+ 4. **Performance**: QwQ-32B-preview is just our early experimental version, and it has only been optimized for reasoning tasks such as Code and Math.
23
+
24
+ **Specification**:
25
+ - Type: Causal Language Models
26
+ - Training Stage: Pretraining & Post-training
27
+ - Architecture: transformers with RoPE, SwiGLU, RMSNorm, and Attention QKV bias
28
+ - Number of Parameters: 32.5B
29
+ - Number of Paramaters (Non-Embedding): 31.0B
30
+ - Number of Layers: 64
31
+ - Number of Attention Heads (GQA): 40 for Q and 8 for KV
32
+ - Context Length: Full 32,768 tokens
33
+
34
+ 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/).
35
+
36
+ ## Requirements
37
+
38
+ The code of Qwen2.5 has been in the latest Hugging face `transformers` and we advise you to use the latest version of `transformers`.
39
+
40
+ With `transformers<4.37.0`, you will encounter the following error:
41
+ ```
42
+ KeyError: 'qwen2'
43
+ ```
44
+
45
+ ## Quickstart
46
+
47
+ Here provides a code snippet with `apply_chat_template` to show you how to load the tokenizer and model and how to generate contents.
48
+
49
+ ```python
50
+ from transformers import AutoModelForCausalLM, AutoTokenizer
51
+
52
+ model_name = "Qwen/QwQ-32B-Preview"
53
+
54
+ model = AutoModelForCausalLM.from_pretrained(
55
+ model_name,
56
+ torch_dtype="auto",
57
+ device_map="auto"
58
+ )
59
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
60
+
61
+ prompt = "How many r in strawberry."
62
+ messages = [
63
+ {"role": "system", "content": "You are a helpful and harmless assistant. You are Qwen developed by Alibaba. You should think step-by-step."},
64
+ {"role": "user", "content": prompt}
65
+ ]
66
+ text = tokenizer.apply_chat_template(
67
+ messages,
68
+ tokenize=False,
69
+ add_generation_prompt=True
70
+ )
71
+ model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
72
+
73
+ generated_ids = model.generate(
74
+ **model_inputs,
75
+ max_new_tokens=512
76
+ )
77
+ generated_ids = [
78
+ output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
79
+ ]
80
+
81
+ response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
82
+ ```
83
+
84
+ ## Citation
85
+
86
+ If you find our work helpful, feel free to give us a cite.
87
+
88
+ ```
89
+ @misc{qwq-32b-preview,
90
+ title = {QwQ: Reflect Deeply on the Boundaries of the Unknown},
91
+ url = {https://qwenlm.github.io/blog/qwq-32b-preview/},
92
+ author = {Qwen Team},
93
+ month = {November},
94
+ year = {2024}
95
+ }
96
+
97
+ @article{qwen2,
98
+ title={Qwen2 Technical Report},
99
+ 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},
100
+ journal={arXiv preprint arXiv:2407.10671},
101
+ year={2024}
102
+ }
103
+ ```