Diffusers documentation

MiniMaxH3Scheduler

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.0 )

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.

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) — A fully-formed sigma schedule, used verbatim (no shifting, no deduplication). It must be strictly decreasing and terminate at 0.0.

Build the sigma / timestep schedule.

The grid is linspace(1, 0, num_inference_steps) pushed through the exponential shift, with consecutive duplicates collapsed. The terminal 0 is already part of that 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: FloatTensorreturn_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.
  • 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.

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.

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