Buckets:
| import"../chunks/DsnmJJEf.js";import{i as Me,h as fe,C as be,H as n,a as o,D as s,E as Te,s as ke}from"../chunks/BtE7mKSK.js";import{p as we,o as ve,s as e,f as v,a as d,b as Ue,c as t,d as U,r as a,n as i}from"../chunks/jDjavuwI.js";import{E as ne}from"../chunks/SrSJA0zO.js";const Je='{"title":"Kandinsky 5.0 Video","local":"kandinsky-50-video","sections":[{"title":"Available Models","local":"available-models","sections":[],"depth":2},{"title":"Usage Examples","local":"usage-examples","sections":[{"title":"Basic Text-to-Video Generation","local":"basic-text-to-video-generation","sections":[{"title":"Pro","local":"pro","sections":[],"depth":4},{"title":"Lite","local":"lite","sections":[],"depth":4}],"depth":3},{"title":"10 second Models","local":"10-second-models","sections":[],"depth":3},{"title":"Diffusion Distilled model","local":"diffusion-distilled-model","sections":[],"depth":3},{"title":"Basic Image-to-Video Generation","local":"basic-image-to-video-generation","sections":[],"depth":3}],"depth":2},{"title":"Kandinsky 5.0 Pro Side-by-Side evaluation","local":"kandinsky-50-pro-side-by-side-evaluation","sections":[],"depth":2},{"title":"Kandinsky 5.0 Lite Side-by-Side evaluation","local":"kandinsky-50-lite-side-by-side-evaluation","sections":[],"depth":2},{"title":"Kandinsky 5.0 Lite Distill Side-by-Side evaluation","local":"kandinsky-50-lite-distill-side-by-side-evaluation","sections":[],"depth":2},{"title":"Kandinsky5T2VPipeline","local":"diffusers.Kandinsky5T2VPipeline","sections":[],"depth":2},{"title":"Kandinsky5I2VPipeline","local":"diffusers.Kandinsky5I2VPipeline","sections":[],"depth":2},{"title":"Citation","local":"citation","sections":[],"depth":2}],"depth":1}';var je=U('<meta name="hf:doc:metadata"/>'),se=U("<p>Examples:</p> <!>",1),Ie=U(`<p></p> <!> <!> <p><a href="https://arxiv.org/abs/2511.14993" rel="nofollow">Kandinsky 5.0</a> is a family of diffusion models for Video & Image generation.</p> <p>Kandinsky 5.0 Lite line-up of lightweight video generation models (2B parameters) that ranks #1 among open-source models in its class. It outperforms larger models and offers the best understanding of Russian concepts in the open-source ecosystem.</p> <p>Kandinsky 5.0 Pro line-up of large high quality video generation models (19B parameters). It offers high qualty generation in HD and more generation formats like I2V.</p> <p>The model introduces several key innovations:</p> <ul><li><strong>Latent diffusion pipeline</strong> with <strong>Flow Matching</strong> for improved training stability</li> <li><strong>Diffusion Transformer (DiT)</strong> as the main generative backbone with cross-attention to text embeddings</li> <li>Dual text encoding using <strong>Qwen2.5-VL</strong> and <strong>CLIP</strong> for comprehensive text understanding</li> <li><strong>HunyuanVideo 3D VAE</strong> for efficient video encoding and decoding</li> <li><strong>Sparse attention mechanisms</strong> (NABLA) for efficient long-sequence processing</li></ul> <p>The original codebase can be found at <a href="https://github.com/kandinskylab/Kandinsky-5" rel="nofollow">kandinskylab/Kandinsky-5</a>.</p> <blockquote class="tip"><p>Check out the <a href="https://huggingface.co/kandinskylab" rel="nofollow">Kandinsky Lab</a> organization on the Hub for the official model checkpoints for text-to-video generation, including pretrained, SFT, no-CFG, and distilled variants.</p></blockquote> <!> <p>Kandinsky 5.0 T2V Pro:</p> <table><thead><tr><th>model_id</th><th>Description</th><th>Use Cases</th></tr></thead><tbody><tr><td><strong>kandinskylab/Kandinsky-5.0-T2V-Pro-sft-5s-Diffusers</strong></td><td>5 second Text-to-Video Pro model</td><td>High-quality text-to-video generation</td></tr><tr><td><strong>kandinskylab/Kandinsky-5.0-I2V-Pro-sft-5s-Diffusers</strong></td><td>5 second Image-to-Video Pro model</td><td>High-quality image-to-video generation</td></tr></tbody></table> <p>Kandinsky 5.0 T2V Lite: | |
| | model_id | Description | Use Cases | | |
| |------------|-------------|-----------| | |
| | <strong>kandinskylab/Kandinsky-5.0-T2V-Lite-sft-5s-Diffusers</strong> | 5 second Supervised Fine-Tuned model | Highest generation quality | | |
| | <strong>kandinskylab/Kandinsky-5.0-T2V-Lite-sft-10s-Diffusers</strong> | 10 second Supervised Fine-Tuned model | Highest generation quality | | |
| | <strong>kandinskylab/Kandinsky-5.0-T2V-Lite-nocfg-5s-Diffusers</strong> | 5 second Classifier-Free Guidance distilled | 2× faster inference | | |
| | <strong>kandinskylab/Kandinsky-5.0-T2V-Lite-nocfg-10s-Diffusers</strong> | 10 second Classifier-Free Guidance distilled | 2× faster inference | | |
| | <strong>kandinskylab/Kandinsky-5.0-T2V-Lite-distilled16steps-5s-Diffusers</strong> | 5 second Diffusion distilled to 16 steps | 6× faster inference, minimal quality loss | | |
| | <strong>kandinskylab/Kandinsky-5.0-T2V-Lite-distilled16steps-10s-Diffusers</strong> | 10 second Diffusion distilled to 16 steps | 6× faster inference, minimal quality loss | | |
| | <strong>kandinskylab/Kandinsky-5.0-T2V-Lite-pretrain-5s-Diffusers</strong> | 5 second Base pretrained model | Research and fine-tuning | | |
| | <strong>kandinskylab/Kandinsky-5.0-T2V-Lite-pretrain-10s-Diffusers</strong> | 10 second Base pretrained model | Research and fine-tuning |</p> <!> <!> <!> <p><strong>⚠️ Warning!</strong> all Pro models should be infered with pipeline.enable_model_cpu_offload()</p> <!> <!> <!> <!> <p><strong>⚠️ Warning!</strong> all 10 second models should be used with Flex attention and max-autotune-no-cudagraphs compilation:</p> <!> <!> <p><strong>⚠️ Warning!</strong> all nocfg and diffusion distilled models should be infered wothout CFG (<code>guidance_scale=1.0</code>):</p> <!> <!> <p><strong>⚠️ Warning!</strong> all Pro models should be infered with pipeline.enable_model_cpu_offload()</p> <!> <!> <table border="0" style="width: 200; text-align: left; margin-top: 20px;"><tbody><tr><td><img width="200" alt="image" src="https://github.com/user-attachments/assets/73e5ff00-2735-40fd-8f01-767de9181918"/></td><td><img width="200" alt="image" src="https://github.com/user-attachments/assets/f449a9e7-74b7-481d-82da-02723e396acd"/></td></tr><tr><td>Comparison with Veo 3</td><td>Comparison with Veo 3 fast</td></tr><tr><td><img width="200" alt="image" src="https://github.com/user-attachments/assets/a6902fb6-b5e8-4093-adad-aa4caab79c6d"/></td><td><img width="200" alt="image" src="https://github.com/user-attachments/assets/09986015-3d07-4de8-b942-c145039b9b2d"/></td></tr><tr><td>Comparison with Wan 2.2 A14B Text-to-Video mode</td><td>Comparison with Wan 2.2 A14B Image-to-Video mode</td></tr></tbody></table> <!> <p>The evaluation is based on the expanded prompts from the <a href="https://github.com/facebookresearch/MovieGenBench" rel="nofollow">Movie Gen benchmark</a>, which are available in the expanded_prompt column of the benchmark/moviegen_bench.csv file.</p> <table border="0" style="width: 400; text-align: left; margin-top: 20px;"><tbody><tr><td><img src="https://github.com/kandinskylab/kandinsky-5/raw/main/assets/sbs/kandinsky_5_video_lite_vs_sora.jpg" width="400"/></td><td><img src="https://github.com/kandinskylab/kandinsky-5/raw/main/assets/sbs/kandinsky_5_video_lite_vs_wan_2.1_14B.jpg" width="400"/></td></tr><tr><td><img src="https://github.com/kandinskylab/kandinsky-5/raw/main/assets/sbs/kandinsky_5_video_lite_vs_wan_2.2_5B.jpg" width="400"/></td><td><img src="https://github.com/kandinskylab/kandinsky-5/raw/main/assets/sbs/kandinsky_5_video_lite_vs_wan_2.2_A14B.jpg" width="400"/></td></tr><tr><td><img src="https://github.com/kandinskylab/kandinsky-5/raw/main/assets/sbs/kandinsky_5_video_lite_vs_wan_2.1_1.3B.jpg" width="400"/></td></tr></tbody></table> <!> <table border="0" style="width: 400; text-align: left; margin-top: 20px;"><tbody><tr><td><img src="https://github.com/kandinskylab/kandinsky-5/raw/main/assets/sbs/kandinsky_5_video_lite_5s_vs_kandinsky_5_video_lite_distill_5s.jpg" width="400"/></td><td><img src="https://github.com/kandinskylab/kandinsky-5/raw/main/assets/sbs/kandinsky_5_video_lite_10s_vs_kandinsky_5_video_lite_distill_10s.jpg" width="400"/></td></tr></tbody></table> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Pipeline for text-to-video generation using Kandinsky 5.0.</p> <p>This model inherits from <a href="/docs/diffusers/pr_14192/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.).</p> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>The call function to the pipeline for generation.</p> <!></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Validate input parameters for the pipeline.</p></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Encodes a single prompt (positive or negative) into text encoder hidden states.</p> <p>This method combines embeddings from both Qwen2.5-VL and CLIP text encoders to create comprehensive text | |
| representations for video generation.</p></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Create a sparse temporal attention (STA) mask for efficient video generation.</p> <p>This method generates a mask that limits attention to nearby frames and spatial positions, reducing | |
| computational complexity for video generation.</p></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Generate sparse attention parameters for the transformer based on sample dimensions.</p> <p>This method computes the sparse attention configuration needed for efficient video processing in the | |
| transformer model.</p></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Prepare initial latent variables for video generation.</p> <p>This method creates random noise latents or uses provided latents as starting point for the denoising process.</p></div></div> <!> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Pipeline for image-to-video generation using Kandinsky 5.0.</p> <p>This model inherits from <a href="/docs/diffusers/pr_14192/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.).</p> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>The call function to the pipeline for image-to-video generation.</p> <!></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Validate input parameters for the pipeline.</p></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Encodes a single prompt (positive or negative) into text encoder hidden states.</p> <p>This method combines embeddings from both Qwen2.5-VL and CLIP text encoders to create comprehensive text | |
| representations for video generation.</p></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Create a sparse temporal attention (STA) mask for efficient video generation.</p> <p>This method generates a mask that limits attention to nearby frames and spatial positions, reducing | |
| computational complexity for video generation.</p></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Generate sparse attention parameters for the transformer based on sample dimensions.</p> <p>This method computes the sparse attention configuration needed for efficient video processing in the | |
| transformer model.</p></div> <div class="docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"><!> <p>Prepare initial latent variables for image-to-video generation.</p> <p>This method creates random noise latents for all frames except the first frame, which is replaced with the | |
| encoded input image.</p></div></div> <!> <!> <!> <p></p>`,1);function Ze(te,ae){we(ae,!1),ve(()=>{new URLSearchParams(window.location.search).get("fw")}),Me();var J=Ie();fe("1nvkmxl",l=>{var p=je();ke(p,"content",Je),d(l,p)});var j=e(v(J),2);be(j,{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"});var I=e(j,2);n(I,{title:"Kandinsky 5.0 Video",local:"kandinsky-50-video",headingTag:"h1"});var V=e(I,16);n(V,{title:"Available Models",local:"available-models",headingTag:"h2"});var C=e(V,8);n(C,{title:"Usage Examples",local:"usage-examples",headingTag:"h2"});var B=e(C,2);n(B,{title:"Basic Text-to-Video Generation",local:"basic-text-to-video-generation",headingTag:"h3"});var G=e(B,2);n(G,{title:"Pro",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mNlX3N0ZXBzJTNENTAlMkMlMEElMjAlMjAlMjAlMjBndWlkYW5jZV9zY2FsZSUzRDUuMCUyQyUwQSkuZnJhbWVzJTVCMCU1RCUwQSUwQWV4cG9ydF90b192aWRlbyhvdXRwdXQlMkMlMjAlMjJvdXRwdXQubXA0JTIyJTJDJTIwZnBzJTNEMjQlMkMlMjBxdWFsaXR5JTNEOSk=",highlighted:`<span class="hljs-keyword">import</span> torch | |
| <span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> Kandinsky5T2VPipeline | |
| <span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> export_to_video | |
| <span class="hljs-comment"># Load the pipeline</span> | |
| model_id = <span class="hljs-string">"kandinskylab/Kandinsky-5.0-T2V-Pro-sft-5s-Diffusers"</span> | |
| pipe = Kandinsky5T2VPipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16) | |
| pipe = pipe.to(<span class="hljs-string">"cuda"</span>) | |
| pipeline.transformer.set_attention_backend(<span class="hljs-string">"flex"</span>) <span class="hljs-comment"># <--- Set attention bakend to Flex</span> | |
| pipeline.enable_model_cpu_offload() <span class="hljs-comment"># <--- Enable cpu offloading for single GPU inference</span> | |
| pipeline.transformer.<span class="hljs-built_in">compile</span>(mode=<span class="hljs-string">"max-autotune-no-cudagraphs"</span>, dynamic=<span class="hljs-literal">True</span>) <span class="hljs-comment"># <--- Compile with max-autotune-no-cudagraphs</span> | |
| <span class="hljs-comment"># Generate video</span> | |
| prompt = <span class="hljs-string">"A cat and a dog baking a cake together in a kitchen."</span> | |
| negative_prompt = <span class="hljs-string">"Static, 2D cartoon, cartoon, 2d animation, paintings, images, worst quality, low quality, ugly, deformed, walking backwards"</span> | |
| output = pipe( | |
| prompt=prompt, | |
| negative_prompt=negative_prompt, | |
| height=<span class="hljs-number">768</span>, | |
| width=<span class="hljs-number">1024</span>, | |
| num_frames=<span class="hljs-number">121</span>, <span class="hljs-comment"># ~5 seconds at 24fps</span> | |
| num_inference_steps=<span class="hljs-number">50</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">"output.mp4"</span>, fps=<span class="hljs-number">24</span>, quality=<span class="hljs-number">9</span>)`,lang:"python",wrap:!1});var x=e(Z,2);n(x,{title:"Lite",local:"lite",headingTag:"h4"});var W=e(x,2);o(W,{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwS2FuZGluc2t5NVQyVlBpcGVsaW5lJTBBZnJvbSUyMGRpZmZ1c2Vycy51dGlscyUyMGltcG9ydCUyMGV4cG9ydF90b192aWRlbyUwQSUwQSUyMyUyMExvYWQlMjB0aGUlMjBwaXBlbGluZSUwQW1vZGVsX2lkJTIwJTNEJTIwJTIya2FuZGluc2t5bGFiJTJGS2FuZGluc2t5LTUuMC1UMlYtTGl0ZS1zZnQtNXMtRGlmZnVzZXJzJTIyJTBBcGlwZSUyMCUzRCUyMEthbmRpbnNreTVUMlZQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQobW9kZWxfaWQlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmJmbG9hdDE2KSUwQXBpcGUlMjAlM0QlMjBwaXBlLnRvKCUyMmN1ZGElMjIpJTBBJTBBJTIzJTIwR2VuZXJhdGUlMjB2aWRlbyUwQXByb21wdCUyMCUzRCUyMCUyMkElMjBjYXQlMjBhbmQlMjBhJTIwZG9nJTIwYmFraW5nJTIwYSUyMGNha2UlMjB0b2dldGhlciUyMGluJTIwYSUyMGtpdGNoZW4uJTIyJTBBbmVnYXRpdmVfcHJvbXB0JTIwJTNEJTIwJTIyU3RhdGljJTJDJTIwMkQlMjBjYXJ0b29uJTJDJTIwY2FydG9vbiUyQyUyMDJkJTIwYW5pbWF0aW9uJTJDJTIwcGFpbnRpbmdzJTJDJTIwaW1hZ2VzJTJDJTIwd29yc3QlMjBxdWFsaXR5JTJDJTIwbG93JTIwcXVhbGl0eSUyQyUyMHVnbHklMkMlMjBkZWZvcm1lZCUyQyUyMHdhbGtpbmclMjBiYWNrd2FyZHMlMjIlMEElMEFvdXRwdXQlMjAlM0QlMjBwaXBlKCUwQSUyMCUyMCUyMCUyMHByb21wdCUzRHByb21wdCUyQyUwQSUyMCUyMCUyMCUyMG5lZ2F0aXZlX3Byb21wdCUzRG5lZ2F0aXZlX3Byb21wdCUyQyUwQSUyMCUyMCUyMCUyMGhlaWdodCUzRDUxMiUyQyUwQSUyMCUyMCUyMCUyMHdpZHRoJTNENzY4JTJDJTBBJTIwJTIwJTIwJTIwbnVtX2ZyYW1lcyUzRDEyMSUyQyUyMCUyMCUyMyUyMH41JTIwc2Vjb25kcyUyMGF0JTIwMjRmcHMlMEElMjAlMjAlMjAlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNENTAlMkMlMEElMjAlMjAlMjAlMjBndWlkYW5jZV9zY2FsZSUzRDUuMCUyQyUwQSkuZnJhbWVzJTVCMCU1RCUwQSUwQWV4cG9ydF90b192aWRlbyhvdXRwdXQlMkMlMjAlMjJvdXRwdXQubXA0JTIyJTJDJTIwZnBzJTNEMjQlMkMlMjBxdWFsaXR5JTNEOSk=",highlighted:`<span class="hljs-keyword">import</span> torch | |
| <span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> Kandinsky5T2VPipeline | |
| <span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> export_to_video | |
| <span class="hljs-comment"># Load the pipeline</span> | |
| model_id = <span class="hljs-string">"kandinskylab/Kandinsky-5.0-T2V-Lite-sft-5s-Diffusers"</span> | |
| pipe = Kandinsky5T2VPipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16) | |
| pipe = pipe.to(<span class="hljs-string">"cuda"</span>) | |
| <span class="hljs-comment"># Generate video</span> | |
| prompt = <span class="hljs-string">"A cat and a dog baking a cake together in a kitchen."</span> | |
| negative_prompt = <span class="hljs-string">"Static, 2D cartoon, cartoon, 2d animation, paintings, images, worst quality, low quality, ugly, deformed, walking backwards"</span> | |
| output = pipe( | |
| prompt=prompt, | |
| negative_prompt=negative_prompt, | |
| height=<span class="hljs-number">512</span>, | |
| width=<span class="hljs-number">768</span>, | |
| num_frames=<span class="hljs-number">121</span>, <span class="hljs-comment"># ~5 seconds at 24fps</span> | |
| num_inference_steps=<span class="hljs-number">50</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">"output.mp4"</span>, fps=<span class="hljs-number">24</span>, quality=<span class="hljs-number">9</span>)`,lang:"python",wrap:!1});var Q=e(W,2);n(Q,{title:"10 second Models",local:"10-second-models",headingTag:"h3"});var P=e(Q,4);o(P,{code:"cGlwZSUyMCUzRCUyMEthbmRpbnNreTVUMlZQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIya2FuZGluc2t5bGFiJTJGS2FuZGluc2t5LTUuMC1UMlYtTGl0ZS1zZnQtMTBzLURpZmZ1c2VycyUyMiUyQyUyMCUwQSUyMCUyMCUyMCUyMHRvcmNoX2R0eXBlJTNEdG9yY2guYmZsb2F0MTYlMEEpJTBBcGlwZSUyMCUzRCUyMHBpcGUudG8oJTIyY3VkYSUyMiklMEElMEFwaXBlLnRyYW5zZm9ybWVyLnNldF9hdHRlbnRpb25fYmFja2VuZCglMEElMjAlMjAlMjAlMjAlMjJmbGV4JTIyJTBBKSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMyUyMCUzQy0tLSUyMFNldCUyMGF0dGVudGlvbiUyMGJha2VuZCUyMHRvJTIwRmxleCUwQXBpcGUudHJhbnNmb3JtZXIuY29tcGlsZS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IwJTIwJTIwJTIwbnVtX2luZmVyZW5jZV9zdGVwcyUzRDUwJTJDJTBBJTIwJTIwJTIwJTIwZ3VpZGFuY2Vfc2NhbGUlM0Q1LjAlMkMlMEEpLmZyYW1lcyU1QjAlNUQlMEElMEFleHBvcnRfdG9fdmlkZW8ob3V0cHV0JTJDJTIwJTIyb3V0cHV0Lm1wNCUyMiUyQyUyMGZwcyUzRDI0JTJDJTIwcXVhbGl0eSUzRDkp",highlighted:`pipe = Kandinsky5T2VPipeline.from_pretrained( | |
| <span class="hljs-string">"kandinskylab/Kandinsky-5.0-T2V-Lite-sft-10s-Diffusers"</span>, | |
| torch_dtype=torch.bfloat16 | |
| ) | |
| pipe = pipe.to(<span class="hljs-string">"cuda"</span>) | |
| pipe.transformer.set_attention_backend( | |
| <span class="hljs-string">"flex"</span> | |
| ) <span class="hljs-comment"># <--- Set attention bakend to Flex</span> | |
| pipe.transformer.<span class="hljs-built_in">compile</span>( | |
| mode=<span class="hljs-string">"max-autotune-no-cudagraphs"</span>, | |
| dynamic=<span class="hljs-literal">True</span> | |
| ) <span class="hljs-comment"># <--- Compile with max-autotune-no-cudagraphs</span> | |
| prompt = <span class="hljs-string">"A cat and a dog baking a cake together in a kitchen."</span> | |
| negative_prompt = <span class="hljs-string">"Static, 2D cartoon, cartoon, 2d animation, paintings, images, worst quality, low quality, ugly, deformed, walking backwards"</span> | |
| output = pipe( | |
| prompt=prompt, | |
| negative_prompt=negative_prompt, | |
| height=<span class="hljs-number">512</span>, | |
| width=<span class="hljs-number">768</span>, | |
| num_frames=<span class="hljs-number">241</span>, | |
| num_inference_steps=<span class="hljs-number">50</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">"output.mp4"</span>, fps=<span class="hljs-number">24</span>, quality=<span class="hljs-number">9</span>)`,lang:"python",wrap:!1});var K=e(P,2);n(K,{title:"Diffusion Distilled model",local:"diffusion-distilled-model",headingTag:"h3"});var N=e(K,4);o(N,{code:"bW9kZWxfaWQlMjAlM0QlMjAlMjJrYW5kaW5za3lsYWIlMkZLYW5kaW5za3ktNS4wLVQyVi1MaXRlLWRpc3RpbGxlZDE2c3RlcHMtNXMtRGlmZnVzZXJzJTIyJTBBcGlwZSUyMCUzRCUyMEthbmRpbnNreTVUMlZQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQobW9kZWxfaWQlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmJmbG9hdDE2KSUwQXBpcGUlMjAlM0QlMjBwaXBlLnRvKCUyMmN1ZGElMjIpJTBBJTBBb3V0cHV0JTIwJTNEJTIwcGlwZSglMEElMjAlMjAlMjAlMjBwcm9tcHQlM0QlMjJBJTIwYmVhdXRpZnVsJTIwc3Vuc2V0JTIwb3ZlciUyMG1vdW50YWlucyUyMiUyQyUwQSUyMCUyMCUyMCUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0QxNiUyQyUyMCUyMCUyMyUyMCUzQy0tLSUyME1vZGVsJTIwaXMlMjBkaXN0aWxsZWQlMjBpbiUyMDE2JTIwc3RlcHMlMEElMjAlMjAlMjAlMjBndWlkYW5jZV9zY2FsZSUzRDEuMCUyQyUyMCUyMCUyMCUyMCUyMCUyMCUyMyUyMCUzQy0tLSUyMG5vJTIwQ0ZHJTBBKS5mcmFtZXMlNUIwJTVEJTBBJTBBZXhwb3J0X3RvX3ZpZGVvKG91dHB1dCUyQyUyMCUyMm91dHB1dC5tcDQlMjIlMkMlMjBmcHMlM0QyNCUyQyUyMHF1YWxpdHklM0Q5KQ==",highlighted:`model_id = <span class="hljs-string">"kandinskylab/Kandinsky-5.0-T2V-Lite-distilled16steps-5s-Diffusers"</span> | |
| pipe = Kandinsky5T2VPipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16) | |
| pipe = pipe.to(<span class="hljs-string">"cuda"</span>) | |
| output = pipe( | |
| prompt=<span class="hljs-string">"A beautiful sunset over mountains"</span>, | |
| num_inference_steps=<span class="hljs-number">16</span>, <span class="hljs-comment"># <--- Model is distilled in 16 steps</span> | |
| guidance_scale=<span class="hljs-number">1.0</span>, <span class="hljs-comment"># <--- no CFG</span> | |
| ).frames[<span class="hljs-number">0</span>] | |
| export_to_video(output, <span class="hljs-string">"output.mp4"</span>, fps=<span class="hljs-number">24</span>, quality=<span class="hljs-number">9</span>)`,lang:"python",wrap:!1});var X=e(N,2);n(X,{title:"Basic Image-to-Video Generation",local:"basic-image-to-video-generation",headingTag:"h3"});var F=e(X,4);o(F,{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwS2FuZGluc2t5NVQyVlBpcGVsaW5lJTBBZnJvbSUyMGRpZmZ1c2Vycy51dGlscyUyMGltcG9ydCUyMGV4cG9ydF90b192aWRlbyUwQSUwQSUyMyUyMExvYWQlMjB0aGUlMjBwaXBlbGluZSUwQW1vZGVsX2lkJTIwJTNEJTIwJTIya2FuZGluc2t5bGFiJTJGS2FuZGluc2t5LTUuMC1JMlYtUHJvLXNmdC01cy1EaWZmdXNlcnMlMjIlMEFwaXBlJTIwJTNEJTIwS2FuZGluc2t5NVQyVlBpcGVsaW5lLmZyb21fcHJldHJhaW5lZChtb2RlbF9pZCUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guYmZsb2F0MTYpJTBBJTBBcGlwZSUyMCUzRCUyMHBpcGUudG8oJTIyY3VkYSUyMiklMEFwaXBlbGluZS50cmFuc2Zvcm1lci5zZXRfYXR0ZW50aW9uX2JhY2tlbmQoJTIyZmxleCUyMiklMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjMlMjAlM0MtLS0lMjBTZXQlMjBhdHRlbnRpb24lMjBiYWtlbmQlMjB0byUyMEZsZXglMEFwaXBlbGluZS5lbmFibGVfbW9k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luc2t5JyUyMiUwQW5lZ2F0aXZlX3Byb21wdCUyMCUzRCUyMCUyMiUyMiUwQSUwQW91dHB1dCUyMCUzRCUyMHBpcGUoJTBBJTIwJTIwJTIwJTIwcHJvbXB0JTNEcHJvbXB0JTJDJTBBJTIwJTIwJTIwJTIwbmVnYXRpdmVfcHJvbXB0JTNEbmVnYXRpdmVfcHJvbXB0JTJDJTBBJTIwJTIwJTIwJTIwaGVpZ2h0JTNEaGVpZ2h0JTJDJTBBJTIwJTIwJTIwJTIwd2lkdGglM0R3aWR0aCUyQyUwQSUyMCUyMCUyMCUyMG51bV9mcmFtZXMlM0QxMjElMkMlMjAlMjAlMjMlMjB+NSUyMHNlY29uZHMlMjBhdCUyMDI0ZnBzJTBBJTIwJTIwJTIwJTIwbnVtX2luZmVyZW5jZV9zdGVwcyUzRDUwJTJDJTBBJTIwJTIwJTIwJTIwZ3VpZGFuY2Vfc2NhbGUlM0Q1LjAlMkMlMEEpLmZyYW1lcyU1QjAlNUQlMEElMEFleHBvcnRfdG9fdmlkZW8ob3V0cHV0JTJDJTIwJTIyb3V0cHV0Lm1wNCUyMiUyQyUyMGZwcyUzRDI0JTJDJTIwcXVhbGl0eSUzRDkp",highlighted:`<span class="hljs-keyword">import</span> torch | |
| <span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> Kandinsky5T2VPipeline | |
| <span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> export_to_video | |
| <span class="hljs-comment"># Load the pipeline</span> | |
| model_id = <span class="hljs-string">"kandinskylab/Kandinsky-5.0-I2V-Pro-sft-5s-Diffusers"</span> | |
| pipe = Kandinsky5T2VPipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16) | |
| pipe = pipe.to(<span class="hljs-string">"cuda"</span>) | |
| pipeline.transformer.set_attention_backend(<span class="hljs-string">"flex"</span>) <span class="hljs-comment"># <--- Set attention bakend to Flex</span> | |
| pipeline.enable_model_cpu_offload() <span class="hljs-comment"># <--- Enable cpu offloading for single GPU inference</span> | |
| pipeline.transformer.<span class="hljs-built_in">compile</span>(mode=<span class="hljs-string">"max-autotune-no-cudagraphs"</span>, dynamic=<span class="hljs-literal">True</span>) <span class="hljs-comment"># <--- Compile with max-autotune-no-cudagraphs</span> | |
| <span class="hljs-comment"># Generate video</span> | |
| image = load_image( | |
| <span class="hljs-string">"https://huggingface.co/kandinsky-community/kandinsky-3/resolve/main/assets/title.jpg?download=true"</span> | |
| ) | |
| height = <span class="hljs-number">896</span> | |
| width = <span class="hljs-number">896</span> | |
| image = image.resize((width, height)) | |
| prompt = <span class="hljs-string">"An funny furry creture smiles happily and holds a sign that says 'Kandinsky'"</span> | |
| negative_prompt = <span class="hljs-string">""</span> | |
| output = pipe( | |
| prompt=prompt, | |
| negative_prompt=negative_prompt, | |
| height=height, | |
| width=width, | |
| num_frames=<span class="hljs-number">121</span>, <span class="hljs-comment"># ~5 seconds at 24fps</span> | |
| num_inference_steps=<span class="hljs-number">50</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">"output.mp4"</span>, fps=<span class="hljs-number">24</span>, quality=<span class="hljs-number">9</span>)`,lang:"python",wrap:!1});var R=e(F,2);n(R,{title:"Kandinsky 5.0 Pro Side-by-Side evaluation",local:"kandinsky-50-pro-side-by-side-evaluation",headingTag:"h2"});var E=e(R,4);n(E,{title:"Kandinsky 5.0 Lite Side-by-Side evaluation",local:"kandinsky-50-lite-side-by-side-evaluation",headingTag:"h2"});var Y=e(E,6);n(Y,{title:"Kandinsky 5.0 Lite Distill Side-by-Side evaluation",local:"kandinsky-50-lite-distill-side-by-side-evaluation",headingTag:"h2"});var S=e(Y,4);n(S,{title:"Kandinsky5T2VPipeline",local:"diffusers.Kandinsky5T2VPipeline",headingTag:"h2"});var c=e(S,2),A=t(c);s(A,{name:"class diffusers.Kandinsky5T2VPipeline",anchor:"diffusers.Kandinsky5T2VPipeline",source:"https://github.com/huggingface/diffusers/blob/vr_14192/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky.py#L131",parameters:[{name:"transformer",val:": Kandinsky5Transformer3DModel"},{name:"vae",val:": AutoencoderKLHunyuanVideo"},{name:"text_encoder",val:": Qwen2_5_VLForConditionalGeneration"},{name:"tokenizer",val:": Qwen2VLProcessor"},{name:"text_encoder_2",val:": CLIPTextModel"},{name:"tokenizer_2",val:": CLIPTokenizer"},{name:"scheduler",val:": FlowMatchEulerDiscreteScheduler"}],parametersDescription:[{anchor:"diffusers.Kandinsky5T2VPipeline.transformer",description:`<strong>transformer</strong> (<code>Kandinsky5Transformer3DModel</code>) — | |
| Conditional Transformer to denoise the encoded video latents.`,name:"transformer"},{anchor:"diffusers.Kandinsky5T2VPipeline.vae",description:`<strong>vae</strong> (<a href="/docs/diffusers/pr_14192/en/api/models/autoencoder_kl_hunyuan_video#diffusers.AutoencoderKLHunyuanVideo">AutoencoderKLHunyuanVideo</a>) — | |
| Variational Auto-Encoder Model <a href="https://huggingface.co/hunyuanvideo-community/HunyuanVideo" rel="nofollow">hunyuanvideo-community/HunyuanVideo | |
| (vae)</a> to encode and decode videos to and from | |
| latent representations.`,name:"vae"},{anchor:"diffusers.Kandinsky5T2VPipeline.text_encoder",description:`<strong>text_encoder</strong> (<code>Qwen2_5_VLForConditionalGeneration</code>) — | |
| Frozen text-encoder <a href="https://huggingface.co/Qwen/Qwen2.5-VL-7B-Instruct" rel="nofollow">Qwen2.5-VL</a>.`,name:"text_encoder"},{anchor:"diffusers.Kandinsky5T2VPipeline.tokenizer",description:`<strong>tokenizer</strong> (<code>AutoProcessor</code>) — | |
| Tokenizer for Qwen2.5-VL.`,name:"tokenizer"},{anchor:"diffusers.Kandinsky5T2VPipeline.text_encoder_2",description:`<strong>text_encoder_2</strong> (<code>CLIPTextModel</code>) — | |
| Frozen <a href="https://huggingface.co/docs/transformers/model_doc/clip#transformers.CLIPTextModel" rel="nofollow">CLIP</a>, | |
| specifically the <a href="https://huggingface.co/openai/clip-vit-large-patch14" rel="nofollow">clip-vit-large-patch14</a> variant.`,name:"text_encoder_2"},{anchor:"diffusers.Kandinsky5T2VPipeline.tokenizer_2",description:`<strong>tokenizer_2</strong> (<code>CLIPTokenizer</code>) — | |
| Tokenizer for CLIP.`,name:"tokenizer_2"},{anchor:"diffusers.Kandinsky5T2VPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/pr_14192/en/api/schedulers/flow_match_euler_discrete#diffusers.FlowMatchEulerDiscreteScheduler">FlowMatchEulerDiscreteScheduler</a>) — | |
| A scheduler to be used in combination with <code>transformer</code> to denoise the encoded video latents.`,name:"scheduler"}]});var m=e(A,6),q=t(m);s(q,{name:"__call__",anchor:"diffusers.Kandinsky5T2VPipeline.__call__",source:"https://github.com/huggingface/diffusers/blob/vr_14192/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky.py#L682",parameters:[{name:"prompt",val:": str | list[str] = None"},{name:"negative_prompt",val:": str | list[str] | None = None"},{name:"height",val:": int = 512"},{name:"width",val:": int = 768"},{name:"num_frames",val:": int = 121"},{name:"num_inference_steps",val:": int = 50"},{name:"guidance_scale",val:": float = 5.0"},{name:"num_videos_per_prompt",val:": int | None = 1"},{name:"generator",val:": typing.Union[torch.Generator, list[torch.Generator], NoneType] = None"},{name:"latents",val:": typing.Optional[torch.Tensor] = None"},{name:"prompt_embeds_qwen",val:": typing.Optional[torch.Tensor] = None"},{name:"prompt_embeds_clip",val:": typing.Optional[torch.Tensor] = None"},{name:"negative_prompt_embeds_qwen",val:": typing.Optional[torch.Tensor] = None"},{name:"negative_prompt_embeds_clip",val:": typing.Optional[torch.Tensor] = None"},{name:"prompt_cu_seqlens",val:": typing.Optional[torch.Tensor] = None"},{name:"negative_prompt_cu_seqlens",val:": typing.Optional[torch.Tensor] = None"},{name:"output_type",val:": str | None = 'pil'"},{name:"return_dict",val:": bool = True"},{name:"callback_on_step_end",val:": typing.Union[typing.Callable[[int, int], NoneType], diffusers.callbacks.PipelineCallback, diffusers.callbacks.MultiPipelineCallbacks, NoneType] = None"},{name:"callback_on_step_end_tensor_inputs",val:": list = ['latents']"},{name:"max_sequence_length",val:": int = 512"}],parametersDescription:[{anchor:"diffusers.Kandinsky5T2VPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>list[str]</code>, <em>optional</em>) — | |
| The prompt or prompts to guide the video generation. If not defined, pass <code>prompt_embeds</code> instead.`,name:"prompt"},{anchor:"diffusers.Kandinsky5T2VPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>list[str]</code>, <em>optional</em>) — | |
| The prompt or prompts to avoid during video generation. If not defined, pass <code>negative_prompt_embeds</code> | |
| instead. Ignored when not using guidance (<code>guidance_scale</code> < <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.Kandinsky5T2VPipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, defaults to <code>512</code>) — | |
| The height in pixels of the generated video.`,name:"height"},{anchor:"diffusers.Kandinsky5T2VPipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>, defaults to <code>768</code>) — | |
| The width in pixels of the generated video.`,name:"width"},{anchor:"diffusers.Kandinsky5T2VPipeline.__call__.num_frames",description:`<strong>num_frames</strong> (<code>int</code>, defaults to <code>25</code>) — | |
| The number of frames in the generated video.`,name:"num_frames"},{anchor:"diffusers.Kandinsky5T2VPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, defaults to <code>50</code>) — | |
| The number of denoising steps.`,name:"num_inference_steps"},{anchor:"diffusers.Kandinsky5T2VPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, defaults to <code>5.0</code>) — | |
| Guidance scale as defined in classifier-free guidance.`,name:"guidance_scale"},{anchor:"diffusers.Kandinsky5T2VPipeline.__call__.num_videos_per_prompt",description:`<strong>num_videos_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) — | |
| The number of videos to generate per prompt.`,name:"num_videos_per_prompt"},{anchor:"diffusers.Kandinsky5T2VPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>list[torch.Generator]</code>, <em>optional</em>) — | |
| A torch generator to make generation deterministic.`,name:"generator"},{anchor:"diffusers.Kandinsky5T2VPipeline.__call__.latents",description:`<strong>latents</strong> (<code>torch.Tensor</code>, <em>optional</em>) — | |
| Pre-generated noisy latents.`,name:"latents"},{anchor:"diffusers.Kandinsky5T2VPipeline.__call__.prompt_embeds_qwen",description:`<strong>prompt_embeds_qwen</strong> (<code>torch.Tensor</code>, <em>optional</em>) — | |
| Pre-generated text embeddings from the Qwen text encoder.`,name:"prompt_embeds_qwen"},{anchor:"diffusers.Kandinsky5T2VPipeline.__call__.prompt_embeds_clip",description:`<strong>prompt_embeds_clip</strong> (<code>torch.Tensor</code>, <em>optional</em>) — | |
| Pre-generated text embeddings from the CLIP text encoder.`,name:"prompt_embeds_clip"},{anchor:"diffusers.Kandinsky5T2VPipeline.__call__.negative_prompt_embeds_qwen",description:`<strong>negative_prompt_embeds_qwen</strong> (<code>torch.Tensor</code>, <em>optional</em>) — | |
| Pre-generated negative text embeddings from the Qwen text encoder.`,name:"negative_prompt_embeds_qwen"},{anchor:"diffusers.Kandinsky5T2VPipeline.__call__.negative_prompt_embeds_clip",description:`<strong>negative_prompt_embeds_clip</strong> (<code>torch.Tensor</code>, <em>optional</em>) — | |
| Pre-generated negative text embeddings from the CLIP text encoder.`,name:"negative_prompt_embeds_clip"},{anchor:"diffusers.Kandinsky5T2VPipeline.__call__.prompt_cu_seqlens",description:`<strong>prompt_cu_seqlens</strong> (<code>torch.Tensor</code>, <em>optional</em>) — | |
| Cumulative sequence lengths for the Qwen prompt embeddings, used for variable-length attention.`,name:"prompt_cu_seqlens"},{anchor:"diffusers.Kandinsky5T2VPipeline.__call__.negative_prompt_cu_seqlens",description:`<strong>negative_prompt_cu_seqlens</strong> (<code>torch.Tensor</code>, <em>optional</em>) — | |
| Cumulative sequence lengths for the Qwen negative prompt embeddings, used for variable-length | |
| attention.`,name:"negative_prompt_cu_seqlens"},{anchor:"diffusers.Kandinsky5T2VPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>"pil"</code>) — | |
| The output format of the generated video.`,name:"output_type"},{anchor:"diffusers.Kandinsky5T2VPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether or not to return a <code>KandinskyPipelineOutput</code>.`,name:"return_dict"},{anchor:"diffusers.Kandinsky5T2VPipeline.__call__.callback_on_step_end",description:`<strong>callback_on_step_end</strong> (<code>Callable</code>, <code>PipelineCallback</code>, <code>MultiPipelineCallbacks</code>, <em>optional</em>) — | |
| A function that is called at the end of each denoising step.`,name:"callback_on_step_end"},{anchor:"diffusers.Kandinsky5T2VPipeline.__call__.callback_on_step_end_tensor_inputs",description:`<strong>callback_on_step_end_tensor_inputs</strong> (<code>list</code>, <em>optional</em>) — | |
| The list of tensor inputs for the <code>callback_on_step_end</code> function.`,name:"callback_on_step_end_tensor_inputs"},{anchor:"diffusers.Kandinsky5T2VPipeline.__call__.max_sequence_length",description:`<strong>max_sequence_length</strong> (<code>int</code>, defaults to <code>512</code>) — | |
| The maximum sequence length for text encoding.`,name:"max_sequence_length"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>If <code>return_dict</code> is <code>True</code>, <code>KandinskyPipelineOutput</code> is returned, otherwise a <code>tuple</code> is returned | |
| where the first element is a list with the generated images.</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><code>~KandinskyPipelineOutput</code> or <code>tuple</code></p> | |
| `});var ie=e(q,4);ne(ie,{anchor:"diffusers.Kandinsky5T2VPipeline.__call__.example",children:(l,p)=>{var r=se(),w=e(v(r),2);o(w,{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwS2FuZGluc2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lMkMlMjBmcHMlM0QyNCUyQyUyMHF1YWxpdHklM0Q5KQ==",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> Kandinsky5T2VPipeline | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> export_to_video | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Available models:</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># kandinskylab/Kandinsky-5.0-T2V-Pro-sft-5s-Diffusers</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># kandinskylab/Kandinsky-5.0-T2V-Lite-sft-5s-Diffusers</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># kandinskylab/Kandinsky-5.0-T2V-Lite-nocfg-5s-Diffusers</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># kandinskylab/Kandinsky-5.0-T2V-Lite-distilled16steps-5s-Diffusers</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># kandinskylab/Kandinsky-5.0-T2V-Lite-pretrain-5s-Diffusers</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># kandinskylab/Kandinsky-5.0-T2V-Lite-sft-10s-Diffusers</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># kandinskylab/Kandinsky-5.0-T2V-Lite-nocfg-10s-Diffusers</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># kandinskylab/Kandinsky-5.0-T2V-Lite-distilled16steps-10s-Diffusers</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># kandinskylab/Kandinsky-5.0-T2V-Lite-pretrain-10s-Diffusers</span> | |
| <span class="hljs-meta">>>> </span>model_id = <span class="hljs-string">"kandinskylab/Kandinsky-5.0-T2V-Lite-sft-5s-Diffusers"</span> | |
| <span class="hljs-meta">>>> </span>pipe = Kandinsky5T2VPipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16) | |
| <span class="hljs-meta">>>> </span>pipe = pipe.to(<span class="hljs-string">"cuda"</span>) | |
| <span class="hljs-meta">>>> </span>prompt = <span class="hljs-string">"A cat and a dog baking a cake together in a kitchen."</span> | |
| <span class="hljs-meta">>>> </span>negative_prompt = <span class="hljs-string">"Static, 2D cartoon, cartoon, 2d animation, paintings, images, worst quality, low quality, ugly, deformed, walking backwards"</span> | |
| <span class="hljs-meta">>>> </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">512</span>, | |
| <span class="hljs-meta">... </span> width=<span class="hljs-number">768</span>, | |
| <span class="hljs-meta">... </span> num_frames=<span class="hljs-number">121</span>, | |
| <span class="hljs-meta">... </span> num_inference_steps=<span class="hljs-number">50</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">>>> </span>export_to_video(output, <span class="hljs-string">"output.mp4"</span>, fps=<span class="hljs-number">24</span>, quality=<span class="hljs-number">9</span>)`,lang:"python",wrap:!1}),d(l,r)},$$slots:{default:!0}}),a(m);var u=e(m,2),oe=t(u);s(oe,{name:"check_inputs",anchor:"diffusers.Kandinsky5T2VPipeline.check_inputs",source:"https://github.com/huggingface/diffusers/blob/vr_14192/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky.py#L513",parameters:[{name:"prompt",val:""},{name:"negative_prompt",val:""},{name:"height",val:""},{name:"width",val:""},{name:"prompt_embeds_qwen",val:" = None"},{name:"prompt_embeds_clip",val:" = None"},{name:"negative_prompt_embeds_qwen",val:" = None"},{name:"negative_prompt_embeds_clip",val:" = None"},{name:"prompt_cu_seqlens",val:" = None"},{name:"negative_prompt_cu_seqlens",val:" = None"},{name:"callback_on_step_end_tensor_inputs",val:" = None"},{name:"max_sequence_length",val:" = None"}],parametersDescription:[{anchor:"diffusers.Kandinsky5T2VPipeline.check_inputs.prompt",description:"<strong>prompt</strong> — Input prompt",name:"prompt"},{anchor:"diffusers.Kandinsky5T2VPipeline.check_inputs.negative_prompt",description:"<strong>negative_prompt</strong> — Negative prompt for guidance",name:"negative_prompt"},{anchor:"diffusers.Kandinsky5T2VPipeline.check_inputs.height",description:"<strong>height</strong> — Video height",name:"height"},{anchor:"diffusers.Kandinsky5T2VPipeline.check_inputs.width",description:"<strong>width</strong> — Video width",name:"width"},{anchor:"diffusers.Kandinsky5T2VPipeline.check_inputs.prompt_embeds_qwen",description:"<strong>prompt_embeds_qwen</strong> — Pre-computed Qwen prompt embeddings",name:"prompt_embeds_qwen"},{anchor:"diffusers.Kandinsky5T2VPipeline.check_inputs.prompt_embeds_clip",description:"<strong>prompt_embeds_clip</strong> — Pre-computed CLIP prompt embeddings",name:"prompt_embeds_clip"},{anchor:"diffusers.Kandinsky5T2VPipeline.check_inputs.negative_prompt_embeds_qwen",description:"<strong>negative_prompt_embeds_qwen</strong> — Pre-computed Qwen negative prompt embeddings",name:"negative_prompt_embeds_qwen"},{anchor:"diffusers.Kandinsky5T2VPipeline.check_inputs.negative_prompt_embeds_clip",description:"<strong>negative_prompt_embeds_clip</strong> — Pre-computed CLIP negative prompt embeddings",name:"negative_prompt_embeds_clip"},{anchor:"diffusers.Kandinsky5T2VPipeline.check_inputs.prompt_cu_seqlens",description:"<strong>prompt_cu_seqlens</strong> — Pre-computed cumulative sequence lengths for Qwen positive prompt",name:"prompt_cu_seqlens"},{anchor:"diffusers.Kandinsky5T2VPipeline.check_inputs.negative_prompt_cu_seqlens",description:"<strong>negative_prompt_cu_seqlens</strong> — Pre-computed cumulative sequence lengths for Qwen negative prompt",name:"negative_prompt_cu_seqlens"},{anchor:"diffusers.Kandinsky5T2VPipeline.check_inputs.callback_on_step_end_tensor_inputs",description:"<strong>callback_on_step_end_tensor_inputs</strong> — Callback tensor inputs",name:"callback_on_step_end_tensor_inputs"}],raiseDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <ul> | |
| <li><code>ValueError</code> — If inputs are invalid</li> | |
| </ul> | |
| `,raiseType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><code>ValueError</code></p> | |
| `}),i(2),a(u);var y=e(u,2),le=t(y);s(le,{name:"encode_prompt",anchor:"diffusers.Kandinsky5T2VPipeline.encode_prompt",source:"https://github.com/huggingface/diffusers/blob/vr_14192/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky.py#L420",parameters:[{name:"prompt",val:": str | list[str]"},{name:"num_videos_per_prompt",val:": int = 1"},{name:"max_sequence_length",val:": int = 512"},{name:"device",val:": typing.Optional[torch.device] = None"},{name:"dtype",val:": typing.Optional[torch.dtype] = None"}],parametersDescription:[{anchor:"diffusers.Kandinsky5T2VPipeline.encode_prompt.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>list[str]</code>) — | |
| Prompt to be encoded.`,name:"prompt"},{anchor:"diffusers.Kandinsky5T2VPipeline.encode_prompt.num_videos_per_prompt",description:`<strong>num_videos_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) — | |
| Number of videos to generate per prompt.`,name:"num_videos_per_prompt"},{anchor:"diffusers.Kandinsky5T2VPipeline.encode_prompt.max_sequence_length",description:`<strong>max_sequence_length</strong> (<code>int</code>, <em>optional</em>, defaults to 512) — | |
| Maximum sequence length for text encoding.`,name:"max_sequence_length"},{anchor:"diffusers.Kandinsky5T2VPipeline.encode_prompt.device",description:`<strong>device</strong> (<code>torch.device</code>, <em>optional</em>) — | |
| Torch device.`,name:"device"},{anchor:"diffusers.Kandinsky5T2VPipeline.encode_prompt.dtype",description:`<strong>dtype</strong> (<code>torch.dtype</code>, <em>optional</em>) — | |
| Torch dtype.`,name:"dtype"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <ul> | |
| <li>Qwen text embeddings of shape (batch_size * num_videos_per_prompt, sequence_length, embedding_dim)</li> | |
| <li>CLIP pooled embeddings of shape (batch_size * num_videos_per_prompt, clip_embedding_dim)</li> | |
| <li>Cumulative sequence lengths (<code>cu_seqlens</code>) for Qwen embeddings of shape (batch_size * | |
| num_videos_per_prompt + 1,)</li> | |
| </ul> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>tuple[torch.Tensor, torch.Tensor, torch.Tensor]</p> | |
| `}),i(4),a(y);var h=e(y,2),re=t(h);s(re,{name:"fast_sta_nabla",anchor:"diffusers.Kandinsky5T2VPipeline.fast_sta_nabla",source:"https://github.com/huggingface/diffusers/blob/vr_14192/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky.py#L229",parameters:[{name:"T",val:": int"},{name:"H",val:": int"},{name:"W",val:": int"},{name:"wT",val:": int = 3"},{name:"wH",val:": int = 3"},{name:"wW",val:": int = 3"},{name:"device",val:" = 'cuda'"}],parametersDescription:[{anchor:"diffusers.Kandinsky5T2VPipeline.fast_sta_nabla.T",description:"<strong>T</strong> (int) — Number of temporal frames",name:"T"},{anchor:"diffusers.Kandinsky5T2VPipeline.fast_sta_nabla.H",description:"<strong>H</strong> (int) — Height in latent space",name:"H"},{anchor:"diffusers.Kandinsky5T2VPipeline.fast_sta_nabla.W",description:"<strong>W</strong> (int) — Width in latent space",name:"W"},{anchor:"diffusers.Kandinsky5T2VPipeline.fast_sta_nabla.wT",description:"<strong>wT</strong> (int) — Temporal attention window size",name:"wT"},{anchor:"diffusers.Kandinsky5T2VPipeline.fast_sta_nabla.wH",description:"<strong>wH</strong> (int) — Height attention window size",name:"wH"},{anchor:"diffusers.Kandinsky5T2VPipeline.fast_sta_nabla.wW",description:"<strong>wW</strong> (int) — Width attention window size",name:"wW"},{anchor:"diffusers.Kandinsky5T2VPipeline.fast_sta_nabla.device",description:"<strong>device</strong> (str) — Device to create tensor on",name:"device"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>Sparse attention mask of shape (T<em>H</em>W, T<em>H</em>W)</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>torch.Tensor</p> | |
| `}),i(4),a(h);var g=e(h,2),pe=t(g);s(pe,{name:"get_sparse_params",anchor:"diffusers.Kandinsky5T2VPipeline.get_sparse_params",source:"https://github.com/huggingface/diffusers/blob/vr_14192/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky.py#L264",parameters:[{name:"sample",val:""},{name:"device",val:""}],parametersDescription:[{anchor:"diffusers.Kandinsky5T2VPipeline.get_sparse_params.sample",description:"<strong>sample</strong> (torch.Tensor) — Input sample tensor",name:"sample"},{anchor:"diffusers.Kandinsky5T2VPipeline.get_sparse_params.device",description:"<strong>device</strong> (torch.device) — Device to place tensors on",name:"device"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>Dictionary containing sparse attention parameters</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>Dict</p> | |
| `}),i(4),a(g);var z=e(g,2),de=t(z);s(de,{name:"prepare_latents",anchor:"diffusers.Kandinsky5T2VPipeline.prepare_latents",source:"https://github.com/huggingface/diffusers/blob/vr_14192/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky.py#L599",parameters:[{name:"batch_size",val:": int"},{name:"num_channels_latents",val:": int = 16"},{name:"height",val:": int = 480"},{name:"width",val:": int = 832"},{name:"num_frames",val:": int = 81"},{name:"dtype",val:": typing.Optional[torch.dtype] = None"},{name:"device",val:": typing.Optional[torch.device] = None"},{name:"generator",val:": typing.Union[torch.Generator, list[torch.Generator], NoneType] = None"},{name:"latents",val:": typing.Optional[torch.Tensor] = None"}],parametersDescription:[{anchor:"diffusers.Kandinsky5T2VPipeline.prepare_latents.batch_size",description:"<strong>batch_size</strong> (int) — Number of videos to generate",name:"batch_size"},{anchor:"diffusers.Kandinsky5T2VPipeline.prepare_latents.num_channels_latents",description:"<strong>num_channels_latents</strong> (int) — Number of channels in latent space",name:"num_channels_latents"},{anchor:"diffusers.Kandinsky5T2VPipeline.prepare_latents.height",description:"<strong>height</strong> (int) — Height of generated video",name:"height"},{anchor:"diffusers.Kandinsky5T2VPipeline.prepare_latents.width",description:"<strong>width</strong> (int) — Width of generated video",name:"width"},{anchor:"diffusers.Kandinsky5T2VPipeline.prepare_latents.num_frames",description:"<strong>num_frames</strong> (int) — Number of frames in video",name:"num_frames"},{anchor:"diffusers.Kandinsky5T2VPipeline.prepare_latents.dtype",description:"<strong>dtype</strong> (torch.dtype) — Data type for latents",name:"dtype"},{anchor:"diffusers.Kandinsky5T2VPipeline.prepare_latents.device",description:"<strong>device</strong> (torch.device) — Device to create latents on",name:"device"},{anchor:"diffusers.Kandinsky5T2VPipeline.prepare_latents.generator",description:"<strong>generator</strong> (torch.Generator) — Random number generator",name:"generator"},{anchor:"diffusers.Kandinsky5T2VPipeline.prepare_latents.latents",description:"<strong>latents</strong> (torch.Tensor) — Pre-existing latents to use",name:"latents"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>Prepared latent tensor</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>torch.Tensor</p> | |
| `}),i(4),a(z),a(c);var H=e(c,2);n(H,{title:"Kandinsky5I2VPipeline",local:"diffusers.Kandinsky5I2VPipeline",headingTag:"h2"});var _=e(H,2),D=t(_);s(D,{name:"class diffusers.Kandinsky5I2VPipeline",anchor:"diffusers.Kandinsky5I2VPipeline",source:"https://github.com/huggingface/diffusers/blob/vr_14192/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky_i2v.py#L128",parameters:[{name:"transformer",val:": Kandinsky5Transformer3DModel"},{name:"vae",val:": AutoencoderKLHunyuanVideo"},{name:"text_encoder",val:": Qwen2_5_VLForConditionalGeneration"},{name:"tokenizer",val:": Qwen2VLProcessor"},{name:"text_encoder_2",val:": CLIPTextModel"},{name:"tokenizer_2",val:": CLIPTokenizer"},{name:"scheduler",val:": FlowMatchEulerDiscreteScheduler"}],parametersDescription:[{anchor:"diffusers.Kandinsky5I2VPipeline.transformer",description:`<strong>transformer</strong> (<code>Kandinsky5Transformer3DModel</code>) — | |
| Conditional Transformer to denoise the encoded video latents.`,name:"transformer"},{anchor:"diffusers.Kandinsky5I2VPipeline.vae",description:`<strong>vae</strong> (<a href="/docs/diffusers/pr_14192/en/api/models/autoencoder_kl_hunyuan_video#diffusers.AutoencoderKLHunyuanVideo">AutoencoderKLHunyuanVideo</a>) — | |
| Variational Auto-Encoder Model <a href="https://huggingface.co/hunyuanvideo-community/HunyuanVideo" rel="nofollow">hunyuanvideo-community/HunyuanVideo | |
| (vae)</a> to encode and decode videos to and from | |
| latent representations.`,name:"vae"},{anchor:"diffusers.Kandinsky5I2VPipeline.text_encoder",description:`<strong>text_encoder</strong> (<code>Qwen2_5_VLForConditionalGeneration</code>) — | |
| Frozen text-encoder <a href="https://huggingface.co/Qwen/Qwen2.5-VL-7B-Instruct" rel="nofollow">Qwen2.5-VL</a>.`,name:"text_encoder"},{anchor:"diffusers.Kandinsky5I2VPipeline.tokenizer",description:`<strong>tokenizer</strong> (<code>AutoProcessor</code>) — | |
| Tokenizer for Qwen2.5-VL.`,name:"tokenizer"},{anchor:"diffusers.Kandinsky5I2VPipeline.text_encoder_2",description:`<strong>text_encoder_2</strong> (<code>CLIPTextModel</code>) — | |
| Frozen <a href="https://huggingface.co/docs/transformers/model_doc/clip#transformers.CLIPTextModel" rel="nofollow">CLIP</a>, | |
| specifically the <a href="https://huggingface.co/openai/clip-vit-large-patch14" rel="nofollow">clip-vit-large-patch14</a> variant.`,name:"text_encoder_2"},{anchor:"diffusers.Kandinsky5I2VPipeline.tokenizer_2",description:`<strong>tokenizer_2</strong> (<code>CLIPTokenizer</code>) — | |
| Tokenizer for CLIP.`,name:"tokenizer_2"},{anchor:"diffusers.Kandinsky5I2VPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/pr_14192/en/api/schedulers/flow_match_euler_discrete#diffusers.FlowMatchEulerDiscreteScheduler">FlowMatchEulerDiscreteScheduler</a>) — | |
| A scheduler to be used in combination with <code>transformer</code> to denoise the encoded video latents.`,name:"scheduler"}]});var M=e(D,6),L=t(M);s(L,{name:"__call__",anchor:"diffusers.Kandinsky5I2VPipeline.__call__",source:"https://github.com/huggingface/diffusers/blob/vr_14192/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky_i2v.py#L749",parameters:[{name:"image",val:": typing.Union[PIL.Image.Image, numpy.ndarray, torch.Tensor, list[PIL.Image.Image], list[numpy.ndarray], list[torch.Tensor]]"},{name:"prompt",val:": str | list[str] = None"},{name:"negative_prompt",val:": str | list[str] | None = None"},{name:"height",val:": int = 512"},{name:"width",val:": int = 768"},{name:"num_frames",val:": int = 121"},{name:"num_inference_steps",val:": int = 50"},{name:"guidance_scale",val:": float = 5.0"},{name:"num_videos_per_prompt",val:": int | None = 1"},{name:"generator",val:": typing.Union[torch.Generator, list[torch.Generator], NoneType] = None"},{name:"latents",val:": typing.Optional[torch.Tensor] = None"},{name:"prompt_embeds_qwen",val:": typing.Optional[torch.Tensor] = None"},{name:"prompt_embeds_clip",val:": typing.Optional[torch.Tensor] = None"},{name:"negative_prompt_embeds_qwen",val:": typing.Optional[torch.Tensor] = None"},{name:"negative_prompt_embeds_clip",val:": typing.Optional[torch.Tensor] = None"},{name:"prompt_cu_seqlens",val:": typing.Optional[torch.Tensor] = None"},{name:"negative_prompt_cu_seqlens",val:": typing.Optional[torch.Tensor] = None"},{name:"output_type",val:": str | None = 'pil'"},{name:"return_dict",val:": bool = True"},{name:"callback_on_step_end",val:": typing.Optional[typing.Callable[[int, int, NoneType], diffusers.callbacks.PipelineCallback | diffusers.callbacks.MultiPipelineCallbacks]] = None"},{name:"callback_on_step_end_tensor_inputs",val:": list = ['latents']"},{name:"max_sequence_length",val:": int = 512"}],parametersDescription:[{anchor:"diffusers.Kandinsky5I2VPipeline.__call__.image",description:`<strong>image</strong> (<code>PipelineImageInput</code>) — | |
| 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.Kandinsky5I2VPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>list[str]</code>, <em>optional</em>) — | |
| The prompt or prompts to guide the video generation. If not defined, pass <code>prompt_embeds</code> instead.`,name:"prompt"},{anchor:"diffusers.Kandinsky5I2VPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>list[str]</code>, <em>optional</em>) — | |
| The prompt or prompts to avoid during video generation. If not defined, pass <code>negative_prompt_embeds</code> | |
| instead. Ignored when not using guidance (<code>guidance_scale</code> < <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.Kandinsky5I2VPipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, defaults to <code>512</code>) — | |
| The height in pixels of the generated video.`,name:"height"},{anchor:"diffusers.Kandinsky5I2VPipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>, defaults to <code>768</code>) — | |
| The width in pixels of the generated video.`,name:"width"},{anchor:"diffusers.Kandinsky5I2VPipeline.__call__.num_frames",description:`<strong>num_frames</strong> (<code>int</code>, defaults to <code>121</code>) — | |
| The number of frames in the generated video.`,name:"num_frames"},{anchor:"diffusers.Kandinsky5I2VPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, defaults to <code>50</code>) — | |
| The number of denoising steps.`,name:"num_inference_steps"},{anchor:"diffusers.Kandinsky5I2VPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, defaults to <code>5.0</code>) — | |
| Guidance scale as defined in classifier-free guidance.`,name:"guidance_scale"},{anchor:"diffusers.Kandinsky5I2VPipeline.__call__.num_videos_per_prompt",description:`<strong>num_videos_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) — | |
| The number of videos to generate per prompt.`,name:"num_videos_per_prompt"},{anchor:"diffusers.Kandinsky5I2VPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>list[torch.Generator]</code>, <em>optional</em>) — | |
| A torch generator to make generation deterministic.`,name:"generator"},{anchor:"diffusers.Kandinsky5I2VPipeline.__call__.latents",description:`<strong>latents</strong> (<code>torch.Tensor</code>, <em>optional</em>) — | |
| Pre-generated noisy latents.`,name:"latents"},{anchor:"diffusers.Kandinsky5I2VPipeline.__call__.prompt_embeds_qwen",description:`<strong>prompt_embeds_qwen</strong> (<code>torch.Tensor</code>, <em>optional</em>) — | |
| Pre-generated Qwen text embeddings.`,name:"prompt_embeds_qwen"},{anchor:"diffusers.Kandinsky5I2VPipeline.__call__.prompt_embeds_clip",description:`<strong>prompt_embeds_clip</strong> (<code>torch.Tensor</code>, <em>optional</em>) — | |
| Pre-generated CLIP text embeddings.`,name:"prompt_embeds_clip"},{anchor:"diffusers.Kandinsky5I2VPipeline.__call__.negative_prompt_embeds_qwen",description:`<strong>negative_prompt_embeds_qwen</strong> (<code>torch.Tensor</code>, <em>optional</em>) — | |
| Pre-generated Qwen negative text embeddings.`,name:"negative_prompt_embeds_qwen"},{anchor:"diffusers.Kandinsky5I2VPipeline.__call__.negative_prompt_embeds_clip",description:`<strong>negative_prompt_embeds_clip</strong> (<code>torch.Tensor</code>, <em>optional</em>) — | |
| Pre-generated CLIP negative text embeddings.`,name:"negative_prompt_embeds_clip"},{anchor:"diffusers.Kandinsky5I2VPipeline.__call__.prompt_cu_seqlens",description:`<strong>prompt_cu_seqlens</strong> (<code>torch.Tensor</code>, <em>optional</em>) — | |
| Pre-generated cumulative sequence lengths for Qwen positive prompt.`,name:"prompt_cu_seqlens"},{anchor:"diffusers.Kandinsky5I2VPipeline.__call__.negative_prompt_cu_seqlens",description:`<strong>negative_prompt_cu_seqlens</strong> (<code>torch.Tensor</code>, <em>optional</em>) — | |
| Pre-generated cumulative sequence lengths for Qwen negative prompt.`,name:"negative_prompt_cu_seqlens"},{anchor:"diffusers.Kandinsky5I2VPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>"pil"</code>) — | |
| The output format of the generated video.`,name:"output_type"},{anchor:"diffusers.Kandinsky5I2VPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether or not to return a <code>KandinskyPipelineOutput</code>.`,name:"return_dict"},{anchor:"diffusers.Kandinsky5I2VPipeline.__call__.callback_on_step_end",description:`<strong>callback_on_step_end</strong> (<code>Callable</code>, <code>PipelineCallback</code>, <code>MultiPipelineCallbacks</code>, <em>optional</em>) — | |
| A function that is called at the end of each denoising step.`,name:"callback_on_step_end"},{anchor:"diffusers.Kandinsky5I2VPipeline.__call__.callback_on_step_end_tensor_inputs",description:`<strong>callback_on_step_end_tensor_inputs</strong> (<code>List</code>, <em>optional</em>) — | |
| The list of tensor inputs for the <code>callback_on_step_end</code> function.`,name:"callback_on_step_end_tensor_inputs"},{anchor:"diffusers.Kandinsky5I2VPipeline.__call__.max_sequence_length",description:`<strong>max_sequence_length</strong> (<code>int</code>, defaults to <code>512</code>) — | |
| The maximum sequence length for text encoding.`,name:"max_sequence_length"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>If <code>return_dict</code> is <code>True</code>, <code>KandinskyPipelineOutput</code> is returned, otherwise a <code>tuple</code> is returned | |
| where the first element is a list with the generated videos.</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><code>~KandinskyPipelineOutput</code> or <code>tuple</code></p> | |
| `});var ce=e(L,4);ne(ce,{anchor:"diffusers.Kandinsky5I2VPipeline.__call__.example",children:(l,p)=>{var r=se(),w=e(v(r),2);o(w,{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwS2FuZGluc2t5NUkyVlBpcGVsaW5lJTBBZnJvbSUyMGRpZmZ1c2Vycy51dGlscyUyMGltcG9ydCUyMGV4cG9ydF90b192aWRlbyUyQyUyMGxvYWRfaW1hZ2UlMEElMEElMjMlMjBB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MGJhY2t3YXJkcyUyMiUwQSUwQW91dHB1dCUyMCUzRCUyMHBpcGUoJTBBJTIwJTIwJTIwJTIwaW1hZ2UlM0RpbWFnZSUyQyUwQSUyMCUyMCUyMCUyMHByb21wdCUzRHByb21wdCUyQyUwQSUyMCUyMCUyMCUyMG5lZ2F0aXZlX3Byb21wdCUzRG5lZ2F0aXZlX3Byb21wdCUyQyUwQSUyMCUyMCUyMCUyMGhlaWdodCUzRDUxMiUyQyUwQSUyMCUyMCUyMCUyMHdpZHRoJTNENzY4JTJDJTBBJTIwJTIwJTIwJTIwbnVtX2ZyYW1lcyUzRDEyMSUyQyUwQSUyMCUyMCUyMCUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0Q1MCUyQyUwQSUyMCUyMCUyMCUyMGd1aWRhbmNlX3NjYWxlJTNENS4wJTJDJTBBKS5mcmFtZXMlNUIwJTVEJTBBJTBBZXhwb3J0X3RvX3ZpZGVvKG91dHB1dCUyQyUyMCUyMm91dHB1dC5tcDQlMjIlMkMlMjBmcHMlM0QyNCUyQyUyMHF1YWxpdHklM0Q5KQ==",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> Kandinsky5I2VPipeline | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> export_to_video, load_image | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Available models:</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># kandinskylab/Kandinsky-5.0-I2V-Pro-sft-5s-Diffusers</span> | |
| <span class="hljs-meta">>>> </span>model_id = <span class="hljs-string">"kandinskylab/Kandinsky-5.0-I2V-Pro-sft-5s-Diffusers"</span> | |
| <span class="hljs-meta">>>> </span>pipe = Kandinsky5I2VPipeline.from_pretrained(model_id, torch_dtype=torch.bfloat16) | |
| <span class="hljs-meta">>>> </span>pipe = pipe.to(<span class="hljs-string">"cuda"</span>) | |
| <span class="hljs-meta">>>> </span>image = load_image( | |
| <span class="hljs-meta">... </span> <span class="hljs-string">"https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/astronaut.jpg"</span> | |
| <span class="hljs-meta">... </span>) | |
| <span class="hljs-meta">>>> </span>prompt = <span class="hljs-string">"An astronaut floating in space with Earth in the background, cinematic shot"</span> | |
| <span class="hljs-meta">>>> </span>negative_prompt = <span class="hljs-string">"Static, 2D cartoon, cartoon, 2d animation, paintings, images, worst quality, low quality, ugly, deformed, walking backwards"</span> | |
| <span class="hljs-meta">>>> </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=<span class="hljs-number">512</span>, | |
| <span class="hljs-meta">... </span> width=<span class="hljs-number">768</span>, | |
| <span class="hljs-meta">... </span> num_frames=<span class="hljs-number">121</span>, | |
| <span class="hljs-meta">... </span> num_inference_steps=<span class="hljs-number">50</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">>>> </span>export_to_video(output, <span class="hljs-string">"output.mp4"</span>, fps=<span class="hljs-number">24</span>, quality=<span class="hljs-number">9</span>)`,lang:"python",wrap:!1}),d(l,r)},$$slots:{default:!0}}),a(M);var f=e(M,2),me=t(f);s(me,{name:"check_inputs",anchor:"diffusers.Kandinsky5I2VPipeline.check_inputs",source:"https://github.com/huggingface/diffusers/blob/vr_14192/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky_i2v.py#L545",parameters:[{name:"prompt",val:""},{name:"negative_prompt",val:""},{name:"image",val:""},{name:"height",val:""},{name:"width",val:""},{name:"prompt_embeds_qwen",val:" = None"},{name:"prompt_embeds_clip",val:" = None"},{name:"negative_prompt_embeds_qwen",val:" = None"},{name:"negative_prompt_embeds_clip",val:" = None"},{name:"prompt_cu_seqlens",val:" = None"},{name:"negative_prompt_cu_seqlens",val:" = None"},{name:"callback_on_step_end_tensor_inputs",val:" = None"},{name:"max_sequence_length",val:" = None"}],parametersDescription:[{anchor:"diffusers.Kandinsky5I2VPipeline.check_inputs.prompt",description:"<strong>prompt</strong> — Input prompt",name:"prompt"},{anchor:"diffusers.Kandinsky5I2VPipeline.check_inputs.negative_prompt",description:"<strong>negative_prompt</strong> — Negative prompt for guidance",name:"negative_prompt"},{anchor:"diffusers.Kandinsky5I2VPipeline.check_inputs.image",description:"<strong>image</strong> — Input image for conditioning",name:"image"},{anchor:"diffusers.Kandinsky5I2VPipeline.check_inputs.height",description:"<strong>height</strong> — Video height",name:"height"},{anchor:"diffusers.Kandinsky5I2VPipeline.check_inputs.width",description:"<strong>width</strong> — Video width",name:"width"},{anchor:"diffusers.Kandinsky5I2VPipeline.check_inputs.prompt_embeds_qwen",description:"<strong>prompt_embeds_qwen</strong> — Pre-computed Qwen prompt embeddings",name:"prompt_embeds_qwen"},{anchor:"diffusers.Kandinsky5I2VPipeline.check_inputs.prompt_embeds_clip",description:"<strong>prompt_embeds_clip</strong> — Pre-computed CLIP prompt embeddings",name:"prompt_embeds_clip"},{anchor:"diffusers.Kandinsky5I2VPipeline.check_inputs.negative_prompt_embeds_qwen",description:"<strong>negative_prompt_embeds_qwen</strong> — Pre-computed Qwen negative prompt embeddings",name:"negative_prompt_embeds_qwen"},{anchor:"diffusers.Kandinsky5I2VPipeline.check_inputs.negative_prompt_embeds_clip",description:"<strong>negative_prompt_embeds_clip</strong> — Pre-computed CLIP negative prompt embeddings",name:"negative_prompt_embeds_clip"},{anchor:"diffusers.Kandinsky5I2VPipeline.check_inputs.prompt_cu_seqlens",description:"<strong>prompt_cu_seqlens</strong> — Pre-computed cumulative sequence lengths for Qwen positive prompt",name:"prompt_cu_seqlens"},{anchor:"diffusers.Kandinsky5I2VPipeline.check_inputs.negative_prompt_cu_seqlens",description:"<strong>negative_prompt_cu_seqlens</strong> — Pre-computed cumulative sequence lengths for Qwen negative prompt",name:"negative_prompt_cu_seqlens"},{anchor:"diffusers.Kandinsky5I2VPipeline.check_inputs.callback_on_step_end_tensor_inputs",description:"<strong>callback_on_step_end_tensor_inputs</strong> — Callback tensor inputs",name:"callback_on_step_end_tensor_inputs"}],raiseDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <ul> | |
| <li><code>ValueError</code> — If inputs are invalid</li> | |
| </ul> | |
| `,raiseType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><code>ValueError</code></p> | |
| `}),i(2),a(f);var b=e(f,2),ue=t(b);s(ue,{name:"encode_prompt",anchor:"diffusers.Kandinsky5I2VPipeline.encode_prompt",source:"https://github.com/huggingface/diffusers/blob/vr_14192/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky_i2v.py#L454",parameters:[{name:"prompt",val:": str | list[str]"},{name:"num_videos_per_prompt",val:": int = 1"},{name:"max_sequence_length",val:": int = 512"},{name:"device",val:": typing.Optional[torch.device] = None"},{name:"dtype",val:": typing.Optional[torch.dtype] = None"}],parametersDescription:[{anchor:"diffusers.Kandinsky5I2VPipeline.encode_prompt.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>list[str]</code>) — | |
| Prompt to be encoded.`,name:"prompt"},{anchor:"diffusers.Kandinsky5I2VPipeline.encode_prompt.num_videos_per_prompt",description:`<strong>num_videos_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) — | |
| Number of videos to generate per prompt.`,name:"num_videos_per_prompt"},{anchor:"diffusers.Kandinsky5I2VPipeline.encode_prompt.max_sequence_length",description:`<strong>max_sequence_length</strong> (<code>int</code>, <em>optional</em>, defaults to 512) — | |
| Maximum sequence length for text encoding.`,name:"max_sequence_length"},{anchor:"diffusers.Kandinsky5I2VPipeline.encode_prompt.device",description:`<strong>device</strong> (<code>torch.device</code>, <em>optional</em>) — | |
| Torch device.`,name:"device"},{anchor:"diffusers.Kandinsky5I2VPipeline.encode_prompt.dtype",description:`<strong>dtype</strong> (<code>torch.dtype</code>, <em>optional</em>) — | |
| Torch dtype.`,name:"dtype"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <ul> | |
| <li>Qwen text embeddings of shape (batch_size * num_videos_per_prompt, sequence_length, embedding_dim)</li> | |
| <li>CLIP pooled embeddings of shape (batch_size * num_videos_per_prompt, clip_embedding_dim)</li> | |
| <li>Cumulative sequence lengths (<code>cu_seqlens</code>) for Qwen embeddings of shape (batch_size * | |
| num_videos_per_prompt + 1,)</li> | |
| </ul> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>tuple[torch.Tensor, torch.Tensor, torch.Tensor]</p> | |
| `}),i(4),a(b);var T=e(b,2),ye=t(T);s(ye,{name:"fast_sta_nabla",anchor:"diffusers.Kandinsky5I2VPipeline.fast_sta_nabla",source:"https://github.com/huggingface/diffusers/blob/vr_14192/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky_i2v.py#L226",parameters:[{name:"T",val:": int"},{name:"H",val:": int"},{name:"W",val:": int"},{name:"wT",val:": int = 3"},{name:"wH",val:": int = 3"},{name:"wW",val:": int = 3"},{name:"device",val:" = 'cuda'"}],parametersDescription:[{anchor:"diffusers.Kandinsky5I2VPipeline.fast_sta_nabla.T",description:"<strong>T</strong> (int) — Number of temporal frames",name:"T"},{anchor:"diffusers.Kandinsky5I2VPipeline.fast_sta_nabla.H",description:"<strong>H</strong> (int) — Height in latent space",name:"H"},{anchor:"diffusers.Kandinsky5I2VPipeline.fast_sta_nabla.W",description:"<strong>W</strong> (int) — Width in latent space",name:"W"},{anchor:"diffusers.Kandinsky5I2VPipeline.fast_sta_nabla.wT",description:"<strong>wT</strong> (int) — Temporal attention window size",name:"wT"},{anchor:"diffusers.Kandinsky5I2VPipeline.fast_sta_nabla.wH",description:"<strong>wH</strong> (int) — Height attention window size",name:"wH"},{anchor:"diffusers.Kandinsky5I2VPipeline.fast_sta_nabla.wW",description:"<strong>wW</strong> (int) — Width attention window size",name:"wW"},{anchor:"diffusers.Kandinsky5I2VPipeline.fast_sta_nabla.device",description:"<strong>device</strong> (str) — Device to create tensor on",name:"device"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>Sparse attention mask of shape (T<em>H</em>W, T<em>H</em>W)</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>torch.Tensor</p> | |
| `}),i(4),a(T);var k=e(T,2),he=t(k);s(he,{name:"get_sparse_params",anchor:"diffusers.Kandinsky5I2VPipeline.get_sparse_params",source:"https://github.com/huggingface/diffusers/blob/vr_14192/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky_i2v.py#L261",parameters:[{name:"sample",val:""},{name:"device",val:""}],parametersDescription:[{anchor:"diffusers.Kandinsky5I2VPipeline.get_sparse_params.sample",description:"<strong>sample</strong> (torch.Tensor) — Input sample tensor",name:"sample"},{anchor:"diffusers.Kandinsky5I2VPipeline.get_sparse_params.device",description:"<strong>device</strong> (torch.device) — Device to place tensors on",name:"device"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>Dictionary containing sparse attention parameters</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>Dict</p> | |
| `}),i(4),a(k);var O=e(k,2),ge=t(O);s(ge,{name:"prepare_latents",anchor:"diffusers.Kandinsky5I2VPipeline.prepare_latents",source:"https://github.com/huggingface/diffusers/blob/vr_14192/src/diffusers/pipelines/kandinsky5/pipeline_kandinsky_i2v.py#L636",parameters:[{name:"image",val:": typing.Union[PIL.Image.Image, numpy.ndarray, torch.Tensor, list[PIL.Image.Image], list[numpy.ndarray], list[torch.Tensor]]"},{name:"batch_size",val:": int"},{name:"num_channels_latents",val:": int = 16"},{name:"height",val:": int = 480"},{name:"width",val:": int = 832"},{name:"num_frames",val:": int = 81"},{name:"dtype",val:": typing.Optional[torch.dtype] = None"},{name:"device",val:": typing.Optional[torch.device] = None"},{name:"generator",val:": typing.Union[torch.Generator, list[torch.Generator], NoneType] = None"},{name:"latents",val:": typing.Optional[torch.Tensor] = None"}],parametersDescription:[{anchor:"diffusers.Kandinsky5I2VPipeline.prepare_latents.image",description:"<strong>image</strong> (PipelineImageInput) — Input image to condition the generation on",name:"image"},{anchor:"diffusers.Kandinsky5I2VPipeline.prepare_latents.batch_size",description:"<strong>batch_size</strong> (int) — Number of videos to generate",name:"batch_size"},{anchor:"diffusers.Kandinsky5I2VPipeline.prepare_latents.num_channels_latents",description:"<strong>num_channels_latents</strong> (int) — Number of channels in latent space",name:"num_channels_latents"},{anchor:"diffusers.Kandinsky5I2VPipeline.prepare_latents.height",description:"<strong>height</strong> (int) — Height of generated video",name:"height"},{anchor:"diffusers.Kandinsky5I2VPipeline.prepare_latents.width",description:"<strong>width</strong> (int) — Width of generated video",name:"width"},{anchor:"diffusers.Kandinsky5I2VPipeline.prepare_latents.num_frames",description:"<strong>num_frames</strong> (int) — Number of frames in video",name:"num_frames"},{anchor:"diffusers.Kandinsky5I2VPipeline.prepare_latents.dtype",description:"<strong>dtype</strong> (torch.dtype) — Data type for latents",name:"dtype"},{anchor:"diffusers.Kandinsky5I2VPipeline.prepare_latents.device",description:"<strong>device</strong> (torch.device) — Device to create latents on",name:"device"},{anchor:"diffusers.Kandinsky5I2VPipeline.prepare_latents.generator",description:"<strong>generator</strong> (torch.Generator) — Random number generator",name:"generator"},{anchor:"diffusers.Kandinsky5I2VPipeline.prepare_latents.latents",description:"<strong>latents</strong> (torch.Tensor) — Pre-existing latents to use",name:"latents"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>Prepared latent tensor with first frame as encoded image</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>torch.Tensor</p> | |
| `}),i(4),a(O),a(_);var $=e(_,2);n($,{title:"Citation",local:"citation",headingTag:"h2"});var ee=e($,2);o(ee,{code:"JTQwbWlzYyU3Qmthbm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TIwR2F2cmlsb3ZhJTIwYW5kJTIwUG9saW5hJTIwTWlraGFpbG92YSUyMGFuZCUyMFRhdGlhbmElMjBOaWt1bGluYSUyMGFuZCUyMFZpYWNoZXNsYXYlMjBWYXNpbGV2JTIwYW5kJTIwVmxhZGltaXIlMjBBcmtoaXBraW4lMjBhbmQlMjBWbGFkaW1pciUyMEtvcnZpYWtvdiUyMGFuZCUyMFZsYWRpbWlyJTIwUG9sb3ZuaWtvdiUyMGFuZCUyMFl1cnklMjBLb2xhYnVzaGluJTdEJTJDJTBBJTIwJTIwJTIwJTIwdGl0bGUlMjAlM0QlMjAlN0JLYW5kaW5za3klMjA1LjAlM0ElMjBBJTIwZmFtaWx5JTIwb2YlMjBkaWZmdXNpb24lMjBtb2RlbHMlMjBmb3IlMjBWaWRlbyUyMCUyNiUyMEltYWdlJTIwZ2VuZXJhdGlvbiU3RCUyQyUwQSUyMCUyMCUyMCUyMGhvd3B1Ymxpc2hlZCUyMCUzRCUyMCU3QiU1Q3VybCU3Qmh0dHBzJTNBJTJGJTJGZ2l0aHViLmNvbSUyRmthbmRpbnNreWxhYiUyRkthbmRpbnNreS01JTdEJTdEJTJDJTBBJTIwJTIwJTIwJTIweWVhciUyMCUzRCUyMDIwMjUlMEElN0Q=",highlighted:`<span class="hljs-comment">@misc{kandinsky2025,</span> | |
| author = {Alexander Belykh <span class="hljs-keyword">and</span> Alexander Varlamov <span class="hljs-keyword">and</span> Alexey Letunovskiy <span class="hljs-keyword">and</span> Anastasia Aliaskina <span class="hljs-keyword">and</span> Anastasia Maltseva <span class="hljs-keyword">and</span> Anastasiia Kargapoltseva <span class="hljs-keyword">and</span> Andrey Shutkin <span class="hljs-keyword">and</span> Anna Averchenkova <span class="hljs-keyword">and</span> Anna Dmitrienko <span class="hljs-keyword">and</span> Bulat Akhmatov <span class="hljs-keyword">and</span> Denis Dimitrov <span class="hljs-keyword">and</span> Denis Koposov <span class="hljs-keyword">and</span> Denis Parkhomenko <span class="hljs-keyword">and</span> Dmitrii <span class="hljs-keyword">and</span> Ilya Vasiliev <span class="hljs-keyword">and</span> Ivan Kirillov <span class="hljs-keyword">and</span> Julia Agafonova <span class="hljs-keyword">and</span> Kirill Chernyshev <span class="hljs-keyword">and</span> Kormilitsyn Semen <span class="hljs-keyword">and</span> Lev Novitskiy <span class="hljs-keyword">and</span> Maria Kovaleva <span class="hljs-keyword">and</span> Mikhail Mamaev <span class="hljs-keyword">and</span> Mikhailov <span class="hljs-keyword">and</span> Nikita Kiselev <span class="hljs-keyword">and</span> Nikita Osterov <span class="hljs-keyword">and</span> Nikolai Gerasimenko <span class="hljs-keyword">and</span> Nikolai Vaulin <span class="hljs-keyword">and</span> Olga Kim <span class="hljs-keyword">and</span> Olga Vdovchenko <span class="hljs-keyword">and</span> Polina Gavrilova <span class="hljs-keyword">and</span> Polina Mikhailova <span class="hljs-keyword">and</span> Tatiana Nikulina <span class="hljs-keyword">and</span> Viacheslav Vasilev <span class="hljs-keyword">and</span> Vladimir Arkhipkin <span class="hljs-keyword">and</span> Vladimir Korviakov <span class="hljs-keyword">and</span> Vladimir Polovnikov <span class="hljs-keyword">and</span> Yury Kolabushin}, | |
| title = {Kandinsky <span class="hljs-number">5</span>.<span class="hljs-number">0</span>: A family of diffusion models for Video & Image generation}, | |
| howpublished = {\\url{https:<span class="hljs-comment">//github.com/kandinskylab/Kandinsky-5}},</span> | |
| year = <span class="hljs-number">2025</span> | |
| }`,lang:"bibtex",wrap:!1});var _e=e(ee,2);Te(_e,{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/pipelines/kandinsky5_video.md"}),i(2),d(te,J),Ue()}export{Ze as component}; | |
Xet Storage Details
- Size:
- 90.2 kB
- Xet hash:
- cbf28fed9872d0cb6159158061d469376d7fb4ba20a952dd49b91e5a91564f30
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.