Issue: Index out of range

#1
by Divyashie - opened

Hi,

I tried using this model but it ran fine on just the provided text_sentence but when I used mine even though I truncate the text to 1024 length. It is giving me this error:

File "/Users/divyasoopal/Desktop/demo-live-transcription/summarizer.py", line 282, in barthezSummarizer
predict = barthez_model.generate(input_ids, max_length=100)[0]
File "/Users/divyasoopal/Desktop/demo-live-transcription/venv/lib/python3.9/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
return func(*args, **kwargs)
File "/Users/divyasoopal/Desktop/demo-live-transcription/venv/lib/python3.9/site-packages/transformers/generation/utils.py", line 1213, in generate
model_kwargs = self._prepare_encoder_decoder_kwargs_for_generation(
File "/Users/divyasoopal/Desktop/demo-live-transcription/venv/lib/python3.9/site-packages/transformers/generation/utils.py", line 610, in _prepare_encoder_decoder_kwargs_for_generation
model_kwargs["encoder_outputs"]: ModelOutput = encoder(**encoder_kwargs)
File "/Users/divyasoopal/Desktop/demo-live-transcription/venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
return forward_call(*input, **kwargs)
File "/Users/divyasoopal/Desktop/demo-live-transcription/venv/lib/python3.9/site-packages/transformers/models/mbart/modeling_mbart.py", line 806, in forward
embed_pos = self.embed_positions(input)
File "/Users/divyasoopal/Desktop/demo-live-transcription/venv/lib/python3.9/site-packages/torch/nn/modules/module.py", line 1194, in _call_impl
return forward_call(*input, **kwargs)
File "/Users/divyasoopal/Desktop/demo-live-transcription/venv/lib/python3.9/site-packages/transformers/models/mbart/modeling_mbart.py", line 145, in forward
return super().forward(positions + self.offset)
File "/Users/divyasoopal/Desktop/demo-live-transcription/venv/lib/python3.9/site-packages/torch/nn/modules/sparse.py", line 160, in forward
return F.embedding(
File "/Users/divyasoopal/Desktop/demo-live-transcription/venv/lib/python3.9/site-packages/torch/nn/functional.py", line 2210, in embedding
return torch.embedding(weight, input, padding_idx, scale_grad_by_freq, sparse)
IndexError: index out of range in self

Any idea what I might be doing wrong here. Also, when I tried computing it on the interface here I get the error "unknown". Any leads on this is much appreciated. Thanks

Sign up or log in to comment