Skip to content

flux_2_timestep_preparation

Flux2-specific timestep preparation.

Classes

fastvideo.pipelines.basic.flux_2.flux_2_timestep_preparation.Flux2TimestepPreparationStage

Flux2TimestepPreparationStage(scheduler)

Bases: TimestepPreparationStage

Flux2 timestep preparation matching the Diffusers Flux2 schedule.

Source code in fastvideo/pipelines/stages/timestep_preparation.py
def __init__(self, scheduler) -> None:
    self.scheduler = scheduler

Functions:

fastvideo.pipelines.basic.flux_2.flux_2_timestep_preparation.compute_empirical_mu

compute_empirical_mu(image_seq_len: int, num_steps: int) -> float

Resolution-dependent mu for Flux2 flow-match scheduler. From Black Forest Labs flux2 official repo: sampling.compute_empirical_mu.

Source code in fastvideo/pipelines/basic/flux_2/flux_2_timestep_preparation.py
def compute_empirical_mu(image_seq_len: int, num_steps: int) -> float:
    """
    Resolution-dependent mu for Flux2 flow-match scheduler.
    From Black Forest Labs flux2 official repo: sampling.compute_empirical_mu.
    """
    a1, b1 = 8.73809524e-05, 1.89833333
    a2, b2 = 0.00016927, 0.45666666

    if image_seq_len > 4300:
        return float(a2 * image_seq_len + b2)

    m_200 = a2 * image_seq_len + b2
    m_10 = a1 * image_seq_len + b1
    a = (m_200 - m_10) / 190.0
    b = m_200 - 200.0 * a
    return float(a * num_steps + b)