PreSumm icon indicating copy to clipboard operation
PreSumm copied to clipboard

Extractive Training is not working

Open jtorrev opened this issue 6 years ago • 3 comments

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

jtorrev avatar Feb 09 '20 13:02 jtorrev

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

areomoon avatar Mar 25 '20 09:03 areomoon

I created a PR for this: https://github.com/nlpyang/PreSumm/pull/143

nikisix avatar Apr 02 '20 15:04 nikisix

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

nlpyang avatar Apr 02 '20 19:04 nlpyang