nemo_automodel.components.loss.linear_ce
nemo_automodel.components.loss.linear_ce
Module Contents
Classes
Functions
Data
API
Bases: LinearCrossEntropy
Fused linear-projection and cross-entropy loss module.
Compute fused linear cross entropy matching PyTorch behavior.
Parameters:
Rank-local hidden states with shape
[batch, sequence, hidden].
Rank-local target token IDs with shape [batch, sequence].
LM-head weight with global shape [vocab, hidden].
It may be a regular tensor or an FSDP-sharded DTensor.
Global number of non-padding target tokens used to normalize a sum-reduced loss.
Group that contributes independent loss shards
when lm_weight is a sharded DTensor.
Optional per-token multipliers matching
labels.shape. Only supported with reduction="sum".
Returns: torch.Tensor
Scalar loss tensor on the same device as hidden_states. The
Check if pytorch-triton/triton version is greater than or equal to the specified version.
Parameters:
Version string to check
Returns:
True if pytorch-triton/triton version >= specified version
Check if pytorch-triton/triton version is greater than or equal to 3.1.0.
Returns:
True if pytorch-triton/triton version >= 3.1.0