wan22_sample ¶
Dense DMD sampling for MLXWan22DiT (Wan2.2 per-token timestep).
Matches the FastVideo pipeline's warped DMD schedule (warp_denoising_step=True, dmd_denoising_steps=[1000,757,522], flow_shift=5.0 for TI2V-5B) rather than treating raw step indices as continuous timesteps (a bug in early demos).
Classes¶
Functions:¶
fastvideo.mlx_runtime.wan22_sample.build_wan22_dmd_schedule ¶
build_wan22_dmd_schedule(dmd_denoising_steps: Sequence[int] | None = None, *, flow_shift: float = 5.0, warp_denoising_step: bool = True) -> tuple[MLXDMDSchedule, list[float]]
Build the flow-matching schedule and continuous timesteps used for Wan2.2 DMD sampling.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dmd_denoising_steps | Sequence[int] | None | Denoising step values to use; defaults to 1000, 757, and 522. | None |
flow_shift | float | Flow-matching shift applied when constructing the schedule. | 5.0 |
warp_denoising_step | bool | Whether to convert denoising steps to scheduler-warped continuous timesteps. | True |
Returns:
| Type | Description |
|---|---|
tuple[MLXDMDSchedule, list[float]] | tuple[MLXDMDSchedule, list[float]]: The DMD schedule and corresponding continuous timesteps. |
Source code in fastvideo/mlx_runtime/wan22_sample.py
fastvideo.mlx_runtime.wan22_sample.sample_wan22_dmd ¶
sample_wan22_dmd(model: MLXWan22DiT, encoder_hidden_states: array, noise_latents: array, freqs_cis: tuple, *, dmd_denoising_steps: Sequence[int] | None = None, flow_shift: float = 5.0, warp_denoising_step: bool = True, seed: int = 0) -> array
Generate clean video latents from noisy latents using iterative DMD denoising.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
noise_latents | array | Initial noisy video latents. | required |
freqs_cis | tuple | Rotary positional frequency tensors used by the model. | required |
dmd_denoising_steps | Sequence[int] | None | DMD denoising steps, or the default schedule when omitted. | None |
flow_shift | float | Flow-matching schedule shift. | 5.0 |
warp_denoising_step | bool | Whether to warp the denoising timesteps. | True |
seed | int | Seed for reproducible intermediate re-noising. | 0 |
Returns:
| Type | Description |
|---|---|
array | mx.array: Denoised video latents. |