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: fork
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 samples. Chunks are mixed within it; aim for a buffer-to-chunk ratio above 10:1. |
int |
required |
|
Whether to shuffle whole chunks as blocks. |
bool |
|
|
Number of worker processes loading data. |
int |
required |
|
Number of batches each worker prefetches. |
int |
required |
|
Multiprocessing start method. |
|
required |
|
Keep worker processes alive between epochs. |
bool |
required |