Create_learner from load_learner

I’m not sure what the “this” refers to. It looks like you try to load the weights from curated_model into a different model structure created by cnn_learner. This will not work.

You have to load the trained, saved weights back into a Learner with the identical model that saved them. Now you have a model with its pretrained trained layers. You then construct the model you want from those layers.

A new model is constructed using PyTorch. Here’s an example:
https://forums.fast.ai/t/modifying-pretrained-resnet-does-it-just-work/39326

(To design and construct a new model requires study and practice - at least I had to make a lot of mistakes!)

Now you can replace learn.model in an existing Learner, or create a new Learner from the DataBunch and the new model.

I am not sure what Learner export() and load_learner() are doing for you. I have never used them - only used Learner save and load for saving and restoring weights.

If you are not trying to construct a custom model, but only want to save/restore a Learner to continue training, use curated_learn.save()…later, construct curated_learn exactly as it was made originally, curated_learn.load(), and continue.

Good luck!