nemo_rl.algorithms.loss.draft#
Module Contents#
Classes#
Raw draft-loss reductions with one entry per pass or block slot. |
|
Functions#
Compute raw soft-CE bins while bounding FP32 vocab work to one token tile. |
Data#
API#
- nemo_rl.algorithms.loss.draft.DEFAULT_DRAFT_TOKEN_CHUNK_SIZE#
4096
- class nemo_rl.algorithms.loss.draft.DraftLossStats#
Raw draft-loss reductions with one entry per pass or block slot.
- numerators: torch.Tensor#
None
- counts: torch.Tensor#
None
- weights: torch.Tensor#
None
- __post_init__() None#
- normalized(*, normalization_counts: torch.Tensor) torch.Tensor#
Normalize local differentiable sums with externally reduced counts.
- nemo_rl.algorithms.loss.draft._tile_log_normalizers(
- student_logits: torch.Tensor,
- teacher_logits: torch.Tensor,
- tp_group: torch.distributed.ProcessGroup | None,
- nemo_rl.algorithms.loss.draft._tile_distributions(
- student_logits: torch.Tensor,
- teacher_logits: torch.Tensor,
- log_normalizers: torch.Tensor,
- nemo_rl.algorithms.loss.draft._cached_tile_distributions_and_cross_entropy(
- student_logits: torch.Tensor,
- teacher_logits: torch.Tensor,
- tp_group: torch.distributed.ProcessGroup | None,
- class nemo_rl.algorithms.loss.draft._CachedVocabParallelSoftCE#
Bases:
torch.autograd.Function- static forward(
- ctx: Any,
- student_logits: torch.Tensor,
- teacher_logits: torch.Tensor,
- mask: torch.Tensor,
- bin_ids: torch.Tensor,
- num_bins: int,
- tp_group: torch.distributed.ProcessGroup | None,
- static backward(
- ctx: Any,
- *grad_outputs: torch.Tensor,
- class nemo_rl.algorithms.loss.draft._StreamingVocabParallelSoftCE#
Bases:
torch.autograd.Function- static forward(
- ctx: Any,
- student_logits: torch.Tensor,
- teacher_logits: torch.Tensor,
- mask: torch.Tensor,
- bin_ids: torch.Tensor,
- num_bins: int,
- token_chunk_size: int,
- tp_group: torch.distributed.ProcessGroup | None,
- static backward(
- ctx: Any,
- *grad_outputs: torch.Tensor,
- nemo_rl.algorithms.loss.draft.streaming_vocab_parallel_soft_ce(
- *,
- student_logits: torch.Tensor,
- teacher_logits: torch.Tensor,
- mask: torch.Tensor,
- token_chunk_size: int,
- tp_group: torch.distributed.ProcessGroup | None,
- bin_ids: torch.Tensor | None = None,
- weights: torch.Tensor | None = None,
Compute raw soft-CE bins while bounding FP32 vocab work to one token tile.