JustinLin610 commited on
Commit
9e961c1
1 Parent(s): c9944b3

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +69 -0
README.md CHANGED
@@ -3,4 +3,73 @@ license: other
3
  license_name: tongyi-qianwen
4
  license_link: >-
5
  https://github.com/QwenLM/Qwen/blob/main/Tongyi%20Qianwen%20LICENSE%20AGREEMENT
 
 
 
 
 
6
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  license_name: tongyi-qianwen
4
  license_link: >-
5
  https://github.com/QwenLM/Qwen/blob/main/Tongyi%20Qianwen%20LICENSE%20AGREEMENT
6
+ language:
7
+ - en
8
+ pipeline_tag: text-generation
9
+ tags:
10
+ - pretrained
11
  ---
12
+
13
+ # Qwen2-beta
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 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_renmote_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
+ ## Requirements
33
+ 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 `KeyError: 'qwen2`.
34
+ <br>
35
+
36
+
37
+ ## Quickstart
38
+
39
+ Here provides a code snippet with `apply_chat_template` to show you how to load the tokenizer and model and how to generate contents.
40
+
41
+ ```python
42
+ from transformers import AutoModelForCausalLM, AutoTokenizer
43
+ device = "cuda" # the device to load the model onto
44
+
45
+ model = AutoModelForCausalLM.from_pretrained("Qwen2/Qwen2-beta-7B-Chat", device_map="auto")
46
+ tokenizer = AutoTokenizer.from_pretrained("Qwen2/Qwen2-beta-7B-Chat")
47
+
48
+ prompt = "Give me a short introduction to large language model."
49
+
50
+ messages = [{"role": "user", "content": prompt}]
51
+
52
+ text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
53
+
54
+ model_inputs = tokenizer([text], return_tensors="pt").to(device)
55
+
56
+ generated_ids = model.generate(model_inputs.input_ids, max_new_tokens=512, do_sample=True)
57
+
58
+ generated_ids = [output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)]
59
+
60
+ response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
61
+ ```
62
+
63
+
64
+ ## Citation
65
+
66
+ If you find our work helpful, feel free to give us a cite.
67
+
68
+ ```
69
+ @article{qwen,
70
+ title={Qwen Technical Report},
71
+ 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},
72
+ journal={arXiv preprint arXiv:2309.16609},
73
+ year={2023}
74
+ }
75
+ ```