patrickvonplaten
commited on
Commit
•
d41cfd0
1
Parent(s):
ca4795a
Update README.md
Browse files
README.md
CHANGED
@@ -76,7 +76,7 @@ Here are some results:
|
|
76 |
## Long Video Generation
|
77 |
|
78 |
You can optimize for memory usage by enabling attention and VAE slicing and using Torch 2.0.
|
79 |
-
This should allow you to generate videos up to
|
80 |
|
81 |
```bash
|
82 |
$ pip install git+https://github.com/huggingface/diffusers transformers accelerate
|
@@ -88,7 +88,7 @@ from diffusers import DiffusionPipeline, DPMSolverMultistepScheduler
|
|
88 |
from diffusers.utils import export_to_video
|
89 |
|
90 |
# load pipeline
|
91 |
-
pipe = DiffusionPipeline.from_pretrained("damo-vilab/text-to-video-ms-1.7b
|
92 |
pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
|
93 |
|
94 |
# optimize for GPU memory
|
@@ -96,8 +96,8 @@ pipe.enable_model_cpu_offload()
|
|
96 |
pipe.enable_vae_slicing()
|
97 |
|
98 |
# generate
|
99 |
-
prompt =
|
100 |
-
video_frames = pipe(prompt, num_inference_steps=25, num_frames=
|
101 |
|
102 |
# convent to video
|
103 |
video_path = export_to_video(video_frames)
|
|
|
76 |
## Long Video Generation
|
77 |
|
78 |
You can optimize for memory usage by enabling attention and VAE slicing and using Torch 2.0.
|
79 |
+
This should allow you to generate videos up to 25 seconds on less than 16GB of GPU VRAM.
|
80 |
|
81 |
```bash
|
82 |
$ pip install git+https://github.com/huggingface/diffusers transformers accelerate
|
|
|
88 |
from diffusers.utils import export_to_video
|
89 |
|
90 |
# load pipeline
|
91 |
+
pipe = DiffusionPipeline.from_pretrained("damo-vilab/text-to-video-ms-1.7b", torch_dtype=torch.float16, variant="fp16")
|
92 |
pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)
|
93 |
|
94 |
# optimize for GPU memory
|
|
|
96 |
pipe.enable_vae_slicing()
|
97 |
|
98 |
# generate
|
99 |
+
prompt = Spiderman is surfing. Darth Vader is also surfing and following Spiderman"
|
100 |
+
video_frames = pipe(prompt, num_inference_steps=25, num_frames=200).frames
|
101 |
|
102 |
# convent to video
|
103 |
video_path = export_to_video(video_frames)
|