🚀 FastApply-1.5B-v1.0
FastApply-1.5B-v1.0是一个专为即时代码应用而设计的15亿参数模型,能够生成完整的文件编辑内容,为 SoftGen AI 提供强大支持。它是Fast Apply管道的一部分,用于数据生成和微调Qwen2.5 Coder模型。
Github: kortix-ai/fast-apply
数据集: Kortix/FastApply-dataset-v1.0
立即在👉 Google Colab中试用
📚 详细文档
基本信息
模型描述
FastApply-1.5B-v1.0是一个15亿参数的模型,专为即时代码应用而设计,能够生成完整的文件编辑内容,为 SoftGen AI 提供支持。它是Fast Apply管道的一部分,用于数据生成和微调Qwen2.5 Coder模型。
该模型在部署到Fireworks等快速服务提供商时,能够实现高吞吐量,同时保持较高的编辑准确率,速度约为340个令牌/秒。
🎯 预期用途
FastApply-1.5B-v1.0旨在用于人工智能驱动的代码编辑器和需要快速、准确代码修改的工具。它特别适用于:
- 即时代码应用任务
- 完整文件编辑
- 与Aider和PearAI等人工智能驱动的代码编辑器集成
- 本地工具,以降低前沿模型输出的成本
💻 推理模板
FastApply-1.5B-v1.0基于Qwen2.5 Coder架构,并针对代码编辑任务进行了微调。它使用特定的提示结构进行推理:
<|im_start|>system
You are a coding assistant that helps merge code updates, ensuring every modification is fully integrated.<|im_end|>
<|im_start|>user
Merge all changes from the <update> snippet into the <code> below.
- Preserve the code's structure, order, comments, and indentation exactly.
- Output only the updated code, enclosed within <updated-code> and </updated-code> tags.
- Do not include any additional text, explanations, placeholders, ellipses, or code fences.
<code>{original_code}</code>
<update>{update_snippet}</update>
Provide the complete updated code.<|im_end|>
<|im_start|>assistant
模型的输出结构如下:
<updated-code>[Full-complete updated file]</updated-code>
📖 额外信息
有关Fast Apply管道、数据生成过程和部署说明的更多详细信息,请参考 GitHub仓库。
💻 使用示例
基础用法
要使用该模型,您可以使用Hugging Face Transformers库加载它:
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("Kortix/FastApply-1.5B-v1.0", device_map="auto")
tokenizer = AutoTokenizer.from_pretrained("Kortix/FastApply-1.5B-v1.0")
input_text = """<|im_start|>system
You are a coding assistant that helps merge code updates, ensuring every modification is fully integrated.<|im_end|>
<|im_start|>user
Merge all changes from the <update> snippet into the <code> below.
- Preserve the code's structure, order, comments, and indentation exactly.
- Output only the updated code, enclosed within <updated-code> and </updated-code> tags.
- Do not include any additional text, explanations, placeholders, ellipses, or code fences.
<code>{original_code}</code>
<update>{update_snippet}</update>
Provide the complete updated code.<|im_end|>
<|im_start|>assistant
"""
input_text = input_text.format(
original_code=original_code,
update_snippet=update_snippet,
).strip()
input_ids = tokenizer.encode(input_text, return_tensors="pt")
output = model.generate(input_ids, max_length=8192,)
response = tokenizer.decode(output[0][len(input_ids[0]):])
print(response)
updated_code = response.split("<updated-code>")[1].split("</updated-code>")[0]
📊 评估
