AttributeError: 'DynamicUnet' object has no attribute 'fine_tune'

Hello, I am trying to make my first model for image segmentation using unet_learner. When I execute the following code:

model = unet_learner(dls, resnet34)

It throws an error: AttributeError: ‘DynamicUnet’ object has no attribute ‘fine_tune’. The same code works just fine on my PC locally, but fails when I try to run it in Jupyter Notebook. The configurations are the same, I have identical versions of torch and fastai installed everywhere. I have tried importing the learner like they do in the tutorials with either “from import unet_learner” or
“from import *”. None of that helps and I really don’t know how else it could be fixed. If you have any ideas, I’d really appreciate it.

In the official docs, they use:

from import *
learn = unet_learner(dls, resnet34)

just like I do and it seemed to work for whoever wrote that

It is very strange that it works on your pc but not in the notebook if everything is the same version.

How did you check that it is in fact the same version?

I just tried making a new notebook and reinstalling everything from scratch. Now it works fine. Seems like there was some sort of an issue with the pip cache or a corrupted install of fast ai.

1 Like