dpfried/incoder

How to use incoder for code infilling task

Closed this issue · 2 comments

Hello😃
A Great job!
I am reaching out to inquire about the possibility of using the pre-trained incoder model provided by your team for code infilling tasks~
However, I have been unable to locate any relevant example code or documentation regarding the usage of the pre-trained incoder model for code infilling. I'm not sure how to get a correctly formatted input〒▽〒
I expected the input like:

fn main(){
let a = 10;
    let b = 20;
    let result: i32;
asm!(
<FILL HERE>
)
}

and the output will be like:

fn main(){
let a = 10;
    let b = 20;
    let result: i32;
asm!(
"add {0}, {1}", // Add the values of a and b
            out(reg) result,
            in(reg) a,
            in(reg) b
)
}

Hi, sorry for the slow response!

If I remember correctly, you'll basically want to prompt the model with:

code prefix<|mask:0|>code suffix<|mask:0|>

We have some example code here: https://github.com/dpfried/incoder/blob/main/example_usage.py in the infill method that you could take a look at to verify this.

Hi, sorry for the slow response!

If I remember correctly, you'll basically want to prompt the model with:

code prefix<|mask:0|>code suffix<|mask:0|>

We have some example code here: https://github.com/dpfried/incoder/blob/main/example_usage.py in the infill method that you could take a look at to verify this.

Thank you! I solved the problem.😃~~