I’m using an audio dataset from kaggle with two sets: curated and noisy (i could simply combine these, but wanna do it properly). I managed to use cnn to learn the curated set on the audio spectrograms, and I exported the results. Day later I start my jupiter and want to load this export - here’s how far I get:
data = ImageDataBunch.from_csv( path=path_project.resolve(), folder=path_data_noisy.relative_to(path_project), csv_labels=path_csv_noisy_png, ds_tfms=None, size=224, bs=48 ) data.normalize(imagenet_stats) curated_learn = load_learner('.', 'export_1_freesound.pkl') curated_learn.save('curated_weights') # dunno how to skip this learn = cnn_learner(data, models.resnet34, metrics=error_rate) learn.load('curated_weights')
And this gives error
RuntimeError: Error(s) in loading state_dict for Sequential: size mismatch for 1.8.weight: copying a param with shape torch.Size([195, 512]) from checkpoint, the shape in current model is torch.Size([1030, 512]). size mismatch for 1.8.bias: copying a param with shape torch.Size() from checkpoint, the shape in current model is torch.Size().
I tore this forum apart and it was only mentioned that I’m supposed to remove the last layer of the learned model, but I’m entirely not sure how this works or why this is necessary. In the course I’ve finished lesson 3.
# Name Version Build Channel fastai 1.0.58 1 fastai