Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 7.3k
[Pipeline] Add TextToVideoZeroSDXLPipeline#4695
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
42d49af72210154469455e00f93e059136714479adfe50922b19d32dcf7aa3b97aa3d2c1e86e8c8e283871fe6cc898f42e20bb7aa40d9ad31794494dc08a706aa65f194ffc44d3288b0804d9f0f8ae9aa8350c859698d16357e87f1de7d5503c91782159e732e73398ec99303972b1720c59ff93804a64d9737aab552865eddf8a80304d7526358689f4c8cdba65002a32641d0a919f9deae67c3167053fdc3ee8371093dfa14652028d1f5de7c20778e8a44b22091e9ee0304d395fa052461ae2ae9893ed786803890c3446ac35e0f2c69ef60409cFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -92,6 +92,19 @@ imageio.mimsave("video.mp4", result, fps=4) | ||
| ``` | ||
| - #### SDXL Support | ||
| In order to use the SDXL model when generating a video from prompt, use the `TextToVideoZeroSDXLPipeline` pipeline: | ||
| ```python | ||
| import torch | ||
| from diffusers import TextToVideoZeroSDXLPipeline | ||
| model_id = "stabilityai/stable-diffusion-xl-base-1.0" | ||
| pipe = TextToVideoZeroSDXLPipeline.from_pretrained( | ||
| model_id, torch_dtype=torch.float16, variant="fp16", use_safetensors=True | ||
| ).to("cuda") | ||
| ``` | ||
| ### Text-To-Video with Pose Control | ||
| To generate a video from prompt with additional pose control | ||
| @@ -141,7 +154,33 @@ To generate a video from prompt with additional pose control | ||
| result = pipe(prompt=[prompt] * len(pose_images), image=pose_images, latents=latents).images | ||
| imageio.mimsave("video.mp4", result, fps=4) | ||
| ``` | ||
| - #### SDXL Support | ||
| Since our attention processor also works with SDXL, it can be utilized to generate a video from prompt using ControlNet models powered by SDXL: | ||
| ```python | ||
| import torch | ||
| from diffusers import StableDiffusionXLControlNetPipeline, ControlNetModel | ||
| from diffusers.pipelines.text_to_video_synthesis.pipeline_text_to_video_zero import CrossFrameAttnProcessor | ||
| controlnet_model_id = 'thibaud/controlnet-openpose-sdxl-1.0' | ||
| model_id = 'stabilityai/stable-diffusion-xl-base-1.0' | ||
| controlnet = ControlNetModel.from_pretrained(controlnet_model_id, torch_dtype=torch.float16) | ||
| pipe = StableDiffusionControlNetPipeline.from_pretrained( | ||
| model_id, controlnet=controlnet, torch_dtype=torch.float16 | ||
| ).to('cuda') | ||
| # Set the attention processor | ||
| pipe.unet.set_attn_processor(CrossFrameAttnProcessor(batch_size=2)) | ||
| pipe.controlnet.set_attn_processor(CrossFrameAttnProcessor(batch_size=2)) | ||
| # fix latents for all frames | ||
| latents = torch.randn((1, 4, 128, 128), device="cuda", dtype=torch.float16).repeat(len(pose_images), 1, 1, 1) | ||
| prompt = "Darth Vader dancing in a desert" | ||
| result = pipe(prompt=[prompt] * len(pose_images), image=pose_images, latents=latents).images | ||
| imageio.mimsave("video.mp4", result, fps=4) | ||
| ``` | ||
| ### Text-To-Video with Edge Control | ||
| @@ -253,5 +292,10 @@ Make sure to check out the Schedulers [guide](../../using-diffusers/schedulers) | ||
| - all | ||
| - __call__ | ||
| ## TextToVideoZeroSDXLPipeline | ||
| [[autodoc]] TextToVideoZeroSDXLPipeline | ||
| - all | ||
| - __call__ | ||
| ## TextToVideoPipelineOutput | ||
| [[autodoc]] pipelines.text_to_video_synthesis.pipeline_text_to_video_zero.TextToVideoPipelineOutput | ||
Member There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We need to add | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this work out of the box?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm good catch. @vahramtadevosyan Can you confirm this works out of the box with SDXL base?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@DN6@patrickvonplaten can you explain what do you mean by
working out of the box?