danielzuegner / code-transformer

Implementation of the paper "Language-agnostic representation learning of source code from structure and context".
https://www.in.tum.de/daml/code-transformer/
MIT License
166 stars 31 forks source link

How to just get the code embedding of entire code_snippet, without having to predict any function name #25

Closed TejaswiniiB closed 2 years ago

TejaswiniiB commented 2 years ago

Hi, I want to get code embedding of entire code_snippet. How to get it? As per Code Snippet embedding section in interactive_prediction.ipynb, it gives the embedding of only masked method. I don't have any masked method or func name to predict. I just want the embedding of entire code. How can we do it?

tobias-kirschstein commented 2 years ago

Hi,

thanks for your interest in the Code Transformer. What is your input? If it is not a code snippet containing a single method, our trained models most likely won't give meaningful embeddings. If it is a single method, you can just mask the method name to make it match our training setting. Regarding the embeddings themselves:

Hope this helps.

Best, Tobias

TejaswiniiB commented 2 years ago

Hi @tobias-kirschstein , Thank you for your reply. My input is the code containing more than one method (multiple methods). Thankyou!