Create a FlowMatch Euler Discrete Scheduler
Description
Creates a FlowMatch scheduler for use with flow-matching diffusion models like LTX-2. FlowMatch schedulers use Euler integration for sampling, which is simpler and often faster than DDIM-style schedulers.
Usage
flowmatch_scheduler_create(num_train_timesteps = 1000L, shift = 1,
use_dynamic_shifting = FALSE, base_shift = 0.5,
max_shift = 1.15, base_seq_len = 256L,
max_seq_len = 4096L, invert_sigmas = FALSE,
shift_terminal = NULL,
time_shift_type = c("exponential", "linear"))
Arguments
num_train_timesteps: Integer. The number of diffusion steps used to train the model. Default: 1000shift: Numeric. The shift value for the timestep schedule. Default: 1.0use_dynamic_shifting: Logical. Whether to apply timestep shifting on-the-fly based on the image/video resolution. Default: FALSEbase_shift: Numeric. Value to stabilize generation. Increasing reduces variation. Default: 0.5max_shift: Numeric. Maximum shift allowed. Increasing encourages more variation. Default: 1.15base_seq_len: Integer. Base sequence length for dynamic shifting. Default: 256max_seq_len: Integer. Maximum sequence length for dynamic shifting. Default: 4096invert_sigmas: Logical. Whether to invert the sigmas (used by some models like Mochi). Default: FALSEshift_terminal: Numeric or NULL. End value of shifted schedule. Default: NULLtime_shift_type: Character. Type of dynamic shifting: “exponential” or “linear”. Default: “exponential”
Details
FlowMatch (Flow Matching) is a framework for training continuous normalizing flows by regressing onto target probability paths. The Euler discrete scheduler implements simple Euler integration for sampling from trained flow models.
The core update rule is:
prev_sample = sample + dt * model_output
where dt = sigma_next - sigma_current.
Value
A FlowMatch scheduler object (list) containing:
- sigmas: The noise schedule
- timesteps: The timestep schedule
- num_train_timesteps: Training timesteps
- config: All configuration parameters
References
Lipman, Y., Chen, R. T. Q., Ben-Hamu, H., Nickel, M., & Le, M. (2022). “Flow Matching for Generative Modeling.” https://arxiv.org/abs/2210.02747
Examples
# Create a FlowMatch scheduler
scheduler <- flowmatch_scheduler_create(
num_train_timesteps = 1000,
shift = 1.0
)
# Set timesteps for inference
scheduler <- flowmatch_set_timesteps(scheduler, num_inference_steps = 8)