Sentiment model endpoint

Hey guys!

I built a sentiment classifier using my own dataset, and I wanted to build a API endpoint in flask for fun, but I’m not exactly sure how to go about loading the saved model on my server. I followed the most recent IMDB notebook that came out a week or so ago and everything’s working great and I have a learner I’m happy with.

My question involves reloading that learner in what is likely a CPU only environment (I loaded the CPU only version of the conda env in my project since I saw on here somewhere that Jeremy said to do the CPU build for servers). I’m not sure if I’m missing something, but it looks like if I want to load my model, upon startup I will have to:
Load numpy tokens and vals
load TextDataset objects for train and val
load SortSamplers for trn and val
load DataLoaders for trn and val
load ModelData from those objects
get_rnn_classifier from m
get an RNNLearner from the ModelData object and TextModel
load my weights into that learner
handle predictions
return those predictions

I guess what I’m getting at is: are those steps actually required? Is there a shortcut to just creating this particular learner and then loading my saved weights?