RuntimeError: CUDA error: device-side assert triggered when fine-tune Bert

I had the same error in one of my machine translation projects.
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.