Diffusers documentation

MiniMaxH3Scheduler

You are viewing main version, which requires installation from source. If you'd like regular pip install, checkout the latest stable version (v0.42.1).
Hugging Face's logo
Join the Hugging Face community

and get access to the augmented documentation experience

to get started

MiniMaxH3Scheduler

MiniMaxH3Scheduler is the rectified-flow Euler scheduler (eta = 0) with an exponential sigma shift used by MiniMax-H3, sigma' = s * sigma / (1 + (s - 1) * sigma).

The MiniMax-H3 pipelines register two of them, because video and audio latents step down two different schedules inside a single transformer call per step: scheduler carries the video schedule (shift=12.0 in the released checkpoints) and audio_scheduler the audio one (shift=3.0).

MiniMaxH3Scheduler

class diffusers.MiniMaxH3Scheduler

< >

( shift: float = 12.0stochastic_sampling: bool = Falseshift_provided_sigmas: bool | None = None )

Parameters

  • shift (float, defaults to 12.0) — Exponential shift applied to the sigma grid, sigma' = s*sigma / (1 + (s-1)*sigma). The released checkpoints use 12.0 for video latents and 3.0 for audio latents.
  • stochastic_sampling (bool, defaults to False) — Replace the Euler blend with a re-noising update: predict the clean sample, then re-noise it to the next sigma with fresh noise. The few-step Pika H3 Flex adapters were trained for this update; the base checkpoints were not.
  • shift_provided_sigmas (bool, optional) — Whether explicit sigmas passed to set_timesteps() are a base grid the scheduler shifts, like its linspace grid, or a finished schedule taken verbatim. Unset means verbatim with a deprecation warning; the default becomes True in 0.44.0.

Rectified-flow Euler scheduler (eta = 0) with an exponential sigma shift, as used by MiniMax-H3.

index_for_timestep

< >

( timestep: typing.Union[float, torch.Tensor] ) → int

Parameters

  • timestep (float or torch.Tensor) — A value taken from self.timesteps. The schedule is strictly increasing in t, so the match is unique.

Returns

int

The index of timestep.

Map a timestep value to its index in the schedule.

scale_noise

< >

( sample: FloatTensortimestep: typing.Union[float, torch.FloatTensor]noise: FloatTensor ) → torch.FloatTensor

Parameters

  • sample (torch.FloatTensor) — The clean sample x_0.
  • timestep (float or torch.FloatTensor) — The target time in [0, 1]; 1 returns sample unchanged.
  • noise (torch.FloatTensor) — The noise to mix in.

Returns

torch.FloatTensor

The noised sample.

Rectified-flow forward process, in MiniMax-H3’s t convention: x_t = t*x_0 + (1 - t)*noise.

MiniMax-H3 uses this to noise its conditioning anchors, where t is the noise_aug level rather than a schedule entry, so timestep is taken at face value and is not looked up in self.timesteps.

set_begin_index

< >

( begin_index: int = 0 )

Parameters

  • begin_index (int, defaults to 0) — The begin index for the scheduler.

Sets the begin index for the scheduler.

set_shift

< >

( shift: float )

Parameters

  • shift (float) — The exponential shift to use for the next schedule.

Overrides the configured sigma shift; call before set_timesteps().

MiniMax-H3 exposes this per request as flow_shift (video) / audio_flow_shift (audio).

set_timesteps

< >

( num_inference_steps: int | None = Nonedevice: typing.Union[str, torch.device, NoneType] = Nonesigmas: typing.Union[list[float], torch.Tensor, NoneType] = None )

Parameters

  • num_inference_steps (int, optional) — Number of sigma grid points, terminal 0 included. Ignored when sigmas is given.
  • device (str or torch.device, optional) — Device the schedule tensors are moved to. The grid itself is always built on CPU in float32 so the schedule does not depend on the accelerator.
  • sigmas (list[float] or torch.Tensor, optional) — An explicit grid, strictly decreasing and terminating at 0.0. With shift_provided_sigmas=True it is a base grid in [0, 1] that goes through the shift like the linspace grid; otherwise it is used verbatim (deprecated default).

Build the sigma / timestep schedule.

The grid is linspace(1, 0, num_inference_steps) pushed through the exponential shift, with consecutive duplicates collapsed, or the explicit sigmas, shifted as well when shift_provided_sigmas is set. The terminal 0 is already part of the grid — the shift maps 0 to exactly 0 — so the schedule holds num_inference_steps sigmas and drives num_inference_steps - 1 model evaluations, exposed as self.timesteps = 1 - sigmas[:-1].

step

< >

( model_output: FloatTensortimestep: typing.Union[float, torch.FloatTensor]sample: FloatTensorgenerator: typing.Optional[torch.Generator] = Nonereturn_dict: bool = True ) → MiniMaxH3SchedulerOutput or tuple

Parameters

  • model_output (torch.FloatTensor) — The transformer’s velocity prediction at timestep.
  • timestep (float or torch.FloatTensor) — The current timestep, one of self.timesteps (so timestep == 1 - sigma).
  • sample (torch.FloatTensor) — The current sample x_t.
  • generator (torch.Generator, optional) — The generator the fresh noise is drawn from with stochastic_sampling; unused otherwise.
  • return_dict (bool, defaults to True) — Whether to return a MiniMaxH3SchedulerOutput instead of a plain tuple.

Returns

MiniMaxH3SchedulerOutput or tuple

the sample for the next step.

Take one Euler (eta = 0) step, or one re-noising step with stochastic_sampling.

The model output is a data-ward velocity, so the denoised estimate is x0 = x_t + (1 - t) * v — note the +, the opposite of the usual flow-match convention. The update is then the blend x_next = r*x_t + (1 - r)*x0 with r = sigma_next / sigma, evaluated in float32 for half-precision samples. With stochastic_sampling the update is x_next = (1 - sigma_next) * x0 + sigma_next * noise with fresh noise from generator, everything in float32, so the last step (sigma_next = 0) returns x0.

MiniMaxH3SchedulerOutput

class diffusers.schedulers.scheduling_minimax_h3.MiniMaxH3SchedulerOutput

< >

( prev_sample: FloatTensor )

Parameters

  • prev_sample (torch.FloatTensor) — Computed sample x_{t+1} for the next step of the denoising loop.

Output class for the scheduler’s step function output.

Update on GitHub