import{s as Zo,o as Wo,n as Y}from"../chunks/scheduler.53228c21.js";import{S as vo,i as Io,e as p,s,c as M,q as Bo,h as Go,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.9bbf7d33.js";import{C as N}from"../chunks/CodeBlock.d30a6509.js";import{E as ft}from"../chunks/ExampleCodeBlock.a8b00edf.js";import{H as F,E as Co}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.8999c127.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 N({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:Y,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 Xo(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 N({props:{code:"JTIzJTIwcGlwJTIwaW5zdGFsbCUyMGZ0ZnklMEFpbXBvcnQlMjB0b3JjaCUwQWltcG9ydCUyMG51bXB5JTIwYXMlMjBucCUwQWZyb20lMjBkaWZmdXNlcnMlMjBpbXBvcnQlMjBBdXRvTW9kZWwlMkMlMjBXYW5QaXBlbGluZSUwQWZyb20lMjBkaWZmdXNlcnMuaG9va3MuZ3JvdXBfb2ZmbG9hZGluZyUyMGltcG9ydCUyMGFwcGx5X2dyb3VwX29mZmxvYWRpbmclMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwZXhwb3J0X3RvX3ZpZGVvJTJDJTIwbG9hZF9pbWFnZSUwQWZyb20lMjB0cmFuc2Zvcm1lcnMlMjBpbXBvcnQlMjBVTVQ1RW5jb2Rlck1vZGVsJTBBJTBBdGV4dF9lbmNvZGVyJTIwJTNEJTIwVU1UNUVuY29kZXJNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyV2F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JDJTBBJTIwJTIwJTIwJTIwZ3VpZGFuY2Vfc2NhbGUlM0Q1LjAlMkMlMEEpLmZyYW1lcyU1QjAlNUQlMEFleHBvcnRfdG9fdmlkZW8ob3V0cHV0JTJDJTIwJTIyb3V0cHV0Lm1wNCUyMiUyQyUyMGZwcyUzRDE2KQ==",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:Y,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 Ro(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:[Xo]},$$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 N({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:Y,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 No(T){let a,f;return a=new N({props:{code:"aW1wb3J0JTIwbnVtcHklMjBhcyUyMG5wJTBBaW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwQXV0b2VuY29kZXJLTFdhbiUyQyUyMFdhbkFuaW1hdGVQaXBlbGluZSUwQWZyb20lMjBkaWZmdXNlcnMudXRpbHMlMjBpbXBvcnQlMjBleHBvcnRfdG9fdmlkZW8lMkMlMjBsb2FkX2ltYWdlJTJDJTIwbG9hZF92aWRlbyUwQWZyb20lMjB0cmFuc2Zvcm1lcnMlMjBpbXBvcnQlMjBDTElQVmlzaW9uTW9kZWwlMEElMEFtb2RlbF9pZCUyMCUzRCUyMCUyMldhbi1BSSUyRldhbjIuMi1BbmltYXRlLTE0Qi1EaWZmdXNlcnMlMjIlMEF2YWUlMjAlM0QlMjBBdXRvZW5jb2RlcktMV2FuLmZyb21fcHJldHJhaW5lZChtb2RlbF9pZCUyQyUyMHN1YmZvbGRlciUzRCUyMnZhZSUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQzMiklMEFwaXBlJTIwJTNEJTIwV2FuQW5pbWF0ZVBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjBtb2RlbF9pZCUyQyUyMHZhZSUzRHZhZSUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guYmZsb2F0MTYlMEEpJTBBcGlwZS50byglMjJjdWRhJTIyKSUwQSUwQSUyMyUyMExvYWQlM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WdhdGl2ZV9wcm9tcHQlMkMlMEElMjAlMjAlMjAlMjBoZWlnaHQlM0RoZWlnaHQlMkMlMEElMjAlMjAlMjAlMjB3aWR0aCUzRHdpZHRoJTJDJTBBJTIwJTIwJTIwJTIwbnVtX2ZyYW1lcyUzRDgxJTJDJTBBJTIwJTIwJTIwJTIwZ3VpZGFuY2Vfc2NhbGUlM0Q1LjAlMkMlMEElMjAlMjAlMjAlMjBtb2RlJTNEJTIyYW5pbWF0aW9uJTIyJTJDJTIwJTIwJTIzJTIwQW5pbWF0aW9uJTIwbW9kZSUyMChkZWZhdWx0KSUwQSkuZnJhbWVzJTVCMCU1RCUwQWV4cG9ydF90b192aWRlbyhvdXRwdXQlMkMlMjAlMjJhbmltYXRlZF9jaGFyYWN0ZXIubXA0JTIyJTJDJTIwZnBzJTNEMTYp",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
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> CLIPVisionModel

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,
    num_frames=<span class="hljs-number">81</span>,
    guidance_scale=<span class="hljs-number">5.0</span>,
    mode=<span class="hljs-string">&quot;animation&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">16</span>)`,wrap:!1}}),{c(){M(a.$$.fragment)},l(i){y(a.$$.fragment,i)},m(i,m){_(a,i,m),f=!0},p:Y,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 N({props:{code:"aW1wb3J0JTIwbnVtcHklMjBhcyUyMG5wJTBBaW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwQXV0b2Vu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QyUwQSUyMCUyMCUyMCUyMHBvc2VfdmlkZW8lM0Rwb3NlX3ZpZGVvJTJDJTBBJTIwJTIwJTIwJTIwZmFjZV92aWRlbyUzRGZhY2VfdmlkZW8lMkMlMEElMjAlMjAlMjAlMjBiYWNrZ3JvdW5kX3ZpZGVvJTNEYmFja2dyb3VuZF92aWRlbyUyQyUwQSUyMCUyMCUyMCUyMG1hc2tfdmlkZW8lM0RtYXNrX3ZpZGVvJTJDJTBBJTIwJTIwJTIwJTIwcHJvbXB0JTNEcHJvbXB0JTJDJTBBJTIwJTIwJTIwJTIwbmVnYXRpdmVfcHJvbXB0JTNEbmVnYXRpdmVfcHJvbXB0JTJDJTBBJTIwJTIwJTIwJTIwaGVpZ2h0JTNEaGVpZ2h0JTJDJTBBJTIwJTIwJTIwJTIwd2lkdGglM0R3aWR0aCUyQyUwQSUyMCUyMCUyMCUyMG51bV9mcmFtZXMlM0Q4MSUyQyUwQSUyMCUyMCUyMCUyMGd1aWRhbmNlX3NjYWxlJTNENS4wJTJDJTBBJTIwJTIwJTIwJTIwbW9kZSUzRCUyMnJlcGxhY2VtZW50JTIyJTJDJTIwJTIwJTIzJTIwUmVwbGFjZW1lbnQlMjBtb2RlJTBBKS5mcmFtZXMlNUIwJTVEJTBBZXhwb3J0X3RvX3ZpZGVvKG91dHB1dCUyQyUyMCUyMmNoYXJhY3Rlcl9yZXBsYWNlZC5tcDQlMjIlMkMlMjBmcHMlM0QxNik=",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
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> CLIPVisionModel

model_id = <span class="hljs-string">&quot;Wan-AI/Wan2.2-Animate-14B-Diffusers&quot;</span>
image_encoder = CLIPVisionModel.from_pretrained(model_id, subfolder=<span class="hljs-string">&quot;image_encoder&quot;</span>, torch_dtype=torch.float16)
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, image_encoder=image_encoder, 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,
    num_frames=<span class="hljs-number">81</span>,
    guidance_scale=<span class="hljs-number">5.0</span>,
    mode=<span class="hljs-string">&quot;replacement&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">16</span>)`,wrap:!1}}),{c(){M(a.$$.fragment)},l(i){y(a.$$.fragment,i)},m(i,m){_(a,i,m),f=!0},p:Y,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;return a=new N({props:{code:"aW1wb3J0JTIwbnVtcHklMjBhcyUyMG5wJTBBaW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwQXV0b2VuY29kZXJLTFdhbiUyQyUyMFdhbkFuaW1hdGVQaXBlbGluZSUwQWZyb20lMjBkaWZmdXNlcnMudXRpbHMlMjBpbXBvcnQlMjBleHBvcnRfdG9fdmlkZW8lMkMlMjBsb2FkX2ltYWdlJTJDJTIwbG9hZF92aWRlbyUwQWZyb20lMjB0cmFuc2Zvcm1lcnMlMjBpbXBvcnQlMjBDTElQVmlzaW9uTW9kZWwlMEElMEFtb2RlbF9pZCUyMCUzRCUyMCUyMldhbi1BSSUyRldhbjIuMi1BbmltYXRlLTE0Qi1EaWZmdXNlcnMlMjIlMEFpbWFnZV9lbmNvZGVyJTIwJTNEJTIwQ0xJUFZpc2lvbk1vZGVsLmZyb21fcHJldHJhaW5lZChtb2RlbF9pZCUyQyUyMHN1YmZvbGRlciUzRCUyMmltYWdlX2VuY29kZXIlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHR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U1RCUyQyUwQSkuZnJhbWVzJTVCMCU1RCUwQWV4cG9ydF90b192aWRlbyhvdXRwdXQlMkMlMjAlMjJhbmltYXRlZF9hZHZhbmNlZC5tcDQlMjIlMkMlMjBmcHMlM0QxNik=",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
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> CLIPVisionModel

model_id = <span class="hljs-string">&quot;Wan-AI/Wan2.2-Animate-14B-Diffusers&quot;</span>
image_encoder = CLIPVisionModel.from_pretrained(model_id, subfolder=<span class="hljs-string">&quot;image_encoder&quot;</span>, torch_dtype=torch.float16)
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, image_encoder=image_encoder, 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,
    num_frames=<span class="hljs-number">81</span>,
    num_inference_steps=<span class="hljs-number">50</span>,
    guidance_scale=<span class="hljs-number">5.0</span>,
    num_frames_for_temporal_guidance=<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">16</span>)`,wrap:!1}}),{c(){M(a.$$.fragment)},l(i){y(a.$$.fragment,i)},m(i,m){_(a,i,m),f=!0},p:Y,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,i,m,h,l;return a=new ht({props:{id:"Animate usage",option:"Animation mode",$$slots:{default:[No]},$$scope:{ctx:T}}}),i=new ht({props:{id:"Animate usage",option:"Replacement mode",$$slots:{default:[Yo]},$$scope:{ctx:T}}}),h=new ht({props:{id:"Animate usage",option:"Advanced options",$$slots:{default:[Eo]},$$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 N({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwZXhwb3J0X3RvX3ZpZGVvJTBBZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9lbmNvZGVyS0xXYW4lMkMlMjBXYW5QaXBlbGluZSUwQWZyb20lMjBkaWZmdXNlcnMuc2NoZWR1bGVycy5zY2hlZHVsaW5nX3VuaXBjX211bHRpc3RlcCUyMGltcG9ydCUyMFVuaVBDTXVsdGlzdGVwU2NoZWR1bGVyJTBBJTBBJTIzJTIwQXZhaWxhYmxlJTIwbW9kZWxzJTNBJTIwV2FuLUFJJTJGV2FuMi4xLVQyVi0xNEItRGlmZnVzZXJzJTJDJTIwV2FuLUFJJTJGV2FuMi4xLVQyVi0xLjNCLURpZmZ1c2VycyUwQW1vZGVsX2lkJTIwJTNEJTIwJTIyV2FuLUFJJTJGV2FuMi4xLVQyVi0xNEItRGlmZnVzZXJzJTIyJTBBdmFlJTIwJTNEJTIwQXV0b2VuY29k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b192aWRlbyhvdXRwdXQlMkMlMjAlMjJvdXRwdXQubXA0JTIyJTJDJTIwZnBzJTNEMTYp",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:Y,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 N({props:{code:"aW1wb3J0JTIwdG9yY2glMEFpbXBvcnQlMjBudW1weSUyMGFzJTIwbnAlMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwQXV0b2VuY29kZXJLTFdhbiUyQyUyMFdhbkltYWdlVG9WaWRlb1BpcGVsaW5lJTBBZnJvbSUyMGRpZmZ1c2Vycy51dGlscyUyMGltc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MCUyMCUyMG5lZ2F0aXZlX3Byb21wdCUzRG5lZ2F0aXZlX3Byb21wdCUyQyUwQSUyMCUyMCUyMCUyMGhlaWdodCUzRGhlaWdodCUyQyUwQSUyMCUyMCUyMCUyMHdpZHRoJTNEd2lkdGglMkMlMEElMjAlMjAlMjAlMjBudW1fZnJhbWVzJTNEODElMkMlMEElMjAlMjAlMjAlMjBndWlkYW5jZV9zY2FsZSUzRDUuMCUyQyUwQSkuZnJhbWVzJTVCMCU1RCUwQWV4cG9ydF90b192aWRlbyhvdXRwdXQlMkMlMjAlMjJvdXRwdXQubXA0JTIyJTJDJTIwZnBzJTNEMTYp",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:Y,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 N({props:{code:"aW1wb3J0JTIwdG9yY2glMEFpbXBvcnQlMjBQSUwuSW1hZ2UlMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwQXV0b2VuY29kZXJLTFdhbiUyQyUyMFdhblZBQ0VQaXBlbGluZSUwQWZyb20lMjBkaWZmdXNlcnMuc2NoZWR1bGVycy5zY2hlZHVsaW5nX3VuaXBjX211bHRpc3RlcCUyMGltcG9ydCUyMFVuaVBDTXVsdGlzdGVwU2NoZWR1bGVyJTBBZnJvbSUyMGRpZmZ1c2Vycy51dGlscyUyMGltcG9ydCUyMGV4cG9ydF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vJTJDJTBBJTIwJTIwJTIwJTIwbWFzayUzRG1hc2slMkMlMEElMjAlMjAlMjAlMjBwcm9tcHQlM0Rwcm9tcHQlMkMlMEElMjAlMjAlMjAlMjBuZWdhdGl2ZV9wcm9tcHQlM0RuZWdhdGl2ZV9wcm9tcHQlMkMlMEElMjAlMjAlMjAlMjBoZWlnaHQlM0RoZWlnaHQlMkMlMEElMjAlMjAlMjAlMjB3aWR0aCUzRHdpZHRoJTJDJTBBJTIwJTIwJTIwJTIwbnVtX2ZyYW1lcyUzRG51bV9mcmFtZXMlMkMlMEElMjAlMjAlMjAlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNEMzAlMkMlMEElMjAlMjAlMjAlMjBndWlkYW5jZV9zY2FsZSUzRDUuMCUyQyUwQSUyMCUyMCUyMCUyMGdlbmVyYXRvciUzRHRvcmNoLkdlbmVyYXRvcigpLm1hbnVhbF9zZWVkKDQyKSUyQyUwQSkuZnJhbWVzJTVCMCU1RCUwQWV4cG9ydF90b192aWRlbyhvdXRwdXQlMkMlMjAlMjJvdXRwdXQubXA0JTIyJTJDJTIwZnBzJTNEMTYp",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:Y,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 N({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwZXhwb3J0X3RvX3ZpZGVvJTJDJTIwbG9hZF92aWRlbyUwQWZyb20lMjBkaWZmdXNlcnMlMjBpbXBvcnQlMjBBdXRvZW5jb2RlcktMV2FuJTJDJTIwV2FuVmlkZW9Ub1ZpZGVvUGlwZWxpbmUlMEFmcm9tJTIwZGlmZnVzZXJzLnNjaGVkdWxlcnMuc2NoZWR1bGluZ191bmlwY19tdWx0aXN0ZXAlMjBpbXBvcnQlMjBVbmlQQ011bHRpc3RlcFNjaGVkdWxlciUwQSUwQSUyMyUyMEF2YWlsYWJsZSUyMG1vZGVscyUzQSUyMFdhbi1BSSUyRldhbjIuMS1UMlYtMTRCLURpZm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UzRDQ4MCUyQyUwQSUyMCUyMCUyMCUyMHdpZHRoJTNENzIwJTJDJTBBJTIwJTIwJTIwJTIwZ3VpZGFuY2Vfc2NhbGUlM0Q1LjAlMkMlMEElMjAlMjAlMjAlMjBzdHJlbmd0aCUzRDAuNyUyQyUwQSkuZnJhbWVzJTVCMCU1RCUwQWV4cG9ydF90b192aWRlbyhvdXRwdXQlMkMlMjAlMjJvdXRwdXQubXA0JTIyJTJDJTIwZnBzJTNEMTYp",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:Y,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 N({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:Y,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:",Bt,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>',Gt,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,Bs='<a href="https://huggingface.co/papers/2509.14055" rel="nofollow">Wan-Animate</a> by the Wan Team.',xt,Ie,Gs="<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>",Xt,Be,ks='The project page: <a href="https://humanaigc.github.io/wan-animate" rel="nofollow">https://humanaigc.github.io/wan-animate</a>',Rt,Ge,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:",Nt,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>",Yt,xe,Et,Xe,Xs="Before using the pipeline, you need to preprocess your reference video to extract:",At,Re,Rs="<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:",$t,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>",zt,te,Ns="<p>The preprocessing tools are available in the original Wan-Animate repository. Integration of these preprocessing steps into Diffusers is planned for a future release.</p>",St,Ne,Ys="The example below demonstrates how to use the Wan-Animate pipeline:",Pt,ae,Lt,Ye,qt,Ee,Es="<li><strong>mode</strong>: Choose between <code>&quot;animation&quot;</code> (default) or <code>&quot;replacement&quot;</code></li> <li><strong>num_frames_for_temporal_guidance</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</li> <li><strong>num_frames</strong>: Total number of frames to generate. Should be divisible by <code>vae_scale_factor_temporal</code> (default: 4)</li>",Dt,Ae,Kt,B,He,Zn,As='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,$e,Wn,Hs="Show example code",ba,ze,wa,Se,vn,$s='<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,Pe,In,zs="Show example code",Ta,Le,Ua,Bn,Ss='<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,Gn,Ps="<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.",Ba,Xn,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.).`,Ga,E,Ke,ka,Rn,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,Xa,Qn,to="Pipeline for image-to-video generation using Wan.",Ra,Nn,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,A,tn,Qa,Yn,so="The call function to the pipeline for generation.",Na,le,Ya,ie,an,Ea,En,oo="Encodes the prompt into text encoder hidden states.",aa,sn,sa,X,on,Aa,An,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.).`,$a,H,ln,za,$n,ro="The call function to the pipeline for generation.",Sa,re,Pa,de,rn,La,zn,po="Encodes the prompt into text encoder hidden states.",oa,dn,la,R,pn,qa,Sn,co="Pipeline for video-to-video generation using Wan.",Da,Pn,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,$,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,z,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,S,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:[Ro]},$$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:[Ao]},$$scope:{ctx:T}}}),Ye=new F({props:{title:"Key Parameters",local:"key-parameters",headingTag:"h4"}}),Ae=new F({props:{title:"Notes",local:"notes",headingTag:"h2"}}),ze=new N({props:{code:"JTIzJTIwcGlwJTIwaW5zdGFsbCUyMGZ0ZnklMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjBkaWZmdXNlcnMlMjBpbXBvcnQl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bSUyMGNvbXBvc2l0aW9uJTJDJTIwZnJvbnQlMjB2aWV3JTJDJTIwbG93JTIwYW5nbGUlMkMlMjB3aXRoJTIwZGVwdGglMjBvZiUyMGZpZWxkLiUwQSUyMiUyMiUyMiUwQSUwQW91dHB1dCUyMCUzRCUyMHBpcGVsaW5lKCUwQSUyMCUyMCUyMCUyMHByb21wdCUzRHByb21wdCUyQyUwQSUyMCUyMCUyMCUyMG51bV9mcmFtZXMlM0Q4MSUyQyUwQSUyMCUyMCUyMCUyMGd1aWRhbmNlX3NjYWxlJTNENS4wJTJDJTBBKS5mcmFtZXMlNUIwJTVEJTBBZXhwb3J0X3RvX3ZpZGVvKG91dHB1dCUyQyUyMCUyMm91dHB1dC5tcDQlMjIlMkMlMjBmcHMlM0QxNik=",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 N({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:[$o]},$$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:[zo]},$$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:[So]},$$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:[Po]},$$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,Bt=s(),Ue=p("ul"),Ue.innerHTML=Ws,Gt=s(),je=p("p"),je.innerHTML=vs,kt=s(),Ze=p("p"),Ze.textContent=Is,Vt=Bo(`
</hfoption>
</hfoptions>
`),M(We.$$.fragment),Ct=s(),ve=p("p"),ve.innerHTML=Bs,xt=s(),Ie=p("p"),Ie.innerHTML=Gs,Xt=s(),Be=p("p"),Be.innerHTML=ks,Rt=s(),Ge=p("p"),Ge.innerHTML=Vs,Ft=s(),M(ke.$$.fragment),Qt=s(),Ve=p("p"),Ve.textContent=Cs,Nt=s(),Ce=p("ol"),Ce.innerHTML=xs,Yt=s(),M(xe.$$.fragment),Et=s(),Xe=p("p"),Xe.textContent=Xs,At=s(),Re=p("ul"),Re.innerHTML=Rs,Ht=s(),Fe=p("p"),Fe.textContent=Fs,$t=s(),Qe=p("ul"),Qe.innerHTML=Qs,zt=s(),te=p("blockquote"),te.innerHTML=Ns,St=s(),Ne=p("p"),Ne.textContent=Ys,Pt=s(),M(ae.$$.fragment),Lt=s(),M(Ye.$$.fragment),qt=s(),Ee=p("ul"),Ee.innerHTML=Es,Dt=s(),M(Ae.$$.fragment),Kt=s(),B=p("ul"),He=p("li"),Zn=p("p"),Zn.innerHTML=As,_a=s(),$e=p("details"),Wn=p("summary"),Wn.textContent=Hs,ba=s(),M(ze.$$.fragment),wa=s(),Se=p("li"),vn=p("p"),vn.innerHTML=$s,Ja=s(),Pe=p("details"),In=p("summary"),In.textContent=zs,Ta=s(),M(Le.$$.fragment),Ua=s(),Bn=p("li"),Bn.innerHTML=Ss,ja=s(),Gn=p("li"),Gn.innerHTML=Ps,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,Ba=s(),Xn=p("p"),Xn.innerHTML=Os,Ga=s(),E=p("div"),M(Ke.$$.fragment),ka=s(),Rn=p("p"),Rn.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),Xa=s(),Qn=p("p"),Qn.textContent=to,Ra=s(),Nn=p("p"),Nn.innerHTML=ao,Fa=s(),A=p("div"),M(tn.$$.fragment),Qa=s(),Yn=p("p"),Yn.textContent=so,Na=s(),M(le.$$.fragment),Ya=s(),ie=p("div"),M(an.$$.fragment),Ea=s(),En=p("p"),En.textContent=oo,aa=s(),M(sn.$$.fragment),sa=s(),X=p("div"),M(on.$$.fragment),Aa=s(),An=p("p"),An.textContent=lo,Ha=s(),Hn=p("p"),Hn.innerHTML=io,$a=s(),H=p("div"),M(ln.$$.fragment),za=s(),$n=p("p"),$n.textContent=ro,Sa=s(),M(re.$$.fragment),Pa=s(),de=p("div"),M(rn.$$.fragment),La=s(),zn=p("p"),zn.textContent=po,oa=s(),M(dn.$$.fragment),la=s(),R=p("div"),M(pn.$$.fragment),qa=s(),Sn=p("p"),Sn.textContent=co,Da=s(),Pn=p("p"),Pn.innerHTML=mo,Ka=s(),$=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(),z=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(),S=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=Go("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),Bt=o(e),Ue=c(e,"UL",{"data-svelte-h":!0}),u(Ue)!=="svelte-1yzklw7"&&(Ue.innerHTML=Ws),Gt=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=Bs),xt=o(e),Ie=c(e,"P",{"data-svelte-h":!0}),u(Ie)!=="svelte-6ojj1v"&&(Ie.innerHTML=Gs),Xt=o(e),Be=c(e,"P",{"data-svelte-h":!0}),u(Be)!=="svelte-yhsjny"&&(Be.innerHTML=ks),Rt=o(e),Ge=c(e,"P",{"data-svelte-h":!0}),u(Ge)!=="svelte-itld7h"&&(Ge.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),Nt=o(e),Ce=c(e,"OL",{"data-svelte-h":!0}),u(Ce)!=="svelte-1hdysu2"&&(Ce.innerHTML=xs),Yt=o(e),y(xe.$$.fragment,e),Et=o(e),Xe=c(e,"P",{"data-svelte-h":!0}),u(Xe)!=="svelte-zj5oon"&&(Xe.textContent=Xs),At=o(e),Re=c(e,"UL",{"data-svelte-h":!0}),u(Re)!=="svelte-15e2qlr"&&(Re.innerHTML=Rs),Ht=o(e),Fe=c(e,"P",{"data-svelte-h":!0}),u(Fe)!=="svelte-1y05jmh"&&(Fe.textContent=Fs),$t=o(e),Qe=c(e,"UL",{"data-svelte-h":!0}),u(Qe)!=="svelte-1q1m9mx"&&(Qe.innerHTML=Qs),zt=o(e),te=c(e,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),u(te)!=="svelte-18w1ya8"&&(te.innerHTML=Ns),St=o(e),Ne=c(e,"P",{"data-svelte-h":!0}),u(Ne)!=="svelte-cropwm"&&(Ne.textContent=Ys),Pt=o(e),y(ae.$$.fragment,e),Lt=o(e),y(Ye.$$.fragment,e),qt=o(e),Ee=c(e,"UL",{"data-svelte-h":!0}),u(Ee)!=="svelte-8x8j6d"&&(Ee.innerHTML=Es),Dt=o(e),y(Ae.$$.fragment,e),Kt=o(e),B=c(e,"UL",{});var G=W(B);He=c(G,"LI",{});var wn=W(He);Zn=c(wn,"P",{"data-svelte-h":!0}),u(Zn)!=="svelte-1qr0hkb"&&(Zn.innerHTML=As),_a=o(wn),$e=c(wn,"DETAILS",{});var Jn=W($e);Wn=c(Jn,"SUMMARY",{"data-svelte-h":!0}),u(Wn)!=="svelte-1m0l1gk"&&(Wn.textContent=Hs),ba=o(Jn),y(ze.$$.fragment,Jn),Jn.forEach(n),wn.forEach(n),wa=o(G),Se=c(G,"LI",{});var Tn=W(Se);vn=c(Tn,"P",{"data-svelte-h":!0}),u(vn)!=="svelte-1u8xg1f"&&(vn.innerHTML=$s),Ja=o(Tn),Pe=c(Tn,"DETAILS",{});var Un=W(Pe);In=c(Un,"SUMMARY",{"data-svelte-h":!0}),u(In)!=="svelte-1m0l1gk"&&(In.textContent=zs),Ta=o(Un),y(Le.$$.fragment,Un),Un.forEach(n),Tn.forEach(n),Ua=o(G),Bn=c(G,"LI",{"data-svelte-h":!0}),u(Bn)!=="svelte-1dr923m"&&(Bn.innerHTML=Ss),ja=o(G),Gn=c(G,"LI",{"data-svelte-h":!0}),u(Gn)!=="svelte-154noqv"&&(Gn.innerHTML=Ps),Za=o(G),kn=c(G,"LI",{"data-svelte-h":!0}),u(kn)!=="svelte-ck8fz4"&&(kn.innerHTML=Ls),Wa=o(G),Vn=c(G,"LI",{"data-svelte-h":!0}),u(Vn)!=="svelte-1lhnjsl"&&(Vn.innerHTML=qs),va=o(G),Cn=c(G,"LI",{"data-svelte-h":!0}),u(Cn)!=="svelte-1kfqgcj"&&(Cn.innerHTML=Ds),G.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),Ba=o(Q),Xn=c(Q,"P",{"data-svelte-h":!0}),u(Xn)!=="svelte-496sm0"&&(Xn.innerHTML=Os),Ga=o(Q),E=c(Q,"DIV",{class:!0});var K=W(E);y(Ke.$$.fragment,K),ka=o(K),Rn=c(K,"P",{"data-svelte-h":!0}),u(Rn)!=="svelte-50j04k"&&(Rn.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 P=W(x);y(nn.$$.fragment,P),Xa=o(P),Qn=c(P,"P",{"data-svelte-h":!0}),u(Qn)!=="svelte-1u5shki"&&(Qn.textContent=to),Ra=o(P),Nn=c(P,"P",{"data-svelte-h":!0}),u(Nn)!=="svelte-496sm0"&&(Nn.innerHTML=ao),Fa=o(P),A=c(P,"DIV",{class:!0});var rt=W(A);y(tn.$$.fragment,rt),Qa=o(rt),Yn=c(rt,"P",{"data-svelte-h":!0}),u(Yn)!=="svelte-50j04k"&&(Yn.textContent=so),Na=o(rt),y(le.$$.fragment,rt),rt.forEach(n),Ya=o(P),ie=c(P,"DIV",{class:!0});var ua=W(ie);y(an.$$.fragment,ua),Ea=o(ua),En=c(ua,"P",{"data-svelte-h":!0}),u(En)!=="svelte-16q0ax1"&&(En.textContent=oo),ua.forEach(n),P.forEach(n),aa=o(e),y(sn.$$.fragment,e),sa=o(e),X=c(e,"DIV",{class:!0});var L=W(X);y(on.$$.fragment,L),Aa=o(L),An=c(L,"P",{"data-svelte-h":!0}),u(An)!=="svelte-14hxha6"&&(An.textContent=lo),Ha=o(L),Hn=c(L,"P",{"data-svelte-h":!0}),u(Hn)!=="svelte-496sm0"&&(Hn.innerHTML=io),$a=o(L),H=c(L,"DIV",{class:!0});var dt=W(H);y(ln.$$.fragment,dt),za=o(dt),$n=c(dt,"P",{"data-svelte-h":!0}),u($n)!=="svelte-50j04k"&&($n.textContent=ro),Sa=o(dt),y(re.$$.fragment,dt),dt.forEach(n),Pa=o(L),de=c(L,"DIV",{class:!0});var ga=W(de);y(rn.$$.fragment,ga),La=o(ga),zn=c(ga,"P",{"data-svelte-h":!0}),u(zn)!=="svelte-16q0ax1"&&(zn.textContent=po),ga.forEach(n),L.forEach(n),oa=o(e),y(dn.$$.fragment,e),la=o(e),R=c(e,"DIV",{class:!0});var q=W(R);y(pn.$$.fragment,q),qa=o(q),Sn=c(q,"P",{"data-svelte-h":!0}),u(Sn)!=="svelte-t5jwqk"&&(Sn.textContent=co),Da=o(q),Pn=c(q,"P",{"data-svelte-h":!0}),u(Pn)!=="svelte-496sm0"&&(Pn.innerHTML=mo),Ka=o(q),$=c(q,"DIV",{class:!0});var pt=W($);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),z=c(I,"DIV",{class:!0});var ct=W(z);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),S=c(I,"DIV",{class:!0});var mt=W(S);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(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(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(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(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(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(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(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(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(S,"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.head,a),r(e,f,t),r(e,i,t),r(e,m,t),r(e,h,t),r(e,g,t),_(U,e,t),r(e,j,t),r(e,V,t),r(e,Mt,t),r(e,ue,t),r(e,yt,t),r(e,ge,t),r(e,_t,t),r(e,fe,t),r(e,bt,t),r(e,Me,t),r(e,wt,t),r(e,O,t),r(e,Jt,t),_(ye,e,t),r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A,null),d(A,Qa),d(A,Yn),d(A,Na),_(le,A,null),d(x,Ya),d(x,ie),_(an,ie,null),d(ie,Ea),d(ie,En),r(e,aa,t),_(sn,e,t),r(e,sa,t),r(e,X,t),_(on,X,null),d(X,Aa),d(X,An),d(X,Ha),d(X,Hn),d(X,$a),d(X,H),_(ln,H,null),d(H,za),d(H,$n),d(H,Sa),_(re,H,null),d(X,Pa),d(X,de),_(rn,de,null),d(de,La),d(de,zn),r(e,oa,t),_(dn,e,t),r(e,la,t),r(e,R,t),_(pn,R,null),d(R,qa),d(R,Sn),d(R,Da),d(R,Pn),d(R,Ka),d(R,$),_(cn,$,null),d($,Oa),d($,Ln),d($,es),_(pe,$,null),d(R,ns),d(R,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,z),_(gn,z,null),d(z,ps),d(z,at),d(z,cs),_(me,z,null),d(Z,ms),d(Z,he),_(fn,he,null),d(he,hs),d(he,st),d(Z,us),d(Z,S),_(Mn,S,null),d(S,gs),d(S,ot),d(S,fs),d(S,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 G={};t&2&&(G.$$scope={dirty:t,ctx:e}),ee.$set(G);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(Ye.$$.fragment,e),b(Ae.$$.fragment,e),b(ze.$$.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(Ye.$$.fragment,e),w(Ae.$$.fragment,e),w(ze.$$.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(Bt),n(Ue),n(Gt),n(je),n(kt),n(Ze),n(Vt),n(Ct),n(ve),n(xt),n(Ie),n(Xt),n(Be),n(Rt),n(Ge),n(Ft),n(Qt),n(Ve),n(Nt),n(Ce),n(Yt),n(Et),n(Xe),n(At),n(Re),n(Ht),n(Fe),n($t),n(Qe),n(zt),n(te),n(St),n(Ne),n(Pt),n(Lt),n(qt),n(Ee),n(Dt),n(Kt),n(B),n(Ot),n(ea),n(C),n(na),n(ta),n(x),n(aa),n(sa),n(X),n(oa),n(la),n(R),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(Ye,e),J(Ae,e),J(ze),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};
