I got an error after train fase when start _do_epoch_validate(),
what’s wrong?
Thanks
Here my code and the error, indexes is a list
dblock = DataBlock(get_x=getData, get_y= label_func, splitter=RandomSplitter())
dsets = dblock.datasets(indexes)
setattr(dsets, ‘device’, ‘cuda’)
dls=DataLoaders.from_dsets(dsets,device=‘cuda’,bs=100,num_workers=2)
learn = Learner(dls, model, loss_func=MyLoss())
learn.fit_one_cycle(1, lr_max=slice(1e-3, 1e-2))
epoch train_loss valid_loss time
0 -0.001312 00:08
IndexError Traceback (most recent call last)
in
----> 1 learn.fit_one_cycle(1, lr_max=slice(1e-3, 1e-2))
~/anaconda3/lib/python3.7/site-packages/fastcore/utils.py in _f(*args, **kwargs)
429 init_args.update(log)
430 setattr(inst, ‘init_args’, init_args)
→ 431 return inst if to_return else f(*args, **kwargs)
432 return _f
433
~/anaconda3/lib/python3.7/site-packages/fastai2/callback/schedule.py in fit_one_cycle(self, n_epoch, lr_max, div, div_final, pct_start, wd, moms, cbs, reset_opt)
111 scheds = {‘lr’: combined_cos(pct_start, lr_max/div, lr_max, lr_max/div_final),
112 ‘mom’: combined_cos(pct_start, *(self.moms if moms is None else moms))}
→ 113 self.fit(n_epoch, cbs=ParamScheduler(scheds)+L(cbs), reset_opt=reset_opt, wd=wd)
114
115 # Cell
~/anaconda3/lib/python3.7/site-packages/fastcore/utils.py in _f(*args, **kwargs)
429 init_args.update(log)
430 setattr(inst, ‘init_args’, init_args)
→ 431 return inst if to_return else f(*args, **kwargs)
432 return _f
433
~/anaconda3/lib/python3.7/site-packages/fastai2/learner.py in fit(self, n_epoch, lr, wd, cbs, reset_opt)
199 self.epoch=epoch; self(‘begin_epoch’)
200 self._do_epoch_train()
→ 201 self._do_epoch_validate()
202 except CancelEpochException: self(‘after_cancel_epoch’)
203 finally: self(‘after_epoch’)
~/anaconda3/lib/python3.7/site-packages/fastai2/learner.py in _do_epoch_validate(self, ds_idx, dl)
178
179 def _do_epoch_validate(self, ds_idx=1, dl=None):
→ 180 if dl is None: dl = self.dls[ds_idx]
181 try:
182 self.dl = dl; self(‘begin_validate’)
~/anaconda3/lib/python3.7/site-packages/fastai2/data/core.py in getitem(self, i)
129 self.device = device
130
→ 131 def getitem(self, i): return self.loaders[i]
132 def new_empty(self):
133 loaders = [dl.new(dl.dataset.new_empty()) for dl in self.loaders]
IndexError: list index out of range