aashish1904 commited on
Commit
66bf1b1
1 Parent(s): 3a1c03a

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +149 -0
README.md ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ ---
3
+
4
+ license: apache-2.0
5
+ license_link: https://huggingface.co/Qwen/Qwen2.5-Coder-7B-Instruct/blob/main/LICENSE
6
+ language:
7
+ - en
8
+ base_model:
9
+ - Qwen/Qwen2.5-Coder-7B
10
+ pipeline_tag: text-generation
11
+ library_name: transformers
12
+ tags:
13
+ - code
14
+ - codeqwen
15
+ - chat
16
+ - qwen
17
+ - qwen-coder
18
+
19
+ ---
20
+
21
+ [![QuantFactory Banner](https://lh7-rt.googleusercontent.com/docsz/AD_4nXeiuCm7c8lEwEJuRey9kiVZsRn2W-b4pWlu3-X534V3YmVuVc2ZL-NXg2RkzSOOS2JXGHutDuyyNAUtdJI65jGTo8jT9Y99tMi4H4MqL44Uc5QKG77B0d6-JfIkZHFaUA71-RtjyYZWVIhqsNZcx8-OMaA?key=xt3VSDoCbmTY7o-cwwOFwQ)](https://hf.co/QuantFactory)
22
+
23
+
24
+ # QuantFactory/Qwen2.5-Coder-7B-Instruct-GGUF
25
+ This is quantized version of [Qwen/Qwen2.5-Coder-7B-Instruct](https://huggingface.co/Qwen/Qwen2.5-Coder-7B-Instruct) created using llama.cpp
26
+
27
+ # Original Model Card
28
+
29
+
30
+
31
+ # Qwen2.5-Coder-7B-Instruct
32
+
33
+ ## Introduction
34
+
35
+ Qwen2.5-Coder is the latest series of Code-Specific Qwen large language models (formerly known as CodeQwen). For Qwen2.5-Coder, we release three base language models and instruction-tuned language models, 1.5, 7 and 32 (coming soon) billion parameters. Qwen2.5-Coder brings the following improvements upon CodeQwen1.5:
36
+
37
+ - Significantly improvements in **code generation**, **code reasoning** and **code fixing**. Base on the strong Qwen2.5, we scale up the training tokens into 5.5 trillion including source code, text-code grounding, Synthetic data, etc.
38
+ - A more comprehensive foundation for real-world applications such as **Code Agents**. Not only enhancing coding capabilities but also maintaining its strengths in mathematics and general competencies.
39
+ - **Long-context Support** up to 128K tokens.
40
+
41
+ **This repo contains the instruction-tuned 7B Qwen2.5-Coder model**, which has the following features:
42
+ - Type: Causal Language Models
43
+ - Training Stage: Pretraining & Post-training
44
+ - Architecture: transformers with RoPE, SwiGLU, RMSNorm, and Attention QKV bias
45
+ - Number of Parameters: 7.61B
46
+ - Number of Paramaters (Non-Embedding): 6.53B
47
+ - Number of Layers: 28
48
+ - Number of Attention Heads (GQA): 28 for Q and 4 for KV
49
+ - Context Length: Full 131,072 tokens
50
+ - Please refer to [this section](#processing-long-texts) for detailed instructions on how to deploy Qwen2.5 for handling long texts.
51
+
52
+ For more details, please refer to our [blog](https://qwenlm.github.io/blog/qwen2.5-coder/), [GitHub](https://github.com/QwenLM/Qwen2.5-Coder), and [Documentation](https://qwen.readthedocs.io/en/latest/).
53
+
54
+ ## Requirements
55
+
56
+ The code of Qwen2.5-Coder has been in the latest Hugging face `transformers` and we advise you to use the latest version of `transformers`.
57
+
58
+ With `transformers<4.37.0`, you will encounter the following error:
59
+ ```
60
+ KeyError: 'qwen2'
61
+ ```
62
+
63
+ ## Quickstart
64
+
65
+ Here provides a code snippet with `apply_chat_template` to show you how to load the tokenizer and model and how to generate contents.
66
+
67
+ ```python
68
+ from transformers import AutoModelForCausalLM, AutoTokenizer
69
+
70
+ model_name = "Qwen/Qwen2.5-Coder-7B-Instruct"
71
+
72
+ model = AutoModelForCausalLM.from_pretrained(
73
+ model_name,
74
+ torch_dtype="auto",
75
+ device_map="auto"
76
+ )
77
+ tokenizer = AutoTokenizer.from_pretrained(model_name)
78
+
79
+ prompt = "write a quick sort algorithm."
80
+ messages = [
81
+ {"role": "system", "content": "You are Qwen, created by Alibaba Cloud. You are a helpful assistant."},
82
+ {"role": "user", "content": prompt}
83
+ ]
84
+ text = tokenizer.apply_chat_template(
85
+ messages,
86
+ tokenize=False,
87
+ add_generation_prompt=True
88
+ )
89
+ model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
90
+
91
+ generated_ids = model.generate(
92
+ **model_inputs,
93
+ max_new_tokens=512
94
+ )
95
+ generated_ids = [
96
+ output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
97
+ ]
98
+
99
+ response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
100
+ ```
101
+
102
+ ### Processing Long Texts
103
+
104
+ The current `config.json` is set for context length up to 32,768 tokens.
105
+ To handle extensive inputs exceeding 32,768 tokens, we utilize [YaRN](https://arxiv.org/abs/2309.00071), a technique for enhancing model length extrapolation, ensuring optimal performance on lengthy texts.
106
+
107
+ For supported frameworks, you could add the following to `config.json` to enable YaRN:
108
+ ```json
109
+ {
110
+ ...,
111
+ "rope_scaling": {
112
+ "factor": 4.0,
113
+ "original_max_position_embeddings": 32768,
114
+ "type": "yarn"
115
+ }
116
+ }
117
+ ```
118
+
119
+ For deployment, we recommend using vLLM.
120
+ Please refer to our [Documentation](https://qwen.readthedocs.io/en/latest/deployment/vllm.html) for usage if you are not familar with vLLM.
121
+ Presently, vLLM only supports static YARN, which means the scaling factor remains constant regardless of input length, **potentially impacting performance on shorter texts**.
122
+ We advise adding the `rope_scaling` configuration only when processing long contexts is required.
123
+
124
+ ## Evaluation & Performance
125
+
126
+ Detailed evaluation results are reported in this [📑 blog](https://qwenlm.github.io/blog/qwen2.5-coder/).
127
+
128
+ For requirements on GPU memory and the respective throughput, see results [here](https://qwen.readthedocs.io/en/latest/benchmark/speed_benchmark.html).
129
+
130
+ ## Citation
131
+
132
+ If you find our work helpful, feel free to give us a cite.
133
+
134
+ ```
135
+ @misc{qwen2.5,
136
+ title = {Qwen2.5: A Party of Foundation Models},
137
+ url = {https://qwenlm.github.io/blog/qwen2.5/},
138
+ author = {Qwen Team},
139
+ month = {September},
140
+ year = {2024}
141
+ }
142
+ @article{qwen2,
143
+ title={Qwen2 Technical Report},
144
+ 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},
145
+ journal={arXiv preprint arXiv:2407.10671},
146
+ year={2024}
147
+ }
148
+ ```
149
+