Found the solution. Posting it here just in case someone else too gets stuck with my particular problem.
I just had to pass ignore_keys = [‘attentions’] in the predict function and everything works fine.