# MiniMaxH3Scheduler

`MiniMaxH3Scheduler` is the rectified-flow Euler scheduler (`eta = 0`) with an exponential sigma shift used by [MiniMax-H3](https://huggingface.co/MiniMaxAI), `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[[diffusers.MiniMaxH3Scheduler]]

#### diffusers.MiniMaxH3Scheduler[[diffusers.MiniMaxH3Scheduler]]

```python
diffusers.MiniMaxH3Scheduler(shift: float = 12.0, stochastic_sampling: bool = False, shift_provided_sigmas: bool | None = None, euler_update_form: str = 'blend')
```

[Source](https://github.com/huggingface/diffusers/blob/v0.43.0/src/diffusers/schedulers/scheduling_minimax_h3.py#L73)

**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()](/docs/diffusers/v0.43.0/en/api/schedulers/minimax_h3#diffusers.MiniMaxH3Scheduler.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.

euler_update_form (`str`, defaults to `"blend"`) : How the Euler update is evaluated. `"blend"` is the `x_t` / `x0` blend `x_next = r*x_t + (1 - r)*x0`; `"velocity"` is `x_next = x_t + (sigma - sigma_next) * v`, in float32. They are the same update and differ only in float32 rounding; MiniMax-H3-Image was distilled with the velocity form.

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

#### index_for_timestep[[diffusers.MiniMaxH3Scheduler.index_for_timestep]]

```python
index_for_timestep(timestep: typing.Union[float, torch.Tensor])
```

[Source](https://github.com/huggingface/diffusers/blob/v0.43.0/src/diffusers/schedulers/scheduling_minimax_h3.py#L225)

**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[[diffusers.MiniMaxH3Scheduler.scale_noise]]

```python
scale_noise(sample: FloatTensor, timestep: typing.Union[float, torch.FloatTensor], noise: FloatTensor)
```

[Source](https://github.com/huggingface/diffusers/blob/v0.43.0/src/diffusers/schedulers/scheduling_minimax_h3.py#L246)

**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[[diffusers.MiniMaxH3Scheduler.set_begin_index]]

```python
set_begin_index(begin_index: int = 0)
```

[Source](https://github.com/huggingface/diffusers/blob/v0.43.0/src/diffusers/schedulers/scheduling_minimax_h3.py#L138)

**Parameters:**

begin_index (`int`, defaults to `0`) : The begin index for the scheduler.

Sets the begin index for the scheduler.

#### set_shift[[diffusers.MiniMaxH3Scheduler.set_shift]]

```python
set_shift(shift: float)
```

[Source](https://github.com/huggingface/diffusers/blob/v0.43.0/src/diffusers/schedulers/scheduling_minimax_h3.py#L148)

**Parameters:**

shift (`float`) : The exponential shift to use for the next schedule.

Overrides the configured sigma shift; call before [set_timesteps()](/docs/diffusers/v0.43.0/en/api/schedulers/minimax_h3#diffusers.MiniMaxH3Scheduler.set_timesteps).

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

#### set_timesteps[[diffusers.MiniMaxH3Scheduler.set_timesteps]]

```python
set_timesteps(num_inference_steps: int | None = None, device: typing.Union[str, torch.device, NoneType] = None, sigmas: typing.Union[list[float], torch.Tensor, NoneType] = None)
```

[Source](https://github.com/huggingface/diffusers/blob/v0.43.0/src/diffusers/schedulers/scheduling_minimax_h3.py#L162)

**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[[diffusers.MiniMaxH3Scheduler.step]]

```python
step(model_output: FloatTensor, timestep: typing.Union[float, torch.FloatTensor], sample: FloatTensor, generator: typing.Optional[torch.Generator] = None, return_dict: bool = True)
```

[Source](https://github.com/huggingface/diffusers/blob/v0.43.0/src/diffusers/schedulers/scheduling_minimax_h3.py#L278)

**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`. With `euler_update_form="velocity"` the same
Euler update is evaluated as `x_next = x_t + (sigma - sigma_next) * v` in float32.

## MiniMaxH3SchedulerOutput[[diffusers.schedulers.scheduling_minimax_h3.MiniMaxH3SchedulerOutput]]

#### diffusers.schedulers.scheduling_minimax_h3.MiniMaxH3SchedulerOutput[[diffusers.schedulers.scheduling_minimax_h3.MiniMaxH3SchedulerOutput]]

```python
diffusers.schedulers.scheduling_minimax_h3.MiniMaxH3SchedulerOutput(prev_sample: FloatTensor)
```

[Source](https://github.com/huggingface/diffusers/blob/v0.43.0/src/diffusers/schedulers/scheduling_minimax_h3.py#L61)

**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.

