ntdxyg / comformer Goto Github PK
View Code? Open in Web Editor NEWcode and data for paper "ComFormer: Code Comment Generation via Transformer and Fusion Method-based Hybrid Code Representation" accepted in DSA2021
code and data for paper "ComFormer: Code Comment Generation via Transformer and Fusion Method-based Hybrid Code Representation" accepted in DSA2021
Hi! I get an error when i run python train.py
How can I fix this?
$ python train.py
Special tokens have been added in the vocabulary, make sure the associated word embeddings are fine-tuned or trained.
INFO:simpletransformers.seq2seq.seq2seq_utils: Creating features from dataset file at cache_dir/
10%|███▍ | 43979/445813 [02:17<19:16, 347.51it/s]Traceback (most recent call last):
File "train.py", line 73, in <module>
model.train_model(train_df, eval_data=eval_df, Rouge=getListRouge)
File "/home/gpuadmin/home/ComFormer/bart_model.py", line 176, in train_model
train_dataset = self.load_and_cache_examples(train_data, verbose=verbose)
File "/home/gpuadmin/home/ComFormer/bart_model.py", line 868, in load_and_cache_examples
dataset = SimpleSummarizationDataset(encoder_tokenizer, self.args, data, mode)
File "/home/gpuadmin/anaconda3/envs/venv/lib/python3.7/site-packages/simpletransformers/seq2seq/seq2seq_utils.py", line 425, in __init__
preprocess_fn(d) for d in tqdm(data, disable=args.silent)
File "/home/gpuadmin/anaconda3/envs/venv/lib/python3.7/site-packages/simpletransformers/seq2seq/seq2seq_utils.py", line 425, in <listcomp>
preprocess_fn(d) for d in tqdm(data, disable=args.silent)
File "/home/gpuadmin/anaconda3/envs/venv/lib/python3.7/site-packages/simpletransformers/seq2seq/seq2seq_utils.py", line 333, in preprocess_data_bart
truncation=True,
File "/home/gpuadmin/anaconda3/envs/venv/lib/python3.7/site-packages/transformers/tokenization_utils_base.py", line 2651, in batch_encode_plus
**kwargs,
File "/home/gpuadmin/anaconda3/envs/venv/lib/python3.7/site-packages/transformers/tokenization_utils.py", line 731, in _batch_encode_plus
first_ids = get_input_ids(ids)
File "/home/gpuadmin/anaconda3/envs/venv/lib/python3.7/site-packages/transformers/tokenization_utils.py", line 712, in get_input_ids
"Input is not valid. Should be a string, a list/tuple of strings or a list/tuple of integers."
ValueError: Input is not valid. Should be a string, a list/tuple of strings or a list/tuple of integers.
Thanks!
Hi,
Thanks you very much for your work.
I'm using your model and I'm having trouble getting a pretrained model from scratch as good as yours.
Here are the best results I got :
hi, how to evaluate model on test set?
in train.py
, test.csv
is loaded but not used. In use.py
, the demo does not seems to be suitable for batch generating
so I tried to introduce the parameters in use.py
into BartModel and call the function eval_model
of the class BartModel to eval the test set. the test set is from Hybrid-DeepCom and preprocessed by utils.transformer
as #7 mentioned . the model i use is the pretrained model 'NTUYG/ComFormer'
however, the result is
INFO:bart_model:{'eval_loss': 5.0416509765625, 'getListRouge': 0.5193519200892092}
the ROUGE score is about 10.0 lower than that mentioned in the paper
is this method ok ?
thanks for your answer in advance
感谢您的分享,请问后续是否会更新论文中提到的源码和数据集部分?如有更新,不胜感激
再次感谢您的分享~
Hello again !
In bart_model.py line 522 : if results[args.early_stopping_metric] - best_eval_metric < args.early_stopping_delta:
We had trouble with the model stopping too early even if the metric getListRouge had a new best score.
So we think that the sign less than should be greater than. What do you think?
Hello :)
I was impressed with your Comformer thesis so I tried your Comformer code.
As it says in README.md, we made csv file with 2 columns (input_text, target_text).
However, when I run "python train.py", the key error is occured.
--> Key Error : input_text_a
How to resolve it?
Thank you.
This is error description.
(ym37) gpuadmin@gpuadmin:~/youngmi/ComFormer$ python train.py
Special tokens have been added in the vocabulary, make sure the associated word embeddings are fine-tuned or trained.
INFO:simpletransformers.seq2seq.seq2seq_utils: Creating features from dataset file at cache_dir/
Traceback (most recent call last):
File "/home/gpuadmin/anaconda3/envs/ym37/lib/python3.7/site-packages/pandas/core/indexes/base.py", line 2895, in get_loc
return self._engine.get_loc(casted_key)
File "pandas/_libs/index.pyx", line 70, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/index.pyx", line 101, in pandas._libs.index.IndexEngine.get_loc
File "pandas/_libs/hashtable_class_helper.pxi", line 1675, in pandas._libs.hashtable.PyObjectHashTable.get_item
File "pandas/_libs/hashtable_class_helper.pxi", line 1683, in pandas._libs.hashtable.PyObjectHashTable.get_item
KeyError: 'input_text_a'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "train.py", line 75, in
model.train_model(train_df, eval_data=eval_df, Rouge=Rouge)
File "/home/gpuadmin/youngmi/ComFormer/bart_model.py", line 176, in train_model
train_dataset = self.load_and_cache_examples(train_data, verbose=verbose)
File "/home/gpuadmin/youngmi/ComFormer/bart_model.py", line 868, in load_and_cache_examples
dataset = SimpleSummarizationDataset(encoder_tokenizer, self.args, data, mode)
File "/home/gpuadmin/youngmi/ComFormer/simpletransformers/seq2seq/seq2seq_utils.py", line 383, in init
data["input_text_a"], data["input_text_b"], data["target_text"]
File "/home/gpuadmin/anaconda3/envs/ym37/lib/python3.7/site-packages/pandas/core/frame.py", line 2902, in getitem
indexer = self.columns.get_loc(key)
File "/home/gpuadmin/anaconda3/envs/ym37/lib/python3.7/site-packages/pandas/core/indexes/base.py", line 2897, in get_loc
raise KeyError(key) from err
KeyError: 'input_text_a'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.