Create README.md
Browse files
README.md
ADDED
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
base_model:
|
3 |
+
- tencent/HunyuanVideo
|
4 |
+
library_name: diffusers
|
5 |
+
---
|
6 |
+
|
7 |
+
Unofficial community fork for Diffusers-format weights on [`tencent/HunyuanVideo`](https://huggingface.co/tencent/HunyuanVideo).
|
8 |
+
|
9 |
+
### Using Diffusers
|
10 |
+
|
11 |
+
HunyuanVideo can be used directly from Diffusers. Install the latest version of Diffusers.
|
12 |
+
|
13 |
+
```python
|
14 |
+
import torch
|
15 |
+
from diffusers import HunyuanVideoPipeline, HunyuanVideoTransformer3DModel
|
16 |
+
from diffusers.utils import export_to_video
|
17 |
+
|
18 |
+
model_id = "hunyuanvideo-community/HunyuanVideo"
|
19 |
+
transformer = HunyuanVideoTransformer3DModel.from_pretrained(
|
20 |
+
model_id, subfolder="transformer", torch_dtype=torch.bfloat16
|
21 |
+
)
|
22 |
+
pipe = HunyuanVideoPipeline.from_pretrained(model_id, transformer=transformer, torch_dtype=torch.float16)
|
23 |
+
|
24 |
+
# Enable memory savings
|
25 |
+
pipe.vae.enable_tiling()
|
26 |
+
pipe.enable_model_cpu_offload()
|
27 |
+
|
28 |
+
output = pipe(
|
29 |
+
prompt="A cat walks on the grass, realistic",
|
30 |
+
height=320,
|
31 |
+
width=512,
|
32 |
+
num_frames=61,
|
33 |
+
num_inference_steps=30,
|
34 |
+
).frames[0]
|
35 |
+
export_to_video(output, "output.mp4", fps=15)
|
36 |
+
```
|
37 |
+
|
38 |
+
Refer to the [documentation](https://huggingface.co/docs/diffusers/main/en/api/pipelines/hunyuan_video) for more information.
|
39 |
+
|