Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using codesearch for my own queries. (How to instanciate model.py Class) #43

Closed
atonkamanda opened this issue May 3, 2021 · 2 comments

Comments

@atonkamanda
Copy link

Hello I managed to finetune codebert for the codesearch task, and I was wondering how I could use the model.bin I just created to perform codesearch on my own natural langage queries.

So the model.bin is a state dictionnary containing all the weight but I don't get how I am supposed to go from that to a working model.

I tried to instanciate it with

model = RobertaModel.from_pretrained("microsoft/codebert-base")

but it returns the following error

RuntimeError: Error(s) in loading state_dict for RobertaModel:
Missing key(s) in state_dict: "embeddings.position_ids", "embeddings.word_embeddings.weight", "embeddings.position_embeddings.weight", "

etc,etc

And I noticed that there is a Model class in model.py so it is probably the one I mused use but I don't get how am I supposed to instanciate it in order for the model to work ? Can you show me an example or explain me a little bit ?

Thank you very much

@atonkamanda
Copy link
Author

And if instanciate is too complicated, how can I use the inference.py file to get my predictions in a file? Like I give the model a string of the query and it output me the code predicted

@atonkamanda
Copy link
Author

Response here microsoft/CodeXGLUE#52

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant