Lesson 12 NLP dive

Hi,
Executing the below ‘learn’ lines gives an error

learn = Learner(dls, LMModel1(len(vocab), 64), loss_func=F.cross_entropy,
metrics=accuracy)
learn.fit_one_cycle(4, 1e-3)

Error message -
AttributeError Traceback (most recent call last)
in
1 learn = Learner(dls, LMModel1(len(vocab), 64), loss_func=F.cross_entropy,
2 metrics=accuracy)
----> 3 learn.fit_one_cycle(4, 1e-3) #shows error

/opt/conda/lib/python3.7/site-packages/fastai/train.py in fit_one_cycle(learn, cyc_len, max_lr, moms, div_factor, pct_start, final_div, wd, callbacks, tot_epochs, start_epoch)
21 callbacks.append(OneCycleScheduler(learn, max_lr, moms=moms, div_factor=div_factor, pct_start=pct_start,
22 final_div=final_div, tot_epochs=tot_epochs, start_epoch=start_epoch))
—> 23 learn.fit(cyc_len, max_lr, wd=wd, callbacks=callbacks)
24
25 def fit_fc(learn:Learner, tot_epochs:int=1, lr:float=defaults.lr, moms:Tuple[float,float]=(0.95,0.85), start_pct:float=0.72,

/opt/conda/lib/python3.7/site-packages/fastai/basic_train.py in fit(self, epochs, lr, wd, callbacks)
197 if not getattr(self, ‘opt’, False): self.create_opt(lr, wd)
198 else: self.opt.lr,self.opt.wd = lr,wd
–> 199 callbacks = [cb(self) for cb in self.callback_fns + listify(defaults.extra_callback_fns)] + listify(callbacks)
200 fit(epochs, self, metrics=self.metrics, callbacks=self.callbacks+callbacks)
201

/opt/conda/lib/python3.7/site-packages/fastai/basic_train.py in (.0)
197 if not getattr(self, ‘opt’, False): self.create_opt(lr, wd)
198 else: self.opt.lr,self.opt.wd = lr,wd
–> 199 callbacks = [cb(self) for cb in self.callback_fns + listify(defaults.extra_callback_fns)] + listify(callbacks)
200 fit(epochs, self, metrics=self.metrics, callbacks=self.callbacks+callbacks)
201

/opt/conda/lib/python3.7/site-packages/fastai/basic_train.py in init(self, learn, add_time, silent)
459 if not getattr(self.learn, ‘opt’, False): self.learn.create_opt(defaults.lr, self.learn.wd)
460 self.opt = self.learn.opt
–> 461 self.train_dl = self.learn.data.train_dl
462 self.no_val,self.silent,self.add_time = False,silent,add_time
463

/opt/conda/lib/python3.7/site-packages/fastcore/foundation.py in getattr(self, k)
238 if self._component_attr_filter(k):
239 attr = getattr(self,self._default,None)
–> 240 if attr is not None: return getattr(attr,k)
241 raise AttributeError(k)
242 def dir(self): return custom_dir(self,self._dir())

/opt/conda/lib/python3.7/site-packages/fastcore/foundation.py in getattr(self, k)
238 if self._component_attr_filter(k):
239 attr = getattr(self,self._default,None)
–> 240 if attr is not None: return getattr(attr,k)
241 raise AttributeError(k)
242 def dir(self): return custom_dir(self,self._dir())

AttributeError: ‘L’ object has no attribute ‘train_dl’

Variable ‘seqs’ is a List. Tried to refer docs.fast.ai but is a learner built from scratch. Why can this list object not have attribute train_dl? May be I am not looking at the right help source page.

Please ignore above, the error disappeared when I restarted the notebook.