nemo_automodel.components.speculative.streaming.loader
nemo_automodel.components.speculative.streaming.loader
Streaming consumer for speculative-decoding draft training.
:class:FeatureDataLoader is a Python iterator over
:class:Eagle3TargetBatch. It pulls one :class:SampleRef lease at a
time from a :class:SampleRefQueue, materializes the tensors through a
:class:FeatureStore, hands the trainer a fresh
:class:Eagle3TargetBatch, and releases the previous lease on every
__next__ call — so the trainer can hold one batch across one full
forward without it being freed mid-forward.
The loader is per-rank and the leases stay on-rank; the queue + store live in the same Python process as the consumer. FSDP / CP / EP parallelism lives inside the trainer’s forward / backward and is unaffected by the loader’s lifecycle.
Module Contents
Classes
Functions
Data
API
Iterator over :class:Eagle3TargetBatch materialized from a streaming queue.
Parameters:
The metadata-only queue the producer puts :class:SampleRef
onto. queue.close() at any time cuts the iterator short.
The :class:FeatureStore each lease will be materialized
through. Must match ref.store_uri for the leased refs.
:class:FeatureAlgorithm the loader runs the
per-algorithm schema check for; defaults to EAGLE-3.
Ack the most recent lease / release its store handle and shut the queue.
After close the iterator raises :class:StopIteration on
the next pull. Idempotent so a trainer can use with safely.
Release the most recently yielded batch eagerly.
Useful for trainer hooks that want to free memory before
pulling the next batch (e.g. immediately after backward()).
Idempotent.
Build an :class:Eagle3TargetBatch from the store’s tensors.
Pulled into a module-level helper so the per-algorithm batch-building logic lives in one place and adding DFlash / DSpark only requires a new branch here.