Buckets:
| import"../chunks/DsnmJJEf.js";import{i as ge,h as ye,C as ke,H as o,a as i,D as a,E as be,s as ve}from"../chunks/BLbO27j4.js";import{p as Te,o as Me,s as e,f as I,a as c,b as we,c as n,d as x,r as s,n as t}from"../chunks/jDjavuwI.js";import{E as $}from"../chunks/DFZbkwCk.js";const Ie='{"title":"Kandinsky 6","local":"kandinsky-6","sections":[{"title":"Available models","local":"available-models","sections":[],"depth":2},{"title":"Text/image-to-video-and-audio","local":"textimage-to-video-and-audio","sections":[],"depth":2},{"title":"Video super-resolution","local":"video-super-resolution","sections":[],"depth":2},{"title":"Memory optimization","local":"memory-optimization","sections":[],"depth":2},{"title":"Notes","local":"notes","sections":[],"depth":2},{"title":"Kandinsky6TI2VAPipeline","local":"diffusers.Kandinsky6TI2VAPipeline","sections":[],"depth":2},{"title":"Kandinsky6SRPipeline","local":"diffusers.Kandinsky6SRPipeline","sections":[],"depth":2},{"title":"Kandinsky6SRLatentUpscalerBank","local":"diffusers.Kandinsky6SRLatentUpscalerBank","sections":[],"depth":2},{"title":"Kandinsky6TI2VAPipelineOutput","local":"diffusers.Kandinsky6TI2VAPipelineOutput","sections":[],"depth":2},{"title":"Kandinsky6SRPipelineOutput","local":"diffusers.Kandinsky6SRPipelineOutput","sections":[],"depth":2}],"depth":1}';var xe=x('<meta name="hf:doc:metadata"/>'),ee=x("<p>Examples:</p> <!>",1),Ve=x(`<p></p> <!> <!> <p>Kandinsky 6 is a family of video generation models from <a href="https://huggingface.co/kandinskylab" rel="nofollow">Kandinsky Lab</a>. The | |
| main model generates video and synchronized audio from text or a reference image with a single multimodal diffusion | |
| transformer: video and audio latents are denoised together through fused blocks that cross-attend between the two | |
| modalities, each conditioned on its own Qwen2.5-VL text branch and a CLIP pooled embedding. A separate | |
| super-resolution model upscales the generated video tile by tile in the latent space of a causal 3D K-VAE.</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 full set of | |
| official checkpoints, including flow-matching and distilled variants of both the base and super-resolution models.</p> <p>Distilled checkpoints ship with the few-step <a href="/docs/diffusers/pr_14949/en/api/schedulers/piflow#diffusers.PiflowScheduler">PiflowScheduler</a> and must be run with <code>guidance_scale=1.0</code>.</p></blockquote> <!> <table><thead><tr><th>Model</th><th>Pipeline</th><th>Notes</th></tr></thead><tbody><tr><td><a href="https://huggingface.co/kandinskylab/Kandinsky-6.0-Pro-5s-Diffusers" rel="nofollow"><code>kandinskylab/Kandinsky-6.0-Pro-5s-Diffusers</code></a></td><td><a href="/docs/diffusers/pr_14949/en/api/pipelines/kandinsky6#diffusers.Kandinsky6TI2VAPipeline">Kandinsky6TI2VAPipeline</a></td><td>Flow matching, <code>guidance_scale=5.0</code>, 50 steps</td></tr><tr><td><a href="https://huggingface.co/kandinskylab/Kandinsky-6.0-Pro-distill-5s-Diffusers" rel="nofollow"><code>kandinskylab/Kandinsky-6.0-Pro-distill-5s-Diffusers</code></a></td><td><a href="/docs/diffusers/pr_14949/en/api/pipelines/kandinsky6#diffusers.Kandinsky6TI2VAPipeline">Kandinsky6TI2VAPipeline</a></td><td>Distilled, <code>guidance_scale=1.0</code>, 10 steps</td></tr><tr><td><a href="https://huggingface.co/kandinskylab/Kandinsky-6.0-Lite-5s-Diffusers" rel="nofollow"><code>kandinskylab/Kandinsky-6.0-Lite-5s-Diffusers</code></a></td><td><a href="/docs/diffusers/pr_14949/en/api/pipelines/kandinsky6#diffusers.Kandinsky6TI2VAPipeline">Kandinsky6TI2VAPipeline</a></td><td>Flow matching, <code>guidance_scale=5.0</code>, 50 steps</td></tr><tr><td><a href="https://huggingface.co/kandinskylab/Kandinsky-6.0-Lite-distill-5s-Diffusers" rel="nofollow"><code>kandinskylab/Kandinsky-6.0-Lite-distill-5s-Diffusers</code></a></td><td><a href="/docs/diffusers/pr_14949/en/api/pipelines/kandinsky6#diffusers.Kandinsky6TI2VAPipeline">Kandinsky6TI2VAPipeline</a></td><td>Distilled, <code>guidance_scale=1.0</code>, 10 steps</td></tr><tr><td><a href="https://huggingface.co/kandinskylab/Kandinsky-6.0-Pro-pretrain-5s-Diffusers" rel="nofollow"><code>kandinskylab/Kandinsky-6.0-Pro-pretrain-5s-Diffusers</code></a></td><td><a href="/docs/diffusers/pr_14949/en/api/pipelines/kandinsky6#diffusers.Kandinsky6TI2VAPipeline">Kandinsky6TI2VAPipeline</a></td><td>Flow matching, <code>guidance_scale=5.0</code>, 50 steps</td></tr><tr><td><a href="https://huggingface.co/kandinskylab/Kandinsky-6.0-Lite-pretrain-5s-Diffusers" rel="nofollow"><code>kandinskylab/Kandinsky-6.0-Lite-pretrain-5s-Diffusers</code></a></td><td><a href="/docs/diffusers/pr_14949/en/api/pipelines/kandinsky6#diffusers.Kandinsky6TI2VAPipeline">Kandinsky6TI2VAPipeline</a></td><td>Flow matching, <code>guidance_scale=5.0</code>, 50 steps</td></tr><tr><td><a href="https://huggingface.co/kandinskylab/Kandinsky-6.0-VSR-5s-Diffusers" rel="nofollow"><code>kandinskylab/Kandinsky-6.0-VSR-5s-Diffusers</code></a></td><td><a href="/docs/diffusers/pr_14949/en/api/pipelines/kandinsky6#diffusers.Kandinsky6SRPipeline">Kandinsky6SRPipeline</a></td><td>Flow matching super-resolution</td></tr><tr><td><a href="https://huggingface.co/kandinskylab/Kandinsky-6.0-VSR-distilled2steps-5s-Diffusers" rel="nofollow"><code>kandinskylab/Kandinsky-6.0-VSR-distilled2steps-5s-Diffusers</code></a></td><td><a href="/docs/diffusers/pr_14949/en/api/pipelines/kandinsky6#diffusers.Kandinsky6SRPipeline">Kandinsky6SRPipeline</a></td><td>Distilled super-resolution, 2 steps</td></tr></tbody></table> <!> <!> <p>Pass <code>image=</code> to condition the first frame on a reference image, <code>sample_audio=False</code> to generate video only, and <code>expand_prompts=True</code> to let the Qwen2.5-VL text encoder rewrite short prompts into detailed ones first.</p> <!> <p><a href="/docs/diffusers/pr_14949/en/api/pipelines/kandinsky6#diffusers.Kandinsky6SRPipeline">Kandinsky6SRPipeline</a> takes the frames produced by <a href="/docs/diffusers/pr_14949/en/api/pipelines/kandinsky6#diffusers.Kandinsky6TI2VAPipeline">Kandinsky6TI2VAPipeline</a> and upscales them by <code>2</code>, <code>4</code>, or <code>2.25</code> (a 1.125x bilinear pre-upscale followed by the 2x path). The video is split into overlapping tiles, every tile | |
| is refined at one of the tile sizes the SR transformer was trained on, and the tiles are blended back with Hann | |
| windows.</p> <!> <!> <p>Refer to the <a href="../../optimization/memory">Reduce memory usage</a> guide for the general set of techniques. Both <a href="/docs/diffusers/pr_14949/en/api/pipelines/kandinsky6#diffusers.Kandinsky6TI2VAPipeline">Kandinsky6TI2VAPipeline</a> and <a href="/docs/diffusers/pr_14949/en/api/pipelines/kandinsky6#diffusers.Kandinsky6SRPipeline">Kandinsky6SRPipeline</a> support <a href="../../optimization/memory#model-offloading">model offloading</a> (used above) and, for a smaller footprint at the cost of speed, <a href="../../optimization/memory#cpu-offloading">sequential CPU offloading</a>:</p> <!> <p><a href="/docs/diffusers/pr_14949/en/api/pipelines/kandinsky6#diffusers.Kandinsky6TI2VAPipeline">Kandinsky6TI2VAPipeline</a>’s video VAE also supports <a href="../../optimization/memory#vae-tiling">tiled decoding</a> for high | |
| resolutions or long videos:</p> <!> <!> <ul><li><code>height</code> and <code>width</code> must be divisible by the video VAE’s spatial compression ratio times the transformer’s patch | |
| size — <code>16</code> with the default <a href="/docs/diffusers/pr_14949/en/api/pipelines/kandinsky6#diffusers.Kandinsky6TI2VAPipeline">Kandinsky6TI2VAPipeline</a> configuration (<code>AutoencoderKLHunyuanVideo</code> at a | |
| compression ratio of <code>8</code>, <code>patch_size=(1, 2, 2)</code>). <code>480x864</code>, used in the example above, satisfies this.</li> <li><a href="/docs/diffusers/pr_14949/en/api/pipelines/kandinsky6#diffusers.Kandinsky6SRPipeline">Kandinsky6SRPipeline</a>’s input <code>video</code> must have <code>1 + k * vae_scale_factor_temporal</code> frames for some integer <code>k</code> (a temporal compression ratio of <code>4</code> with the default K-VAE configuration, so <code>121</code> frames works but <code>120</code> doesn’t) | |
| — trim or pad a video that doesn’t already satisfy this before upscaling it.</li> <li><code>expand_prompts=True</code> reuses the already-loaded Qwen2.5-VL text encoder for an extra generation pass before | |
| denoising, so it adds latency but no extra model weights.</li> <li>Compile the repeated transformer blocks for faster repeated inference: <!></li></ul> <!> <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/image-to-video-and-audio generation with Kandinsky 6.</p> <p>Video and audio latents are denoised together by a single multimodal transformer, conditioned on Qwen2.5-VL text | |
| tokens and a CLIP pooled embedding. An optional reference image conditions the first frame.</p> <p>This model inherits from <a href="/docs/diffusers/pr_14949/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>Encodes the reference image(s) into first-frame latents of shape <code>(batch_size, latent_height, latent_width, latent_channels)</code>, scaled by the VAE <code>scaling_factor</code>. PIL images are resized and center-cropped to <code>height x width</code>; tensors and arrays must already have that size. The latents are repeated <code>num_videos_per_prompt</code> times | |
| along the batch dimension.</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 the prompt into text encoder hidden states.</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>Rewrites short prompts into detailed video+audio prompts with the Qwen2.5-VL text encoder, grounding them on | |
| the reference image when one is given. A <code>staticmethod</code> so it can be used standalone, before running 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>Returns audio latents in the transformer’s <code>(batch_size, audio_length, channels)</code> layout. A user-provided <code>audio_latents</code> tensor is expected in the <code>(batch_size, channels, audio_length)</code> layout.</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>Returns video latents in the transformer’s <code>(batch_size, num_frames, height, width, channels)</code> layout. | |
| A user-provided <code>latents</code> tensor is expected in the <code>(batch_size, channels, num_frames, height, width)</code> layout.</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 video super-resolution with Kandinsky 6.</p> <p>The video is split into overlapping spatial tiles, every tile is refined by the SR transformer at one of the tile | |
| sizes the model was trained on (<code>transformer.config.tile_sizes</code>), and the refined tiles are blended back with Hann | |
| windows. When the pipeline has a <code>latent_upscaler</code>, the tiles are cut from the K-VAE latents of the whole video and | |
| upscaled in latent space; otherwise the pixel tiles are bilinearly upscaled and encoded.</p> <p>This model inherits from <a href="/docs/diffusers/pr_14949/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 super-resolution.</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>Decodes scaled K-VAE latents into a <code>(batch_size, channels, num_frames, height, width)</code> video in <code>[-1, 1]</code>.</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 <code>(batch_size, channels, num_frames, height, width)</code> video in <code>[-1, 1]</code> into K-VAE latents scaled by | |
| the VAE <code>scaling_factor</code>.</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>Bank of latent upscalers used by <a href="/docs/diffusers/pr_14949/en/api/pipelines/kandinsky6#diffusers.Kandinsky6SRPipeline">Kandinsky6SRPipeline</a>: one <code>Kandinsky6SRLatentUpscaler</code> per supported spatial | |
| scale, operating on K-VAE latents.</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"><!></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>Output class for <a href="/docs/diffusers/pr_14949/en/api/pipelines/kandinsky6#diffusers.Kandinsky6TI2VAPipeline">Kandinsky6TI2VAPipeline</a>.</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>Output class for <a href="/docs/diffusers/pr_14949/en/api/pipelines/kandinsky6#diffusers.Kandinsky6SRPipeline">Kandinsky6SRPipeline</a>.</p></div> <!> <p></p>`,1);function Je(ne,se){Te(se,!1),Me(()=>{new URLSearchParams(window.location.search).get("fw")}),ge();var V=Ve();ye("19ws4wq",r=>{var l=xe();ve(l,"content",Ie),c(r,l)});var j=e(I(V),2);ke(j,{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"});var P=e(j,2);o(P,{title:"Kandinsky 6",local:"kandinsky-6",headingTag:"h1"});var K=e(P,6);o(K,{title:"Available models",local:"available-models",headingTag:"h2"});var U=e(K,4);o(U,{title:"Text/image-to-video-and-audio",local:"textimage-to-video-and-audio",headingTag:"h2"});var J=e(U,2);i(J,{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwS2FuZGluc2t5NlRJMlZBUGlwZWxpbmUlMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwZW5jb2RlX3ZpZGVvJTBBJTBBcGlwZSUyMCUzRCUyMEthbmRpbnNreTZUSTJWQVBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJrYW5kaW5za3lsYWIlMkZLYW5kaW5za3ktNi4wLVByby1kaXN0aWxsLTVzLURpZmZ1c2VycyUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guYmZsb2F0MTYlMEEpJTBBcGlwZS5lbmFibGVfbW9kZWxfY3B1X29mZmxvYWQoKSUwQSUwQW91dHB1dCUyMCUzRCUyMHBpcGUoJTBBJTIwJTIwJTIwJTIwcHJvbXB0JTNEJTIyQSUyMGNhdCUyMGFuZCUyMGElMjBkb2clMjBiYWtpbmclMjBhJTIwY2FrZSUyMHRvZ2V0aGVyJTIwaW4lMjBhJTIwa2l0Y2hlbi4lMjIlMkMlMEElMjAlMjAlMjAlMjBoZWlnaHQlM0Q0ODAlMkMlMEElMjAlMjAlMjAlMjB3aWR0aCUzRDg2NCUyQyUwQSUyMCUyMCUyMCUyMG51bV9mcmFtZXMlM0QxMjElMkMlMEElMjAlMjAlMjAlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNEMTAlMkMlMEElMjAlMjAlMjAlMjBndWlkYW5jZV9zY2FsZSUzRDEuMCUyQyUwQSklMEFlbmNvZGVfdmlkZW8oJTBBJTIwJTIwJTIwJTIwb3V0cHV0LmZyYW1lcyU1QjAlNUQlMkMlMEElMjAlMjAlMjAlMjBmcHMlM0QyNCUyQyUwQSUyMCUyMCUyMCUyMG91dHB1dF9wYXRoJTNEJTIyb3V0cHV0Lm1wNCUyMiUyQyUwQSUyMCUyMCUyMCUyMGF1ZGlvJTNEb3V0cHV0LmF1ZGlvJTVCMCU1RCU1Qk5vbmUlNUQlMkMlMEElMjAlMjAlMjAlMjBhdWRpb19zYW1wbGVfcmF0ZSUzRHBpcGUuYXVkaW9fc2FtcGxlX3JhdGUlMkMlMEEp",highlighted:`<span class="hljs-keyword">import</span> torch | |
| <span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> Kandinsky6TI2VAPipeline | |
| <span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> encode_video | |
| pipe = Kandinsky6TI2VAPipeline.from_pretrained( | |
| <span class="hljs-string">"kandinskylab/Kandinsky-6.0-Pro-distill-5s-Diffusers"</span>, torch_dtype=torch.bfloat16 | |
| ) | |
| pipe.enable_model_cpu_offload() | |
| output = pipe( | |
| prompt=<span class="hljs-string">"A cat and a dog baking a cake together in a kitchen."</span>, | |
| height=<span class="hljs-number">480</span>, | |
| width=<span class="hljs-number">864</span>, | |
| num_frames=<span class="hljs-number">121</span>, | |
| num_inference_steps=<span class="hljs-number">10</span>, | |
| guidance_scale=<span class="hljs-number">1.0</span>, | |
| ) | |
| encode_video( | |
| output.frames[<span class="hljs-number">0</span>], | |
| fps=<span class="hljs-number">24</span>, | |
| output_path=<span class="hljs-string">"output.mp4"</span>, | |
| audio=output.audio[<span class="hljs-number">0</span>][<span class="hljs-literal">None</span>], | |
| audio_sample_rate=pipe.audio_sample_rate, | |
| )`,lang:"python",wrap:!1});var A=e(J,4);o(A,{title:"Video super-resolution",local:"video-super-resolution",headingTag:"h2"});var R=e(A,4);i(R,{code:"JTIzJTIwcmVxdWlyZWQlM0ElMjBsZXRzJTIwaW5kdWN0b3IlMjBwaWNrJTIwZmxleC1hdHRlbnRpb24lMjB0aWxlcyUyMHRoYXQlMjBmaXQlMjB0aGUlMjBTUiUyMGJsb2NrJTIwbWFzayUwQXRvcmNoLl9pbmR1Y3Rvci5jb25maWcubWF4X2F1dG90dW5lJTIwJTNEJTIwVHJ1ZSUyMCUyMCUwQSUwQXNyX3BpcGUlMjAlM0QlMjBLYW5kaW5za3k2U1JQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIya2FuZGluc2t5bGFiJTJGS2FuZGluc2t5LTYuMC1WU1ItZGlzdGlsbGVkMnN0ZXBzLTVzLURpZmZ1c2VycyUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guYmZsb2F0MTYlMEEpJTBBJTIzJTIwVGhlJTIwU1IlMjB0cmFuc2Zvcm1lciUyMGFsd2F5cyUyMHJ1bnMlMjBOQUJMQSUyMHNwYXJzZSUyMGF0dGVudGlvbiUyMG9uJTIwdGhlJTIwJTYwZmxleCU2MCUyMGJhY2tlbmQuJTIwQ29tcGlsZSUyMGl0JTJDJTIwb3RoZXJ3aXNlJTIwZmxleCUyMGZhbGxzJTBBJTIzJTIwYmFjayUyMHRvJTIwYW4lMjBlYWdlciUyMGltcGxlbWVudGF0aW9uJTIwdGhhdCUyMG5lZWRzJTIwZmFyJTIwbW9yZSUyMG1lbW9yeSUyMGF0JTIwdmlkZW8lMjByZXNvbHV0aW9ucy4lMEFzcl9waXBlLmVuYWJsZV9tb2RlbF9jcHVfb2ZmbG9hZCgpJTBBc3JfcGlwZS50cmFuc2Zvcm1lci5zZXRfYXR0ZW50aW9uX2JhY2tlbmQoJTIyZmxleCUyMiklMEFzcl9waXBlLnRyYW5zZm9ybWVyLmNvbXBpbGVfcmVwZWF0ZWRfYmxvY2tzKGZ1bGxncmFwaCUzRFRydWUpJTBBJTBBdXBzY2FsZWQlMjAlM0QlMjBzcl9waXBlKHZpZGVvJTNEb3V0cHV0LmZyYW1lcyU1QjAlNUQlMkMlMjByZXNvbHV0aW9uX3NjYWxlJTNEMi4yNSUyQyUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0QyKS5mcmFtZXMlNUIwJTVE",highlighted:`<span class="hljs-comment"># required: lets inductor pick flex-attention tiles that fit the SR block mask</span> | |
| torch._inductor.config.max_autotune = <span class="hljs-literal">True</span> | |
| sr_pipe = Kandinsky6SRPipeline.from_pretrained( | |
| <span class="hljs-string">"kandinskylab/Kandinsky-6.0-VSR-distilled2steps-5s-Diffusers"</span>, torch_dtype=torch.bfloat16 | |
| ) | |
| <span class="hljs-comment"># The SR transformer always runs NABLA sparse attention on the \`flex\` backend. Compile it, otherwise flex falls</span> | |
| <span class="hljs-comment"># back to an eager implementation that needs far more memory at video resolutions.</span> | |
| sr_pipe.enable_model_cpu_offload() | |
| sr_pipe.transformer.set_attention_backend(<span class="hljs-string">"flex"</span>) | |
| sr_pipe.transformer.compile_repeated_blocks(fullgraph=<span class="hljs-literal">True</span>) | |
| upscaled = sr_pipe(video=output.frames[<span class="hljs-number">0</span>], resolution_scale=<span class="hljs-number">2.25</span>, num_inference_steps=<span class="hljs-number">2</span>).frames[<span class="hljs-number">0</span>]`,lang:"python",wrap:!1});var Z=e(R,2);o(Z,{title:"Memory optimization",local:"memory-optimization",headingTag:"h2"});var S=e(Z,4);i(S,{code:"cGlwZS5lbmFibGVfc2VxdWVudGlhbF9jcHVfb2ZmbG9hZCgp",highlighted:"pipe.enable_sequential_cpu_offload()",lang:"python",wrap:!1});var B=e(S,4);i(B,{code:"cGlwZS52YWUuZW5hYmxlX3RpbGluZygp",highlighted:"pipe.vae.enable_tiling()",lang:"python",wrap:!1});var G=e(B,2);o(G,{title:"Notes",local:"notes",headingTag:"h2"});var p=e(G,2),N=e(n(p),6),ae=e(n(N));i(ae,{code:"cGlwZS50cmFuc2Zvcm1lci5jb21waWxlX3JlcGVhdGVkX2Jsb2NrcyhmdWxsZ3JhcGglM0RUcnVlKQ==",highlighted:'pipe.transformer.compile_repeated_blocks(fullgraph=<span class="hljs-literal">True</span>)',lang:"python",wrap:!1}),s(N),s(p);var W=e(p,2);o(W,{title:"Kandinsky6TI2VAPipeline",local:"diffusers.Kandinsky6TI2VAPipeline",headingTag:"h2"});var m=e(W,2),z=n(m);a(z,{name:"class diffusers.Kandinsky6TI2VAPipeline",anchor:"diffusers.Kandinsky6TI2VAPipeline",source:"https://github.com/huggingface/diffusers/blob/vr_14949/src/diffusers/pipelines/kandinsky6/pipeline_kandinsky6_ti2va.py#L178",parameters:[{name:"transformer",val:": Kandinsky6Transformer3DModel"},{name:"vae",val:": AutoencoderKLHunyuanVideo"},{name:"text_encoder",val:": Qwen2_5_VLForConditionalGeneration"},{name:"tokenizer",val:": Qwen2_5_VLProcessor"},{name:"text_encoder_2",val:": CLIPTextModel"},{name:"tokenizer_2",val:": CLIPTokenizer"},{name:"scheduler",val:": diffusers.schedulers.scheduling_flow_match_euler_discrete.FlowMatchEulerDiscreteScheduler | diffusers.schedulers.scheduling_piflow.PiflowScheduler"},{name:"audio_vae",val:": diffusers.models.autoencoders.autoencoder_mmaudio.MMAudioVAE | None = None"},{name:"vocoder",val:": diffusers.models.autoencoders.mmaudio_vocoder.MMAudioVocoder | None = None"}],parametersDescription:[{anchor:"diffusers.Kandinsky6TI2VAPipeline.transformer",description:`<strong>transformer</strong> (<a href="/docs/diffusers/pr_14949/en/api/models/kandinsky6_transformer#diffusers.Kandinsky6Transformer3DModel">Kandinsky6Transformer3DModel</a>) — | |
| Multimodal transformer that denoises the video and audio latents.`,name:"transformer"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.vae",description:`<strong>vae</strong> (<a href="/docs/diffusers/pr_14949/en/api/models/autoencoder_kl_hunyuan_video#diffusers.AutoencoderKLHunyuanVideo">AutoencoderKLHunyuanVideo</a>) — | |
| Video VAE used to encode the reference image and decode the generated video.`,name:"vae"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.text_encoder",description:`<strong>text_encoder</strong> (<a href="https://huggingface.co/docs/transformers/main/en/model_doc/qwen2_5_vl#transformers.Qwen2_5_VLForConditionalGeneration" rel="nofollow">Qwen2_5_VLForConditionalGeneration</a>) — | |
| Qwen2.5-VL model providing the token-level text embeddings and, optionally, prompt expansion.`,name:"text_encoder"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.tokenizer",description:`<strong>tokenizer</strong> (<a href="https://huggingface.co/docs/transformers/main/en/model_doc/qwen2_5_vl#transformers.Qwen2_5_VLProcessor" rel="nofollow">Qwen2_5_VLProcessor</a>) — | |
| Processor of <code>text_encoder</code>.`,name:"tokenizer"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.text_encoder_2",description:`<strong>text_encoder_2</strong> (<a href="https://huggingface.co/docs/transformers/main/en/model_doc/clip#transformers.CLIPTextModel" rel="nofollow">CLIPTextModel</a>) — | |
| CLIP text encoder providing the pooled text embedding.`,name:"text_encoder_2"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.tokenizer_2",description:`<strong>tokenizer_2</strong> (<a href="https://huggingface.co/docs/transformers/main/en/model_doc/clip#transformers.CLIPTokenizer" rel="nofollow">CLIPTokenizer</a>) — | |
| Tokenizer of <code>text_encoder_2</code>.`,name:"tokenizer_2"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/pr_14949/en/api/schedulers/flow_match_euler_discrete#diffusers.FlowMatchEulerDiscreteScheduler">FlowMatchEulerDiscreteScheduler</a> or <a href="/docs/diffusers/pr_14949/en/api/schedulers/piflow#diffusers.PiflowScheduler">PiflowScheduler</a>) — | |
| Scheduler used with <code>transformer</code> to denoise the latents. Distilled checkpoints ship with a | |
| <a href="/docs/diffusers/pr_14949/en/api/schedulers/piflow#diffusers.PiflowScheduler">PiflowScheduler</a> and must be run with <code>guidance_scale=1.0</code>.`,name:"scheduler"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.audio_vae",description:`<strong>audio_vae</strong> (<a href="/docs/diffusers/pr_14949/en/api/models/kandinsky6_vae#diffusers.MMAudioVAE">MMAudioVAE</a>, <em>optional</em>) — | |
| Audio VAE used to decode the generated audio latents into a mel spectrogram. Only needed when | |
| <code>sample_audio=True</code>.`,name:"audio_vae"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.vocoder",description:`<strong>vocoder</strong> (<a href="/docs/diffusers/pr_14949/en/api/models/kandinsky6_vae#diffusers.MMAudioVocoder">MMAudioVocoder</a>, <em>optional</em>) — | |
| Vocoder used to turn the mel spectrogram <code>audio_vae</code> decodes into a waveform. Only needed when | |
| <code>sample_audio=True</code>.`,name:"vocoder"}]});var u=e(z,8),L=n(u);a(L,{name:"__call__",anchor:"diffusers.Kandinsky6TI2VAPipeline.__call__",source:"https://github.com/huggingface/diffusers/blob/vr_14949/src/diffusers/pipelines/kandinsky6/pipeline_kandinsky6_ti2va.py#L644",parameters:[{name:"prompt",val:": str | list[str] | None = None"},{name:"image",val:": typing.Union[PIL.Image.Image, numpy.ndarray, torch.Tensor, list[PIL.Image.Image], list[numpy.ndarray], list[torch.Tensor], NoneType] = 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:"frame_rate",val:": float = 24.0"},{name:"num_inference_steps",val:": int = 50"},{name:"timesteps",val:": list[int] | None = None"},{name:"sigmas",val:": list[float] | None = None"},{name:"guidance_scale",val:": float = 5.0"},{name:"num_videos_per_prompt",val:": int = 1"},{name:"generator",val:": typing.Union[torch.Generator, list[torch.Generator], NoneType] = None"},{name:"latents",val:": typing.Optional[torch.Tensor] = None"},{name:"audio_latents",val:": typing.Optional[torch.Tensor] = None"},{name:"prompt_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"pooled_prompt_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"negative_pooled_prompt_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"sample_audio",val:": bool = True"},{name:"expand_prompts",val:": bool = False"},{name:"max_sequence_length",val:": int = 1024"},{name:"output_type",val:": str = 'pil'"},{name:"return_dict",val:": bool = True"},{name:"callback_on_step_end",val:": collections.abc.Callable[[int, int, dict], None] | None = None"},{name:"callback_on_step_end_tensor_inputs",val:": list = ['latents']"}],parametersDescription:[{anchor:"diffusers.Kandinsky6TI2VAPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>list[str]</code>, <em>optional</em>) — | |
| The prompt or prompts to guide the generation. Required unless <code>prompt_embeds</code> is given.`,name:"prompt"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.__call__.image",description:`<strong>image</strong> (<code>PipelineImageInput</code>, <em>optional</em>) — | |
| Reference image(s) conditioning the first frame (image-to-video-and-audio).`,name:"image"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>list[str]</code>, <em>optional</em>) — | |
| The prompt or prompts not to guide the generation. Defaults to the Kandinsky 6 negative prompt.`,name:"negative_prompt"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, defaults to <code>512</code>) — | |
| Height of the generated video in pixels.`,name:"height"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>, defaults to <code>768</code>) — | |
| Width of the generated video in pixels.`,name:"width"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.__call__.num_frames",description:`<strong>num_frames</strong> (<code>int</code>, defaults to <code>121</code>) — | |
| Number of generated frames.`,name:"num_frames"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.__call__.frame_rate",description:`<strong>frame_rate</strong> (<code>float</code>, defaults to <code>24.0</code>) — | |
| Frame rate the video is generated at; sets the length of the synchronized audio.`,name:"frame_rate"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, defaults to <code>50</code>) — | |
| The number of denoising steps. Use <code>16</code> with the distilled checkpoints.`,name:"num_inference_steps"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.__call__.timesteps",description:`<strong>timesteps</strong> (<code>list[int]</code>, <em>optional</em>) — | |
| Custom timesteps for schedulers that support them.`,name:"timesteps"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.__call__.sigmas",description:`<strong>sigmas</strong> (<code>list[float]</code>, <em>optional</em>) — | |
| Custom sigmas for schedulers that support them.`,name:"sigmas"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, defaults to <code>5.0</code>) — | |
| Classifier-free guidance scale. Must be <code>1.0</code> with a <a href="/docs/diffusers/pr_14949/en/api/schedulers/piflow#diffusers.PiflowScheduler">PiflowScheduler</a>.`,name:"guidance_scale"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.__call__.num_videos_per_prompt",description:`<strong>num_videos_per_prompt</strong> (<code>int</code>, defaults to <code>1</code>) — | |
| The number of videos to generate per prompt.`,name:"num_videos_per_prompt"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>list[torch.Generator]</code>, <em>optional</em>) — | |
| Generator(s) used for the initial noise and the reference image encoding.`,name:"generator"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.__call__.latents",description:`<strong>latents</strong> (<code>torch.Tensor</code>, <em>optional</em>) — | |
| Pre-generated video latents of shape <code>(batch_size, channels, num_latent_frames, latent_height, latent_width)</code>.`,name:"latents"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.__call__.audio_latents",description:`<strong>audio_latents</strong> (<code>torch.Tensor</code>, <em>optional</em>) — | |
| Pre-generated audio latents of shape <code>(batch_size, channels, audio_length)</code>.`,name:"audio_latents"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.__call__.prompt_embeds",description:`<strong>prompt_embeds</strong> (<code>torch.Tensor</code>, <em>optional</em>) — | |
| Pre-generated Qwen2.5-VL text embeddings.`,name:"prompt_embeds"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.__call__.pooled_prompt_embeds",description:`<strong>pooled_prompt_embeds</strong> (<code>torch.Tensor</code>, <em>optional</em>) — | |
| Pre-generated CLIP pooled text embeddings.`,name:"pooled_prompt_embeds"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.__call__.negative_prompt_embeds",description:`<strong>negative_prompt_embeds</strong> (<code>torch.Tensor</code>, <em>optional</em>) — | |
| Pre-generated negative Qwen2.5-VL text embeddings.`,name:"negative_prompt_embeds"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.__call__.negative_pooled_prompt_embeds",description:`<strong>negative_pooled_prompt_embeds</strong> (<code>torch.Tensor</code>, <em>optional</em>) — | |
| Pre-generated negative CLIP pooled text embeddings.`,name:"negative_pooled_prompt_embeds"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.__call__.sample_audio",description:`<strong>sample_audio</strong> (<code>bool</code>, defaults to <code>True</code>) — | |
| Whether to generate synchronized audio. Requires the pipeline to have an <code>audio_vae</code> and a <code>vocoder</code>.`,name:"sample_audio"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.__call__.expand_prompts",description:`<strong>expand_prompts</strong> (<code>bool</code>, defaults to <code>False</code>) — | |
| Whether to rewrite the prompts with <a href="/docs/diffusers/pr_14949/en/api/pipelines/kandinsky6#diffusers.Kandinsky6TI2VAPipeline.expand_prompts">expand_prompts()</a> before encoding.`,name:"expand_prompts"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.__call__.max_sequence_length",description:`<strong>max_sequence_length</strong> (<code>int</code>, defaults to <code>1024</code>) — | |
| Maximum number of prompt tokens after the chat template.`,name:"max_sequence_length"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, defaults to <code>"pil"</code>) — | |
| The output format of the generated video: <code>"pil"</code>, <code>"np"</code>, <code>"pt"</code> or <code>"latent"</code>.`,name:"output_type"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, defaults to <code>True</code>) — | |
| Whether or not to return a <a href="/docs/diffusers/pr_14949/en/api/pipelines/kandinsky6#diffusers.Kandinsky6TI2VAPipelineOutput">Kandinsky6TI2VAPipelineOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.__call__.callback_on_step_end",description:`<strong>callback_on_step_end</strong> (<code>Callable</code>, <em>optional</em>) — | |
| A function called at the end of each denoising step with <code>callback_on_step_end(self, step, timestep, callback_kwargs)</code>. It may return a dict overriding the listed tensors.`,name:"callback_on_step_end"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.__call__.callback_on_step_end_tensor_inputs",description:`<strong>callback_on_step_end_tensor_inputs</strong> (<code>list[str]</code>, defaults to <code>["latents"]</code>) — | |
| Tensor inputs passed to <code>callback_on_step_end</code>; a subset of <code>_callback_tensor_inputs</code>.`,name:"callback_on_step_end_tensor_inputs"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>The generated video and audio; a <code>(frames, audio)</code> tuple when <code>return_dict=False</code>.</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/diffusers/pr_14949/en/api/pipelines/kandinsky6#diffusers.Kandinsky6TI2VAPipelineOutput" | |
| >Kandinsky6TI2VAPipelineOutput</a> or <code>tuple</code></p> | |
| `});var oe=e(L,4);$(oe,{anchor:"diffusers.Kandinsky6TI2VAPipeline.__call__.example",children:(r,l)=>{var d=ee(),w=e(I(d),2);i(w,{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwS2FuZGluc2t5NlRJMlZBUGlwZWxpbmUlMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwZW5jb2RlX3ZpZGVvJTBBJTBBcGlwZSUyMCUzRCUyMEthbmRpbnNreTZUSTJWQVBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJrYW5kaW5za3lsYWIlMkZLYW5kaW5za3ktNi4wLVByby1kaXN0aWxsLTVzLURpZmZ1c2VycyUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guYmZsb2F0MTYlMEEpJTBBcGlwZS5lbmFibGVfbW9kZWxfY3B1X29mZmxvYWQoKSUwQSUwQW91dHB1dCUyMCUzRCUyMHBpcGUoJTBBJTIwJTIwJTIwJTIwcHJvbXB0JTNEJTIyQSUyMGNhdCUyMGFuZCUyMGElMjBkb2clMjBiYWtpbmclMjBhJTIwY2FrZSUyMHRvZ2V0aGVyJTIwaW4lMjBhJTIwa2l0Y2hlbi4lMjIlMkMlMEElMjAlMjAlMjAlMjBoZWlnaHQlM0Q0ODAlMkMlMEElMjAlMjAlMjAlMjB3aWR0aCUzRDg2NCUyQyUwQSUyMCUyMCUyMCUyMG51bV9mcmFtZXMlM0QxMjElMkMlMEElMjAlMjAlMjAlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNEMTYlMkMlMEElMjAlMjAlMjAlMjBndWlkYW5jZV9zY2FsZSUzRDEuMCUyQyUwQSklMEFlbmNvZGVfdmlkZW8oJTBBJTIwJTIwJTIwJTIwb3V0cHV0LmZyYW1lcyU1QjAlNUQlMkMlMEElMjAlMjAlMjAlMjBmcHMlM0QyNCUyQyUwQSUyMCUyMCUyMCUyMG91dHB1dF9wYXRoJTNEJTIyb3V0cHV0Lm1wNCUyMiUyQyUwQSUyMCUyMCUyMCUyMGF1ZGlvJTNEb3V0cHV0LmF1ZGlvJTVCMCU1RCU1Qk5vbmUlNUQlMkMlMEElMjAlMjAlMjAlMjBhdWRpb19zYW1wbGVfcmF0ZSUzRHBpcGUuYXVkaW9fc2FtcGxlX3JhdGUlMkMlMEEp",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> Kandinsky6TI2VAPipeline | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> encode_video | |
| <span class="hljs-meta">>>> </span>pipe = Kandinsky6TI2VAPipeline.from_pretrained( | |
| <span class="hljs-meta">... </span> <span class="hljs-string">"kandinskylab/Kandinsky-6.0-Pro-distill-5s-Diffusers"</span>, torch_dtype=torch.bfloat16 | |
| <span class="hljs-meta">... </span>) | |
| <span class="hljs-meta">>>> </span>pipe.enable_model_cpu_offload() | |
| <span class="hljs-meta">>>> </span>output = pipe( | |
| <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> height=<span class="hljs-number">480</span>, | |
| <span class="hljs-meta">... </span> width=<span class="hljs-number">864</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">16</span>, | |
| <span class="hljs-meta">... </span> guidance_scale=<span class="hljs-number">1.0</span>, | |
| <span class="hljs-meta">... </span>) | |
| <span class="hljs-meta">>>> </span>encode_video( | |
| <span class="hljs-meta">... </span> output.frames[<span class="hljs-number">0</span>], | |
| <span class="hljs-meta">... </span> fps=<span class="hljs-number">24</span>, | |
| <span class="hljs-meta">... </span> output_path=<span class="hljs-string">"output.mp4"</span>, | |
| <span class="hljs-meta">... </span> audio=output.audio[<span class="hljs-number">0</span>][<span class="hljs-literal">None</span>], | |
| <span class="hljs-meta">... </span> audio_sample_rate=pipe.audio_sample_rate, | |
| <span class="hljs-meta">... </span>)`,lang:"python",wrap:!1}),c(r,d)},$$slots:{default:!0}}),s(u);var f=e(u,2),te=n(f);a(te,{name:"encode_image",anchor:"diffusers.Kandinsky6TI2VAPipeline.encode_image",source:"https://github.com/huggingface/diffusers/blob/vr_14949/src/diffusers/pipelines/kandinsky6/pipeline_kandinsky6_ti2va.py#L551",parameters:[{name:"image",val:": typing.Union[PIL.Image.Image, numpy.ndarray, torch.Tensor, list[PIL.Image.Image], list[numpy.ndarray], list[torch.Tensor]]"},{name:"height",val:": int"},{name:"width",val:": int"},{name:"device",val:": device"},{name:"dtype",val:": dtype"},{name:"num_videos_per_prompt",val:": int = 1"},{name:"generator",val:": typing.Optional[torch.Generator] = None"}]}),t(2),s(f);var h=e(f,2),ie=n(h);a(ie,{name:"encode_prompt",anchor:"diffusers.Kandinsky6TI2VAPipeline.encode_prompt",source:"https://github.com/huggingface/diffusers/blob/vr_14949/src/diffusers/pipelines/kandinsky6/pipeline_kandinsky6_ti2va.py#L309",parameters:[{name:"prompt",val:": str | list[str]"},{name:"negative_prompt",val:": str | list[str] | None = None"},{name:"do_classifier_free_guidance",val:": bool = True"},{name:"num_videos_per_prompt",val:": int = 1"},{name:"prompt_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"pooled_prompt_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"prompt_attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"negative_pooled_prompt_embeds",val:": typing.Optional[torch.Tensor] = None"},{name:"negative_prompt_attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"max_sequence_length",val:": int = 1024"},{name:"device",val:": typing.Optional[torch.device] = None"},{name:"dtype",val:": typing.Optional[torch.dtype] = None"}],parametersDescription:[{anchor:"diffusers.Kandinsky6TI2VAPipeline.encode_prompt.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>list[str]</code>) — | |
| Prompt to be encoded.`,name:"prompt"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.encode_prompt.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>list[str]</code>, <em>optional</em>) — | |
| The prompt not to guide the generation. Ignored when <code>do_classifier_free_guidance</code> is <code>False</code>.`,name:"negative_prompt"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.encode_prompt.do_classifier_free_guidance",description:`<strong>do_classifier_free_guidance</strong> (<code>bool</code>, defaults to <code>True</code>) — | |
| Whether to also encode the negative prompt.`,name:"do_classifier_free_guidance"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.encode_prompt.num_videos_per_prompt",description:`<strong>num_videos_per_prompt</strong> (<code>int</code>, defaults to <code>1</code>) — | |
| Number of videos generated per prompt; the embeddings are repeated accordingly.`,name:"num_videos_per_prompt"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.encode_prompt.prompt_embeds",description:`<strong>prompt_embeds</strong> (<code>torch.Tensor</code>, <em>optional</em>) — | |
| Pre-generated Qwen2.5-VL text embeddings. Skips encoding <code>prompt</code>.`,name:"prompt_embeds"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.encode_prompt.pooled_prompt_embeds",description:`<strong>pooled_prompt_embeds</strong> (<code>torch.Tensor</code>, <em>optional</em>) — | |
| Pre-generated CLIP pooled text embeddings. Must be given together with <code>prompt_embeds</code>.`,name:"pooled_prompt_embeds"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.encode_prompt.prompt_attention_mask",description:`<strong>prompt_attention_mask</strong> (<code>torch.Tensor</code>, <em>optional</em>) — | |
| Boolean padding mask of <code>prompt_embeds</code>.`,name:"prompt_attention_mask"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.encode_prompt.negative_prompt_embeds",description:`<strong>negative_prompt_embeds</strong> (<code>torch.Tensor</code>, <em>optional</em>) — | |
| Pre-generated negative Qwen2.5-VL text embeddings.`,name:"negative_prompt_embeds"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.encode_prompt.negative_pooled_prompt_embeds",description:`<strong>negative_pooled_prompt_embeds</strong> (<code>torch.Tensor</code>, <em>optional</em>) — | |
| Pre-generated negative CLIP pooled text embeddings.`,name:"negative_pooled_prompt_embeds"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.encode_prompt.negative_prompt_attention_mask",description:`<strong>negative_prompt_attention_mask</strong> (<code>torch.Tensor</code>, <em>optional</em>) — | |
| Boolean padding mask of <code>negative_prompt_embeds</code>.`,name:"negative_prompt_attention_mask"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.encode_prompt.max_sequence_length",description:`<strong>max_sequence_length</strong> (<code>int</code>, defaults to <code>1024</code>) — | |
| Maximum number of prompt tokens after the chat template.`,name:"max_sequence_length"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.encode_prompt.device",description:`<strong>device</strong> (<code>torch.device</code>, <em>optional</em>) — | |
| Device to run the text encoders on.`,name:"device"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.encode_prompt.dtype",description:`<strong>dtype</strong> (<code>torch.dtype</code>, <em>optional</em>) — | |
| Dtype of the returned embeddings.`,name:"dtype"}]}),t(2),s(h);var _=e(h,2),re=n(_);a(re,{name:"expand_prompts",anchor:"diffusers.Kandinsky6TI2VAPipeline.expand_prompts",source:"https://github.com/huggingface/diffusers/blob/vr_14949/src/diffusers/pipelines/kandinsky6/pipeline_kandinsky6_ti2va.py#L412",parameters:[{name:"prompt",val:": str | list[str]"},{name:"tokenizer",val:""},{name:"text_encoder",val:""},{name:"device",val:": device"},{name:"image",val:": PIL.Image.Image | list[PIL.Image.Image] | None = None"},{name:"max_sequence_length",val:": int = 1024"},{name:"generator",val:": typing.Union[torch.Generator, list[torch.Generator], NoneType] = None"}],parametersDescription:[{anchor:"diffusers.Kandinsky6TI2VAPipeline.expand_prompts.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>list[str]</code>) — | |
| Prompt or prompts to expand.`,name:"prompt"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.expand_prompts.tokenizer",description:`<strong>tokenizer</strong> — | |
| The Qwen2.5-VL processor, e.g. <code>pipe.tokenizer</code>.`,name:"tokenizer"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.expand_prompts.text_encoder",description:`<strong>text_encoder</strong> — | |
| The Qwen2.5-VL model, e.g. <code>pipe.text_encoder</code>.`,name:"text_encoder"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.expand_prompts.device",description:`<strong>device</strong> (<code>torch.device</code>) — | |
| Device to run the text encoder on.`,name:"device"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.expand_prompts.image",description:`<strong>image</strong> (<code>PIL.Image.Image</code> or <code>list[PIL.Image.Image]</code>, <em>optional</em>) — | |
| Reference image(s) of an image-to-video call.`,name:"image"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.expand_prompts.max_sequence_length",description:`<strong>max_sequence_length</strong> (<code>int</code>, defaults to <code>1024</code>) — | |
| Maximum number of generated tokens per prompt.`,name:"max_sequence_length"},{anchor:"diffusers.Kandinsky6TI2VAPipeline.expand_prompts.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>list[torch.Generator]</code>, <em>optional</em>) — | |
| Seeds the sampled expansion; a list must match <code>prompt</code>’s length, one generator per item. <code>generate</code> | |
| draws from the global RNG, so the global RNG is seeded from this generator’s seed; later <code>randn_tensor</code> | |
| calls keep using <code>generator</code> directly.`,name:"generator"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>The expanded prompt(s).</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><code>str</code> or <code>list[str]</code></p> | |
| `}),t(2),s(_);var g=e(_,2),de=n(g);a(de,{name:"prepare_audio_latents",anchor:"diffusers.Kandinsky6TI2VAPipeline.prepare_audio_latents",source:"https://github.com/huggingface/diffusers/blob/vr_14949/src/diffusers/pipelines/kandinsky6/pipeline_kandinsky6_ti2va.py#L607",parameters:[{name:"batch_size",val:": int"},{name:"num_channels_latents",val:": int"},{name:"audio_length",val:": int"},{name:"dtype",val:": dtype"},{name:"device",val:": device"},{name:"generator",val:": typing.Union[torch.Generator, list[torch.Generator], NoneType]"},{name:"audio_latents",val:": typing.Optional[torch.Tensor] = None"}]}),t(2),s(g);var E=e(g,2),le=n(E);a(le,{name:"prepare_latents",anchor:"diffusers.Kandinsky6TI2VAPipeline.prepare_latents",source:"https://github.com/huggingface/diffusers/blob/vr_14949/src/diffusers/pipelines/kandinsky6/pipeline_kandinsky6_ti2va.py#L578",parameters:[{name:"batch_size",val:": int"},{name:"num_channels_latents",val:": int"},{name:"height",val:": int"},{name:"width",val:": int"},{name:"num_frames",val:": int"},{name:"dtype",val:": dtype"},{name:"device",val:": device"},{name:"generator",val:": typing.Union[torch.Generator, list[torch.Generator], NoneType]"},{name:"latents",val:": typing.Optional[torch.Tensor] = None"}]}),t(2),s(E),s(m);var C=e(m,2);o(C,{title:"Kandinsky6SRPipeline",local:"diffusers.Kandinsky6SRPipeline",headingTag:"h2"});var y=e(C,2),Q=n(y);a(Q,{name:"class diffusers.Kandinsky6SRPipeline",anchor:"diffusers.Kandinsky6SRPipeline",source:"https://github.com/huggingface/diffusers/blob/vr_14949/src/diffusers/pipelines/kandinsky6/pipeline_kandinsky6_sr.py#L143",parameters:[{name:"transformer",val:": Kandinsky6SRTransformer3DModel"},{name:"vae",val:": Kandinsky6SRVAE"},{name:"scheduler",val:": diffusers.schedulers.scheduling_flow_match_euler_discrete.FlowMatchEulerDiscreteScheduler | diffusers.schedulers.scheduling_piflow.PiflowScheduler"},{name:"latent_upscaler",val:": diffusers.models.latent_upscaler.latent_upscaler_kandinsky6_sr.Kandinsky6SRLatentUpscalerBank | None = None"}],parametersDescription:[{anchor:"diffusers.Kandinsky6SRPipeline.transformer",description:`<strong>transformer</strong> (<a href="/docs/diffusers/pr_14949/en/api/models/kandinsky6_transformer#diffusers.Kandinsky6SRTransformer3DModel">Kandinsky6SRTransformer3DModel</a>) — | |
| Transformer that refines the latent tiles.`,name:"transformer"},{anchor:"diffusers.Kandinsky6SRPipeline.vae",description:`<strong>vae</strong> (<a href="/docs/diffusers/pr_14949/en/api/models/kandinsky6_vae#diffusers.Kandinsky6SRVAE">Kandinsky6SRVAE</a>) — | |
| Causal video K-VAE used to encode the input video and decode the refined tiles.`,name:"vae"},{anchor:"diffusers.Kandinsky6SRPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/pr_14949/en/api/schedulers/flow_match_euler_discrete#diffusers.FlowMatchEulerDiscreteScheduler">FlowMatchEulerDiscreteScheduler</a> or <a href="/docs/diffusers/pr_14949/en/api/schedulers/piflow#diffusers.PiflowScheduler">PiflowScheduler</a>) — | |
| Scheduler used with <code>transformer</code> to denoise the tiles. Distilled checkpoints ship with a | |
| <a href="/docs/diffusers/pr_14949/en/api/schedulers/piflow#diffusers.PiflowScheduler">PiflowScheduler</a>.`,name:"scheduler"},{anchor:"diffusers.Kandinsky6SRPipeline.latent_upscaler",description:`<strong>latent_upscaler</strong> (<a href="/docs/diffusers/pr_14949/en/api/pipelines/kandinsky6#diffusers.Kandinsky6SRLatentUpscalerBank">Kandinsky6SRLatentUpscalerBank</a>, <em>optional</em>) — | |
| Latent upscalers for the supported scales.`,name:"latent_upscaler"}]});var k=e(Q,8),F=n(k);a(F,{name:"__call__",anchor:"diffusers.Kandinsky6SRPipeline.__call__",source:"https://github.com/huggingface/diffusers/blob/vr_14949/src/diffusers/pipelines/kandinsky6/pipeline_kandinsky6_sr.py#L228",parameters:[{name:"video",val:": typing.Union[list[PIL.Image.Image], list[list[PIL.Image.Image]], numpy.ndarray, torch.Tensor]"},{name:"resolution_scale",val:": float = 2.25"},{name:"num_inference_steps",val:": int = 4"},{name:"timesteps",val:": list[int] | None = None"},{name:"sigmas",val:": list[float] | None = None"},{name:"lq_noise_scale",val:": float = 0.7"},{name:"min_overlap",val:": float = 0.2"},{name:"tiles_batch_size",val:": int = 1"},{name:"generator",val:": typing.Union[torch.Generator, list[torch.Generator], NoneType] = None"},{name:"output_type",val:": str = 'pil'"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.Kandinsky6SRPipeline.__call__.video",description:`<strong>video</strong> (<code>list[PIL.Image.Image]</code>, <code>np.ndarray</code> or <code>torch.Tensor</code>) — | |
| The low-resolution video(s), in any format <a href="/docs/diffusers/pr_14949/en/api/video_processor#diffusers.VideoProcessor.preprocess_video">preprocess_video()</a> | |
| accepts, with <code>1 + k * 4</code> frames. Sizes are rounded down to a multiple of the VAE spatial factor.`,name:"video"},{anchor:"diffusers.Kandinsky6SRPipeline.__call__.resolution_scale",description:`<strong>resolution_scale</strong> (<code>float</code>, defaults to <code>2.25</code>) — | |
| Total spatial upscale: <code>2</code>, <code>4</code>, or <code>2.25</code> (a 1.125x bilinear pre-upscale followed by the 2x path).`,name:"resolution_scale"},{anchor:"diffusers.Kandinsky6SRPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, defaults to <code>4</code>) — | |
| The number of denoising steps per tile. Use <code>2</code> with the distilled checkpoints.`,name:"num_inference_steps"},{anchor:"diffusers.Kandinsky6SRPipeline.__call__.timesteps",description:`<strong>timesteps</strong> (<code>list[int]</code>, <em>optional</em>) — | |
| Custom timesteps for schedulers that support them.`,name:"timesteps"},{anchor:"diffusers.Kandinsky6SRPipeline.__call__.sigmas",description:`<strong>sigmas</strong> (<code>list[float]</code>, <em>optional</em>) — | |
| Custom sigmas for schedulers that support them.`,name:"sigmas"},{anchor:"diffusers.Kandinsky6SRPipeline.__call__.lq_noise_scale",description:`<strong>lq_noise_scale</strong> (<code>float</code>, defaults to <code>0.7</code>) — | |
| Amount of Gaussian noise mixed into the low-resolution latents (variance preserving) before denoising.`,name:"lq_noise_scale"},{anchor:"diffusers.Kandinsky6SRPipeline.__call__.min_overlap",description:`<strong>min_overlap</strong> (<code>float</code>, defaults to <code>0.2</code>) — | |
| Minimum overlap between neighbouring tiles as a fraction of the tile size.`,name:"min_overlap"},{anchor:"diffusers.Kandinsky6SRPipeline.__call__.tiles_batch_size",description:`<strong>tiles_batch_size</strong> (<code>int</code>, defaults to <code>1</code>) — | |
| Number of tiles denoised per transformer call.`,name:"tiles_batch_size"},{anchor:"diffusers.Kandinsky6SRPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>list[torch.Generator]</code>, <em>optional</em>) — | |
| Generator(s) used for the noise mixed into the tiles.`,name:"generator"},{anchor:"diffusers.Kandinsky6SRPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, defaults to <code>"pil"</code>) — | |
| The output format of the generated video: <code>"pil"</code>, <code>"np"</code> or <code>"pt"</code>.`,name:"output_type"},{anchor:"diffusers.Kandinsky6SRPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, defaults to <code>True</code>) — | |
| Whether or not to return a <a href="/docs/diffusers/pr_14949/en/api/pipelines/kandinsky6#diffusers.Kandinsky6SRPipelineOutput">Kandinsky6SRPipelineOutput</a> instead of a plain tuple.`,name:"return_dict"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>The super-resolved video; a one-element tuple when <code>return_dict=False</code>.</p> | |
| `,returnType:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p><a | |
| href="/docs/diffusers/pr_14949/en/api/pipelines/kandinsky6#diffusers.Kandinsky6SRPipelineOutput" | |
| >Kandinsky6SRPipelineOutput</a> or <code>tuple</code></p> | |
| `});var ce=e(F,4);$(ce,{anchor:"diffusers.Kandinsky6SRPipeline.__call__.example",children:(r,l)=>{var d=ee(),w=e(I(d),2);i(w,{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwS2FuZGluc2t5NlNSUGlwZWxpbmUlMkMlMjBLYW5kaW5za3k2VEkyVkFQaXBlbGluZSUwQWZyb20lMjBkaWZmdXNlcnMudXRpbHMlMjBpbXBvcnQlMjBleHBvcnRfdG9fdmlkZW8lMEElMEFwaXBlJTIwJTNEJTIwS2FuZGluc2t5NlRJMlZBUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMmthbmRpbnNreWxhYiUyRkthbmRpbnNreS02LjAtUHJvLWRpc3RpbGwtNXMtRGlmZnVzZXJzJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5iZmxvYXQxNiUwQSklMEFwaXBlLmVuYWJsZV9tb2RlbF9jcHVfb2ZmbG9hZCgpJTBBdmlkZW8lMjAlM0QlMjBwaXBlKCUwQSUyMCUyMCUyMCUyMHByb21wdCUzRCUyMkElMjBjYXQlMjBhbmQlMjBhJTIwZG9nJTIwYmFraW5nJTIwYSUyMGNha2UlMjB0b2dldGhlciUyMGluJTIwYSUyMGtpdGNoZW4uJTIyJTJDJTBBJTIwJTIwJTIwJTIwaGVpZ2h0JTNENDgwJTJDJTBBJTIwJTIwJTIwJTIwd2lkdGglM0Q4NjQlMkMlMEElMjAlMjAlMjAlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNEMTYlMkMlMEElMjAlMjAlMjAlMjBndWlkYW5jZV9zY2FsZSUzRDEuMCUyQyUwQSUyMCUyMCUyMCUyMHNhbXBsZV9hdWRpbyUzREZhbHNlJTJDJTBBKS5mcmFtZXMlNUIwJTVEJTBBJTBBc3JfcGlwZSUyMCUzRCUyMEthbmRpbnNreTZTUlBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJrYW5kaW5za3lsYWIlMkZLYW5kaW5za3ktNi4wLVZTUi1kaXN0aWxsZWQyc3RlcHMtNXMtRGlmZnVzZXJzJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5iZmxvYXQxNiUwQSklMEElMjMlMjBUaGUlMjB0cmFuc2Zvcm1lciUyMGFsd2F5cyUyMHJ1bnMlMjBhdHRlbnRpb24lMjB0aHJvdWdoJTIwdGhlJTIwJTYwZmxleCU2MCUyMGJhY2tlbmQlM0IlMjBjb21waWxpbmclMjBhdm9pZHMlMjB0aGUlMjBlYWdlciUwQSUyMyUyMGZhbGxiYWNrJ3MlMjBtdWNoJTIwaGlnaGVyJTIwbWVtb3J5JTIwdXNlJTIwYXQlMjB2aWRlbyUyMHJlc29sdXRpb25zLiUwQXNyX3BpcGUudHJhbnNmb3JtZXIuY29tcGlsZV9yZXBlYXRlZF9ibG9ja3MoZnVsbGdyYXBoJTNEVHJ1ZSklMEFzcl9waXBlLmVuYWJsZV9tb2RlbF9jcHVfb2ZmbG9hZCgpJTBBb3V0cHV0JTIwJTNEJTIwc3JfcGlwZSh2aWRlbyUzRHZpZGVvJTJDJTIwcmVzb2x1dGlvbl9zY2FsZSUzRDIuMjUlMkMlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNEMiklMEFleHBvcnRfdG9fdmlkZW8ob3V0cHV0LmZyYW1lcyU1QjAlNUQlMkMlMjAlMjJvdXRwdXRfc3IubXA0JTIyJTJDJTIwZnBzJTNEMjQp",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> Kandinsky6SRPipeline, Kandinsky6TI2VAPipeline | |
| <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>pipe = Kandinsky6TI2VAPipeline.from_pretrained( | |
| <span class="hljs-meta">... </span> <span class="hljs-string">"kandinskylab/Kandinsky-6.0-Pro-distill-5s-Diffusers"</span>, torch_dtype=torch.bfloat16 | |
| <span class="hljs-meta">... </span>) | |
| <span class="hljs-meta">>>> </span>pipe.enable_model_cpu_offload() | |
| <span class="hljs-meta">>>> </span>video = pipe( | |
| <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> height=<span class="hljs-number">480</span>, | |
| <span class="hljs-meta">... </span> width=<span class="hljs-number">864</span>, | |
| <span class="hljs-meta">... </span> num_inference_steps=<span class="hljs-number">16</span>, | |
| <span class="hljs-meta">... </span> guidance_scale=<span class="hljs-number">1.0</span>, | |
| <span class="hljs-meta">... </span> sample_audio=<span class="hljs-literal">False</span>, | |
| <span class="hljs-meta">... </span>).frames[<span class="hljs-number">0</span>] | |
| <span class="hljs-meta">>>> </span>sr_pipe = Kandinsky6SRPipeline.from_pretrained( | |
| <span class="hljs-meta">... </span> <span class="hljs-string">"kandinskylab/Kandinsky-6.0-VSR-distilled2steps-5s-Diffusers"</span>, torch_dtype=torch.bfloat16 | |
| <span class="hljs-meta">... </span>) | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># The transformer always runs attention through the \`flex\` backend; compiling avoids the eager</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># fallback's much higher memory use at video resolutions.</span> | |
| <span class="hljs-meta">>>> </span>sr_pipe.transformer.compile_repeated_blocks(fullgraph=<span class="hljs-literal">True</span>) | |
| <span class="hljs-meta">>>> </span>sr_pipe.enable_model_cpu_offload() | |
| <span class="hljs-meta">>>> </span>output = sr_pipe(video=video, resolution_scale=<span class="hljs-number">2.25</span>, num_inference_steps=<span class="hljs-number">2</span>) | |
| <span class="hljs-meta">>>> </span>export_to_video(output.frames[<span class="hljs-number">0</span>], <span class="hljs-string">"output_sr.mp4"</span>, fps=<span class="hljs-number">24</span>)`,lang:"python",wrap:!1}),c(r,d)},$$slots:{default:!0}}),s(k);var b=e(k,2),pe=n(b);a(pe,{name:"decode_latents",anchor:"diffusers.Kandinsky6SRPipeline.decode_latents",source:"https://github.com/huggingface/diffusers/blob/vr_14949/src/diffusers/pipelines/kandinsky6/pipeline_kandinsky6_sr.py#L223",parameters:[{name:"latents",val:": Tensor"}]}),t(2),s(b);var X=e(b,2),me=n(X);a(me,{name:"encode_video",anchor:"diffusers.Kandinsky6SRPipeline.encode_video",source:"https://github.com/huggingface/diffusers/blob/vr_14949/src/diffusers/pipelines/kandinsky6/pipeline_kandinsky6_sr.py#L213",parameters:[{name:"video",val:": Tensor"}]}),t(2),s(X),s(y);var Y=e(y,2);o(Y,{title:"Kandinsky6SRLatentUpscalerBank",local:"diffusers.Kandinsky6SRLatentUpscalerBank",headingTag:"h2"});var v=e(Y,2),D=n(v);a(D,{name:"class diffusers.Kandinsky6SRLatentUpscalerBank",anchor:"diffusers.Kandinsky6SRLatentUpscalerBank",source:"https://github.com/huggingface/diffusers/blob/vr_14949/src/diffusers/models/latent_upscaler/latent_upscaler_kandinsky6_sr.py#L251",parameters:[{name:"in_channels",val:": int = 64"},{name:"stage_channels",val:": tuple[int, int, int] = (2048, 1024, 512)"},{name:"num_pre_blocks",val:": int = 5"},{name:"num_mid_blocks",val:": int = 3"},{name:"num_post_blocks",val:": int = 3"},{name:"num_x2_adapter_blocks",val:": int = 2"},{name:"scales",val:": tuple[int, ...] = (2, 4)"},{name:"scaling_factor",val:": float = 0.910344004631042"}],parametersDescription:[{anchor:"diffusers.Kandinsky6SRLatentUpscalerBank.in_channels",description:`<strong>in_channels</strong> (<code>int</code>, defaults to <code>64</code>) — | |
| Number of latent channels.`,name:"in_channels"},{anchor:"diffusers.Kandinsky6SRLatentUpscalerBank.stage_channels",description:`<strong>stage_channels</strong> (<code>tuple[int, int, int]</code>, defaults to <code>(2048, 1024, 512)</code>) — | |
| Feature widths of the three stages of the cascade.`,name:"stage_channels"},{anchor:"diffusers.Kandinsky6SRLatentUpscalerBank.num_pre_blocks",description:`<strong>num_pre_blocks</strong> (<code>int</code>, defaults to <code>5</code>) — | |
| Residual blocks before the first upsample of the x4 model.`,name:"num_pre_blocks"},{anchor:"diffusers.Kandinsky6SRLatentUpscalerBank.num_mid_blocks",description:`<strong>num_mid_blocks</strong> (<code>int</code>, defaults to <code>3</code>) — | |
| Residual blocks between the two upsamples.`,name:"num_mid_blocks"},{anchor:"diffusers.Kandinsky6SRLatentUpscalerBank.num_post_blocks",description:`<strong>num_post_blocks</strong> (<code>int</code>, defaults to <code>3</code>) — | |
| Residual blocks after the last upsample.`,name:"num_post_blocks"},{anchor:"diffusers.Kandinsky6SRLatentUpscalerBank.num_x2_adapter_blocks",description:`<strong>num_x2_adapter_blocks</strong> (<code>int</code>, defaults to <code>2</code>) — | |
| Residual blocks of the x2 model’s adapter.`,name:"num_x2_adapter_blocks"},{anchor:"diffusers.Kandinsky6SRLatentUpscalerBank.scales",description:`<strong>scales</strong> (<code>tuple[int, ...]</code>, defaults to <code>(2, 4)</code>) — | |
| Spatial scales the bank provides an upscaler for.`,name:"scales"},{anchor:"diffusers.Kandinsky6SRLatentUpscalerBank.scaling_factor",description:`<strong>scaling_factor</strong> (<code>float</code>, defaults to <code>0.910344</code>) — | |
| Scale the input latents are expected to carry (the K-VAE <code>scaling_factor</code>).`,name:"scaling_factor"}]});var H=e(D,4),ue=n(H);a(ue,{name:"forward",anchor:"diffusers.Kandinsky6SRLatentUpscalerBank.forward",source:"https://github.com/huggingface/diffusers/blob/vr_14949/src/diffusers/models/latent_upscaler/latent_upscaler_kandinsky6_sr.py#L305",parameters:[{name:"latents",val:": Tensor"},{name:"scale",val:": int"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.Kandinsky6SRLatentUpscalerBank.forward.latents",description:`<strong>latents</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, in_channels, num_frames, height, width)</code>) — | |
| K-VAE latents scaled by <code>scaling_factor</code>.`,name:"latents"},{anchor:"diffusers.Kandinsky6SRLatentUpscalerBank.forward.scale",description:`<strong>scale</strong> (<code>int</code>) — | |
| Spatial upscale factor; one of <code>scales</code>.`,name:"scale"},{anchor:"diffusers.Kandinsky6SRLatentUpscalerBank.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, defaults to <code>True</code>) — | |
| Whether to return a <code>~models.autoencoder_kl.DecoderOutput</code> instead of a plain tuple.`,name:"return_dict"}],returnDescription:`<script context="module">export const metadata = 'undefined';<\/script> | |
| <p>The upscaled latents of shape <code>(batch_size, in_channels, num_frames, height * scale, width * scale)</code>.</p> | |
| `}),s(H),s(v);var q=e(v,2);o(q,{title:"Kandinsky6TI2VAPipelineOutput",local:"diffusers.Kandinsky6TI2VAPipelineOutput",headingTag:"h2"});var T=e(q,2),fe=n(T);a(fe,{name:"class diffusers.Kandinsky6TI2VAPipelineOutput",anchor:"diffusers.Kandinsky6TI2VAPipelineOutput",source:"https://github.com/huggingface/diffusers/blob/vr_14949/src/diffusers/pipelines/kandinsky6/pipeline_output.py#L25",parameters:[{name:"frames",val:": typing.Union[torch.Tensor, numpy.ndarray, list[list[PIL.Image.Image]]]"},{name:"audio",val:": typing.Union[torch.Tensor, numpy.ndarray, NoneType] = None"}],parametersDescription:[{anchor:"diffusers.Kandinsky6TI2VAPipelineOutput.frames",description:`<strong>frames</strong> (<code>torch.Tensor</code>, <code>np.ndarray</code>, or <code>list[list[PIL.Image.Image]]</code>) — | |
| The generated video. A nested list of length <code>batch_size</code> holding <code>num_frames</code> PIL images each, or a NumPy | |
| array or torch tensor of shape <code>(batch_size, num_frames, height, width, channels)</code> / <code>(batch_size, num_frames, channels, height, width)</code>. With <code>output_type="latent"</code>, the video latents of shape | |
| <code>(batch_size, channels, num_latent_frames, latent_height, latent_width)</code>.`,name:"frames"},{anchor:"diffusers.Kandinsky6TI2VAPipelineOutput.audio",description:`<strong>audio</strong> (<code>torch.Tensor</code> or <code>np.ndarray</code>, <em>optional</em>) — | |
| The generated waveforms of shape <code>(batch_size, num_samples)</code> in <code>[-1, 1]</code> at the audio VAE’s sample rate, | |
| or <code>None</code> when audio was not sampled. With <code>output_type="latent"</code>, the audio latents of shape <code>(batch_size, channels, audio_length)</code>.`,name:"audio"}]}),t(2),s(T);var O=e(T,2);o(O,{title:"Kandinsky6SRPipelineOutput",local:"diffusers.Kandinsky6SRPipelineOutput",headingTag:"h2"});var M=e(O,2),he=n(M);a(he,{name:"class diffusers.Kandinsky6SRPipelineOutput",anchor:"diffusers.Kandinsky6SRPipelineOutput",source:"https://github.com/huggingface/diffusers/blob/vr_14949/src/diffusers/pipelines/kandinsky6/pipeline_output.py#L46",parameters:[{name:"frames",val:": typing.Union[torch.Tensor, numpy.ndarray, list[list[PIL.Image.Image]]]"}],parametersDescription:[{anchor:"diffusers.Kandinsky6SRPipelineOutput.frames",description:`<strong>frames</strong> (<code>torch.Tensor</code>, <code>np.ndarray</code>, or <code>list[list[PIL.Image.Image]]</code>) — | |
| The super-resolved video. A nested list of length <code>batch_size</code> holding <code>num_frames</code> PIL images each, or a | |
| NumPy array or torch tensor of shape <code>(batch_size, num_frames, height, width, channels)</code> / <code>(batch_size, num_frames, channels, height, width)</code>.`,name:"frames"}]}),t(2),s(M);var _e=e(M,2);be(_e,{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/api/pipelines/kandinsky6.md"}),t(2),c(ne,V),we()}export{Je as component}; | |
Xet Storage Details
- Size:
- 66.5 kB
- Xet hash:
- 5a3aa391ef8b68aeb9ec3d5949d053c51ad662f18a1d85958f74d6e8363a3c7c
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.