Skip to content

Commit 7fb3f5d

Browse files
committed
update
1 parent b50748c commit 7fb3f5d

File tree

3 files changed

+36
-159
lines changed

3 files changed

+36
-159
lines changed

docs/source/en/_toctree.yml

-2
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@
8787
title: API Reference
8888
title: Hybrid Inference
8989
- sections:
90-
- local: using-diffusers/cogvideox
91-
title: CogVideoX
9290
- local: using-diffusers/consisid
9391
title: ConsisID
9492
- local: using-diffusers/sdxl

docs/source/en/api/pipelines/cogvideox.md

+36-37
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@
1313
# limitations under the License.
1414
-->
1515

16-
# CogVideoX
17-
1816
<div style="float: right;">
1917
<div class="flex flex-wrap space-x-1">
2018
<img alt="LoRA" src="https://img.shields.io/badge/LoRA-d8b4fe?style=flat"/>
2119
</div>
2220
</div>
2321

22+
# CogVideoX
23+
2424
[CogVideoX](https://huggingface.co/papers/2408.06072) is a large diffusion transformer model - available in 2B and 5B parameters - designed to generate longer and more consistent videos from text. This model uses a 3D causal variational autoencoder to more efficiently process video data by reducing sequence length (and associated training compute) and preventing flickering in generated videos. An "expert" transformer with adaptive LayerNorm improves alignment between text and video, and 3D full attention helps accurately capture motion and time in generated videos.
2525

2626
You can find all the original CogVideoX checkpoints under the [CogVideoX collection](https://huggingface.co/collections/THUDM/cogvideo-66c08e62f1685a3ade464cce).
@@ -148,44 +148,43 @@ export_to_video(video, "output.mp4", fps=8)
148148
</hfoption>
149149
</hfoptions>
150150

151-
CogVideoX supports LoRAs with [`~loaders.CogVideoXLoraLoaderMixin.load_lora_weights`].
152-
153-
```py
154-
import torch
155-
from diffusers import CogVideoXPipeline, CogVideoXTransformer3DModel
156-
from diffusers.hooks import apply_group_offloading
157-
from diffusers.utils import export_to_video
158-
159-
pipeline = CogVideoXPipeline.from_pretrained(
160-
"THUDM/CogVideoX-5b",
161-
torch_dtype=torch.bfloat16
162-
)
163-
pipeline.to("cuda")
164-
165-
pipeline.load_lora_weights("finetrainers/CogVideoX-1.5-crush-smol-v0", adapter_name="crush-lora")
166-
pipeline.set_adapters("crush-lora", 0.9)
167-
168-
# model-offloading
169-
pipeline.enable_model_cpu_offload()
170-
171-
prompt = """
172-
PIKA_CRUSH A large metal cylinder is seen pressing down on a pile of Oreo cookies, flattening them as if they were under a hydraulic press.
173-
"""
174-
negative_prompt = "inconsistent motion, blurry motion, worse quality, degenerate outputs, deformed outputs"
151+
## Notes
175152

176-
video = pipeline(
177-
prompt=prompt,
178-
negative_prompt=negative_prompt,
179-
num_frames=81,
180-
height=480,
181-
width=768,
182-
num_inference_steps=50
183-
).frames[0]
184-
export_to_video(video, "output.mp4", fps=16)
185-
```
153+
- CogVideoX supports LoRAs with [`~loaders.CogVideoXLoraLoaderMixin.load_lora_weights`].
186154

187-
## Notes
155+
```py
156+
import torch
157+
from diffusers import CogVideoXPipeline, CogVideoXTransformer3DModel
158+
from diffusers.hooks import apply_group_offloading
159+
from diffusers.utils import export_to_video
188160

161+
pipeline = CogVideoXPipeline.from_pretrained(
162+
"THUDM/CogVideoX-5b",
163+
torch_dtype=torch.bfloat16
164+
)
165+
pipeline.to("cuda")
166+
167+
pipeline.load_lora_weights("finetrainers/CogVideoX-1.5-crush-smol-v0", adapter_name="crush-lora")
168+
pipeline.set_adapters("crush-lora", 0.9)
169+
170+
# model-offloading
171+
pipeline.enable_model_cpu_offload()
172+
173+
prompt = """
174+
PIKA_CRUSH A large metal cylinder is seen pressing down on a pile of Oreo cookies, flattening them as if they were under a hydraulic press.
175+
"""
176+
negative_prompt = "inconsistent motion, blurry motion, worse quality, degenerate outputs, deformed outputs"
177+
178+
video = pipeline(
179+
prompt=prompt,
180+
negative_prompt=negative_prompt,
181+
num_frames=81,
182+
height=480,
183+
width=768,
184+
num_inference_steps=50
185+
).frames[0]
186+
export_to_video(video, "output.mp4", fps=16)
187+
```
189188
- The text-to-video (T2V) checkpoints work best with a resolution of 1360x768 because that was the resolution it was pretrained on.
190189
- The image-to-video (I2V) checkpoints work with multiple resolutions. The width can vary from 768 to 1360, but the height must be 758. Both height and width must be divisible by 16.
191190
- Both T2V and I2V checkpoints work best with 81 and 161 frames. It is recommended to export the generated video at 16fps.

docs/source/en/using-diffusers/cogvideox.md

-120
This file was deleted.

0 commit comments

Comments
 (0)