How do i batch in streaming of data set

This might be it. The benefit is probably that it will be processed in parallel according to the number of workers?

Now you can iterate on batches using

for batch in train_ds.iter(batch_size=32):
    ...