nemo_automodel.components.datasets.zephon.loader
nemo_automodel.components.datasets.zephon.loader
Checkpointable Zephon stream with all-rank aggregation of opaque loader state.
Module Contents
Classes
Functions
Data
API
Bases: Iterator[TrainingBatch]
One owned stream; iteration never reconstructs the work source.
use_distributed_checkpointing selects BaseRecipe’s all-rank auxiliary
state path so TP/PP peers participate in Zephon checkpoint collectives as
well as data-owning ranks. StatefulDataLoader checkpoint routing saves only
data-owning ranks and cannot provide that participation.
The original SampleBatch keeps Zephon replay/accounting metadata unchanged. The consumer calls to_training and applies lightweight model-input adaptations.
Release owned workers at completion, failure, or an explicit training cap.
Restore opaque bytes before iteration; empty state requires a fresh loader.
Parameters:
Mapping containing zephon checkpoint bytes. Empty bytes
represent a stream that has never started or been restored.
Nonempty bytes are validated and restored by Zephon.
Return opaque checkpoint bytes, or empty bytes for an unstarted stream.
DCP calls this method before loading. An unstarted loader returns its initial or restored state without initializing or calibrating a pipeline. Once iteration starts, every rank collects the complete aggregated state, including after exhaustion or close.
Returns: dict[str, bytes]
Mapping containing zephon bytes for the current stream position.
Collate text, retaining boundaries independently of the model’s positions.
Parameters:
Prepared documents with unshifted token IDs and scalar subdocument-reset positions [sequence] in each payload. Positions come from online packing, an offline export, or single-document defaults.
Model-derived return requests; mask and gathered-token requests apply only to batched output.
Loss exclusion value for shifted labels.
Mask targets at original subdocument boundaries.
Allow earlier subdocuments as context and number each packed document continuously for RoPE.
Batched mask/metadata route or native THD lengths.
Unshifted target length when online packing is disabled. Shorter supplied documents are padded, with padding excluded from loss.
Resolved model padding ID, required with pad_to_length.
Returns: TrainingBatch
Token IDs, labels, positions, padding and compact boundary/attention IDs