[07 sizing_and_tta] where the model location in the middle of training?

dls = get_dls(64, 224)
model = xresnet50()
learn = Learner(dls, model, loss_func=CrossEntropyLossFlat(), metrics=accuracy)
learn.fit_one_cycle(5, 3e-3)

dls = get_dls(128, 128)
learn = Learner(dls, xresnet50(), loss_func=CrossEntropyLossFlat(),
metrics=accuracy)
learn.fit_one_cycle(4, 3e-3)

I see it firstly use size of 224 then size of 128. But the second step reassign a new Learn. Thus, where is the model before it? I don’t think we want to retain everything with size of 128 again.

In this link, we are calling ‘Learner’ once. The data loader is called with different sizes. So, you get to reuse the Learner object and progressive sizing…

Are you referring to another source?

@karthikr
I see the Learner object is being called many times and assigned to the variable learner many times from your link. My code should be the same from your link

In fastaiv1, It was done by learn.save and learn.load the pth file. But I don’t know about fastai v2.

But please, I am not asking about fastaiv2’s learn.save and learn.load.

They are sections in that notebook and each section reuses names for objects or calls a function defined earlier.

Under “Progressive Resizing” section, there is code about using different image sizes. In the prior section, “Normalization”, there is code about normalization… They use the same object (eg: learn) names, but it does not mean you have to read it as one continuous block of code.

Step1


Step2
image
So you are saying after creating another new variable learn, we are still using the same Learner object?
Please note in the second step, it creates a new model variable too.

Or they are not training the same mode? It is because for teaching purpose we need to train with different xresnet50 model to show different results?

We are not using the same Learner object when we create new instances. I am saying each section in that notebook should be treated separately. That is,

In “Imagenette” section, we create a instance of Learner called learn.
In “Normalization” section, we create an instance of Learner called learn
Likewise, in “Progressive Resizing” and “Mixup”, we create instances of Learner object called learn.

All the above Learner objects are different.

I assumed your initial question was about “Progressive Resizing” part - there I see we create one instance of the Learner but the dataloader are two (one of size 128 and the other, of size 224)

Yes, I made a mistake and you are correct. They are different.