I see your problem is solved, but for some folks that may get this error for the same reason as me, I was loading my pytorch checkpoint with torch v1.4 while the torch version I used when pretraining my model and saving my checkpoint was v1.9 (I pretrained my models on one server and was loading them on another server.) So, double-checking the torch version might help to resolve this error in some cases.