nemo_automodel.components.speculative.eagle.target_v12
nemo_automodel.components.speculative.eagle.target_v12
Target-model wrapper for EAGLE-1 / EAGLE-2 training.
Module Contents
Classes
Functions
API
Target-model outputs needed by the EAGLE-1 / EAGLE-2 trainer.
position_ids / seq_lens / doc_remaining are None on the
unpacked path and carry the packing metadata (unshifted, indexed by slot)
through to the trainer on the packed path.
Thin wrapper that exposes hidden-state supervision from a causal LM.
Run the target transformer and prepare shifted supervision tensors.
All per-token inputs are [B, T]. With seq_lens ([B, max_docs]
long, per-document lengths summing to T) the target runs with a
document-level block-causal mask and per-document position_ids so its
hidden states do not leak across document boundaries; SDPA/eager targets
consume the [B, 1, T, T] block-causal additive mask, FlashAttention
targets infer document boundaries from position_ids and are passed
attention_mask=None (batch size 1 only). position_ids / seq_lens
/ doc_remaining are carried through (unshifted) so the trainer can build
the draft’s block-causal mask and drop cross-document supervision.
Return the target model input embeddings.
Return the target model lm_head.
Shift a batched sequence tensor left and zero-fill the tail.
Materialise a (possibly tensor-parallel) tensor as a plain local tensor.
With a tensor-parallel target the lm_head is column-parallel, so its logits
come back as a vocab-sharded DTensor. The draft consumes plain tensors,
so gather the full tensor before handing it on. A no-op for an already-plain
(unsharded or pure-FSDP-replicated) tensor.