nemo_automodel.components.models.deepseek_v41.quantization
nemo_automodel.components.models.deepseek_v41.quantization
Reference cache QAT formats with straight-through activation gradients.
Module Contents
Classes
Functions
API
Bases: Function
Quantize cache values in forward and pass the activation gradient unchanged.
Pass the gradient for […, channels] activations through quantization.
Parameters:
Unused forward context.
Tensor of shape […, channels] from the cache consumer.
Returns: torch.Tensor
Gradient of shape […, channels], followed by no gradients for the
Round independent channel groups without modifying the input.
Parameters:
Autograd context; no tensors need saving for the straight-through gradient.
Tensor of shape […, channels], with arbitrary leading dimensions.
Consecutive channels sharing a quantization scale.
fp8, mxfp4 (E8M0 scale), or nvfp4 (E4M3 scale).
Returns: torch.Tensor
Independently stored tensor of shape […, channels] with input dtype.
Round positive normal FP32 values up to an exactly represented power of two.
Parameters:
Positive FP32 tensor of arbitrary shape.
Returns: torch.Tensor
FP32 tensor of the same shape with integer powers of two, matching the
Apply the released model’s quantize/dequantize cache representation.
Parameters:
Tensor of shape […, channels], with arbitrary leading dimensions. Complete groups are required by the released kernels; a final partial group is zero-padded internally for scaled unit-test configurations.
fp8 for SWA KV, mxfp4 for index Q/K, nvfp4 for compressed KV.
Channels per scale: 32 for SWA/indexer, 16 for compressed KV.
Returns: torch.Tensor
Tensor of shape […, channels], in the original dtype, with a