Exception from Summarization Network

I’ve been experimenting with a summarization pipeline:
summarizer = pipeline(“summarization”, model=“facebook/bart-large-cnn”, device=0)

It works wonderfully, however, there are occasions where I get an exception that is apparently caused by submitting something too large?..at least that’s what the error message seems to suggest:

Token indices sequence length is longer than the specified maximum sequence length for this model (1068 > 1024). Running this sequence through the model will result in indexing errors
/opt/conda/conda-bld/pytorch_1670525552843/work/aten/src/ATen/native/cuda/Indexing.cu:1141: indexSelectLargeIndex: block: [420,0,0], thread: [32,0,0] Assertion srcIndex < srcSelectDimSize failed.

My questions are:
1 - is this indeed caused by submitted a string with too many words?
2 - what is the “sequence length” and how to I calculate it on a string before submitting it for summarization?

Thanks!!

1 Like