DeepSeek-Coder icon indicating copy to clipboard operation
DeepSeek-Coder copied to clipboard

Instruct - Code Completion

Open RussellCanfield opened this issue 2 years ago • 5 comments

Hi,

I was wondering if Instruct supports code completion? I’ve tried various prompt formats, and while it does seem to perform code completion, it always includes the original code as well.

is there a way to use the tokens to only include the “new code” in the response?

Thank you!

RussellCanfield avatar Dec 21 '23 03:12 RussellCanfield

You can try this example,and the instruct model should be used for code completion. https://github.com/deepseek-ai/DeepSeek-Coder#1-code-completion

guoday avatar Jan 02 '24 03:01 guoday

Thanks I can try this with instruct, the example shows base as the model. Do you know if FIM would work the same? In my testing it seems to struggle a bit. Example:

### Instruction:
<|fim_begin|> const printHelloWorld = () => {} <|fim_hole|>  <|fim_end|>
### Response:
<|EOT|>

Outputs this:

\n```javascript\nconst printHelloWorld = () => {\n console.log(\"Hello, World!\");\n};\nprintHelloWorld();\n``` \n


Although the code is correct and complete and it did fill in the middle, it outputs all the code and wraps it with markdown

RussellCanfield avatar Jan 03 '24 05:01 RussellCanfield

Instruct model can't support FIM because we don't use FIM task during fine-tuning.

guoday avatar Jan 03 '24 05:01 guoday

Thanks! I was confused based on this issue: https://github.com/deepseek-ai/DeepSeek-Coder/issues/71#issuecomment-1845563467

But if only base works, I can use that. Appreciate it!

RussellCanfield avatar Jan 04 '24 20:01 RussellCanfield

Thanks! I was confused based on this issue: #71 (comment)

But if only base works, I can use that. Appreciate it!

me too

meichangsu1 avatar Jan 11 '24 09:01 meichangsu1

sft model still can work with "<|fim_begin|> const printHelloWorld = () => {} <|fim_hole|> <|fim_end|>", donot add ### instruction.

pkuzqh avatar Feb 04 '24 02:02 pkuzqh

Instruct model can't support FIM because we don't use FIM task during fine-tuning.

why not use fim format during finetuning? if not use, how to get fim ability?

yiyepiaoling0715 avatar Feb 29 '24 06:02 yiyepiaoling0715

Instruct model can't support FIM because we don't use FIM task during fine-tuning.

why not use fim format during finetuning? if not use, how to get fim ability?

  1. Our initial idea was to apply the instruct model in chat scenarios, not in code completion, so we didn't use FIM during the fine-tuning phase. In the next versions, we will consider using FIM during fine-tuning.
  2. Even if FIM was not used during the finetuning stage, the current instruct model still retains a certain FIM capability, which comes from the pre-training stage. However, not using FIM tasks during the finetuning stage may reduce its FIM capability.

guoday avatar Feb 29 '24 07:02 guoday

Instruct model can't support FIM because we don't use FIM task during fine-tuning.

why not use fim format during finetuning? if not use, how to get fim ability?

  1. Our initial idea was to apply the instruct model in chat scenarios, not in code completion, so we didn't use FIM during the fine-tuning phase. In the next versions, we will consider using FIM during fine-tuning.
  2. Even if FIM was not used during the finetuning stage, the current instruct model still retains a certain FIM capability, which comes from the pre-training stage. However, not using FIM tasks during the finetuning stage may reduce its FIM capability.

i see,thanks

yiyepiaoling0715 avatar Feb 29 '24 07:02 yiyepiaoling0715

Thanks! I am going to close the issue since this has been answered.

RussellCanfield avatar Feb 29 '24 12:02 RussellCanfield