I need to use a trained ULMFit model, to make a real-time prediction, possibly provide the model as API service maybe.
How can we save the ULMFit model and then use new it for the prediction on a new data set?
I got this working in one way, as in this thread, Load ULMFit model.
This basically rebuilds the model and then loads the weights for the trained model.
However, rebuilding the model requires Textdata object to be built, which required training data(or validation data). Is it possible to just save the whole “learn” object ( final object in imdb.py, https://github.com/fastai/fastai/blob/master/courses/dl2/imdb.ipynb) and reload it just for making prediction purpose? I tried pickle.dump() to save, but that throws up picking error.
Or it’s there a better way to save and use this model?