Lesson 3 - IMDB - language_model_learner : Index out of range

language_model_learner is throwing ‘list index out of range error’.

here is the path, and the .pkl file is in this folder

data_lm.path
Out[28]:
PosixPath(’/home/ubuntu/.fastai/data/imdb’)

Has anyone else encountered this, or does anyone have suggestions?

I also tried restarting the kernel…


IndexError Traceback (most recent call last)
in
----> 1 learn = language_model_learner(data_lm, AWD_LSTM, drop_mult=0.3)

~/anaconda3/lib/python3.6/site-packages/fastai/text/learner.py in language_model_learner(data, arch, config, drop_mult, pretrained, pretrained_fnames, **learn_kwargs)
214 return learn
215 model_path = untar_data(meta[url] , data=False)
–> 216 fnames = [list(model_path.glob(f’*.{ext}’))[0] for ext in [‘pth’, ‘pkl’]]
217 learn = learn.load_pretrained(*fnames)
218 learn.freeze()

~/anaconda3/lib/python3.6/site-packages/fastai/text/learner.py in (.0)
214 return learn
215 model_path = untar_data(meta[url] , data=False)
–> 216 fnames = [list(model_path.glob(f’*.{ext}’))[0] for ext in [‘pth’, ‘pkl’]]
217 learn = learn.load_pretrained(*fnames)
218 learn.freeze()

IndexError: list index out of range


FYI&FWIW: Doing some research I found the entry in config.yaml, and tried moving ‘models’ folder there, and coding the location in the variable passed to learner, with same results.

This is most probably a corrupt (pretrained) model download. Try this:

untar_data(URLs.WT103_FWD, force_download=True, c_key='model')