How to load model for inference?
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 -&gt; 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


model = TheModelClass(*args, **kwargs) # Model class must be defined somewhere
model.load_state_dict(torch.load(PATH))
model.eval() # run if you only want to use it for inference



Once step 1 is done, I hope we can deploy the model using Flask and expose a REST API for model inference.

I found a nice tutorial explaining how to load model for inference, here is the link
https://pytorch.org/tutorials/recipes/recipes/saving_and_loading_models_for_inference.html
Thanks!
