import{s as Zo,o as Wo,n as N}from"../chunks/scheduler.53228c21.js";import{S as vo,i as Io,e as p,s,c as M,q as Go,h as Bo,a as c,d as n,b as o,f as W,j as u,g as y,r as ko,k as v,w as Vo,l as d,m as r,n as _,t as b,o as w,p as J}from"../chunks/index.100fac89.js";import{D as k}from"../chunks/Docstring.46d0934e.js";import{C as Y}from"../chunks/CodeBlock.d30a6509.js";import{E as ft}from"../chunks/ExampleCodeBlock.9c663ca1.js";import{H as F,E as Co}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.d27ae4df.js";import{H as ys,a as ht}from"../chunks/HfOption.fad27e59.js";function xo(T){let a,f='Refer to the <a href="../../optimization/memory">Reduce memory usage</a> guide for more details about the various memory saving techniques.',i,m,h="The Wan2.1 text-to-video model below requires ~13GB of VRAM.",l,g,U;return g=new Y({props:{code:" ",highlighted:`<span class="hljs-comment"># pip install ftfy</span>
<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoModel, WanPipeline
<span class="hljs-keyword">from</span> diffusers.quantizers <span class="hljs-keyword">import</span> PipelineQuantizationConfig
<span class="hljs-keyword">from</span> diffusers.hooks.group_offloading <span class="hljs-keyword">import</span> apply_group_offloading
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> export_to_video, load_image
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> UMT5EncoderModel

text_encoder = UMT5EncoderModel.from_pretrained(<span class="hljs-string">&quot;Wan-AI/Wan2.1-T2V-14B-Diffusers&quot;</span>, subfolder=<span class="hljs-string">&quot;text_encoder&quot;</span>, torch_dtype=torch.bfloat16)
vae = AutoModel.from_pretrained(<span class="hljs-string">&quot;Wan-AI/Wan2.1-T2V-14B-Diffusers&quot;</span>, subfolder=<span class="hljs-string">&quot;vae&quot;</span>, torch_dtype=torch.float32)
transformer = AutoModel.from_pretrained(<span class="hljs-string">&quot;Wan-AI/Wan2.1-T2V-14B-Diffusers&quot;</span>, subfolder=<span class="hljs-string">&quot;transformer&quot;</span>, torch_dtype=torch.bfloat16)

<span class="hljs-comment"># group-offloading</span>
onload_device = torch.device(<span class="hljs-string">&quot;cuda&quot;</span>)
offload_device = torch.device(<span class="hljs-string">&quot;cpu&quot;</span>)
apply_group_offloading(text_encoder,
    onload_device=onload_device,
    offload_device=offload_device,
    offload_type=<span class="hljs-string">&quot;block_level&quot;</span>,
    num_blocks_per_group=<span class="hljs-number">4</span>
)
transformer.enable_group_offload(
    onload_device=onload_device,
    offload_device=offload_device,
    offload_type=<span class="hljs-string">&quot;leaf_level&quot;</span>,
    use_stream=<span class="hljs-literal">True</span>
)

pipeline = WanPipeline.from_pretrained(
    <span class="hljs-string">&quot;Wan-AI/Wan2.1-T2V-14B-Diffusers&quot;</span>,
    vae=vae,
    transformer=transformer,
    text_encoder=text_encoder,
    torch_dtype=torch.bfloat16
)
pipeline.to(<span class="hljs-string">&quot;cuda&quot;</span>)

prompt = <span class="hljs-string">&quot;&quot;&quot;
The camera rushes from far to near in a low-angle shot,
revealing a white ferret on a log. It plays, leaps into the water, and emerges, as the camera zooms in
for a close-up. Water splashes berry bushes nearby, while moss, snow, and leaves blanket the ground.
Birch trees and a light blue sky frame the scene, with ferns in the foreground. Side lighting casts dynamic
shadows and warm highlights. Medium composition, front view, low angle, with depth of field.
&quot;&quot;&quot;</span>
negative_prompt = <span class="hljs-string">&quot;&quot;&quot;
Bright tones, overexposed, static, blurred details, subtitles, style, works, paintings, images, static, overall gray, worst quality,
low quality, JPEG compression residue, ugly, incomplete, extra fingers, poorly drawn hands, poorly drawn faces, deformed, disfigured,
misshapen limbs, fused fingers, still picture, messy background, three legs, many people in the background, walking backwards
&quot;&quot;&quot;</span>

output = pipeline(
    prompt=prompt,
    negative_prompt=negative_prompt,
    num_frames=<span class="hljs-number">81</span>,
    guidance_scale=<span class="hljs-number">5.0</span>,
).frames[<span class="hljs-number">0</span>]
export_to_video(output, <span class="hljs-string">&quot;output.mp4&quot;</span>, fps=<span class="hljs-number">16</span>)`,wrap:!1}}),{c(){a=p("p"),a.innerHTML=f,i=s(),m=p("p"),m.textContent=h,l=s(),M(g.$$.fragment)},l(j){a=c(j,"P",{"data-svelte-h":!0}),u(a)!=="svelte-iowzkr"&&(a.innerHTML=f),i=o(j),m=c(j,"P",{"data-svelte-h":!0}),u(m)!=="svelte-lj5f0r"&&(m.textContent=h),l=o(j),y(g.$$.fragment,j)},m(j,V){r(j,a,V),r(j,i,V),r(j,m,V),r(j,l,V),_(g,j,V),U=!0},p:N,i(j){U||(b(g.$$.fragment,j),U=!0)},o(j){w(g.$$.fragment,j),U=!1},d(j){j&&(n(a),n(i),n(m),n(l)),J(g,j)}}}function Ro(T){let a,f='<a href="../../optimization/fp16#torchcompile">Compilation</a> is slow the first time but subsequent calls to the pipeline are faster. <a href="../../optimization/cache">Caching</a> may also speed up inference by storing and reusing intermediate outputs.',i,m,h;return m=new Y({props:{code:"JTIzJTIwcGlwJTIwaW5zdGFsbCUyMGZ0ZnklMEFpbXBvcnQlMjB0b3JjaCUwQWltcG9ydCUyMG51bXB5JTIwYXMlMjBucCUwQWZyb20lMjBkaWZmdXNlcnMlMjBpbXBvcnQlMjBBdXRvTW9kZWwlMkMlMjBXYW5QaXBlbGluZSUwQWZyb20lMjBkaWZmdXNlcnMuaG9va3MuZ3JvdXBfb2ZmbG9hZGluZyUyMGltcG9ydCUyMGFwcGx5X2dyb3VwX29mZmxvYWRpbmclMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwZXhwb3J0X3RvX3ZpZGVvJTJDJTIwbG9hZF9pbWFnZSUwQWZyb20lMjB0cmFuc2Zvcm1lcnMlMjBpbXBvcnQlMjBVTVQ1RW5jb2Rlck1vZGVsJTBBJTBBdGV4dF9lbmNvZGVyJTIwJTNEJTIwVU1UNUVuY29kZXJNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyV2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TJDJTBBJTIwJTIwJTIwJTIwZ3VpZGFuY2Vfc2NhbGUlM0Q1LjAlMkMlMEEpLmZyYW1lcyU1QjAlNUQlMEFleHBvcnRfdG9fdmlkZW8ob3V0cHV0JTJDJTIwJTIyb3V0cHV0Lm1wNCUyMiUyQyUyMGZwcyUzRDE2KQ==",highlighted:`<span class="hljs-comment"># pip install ftfy</span>
<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoModel, WanPipeline
<span class="hljs-keyword">from</span> diffusers.hooks.group_offloading <span class="hljs-keyword">import</span> apply_group_offloading
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> export_to_video, load_image
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> UMT5EncoderModel

text_encoder = UMT5EncoderModel.from_pretrained(<span class="hljs-string">&quot;Wan-AI/Wan2.1-T2V-14B-Diffusers&quot;</span>, subfolder=<span class="hljs-string">&quot;text_encoder&quot;</span>, torch_dtype=torch.bfloat16)
vae = AutoModel.from_pretrained(<span class="hljs-string">&quot;Wan-AI/Wan2.1-T2V-14B-Diffusers&quot;</span>, subfolder=<span class="hljs-string">&quot;vae&quot;</span>, torch_dtype=torch.float32)
transformer = AutoModel.from_pretrained(<span class="hljs-string">&quot;Wan-AI/Wan2.1-T2V-14B-Diffusers&quot;</span>, subfolder=<span class="hljs-string">&quot;transformer&quot;</span>, torch_dtype=torch.bfloat16)

pipeline = WanPipeline.from_pretrained(
    <span class="hljs-string">&quot;Wan-AI/Wan2.1-T2V-14B-Diffusers&quot;</span>,
    vae=vae,
    transformer=transformer,
    text_encoder=text_encoder,
    torch_dtype=torch.bfloat16
)
pipeline.to(<span class="hljs-string">&quot;cuda&quot;</span>)

<span class="hljs-comment"># torch.compile</span>
pipeline.transformer.to(memory_format=torch.channels_last)
pipeline.transformer = torch.<span class="hljs-built_in">compile</span>(
    pipeline.transformer, mode=<span class="hljs-string">&quot;max-autotune&quot;</span>, fullgraph=<span class="hljs-literal">True</span>
)

prompt = <span class="hljs-string">&quot;&quot;&quot;
The camera rushes from far to near in a low-angle shot,
revealing a white ferret on a log. It plays, leaps into the water, and emerges, as the camera zooms in
for a close-up. Water splashes berry bushes nearby, while moss, snow, and leaves blanket the ground.
Birch trees and a light blue sky frame the scene, with ferns in the foreground. Side lighting casts dynamic
shadows and warm highlights. Medium composition, front view, low angle, with depth of field.
&quot;&quot;&quot;</span>
negative_prompt = <span class="hljs-string">&quot;&quot;&quot;
Bright tones, overexposed, static, blurred details, subtitles, style, works, paintings, images, static, overall gray, worst quality,
low quality, JPEG compression residue, ugly, incomplete, extra fingers, poorly drawn hands, poorly drawn faces, deformed, disfigured,
misshapen limbs, fused fingers, still picture, messy background, three legs, many people in the background, walking backwards
&quot;&quot;&quot;</span>

output = pipeline(
    prompt=prompt,
    negative_prompt=negative_prompt,
    num_frames=<span class="hljs-number">81</span>,
    guidance_scale=<span class="hljs-number">5.0</span>,
).frames[<span class="hljs-number">0</span>]
export_to_video(output, <span class="hljs-string">&quot;output.mp4&quot;</span>, fps=<span class="hljs-number">16</span>)`,wrap:!1}}),{c(){a=p("p"),a.innerHTML=f,i=s(),M(m.$$.fragment)},l(l){a=c(l,"P",{"data-svelte-h":!0}),u(a)!=="svelte-e4r7sz"&&(a.innerHTML=f),i=o(l),y(m.$$.fragment,l)},m(l,g){r(l,a,g),r(l,i,g),_(m,l,g),h=!0},p:N,i(l){h||(b(m.$$.fragment,l),h=!0)},o(l){w(m.$$.fragment,l),h=!1},d(l){l&&(n(a),n(i)),J(m,l)}}}function Xo(T){let a,f,i,m;return a=new ht({props:{id:"T2V usage",option:"T2V memory",$$slots:{default:[xo]},$$scope:{ctx:T}}}),i=new ht({props:{id:"T2V usage",option:"T2V inference speed",$$slots:{default:[Ro]},$$scope:{ctx:T}}}),{c(){M(a.$$.fragment),f=s(),M(i.$$.fragment)},l(h){y(a.$$.fragment,h),f=o(h),y(i.$$.fragment,h)},m(h,l){_(a,h,l),r(h,f,l),_(i,h,l),m=!0},p(h,l){const g={};l&2&&(g.$$scope={dirty:l,ctx:h}),a.$set(g);const U={};l&2&&(U.$$scope={dirty:l,ctx:h}),i.$set(U)},i(h){m||(b(a.$$.fragment,h),b(i.$$.fragment,h),m=!0)},o(h){w(a.$$.fragment,h),w(i.$$.fragment,h),m=!1},d(h){h&&n(f),J(a,h),J(i,h)}}}function Fo(T){let a,f;return a=new Y({props:{code:" ",highlighted:`<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">import</span> torchvision.transforms.functional <span class="hljs-keyword">as</span> TF
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoencoderKLWan, WanImageToVideoPipeline
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> export_to_video, load_image
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> CLIPVisionModel


model_id = <span class="hljs-string">&quot;Wan-AI/Wan2.1-FLF2V-14B-720P-diffusers&quot;</span>
image_encoder = CLIPVisionModel.from_pretrained(model_id, subfolder=<span class="hljs-string">&quot;image_encoder&quot;</span>, torch_dtype=torch.float32)
vae = AutoencoderKLWan.from_pretrained(model_id, subfolder=<span class="hljs-string">&quot;vae&quot;</span>, torch_dtype=torch.float32)
pipe = WanImageToVideoPipeline.from_pretrained(
    model_id, vae=vae, image_encoder=image_encoder, torch_dtype=torch.bfloat16
)
pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)

first_frame = load_image(<span class="hljs-string">&quot;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/flf2v_input_first_frame.png&quot;</span>)
last_frame = load_image(<span class="hljs-string">&quot;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/flf2v_input_last_frame.png&quot;</span>)

<span class="hljs-keyword">def</span> <span class="hljs-title function_">aspect_ratio_resize</span>(<span class="hljs-params">image, pipe, max_area=<span class="hljs-number">720</span> * <span class="hljs-number">1280</span></span>):
    aspect_ratio = image.height / image.width
    mod_value = pipe.vae_scale_factor_spatial * pipe.transformer.config.patch_size[<span class="hljs-number">1</span>]
    height = <span class="hljs-built_in">round</span>(np.sqrt(max_area * aspect_ratio)) // mod_value * mod_value
    width = <span class="hljs-built_in">round</span>(np.sqrt(max_area / aspect_ratio)) // mod_value * mod_value
    image = image.resize((width, height))
    <span class="hljs-keyword">return</span> image, height, width

<span class="hljs-keyword">def</span> <span class="hljs-title function_">center_crop_resize</span>(<span class="hljs-params">image, height, width</span>):
    <span class="hljs-comment"># Calculate resize ratio to match first frame dimensions</span>
    resize_ratio = <span class="hljs-built_in">max</span>(width / image.width, height / image.height)

    <span class="hljs-comment"># Resize the image</span>
    width = <span class="hljs-built_in">round</span>(image.width * resize_ratio)
    height = <span class="hljs-built_in">round</span>(image.height * resize_ratio)
    size = [width, height]
    image = TF.center_crop(image, size)

    <span class="hljs-keyword">return</span> image, height, width

first_frame, height, width = aspect_ratio_resize(first_frame, pipe)
<span class="hljs-keyword">if</span> last_frame.size != first_frame.size:
    last_frame, _, _ = center_crop_resize(last_frame, height, width)

prompt = <span class="hljs-string">&quot;CG animation style, a small blue bird takes off from the ground, flapping its wings. The bird&#x27;s feathers are delicate, with a unique pattern on its chest. The background shows a blue sky with white clouds under bright sunshine. The camera follows the bird upward, capturing its flight and the vastness of the sky from a close-up, low-angle perspective.&quot;</span>

output = pipe(
    image=first_frame, last_image=last_frame, prompt=prompt, height=height, width=width, guidance_scale=<span class="hljs-number">5.5</span>
).frames[<span class="hljs-number">0</span>]
export_to_video(output, <span class="hljs-string">&quot;output.mp4&quot;</span>, fps=<span class="hljs-number">16</span>)`,wrap:!1}}),{c(){M(a.$$.fragment)},l(i){y(a.$$.fragment,i)},m(i,m){_(a,i,m),f=!0},p:N,i(i){f||(b(a.$$.fragment,i),f=!0)},o(i){w(a.$$.fragment,i),f=!1},d(i){J(a,i)}}}function Qo(T){let a,f;return a=new ht({props:{id:"FLF2V usage",option:"usage",$$slots:{default:[Fo]},$$scope:{ctx:T}}}),{c(){M(a.$$.fragment)},l(i){y(a.$$.fragment,i)},m(i,m){_(a,i,m),f=!0},p(i,m){const h={};m&2&&(h.$$scope={dirty:m,ctx:i}),a.$set(h)},i(i){f||(b(a.$$.fragment,i),f=!0)},o(i){w(a.$$.fragment,i),f=!1},d(i){J(a,i)}}}function Yo(T){let a,f;return a=new Y({props:{code:"aW1wb3J0JTIwbnVtcHklMjBhcyUyMG5wJTBBaW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwQXV0b2VuY29kZXJLTFdhbiUyQyUyMFdhbkFuaW1hdGVQaXBlbGluZSUwQWZyb20lMjBkaWZmdXNlcnMudXRpbHMlMjBpbXBvcnQlMjBleHBvcnRfdG9fdmlkZW8lMkMlMjBsb2FkX2ltYWdlJTJDJTIwbG9hZF92aWRlbyUwQSUwQW1vZGVsX2lkJTIwJTNEJTIwJTIyV2FuLUFJJTJGV2FuMi4yLUFuaW1hdGUtMTRCLURpZmZ1c2VycyUyMiUwQXZhZSUyMCUzRCUyMEF1dG9lbmNvZGVyS0xXYW4uZnJvbV9wcmV0cmFpbmVkKG1vZGVsX2lkJTJDJTIwc3ViZm9sZGVyJTNEJTIydmFlJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDMyKSUwQXBpcGUlMjAlM0QlMjBXYW5BbmltYXRlUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKG1vZGVsX2lkJTJDJTIwdmFlJTNEdmFlJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5iZmxvYXQxNiklMEFwaXBlLnRvKCUyMmN1ZGElMjIpJTBBJTBBJTIzJTIwTG9hZCUyMGNoYXJhY3RlciUyMGltYWdlJTIwYW5kJTIwcHJlcHJvY2Vzc2VkJTIwdmlkZW9zJTBBaW1h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CUyMCUyMHdpZHRoJTNEd2lkdGglMkMlMEElMjAlMjAlMjAlMjBzZWdtZW50X2ZyYW1lX2xlbmd0aCUzRDc3JTJDJTBBJTIwJTIwJTIwJTIwZ3VpZGFuY2Vfc2NhbGUlM0QxLjAlMkMlMEElMjAlMjAlMjAlMjBtb2RlJTNEJTIyYW5pbWF0ZSUyMiUyQyUyMCUyMCUyMyUyMEFuaW1hdGlvbiUyMG1vZGUlMjAoZGVmYXVsdCklMEEpLmZyYW1lcyU1QjAlNUQlMEFleHBvcnRfdG9fdmlkZW8ob3V0cHV0JTJDJTIwJTIyYW5pbWF0ZWRfY2hhcmFjdGVyLm1wNCUyMiUyQyUyMGZwcyUzRDMwKQ==",highlighted:`<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoencoderKLWan, WanAnimatePipeline
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> export_to_video, load_image, load_video

model_id = <span class="hljs-string">&quot;Wan-AI/Wan2.2-Animate-14B-Diffusers&quot;</span>
vae = AutoencoderKLWan.from_pretrained(model_id, subfolder=<span class="hljs-string">&quot;vae&quot;</span>, torch_dtype=torch.float32)
pipe = WanAnimatePipeline.from_pretrained(model_id, vae=vae, torch_dtype=torch.bfloat16)
pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)

<span class="hljs-comment"># Load character image and preprocessed videos</span>
image = load_image(<span class="hljs-string">&quot;path/to/character.jpg&quot;</span>)
pose_video = load_video(<span class="hljs-string">&quot;path/to/pose_video.mp4&quot;</span>)  <span class="hljs-comment"># Preprocessed skeletal keypoints</span>
face_video = load_video(<span class="hljs-string">&quot;path/to/face_video.mp4&quot;</span>)  <span class="hljs-comment"># Preprocessed facial features</span>

<span class="hljs-comment"># Resize image to match VAE constraints</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">aspect_ratio_resize</span>(<span class="hljs-params">image, pipe, max_area=<span class="hljs-number">720</span> * <span class="hljs-number">1280</span></span>):
    aspect_ratio = image.height / image.width
    mod_value = pipe.vae_scale_factor_spatial * pipe.transformer.config.patch_size[<span class="hljs-number">1</span>]
    height = <span class="hljs-built_in">round</span>(np.sqrt(max_area * aspect_ratio)) // mod_value * mod_value
    width = <span class="hljs-built_in">round</span>(np.sqrt(max_area / aspect_ratio)) // mod_value * mod_value
    image = image.resize((width, height))
    <span class="hljs-keyword">return</span> image, height, width

image, height, width = aspect_ratio_resize(image, pipe)

prompt = <span class="hljs-string">&quot;A person dancing energetically in a studio with dynamic lighting and professional camera work&quot;</span>
negative_prompt = <span class="hljs-string">&quot;blurry, low quality, distorted, deformed, static, poorly drawn&quot;</span>

<span class="hljs-comment"># Generate animated video</span>
output = pipe(
    image=image,
    pose_video=pose_video,
    face_video=face_video,
    prompt=prompt,
    negative_prompt=negative_prompt,
    height=height,
    width=width,
    segment_frame_length=<span class="hljs-number">77</span>,
    guidance_scale=<span class="hljs-number">1.0</span>,
    mode=<span class="hljs-string">&quot;animate&quot;</span>,  <span class="hljs-comment"># Animation mode (default)</span>
).frames[<span class="hljs-number">0</span>]
export_to_video(output, <span class="hljs-string">&quot;animated_character.mp4&quot;</span>, fps=<span class="hljs-number">30</span>)`,wrap:!1}}),{c(){M(a.$$.fragment)},l(i){y(a.$$.fragment,i)},m(i,m){_(a,i,m),f=!0},p:N,i(i){f||(b(a.$$.fragment,i),f=!0)},o(i){w(a.$$.fragment,i),f=!1},d(i){J(a,i)}}}function No(T){let a,f;return a=new Y({props:{code:"aW1wb3J0JTIwbnVtcHklMjBhcyUyMG5wJTBBaW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwQXV0b2VuY29kZXJLTFdhbiUyQyUyMFdhbkFuaW1hdGVQaXBlbGluZSUwQWZyb20lMjBkaWZmdXNlcnMudXRpbHMlMjBpbXBvcnQlMjBleHBvcnRfdG9fdmlkZW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aWR0aCUzRHdpZHRoJTJDJTBBJTIwJTIwJTIwJTIwc2VnbWVudF9mcmFtZV9sZW5ndGhzJTNENzclMkMlMEElMjAlMjAlMjAlMjBndWlkYW5jZV9zY2FsZSUzRDEuMCUyQyUwQSUyMCUyMCUyMCUyMG1vZGUlM0QlMjJyZXBsYWNlJTIyJTJDJTIwJTIwJTIzJTIwUmVwbGFjZW1lbnQlMjBtb2RlJTBBKS5mcmFtZXMlNUIwJTVEJTBBZXhwb3J0X3RvX3ZpZGVvKG91dHB1dCUyQyUyMCUyMmNoYXJhY3Rlcl9yZXBsYWNlZC5tcDQlMjIlMkMlMjBmcHMlM0QzMCk=",highlighted:`<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoencoderKLWan, WanAnimatePipeline
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> export_to_video, load_image, load_video

model_id = <span class="hljs-string">&quot;Wan-AI/Wan2.2-Animate-14B-Diffusers&quot;</span>
vae = AutoencoderKLWan.from_pretrained(model_id, subfolder=<span class="hljs-string">&quot;vae&quot;</span>, torch_dtype=torch.float32)
pipe = WanAnimatePipeline.from_pretrained(model_id, vae=vae, torch_dtype=torch.bfloat16)
pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)

<span class="hljs-comment"># Load all required inputs for replacement mode</span>
image = load_image(<span class="hljs-string">&quot;path/to/new_character.jpg&quot;</span>)
pose_video = load_video(<span class="hljs-string">&quot;path/to/pose_video.mp4&quot;</span>)  <span class="hljs-comment"># Preprocessed skeletal keypoints</span>
face_video = load_video(<span class="hljs-string">&quot;path/to/face_video.mp4&quot;</span>)  <span class="hljs-comment"># Preprocessed facial features</span>
background_video = load_video(<span class="hljs-string">&quot;path/to/background_video.mp4&quot;</span>)  <span class="hljs-comment"># Original scene</span>
mask_video = load_video(<span class="hljs-string">&quot;path/to/mask_video.mp4&quot;</span>)  <span class="hljs-comment"># Black: preserve, White: generate</span>

<span class="hljs-comment"># Resize image to match video dimensions</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">aspect_ratio_resize</span>(<span class="hljs-params">image, pipe, max_area=<span class="hljs-number">720</span> * <span class="hljs-number">1280</span></span>):
    aspect_ratio = image.height / image.width
    mod_value = pipe.vae_scale_factor_spatial * pipe.transformer.config.patch_size[<span class="hljs-number">1</span>]
    height = <span class="hljs-built_in">round</span>(np.sqrt(max_area * aspect_ratio)) // mod_value * mod_value
    width = <span class="hljs-built_in">round</span>(np.sqrt(max_area / aspect_ratio)) // mod_value * mod_value
    image = image.resize((width, height))
    <span class="hljs-keyword">return</span> image, height, width

image, height, width = aspect_ratio_resize(image, pipe)

prompt = <span class="hljs-string">&quot;A person seamlessly integrated into the scene with consistent lighting and environment&quot;</span>
negative_prompt = <span class="hljs-string">&quot;blurry, low quality, inconsistent lighting, floating, disconnected from scene&quot;</span>

<span class="hljs-comment"># Replace character in background video</span>
output = pipe(
    image=image,
    pose_video=pose_video,
    face_video=face_video,
    background_video=background_video,
    mask_video=mask_video,
    prompt=prompt,
    negative_prompt=negative_prompt,
    height=height,
    width=width,
    segment_frame_lengths=<span class="hljs-number">77</span>,
    guidance_scale=<span class="hljs-number">1.0</span>,
    mode=<span class="hljs-string">&quot;replace&quot;</span>,  <span class="hljs-comment"># Replacement mode</span>
).frames[<span class="hljs-number">0</span>]
export_to_video(output, <span class="hljs-string">&quot;character_replaced.mp4&quot;</span>, fps=<span class="hljs-number">30</span>)`,wrap:!1}}),{c(){M(a.$$.fragment)},l(i){y(a.$$.fragment,i)},m(i,m){_(a,i,m),f=!0},p:N,i(i){f||(b(a.$$.fragment,i),f=!0)},o(i){w(a.$$.fragment,i),f=!1},d(i){J(a,i)}}}function Ao(T){let a,f;return a=new Y({props:{code:"aW1wb3J0JTIwbnVtcHklMjBhcyUyMG5wJTBBaW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZ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MHJlY29tbWVuZGVkKSUwQSUyMCUyMCUyMCUyMGNhbGxiYWNrX29uX3N0ZXBfZW5kJTNEY2FsbGJhY2tfZm4lMkMlMEElMjAlMjAlMjAlMjBjYWxsYmFja19vbl9zdGVwX2VuZF90ZW5zb3JfaW5wdXRzJTNEJTVCJTIybGF0ZW50cyUyMiU1RCUyQyUwQSkuZnJhbWVzJTVCMCU1RCUwQWV4cG9ydF90b192aWRlbyhvdXRwdXQlMkMlMjAlMjJhbmltYXRlZF9hZHZhbmNlZC5tcDQlMjIlMkMlMjBmcHMlM0QzMCk=",highlighted:`<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoencoderKLWan, WanAnimatePipeline
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> export_to_video, load_image, load_video

model_id = <span class="hljs-string">&quot;Wan-AI/Wan2.2-Animate-14B-Diffusers&quot;</span>
vae = AutoencoderKLWan.from_pretrained(model_id, subfolder=<span class="hljs-string">&quot;vae&quot;</span>, torch_dtype=torch.float32)
pipe = WanAnimatePipeline.from_pretrained(model_id, vae=vae, torch_dtype=torch.bfloat16)
pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)

image = load_image(<span class="hljs-string">&quot;path/to/character.jpg&quot;</span>)
pose_video = load_video(<span class="hljs-string">&quot;path/to/pose_video.mp4&quot;</span>)
face_video = load_video(<span class="hljs-string">&quot;path/to/face_video.mp4&quot;</span>)

<span class="hljs-keyword">def</span> <span class="hljs-title function_">aspect_ratio_resize</span>(<span class="hljs-params">image, pipe, max_area=<span class="hljs-number">720</span> * <span class="hljs-number">1280</span></span>):
    aspect_ratio = image.height / image.width
    mod_value = pipe.vae_scale_factor_spatial * pipe.transformer.config.patch_size[<span class="hljs-number">1</span>]
    height = <span class="hljs-built_in">round</span>(np.sqrt(max_area * aspect_ratio)) // mod_value * mod_value
    width = <span class="hljs-built_in">round</span>(np.sqrt(max_area / aspect_ratio)) // mod_value * mod_value
    image = image.resize((width, height))
    <span class="hljs-keyword">return</span> image, height, width

image, height, width = aspect_ratio_resize(image, pipe)

prompt = <span class="hljs-string">&quot;A person dancing energetically in a studio&quot;</span>
negative_prompt = <span class="hljs-string">&quot;blurry, low quality&quot;</span>

<span class="hljs-comment"># Advanced: Use temporal guidance and custom callback</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">callback_fn</span>(<span class="hljs-params">pipe, step_index, timestep, callback_kwargs</span>):
    <span class="hljs-comment"># You can modify latents or other tensors here</span>
    <span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;Step <span class="hljs-subst">{step_index}</span>, Timestep <span class="hljs-subst">{timestep}</span>&quot;</span>)
    <span class="hljs-keyword">return</span> callback_kwargs

output = pipe(
    image=image,
    pose_video=pose_video,
    face_video=face_video,
    prompt=prompt,
    negative_prompt=negative_prompt,
    height=height,
    width=width,
    segment_frame_length=<span class="hljs-number">77</span>,
    num_inference_steps=<span class="hljs-number">50</span>,
    guidance_scale=<span class="hljs-number">5.0</span>,
    prev_segment_conditioning_frames=<span class="hljs-number">5</span>,  <span class="hljs-comment"># Use 5 frames for temporal guidance (1 or 5 recommended)</span>
    callback_on_step_end=callback_fn,
    callback_on_step_end_tensor_inputs=[<span class="hljs-string">&quot;latents&quot;</span>],
).frames[<span class="hljs-number">0</span>]
export_to_video(output, <span class="hljs-string">&quot;animated_advanced.mp4&quot;</span>, fps=<span class="hljs-number">30</span>)`,wrap:!1}}),{c(){M(a.$$.fragment)},l(i){y(a.$$.fragment,i)},m(i,m){_(a,i,m),f=!0},p:N,i(i){f||(b(a.$$.fragment,i),f=!0)},o(i){w(a.$$.fragment,i),f=!1},d(i){J(a,i)}}}function Eo(T){let a,f,i,m,h,l;return a=new ht({props:{id:"Animate usage",option:"Animation mode",$$slots:{default:[Yo]},$$scope:{ctx:T}}}),i=new ht({props:{id:"Animate usage",option:"Replacement mode",$$slots:{default:[No]},$$scope:{ctx:T}}}),h=new ht({props:{id:"Animate usage",option:"Advanced options",$$slots:{default:[Ao]},$$scope:{ctx:T}}}),{c(){M(a.$$.fragment),f=s(),M(i.$$.fragment),m=s(),M(h.$$.fragment)},l(g){y(a.$$.fragment,g),f=o(g),y(i.$$.fragment,g),m=o(g),y(h.$$.fragment,g)},m(g,U){_(a,g,U),r(g,f,U),_(i,g,U),r(g,m,U),_(h,g,U),l=!0},p(g,U){const j={};U&2&&(j.$$scope={dirty:U,ctx:g}),a.$set(j);const V={};U&2&&(V.$$scope={dirty:U,ctx:g}),i.$set(V);const ut={};U&2&&(ut.$$scope={dirty:U,ctx:g}),h.$set(ut)},i(g){l||(b(a.$$.fragment,g),b(i.$$.fragment,g),b(h.$$.fragment,g),l=!0)},o(g){w(a.$$.fragment,g),w(i.$$.fragment,g),w(h.$$.fragment,g),l=!1},d(g){g&&(n(f),n(m)),J(a,g),J(i,g),J(h,g)}}}function Ho(T){let a,f="Examples:",i,m,h;return m=new Y({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwZXhwb3J0X3RvX3ZpZGVvJTBBZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9lbmNvZGVyS0xXYW4lMkMlMjBXYW5QaXBlbGluZSUwQWZyb20lMjBkaWZmdXNlcnMuc2NoZWR1bGVycy5zY2hlZHVsaW5nX3VuaXBjX211bHRpc3RlcCUyMGltcG9ydCUyMFVuaVBDTXVsdGlzdGVwU2NoZWR1bGVyJTBBJTBBJTIzJTIwQXZhaWxhYmxlJTIwbW9kZWxzJTNBJTIwV2FuLUFJJTJGV2FuMi4xLVQyVi0xNEItRGlmZnVzZXJzJTJDJTIwV2FuLUFJJTJGV2FuMi4xLVQyVi0xLjNCLURpZmZ1c2VycyUwQW1vZGVsX2lkJTIwJTNEJTIwJTIyV2FuLUFJJTJGV2FuMi4xLVQyVi0xNEItRGlm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MCUyQyUwQSkuZnJhbWVzJTVCMCU1RCUwQWV4cG9ydF90b192aWRlbyhvdXRwdXQlMkMlMjAlMjJvdXRwdXQubXA0JTIyJTJDJTIwZnBzJTNEMTYp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> export_to_video
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoencoderKLWan, WanPipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers.schedulers.scheduling_unipc_multistep <span class="hljs-keyword">import</span> UniPCMultistepScheduler

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Available models: Wan-AI/Wan2.1-T2V-14B-Diffusers, Wan-AI/Wan2.1-T2V-1.3B-Diffusers</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model_id = <span class="hljs-string">&quot;Wan-AI/Wan2.1-T2V-14B-Diffusers&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>vae = AutoencoderKLWan.from_pretrained(model_id, subfolder=<span class="hljs-string">&quot;vae&quot;</span>, torch_dtype=torch.float32)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = WanPipeline.from_pretrained(model_id, vae=vae, torch_dtype=torch.bfloat16)
<span class="hljs-meta">&gt;&gt;&gt; </span>flow_shift = <span class="hljs-number">5.0</span>  <span class="hljs-comment"># 5.0 for 720P, 3.0 for 480P</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config, flow_shift=flow_shift)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;A cat and a dog baking a cake together in a kitchen. The cat is carefully measuring flour, while the dog is stirring the batter with a wooden spoon. The kitchen is cozy, with sunlight streaming through the window.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>negative_prompt = <span class="hljs-string">&quot;Bright tones, overexposed, static, blurred details, subtitles, style, works, paintings, images, static, overall gray, worst quality, low quality, JPEG compression residue, ugly, incomplete, extra fingers, poorly drawn hands, poorly drawn faces, deformed, disfigured, misshapen limbs, fused fingers, still picture, messy background, three legs, many people in the background, walking backwards&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>output = pipe(
<span class="hljs-meta">... </span>    prompt=prompt,
<span class="hljs-meta">... </span>    negative_prompt=negative_prompt,
<span class="hljs-meta">... </span>    height=<span class="hljs-number">720</span>,
<span class="hljs-meta">... </span>    width=<span class="hljs-number">1280</span>,
<span class="hljs-meta">... </span>    num_frames=<span class="hljs-number">81</span>,
<span class="hljs-meta">... </span>    guidance_scale=<span class="hljs-number">5.0</span>,
<span class="hljs-meta">... </span>).frames[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>export_to_video(output, <span class="hljs-string">&quot;output.mp4&quot;</span>, fps=<span class="hljs-number">16</span>)`,wrap:!1}}),{c(){a=p("p"),a.textContent=f,i=s(),M(m.$$.fragment)},l(l){a=c(l,"P",{"data-svelte-h":!0}),u(a)!=="svelte-kvfsh7"&&(a.textContent=f),i=o(l),y(m.$$.fragment,l)},m(l,g){r(l,a,g),r(l,i,g),_(m,l,g),h=!0},p:N,i(l){h||(b(m.$$.fragment,l),h=!0)},o(l){w(m.$$.fragment,l),h=!1},d(l){l&&(n(a),n(i)),J(m,l)}}}function zo(T){let a,f="Examples:",i,m,h;return m=new Y({props:{code:"aW1wb3J0JTIwdG9yY2glMEFpbXBvcnQlMjBudW1weSUyMGFzJTIwbnAlMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwQXV0b2VuY29kZXJLTFdhbiUyQyUyMFdhbkltYWdlVG9WaWRlb1BpcGVs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CUyMCUyMCUyMHByb21wdCUzRHByb21wdCUyQyUwQSUyMCUyMCUyMCUyMG5lZ2F0aXZlX3Byb21wdCUzRG5lZ2F0aXZlX3Byb21wdCUyQyUwQSUyMCUyMCUyMCUyMGhlaWdodCUzRGhlaWdodCUyQyUwQSUyMCUyMCUyMCUyMHdpZHRoJTNEd2lkdGglMkMlMEElMjAlMjAlMjAlMjBudW1fZnJhbWVzJTNEODElMkMlMEElMjAlMjAlMjAlMjBndWlkYW5jZV9zY2FsZSUzRDUuMCUyQyUwQSkuZnJhbWVzJTVCMCU1RCUwQWV4cG9ydF90b192aWRlbyhvdXRwdXQlMkMlMjAlMjJvdXRwdXQubXA0JTIyJTJDJTIwZnBzJTNEMTYp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoencoderKLWan, WanImageToVideoPipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> export_to_video, load_image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> CLIPVisionModel

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Available models: Wan-AI/Wan2.1-I2V-14B-480P-Diffusers, Wan-AI/Wan2.1-I2V-14B-720P-Diffusers</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model_id = <span class="hljs-string">&quot;Wan-AI/Wan2.1-I2V-14B-480P-Diffusers&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image_encoder = CLIPVisionModel.from_pretrained(
<span class="hljs-meta">... </span>    model_id, subfolder=<span class="hljs-string">&quot;image_encoder&quot;</span>, torch_dtype=torch.float32
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>vae = AutoencoderKLWan.from_pretrained(model_id, subfolder=<span class="hljs-string">&quot;vae&quot;</span>, torch_dtype=torch.float32)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = WanImageToVideoPipeline.from_pretrained(
<span class="hljs-meta">... </span>    model_id, vae=vae, image_encoder=image_encoder, torch_dtype=torch.bfloat16
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>image = load_image(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/astronaut.jpg&quot;</span>
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>max_area = <span class="hljs-number">480</span> * <span class="hljs-number">832</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>aspect_ratio = image.height / image.width
<span class="hljs-meta">&gt;&gt;&gt; </span>mod_value = pipe.vae_scale_factor_spatial * pipe.transformer.config.patch_size[<span class="hljs-number">1</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>height = <span class="hljs-built_in">round</span>(np.sqrt(max_area * aspect_ratio)) // mod_value * mod_value
<span class="hljs-meta">&gt;&gt;&gt; </span>width = <span class="hljs-built_in">round</span>(np.sqrt(max_area / aspect_ratio)) // mod_value * mod_value
<span class="hljs-meta">&gt;&gt;&gt; </span>image = image.resize((width, height))
<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = (
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;An astronaut hatching from an egg, on the surface of the moon, the darkness and depth of space realised in &quot;</span>
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;the background. High quality, ultrarealistic detail and breath-taking movie-like camera shot.&quot;</span>
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>negative_prompt = <span class="hljs-string">&quot;Bright tones, overexposed, static, blurred details, subtitles, style, works, paintings, images, static, overall gray, worst quality, low quality, JPEG compression residue, ugly, incomplete, extra fingers, poorly drawn hands, poorly drawn faces, deformed, disfigured, misshapen limbs, fused fingers, still picture, messy background, three legs, many people in the background, walking backwards&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>output = pipe(
<span class="hljs-meta">... </span>    image=image,
<span class="hljs-meta">... </span>    prompt=prompt,
<span class="hljs-meta">... </span>    negative_prompt=negative_prompt,
<span class="hljs-meta">... </span>    height=height,
<span class="hljs-meta">... </span>    width=width,
<span class="hljs-meta">... </span>    num_frames=<span class="hljs-number">81</span>,
<span class="hljs-meta">... </span>    guidance_scale=<span class="hljs-number">5.0</span>,
<span class="hljs-meta">... </span>).frames[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>export_to_video(output, <span class="hljs-string">&quot;output.mp4&quot;</span>, fps=<span class="hljs-number">16</span>)`,wrap:!1}}),{c(){a=p("p"),a.textContent=f,i=s(),M(m.$$.fragment)},l(l){a=c(l,"P",{"data-svelte-h":!0}),u(a)!=="svelte-kvfsh7"&&(a.textContent=f),i=o(l),y(m.$$.fragment,l)},m(l,g){r(l,a,g),r(l,i,g),_(m,l,g),h=!0},p:N,i(l){h||(b(m.$$.fragment,l),h=!0)},o(l){w(m.$$.fragment,l),h=!1},d(l){l&&(n(a),n(i)),J(m,l)}}}function $o(T){let a,f="Examples:",i,m,h;return m=new Y({props:{code:"aW1wb3J0JTIwdG9yY2glMEFpbXBvcnQlMjBQSUwuSW1hZ2UlMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwQXV0b2VuY29kZXJLTFdhbiUyQyUyMFdhblZBQ0VQaXBlbGluZSUwQWZyb20lMjBkaWZmdXNlcnMuc2NoZWR1bGVycy5zY2hlZHVsaW5nX3VuaXBjX211bHRpc3RlcCUyMGltcG9ydCUyMFVuaVBDTXVsdGlzdGVwU2NoZWR1bGVyJTBBZnJvbSUyM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IwcGlwZSglMEElMjAlMjAlMjAlMjB2aWRlbyUzRHZpZGVvJTJDJTBBJTIwJTIwJTIwJTIwbWFzayUzRG1hc2slMkMlMEElMjAlMjAlMjAlMjBwcm9tcHQlM0Rwcm9tcHQlMkMlMEElMjAlMjAlMjAlMjBuZWdhdGl2ZV9wcm9tcHQlM0RuZWdhdGl2ZV9wcm9tcHQlMkMlMEElMjAlMjAlMjAlMjBoZWlnaHQlM0RoZWlnaHQlMkMlMEElMjAlMjAlMjAlMjB3aWR0aCUzRHdpZHRoJTJDJTBBJTIwJTIwJTIwJTIwbnVtX2ZyYW1lcyUzRG51bV9mcmFtZXMlMkMlMEElMjAlMjAlMjAlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNEMzAlMkMlMEElMjAlMjAlMjAlMjBndWlkYW5jZV9zY2FsZSUzRDUuMCUyQyUwQSUyMCUyMCUyMCUyMGdlbmVyYXRvciUzRHRvcmNoLkdlbmVyYXRvcigpLm1hbnVhbF9zZWVkKDQyKSUyQyUwQSkuZnJhbWVzJTVCMCU1RCUwQWV4cG9ydF90b192aWRlbyhvdXRwdXQlMkMlMjAlMjJvdXRwdXQubXA0JTIyJTJDJTIwZnBzJTNEMTYp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> PIL.Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoencoderKLWan, WanVACEPipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers.schedulers.scheduling_unipc_multistep <span class="hljs-keyword">import</span> UniPCMultistepScheduler
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> export_to_video, load_image
<span class="hljs-keyword">def</span> <span class="hljs-title function_">prepare_video_and_mask</span>(<span class="hljs-params">first_img: PIL.Image.Image, last_img: PIL.Image.Image, height: <span class="hljs-built_in">int</span>, width: <span class="hljs-built_in">int</span>, num_frames: <span class="hljs-built_in">int</span></span>):
    first_img = first_img.resize((width, height))
    last_img = last_img.resize((width, height))
    frames = []
    frames.append(first_img)
    <span class="hljs-comment"># Ideally, this should be 127.5 to match original code, but they perform computation on numpy arrays</span>
    <span class="hljs-comment"># whereas we are passing PIL images. If you choose to pass numpy arrays, you can set it to 127.5 to</span>
    <span class="hljs-comment"># match the original code.</span>
    frames.extend([PIL.Image.new(<span class="hljs-string">&quot;RGB&quot;</span>, (width, height), (<span class="hljs-number">128</span>, <span class="hljs-number">128</span>, <span class="hljs-number">128</span>))] * (num_frames - <span class="hljs-number">2</span>))
    frames.append(last_img)
    mask_black = PIL.Image.new(<span class="hljs-string">&quot;L&quot;</span>, (width, height), <span class="hljs-number">0</span>)
    mask_white = PIL.Image.new(<span class="hljs-string">&quot;L&quot;</span>, (width, height), <span class="hljs-number">255</span>)
    mask = [mask_black, *[mask_white] * (num_frames - <span class="hljs-number">2</span>), mask_black]
    <span class="hljs-keyword">return</span> frames, mask

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Available checkpoints: Wan-AI/Wan2.1-VACE-1.3B-diffusers, Wan-AI/Wan2.1-VACE-14B-diffusers</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model_id = <span class="hljs-string">&quot;Wan-AI/Wan2.1-VACE-1.3B-diffusers&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>vae = AutoencoderKLWan.from_pretrained(model_id, subfolder=<span class="hljs-string">&quot;vae&quot;</span>, torch_dtype=torch.float32)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = WanVACEPipeline.from_pretrained(model_id, vae=vae, torch_dtype=torch.bfloat16)
<span class="hljs-meta">&gt;&gt;&gt; </span>flow_shift = <span class="hljs-number">3.0</span>  <span class="hljs-comment"># 5.0 for 720P, 3.0 for 480P</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config, flow_shift=flow_shift)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;CG animation style, a small blue bird takes off from the ground, flapping its wings. The bird&#x27;s feathers are delicate, with a unique pattern on its chest. The background shows a blue sky with white clouds under bright sunshine. The camera follows the bird upward, capturing its flight and the vastness of the sky from a close-up, low-angle perspective.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>negative_prompt = <span class="hljs-string">&quot;Bright tones, overexposed, static, blurred details, subtitles, style, works, paintings, images, static, overall gray, worst quality, low quality, JPEG compression residue, ugly, incomplete, extra fingers, poorly drawn hands, poorly drawn faces, deformed, disfigured, misshapen limbs, fused fingers, still picture, messy background, three legs, many people in the background, walking backwards&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>first_frame = load_image(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/flf2v_input_first_frame.png&quot;</span>
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>last_frame = load_image(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/flf2v_input_last_frame.png&gt;&gt;&gt; &quot;</span>
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>height = <span class="hljs-number">512</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>width = <span class="hljs-number">512</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>num_frames = <span class="hljs-number">81</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>video, mask = prepare_video_and_mask(first_frame, last_frame, height, width, num_frames)

<span class="hljs-meta">&gt;&gt;&gt; </span>output = pipe(
<span class="hljs-meta">... </span>    video=video,
<span class="hljs-meta">... </span>    mask=mask,
<span class="hljs-meta">... </span>    prompt=prompt,
<span class="hljs-meta">... </span>    negative_prompt=negative_prompt,
<span class="hljs-meta">... </span>    height=height,
<span class="hljs-meta">... </span>    width=width,
<span class="hljs-meta">... </span>    num_frames=num_frames,
<span class="hljs-meta">... </span>    num_inference_steps=<span class="hljs-number">30</span>,
<span class="hljs-meta">... </span>    guidance_scale=<span class="hljs-number">5.0</span>,
<span class="hljs-meta">... </span>    generator=torch.Generator().manual_seed(<span class="hljs-number">42</span>),
<span class="hljs-meta">... </span>).frames[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>export_to_video(output, <span class="hljs-string">&quot;output.mp4&quot;</span>, fps=<span class="hljs-number">16</span>)`,wrap:!1}}),{c(){a=p("p"),a.textContent=f,i=s(),M(m.$$.fragment)},l(l){a=c(l,"P",{"data-svelte-h":!0}),u(a)!=="svelte-kvfsh7"&&(a.textContent=f),i=o(l),y(m.$$.fragment,l)},m(l,g){r(l,a,g),r(l,i,g),_(m,l,g),h=!0},p:N,i(l){h||(b(m.$$.fragment,l),h=!0)},o(l){w(m.$$.fragment,l),h=!1},d(l){l&&(n(a),n(i)),J(m,l)}}}function Po(T){let a,f="Examples:",i,m,h;return m=new Y({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwZXhwb3J0X3RvX3ZpZGVvJTJDJTIwbG9hZF92aWRlbyUwQWZyb20lMjBkaWZmdXNlcnMlMjBpbXBvcnQlMjBBdXRvZW5jb2RlcktMV2FuJTJDJTIwV2FuVmlkZW9Ub1ZpZGVvUGlwZWxpbmUlMEFmcm9tJTIwZGlmZnVzZXJzLnNjaGVkdWxlcnMuc2NoZWR1bGluZ191bmlwY19tdWx0aXN0ZXAlMjBpbXBvcnQlMjBVbmlQQ011bHRpc3RlcFNjaGVkdWxlciUwQSUwQSUyMyUyMEF2YWlsYWJsZSUyMG1vZGV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aXZlX3Byb21wdCUyQyUwQSUyMCUyMCUyMCUyMGhlaWdodCUzRDQ4MCUyQyUwQSUyMCUyMCUyMCUyMHdpZHRoJTNENzIwJTJDJTBBJTIwJTIwJTIwJTIwZ3VpZGFuY2Vfc2NhbGUlM0Q1LjAlMkMlMEElMjAlMjAlMjAlMjBzdHJlbmd0aCUzRDAuNyUyQyUwQSkuZnJhbWVzJTVCMCU1RCUwQWV4cG9ydF90b192aWRlbyhvdXRwdXQlMkMlMjAlMjJvdXRwdXQubXA0JTIyJTJDJTIwZnBzJTNEMTYp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> export_to_video, load_video
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoencoderKLWan, WanVideoToVideoPipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers.schedulers.scheduling_unipc_multistep <span class="hljs-keyword">import</span> UniPCMultistepScheduler

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Available models: Wan-AI/Wan2.1-T2V-14B-Diffusers, Wan-AI/Wan2.1-T2V-1.3B-Diffusers</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model_id = <span class="hljs-string">&quot;Wan-AI/Wan2.1-T2V-1.3B-Diffusers&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>vae = AutoencoderKLWan.from_pretrained(model_id, subfolder=<span class="hljs-string">&quot;vae&quot;</span>, torch_dtype=torch.float32)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = WanVideoToVideoPipeline.from_pretrained(model_id, vae=vae, torch_dtype=torch.bfloat16)
<span class="hljs-meta">&gt;&gt;&gt; </span>flow_shift = <span class="hljs-number">3.0</span>  <span class="hljs-comment"># 5.0 for 720P, 3.0 for 480P</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config, flow_shift=flow_shift)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;A robot standing on a mountain top. The sun is setting in the background&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>negative_prompt = <span class="hljs-string">&quot;Bright tones, overexposed, static, blurred details, subtitles, style, works, paintings, images, static, overall gray, worst quality, low quality, JPEG compression residue, ugly, incomplete, extra fingers, poorly drawn hands, poorly drawn faces, deformed, disfigured, misshapen limbs, fused fingers, still picture, messy background, three legs, many people in the background, walking backwards&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>video = load_video(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/hiker.mp4&quot;</span>
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>output = pipe(
<span class="hljs-meta">... </span>    video=video,
<span class="hljs-meta">... </span>    prompt=prompt,
<span class="hljs-meta">... </span>    negative_prompt=negative_prompt,
<span class="hljs-meta">... </span>    height=<span class="hljs-number">480</span>,
<span class="hljs-meta">... </span>    width=<span class="hljs-number">720</span>,
<span class="hljs-meta">... </span>    guidance_scale=<span class="hljs-number">5.0</span>,
<span class="hljs-meta">... </span>    strength=<span class="hljs-number">0.7</span>,
<span class="hljs-meta">... </span>).frames[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>export_to_video(output, <span class="hljs-string">&quot;output.mp4&quot;</span>, fps=<span class="hljs-number">16</span>)`,wrap:!1}}),{c(){a=p("p"),a.textContent=f,i=s(),M(m.$$.fragment)},l(l){a=c(l,"P",{"data-svelte-h":!0}),u(a)!=="svelte-kvfsh7"&&(a.textContent=f),i=o(l),y(m.$$.fragment,l)},m(l,g){r(l,a,g),r(l,i,g),_(m,l,g),h=!0},p:N,i(l){h||(b(m.$$.fragment,l),h=!0)},o(l){w(m.$$.fragment,l),h=!1},d(l){l&&(n(a),n(i)),J(m,l)}}}function So(T){let a,f="Examples:",i,m,h;return m=new Y({props:{code:" ",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> WanAnimatePipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> export_to_video, load_image, load_video

<span class="hljs-meta">&gt;&gt;&gt; </span>model_id = <span class="hljs-string">&quot;Wan-AI/Wan2.2-Animate-14B-Diffusers&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = WanAnimatePipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Optionally upcast the Wan VAE to FP32</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe.vae.to(torch.float32)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Load the reference character image</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = load_image(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/astronaut.jpg&quot;</span>
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Load pose and face videos (preprocessed from reference video)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Note: Videos should be preprocessed to extract pose keypoints and face features</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Refer to the Wan-Animate preprocessing documentation for details</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pose_video = load_video(<span class="hljs-string">&quot;path/to/pose_video.mp4&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>face_video = load_video(<span class="hljs-string">&quot;path/to/face_video.mp4&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># CFG is generally not used for Wan Animate</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = (
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;An astronaut hatching from an egg, on the surface of the moon, the darkness and depth of space realised in &quot;</span>
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;the background. High quality, ultrarealistic detail and breath-taking movie-like camera shot.&quot;</span>
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Animation mode: Animate the character with the motion from pose/face videos</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>output = pipe(
<span class="hljs-meta">... </span>    image=image,
<span class="hljs-meta">... </span>    pose_video=pose_video,
<span class="hljs-meta">... </span>    face_video=face_video,
<span class="hljs-meta">... </span>    prompt=prompt,
<span class="hljs-meta">... </span>    height=height,
<span class="hljs-meta">... </span>    width=width,
<span class="hljs-meta">... </span>    segment_frame_length=<span class="hljs-number">77</span>,  <span class="hljs-comment"># Frame length of each inference segment</span>
<span class="hljs-meta">... </span>    guidance_scale=<span class="hljs-number">1.0</span>,
<span class="hljs-meta">... </span>    num_inference_steps=<span class="hljs-number">20</span>,
<span class="hljs-meta">... </span>    mode=<span class="hljs-string">&quot;animate&quot;</span>,
<span class="hljs-meta">... </span>).frames[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>export_to_video(output, <span class="hljs-string">&quot;output_animation.mp4&quot;</span>, fps=<span class="hljs-number">30</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Replacement mode: Replace a character in the background video</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Requires additional background_video and mask_video inputs</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>background_video = load_video(<span class="hljs-string">&quot;path/to/background_video.mp4&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>mask_video = load_video(<span class="hljs-string">&quot;path/to/mask_video.mp4&quot;</span>)  <span class="hljs-comment"># Black areas preserved, white areas generated</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>output = pipe(
<span class="hljs-meta">... </span>    image=image,
<span class="hljs-meta">... </span>    pose_video=pose_video,
<span class="hljs-meta">... </span>    face_video=face_video,
<span class="hljs-meta">... </span>    background_video=background_video,
<span class="hljs-meta">... </span>    mask_video=mask_video,
<span class="hljs-meta">... </span>    prompt=prompt,
<span class="hljs-meta">... </span>    height=height,
<span class="hljs-meta">... </span>    width=width,
<span class="hljs-meta">... </span>    segment_frame_length=<span class="hljs-number">77</span>,  <span class="hljs-comment"># Frame length of each inference segment</span>
<span class="hljs-meta">... </span>    guidance_scale=<span class="hljs-number">1.0</span>,
<span class="hljs-meta">... </span>    num_inference_steps=<span class="hljs-number">20</span>,
<span class="hljs-meta">... </span>    mode=<span class="hljs-string">&quot;replace&quot;</span>,
<span class="hljs-meta">... </span>).frames[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>export_to_video(output, <span class="hljs-string">&quot;output_replacement.mp4&quot;</span>, fps=<span class="hljs-number">30</span>)`,wrap:!1}}),{c(){a=p("p"),a.textContent=f,i=s(),M(m.$$.fragment)},l(l){a=c(l,"P",{"data-svelte-h":!0}),u(a)!=="svelte-kvfsh7"&&(a.textContent=f),i=o(l),y(m.$$.fragment,l)},m(l,g){r(l,a,g),r(l,i,g),_(m,l,g),h=!0},p:N,i(l){h||(b(m.$$.fragment,l),h=!0)},o(l){w(m.$$.fragment,l),h=!1},d(l){l&&(n(a),n(i)),J(m,l)}}}function Lo(T){let a,f,i,m,h,l='<div class="flex flex-wrap space-x-1"><a href="https://huggingface.co/docs/diffusers/main/en/tutorials/using_peft_for_inference" target="_blank" rel="noopener"><img alt="LoRA" src="https://img.shields.io/badge/LoRA-d8b4fe?style=flat"/></a></div>',g,U,j,V,ut='<a href="https://huggingface.co/papers/2503.20314" rel="nofollow">Wan-2.1</a> by the Wan Team.',Mt,ue,_s='<em>This report presents Wan, a comprehensive and open suite of video foundation models designed to push the boundaries of video generation. Built upon the mainstream diffusion transformer paradigm, Wan achieves significant advancements in generative capabilities through a series of innovations, including our novel VAE, scalable pre-training strategies, large-scale data curation, and automated evaluation metrics. These contributions collectively enhance the model’s performance and versatility. Specifically, Wan is characterized by four key features: Leading Performance: The 14B model of Wan, trained on a vast dataset comprising billions of images and videos, demonstrates the scaling laws of video generation with respect to both data and model size. It consistently outperforms the existing open-source models as well as state-of-the-art commercial solutions across multiple internal and external benchmarks, demonstrating a clear and significant performance superiority. Comprehensiveness: Wan offers two capable models, i.e., 1.3B and 14B parameters, for efficiency and effectiveness respectively. It also covers multiple downstream applications, including image-to-video, instruction-guided video editing, and personal video generation, encompassing up to eight tasks. Consumer-Grade Efficiency: The 1.3B model demonstrates exceptional resource efficiency, requiring only 8.19 GB VRAM, making it compatible with a wide range of consumer-grade GPUs. Openness: We open-source the entire series of Wan, including source code and all models, with the goal of fostering the growth of the video generation community. This openness seeks to significantly expand the creative possibilities of video production in the industry and provide academia with high-quality video foundation models. All the code and models are available at <a href="https://github.com/Wan-Video/Wan2.1" rel="nofollow">this https URL</a>.</em>',yt,ge,bs='You can find all the original Wan2.1 checkpoints under the <a href="https://huggingface.co/Wan-AI" rel="nofollow">Wan-AI</a> organization.',_t,fe,ws="The following Wan models are supported in Diffusers:",bt,Me,Js='<li><a href="https://huggingface.co/Wan-AI/Wan2.1-T2V-1.3B-Diffusers" rel="nofollow">Wan 2.1 T2V 1.3B</a></li> <li><a href="https://huggingface.co/Wan-AI/Wan2.1-T2V-14B-Diffusers" rel="nofollow">Wan 2.1 T2V 14B</a></li> <li><a href="https://huggingface.co/Wan-AI/Wan2.1-I2V-14B-480P-Diffusers" rel="nofollow">Wan 2.1 I2V 14B - 480P</a></li> <li><a href="https://huggingface.co/Wan-AI/Wan2.1-I2V-14B-720P-Diffusers" rel="nofollow">Wan 2.1 I2V 14B - 720P</a></li> <li><a href="https://huggingface.co/Wan-AI/Wan2.1-FLF2V-14B-720P-diffusers" rel="nofollow">Wan 2.1 FLF2V 14B - 720P</a></li> <li><a href="https://huggingface.co/Wan-AI/Wan2.1-VACE-1.3B-diffusers" rel="nofollow">Wan 2.1 VACE 1.3B</a></li> <li><a href="https://huggingface.co/Wan-AI/Wan2.1-VACE-14B-diffusers" rel="nofollow">Wan 2.1 VACE 14B</a></li> <li><a href="https://huggingface.co/Wan-AI/Wan2.2-T2V-A14B-Diffusers" rel="nofollow">Wan 2.2 T2V 14B</a></li> <li><a href="https://huggingface.co/Wan-AI/Wan2.2-I2V-A14B-Diffusers" rel="nofollow">Wan 2.2 I2V 14B</a></li> <li><a href="https://huggingface.co/Wan-AI/Wan2.2-TI2V-5B-Diffusers" rel="nofollow">Wan 2.2 TI2V 5B</a></li> <li><a href="https://huggingface.co/Wan-AI/Wan2.2-Animate-14B-Diffusers" rel="nofollow">Wan 2.2 Animate 14B</a></li>',wt,O,Ts="<p>Click on the Wan models in the right sidebar for more examples of video generation.</p>",Jt,ye,Tt,_e,Us="The example below demonstrates how to generate a video from text optimized for memory or inference speed.",Ut,ee,jt,be,Zt,we,js="The example below demonstrates how to use the image-to-video pipeline to generate a video using a text description, a starting frame, and an ending frame.",Wt,ne,vt,Je,It,Te,Zs="Wan VACE supports various generation techniques which achieve controllable video generation. Some of the capabilities include:",Gt,Ue,Ws='<li>Control to Video (Depth, Pose, Sketch, Flow, Grayscale, Scribble, Layout, Boundary Box, etc.). Recommended library for preprocessing videos to obtain control videos: <a href="">huggingface/controlnet_aux</a></li> <li>Image/Video to Video (first frame, last frame, starting clip, ending clip, random clips)</li> <li>Inpainting and Outpainting</li> <li>Subject to Video (faces, object, characters, etc.)</li> <li>Composition to Video (reference anything, animate anything, swap anything, expand anything, move anything, etc.)</li>',Bt,je,vs='The code snippets available in <a href="https://github.com/huggingface/diffusers/pull/11582" rel="nofollow">this</a> pull request demonstrate some examples of how videos can be generated with controllability signals.',kt,Ze,Is="The general rule of thumb to keep in mind when preparing inputs for the VACE pipeline is that the input images, or frames of a video that you want to use for conditioning, should have a corresponding mask that is black in color. The black mask signifies that the model will not generate new content for that area, and only use those parts for conditioning the generation process. For parts/frames that should be generated by the model, the mask should be white in color.",Vt,We,Ct,ve,Gs='<a href="https://huggingface.co/papers/2509.14055" rel="nofollow">Wan-Animate</a> by the Wan Team.',xt,Ie,Bs="<em>We introduce Wan-Animate, a unified framework for character animation and replacement. Given a character image and a reference video, Wan-Animate can animate the character by precisely replicating the expressions and movements of the character in the video to generate high-fidelity character videos. Alternatively, it can integrate the animated character into the reference video to replace the original character, replicating the scene’s lighting and color tone to achieve seamless environmental integration. Wan-Animate is built upon the Wan model. To adapt it for character animation tasks, we employ a modified input paradigm to differentiate between reference conditions and regions for generation. This design unifies multiple tasks into a common symbolic representation. We use spatially-aligned skeleton signals to replicate body motion and implicit facial features extracted from source images to reenact expressions, enabling the generation of character videos with high controllability and expressiveness. Furthermore, to enhance environmental integration during character replacement, we develop an auxiliary Relighting LoRA. This module preserves the character’s appearance consistency while applying the appropriate environmental lighting and color tone. Experimental results demonstrate that Wan-Animate achieves state-of-the-art performance. We are committed to open-sourcing the model weights and its source code.</em>",Rt,Ge,ks='The project page: <a href="https://humanaigc.github.io/wan-animate" rel="nofollow">https://humanaigc.github.io/wan-animate</a>',Xt,Be,Vs='This model was mostly contributed by <a href="https://github.com/tolgacangoz" rel="nofollow">M. Tolga Cangöz</a>.',Ft,ke,Qt,Ve,Cs="The Wan-Animate pipeline supports two modes of operation:",Yt,Ce,xs="<li><strong>Animation Mode</strong> (default): Animates a character image based on motion and expression from reference videos</li> <li><strong>Replacement Mode</strong>: Replaces a character in a background video with a new character while preserving the scene</li>",Nt,xe,At,Re,Rs="Before using the pipeline, you need to preprocess your reference video to extract:",Et,Xe,Xs="<li><strong>Pose video</strong>: Contains skeletal keypoints representing body motion</li> <li><strong>Face video</strong>: Contains facial feature representations for expression control</li>",Ht,Fe,Fs="For replacement mode, you additionally need:",zt,Qe,Qs="<li><strong>Background video</strong>: The original video containing the scene</li> <li><strong>Mask video</strong>: A mask indicating where to generate content (white) vs. preserve original (black)</li>",$t,te,Ys='<p>Raw videos should not be used for inputs such as <code>pose_video</code>, which the pipeline expects to be preprocessed to extract the proper information. Preprocessing scripts to prepare these inputs are available in the <a href="https://github.com/Wan-Video/Wan2.2?tab=readme-ov-file#1-preprocessing" rel="nofollow">original Wan-Animate repository</a>. Integration of these preprocessing steps into Diffusers is planned for a future release.</p>',Pt,Ye,Ns="The example below demonstrates how to use the Wan-Animate pipeline:",St,ae,Lt,Ne,qt,Ae,As="<li><strong>mode</strong>: Choose between <code>&quot;animate&quot;</code> (default) or <code>&quot;replace&quot;</code></li> <li><strong>prev_segment_conditioning_frames</strong>: Number of frames for temporal guidance (1 or 5 recommended). Using 5 provides better temporal consistency but requires more memory</li> <li><strong>guidance_scale</strong>: Controls how closely the output follows the text prompt. Higher values (5-7) produce results more aligned with the prompt. For Wan-Animate, CFG is disabled by default (<code>guidance_scale=1.0</code>) but can be enabled to support negative prompts and finer control over facial expressions. (Note that CFG will only target the text prompt and face conditioning.)</li>",Dt,Ee,Kt,G,He,Zn,Es='Wan2.1 supports LoRAs with <a href="/docs/diffusers/main/en/api/loaders/lora#diffusers.loaders.WanLoraLoaderMixin.load_lora_weights">load_lora_weights()</a>.',_a,ze,Wn,Hs="Show example code",ba,$e,wa,Pe,vn,zs='<a href="/docs/diffusers/main/en/api/models/wan_transformer_3d#diffusers.WanTransformer3DModel">WanTransformer3DModel</a> and <a href="/docs/diffusers/main/en/api/models/autoencoder_kl_wan#diffusers.AutoencoderKLWan">AutoencoderKLWan</a> supports loading from single files with <a href="/docs/diffusers/main/en/api/loaders/single_file#diffusers.loaders.FromSingleFileMixin.from_single_file">from_single_file()</a>.',Ja,Se,In,$s="Show example code",Ta,Le,Ua,Gn,Ps='<p>Set the <a href="/docs/diffusers/main/en/api/models/autoencoder_kl_wan#diffusers.AutoencoderKLWan">AutoencoderKLWan</a> dtype to <code>torch.float32</code> for better decoding quality.</p>',ja,Bn,Ss="<p>The number of frames per second (fps) or <code>k</code> should be calculated by <code>4 * k + 1</code>.</p>",Za,kn,Ls="<p>Try lower <code>shift</code> values (<code>2.0</code> to <code>5.0</code>) for lower resolution videos and higher <code>shift</code> values (<code>7.0</code> to <code>12.0</code>) for higher resolution images.</p>",Wa,Vn,qs='<p>Wan 2.1 and 2.2 support using <a href="https://huggingface.co/Kijai/WanVideo_comfy/tree/main/Lightx2v" rel="nofollow">LightX2V LoRAs</a> to speed up inference. Using them on Wan 2.2 is slightly more involed. Refer to <a href="https://github.com/huggingface/diffusers/pull/12040#issuecomment-3144185272" rel="nofollow">this code snippet</a> to learn more.</p>',va,Cn,Ds='<p>Wan 2.2 has two denoisers. By default, LoRAs are only loaded into the first denoiser. One can set <code>load_into_transformer_2=True</code> to load LoRAs into the second denoiser. Refer to <a href="https://github.com/huggingface/diffusers/pull/12074#issue-3292620048" rel="nofollow">this</a> and <a href="https://github.com/huggingface/diffusers/pull/12074#issuecomment-3155896144" rel="nofollow">this</a> examples to learn more.</p>',Ot,qe,ea,C,De,Ia,xn,Ks="Pipeline for text-to-video generation using Wan.",Ga,Rn,Os=`This model inherits from <a href="/docs/diffusers/main/en/api/pipelines/overview#diffusers.DiffusionPipeline">DiffusionPipeline</a>. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).`,Ba,A,Ke,ka,Xn,eo="The call function to the pipeline for generation.",Va,se,Ca,oe,Oe,xa,Fn,no="Encodes the prompt into text encoder hidden states.",na,en,ta,x,nn,Ra,Qn,to="Pipeline for image-to-video generation using Wan.",Xa,Yn,ao=`This model inherits from <a href="/docs/diffusers/main/en/api/pipelines/overview#diffusers.DiffusionPipeline">DiffusionPipeline</a>. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).`,Fa,E,tn,Qa,Nn,so="The call function to the pipeline for generation.",Ya,le,Na,ie,an,Aa,An,oo="Encodes the prompt into text encoder hidden states.",aa,sn,sa,R,on,Ea,En,lo="Pipeline for controllable generation using Wan.",Ha,Hn,io=`This model inherits from <a href="/docs/diffusers/main/en/api/pipelines/overview#diffusers.DiffusionPipeline">DiffusionPipeline</a>. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).`,za,H,ln,$a,zn,ro="The call function to the pipeline for generation.",Pa,re,Sa,de,rn,La,$n,po="Encodes the prompt into text encoder hidden states.",oa,dn,la,X,pn,qa,Pn,co="Pipeline for video-to-video generation using Wan.",Da,Sn,mo=`This model inherits from <a href="/docs/diffusers/main/en/api/pipelines/overview#diffusers.DiffusionPipeline">DiffusionPipeline</a>. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).`,Ka,z,cn,Oa,Ln,ho="The call function to the pipeline for generation.",es,pe,ns,ce,mn,ts,qn,uo="Encodes the prompt into text encoder hidden states.",ia,hn,ra,Z,un,as,Dn,go="Pipeline for unified character animation and replacement using Wan-Animate.",ss,Kn,fo=`WanAnimatePipeline takes a character image, pose video, and face video as input, and generates a video in two
modes:`,os,On,Mo=`<li><p><strong>Animation mode</strong>: The model generates a video of the character image that mimics the human motion in the input
pose and face videos. The character is animated based on the provided motion controls, creating a new animated
video of the character.</p></li> <li><p><strong>Replacement mode</strong>: The model replaces a character in a background video with the provided character image,
using the pose and face videos for motion control. This mode requires additional <code>background_video</code> and
<code>mask_video</code> inputs. The mask video should have black regions where the original content should be preserved and
white regions where the new character should be generated.</p></li>`,ls,et,yo=`This model inherits from <a href="/docs/diffusers/main/en/api/pipelines/overview#diffusers.DiffusionPipeline">DiffusionPipeline</a>. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).`,is,nt,_o="The pipeline also inherits the following loading methods:",rs,tt,bo='<li><a href="/docs/diffusers/main/en/api/loaders/lora#diffusers.loaders.WanLoraLoaderMixin.load_lora_weights">load_lora_weights()</a> for loading LoRA weights</li>',ds,$,gn,ps,at,wo="The call function to the pipeline for generation.",cs,me,ms,he,fn,hs,st,Jo="Encodes the prompt into text encoder hidden states.",us,P,Mn,gs,ot,To=`Pads an array-like video <code>frames</code> to <code>num_target_frames</code> using a “reflect”-like strategy. The frame dimension
is assumed to be the first dimension. In the 1D case, we can visualize this strategy as follows:`,fs,lt,Uo="pad_video_frames([1, 2, 3, 4, 5], 10) -> [1, 2, 3, 4, 5, 4, 3, 2, 1, 2]",da,yn,pa,D,_n,Ms,it,jo="Output class for Wan pipelines.",ca,bn,ma,gt,ha;return U=new F({props:{title:"Wan",local:"wan",headingTag:"h1"}}),ye=new F({props:{title:"Text-to-Video Generation",local:"text-to-video-generation",headingTag:"h3"}}),ee=new ys({props:{id:"T2V usage",options:["T2V memory","T2V inference speed"],$$slots:{default:[Xo]},$$scope:{ctx:T}}}),be=new F({props:{title:"First-Last-Frame-to-Video Generation",local:"first-last-frame-to-video-generation",headingTag:"h3"}}),ne=new ys({props:{id:"FLF2V usage",options:["usage"],$$slots:{default:[Qo]},$$scope:{ctx:T}}}),Je=new F({props:{title:"Any-to-Video Controllable Generation",local:"any-to-video-controllable-generation",headingTag:"h3"}}),We=new F({props:{title:"Wan-Animate: Unified Character Animation and Replacement with Holistic Replication",local:"wan-animate-unified-character-animation-and-replacement-with-holistic-replication",headingTag:"h3"}}),ke=new F({props:{title:"Usage",local:"usage",headingTag:"h4"}}),xe=new F({props:{title:"Prerequisites",local:"prerequisites",headingTag:"h5"}}),ae=new ys({props:{id:"Animate usage",options:["Animation mode","Replacement mode","Advanced options"],$$slots:{default:[Eo]},$$scope:{ctx:T}}}),Ne=new F({props:{title:"Key Parameters",local:"key-parameters",headingTag:"h4"}}),Ee=new F({props:{title:"Notes",local:"notes",headingTag:"h2"}}),$e=new Y({props:{code:"JTIzJTIwcGlwJTIwaW5zdGFsbCUyMGZ0ZnklMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjBkaWZmdXNlcnMlMjBpbXBvcnQlMjBBdXRvTW9kZWwlMkMlMjBXYW5QaXBlbGluZSUwQWZyb20lMjBkaWZmdXNlcnMuc2NoZWR1bGVycy5zY2hlZHVsaW5nX3VuaXBjX211bHRpc3RlcCUyMGltcG9ydCUyMFVuaVBDTXVsdGlzdGVwU2NoZWR1bGVyJTBBZnJvbSUyMGRpZmZ1c2Vycy51dGlscyUyMGltcG9ydCUyMGV4cG9ydF90b192aWRlbyUwQSUwQXZhZSUyMCUzRCUyMEF1dG9Nb2RlbC5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyV2FuLUFJJTJGV2FuMi4xLVQyVi0xLjNCLURpZmZ1c2VycyUyMiUyQyUyMHN1YmZvbGRlciUzRCUyMnZhZSUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQzMiUwQSklMEFwaXBlbGluZSUyMCUzRCUyMFdhblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJXYW4tQUklMkZXYW4yLjEtVDJWLTEuM0ItRGlmZnVzZXJzJTIyJTJDJTIwdmFlJTNEdmFlJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5iZmxvYXQxNiUwQSklMEFwaXBlbGluZS5zY2hlZHVsZXIlMjAlM0QlMjBVbmlQQ011bHRpc3RlcFNjaGVkdWxlci5mcm9tX2NvbmZpZyglMEElMjAlMjAlMjAlMjBwaXBlbGluZS5zY2hlZHVsZXIuY29uZmlnJTJDJTIwZmxvd19zaGlmdCUzRDUuMCUwQSklMEFwaXBlbGluZS50byglMjJjdWRhJTIyKSUwQSUwQXBpcGVsaW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JTIwdGhlJTIwc2NlbmUlMkMlMjB3aXRoJTIwZmVybnMlMjBpbiUyMHRoZSUyMGZvcmVncm91bmQuJTIwU2lkZSUyMGxpZ2h0aW5nJTIwY2FzdHMlMjBkeW5hbWljJTBBc2hhZG93cyUyMGFuZCUyMHdhcm0lMjBoaWdobGlnaHRzLiUyME1lZGl1bSUyMGNvbXBvc2l0aW9uJTJDJTIwZnJvbnQlMjB2aWV3JTJDJTIwbG93JTIwYW5nbGUlMkMlMjB3aXRoJTIwZGVwdGglMjBvZiUyMGZpZWxkLiUwQSUyMiUyMiUyMiUwQSUwQW91dHB1dCUyMCUzRCUyMHBpcGVsaW5lKCUwQSUyMCUyMCUyMCUyMHByb21wdCUzRHByb21wdCUyQyUwQSUyMCUyMCUyMCUyMG51bV9mcmFtZXMlM0Q4MSUyQyUwQSUyMCUyMCUyMCUyMGd1aWRhbmNlX3NjYWxlJTNENS4wJTJDJTBBKS5mcmFtZXMlNUIwJTVEJTBBZXhwb3J0X3RvX3ZpZGVvKG91dHB1dCUyQyUyMCUyMm91dHB1dC5tcDQlMjIlMkMlMjBmcHMlM0QxNik=",highlighted:`<span class="hljs-comment"># pip install ftfy</span>
<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoModel, WanPipeline
<span class="hljs-keyword">from</span> diffusers.schedulers.scheduling_unipc_multistep <span class="hljs-keyword">import</span> UniPCMultistepScheduler
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> export_to_video

vae = AutoModel.from_pretrained(
    <span class="hljs-string">&quot;Wan-AI/Wan2.1-T2V-1.3B-Diffusers&quot;</span>, subfolder=<span class="hljs-string">&quot;vae&quot;</span>, torch_dtype=torch.float32
)
pipeline = WanPipeline.from_pretrained(
    <span class="hljs-string">&quot;Wan-AI/Wan2.1-T2V-1.3B-Diffusers&quot;</span>, vae=vae, torch_dtype=torch.bfloat16
)
pipeline.scheduler = UniPCMultistepScheduler.from_config(
    pipeline.scheduler.config, flow_shift=<span class="hljs-number">5.0</span>
)
pipeline.to(<span class="hljs-string">&quot;cuda&quot;</span>)

pipeline.load_lora_weights(<span class="hljs-string">&quot;benjamin-paine/steamboat-willie-1.3b&quot;</span>, adapter_name=<span class="hljs-string">&quot;steamboat-willie&quot;</span>)
pipeline.set_adapters(<span class="hljs-string">&quot;steamboat-willie&quot;</span>)

pipeline.enable_model_cpu_offload()

<span class="hljs-comment"># use &quot;steamboat willie style&quot; to trigger the LoRA</span>
prompt = <span class="hljs-string">&quot;&quot;&quot;
steamboat willie style, golden era animation, The camera rushes from far to near in a low-angle shot,
revealing a white ferret on a log. It plays, leaps into the water, and emerges, as the camera zooms in
for a close-up. Water splashes berry bushes nearby, while moss, snow, and leaves blanket the ground.
Birch trees and a light blue sky frame the scene, with ferns in the foreground. Side lighting casts dynamic
shadows and warm highlights. Medium composition, front view, low angle, with depth of field.
&quot;&quot;&quot;</span>

output = pipeline(
    prompt=prompt,
    num_frames=<span class="hljs-number">81</span>,
    guidance_scale=<span class="hljs-number">5.0</span>,
).frames[<span class="hljs-number">0</span>]
export_to_video(output, <span class="hljs-string">&quot;output.mp4&quot;</span>, fps=<span class="hljs-number">16</span>)`,wrap:!1}}),Le=new Y({props:{code:"JTIzJTIwcGlwJTIwaW5zdGFsbCUyMGZ0ZnklMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjBkaWZmdXNlcnMlMjBpbXBvcnQlMjBXYW5QaXBlbGluZSUyQyUyMFdhblRyYW5zZm9ybWVyM0RNb2RlbCUyQyUyMEF1dG9lbmNvZGVyS0xXYW4lMEElMEF2YWUlMjAlM0QlMjBBdXRvZW5jb2RlcktMV2FuLmZyb21fc2luZ2xlX2ZpbGUoJTBBJTIwJTIwJTIwJTIwJTIyaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRkNvbWZ5LU9yZyUyRldhbl8yLjFfQ29tZnlVSV9yZXBhY2thZ2VkJTJGYmxvYiUyRm1haW4lMkZzcGxpdF9maWxlcyUyRnZhZSUyRndhbl8yLjFfdmFlLnNhZmV0ZW5zb3JzJTIyJTBBKSUwQXRyYW5zZm9ybWVyJTIwJTNEJTIwV2FuVHJhbnNmb3JtZXIzRE1vZGVsLmZyb21fc2luZ2xlX2ZpbGUoJTBBJTIwJTIwJTIwJTIwJTIyaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRkNvbWZ5LU9yZyUyRldhbl8yLjFfQ29tZnlVSV9yZXBhY2thZ2VkJTJGYmxvYiUyRm1haW4lMkZzcGxpdF9maWxlcyUyRmRpZmZ1c2lvbl9tb2RlbHMlMkZ3YW4yLjFfdDJ2XzEuM0JfYmYxNi5zYWZldGVuc29ycyUyMiUyQyUwQSUyMCUyMCUyMCUyMHRvcmNoX2R0eXBlJTNEdG9yY2guYmZsb2F0MTYlMEEpJTBBcGlwZWxpbmUlMjAlM0QlMjBXYW5QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyV2FuLUFJJTJGV2FuMi4xLVQyVi0xLjNCLURpZmZ1c2VycyUyMiUyQyUwQSUyMCUyMCUyMCUyMHZhZSUzRHZhZSUyQyUwQSUyMCUyMCUyMCUyMHRyYW5zZm9ybWVyJTNEdHJhbnNmb3JtZXIlMkMlMEElMjAlMjAlMjAlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmJmbG9hdDE2JTBBKQ==",highlighted:`<span class="hljs-comment"># pip install ftfy</span>
<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> WanPipeline, WanTransformer3DModel, AutoencoderKLWan

vae = AutoencoderKLWan.from_single_file(
    <span class="hljs-string">&quot;https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/blob/main/split_files/vae/wan_2.1_vae.safetensors&quot;</span>
)
transformer = WanTransformer3DModel.from_single_file(
    <span class="hljs-string">&quot;https://huggingface.co/Comfy-Org/Wan_2.1_ComfyUI_repackaged/blob/main/split_files/diffusion_models/wan2.1_t2v_1.3B_bf16.safetensors&quot;</span>,
    torch_dtype=torch.bfloat16
)
pipeline = WanPipeline.from_pretrained(
    <span class="hljs-string">&quot;Wan-AI/Wan2.1-T2V-1.3B-Diffusers&quot;</span>,
    vae=vae,
    transformer=transformer,
    torch_dtype=torch.bfloat16
)`,wrap:!1}}),qe=new F({props:{title:"WanPipeline",local:"diffusers.WanPipeline",headingTag:"h2"}}),De=new k({props:{name:"class diffusers.WanPipeline",anchor:"diffusers.WanPipeline",parameters:[{name:"tokenizer",val:": AutoTokenizer"},{name:"text_encoder",val:": UMT5EncoderModel"},{name:"vae",val:": AutoencoderKLWan"},{name:"scheduler",val:": FlowMatchEulerDiscreteScheduler"},{name:"transformer",val:": typing.Optional[diffusers.models.transformers.transformer_wan.WanTransformer3DModel] = None"},{name:"transformer_2",val:": typing.Optional[diffusers.models.transformers.transformer_wan.WanTransformer3DModel] = None"},{name:"boundary_ratio",val:": typing.Optional[float] = None"},{name:"expand_timesteps",val:": bool = False"}],parametersDescription:[{anchor:"diffusers.WanPipeline.tokenizer",description:`<strong>tokenizer</strong> (<code>T5Tokenizer</code>) &#x2014;
Tokenizer from <a href="https://huggingface.co/docs/transformers/en/model_doc/t5#transformers.T5Tokenizer" rel="nofollow">T5</a>,
specifically the <a href="https://huggingface.co/google/umt5-xxl" rel="nofollow">google/umt5-xxl</a> variant.`,name:"tokenizer"},{anchor:"diffusers.WanPipeline.text_encoder",description:`<strong>text_encoder</strong> (<code>T5EncoderModel</code>) &#x2014;
<a href="https://huggingface.co/docs/transformers/en/model_doc/t5#transformers.T5EncoderModel" rel="nofollow">T5</a>, specifically
the <a href="https://huggingface.co/google/umt5-xxl" rel="nofollow">google/umt5-xxl</a> variant.`,name:"text_encoder"},{anchor:"diffusers.WanPipeline.transformer",description:`<strong>transformer</strong> (<a href="/docs/diffusers/main/en/api/models/wan_transformer_3d#diffusers.WanTransformer3DModel">WanTransformer3DModel</a>) &#x2014;
Conditional Transformer to denoise the input latents.`,name:"transformer"},{anchor:"diffusers.WanPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/main/en/api/schedulers/unipc#diffusers.UniPCMultistepScheduler">UniPCMultistepScheduler</a>) &#x2014;
A scheduler to be used in combination with <code>transformer</code> to denoise the encoded image latents.`,name:"scheduler"},{anchor:"diffusers.WanPipeline.vae",description:`<strong>vae</strong> (<a href="/docs/diffusers/main/en/api/models/autoencoder_kl_wan#diffusers.AutoencoderKLWan">AutoencoderKLWan</a>) &#x2014;
Variational Auto-Encoder (VAE) Model to encode and decode videos to and from latent representations.`,name:"vae"},{anchor:"diffusers.WanPipeline.transformer_2",description:`<strong>transformer_2</strong> (<a href="/docs/diffusers/main/en/api/models/wan_transformer_3d#diffusers.WanTransformer3DModel">WanTransformer3DModel</a>, <em>optional</em>) &#x2014;
Conditional Transformer to denoise the input latents during the low-noise stage. If provided, enables
two-stage denoising where <code>transformer</code> handles high-noise stages and <code>transformer_2</code> handles low-noise
stages. If not provided, only <code>transformer</code> is used.`,name:"transformer_2"},{anchor:"diffusers.WanPipeline.boundary_ratio",description:`<strong>boundary_ratio</strong> (<code>float</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
Ratio of total timesteps to use as the boundary for switching between transformers in two-stage denoising.
The actual boundary timestep is calculated as <code>boundary_ratio * num_train_timesteps</code>. When provided,
<code>transformer</code> handles timesteps &gt;= boundary_timestep and <code>transformer_2</code> handles timesteps &lt;
boundary_timestep. If <code>None</code>, only <code>transformer</code> is used for the entire denoising process.`,name:"boundary_ratio"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/wan/pipeline_wan.py#L95"}}),Ke=new k({props:{name:"__call__",anchor:"diffusers.WanPipeline.__call__",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]] = None"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str]] = None"},{name:"height",val:": int = 480"},{name:"width",val:": int = 832"},{name:"num_frames",val:": int = 81"},{name:"num_inference_steps",val:": int = 50"},{name:"guidance_scale",val:": float = 5.0"},{name:"guidance_scale_2",val:": typing.Optional[float] = None"},{name:"num_videos_per_prompt",val:": typing.Optional[int] = 1"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"latents",val:": typing.Optional[torch.Tensor] = None"},{name:"prompt_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"output_type",val:": typing.Optional[str] = 'np'"},{name:"return_dict",val:": bool = True"},{name:"attention_kwargs",val:": typing.Optional[typing.Dict[str, typing.Any]] = None"},{name:"callback_on_step_end",val:": typing.Union[typing.Callable[[int, int, typing.Dict], NoneType], diffusers.callbacks.PipelineCallback, diffusers.callbacks.MultiPipelineCallbacks, NoneType] = None"},{name:"callback_on_step_end_tensor_inputs",val:": typing.List[str] = ['latents']"},{name:"max_sequence_length",val:": int = 512"}],parametersDescription:[{anchor:"diffusers.WanPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts to guide the image generation. If not defined, pass <code>prompt_embeds</code> instead.`,name:"prompt"},{anchor:"diffusers.WanPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts to avoid during image generation. If not defined, pass <code>negative_prompt_embeds</code>
instead. Ignored when not using guidance (<code>guidance_scale</code> &lt; <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.WanPipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, defaults to <code>480</code>) &#x2014;
The height in pixels of the generated image.`,name:"height"},{anchor:"diffusers.WanPipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>, defaults to <code>832</code>) &#x2014;
The width in pixels of the generated image.`,name:"width"},{anchor:"diffusers.WanPipeline.__call__.num_frames",description:`<strong>num_frames</strong> (<code>int</code>, defaults to <code>81</code>) &#x2014;
The number of frames in the generated video.`,name:"num_frames"},{anchor:"diffusers.WanPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, defaults to <code>50</code>) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.WanPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, defaults to <code>5.0</code>) &#x2014;
Guidance scale as defined in <a href="https://huggingface.co/papers/2207.12598" rel="nofollow">Classifier-Free Diffusion
Guidance</a>. <code>guidance_scale</code> is defined as <code>w</code> of equation 2.
of <a href="https://huggingface.co/papers/2205.11487" rel="nofollow">Imagen Paper</a>. Guidance scale is enabled by setting
<code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to
the text <code>prompt</code>, usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.WanPipeline.__call__.guidance_scale_2",description:`<strong>guidance_scale_2</strong> (<code>float</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
Guidance scale for the low-noise stage transformer (<code>transformer_2</code>). If <code>None</code> and the pipeline&#x2019;s
<code>boundary_ratio</code> is not None, uses the same value as <code>guidance_scale</code>. Only used when <code>transformer_2</code>
and the pipeline&#x2019;s <code>boundary_ratio</code> are not None.`,name:"guidance_scale_2"},{anchor:"diffusers.WanPipeline.__call__.num_videos_per_prompt",description:`<strong>num_videos_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_videos_per_prompt"},{anchor:"diffusers.WanPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
A <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow"><code>torch.Generator</code></a> to make
generation deterministic.`,name:"generator"},{anchor:"diffusers.WanPipeline.__call__.latents",description:`<strong>latents</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated noisy latents sampled from a Gaussian distribution, to be used as inputs for image
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 <code>generator</code>.`,name:"latents"},{anchor:"diffusers.WanPipeline.__call__.prompt_embeds",description:`<strong>prompt_embeds</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated text embeddings. Can be used to easily tweak text inputs (prompt weighting). If not
provided, text embeddings are generated from the <code>prompt</code> input argument.`,name:"prompt_embeds"},{anchor:"diffusers.WanPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;np&quot;</code>) &#x2014;
The output format of the generated image. Choose between <code>PIL.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.WanPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <code>WanPipelineOutput</code> instead of a plain tuple.`,name:"return_dict"},{anchor:"diffusers.WanPipeline.__call__.attention_kwargs",description:`<strong>attention_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
A kwargs dictionary that if specified is passed along to the <code>AttentionProcessor</code> as defined under
<code>self.processor</code> in
<a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py" rel="nofollow">diffusers.models.attention_processor</a>.`,name:"attention_kwargs"},{anchor:"diffusers.WanPipeline.__call__.callback_on_step_end",description:`<strong>callback_on_step_end</strong> (<code>Callable</code>, <code>PipelineCallback</code>, <code>MultiPipelineCallbacks</code>, <em>optional</em>) &#x2014;
A function or a subclass of <code>PipelineCallback</code> or <code>MultiPipelineCallbacks</code> that is called at the end of
each denoising step during the inference. with the following arguments: <code>callback_on_step_end(self: DiffusionPipeline, step: int, timestep: int, callback_kwargs: Dict)</code>. <code>callback_kwargs</code> will include a
list of all tensors as specified by <code>callback_on_step_end_tensor_inputs</code>.`,name:"callback_on_step_end"},{anchor:"diffusers.WanPipeline.__call__.callback_on_step_end_tensor_inputs",description:`<strong>callback_on_step_end_tensor_inputs</strong> (<code>List</code>, <em>optional</em>) &#x2014;
The list of tensor inputs for the <code>callback_on_step_end</code> function. The tensors specified in the list
will be passed as <code>callback_kwargs</code> argument. You will only be able to include variables listed in the
<code>._callback_tensor_inputs</code> attribute of your pipeline class.`,name:"callback_on_step_end_tensor_inputs"},{anchor:"diffusers.WanPipeline.__call__.max_sequence_length",description:`<strong>max_sequence_length</strong> (<code>int</code>, defaults to <code>512</code>) &#x2014;
The maximum sequence length of the text encoder. If the prompt is longer than this, it will be
truncated. If the prompt is shorter, it will be padded to this length.`,name:"max_sequence_length"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/wan/pipeline_wan.py#L380",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>If <code>return_dict</code> is <code>True</code>, <code>WanPipelineOutput</code> is returned, otherwise a <code>tuple</code> is returned where
the first element is a list with the generated images and the second element is a list of <code>bool</code>s
indicating whether the corresponding generated image contains “not-safe-for-work” (nsfw) content.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>~WanPipelineOutput</code> or <code>tuple</code></p>
`}}),se=new ft({props:{anchor:"diffusers.WanPipeline.__call__.example",$$slots:{default:[Ho]},$$scope:{ctx:T}}}),Oe=new k({props:{name:"encode_prompt",anchor:"diffusers.WanPipeline.encode_prompt",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]]"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"do_classifier_free_guidance",val:": bool = True"},{name:"num_videos_per_prompt",val:": int = 1"},{name:"prompt_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"max_sequence_length",val:": int = 226"},{name:"device",val:": typing.Optional[torch.device] = None"},{name:"dtype",val:": typing.Optional[torch.dtype] = None"}],parametersDescription:[{anchor:"diffusers.WanPipeline.encode_prompt.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
prompt to be encoded`,name:"prompt"},{anchor:"diffusers.WanPipeline.encode_prompt.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. If not defined, one has to pass
<code>negative_prompt_embeds</code> instead. Ignored when not using guidance (i.e., ignored if <code>guidance_scale</code> is
less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.WanPipeline.encode_prompt.do_classifier_free_guidance",description:`<strong>do_classifier_free_guidance</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to use classifier free guidance or not.`,name:"do_classifier_free_guidance"},{anchor:"diffusers.WanPipeline.encode_prompt.num_videos_per_prompt",description:`<strong>num_videos_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
Number of videos that should be generated per prompt. torch device to place the resulting embeddings on`,name:"num_videos_per_prompt"},{anchor:"diffusers.WanPipeline.encode_prompt.prompt_embeds",description:`<strong>prompt_embeds</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt weighting. If not
provided, text embeddings will be generated from <code>prompt</code> input argument.`,name:"prompt_embeds"},{anchor:"diffusers.WanPipeline.encode_prompt.negative_prompt_embeds",description:`<strong>negative_prompt_embeds</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt
weighting. If not provided, negative_prompt_embeds will be generated from <code>negative_prompt</code> input
argument.`,name:"negative_prompt_embeds"},{anchor:"diffusers.WanPipeline.encode_prompt.device",description:`<strong>device</strong> &#x2014; (<code>torch.device</code>, <em>optional</em>):
torch device`,name:"device"},{anchor:"diffusers.WanPipeline.encode_prompt.dtype",description:`<strong>dtype</strong> &#x2014; (<code>torch.dtype</code>, <em>optional</em>):
torch dtype`,name:"dtype"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/wan/pipeline_wan.py#L198"}}),en=new F({props:{title:"WanImageToVideoPipeline",local:"diffusers.WanImageToVideoPipeline",headingTag:"h2"}}),nn=new k({props:{name:"class diffusers.WanImageToVideoPipeline",anchor:"diffusers.WanImageToVideoPipeline",parameters:[{name:"tokenizer",val:": AutoTokenizer"},{name:"text_encoder",val:": UMT5EncoderModel"},{name:"vae",val:": AutoencoderKLWan"},{name:"scheduler",val:": FlowMatchEulerDiscreteScheduler"},{name:"image_processor",val:": CLIPImageProcessor = None"},{name:"image_encoder",val:": CLIPVisionModel = None"},{name:"transformer",val:": WanTransformer3DModel = None"},{name:"transformer_2",val:": WanTransformer3DModel = None"},{name:"boundary_ratio",val:": typing.Optional[float] = None"},{name:"expand_timesteps",val:": bool = False"}],parametersDescription:[{anchor:"diffusers.WanImageToVideoPipeline.tokenizer",description:`<strong>tokenizer</strong> (<code>T5Tokenizer</code>) &#x2014;
Tokenizer from <a href="https://huggingface.co/docs/transformers/en/model_doc/t5#transformers.T5Tokenizer" rel="nofollow">T5</a>,
specifically the <a href="https://huggingface.co/google/umt5-xxl" rel="nofollow">google/umt5-xxl</a> variant.`,name:"tokenizer"},{anchor:"diffusers.WanImageToVideoPipeline.text_encoder",description:`<strong>text_encoder</strong> (<code>T5EncoderModel</code>) &#x2014;
<a href="https://huggingface.co/docs/transformers/en/model_doc/t5#transformers.T5EncoderModel" rel="nofollow">T5</a>, specifically
the <a href="https://huggingface.co/google/umt5-xxl" rel="nofollow">google/umt5-xxl</a> variant.`,name:"text_encoder"},{anchor:"diffusers.WanImageToVideoPipeline.image_encoder",description:`<strong>image_encoder</strong> (<code>CLIPVisionModel</code>) &#x2014;
<a href="https://huggingface.co/docs/transformers/model_doc/clip#transformers.CLIPVisionModel" rel="nofollow">CLIP</a>, specifically
the
<a href="https://github.com/mlfoundations/open_clip/blob/main/docs/PRETRAINED.md#vit-h14-xlm-roberta-large" rel="nofollow">clip-vit-huge-patch14</a>
variant.`,name:"image_encoder"},{anchor:"diffusers.WanImageToVideoPipeline.transformer",description:`<strong>transformer</strong> (<a href="/docs/diffusers/main/en/api/models/wan_transformer_3d#diffusers.WanTransformer3DModel">WanTransformer3DModel</a>) &#x2014;
Conditional Transformer to denoise the input latents.`,name:"transformer"},{anchor:"diffusers.WanImageToVideoPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/main/en/api/schedulers/unipc#diffusers.UniPCMultistepScheduler">UniPCMultistepScheduler</a>) &#x2014;
A scheduler to be used in combination with <code>transformer</code> to denoise the encoded image latents.`,name:"scheduler"},{anchor:"diffusers.WanImageToVideoPipeline.vae",description:`<strong>vae</strong> (<a href="/docs/diffusers/main/en/api/models/autoencoder_kl_wan#diffusers.AutoencoderKLWan">AutoencoderKLWan</a>) &#x2014;
Variational Auto-Encoder (VAE) Model to encode and decode videos to and from latent representations.`,name:"vae"},{anchor:"diffusers.WanImageToVideoPipeline.transformer_2",description:`<strong>transformer_2</strong> (<a href="/docs/diffusers/main/en/api/models/wan_transformer_3d#diffusers.WanTransformer3DModel">WanTransformer3DModel</a>, <em>optional</em>) &#x2014;
Conditional Transformer to denoise the input latents during the low-noise stage. In two-stage denoising,
<code>transformer</code> handles high-noise stages and <code>transformer_2</code> handles low-noise stages. If not provided, only
<code>transformer</code> is used.`,name:"transformer_2"},{anchor:"diffusers.WanImageToVideoPipeline.boundary_ratio",description:`<strong>boundary_ratio</strong> (<code>float</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
Ratio of total timesteps to use as the boundary for switching between transformers in two-stage denoising.
The actual boundary timestep is calculated as <code>boundary_ratio * num_train_timesteps</code>. When provided,
<code>transformer</code> handles timesteps &gt;= boundary_timestep and <code>transformer_2</code> handles timesteps &lt;
boundary_timestep. If <code>None</code>, only <code>transformer</code> is used for the entire denoising process.`,name:"boundary_ratio"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/wan/pipeline_wan_i2v.py#L127"}}),tn=new k({props:{name:"__call__",anchor:"diffusers.WanImageToVideoPipeline.__call__",parameters:[{name:"image",val:": typing.Union[PIL.Image.Image, numpy.ndarray, torch.Tensor, typing.List[PIL.Image.Image], typing.List[numpy.ndarray], typing.List[torch.Tensor]]"},{name:"prompt",val:": typing.Union[str, typing.List[str]] = None"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str]] = None"},{name:"height",val:": int = 480"},{name:"width",val:": int = 832"},{name:"num_frames",val:": int = 81"},{name:"num_inference_steps",val:": int = 50"},{name:"guidance_scale",val:": float = 5.0"},{name:"guidance_scale_2",val:": typing.Optional[float] = None"},{name:"num_videos_per_prompt",val:": typing.Optional[int] = 1"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"latents",val:": typing.Optional[torch.Tensor] = None"},{name:"prompt_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"image_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"last_image",val:": typing.Optional[torch.Tensor] = None"},{name:"output_type",val:": typing.Optional[str] = 'np'"},{name:"return_dict",val:": bool = True"},{name:"attention_kwargs",val:": typing.Optional[typing.Dict[str, typing.Any]] = None"},{name:"callback_on_step_end",val:": typing.Union[typing.Callable[[int, int, typing.Dict], NoneType], diffusers.callbacks.PipelineCallback, diffusers.callbacks.MultiPipelineCallbacks, NoneType] = None"},{name:"callback_on_step_end_tensor_inputs",val:": typing.List[str] = ['latents']"},{name:"max_sequence_length",val:": int = 512"}],parametersDescription:[{anchor:"diffusers.WanImageToVideoPipeline.__call__.image",description:`<strong>image</strong> (<code>PipelineImageInput</code>) &#x2014;
The input image to condition the generation on. Must be an image, a list of images or a <code>torch.Tensor</code>.`,name:"image"},{anchor:"diffusers.WanImageToVideoPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts to guide the image generation. If not defined, one has to pass <code>prompt_embeds</code>.
instead.`,name:"prompt"},{anchor:"diffusers.WanImageToVideoPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. If not defined, one has to pass
<code>negative_prompt_embeds</code> instead. Ignored when not using guidance (i.e., ignored if <code>guidance_scale</code> is
less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.WanImageToVideoPipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, defaults to <code>480</code>) &#x2014;
The height of the generated video.`,name:"height"},{anchor:"diffusers.WanImageToVideoPipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>, defaults to <code>832</code>) &#x2014;
The width of the generated video.`,name:"width"},{anchor:"diffusers.WanImageToVideoPipeline.__call__.num_frames",description:`<strong>num_frames</strong> (<code>int</code>, defaults to <code>81</code>) &#x2014;
The number of frames in the generated video.`,name:"num_frames"},{anchor:"diffusers.WanImageToVideoPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, defaults to <code>50</code>) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.WanImageToVideoPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, defaults to <code>5.0</code>) &#x2014;
Guidance scale as defined in <a href="https://huggingface.co/papers/2207.12598" rel="nofollow">Classifier-Free Diffusion
Guidance</a>. <code>guidance_scale</code> is defined as <code>w</code> of equation 2.
of <a href="https://huggingface.co/papers/2205.11487" rel="nofollow">Imagen Paper</a>. Guidance scale is enabled by setting
<code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to
the text <code>prompt</code>, usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.WanImageToVideoPipeline.__call__.guidance_scale_2",description:`<strong>guidance_scale_2</strong> (<code>float</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
Guidance scale for the low-noise stage transformer (<code>transformer_2</code>). If <code>None</code> and the pipeline&#x2019;s
<code>boundary_ratio</code> is not None, uses the same value as <code>guidance_scale</code>. Only used when <code>transformer_2</code>
and the pipeline&#x2019;s <code>boundary_ratio</code> are not None.`,name:"guidance_scale_2"},{anchor:"diffusers.WanImageToVideoPipeline.__call__.num_videos_per_prompt",description:`<strong>num_videos_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_videos_per_prompt"},{anchor:"diffusers.WanImageToVideoPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
A <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow"><code>torch.Generator</code></a> to make
generation deterministic.`,name:"generator"},{anchor:"diffusers.WanImageToVideoPipeline.__call__.latents",description:`<strong>latents</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated noisy latents sampled from a Gaussian distribution, to be used as inputs for image
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 <code>generator</code>.`,name:"latents"},{anchor:"diffusers.WanImageToVideoPipeline.__call__.prompt_embeds",description:`<strong>prompt_embeds</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated text embeddings. Can be used to easily tweak text inputs (prompt weighting). If not
provided, text embeddings are generated from the <code>prompt</code> input argument.`,name:"prompt_embeds"},{anchor:"diffusers.WanImageToVideoPipeline.__call__.negative_prompt_embeds",description:`<strong>negative_prompt_embeds</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated text embeddings. Can be used to easily tweak text inputs (prompt weighting). If not
provided, text embeddings are generated from the <code>negative_prompt</code> input argument.`,name:"negative_prompt_embeds"},{anchor:"diffusers.WanImageToVideoPipeline.__call__.image_embeds",description:`<strong>image_embeds</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated image embeddings. Can be used to easily tweak image inputs (weighting). If not provided,
image embeddings are generated from the <code>image</code> input argument.`,name:"image_embeds"},{anchor:"diffusers.WanImageToVideoPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;np&quot;</code>) &#x2014;
The output format of the generated image. Choose between <code>PIL.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.WanImageToVideoPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <code>WanPipelineOutput</code> instead of a plain tuple.`,name:"return_dict"},{anchor:"diffusers.WanImageToVideoPipeline.__call__.attention_kwargs",description:`<strong>attention_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
A kwargs dictionary that if specified is passed along to the <code>AttentionProcessor</code> as defined under
<code>self.processor</code> in
<a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py" rel="nofollow">diffusers.models.attention_processor</a>.`,name:"attention_kwargs"},{anchor:"diffusers.WanImageToVideoPipeline.__call__.callback_on_step_end",description:`<strong>callback_on_step_end</strong> (<code>Callable</code>, <code>PipelineCallback</code>, <code>MultiPipelineCallbacks</code>, <em>optional</em>) &#x2014;
A function or a subclass of <code>PipelineCallback</code> or <code>MultiPipelineCallbacks</code> that is called at the end of
each denoising step during the inference. with the following arguments: <code>callback_on_step_end(self: DiffusionPipeline, step: int, timestep: int, callback_kwargs: Dict)</code>. <code>callback_kwargs</code> will include a
list of all tensors as specified by <code>callback_on_step_end_tensor_inputs</code>.`,name:"callback_on_step_end"},{anchor:"diffusers.WanImageToVideoPipeline.__call__.callback_on_step_end_tensor_inputs",description:`<strong>callback_on_step_end_tensor_inputs</strong> (<code>List</code>, <em>optional</em>) &#x2014;
The list of tensor inputs for the <code>callback_on_step_end</code> function. The tensors specified in the list
will be passed as <code>callback_kwargs</code> argument. You will only be able to include variables listed in the
<code>._callback_tensor_inputs</code> attribute of your pipeline class.`,name:"callback_on_step_end_tensor_inputs"},{anchor:"diffusers.WanImageToVideoPipeline.__call__.max_sequence_length",description:`<strong>max_sequence_length</strong> (<code>int</code>, defaults to <code>512</code>) &#x2014;
The maximum sequence length of the text encoder. If the prompt is longer than this, it will be
truncated. If the prompt is shorter, it will be padded to this length.`,name:"max_sequence_length"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/wan/pipeline_wan_i2v.py#L507",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>If <code>return_dict</code> is <code>True</code>, <code>WanPipelineOutput</code> is returned, otherwise a <code>tuple</code> is returned where
the first element is a list with the generated images and the second element is a list of <code>bool</code>s
indicating whether the corresponding generated image contains “not-safe-for-work” (nsfw) content.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>~WanPipelineOutput</code> or <code>tuple</code></p>
`}}),le=new ft({props:{anchor:"diffusers.WanImageToVideoPipeline.__call__.example",$$slots:{default:[zo]},$$scope:{ctx:T}}}),an=new k({props:{name:"encode_prompt",anchor:"diffusers.WanImageToVideoPipeline.encode_prompt",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]]"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"do_classifier_free_guidance",val:": bool = True"},{name:"num_videos_per_prompt",val:": int = 1"},{name:"prompt_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"max_sequence_length",val:": int = 226"},{name:"device",val:": typing.Optional[torch.device] = None"},{name:"dtype",val:": typing.Optional[torch.dtype] = None"}],parametersDescription:[{anchor:"diffusers.WanImageToVideoPipeline.encode_prompt.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
prompt to be encoded`,name:"prompt"},{anchor:"diffusers.WanImageToVideoPipeline.encode_prompt.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. If not defined, one has to pass
<code>negative_prompt_embeds</code> instead. Ignored when not using guidance (i.e., ignored if <code>guidance_scale</code> is
less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.WanImageToVideoPipeline.encode_prompt.do_classifier_free_guidance",description:`<strong>do_classifier_free_guidance</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to use classifier free guidance or not.`,name:"do_classifier_free_guidance"},{anchor:"diffusers.WanImageToVideoPipeline.encode_prompt.num_videos_per_prompt",description:`<strong>num_videos_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
Number of videos that should be generated per prompt. torch device to place the resulting embeddings on`,name:"num_videos_per_prompt"},{anchor:"diffusers.WanImageToVideoPipeline.encode_prompt.prompt_embeds",description:`<strong>prompt_embeds</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt weighting. If not
provided, text embeddings will be generated from <code>prompt</code> input argument.`,name:"prompt_embeds"},{anchor:"diffusers.WanImageToVideoPipeline.encode_prompt.negative_prompt_embeds",description:`<strong>negative_prompt_embeds</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt
weighting. If not provided, negative_prompt_embeds will be generated from <code>negative_prompt</code> input
argument.`,name:"negative_prompt_embeds"},{anchor:"diffusers.WanImageToVideoPipeline.encode_prompt.device",description:`<strong>device</strong> &#x2014; (<code>torch.device</code>, <em>optional</em>):
torch device`,name:"device"},{anchor:"diffusers.WanImageToVideoPipeline.encode_prompt.dtype",description:`<strong>dtype</strong> &#x2014; (<code>torch.dtype</code>, <em>optional</em>):
torch dtype`,name:"dtype"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/wan/pipeline_wan_i2v.py#L251"}}),sn=new F({props:{title:"WanVACEPipeline",local:"diffusers.WanVACEPipeline",headingTag:"h2"}}),on=new k({props:{name:"class diffusers.WanVACEPipeline",anchor:"diffusers.WanVACEPipeline",parameters:[{name:"tokenizer",val:": AutoTokenizer"},{name:"text_encoder",val:": UMT5EncoderModel"},{name:"vae",val:": AutoencoderKLWan"},{name:"scheduler",val:": FlowMatchEulerDiscreteScheduler"},{name:"transformer",val:": WanVACETransformer3DModel = None"},{name:"transformer_2",val:": WanVACETransformer3DModel = None"},{name:"boundary_ratio",val:": typing.Optional[float] = None"}],parametersDescription:[{anchor:"diffusers.WanVACEPipeline.tokenizer",description:`<strong>tokenizer</strong> (<code>T5Tokenizer</code>) &#x2014;
Tokenizer from <a href="https://huggingface.co/docs/transformers/en/model_doc/t5#transformers.T5Tokenizer" rel="nofollow">T5</a>,
specifically the <a href="https://huggingface.co/google/umt5-xxl" rel="nofollow">google/umt5-xxl</a> variant.`,name:"tokenizer"},{anchor:"diffusers.WanVACEPipeline.text_encoder",description:`<strong>text_encoder</strong> (<code>T5EncoderModel</code>) &#x2014;
<a href="https://huggingface.co/docs/transformers/en/model_doc/t5#transformers.T5EncoderModel" rel="nofollow">T5</a>, specifically
the <a href="https://huggingface.co/google/umt5-xxl" rel="nofollow">google/umt5-xxl</a> variant.`,name:"text_encoder"},{anchor:"diffusers.WanVACEPipeline.vae",description:`<strong>vae</strong> (<a href="/docs/diffusers/main/en/api/models/autoencoder_kl_wan#diffusers.AutoencoderKLWan">AutoencoderKLWan</a>) &#x2014;
Variational Auto-Encoder (VAE) Model to encode and decode videos to and from latent representations.`,name:"vae"},{anchor:"diffusers.WanVACEPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/main/en/api/schedulers/unipc#diffusers.UniPCMultistepScheduler">UniPCMultistepScheduler</a>) &#x2014;
A scheduler to be used in combination with <code>transformer</code> to denoise the encoded image latents.`,name:"scheduler"},{anchor:"diffusers.WanVACEPipeline.transformer",description:`<strong>transformer</strong> (<code>WanVACETransformer3DModel</code>, <em>optional</em>) &#x2014;
Conditional Transformer to denoise the input latents during the high-noise stage. In two-stage denoising,
<code>transformer</code> handles high-noise stages and <code>transformer_2</code> handles low-noise stages. At least one of
<code>transformer</code> or <code>transformer_2</code> must be provided.`,name:"transformer"},{anchor:"diffusers.WanVACEPipeline.transformer_2",description:`<strong>transformer_2</strong> (<code>WanVACETransformer3DModel</code>, <em>optional</em>) &#x2014;
Conditional Transformer to denoise the input latents during the low-noise stage. In two-stage denoising,
<code>transformer</code> handles high-noise stages and <code>transformer_2</code> handles low-noise stages. At least one of
<code>transformer</code> or <code>transformer_2</code> must be provided.`,name:"transformer_2"},{anchor:"diffusers.WanVACEPipeline.boundary_ratio",description:`<strong>boundary_ratio</strong> (<code>float</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
Ratio of total timesteps to use as the boundary for switching between transformers in two-stage denoising.
The actual boundary timestep is calculated as <code>boundary_ratio * num_train_timesteps</code>. When provided,
<code>transformer</code> handles timesteps &gt;= boundary_timestep and <code>transformer_2</code> handles timesteps &lt;
boundary_timestep. If <code>None</code>, only the available transformer is used for the entire denoising process.`,name:"boundary_ratio"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/wan/pipeline_wan_vace.py#L141"}}),ln=new k({props:{name:"__call__",anchor:"diffusers.WanVACEPipeline.__call__",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]] = None"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str]] = None"},{name:"video",val:": typing.Optional[typing.List[typing.Union[PIL.Image.Image, numpy.ndarray, torch.Tensor, typing.List[PIL.Image.Image], typing.List[numpy.ndarray], typing.List[torch.Tensor]]]] = None"},{name:"mask",val:": typing.Optional[typing.List[typing.Union[PIL.Image.Image, numpy.ndarray, torch.Tensor, typing.List[PIL.Image.Image], typing.List[numpy.ndarray], typing.List[torch.Tensor]]]] = None"},{name:"reference_images",val:": typing.Optional[typing.List[typing.Union[PIL.Image.Image, numpy.ndarray, torch.Tensor, typing.List[PIL.Image.Image], typing.List[numpy.ndarray], typing.List[torch.Tensor]]]] = None"},{name:"conditioning_scale",val:": typing.Union[float, typing.List[float], torch.Tensor] = 1.0"},{name:"height",val:": int = 480"},{name:"width",val:": int = 832"},{name:"num_frames",val:": int = 81"},{name:"num_inference_steps",val:": int = 50"},{name:"guidance_scale",val:": float = 5.0"},{name:"guidance_scale_2",val:": typing.Optional[float] = None"},{name:"num_videos_per_prompt",val:": typing.Optional[int] = 1"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"latents",val:": typing.Optional[torch.Tensor] = None"},{name:"prompt_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"output_type",val:": typing.Optional[str] = 'np'"},{name:"return_dict",val:": bool = True"},{name:"attention_kwargs",val:": typing.Optional[typing.Dict[str, typing.Any]] = None"},{name:"callback_on_step_end",val:": typing.Union[typing.Callable[[int, int, typing.Dict], NoneType], diffusers.callbacks.PipelineCallback, diffusers.callbacks.MultiPipelineCallbacks, NoneType] = None"},{name:"callback_on_step_end_tensor_inputs",val:": typing.List[str] = ['latents']"},{name:"max_sequence_length",val:": int = 512"}],parametersDescription:[{anchor:"diffusers.WanVACEPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts to guide the image generation. If not defined, one has to pass <code>prompt_embeds</code>
instead.`,name:"prompt"},{anchor:"diffusers.WanVACEPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. If not defined, one has to pass
<code>negative_prompt_embeds</code> instead. Ignored when not using guidance (i.e., ignored if <code>guidance_scale</code> is
less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.WanVACEPipeline.__call__.video",description:`<strong>video</strong> (<code>List[PIL.Image.Image]</code>, <em>optional</em>) &#x2014;
The input video or videos to be used as a starting point for the generation. The video should be a list
of PIL images, a numpy array, or a torch tensor. Currently, the pipeline only supports generating one
video at a time.`,name:"video"},{anchor:"diffusers.WanVACEPipeline.__call__.mask",description:`<strong>mask</strong> (<code>List[PIL.Image.Image]</code>, <em>optional</em>) &#x2014;
The input mask defines which video regions to condition on and which to generate. Black areas in the
mask indicate conditioning regions, while white areas indicate regions for generation. The mask should
be a list of PIL images, a numpy array, or a torch tensor. Currently supports generating a single video
at a time.`,name:"mask"},{anchor:"diffusers.WanVACEPipeline.__call__.reference_images",description:`<strong>reference_images</strong> (<code>List[PIL.Image.Image]</code>, <em>optional</em>) &#x2014;
A list of one or more reference images as extra conditioning for the generation. For example, if you
are trying to inpaint a video to change the character, you can pass reference images of the new
character here. Refer to the Diffusers <a href="https://github.com/huggingface/diffusers/pull/11582" rel="nofollow">examples</a>
and original <a href="https://github.com/ali-vilab/VACE/blob/0897c6d055d7d9ea9e191dce763006664d9780f8/UserGuide.md" rel="nofollow">user
guide</a>
for a full list of supported tasks and use cases.`,name:"reference_images"},{anchor:"diffusers.WanVACEPipeline.__call__.conditioning_scale",description:`<strong>conditioning_scale</strong> (<code>float</code>, <code>List[float]</code>, <code>torch.Tensor</code>, defaults to <code>1.0</code>) &#x2014;
The conditioning scale to be applied when adding the control conditioning latent stream to the
denoising latent stream in each control layer of the model. If a float is provided, it will be applied
uniformly to all layers. If a list or tensor is provided, it should have the same length as the number
of control layers in the model (<code>len(transformer.config.vace_layers)</code>).`,name:"conditioning_scale"},{anchor:"diffusers.WanVACEPipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, defaults to <code>480</code>) &#x2014;
The height in pixels of the generated image.`,name:"height"},{anchor:"diffusers.WanVACEPipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>, defaults to <code>832</code>) &#x2014;
The width in pixels of the generated image.`,name:"width"},{anchor:"diffusers.WanVACEPipeline.__call__.num_frames",description:`<strong>num_frames</strong> (<code>int</code>, defaults to <code>81</code>) &#x2014;
The number of frames in the generated video.`,name:"num_frames"},{anchor:"diffusers.WanVACEPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, defaults to <code>50</code>) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.WanVACEPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, defaults to <code>5.0</code>) &#x2014;
Guidance scale as defined in <a href="https://huggingface.co/papers/2207.12598" rel="nofollow">Classifier-Free Diffusion
Guidance</a>. <code>guidance_scale</code> is defined as <code>w</code> of equation 2.
of <a href="https://huggingface.co/papers/2205.11487" rel="nofollow">Imagen Paper</a>. Guidance scale is enabled by setting
<code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to
the text <code>prompt</code>, usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.WanVACEPipeline.__call__.guidance_scale_2",description:`<strong>guidance_scale_2</strong> (<code>float</code>, <em>optional</em>, defaults to <code>None</code>) &#x2014;
Guidance scale for the low-noise stage transformer (<code>transformer_2</code>). If <code>None</code> and the pipeline&#x2019;s
<code>boundary_ratio</code> is not None, uses the same value as <code>guidance_scale</code>. Only used when <code>transformer_2</code>
and the pipeline&#x2019;s <code>boundary_ratio</code> are not None.`,name:"guidance_scale_2"},{anchor:"diffusers.WanVACEPipeline.__call__.num_videos_per_prompt",description:`<strong>num_videos_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_videos_per_prompt"},{anchor:"diffusers.WanVACEPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
A <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow"><code>torch.Generator</code></a> to make
generation deterministic.`,name:"generator"},{anchor:"diffusers.WanVACEPipeline.__call__.latents",description:`<strong>latents</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated noisy latents sampled from a Gaussian distribution, to be used as inputs for image
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 <code>generator</code>.`,name:"latents"},{anchor:"diffusers.WanVACEPipeline.__call__.prompt_embeds",description:`<strong>prompt_embeds</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated text embeddings. Can be used to easily tweak text inputs (prompt weighting). If not
provided, text embeddings are generated from the <code>prompt</code> input argument.`,name:"prompt_embeds"},{anchor:"diffusers.WanVACEPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;np&quot;</code>) &#x2014;
The output format of the generated image. Choose between <code>PIL.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.WanVACEPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <code>WanPipelineOutput</code> instead of a plain tuple.`,name:"return_dict"},{anchor:"diffusers.WanVACEPipeline.__call__.attention_kwargs",description:`<strong>attention_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
A kwargs dictionary that if specified is passed along to the <code>AttentionProcessor</code> as defined under
<code>self.processor</code> in
<a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py" rel="nofollow">diffusers.models.attention_processor</a>.`,name:"attention_kwargs"},{anchor:"diffusers.WanVACEPipeline.__call__.callback_on_step_end",description:`<strong>callback_on_step_end</strong> (<code>Callable</code>, <code>PipelineCallback</code>, <code>MultiPipelineCallbacks</code>, <em>optional</em>) &#x2014;
A function or a subclass of <code>PipelineCallback</code> or <code>MultiPipelineCallbacks</code> that is called at the end of
each denoising step during the inference. with the following arguments: <code>callback_on_step_end(self: DiffusionPipeline, step: int, timestep: int, callback_kwargs: Dict)</code>. <code>callback_kwargs</code> will include a
list of all tensors as specified by <code>callback_on_step_end_tensor_inputs</code>.`,name:"callback_on_step_end"},{anchor:"diffusers.WanVACEPipeline.__call__.callback_on_step_end_tensor_inputs",description:`<strong>callback_on_step_end_tensor_inputs</strong> (<code>List</code>, <em>optional</em>) &#x2014;
The list of tensor inputs for the <code>callback_on_step_end</code> function. The tensors specified in the list
will be passed as <code>callback_kwargs</code> argument. You will only be able to include variables listed in the
<code>._callback_tensor_inputs</code> attribute of your pipeline class.`,name:"callback_on_step_end_tensor_inputs"},{anchor:"diffusers.WanVACEPipeline.__call__.max_sequence_length",description:`<strong>max_sequence_length</strong> (<code>int</code>, defaults to <code>512</code>) &#x2014;
The maximum sequence length of the text encoder. If the prompt is longer than this, it will be
truncated. If the prompt is shorter, it will be padded to this length.`,name:"max_sequence_length"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/wan/pipeline_wan_vace.py#L689",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>If <code>return_dict</code> is <code>True</code>, <code>WanPipelineOutput</code> is returned, otherwise a <code>tuple</code> is returned where
the first element is a list with the generated images and the second element is a list of <code>bool</code>s
indicating whether the corresponding generated image contains “not-safe-for-work” (nsfw) content.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>~WanPipelineOutput</code> or <code>tuple</code></p>
`}}),re=new ft({props:{anchor:"diffusers.WanVACEPipeline.__call__.example",$$slots:{default:[$o]},$$scope:{ctx:T}}}),rn=new k({props:{name:"encode_prompt",anchor:"diffusers.WanVACEPipeline.encode_prompt",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]]"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"do_classifier_free_guidance",val:": bool = True"},{name:"num_videos_per_prompt",val:": int = 1"},{name:"prompt_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"max_sequence_length",val:": int = 226"},{name:"device",val:": typing.Optional[torch.device] = None"},{name:"dtype",val:": typing.Optional[torch.dtype] = None"}],parametersDescription:[{anchor:"diffusers.WanVACEPipeline.encode_prompt.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
prompt to be encoded`,name:"prompt"},{anchor:"diffusers.WanVACEPipeline.encode_prompt.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. If not defined, one has to pass
<code>negative_prompt_embeds</code> instead. Ignored when not using guidance (i.e., ignored if <code>guidance_scale</code> is
less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.WanVACEPipeline.encode_prompt.do_classifier_free_guidance",description:`<strong>do_classifier_free_guidance</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to use classifier free guidance or not.`,name:"do_classifier_free_guidance"},{anchor:"diffusers.WanVACEPipeline.encode_prompt.num_videos_per_prompt",description:`<strong>num_videos_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
Number of videos that should be generated per prompt. torch device to place the resulting embeddings on`,name:"num_videos_per_prompt"},{anchor:"diffusers.WanVACEPipeline.encode_prompt.prompt_embeds",description:`<strong>prompt_embeds</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt weighting. If not
provided, text embeddings will be generated from <code>prompt</code> input argument.`,name:"prompt_embeds"},{anchor:"diffusers.WanVACEPipeline.encode_prompt.negative_prompt_embeds",description:`<strong>negative_prompt_embeds</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt
weighting. If not provided, negative_prompt_embeds will be generated from <code>negative_prompt</code> input
argument.`,name:"negative_prompt_embeds"},{anchor:"diffusers.WanVACEPipeline.encode_prompt.device",description:`<strong>device</strong> &#x2014; (<code>torch.device</code>, <em>optional</em>):
torch device`,name:"device"},{anchor:"diffusers.WanVACEPipeline.encode_prompt.dtype",description:`<strong>dtype</strong> &#x2014; (<code>torch.dtype</code>, <em>optional</em>):
torch dtype`,name:"dtype"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/wan/pipeline_wan_vace.py#L246"}}),dn=new F({props:{title:"WanVideoToVideoPipeline",local:"diffusers.WanVideoToVideoPipeline",headingTag:"h2"}}),pn=new k({props:{name:"class diffusers.WanVideoToVideoPipeline",anchor:"diffusers.WanVideoToVideoPipeline",parameters:[{name:"tokenizer",val:": AutoTokenizer"},{name:"text_encoder",val:": UMT5EncoderModel"},{name:"transformer",val:": WanTransformer3DModel"},{name:"vae",val:": AutoencoderKLWan"},{name:"scheduler",val:": FlowMatchEulerDiscreteScheduler"}],parametersDescription:[{anchor:"diffusers.WanVideoToVideoPipeline.tokenizer",description:`<strong>tokenizer</strong> (<code>T5Tokenizer</code>) &#x2014;
Tokenizer from <a href="https://huggingface.co/docs/transformers/en/model_doc/t5#transformers.T5Tokenizer" rel="nofollow">T5</a>,
specifically the <a href="https://huggingface.co/google/umt5-xxl" rel="nofollow">google/umt5-xxl</a> variant.`,name:"tokenizer"},{anchor:"diffusers.WanVideoToVideoPipeline.text_encoder",description:`<strong>text_encoder</strong> (<code>T5EncoderModel</code>) &#x2014;
<a href="https://huggingface.co/docs/transformers/en/model_doc/t5#transformers.T5EncoderModel" rel="nofollow">T5</a>, specifically
the <a href="https://huggingface.co/google/umt5-xxl" rel="nofollow">google/umt5-xxl</a> variant.`,name:"text_encoder"},{anchor:"diffusers.WanVideoToVideoPipeline.transformer",description:`<strong>transformer</strong> (<a href="/docs/diffusers/main/en/api/models/wan_transformer_3d#diffusers.WanTransformer3DModel">WanTransformer3DModel</a>) &#x2014;
Conditional Transformer to denoise the input latents.`,name:"transformer"},{anchor:"diffusers.WanVideoToVideoPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/main/en/api/schedulers/unipc#diffusers.UniPCMultistepScheduler">UniPCMultistepScheduler</a>) &#x2014;
A scheduler to be used in combination with <code>transformer</code> to denoise the encoded image latents.`,name:"scheduler"},{anchor:"diffusers.WanVideoToVideoPipeline.vae",description:`<strong>vae</strong> (<a href="/docs/diffusers/main/en/api/models/autoencoder_kl_wan#diffusers.AutoencoderKLWan">AutoencoderKLWan</a>) &#x2014;
Variational Auto-Encoder (VAE) Model to encode and decode videos to and from latent representations.`,name:"vae"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/wan/pipeline_wan_video2video.py#L174"}}),cn=new k({props:{name:"__call__",anchor:"diffusers.WanVideoToVideoPipeline.__call__",parameters:[{name:"video",val:": typing.List[PIL.Image.Image] = None"},{name:"prompt",val:": typing.Union[str, typing.List[str]] = None"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str]] = None"},{name:"height",val:": int = 480"},{name:"width",val:": int = 832"},{name:"num_inference_steps",val:": int = 50"},{name:"timesteps",val:": typing.Optional[typing.List[int]] = None"},{name:"guidance_scale",val:": float = 5.0"},{name:"strength",val:": float = 0.8"},{name:"num_videos_per_prompt",val:": typing.Optional[int] = 1"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"latents",val:": typing.Optional[torch.Tensor] = None"},{name:"prompt_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"output_type",val:": typing.Optional[str] = 'np'"},{name:"return_dict",val:": bool = True"},{name:"attention_kwargs",val:": typing.Optional[typing.Dict[str, typing.Any]] = None"},{name:"callback_on_step_end",val:": typing.Union[typing.Callable[[int, int, typing.Dict], NoneType], diffusers.callbacks.PipelineCallback, diffusers.callbacks.MultiPipelineCallbacks, NoneType] = None"},{name:"callback_on_step_end_tensor_inputs",val:": typing.List[str] = ['latents']"},{name:"max_sequence_length",val:": int = 512"}],parametersDescription:[{anchor:"diffusers.WanVideoToVideoPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts to guide the image generation. If not defined, one has to pass <code>prompt_embeds</code>
instead.`,name:"prompt"},{anchor:"diffusers.WanVideoToVideoPipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, defaults to <code>480</code>) &#x2014;
The height in pixels of the generated image.`,name:"height"},{anchor:"diffusers.WanVideoToVideoPipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>, defaults to <code>832</code>) &#x2014;
The width in pixels of the generated image.`,name:"width"},{anchor:"diffusers.WanVideoToVideoPipeline.__call__.num_frames",description:`<strong>num_frames</strong> (<code>int</code>, defaults to <code>81</code>) &#x2014;
The number of frames in the generated video.`,name:"num_frames"},{anchor:"diffusers.WanVideoToVideoPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, defaults to <code>50</code>) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.WanVideoToVideoPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, defaults to <code>5.0</code>) &#x2014;
Guidance scale as defined in <a href="https://huggingface.co/papers/2207.12598" rel="nofollow">Classifier-Free Diffusion
Guidance</a>. <code>guidance_scale</code> is defined as <code>w</code> of equation 2.
of <a href="https://huggingface.co/papers/2205.11487" rel="nofollow">Imagen Paper</a>. Guidance scale is enabled by setting
<code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to
the text <code>prompt</code>, usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.WanVideoToVideoPipeline.__call__.strength",description:`<strong>strength</strong> (<code>float</code>, defaults to <code>0.8</code>) &#x2014;
Higher strength leads to more differences between original image and generated video.`,name:"strength"},{anchor:"diffusers.WanVideoToVideoPipeline.__call__.num_videos_per_prompt",description:`<strong>num_videos_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_videos_per_prompt"},{anchor:"diffusers.WanVideoToVideoPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
A <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow"><code>torch.Generator</code></a> to make
generation deterministic.`,name:"generator"},{anchor:"diffusers.WanVideoToVideoPipeline.__call__.latents",description:`<strong>latents</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated noisy latents sampled from a Gaussian distribution, to be used as inputs for image
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 <code>generator</code>.`,name:"latents"},{anchor:"diffusers.WanVideoToVideoPipeline.__call__.prompt_embeds",description:`<strong>prompt_embeds</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated text embeddings. Can be used to easily tweak text inputs (prompt weighting). If not
provided, text embeddings are generated from the <code>prompt</code> input argument.`,name:"prompt_embeds"},{anchor:"diffusers.WanVideoToVideoPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;np&quot;</code>) &#x2014;
The output format of the generated image. Choose between <code>PIL.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.WanVideoToVideoPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <code>WanPipelineOutput</code> instead of a plain tuple.`,name:"return_dict"},{anchor:"diffusers.WanVideoToVideoPipeline.__call__.attention_kwargs",description:`<strong>attention_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
A kwargs dictionary that if specified is passed along to the <code>AttentionProcessor</code> as defined under
<code>self.processor</code> in
<a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py" rel="nofollow">diffusers.models.attention_processor</a>.`,name:"attention_kwargs"},{anchor:"diffusers.WanVideoToVideoPipeline.__call__.callback_on_step_end",description:`<strong>callback_on_step_end</strong> (<code>Callable</code>, <code>PipelineCallback</code>, <code>MultiPipelineCallbacks</code>, <em>optional</em>) &#x2014;
A function or a subclass of <code>PipelineCallback</code> or <code>MultiPipelineCallbacks</code> that is called at the end of
each denoising step during the inference. with the following arguments: <code>callback_on_step_end(self: DiffusionPipeline, step: int, timestep: int, callback_kwargs: Dict)</code>. <code>callback_kwargs</code> will include a
list of all tensors as specified by <code>callback_on_step_end_tensor_inputs</code>.`,name:"callback_on_step_end"},{anchor:"diffusers.WanVideoToVideoPipeline.__call__.callback_on_step_end_tensor_inputs",description:`<strong>callback_on_step_end_tensor_inputs</strong> (<code>List</code>, <em>optional</em>) &#x2014;
The list of tensor inputs for the <code>callback_on_step_end</code> function. The tensors specified in the list
will be passed as <code>callback_kwargs</code> argument. You will only be able to include variables listed in the
<code>._callback_tensor_inputs</code> attribute of your pipeline class.`,name:"callback_on_step_end_tensor_inputs"},{anchor:"diffusers.WanVideoToVideoPipeline.__call__.max_sequence_length",description:`<strong>max_sequence_length</strong> (<code>int</code>, defaults to <code>512</code>) &#x2014;
The maximum sequence length of the text encoder. If the prompt is longer than this, it will be
truncated. If the prompt is shorter, it will be padded to this length.`,name:"max_sequence_length"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/wan/pipeline_wan_video2video.py#L479",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>If <code>return_dict</code> is <code>True</code>, <code>WanPipelineOutput</code> is returned, otherwise a <code>tuple</code> is returned where
the first element is a list with the generated images and the second element is a list of <code>bool</code>s
indicating whether the corresponding generated image contains “not-safe-for-work” (nsfw) content.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>~WanPipelineOutput</code> or <code>tuple</code></p>
`}}),pe=new ft({props:{anchor:"diffusers.WanVideoToVideoPipeline.__call__.example",$$slots:{default:[Po]},$$scope:{ctx:T}}}),mn=new k({props:{name:"encode_prompt",anchor:"diffusers.WanVideoToVideoPipeline.encode_prompt",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]]"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"do_classifier_free_guidance",val:": bool = True"},{name:"num_videos_per_prompt",val:": int = 1"},{name:"prompt_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"max_sequence_length",val:": int = 226"},{name:"device",val:": typing.Optional[torch.device] = None"},{name:"dtype",val:": typing.Optional[torch.dtype] = None"}],parametersDescription:[{anchor:"diffusers.WanVideoToVideoPipeline.encode_prompt.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
prompt to be encoded`,name:"prompt"},{anchor:"diffusers.WanVideoToVideoPipeline.encode_prompt.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. If not defined, one has to pass
<code>negative_prompt_embeds</code> instead. Ignored when not using guidance (i.e., ignored if <code>guidance_scale</code> is
less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.WanVideoToVideoPipeline.encode_prompt.do_classifier_free_guidance",description:`<strong>do_classifier_free_guidance</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to use classifier free guidance or not.`,name:"do_classifier_free_guidance"},{anchor:"diffusers.WanVideoToVideoPipeline.encode_prompt.num_videos_per_prompt",description:`<strong>num_videos_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
Number of videos that should be generated per prompt. torch device to place the resulting embeddings on`,name:"num_videos_per_prompt"},{anchor:"diffusers.WanVideoToVideoPipeline.encode_prompt.prompt_embeds",description:`<strong>prompt_embeds</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt weighting. If not
provided, text embeddings will be generated from <code>prompt</code> input argument.`,name:"prompt_embeds"},{anchor:"diffusers.WanVideoToVideoPipeline.encode_prompt.negative_prompt_embeds",description:`<strong>negative_prompt_embeds</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt
weighting. If not provided, negative_prompt_embeds will be generated from <code>negative_prompt</code> input
argument.`,name:"negative_prompt_embeds"},{anchor:"diffusers.WanVideoToVideoPipeline.encode_prompt.device",description:`<strong>device</strong> &#x2014; (<code>torch.device</code>, <em>optional</em>):
torch device`,name:"device"},{anchor:"diffusers.WanVideoToVideoPipeline.encode_prompt.dtype",description:`<strong>dtype</strong> &#x2014; (<code>torch.dtype</code>, <em>optional</em>):
torch dtype`,name:"dtype"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/wan/pipeline_wan_video2video.py#L264"}}),hn=new F({props:{title:"WanAnimatePipeline",local:"diffusers.WanAnimatePipeline",headingTag:"h2"}}),un=new k({props:{name:"class diffusers.WanAnimatePipeline",anchor:"diffusers.WanAnimatePipeline",parameters:[{name:"tokenizer",val:": AutoTokenizer"},{name:"text_encoder",val:": UMT5EncoderModel"},{name:"vae",val:": AutoencoderKLWan"},{name:"scheduler",val:": UniPCMultistepScheduler"},{name:"image_processor",val:": CLIPImageProcessor"},{name:"image_encoder",val:": CLIPVisionModel"},{name:"transformer",val:": WanAnimateTransformer3DModel"}],parametersDescription:[{anchor:"diffusers.WanAnimatePipeline.tokenizer",description:`<strong>tokenizer</strong> (<code>T5Tokenizer</code>) &#x2014;
Tokenizer from <a href="https://huggingface.co/docs/transformers/en/model_doc/t5#transformers.T5Tokenizer" rel="nofollow">T5</a>,
specifically the <a href="https://huggingface.co/google/umt5-xxl" rel="nofollow">google/umt5-xxl</a> variant.`,name:"tokenizer"},{anchor:"diffusers.WanAnimatePipeline.text_encoder",description:`<strong>text_encoder</strong> (<code>T5EncoderModel</code>) &#x2014;
<a href="https://huggingface.co/docs/transformers/en/model_doc/t5#transformers.T5EncoderModel" rel="nofollow">T5</a>, specifically
the <a href="https://huggingface.co/google/umt5-xxl" rel="nofollow">google/umt5-xxl</a> variant.`,name:"text_encoder"},{anchor:"diffusers.WanAnimatePipeline.image_encoder",description:`<strong>image_encoder</strong> (<code>CLIPVisionModel</code>) &#x2014;
<a href="https://huggingface.co/docs/transformers/model_doc/clip#transformers.CLIPVisionModel" rel="nofollow">CLIP</a>, specifically
the
<a href="https://github.com/mlfoundations/open_clip/blob/main/docs/PRETRAINED.md#vit-h14-xlm-roberta-large" rel="nofollow">clip-vit-huge-patch14</a>
variant.`,name:"image_encoder"},{anchor:"diffusers.WanAnimatePipeline.transformer",description:`<strong>transformer</strong> (<a href="/docs/diffusers/main/en/api/models/wan_animate_transformer_3d#diffusers.WanAnimateTransformer3DModel">WanAnimateTransformer3DModel</a>) &#x2014;
Conditional Transformer to denoise the input latents.`,name:"transformer"},{anchor:"diffusers.WanAnimatePipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/main/en/api/schedulers/unipc#diffusers.UniPCMultistepScheduler">UniPCMultistepScheduler</a>) &#x2014;
A scheduler to be used in combination with <code>transformer</code> to denoise the encoded image latents.`,name:"scheduler"},{anchor:"diffusers.WanAnimatePipeline.vae",description:`<strong>vae</strong> (<a href="/docs/diffusers/main/en/api/models/autoencoder_kl_wan#diffusers.AutoencoderKLWan">AutoencoderKLWan</a>) &#x2014;
Variational Auto-Encoder (VAE) Model to encode and decode videos to and from latent representations.`,name:"vae"},{anchor:"diffusers.WanAnimatePipeline.image_processor",description:`<strong>image_processor</strong> (<code>CLIPImageProcessor</code>) &#x2014;
Image processor for preprocessing images before encoding.`,name:"image_processor"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/wan/pipeline_wan_animate.py#L150"}}),gn=new k({props:{name:"__call__",anchor:"diffusers.WanAnimatePipeline.__call__",parameters:[{name:"image",val:": typing.Union[PIL.Image.Image, numpy.ndarray, torch.Tensor, typing.List[PIL.Image.Image], typing.List[numpy.ndarray], typing.List[torch.Tensor]]"},{name:"pose_video",val:": typing.List[PIL.Image.Image]"},{name:"face_video",val:": typing.List[PIL.Image.Image]"},{name:"background_video",val:": typing.Optional[typing.List[PIL.Image.Image]] = None"},{name:"mask_video",val:": typing.Optional[typing.List[PIL.Image.Image]] = None"},{name:"prompt",val:": typing.Union[str, typing.List[str]] = None"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str]] = None"},{name:"height",val:": int = 720"},{name:"width",val:": int = 1280"},{name:"segment_frame_length",val:": int = 77"},{name:"num_inference_steps",val:": int = 20"},{name:"mode",val:": str = 'animate'"},{name:"prev_segment_conditioning_frames",val:": int = 1"},{name:"motion_encode_batch_size",val:": typing.Optional[int] = None"},{name:"guidance_scale",val:": float = 1.0"},{name:"num_videos_per_prompt",val:": typing.Optional[int] = 1"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"latents",val:": typing.Optional[torch.Tensor] = None"},{name:"prompt_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"image_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"output_type",val:": typing.Optional[str] = 'np'"},{name:"return_dict",val:": bool = True"},{name:"attention_kwargs",val:": typing.Optional[typing.Dict[str, typing.Any]] = None"},{name:"callback_on_step_end",val:": typing.Union[typing.Callable[[int, int, typing.Dict], NoneType], diffusers.callbacks.PipelineCallback, diffusers.callbacks.MultiPipelineCallbacks, NoneType] = None"},{name:"callback_on_step_end_tensor_inputs",val:": typing.List[str] = ['latents']"},{name:"max_sequence_length",val:": int = 512"}],parametersDescription:[{anchor:"diffusers.WanAnimatePipeline.__call__.image",description:`<strong>image</strong> (<code>PipelineImageInput</code>) &#x2014;
The input character image to condition the generation on. Must be an image, a list of images or a
<code>torch.Tensor</code>.`,name:"image"},{anchor:"diffusers.WanAnimatePipeline.__call__.pose_video",description:`<strong>pose_video</strong> (<code>List[PIL.Image.Image]</code>) &#x2014;
The input pose video to condition the generation on. Must be a list of PIL images.`,name:"pose_video"},{anchor:"diffusers.WanAnimatePipeline.__call__.face_video",description:`<strong>face_video</strong> (<code>List[PIL.Image.Image]</code>) &#x2014;
The input face video to condition the generation on. Must be a list of PIL images.`,name:"face_video"},{anchor:"diffusers.WanAnimatePipeline.__call__.background_video",description:`<strong>background_video</strong> (<code>List[PIL.Image.Image]</code>, <em>optional</em>) &#x2014;
When mode is <code>&quot;replace&quot;</code>, the input background video to condition the generation on. Must be a list of
PIL images.`,name:"background_video"},{anchor:"diffusers.WanAnimatePipeline.__call__.mask_video",description:`<strong>mask_video</strong> (<code>List[PIL.Image.Image]</code>, <em>optional</em>) &#x2014;
When mode is <code>&quot;replace&quot;</code>, the input mask video to condition the generation on. Must be a list of PIL
images.`,name:"mask_video"},{anchor:"diffusers.WanAnimatePipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts to guide the image generation. If not defined, one has to pass <code>prompt_embeds</code>.
instead.`,name:"prompt"},{anchor:"diffusers.WanAnimatePipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. If not defined, one has to pass
<code>negative_prompt_embeds</code> instead. Ignored when not using guidance (i.e., ignored if <code>guidance_scale</code> is
less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.WanAnimatePipeline.__call__.mode",description:`<strong>mode</strong> (<code>str</code>, defaults to <code>&quot;animation&quot;</code>) &#x2014;
The mode of the generation. Choose between <code>&quot;animate&quot;</code> and <code>&quot;replace&quot;</code>.`,name:"mode"},{anchor:"diffusers.WanAnimatePipeline.__call__.prev_segment_conditioning_frames",description:`<strong>prev_segment_conditioning_frames</strong> (<code>int</code>, defaults to <code>1</code>) &#x2014;
The number of frames from the previous video segment to be used for temporal guidance. Recommended to
be 1 or 5. In general, should be 4N + 1, where N is a non-negative integer.`,name:"prev_segment_conditioning_frames"},{anchor:"diffusers.WanAnimatePipeline.__call__.motion_encode_batch_size",description:`<strong>motion_encode_batch_size</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The batch size for batched encoding of the face video via the motion encoder. This allows trading off
inference speed for lower memory usage by setting a smaller batch size. Will default to
<code>self.transformer.config.motion_encoder_batch_size</code> if not set.`,name:"motion_encode_batch_size"},{anchor:"diffusers.WanAnimatePipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, defaults to <code>720</code>) &#x2014;
The height of the generated video.`,name:"height"},{anchor:"diffusers.WanAnimatePipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>, defaults to <code>1280</code>) &#x2014;
The width of the generated video.`,name:"width"},{anchor:"diffusers.WanAnimatePipeline.__call__.segment_frame_length",description:`<strong>segment_frame_length</strong> (<code>int</code>, defaults to <code>77</code>) &#x2014;
The number of frames in each generated video segment. The total frames of video generated will be equal
to the number of frames in <code>pose_video</code>; we will generate the video in segments until we have hit this
length. In general, should be 4N + 1, where N is a non-negative integer.`,name:"segment_frame_length"},{anchor:"diffusers.WanAnimatePipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, defaults to <code>20</code>) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.WanAnimatePipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, defaults to <code>1.0</code>) &#x2014;
Guidance scale as defined in <a href="https://huggingface.co/papers/2207.12598" rel="nofollow">Classifier-Free Diffusion
Guidance</a>. <code>guidance_scale</code> is defined as <code>w</code> of equation 2.
of <a href="https://huggingface.co/papers/2205.11487" rel="nofollow">Imagen Paper</a>. Guidance scale is enabled by setting
<code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to
the text <code>prompt</code>, usually at the expense of lower image quality. By default, CFG is not used in Wan
Animate inference.`,name:"guidance_scale"},{anchor:"diffusers.WanAnimatePipeline.__call__.num_videos_per_prompt",description:`<strong>num_videos_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_videos_per_prompt"},{anchor:"diffusers.WanAnimatePipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
A <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow"><code>torch.Generator</code></a> to make
generation deterministic.`,name:"generator"},{anchor:"diffusers.WanAnimatePipeline.__call__.latents",description:`<strong>latents</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated noisy latents sampled from a Gaussian distribution, to be used as inputs for image
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 <code>generator</code>.`,name:"latents"},{anchor:"diffusers.WanAnimatePipeline.__call__.prompt_embeds",description:`<strong>prompt_embeds</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated text embeddings. Can be used to easily tweak text inputs (prompt weighting). If not
provided, text embeddings are generated from the <code>prompt</code> input argument.`,name:"prompt_embeds"},{anchor:"diffusers.WanAnimatePipeline.__call__.negative_prompt_embeds",description:`<strong>negative_prompt_embeds</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated text embeddings. Can be used to easily tweak text inputs (prompt weighting). If not
provided, text embeddings are generated from the <code>negative_prompt</code> input argument.`,name:"negative_prompt_embeds"},{anchor:"diffusers.WanAnimatePipeline.__call__.image_embeds",description:`<strong>image_embeds</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated image embeddings. Can be used to easily tweak image inputs (weighting). If not provided,
image embeddings are generated from the <code>image</code> input argument.`,name:"image_embeds"},{anchor:"diffusers.WanAnimatePipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;np&quot;</code>) &#x2014;
The output format of the generated image. Choose between <code>PIL.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.WanAnimatePipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <code>WanPipelineOutput</code> instead of a plain tuple.`,name:"return_dict"},{anchor:"diffusers.WanAnimatePipeline.__call__.attention_kwargs",description:`<strong>attention_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
A kwargs dictionary that if specified is passed along to the <code>AttentionProcessor</code> as defined under
<code>self.processor</code> in
<a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py" rel="nofollow">diffusers.models.attention_processor</a>.`,name:"attention_kwargs"},{anchor:"diffusers.WanAnimatePipeline.__call__.callback_on_step_end",description:`<strong>callback_on_step_end</strong> (<code>Callable</code>, <code>PipelineCallback</code>, <code>MultiPipelineCallbacks</code>, <em>optional</em>) &#x2014;
A function or a subclass of <code>PipelineCallback</code> or <code>MultiPipelineCallbacks</code> that is called at the end of
each denoising step during the inference. with the following arguments: <code>callback_on_step_end(self: DiffusionPipeline, step: int, timestep: int, callback_kwargs: Dict)</code>. <code>callback_kwargs</code> will include a
list of all tensors as specified by <code>callback_on_step_end_tensor_inputs</code>.`,name:"callback_on_step_end"},{anchor:"diffusers.WanAnimatePipeline.__call__.callback_on_step_end_tensor_inputs",description:`<strong>callback_on_step_end_tensor_inputs</strong> (<code>List</code>, <em>optional</em>) &#x2014;
The list of tensor inputs for the <code>callback_on_step_end</code> function. The tensors specified in the list
will be passed as <code>callback_kwargs</code> argument. You will only be able to include variables listed in the
<code>._callback_tensor_inputs</code> attribute of your pipeline class.`,name:"callback_on_step_end_tensor_inputs"},{anchor:"diffusers.WanAnimatePipeline.__call__.max_sequence_length",description:`<strong>max_sequence_length</strong> (<code>int</code>, defaults to <code>512</code>) &#x2014;
The maximum sequence length of the text encoder. If the prompt is longer than this, it will be
truncated. If the prompt is shorter, it will be padded to this length.`,name:"max_sequence_length"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/wan/pipeline_wan_animate.py#L760",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>If <code>return_dict</code> is <code>True</code>, <code>WanPipelineOutput</code> is returned, otherwise a <code>tuple</code> is returned where
the first element is a list with the generated images and the second element is a list of <code>bool</code>s
indicating whether the corresponding generated image contains “not-safe-for-work” (nsfw) content.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>~WanPipelineOutput</code> or <code>tuple</code></p>
`}}),me=new ft({props:{anchor:"diffusers.WanAnimatePipeline.__call__.example",$$slots:{default:[So]},$$scope:{ctx:T}}}),fn=new k({props:{name:"encode_prompt",anchor:"diffusers.WanAnimatePipeline.encode_prompt",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]]"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"do_classifier_free_guidance",val:": bool = True"},{name:"num_videos_per_prompt",val:": int = 1"},{name:"prompt_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"max_sequence_length",val:": int = 226"},{name:"device",val:": typing.Optional[torch.device] = None"},{name:"dtype",val:": typing.Optional[torch.dtype] = None"}],parametersDescription:[{anchor:"diffusers.WanAnimatePipeline.encode_prompt.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
prompt to be encoded`,name:"prompt"},{anchor:"diffusers.WanAnimatePipeline.encode_prompt.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. If not defined, one has to pass
<code>negative_prompt_embeds</code> instead. Ignored when not using guidance (i.e., ignored if <code>guidance_scale</code> is
less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.WanAnimatePipeline.encode_prompt.do_classifier_free_guidance",description:`<strong>do_classifier_free_guidance</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to use classifier free guidance or not.`,name:"do_classifier_free_guidance"},{anchor:"diffusers.WanAnimatePipeline.encode_prompt.num_videos_per_prompt",description:`<strong>num_videos_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
Number of videos that should be generated per prompt. torch device to place the resulting embeddings on`,name:"num_videos_per_prompt"},{anchor:"diffusers.WanAnimatePipeline.encode_prompt.prompt_embeds",description:`<strong>prompt_embeds</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt weighting. If not
provided, text embeddings will be generated from <code>prompt</code> input argument.`,name:"prompt_embeds"},{anchor:"diffusers.WanAnimatePipeline.encode_prompt.negative_prompt_embeds",description:`<strong>negative_prompt_embeds</strong> (<code>torch.Tensor</code>, <em>optional</em>) &#x2014;
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt
weighting. If not provided, negative_prompt_embeds will be generated from <code>negative_prompt</code> input
argument.`,name:"negative_prompt_embeds"},{anchor:"diffusers.WanAnimatePipeline.encode_prompt.device",description:`<strong>device</strong> &#x2014; (<code>torch.device</code>, <em>optional</em>):
torch device`,name:"device"},{anchor:"diffusers.WanAnimatePipeline.encode_prompt.dtype",description:`<strong>dtype</strong> &#x2014; (<code>torch.dtype</code>, <em>optional</em>):
torch dtype`,name:"dtype"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/wan/pipeline_wan_animate.py#L288"}}),Mn=new k({props:{name:"pad_video_frames",anchor:"diffusers.WanAnimatePipeline.pad_video_frames",parameters:[{name:"frames",val:": typing.List[typing.Any]"},{name:"num_target_frames",val:": int"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/wan/pipeline_wan_animate.py#L715"}}),yn=new F({props:{title:"WanPipelineOutput",local:"diffusers.pipelines.wan.pipeline_output.WanPipelineOutput",headingTag:"h2"}}),_n=new k({props:{name:"class diffusers.pipelines.wan.pipeline_output.WanPipelineOutput",anchor:"diffusers.pipelines.wan.pipeline_output.WanPipelineOutput",parameters:[{name:"frames",val:": Tensor"}],parametersDescription:[{anchor:"diffusers.pipelines.wan.pipeline_output.WanPipelineOutput.frames",description:`<strong>frames</strong> (<code>torch.Tensor</code>, <code>np.ndarray</code>, or List[List[PIL.Image.Image]]) &#x2014;
List of video outputs - It can be a nested list of length <code>batch_size,</code> with each sub-list containing
denoised PIL image sequences of length <code>num_frames.</code> It can also be a NumPy array or Torch tensor of shape
<code>(batch_size, num_frames, channels, height, width)</code>.`,name:"frames"}],source:"https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/wan/pipeline_output.py#L9"}}),bn=new Co({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/pipelines/wan.md"}}),{c(){a=p("meta"),f=s(),i=p("p"),m=s(),h=p("div"),h.innerHTML=l,g=s(),M(U.$$.fragment),j=s(),V=p("p"),V.innerHTML=ut,Mt=s(),ue=p("p"),ue.innerHTML=_s,yt=s(),ge=p("p"),ge.innerHTML=bs,_t=s(),fe=p("p"),fe.textContent=ws,bt=s(),Me=p("ul"),Me.innerHTML=Js,wt=s(),O=p("blockquote"),O.innerHTML=Ts,Jt=s(),M(ye.$$.fragment),Tt=s(),_e=p("p"),_e.textContent=Us,Ut=s(),M(ee.$$.fragment),jt=s(),M(be.$$.fragment),Zt=s(),we=p("p"),we.textContent=js,Wt=s(),M(ne.$$.fragment),vt=s(),M(Je.$$.fragment),It=s(),Te=p("p"),Te.textContent=Zs,Gt=s(),Ue=p("ul"),Ue.innerHTML=Ws,Bt=s(),je=p("p"),je.innerHTML=vs,kt=s(),Ze=p("p"),Ze.textContent=Is,Vt=Go(`
</hfoption>
</hfoptions>
`),M(We.$$.fragment),Ct=s(),ve=p("p"),ve.innerHTML=Gs,xt=s(),Ie=p("p"),Ie.innerHTML=Bs,Rt=s(),Ge=p("p"),Ge.innerHTML=ks,Xt=s(),Be=p("p"),Be.innerHTML=Vs,Ft=s(),M(ke.$$.fragment),Qt=s(),Ve=p("p"),Ve.textContent=Cs,Yt=s(),Ce=p("ol"),Ce.innerHTML=xs,Nt=s(),M(xe.$$.fragment),At=s(),Re=p("p"),Re.textContent=Rs,Et=s(),Xe=p("ul"),Xe.innerHTML=Xs,Ht=s(),Fe=p("p"),Fe.textContent=Fs,zt=s(),Qe=p("ul"),Qe.innerHTML=Qs,$t=s(),te=p("blockquote"),te.innerHTML=Ys,Pt=s(),Ye=p("p"),Ye.textContent=Ns,St=s(),M(ae.$$.fragment),Lt=s(),M(Ne.$$.fragment),qt=s(),Ae=p("ul"),Ae.innerHTML=As,Dt=s(),M(Ee.$$.fragment),Kt=s(),G=p("ul"),He=p("li"),Zn=p("p"),Zn.innerHTML=Es,_a=s(),ze=p("details"),Wn=p("summary"),Wn.textContent=Hs,ba=s(),M($e.$$.fragment),wa=s(),Pe=p("li"),vn=p("p"),vn.innerHTML=zs,Ja=s(),Se=p("details"),In=p("summary"),In.textContent=$s,Ta=s(),M(Le.$$.fragment),Ua=s(),Gn=p("li"),Gn.innerHTML=Ps,ja=s(),Bn=p("li"),Bn.innerHTML=Ss,Za=s(),kn=p("li"),kn.innerHTML=Ls,Wa=s(),Vn=p("li"),Vn.innerHTML=qs,va=s(),Cn=p("li"),Cn.innerHTML=Ds,Ot=s(),M(qe.$$.fragment),ea=s(),C=p("div"),M(De.$$.fragment),Ia=s(),xn=p("p"),xn.textContent=Ks,Ga=s(),Rn=p("p"),Rn.innerHTML=Os,Ba=s(),A=p("div"),M(Ke.$$.fragment),ka=s(),Xn=p("p"),Xn.textContent=eo,Va=s(),M(se.$$.fragment),Ca=s(),oe=p("div"),M(Oe.$$.fragment),xa=s(),Fn=p("p"),Fn.textContent=no,na=s(),M(en.$$.fragment),ta=s(),x=p("div"),M(nn.$$.fragment),Ra=s(),Qn=p("p"),Qn.textContent=to,Xa=s(),Yn=p("p"),Yn.innerHTML=ao,Fa=s(),E=p("div"),M(tn.$$.fragment),Qa=s(),Nn=p("p"),Nn.textContent=so,Ya=s(),M(le.$$.fragment),Na=s(),ie=p("div"),M(an.$$.fragment),Aa=s(),An=p("p"),An.textContent=oo,aa=s(),M(sn.$$.fragment),sa=s(),R=p("div"),M(on.$$.fragment),Ea=s(),En=p("p"),En.textContent=lo,Ha=s(),Hn=p("p"),Hn.innerHTML=io,za=s(),H=p("div"),M(ln.$$.fragment),$a=s(),zn=p("p"),zn.textContent=ro,Pa=s(),M(re.$$.fragment),Sa=s(),de=p("div"),M(rn.$$.fragment),La=s(),$n=p("p"),$n.textContent=po,oa=s(),M(dn.$$.fragment),la=s(),X=p("div"),M(pn.$$.fragment),qa=s(),Pn=p("p"),Pn.textContent=co,Da=s(),Sn=p("p"),Sn.innerHTML=mo,Ka=s(),z=p("div"),M(cn.$$.fragment),Oa=s(),Ln=p("p"),Ln.textContent=ho,es=s(),M(pe.$$.fragment),ns=s(),ce=p("div"),M(mn.$$.fragment),ts=s(),qn=p("p"),qn.textContent=uo,ia=s(),M(hn.$$.fragment),ra=s(),Z=p("div"),M(un.$$.fragment),as=s(),Dn=p("p"),Dn.textContent=go,ss=s(),Kn=p("p"),Kn.textContent=fo,os=s(),On=p("ol"),On.innerHTML=Mo,ls=s(),et=p("p"),et.innerHTML=yo,is=s(),nt=p("p"),nt.textContent=_o,rs=s(),tt=p("ul"),tt.innerHTML=bo,ds=s(),$=p("div"),M(gn.$$.fragment),ps=s(),at=p("p"),at.textContent=wo,cs=s(),M(me.$$.fragment),ms=s(),he=p("div"),M(fn.$$.fragment),hs=s(),st=p("p"),st.textContent=Jo,us=s(),P=p("div"),M(Mn.$$.fragment),gs=s(),ot=p("p"),ot.innerHTML=To,fs=s(),lt=p("p"),lt.textContent=Uo,da=s(),M(yn.$$.fragment),pa=s(),D=p("div"),M(_n.$$.fragment),Ms=s(),it=p("p"),it.textContent=jo,ca=s(),M(bn.$$.fragment),ma=s(),gt=p("p"),this.h()},l(e){const t=Bo("svelte-u9bgzb",document.head);a=c(t,"META",{name:!0,content:!0}),t.forEach(n),f=o(e),i=c(e,"P",{}),W(i).forEach(n),m=o(e),h=c(e,"DIV",{style:!0,"data-svelte-h":!0}),u(h)!=="svelte-p206qu"&&(h.innerHTML=l),g=o(e),y(U.$$.fragment,e),j=o(e),V=c(e,"P",{"data-svelte-h":!0}),u(V)!=="svelte-1o4eh30"&&(V.innerHTML=ut),Mt=o(e),ue=c(e,"P",{"data-svelte-h":!0}),u(ue)!=="svelte-snfs92"&&(ue.innerHTML=_s),yt=o(e),ge=c(e,"P",{"data-svelte-h":!0}),u(ge)!=="svelte-1uk9cie"&&(ge.innerHTML=bs),_t=o(e),fe=c(e,"P",{"data-svelte-h":!0}),u(fe)!=="svelte-1j7jvpk"&&(fe.textContent=ws),bt=o(e),Me=c(e,"UL",{"data-svelte-h":!0}),u(Me)!=="svelte-zbr29k"&&(Me.innerHTML=Js),wt=o(e),O=c(e,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),u(O)!=="svelte-16bh70k"&&(O.innerHTML=Ts),Jt=o(e),y(ye.$$.fragment,e),Tt=o(e),_e=c(e,"P",{"data-svelte-h":!0}),u(_e)!=="svelte-r8z9s6"&&(_e.textContent=Us),Ut=o(e),y(ee.$$.fragment,e),jt=o(e),y(be.$$.fragment,e),Zt=o(e),we=c(e,"P",{"data-svelte-h":!0}),u(we)!=="svelte-1jq7n9p"&&(we.textContent=js),Wt=o(e),y(ne.$$.fragment,e),vt=o(e),y(Je.$$.fragment,e),It=o(e),Te=c(e,"P",{"data-svelte-h":!0}),u(Te)!=="svelte-1qiyvqd"&&(Te.textContent=Zs),Gt=o(e),Ue=c(e,"UL",{"data-svelte-h":!0}),u(Ue)!=="svelte-1yzklw7"&&(Ue.innerHTML=Ws),Bt=o(e),je=c(e,"P",{"data-svelte-h":!0}),u(je)!=="svelte-1rpd72j"&&(je.innerHTML=vs),kt=o(e),Ze=c(e,"P",{"data-svelte-h":!0}),u(Ze)!=="svelte-1icmgvo"&&(Ze.textContent=Is),Vt=ko(e,`
</hfoption>
</hfoptions>
`),y(We.$$.fragment,e),Ct=o(e),ve=c(e,"P",{"data-svelte-h":!0}),u(ve)!=="svelte-1svse5h"&&(ve.innerHTML=Gs),xt=o(e),Ie=c(e,"P",{"data-svelte-h":!0}),u(Ie)!=="svelte-6ojj1v"&&(Ie.innerHTML=Bs),Rt=o(e),Ge=c(e,"P",{"data-svelte-h":!0}),u(Ge)!=="svelte-yhsjny"&&(Ge.innerHTML=ks),Xt=o(e),Be=c(e,"P",{"data-svelte-h":!0}),u(Be)!=="svelte-itld7h"&&(Be.innerHTML=Vs),Ft=o(e),y(ke.$$.fragment,e),Qt=o(e),Ve=c(e,"P",{"data-svelte-h":!0}),u(Ve)!=="svelte-ywaxwd"&&(Ve.textContent=Cs),Yt=o(e),Ce=c(e,"OL",{"data-svelte-h":!0}),u(Ce)!=="svelte-1hdysu2"&&(Ce.innerHTML=xs),Nt=o(e),y(xe.$$.fragment,e),At=o(e),Re=c(e,"P",{"data-svelte-h":!0}),u(Re)!=="svelte-zj5oon"&&(Re.textContent=Rs),Et=o(e),Xe=c(e,"UL",{"data-svelte-h":!0}),u(Xe)!=="svelte-15e2qlr"&&(Xe.innerHTML=Xs),Ht=o(e),Fe=c(e,"P",{"data-svelte-h":!0}),u(Fe)!=="svelte-1y05jmh"&&(Fe.textContent=Fs),zt=o(e),Qe=c(e,"UL",{"data-svelte-h":!0}),u(Qe)!=="svelte-1q1m9mx"&&(Qe.innerHTML=Qs),$t=o(e),te=c(e,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),u(te)!=="svelte-1tbaclm"&&(te.innerHTML=Ys),Pt=o(e),Ye=c(e,"P",{"data-svelte-h":!0}),u(Ye)!=="svelte-cropwm"&&(Ye.textContent=Ns),St=o(e),y(ae.$$.fragment,e),Lt=o(e),y(Ne.$$.fragment,e),qt=o(e),Ae=c(e,"UL",{"data-svelte-h":!0}),u(Ae)!=="svelte-18ddf2h"&&(Ae.innerHTML=As),Dt=o(e),y(Ee.$$.fragment,e),Kt=o(e),G=c(e,"UL",{});var B=W(G);He=c(B,"LI",{});var wn=W(He);Zn=c(wn,"P",{"data-svelte-h":!0}),u(Zn)!=="svelte-1qr0hkb"&&(Zn.innerHTML=Es),_a=o(wn),ze=c(wn,"DETAILS",{});var Jn=W(ze);Wn=c(Jn,"SUMMARY",{"data-svelte-h":!0}),u(Wn)!=="svelte-1m0l1gk"&&(Wn.textContent=Hs),ba=o(Jn),y($e.$$.fragment,Jn),Jn.forEach(n),wn.forEach(n),wa=o(B),Pe=c(B,"LI",{});var Tn=W(Pe);vn=c(Tn,"P",{"data-svelte-h":!0}),u(vn)!=="svelte-1u8xg1f"&&(vn.innerHTML=zs),Ja=o(Tn),Se=c(Tn,"DETAILS",{});var Un=W(Se);In=c(Un,"SUMMARY",{"data-svelte-h":!0}),u(In)!=="svelte-1m0l1gk"&&(In.textContent=$s),Ta=o(Un),y(Le.$$.fragment,Un),Un.forEach(n),Tn.forEach(n),Ua=o(B),Gn=c(B,"LI",{"data-svelte-h":!0}),u(Gn)!=="svelte-1dr923m"&&(Gn.innerHTML=Ps),ja=o(B),Bn=c(B,"LI",{"data-svelte-h":!0}),u(Bn)!=="svelte-154noqv"&&(Bn.innerHTML=Ss),Za=o(B),kn=c(B,"LI",{"data-svelte-h":!0}),u(kn)!=="svelte-ck8fz4"&&(kn.innerHTML=Ls),Wa=o(B),Vn=c(B,"LI",{"data-svelte-h":!0}),u(Vn)!=="svelte-1lhnjsl"&&(Vn.innerHTML=qs),va=o(B),Cn=c(B,"LI",{"data-svelte-h":!0}),u(Cn)!=="svelte-1kfqgcj"&&(Cn.innerHTML=Ds),B.forEach(n),Ot=o(e),y(qe.$$.fragment,e),ea=o(e),C=c(e,"DIV",{class:!0});var Q=W(C);y(De.$$.fragment,Q),Ia=o(Q),xn=c(Q,"P",{"data-svelte-h":!0}),u(xn)!=="svelte-cppop6"&&(xn.textContent=Ks),Ga=o(Q),Rn=c(Q,"P",{"data-svelte-h":!0}),u(Rn)!=="svelte-496sm0"&&(Rn.innerHTML=Os),Ba=o(Q),A=c(Q,"DIV",{class:!0});var K=W(A);y(Ke.$$.fragment,K),ka=o(K),Xn=c(K,"P",{"data-svelte-h":!0}),u(Xn)!=="svelte-50j04k"&&(Xn.textContent=eo),Va=o(K),y(se.$$.fragment,K),K.forEach(n),Ca=o(Q),oe=c(Q,"DIV",{class:!0});var jn=W(oe);y(Oe.$$.fragment,jn),xa=o(jn),Fn=c(jn,"P",{"data-svelte-h":!0}),u(Fn)!=="svelte-16q0ax1"&&(Fn.textContent=no),jn.forEach(n),Q.forEach(n),na=o(e),y(en.$$.fragment,e),ta=o(e),x=c(e,"DIV",{class:!0});var S=W(x);y(nn.$$.fragment,S),Ra=o(S),Qn=c(S,"P",{"data-svelte-h":!0}),u(Qn)!=="svelte-1u5shki"&&(Qn.textContent=to),Xa=o(S),Yn=c(S,"P",{"data-svelte-h":!0}),u(Yn)!=="svelte-496sm0"&&(Yn.innerHTML=ao),Fa=o(S),E=c(S,"DIV",{class:!0});var rt=W(E);y(tn.$$.fragment,rt),Qa=o(rt),Nn=c(rt,"P",{"data-svelte-h":!0}),u(Nn)!=="svelte-50j04k"&&(Nn.textContent=so),Ya=o(rt),y(le.$$.fragment,rt),rt.forEach(n),Na=o(S),ie=c(S,"DIV",{class:!0});var ua=W(ie);y(an.$$.fragment,ua),Aa=o(ua),An=c(ua,"P",{"data-svelte-h":!0}),u(An)!=="svelte-16q0ax1"&&(An.textContent=oo),ua.forEach(n),S.forEach(n),aa=o(e),y(sn.$$.fragment,e),sa=o(e),R=c(e,"DIV",{class:!0});var L=W(R);y(on.$$.fragment,L),Ea=o(L),En=c(L,"P",{"data-svelte-h":!0}),u(En)!=="svelte-14hxha6"&&(En.textContent=lo),Ha=o(L),Hn=c(L,"P",{"data-svelte-h":!0}),u(Hn)!=="svelte-496sm0"&&(Hn.innerHTML=io),za=o(L),H=c(L,"DIV",{class:!0});var dt=W(H);y(ln.$$.fragment,dt),$a=o(dt),zn=c(dt,"P",{"data-svelte-h":!0}),u(zn)!=="svelte-50j04k"&&(zn.textContent=ro),Pa=o(dt),y(re.$$.fragment,dt),dt.forEach(n),Sa=o(L),de=c(L,"DIV",{class:!0});var ga=W(de);y(rn.$$.fragment,ga),La=o(ga),$n=c(ga,"P",{"data-svelte-h":!0}),u($n)!=="svelte-16q0ax1"&&($n.textContent=po),ga.forEach(n),L.forEach(n),oa=o(e),y(dn.$$.fragment,e),la=o(e),X=c(e,"DIV",{class:!0});var q=W(X);y(pn.$$.fragment,q),qa=o(q),Pn=c(q,"P",{"data-svelte-h":!0}),u(Pn)!=="svelte-t5jwqk"&&(Pn.textContent=co),Da=o(q),Sn=c(q,"P",{"data-svelte-h":!0}),u(Sn)!=="svelte-496sm0"&&(Sn.innerHTML=mo),Ka=o(q),z=c(q,"DIV",{class:!0});var pt=W(z);y(cn.$$.fragment,pt),Oa=o(pt),Ln=c(pt,"P",{"data-svelte-h":!0}),u(Ln)!=="svelte-50j04k"&&(Ln.textContent=ho),es=o(pt),y(pe.$$.fragment,pt),pt.forEach(n),ns=o(q),ce=c(q,"DIV",{class:!0});var fa=W(ce);y(mn.$$.fragment,fa),ts=o(fa),qn=c(fa,"P",{"data-svelte-h":!0}),u(qn)!=="svelte-16q0ax1"&&(qn.textContent=uo),fa.forEach(n),q.forEach(n),ia=o(e),y(hn.$$.fragment,e),ra=o(e),Z=c(e,"DIV",{class:!0});var I=W(Z);y(un.$$.fragment,I),as=o(I),Dn=c(I,"P",{"data-svelte-h":!0}),u(Dn)!=="svelte-feyfe7"&&(Dn.textContent=go),ss=o(I),Kn=c(I,"P",{"data-svelte-h":!0}),u(Kn)!=="svelte-1lth9bl"&&(Kn.textContent=fo),os=o(I),On=c(I,"OL",{"data-svelte-h":!0}),u(On)!=="svelte-1cmct20"&&(On.innerHTML=Mo),ls=o(I),et=c(I,"P",{"data-svelte-h":!0}),u(et)!=="svelte-496sm0"&&(et.innerHTML=yo),is=o(I),nt=c(I,"P",{"data-svelte-h":!0}),u(nt)!=="svelte-14s6m4u"&&(nt.textContent=_o),rs=o(I),tt=c(I,"UL",{"data-svelte-h":!0}),u(tt)!=="svelte-u7qgdw"&&(tt.innerHTML=bo),ds=o(I),$=c(I,"DIV",{class:!0});var ct=W($);y(gn.$$.fragment,ct),ps=o(ct),at=c(ct,"P",{"data-svelte-h":!0}),u(at)!=="svelte-50j04k"&&(at.textContent=wo),cs=o(ct),y(me.$$.fragment,ct),ct.forEach(n),ms=o(I),he=c(I,"DIV",{class:!0});var Ma=W(he);y(fn.$$.fragment,Ma),hs=o(Ma),st=c(Ma,"P",{"data-svelte-h":!0}),u(st)!=="svelte-16q0ax1"&&(st.textContent=Jo),Ma.forEach(n),us=o(I),P=c(I,"DIV",{class:!0});var mt=W(P);y(Mn.$$.fragment,mt),gs=o(mt),ot=c(mt,"P",{"data-svelte-h":!0}),u(ot)!=="svelte-17ekve0"&&(ot.innerHTML=To),fs=o(mt),lt=c(mt,"P",{"data-svelte-h":!0}),u(lt)!=="svelte-rnn4t9"&&(lt.textContent=Uo),mt.forEach(n),I.forEach(n),da=o(e),y(yn.$$.fragment,e),pa=o(e),D=c(e,"DIV",{class:!0});var ya=W(D);y(_n.$$.fragment,ya),Ms=o(ya),it=c(ya,"P",{"data-svelte-h":!0}),u(it)!=="svelte-fkhkmf"&&(it.textContent=jo),ya.forEach(n),ca=o(e),y(bn.$$.fragment,e),ma=o(e),gt=c(e,"P",{}),W(gt).forEach(n),this.h()},h(){v(a,"name","hf:doc:metadata"),v(a,"content",qo),Vo(h,"float","right"),v(O,"class","tip"),v(te,"class","note"),v(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(oe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(ie,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(de,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(ce,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(he,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,t){d(document.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,A),_(Ke,A,null),d(A,ka),d(A,Xn),d(A,Va),_(se,A,null),d(C,Ca),d(C,oe),_(Oe,oe,null),d(oe,xa),d(oe,Fn),r(e,na,t),_(en,e,t),r(e,ta,t),r(e,x,t),_(nn,x,null),d(x,Ra),d(x,Qn),d(x,Xa),d(x,Yn),d(x,Fa),d(x,E),_(tn,E,null),d(E,Qa),d(E,Nn),d(E,Ya),_(le,E,null),d(x,Na),d(x,ie),_(an,ie,null),d(ie,Aa),d(ie,An),r(e,aa,t),_(sn,e,t),r(e,sa,t),r(e,R,t),_(on,R,null),d(R,Ea),d(R,En),d(R,Ha),d(R,Hn),d(R,za),d(R,H),_(ln,H,null),d(H,$a),d(H,zn),d(H,Pa),_(re,H,null),d(R,Sa),d(R,de),_(rn,de,null),d(de,La),d(de,$n),r(e,oa,t),_(dn,e,t),r(e,la,t),r(e,X,t),_(pn,X,null),d(X,qa),d(X,Pn),d(X,Da),d(X,Sn),d(X,Ka),d(X,z),_(cn,z,null),d(z,Oa),d(z,Ln),d(z,es),_(pe,z,null),d(X,ns),d(X,ce),_(mn,ce,null),d(ce,ts),d(ce,qn),r(e,ia,t),_(hn,e,t),r(e,ra,t),r(e,Z,t),_(un,Z,null),d(Z,as),d(Z,Dn),d(Z,ss),d(Z,Kn),d(Z,os),d(Z,On),d(Z,ls),d(Z,et),d(Z,is),d(Z,nt),d(Z,rs),d(Z,tt),d(Z,ds),d(Z,$),_(gn,$,null),d($,ps),d($,at),d($,cs),_(me,$,null),d(Z,ms),d(Z,he),_(fn,he,null),d(he,hs),d(he,st),d(Z,us),d(Z,P),_(Mn,P,null),d(P,gs),d(P,ot),d(P,fs),d(P,lt),r(e,da,t),_(yn,e,t),r(e,pa,t),r(e,D,t),_(_n,D,null),d(D,Ms),d(D,it),r(e,ca,t),_(bn,e,t),r(e,ma,t),r(e,gt,t),ha=!0},p(e,[t]){const B={};t&2&&(B.$$scope={dirty:t,ctx:e}),ee.$set(B);const wn={};t&2&&(wn.$$scope={dirty:t,ctx:e}),ne.$set(wn);const Jn={};t&2&&(Jn.$$scope={dirty:t,ctx:e}),ae.$set(Jn);const Tn={};t&2&&(Tn.$$scope={dirty:t,ctx:e}),se.$set(Tn);const Un={};t&2&&(Un.$$scope={dirty:t,ctx:e}),le.$set(Un);const Q={};t&2&&(Q.$$scope={dirty:t,ctx:e}),re.$set(Q);const K={};t&2&&(K.$$scope={dirty:t,ctx:e}),pe.$set(K);const jn={};t&2&&(jn.$$scope={dirty:t,ctx:e}),me.$set(jn)},i(e){ha||(b(U.$$.fragment,e),b(ye.$$.fragment,e),b(ee.$$.fragment,e),b(be.$$.fragment,e),b(ne.$$.fragment,e),b(Je.$$.fragment,e),b(We.$$.fragment,e),b(ke.$$.fragment,e),b(xe.$$.fragment,e),b(ae.$$.fragment,e),b(Ne.$$.fragment,e),b(Ee.$$.fragment,e),b($e.$$.fragment,e),b(Le.$$.fragment,e),b(qe.$$.fragment,e),b(De.$$.fragment,e),b(Ke.$$.fragment,e),b(se.$$.fragment,e),b(Oe.$$.fragment,e),b(en.$$.fragment,e),b(nn.$$.fragment,e),b(tn.$$.fragment,e),b(le.$$.fragment,e),b(an.$$.fragment,e),b(sn.$$.fragment,e),b(on.$$.fragment,e),b(ln.$$.fragment,e),b(re.$$.fragment,e),b(rn.$$.fragment,e),b(dn.$$.fragment,e),b(pn.$$.fragment,e),b(cn.$$.fragment,e),b(pe.$$.fragment,e),b(mn.$$.fragment,e),b(hn.$$.fragment,e),b(un.$$.fragment,e),b(gn.$$.fragment,e),b(me.$$.fragment,e),b(fn.$$.fragment,e),b(Mn.$$.fragment,e),b(yn.$$.fragment,e),b(_n.$$.fragment,e),b(bn.$$.fragment,e),ha=!0)},o(e){w(U.$$.fragment,e),w(ye.$$.fragment,e),w(ee.$$.fragment,e),w(be.$$.fragment,e),w(ne.$$.fragment,e),w(Je.$$.fragment,e),w(We.$$.fragment,e),w(ke.$$.fragment,e),w(xe.$$.fragment,e),w(ae.$$.fragment,e),w(Ne.$$.fragment,e),w(Ee.$$.fragment,e),w($e.$$.fragment,e),w(Le.$$.fragment,e),w(qe.$$.fragment,e),w(De.$$.fragment,e),w(Ke.$$.fragment,e),w(se.$$.fragment,e),w(Oe.$$.fragment,e),w(en.$$.fragment,e),w(nn.$$.fragment,e),w(tn.$$.fragment,e),w(le.$$.fragment,e),w(an.$$.fragment,e),w(sn.$$.fragment,e),w(on.$$.fragment,e),w(ln.$$.fragment,e),w(re.$$.fragment,e),w(rn.$$.fragment,e),w(dn.$$.fragment,e),w(pn.$$.fragment,e),w(cn.$$.fragment,e),w(pe.$$.fragment,e),w(mn.$$.fragment,e),w(hn.$$.fragment,e),w(un.$$.fragment,e),w(gn.$$.fragment,e),w(me.$$.fragment,e),w(fn.$$.fragment,e),w(Mn.$$.fragment,e),w(yn.$$.fragment,e),w(_n.$$.fragment,e),w(bn.$$.fragment,e),ha=!1},d(e){e&&(n(f),n(i),n(m),n(h),n(g),n(j),n(V),n(Mt),n(ue),n(yt),n(ge),n(_t),n(fe),n(bt),n(Me),n(wt),n(O),n(Jt),n(Tt),n(_e),n(Ut),n(jt),n(Zt),n(we),n(Wt),n(vt),n(It),n(Te),n(Gt),n(Ue),n(Bt),n(je),n(kt),n(Ze),n(Vt),n(Ct),n(ve),n(xt),n(Ie),n(Rt),n(Ge),n(Xt),n(Be),n(Ft),n(Qt),n(Ve),n(Yt),n(Ce),n(Nt),n(At),n(Re),n(Et),n(Xe),n(Ht),n(Fe),n(zt),n(Qe),n($t),n(te),n(Pt),n(Ye),n(St),n(Lt),n(qt),n(Ae),n(Dt),n(Kt),n(G),n(Ot),n(ea),n(C),n(na),n(ta),n(x),n(aa),n(sa),n(R),n(oa),n(la),n(X),n(ia),n(ra),n(Z),n(da),n(pa),n(D),n(ca),n(ma),n(gt)),n(a),J(U,e),J(ye,e),J(ee,e),J(be,e),J(ne,e),J(Je,e),J(We,e),J(ke,e),J(xe,e),J(ae,e),J(Ne,e),J(Ee,e),J($e),J(Le),J(qe,e),J(De),J(Ke),J(se),J(Oe),J(en,e),J(nn),J(tn),J(le),J(an),J(sn,e),J(on),J(ln),J(re),J(rn),J(dn,e),J(pn),J(cn),J(pe),J(mn),J(hn,e),J(un),J(gn),J(me),J(fn),J(Mn),J(yn,e),J(_n),J(bn,e)}}}const qo='{"title":"Wan","local":"wan","sections":[{"title":"Text-to-Video Generation","local":"text-to-video-generation","sections":[],"depth":3},{"title":"First-Last-Frame-to-Video Generation","local":"first-last-frame-to-video-generation","sections":[],"depth":3},{"title":"Any-to-Video Controllable Generation","local":"any-to-video-controllable-generation","sections":[],"depth":3},{"title":"Wan-Animate: Unified Character Animation and Replacement with Holistic Replication","local":"wan-animate-unified-character-animation-and-replacement-with-holistic-replication","sections":[{"title":"Usage","local":"usage","sections":[{"title":"Prerequisites","local":"prerequisites","sections":[],"depth":5}],"depth":4},{"title":"Key Parameters","local":"key-parameters","sections":[],"depth":4}],"depth":3},{"title":"Notes","local":"notes","sections":[],"depth":2},{"title":"WanPipeline","local":"diffusers.WanPipeline","sections":[],"depth":2},{"title":"WanImageToVideoPipeline","local":"diffusers.WanImageToVideoPipeline","sections":[],"depth":2},{"title":"WanVACEPipeline","local":"diffusers.WanVACEPipeline","sections":[],"depth":2},{"title":"WanVideoToVideoPipeline","local":"diffusers.WanVideoToVideoPipeline","sections":[],"depth":2},{"title":"WanAnimatePipeline","local":"diffusers.WanAnimatePipeline","sections":[],"depth":2},{"title":"WanPipelineOutput","local":"diffusers.pipelines.wan.pipeline_output.WanPipelineOutput","sections":[],"depth":2}],"depth":1}';function Do(T){return Wo(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ol extends vo{constructor(a){super(),Io(this,a,Do,Lo,Zo,{})}}export{ol as component};
