Validation sanity check: 100%|ββββββββββ| 1/1 [00:01<00:00, 1.67s/it]Traceback (most recent call last):
File "/content/drive/My Drive/MAGMA: Summarization/seq2seq/finetune.py", line 443, in <module>
main(args)
File "/content/drive/My Drive/MAGMA: Summarization/seq2seq/finetune.py", line 418, in main
logger=logger,
File "/content/drive/My Drive/MAGMA: Summarization/seq2seq/lightning_base.py", line 389, in generic_train
trainer.fit(model)
File "/usr/local/lib/python3.6/dist-packages/pytorch_lightning/trainer/trainer.py", line 440, in fit
results = self.accelerator_backend.train()
File "/usr/local/lib/python3.6/dist-packages/pytorch_lightning/accelerators/gpu_accelerator.py", line 54, in train
results = self.train_or_test()
File "/usr/local/lib/python3.6/dist-packages/pytorch_lightning/accelerators/accelerator.py", line 68, in train_or_test
results = self.trainer.train()
File "/usr/local/lib/python3.6/dist-packages/pytorch_lightning/trainer/trainer.py", line 462, in train
self.run_sanity_check(self.get_model())
File "/usr/local/lib/python3.6/dist-packages/pytorch_lightning/trainer/trainer.py", line 650, in run_sanity_check
_, eval_results = self.run_evaluation(test_mode=False, max_batches=self.num_sanity_val_batches)
File "/usr/local/lib/python3.6/dist-packages/pytorch_lightning/trainer/trainer.py", line 597, in run_evaluation
num_dataloaders=len(dataloaders)
File "/usr/local/lib/python3.6/dist-packages/pytorch_lightning/trainer/evaluation_loop.py", line 196, in evaluation_epoch_end
deprecated_results = self.__run_eval_epoch_end(num_dataloaders, using_eval_result)
File "/usr/local/lib/python3.6/dist-packages/pytorch_lightning/trainer/evaluation_loop.py", line 247, in __run_eval_epoch_end
eval_results = model.validation_epoch_end(eval_results)
File "/content/drive/My Drive/MAGMA: Summarization/seq2seq/finetune.py", line 190, in validation_epoch_end
k: np.array([x[k] for x in outputs]).mean() for k in self.metric_names + ["gen_time", "gen_len"]
File "/content/drive/My Drive/MAGMA: Summarization/seq2seq/finetune.py", line 190, in <dictcomp>
k: np.array([x[k] for x in outputs]).mean() for k in self.metric_names + ["gen_time", "gen_len"]
File "/usr/local/lib/python3.6/dist-packages/numpy/core/_methods.py", line 163, in _mean
ret = ret / rcount
TypeError: unsupported operand type(s) for /: 'dict' and 'int'
From my understanding self.metric_names should be a list.
Environment info
transformers
version: masterWho can help
Trainer: @sgugger examples/seq2seq: @patil-suraj
Information
Model I am using (Bert, XLNet ...): bart-base
The tasks I am working on is: summarization on XSUM
To reproduce
Change
calculate_rouge
function inutils.py
withreturn_precision_and_recall=True
. Fine-tune any seq2seq model with the official scriptfinetune.py
:Throws the error
From my understanding self.metric_names should be a list.