Has anyone here succeed to load a normal dataloader or dataset (in pytorch) into a databunch of fastai?
Me when i tried to load it into databunch, then when i try to display one batch in dataloader, it gives me an error ‘DataBunch’ object is not subscriptable
Here what i’ve done so far:
train_dataset = ... val_dataset = ... collate_fn = ... train_dl = torch.utils.data.Dataloader(train_dataset, batch_size=4, collate_fn = _collate_fn, num_workers=1) val_dl = torch.utils.data.Dataloader(val_dataset, batch_size=4, collate_fn= _collate_fn, num_workers=1) #load into databunch from fastai.basic_data import DataBunch data = DataBunch(train_dl=train_dl, valid_dl= val_dl)
Then when i try to run each batch:
for xb, yb in progress_bar(data.train_dl): print(xb)
It gives me an error: TypeError: ‘DataBunch’ object is not subscriptable
It seems the library lacks a flexibility when we want to customize our dataset and model or I miss something here?