Saving and reloading a Tabular model in fastai V1

I have trained a tabular model and am attempting to save and reload it.'fastai_v1_tabular_test')

now according to the docs you have to run


to get it back, but that is dependent upon having already created a
new, blank learn2 object.

The only way I’ve been able to make this work is to create a learn2 object with exactly the same layers configuration as the original.

Is there any way to create a new blank model ?, and then have the layer configurations picked up from the model you are loading ? I think some of the non-tabular models seem to have a pretrained option, but I can’t find this in the tabular docs.


Simply call and Learner.load to save and load models. Only the parameters are saved, not the actual architecture (so you’ll need to create your model in the same way before loading weights back in). Models are saved to the path / model_dir directory.

You create the learner as before. If you load you get the trained weights that you have saved. If you do not load any weights, your model is randomly initialized.