Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DeepSeek-Coder-V2-Lite模型代码补全微调 #216

Open
FWLamb opened this issue Jul 22, 2024 · 3 comments
Open

DeepSeek-Coder-V2-Lite模型代码补全微调 #216

FWLamb opened this issue Jul 22, 2024 · 3 comments

Comments

@FWLamb
Copy link

FWLamb commented Jul 22, 2024

请问下,想基于公司自研的组件源码微调DeepSeek-Coder-V2-Lite模型实现代码补全,数据集该如何构建?

@Kailigithub
Copy link
Contributor

Kailigithub commented Jul 22, 2024

参考模型论文描述的数据集准备
https://github.com/deepseek-ai/DeepSeek-Coder-V2/blob/09209c4aed8e6a8988681b259eb51b7b3eee42c9/paper.pdf
直接使用项目源代码数据构建数据集即可
Prompt模版可以参考deepseek官方的代码不全模版来构建Prompt模版数据集
https://github.com/deepseek-ai/DeepSeek-Coder-V2?tab=readme-ov-file#6-how-to-run-locally
两者综合一下可以得出以下模版:

{
    "input":"#需要实现的代码功能注释",
    "output":"实现该功能的具体代码"
}

具体举例如下:

{
"input":"#write a quick sort algorithm"
"output":"your quick sort algorithm code"
}

@FWLamb
Copy link
Author

FWLamb commented Jul 22, 2024

参考模型论文描述的数据集准备 https://github.com/deepseek-ai/DeepSeek-Coder-V2/blob/09209c4aed8e6a8988681b259eb51b7b3eee42c9/paper.pdf 直接使用项目源代码数据构建数据集即可 Prompt模版可以参考deepseek官方的代码不全模版来构建Prompt模版数据集 https://github.com/deepseek-ai/DeepSeek-Coder-V2?tab=readme-ov-file#6-how-to-run-locally 两者综合一下可以得出以下模版:

{
    "input":"#需要实现的代码功能注释",
    "output":"实现该功能的具体代码"
}

具体举例如下:

{
"input":"#write a quick sort algorithm"
"output":"your quick sort algorithm code"
}

这个例子是基于注释或者问题进行代码补全的,这是其中一个补全的方式。还有一种是基于上下文FIM进行补全,比如deepseek官网中的描述的例子:
"""<|fim▁begin|>def quick_sort(arr):
if len(arr) <= 1:
return arr
pivot = arr[0]
left = []
right = []
<|fim▁hole|>
if arr[i] < pivot:
left.append(arr[i])
else:
right.append(arr[i])
return quick_sort(left) + [pivot] + quick_sort(right)<|fim▁end|>"""

想知道如果要实现这种方式的补全,该如何构建数据集。

@FWLamb
Copy link
Author

FWLamb commented Jul 23, 2024

是将代码切分成<|fim▁begin|>{code}<|fim▁hole|>{code}<|fim▁end|>的形式喂给大模型就可以了吗?无监督微调。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants