Update README.md
Browse files
README.md
CHANGED
@@ -47,3 +47,58 @@ display.Video("Island_scene.mp4")
|
|
47 |
- With lora
|
48 |
|
49 |
<video controls autoplay src="https://cdn-uploads.huggingface.co/production/uploads/634dffc49b777beec3bc6448/W9LCnObK9gftXaDGTPajF.mp4"></video>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
- With lora
|
48 |
|
49 |
<video controls autoplay src="https://cdn-uploads.huggingface.co/production/uploads/634dffc49b777beec3bc6448/W9LCnObK9gftXaDGTPajF.mp4"></video>
|
50 |
+
|
51 |
+
# STG Example (use STG make better video)
|
52 |
+
# Additional Installtion
|
53 |
+
```bash
|
54 |
+
git clone https://github.com/svjack/STGuidance
|
55 |
+
cd STGuidance/diffusers/mochi
|
56 |
+
```
|
57 |
+
|
58 |
+
## LandScape Example
|
59 |
+
```python
|
60 |
+
import torch
|
61 |
+
from pipeline_stg_mochi import MochiSTGPipeline
|
62 |
+
from diffusers.utils import export_to_video
|
63 |
+
import os
|
64 |
+
|
65 |
+
# Load the pipeline
|
66 |
+
pipe = MochiSTGPipeline.from_pretrained("genmo/mochi-1-preview", variant="bf16", torch_dtype=torch.bfloat16)
|
67 |
+
|
68 |
+
pipe.load_lora_weights("svjack/mochi_game_mix_early_lora")
|
69 |
+
pipe.enable_model_cpu_offload()
|
70 |
+
pipe.enable_sequential_cpu_offload()
|
71 |
+
pipe.vae.enable_slicing()
|
72 |
+
pipe.vae.enable_tiling()
|
73 |
+
pipe.enable_vae_tiling()
|
74 |
+
#pipe = pipe.to("cuda")
|
75 |
+
|
76 |
+
#--------Option--------#
|
77 |
+
prompt = "The video presents a tranquil scene of a small, isolated island with a rocky outcrop. The island is covered in lush greenery and dotted with vibrant pink cherry blossom trees in full bloom. A traditional-style building with a pagoda-like roof stands prominently on the highest point of the island, suggesting a cultural or historical significance. The sky above is a gradient of soft pastel colors, transitioning from light blue to pink, indicating either dawn or dusk. The water surrounding the island is calm, reflecting the colors of the sky and the island's features. There are no visible people or moving objects, giving the scene a serene and untouched quality."
|
78 |
+
stg_mode = "STG-R"
|
79 |
+
stg_applied_layers_idx = [35]
|
80 |
+
stg_scale = 0.8 # 0.0 for CFG (default)
|
81 |
+
do_rescaling = True # False (default)
|
82 |
+
#----------------------#
|
83 |
+
|
84 |
+
# Generate video frames
|
85 |
+
frames = pipe(
|
86 |
+
prompt,
|
87 |
+
num_frames=84,
|
88 |
+
stg_mode=stg_mode,
|
89 |
+
stg_applied_layers_idx=stg_applied_layers_idx,
|
90 |
+
stg_scale=stg_scale,
|
91 |
+
do_rescaling=do_rescaling
|
92 |
+
).frames[0]
|
93 |
+
|
94 |
+
export_to_video(frames, "Island_landscape_mix_stg.mp4")
|
95 |
+
from IPython import display
|
96 |
+
display.clear_output(wait = True)
|
97 |
+
display.Video("Island_landscape_mix_stg.mp4")
|
98 |
+
```
|
99 |
+
|
100 |
+
- With lora and STG
|
101 |
+
|
102 |
+
|
103 |
+
<video controls autoplay src="https://cdn-uploads.huggingface.co/production/uploads/634dffc49b777beec3bc6448/tWYzscGew0nmsQUW6vX_Q.mp4"></video>
|
104 |
+
|