Comments (7)
It seems that there are correct steps. Could you provide more information:
- The mined paths from the code snippet
- The input tensors shapes (they should be something like
[5; n_paths]
)
Also, the model was trained with masked method names, so you should replace them too in your example. As far as I remember, mask token in <MN>
. But you can check it. It should be in the top of the label_to_id
counter. The correct code snippet is
def <MN>(n):
if n == 0:
return 1
else:
return n * <MN>(n-1)
Output shape is [7; 1; vocab size]
, so correct decoding is:
# [7]
predictions = output.squeeze(1).argmax(-1)
labels = [id_to_label(i.item()) for i in predictions]
from code2seq.
Hi!
First of all, you need to extract paths from the code snippet. This should be done by the tool you used for model training.
After that, you should write a little wrapper to pass your datapoint into the model. Look into an example from readme for correct model loading. Pass your example into the model according to forward method signature.
from code2seq.
Hi @SpirinEgor, thanks for responding !
To train the model I downloaded the dataset and ran the train script provided in the readme. I am a bit unclear, what do you mean by the "tool" used for model training?
from code2seq.
What dataset did you download?
The tool I was speaking about is a tool for extracting paths from AST of code. There are some different ways to do it:
All these tools use different parsers therefore they build different ASTs and extract different paths.
from code2seq.
hello, i'm doing same thing with my own python ast miner
can you confirm whether i'm doing correctly?
https://gist.github.com/hehehwang/d058c6fca986a5b479afe10245f63a3e
(i think something went wrong since it's keep printing out and token..)
thank you!
from code2seq.
seems that i've made a silly mistake on decoding.. thank you for your help!
now it works just fine and clear (without mask token though)
thanks again!
from code2seq.
Awesome!
If you have other questions, feel free to open an issue!
from code2seq.
Related Issues (14)
- Scripts
- Can't install black 20.8b1 with pip HOT 1
- What is the difference between these three models? HOT 4
- '\n' mixed in Vocabulary['token'] HOT 3
- can i get an information about the java-med dataset parser? HOT 1
- Save model for prediction HOT 27
- Improve Code2Class usage scenario
- Failed to run minimal code example HOT 2
- Beam search for code2seq
- Application to real case study
- Not able to replicate results of paper HOT 1
- Make typechecker happy HOT 1
- Debug output \w hyperparameters
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from code2seq.