Chapter 15 fastai book issue (Siamese training running mean)


When executing the chapter 15 of the fastai book, I get an error I can’t quite figure out.
With no change whatsoever to the code of the colab workbout I get the following error:

RuntimeError: running_mean should contain 2048 elements not 4096

After executing the cell ====> learn.fit_one_cycle(4, 3e-3)

In case you need the link to the colab notebook for chapter 15.
Chapter 15, Arch Details

Set the inputs to create_head in half (so rather than 512x4, do 512x2)


That does the trick, thank you very much!

I do understand why this solves the error but I do not fully understand why we have to change this? In the fastbook the *4 is explained because: 2 images, 2 poolingLayers --> 4. Was there any change in the fastai framework?

Yes (hence the solution). Now create_head will setup the proper input filters based on if we’re doing two pooling layers or not (so it will do that * 2 internally)

1 Like

I have submitted an errata request to the book to reflect the change on page 464.
Regards Conwyn