LE Quoc Dat commited on
Commit
c1876e6
·
verified ·
1 Parent(s): 5d875aa

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +96 -5
README.md CHANGED
@@ -10,14 +10,105 @@ tags:
10
  - qwen2
11
  - trl
12
  - sft
 
 
13
  ---
14
 
15
- # Uploaded model
16
 
17
- - **Developed by:** quocdat25
 
 
 
 
 
 
 
 
 
18
  - **License:** apache-2.0
19
- - **Finetuned from model :** unsloth/qwen2.5-coder-7b-instruct-bnb-4bit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
 
21
- This qwen2 model was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth) and Huggingface's TRL library.
 
22
 
23
- [<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
 
 
10
  - qwen2
11
  - trl
12
  - sft
13
+ - fast-apply
14
+ - instant-apply
15
  ---
16
 
 
17
 
18
+ # FastApply-7B-v1.0
19
+
20
+ [Github: kortix-ai/fast-apply](https://github.com/kortix-ai/fast-apply)
21
+ [Dataset: Kortix/FastApply-dataset-v1.0](https://huggingface.co/datasets/Kortix/FastApply-dataset-v1.0)
22
+
23
+ ## Model Details
24
+
25
+ ### Basic Information
26
+
27
+ - **Developed by:** Kortix
28
  - **License:** apache-2.0
29
+ - **Finetuned from model:** [unsloth/Qwen2.5-Coder-7B-Instruct-bnb-4bit](https://huggingface.co/unsloth/Qwen2.5-Coder-7B-Instruct-bnb-4bit)
30
+
31
+ ### Model Description
32
+
33
+ FastApply-7B-v1.0 is a 7B model designed for instant code application, producing full file edits to power [SoftGen AI](https://softgen.ai/).
34
+ It is part of the Fast Apply pipeline for data generation and fine-tuning Qwen2.5 Coder models.
35
+
36
+ The model achieves high throughput when deployed on fast providers like Fireworks while maintaining high edit accuracy, with a speed of approximately 150 tokens/second.
37
+
38
+ ## Intended Use
39
+
40
+ FastApply-7B-v1.0 is intended for use in AI-powered code editors and tools that require fast, accurate code modifications. It is particularly well-suited for:
41
+
42
+ - Instant code application tasks
43
+ - Full file edits
44
+ - Integration with AI-powered code editors like Aider and PearAI
45
+ - Local tools to reduce the cost of frontier model output
46
+
47
+ ## Inference template
48
+
49
+ FastApply-7B-v1.0 is based on the Qwen2.5 Coder architecture and is fine-tuned for code editing tasks. It uses a specific prompt structure for inference:
50
+
51
+ ```
52
+ <|im_start|>user
53
+ Merge all changes from the <update> snippet into the <code> below.
54
+ - Preserve the code's structure, order, comments, and indentation exactly.
55
+ - Output only the updated code, enclosed within <updated-code> and </updated-code> tags.
56
+ - Do not include any additional text, explanations, placeholders, ellipses, or code fences.
57
+
58
+ <code>{original_code}</code>
59
+
60
+ <update>{update_snippet}</update>
61
+
62
+ Provide the complete updated code."""
63
+ ```
64
+
65
+ The model's output is structured as:
66
+
67
+ ```
68
+ <|im_start|>assistant
69
+ <updated-code>[Full-complete updated file]</updatedcode>
70
+ ```
71
+
72
+ ## Additional Information
73
+
74
+ For more details on the Fast Apply pipeline, data generation process, and deployment instructions, please refer to the [GitHub repository](https://github.com/Kortex/FastApply).
75
+
76
+ ## How to Use
77
+
78
+ To use the model, you can load it using the Hugging Face Transformers library:
79
+
80
+
81
+ ```python
82
+ from transformers import AutoModelForCausalLM, AutoTokenizer
83
+
84
+ model = AutoModelForCausalLM.from_pretrained("Kortix/FastApply-7B-v1.0")
85
+ tokenizer = AutoTokenizer.from_pretrained("Kortix/FastApply-7B-v1.0")
86
+
87
+ # Prepare your input following the prompt structure mentioned above
88
+ input_text = """<|im_start|>user
89
+ Merge all changes from the <update> snippet into the <code> below.
90
+ - Preserve the code's structure, order, comments, and indentation exactly.
91
+ - Output only the updated code, enclosed within <updated-code> and </updated-code> tags.
92
+ - Do not include any additional text, explanations, placeholders, ellipses, or code fences.
93
+
94
+ <code>{original_code}</code>
95
+
96
+ <update>{update_snippet}</update>
97
+
98
+ Provide the complete updated code."""
99
+
100
+ input_text = input_text.format(
101
+ original_code=original_code,
102
+ update_snippet=update_snippet,
103
+ ).strip() + tokenizer.eos_token
104
+
105
+ # Generate the response
106
+ input_ids = tokenizer.encode(input_text, return_tensors="pt")
107
+ output = model.generate(input_ids, max_length=8192)
108
+ response = tokenizer.decode(output[0])
109
 
110
+ # Extract the updated code from the response
111
+ updated_code = response.split("<updated-code>")[1].split("</updatedcode>")[0]
112
 
113
+ print(updated_code)
114
+ ```