JustinLin610 commited on
Commit
29245ca
1 Parent(s): ae56217

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +90 -1
README.md CHANGED
@@ -1,5 +1,94 @@
1
  ---
2
  license: other
3
  license_name: tongyi-qianwen
4
- license_link: LICENSE
 
 
 
 
 
 
5
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: other
3
  license_name: tongyi-qianwen
4
+ license_link: >-
5
+ https://huggingface.co/Qwen/CodeQwen1.5-7B-Chat/blob/main/LICENSE
6
+ language:
7
+ - en
8
+ pipeline_tag: text-generation
9
+ tags:
10
+ - chat
11
  ---
12
+
13
+ # CodeQwen1.5-7B-Chat
14
+
15
+
16
+ ## Introduction
17
+
18
+ CodeQwen1.5 is the Code-Specific version of Qwen1.5. It is a transformer-based decoder-only language model pretrained on a large amount of data of codes.
19
+
20
+ * Strong code generation capabilities and competitve performance across a series of benchmarks;
21
+ * Supporting long context understanding and generation with the context length of 64K tokens;
22
+ * Supporting 92 coding languages
23
+ * Excellent performance on text-to-SQL, bug fix, etc.
24
+
25
+
26
+ For more details, please refer to our [blog post](https://qwenlm.github.io/blog/codeqwen1.5/) and [GitHub repo](https://github.com/QwenLM/Qwen1.5).
27
+
28
+ ## Model Details
29
+ CodeQwen1.5 is based on Qwen1.5, a language model series including decoder language models of different model sizes. It is trained on 3 trillion tokens of data of codes, and it includes group query attention (GQA) for efficient inference.
30
+
31
+
32
+ ## Requirements
33
+ The code of Qwen1.5 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:
34
+ ```
35
+ KeyError: 'qwen2'.
36
+ ```
37
+
38
+ ## Quickstart
39
+
40
+ Here provides a code snippet with `apply_chat_template` to show you how to load the tokenizer and model and how to generate contents.
41
+
42
+ ```python
43
+ from transformers import AutoModelForCausalLM, AutoTokenizer
44
+ device = "cuda" # the device to load the model onto
45
+
46
+ model = AutoModelForCausalLM.from_pretrained(
47
+ "Qwen/CodeQwen1.5-7B-Chat",
48
+ torch_dtype="auto",
49
+ device_map="auto"
50
+ )
51
+ tokenizer = AutoTokenizer.from_pretrained("Qwen/CodeQwen1.5-7B-Chat")
52
+
53
+ prompt = "Write a quicksort algorithm in python."
54
+ messages = [
55
+ {"role": "system", "content": "You are a helpful assistant."},
56
+ {"role": "user", "content": prompt}
57
+ ]
58
+ text = tokenizer.apply_chat_template(
59
+ messages,
60
+ tokenize=False,
61
+ add_generation_prompt=True
62
+ )
63
+ model_inputs = tokenizer([text], return_tensors="pt").to(device)
64
+
65
+ generated_ids = model.generate(
66
+ model_inputs.input_ids,
67
+ max_new_tokens=512
68
+ )
69
+ generated_ids = [
70
+ output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
71
+ ]
72
+
73
+ response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
74
+ ```
75
+
76
+
77
+
78
+ ## Tips
79
+
80
+ * If you encounter code switching or other bad cases, we advise you to use our provided hyper-parameters in `generation_config.json`.
81
+
82
+
83
+ ## Citation
84
+
85
+ If you find our work helpful, feel free to give us a cite.
86
+
87
+ ```
88
+ @article{qwen,
89
+ title={Qwen Technical Report},
90
+ 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},
91
+ journal={arXiv preprint arXiv:2309.16609},
92
+ year={2023}
93
+ }
94
+ ```