google-research / pegasus

Apache License 2.0
1.59k stars 315 forks source link

Summarization error #202

Open YatinKapoor opened 2 years ago

YatinKapoor commented 2 years ago

Hi, I am new into this and was trying to run the example given at LINK

However, on running batch = tokenizer(src_text, truncation=True, padding='longest', return_tensors="pt").to(device) I am getting the error

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-49-e6e55e18a32c> in <module>()
----> 1 batch = tokenizer(src_text, truncation=True, padding='longest', return_tensors="pt").to(device)
      2 translated = model.generate(**batch)
      3 tgt_text = tokenizer.batch_decode(translated, skip_special_tokens=True)

TypeError: 'NoneType' object is not callable

I also tried running batch = tokenizer.prepare_seq2seq_batch(src_text, truncation=True, padding='longest', return_tensors='pt').to(torch_device) But I am getting the error

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-50-b7183fa2a37c> in <module>()
----> 1 batch = tokenizer.prepare_seq2seq_batch(src_text, truncation=True, padding='longest', return_tensors='pt').to(torch_device)
      2 translated = model.generate(**batch)
      3 tgt_text = tokenizer.batch_decode(translated, skip_special_tokens=True)

AttributeError: 'NoneType' object has no attribute 'prepare_seq2seq_batch'

Any help would be greatly appreciated.