Hi,
so far in the book I foun examples where a dls (DataLoaders) is built from a DataBlock(…).dataloaders(path_to_the_images_folder).
Is it possible to build a dls given two DataLoader? One for the training and one for the validation.
For example
train_set = dset[0:50000]
valid_set = dset[50000:]
dl = DataLoader(train_set, batch_size=bs, shuffle=True)
valid_dl = DataLoader(valid_set, batch_size=bs)
dls = ??? how ???
learn = cnn_learner(dls, resnet34, metrics=error_rate)
The dl dataloader and the valid_dl dataloader already contains x and y, i can iterate over them like that
for x,y in dl:
print("input", x)
print("target", y)
I tried to do that, but it doesn’t work
dls = DataLoaders(dl, valid_dl)
learn = cnn_learner(dls, resnet34, metrics=error_rate)
----> 2 learn = cnn_learner(dls, resnet34, metrics=error_rate)
1 frames
/usr/local/lib/python3.7/dist-packages/fastai/vision/learner.py in _add_norm(dls, meta, pretrained)
154 if not pretrained: return
155 after_batch = dls.after_batch
--> 156 if first(o for o in after_batch.fs if isinstance(o,Normalize)): return
157 stats = meta.get('stats')
158 if stats is None: return
AttributeError: 'function' object has no attribute 'fs'