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

Extractive Training is not working #126

Open
jtorrev opened this issue Feb 9, 2020 · 3 comments
Open

Extractive Training is not working #126

jtorrev opened this issue Feb 9, 2020 · 3 comments

Comments

@jtorrev
Copy link

jtorrev commented Feb 9, 2020

Abstractive is working well, but extractive with the following command:
python train.py -task ext -mode train -bert_data_path ../data/bert_data_cnn10k/cnndm -ext_dropout 0.1 -model_path ../models/cnn10_ext -lr 2e-3 -visible_gpus 0 -report_every 50 -save_checkpoint_steps 1000 -batch_size 3000 -train_steps 50000 -accum_count 2 -log_file ../logs/ext_bert_cnndm -use_interval true -warmup_steps 10000 -max_pos 512

This is the output:
Traceback (most recent call last):
File "train.py", line 144, in
train_ext(args, device_id)
File "/home/ubuntu/jose/PreSumm/src/train_extractive.py", line 203, in train_ext
train_single_ext(args, device_id)
File "/home/ubuntu/jose/PreSumm/src/train_extractive.py", line 245, in train_single_ext
trainer.train(train_iter_fct, args.train_steps)
File "/home/ubuntu/jose/PreSumm/src/models/trainer_ext.py", line 137, in train
for i, batch in enumerate(train_iter):
File "/home/ubuntu/jose/PreSumm/src/models/data_loader.py", line 144, in iter
for batch in self.cur_iter:
File "/home/ubuntu/jose/PreSumm/src/models/data_loader.py", line 280, in iter
for idx, minibatch in enumerate(self.batches):
File "/home/ubuntu/jose/PreSumm/src/models/data_loader.py", line 258, in create_batches
for buffer in self.batch_buffer(data, self.batch_size * 300):
File "/home/ubuntu/jose/PreSumm/src/models/data_loader.py", line 230, in batch_buffer
size_so_far = self.batch_size_fn(ex, len(minibatch), self.args.max_ndocs_in_batch)
TypeError: ext_batch_size_fn() takes 2 positional arguments but 3 were given

@areomoon
Copy link

Can change the code in PreSumm/src/models/data_loader.py line 114
def ext_batch_size_fn(new,count) to => def ext_batch_size_fn(new,count,max_ndocs_in_batch=None)
The BertSumExt training will be runnable after that

@nikisix
Copy link

nikisix commented Apr 2, 2020

I created a PR for this:
#143

@nlpyang
Copy link
Owner

nlpyang commented Apr 2, 2020

Please use master version for regular training, dev branch should be only used for -mode test_text .

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

4 participants