
Title | A Neural Model for Generating Natural Language Summaries of Program Subroutines |
---|---|
Publication Title | 2019 IEEE/ACM 41st International Conference on Software Engineering (ICSE) |
Authors | Alexander LeClair, Siyuan Jiang, Collin McMillan |
Repository | funcom |
-
Install environment such as Google Colab env, GPU with high RAM. Google Colab is an online environment for machine learning and deep learning, which supports Python and Jupyter Notebook. The free version has only basic functionality. For reproduction, I use the Pro version with a high RAM GPU (monthly costs $10.88).
-
Download and unzip
Models
andData
at Release, as well as the source code. -
Upload the whole
funcom_reproduction
folder to the Google Drive root (everyone has 15GB free storage, I think maybe enough). Create a directory and make sure that thedata
folder is located at./funcom_reproduction/scratch/funcom/data
.
-
Before the model training, Please create
outdir
directory under./funcom_reproduction/scratch/funcom/data
, and then create 3 directorieshistories
,models
andpredictions
respectively underoutdir
. After creation, you can execute steps 0, 0.5, 1 and 2 in the.ipynb
file for training. The epoch suggested by the author is 5 (each epoch nearly costs more than 2 hours) because the effect will decrease if the epoch>5. But in my case, ast-attendgru model will abort exceptionally at the 4th epoch so eventually I choose epoch=3 for comparison. The epoch value can be modified at line 79 oftrain.py
. Or you can also use my models inModels
and skip this step. -
For comment generation and BLEU score calculation in the standard dataset, the attendgru model and ast-attendgru model have been released in
Models
. You can directly use them to generate comments for calculating BLEU scores. If you do, please start from step iii the following:-
Select
outdir_attendgru
oroutdir_ast-attendgru
indata
, and rename the folder asoutdir
. -
Put the corresponding model file from
Models
under the directory./funcom_reproduction/scratch/funcom/data/outdir/models
. For example, if you chooseoutdir_attendgru
, you need to useattendgru_E03_1633627453.h5
orattendgru_E05_1633627453.h5
. Please do not forget to create themodels
directory. -
Open the corresponding
.ipynb
file under the root directory, and execute steps 0, 0.5, 1 and 3. After that, the.txt
comment will be generated under./funcom_reproduction/scratch/funcom/data/outdir/predictions
. Please double-check the.h5
file name before running the code. -
Calculate the BLEU score by executing step 4 in the
.ipynb
file. I leave my results here for checking:Model Ba B1 B2 B3 B4 ast-attendgru, E03 19.37 38.74 21.88 14.75 11.27 attendgru, E03 19.24 38.65 21.77 14.66 11.12 attendgru, E05 19.14 37.88 21.4 14.66 11.3
-
-
For comment generation & BLEU score calculation in the challenge dataset, please modify line 114 of
predict.py
, and change default value fromFalse
toTrue
. Then, redo steps iii and iv in the last point.
Feel free to open an issue or submit PRs.

Leave a Reply