I tried to implement custom IteratableDataset
with Dataloder
as follows:
class LazyDataset(IterableDataset):
def __init__(self, file_dir):
self.file_dir = file_dir
self.files = os.listdir(file_dir)
def __len__(self) -> int:
return len(self.files)
def __iter__(self):
for file in self.files:
# read and preprocess file
yield data
train_dataset = LazyDataset('/train')
train_loader = DataLoader(train_dataset,
batch_size=args.train_batch_size,
num_workers=args.n_workers
)
Its works fine but when I integrate with ignite-engine it throws following exception:
"batch_sampler option, but got batch_sampler={}".format(batch_sampler))
ValueError: DataLoader with IterableDataset: expected unspecified batch_sampler option, but got batch_sampler=<ignite.engine.engine.ReproducibleBatchSampler
How can I fix the above problem?