Lesson 1: NameError: name 'cnn_learner' is not defined


(Abhishek Velidi) #1

Hi,

I am getting the following error in Lesson 1
image

Thanks,
Abhishek


(Shahbaz Khan) #2

Hey @velidia
I got the same error a while ago.
My version of fastai is 1.0.46
I checked list of methods available for fastai.vision using dir(), and figured out that the method available to create CNN learner is create _cnn, and not cnn_learner.
I tried the same and overcame the error. It’s working now.
So go ahead and replace cnn_learner with create _cnn

Cheers !


#3

This is the correct answer. You can find breaking changes on the fastai v1 GitHub page under “changes”


#4

There is also a topic with all the announcements you should follow


(Abhishek Velidi) #5

Hey shahbazkhan185,
Changing cnn_learner to create_cnn worked. Thanks!


#6

Better use:
!pip install --no-deps fastai==1.0.47 to grab the version where it works, or later version.


(Patrick Trampert) #7

Adding ‘deprecated’ messages and supporting the old and the new version, at least for refactorings in terms of naming, are in general a good way to prevent such problems.

The message will then tell you, what changed, so that you can adapt the code.