You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/source/en/api/pipelines/mochi.md
+69-3Lines changed: 69 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,7 +27,7 @@ Make sure to check out the Schedulers [guide](../../using-diffusers/schedulers.m
27
27
28
28
## Generating videos with Mochi-1 Preview
29
29
30
-
The following example will download the full precision `mochi-1-preview` weights and produce the highest quality results but will require at least 42GB VRAM to run.
30
+
The following example will download the full precision `mochi-1-preview` weights and produce the highest quality results but will require at least 42GB VRAM to run.
31
31
32
32
```python
33
33
import torch
@@ -43,7 +43,7 @@ pipe.enable_vae_tiling()
43
43
prompt ="Close-up of a chameleon's eye, with its scaly skin changing color. Ultra high resolution 4k."
44
44
45
45
with torch.autocast("cuda", torch.bfloat16, cache_enabled=False):
prompt ="Close-up of a chameleon's eye, with its scaly skin changing color. Ultra high resolution 4k."
67
-
frames = pipe(prompt, num_frames=84).frames[0]
67
+
frames = pipe(prompt, num_frames=85).frames[0]
68
68
69
69
export_to_video(frames, "mochi.mp4", fps=30)
70
70
```
71
71
72
+
## Reproducing the results from the Genmo Mochi repo
73
+
74
+
The [Genmo Mochi implementation](https://github.com/genmoai/mochi/tree/main) uses different precision values for each stage in the inference process. The text encoder and VAE use `torch.float32`, while the DiT uses `torch.bfloat16` with the [attention kernel](https://pytorch.org/docs/stable/generated/torch.nn.attention.sdpa_kernel.html#torch.nn.attention.sdpa_kernel) set to `EFFICIENT_ATTENTION`. Diffusers pipelines currently do not support setting different `dtypes` for different stages of the pipeline. In order to run inference in the same way as the the original implementation, please refer to the following example.
75
+
76
+
<Tip>
77
+
Decoding the latents in full precision is very memory intensive. You will need at least 70GB VRAM to generate the 163 frames
78
+
in this example. To reduce memory, either reduce the number of frames or run the decoding step in `torch.bfloat16`
79
+
</Tip>
80
+
81
+
```python
82
+
import torch
83
+
from torch.nn.attention import SDPBackend, sdpa_kernel
84
+
85
+
from diffusers import MochiPipeline
86
+
from diffusers.utils import export_to_video
87
+
from diffusers.video_processor import VideoProcessor
0 commit comments