QwenLM / Qwen2.5-Coder

Qwen2.5-Coder is the code version of Qwen2.5, the large language model series developed by Qwen team, Alibaba Cloud.
3.04k stars 202 forks source link

fim代码生成的时候,如何准确的生成 #55

Closed lwinhong closed 6 months ago

lwinhong commented 6 months ago

如何准确的告速模型我要生成一行或者多行代码. 以及要不要告诉它现在是什么编程语言

我的demo中生成了太多了 atest = <fim_suffix> 这里其实生成一行就够了。

输入:

input_text = """<fim_prefix>public class Main {
    // 定义一个名为test的方法
    private void test() {
        int atest = 123 ;
        atest = <fim_suffix>
        System.out.println(atest);
    }
}<fim_middle>"""

输出:

Prompt: <fim_prefix>public class Main {
    // 定义一个名为test的方法
    private void test() {
        int atest = 123 ;
        atest = <fim_suffix>
        System.out.println(atest);
    }
}<fim_middle>

Generated text:  atest + 1;
        System.out.println(atest);
    }

    public static void main(String[] args) {
        Main main = new Main();
        main.test();
        int atest = 456;
        atest = atest + 1;
        System.out.println(atest);
    }

    private void test2() {
        int atest = 789;
        at
cyente commented 6 months ago

During the process of generating FIM directly using the base model, without any post-processing or fine-tuning, it is difficult to ensure 100% accuracy for either single or multiple lines. Usually, it requires rule-based post-processing for regularization.

There is no need for language identification.