Open-source experiment · PyTorch
Dataloader Optimization
Experiments on the path from stored images to GPU-ready batches.
I explored data-loading bottlenecks in PyTorch with CIFAR-10 and CelebA, then published the code and a technical write-up. The project looks at why a GPU may wait for data and what can be done at different points in the loading pipeline.
- Period
- 2021
- My role
- Author · Implementation and technical write-up
- Scope
- Data loading, transfer, chunk caching, and batch reuse
01 / The bottleneck
Prepare another batch while the GPU trains
A GPU can finish its current batch before the next one is ready. I explored multiprocess loading and prefetching so CPU workers could prepare upcoming batches while training continued.
Prepare
Hold next batch
Train
02 / The experiments
Match the intervention to the bottleneck
Other experiments addressed different costs: keeping images in a compact data type before conversion, using HDF5 chunks and caching, and reusing a batch through batch echoing.
Batch echoing performs more updates on a batch that has already been transferred. My write-up discusses the tradeoff with randomness. High utilization alone does not show that training quality is preserved.
HDF5 chunks + cache
Multiprocess loading
Compact image representation
Batch echoing
03 / The artifact
Publish the code and the reasoning
The repository contains separate CIFAR-10 and CelebA scripts, chunking and batch-echoing variants, and a write-up explaining the choices. The original article is also available on this site.
Contribution & outcome
Code and a write-up others can inspect
- My contribution
- Experimental implementations and a public explanation of the data-loading pipeline.
- Published material
- Source code and historical CIFAR-10/CelebA experiment notes.
The historical utilization observations depend on the experiment setup. These experiments were not rerun for this portfolio, and no general speedup across hardware is claimed.