NameError: name 'AWD_LSTM' is not defined

Hi!

I’m working on “lesson3-imdb.ipynb”, and when I ran learn = language_model_learner(data_lm, AWD_LSTM, drop_mult=0.3) I got NameError: name 'AWD_LSTM' is not defined.

Any suggestion please?


UPDATE:

I guess this is a bug in the notebook. It should be learn = language_model_learner(data_lm, "AWD_LSTM", drop_mult=0.3). With parentheses around AWD_LSTM.


UPDATE AGAIN:

Turns out the newest fastai library already fix the bug. So if you encounter this problem, just try

conda install fastai -c fastai -c pytorch

@jls
Thank you , it works for me.

It should be like this i.e. without the quotes. At least according to the docs. Certainly worked for me without. Suspect it was because of the version.

Yes, I noticed that just after I posted it. :joy: So I updated the post immediately.

All my packages are up to date, i still get this error.

Any suggestions? [I am on running on windows]

Suggest you post your code and specific error.

I am trying to run https://github.com/fastai/course-v3/blob/master/nbs/dl1/lesson3-imdb.ipynb on my local machine and the line

learn = language_model_learner(data_lm, AWD_LSTM, drop_mult=0.3)

throws error

NameError: name ‘AWD_LSTM’ is not defined

I am on windows. And have the pytorch and fastai libraries updated with conda install.

Your code looks correct.

Maybe double check you do have the latest version by including this in a cell after the fastai imports in your notebook

! conda list fastai

This should show which version is running in your active environment…

Tried and it is version 1.0.38.

According to https://github.com/fastai/fastai/releases latest release is 1.0.47.post1

But when i run

conda update fastai -c fastai -c pytorch

inside my env it says

All requested packages already installed.

Not sure what is wrong.

It seems your notebook is not running in the environment you are expecting. This post may help.

Also check jupyter is actually installed in your fastai environment.

I tried all of those, but it dint work.

Though Problem while updating the fastai library in conda solved it for me.
Thanks a ton, for helping :slight_smile: