renmada / t5-pegasus-pytorch

401 stars 61 forks source link

您好,运行train_t5_copy,报prepare_inputs_for_generation()参数错误 #53

Open zyDotwei opened 2 years ago

zyDotwei commented 2 years ago

File "/home/root/v2/train_t5_copy.py", line 84, in validation_step pred = self.predict_batch(batch) File "/home/root/v2/train_t5_copy.py", line 60, in predict_batch pred = self.model.generate(eos_token_id=tokenizer.sep_token_id, File "/opt/conda/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 26, in decorate_context return func(*args, kwargs) File "/opt/conda/lib/python3.8/site-packages/transformers/generation_utils.py", line 965, in generate return self.beam_search( File "/opt/conda/lib/python3.8/site-packages/transformers/generation_utils.py", line 1604, in beam_search model_inputs = self.prepare_inputs_for_generation(input_ids, model_kwargs) File "/home/root/v2/t5_copy.py", line 64, in prepare_inputs_for_generation res = super().prepare_inputs_for_generation(input_ids, TypeError: prepare_inputs_for_generation() takes from 2 to 6 positional arguments but 9 were given

vanpersie32 commented 2 years ago

I met the same problem

renmada commented 2 years ago

如果transformers的版本高于4.12.0的话,降级试试

zyDotwei commented 2 years ago

如果transformers的版本高于4.12.0的话,降级试试

可能是我的太低了;改到4.10.0就好了,感谢~