Text-to-Video Generation with AnimateDiff¶
Overview¶
AnimateDiff: Animate Your Personalized Text-to-Image Diffusion Models without Specific Tuning by Yuwei Guo, Ceyuan Yang, Anyi Rao, Yaohui Wang, Yu Qiao, Dahua Lin, Bo Dai.
The abstract of the paper is the following:
With the advance of text-to-image models (e.g., Stable Diffusion) and corresponding personalization techniques such as DreamBooth and LoRA, everyone can manifest their imagination into high-quality images at an affordable cost. Subsequently, there is a great demand for image animation techniques to further combine generated static images with motion dynamics. In this report, we propose a practical framework to animate most of the existing personalized text-to-image models once and for all, saving efforts in model-specific tuning. At the core of the proposed framework is to insert a newly initialized motion modeling module into the frozen text-to-image model and train it on video clips to distill reasonable motion priors. Once trained, by simply injecting this motion modeling module, all personalized versions derived from the same base T2I readily become text-driven models that produce diverse and personalized animated images. We conduct our evaluation on several public representative personalized text-to-image models across anime pictures and realistic photographs, and demonstrate that our proposed framework helps these models generate temporally smooth animation clips while preserving the domain and diversity of their outputs. Code and pre-trained weights will be publicly available at this https URL.
Available Pipelines¶
Pipeline | Tasks |
---|---|
AnimateDiffPipeline | Text-to-Video Generation with AnimateDiff |
AnimateDiffControlNetPipeline | Controlled Video-to-Video Generation with AnimateDiff using ControlNet |
AnimateDiffSparseControlNetPipeline | Controlled Video-to-Video Generation with AnimateDiff using SparseCtrl |
AnimateDiffSDXLPipeline | Video-to-Video Generation with AnimateDiff |
AnimateDiffVideoToVideoPipeline | Video-to-Video Generation with AnimateDiff |
Available checkpoints¶
Motion Adapter checkpoints can be found under guoyww. These checkpoints are meant to work with any model based on Stable Diffusion 1.4/1.5.
Usage example¶
AnimateDiffPipeline¶
AnimateDiff works with a MotionAdapter checkpoint and a Stable Diffusion model checkpoint. The MotionAdapter is a collection of Motion Modules that are responsible for adding coherent motion across image frames. These modules are applied after the Resnet and Attention blocks in Stable Diffusion UNet.
The following example demonstrates how to use a MotionAdapter checkpoint with Diffusers for inference based on StableDiffusion-1.4/1.5.
import mindspore as ms
from mindone.diffusers import AnimateDiffPipeline, DDIMScheduler, MotionAdapter
from mindone.diffusers.utils import export_to_gif
# Load the motion adapter
adapter = MotionAdapter.from_pretrained("guoyww/animatediff-motion-adapter-v1-5-2", mindspore_dtype=ms.float16)
# load SD 1.5 based finetuned model
model_id = "SG161222/Realistic_Vision_V5.1_noVAE"
pipe = AnimateDiffPipeline.from_pretrained(model_id, motion_adapter=adapter, mindspore_dtype=ms.float16)
scheduler = DDIMScheduler.from_pretrained(
model_id,
subfolder="scheduler",
clip_sample=False,
timestep_spacing="linspace",
beta_schedule="linear",
steps_offset=1,
)
pipe.scheduler = scheduler
output = pipe(
prompt=(
"masterpiece, bestquality, highlydetailed, ultradetailed, sunset, "
"orange sky, warm lighting, fishing boats, ocean waves seagulls, "
"rippling water, wharf, silhouette, serene atmosphere, dusk, evening glow, "
"golden hour, coastal landscape, seaside scenery"
),
negative_prompt="bad quality, worse quality",
num_frames=16,
guidance_scale=7.5,
num_inference_steps=25,
)
frames = output[0][0]
export_to_gif(frames, "animation.gif")
Here are some sample outputs:
Tip
AnimateDiff tends to work better with finetuned Stable Diffusion models. If you plan on using a scheduler that can clip samples, make sure to disable it by setting clip_sample=False
in the scheduler as this can also have an adverse effect on generated samples. Additionally, the AnimateDiff checkpoints can be sensitive to the beta schedule of the scheduler. We recommend setting this to linear
.
AnimateDiffControlNetPipeline¶
Warning
⚠️ MindONE currently does not support the full process for condition frames generating, as MindONE does not yet support ZoeDetector
from controlnet_aux. Therefore, you need to prepare the conditioning_video
in advance to continue the process.
AnimateDiff can also be used with ControlNets ControlNet was introduced in Adding Conditional Control to Text-to-Image Diffusion Models by Lvmin Zhang, Anyi Rao, and Maneesh Agrawala. With a ControlNet model, you can provide an additional control image to condition and control Stable Diffusion generation. For example, if you provide depth maps, the ControlNet model generates a video that'll preserve the spatial information from the depth maps. It is a more flexible and accurate way to control the video generation process.
import mindspore as ms
import numpy as np
from mindone.diffusers import AnimateDiffControlNetPipeline, AutoencoderKL, ControlNetModel, MotionAdapter, LCMScheduler
from mindone.diffusers.utils import export_to_gif, load_video
# Download controlnets from https://huggingface.co/lllyasviel/ControlNet-v1-1 to use .from_single_file
# Download Diffusers-format controlnets, such as https://huggingface.co/lllyasviel/sd-controlnet-depth, to use .from_pretrained()
controlnet = ControlNetModel.from_pretrained("lllyasviel/sd-controlnet-depth", mindspore_dtype=ms.float16)
# We use AnimateLCM for this example but one can use the original motion adapters as well (for example, https://huggingface.co/guoyww/animatediff-motion-adapter-v1-5-3)
motion_adapter = MotionAdapter.from_pretrained("wangfuyun/AnimateLCM")
vae = AutoencoderKL.from_pretrained("stabilityai/sd-vae-ft-mse", mindspore_dtype=ms.float16)
pipe: AnimateDiffControlNetPipeline = AnimateDiffControlNetPipeline.from_pretrained(
"SG161222/Realistic_Vision_V5.1_noVAE",
motion_adapter=motion_adapter,
controlnet=controlnet,
vae=vae,
).to(dtype=ms.float16)
pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config, beta_schedule="linear")
pipe.load_lora_weights("wangfuyun/AnimateLCM", weight_name="AnimateLCM_sd15_t2v_lora.safetensors", adapter_name="lcm-lora")
pipe.set_adapters(["lcm-lora"], [0.8])
video = load_video("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/animatediff-vid2vid-input-1.gif")
conditioning_video = load_video("path/to/conditioning_video")
conditioning_frames = []
with pipe.progress_bar(total=len(conditioning_video)) as progress_bar:
for frame in conditioning_video:
conditioning_frames.append(frame)
progress_bar.update()
prompt = "a panda, playing a guitar, sitting in a pink boat, in the ocean, mountains in background, realistic, high quality"
negative_prompt = "bad quality, worst quality"
video = pipe(
prompt=prompt,
negative_prompt=negative_prompt,
num_frames=len(video),
num_inference_steps=10,
guidance_scale=2.0,
conditioning_frames=conditioning_frames,
generator=np.random.Generator(np.random.PCG64(seed=42)),
)[0][0]
export_to_gif(video, "animatediff_controlnet.gif", fps=8)
Here are some sample outputs:
Source Video | Output Video |
---|---|
raccoon playing a guitar
|
a panda, playing a guitar, sitting in a pink boat, in the ocean, mountains in background, realistic, high quality
|
AnimateDiffSparseControlNetPipeline¶
SparseCtrl: Adding Sparse Controls to Text-to-Video Diffusion Models for achieving controlled generation in text-to-video diffusion models by Yuwei Guo, Ceyuan Yang, Anyi Rao, Maneesh Agrawala, Dahua Lin, and Bo Dai.
The abstract from the paper is:
The development of text-to-video (T2V), i.e., generating videos with a given text prompt, has been significantly advanced in recent years. However, relying solely on text prompts often results in ambiguous frame composition due to spatial uncertainty. The research community thus leverages the dense structure signals, e.g., per-frame depth/edge sequences, to enhance controllability, whose collection accordingly increases the burden of inference. In this work, we present SparseCtrl to enable flexible structure control with temporally sparse signals, requiring only one or a few inputs, as shown in Figure 1. It incorporates an additional condition encoder to process these sparse signals while leaving the pre-trained T2V model untouched. The proposed approach is compatible with various modalities, including sketches, depth maps, and RGB images, providing more practical control for video generation and promoting applications such as storyboarding, depth rendering, keyframe animation, and interpolation. Extensive experiments demonstrate the generalization of SparseCtrl on both original and personalized T2V generators. Codes and models will be publicly available at this https URL.
SparseCtrl introduces the following checkpoints for controlled text-to-video generation:
Using SparseCtrl Scribble¶
import mindspore as ms
import numpy as np
from mindone.diffusers import AnimateDiffSparseControlNetPipeline
from mindone.diffusers.models import AutoencoderKL, MotionAdapter, SparseControlNetModel
from mindone.diffusers.schedulers import DPMSolverMultistepScheduler
from mindone.diffusers.utils import export_to_gif, load_image
model_id = "SG161222/Realistic_Vision_V5.1_noVAE"
motion_adapter_id = "guoyww/animatediff-motion-adapter-v1-5-3"
controlnet_id = "guoyww/animatediff-sparsectrl-scribble"
lora_adapter_id = "guoyww/animatediff-motion-lora-v1-5-3"
vae_id = "stabilityai/sd-vae-ft-mse"
motion_adapter = MotionAdapter.from_pretrained(motion_adapter_id, mindspore_dtype=ms.float16)
controlnet = SparseControlNetModel.from_pretrained(controlnet_id, mindspore_dtype=ms.float16)
vae = AutoencoderKL.from_pretrained(vae_id, mindspore_dtype=ms.float16)
scheduler = DPMSolverMultistepScheduler.from_pretrained(
model_id,
subfolder="scheduler",
beta_schedule="linear",
algorithm_type="dpmsolver++",
use_karras_sigmas=True,
)
pipe = AnimateDiffSparseControlNetPipeline.from_pretrained(
model_id,
motion_adapter=motion_adapter,
controlnet=controlnet,
vae=vae,
scheduler=scheduler,
mindspore_dtype=ms.float16,
)
pipe.load_lora_weights(lora_adapter_id, adapter_name="motion_lora")
pipe.fuse_lora(lora_scale=1.0)
prompt = "an aerial view of a cyberpunk city, night time, neon lights, masterpiece, high quality"
negative_prompt = "low quality, worst quality, letterboxed"
image_files = [
"https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/animatediff-scribble-1.png",
"https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/animatediff-scribble-2.png",
"https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/animatediff-scribble-3.png"
]
condition_frame_indices = [0, 8, 15]
conditioning_frames = [load_image(img_file) for img_file in image_files]
video = pipe(
prompt=prompt,
negative_prompt=negative_prompt,
num_inference_steps=25,
conditioning_frames=conditioning_frames,
controlnet_conditioning_scale=1.0,
controlnet_frame_indices=condition_frame_indices,
generator=np.random.Generator(np.random.PCG64(seed=1337)),
)[0][0]
export_to_gif(video, "output.gif")
Here are some sample outputs:
|
|
|
|
Using SparseCtrl RGB¶
import mindspore as ms
import numpy as np
from mindone.diffusers import AnimateDiffSparseControlNetPipeline
from mindone.diffusers.models import AutoencoderKL, MotionAdapter, SparseControlNetModel
from mindone.diffusers.schedulers import DPMSolverMultistepScheduler
from mindone.diffusers.utils import export_to_gif, load_image
model_id = "SG161222/Realistic_Vision_V5.1_noVAE"
motion_adapter_id = "guoyww/animatediff-motion-adapter-v1-5-3"
controlnet_id = "guoyww/animatediff-sparsectrl-rgb"
lora_adapter_id = "guoyww/animatediff-motion-lora-v1-5-3"
vae_id = "stabilityai/sd-vae-ft-mse"
motion_adapter = MotionAdapter.from_pretrained(motion_adapter_id, mindspore_dtype=ms.float16)
controlnet = SparseControlNetModel.from_pretrained(controlnet_id, mindspore_dtype=ms.float16)
vae = AutoencoderKL.from_pretrained(vae_id, mindspore_dtype=ms.float16)
scheduler = DPMSolverMultistepScheduler.from_pretrained(
model_id,
subfolder="scheduler",
beta_schedule="linear",
algorithm_type="dpmsolver++",
use_karras_sigmas=True,
)
pipe = AnimateDiffSparseControlNetPipeline.from_pretrained(
model_id,
motion_adapter=motion_adapter,
controlnet=controlnet,
vae=vae,
scheduler=scheduler,
mindspore_dtype=ms.float16,
)
pipe.load_lora_weights(lora_adapter_id, adapter_name="motion_lora")
image = load_image("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/animatediff-firework.png")
video = pipe(
prompt="closeup face photo of man in black clothes, night city street, bokeh, fireworks in background",
negative_prompt="low quality, worst quality",
num_inference_steps=25,
conditioning_frames=image,
controlnet_frame_indices=[0],
controlnet_conditioning_scale=1.0,
generator=np.random.Generator(np.random.PCG64(seed=42)),
)[0][0]
export_to_gif(video, "output.gif")
Here are some sample outputs:
|
|
AnimateDiffSDXLPipeline¶
AnimateDiff can also be used with SDXL models. This is currently an experimental feature as only a beta release of the motion adapter checkpoint is available.
import mindspore as ms
from mindone.diffusers.models import MotionAdapter
from mindone.diffusers import AnimateDiffSDXLPipeline, DDIMScheduler
from mindone.diffusers.utils import export_to_gif
adapter = MotionAdapter.from_pretrained("guoyww/animatediff-motion-adapter-sdxl-beta", mindspore_dtype=ms.float16)
model_id = "stabilityai/stable-diffusion-xl-base-1.0"
scheduler = DDIMScheduler.from_pretrained(
model_id,
subfolder="scheduler",
clip_sample=False,
timestep_spacing="linspace",
beta_schedule="linear",
steps_offset=1,
)
pipe = AnimateDiffSDXLPipeline.from_pretrained(
model_id,
motion_adapter=adapter,
scheduler=scheduler,
mindspore_dtype=ms.float16,
variant="fp16",
)
output = pipe(
prompt="a panda surfing in the ocean, realistic, high quality",
negative_prompt="low quality, worst quality",
num_inference_steps=20,
guidance_scale=8,
width=1024,
height=1024,
num_frames=16,
)
frames = output.frames[0]
export_to_gif(frames, "animation.gif")
AnimateDiffVideoToVideoPipeline¶
AnimateDiff can also be used to generate visually similar videos or enable style/character/background or other edits starting from an initial video, allowing you to seamlessly explore creative possibilities.
import imageio
import requests
import numpy as np
import mindspore as ms
from mindone.diffusers import AnimateDiffVideoToVideoPipeline, DDIMScheduler, MotionAdapter
from mindone.diffusers.utils import export_to_gif
from io import BytesIO
from PIL import Image
# Load the motion adapter
adapter = MotionAdapter.from_pretrained("guoyww/animatediff-motion-adapter-v1-5-2", mindspore_dtype=ms.float16)
# load SD 1.5 based finetuned model
model_id = "SG161222/Realistic_Vision_V5.1_noVAE"
pipe = AnimateDiffVideoToVideoPipeline.from_pretrained(model_id, motion_adapter=adapter, mindspore_dtype=ms.float16)
scheduler = DDIMScheduler.from_pretrained(
model_id,
subfolder="scheduler",
clip_sample=False,
timestep_spacing="linspace",
beta_schedule="linear",
steps_offset=1,
)
pipe.scheduler = scheduler
# helper function to load videos
def load_video(file_path: str):
images = []
if file_path.startswith(('http://', 'https://')):
# If the file_path is a URL
response = requests.get(file_path)
response.raise_for_status()
content = BytesIO(response.content)
vid = imageio.get_reader(content)
else:
# Assuming it's a local file path
vid = imageio.get_reader(file_path)
for frame in vid:
pil_image = Image.fromarray(frame)
images.append(pil_image)
return images
video = load_video("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/animatediff-vid2vid-input-1.gif")
output = pipe(
video = video,
prompt="panda playing a guitar, on a boat, in the ocean, high quality",
negative_prompt="bad quality, worse quality",
guidance_scale=7.5,
num_inference_steps=25,
strength=0.5,
generator=np.random.Generator(np.random.PCG64(42)),
)
frames = output[0][0]
export_to_gif(frames, "animation.gif")
Here are some sample outputs:
Source Video | Output Video |
---|---|
raccoon playing a guitar
|
panda playing a guitar
|
closeup of margot robbie, fireworks in the background, high quality
|
closeup of tony stark, robert downey jr, fireworks
|
Using Motion LoRAs¶
Motion LoRAs are a collection of LoRAs that work with the guoyww/animatediff-motion-adapter-v1-5-2
checkpoint. These LoRAs are responsible for adding specific types of motion to the animations.
import numpy as np
import mindspore as ms
from mindone.diffusers import AnimateDiffPipeline, DDIMScheduler, MotionAdapter
from mindone.diffusers.utils import export_to_gif
# Load the motion adapter
adapter = MotionAdapter.from_pretrained("guoyww/animatediff-motion-adapter-v1-5-2", mindspore_dtype=ms.float16)
# load SD 1.5 based finetuned model
model_id = "SG161222/Realistic_Vision_V5.1_noVAE"
pipe = AnimateDiffPipeline.from_pretrained(model_id, motion_adapter=adapter, mindspore_dtype=ms.float16)
pipe.load_lora_weights(
"guoyww/animatediff-motion-lora-zoom-out", adapter_name="zoom-out"
)
scheduler = DDIMScheduler.from_pretrained(
model_id,
subfolder="scheduler",
clip_sample=False,
beta_schedule="linear",
timestep_spacing="linspace",
steps_offset=1,
)
pipe.scheduler = scheduler
output = pipe(
prompt=(
"masterpiece, bestquality, highlydetailed, ultradetailed, sunset, "
"orange sky, warm lighting, fishing boats, ocean waves seagulls, "
"rippling water, wharf, silhouette, serene atmosphere, dusk, evening glow, "
"golden hour, coastal landscape, seaside scenery"
),
negative_prompt="bad quality, worse quality",
num_frames=16,
guidance_scale=7.5,
num_inference_steps=25,
generator=np.random.Generator(np.random.PCG64(42)),
)
frames = output[0][0]
export_to_gif(frames, "animation.gif")
import numpy as np
import mindspore as ms
from mindone.diffusers import AnimateDiffPipeline, DDIMScheduler, MotionAdapter
from mindone.diffusers.utils import export_to_gif
# Load the motion adapter
adapter = MotionAdapter.from_pretrained("guoyww/animatediff-motion-adapter-v1-5-2", mindspore_dtype=ms.float16)
# load SD 1.5 based finetuned model
model_id = "SG161222/Realistic_Vision_V5.1_noVAE"
pipe = AnimateDiffPipeline.from_pretrained(model_id, motion_adapter=adapter, mindspore_dtype=ms.float16)
pipe.load_lora_weights(
"guoyww/animatediff-motion-lora-zoom-out", adapter_name="zoom-out",
)
pipe.load_lora_weights(
"guoyww/animatediff-motion-lora-pan-left", adapter_name="pan-left",
)
pipe.set_adapters(["zoom-out", "pan-left"], adapter_weights=[1.0, 1.0])
scheduler = DDIMScheduler.from_pretrained(
model_id,
subfolder="scheduler",
clip_sample=False,
timestep_spacing="linspace",
beta_schedule="linear",
steps_offset=1,
)
pipe.scheduler = scheduler
output = pipe(
prompt=(
"masterpiece, bestquality, highlydetailed, ultradetailed, sunset, "
"orange sky, warm lighting, fishing boats, ocean waves seagulls, "
"rippling water, wharf, silhouette, serene atmosphere, dusk, evening glow, "
"golden hour, coastal landscape, seaside scenery"
),
negative_prompt="bad quality, worse quality",
num_frames=16,
guidance_scale=7.5,
num_inference_steps=25,
generator=np.random.Generator(np.random.PCG64(42)),
)
frames = output[0][0]
export_to_gif(frames, "animation.gif")
Using AnimateLCM¶
AnimateLCM is a motion module checkpoint and an LCM LoRA that have been created using a consistency learning strategy that decouples the distillation of the image generation priors and the motion generation priors.
import numpy as np
from mindone.diffusers import AnimateDiffPipeline, LCMScheduler, MotionAdapter
from mindone.diffusers.utils import export_to_gif
adapter = MotionAdapter.from_pretrained("wangfuyun/AnimateLCM")
pipe = AnimateDiffPipeline.from_pretrained("emilianJR/epiCRealism", motion_adapter=adapter)
pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config, beta_schedule="linear")
pipe.load_lora_weights("wangfuyun/AnimateLCM", weight_name="AnimateLCM_sd15_t2v_lora.safetensors", adapter_name="lcm-lora")
output = pipe(
prompt="A space rocket with trails of smoke behind it launching into space from the desert, 4k, high resolution",
negative_prompt="bad quality, worse quality, low resolution",
num_frames=16,
guidance_scale=1.5,
num_inference_steps=6,
generator=np.random.Generator(np.random.PCG64(0)),
)
frames = output[0][0]
export_to_gif(frames, "animatelcm.gif")
AnimateLCM is also compatible with existing Motion LoRAs.
import numpy as np
import mindspore as ms
from mindone.diffusers import AnimateDiffPipeline, LCMScheduler, MotionAdapter
from mindone.diffusers.utils import export_to_gif
adapter = MotionAdapter.from_pretrained("wangfuyun/AnimateLCM")
pipe = AnimateDiffPipeline.from_pretrained("emilianJR/epiCRealism", motion_adapter=adapter)
pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config, beta_schedule="linear")
pipe.load_lora_weights("wangfuyun/AnimateLCM", weight_name="AnimateLCM_sd15_t2v_lora.safetensors", adapter_name="lcm-lora")
pipe.load_lora_weights("guoyww/animatediff-motion-lora-tilt-up", adapter_name="tilt-up")
pipe.set_adapters(["lcm-lora", "tilt-up"], [1.0, 0.8])
output = pipe(
prompt="A space rocket with trails of smoke behind it launching into space from the desert, 4k, high resolution",
negative_prompt="bad quality, worse quality, low resolution",
num_frames=16,
guidance_scale=1.5,
num_inference_steps=6,
generator=np.random.Generator(np.random.PCG64(0)),
)
frames = output[0][0]
export_to_gif(frames, "animatelcm-motion-lora.gif")
mindone.diffusers.pipelines.AnimateDiffPipeline
¶
Bases: DiffusionPipeline
, StableDiffusionMixin
, TextualInversionLoaderMixin
, IPAdapterMixin
, LoraLoaderMixin
Pipeline for text-to-video generation.
This model inherits from [DiffusionPipeline
]. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).
The pipeline also inherits the following loading methods
- [
~loaders.TextualInversionLoaderMixin.load_textual_inversion
] for loading textual inversion embeddings - [
~loaders.LoraLoaderMixin.load_lora_weights
] for loading LoRA weights - [
~loaders.LoraLoaderMixin.save_lora_weights
] for saving LoRA weights - [
~loaders.IPAdapterMixin.load_ip_adapter
] for loading IP Adapters
PARAMETER | DESCRIPTION |
---|---|
vae |
Variational Auto-Encoder (VAE) Model to encode and decode images to and from latent representations.
TYPE:
|
text_encoder |
Frozen text-encoder (clip-vit-large-patch14).
TYPE:
|
tokenizer |
A [
TYPE:
|
unet |
A [
TYPE:
|
motion_adapter |
A [
TYPE:
|
scheduler |
A scheduler to be used in combination with
TYPE:
|
Source code in mindone/diffusers/pipelines/animatediff/pipeline_animatediff.py
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 |
|
mindone.diffusers.pipelines.AnimateDiffPipeline.__call__(prompt=None, num_frames=16, height=None, width=None, num_inference_steps=50, guidance_scale=7.5, negative_prompt=None, num_videos_per_prompt=1, eta=0.0, generator=None, latents=None, prompt_embeds=None, negative_prompt_embeds=None, ip_adapter_image=None, ip_adapter_image_embeds=None, output_type='pil', return_dict=False, cross_attention_kwargs=None, clip_skip=None, callback_on_step_end=None, callback_on_step_end_tensor_inputs=['latents'], **kwargs)
¶
The call function to the pipeline for generation.
PARAMETER | DESCRIPTION |
---|---|
prompt |
The prompt or prompts to guide image generation. If not defined, you need to pass
TYPE:
|
height |
The height in pixels of the generated video.
TYPE:
|
width |
The width in pixels of the generated video.
TYPE:
|
num_frames |
The number of video frames that are generated. Defaults to 16 frames which at 8 frames per seconds amounts to 2 seconds of video.
TYPE:
|
num_inference_steps |
The number of denoising steps. More denoising steps usually lead to a higher quality videos at the expense of slower inference.
TYPE:
|
guidance_scale |
A higher guidance scale value encourages the model to generate images closely linked to the text
TYPE:
|
negative_prompt |
The prompt or prompts to guide what to not include in image generation. If not defined, you need to
pass
TYPE:
|
eta |
Corresponds to parameter eta (η) from the DDIM paper. Only applies
to the [
TYPE:
|
generator |
A
TYPE:
|
latents |
Pre-generated noisy latents sampled from a Gaussian distribution, to be used as inputs for video
generation. Can be used to tweak the same generation with different prompts. If not provided, a latents
tensor is generated by sampling using the supplied random
TYPE:
|
prompt_embeds |
Pre-generated text embeddings. Can be used to easily tweak text inputs (prompt weighting). If not
provided, text embeddings are generated from the
TYPE:
|
negative_prompt_embeds |
Pre-generated negative text embeddings. Can be used to easily tweak text inputs (prompt weighting). If
not provided,
TYPE:
|
ip_adapter_image |
(
TYPE:
|
ip_adapter_image_embeds |
Pre-generated image embeddings for IP-Adapter. It should be a list of length same as number of
IP-adapters. Each element should be a tensor of shape
TYPE:
|
output_type |
The output format of the generated video. Choose between
TYPE:
|
return_dict |
Whether or not to return a [
TYPE:
|
cross_attention_kwargs |
A kwargs dictionary that if specified is passed along to the [
TYPE:
|
clip_skip |
Number of layers to be skipped from CLIP while computing the prompt embeddings. A value of 1 means that the output of the pre-final layer will be used for computing the prompt embeddings.
TYPE:
|
callback_on_step_end |
A function that calls at the end of each denoising steps during the inference. The function is called
with the following arguments:
TYPE:
|
callback_on_step_end_tensor_inputs |
The list of tensor inputs for the
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
[ |
Source code in mindone/diffusers/pipelines/animatediff/pipeline_animatediff.py
555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 |
|
mindone.diffusers.pipelines.AnimateDiffPipeline.encode_prompt(prompt, num_images_per_prompt, do_classifier_free_guidance, negative_prompt=None, prompt_embeds=None, negative_prompt_embeds=None, lora_scale=None, clip_skip=None)
¶
Encodes the prompt into text encoder hidden states.
PARAMETER | DESCRIPTION |
---|---|
prompt |
prompt to be encoded
TYPE:
|
num_images_per_prompt |
number of images that should be generated per prompt
TYPE:
|
do_classifier_free_guidance |
whether to use classifier free guidance or not
TYPE:
|
negative_prompt |
The prompt or prompts not to guide the image generation. If not defined, one has to pass
TYPE:
|
prompt_embeds |
Pre-generated text embeddings. Can be used to easily tweak text inputs, e.g. prompt weighting. If not
provided, text embeddings will be generated from
TYPE:
|
negative_prompt_embeds |
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, e.g. prompt
weighting. If not provided, negative_prompt_embeds will be generated from
TYPE:
|
lora_scale |
A LoRA scale that will be applied to all LoRA layers of the text encoder if LoRA layers are loaded.
TYPE:
|
clip_skip |
Number of layers to be skipped from CLIP while computing the prompt embeddings. A value of 1 means that the output of the pre-final layer will be used for computing the prompt embeddings.
TYPE:
|
Source code in mindone/diffusers/pipelines/animatediff/pipeline_animatediff.py
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 |
|
mindone.diffusers.pipelines.AnimateDiffControlNetPipeline
¶
Bases: DiffusionPipeline
, TextualInversionLoaderMixin
, IPAdapterMixin
, StableDiffusionLoraLoaderMixin
Pipeline for text-to-video generation with ControlNet guidance.
This model inherits from [DiffusionPipeline
]. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).
The pipeline also inherits the following loading methods
- [
~loaders.TextualInversionLoaderMixin.load_textual_inversion
] for loading textual inversion embeddings - [
~loaders.StableDiffusionLoraLoaderMixin.load_lora_weights
] for loading LoRA weights - [
~loaders.StableDiffusionLoraLoaderMixin.save_lora_weights
] for saving LoRA weights - [
~loaders.IPAdapterMixin.load_ip_adapter
] for loading IP Adapters
PARAMETER | DESCRIPTION |
---|---|
vae |
Variational Auto-Encoder (VAE) Model to encode and decode images to and from latent representations.
TYPE:
|
text_encoder |
Frozen text-encoder (clip-vit-large-patch14).
TYPE:
|
tokenizer |
A [
TYPE:
|
unet |
A [
TYPE:
|
motion_adapter |
A [
TYPE:
|
scheduler |
A scheduler to be used in combination with
TYPE:
|
Source code in mindone/diffusers/pipelines/animatediff/pipeline_animatediff_controlnet.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 |
|
mindone.diffusers.pipelines.AnimateDiffControlNetPipeline.__call__(prompt=None, num_frames=16, height=None, width=None, num_inference_steps=50, guidance_scale=7.5, negative_prompt=None, num_videos_per_prompt=1, eta=0.0, generator=None, latents=None, prompt_embeds=None, negative_prompt_embeds=None, ip_adapter_image=None, ip_adapter_image_embeds=None, conditioning_frames=None, output_type='pil', return_dict=False, cross_attention_kwargs=None, controlnet_conditioning_scale=1.0, guess_mode=False, control_guidance_start=0.0, control_guidance_end=1.0, clip_skip=None, callback_on_step_end=None, callback_on_step_end_tensor_inputs=['latents'], decode_chunk_size=16)
¶
The call function to the pipeline for generation.
PARAMETER | DESCRIPTION |
---|---|
prompt |
The prompt or prompts to guide image generation. If not defined, you need to pass
TYPE:
|
height |
The height in pixels of the generated video.
TYPE:
|
width |
The width in pixels of the generated video.
TYPE:
|
num_frames |
The number of video frames that are generated. Defaults to 16 frames which at 8 frames per seconds amounts to 2 seconds of video.
TYPE:
|
num_inference_steps |
The number of denoising steps. More denoising steps usually lead to a higher quality videos at the expense of slower inference.
TYPE:
|
guidance_scale |
A higher guidance scale value encourages the model to generate images closely linked to the text
TYPE:
|
negative_prompt |
The prompt or prompts to guide what to not include in image generation. If not defined, you need to
pass
TYPE:
|
eta |
Corresponds to parameter eta (η) from the DDIM paper. Only applies
to the [
TYPE:
|
generator |
A
TYPE:
|
latents |
Pre-generated noisy latents sampled from a Gaussian distribution, to be used as inputs for video
generation. Can be used to tweak the same generation with different prompts. If not provided, a latents
tensor is generated by sampling using the supplied random
TYPE:
|
prompt_embeds |
Pre-generated text embeddings. Can be used to easily tweak text inputs (prompt weighting). If not
provided, text embeddings are generated from the
TYPE:
|
negative_prompt_embeds |
Pre-generated negative text embeddings. Can be used to easily tweak text inputs (prompt weighting). If
not provided,
TYPE:
|
ip_adapter_image |
Optional image input to work with IP Adapters.
TYPE:
|
ip_adapter_image_embeds |
Pre-generated image embeddings for IP-Adapter. It should be a list of length same as number of
IP-adapters. Each element should be a tensor of shape
TYPE:
|
conditioning_frames |
The ControlNet input condition to provide guidance to the
TYPE:
|
output_type |
The output format of the generated video. Choose between
TYPE:
|
return_dict |
Whether or not to return a [
TYPE:
|
cross_attention_kwargs |
A kwargs dictionary that if specified is passed along to the [
TYPE:
|
controlnet_conditioning_scale |
The outputs of the ControlNet are multiplied by
TYPE:
|
guess_mode |
The ControlNet encoder tries to recognize the content of the input image even if you remove all
prompts. A
TYPE:
|
control_guidance_start |
The percentage of total steps at which the ControlNet starts applying.
TYPE:
|
control_guidance_end |
The percentage of total steps at which the ControlNet stops applying.
TYPE:
|
clip_skip |
Number of layers to be skipped from CLIP while computing the prompt embeddings. A value of 1 means that the output of the pre-final layer will be used for computing the prompt embeddings.
TYPE:
|
callback_on_step_end |
A function that calls at the end of each denoising steps during the inference. The function is called
with the following arguments:
TYPE:
|
callback_on_step_end_tensor_inputs |
The list of tensor inputs for the
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
[ |
Source code in mindone/diffusers/pipelines/animatediff/pipeline_animatediff_controlnet.py
667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 |
|
mindone.diffusers.pipelines.AnimateDiffControlNetPipeline.encode_prompt(prompt, num_images_per_prompt, do_classifier_free_guidance, negative_prompt=None, prompt_embeds=None, negative_prompt_embeds=None, lora_scale=None, clip_skip=None)
¶
Encodes the prompt into text encoder hidden states.
PARAMETER | DESCRIPTION |
---|---|
prompt |
prompt to be encoded
TYPE:
|
num_images_per_prompt |
number of images that should be generated per prompt
TYPE:
|
do_classifier_free_guidance |
whether to use classifier free guidance or not
TYPE:
|
negative_prompt |
The prompt or prompts not to guide the image generation. If not defined, one has to pass
TYPE:
|
prompt_embeds |
Pre-generated text embeddings. Can be used to easily tweak text inputs, e.g. prompt weighting. If not
provided, text embeddings will be generated from
TYPE:
|
negative_prompt_embeds |
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, e.g. prompt
weighting. If not provided, negative_prompt_embeds will be generated from
TYPE:
|
lora_scale |
A LoRA scale that will be applied to all LoRA layers of the text encoder if LoRA layers are loaded.
TYPE:
|
clip_skip |
Number of layers to be skipped from CLIP while computing the prompt embeddings. A value of 1 means that the output of the pre-final layer will be used for computing the prompt embeddings.
TYPE:
|
Source code in mindone/diffusers/pipelines/animatediff/pipeline_animatediff_controlnet.py
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 |
|
mindone.diffusers.pipelines.AnimateDiffSparseControlNetPipeline
¶
Bases: DiffusionPipeline
, TextualInversionLoaderMixin
, IPAdapterMixin
, StableDiffusionLoraLoaderMixin
Pipeline for controlled text-to-video generation using the method described in SparseCtrl: Adding Sparse Controls to Text-to-Video Diffusion Models.
This model inherits from [DiffusionPipeline
]. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).
The pipeline also inherits the following loading methods
- [
~loaders.TextualInversionLoaderMixin.load_textual_inversion
] for loading textual inversion embeddings - [
~loaders.StableDiffusionLoraLoaderMixin.load_lora_weights
] for loading LoRA weights - [
~loaders.StableDiffusionLoraLoaderMixin.save_lora_weights
] for saving LoRA weights - [
~loaders.IPAdapterMixin.load_ip_adapter
] for loading IP Adapters
PARAMETER | DESCRIPTION |
---|---|
vae |
Variational Auto-Encoder (VAE) Model to encode and decode images to and from latent representations.
TYPE:
|
text_encoder |
Frozen text-encoder (clip-vit-large-patch14).
TYPE:
|
tokenizer |
A [
TYPE:
|
unet |
A [
TYPE:
|
motion_adapter |
A [
TYPE:
|
scheduler |
A scheduler to be used in combination with
TYPE:
|
Source code in mindone/diffusers/pipelines/animatediff/pipeline_animatediff_sparsectrl.py
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 |
|
mindone.diffusers.pipelines.AnimateDiffSparseControlNetPipeline.__call__(prompt=None, height=None, width=None, num_frames=16, num_inference_steps=50, guidance_scale=7.5, negative_prompt=None, num_videos_per_prompt=1, eta=0.0, generator=None, latents=None, prompt_embeds=None, negative_prompt_embeds=None, ip_adapter_image=None, ip_adapter_image_embeds=None, conditioning_frames=None, output_type='pil', return_dict=False, cross_attention_kwargs=None, controlnet_conditioning_scale=1.0, controlnet_frame_indices=[0], guess_mode=False, clip_skip=None, callback_on_step_end=None, callback_on_step_end_tensor_inputs=['latents'])
¶
The call function to the pipeline for generation.
PARAMETER | DESCRIPTION |
---|---|
prompt |
The prompt or prompts to guide image generation. If not defined, you need to pass
TYPE:
|
height |
The height in pixels of the generated video.
TYPE:
|
width |
The width in pixels of the generated video.
TYPE:
|
num_frames |
The number of video frames that are generated. Defaults to 16 frames which at 8 frames per seconds amounts to 2 seconds of video.
TYPE:
|
num_inference_steps |
The number of denoising steps. More denoising steps usually lead to a higher quality videos at the expense of slower inference.
TYPE:
|
guidance_scale |
A higher guidance scale value encourages the model to generate images closely linked to the text
TYPE:
|
negative_prompt |
The prompt or prompts to guide what to not include in image generation. If not defined, you need to
pass
TYPE:
|
eta |
Corresponds to parameter eta (η) from the DDIM paper. Only applies
to the [
TYPE:
|
generator |
A
TYPE:
|
latents |
Pre-generated noisy latents sampled from a Gaussian distribution, to be used as inputs for video
generation. Can be used to tweak the same generation with different prompts. If not provided, a latents
tensor is generated by sampling using the supplied random
TYPE:
|
prompt_embeds |
Pre-generated text embeddings. Can be used to easily tweak text inputs (prompt weighting). If not
provided, text embeddings are generated from the
TYPE:
|
negative_prompt_embeds |
Pre-generated negative text embeddings. Can be used to easily tweak text inputs (prompt weighting). If
not provided,
TYPE:
|
ip_adapter_image |
(
TYPE:
|
ip_adapter_image_embeds |
Pre-generated image embeddings for IP-Adapter. It should be a list of length same as number of
IP-adapters. Each element should be a tensor of shape
TYPE:
|
conditioning_frames |
The SparseControlNet input to provide guidance to the
TYPE:
|
output_type |
The output format of the generated video. Choose between
TYPE:
|
return_dict |
Whether or not to return a [
TYPE:
|
cross_attention_kwargs |
A kwargs dictionary that if specified is passed along to the [
TYPE:
|
controlnet_conditioning_scale |
The outputs of the ControlNet are multiplied by
TYPE:
|
controlnet_frame_indices |
The indices where the conditioning frames must be applied for generation. Multiple frames can be
provided to guide the model to generate similar structure outputs, where the
TYPE:
|
clip_skip |
Number of layers to be skipped from CLIP while computing the prompt embeddings. A value of 1 means that the output of the pre-final layer will be used for computing the prompt embeddings.
TYPE:
|
callback_on_step_end |
A function that calls at the end of each denoising steps during the inference. The function is called
with the following arguments:
TYPE:
|
callback_on_step_end_tensor_inputs |
The list of tensor inputs for the
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
[ |
Source code in mindone/diffusers/pipelines/animatediff/pipeline_animatediff_sparsectrl.py
679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 |
|
mindone.diffusers.pipelines.AnimateDiffSparseControlNetPipeline.encode_prompt(prompt, num_images_per_prompt, do_classifier_free_guidance, negative_prompt=None, prompt_embeds=None, negative_prompt_embeds=None, lora_scale=None, clip_skip=None)
¶
Encodes the prompt into text encoder hidden states.
PARAMETER | DESCRIPTION |
---|---|
prompt |
prompt to be encoded
TYPE:
|
num_images_per_prompt |
number of images that should be generated per prompt
TYPE:
|
do_classifier_free_guidance |
whether to use classifier free guidance or not
TYPE:
|
negative_prompt |
The prompt or prompts not to guide the image generation. If not defined, one has to pass
TYPE:
|
prompt_embeds |
Pre-generated text embeddings. Can be used to easily tweak text inputs, e.g. prompt weighting. If not
provided, text embeddings will be generated from
TYPE:
|
negative_prompt_embeds |
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, e.g. prompt
weighting. If not provided, negative_prompt_embeds will be generated from
TYPE:
|
lora_scale |
A LoRA scale that will be applied to all LoRA layers of the text encoder if LoRA layers are loaded.
TYPE:
|
clip_skip |
Number of layers to be skipped from CLIP while computing the prompt embeddings. A value of 1 means that the output of the pre-final layer will be used for computing the prompt embeddings.
TYPE:
|
Source code in mindone/diffusers/pipelines/animatediff/pipeline_animatediff_sparsectrl.py
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 |
|
mindone.diffusers.pipelines.AnimateDiffSDXLPipeline
¶
Bases: DiffusionPipeline
, StableDiffusionMixin
, FromSingleFileMixin
, StableDiffusionXLLoraLoaderMixin
, TextualInversionLoaderMixin
, IPAdapterMixin
Pipeline for text-to-video generation using Stable Diffusion XL.
This model inherits from [DiffusionPipeline
]. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)
The pipeline also inherits the following loading methods
- [
~loaders.TextualInversionLoaderMixin.load_textual_inversion
] for loading textual inversion embeddings - [
~loaders.FromSingleFileMixin.from_single_file
] for loading.ckpt
files - [
~loaders.StableDiffusionXLLoraLoaderMixin.load_lora_weights
] for loading LoRA weights - [
~loaders.StableDiffusionXLLoraLoaderMixin.save_lora_weights
] for saving LoRA weights - [
~loaders.IPAdapterMixin.load_ip_adapter
] for loading IP Adapters
PARAMETER | DESCRIPTION |
---|---|
vae |
Variational Auto-Encoder (VAE) Model to encode and decode images to and from latent representations.
TYPE:
|
text_encoder |
Frozen text-encoder. Stable Diffusion XL uses the text portion of CLIP, specifically the clip-vit-large-patch14 variant.
TYPE:
|
text_encoder_2 |
Second frozen text-encoder. Stable Diffusion XL uses the text and pool portion of CLIP, specifically the laion/CLIP-ViT-bigG-14-laion2B-39B-b160k variant.
TYPE:
|
tokenizer |
Tokenizer of class CLIPTokenizer.
TYPE:
|
tokenizer_2 |
Second Tokenizer of class CLIPTokenizer.
TYPE:
|
unet |
Conditional U-Net architecture to denoise the encoded image latents.
TYPE:
|
scheduler |
A scheduler to be used in combination with
TYPE:
|
force_zeros_for_empty_prompt |
Whether the negative prompt embeddings shall be forced to always be set to 0. Also see the config of
TYPE:
|
Source code in mindone/diffusers/pipelines/animatediff/pipeline_animatediff_sdxl.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 |
|
mindone.diffusers.pipelines.AnimateDiffSDXLPipeline.__call__(prompt=None, prompt_2=None, num_frames=16, height=None, width=None, num_inference_steps=50, timesteps=None, sigmas=None, denoising_end=None, guidance_scale=5.0, negative_prompt=None, negative_prompt_2=None, num_videos_per_prompt=1, eta=0.0, generator=None, latents=None, prompt_embeds=None, negative_prompt_embeds=None, pooled_prompt_embeds=None, negative_pooled_prompt_embeds=None, ip_adapter_image=None, ip_adapter_image_embeds=None, output_type='pil', return_dict=False, cross_attention_kwargs=None, guidance_rescale=0.0, original_size=None, crops_coords_top_left=(0, 0), target_size=None, negative_original_size=None, negative_crops_coords_top_left=(0, 0), negative_target_size=None, clip_skip=None, callback_on_step_end=None, callback_on_step_end_tensor_inputs=['latents'])
¶
Function invoked when calling the pipeline for generation.
PARAMETER | DESCRIPTION |
---|---|
prompt |
The prompt or prompts to guide the video generation. If not defined, one has to pass
TYPE:
|
prompt_2 |
The prompt or prompts to be sent to the
TYPE:
|
num_frames |
The number of video frames that are generated. Defaults to 16 frames which at 8 frames per seconds amounts to 2 seconds of video.
TYPE:
|
height |
The height in pixels of the generated video. This is set to 1024 by default for the best results. Anything below 512 pixels won't work well for stabilityai/stable-diffusion-xl-base-1.0 and checkpoints that are not specifically fine-tuned on low resolutions.
TYPE:
|
width |
The width in pixels of the generated video. This is set to 1024 by default for the best results. Anything below 512 pixels won't work well for stabilityai/stable-diffusion-xl-base-1.0 and checkpoints that are not specifically fine-tuned on low resolutions.
TYPE:
|
num_inference_steps |
The number of denoising steps. More denoising steps usually lead to a higher quality video at the expense of slower inference.
TYPE:
|
timesteps |
Custom timesteps to use for the denoising process with schedulers which support a
TYPE:
|
sigmas |
Custom sigmas to use for the denoising process with schedulers which support a
TYPE:
|
denoising_end |
When specified, determines the fraction (between 0.0 and 1.0) of the total denoising process to be completed before it is intentionally prematurely terminated. As a result, the returned sample will still retain a substantial amount of noise as determined by the discrete timesteps selected by the scheduler. The denoising_end parameter should ideally be utilized when this pipeline forms a part of a "Mixture of Denoisers" multi-pipeline setup, as elaborated in Refining the Image Output
TYPE:
|
guidance_scale |
Guidance scale as defined in Classifier-Free Diffusion Guidance.
TYPE:
|
negative_prompt |
The prompt or prompts not to guide the video generation. If not defined, one has to pass
TYPE:
|
negative_prompt_2 |
The prompt or prompts not to guide the video generation to be sent to
TYPE:
|
num_videos_per_prompt |
The number of videos to generate per prompt.
TYPE:
|
eta |
Corresponds to parameter eta (η) in the DDIM paper: https://arxiv.org/abs/2010.02502. Only applies to
[
TYPE:
|
generator |
One or a list of numpy generator(s) to make generation deterministic.
TYPE:
|
latents |
Pre-generated noisy latents, sampled from a Gaussian distribution, to be used as inputs for video
generation. Can be used to tweak the same generation with different prompts. If not provided, a latents
tensor will ge generated by sampling using the supplied random
TYPE:
|
prompt_embeds |
Pre-generated text embeddings. Can be used to easily tweak text inputs, e.g. prompt weighting. If not
provided, text embeddings will be generated from
TYPE:
|
negative_prompt_embeds |
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, e.g. prompt
weighting. If not provided, negative_prompt_embeds will be generated from
TYPE:
|
pooled_prompt_embeds |
Pre-generated pooled text embeddings. Can be used to easily tweak text inputs, e.g. prompt weighting.
If not provided, pooled text embeddings will be generated from
TYPE:
|
negative_pooled_prompt_embeds |
Pre-generated negative pooled text embeddings. Can be used to easily tweak text inputs, e.g. prompt
weighting. If not provided, pooled negative_prompt_embeds will be generated from
TYPE:
|
ip_adapter_image |
(
TYPE:
|
ip_adapter_image_embeds |
Pre-generated image embeddings for IP-Adapter. If not provided, embeddings are computed from the
TYPE:
|
output_type |
The output format of the generated video. Choose between
PIL:
TYPE:
|
return_dict |
Whether or not to return a [
TYPE:
|
cross_attention_kwargs |
A kwargs dictionary that if specified is passed along to the
TYPE:
|
guidance_rescale |
Guidance rescale factor proposed by Common Diffusion Noise Schedules and Sample Steps are
Flawed
TYPE:
|
original_size |
If
TYPE:
|
crops_coords_top_left |
TYPE:
|
target_size |
For most cases,
TYPE:
|
negative_original_size |
To negatively condition the generation process based on a specific image resolution. Part of SDXL's micro-conditioning as explained in section 2.2 of https://huggingface.co/papers/2307.01952. For more information, refer to this issue thread: https://github.com/huggingface/diffusers/issues/4208.
TYPE:
|
negative_crops_coords_top_left |
To negatively condition the generation process based on a specific crop coordinates. Part of SDXL's micro-conditioning as explained in section 2.2 of https://huggingface.co/papers/2307.01952. For more information, refer to this issue thread: https://github.com/huggingface/diffusers/issues/4208.
TYPE:
|
negative_target_size |
To negatively condition the generation process based on a target image resolution. It should be as same
as the
TYPE:
|
callback_on_step_end |
A function that calls at the end of each denoising steps during the inference. The function is called
with the following arguments:
TYPE:
|
callback_on_step_end_tensor_inputs |
The list of tensor inputs for the
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
[ |
Source code in mindone/diffusers/pipelines/animatediff/pipeline_animatediff_sdxl.py
796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 |
|
mindone.diffusers.pipelines.AnimateDiffSDXLPipeline.encode_prompt(prompt, prompt_2=None, num_videos_per_prompt=1, do_classifier_free_guidance=True, negative_prompt=None, negative_prompt_2=None, prompt_embeds=None, negative_prompt_embeds=None, pooled_prompt_embeds=None, negative_pooled_prompt_embeds=None, lora_scale=None, clip_skip=None)
¶
Encodes the prompt into text encoder hidden states.
PARAMETER | DESCRIPTION |
---|---|
prompt |
prompt to be encoded
TYPE:
|
prompt_2 |
The prompt or prompts to be sent to the
TYPE:
|
num_videos_per_prompt |
number of images that should be generated per prompt
TYPE:
|
do_classifier_free_guidance |
whether to use classifier free guidance or not
TYPE:
|
negative_prompt |
The prompt or prompts not to guide the image generation. If not defined, one has to pass
TYPE:
|
negative_prompt_2 |
The prompt or prompts not to guide the image generation to be sent to
TYPE:
|
prompt_embeds |
Pre-generated text embeddings. Can be used to easily tweak text inputs, e.g. prompt weighting. If not
provided, text embeddings will be generated from
TYPE:
|
negative_prompt_embeds |
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, e.g. prompt
weighting. If not provided, negative_prompt_embeds will be generated from
TYPE:
|
pooled_prompt_embeds |
Pre-generated pooled text embeddings. Can be used to easily tweak text inputs, e.g. prompt weighting.
If not provided, pooled text embeddings will be generated from
TYPE:
|
negative_pooled_prompt_embeds |
Pre-generated negative pooled text embeddings. Can be used to easily tweak text inputs, e.g. prompt
weighting. If not provided, pooled negative_prompt_embeds will be generated from
TYPE:
|
lora_scale |
A lora scale that will be applied to all LoRA layers of the text encoder if LoRA layers are loaded.
TYPE:
|
clip_skip |
Number of layers to be skipped from CLIP while computing the prompt embeddings. A value of 1 means that the output of the pre-final layer will be used for computing the prompt embeddings.
TYPE:
|
Source code in mindone/diffusers/pipelines/animatediff/pipeline_animatediff_sdxl.py
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 |
|
mindone.diffusers.pipelines.AnimateDiffSDXLPipeline.get_guidance_scale_embedding(w, embedding_dim=512, dtype=ms.float32)
¶
See https://github.com/google-research/vdm/blob/dc27b98a554f65cdc654b800da5aa1846545d41b/model_vdm.py#L298
PARAMETER | DESCRIPTION |
---|---|
w |
Generate embedding vectors with a specified guidance scale to subsequently enrich timestep embeddings.
TYPE:
|
embedding_dim |
Dimension of the embeddings to generate.
TYPE:
|
dtype |
Data type of the generated embeddings.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Tensor
|
|
Source code in mindone/diffusers/pipelines/animatediff/pipeline_animatediff_sdxl.py
731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 |
|
mindone.diffusers.pipelines.AnimateDiffVideoToVideoPipeline
¶
Bases: DiffusionPipeline
, StableDiffusionMixin
, TextualInversionLoaderMixin
, IPAdapterMixin
, LoraLoaderMixin
Pipeline for video-to-video generation.
This model inherits from [DiffusionPipeline
]. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).
The pipeline also inherits the following loading methods
- [
~loaders.TextualInversionLoaderMixin.load_textual_inversion
] for loading textual inversion embeddings - [
~loaders.LoraLoaderMixin.load_lora_weights
] for loading LoRA weights - [
~loaders.LoraLoaderMixin.save_lora_weights
] for saving LoRA weights - [
~loaders.IPAdapterMixin.load_ip_adapter
] for loading IP Adapters
PARAMETER | DESCRIPTION |
---|---|
vae |
Variational Auto-Encoder (VAE) Model to encode and decode images to and from latent representations.
TYPE:
|
text_encoder |
Frozen text-encoder (clip-vit-large-patch14).
TYPE:
|
tokenizer |
A [
TYPE:
|
unet |
A [
TYPE:
|
motion_adapter |
A [
TYPE:
|
scheduler |
A scheduler to be used in combination with
TYPE:
|
Source code in mindone/diffusers/pipelines/animatediff/pipeline_animatediff_video2video.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 |
|
mindone.diffusers.pipelines.AnimateDiffVideoToVideoPipeline.__call__(video=None, prompt=None, height=None, width=None, num_inference_steps=50, timesteps=None, sigmas=None, guidance_scale=7.5, strength=0.8, negative_prompt=None, num_videos_per_prompt=1, eta=0.0, generator=None, latents=None, prompt_embeds=None, negative_prompt_embeds=None, ip_adapter_image=None, ip_adapter_image_embeds=None, output_type='pil', return_dict=False, cross_attention_kwargs=None, clip_skip=None, callback_on_step_end=None, callback_on_step_end_tensor_inputs=['latents'])
¶
The call function to the pipeline for generation.
PARAMETER | DESCRIPTION |
---|---|
video |
The input video to condition the generation on. Must be a list of images/frames of the video.
TYPE:
|
prompt |
The prompt or prompts to guide image generation. If not defined, you need to pass
TYPE:
|
height |
The height in pixels of the generated video.
TYPE:
|
width |
The width in pixels of the generated video.
TYPE:
|
num_inference_steps |
The number of denoising steps. More denoising steps usually lead to a higher quality videos at the expense of slower inference.
TYPE:
|
timesteps |
Custom timesteps to use for the denoising process with schedulers which support a
TYPE:
|
sigmas |
Custom sigmas to use for the denoising process with schedulers which support a
TYPE:
|
strength |
Higher strength leads to more differences between original video and generated video.
TYPE:
|
guidance_scale |
A higher guidance scale value encourages the model to generate images closely linked to the text
TYPE:
|
negative_prompt |
The prompt or prompts to guide what to not include in image generation. If not defined, you need to
pass
TYPE:
|
eta |
Corresponds to parameter eta (η) from the DDIM paper. Only applies
to the [
TYPE:
|
generator |
A
TYPE:
|
latents |
Pre-generated noisy latents sampled from a Gaussian distribution, to be used as inputs for video
generation. Can be used to tweak the same generation with different prompts. If not provided, a latents
tensor is generated by sampling using the supplied random
TYPE:
|
prompt_embeds |
Pre-generated text embeddings. Can be used to easily tweak text inputs (prompt weighting). If not
provided, text embeddings are generated from the
TYPE:
|
negative_prompt_embeds |
Pre-generated negative text embeddings. Can be used to easily tweak text inputs (prompt weighting). If
not provided,
TYPE:
|
ip_adapter_image |
(
TYPE:
|
ip_adapter_image_embeds |
Pre-generated image embeddings for IP-Adapter. It should be a list of length same as number of
IP-adapters. Each element should be a tensor of shape
TYPE:
|
output_type |
The output format of the generated video. Choose between
TYPE:
|
return_dict |
Whether or not to return a [
TYPE:
|
cross_attention_kwargs |
A kwargs dictionary that if specified is passed along to the [
TYPE:
|
clip_skip |
Number of layers to be skipped from CLIP while computing the prompt embeddings. A value of 1 means that the output of the pre-final layer will be used for computing the prompt embeddings.
TYPE:
|
callback_on_step_end |
A function that calls at the end of each denoising steps during the inference. The function is called
with the following arguments:
TYPE:
|
callback_on_step_end_tensor_inputs |
The list of tensor inputs for the
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
[ |
Source code in mindone/diffusers/pipelines/animatediff/pipeline_animatediff_video2video.py
714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 |
|
mindone.diffusers.pipelines.AnimateDiffVideoToVideoPipeline.encode_prompt(prompt, num_images_per_prompt, do_classifier_free_guidance, negative_prompt=None, prompt_embeds=None, negative_prompt_embeds=None, lora_scale=None, clip_skip=None)
¶
Encodes the prompt into text encoder hidden states.
PARAMETER | DESCRIPTION |
---|---|
prompt |
prompt to be encoded
TYPE:
|
num_images_per_prompt |
number of images that should be generated per prompt
TYPE:
|
do_classifier_free_guidance |
whether to use classifier free guidance or not
TYPE:
|
negative_prompt |
The prompt or prompts not to guide the image generation. If not defined, one has to pass
TYPE:
|
prompt_embeds |
Pre-generated text embeddings. Can be used to easily tweak text inputs, e.g. prompt weighting. If not
provided, text embeddings will be generated from
TYPE:
|
negative_prompt_embeds |
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, e.g. prompt
weighting. If not provided, negative_prompt_embeds will be generated from
TYPE:
|
lora_scale |
A LoRA scale that will be applied to all LoRA layers of the text encoder if LoRA layers are loaded.
TYPE:
|
clip_skip |
Number of layers to be skipped from CLIP while computing the prompt embeddings. A value of 1 means that the output of the pre-final layer will be used for computing the prompt embeddings.
TYPE:
|
Source code in mindone/diffusers/pipelines/animatediff/pipeline_animatediff_video2video.py
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 |
|
mindone.diffusers.pipelines.animatediff.AnimateDiffPipelineOutput
dataclass
¶
Bases: BaseOutput
Output class for AnimateDiff pipelines.
Args:
frames (mindspore.Tensor
, np.ndarray
, or List[List[PIL.Image.Image]]):
List of video outputs - It can be a nested list of length batch_size,
with each sub-list containing denoised
PIL image sequences of length num_frames.
It can also be a NumPy array or Torch tensor of shape
(batch_size, num_frames, channels, height, width)
Source code in mindone/diffusers/pipelines/animatediff/pipeline_output.py
12 13 14 15 16 17 18 19 20 21 22 23 24 |
|