CodeT5 icon indicating copy to clipboard operation
CodeT5 copied to clipboard

How to get embedding for javascript and python code snippet?

Open smith-co opened this issue 3 years ago • 2 comments

I have a couple of questions:

a) How can I use CodeT5 to extract embedding for JavaScript and Python code? b) Can I feed incomplete code JavaScript and Python snippet to extract embedding? Or the code snippet needs to be complete? c) Have anyone used CodeT5 to perform code to code search?

smith-co avatar Aug 04 '22 05:08 smith-co

Hi, for embedding exaction with CodeT5, we suggest to follow the BART manner by feeding the sequences to both encoder and decoder. Then you can employ either the last decoder state or the average pooling of all decoder states as the sequence embedding.

For code search, we did not try it yet. You can refer to this UniXcoder paper which includes such evaluation for the moment.

yuewang-cuhk avatar Aug 09 '22 02:08 yuewang-cuhk

Hi @yuewang-cuhk Does code-t5 give proper embeddings for python code with multiple methods as well? Or only for the code with single method?

TejaswiniiB avatar Aug 16 '22 04:08 TejaswiniiB

HI TejaswiniiB, we did not test it but believe it should give proper embeddings.

yuewang-cuhk avatar Dec 21 '22 02:12 yuewang-cuhk