How to use pre-trained model built using Pytorch?

I am using a simple perceptron based classifier to generate sentiment analysis in Pytorch, complete code here Classifying Yelp Reviews.

The example does sentiment analysis, it outputs if the given input string is positive or negative.

example: this is a pretty small old great book → positive

The application stores the final model along with the vectorizer.json.

So my question is: What should be the pre-requisites to build a separate application just to test the model, so that it can be used in web-application later-on?

Below is my current understanding and queries for this:

I assume to test, we need to load the model, load model parameters and evaluate for inference, please confirm

I think this tutorial is pretty straightforward in explaining how to load a pre-trained model for inference. You would need the ‘state-dict’ stored in the disc.

1 Like