I have a Sentiment model trained using glove vectors refer https://blog.floydhub.com/long-short-term-memory-from-zero-to-hero-with-pytorch/ 1.
I save the trained mode and dictionary
torch.save(trainedmodel, ‘./trained_lstm.pt’)
torch.save(trainedmodel.state_dict(), ‘./state_dict.pt’)
I try to recreate the model for inference
model = torch.load(‘trained_lstm.pt’, map_location=torch.device(“cpu”))
but keep getting error cannot get attribute SentimentNet in module main.  If I just load the state dictionary i get error on embedding and weight sizes.
I included the model class in the same file while saving and reloading. Any help ?