I had the same error 3 in one of my machine translation projects 4.
I solved the error by removing the very long sentences in my datasets.
Maybe when I see your code I will be able to help you better.