Data
The data service provides the data loaders that feed the training, validation, and test loops. It turns the dataset into shuffled, batched graphs delivered to the model, and centralizes the knobs that govern batching, shuffling, and worker parallelism.
Usage
Configured under services.data.
services:
data:
batch_size: 2048
buffer_size: 16384
chunk_size: 4096
num_workers: 8
prefetch_factor: 8
mp_context: spawn
persistent_workers: true
How it works
Samples are read in contiguous chunks and passed through a shuffle buffer so that batches can mix across chunk boundaries without holding the whole dataset in memory. A pool of worker processes reads and assembles batches ahead of the model to reduce I/O latency. The service builds and caches one loader per requested split.
Configuration
Option |
Description |
Type |
Default |
|---|---|---|---|
|
Number of samples per batch. |
int |
required |
|
Number of samples read as one contiguous block. |
int |
required |
|
Size of the shuffle buffer, in chunks. Chunks are mixed within it; aim for >10 if memory allows. |
int |
required |
|
Whether to shuffle whole chunks as blocks. |
bool |
|
|
Fraction of the buffer size at which a refill is triggered. |
float |
0.25 |
|
Maximum number of chunks drawn per epoch. Chunk order is reshuffled each
epoch, so the full dataset is still covered after roughly
\(E \approx \frac{C}{K}\left(\ln C + \gamma\right)\) epochs, where
\(C = \lfloor N / S \rfloor\) is the total chunk count for \(N\)
samples of |
int |
|
|
Number of worker processes loading data. |
int |
required |
|
Number of batches each worker prefetches. |
int |
required |
|
Multiprocessing start method, ‘fork’ is not supported. |
|
required |
|
Keep worker processes alive between epochs. Highly recommended for performance. |
bool |
required |