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

Input for training code2seq on new dataset #41

Closed
rishab-32 opened this issue Apr 20, 2020 · 5 comments
Closed

Input for training code2seq on new dataset #41

rishab-32 opened this issue Apr 20, 2020 · 5 comments

Comments

@rishab-32
Copy link

Hi, I am using code2seq to run on a custom JAVA dataset. What is the expected format of input to code2seq? I have my code and summary in txt files right now.(All the Code sequences are arranged in a single text file and same for predictions)

@urialon
Copy link
Contributor

urialon commented Apr 20, 2020

Hi @rishab-32 ,
Thank you for your interest in code2seq.

By default, our preprocessing takes Java method names as the code sequences. Getting the sequences from a separate text file will require some modifications. For example, you can change the method names to unique IDs in the Java file, and then use these IDs to look up the code sequence in the text file and join them.

Please see: https://github.com/tech-srl/code2seq#creating-and-preprocessing-a-new-java-dataset
and follow the execution of preprocess.sh on a small code directory, to see the outcomes of every step.

Best,
Uri

@rishab-32
Copy link
Author

Hi thanks for the prompt reply, In the paper, you have talked about an additional comparison to Hu et al. (2018) dataset. I am also working with the Hu dataset, do you have any implementation of code2seq available on this dataset? That would be really helpful.

@urialon
Copy link
Contributor

urialon commented Apr 20, 2020

The comparison to Hu et al was rush, because one of the reviewers asked for it throughout the rebuttal. Since we found out that the BLEU scores reported by Hu et al were totally erroneous, we did not release official repro scripts (if I remember correctly, they reported exceptional BLEU score of about 40, while in fact, when I measured BLEU score on their logs - it was about 9).

However, I do have the scripts that I used to convert their dataset to our format.
If I remember correctly, you need to use the first script to convert their dataset from one-large-json into a directory of many files (for each of training/validation/test):

https://gist.github.com/urialon/6ce2ffab7b675d9437b730246dc07827

Then, run our preprocess.sh script on the resulting directories.
Finally, you need to "insert" the code sequences into the produced files, using this script:

https://gist.github.com/urialon/7c4d129f6cb45c2cdba669a15f132fb4

@urialon
Copy link
Contributor

urialon commented Apr 20, 2020

But note that I haven't touched these scripts for almost two years, so it is very likely that I am forgetting some details. Follow these scripts carefully to verify that I did not mislead you.

@rishab-32
Copy link
Author

Thanks a lot for sharing the scripts. I understand that you do not have any intention of misleading me in any way.

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

2 participants