How load text_classifier_learner without dls

Would somebody help me?
I’ve fitted text_classifier_learner and saved the result.
Next time I just want to load the previous result and use it for prediction on a new dataset.
learn.get_preds(dl=test_dl) But I have no idea how to create learner.

Thank you.

Please check out these two for V1 or these two for V2. Basically, a Learner always requires DataLoaders, but you could supply dummy placeholders or use fastai’s load_learner to do it for you.


Thank you. I am sorry for the stupid questions.
I’ve used


But it doesn’t help me at all, since type(learn) is Dict. I need text_classifier_learner.

You need to export your learner with learn.export() and then load it back in with load_learner. I think you only did'final.pth'), which only contains the model weights?

1 Like