Error while summarizing
#61
by
Harsh6519
- opened
Your input text is probably too long. You need to truncate it:
summary = summarizer(text, min_length=10, max_length=200, truncation=True)
I still receive the same error despite setting truncation to True and max_length to 200. Error message states that 'Asking to truncate to max_length but no maximum length is provided and the model has no predefined maximum length. Default to no truncation.'
but I clearly set max_length: summary = summarizer(text_to_summarize, min_length=10, max_length=200, truncation=True)
The maximum input length for bart is 1024 tokens. To not have the error, do the following:
summarizer.tokenizer.model_max_length = 1024
summarizer(long_text, max_new_tokens=10, truncation=True, min_length=1)
The max output length is also 1024