Error in _do_epoch_validate

I got an error after train fase when start _do_epoch_validate(),
what’s wrong?

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’)
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)
----> 1 learn.fit_one_cycle(1, lr_max=slice(1e-3, 1e-2))

~/anaconda3/lib/python3.7/site-packages/fastcore/ 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

~/anaconda3/lib/python3.7/site-packages/fastai2/callback/ 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, cbs=ParamScheduler(scheds)+L(cbs), reset_opt=reset_opt, wd=wd)
115 # Cell

~/anaconda3/lib/python3.7/site-packages/fastcore/ 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

~/anaconda3/lib/python3.7/site-packages/fastai2/ 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/ in _do_epoch_validate(self, ds_idx, dl)
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/ in getitem(self, i)
129 self.device = device
–> 131 def getitem(self, i): return self.loaders[i]
132 def new_empty(self):
133 loaders = [ for dl in self.loaders]

IndexError: list index out of range

blocks parameter is missing.

We don’t know what getData and label_func do

I’m trying to implement a deep direct reinforcement learning
getData returns a matrix that represents a single episode

 def getData(index):
     return Tensor(df.values.astype(float)).to(float)

label_func is fake because i dont need it

def label_func(index):
return 1

this is the output of learn.dls.one_batch() with bs=1

(tensor([[[ 3.7500e-04, -9.7500e-04, 1.0000e+00, 0.0000e+00, 0.0000e+00],
[ 3.7500e-04, -9.5000e-04, 1.0000e+00, 1.0000e+00, -2.0000e-04],
[ 3.7500e-04, -8.2500e-04, 1.0000e+00, 2.0000e+00, -5.0000e-05],
[ 8.5000e-04, -5.2500e-04, 1.0000e+00, 4.6300e+02, 0.0000e+00],
[ 8.5000e-04, -4.7500e-04, 1.0000e+00, 4.6400e+02, -5.0000e-05],
[ 8.5000e-04, -4.5000e-04, 1.0000e+00, 4.6500e+02, nan]]],
device=‘cuda:0’, dtype=torch.float64),
tensor([1], device=‘cuda:0’))

I solved

dl=DataLoaders.from_dsets(dsets.train,dsets.valid,device=‘cuda’,bs=100, num_workers=2)