Skip to content

eval of seq2seq/finetune_trainer does not work on multiple gpus  #8713

Description

@rabeehk

Hi
I am using
transformers = 3.5.1
python = 3.7
8 gpu machine

I am getting this error when trying to run "finetune_trainer.py" with do_eval option on multiple gpus. thanks for your help
@patil-suraj @patrickvonplaten

11/22/2020 17:14:20 - INFO - __main__ -   *** Evaluate ***
11/22/2020 17:14:20 - INFO - seq2seq.utils.utils -   using task specific params for boolq: {'max_length': 4}
Traceback (most recent call last):
  File "finetune_t5_trainer.py", line 233, in <module>
    main()
  File "finetune_t5_trainer.py", line 188, in main
    result = trainer.evaluate(eval_datasets, compute_metrics_fn)
  File "/home/rabeeh/internship/seq2seq/t5_trainer.py", line 175, in evaluate
    prediction_loss_only=True if self.compute_metrics is None else None, # self.compute_metrics[eval_task]
  File "/opt/conda/envs/internship/lib/python3.7/site-packages/transformers/trainer.py", line 1417, in prediction_loop
    loss, logits, labels = self.prediction_step(model, inputs, prediction_loss_only)
  File "/home/rabeeh/internship/seq2seq/t5_trainer.py", line 249, in prediction_step
    generated_tokens = model.generate(
  File "/opt/conda/envs/internship/lib/python3.7/site-packages/torch/nn/modules/module.py", line 779, in __getattr__
    type(self).__name__, name))
torch.nn.modules.module.ModuleAttributeError: 'DataParallel' object has no attribute 'generate'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions