ChangshiLi commited on
Commit
7743421
·
verified ·
1 Parent(s): 1aff020

initial readme

Browse files
Files changed (1) hide show
  1. README.md +150 -130
README.md CHANGED
@@ -1,138 +1,158 @@
1
- ---
2
- license: apache-2.0
3
- license_link: https://huggingface.co/Qwen/Qwen2.5-Coder-32B-Instruct/blob/main/LICENSE
4
- language:
5
- - en
6
- base_model:
7
- - Qwen/Qwen2.5-Coder-32B
8
- pipeline_tag: text-generation
9
- library_name: transformers
10
- tags:
11
- - code
12
- - codeqwen
13
- - chat
14
- - qwen
15
- - qwen-coder
16
- ---
17
-
18
-
19
- # Qwen2.5-Coder-32B-Instruct
20
- <a href="https://chat.qwenlm.ai/" target="_blank" style="margin: 2px;">
21
- <img alt="Chat" src="https://img.shields.io/badge/%F0%9F%92%9C%EF%B8%8F%20Qwen%20Chat%20-536af5" style="display: inline-block; vertical-align: middle;"/>
22
- </a>
23
-
24
- ## Introduction
25
-
26
- Qwen2.5-Coder is the latest series of Code-Specific Qwen large language models (formerly known as CodeQwen). As of now, Qwen2.5-Coder has covered six mainstream model sizes, 0.5, 1.5, 3, 7, 14, 32 billion parameters, to meet the needs of different developers. Qwen2.5-Coder brings the following improvements upon CodeQwen1.5:
27
-
28
- - 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. Qwen2.5-Coder-32B has become the current state-of-the-art open-source codeLLM, with its coding abilities matching those of GPT-4o.
29
- - 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.
30
- - **Long-context Support** up to 128K tokens.
31
-
32
- **This repo contains the instruction-tuned 32B Qwen2.5-Coder model**, which has the following features:
33
- - Type: Causal Language Models
34
- - Training Stage: Pretraining & Post-training
35
- - Architecture: transformers with RoPE, SwiGLU, RMSNorm, and Attention QKV bias
36
- - Number of Parameters: 32.5B
37
- - Number of Paramaters (Non-Embedding): 31.0B
38
- - Number of Layers: 64
39
- - Number of Attention Heads (GQA): 40 for Q and 8 for KV
40
- - Context Length: Full 131,072 tokens
41
- - Please refer to [this section](#processing-long-texts) for detailed instructions on how to deploy Qwen2.5 for handling long texts.
42
-
43
- For more details, please refer to our [blog](https://qwenlm.github.io/blog/qwen2.5-coder-family/), [GitHub](https://github.com/QwenLM/Qwen2.5-Coder), [Documentation](https://qwen.readthedocs.io/en/latest/), [Arxiv](https://arxiv.org/abs/2409.12186).
44
-
45
- ## Requirements
46
-
47
- 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`.
48
-
49
- With `transformers<4.37.0`, you will encounter the following error:
50
- ```
51
- KeyError: 'qwen2'
52
- ```
53
-
54
- ## Quickstart
55
-
56
- Here provides a code snippet with `apply_chat_template` to show you how to load the tokenizer and model and how to generate contents.
57
-
58
- ```python
59
- from transformers import AutoModelForCausalLM, AutoTokenizer
60
-
61
- model_name = "Qwen/Qwen2.5-Coder-32B-Instruct"
62
-
63
- model = AutoModelForCausalLM.from_pretrained(
64
- model_name,
65
- torch_dtype="auto",
66
- device_map="auto"
67
- )
68
- tokenizer = AutoTokenizer.from_pretrained(model_name)
69
-
70
- prompt = "write a quick sort algorithm."
71
- messages = [
72
- {"role": "system", "content": "You are Qwen, created by Alibaba Cloud. You are a helpful assistant."},
73
- {"role": "user", "content": prompt}
74
- ]
75
- text = tokenizer.apply_chat_template(
76
- messages,
77
- tokenize=False,
78
- add_generation_prompt=True
79
- )
80
- model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
81
-
82
- generated_ids = model.generate(
83
- **model_inputs,
84
- max_new_tokens=512
85
- )
86
- generated_ids = [
87
- output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
88
- ]
89
-
90
- response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
91
- ```
92
-
93
- ### Processing Long Texts
94
-
95
- The current `config.json` is set for context length up to 32,768 tokens.
96
- 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.
97
-
98
- For supported frameworks, you could add the following to `config.json` to enable YaRN:
99
- ```json
100
- {
101
- ...,
102
- "rope_scaling": {
103
- "factor": 4.0,
104
- "original_max_position_embeddings": 32768,
105
- "type": "yarn"
106
- }
107
- }
108
  ```
109
 
110
- For deployment, we recommend using vLLM.
111
- Please refer to our [Documentation](https://qwen.readthedocs.io/en/latest/deployment/vllm.html) for usage if you are not familar with vLLM.
112
- Presently, vLLM only supports static YARN, which means the scaling factor remains constant regardless of input length, **potentially impacting performance on shorter texts**.
113
- We advise adding the `rope_scaling` configuration only when processing long contexts is required.
114
 
115
- ## Evaluation & Performance
116
 
117
- Detailed evaluation results are reported in this [📑 blog](https://qwenlm.github.io/blog/qwen2.5-coder-family/).
 
 
 
 
 
 
 
 
118
 
119
- For requirements on GPU memory and the respective throughput, see results [here](https://qwen.readthedocs.io/en/latest/benchmark/speed_benchmark.html).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
 
121
- ## Citation
 
 
 
 
 
 
 
 
 
 
 
122
 
123
- If you find our work helpful, feel free to give us a cite.
124
-
125
- ```
126
- @article{hui2024qwen2,
127
- title={Qwen2. 5-Coder Technical Report},
128
- author={Hui, Binyuan and Yang, Jian and Cui, Zeyu and Yang, Jiaxi and Liu, Dayiheng and Zhang, Lei and Liu, Tianyu and Zhang, Jiajun and Yu, Bowen and Dang, Kai and others},
129
- journal={arXiv preprint arXiv:2409.12186},
130
- year={2024}
131
- }
132
- @article{qwen2,
133
- title={Qwen2 Technical Report},
134
- 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},
135
- journal={arXiv preprint arXiv:2407.10671},
136
- year={2024}
137
- }
 
 
138
  ```
 
1
+ # Skywork-SWE
2
+
3
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/6665dd2b3a64c70529f7542c/KJezzkcswgRQDkC9MvKXg.png)
4
+
5
+ 📖 [Report]() 📰 [Blog](https://quixotic-sting-239.notion.site/eb17f379610040ceb54da5d5d24065bd)
6
+
7
+ ## Model Introduction
8
+ ***Skywork-SWE-32B*** is a code agent model specifically designed for software engineering (SWE) tasks developed by [Skywork.AI](https://skywork.ai/home). It achieves state-of-the-art performance across several key metrics:
9
+ - Skywork-SWE-32B attains 38.0% pass@1 accuracy on the [SWE-bench Verified](https://huggingface.co/datasets/princeton-nlp/SWE-bench_Verified) benchmark, outperforming previous open-source SOTA [Qwen2.5-Coder-32B-based](https://huggingface.co/Qwen/Qwen2.5-Coder-32B) LLMs built on the [OpenHands](https://www.all-hands.dev/) agent framework.
10
+ - When incorporated with test-time scaling techniques, the performance further improves to 47.0% pass@1 accuracy, surpassing the previous SoTA results for sub-32B parameter models.
11
+ - We clearly demonstrate the data scaling law phenomenon for software engineering capabilities in LLMs, with no signs of saturation at 8209 collected training trajectories.
12
+
13
+ We also introduce an efficient and automated pipeline for SWE data collection, culminating in the creation of the Skywork-SWE dataset---a large-scale, high-quality dataset featuring comprehensive executable runtime environments. Detailed descriptions are available on [arXiv](https://xxx).
14
+ ### 🔧 Model Details
15
+
16
+ | Model Name | Backbone LLM | HuggingFace Link | Technology Report | Blog |
17
+ |---|---------------|-----------|-|-|
18
+ |Skywork-SWE-32B | [🤗 Qwen2.5-Coder-32B-Instruct](https://huggingface.co/Qwen/Qwen2.5-Coder-32B-Instruct) | [🤗 Skywork-SWE-32B](https://huggingface.co/Skywork/Skywork-SWE-32B) | [arXiv]() | [blog]()|
19
+
20
+ ## Evaluation
21
+
22
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/6665dd2b3a64c70529f7542c/_ywqwtZYRcNO4jvYLb6dp.png)
23
+
24
+ Data Scaling Law for Pass@1 Accuracy on Qwen2.5-Coder-32B-Based LLMs Using the OpenHands v0.32.0 Code Agent Framework. Skywork-SWE-32B establishes a new state-of-the-art (SoTA) among the Qwen2.5-Coder-32B-based LLM, achieving the highest pass@1 accuracy without using verifiers or multiple rollouts.
25
+
26
+ ![image/png](https://cdn-uploads.huggingface.co/production/uploads/6665dd2b3a64c70529f7542c/K70TVU8eeRrFPf3tArIao.png)
27
+
28
+ With the incorporation of test-time scaling techniques, Skywork-SWE-32B further improves to 47.0% pass@1 accuracy, surpassing the previous SoTA results for sub-32B parameter models.
29
+
30
+ ## Performance Summary
31
+ - Skywork-SWE-32B:
32
+ ```
33
+ Submission summary on SWE-bench verified split
34
+ ==================================================
35
+ Resolved 190 instances (38.0%)
36
+ ==================================================
37
+ Resolved by Repository
38
+ - astropy/astropy: 4/22 (18.18%)
39
+ - django/django: 99/231 (42.86%)
40
+ - matplotlib/matplotlib: 9/34 (26.47%)
41
+ - mwaskom/seaborn: 0/2 (0.0%)
42
+ - pallets/flask: 1/1 (100.0%)
43
+ - psf/requests: 4/8 (50.0%)
44
+ - pydata/xarray: 7/22 (31.82%)
45
+ - pylint-dev/pylint: 2/10 (20.0%)
46
+ - pytest-dev/pytest: 9/19 (47.37%)
47
+ - scikit-learn/scikit-learn: 17/32 (53.12%)
48
+ - sphinx-doc/sphinx: 13/44 (29.55%)
49
+ - sympy/sympy: 25/75 (33.33%)
50
+ ==================================================
51
+ Resolved by Time
52
+ - 2013: 2/3 (66.67%)
53
+ - 2014: 2/2 (100.0%)
54
+ - 2015: 0/1 (0.0%)
55
+ - 2016: 2/2 (100.0%)
56
+ - 2017: 5/16 (31.25%)
57
+ - 2018: 7/24 (29.17%)
58
+ - 2019: 46/98 (46.94%)
59
+ - 2020: 43/108 (39.81%)
60
+ - 2021: 27/86 (31.4%)
61
+ - 2022: 35/102 (34.31%)
62
+ - 2023: 21/58 (36.21%)
63
+ ```
64
+ - Skywork-SWE-32B + TTS:
65
+ ```
66
+ Submission summary on SWE-bench verified split
67
+ ==================================================
68
+ Resolved 235 instances (47.0%)
69
+ ==================================================
70
+ Resolved by Repository
71
+ - astropy/astropy: 8/22 (36.36%)
72
+ - django/django: 115/231 (49.78%)
73
+ - matplotlib/matplotlib: 15/34 (44.12%)
74
+ - mwaskom/seaborn: 0/2 (0.0%)
75
+ - pallets/flask: 1/1 (100.0%)
76
+ - psf/requests: 3/8 (37.5%)
77
+ - pydata/xarray: 14/22 (63.64%)
78
+ - pylint-dev/pylint: 4/10 (40.0%)
79
+ - pytest-dev/pytest: 10/19 (52.63%)
80
+ - scikit-learn/scikit-learn: 22/32 (68.75%)
81
+ - sphinx-doc/sphinx: 12/44 (27.27%)
82
+ - sympy/sympy: 31/75 (41.33%)
83
+ ==================================================
84
+ Resolved by Time
85
+ - 2013: 1/3 (33.33%)
86
+ - 2014: 1/2 (50.0%)
87
+ - 2015: 0/1 (0.0%)
88
+ - 2016: 2/2 (100.0%)
89
+ - 2017: 6/16 (37.5%)
90
+ - 2018: 9/24 (37.5%)
91
+ - 2019: 52/98 (53.06%)
92
+ - 2020: 48/108 (44.44%)
93
+ - 2021: 40/86 (46.51%)
94
+ - 2022: 46/102 (45.1%)
95
+ - 2023: 30/58 (51.72%)
 
 
 
 
 
 
 
 
 
 
 
 
96
  ```
97
 
98
+ ## Usage
 
 
 
99
 
100
+ ### Launch a server to deploy Skywork-SWE-32B
101
 
102
+ You can serve the model using vLLM or SGLang. Since our model has 32 billion parameters and supports a 32K context length, we recommend launching the model server with at least 2 GPUs equipped with sufficient VRAM to ensure efficient inference.
103
+ ### Set up OpenHands framework
104
+ ```
105
+ git clone https://github.com/All-Hands-AI/OpenHands.git
106
+ cd OpenHands
107
+ git checkout tags/0.32.0
108
+ make build
109
+ ```
110
+ See official documentation for more details: [SWE-Bench Evaluation with OpenHands SWE-Bench Docker Image](https://github.com/All-Hands-AI/OpenHands/tree/main/evaluation/benchmarks/swe_bench)
111
 
112
+ ### Create the corresponding config file:
113
+ ```
114
+ [core]
115
+ workspace_base="./workspace"
116
+
117
+ [llm.my-oss-model]
118
+ model = "openai//path/to/Skywork-SWE "
119
+ base_url = "http://0.0.0.0:8000/v1"
120
+ api_key="vllm"
121
+ max_message_chars=32768
122
+ max_input_tokens=32768
123
+ max_output_tokens=8192
124
+ log_completions=true
125
+ temperature=0.0
126
+ ```
127
 
128
+ If you want to run the OpenHands agent with test-time scaling techniques (a Best-of-N method based on the critic model), please refer to the [blog](https://www.all-hands.dev/blog/sota-on-swe-bench-verified-with-inference-time-scaling-and-critic-model) for detailed instructions. You will need to switch to the [feature/llm-critic](https://github.com/All-Hands-AI/OpenHands/tree/feature/llm-critic) branch and deploy the [critic model](https://huggingface.co/all-hands/openhands-critic-32b-exp-20250417) accordingly. Additionally, you need to add the following parameters into the configuration file:
129
+ ```
130
+ use_critic=true
131
+ critic_model="critic_model"
132
+ critic_base_url="**********"
133
+ critic_api_key="************"
134
+ critic_num_candidates=2
135
+ ```
136
+
137
+ ### Rollout on SWE-Bench Instances
138
+ ```
139
+ ./evaluation/benchmarks/swe_bench/scripts/run_infer.sh [model_config] [git-version] [agent] [eval_limit] [max_iter] [num_workers] [dataset] [dataset_split]
140
 
141
+ # Example
142
+ ./evaluation/benchmarks/swe_bench/scripts/run_infer.sh llm.my-oss-model HEAD CodeActAgent 500 100 1
143
+ princeton-nlp/SWE-bench_Verified test
144
+ ```
145
+
146
+ ### Evaluate generated patches
147
+ ```
148
+ ./evaluation/benchmarks/swe_bench/scripts/eval_infer.sh \
149
+ ./evaluation_outputs/outputs/princeton-nlp__SWE-bench_Lite-test/CodeActAgent/my-oss-model_maxiter_100_N_v0.32.0-no-hint-run_1/output.jsonl
150
+ ```
151
+
152
+ ## Acknowledgements
153
+ We would like to thank the contributors of the [OpenHands](https://www.all-hands.dev/) and [AllHands Critic](https://huggingface.co/all-hands/openhands-critic-32b-exp-20250417) repositories for their open research and valuable contributions.
154
+
155
+ ## Citation
156
+ If you use Skywork-SWE in your research, please consider citing our work using the following BibTeX entry:
157
+ ```
158
  ```