'DataLoader' object is not subscriptable

I created a custom dataset class using torch.utils.data.Dataset and created a fastai dataloader from torch dataset using fastai.data.load.DataLoader.

Then I created separate train and validation data loaders this way and created DataLoaders using fastai.data.core.DataLoaders. This Dataloaders object is used in learner (fastai.learner.Learner).

Now when I try to fit the learner, the following error is thrown:

 learn.fit(config.epochs, cbs=[best_save_cb])        
  File "/home/bala/anaconda3/envs/vt_fv2/lib/python3.8/site-packages/fastai/learner.py", line 221, in fit
    self._with_events(self._do_fit, 'fit', CancelFitException, self._end_cleanup)
  File "/home/bala/anaconda3/envs/vt_fv2/lib/python3.8/site-packages/fastai/learner.py", line 163, in _with_events
    try: self(f'before_{event_type}');  f()
  File "/home/bala/anaconda3/envs/vt_fv2/lib/python3.8/site-packages/fastai/learner.py", line 212, in _do_fit
    self._with_events(self._do_epoch, 'epoch', CancelEpochException)
  File "/home/bala/anaconda3/envs/vt_fv2/lib/python3.8/site-packages/fastai/learner.py", line 163, in _with_events
    try: self(f'before_{event_type}');  f()
  File "/home/bala/anaconda3/envs/vt_fv2/lib/python3.8/site-packages/fastai/learner.py", line 206, in _do_epoch
    self._do_epoch_train()
  File "/home/bala/anaconda3/envs/vt_fv2/lib/python3.8/site-packages/fastai/learner.py", line 198, in _do_epoch_train
    self._with_events(self.all_batches, 'train', CancelTrainException)
  File "/home/bala/anaconda3/envs/vt_fv2/lib/python3.8/site-packages/fastai/learner.py", line 163, in _with_events
    try: self(f'before_{event_type}');  f()
  File "/home/bala/anaconda3/envs/vt_fv2/lib/python3.8/site-packages/fastai/learner.py", line 169, in all_batches
    for o in enumerate(self.dl): self.one_batch(*o)
  File "/home/bala/anaconda3/envs/vt_fv2/lib/python3.8/site-packages/fastai/learner.py", line 193, in one_batch
    self._split(b)
  File "/home/bala/anaconda3/envs/vt_fv2/lib/python3.8/site-packages/fastai/learner.py", line 160, in _split
    self.xb,self.yb = b[:i],b[i:]
TypeError: 'DataLoader' object is not subscriptable

Could someone point to the procedure to use a custom torch dataset in fastai?

PS: I am using fastai v2.5.2