Buckets:
| <meta charset="utf-8" /><meta name="hf:doc:metadata" content="{"title":"Wan-Animate-2","local":"wan-animate-2","sections":[{"title":"WanAnimate2ModularPipeline","local":"diffusers.WanAnimate2ModularPipeline","sections":[],"depth":2},{"title":"WanAnimate2DistilledModularPipeline","local":"diffusers.WanAnimate2DistilledModularPipeline","sections":[],"depth":2},{"title":"WanAnimate2Blocks","local":"diffusers.WanAnimate2Blocks","sections":[],"depth":2},{"title":"WanAnimate2DistilledBlocks","local":"diffusers.WanAnimate2DistilledBlocks","sections":[],"depth":2}],"depth":1}"/> | |
| <link href="/docs/diffusers/v0.43.0/en/_app/immutable/entry/start.1gaXe03k.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/v0.43.0/en/_app/immutable/chunks/BObs6oQO.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/v0.43.0/en/_app/immutable/chunks/DPnyVmXs.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/v0.43.0/en/_app/immutable/entry/app.BwdYRbCn.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/v0.43.0/en/_app/immutable/chunks/DSGUT_OW.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/v0.43.0/en/_app/immutable/chunks/C045MWWx.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/v0.43.0/en/_app/immutable/chunks/6tuJ3nyi.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/v0.43.0/en/_app/immutable/chunks/DsnmJJEf.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/v0.43.0/en/_app/immutable/nodes/0.CornNeQR.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/v0.43.0/en/_app/immutable/chunks/IaDvMxLQ.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/v0.43.0/en/_app/immutable/nodes/258.6JqFTll0.js" rel="modulepreload"> | |
| <link href="/docs/diffusers/v0.43.0/en/_app/immutable/chunks/bKdwVYpU.js" rel="modulepreload"> | |
| <!--1nkjp63--><meta name="hf:doc:metadata" content="{"title":"Wan-Animate-2","local":"wan-animate-2","sections":[{"title":"WanAnimate2ModularPipeline","local":"diffusers.WanAnimate2ModularPipeline","sections":[],"depth":2},{"title":"WanAnimate2DistilledModularPipeline","local":"diffusers.WanAnimate2DistilledModularPipeline","sections":[],"depth":2},{"title":"WanAnimate2Blocks","local":"diffusers.WanAnimate2Blocks","sections":[],"depth":2},{"title":"WanAnimate2DistilledBlocks","local":"diffusers.WanAnimate2DistilledBlocks","sections":[],"depth":2}],"depth":1}"/><!----> | |
| <link href="/docs/diffusers/v0.43.0/en/_app/immutable/assets/0.tn0RQdqM.css" rel="modulepreload"> <!--[--><!--[0--><!--[--><!--[0--><!--[--><p></p> <!--[0--><h1 class="relative group"><a id="wan-animate-2" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#wan-animate-2"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->Wan-Animate-2<!----></span></h1><!--]--><!----> <p><a href="https://github.com/Wan-Video/Wan2.2" rel="nofollow">Wan-Animate-2</a> của nhóm Alibaba Wan Team tạo chuyển động cho một hình ảnh nhân vật tham chiếu bằng chuyển động từ một video điều khiển. Video điều khiển được xử lý theo các đoạn có độ dài cố định: mỗi đoạn chạy một lượt trích xuất tham chiếu để lưu bộ nhớ đệm K/V của đoạn điều khiển trong mọi lớp transformer, khử nhiễu dựa trên bộ nhớ đệm đó, và được giải mã ngay trong vòng lặp vì đoạn tiếp theo phụ thuộc vào các khung hình đuôi đã được giải mã của đoạn trước.</p> <p>Có hai preset khả dụng: checkpoint cơ bản lấy mẫu với classifier-free guidance, và checkpoint distilled lấy mẫu trong vài bước mà không có nó (guider của nó được cố định ở <code>guidance_scale=1.0</code>).</p> <div class="code-block relative "><div class="absolute top-2.5 right-4"><button class="inline-flex items-center relative text-sm focus:text-green-500 cursor-pointer focus:outline-none transition duration-200 ease-in-out opacity-0 mx-0.5 text-gray-600 " title="code excerpt" type="button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M28,10V28H10V10H28m0-2H10a2,2,0,0,0-2,2V28a2,2,0,0,0,2,2H28a2,2,0,0,0,2-2V10a2,2,0,0,0-2-2Z" transform="translate(0)"></path><path d="M4,18H2V4A2,2,0,0,1,4,2H18V4H4Z" transform="translate(0)"></path><rect fill="none" width="32" height="32"></rect></svg><!----> <div class=" absolute pointer-events-none transition-opacity bg-black text-white py-1 px-2 leading-tight rounded font-normal shadow left-1/2 top-full transform -translate-x-1/2 translate-y-2 opacity-0 "><div class="absolute bottom-full left-1/2 transform -translate-x-1/2 w-0 h-0 border-black border-4 border-t-0" style="border-left-color: transparent; border-right-color: transparent;"></div> Đã sao chép</div><!----></button><!----></div> <pre class="language-python "><!----><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> ModularPipeline | |
| <span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> export_to_video, load_image, load_video | |
| pipe = ModularPipeline.from_pretrained(<span class="hljs-string">"Wan-AI/Wan2.2-Animate-2-14B-Diffusers"</span>) | |
| pipe.load_components(dtype=torch.bfloat16) | |
| <span class="hljs-comment"># The transformer weights and the per-segment reference KV cache do not co-reside on one 80 GB</span> | |
| <span class="hljs-comment"># card at the default resolution, so stream the transformer's blocks. Compiling the blocks is</span> | |
| <span class="hljs-comment"># required as the in-context attention runs on the flex backend</span> | |
| pipe.transformer.enable_group_offload( | |
| onload_device=torch.device(<span class="hljs-string">"cuda"</span>), | |
| offload_device=torch.device(<span class="hljs-string">"cpu"</span>), | |
| offload_type=<span class="hljs-string">"block_level"</span>, | |
| use_stream=<span class="hljs-literal">True</span>, | |
| ) | |
| pipe.text_encoder.to(<span class="hljs-string">"cuda"</span>) <span class="hljs-comment"># or "mps", "xpu", "cpu"</span> | |
| pipe.image_encoder.to(<span class="hljs-string">"cuda"</span>) | |
| pipe.vae.to(<span class="hljs-string">"cuda"</span>) | |
| pipe.transformer.compile_repeated_blocks(fullgraph=<span class="hljs-literal">False</span>) | |
| <span class="hljs-comment"># The first demo from the official repository: https://github.com/Wan-Video/Wan-Animate-2</span> | |
| demo = <span class="hljs-string">"https://raw.githubusercontent.com/Wan-Video/Wan-Animate-2/main/examples/demo1"</span> | |
| image = load_image(<span class="hljs-string">f"<span class="hljs-subst">{demo}</span>/reference.png"</span>) | |
| driving_video, driving_video_fps = load_video(<span class="hljs-string">f"<span class="hljs-subst">{demo}</span>/template.mp4"</span>, return_fps=<span class="hljs-literal">True</span>) | |
| prompt = <span class="hljs-string">"人物外观描述:一只银灰色虎斑纹的小猫,拥有圆润的脸庞、竖立的耳朵和巨大的圆形眼睛。它身穿一套深蓝色的制服套装,包括一件带有金色纽扣的西装外套和一条百褶裙。外套里面搭配着白色衬衫,领口处系着一个红色的蝴蝶结,袖口露出白色的衬衫边缘。背景描述:背景为纯白色,光线均匀明亮,无其他杂物或装饰。"</span> | |
| videos = pipe( | |
| image=image, | |
| driving_video=driving_video, | |
| driving_video_fps=driving_video_fps, | |
| prompt=prompt, | |
| output=<span class="hljs-string">"videos"</span>, | |
| ) | |
| export_to_video(videos[<span class="hljs-number">0</span>], <span class="hljs-string">"output.mp4"</span>, fps=<span class="hljs-number">24</span>)<!----></pre></div><!----> <p>Đối với checkpoint đã distilled, hãy nạp <code>Wan-AI/Wan2.2-Animate-2-14B-Distilled-Diffusers</code> theo cách tương tự — không có gì khác thay đổi. Mỗi preset mang theo các giá trị mặc định riêng cho quá trình sampling (40 bước cho checkpoint gốc, 10 bước cho checkpoint distilled), và không có đối số <code>guidance_scale</code> ở bất kỳ đâu: guidance được quản lý bởi thành phần guider của pipeline (classifier-free guidance ở mức 3.0 cho preset gốc, bị tắt cho preset distilled).</p> <p><code>height</code> và <code>width</code> (mặc định là 800 và 640) xác định <em>khu vực</em> mục tiêu của video được tạo ra; kích thước khung hình thực tế sẽ giữ nguyên tỷ lệ khung hình của hình ảnh tham chiếu, và các khung hình điều khiển sẽ được letterbox để khớp với kích thước đó. Các đầu vào đã có kích thước letterbox đúng như mục tiêu sẽ đi qua bước tiền xử lý mà không bị thay đổi, do đó tiền xử lý cũng có thể được thực hiện hoàn toàn bên ngoài pipeline.</p> <!--[1--><h2 class="relative group"><a id="diffusers.WanAnimate2ModularPipeline" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#diffusers.WanAnimate2ModularPipeline"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->WanAnimate2ModularPipeline<!----></span></h2><!--]--><!----> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><div><span class="group flex space-x-1.5 items-center text-gray-800 bg-gradient-to-r rounded-tr-lg -mt-4 -ml-4 pt-3 px-2.5" id="diffusers.WanAnimate2ModularPipeline"><!----><h3 class="!m-0"><span class="flex-1 break-all md:text-lg bg-gradient-to-r px-2.5 py-1.5 rounded-xl from-indigo-50/70 to-white dark:from-gray-900 dark:to-gray-950 dark:text-indigo-300 text-indigo-700"><svg class="mr-1.5 text-indigo-500 inline-block -mt-0.5" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width=".8em" height=".8em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path class="uim-quaternary" d="M20.23 7.24L12 12L3.77 7.24a1.98 1.98 0 0 1 .7-.71L11 2.76c.62-.35 1.38-.35 2 0l6.53 3.77c.29.173.531.418.7.71z" opacity=".25" fill="currentColor"></path><path class="uim-tertiary" d="M12 12v9.5a2.09 2.09 0 0 1-.91-.21L4.5 17.48a2.003 2.003 0 0 1-1-1.73v-7.5a2.06 2.06 0 0 1 .27-1.01L12 12z" opacity=".5" fill="currentColor"></path><path class="uim-primary" d="M20.5 8.25v7.5a2.003 2.003 0 0 1-1 1.73l-6.62 3.82c-.275.13-.576.198-.88.2V12l8.23-4.76c.175.308.268.656.27 1.01z" fill="currentColor"></path></svg><span class="font-light">lớp</span> <span class="font-medium">diffusers.</span><span class="font-semibold">WanAnimate2ModularPipeline</span></span></h3><!----> <a id="diffusers.WanAnimate2ModularPipeline" class="header-link invisible with-hover:group-hover:visible pr-2" href="#diffusers.WanAnimate2ModularPipeline"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></a> <!--[0--><a class="!ml-auto !text-gray-400 !no-underline text-sm flex items-center" href="https://github.com/huggingface/diffusers/blob/v0.43.0/src/diffusers/modular_pipelines/wan_animate_2/modular_pipeline.py#L23" target="_blank"><span><</span> <span class="hidden md:block mx-0.5 hover:!underline">source</span> <span>></span></a><!--]--></span> <!--[0--><p class="font-mono text-xs md:text-sm !leading-relaxed !my-6"><span>(</span> <!--[--><span class="comma cursor-default"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">blocks<span class="opacity-60">: diffusers.modular_pipelines.modular_pipeline.ModularPipelineBlocks | None = None</span></span></span><span class="comma cursor-default"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">pretrained_model_name_or_path<span class="opacity-60">: str | os.PathLike | None = None</span></span></span><span class="comma cursor-default"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">components_manager<span class="opacity-60">: diffusers.modular_pipelines.components_manager.ComponentsManager | None = None</span></span></span><span class="comma cursor-default"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">collection<span class="opacity-60">: str | None = None</span></span></span><span class="comma cursor-default"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">workflow<span class="opacity-60">: str | None = None</span></span></span><span class="comma cursor-default"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">modular_config_dict<span class="opacity-60">: dict[str, typing.Any] | None = None</span></span></span><span class="comma cursor-default"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">config_dict<span class="opacity-60">: dict[str, typing.Any] | None = None</span></span></span><span class="comma cursor-default"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">**kwargs<span class="opacity-60"></span></span></span><!--]--> <span>)</span> <!--[-1--><!--]--></p><!--]--> <div class="!mb-10 relative docstring-details "><!--[-1--><!--]--> <!--[-1--><!--]--> <!--[-1--><!--]--> <!--[-1--><!--]--> <!--[-1--><!--]--></div></div><!----> <p>Một ModularPipeline cho hoạt hình nhân vật Wan-Animate-2.</p></div> <!--[1--><h2 class="relative group"><a id="diffusers.WanAnimate2DistilledModularPipeline" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#diffusers.WanAnimate2DistilledModularPipeline"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->WanAnimate2DistilledModularPipeline<!----></span></h2><!--]--><!----> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><div><span class="group flex space-x-1.5 items-center text-gray-800 bg-gradient-to-r rounded-tr-lg -mt-4 -ml-4 pt-3 px-2.5" id="diffusers.WanAnimate2DistilledModularPipeline"><!----><h3 class="!m-0"><span class="flex-1 break-all md:text-lg bg-gradient-to-r px-2.5 py-1.5 rounded-xl from-indigo-50/70 to-white dark:from-gray-900 dark:to-gray-950 dark:text-indigo-300 text-indigo-700"><svg class="mr-1.5 text-indigo-500 inline-block -mt-0.5" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width=".8em" height=".8em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path class="uim-quaternary" d="M20.23 7.24L12 12L3.77 7.24a1.98 1.98 0 0 1 .7-.71L11 2.76c.62-.35 1.38-.35 2 0l6.53 3.77c.29.173.531.418.7.71z" opacity=".25" fill="currentColor"></path><path class="uim-tertiary" d="M12 12v9.5a2.09 2.09 0 0 1-.91-.21L4.5 17.48a2.003 2.003 0 0 1-1-1.73v-7.5a2.06 2.06 0 0 1 .27-1.01L12 12z" opacity=".5" fill="currentColor"></path><path class="uim-primary" d="M20.5 8.25v7.5a2.003 2.003 0 0 1-1 1.73l-6.62 3.82c-.275.13-.576.198-.88.2V12l8.23-4.76c.175.308.268.656.27 1.01z" fill="currentColor"></path></svg><span class="font-light">lớp</span> <span class="font-medium">diffusers.</span><span class="font-semibold">WanAnimate2DistilledModularPipeline</span></span></h3><!----> <a id="diffusers.WanAnimate2DistilledModularPipeline" class="header-link invisible with-hover:group-hover:visible pr-2" href="#diffusers.WanAnimate2DistilledModularPipeline"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></a> <!--[0--><a class="!ml-auto !text-gray-400 !no-underline text-sm flex items-center" href="https://github.com/huggingface/diffusers/blob/v0.43.0/src/diffusers/modular_pipelines/wan_animate_2/modular_pipeline.py#L62" target="_blank"><span><</span> <span class="hidden md:block mx-0.5 hover:!underline">source</span> <span>></span></a><!--]--></span> <!--[0--><p class="font-mono text-xs md:text-sm !leading-relaxed !my-6"><span>(</span> <!--[--><span class="comma cursor-default"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">blocks<span class="opacity-60">: diffusers.modular_pipelines.modular_pipeline.ModularPipelineBlocks | None = None</span></span></span><span class="comma cursor-default"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">pretrained_model_name_or_path<span class="opacity-60">: str | os.PathLike | None = None</span></span></span><span class="comma cursor-default"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">components_manager<span class="opacity-60">: diffusers.modular_pipelines.components_manager.ComponentsManager | None = None</span></span></span><span class="comma cursor-default"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">collection<span class="opacity-60">: str | None = None</span></span></span><span class="comma cursor-default"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">workflow<span class="opacity-60">: str | None = None</span></span></span><span class="comma cursor-default"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">modular_config_dict<span class="opacity-60">: dict[str, typing.Any] | None = None</span></span></span><span class="comma cursor-default"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">config_dict<span class="opacity-60">: dict[str, typing.Any] | None = None</span></span></span><span class="comma cursor-default"><span class="rounded hover:bg-black hover:text-white dark:hover:bg-white dark:hover:text-black">**kwargs<span class="opacity-60"></span></span></span><!--]--> <span>)</span> <!--[-1--><!--]--></p><!--]--> <div class="!mb-10 relative docstring-details "><!--[-1--><!--]--> <!--[-1--><!--]--> <!--[-1--><!--]--> <!--[-1--><!--]--> <!--[-1--><!--]--></div></div><!----> <p>ModularPipeline cho mô hình Wan-Animate-2 đã được chưng cất, cho phép lấy mẫu trong vài bước mà không cần sử dụng classifier-free guidance.</p></div> <!--[1--><h2 class="relative group"><a id="diffusers.WanAnimate2Blocks" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#diffusers.WanAnimate2Blocks"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->WanAnimate2Blocks<!----></span></h2><!--]--><!----> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><div><span class="group flex space-x-1.5 items-center text-gray-800 bg-gradient-to-r rounded-tr-lg -mt-4 -ml-4 pt-3 px-2.5" id="diffusers.WanAnimate2Blocks"><!----><h3 class="!m-0"><span class="flex-1 break-all md:text-lg bg-gradient-to-r px-2.5 py-1.5 rounded-xl from-indigo-50/70 to-white dark:from-gray-900 dark:to-gray-950 dark:text-indigo-300 text-indigo-700"><svg class="mr-1.5 text-indigo-500 inline-block -mt-0.5" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width=".8em" height=".8em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path class="uim-quaternary" d="M20.23 7.24L12 12L3.77 7.24a1.98 1.98 0 0 1 .7-.71L11 2.76c.62-.35 1.38-.35 2 0l6.53 3.77c.29.173.531.418.7.71z" opacity=".25" fill="currentColor"></path><path class="uim-tertiary" d="M12 12v9.5a2.09 2.09 0 0 1-.91-.21L4.5 17.48a2.003 2.003 0 0 1-1-1.73v-7.5a2.06 2.06 0 0 1 .27-1.01L12 12z" opacity=".5" fill="currentColor"></path><path class="uim-primary" d="M20.5 8.25v7.5a2.003 2.003 0 0 1-1 1.73l-6.62 3.82c-.275.13-.576.198-.88.2V12l8.23-4.76c.175.308.268.656.27 1.01z" fill="currentColor"></path></svg><span class="font-light">lớp</span> <span class="font-medium">diffusers.</span><span class="font-semibold">WanAnimate2Blocks</span></span></h3><!----> <a id="diffusers.WanAnimate2Blocks" class="header-link invisible with-hover:group-hover:visible pr-2" href="#diffusers.WanAnimate2Blocks"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></a> <!--[0--><a class="!ml-auto !text-gray-400 !no-underline text-sm flex items-center" href="https://github.com/huggingface/diffusers/blob/v0.43.0/src/diffusers/modular_pipelines/wan_animate_2/modular_blocks_wan_animate_2.py#L252" target="_blank"><span><</span> <span class="hidden md:block mx-0.5 hover:!underline">source</span> <span>></span></a><!--]--></span> <!--[0--><p class="font-mono text-xs md:text-sm !leading-relaxed !my-6"><span>(</span> <!--[--><!--]--> <span>)</span> <!--[-1--><!--]--></p><!--]--> <div class="!mb-10 relative docstring-details "><!--[-1--><!--]--> <!--[-1--><!--]--> <!--[-1--><!--]--> <!--[-1--><!--]--> <!--[-1--><!--]--></div></div><!----> <p>Các khối pipeline mô-đun cho hoạt hình nhân vật Wan-Animate-2: một hình ảnh nhân vật tham chiếu và một video điều khiển tạo ra một video nhân vật thực hiện chuyển động theo video điều khiển.</p> <p>Các thành phần: | |
| text_encoder (<code>UMT5EncoderModel</code>) tokenizer (<code>AutoTokenizer</code>) image_processor (<code>WanAnimate2VideoProcessor</code>) | |
| image_encoder (<code>CLIPVisionModel</code>) video_processor (<code>WanAnimate2VideoProcessor</code>) vae (<code>AutoencoderKLWan</code>) | |
| transformer (<code>WanAnimate2Transformer3DModel</code>) scheduler (<code>SchedulerMixin</code>) guider (<code>ClassifierFreeGuidance</code>)</p> <p>Đầu vào: | |
| prompt (<code>str</code>): | |
| Prompt hoặc các prompt để định hướng việc tạo hình ảnh. | |
| negative_prompt (<code>str</code>, <em>tùy chọn</em>): | |
| Prompt hoặc các prompt không dùng để định hướng việc tạo hình ảnh. | |
| prompt_ref (<code>str</code>, <em>tùy chọn</em>, mặc định là 人物动作的参考视频): | |
| Prompt tham chiếu cho ngữ cảnh video điều khiển | |
| max_sequence_length (<code>int</code>, <em>tùy chọn</em>, mặc định là 512): | |
| Độ dài chuỗi tối đa cho việc mã hóa prompt. | |
| image (<code>Image | list</code>): | |
| Hình ảnh tham chiếu chứa nhân vật cần tạo chuyển động. | |
| height (<code>int</code>, <em>tùy chọn</em>, mặc định là 800): | |
| Cùng với <code>width</code>, là <em>diện tích</em> mục tiêu của video được tạo; tỷ lệ khung hình được lấy từ <code>image</code>. | |
| Được ghi đè bằng chiều cao khung hình đã được xác định. | |
| width (<code>int</code>, <em>tùy chọn</em>, mặc định là 640): | |
| Xem <code>height</code>. Được ghi đè bằng chiều rộng khung hình đã được xác định. | |
| driving_video (<code>list</code>): | |
| Video điều khiển cung cấp chuyển động, ở bất kỳ định dạng nào được chấp nhận bởi <code>VideoProcessor.preprocess_video</code>. | |
| driving_video_fps (<code>float</code>, <em>tùy chọn</em>): | |
| Tốc độ khung hình mà <code>driving_video</code> được ghi lại — <code>load_video(..., return_fps=True)</code> sẽ báo cáo giá trị này. Khi được đặt, | |
| các khung hình điều khiển sẽ được lấy mẫu lại từ giá trị này sang <code>fps</code>; khi <code>None</code>, chúng được sử dụng nguyên bản. | |
| fps (<code>int</code>, <em>tùy chọn</em>, mặc định là 24): | |
| Tốc độ khung hình mà mô hình tạo ra | |
| segment_frame_length (<code>int</code>, <em>tùy chọn</em>, mặc định là 81): | |
| Số lượng khung hình trong mỗi phân đoạn suy luận | |
| prev_segment_conditioning_frames (<code>int</code>, <em>tùy chọn</em>, mặc định là 1): | |
| Số lượng khung hình điều kiện được chuyển tiếp từ phân đoạn trước | |
| generator (<code>Generator</code>, <em>tùy chọn</em>): | |
| Trình tạo Torch cho việc tạo ra kết quả xác định. | |
| num_inference_steps (<code>int</code>, <em>tùy chọn</em>, mặc định là 40): | |
| Số bước khử nhiễu. | |
| *<em>denoiser_input_fields (<code>None</code>,</em>tùy chọn<em>): | |
| đầu vào mô hình có điều kiện cho bộ khử nhiễu: ví dụ prompt_embeds, negative_prompt_embeds, v.v. | |
| output_type (<code>str</code>,</em>tùy chọn*, mặc định là np): | |
| Loại đầu ra của các video đã được giải mã</p> <p>Đầu ra: | |
| videos (<code>list</code>): | |
| Các video được tạo.</p></div> <!--[1--><h2 class="relative group"><a id="diffusers.WanAnimate2DistilledBlocks" class="header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full" href="#diffusers.WanAnimate2DistilledBlocks"><span><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></span></a> <span><!---->WanAnimate2DistilledBlocks<!----></span></h2><!--]--><!----> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><div><span class="group flex space-x-1.5 items-center text-gray-800 bg-gradient-to-r rounded-tr-lg -mt-4 -ml-4 pt-3 px-2.5" id="diffusers.WanAnimate2DistilledBlocks"><!----><h3 class="!m-0"><span class="flex-1 break-all md:text-lg bg-gradient-to-r px-2.5 py-1.5 rounded-xl from-indigo-50/70 to-white dark:from-gray-900 dark:to-gray-950 dark:text-indigo-300 text-indigo-700"><svg class="mr-1.5 text-indigo-500 inline-block -mt-0.5" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" focusable="false" role="img" width=".8em" height=".8em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 24 24"><path class="uim-quaternary" d="M20.23 7.24L12 12L3.77 7.24a1.98 1.98 0 0 1 .7-.71L11 2.76c.62-.35 1.38-.35 2 0l6.53 3.77c.29.173.531.418.7.71z" opacity=".25" fill="currentColor"></path><path class="uim-tertiary" d="M12 12v9.5a2.09 2.09 0 0 1-.91-.21L4.5 17.48a2.003 2.003 0 0 1-1-1.73v-7.5a2.06 2.06 0 0 1 .27-1.01L12 12z" opacity=".5" fill="currentColor"></path><path class="uim-primary" d="M20.5 8.25v7.5a2.003 2.003 0 0 1-1 1.73l-6.62 3.82c-.275.13-.576.198-.88.2V12l8.23-4.76c.175.308.268.656.27 1.01z" fill="currentColor"></path></svg><span class="font-light">lớp</span> <span class="font-medium">diffusers.</span><span class="font-semibold">WanAnimate2DistilledBlocks</span></span></h3><!----> <a id="diffusers.WanAnimate2DistilledBlocks" class="header-link invisible with-hover:group-hover:visible pr-2" href="#diffusers.WanAnimate2DistilledBlocks"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path d="M167.594 88.393a8.001 8.001 0 0 1 0 11.314l-67.882 67.882a8 8 0 1 1-11.314-11.315l67.882-67.881a8.003 8.003 0 0 1 11.314 0zm-28.287 84.86l-28.284 28.284a40 40 0 0 1-56.567-56.567l28.284-28.284a8 8 0 0 0-11.315-11.315l-28.284 28.284a56 56 0 0 0 79.196 79.197l28.285-28.285a8 8 0 1 0-11.315-11.314zM212.852 43.14a56.002 56.002 0 0 0-79.196 0l-28.284 28.284a8 8 0 1 0 11.314 11.314l28.284-28.284a40 40 0 0 1 56.568 56.567l-28.285 28.285a8 8 0 0 0 11.315 11.314l28.284-28.284a56.065 56.065 0 0 0 0-79.196z" fill="currentColor"></path></svg><!----></a> <!--[0--><a class="!ml-auto !text-gray-400 !no-underline text-sm flex items-center" href="https://github.com/huggingface/diffusers/blob/v0.43.0/src/diffusers/modular_pipelines/wan_animate_2/modular_blocks_wan_animate_2_distilled.py#L254" target="_blank"><span><</span> <span class="hidden md:block mx-0.5 hover:!underline">source</span> <span>></span></a><!--]--></span> <!--[0--><p class="font-mono text-xs md:text-sm !leading-relaxed !my-6"><span>(</span> <!--[--><!--]--> <span>)</span> <!--[-1--><!--]--></p><!--]--> <div class="!mb-10 relative docstring-details "><!--[-1--><!--]--> <!--[-1--><!--]--> <!--[-1--><!--]--> <!--[-1--><!--]--> <!--[-1--><!--]--></div></div><!----> <p>Các khối pipeline mô-đun cho hoạt ảnh nhân vật Wan-Animate-2 đã được chưng cất, lấy mẫu trong vài bước mà không cần classifier-free guidance.</p> <p>Các thành phần: | |
| text_encoder (<code>UMT5EncoderModel</code>) tokenizer (<code>AutoTokenizer</code>) image_processor (<code>WanAnimate2VideoProcessor</code>) | |
| image_encoder (<code>CLIPVisionModel</code>) video_processor (<code>WanAnimate2VideoProcessor</code>) vae (<code>AutoencoderKLWan</code>) | |
| transformer (<code>WanAnimate2Transformer3DModel</code>) scheduler (<code>SchedulerMixin</code>) guider (<code>ClassifierFreeGuidance</code>)</p> <p>Đầu vào: | |
| prompt (<code>str</code>): | |
| Prompt hoặc các prompt để định hướng việc tạo hình ảnh. | |
| negative_prompt (<code>str</code>, <em>tùy chọn</em>): | |
| Prompt hoặc các prompt không dùng để định hướng việc tạo hình ảnh. | |
| prompt_ref (<code>str</code>, <em>tùy chọn</em>, mặc định là 人物动作的参考视频): | |
| Prompt tham chiếu cho ngữ cảnh video điều khiển | |
| max_sequence_length (<code>int</code>, <em>tùy chọn</em>, mặc định là 512): | |
| Độ dài chuỗi tối đa cho việc mã hóa prompt. | |
| image (<code>Image | list</code>): | |
| Hình ảnh tham chiếu chứa nhân vật cần tạo chuyển động. | |
| height (<code>int</code>, <em>tùy chọn</em>, mặc định là 800): | |
| Cùng với <code>width</code>, là <em>diện tích</em> mục tiêu của video được tạo; tỷ lệ khung hình được lấy từ <code>image</code>. | |
| Được ghi đè bằng chiều cao khung hình đã được xác định. | |
| width (<code>int</code>, <em>tùy chọn</em>, mặc định là 640): | |
| Xem <code>height</code>. Được ghi đè bằng chiều rộng khung hình đã được xác định. | |
| driving_video (<code>list</code>): | |
| Video điều khiển cung cấp chuyển động, ở bất kỳ định dạng nào được chấp nhận bởi <code>VideoProcessor.preprocess_video</code>. | |
| driving_video_fps (<code>float</code>, <em>tùy chọn</em>): | |
| Tốc độ khung hình mà <code>driving_video</code> được ghi lại — <code>load_video(..., return_fps=True)</code> sẽ báo cáo giá trị này. Khi được đặt, | |
| các khung hình điều khiển sẽ được lấy mẫu lại từ giá trị này sang <code>fps</code>; khi <code>None</code>, chúng được sử dụng nguyên bản. | |
| fps (<code>int</code>, <em>tùy chọn</em>, mặc định là 24): | |
| Tốc độ khung hình mà mô hình tạo ra | |
| segment_frame_length (<code>int</code>, <em>tùy chọn</em>, mặc định là 81): | |
| Số lượng khung hình trong mỗi phân đoạn suy luận | |
| prev_segment_conditioning_frames (<code>int</code>, <em>tùy chọn</em>, mặc định là 1): | |
| Số lượng khung hình điều kiện được chuyển tiếp từ phân đoạn trước | |
| generator (<code>Generator</code>, <em>tùy chọn</em>): | |
| Trình tạo Torch cho việc tạo ra kết quả xác định. | |
| num_inference_steps (<code>int</code>, <em>tùy chọn</em>, mặc định là 10): | |
| Số bước khử nhiễu. | |
| *<em>denoiser_input_fields (<code>None</code>,</em>tùy chọn<em>): | |
| đầu vào mô hình có điều kiện cho bộ khử nhiễu: ví dụ prompt_embeds, negative_prompt_embeds, v.v. | |
| output_type (<code>str</code>,</em>tùy chọn*, mặc định là np): | |
| Loại đầu ra của các video đã được giải mã</p> <p>Đầu ra: | |
| videos (<code>list</code>): | |
| Các video được tạo.</p></div> <a class="!text-gray-400 !no-underline text-sm flex items-center not-prose mt-4" href="https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/pipelines/wan_animate_2.md" target="_blank"><svg class="mr-1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" fill="currentColor" focusable="false" role="img" width="1em" height="1em" preserveAspectRatio="xMidYMid meet" viewBox="0 0 32 32"><path d="M31,16l-7,7l-1.41-1.41L28.17,16l-5.58-5.59L24,9l7,7z"></path><path d="M1,16l7-7l1.41,1.41L3.83,16l5.58,5.59L8,23l-7-7z"></path><path d="M12.419,25.484L17.639,6.552l1.932,0.518L14.351,26.002z"></path></svg><!----> <span><span class="underline">Update</span> on GitHub</span></a><!----> <p></p><!--]--><!----><!--]--><!--]--><!--]--> <!--[-1--><!--]--><!--]--> | |
| <script> | |
| { | |
| __sveltekit_ywq9g6 = { | |
| base: "/docs/diffusers/v0.43.0/en", | |
| assets: "/docs/diffusers/v0.43.0/en" | |
| }; | |
| const element = document.currentScript.parentElement; | |
| Promise.all([ | |
| import("/docs/diffusers/v0.43.0/en/_app/immutable/entry/start.1gaXe03k.js"), | |
| import("/docs/diffusers/v0.43.0/en/_app/immutable/entry/app.BwdYRbCn.js") | |
| ]).then(([kit, app]) => { | |
| kit.start(app, element, { | |
| node_ids: [0, 258], | |
| data: [null,null], | |
| form: null, | |
| error: null | |
| }); | |
| }); | |
| } | |
| </script> | |
Xet Storage Details
- Size:
- 39.5 kB
- Xet hash:
- 4b46e5242b01e05d0881888c393837644d2498035554635539ade2ac25b4c036
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.