Closed manishiitg closed 4 years ago
@sshleifer I'm seeing this as well. It doesn't happen if num_beams=1
. Might have to do with the recent generation and bart changes. Only started happening in the last week or so.
Thanks for contributing!
A few thoughts:
output_past=True
to BartForConditionalGeneration.from_pretrained
, the code works.copy paste LONG_BORING_TENNIS_ARTICLE
model_name = 'bart-large-mnli'
from transformers import *
torch_device='cpu'
tokenizer = BartTokenizer.from_pretrained(model_name)
model = BartForConditionalGeneration.from_pretrained(model_name, output_past=True)
article_input_ids = tokenizer.batch_encode_plus([LONG_BORING_TENNIS_ARTICLE], return_tensors='pt', max_length=1024)['input_ids'].to(torch_device)
summary_ids = model.generate(article_input_ids,
num_beams=4,
length_penalty=2.0,
max_length=100,
early_stopping=True)
print([tokenizer.decode(g, skip_special_tokens=True, clean_up_tokenization_spaces=False) for g in summary_ids])
This wasn't solved. I am using a trainer on BART and I have tried to use use_cache
, but it still doesn't work.
🐛 Bug
Information
i am using BART
Language I am using the model on (English, Chinese ...): English
The problem arises when using:
The tasks I am working on is:
Summarization
To reproduce
Steps to reproduce the behavior:
i get error
this works with bart-large-cnn but gives error with other models?