prefetch
optimus_dl.modules.data.transforms.prefetch
¶
PrefetchTransform
¶
Bases: BaseTransform
Transform that pre-fetches data items in a background thread.
This helps hide data loading and transformation latency by keeping a buffer of items ready for the training loop.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cfg
|
PrefetchTransformConfig
|
Prefetching configuration. |
required |
Source code in optimus_dl/modules/data/transforms/prefetch.py
build(source)
¶
Wrap the source node with a Prefetcher.
Source code in optimus_dl/modules/data/transforms/prefetch.py
PrefetchTransformConfig
dataclass
¶
Bases: RegistryConfigStrict
Configuration for prefetching.
Attributes:
| Name | Type | Description |
|---|
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prefetch_factor
|
int
|
|
8
|
snapshot_frequency
|
int
|
|
128
|