JustinLin610
commited on
Commit
•
84bc9af
1
Parent(s):
dac0eeb
Update README.md
Browse files
README.md
CHANGED
@@ -1,5 +1,97 @@
|
|
1 |
---
|
2 |
license: other
|
3 |
license_name: tongyi-qianwen-research
|
4 |
-
license_link:
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
license: other
|
3 |
license_name: tongyi-qianwen-research
|
4 |
+
license_link: >-
|
5 |
+
https://huggingface.co/Qwen/Qwen2-beta-0_5B-Chat/blob/main/LICENSE
|
6 |
+
language:
|
7 |
+
- en
|
8 |
+
pipeline_tag: text-generation
|
9 |
+
tags:
|
10 |
+
- chat
|
11 |
---
|
12 |
+
|
13 |
+
# Qwen2-beta-0.5B-Chat-AWQ
|
14 |
+
|
15 |
+
|
16 |
+
## Introduction
|
17 |
+
|
18 |
+
Qwen2-beta is the beta version of Qwen2, a transformer-based decoder-only language model pretrained on a large amount of data. In comparison with the previous released Qwen, the improvements include:
|
19 |
+
|
20 |
+
* 6 model sizes, including 0.5B, 1.8B, 4B, 7B, 14B, and 72B;
|
21 |
+
* Significant performance improvement in human preference for chat models;
|
22 |
+
* Multilingual support of both base and chat models;
|
23 |
+
* Stable support of 32K context length for models of all sizes
|
24 |
+
* No need of `trust_remote_code`.
|
25 |
+
|
26 |
+
For more details, please refer to our blog post and GitHub repo.
|
27 |
+
<br>
|
28 |
+
|
29 |
+
## Model Details
|
30 |
+
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, mixture of sliding window attention and full attention, etc. Additionally, we have an improved tokenizer adaptive to multiple natural languages and codes. For the beta version, temporarily we did not include GQA and the mixture of SWA and full attention.
|
31 |
+
|
32 |
+
## Training details
|
33 |
+
We pretrained the models with a large amount of data, and we post-trained the models with both supervised finetuning and direct preference optimization. However, DPO leads to improvements in human preference evaluation but degradation in benchmark evaluation. In the very near future, we will fix both problems.
|
34 |
+
|
35 |
+
## Requirements
|
36 |
+
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:
|
37 |
+
```
|
38 |
+
KeyError: 'qwen2'
|
39 |
+
```
|
40 |
+
|
41 |
+
## Quickstart
|
42 |
+
|
43 |
+
Here provides a code snippet with `apply_chat_template` to show you how to load the tokenizer and model and how to generate contents.
|
44 |
+
|
45 |
+
```python
|
46 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
47 |
+
device = "cuda" # the device to load the model onto
|
48 |
+
|
49 |
+
model = AutoModelForCausalLM.from_pretrained(
|
50 |
+
"Qwen/Qwen2-beta-0_5B-Chat-AWQ",
|
51 |
+
device_map="auto"
|
52 |
+
)
|
53 |
+
tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2-beta-0_5B-Chat-AWQ")
|
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 |
+
For quantized models, we advise you to use the GPTQ, AWQ, and GGUF correspondents, namely `Qwen-beta-0_5B-Chat-GPTQ`, `Qwen-beta-0_5B-Chat-AWQ`, and `Qwen-beta-0_5B-Chat-GGUF`.
|
79 |
+
|
80 |
+
|
81 |
+
## Limitations
|
82 |
+
* Reduced capabilities in agent;
|
83 |
+
* Codeswitch sometimes happen. We advise you to use our provided hyperparameters in `generation_config.json`.
|
84 |
+
|
85 |
+
|
86 |
+
## Citation
|
87 |
+
|
88 |
+
If you find our work helpful, feel free to give us a cite.
|
89 |
+
|
90 |
+
```
|
91 |
+
@article{qwen,
|
92 |
+
title={Qwen Technical Report},
|
93 |
+
author={Jinze Bai and Shuai Bai and Yunfei Chu and Zeyu Cui and Kai Dang and Xiaodong Deng and Yang Fan and Wenbin Ge and Yu Han and Fei Huang and Binyuan Hui and Luo Ji and Mei Li and Junyang Lin and Runji Lin and Dayiheng Liu and Gao Liu and Chengqiang Lu and Keming Lu and Jianxin Ma and Rui Men and Xingzhang Ren and Xuancheng Ren and Chuanqi Tan and Sinan Tan and Jianhong Tu and Peng Wang and Shijie Wang and Wei Wang and Shengguang Wu and Benfeng Xu and Jin Xu and An Yang and Hao Yang and Jian Yang and Shusheng Yang and Yang Yao and Bowen Yu and Hongyi Yuan and Zheng Yuan and Jianwei Zhang and Xingxuan Zhang and Yichang Zhang and Zhenru Zhang and Chang Zhou and Jingren Zhou and Xiaohuan Zhou and Tianhang Zhu},
|
94 |
+
journal={arXiv preprint arXiv:2309.16609},
|
95 |
+
year={2023}
|
96 |
+
}
|
97 |
+
```
|