In your code I’m not seeing how your model is built, which is probably where the issue lies. Is it a model you created yourself, which does not inherit from PretrainedModel, hence why you’re using torch.load instead of from_pretrained?
If so, could you show me your model creation so that I can try and replicate on my side? Thank you.