File size of resnet18 model (pretrained vs. from scratch)

I used the fastai library to build a trivial classificator with resnet18.

learner = cnn_learner(data, models.resnet18, metrics=accuracy, pretrained=False)

After some training the net is 135 MB big after saving it to disk. If I use pretrained=True (default) the net is “just” 50 MB.

Why is there such a huge difference in size?

This is actually also the right answer for my question in this thread. If I save my model with

learner.save('foo.model', with_opt=False)

the file size is reduced to 47 MB :slight_smile:

Had missed that question somehow. Glad you found your answer!