Saving and a fast.ai v1 ULMFiT model. to/from disk

Viewed 737

Simple Question.

I have been doing experiments with ULMFiT

Yet I do not see a way to save and load models to/from disk easily? There is a load method available to the RNNLearner class that is created in this example, but it is not documented.

I have tried several methods and none of them work. Is there something i am missing? There do not seem to be any examples of a fast ai v1 model loaded from disk.

1 Answers

The RNNLearner() class has a save_encoder() method. For example, if your RNNLearner() object is called learn, then the call invoke the save_encoder() method would be: learn.save_encoder(name='my_model_name')

Also, the RNNLearner() class inherits from the Learner() class, which itself contains a save() method.

Both the save_encoder() and save() methods have a name argument which takes a string that will serve as the name under which your model is saved.

Related