import{S as Zh,i as Gh,s as Eh,e as a,k as c,w as f,t as o,M as Wh,c as s,d as n,m,a as i,x as g,h as l,b as p,N as We,G as t,g as d,y,q as _,o as b,B as w,v as Ph,L as Ra}from"../../../chunks/vendor-hf-doc-builder.js";import{T as $h}from"../../../chunks/Tip-hf-doc-builder.js";import{D as B}from"../../../chunks/Docstring-hf-doc-builder.js";import{C as Z}from"../../../chunks/CodeBlock-hf-doc-builder.js";import{I as q}from"../../../chunks/IconCopyLink-hf-doc-builder.js";import{E as si}from"../../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Bh(x){let u,T,v,M,J,h,k,ye,_e,Pe,X,V,be,O,$e,$,ft,ae,R,gt,K,yt,_t,S,ee,Be;return ee=new Z({props:{code:"cHJvbXB0JTIwJTNEJTIwJTIyQSUyMGFsaWVuJTIwY2hlZXNlYnVyZ2VyJTIwY3JlYXR1cmUlMjBlYXRpbmclMjBpdHNlbGYlMkMlMjBjbGF5bWF0aW9uJTJDJTIwY2luZW1hdGljJTJDJTIwbW9vZHklMjBsaWdodGluZyUyMiUwQW5lZ2F0aXZlX3Byb21wdCUyMCUzRCUyMCUyMmxvdyUyMHF1YWxpdHklMkMlMjBiYWQlMjBxdWFsaXR5JTIyJTBBJTBBaW1hZ2VfZW1iZWRzJTJDJTIwbmVnYXRpdmVfaW1hZ2VfZW1iZWRzJTIwJTNEJTIwcGlwZV9wcmlvcihwcm9tcHQlMkMlMjBuZWdhdGl2ZV9wcm9tcHQlMkMlMjBnZW5lcmF0b3IlM0RnZW5lcmF0b3IpLnRvX3R1cGxlKCk=",highlighted:`prompt = <span class="hljs-string">&quot;A alien cheeseburger creature eating itself, claymation, cinematic, moody lighting&quot;</span>
negative_prompt = <span class="hljs-string">&quot;low quality, bad quality&quot;</span>

image_embeds, negative_image_embeds = pipe_prior(prompt, negative_prompt, generator=generator).to_tuple()`}}),{c(){u=a("p"),T=o("The text-to-image pipeline expects both "),v=a("code"),M=o("image_embeds"),J=o(", "),h=a("code"),k=o("negative_image_embeds"),ye=o(` and the original
`),_e=a("code"),Pe=o("prompt"),X=o(` as the text-to-image pipeline uses another text encoder to better guide the second diffusion
process of `),V=a("code"),be=o("t2i_pipe"),O=o("."),$e=c(),$=a("p"),ft=o("By default, the prior returns unconditioned negative image embeddings corresponding to the negative prompt of "),ae=a("code"),R=o('""'),gt=o(`.
For better results, you can also pass a `),K=a("code"),yt=o("negative_prompt"),_t=o(` to the prior. This will increase the effective batch size
of the prior by a factor of 2.`),S=c(),f(ee.$$.fragment)},l(U){u=s(U,"P",{});var I=i(u);T=l(I,"The text-to-image pipeline expects both "),v=s(I,"CODE",{});var Vn=i(v);M=l(Vn,"image_embeds"),Vn.forEach(n),J=l(I,", "),h=s(I,"CODE",{});var se=i(h);k=l(se,"negative_image_embeds"),se.forEach(n),ye=l(I,` and the original
`),_e=s(I,"CODE",{});var Rn=i(_e);Pe=l(Rn,"prompt"),Rn.forEach(n),X=l(I,` as the text-to-image pipeline uses another text encoder to better guide the second diffusion
process of `),V=s(I,"CODE",{});var Nn=i(V);be=l(Nn,"t2i_pipe"),Nn.forEach(n),O=l(I,"."),I.forEach(n),$e=m(U),$=s(U,"P",{});var te=i($);ft=l(te,"By default, the prior returns unconditioned negative image embeddings corresponding to the negative prompt of "),ae=s(te,"CODE",{});var j=i(ae);R=l(j,'""'),j.forEach(n),gt=l(te,`.
For better results, you can also pass a `),K=s(te,"CODE",{});var Xn=i(K);yt=l(Xn,"negative_prompt"),Xn.forEach(n),_t=l(te,` to the prior. This will increase the effective batch size
of the prior by a factor of 2.`),te.forEach(n),S=m(U),g(ee.$$.fragment,U)},m(U,I){d(U,u,I),t(u,T),t(u,v),t(v,M),t(u,J),t(u,h),t(h,k),t(u,ye),t(u,_e),t(_e,Pe),t(u,X),t(u,V),t(V,be),t(u,O),d(U,$e,I),d(U,$,I),t($,ft),t($,ae),t(ae,R),t($,gt),t($,K),t(K,yt),t($,_t),d(U,S,I),y(ee,U,I),Be=!0},p:Ra,i(U){Be||(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ENzY4JTJDJTBBJTIwJTIwJTIwJTIwd2lkdGglM0Q3NjglMkMlMEElMjAlMjAlMjAlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNEMTAwJTJDJTBBKS5pbWFnZXMlMEElMEFpbWFnZSU1QjAlNUQuc2F2ZSglMjJjYXQucG5nJTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> KandinskyPipeline, KandinskyPriorPipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>pipe_prior = KandinskyPriorPipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-1-prior&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe_prior.to(<span class="hljs-string">&quot;cuda&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;red cat, 4k photo&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>out = pipe_prior(prompt)
<span class="hljs-meta">&gt;&gt;&gt; </span>image_emb = out.image_embeds
<span class="hljs-meta">&gt;&gt;&gt; </span>negative_image_emb = out.negative_image_embeds

<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = KandinskyPipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-1&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>image = pipe(
<span class="hljs-meta">... </span>    prompt,
<span class="hljs-meta">... </span>    image_embeds=image_emb,
<span class="hljs-meta">... </span>    negative_image_embeds=negative_image_emb,
<span class="hljs-meta">... </span>    height=<span class="hljs-number">768</span>,
<span class="hljs-meta">... </span>    width=<span class="hljs-number">768</span>,
<span class="hljs-meta">... </span>    num_inference_steps=<span class="hljs-number">100</span>,
<span class="hljs-meta">... </span>).images

<span class="hljs-meta">&gt;&gt;&gt; </span>image[<span class="hljs-number">0</span>].save(<span class="hljs-string">&quot;cat.png&quot;</span>)`}}),{c(){u=a("p"),T=o("Examples:"),v=c(),f(M.$$.fragment)},l(h){u=s(h,"P",{});var k=i(u);T=l(k,"Examples:"),k.forEach(n),v=m(h),g(M.$$.fragment,h)},m(h,k){d(h,u,k),t(u,T),d(h,v,k),y(M,h,k),J=!0},p:Ra,i(h){J||(_(M.$$.fragment,h),J=!0)},o(h){b(M.$$.fragment,h),J=!1},d(h){h&&n(u),h&&n(v),w(M,h)}}}function xh(x){let u,T,v,M,J;return M=new Z({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEthbmRpbnNreVByaW9yUGlwZWxpbmUlMkMlMjBLYW5kaW5za3lQaXBlbGluZSUwQWZyb20lMjBkaWZmdXNlcnMudXRpbHMlMjBpbXBvcnQlMjBsb2FkX2ltYWdlJTBBaW1wb3J0JTIwUElMJTBBJTBBaW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdG9yY2h2aXNpb24lMjBpbXBvcnQlMjB0cmFuc2Zvcm1zJTBBJTBBcGlwZV9wcmlvciUyMCUzRCUyMEthbmRpbnNreVByaW9yUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMi0xLXByaW9yJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTBBKSUwQXBpcGVfcHJpb3IudG8oJTIyY3VkYSUyMiklMEElMEFpbWcxJTIwJTNEJTIwbG9hZF9pbWFnZSglMEElMjAlMjAlMjAlMjAlMjJodHRwcyUzQSUyRiUyRmh1Z2dpbmdmYWNlLmNvJTJGZGF0YXNldHMlMkZoZi1pbnRlcm5hbC10ZXN0aW5nJTJGZGlmZnVzZXJzLWltYWdlcyUyRnJlc29sdmUlMkZtYWluJTIyJ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yMCUyMHdpZHRoJTNENzY4JTJDJTBBJTIwJTIwJTIwJTIwbnVtX2luZmVyZW5jZV9zdGVwcyUzRDE1MCUyQyUwQSkuaW1hZ2VzJTVCMCU1RCUwQSUwQWltYWdlLnNhdmUoJTIyc3RhcnJ5X2NhdC5wbmclMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> KandinskyPriorPipeline, KandinskyPipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> PIL

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> torchvision <span class="hljs-keyword">import</span> transforms

<span class="hljs-meta">&gt;&gt;&gt; </span>pipe_prior = KandinskyPriorPipeline.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;kandinsky-community/kandinsky-2-1-prior&quot;</span>, torch_dtype=torch.float16
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe_prior.to(<span class="hljs-string">&quot;cuda&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>img1 = load_image(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main&quot;</span>
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;/kandinsky/cat.png&quot;</span>
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>img2 = load_image(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main&quot;</span>
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;/kandinsky/starry_night.jpeg&quot;</span>
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>images_texts = [<span class="hljs-string">&quot;a cat&quot;</span>, img1, img2]
<span class="hljs-meta">&gt;&gt;&gt; </span>weights = [<span class="hljs-number">0.3</span>, <span class="hljs-number">0.3</span>, <span class="hljs-number">0.4</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>image_emb, zero_image_emb = pipe_prior.interpolate(images_texts, weights)

<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = KandinskyPipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-1&quot;</span>, torch_dtype=torch.float16)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>image = pipe(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;&quot;</span>,
<span class="hljs-meta">... </span>    image_embeds=image_emb,
<span class="hljs-meta">... </span>    negative_image_embeds=zero_image_emb,
<span class="hljs-meta">... </span>    height=<span class="hljs-number">768</span>,
<span class="hljs-meta">... </span>    width=<span class="hljs-number">768</span>,
<span class="hljs-meta">... </span>    num_inference_steps=<span class="hljs-number">150</span>,
<span class="hljs-meta">... </span>).images[<span class="hljs-number">0</span>]

<span class="hljs-meta">&gt;&gt;&gt; </span>image.save(<span class="hljs-string">&quot;starry_cat.png&quot;</span>)`}}),{c(){u=a("p"),T=o("Examples:"),v=c(),f(M.$$.fragment)},l(h){u=s(h,"P",{});var k=i(u);T=l(k,"Examples:"),k.forEach(n),v=m(h),g(M.$$.fragment,h)},m(h,k){d(h,u,k),t(u,T),d(h,v,k),y(M,h,k),J=!0},p:Ra,i(h){J||(_(M.$$.fragment,h),J=!0)},o(h){b(M.$$.fragment,h),J=!1},d(h){h&&n(u),h&&n(v),w(M,h)}}}function Vh(x){let u,T,v,M,J;return M=new Z({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEthbmRpbnNreVBpcGVsaW5lJTJDJTIwS2F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gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> KandinskyPipeline, KandinskyPriorPipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>pipe_prior = KandinskyPriorPipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/Kandinsky-2-1-prior&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe_prior.to(<span class="hljs-string">&quot;cuda&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;red cat, 4k photo&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>out = pipe_prior(prompt)
<span class="hljs-meta">&gt;&gt;&gt; </span>image_emb = out.image_embeds
<span class="hljs-meta">&gt;&gt;&gt; </span>negative_image_emb = out.negative_image_embeds

<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = KandinskyPipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-1&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>image = pipe(
<span class="hljs-meta">... </span>    prompt,
<span class="hljs-meta">... </span>    image_embeds=image_emb,
<span class="hljs-meta">... </span>    negative_image_embeds=negative_image_emb,
<span class="hljs-meta">... </span>    height=<span class="hljs-number">768</span>,
<span class="hljs-meta">... </span>    width=<span class="hljs-number">768</span>,
<span class="hljs-meta">... </span>    num_inference_steps=<span class="hljs-number">100</span>,
<span class="hljs-meta">... </span>).images

<span class="hljs-meta">&gt;&gt;&gt; </span>image[<span class="hljs-number">0</span>].save(<span class="hljs-string">&quot;cat.png&quot;</span>)`}}),{c(){u=a("p"),T=o("Examples:"),v=c(),f(M.$$.fragment)},l(h){u=s(h,"P",{});var k=i(u);T=l(k,"Examples:"),k.forEach(n),v=m(h),g(M.$$.fragment,h)},m(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WFnZSglMEElMjAlMjAlMjAlMjAlMjJodHRwcyUzQSUyRiUyRmh1Z2dpbmdmYWNlLmNvJTJGZGF0YXNldHMlMkZoZi1pbnRlcm5hbC10ZXN0aW5nJTJGZGlmZnVzZXJzLWltYWdlcyUyRnJlc29sdmUlMkZtYWluJTIyJTBBJTIwJTIwJTIwJTIwJTIyJTJGa2FuZGluc2t5JTJGZnJvZy5wbmclMjIlMEEpJTBBJTBBaW1hZ2UlMjAlM0QlMjBwaXBlKCUwQSUyMCUyMCUyMCUyMHByb21wdCUyQyUwQSUyMCUyMCUyMCUyMGltYWdlJTNEaW5pdF9pbWFnZSUyQyUwQSUyMCUyMCUyMCUyMGltYWdlX2VtYmVkcyUzRGltYWdlX2VtYiUyQyUwQSUyMCUyMCUyMCUyMG5lZ2F0aXZlX2ltYWdlX2VtYmVkcyUzRHplcm9faW1hZ2VfZW1iJTJDJTBBJTIwJTIwJTIwJTIwaGVpZ2h0JTNENzY4JTJDJTBBJTIwJTIwJTIwJTIwd2lkdGglM0Q3NjglMkMlMEElMjAlMjAlMjAlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNEMTAwJTJDJTBBJTIwJTIwJTIwJTIwc3RyZW5ndGglM0QwLjIlMkMlMEEpLmltYWdlcyUwQSUwQWltYWdlJTVCMCU1RC5zYXZlKCUyMnJlZF9mcm9nLnBuZyUyMik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> KandinskyImg2ImgPipeline, KandinskyPriorPipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>pipe_prior = KandinskyPriorPipeline.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;kandinsky-community/kandinsky-2-1-prior&quot;</span>, torch_dtype=torch.float16
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe_prior.to(<span class="hljs-string">&quot;cuda&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;A red cartoon frog, 4k&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image_emb, zero_image_emb = pipe_prior(prompt, return_dict=<span class="hljs-literal">False</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = KandinskyImg2ImgPipeline.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;kandinsky-community/kandinsky-2-1&quot;</span>, torch_dtype=torch.float16
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>init_image = load_image(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main&quot;</span>
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;/kandinsky/frog.png&quot;</span>
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>image = pipe(
<span class="hljs-meta">... </span>    prompt,
<span class="hljs-meta">... </span>    image=init_image,
<span class="hljs-meta">... </span>    image_embeds=image_emb,
<span class="hljs-meta">... </span>    negative_image_embeds=zero_image_emb,
<span class="hljs-meta">... </span>    height=<span class="hljs-number">768</span>,
<span class="hljs-meta">... </span>    width=<span class="hljs-number">768</span>,
<span class="hljs-meta">... </span>    num_inference_steps=<span class="hljs-number">100</span>,
<span class="hljs-meta">... </span>    strength=<span class="hljs-number">0.2</span>,
<span class="hljs-meta">... </span>).images

<span class="hljs-meta">&gt;&gt;&gt; </span>image[<span class="hljs-number">0</span>].save(<span class="hljs-string">&quot;red_frog.png&quot;</span>)`}}),{c(){u=a("p"),T=o("Examples:"),v=c(),f(M.$$.fragment)},l(h){u=s(h,"P",{});var k=i(u);T=l(k,"Examples:"),k.forEach(n),v=m(h),g(M.$$.fragment,h)},m(h,k){d(h,u,k),t(u,T),d(h,v,k),y(M,h,k),J=!0},p:Ra,i(h){J||(_(M.$$.fragment,h),J=!0)},o(h){b(M.$$.fragment,h),J=!1},d(h){h&&n(u),h&&n(v),w(M,h)}}}function Nh(x){let u,T,v,M,J;return M=new Z({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEthbmRpbnNreUlucGFpbnRQaXBlbGluZSUyQyUyMEthbmRpbnNreVByaW9yUGlwZWxpbmUlMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwbG9hZF9pbWFnZSUwQWltcG9ydCUyMHRvcmNoJTBBaW1wb3J0JTIwbnVtcHklMjBhcyUyMG5wJTBBJTBBcGlwZV9wcmlvciUyMCUzRCUyMEthbmRpbnNreVByaW9yUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMi0xLXByaW9yJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTBBKSUwQXBpcGVfcHJpb3IudG8oJTIyY3VkYSUyMiklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJhJTIwaGF0JTIyJTBBaW1hZ2VfZW1iJTJDJTIwemVyb19pbWFnZV9lbWIlMjAlM0QlMjBwaXBlX3ByaW9yKHByb21wdCUyQyUyMHJldHVybl9kaWN0JTNERmFsc2UpJTBBJTBBcGlwZSUyMCUzRCUyMEthbmRpbnNreUlucGFpbnRQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIya2FuZGluc2t5LWNvbW11bml0eSUyRmthbmRpbnNreS0yLTEtaW5wYWludCUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUwQSklMEFw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InpaintPipeline, KandinskyPriorPipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np

<span class="hljs-meta">&gt;&gt;&gt; </span>pipe_prior = KandinskyPriorPipeline.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;kandinsky-community/kandinsky-2-1-prior&quot;</span>, torch_dtype=torch.float16
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe_prior.to(<span class="hljs-string">&quot;cuda&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;a hat&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image_emb, zero_image_emb = pipe_prior(prompt, return_dict=<span class="hljs-literal">False</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = KandinskyInpaintPipeline.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;kandinsky-community/kandinsky-2-1-inpaint&quot;</span>, torch_dtype=torch.float16
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>init_image = load_image(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main&quot;</span>
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;/kandinsky/cat.png&quot;</span>
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>mask = np.ones((<span class="hljs-number">768</span>, <span class="hljs-number">768</span>), dtype=np.float32)
<span class="hljs-meta">&gt;&gt;&gt; </span>mask[:<span class="hljs-number">250</span>, <span class="hljs-number">250</span>:-<span class="hljs-number">250</span>] = <span class="hljs-number">0</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>out = pipe(
<span class="hljs-meta">... </span>    prompt,
<span class="hljs-meta">... </span>    image=init_image,
<span class="hljs-meta">... </span>    mask_image=mask,
<span class="hljs-meta">... </span>    image_embeds=image_emb,
<span class="hljs-meta">... </span>    negative_image_embeds=zero_image_emb,
<span class="hljs-meta">... </span>    height=<span class="hljs-number">768</span>,
<span class="hljs-meta">... </span>    width=<span class="hljs-number">768</span>,
<span class="hljs-meta">... </span>    num_inference_steps=<span class="hljs-number">50</span>,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>image = out.images[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>image.save(<span class="hljs-string">&quot;cat_with_hat.png&quot;</span>)`}}),{c(){u=a("p"),T=o("Examples:"),v=c(),f(M.$$.fragment)},l(h){u=s(h,"P",{});var k=i(u);T=l(k,"Examples:"),k.forEach(n),v=m(h),g(M.$$.fragment,h)},m(h,k){d(h,u,k),t(u,T),d(h,v,k),y(M,h,k),J=!0},p:Ra,i(h){J||(_(M.$$.fragment,h),J=!0)},o(h){b(M.$$.fragment,h),J=!1},d(h){h&&n(u),h&&n(v),w(M,h)}}}function Xh(x){let u,T,v,M,J,h,k,ye,_e,Pe,X,V,be,O,$e,$,ft,ae,R,gt,K,yt,_t,S,ee,Be,U,I,Vn,se,Rn,Nn,te,j,Xn,bt,tl,nl,wt,al,sl,Mt,il,ol,kt,ll,rl,vt,pl,dl,Jt,cl,ml,Tt,hl,ii,we,Ce,Na,Ut,ul,Xa,fl,oi,xe,Ka,It,Fa,gl,yl,Ya,_l,bl,Me,jt,Qa,Zt,wl,Ml,qa,Sa,kl,vl,Gt,za,Et,Jl,Tl,Aa,Ha,Ul,Il,Wt,La,Pt,jl,Zl,Da,Oa,Gl,li,ke,Ve,es,$t,El,ts,Wl,ri,Kn,Pl,pi,ve,Re,ns,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,Rp,Np,Ps,Xp,Kp,$s,Fp,Yp,Qp,it,bn,qp,wn,Sp,Bs,zp,Ap,co,Ge,ot,Cs,Mn,Hp,xs,Lp,mo,W,kn,Dp,Vs,Op,ed,vn,td,Ia,nd,ad,sd,ce,Jn,id,Rs,od,ld,lt,rd,rt,Tn,pd,Y,dd,Ns,cd,md,Xs,hd,ud,Ks,fd,gd,Fs,yd,_d,bd,pt,Un,wd,In,Md,Ys,kd,vd,ho,Ee,dt,Qs,jn,Jd,qs,Td,uo,P,Zn,Ud,Ss,Id,jd,Gn,Zd,ja,Gd,Ed,Wd,me,En,Pd,zs,$d,Bd,ct,Cd,mt,Wn,xd,Q,Vd,As,Rd,Nd,Hs,Xd,Kd,Ls,Fd,Yd,Ds,Qd,qd,Sd,ht,Pn,zd,$n,Ad,Os,Hd,Ld,fo;return h=new q({}),O=new q({}),Ut=new q({}),$t=new q({}),Bt=new q({}),xt=new Z({props:{code:"cHJvbXB0JTIwJTNEJTIwJTIyQSUyMGFsaWVuJTIwY2hlZXNlYnVyZ2VyJTIwY3JlYXR1cmUlMjBlYXRpbmclMjBpdHNlbGYlMkMlMjBjbGF5bWF0aW9uJTJDJTIwY2luZW1hdGljJTJDJTIwbW9vZHklMjBsaWdodGluZyUyMg==",highlighted:'prompt = <span class="hljs-string">&quot;A alien cheeseburger creature eating itself, claymation, cinematic, moody lighting&quot;</span>'}}),Vt=new Z({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBaW1wb3J0JTIwdG9yY2glMEElMEFwaXBlX3ByaW9yJTIwJTNEJTIwRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMi0xLXByaW9yJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2KSUwQXBpcGVfcHJpb3IudG8oJTIyY3VkYSUyMiklMEElMEF0MmlfcGlwZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTItMSUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiklMEF0MmlfcGlwZS50byglMjJjdWRhJTIyKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline
<span class="hljs-keyword">import</span> torch

pipe_prior = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-1-prior&quot;</span>, torch_dtype=torch.float16)
pipe_prior.to(<span class="hljs-string">&quot;cuda&quot;</span>)

t2i_pipe = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-1&quot;</span>, torch_dtype=torch.float16)
t2i_pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)`}}),Rt=new Z({props:{code:"Z2VuZXJhdG9yJTIwJTNEJTIwdG9yY2guR2VuZXJhdG9yKGRldmljZSUzRCUyMmN1ZGElMjIpLm1hbnVhbF9zZWVkKDEyKSUwQWltYWdlX2VtYmVkcyUyQyUyMG5lZ2F0aXZlX2ltYWdlX2VtYmVkcyUyMCUzRCUyMHBpcGVfcHJpb3IocHJvbXB0JTJDJTIwZ2VuZXJhdG9yJTNEZ2VuZXJhdG9yKS50b190dXBsZSgp",highlighted:`generator = torch.Generator(device=<span class="hljs-string">&quot;cuda&quot;</span>).manual_seed(<span class="hljs-number">12</span>)
image_embeds, negative_image_embeds = pipe_prior(prompt, generator=generator).to_tuple()`}}),Ne=new $h({props:{warning:!0,$$slots:{default:[Bh]},$$scope:{ctx:x}}}),Nt=new Z({props:{code:"aW1hZ2UlMjAlM0QlMjB0MmlfcGlwZShwcm9tcHQlMkMlMjBpbWFnZV9lbWJlZHMlM0RpbWFnZV9lbWJlZHMlMkMlMjBuZWdhdGl2ZV9pbWFnZV9lbWJlZHMlM0RuZWdhdGl2ZV9pbWFnZV9lbWJlZHMpLmltYWdlcyU1QjAlNUQlMEFpbWFnZS5zYXZlKCUyMmNoZWVzZWJ1cmdlcl9tb25zdGVyLnBuZyUyMik=",highlighted:`image = t2i_pipe(prompt, image_embeds=image_embeds, negative_image_embeds=negative_image_embeds).images[<span class="hljs-number">0</span>]
image.save(<span class="hljs-string">&quot;cheeseburger_monster.png&quot;</span>)`}}),Xt=new Z({props:{code:"cHJvbXB0JTIwJTNEJTIwJTIyYmlyZCUyMGV5ZSUyMHZpZXclMjBzaG90JTIwb2YlMjBhJTIwZnVsbCUyMGJvZHklMjB3b21hbiUyMHdpdGglMjBjeWFuJTIwbGlnaHQlMjBvcmFuZ2UlMjBtYWdlbnRhJTIwbWFrZXVwJTJDJTIwZGlnaXRhbCUyMGFydCUyQyUyMGxvbmclMjBicmFpZGVkJTIwaGFpciUyMGhlciUyMGZhY2UlMjBzZXBhcmF0ZWQlMjBieSUyMG1ha2V1cCUyMGluJTIwdGhlJTIwc3R5bGUlMjBvZiUyMHlpbiUyMFlhbmclMjBzdXJyZWFsaXNtJTJDJTIwc3ltbWV0cmljYWwlMjBmYWNlJTJDJTIwcmVhbCUyMGltYWdlJTJDJTIwY29udHJhc3RpbmclMjB0b25lJTJDJTIwcGFzdGVsJTIwZ3JhZGllbnQlMjBiYWNrZ3JvdW5kJTIy",highlighted:'prompt = <span class="hljs-string">&quot;bird eye view shot of a full body woman with cyan light orange magenta makeup, digital art, long braided hair her face separated by makeup in the style of yin Yang surrealism, symmetrical face, real image, contrasting tone, pastel gradient background&quot;</span>'}}),Kt=new Z({props:{code:"cHJvbXB0JTIwJTNEJTIwJTIyQSUyMGNhciUyMGV4cGxvZGluZyUyMGludG8lMjBjb2xvcmZ1bCUyMGR1c3QlMjI=",highlighted:'prompt = <span class="hljs-string">&quot;A car exploding into colorful dust&quot;</span>'}}),Ft=new Z({props:{code:"cHJvbXB0JTIwJTNEJTIwJTIyZWRpdG9yaWFsJTIwcGhvdG9ncmFwaHklMjBvZiUyMGFuJTIwb3JnYW5pYyUyQyUyMGFsbW9zdCUyMGxpcXVpZCUyMHNtb2tlJTIwc3R5bGUlMjBhcm1jaGFpciUyMg==",highlighted:'prompt = <span class="hljs-string">&quot;editorial photography of an organic, almost liquid smoke style armchair&quot;</span>'}}),Yt=new Z({props:{code:"cHJvbXB0JTIwJTNEJTIwJTIyYmlyZHMlMjBleWUlMjB2aWV3JTIwb2YlMjBhJTIwcXVpbHRlZCUyMHBhcGVyJTIwc3R5bGUlMjBhbGllbiUyMHBsYW5ldCUyMGxhbmRzY2FwZSUyQyUyMHZpYnJhbnQlMjBjb2xvdXJzJTJDJTIwQ2luZW1hdGljJTIwbGlnaHRpbmclMjI=",highlighted:'prompt = <span class="hljs-string">&quot;birds eye view of a quilted paper style alien planet landscape, vibrant colours, Cinematic lighting&quot;</span>'}}),Qt=new q({}),qt=new Z({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwaW8lMjBpbXBvcnQlMjBCeXRlc0lPJTBBJTBBJTIzJTIwZG93bmxvYWQlMjBpbWFnZSUwQXVybCUyMCUzRCUyMCUyMmh0dHBzJTNBJTJGJTJGcmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSUyRkNvbXBWaXMlMkZzdGFibGUtZGlmZnVzaW9uJTJGbWFpbiUyRmFzc2V0cyUyRnN0YWJsZS1zYW1wbGVzJTJGaW1nMmltZyUyRnNrZXRjaC1tb3VudGFpbnMtaW5wdXQuanBnJTIyJTBBcmVzcG9uc2UlMjAlM0QlMjByZXF1ZXN0cy5nZXQodXJsKSUwQW9yaWdpbmFsX2ltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihCeXRlc0lPKHJlc3BvbnNlLmNvbnRlbnQpKS5jb252ZXJ0KCUyMlJHQiUyMiklMEFvcmlnaW5hbF9pbWFnZSUyMCUzRCUyMG9yaWdpbmFsX2ltYWdlLnJlc2l6ZSgoNzY4JTJDJTIwNTEyKSk=",highlighted:`<span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-keyword">import</span> requests
<span class="hljs-keyword">from</span> io <span class="hljs-keyword">import</span> BytesIO

<span class="hljs-comment"># download image</span>
url = <span class="hljs-string">&quot;https://raw.githubusercontent.com/CompVis/stable-diffusion/main/assets/stable-samples/img2img/sketch-mountains-input.jpg&quot;</span>
response = requests.get(url)
original_image = Image.<span class="hljs-built_in">open</span>(BytesIO(response.content)).convert(<span class="hljs-string">&quot;RGB&quot;</span>)
original_image = original_image.resize((<span class="hljs-number">768</span>, <span class="hljs-number">512</span>))`}}),St=new Z({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwS2FuZGluc2t5SW1nMkltZ1BpcGVsaW5lJTJDJTIwS2FuZGluc2t5UHJpb3JQaXBlbGluZSUwQSUwQSUyMyUyMGNyZWF0ZSUyMHByaW9yJTBBcGlwZV9wcmlvciUyMCUzRCUyMEthbmRpbnNreVByaW9yUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMi0xLXByaW9yJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTBBKSUwQXBpcGVfcHJpb3IudG8oJTIyY3VkYSUyMiklMEElMEElMjMlMjBjcmVhdGUlMjBpbWcyaW1nJTIwcGlwZWxpbmUlMEFwaXBlJTIwJTNEJTIwS2FuZGluc2t5SW1nMkltZ1BpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTItMSUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiklMEFwaXBlLnRvKCUyMmN1ZGElMjIpJTBBJTBBcHJvbXB0JTIwJTNEJTIwJTIyQSUyMGZhbnRhc3klMjBsYW5kc2NhcGUlMkMlMjBDaW5lbWF0aWMlMjBsaWdodGluZyUyMiUwQW5lZ2F0aXZlX3Byb21wdCUyMCUzRCUyMCUyMmxvdyUyMHF1YWxpdHklMkMlMjBiYWQlMjBxdWFsaXR5JTIyJTBBJTBBZ2VuZXJhdG9yJTIwJTNEJTIwdG9yY2guR2VuZXJhdG9yKGRldmljZSUzRCUyMmN1ZGElMjIpLm1hbnVhbF9zZWVkKDMwKSUwQWltYWdlX2VtYmVkcyUyQyUyMG5lZ2F0aXZlX2ltYWdlX2VtYmVkcyUyMCUzRCUyMHBpcGVfcHJpb3IocHJvbXB0JTJDJTIwbmVnYXRpdmVfcHJvbXB0JTJDJTIwZ2VuZXJhdG9yJTNEZ2VuZXJhdG9yKS50b190dXBsZSgpJTBBJTBBb3V0JTIwJTNEJTIwcGlwZSglMEElMjAlMjAlMjAlMjBwcm9tcHQlMkMlMEElMjAlMjAlMjAlMjBpbWFnZSUzRG9yaWdpbmFsX2ltYWdlJTJDJTBBJTIwJTIwJTIwJTIwaW1hZ2VfZW1iZWRzJTNEaW1hZ2VfZW1iZWRzJTJDJTBBJTIwJTIwJTIwJTIwbmVnYXRpdmVfaW1hZ2VfZW1iZWRzJTNEbmVnYXRpdmVfaW1hZ2VfZW1iZWRzJTJDJTBBJTIwJTIwJTIwJTIwaGVpZ2h0JTNENzY4JTJDJTBBJTIwJTIwJTIwJTIwd2lkdGglM0Q3NjglMkMlMEElMjAlMjAlMjAlMjBzdHJlbmd0aCUzRDAuMyUyQyUwQSklMEElMEFvdXQuaW1hZ2VzJTVCMCU1RC5zYXZlKCUyMmZhbnRhc3lfbGFuZC5wbmclMjIp",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> KandinskyImg2ImgPipeline, KandinskyPriorPipeline

<span class="hljs-comment"># create prior</span>
pipe_prior = KandinskyPriorPipeline.from_pretrained(
    <span class="hljs-string">&quot;kandinsky-community/kandinsky-2-1-prior&quot;</span>, torch_dtype=torch.float16
)
pipe_prior.to(<span class="hljs-string">&quot;cuda&quot;</span>)

<span class="hljs-comment"># create img2img pipeline</span>
pipe = KandinskyImg2ImgPipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-1&quot;</span>, torch_dtype=torch.float16)
pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)

prompt = <span class="hljs-string">&quot;A fantasy landscape, Cinematic lighting&quot;</span>
negative_prompt = <span class="hljs-string">&quot;low quality, bad quality&quot;</span>

generator = torch.Generator(device=<span class="hljs-string">&quot;cuda&quot;</span>).manual_seed(<span class="hljs-number">30</span>)
image_embeds, negative_image_embeds = pipe_prior(prompt, negative_prompt, generator=generator).to_tuple()

out = pipe(
    prompt,
    image=original_image,
    image_embeds=image_embeds,
    negative_image_embeds=negative_image_embeds,
    height=<span class="hljs-number">768</span>,
    width=<span class="hljs-number">768</span>,
    strength=<span class="hljs-number">0.3</span>,
)

out.images[<span class="hljs-number">0</span>].save(<span class="hljs-string">&quot;fantasy_land.png&quot;</span>)`}}),zt=new q({}),At=new Z({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEthbmRpbnNreUlucGFpbnRQaXBlbGluZSUyQyUyMEthbmRpbnNreVByaW9yUGlwZWxpbmUlMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwbG9hZF9pbWFnZSUwQWltcG9ydCUyMHRvcmNoJTBBaW1wb3J0JTIwbnVtcHklMjBhcyUyMG5wJTBBJTBBcGlwZV9wcmlvciUyMCUzRCUyMEthbmRpbnNreVByaW9yUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMi0xLXByaW9yJTIyJTJDJTIwdG9yY2hf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wJTIwJTIwKipwcmlvcl9vdXRwdXQlMkMlMEElMjAlMjAlMjAlMjBoZWlnaHQlM0Q3NjglMkMlMEElMjAlMjAlMjAlMjB3aWR0aCUzRDc2OCUyQyUwQSUyMCUyMCUyMCUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0QxNTAlMkMlMEEpJTBBJTBBaW1hZ2UlMjAlM0QlMjBvdXQuaW1hZ2VzJTVCMCU1RCUwQWltYWdlLnNhdmUoJTIyY2F0X3dpdGhfaGF0LnBuZyUyMik=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> KandinskyInpaintPipeline, KandinskyPriorPipeline
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image
<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np

pipe_prior = KandinskyPriorPipeline.from_pretrained(
    <span class="hljs-string">&quot;kandinsky-community/kandinsky-2-1-prior&quot;</span>, torch_dtype=torch.float16
)
pipe_prior.to(<span class="hljs-string">&quot;cuda&quot;</span>)

prompt = <span class="hljs-string">&quot;a hat&quot;</span>
prior_output = pipe_prior(prompt)

pipe = KandinskyInpaintPipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-1-inpaint&quot;</span>, torch_dtype=torch.float16)
pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)

init_image = load_image(
    <span class="hljs-string">&quot;https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main&quot;</span> <span class="hljs-string">&quot;/kandinsky/cat.png&quot;</span>
)

mask = np.ones((<span class="hljs-number">768</span>, <span class="hljs-number">768</span>), dtype=np.float32)
<span class="hljs-comment"># Let&#x27;s mask out an area above the cat&#x27;s head</span>
mask[:<span class="hljs-number">250</span>, <span class="hljs-number">250</span>:-<span class="hljs-number">250</span>] = <span class="hljs-number">0</span>

out = pipe(
    prompt,
    image=init_image,
    mask_image=mask,
    **prior_output,
    height=<span class="hljs-number">768</span>,
    width=<span class="hljs-number">768</span>,
    num_inference_steps=<span class="hljs-number">150</span>,
)

image = out.images[<span class="hljs-number">0</span>]
image.save(<span class="hljs-string">&quot;cat_with_hat.png&quot;</span>)`}}),Ht=new q({}),Lt=new Z({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEthbmRpbnNreVByaW9yUGlwZWxpbmUlMkMlMjBLYW5kaW5za3lQaXBlbGluZSUwQWZyb20lMjBkaWZmdXNlcnMudXRpbHMlMjBpbXBvcnQlMjBsb2FkX2ltYWdlJTBBaW1wb3J0JTIwUElMJTBBJTBBaW1wb3J0JTIwdG9yY2glMEElMEFwaXBlX3ByaW9yJTIwJTNEJTIwS2FuZGluc2t5UHJpb3JQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIya2FuZGluc2t5LWNvbW11bml0eSUyRmthbmRpbnNreS0yLTEtcHJpb3IlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMEEpJTBBcGlwZV9wcmlvci50byglMjJjdWRhJTIyKSUwQSUwQWltZzElMjAlM0QlMjBsb2FkX2ltYWdlKCUwQSUyMCUyMCUyMCUyMCUyMmh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZkYXRhc2V0cyUyRmhmLWludGVybmFsLXRlc3RpbmclMkZkaWZmdXNlcnMtaW1hZ2VzJTJGcmVzb2x2ZSUyRm1haW4lMjIlMjAlMjIlMkZrYW5kaW5za3klMkZjYXQucG5nJTIyJTBBKSUwQSUwQWltZzIlMjAlM0QlMjBsb2FkX2ltYWdlKCUwQSUyMCUyMCUyMCUyMCUyMmh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZkYXRhc2V0cyUyRmhmLWludGVybmFsLXRlc3RpbmclMkZkaWZmdXNlcnMtaW1hZ2VzJTJGcmVzb2x2ZSUyRm1haW4lMjIlMjAlMjIlMkZrYW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word">import</span> KandinskyPriorPipeline, KandinskyPipeline
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image
<span class="hljs-keyword">import</span> PIL

<span class="hljs-keyword">import</span> torch

pipe_prior = KandinskyPriorPipeline.from_pretrained(
    <span class="hljs-string">&quot;kandinsky-community/kandinsky-2-1-prior&quot;</span>, torch_dtype=torch.float16
)
pipe_prior.to(<span class="hljs-string">&quot;cuda&quot;</span>)

img1 = load_image(
    <span class="hljs-string">&quot;https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main&quot;</span> <span class="hljs-string">&quot;/kandinsky/cat.png&quot;</span>
)

img2 = load_image(
    <span class="hljs-string">&quot;https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main&quot;</span> <span class="hljs-string">&quot;/kandinsky/starry_night.jpeg&quot;</span>
)

<span class="hljs-comment"># add all the conditions we want to interpolate, can be either text or image</span>
images_texts = [<span class="hljs-string">&quot;a cat&quot;</span>, img1, img2]

<span class="hljs-comment"># specify the weights for each condition in images_texts</span>
weights = [<span class="hljs-number">0.3</span>, <span class="hljs-number">0.3</span>, <span class="hljs-number">0.4</span>]

<span class="hljs-comment"># We can leave the prompt empty</span>
prompt = <span class="hljs-string">&quot;&quot;</span>
prior_out = pipe_prior.interpolate(images_texts, weights)

pipe = KandinskyPipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-1&quot;</span>, torch_dtype=torch.float16)
pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)

image = pipe(prompt, **prior_out, height=<span class="hljs-number">768</span>, width=<span class="hljs-number">768</span>).images[<span class="hljs-number">0</span>]

image.save(<span class="hljs-string">&quot;starry_cat.png&quot;</span>)`}}),Dt=new q({}),en=new Z({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBaW1wb3J0JTIwdG9yY2glMEElMEF0MmlfcGlwZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTItMSUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiklMEF0MmlfcGlwZS5lbmFibGVfeGZvcm1lcnNfbWVtb3J5X2VmZmljaWVudF9hdHRlbnRpb24oKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline
<span class="hljs-keyword">import</span> torch

t2i_pipe = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-1&quot;</span>, torch_dtype=torch.float16)
t2i_pipe.enable_xformers_memory_efficient_attention()`}}),nn=new Z({props:{code:"ZnJvbSUyMGRpZmZ1c2Vycy5tb2RlbHMuYXR0ZW50aW9uX3Byb2Nlc3NvciUyMGltcG9ydCUyMEF0dG5BZGRlZEtWUHJvY2Vzc29yMl8wJTBBJTBBdDJpX3BpcGUudW5ldC5zZXRfYXR0bl9wcm9jZXNzb3IoQXR0bkFkZGVkS1ZQcm9jZXNzb3IyXzAoKSk=",highlighted:`<span class="hljs-keyword">from</span> diffusers.models.attention_processor <span class="hljs-keyword">import</span> AttnAddedKVProcessor2_0

t2i_pipe.unet.set_attn_processor(AttnAddedKVProcessor2_0())`}}),an=new Z({props:{code:"ZnJvbSUyMGRpZmZ1c2Vycy5tb2RlbHMuYXR0ZW50aW9uX3Byb2Nlc3NvciUyMGltcG9ydCUyMEF0dG5BZGRlZEtWUHJvY2Vzc29yJTBBJTBBdDJpX3BpcGUudW5ldC5zZXRfYXR0bl9wcm9jZXNzb3IoQXR0bkFkZGVkS1ZQcm9jZXNzb3IoKSk=",highlighted:`<span class="hljs-keyword">from</span> diffusers.models.attention_processor <span class="hljs-keyword">import</span> AttnAddedKVProcessor

t2i_pipe.unet.set_attn_processor(AttnAddedKVProcessor())`}}),sn=new Z({props:{code:"dDJpX3BpcGUudW5ldC50byhtZW1vcnlfZm9ybWF0JTNEdG9yY2guY2hhbm5lbHNfbGFzdCklMEF0MmlfcGlwZS51bmV0JTIwJTNEJTIwdG9yY2guY29tcGlsZSh0MmlfcGlwZS51bmV0JTJDJTIwbW9kZSUzRCUyMnJlZHVjZS1vdmVyaGVhZCUyMiUyQyUyMGZ1bGxncmFwaCUzRFRydWUp",highlighted:`t2i_pipe.unet.to(memory_format=torch.channels_last)
t2i_pipe.unet = torch.<span class="hljs-built_in">compile</span>(t2i_pipe.unet, mode=<span class="hljs-string">&quot;reduce-overhead&quot;</span>, fullgraph=<span class="hljs-literal">True</span>)`}}),ln=new q({}),rn=new B({props:{name:"class diffusers.KandinskyPriorPipeline",anchor:"diffusers.KandinskyPriorPipeline",parameters:[{name:"prior",val:": PriorTransformer"},{name:"image_encoder",val:": CLIPVisionModelWithProjection"},{name:"text_encoder",val:": CLIPTextModelWithProjection"},{name:"tokenizer",val:": CLIPTokenizer"},{name:"scheduler",val:": UnCLIPScheduler"},{name:"image_processor",val:": CLIPImageProcessor"}],parametersDescription:[{anchor:"diffusers.KandinskyPriorPipeline.prior",description:`<strong>prior</strong> (<a href="/docs/diffusers/v0.17.0/en/api/models#diffusers.PriorTransformer">PriorTransformer</a>) &#x2014;
The canonincal unCLIP prior to approximate the image embedding from the text embedding.`,name:"prior"},{anchor:"diffusers.KandinskyPriorPipeline.image_encoder",description:`<strong>image_encoder</strong> (<code>CLIPVisionModelWithProjection</code>) &#x2014;
Frozen image-encoder.`,name:"image_encoder"},{anchor:"diffusers.KandinskyPriorPipeline.text_encoder",description:`<strong>text_encoder</strong> (<code>CLIPTextModelWithProjection</code>) &#x2014;
Frozen text-encoder.`,name:"text_encoder"},{anchor:"diffusers.KandinskyPriorPipeline.tokenizer",description:`<strong>tokenizer</strong> (<code>CLIPTokenizer</code>) &#x2014;
Tokenizer of class
<a href="https://huggingface.co/docs/transformers/v4.21.0/en/model_doc/clip#transformers.CLIPTokenizer" rel="nofollow">CLIPTokenizer</a>.`,name:"tokenizer"},{anchor:"diffusers.KandinskyPriorPipeline.scheduler",description:`<strong>scheduler</strong> (<code>UnCLIPScheduler</code>) &#x2014;
A scheduler to be used in combination with <code>prior</code> to generate image embedding.`,name:"scheduler"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.0/src/diffusers/pipelines/kandinsky/pipeline_kandinsky_prior.py#L129"}}),dn=new B({props:{name:"__call__",anchor:"diffusers.KandinskyPriorPipeline.__call__",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]]"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"num_images_per_prompt",val:": int = 1"},{name:"num_inference_steps",val:": int = 25"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"latents",val:": typing.Optional[torch.FloatTensor] = None"},{name:"guidance_scale",val:": float = 4.0"},{name:"output_type",val:": typing.Optional[str] = 'pt'"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.KandinskyPriorPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>) &#x2014;
The prompt or prompts to guide the image generation.`,name:"prompt"},{anchor:"diffusers.KandinskyPriorPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. Ignored when not using guidance (i.e., ignored
if <code>guidance_scale</code> is less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.KandinskyPriorPipeline.__call__.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.KandinskyPriorPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 100) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.KandinskyPriorPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.KandinskyPriorPipeline.__call__.latents",description:`<strong>latents</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated noisy latents, sampled from a Gaussian distribution, to be used as inputs for image
generation. Can be used to tweak the same generation with different prompts. If not provided, a latents
tensor will ge generated by sampling using the supplied random <code>generator</code>.`,name:"latents"},{anchor:"diffusers.KandinskyPriorPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 4.0) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.KandinskyPriorPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pt&quot;</code>) &#x2014;
The output format of the generate image. Choose between: <code>&quot;np&quot;</code> (<code>np.array</code>) or <code>&quot;pt&quot;</code>
(<code>torch.Tensor</code>).`,name:"output_type"},{anchor:"diffusers.KandinskyPriorPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <a href="/docs/diffusers/v0.17.0/en/api/outputs#diffusers.ImagePipelineOutput">ImagePipelineOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.0/src/diffusers/pipelines/kandinsky/pipeline_kandinsky_prior.py#L433",returnType:`
<p><code>KandinskyPriorPipelineOutput</code> or <code>tuple</code></p>
`}}),Oe=new si({props:{anchor:"diffusers.KandinskyPriorPipeline.__call__.example",$$slots:{default:[Ch]},$$scope:{ctx:x}}}),cn=new B({props:{name:"interpolate",anchor:"diffusers.KandinskyPriorPipeline.interpolate",parameters:[{name:"images_and_prompts",val:": typing.List[typing.Union[str, PIL.Image.Image, torch.FloatTensor]]"},{name:"weights",val:": typing.List[float]"},{name:"num_images_per_prompt",val:": int = 1"},{name:"num_inference_steps",val:": int = 25"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"latents",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_prior_prompt",val:": typing.Optional[str] = None"},{name:"negative_prompt",val:": str = ''"},{name:"guidance_scale",val:": float = 4.0"},{name:"device",val:" = None"}],parametersDescription:[{anchor:"diffusers.KandinskyPriorPipeline.interpolate.images_and_prompts",description:`<strong>images_and_prompts</strong> (<code>List[Union[str, PIL.Image.Image, torch.FloatTensor]]</code>) &#x2014;
list of prompts and images to guide the image generation.
weights &#x2014; (<code>List[float]</code>):
list of weights for each condition in <code>images_and_prompts</code>`,name:"images_and_prompts"},{anchor:"diffusers.KandinskyPriorPipeline.interpolate.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.KandinskyPriorPipeline.interpolate.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 100) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.KandinskyPriorPipeline.interpolate.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.KandinskyPriorPipeline.interpolate.latents",description:`<strong>latents</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated noisy latents, sampled from a Gaussian distribution, to be used as inputs for image
generation. Can be used to tweak the same generation with different prompts. If not provided, a latents
tensor will ge generated by sampling using the supplied random <code>generator</code>.`,name:"latents"},{anchor:"diffusers.KandinskyPriorPipeline.interpolate.negative_prior_prompt",description:`<strong>negative_prior_prompt</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The prompt not to guide the prior diffusion process. Ignored when not using guidance (i.e., ignored if
<code>guidance_scale</code> is less than <code>1</code>).`,name:"negative_prior_prompt"},{anchor:"diffusers.KandinskyPriorPipeline.interpolate.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt not to guide the image generation. Ignored when not using guidance (i.e., ignored if
<code>guidance_scale</code> is less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.KandinskyPriorPipeline.interpolate.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 4.0) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,name:"guidance_scale"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.0/src/diffusers/pipelines/kandinsky/pipeline_kandinsky_prior.py#L170",returnType:`
<p><code>KandinskyPriorPipelineOutput</code> or <code>tuple</code></p>
`}}),et=new si({props:{anchor:"diffusers.KandinskyPriorPipeline.interpolate.example",$$slots:{default:[xh]},$$scope:{ctx:x}}}),mn=new B({props:{name:"enable_sequential_cpu_offload",anchor:"diffusers.KandinskyPriorPipeline.enable_sequential_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.0/src/diffusers/pipelines/kandinsky/pipeline_kandinsky_prior.py#L297"}}),un=new q({}),fn=new B({props:{name:"class diffusers.KandinskyPipeline",anchor:"diffusers.KandinskyPipeline",parameters:[{name:"text_encoder",val:": MultilingualCLIP"},{name:"tokenizer",val:": XLMRobertaTokenizer"},{name:"unet",val:": UNet2DConditionModel"},{name:"scheduler",val:": DDIMScheduler"},{name:"movq",val:": VQModel"}],parametersDescription:[{anchor:"diffusers.KandinskyPipeline.text_encoder",description:`<strong>text_encoder</strong> (<code>MultilingualCLIP</code>) &#x2014;
Frozen text-encoder.`,name:"text_encoder"},{anchor:"diffusers.KandinskyPipeline.tokenizer",description:`<strong>tokenizer</strong> (<code>XLMRobertaTokenizer</code>) &#x2014;
Tokenizer of class`,name:"tokenizer"},{anchor:"diffusers.KandinskyPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/v0.17.0/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>) &#x2014;
A scheduler to be used in combination with <code>unet</code> to generate image latents.`,name:"scheduler"},{anchor:"diffusers.KandinskyPipeline.unet",description:`<strong>unet</strong> (<a href="/docs/diffusers/v0.17.0/en/api/models#diffusers.UNet2DConditionModel">UNet2DConditionModel</a>) &#x2014;
Conditional U-Net architecture to denoise the image embedding.`,name:"unet"},{anchor:"diffusers.KandinskyPipeline.movq",description:`<strong>movq</strong> (<a href="/docs/diffusers/v0.17.0/en/api/models#diffusers.VQModel">VQModel</a>) &#x2014;
MoVQ Decoder to generate the image from the latents.`,name:"movq"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.0/src/diffusers/pipelines/kandinsky/pipeline_kandinsky.py#L79"}}),yn=new B({props:{name:"__call__",anchor:"diffusers.KandinskyPipeline.__call__",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]]"},{name:"image_embeds",val:": typing.Union[torch.FloatTensor, typing.List[torch.FloatTensor]]"},{name:"negative_image_embeds",val:": typing.Union[torch.FloatTensor, typing.List[torch.FloatTensor]]"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"height",val:": int = 512"},{name:"width",val:": int = 512"},{name:"num_inference_steps",val:": int = 100"},{name:"guidance_scale",val:": float = 4.0"},{name:"num_images_per_prompt",val:": int = 1"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"latents",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_type",val:": typing.Optional[str] = 'pil'"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.KandinskyPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>) &#x2014;
The prompt or prompts to guide the image generation.`,name:"prompt"},{anchor:"diffusers.KandinskyPipeline.__call__.image_embeds",description:`<strong>image_embeds</strong> (<code>torch.FloatTensor</code> or <code>List[torch.FloatTensor]</code>) &#x2014;
The clip image embeddings for text prompt, that will be used to condition the image generation.`,name:"image_embeds"},{anchor:"diffusers.KandinskyPipeline.__call__.negative_image_embeds",description:`<strong>negative_image_embeds</strong> (<code>torch.FloatTensor</code> or <code>List[torch.FloatTensor]</code>) &#x2014;
The clip image embeddings for negative text prompt, will be used to condition the image generation.`,name:"negative_image_embeds"},{anchor:"diffusers.KandinskyPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. Ignored when not using guidance (i.e., ignored
if <code>guidance_scale</code> is less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.KandinskyPipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
The height in pixels of the generated image.`,name:"height"},{anchor:"diffusers.KandinskyPipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
The width in pixels of the generated image.`,name:"width"},{anchor:"diffusers.KandinskyPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 100) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.KandinskyPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 4.0) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.KandinskyPipeline.__call__.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.KandinskyPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.KandinskyPipeline.__call__.latents",description:`<strong>latents</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated noisy latents, sampled from a Gaussian distribution, to be used as inputs for image
generation. Can be used to tweak the same generation with different prompts. If not provided, a latents
tensor will ge generated by sampling using the supplied random <code>generator</code>.`,name:"latents"},{anchor:"diffusers.KandinskyPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pil&quot;</code>) &#x2014;
The output format of the generate image. Choose between: <code>&quot;pil&quot;</code> (<code>PIL.Image.Image</code>), <code>&quot;np&quot;</code>
(<code>np.array</code>) or <code>&quot;pt&quot;</code> (<code>torch.Tensor</code>).`,name:"output_type"},{anchor:"diffusers.KandinskyPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <a href="/docs/diffusers/v0.17.0/en/api/outputs#diffusers.ImagePipelineOutput">ImagePipelineOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.0/src/diffusers/pipelines/kandinsky/pipeline_kandinsky.py#L300",returnType:`
<p><a
  href="/docs/diffusers/v0.17.0/en/api/outputs#diffusers.ImagePipelineOutput"
>ImagePipelineOutput</a> or <code>tuple</code></p>
`}}),at=new si({props:{anchor:"diffusers.KandinskyPipeline.__call__.example",$$slots:{default:[Vh]},$$scope:{ctx:x}}}),_n=new B({props:{name:"enable_model_cpu_offload",anchor:"diffusers.KandinskyPipeline.enable_model_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.0/src/diffusers/pipelines/kandinsky/pipeline_kandinsky.py#L253"}}),bn=new B({props:{name:"enable_sequential_cpu_offload",anchor:"diffusers.KandinskyPipeline.enable_sequential_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.0/src/diffusers/pipelines/kandinsky/pipeline_kandinsky.py#L231"}}),Mn=new q({}),kn=new B({props:{name:"class diffusers.KandinskyImg2ImgPipeline",anchor:"diffusers.KandinskyImg2ImgPipeline",parameters:[{name:"text_encoder",val:": MultilingualCLIP"},{name:"movq",val:": VQModel"},{name:"tokenizer",val:": XLMRobertaTokenizer"},{name:"unet",val:": UNet2DConditionModel"},{name:"scheduler",val:": DDIMScheduler"}],parametersDescription:[{anchor:"diffusers.KandinskyImg2ImgPipeline.text_encoder",description:`<strong>text_encoder</strong> (<code>MultilingualCLIP</code>) &#x2014;
Frozen text-encoder.`,name:"text_encoder"},{anchor:"diffusers.KandinskyImg2ImgPipeline.tokenizer",description:`<strong>tokenizer</strong> (<code>XLMRobertaTokenizer</code>) &#x2014;
Tokenizer of class`,name:"tokenizer"},{anchor:"diffusers.KandinskyImg2ImgPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/v0.17.0/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>) &#x2014;
A scheduler to be used in combination with <code>unet</code> to generate image latents.`,name:"scheduler"},{anchor:"diffusers.KandinskyImg2ImgPipeline.unet",description:`<strong>unet</strong> (<a href="/docs/diffusers/v0.17.0/en/api/models#diffusers.UNet2DConditionModel">UNet2DConditionModel</a>) &#x2014;
Conditional U-Net architecture to denoise the image embedding.`,name:"unet"},{anchor:"diffusers.KandinskyImg2ImgPipeline.movq",description:`<strong>movq</strong> (<a href="/docs/diffusers/v0.17.0/en/api/models#diffusers.VQModel">VQModel</a>) &#x2014;
MoVQ image encoder and decoder`,name:"movq"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.0/src/diffusers/pipelines/kandinsky/pipeline_kandinsky_img2img.py#L101"}}),Jn=new B({props:{name:"__call__",anchor:"diffusers.KandinskyImg2ImgPipeline.__call__",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]]"},{name:"image",val:": typing.Union[torch.FloatTensor, PIL.Image.Image, typing.List[torch.FloatTensor], typing.List[PIL.Image.Image]]"},{name:"image_embeds",val:": FloatTensor"},{name:"negative_image_embeds",val:": FloatTensor"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"height",val:": int = 512"},{name:"width",val:": int = 512"},{name:"num_inference_steps",val:": int = 100"},{name:"strength",val:": float = 0.3"},{name:"guidance_scale",val:": float = 7.0"},{name:"num_images_per_prompt",val:": int = 1"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"output_type",val:": typing.Optional[str] = 'pil'"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.KandinskyImg2ImgPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>) &#x2014;
The prompt or prompts to guide the image generation.`,name:"prompt"},{anchor:"diffusers.KandinskyImg2ImgPipeline.__call__.image",description:`<strong>image</strong> (<code>torch.FloatTensor</code>, <code>PIL.Image.Image</code>) &#x2014;
<code>Image</code>, or tensor representing an image batch, that will be used as the starting point for the
process.`,name:"image"},{anchor:"diffusers.KandinskyImg2ImgPipeline.__call__.image_embeds",description:`<strong>image_embeds</strong> (<code>torch.FloatTensor</code> or <code>List[torch.FloatTensor]</code>) &#x2014;
The clip image embeddings for text prompt, that will be used to condition the image generation.`,name:"image_embeds"},{anchor:"diffusers.KandinskyImg2ImgPipeline.__call__.negative_image_embeds",description:`<strong>negative_image_embeds</strong> (<code>torch.FloatTensor</code> or <code>List[torch.FloatTensor]</code>) &#x2014;
The clip image embeddings for negative text prompt, will be used to condition the image generation.`,name:"negative_image_embeds"},{anchor:"diffusers.KandinskyImg2ImgPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. Ignored when not using guidance (i.e., ignored
if <code>guidance_scale</code> is less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.KandinskyImg2ImgPipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
The height in pixels of the generated image.`,name:"height"},{anchor:"diffusers.KandinskyImg2ImgPipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
The width in pixels of the generated image.`,name:"width"},{anchor:"diffusers.KandinskyImg2ImgPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 100) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.KandinskyImg2ImgPipeline.__call__.strength",description:`<strong>strength</strong> (<code>float</code>, <em>optional</em>, defaults to 0.3) &#x2014;
Conceptually, indicates how much to transform the reference <code>image</code>. Must be between 0 and 1. <code>image</code>
will be used as a starting point, adding more noise to it the larger the <code>strength</code>. The number of
denoising steps depends on the amount of noise initially added. When <code>strength</code> is 1, added noise will
be maximum and the denoising process will run for the full number of iterations specified in
<code>num_inference_steps</code>. A value of 1, therefore, essentially ignores <code>image</code>.`,name:"strength"},{anchor:"diffusers.KandinskyImg2ImgPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 4.0) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.KandinskyImg2ImgPipeline.__call__.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.KandinskyImg2ImgPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.KandinskyImg2ImgPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pil&quot;</code>) &#x2014;
The output format of the generate image. Choose between: <code>&quot;pil&quot;</code> (<code>PIL.Image.Image</code>), <code>&quot;np&quot;</code>
(<code>np.array</code>) or <code>&quot;pt&quot;</code> (<code>torch.Tensor</code>).`,name:"output_type"},{anchor:"diffusers.KandinskyImg2ImgPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <a href="/docs/diffusers/v0.17.0/en/api/outputs#diffusers.ImagePipelineOutput">ImagePipelineOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.0/src/diffusers/pipelines/kandinsky/pipeline_kandinsky_img2img.py#L363",returnType:`
<p><a
  href="/docs/diffusers/v0.17.0/en/api/outputs#diffusers.ImagePipelineOutput"
>ImagePipelineOutput</a> or <code>tuple</code></p>
`}}),lt=new si({props:{anchor:"diffusers.KandinskyImg2ImgPipeline.__call__.example",$$slots:{default:[Rh]},$$scope:{ctx:x}}}),Tn=new B({props:{name:"enable_model_cpu_offload",anchor:"diffusers.KandinskyImg2ImgPipeline.enable_model_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.0/src/diffusers/pipelines/kandinsky/pipeline_kandinsky_img2img.py#L289"}}),Un=new B({props:{name:"enable_sequential_cpu_offload",anchor:"diffusers.KandinskyImg2ImgPipeline.enable_sequential_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.0/src/diffusers/pipelines/kandinsky/pipeline_kandinsky_img2img.py#L267"}}),jn=new q({}),Zn=new B({props:{name:"class diffusers.KandinskyInpaintPipeline",anchor:"diffusers.KandinskyInpaintPipeline",parameters:[{name:"text_encoder",val:": MultilingualCLIP"},{name:"movq",val:": VQModel"},{name:"tokenizer",val:": XLMRobertaTokenizer"},{name:"unet",val:": UNet2DConditionModel"},{name:"scheduler",val:": DDIMScheduler"}],parametersDescription:[{anchor:"diffusers.KandinskyInpaintPipeline.text_encoder",description:`<strong>text_encoder</strong> (<code>MultilingualCLIP</code>) &#x2014;
Frozen text-encoder.`,name:"text_encoder"},{anchor:"diffusers.KandinskyInpaintPipeline.tokenizer",description:`<strong>tokenizer</strong> (<code>XLMRobertaTokenizer</code>) &#x2014;
Tokenizer of class`,name:"tokenizer"},{anchor:"diffusers.KandinskyInpaintPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/v0.17.0/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>) &#x2014;
A scheduler to be used in combination with <code>unet</code> to generate image latents.`,name:"scheduler"},{anchor:"diffusers.KandinskyInpaintPipeline.unet",description:`<strong>unet</strong> (<a href="/docs/diffusers/v0.17.0/en/api/models#diffusers.UNet2DConditionModel">UNet2DConditionModel</a>) &#x2014;
Conditional U-Net architecture to denoise the image embedding.`,name:"unet"},{anchor:"diffusers.KandinskyInpaintPipeline.movq",description:`<strong>movq</strong> (<a href="/docs/diffusers/v0.17.0/en/api/models#diffusers.VQModel">VQModel</a>) &#x2014;
MoVQ image encoder and decoder`,name:"movq"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.0/src/diffusers/pipelines/kandinsky/pipeline_kandinsky_inpaint.py#L239"}}),En=new B({props:{name:"__call__",anchor:"diffusers.KandinskyInpaintPipeline.__call__",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]]"},{name:"image",val:": typing.Union[torch.FloatTensor, PIL.Image.Image]"},{name:"mask_image",val:": typing.Union[torch.FloatTensor, PIL.Image.Image, numpy.ndarray]"},{name:"image_embeds",val:": FloatTensor"},{name:"negative_image_embeds",val:": FloatTensor"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"height",val:": int = 512"},{name:"width",val:": int = 512"},{name:"num_inference_steps",val:": int = 100"},{name:"guidance_scale",val:": float = 4.0"},{name:"num_images_per_prompt",val:": int = 1"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"latents",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_type",val:": typing.Optional[str] = 'pil'"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.KandinskyInpaintPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>) &#x2014;
The prompt or prompts to guide the image generation.`,name:"prompt"},{anchor:"diffusers.KandinskyInpaintPipeline.__call__.image",description:`<strong>image</strong> (<code>torch.FloatTensor</code>, <code>PIL.Image.Image</code> or <code>np.ndarray</code>) &#x2014;
<code>Image</code>, or tensor representing an image batch, that will be used as the starting point for the
process.`,name:"image"},{anchor:"diffusers.KandinskyInpaintPipeline.__call__.mask_image",description:`<strong>mask_image</strong> (<code>PIL.Image.Image</code>,<code>torch.FloatTensor</code> or <code>np.ndarray</code>) &#x2014;
<code>Image</code>, or a tensor representing an image batch, to mask <code>image</code>. White pixels in the mask will be
repainted, while black pixels will be preserved. You can pass a pytorch tensor as mask only if the
image you passed is a pytorch tensor, and it should contain one color channel (L) instead of 3, so the
expected shape would be either <code>(B, 1, H, W,)</code>, <code>(B, H, W)</code>, <code>(1, H, W)</code> or <code>(H, W)</code> If image is an PIL
image or numpy array, mask should also be a either PIL image or numpy array. If it is a PIL image, it
will be converted to a single channel (luminance) before use. If it is a nummpy array, the expected
shape is <code>(H, W)</code>.`,name:"mask_image"},{anchor:"diffusers.KandinskyInpaintPipeline.__call__.image_embeds",description:`<strong>image_embeds</strong> (<code>torch.FloatTensor</code> or <code>List[torch.FloatTensor]</code>) &#x2014;
The clip image embeddings for text prompt, that will be used to condition the image generation.`,name:"image_embeds"},{anchor:"diffusers.KandinskyInpaintPipeline.__call__.negative_image_embeds",description:`<strong>negative_image_embeds</strong> (<code>torch.FloatTensor</code> or <code>List[torch.FloatTensor]</code>) &#x2014;
The clip image embeddings for negative text prompt, will be used to condition the image generation.`,name:"negative_image_embeds"},{anchor:"diffusers.KandinskyInpaintPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. Ignored when not using guidance (i.e., ignored
if <code>guidance_scale</code> is less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.KandinskyInpaintPipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
The height in pixels of the generated image.`,name:"height"},{anchor:"diffusers.KandinskyInpaintPipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
The width in pixels of the generated image.`,name:"width"},{anchor:"diffusers.KandinskyInpaintPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 100) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.KandinskyInpaintPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 4.0) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.KandinskyInpaintPipeline.__call__.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.KandinskyInpaintPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.KandinskyInpaintPipeline.__call__.latents",description:`<strong>latents</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated noisy latents, sampled from a Gaussian distribution, to be used as inputs for image
generation. Can be used to tweak the same generation with different prompts. If not provided, a latents
tensor will ge generated by sampling using the supplied random <code>generator</code>.`,name:"latents"},{anchor:"diffusers.KandinskyInpaintPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pil&quot;</code>) &#x2014;
The output format of the generate image. Choose between: <code>&quot;pil&quot;</code> (<code>PIL.Image.Image</code>), <code>&quot;np&quot;</code>
(<code>np.array</code>) or <code>&quot;pt&quot;</code> (<code>torch.Tensor</code>).`,name:"output_type"},{anchor:"diffusers.KandinskyInpaintPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <a href="/docs/diffusers/v0.17.0/en/api/outputs#diffusers.ImagePipelineOutput">ImagePipelineOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.0/src/diffusers/pipelines/kandinsky/pipeline_kandinsky_inpaint.py#L460",returnType:`
<p><a
  href="/docs/diffusers/v0.17.0/en/api/outputs#diffusers.ImagePipelineOutput"
>ImagePipelineOutput</a> or <code>tuple</code></p>
`}}),ct=new si({props:{anchor:"diffusers.KandinskyInpaintPipeline.__call__.example",$$slots:{default:[Nh]},$$scope:{ctx:x}}}),Wn=new B({props:{name:"enable_model_cpu_offload",anchor:"diffusers.KandinskyInpaintPipeline.enable_model_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.0/src/diffusers/pipelines/kandinsky/pipeline_kandinsky_inpaint.py#L413"}}),Pn=new B({props:{name:"enable_sequential_cpu_offload",anchor:"diffusers.KandinskyInpaintPipeline.enable_sequential_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.0/src/diffusers/pipelines/kandinsky/pipeline_kandinsky_inpaint.py#L391"}}),{c(){u=a("meta"),T=c(),v=a("h1"),M=a("a"),J=a("span"),f(h.$$.fragment),k=c(),ye=a("span"),_e=o("Kandinsky"),Pe=c(),X=a("h2"),V=a("a"),be=a("span"),f(O.$$.fragment),$e=c(),$=a("span"),ft=o("Overview"),ae=c(),R=a("p"),gt=o("Kandinsky 2.1 inherits best practices from "),K=a("a"),yt=o("DALL-E 2"),_t=o(" and "),S=a("a"),ee=o("Latent Diffusion"),Be=o(", while introducing some new ideas."),U=c(),I=a("p"),Vn=o("It uses "),se=a("a"),Rn=o("CLIP"),Nn=o(" for encoding images and text, and a diffusion image prior (mapping) between latent spaces of CLIP modalities. This approach enhances the visual performance of the model and unveils new horizons in blending images and text-guided image manipulation."),te=c(),j=a("p"),Xn=o("The Kandinsky model is created by "),bt=a("a"),tl=o("Arseniy Shakhmatov"),nl=o(", "),wt=a("a"),al=o("Anton Razzhigaev"),sl=o(", "),Mt=a("a"),il=o("Aleksandr Nikolich"),ol=o(", "),kt=a("a"),ll=o("Igor Pavlov"),rl=o(", "),vt=a("a"),pl=o("Andrey Kuznetsov"),dl=o(" and "),Jt=a("a"),cl=o("Denis Dimitrov"),ml=o(" and the original codebase can be found "),Tt=a("a"),hl=o("here"),ii=c(),we=a("h2"),Ce=a("a"),Na=a("span"),f(Ut.$$.fragment),ul=c(),Xa=a("span"),fl=o("Available Pipelines:"),oi=c(),xe=a("table"),Ka=a("thead"),It=a("tr"),Fa=a("th"),gl=o("Pipeline"),yl=c(),Ya=a("th"),_l=o("Tasks"),bl=c(),Me=a("tbody"),jt=a("tr"),Qa=a("td"),Zt=a("a"),wl=o("pipeline_kandinsky.py"),Ml=c(),qa=a("td"),Sa=a("em"),kl=o("Text-to-Image Generation"),vl=c(),Gt=a("tr"),za=a("td"),Et=a("a"),Jl=o("pipeline_kandinsky_inpaint.py"),Tl=c(),Aa=a("td"),Ha=a("em"),Ul=o("Image-Guided Image Generation"),Il=c(),Wt=a("tr"),La=a("td"),Pt=a("a"),jl=o("pipeline_kandinsky_img2img.py"),Zl=c(),Da=a("td"),Oa=a("em"),Gl=o("Image-Guided Image Generation"),li=c(),ke=a("h2"),Ve=a("a"),es=a("span"),f($t.$$.fragment),El=c(),ts=a("span"),Wl=o("Usage example"),ri=c(),Kn=a("p"),Pl=o("In the following, we will walk you through some examples of how to use the Kandinsky pipelines to create some visually aesthetic artwork."),pi=c(),ve=a("h3"),Re=a("a"),ns=a("span"),f(Bt.$$.fragment),$l=c(),as=a("span"),Bl=o("Text-to-Image Generation"),di=c(),z=a("p"),Cl=o("For text-to-image generation, we need to use both "),Fn=a("a"),xl=o("KandinskyPriorPipeline"),Vl=o(" and "),Yn=a("a"),Rl=o("KandinskyPipeline"),Nl=o(`.
The first step is to encode text prompts with CLIP and then diffuse the CLIP text embeddings to CLIP image embeddings,
as first proposed in `),Ct=a("a"),Xl=o("DALL-E 2"),Kl=o(`.
Let\u2019s throw a fun prompt at Kandinsky to see what it comes up with.`),ci=c(),f(xt.$$.fragment),mi=c(),Qn=a("p"),Fl=o(`First, let\u2019s instantiate the prior pipeline and the text-to-image pipeline. Both
pipelines are diffusion models.`),hi=c(),f(Vt.$$.fragment),ui=c(),qn=a("p"),Yl=o(`Now we pass the prompt through the prior to generate image embeddings. The prior
returns both the image embeddings corresponding to the prompt and negative/unconditional image
embeddings corresponding to an empty string.`),fi=c(),f(Rt.$$.fragment),gi=c(),f(Ne.$$.fragment),yi=c(),Xe=a("p"),Ql=o(`Next, we can pass the embeddings as well as the prompt to the text-to-image pipeline. Remember that
in case you are using a customized negative prompt, that you should pass this one also to the text-to-image pipelines
with `),ss=a("code"),ql=o("negative_prompt=negative_prompt"),Sl=o(":"),_i=c(),f(Nt.$$.fragment),bi=c(),Sn=a("p"),zl=o("One cheeseburger monster coming up! Enjoy!"),wi=c(),zn=a("p"),An=a("img"),Mi=c(),Hn=a("p"),Al=o("The Kandinsky model works extremely well with creative prompts. Here is some of the amazing art that can be created using the exact same process but with different prompts."),ki=c(),f(Xt.$$.fragment),vi=c(),Ln=a("p"),Dn=a("img"),Ji=c(),f(Kt.$$.fragment),Ti=c(),On=a("p"),ea=a("img"),Ui=c(),f(Ft.$$.fragment),Ii=c(),ta=a("p"),na=a("img"),ji=c(),f(Yt.$$.fragment),Zi=c(),aa=a("p"),sa=a("img"),Gi=c(),Je=a("h3"),Ke=a("a"),is=a("span"),f(Qt.$$.fragment),Hl=c(),os=a("span"),Ll=o("Text Guided Image-to-Image Generation"),Ei=c(),Fe=a("p"),Dl=o("The same Kandinsky model weights can be used for text-guided image-to-image translation. In this case, just make sure to load the weights using the "),ia=a("a"),Ol=o("KandinskyImg2ImgPipeline"),er=o(" pipeline."),Wi=c(),ne=a("p"),ls=a("strong"),tr=o("Note"),nr=o(`: You can also directly move the weights of the text-to-image pipelines to the image-to-image pipelines
without loading them twice by making use of the `),oa=a("a"),ar=o("components"),sr=o(" function as explained "),la=a("a"),ir=o("here"),or=o("."),Pi=c(),ra=a("p"),lr=o("Let\u2019s download an image."),$i=c(),f(qt.$$.fragment),Bi=c(),pa=a("p"),da=a("img"),Ci=c(),f(St.$$.fragment),xi=c(),ca=a("p"),ma=a("img"),Vi=c(),Te=a("h3"),Ye=a("a"),rs=a("span"),f(zt.$$.fragment),rr=c(),ps=a("span"),pr=o("Text Guided Inpainting Generation"),Ri=c(),Qe=a("p"),dr=o("You can use "),ha=a("a"),cr=o("KandinskyInpaintPipeline"),mr=o(" to edit images. In this example, we will add a hat to the portrait of a cat."),Ni=c(),f(At.$$.fragment),Xi=c(),ua=a("p"),fa=a("img"),Ki=c(),Ue=a("h3"),qe=a("a"),ds=a("span"),f(Ht.$$.fragment),hr=c(),cs=a("span"),ur=o("Interpolate"),Fi=c(),Se=a("p"),fr=o("The "),ga=a("a"),gr=o("KandinskyPriorPipeline"),yr=o(" also comes with a cool utility function that will allow you to interpolate the latent space of different images and texts super easily. Here is an example of how you can create an Impressionist-style portrait for your pet based on \u201CThe Starry Night\u201D."),Yi=c(),ie=a("p"),_r=o("Note that you can interpolate between texts and images - in the below example, we passed a text prompt \u201Ca cat\u201D and two images to the "),ms=a("code"),br=o("interplate"),wr=o(" function, along with a "),hs=a("code"),Mr=o("weights"),kr=o(" variable containing the corresponding weights for each condition we interplate."),Qi=c(),f(Lt.$$.fragment),qi=c(),ya=a("p"),_a=a("img"),Si=c(),Ie=a("h2"),ze=a("a"),us=a("span"),f(Dt.$$.fragment),vr=c(),fs=a("span"),Jr=o("Optimization"),zi=c(),N=a("p"),Tr=o("Running Kandinsky in inference requires running both a first prior pipeline: "),ba=a("a"),Ur=o("KandinskyPriorPipeline"),Ir=o(`
and a second image decoding pipeline which is one of `),wa=a("a"),jr=o("KandinskyPipeline"),Zr=o(", "),Ma=a("a"),Gr=o("KandinskyImg2ImgPipeline"),Er=o(", or "),ka=a("a"),Wr=o("KandinskyInpaintPipeline"),Pr=o("."),Ai=c(),va=a("p"),$r=o(`The bulk of the computation time will always be the second image decoding pipeline, so when looking
into optimizing the model, one should look into the second image decoding pipeline.`),Hi=c(),Ae=a("p"),Br=o("When running with PyTorch < 2.0, we strongly recommend making use of "),Ot=a("a"),gs=a("code"),Cr=o("xformers"),xr=o(`
to speed-up the optimization. This can be done by simply running:`),Li=c(),f(en.$$.fragment),Di=c(),He=a("p"),Vr=o(`When running on PyTorch >= 2.0, PyTorch\u2019s SDPA attention will automatically be used. For more information on
PyTorch\u2019s SDPA, feel free to have a look at `),tn=a("a"),Rr=o("this blog post"),Nr=o("."),Oi=c(),Ja=a("p"),Xr=o("To have explicit control , you can also manually set the pipeline to use PyTorch\u2019s 2.0 efficient attention:"),eo=c(),f(nn.$$.fragment),to=c(),oe=a("p"),Kr=o("The slowest and most memory intense attention processor is the default "),ys=a("code"),Fr=o("AttnAddedKVProcessor"),Yr=o(` processor.
We do `),_s=a("strong"),Qr=o("not"),qr=o(` recommend using it except for testing purposes or cases where very high determistic behaviour is desired.
You can set it with:`),no=c(),f(an.$$.fragment),ao=c(),le=a("p"),Sr=o("With PyTorch >= 2.0, you can also use Kandinsky with "),bs=a("code"),zr=o("torch.compile"),Ar=o(` which depending
on your hardware can signficantly speed-up your inference time once the model is compiled.
To use Kandinsksy with `),ws=a("code"),Hr=o("torch.compile"),Lr=o(", you can do:"),so=c(),f(sn.$$.fragment),io=c(),Le=a("p"),Dr=o(`After compilation you should see a very fast inference time. For more information,
feel free to have a look at `),on=a("a"),Or=o("Our PyTorch 2.0 benchmark"),ep=o("."),oo=c(),je=a("h2"),De=a("a"),Ms=a("span"),f(ln.$$.fragment),tp=c(),ks=a("span"),np=o("KandinskyPriorPipeline"),lo=c(),G=a("div"),f(rn.$$.fragment),ap=c(),vs=a("p"),sp=o("Pipeline for generating image prior for Kandinsky"),ip=c(),pn=a("p"),op=o("This model inherits from "),Ta=a("a"),lp=o("DiffusionPipeline"),rp=o(`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),pp=c(),re=a("div"),f(dn.$$.fragment),dp=c(),Js=a("p"),cp=o("Function invoked when calling the pipeline for generation."),mp=c(),f(Oe.$$.fragment),hp=c(),pe=a("div"),f(cn.$$.fragment),up=c(),Ts=a("p"),fp=o("Function invoked when using the prior pipeline for interpolation."),gp=c(),f(et.$$.fragment),yp=c(),tt=a("div"),f(mn.$$.fragment),_p=c(),hn=a("p"),bp=o(`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, the pipeline\u2019s
models have their state dicts saved to CPU and then are moved to a `),Us=a("code"),wp=o("torch.device('meta') and loaded to GPU only when their specific submodule has its "),Mp=o("forward` method called."),ro=c(),Ze=a("h2"),nt=a("a"),Is=a("span"),f(un.$$.fragment),kp=c(),js=a("span"),vp=o("KandinskyPipeline"),po=c(),E=a("div"),f(fn.$$.fragment),Jp=c(),Zs=a("p"),Tp=o("Pipeline for text-to-image generation using Kandinsky"),Up=c(),gn=a("p"),Ip=o("This model inherits from "),Ua=a("a"),jp=o("DiffusionPipeline"),Zp=o(`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),Gp=c(),de=a("div"),f(yn.$$.fragment),Ep=c(),Gs=a("p"),Wp=o("Function invoked when calling the pipeline for generation."),Pp=c(),f(at.$$.fragment),$p=c(),st=a("div"),f(_n.$$.fragment),Bp=c(),F=a("p"),Cp=o(`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),Es=a("code"),xp=o("enable_sequential_cpu_offload"),Vp=o(", this method moves one whole model at a time to the GPU when its "),Ws=a("code"),Rp=o("forward"),Np=o(`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),Ps=a("code"),Xp=o("enable_sequential_cpu_offload"),Kp=o(", but performance is much better due to the iterative execution of the "),$s=a("code"),Fp=o("unet"),Yp=o("."),Qp=c(),it=a("div"),f(bn.$$.fragment),qp=c(),wn=a("p"),Sp=o(`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, the pipeline\u2019s
models have their state dicts saved to CPU and then are moved to a `),Bs=a("code"),zp=o("torch.device('meta') and loaded to GPU only when their specific submodule has its "),Ap=o("forward` method called."),co=c(),Ge=a("h2"),ot=a("a"),Cs=a("span"),f(Mn.$$.fragment),Hp=c(),xs=a("span"),Lp=o("KandinskyImg2ImgPipeline"),mo=c(),W=a("div"),f(kn.$$.fragment),Dp=c(),Vs=a("p"),Op=o("Pipeline for image-to-image generation using Kandinsky"),ed=c(),vn=a("p"),td=o("This model inherits from "),Ia=a("a"),nd=o("DiffusionPipeline"),ad=o(`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),sd=c(),ce=a("div"),f(Jn.$$.fragment),id=c(),Rs=a("p"),od=o("Function invoked when calling the pipeline for generation."),ld=c(),f(lt.$$.fragment),rd=c(),rt=a("div"),f(Tn.$$.fragment),pd=c(),Y=a("p"),dd=o(`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),Ns=a("code"),cd=o("enable_sequential_cpu_offload"),md=o(", this method moves one whole model at a time to the GPU when its "),Xs=a("code"),hd=o("forward"),ud=o(`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),Ks=a("code"),fd=o("enable_sequential_cpu_offload"),gd=o(", but performance is much better due to the iterative execution of the "),Fs=a("code"),yd=o("unet"),_d=o("."),bd=c(),pt=a("div"),f(Un.$$.fragment),wd=c(),In=a("p"),Md=o(`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, the pipeline\u2019s
models have their state dicts saved to CPU and then are moved to a `),Ys=a("code"),kd=o("torch.device('meta') and loaded to GPU only when their specific submodule has its "),vd=o("forward` method called."),ho=c(),Ee=a("h2"),dt=a("a"),Qs=a("span"),f(jn.$$.fragment),Jd=c(),qs=a("span"),Td=o("KandinskyInpaintPipeline"),uo=c(),P=a("div"),f(Zn.$$.fragment),Ud=c(),Ss=a("p"),Id=o("Pipeline for text-guided image inpainting using Kandinsky2.1"),jd=c(),Gn=a("p"),Zd=o("This model inherits from "),ja=a("a"),Gd=o("DiffusionPipeline"),Ed=o(`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),Wd=c(),me=a("div"),f(En.$$.fragment),Pd=c(),zs=a("p"),$d=o("Function invoked when calling the pipeline for generation."),Bd=c(),f(ct.$$.fragment),Cd=c(),mt=a("div"),f(Wn.$$.fragment),xd=c(),Q=a("p"),Vd=o(`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),As=a("code"),Rd=o("enable_sequential_cpu_offload"),Nd=o(", this method moves one whole model at a time to the GPU when its "),Hs=a("code"),Xd=o("forward"),Kd=o(`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),Ls=a("code"),Fd=o("enable_sequential_cpu_offload"),Yd=o(", but performance is much better due to the iterative execution of the "),Ds=a("code"),Qd=o("unet"),qd=o("."),Sd=c(),ht=a("div"),f(Pn.$$.fragment),zd=c(),$n=a("p"),Ad=o(`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, the pipeline\u2019s
models have their state dicts saved to CPU and then are moved to a `),Os=a("code"),Hd=o("torch.device('meta') and loaded to GPU only when their specific submodule has its "),Ld=o("forward` method called."),this.h()},l(e){const r=Wh('[data-svelte="svelte-1phssyn"]',document.head);u=s(r,"META",{name:!0,content:!0}),r.forEach(n),T=m(e),v=s(e,"H1",{class:!0});var Bn=i(v);M=s(Bn,"A",{id:!0,class:!0,href:!0});var ei=i(M);J=s(ei,"SPAN",{});var ti=i(J);g(h.$$.fragment,ti),ti.forEach(n),ei.forEach(n),k=m(Bn),ye=s(Bn,"SPAN",{});var ni=i(ye);_e=l(ni,"Kandinsky"),ni.forEach(n),Bn.forEach(n),Pe=m(e),X=s(e,"H2",{class:!0});var Cn=i(X);V=s(Cn,"A",{id:!0,class:!0,href:!0});var ai=i(V);be=s(ai,"SPAN",{});var lc=i(be);g(O.$$.fragment,lc),lc.forEach(n),ai.forEach(n),$e=m(Cn),$=s(Cn,"SPAN",{});var rc=i($);ft=l(rc,"Overview"),rc.forEach(n),Cn.forEach(n),ae=m(e),R=s(e,"P",{});var Za=i(R);gt=l(Za,"Kandinsky 2.1 inherits best practices from "),K=s(Za,"A",{href:!0,rel:!0});var pc=i(K);yt=l(pc,"DALL-E 2"),pc.forEach(n),_t=l(Za," and "),S=s(Za,"A",{href:!0,rel:!0});var dc=i(S);ee=l(dc,"Latent Diffusion"),dc.forEach(n),Be=l(Za,", while introducing some new ideas."),Za.forEach(n),U=m(e),I=s(e,"P",{});var go=i(I);Vn=l(go,"It uses "),se=s(go,"A",{href:!0,rel:!0});var cc=i(se);Rn=l(cc,"CLIP"),cc.forEach(n),Nn=l(go," for encoding images and text, and a diffusion image prior (mapping) between latent spaces of CLIP modalities. This approach enhances the visual performance of the model and unveils new horizons in blending images and text-guided image manipulation."),go.forEach(n),te=m(e),j=s(e,"P",{});var C=i(j);Xn=l(C,"The Kandinsky model is created by "),bt=s(C,"A",{href:!0,rel:!0});var mc=i(bt);tl=l(mc,"Arseniy Shakhmatov"),mc.forEach(n),nl=l(C,", "),wt=s(C,"A",{href:!0,rel:!0});var hc=i(wt);al=l(hc,"Anton Razzhigaev"),hc.forEach(n),sl=l(C,", "),Mt=s(C,"A",{href:!0,rel:!0});var uc=i(Mt);il=l(uc,"Aleksandr Nikolich"),uc.forEach(n),ol=l(C,", "),kt=s(C,"A",{href:!0,rel:!0});var fc=i(kt);ll=l(fc,"Igor Pavlov"),fc.forEach(n),rl=l(C,", "),vt=s(C,"A",{href:!0,rel:!0});var gc=i(vt);pl=l(gc,"Andrey Kuznetsov"),gc.forEach(n),dl=l(C," and "),Jt=s(C,"A",{href:!0,rel:!0});var yc=i(Jt);cl=l(yc,"Denis Dimitrov"),yc.forEach(n),ml=l(C," and the original codebase can be found "),Tt=s(C,"A",{href:!0,rel:!0});var _c=i(Tt);hl=l(_c,"here"),_c.forEach(n),C.forEach(n),ii=m(e),we=s(e,"H2",{class:!0});var yo=i(we);Ce=s(yo,"A",{id:!0,class:!0,href:!0});var bc=i(Ce);Na=s(bc,"SPAN",{});var wc=i(Na);g(Ut.$$.fragment,wc),wc.forEach(n),bc.forEach(n),ul=m(yo),Xa=s(yo,"SPAN",{});var Mc=i(Xa);fl=l(Mc,"Available Pipelines:"),Mc.forEach(n),yo.forEach(n),oi=m(e),xe=s(e,"TABLE",{});var _o=i(xe);Ka=s(_o,"THEAD",{});var kc=i(Ka);It=s(kc,"TR",{});var bo=i(It);Fa=s(bo,"TH",{});var vc=i(Fa);gl=l(vc,"Pipeline"),vc.forEach(n),yl=m(bo),Ya=s(bo,"TH",{});var Jc=i(Ya);_l=l(Jc,"Tasks"),Jc.forEach(n),bo.forEach(n),kc.forEach(n),bl=m(_o),Me=s(_o,"TBODY",{});var Ga=i(Me);jt=s(Ga,"TR",{});var wo=i(jt);Qa=s(wo,"TD",{});var Tc=i(Qa);Zt=s(Tc,"A",{href:!0,rel:!0});var Uc=i(Zt);wl=l(Uc,"pipeline_kandinsky.py"),Uc.forEach(n),Tc.forEach(n),Ml=m(wo),qa=s(wo,"TD",{});var Ic=i(qa);Sa=s(Ic,"EM",{});var jc=i(Sa);kl=l(jc,"Text-to-Image Generation"),jc.forEach(n),Ic.forEach(n),wo.forEach(n),vl=m(Ga),Gt=s(Ga,"TR",{});var Mo=i(Gt);za=s(Mo,"TD",{});var Zc=i(za);Et=s(Zc,"A",{href:!0,rel:!0});var Gc=i(Et);Jl=l(Gc,"pipeline_kandinsky_inpaint.py"),Gc.forEach(n),Zc.forEach(n),Tl=m(Mo),Aa=s(Mo,"TD",{});var Ec=i(Aa);Ha=s(Ec,"EM",{});var Wc=i(Ha);Ul=l(Wc,"Image-Guided Image Generation"),Wc.forEach(n),Ec.forEach(n),Mo.forEach(n),Il=m(Ga),Wt=s(Ga,"TR",{});var ko=i(Wt);La=s(ko,"TD",{});var Pc=i(La);Pt=s(Pc,"A",{href:!0,rel:!0});var $c=i(Pt);jl=l($c,"pipeline_kandinsky_img2img.py"),$c.forEach(n),Pc.forEach(n),Zl=m(ko),Da=s(ko,"TD",{});var Bc=i(Da);Oa=s(Bc,"EM",{});var Cc=i(Oa);Gl=l(Cc,"Image-Guided Image Generation"),Cc.forEach(n),Bc.forEach(n),ko.forEach(n),Ga.forEach(n),_o.forEach(n),li=m(e),ke=s(e,"H2",{class:!0});var vo=i(ke);Ve=s(vo,"A",{id:!0,class:!0,href:!0});var xc=i(Ve);es=s(xc,"SPAN",{});var Vc=i(es);g($t.$$.fragment,Vc),Vc.forEach(n),xc.forEach(n),El=m(vo),ts=s(vo,"SPAN",{});var Rc=i(ts);Wl=l(Rc,"Usage example"),Rc.forEach(n),vo.forEach(n),ri=m(e),Kn=s(e,"P",{});var Nc=i(Kn);Pl=l(Nc,"In the following, we will walk you through some examples of how to use the Kandinsky pipelines to create some visually aesthetic artwork."),Nc.forEach(n),pi=m(e),ve=s(e,"H3",{class:!0});var Jo=i(ve);Re=s(Jo,"A",{id:!0,class:!0,href:!0});var Xc=i(Re);ns=s(Xc,"SPAN",{});var Kc=i(ns);g(Bt.$$.fragment,Kc),Kc.forEach(n),Xc.forEach(n),$l=m(Jo),as=s(Jo,"SPAN",{});var Fc=i(as);Bl=l(Fc,"Text-to-Image Generation"),Fc.forEach(n),Jo.forEach(n),di=m(e),z=s(e,"P",{});var ut=i(z);Cl=l(ut,"For text-to-image generation, we need to use both "),Fn=s(ut,"A",{href:!0});var Yc=i(Fn);xl=l(Yc,"KandinskyPriorPipeline"),Yc.forEach(n),Vl=l(ut," and "),Yn=s(ut,"A",{href:!0});var Qc=i(Yn);Rl=l(Qc,"KandinskyPipeline"),Qc.forEach(n),Nl=l(ut,`.
The first step is to encode text prompts with CLIP and then diffuse the CLIP text embeddings to CLIP image embeddings,
as first proposed in `),Ct=s(ut,"A",{href:!0,rel:!0});var qc=i(Ct);Xl=l(qc,"DALL-E 2"),qc.forEach(n),Kl=l(ut,`.
Let\u2019s throw a fun prompt at Kandinsky to see what it comes up with.`),ut.forEach(n),ci=m(e),g(xt.$$.fragment,e),mi=m(e),Qn=s(e,"P",{});var Sc=i(Qn);Fl=l(Sc,`First, let\u2019s instantiate the prior pipeline and the text-to-image pipeline. Both
pipelines are diffusion models.`),Sc.forEach(n),hi=m(e),g(Vt.$$.fragment,e),ui=m(e),qn=s(e,"P",{});var zc=i(qn);Yl=l(zc,`Now we pass the prompt through the prior to generate image embeddings. The prior
returns both the image embeddings corresponding to the prompt and negative/unconditional image
embeddings corresponding to an empty string.`),zc.forEach(n),fi=m(e),g(Rt.$$.fragment,e),gi=m(e),g(Ne.$$.fragment,e),yi=m(e),Xe=s(e,"P",{});var To=i(Xe);Ql=l(To,`Next, we can pass the embeddings as well as the prompt to the text-to-image pipeline. Remember that
in case you are using a customized negative prompt, that you should pass this one also to the text-to-image pipelines
with `),ss=s(To,"CODE",{});var Ac=i(ss);ql=l(Ac,"negative_prompt=negative_prompt"),Ac.forEach(n),Sl=l(To,":"),To.forEach(n),_i=m(e),g(Nt.$$.fragment,e),bi=m(e),Sn=s(e,"P",{});var Hc=i(Sn);zl=l(Hc,"One cheeseburger monster coming up! Enjoy!"),Hc.forEach(n),wi=m(e),zn=s(e,"P",{});var Lc=i(zn);An=s(Lc,"IMG",{src:!0,alt:!0}),Lc.forEach(n),Mi=m(e),Hn=s(e,"P",{});var Dc=i(Hn);Al=l(Dc,"The Kandinsky model works extremely well with creative prompts. Here is some of the amazing art that can be created using the exact same process but with different prompts."),Dc.forEach(n),ki=m(e),g(Xt.$$.fragment,e),vi=m(e),Ln=s(e,"P",{});var Oc=i(Ln);Dn=s(Oc,"IMG",{src:!0,alt:!0}),Oc.forEach(n),Ji=m(e),g(Kt.$$.fragment,e),Ti=m(e),On=s(e,"P",{});var em=i(On);ea=s(em,"IMG",{src:!0,alt:!0}),em.forEach(n),Ui=m(e),g(Ft.$$.fragment,e),Ii=m(e),ta=s(e,"P",{});var tm=i(ta);na=s(tm,"IMG",{src:!0,alt:!0}),tm.forEach(n),ji=m(e),g(Yt.$$.fragment,e),Zi=m(e),aa=s(e,"P",{});var nm=i(aa);sa=s(nm,"IMG",{src:!0,alt:!0}),nm.forEach(n),Gi=m(e),Je=s(e,"H3",{class:!0});var Uo=i(Je);Ke=s(Uo,"A",{id:!0,class:!0,href:!0});var am=i(Ke);is=s(am,"SPAN",{});var sm=i(is);g(Qt.$$.fragment,sm),sm.forEach(n),am.forEach(n),Hl=m(Uo),os=s(Uo,"SPAN",{});var im=i(os);Ll=l(im,"Text Guided Image-to-Image Generation"),im.forEach(n),Uo.forEach(n),Ei=m(e),Fe=s(e,"P",{});var Io=i(Fe);Dl=l(Io,"The same Kandinsky model weights can be used for text-guided image-to-image translation. In this case, just make sure to load the weights using the "),ia=s(Io,"A",{href:!0});var om=i(ia);Ol=l(om,"KandinskyImg2ImgPipeline"),om.forEach(n),er=l(Io," pipeline."),Io.forEach(n),Wi=m(e),ne=s(e,"P",{});var xn=i(ne);ls=s(xn,"STRONG",{});var lm=i(ls);tr=l(lm,"Note"),lm.forEach(n),nr=l(xn,`: You can also directly move the weights of the text-to-image pipelines to the image-to-image pipelines
without loading them twice by making use of the `),oa=s(xn,"A",{href:!0});var rm=i(oa);ar=l(rm,"components"),rm.forEach(n),sr=l(xn," function as explained "),la=s(xn,"A",{href:!0});var pm=i(la);ir=l(pm,"here"),pm.forEach(n),or=l(xn,"."),xn.forEach(n),Pi=m(e),ra=s(e,"P",{});var dm=i(ra);lr=l(dm,"Let\u2019s download an image."),dm.forEach(n),$i=m(e),g(qt.$$.fragment,e),Bi=m(e),pa=s(e,"P",{});var cm=i(pa);da=s(cm,"IMG",{src:!0,alt:!0}),cm.forEach(n),Ci=m(e),g(St.$$.fragment,e),xi=m(e),ca=s(e,"P",{});var mm=i(ca);ma=s(mm,"IMG",{src:!0,alt:!0}),mm.forEach(n),Vi=m(e),Te=s(e,"H3",{class:!0});var jo=i(Te);Ye=s(jo,"A",{id:!0,class:!0,href:!0});var hm=i(Ye);rs=s(hm,"SPAN",{});var um=i(rs);g(zt.$$.fragment,um),um.forEach(n),hm.forEach(n),rr=m(jo),ps=s(jo,"SPAN",{});var fm=i(ps);pr=l(fm,"Text Guided Inpainting Generation"),fm.forEach(n),jo.forEach(n),Ri=m(e),Qe=s(e,"P",{});var Zo=i(Qe);dr=l(Zo,"You can use "),ha=s(Zo,"A",{href:!0});var gm=i(ha);cr=l(gm,"KandinskyInpaintPipeline"),gm.forEach(n),mr=l(Zo," to edit images. In this example, we will add a hat to the portrait of a cat."),Zo.forEach(n),Ni=m(e),g(At.$$.fragment,e),Xi=m(e),ua=s(e,"P",{});var ym=i(ua);fa=s(ym,"IMG",{src:!0,alt:!0}),ym.forEach(n),Ki=m(e),Ue=s(e,"H3",{class:!0});var Go=i(Ue);qe=s(Go,"A",{id:!0,class:!0,href:!0});var _m=i(qe);ds=s(_m,"SPAN",{});var bm=i(ds);g(Ht.$$.fragment,bm),bm.forEach(n),_m.forEach(n),hr=m(Go),cs=s(Go,"SPAN",{});var wm=i(cs);ur=l(wm,"Interpolate"),wm.forEach(n),Go.forEach(n),Fi=m(e),Se=s(e,"P",{});var Eo=i(Se);fr=l(Eo,"The "),ga=s(Eo,"A",{href:!0});var Mm=i(ga);gr=l(Mm,"KandinskyPriorPipeline"),Mm.forEach(n),yr=l(Eo," also comes with a cool utility function that will allow you to interpolate the latent space of different images and texts super easily. Here is an example of how you can create an Impressionist-style portrait for your pet based on \u201CThe Starry Night\u201D."),Eo.forEach(n),Yi=m(e),ie=s(e,"P",{});var Ea=i(ie);_r=l(Ea,"Note that you can interpolate between texts and images - in the below example, we passed a text prompt \u201Ca cat\u201D and two images to the "),ms=s(Ea,"CODE",{});var km=i(ms);br=l(km,"interplate"),km.forEach(n),wr=l(Ea," function, along with a "),hs=s(Ea,"CODE",{});var vm=i(hs);Mr=l(vm,"weights"),vm.forEach(n),kr=l(Ea," variable containing the corresponding weights for each condition we interplate."),Ea.forEach(n),Qi=m(e),g(Lt.$$.fragment,e),qi=m(e),ya=s(e,"P",{});var Jm=i(ya);_a=s(Jm,"IMG",{src:!0,alt:!0}),Jm.forEach(n),Si=m(e),Ie=s(e,"H2",{class:!0});var Wo=i(Ie);ze=s(Wo,"A",{id:!0,class:!0,href:!0});var Tm=i(ze);us=s(Tm,"SPAN",{});var Um=i(us);g(Dt.$$.fragment,Um),Um.forEach(n),Tm.forEach(n),vr=m(Wo),fs=s(Wo,"SPAN",{});var Im=i(fs);Jr=l(Im,"Optimization"),Im.forEach(n),Wo.forEach(n),zi=m(e),N=s(e,"P",{});var he=i(N);Tr=l(he,"Running Kandinsky in inference requires running both a first prior pipeline: "),ba=s(he,"A",{href:!0});var jm=i(ba);Ur=l(jm,"KandinskyPriorPipeline"),jm.forEach(n),Ir=l(he,`
and a second image decoding pipeline which is one of `),wa=s(he,"A",{href:!0});var Zm=i(wa);jr=l(Zm,"KandinskyPipeline"),Zm.forEach(n),Zr=l(he,", "),Ma=s(he,"A",{href:!0});var Gm=i(Ma);Gr=l(Gm,"KandinskyImg2ImgPipeline"),Gm.forEach(n),Er=l(he,", or "),ka=s(he,"A",{href:!0});var Em=i(ka);Wr=l(Em,"KandinskyInpaintPipeline"),Em.forEach(n),Pr=l(he,"."),he.forEach(n),Ai=m(e),va=s(e,"P",{});var Wm=i(va);$r=l(Wm,`The bulk of the computation time will always be the second image decoding pipeline, so when looking
into optimizing the model, one should look into the second image decoding pipeline.`),Wm.forEach(n),Hi=m(e),Ae=s(e,"P",{});var Po=i(Ae);Br=l(Po,"When running with PyTorch < 2.0, we strongly recommend making use of "),Ot=s(Po,"A",{href:!0,rel:!0});var Pm=i(Ot);gs=s(Pm,"CODE",{});var $m=i(gs);Cr=l($m,"xformers"),$m.forEach(n),Pm.forEach(n),xr=l(Po,`
to speed-up the optimization. This can be done by simply running:`),Po.forEach(n),Li=m(e),g(en.$$.fragment,e),Di=m(e),He=s(e,"P",{});var $o=i(He);Vr=l($o,`When running on PyTorch >= 2.0, PyTorch\u2019s SDPA attention will automatically be used. For more information on
PyTorch\u2019s SDPA, feel free to have a look at `),tn=s($o,"A",{href:!0,rel:!0});var Bm=i(tn);Rr=l(Bm,"this blog post"),Bm.forEach(n),Nr=l($o,"."),$o.forEach(n),Oi=m(e),Ja=s(e,"P",{});var Cm=i(Ja);Xr=l(Cm,"To have explicit control , you can also manually set the pipeline to use PyTorch\u2019s 2.0 efficient attention:"),Cm.forEach(n),eo=m(e),g(nn.$$.fragment,e),to=m(e),oe=s(e,"P",{});var Wa=i(oe);Kr=l(Wa,"The slowest and most memory intense attention processor is the default "),ys=s(Wa,"CODE",{});var xm=i(ys);Fr=l(xm,"AttnAddedKVProcessor"),xm.forEach(n),Yr=l(Wa,` processor.
We do `),_s=s(Wa,"STRONG",{});var Vm=i(_s);Qr=l(Vm,"not"),Vm.forEach(n),qr=l(Wa,` recommend using it except for testing purposes or cases where very high determistic behaviour is desired.
You can set it with:`),Wa.forEach(n),no=m(e),g(an.$$.fragment,e),ao=m(e),le=s(e,"P",{});var Pa=i(le);Sr=l(Pa,"With PyTorch >= 2.0, you can also use Kandinsky with "),bs=s(Pa,"CODE",{});var Rm=i(bs);zr=l(Rm,"torch.compile"),Rm.forEach(n),Ar=l(Pa,` which depending
on your hardware can signficantly speed-up your inference time once the model is compiled.
To use Kandinsksy with `),ws=s(Pa,"CODE",{});var Nm=i(ws);Hr=l(Nm,"torch.compile"),Nm.forEach(n),Lr=l(Pa,", you can do:"),Pa.forEach(n),so=m(e),g(sn.$$.fragment,e),io=m(e),Le=s(e,"P",{});var Bo=i(Le);Dr=l(Bo,`After compilation you should see a very fast inference time. For more information,
feel free to have a look at `),on=s(Bo,"A",{href:!0,rel:!0});var Xm=i(on);Or=l(Xm,"Our PyTorch 2.0 benchmark"),Xm.forEach(n),ep=l(Bo,"."),Bo.forEach(n),oo=m(e),je=s(e,"H2",{class:!0});var Co=i(je);De=s(Co,"A",{id:!0,class:!0,href:!0});var Km=i(De);Ms=s(Km,"SPAN",{});var Fm=i(Ms);g(ln.$$.fragment,Fm),Fm.forEach(n),Km.forEach(n),tp=m(Co),ks=s(Co,"SPAN",{});var Ym=i(ks);np=l(Ym,"KandinskyPriorPipeline"),Ym.forEach(n),Co.forEach(n),lo=m(e),G=s(e,"DIV",{class:!0});var A=i(G);g(rn.$$.fragment,A),ap=m(A),vs=s(A,"P",{});var Qm=i(vs);sp=l(Qm,"Pipeline for generating image prior for Kandinsky"),Qm.forEach(n),ip=m(A),pn=s(A,"P",{});var xo=i(pn);op=l(xo,"This model inherits from "),Ta=s(xo,"A",{href:!0});var qm=i(Ta);lp=l(qm,"DiffusionPipeline"),qm.forEach(n),rp=l(xo,`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),xo.forEach(n),pp=m(A),re=s(A,"DIV",{class:!0});var $a=i(re);g(dn.$$.fragment,$a),dp=m($a),Js=s($a,"P",{});var Sm=i(Js);cp=l(Sm,"Function invoked when calling the pipeline for generation."),Sm.forEach(n),mp=m($a),g(Oe.$$.fragment,$a),$a.forEach(n),hp=m(A),pe=s(A,"DIV",{class:!0});var Ba=i(pe);g(cn.$$.fragment,Ba),up=m(Ba),Ts=s(Ba,"P",{});var zm=i(Ts);fp=l(zm,"Function invoked when using the prior pipeline for interpolation."),zm.forEach(n),gp=m(Ba),g(et.$$.fragment,Ba),Ba.forEach(n),yp=m(A),tt=s(A,"DIV",{class:!0});var Vo=i(tt);g(mn.$$.fragment,Vo),_p=m(Vo),hn=s(Vo,"P",{});var Ro=i(hn);bp=l(Ro,`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, the pipeline\u2019s
models have their state dicts saved to CPU and then are moved to a `),Us=s(Ro,"CODE",{});var Am=i(Us);wp=l(Am,"torch.device('meta') and loaded to GPU only when their specific submodule has its "),Am.forEach(n),Mp=l(Ro,"forward` method called."),Ro.forEach(n),Vo.forEach(n),A.forEach(n),ro=m(e),Ze=s(e,"H2",{class:!0});var No=i(Ze);nt=s(No,"A",{id:!0,class:!0,href:!0});var Hm=i(nt);Is=s(Hm,"SPAN",{});var Lm=i(Is);g(un.$$.fragment,Lm),Lm.forEach(n),Hm.forEach(n),kp=m(No),js=s(No,"SPAN",{});var Dm=i(js);vp=l(Dm,"KandinskyPipeline"),Dm.forEach(n),No.forEach(n),po=m(e),E=s(e,"DIV",{class:!0});var H=i(E);g(fn.$$.fragment,H),Jp=m(H),Zs=s(H,"P",{});var Om=i(Zs);Tp=l(Om,"Pipeline for text-to-image generation using Kandinsky"),Om.forEach(n),Up=m(H),gn=s(H,"P",{});var Xo=i(gn);Ip=l(Xo,"This model inherits from "),Ua=s(Xo,"A",{href:!0});var eh=i(Ua);jp=l(eh,"DiffusionPipeline"),eh.forEach(n),Zp=l(Xo,`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),Xo.forEach(n),Gp=m(H),de=s(H,"DIV",{class:!0});var Ca=i(de);g(yn.$$.fragment,Ca),Ep=m(Ca),Gs=s(Ca,"P",{});var th=i(Gs);Wp=l(th,"Function invoked when calling the pipeline for generation."),th.forEach(n),Pp=m(Ca),g(at.$$.fragment,Ca),Ca.forEach(n),$p=m(H),st=s(H,"DIV",{class:!0});var Ko=i(st);g(_n.$$.fragment,Ko),Bp=m(Ko),F=s(Ko,"P",{});var ue=i(F);Cp=l(ue,`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),Es=s(ue,"CODE",{});var nh=i(Es);xp=l(nh,"enable_sequential_cpu_offload"),nh.forEach(n),Vp=l(ue,", this method moves one whole model at a time to the GPU when its "),Ws=s(ue,"CODE",{});var ah=i(Ws);Rp=l(ah,"forward"),ah.forEach(n),Np=l(ue,`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),Ps=s(ue,"CODE",{});var sh=i(Ps);Xp=l(sh,"enable_sequential_cpu_offload"),sh.forEach(n),Kp=l(ue,", but performance is much better due to the iterative execution of the "),$s=s(ue,"CODE",{});var ih=i($s);Fp=l(ih,"unet"),ih.forEach(n),Yp=l(ue,"."),ue.forEach(n),Ko.forEach(n),Qp=m(H),it=s(H,"DIV",{class:!0});var Fo=i(it);g(bn.$$.fragment,Fo),qp=m(Fo),wn=s(Fo,"P",{});var Yo=i(wn);Sp=l(Yo,`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, the pipeline\u2019s
models have their state dicts saved to CPU and then are moved to a `),Bs=s(Yo,"CODE",{});var oh=i(Bs);zp=l(oh,"torch.device('meta') and loaded to GPU only when their specific submodule has its "),oh.forEach(n),Ap=l(Yo,"forward` method called."),Yo.forEach(n),Fo.forEach(n),H.forEach(n),co=m(e),Ge=s(e,"H2",{class:!0});var Qo=i(Ge);ot=s(Qo,"A",{id:!0,class:!0,href:!0});var lh=i(ot);Cs=s(lh,"SPAN",{});var rh=i(Cs);g(Mn.$$.fragment,rh),rh.forEach(n),lh.forEach(n),Hp=m(Qo),xs=s(Qo,"SPAN",{});var ph=i(xs);Lp=l(ph,"KandinskyImg2ImgPipeline"),ph.forEach(n),Qo.forEach(n),mo=m(e),W=s(e,"DIV",{class:!0});var L=i(W);g(kn.$$.fragment,L),Dp=m(L),Vs=s(L,"P",{});var dh=i(Vs);Op=l(dh,"Pipeline for image-to-image generation using Kandinsky"),dh.forEach(n),ed=m(L),vn=s(L,"P",{});var qo=i(vn);td=l(qo,"This model inherits from "),Ia=s(qo,"A",{href:!0});var ch=i(Ia);nd=l(ch,"DiffusionPipeline"),ch.forEach(n),ad=l(qo,`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),qo.forEach(n),sd=m(L),ce=s(L,"DIV",{class:!0});var xa=i(ce);g(Jn.$$.fragment,xa),id=m(xa),Rs=s(xa,"P",{});var mh=i(Rs);od=l(mh,"Function invoked when calling the pipeline for generation."),mh.forEach(n),ld=m(xa),g(lt.$$.fragment,xa),xa.forEach(n),rd=m(L),rt=s(L,"DIV",{class:!0});var So=i(rt);g(Tn.$$.fragment,So),pd=m(So),Y=s(So,"P",{});var fe=i(Y);dd=l(fe,`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),Ns=s(fe,"CODE",{});var hh=i(Ns);cd=l(hh,"enable_sequential_cpu_offload"),hh.forEach(n),md=l(fe,", this method moves one whole model at a time to the GPU when its "),Xs=s(fe,"CODE",{});var uh=i(Xs);hd=l(uh,"forward"),uh.forEach(n),ud=l(fe,`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),Ks=s(fe,"CODE",{});var fh=i(Ks);fd=l(fh,"enable_sequential_cpu_offload"),fh.forEach(n),gd=l(fe,", but performance is much better due to the iterative execution of the "),Fs=s(fe,"CODE",{});var gh=i(Fs);yd=l(gh,"unet"),gh.forEach(n),_d=l(fe,"."),fe.forEach(n),So.forEach(n),bd=m(L),pt=s(L,"DIV",{class:!0});var zo=i(pt);g(Un.$$.fragment,zo),wd=m(zo),In=s(zo,"P",{});var Ao=i(In);Md=l(Ao,`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, the pipeline\u2019s
models have their state dicts saved to CPU and then are moved to a `),Ys=s(Ao,"CODE",{});var yh=i(Ys);kd=l(yh,"torch.device('meta') and loaded to GPU only when their specific submodule has its "),yh.forEach(n),vd=l(Ao,"forward` method called."),Ao.forEach(n),zo.forEach(n),L.forEach(n),ho=m(e),Ee=s(e,"H2",{class:!0});var Ho=i(Ee);dt=s(Ho,"A",{id:!0,class:!0,href:!0});var _h=i(dt);Qs=s(_h,"SPAN",{});var bh=i(Qs);g(jn.$$.fragment,bh),bh.forEach(n),_h.forEach(n),Jd=m(Ho),qs=s(Ho,"SPAN",{});var wh=i(qs);Td=l(wh,"KandinskyInpaintPipeline"),wh.forEach(n),Ho.forEach(n),uo=m(e),P=s(e,"DIV",{class:!0});var D=i(P);g(Zn.$$.fragment,D),Ud=m(D),Ss=s(D,"P",{});var Mh=i(Ss);Id=l(Mh,"Pipeline for text-guided image inpainting using Kandinsky2.1"),Mh.forEach(n),jd=m(D),Gn=s(D,"P",{});var Lo=i(Gn);Zd=l(Lo,"This model inherits from "),ja=s(Lo,"A",{href:!0});var kh=i(ja);Gd=l(kh,"DiffusionPipeline"),kh.forEach(n),Ed=l(Lo,`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),Lo.forEach(n),Wd=m(D),me=s(D,"DIV",{class:!0});var Va=i(me);g(En.$$.fragment,Va),Pd=m(Va),zs=s(Va,"P",{});var vh=i(zs);$d=l(vh,"Function invoked when calling the pipeline for generation."),vh.forEach(n),Bd=m(Va),g(ct.$$.fragment,Va),Va.forEach(n),Cd=m(D),mt=s(D,"DIV",{class:!0});var Do=i(mt);g(Wn.$$.fragment,Do),xd=m(Do),Q=s(Do,"P",{});var ge=i(Q);Vd=l(ge,`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),As=s(ge,"CODE",{});var Jh=i(As);Rd=l(Jh,"enable_sequential_cpu_offload"),Jh.forEach(n),Nd=l(ge,", this method moves one whole model at a time to the GPU when its "),Hs=s(ge,"CODE",{});var Th=i(Hs);Xd=l(Th,"forward"),Th.forEach(n),Kd=l(ge,`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),Ls=s(ge,"CODE",{});var Uh=i(Ls);Fd=l(Uh,"enable_sequential_cpu_offload"),Uh.forEach(n),Yd=l(ge,", but performance is much better due to the iterative execution of the "),Ds=s(ge,"CODE",{});var Ih=i(Ds);Qd=l(Ih,"unet"),Ih.forEach(n),qd=l(ge,"."),ge.forEach(n),Do.forEach(n),Sd=m(D),ht=s(D,"DIV",{class:!0});var Oo=i(ht);g(Pn.$$.fragment,Oo),zd=m(Oo),$n=s(Oo,"P",{});var el=i($n);Ad=l(el,`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, the pipeline\u2019s
models have their state dicts saved to CPU and then are moved to a `),Os=s(el,"CODE",{});var jh=i(Os);Hd=l(jh,"torch.device('meta') and loaded to GPU only when their specific submodule has its "),jh.forEach(n),Ld=l(el,"forward` method called."),el.forEach(n),Oo.forEach(n),D.forEach(n),this.h()},h(){p(u,"name","hf:doc:metadata"),p(u,"content",JSON.stringify(Kh)),p(M,"id","kandinsky"),p(M,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(M,"href","#kandinsky"),p(v,"class","relative group"),p(V,"id","overview"),p(V,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(V,"href","#overview"),p(X,"class","relative group"),p(K,"href","https://arxiv.org/abs/2204.06125"),p(K,"rel","nofollow"),p(S,"href","https://huggingface.co/docs/diffusers/api/pipelines/latent_diffusion"),p(S,"rel","nofollow"),p(se,"href","https://huggingface.co/docs/transformers/model_doc/clip"),p(se,"rel","nofollow"),p(bt,"href","https://github.com/cene555"),p(bt,"rel","nofollow"),p(wt,"href","https://github.com/razzant"),p(wt,"rel","nofollow"),p(Mt,"href","https://github.com/AlexWortega"),p(Mt,"rel","nofollow"),p(kt,"href","https://github.com/boomb0om"),p(kt,"rel","nofollow"),p(vt,"href","https://github.com/kuznetsoffandrey"),p(vt,"rel","nofollow"),p(Jt,"href","https://github.com/denndimitrov"),p(Jt,"rel","nofollow"),p(Tt,"href","https://github.com/ai-forever/Kandinsky-2"),p(Tt,"rel","nofollow"),p(Ce,"id","available-pipelines"),p(Ce,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(Ce,"href","#available-pipelines"),p(we,"class","relative group"),p(Zt,"href","https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/kandinsky/pipeline_kandinsky.py"),p(Zt,"rel","nofollow"),p(Et,"href","https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/kandinsky/pipeline_kandinsky_inpaint.py"),p(Et,"rel","nofollow"),p(Pt,"href","https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/kandinsky/pipeline_kandinsky_img2img.py"),p(Pt,"rel","nofollow"),p(Ve,"id","usage-example"),p(Ve,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(Ve,"href","#usage-example"),p(ke,"class","relative group"),p(Re,"id","texttoimage-generation"),p(Re,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(Re,"href","#texttoimage-generation"),p(ve,"class","relative group"),p(Fn,"href","/docs/diffusers/v0.17.0/en/api/pipelines/kandinsky#diffusers.KandinskyPriorPipeline"),p(Yn,"href","/docs/diffusers/v0.17.0/en/api/pipelines/kandinsky#diffusers.KandinskyPipeline"),p(Ct,"href","https://cdn.openai.com/papers/dall-e-2.pdf"),p(Ct,"rel","nofollow"),We(An.src,Dd="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/kandinsky-docs/cheeseburger.png")||p(An,"src",Dd),p(An,"alt","img"),We(Dn.src,Od="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/kandinsky-docs/hair.png")||p(Dn,"src",Od),p(Dn,"alt","img"),We(ea.src,ec="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/kandinsky-docs/dusts.png")||p(ea,"src",ec),p(ea,"alt","img"),We(na.src,tc="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/kandinsky-docs/smokechair.png")||p(na,"src",tc),p(na,"alt","img"),We(sa.src,nc="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/kandinsky-docs/alienplanet.png")||p(sa,"src",nc),p(sa,"alt","img"),p(Ke,"id","text-guided-imagetoimage-generation"),p(Ke,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(Ke,"href","#text-guided-imagetoimage-generation"),p(Je,"class","relative group"),p(ia,"href","/docs/diffusers/v0.17.0/en/api/pipelines/kandinsky#diffusers.KandinskyImg2ImgPipeline"),p(oa,"href","/docs/diffusers/v0.17.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.components"),p(la,"href","#converting-between-different-pipelines"),We(da.src,ac="https://raw.githubusercontent.com/CompVis/stable-diffusion/main/assets/stable-samples/img2img/sketch-mountains-input.jpg")||p(da,"src",ac),p(da,"alt","img"),We(ma.src,sc="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/kandinsky-docs/img2img_fantasyland.png")||p(ma,"src",sc),p(ma,"alt","img"),p(Ye,"id","text-guided-inpainting-generation"),p(Ye,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(Ye,"href","#text-guided-inpainting-generation"),p(Te,"class","relative group"),p(ha,"href","/docs/diffusers/v0.17.0/en/api/pipelines/kandinsky#diffusers.KandinskyInpaintPipeline"),We(fa.src,ic="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/kandinsky-docs/inpaint_cat_hat.png")||p(fa,"src",ic),p(fa,"alt","img"),p(qe,"id","interpolate"),p(qe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(qe,"href","#interpolate"),p(Ue,"class","relative group"),p(ga,"href","/docs/diffusers/v0.17.0/en/api/pipelines/kandinsky#diffusers.KandinskyPriorPipeline"),We(_a.src,oc="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/kandinsky-docs/starry_cat.png")||p(_a,"src",oc),p(_a,"alt","img"),p(ze,"id","optimization"),p(ze,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(ze,"href","#optimization"),p(Ie,"class","relative group"),p(ba,"href","/docs/diffusers/v0.17.0/en/api/pipelines/kandinsky#diffusers.KandinskyPriorPipeline"),p(wa,"href","/docs/diffusers/v0.17.0/en/api/pipelines/kandinsky#diffusers.KandinskyPipeline"),p(Ma,"href","/docs/diffusers/v0.17.0/en/api/pipelines/kandinsky#diffusers.KandinskyImg2ImgPipeline"),p(ka,"href","/docs/diffusers/v0.17.0/en/api/pipelines/kandinsky#diffusers.KandinskyInpaintPipeline"),p(Ot,"href","https://github.com/facebookresearch/xformers"),p(Ot,"rel","nofollow"),p(tn,"href","https://pytorch.org/blog/accelerated-diffusers-pt-20/"),p(tn,"rel","nofollow"),p(on,"href","https://huggingface.co/docs/diffusers/main/en/optimization/torch2.0"),p(on,"rel","nofollow"),p(De,"id","diffusers.KandinskyPriorPipeline"),p(De,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(De,"href","#diffusers.KandinskyPriorPipeline"),p(je,"class","relative group"),p(Ta,"href","/docs/diffusers/v0.17.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),p(re,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(pe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(tt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(nt,"id","diffusers.KandinskyPipeline"),p(nt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(nt,"href","#diffusers.KandinskyPipeline"),p(Ze,"class","relative group"),p(Ua,"href","/docs/diffusers/v0.17.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),p(de,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(st,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(it,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(ot,"id","diffusers.KandinskyImg2ImgPipeline"),p(ot,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(ot,"href","#diffusers.KandinskyImg2ImgPipeline"),p(Ge,"class","relative group"),p(Ia,"href","/docs/diffusers/v0.17.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),p(ce,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(rt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(pt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(W,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(dt,"id","diffusers.KandinskyInpaintPipeline"),p(dt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(dt,"href","#diffusers.KandinskyInpaintPipeline"),p(Ee,"class","relative group"),p(ja,"href","/docs/diffusers/v0.17.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),p(me,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(mt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(ht,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),p(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,r){t(document.head,u),d(e,T,r),d(e,v,r),t(v,M),t(M,J),y(h,J,null),t(v,k),t(v,ye),t(ye,_e),d(e,Pe,r),d(e,X,r),t(X,V),t(V,be),y(O,be,null),t(X,$e),t(X,$),t($,ft),d(e,ae,r),d(e,R,r),t(R,gt),t(R,K),t(K,yt),t(R,_t),t(R,S),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t(hs,Mr),t(ie,kr),d(e,Qi,r),y(Lt,e,r),d(e,qi,r),d(e,ya,r),t(ya,_a),d(e,Si,r),d(e,Ie,r),t(Ie,ze),t(ze,us),y(Dt,us,null),t(Ie,vr),t(Ie,fs),t(fs,Jr),d(e,zi,r),d(e,N,r),t(N,Tr),t(N,ba),t(ba,Ur),t(N,Ir),t(N,wa),t(wa,jr),t(N,Zr),t(N,Ma),t(Ma,Gr),t(N,Er),t(N,ka),t(ka,Wr),t(N,Pr),d(e,Ai,r),d(e,va,r),t(va,$r),d(e,Hi,r),d(e,Ae,r),t(Ae,Br),t(Ae,Ot),t(Ot,gs),t(gs,Cr),t(Ae,xr),d(e,Li,r),y(en,e,r),d(e,Di,r),d(e,He,r),t(He,Vr),t(He,tn),t(tn,Rr),t(He,Nr),d(e,Oi,r),d(e,Ja,r),t(Ja,Xr),d(e,eo,r),y(nn,e,r),d(e,to,r),d(e,oe,r),t(oe,Kr),t(oe,ys),t(ys,Fr),t(oe,Yr),t(oe,_s),t(_s,Qr),t(oe,qr),d(e,no,r),y(an,e,r),d(e,ao,r),d(e,le,r),t(le,Sr),t(le,bs),t(bs,zr),t(le,Ar),t(le,ws),t(ws,Hr),t(le,Lr),d(e,so,r),y(sn,e,r),d(e,io,r),d(e,Le,r),t(Le,Dr),t(Le,on),t(on,Or),t(Le,ep),d(e,oo,r),d(e,je,r),t(je,De),t(De,Ms),y(ln,Ms,null),t(je,tp),t(je,ks),t(ks,np),d(e,lo,r),d(e,G,r),y(rn,G,null),t(G,ap),t(G,vs),t(vs,sp),t(G,ip),t(G,pn),t(pn,op),t(pn,Ta),t(Ta,lp),t(pn,rp),t(G,pp),t(G,re),y(dn,re,null),t(re,dp),t(re,Js),t(Js,cp),t(re,mp),y(Oe,re,null),t(G,hp),t(G,pe),y(cn,pe,null),t(pe,up),t(pe,Ts),t(Ts,fp),t(pe,gp),y(et,pe,null),t(G,yp),t(G,tt),y(mn,tt,null),t(tt,_p),t(tt,hn),t(hn,bp),t(hn,Us),t(Us,wp),t(hn,Mp),d(e,ro,r),d(e,Ze,r),t(Ze,nt),t(nt,Is),y(un,Is,null),t(Ze,kp),t(Ze,js),t(js,vp),d(e,po,r),d(e,E,r),y(fn,E,null),t(E,Jp),t(E,Zs),t(Zs,Tp),t(E,Up),t(E,gn),t(gn,Ip),t(gn,Ua),t(Ua,jp),t(gn,Zp),t(E,Gp),t(E,de),y(yn,de,null),t(de,Ep),t(de,Gs),t(Gs,Wp),t(de,Pp),y(at,de,null),t(E,$p),t(E,st),y(_n,st,null),t(st,Bp),t(st,F),t(F,Cp),t(F,Es),t(Es,xp),t(F,Vp),t(F,Ws),t(Ws,Rp),t(F,Np),t(F,Ps),t(Ps,Xp),t(F,Kp),t(F,$s),t($s,Fp),t(F,Yp),t(E,Qp),t(E,it),y(bn,it,null),t(it,qp),t(it,wn),t(wn,Sp),t(wn,Bs),t(Bs,zp),t(wn,Ap),d(e,co,r),d(e,Ge,r),t(Ge,ot),t(ot,Cs),y(Mn,Cs,null),t(Ge,Hp),t(Ge,xs),t(xs,Lp),d(e,mo,r),d(e,W,r),y(kn,W,null),t(W,Dp),t(W,Vs),t(Vs,Op),t(W,ed),t(W,vn),t(vn,td),t(vn,Ia),t(Ia,nd),t(vn,ad),t(W,sd),t(W,ce),y(Jn,ce,null),t(ce,id),t(ce,Rs),t(Rs,od),t(ce,ld),y(lt,ce,null),t(W,rd),t(W,rt),y(Tn,rt,null),t(rt,pd),t(rt,Y),t(Y,dd),t(Y,Ns),t(Ns,cd),t(Y,md),t(Y,Xs),t(Xs,hd),t(Y,ud),t(Y,Ks),t(Ks,fd),t(Y,gd),t(Y,Fs),t(Fs,yd),t(Y,_d),t(W,bd),t(W,pt),y(Un,pt,null),t(pt,wd),t(pt,In),t(In,Md),t(In,Ys),t(Ys,kd),t(In,vd),d(e,ho,r),d(e,Ee,r),t(Ee,dt),t(dt,Qs),y(jn,Qs,null),t(Ee,Jd),t(Ee,qs),t(qs,Td),d(e,uo,r),d(e,P,r),y(Zn,P,null),t(P,Ud),t(P,Ss),t(Ss,Id),t(P,jd),t(P,Gn),t(Gn,Zd),t(Gn,ja),t(ja,Gd),t(Gn,Ed),t(P,Wd),t(P,me),y(En,me,null),t(me,Pd),t(me,zs),t(zs,$d),t(me,Bd),y(ct,me,null),t(P,Cd),t(P,mt),y(Wn,mt,null),t(mt,xd),t(mt,Q),t(Q,Vd),t(Q,As),t(As,Rd),t(Q,Nd),t(Q,Hs),t(Hs,Xd),t(Q,Kd),t(Q,Ls),t(Ls,Fd),t(Q,Yd),t(Q,Ds),t(Ds,Qd),t(Q,qd),t(P,Sd),t(P,ht),y(Pn,ht,null),t(ht,zd),t(ht,$n),t($n,Ad),t($n,Os),t(Os,Hd),t($n,Ld),fo=!0},p(e,[r]){const Bn={};r&2&&(Bn.$$scope={dirty:r,ctx:e}),Ne.$set(Bn);const ei={};r&2&&(ei.$$scope={dirty:r,ctx:e}),Oe.$set(ei);const ti={};r&2&&(ti.$$scope={dirty:r,ctx:e}),et.$set(ti);const ni={};r&2&&(ni.$$scope={dirty:r,ctx:e}),at.$set(ni);const Cn={};r&2&&(Cn.$$scope={dirty:r,ctx:e}),lt.$set(Cn);const ai={};r&2&&(ai.$$scope={dirty:r,ctx:e}),ct.$set(ai)},i(e){fo||(_(h.$$.fragment,e),_(O.$$.fragment,e),_(Ut.$$.fragment,e),_($t.$$.fragment,e),_(Bt.$$.fragment,e),_(xt.$$.fragment,e),_(Vt.$$.fragment,e),_(Rt.$$.fragment,e),_(Ne.$$.fragment,e),_(Nt.$$.fragment,e),_(Xt.$$.fragment,e),_(Kt.$$.fragment,e),_(Ft.$$.fragment,e),_(Yt.$$.fragment,e),_(Qt.$$.fragment,e),_(qt.$$.fragment,e),_(St.$$.fragment,e),_(zt.$$.fragment,e),_(At.$$.fragment,e),_(Ht.$$.fragment,e),_(Lt.$$.fragment,e),_(Dt.$$.fragment,e),_(en.$$.fragment,e),_(nn.$$.fragment,e),_(an.$$.fragment,e),_(sn.$$.fragment,e),_(ln.$$.fragment,e),_(rn.$$.fragment,e),_(dn.$$.fragment,e),_(Oe.$$.fragment,e),_(cn.$$.fragment,e),_(et.$$.fragment,e),_(mn.$$.fragment,e),_(un.$$.fragment,e),_(fn.$$.fragment,e),_(yn.$$.fragment,e),_(at.$$.fragment,e),_(_n.$$.fragment,e),_(bn.$$.fragment,e),_(Mn.$$.fragment,e),_(kn.$$.fragment,e),_(Jn.$$.fragment,e),_(lt.$$.fragment,e),_(Tn.$$.fragment,e),_(Un.$$.fragment,e),_(jn.$$.fragment,e),_(Zn.$$.fragment,e),_(En.$$.fragment,e),_(ct.$$.fragment,e),_(Wn.$$.fragment,e),_(Pn.$$.fragment,e),fo=!0)},o(e){b(h.$$.fragment,e),b(O.$$.fragment,e),b(Ut.$$.fragment,e),b($t.$$.fragment,e),b(Bt.$$.fragment,e),b(xt.$$.fragment,e),b(Vt.$$.fragment,e),b(Rt.$$.fragment,e),b(Ne.$$.fragment,e),b(Nt.$$.fragment,e),b(Xt.$$.fragment,e),b(Kt.$$.fragment,e),b(Ft.$$.fragment,e),b(Yt.$$.fragment,e),b(Qt.$$.fragment,e),b(qt.$$.fragment,e),b(St.$$.fragment,e),b(zt.$$.fragment,e),b(At.$$.fragment,e),b(Ht.$$.fragment,e),b(Lt.$$.fragment,e),b(Dt.$$.fragment,e),b(en.$$.fragment,e),b(nn.$$.fragment,e),b(an.$$.fragment,e),b(sn.$$.fragment,e),b(ln.$$.fragment,e),b(rn.$$.fragment,e),b(dn.$$.fragment,e),b(Oe.$$.fragment,e),b(cn.$$.fragment,e),b(et.$$.fragment,e),b(mn.$$.fragment,e),b(un.$$.fragment,e),b(fn.$$.fragment,e),b(yn.$$.fragment,e),b(at.$$.fragment,e),b(_n.$$.fragment,e),b(bn.$$.fragment,e),b(Mn.$$.fragment,e),b(kn.$$.fragment,e),b(Jn.$$.fragment,e),b(lt.$$.fragment,e),b(Tn.$$.fragment,e),b(Un.$$.fragment,e),b(jn.$$.fragment,e),b(Zn.$$.fragment,e),b(En.$$.fragment,e),b(ct.$$.fragment,e),b(Wn.$$.fragment,e),b(Pn.$$.fragment,e),fo=!1},d(e){n(u),e&&n(T),e&&n(v),w(h),e&&n(Pe),e&&n(X),w(O),e&&n(ae),e&&n(R),e&&n(U),e&&n(I),e&&n(te),e&&n(j),e&&n(ii),e&&n(we),w(Ut),e&&n(oi),e&&n(xe),e&&n(li),e&&n(ke),w($t),e&&n(ri),e&&n(Kn),e&&n(pi),e&&n(ve),w(Bt),e&&n(di),e&&n(z),e&&n(ci),w(xt,e),e&&n(mi),e&&n(Qn),e&&n(hi),w(Vt,e),e&&n(ui),e&&n(qn),e&&n(fi),w(Rt,e),e&&n(gi),w(Ne,e),e&&n(yi),e&&n(Xe),e&&n(_i),w(Nt,e),e&&n(bi),e&&n(Sn),e&&n(wi),e&&n(zn),e&&n(Mi),e&&n(Hn),e&&n(ki),w(Xt,e),e&&n(vi),e&&n(Ln),e&&n(Ji),w(Kt,e),e&&n(Ti),e&&n(On),e&&n(Ui),w(Ft,e),e&&n(Ii),e&&n(ta),e&&n(ji),w(Yt,e),e&&n(Zi),e&&n(aa),e&&n(Gi),e&&n(Je),w(Qt),e&&n(Ei),e&&n(Fe),e&&n(Wi),e&&n(ne),e&&n(Pi),e&&n(ra),e&&n($i),w(qt,e),e&&n(Bi),e&&n(pa),e&&n(Ci),w(St,e),e&&n(xi),e&&n(ca),e&&n(Vi),e&&n(Te),w(zt),e&&n(Ri),e&&n(Qe),e&&n(Ni),w(At,e),e&&n(Xi),e&&n(ua),e&&n(Ki),e&&n(Ue),w(Ht),e&&n(Fi),e&&n(Se),e&&n(Yi),e&&n(ie),e&&n(Qi),w(Lt,e),e&&n(qi),e&&n(ya),e&&n(Si),e&&n(Ie),w(Dt),e&&n(zi),e&&n(N),e&&n(Ai),e&&n(va),e&&n(Hi),e&&n(Ae),e&&n(Li),w(en,e),e&&n(Di),e&&n(He),e&&n(Oi),e&&n(Ja),e&&n(eo),w(nn,e),e&&n(to),e&&n(oe),e&&n(no),w(an,e),e&&n(ao),e&&n(le),e&&n(so),w(sn,e),e&&n(io),e&&n(Le),e&&n(oo),e&&n(je),w(ln),e&&n(lo),e&&n(G),w(rn),w(dn),w(Oe),w(cn),w(et),w(mn),e&&n(ro),e&&n(Ze),w(un),e&&n(po),e&&n(E),w(fn),w(yn),w(at),w(_n),w(bn),e&&n(co),e&&n(Ge),w(Mn),e&&n(mo),e&&n(W),w(kn),w(Jn),w(lt),w(Tn),w(Un),e&&n(ho),e&&n(Ee),w(jn),e&&n(uo),e&&n(P),w(Zn),w(En),w(ct),w(Wn),w(Pn)}}}const Kh={local:"kandinsky",sections:[{local:"overview",title:"Overview"},{local:"available-pipelines",title:"Available Pipelines:"},{local:"usage-example",sections:[{local:"texttoimage-generation",title:"Text-to-Image Generation"},{local:"text-guided-imagetoimage-generation",title:"Text Guided Image-to-Image Generation"},{local:"text-guided-inpainting-generation",title:"Text Guided Inpainting Generation"},{local:"interpolate",title:"Interpolate "}],title:"Usage example"},{local:"optimization",title:"Optimization"},{local:"diffusers.KandinskyPriorPipeline",title:"KandinskyPriorPipeline"},{local:"diffusers.KandinskyPipeline",title:"KandinskyPipeline"},{local:"diffusers.KandinskyImg2ImgPipeline",title:"KandinskyImg2ImgPipeline"},{local:"diffusers.KandinskyInpaintPipeline",title:"KandinskyInpaintPipeline"}],title:"Kandinsky"};function Fh(x){return Ph(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Hh extends Zh{constructor(u){super();Gh(this,u,Fh,Xh,Eh,{})}}export{Hh as default,Kh as metadata};
