nemo_automodel.components.flow_matching.time_shift_utils
nemo_automodel.components.flow_matching.time_shift_utils
Module Contents
Functions
API
Sample timesteps from different distributions for better training coverage.
Parameters:
“logit_normal” or “mode” for the corresponding transform. “uniform” and any other value use uniform sampling.
number of samples to generate
mean for logit-normal distribution
std for logit-normal distribution
scale for mode-based sampling
Returns: torch.Tensor
Tensor of shape [batch_size] on the CPU, using PyTorch’s default floating-point dtype. Logit-normal samples
Compute loss weights for flow matching based on sigma values.
Higher sigma (more noise) typically gets higher weight.
Parameters:
Floating-point tensor of arbitrary shape containing sigma values in the range [0, 1].
weight scaling factor
Returns: torch.Tensor
New tensor of loss weights with the same shape, dtype, and device as sigma. The result does not alias
Convert timesteps to sigmas with sequence-length-aware shifting.
Parameters:
Tensor of arbitrary shape containing timesteps in the range [0, 1].
number of tokens (frames * height * width / patch_size^2)
“linear”, “sqrt”, or “constant”. Any other value returns t unchanged.
base shift for linear mode
max shift for linear mode
shift value for constant mode (default 3.0 matches Pika)
Returns: torch.Tensor
Tensor with the same shape as t containing sigma values. Shifted floating-point results preserve the