How to do text classification on long sequence?

I also ran into this error while running a pytorch code, and later found it was an issue with the dataset only. Actually I was using a replication package where the origianl authors have used labels in their dataset starting from ‘0’, while the dataset which I was testing it upon had labels starting from ‘1’. later I changed it to zero and it solved the issue.