nirandaperera:

shouldn’t the data loading threads load batches ahead of time? Is this an expected behavior for the multi-process dataloader (slow-down in every num_workers batch)?


Each worker is starting to load the next batch once the current one was returned.
However, if the actual workload is small, you would basically just use the data loading loop as:
for data in loader:
    pass

This dummy loop would have a startup time, yield the next batches pretty fast and slow down again, as each worker has to load the next batch.
Your current output looks interesting, as I thought you have already used 10 workers (which would explain the slow down after 10 iterations).
What’s the difference between the new output and the previous one?