microsoft / CodeBERT

CodeBERT
MIT License
2.25k stars 460 forks source link

How can I get similarity between nl and code of unixcoder and codebert? #326

Open nevermet opened 1 month ago

nevermet commented 1 month ago

Dear all,

What I like to do is to compare the similarities between nl and code from codebert and unixcoder.

I could see quick tour code on unixcoder explaining how to get the similarity between nl and code but I don't see how to get the similarity between nl and code on the codebert page. My questions are as follows.

  1. Can I change the model on the unixcoder quick tour page from 'microsoft/unixcoder-base' to 'microsoft/codebert-base' to get the similarity result?

  2. I also tried to get the nl embedding and code embedding separately from the code on codebert page. I found that nl embedding shape and code embedding shape is different. Could you tell me how I can get the cosine similarity in this case?

Thank you in advance.

Leo-Ritchie commented 1 week ago

Hello, I tried to use graphcodebert to detect the similarity again, and it looks similar to your problem, may I ask if you have solved it