import{s as nn,o as an,n as $}from"../chunks/scheduler.53228c21.js";import{S as pn,i as mn,e as w,s as o,c as y,h as rn,a as Z,d as i,b as c,f as Ot,g as u,j as U,k as I,l as el,m as p,n as M,t as f,o as h,p as b}from"../chunks/index.100fac89.js";import{C as on}from"../chunks/CopyLLMTxtMenu.2cdbb51f.js";import{C as T}from"../chunks/CodeBlock.d30a6509.js";import{D as cn}from"../chunks/DocNotebookDropdown.74a16910.js";import{H as v,E as dn}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.3fcbbc76.js";import{H as B,a as j}from"../chunks/HfOption.fad27e59.js";function yn(g){let t,m,s,d='Now pass all the prompts and embeddings to the <a href="/docs/diffusers/main/en/api/pipelines/kandinsky#diffusers.KandinskyPipeline">KandinskyPipeline</a> to generate an image:',l,n,r,J,G='<img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/kandinsky-docs/cheeseburger.png"/>',W;return t=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEthbmRpbnNreVByaW9yUGlwZWxpbmUlMkMlMjBLYW5kaW5za3lQaXBlbGluZSUwQWltcG9ydCUyMHRvcmNoJTBBJTBBcHJpb3JfcGlwZWxpbmUlMjAlM0QlMjBLYW5kaW5za3lQcmlvclBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTItMS1wcmlvciUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNikudG8oJTIyY3VkYSUyMiklMEFwaXBlbGluZSUyMCUzRCUyMEthbmRpbnNreVBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTItMSUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNikudG8oJTIyY3VkYSUyMiklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJBJTIwYWxpZW4lMjBjaGVlc2VidXJnZXIlMjBjcmVhdHVyZSUyMGVhdGluZyUyMGl0c2VsZiUyQyUyMGNsYXltYXRpb24lMkMlMjBjaW5lbWF0aWMlMkMlMjBtb29keSUyMGxpZ2h0aW5nJTIyJTBBbmVnYXRpdmVfcHJvbXB0JTIwJTNEJTIwJTIybG93JTIwcXVhbGl0eSUyQyUyMGJhZCUyMHF1YWxpdHklMjIlMjAlMjMlMjBvcHRpb25hbCUyMHRvJTIwaW5jbHVkZSUyMGElMjBuZWdhdGl2ZSUyMHByb21wdCUyQyUyMGJ1dCUyMHJlc3VsdHMlMjBhcmUlMjB1c3VhbGx5JTIwYmV0dGVyJTBBaW1hZ2VfZW1iZWRzJTJDJTIwbmVnYXRpdmVfaW1hZ2VfZW1iZWRzJTIwJTNEJTIwcHJpb3JfcGlwZWxpbmUocHJvbXB0JTJDJTIwbmVnYXRpdmVfcHJvbXB0JTJDJTIwZ3VpZGFuY2Vfc2NhbGUlM0QxLjApLnRvX3R1cGxlKCk=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> KandinskyPriorPipeline, KandinskyPipeline
<span class="hljs-keyword">import</span> torch

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

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> <span class="hljs-comment"># optional to include a negative prompt, but results are usually better</span>
image_embeds, negative_image_embeds = prior_pipeline(prompt, negative_prompt, guidance_scale=<span class="hljs-number">1.0</span>).to_tuple()`,wrap:!1}}),n=new T({props:{code:"aW1hZ2UlMjAlM0QlMjBwaXBlbGluZShwcm9tcHQlMkMlMjBpbWFnZV9lbWJlZHMlM0RpbWFnZV9lbWJlZHMlMkMlMjBuZWdhdGl2ZV9wcm9tcHQlM0RuZWdhdGl2ZV9wcm9tcHQlMkMlMjBuZWdhdGl2ZV9pbWFnZV9lbWJlZHMlM0RuZWdhdGl2ZV9pbWFnZV9lbWJlZHMlMkMlMjBoZWlnaHQlM0Q3NjglMkMlMjB3aWR0aCUzRDc2OCkuaW1hZ2VzJTVCMCU1RCUwQWltYWdl",highlighted:`image = pipeline(prompt, image_embeds=image_embeds, negative_prompt=negative_prompt, negative_image_embeds=negative_image_embeds, height=<span class="hljs-number">768</span>, width=<span class="hljs-number">768</span>).images[<span class="hljs-number">0</span>]
image`,wrap:!1}}),{c(){y(t.$$.fragment),m=o(),s=w("p"),s.innerHTML=d,l=o(),y(n.$$.fragment),r=o(),J=w("div"),J.innerHTML=G,this.h()},l(k){u(t.$$.fragment,k),m=c(k),s=Z(k,"P",{"data-svelte-h":!0}),U(s)!=="svelte-fnb5ou"&&(s.innerHTML=d),l=c(k),u(n.$$.fragment,k),r=c(k),J=Z(k,"DIV",{class:!0,"data-svelte-h":!0}),U(J)!=="svelte-i75i2v"&&(J.innerHTML=G),this.h()},h(){I(J,"class","flex justify-center")},m(k,V){M(t,k,V),p(k,m,V),p(k,s,V),p(k,l,V),M(n,k,V),p(k,r,V),p(k,J,V),W=!0},p:$,i(k){W||(f(t.$$.fragment,k),f(n.$$.fragment,k),W=!0)},o(k){h(t.$$.fragment,k),h(n.$$.fragment,k),W=!1},d(k){k&&(i(m),i(s),i(l),i(r),i(J)),b(t,k),b(n,k)}}}function un(g){let t,m,s,d='Pass the <code>image_embeds</code> and <code>negative_image_embeds</code> to the <a href="/docs/diffusers/main/en/api/pipelines/kandinsky_v22#diffusers.KandinskyV22Pipeline">KandinskyV22Pipeline</a> to generate an image:',l,n,r,J,G='<img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/kandinsky-text-to-image.png"/>',W;return t=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEthbmRpbnNreVYyMlByaW9yUGlwZWxpbmUlMkMlMjBLYW5kaW5za3lWMjJQaXBlbGluZSUwQWltcG9ydCUyMHRvcmNoJTBBJTBBcHJpb3JfcGlwZWxpbmUlMjAlM0QlMjBLYW5kaW5za3lWMjJQcmlvclBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTItMi1wcmlvciUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNikudG8oJTIyY3VkYSUyMiklMEFwaXBlbGluZSUyMCUzRCUyMEthbmRpbnNreVYyMlBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTItMi1kZWNvZGVyJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2KS50byglMjJjdWRhJTIyKSUwQSUwQXByb21wdCUyMCUzRCUyMCUyMkElMjBhbGllbiUyMGNoZWVzZWJ1cmdlciUyMGNyZWF0dXJlJTIwZWF0aW5nJTIwaXRzZWxmJTJDJTIwY2xheW1hdGlvbiUyQyUyMGNpbmVtYXRpYyUyQyUyMG1vb2R5JTIwbGlnaHRpbmclMjIlMEFuZWdhdGl2ZV9wcm9tcHQlMjAlM0QlMjAlMjJsb3clMjBxdWFsaXR5JTJDJTIwYmFkJTIwcXVhbGl0eSUyMiUyMCUyMyUyMG9wdGlvbmFsJTIwdG8lMjBpbmNsdWRlJTIwYSUyMG5lZ2F0aXZlJTIwcHJvbXB0JTJDJTIwYnV0JTIwcmVzdWx0cyUyMGFyZSUyMHVzdWFsbHklMjBiZXR0ZXIlMEFpbWFnZV9lbWJlZHMlMkMlMjBuZWdhdGl2ZV9pbWFnZV9lbWJlZHMlMjAlM0QlMjBwcmlvcl9waXBlbGluZShwcm9tcHQlMkMlMjBndWlkYW5jZV9zY2FsZSUzRDEuMCkudG9fdHVwbGUoKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> KandinskyV22PriorPipeline, KandinskyV22Pipeline
<span class="hljs-keyword">import</span> torch

prior_pipeline = KandinskyV22PriorPipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-2-prior&quot;</span>, torch_dtype=torch.float16).to(<span class="hljs-string">&quot;cuda&quot;</span>)
pipeline = KandinskyV22Pipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-2-decoder&quot;</span>, torch_dtype=torch.float16).to(<span class="hljs-string">&quot;cuda&quot;</span>)

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> <span class="hljs-comment"># optional to include a negative prompt, but results are usually better</span>
image_embeds, negative_image_embeds = prior_pipeline(prompt, guidance_scale=<span class="hljs-number">1.0</span>).to_tuple()`,wrap:!1}}),n=new T({props:{code:"aW1hZ2UlMjAlM0QlMjBwaXBlbGluZShpbWFnZV9lbWJlZHMlM0RpbWFnZV9lbWJlZHMlMkMlMjBuZWdhdGl2ZV9pbWFnZV9lbWJlZHMlM0RuZWdhdGl2ZV9pbWFnZV9lbWJlZHMlMkMlMjBoZWlnaHQlM0Q3NjglMkMlMjB3aWR0aCUzRDc2OCkuaW1hZ2VzJTVCMCU1RCUwQWltYWdl",highlighted:`image = pipeline(image_embeds=image_embeds, negative_image_embeds=negative_image_embeds, height=<span class="hljs-number">768</span>, width=<span class="hljs-number">768</span>).images[<span class="hljs-number">0</span>]
image`,wrap:!1}}),{c(){y(t.$$.fragment),m=o(),s=w("p"),s.innerHTML=d,l=o(),y(n.$$.fragment),r=o(),J=w("div"),J.innerHTML=G,this.h()},l(k){u(t.$$.fragment,k),m=c(k),s=Z(k,"P",{"data-svelte-h":!0}),U(s)!=="svelte-h1vaih"&&(s.innerHTML=d),l=c(k),u(n.$$.fragment,k),r=c(k),J=Z(k,"DIV",{class:!0,"data-svelte-h":!0}),U(J)!=="svelte-kkab9k"&&(J.innerHTML=G),this.h()},h(){I(J,"class","flex justify-center")},m(k,V){M(t,k,V),p(k,m,V),p(k,s,V),p(k,l,V),M(n,k,V),p(k,r,V),p(k,J,V),W=!0},p:$,i(k){W||(f(t.$$.fragment,k),f(n.$$.fragment,k),W=!0)},o(k){h(t.$$.fragment,k),h(n.$$.fragment,k),W=!1},d(k){k&&(i(m),i(s),i(l),i(r),i(J)),b(t,k),b(n,k)}}}function Mn(g){let t,m='Kandinsky 3 doesn’t require a prior model so you can directly load the <a href="/docs/diffusers/main/en/api/pipelines/kandinsky3#diffusers.Kandinsky3Pipeline">Kandinsky3Pipeline</a> and pass a prompt to generate an image:',s,d,l;return d=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEthbmRpbnNreTNQaXBlbGluZSUwQWltcG9ydCUyMHRvcmNoJTBBJTBBcGlwZWxpbmUlMjAlM0QlMjBLYW5kaW5za3kzUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMyUyMiUyQyUyMHZhcmlhbnQlM0QlMjJmcDE2JTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2KSUwQXBpcGVsaW5lLmVuYWJsZV9tb2RlbF9jcHVfb2ZmbG9hZCgpJTBBJTBBcHJvbXB0JTIwJTNEJTIwJTIyQSUyMGFsaWVuJTIwY2hlZXNlYnVyZ2VyJTIwY3JlYXR1cmUlMjBlYXRpbmclMjBpdHNlbGYlMkMlMjBjbGF5bWF0aW9uJTJDJTIwY2luZW1hdGljJTJDJTIwbW9vZHklMjBsaWdodGluZyUyMiUwQWltYWdlJTIwJTNEJTIwcGlwZWxpbmUocHJvbXB0KS5pbWFnZXMlNUIwJTVEJTBBaW1hZ2U=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> Kandinsky3Pipeline
<span class="hljs-keyword">import</span> torch

pipeline = Kandinsky3Pipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-3&quot;</span>, variant=<span class="hljs-string">&quot;fp16&quot;</span>, torch_dtype=torch.float16)
pipeline.enable_model_cpu_offload()

prompt = <span class="hljs-string">&quot;A alien cheeseburger creature eating itself, claymation, cinematic, moody lighting&quot;</span>
image = pipeline(prompt).images[<span class="hljs-number">0</span>]
image`,wrap:!1}}),{c(){t=w("p"),t.innerHTML=m,s=o(),y(d.$$.fragment)},l(n){t=Z(n,"P",{"data-svelte-h":!0}),U(t)!=="svelte-ekc97p"&&(t.innerHTML=m),s=c(n),u(d.$$.fragment,n)},m(n,r){p(n,t,r),p(n,s,r),M(d,n,r),l=!0},p:$,i(n){l||(f(d.$$.fragment,n),l=!0)},o(n){h(d.$$.fragment,n),l=!1},d(n){n&&(i(t),i(s)),b(d,n)}}}function fn(g){let t,m,s,d,l,n;return t=new j({props:{id:"text-to-image",option:"Kandinsky 2.1",$$slots:{default:[yn]},$$scope:{ctx:g}}}),s=new j({props:{id:"text-to-image",option:"Kandinsky 2.2",$$slots:{default:[un]},$$scope:{ctx:g}}}),l=new j({props:{id:"text-to-image",option:"Kandinsky 3",$$slots:{default:[Mn]},$$scope:{ctx:g}}}),{c(){y(t.$$.fragment),m=o(),y(s.$$.fragment),d=o(),y(l.$$.fragment)},l(r){u(t.$$.fragment,r),m=c(r),u(s.$$.fragment,r),d=c(r),u(l.$$.fragment,r)},m(r,J){M(t,r,J),p(r,m,J),M(s,r,J),p(r,d,J),M(l,r,J),n=!0},p(r,J){const G={};J&2&&(G.$$scope={dirty:J,ctx:r}),t.$set(G);const W={};J&2&&(W.$$scope={dirty:J,ctx:r}),s.$set(W);const k={};J&2&&(k.$$scope={dirty:J,ctx:r}),l.$set(k)},i(r){n||(f(t.$$.fragment,r),f(s.$$.fragment,r),f(l.$$.fragment,r),n=!0)},o(r){h(t.$$.fragment,r),h(s.$$.fragment,r),h(l.$$.fragment,r),n=!1},d(r){r&&(i(m),i(d)),b(t,r),b(s,r),b(l,r)}}}function hn(g){let t,m;return t=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9QaXBlbGluZUZvclRleHQySW1hZ2UlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwQXV0b1BpcGVsaW5lRm9yVGV4dDJJbWFnZS5mcm9tX3ByZXRyYWluZWQoJTIya2FuZGluc2t5LWNvbW11bml0eSUyRmthbmRpbnNreS0yLTElMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYpJTBBcGlwZWxpbmUuZW5hYmxlX21vZGVsX2NwdV9vZmZsb2FkKCklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJBJTIwYWxpZW4lMjBjaGVlc2VidXJnZXIlMjBjcmVhdHVyZSUyMGVhdGluZyUyMGl0c2VsZiUyQyUyMGNsYXltYXRpb24lMkMlMjBjaW5lbWF0aWMlMkMlMjBtb29keSUyMGxpZ2h0aW5nJTIyJTBBbmVnYXRpdmVfcHJvbXB0JTIwJTNEJTIwJTIybG93JTIwcXVhbGl0eSUyQyUyMGJhZCUyMHF1YWxpdHklMjIlMEElMEFpbWFnZSUyMCUzRCUyMHBpcGVsaW5lKHByb21wdCUzRHByb21wdCUyQyUyMG5lZ2F0aXZlX3Byb21wdCUzRG5lZ2F0aXZlX3Byb21wdCUyQyUyMHByaW9yX2d1aWRhbmNlX3NjYWxlJTNEMS4wJTJDJTIwZ3VpZGFuY2Vfc2NhbGUlM0Q0LjAlMkMlMjBoZWlnaHQlM0Q3NjglMkMlMjB3aWR0aCUzRDc2OCkuaW1hZ2VzJTVCMCU1RCUwQWltYWdl",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoPipelineForText2Image
<span class="hljs-keyword">import</span> torch

pipeline = AutoPipelineForText2Image.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-1&quot;</span>, torch_dtype=torch.float16)
pipeline.enable_model_cpu_offload()

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 = pipeline(prompt=prompt, negative_prompt=negative_prompt, prior_guidance_scale=<span class="hljs-number">1.0</span>, guidance_scale=<span class="hljs-number">4.0</span>, height=<span class="hljs-number">768</span>, width=<span class="hljs-number">768</span>).images[<span class="hljs-number">0</span>]
image`,wrap:!1}}),{c(){y(t.$$.fragment)},l(s){u(t.$$.fragment,s)},m(s,d){M(t,s,d),m=!0},p:$,i(s){m||(f(t.$$.fragment,s),m=!0)},o(s){h(t.$$.fragment,s),m=!1},d(s){b(t,s)}}}function bn(g){let t,m;return t=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9QaXBlbGluZUZvclRleHQySW1hZ2UlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwQXV0b1BpcGVsaW5lRm9yVGV4dDJJbWFnZS5mcm9tX3ByZXRyYWluZWQoJTIya2FuZGluc2t5LWNvbW11bml0eSUyRmthbmRpbnNreS0yLTItZGVjb2RlciUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiklMEFwaXBlbGluZS5lbmFibGVfbW9kZWxfY3B1X29mZmxvYWQoKSUwQSUwQXByb21wdCUyMCUzRCUyMCUyMkElMjBhbGllbiUyMGNoZWVzZWJ1cmdlciUyMGNyZWF0dXJlJTIwZWF0aW5nJTIwaXRzZWxmJTJDJTIwY2xheW1hdGlvbiUyQyUyMGNpbmVtYXRpYyUyQyUyMG1vb2R5JTIwbGlnaHRpbmclMjIlMEFuZWdhdGl2ZV9wcm9tcHQlMjAlM0QlMjAlMjJsb3clMjBxdWFsaXR5JTJDJTIwYmFkJTIwcXVhbGl0eSUyMiUwQSUwQWltYWdlJTIwJTNEJTIwcGlwZWxpbmUocHJvbXB0JTNEcHJvbXB0JTJDJTIwbmVnYXRpdmVfcHJvbXB0JTNEbmVnYXRpdmVfcHJvbXB0JTJDJTIwcHJpb3JfZ3VpZGFuY2Vfc2NhbGUlM0QxLjAlMkMlMjBndWlkYW5jZV9zY2FsZSUzRDQuMCUyQyUyMGhlaWdodCUzRDc2OCUyQyUyMHdpZHRoJTNENzY4KS5pbWFnZXMlNUIwJTVEJTBBaW1hZ2U=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoPipelineForText2Image
<span class="hljs-keyword">import</span> torch

pipeline = AutoPipelineForText2Image.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-2-decoder&quot;</span>, torch_dtype=torch.float16)
pipeline.enable_model_cpu_offload()

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 = pipeline(prompt=prompt, negative_prompt=negative_prompt, prior_guidance_scale=<span class="hljs-number">1.0</span>, guidance_scale=<span class="hljs-number">4.0</span>, height=<span class="hljs-number">768</span>, width=<span class="hljs-number">768</span>).images[<span class="hljs-number">0</span>]
image`,wrap:!1}}),{c(){y(t.$$.fragment)},l(s){u(t.$$.fragment,s)},m(s,d){M(t,s,d),m=!0},p:$,i(s){m||(f(t.$$.fragment,s),m=!0)},o(s){h(t.$$.fragment,s),m=!1},d(s){b(t,s)}}}function Jn(g){let t,m,s,d;return t=new j({props:{id:"text-to-image",option:"Kandinsky 2.1",$$slots:{default:[hn]},$$scope:{ctx:g}}}),s=new j({props:{id:"text-to-image",option:"Kandinsky 2.2",$$slots:{default:[bn]},$$scope:{ctx:g}}}),{c(){y(t.$$.fragment),m=o(),y(s.$$.fragment)},l(l){u(t.$$.fragment,l),m=c(l),u(s.$$.fragment,l)},m(l,n){M(t,l,n),p(l,m,n),M(s,l,n),d=!0},p(l,n){const r={};n&2&&(r.$$scope={dirty:n,ctx:l}),t.$set(r);const J={};n&2&&(J.$$scope={dirty:n,ctx:l}),s.$set(J)},i(l){d||(f(t.$$.fragment,l),f(s.$$.fragment,l),d=!0)},o(l){h(t.$$.fragment,l),h(s.$$.fragment,l),d=!1},d(l){l&&i(m),b(t,l),b(s,l)}}}function gn(g){let t,m;return t=new T({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwS2FuZGluc2t5SW1nMkltZ1BpcGVsaW5lJTJDJTIwS2FuZGluc2t5UHJpb3JQaXBlbGluZSUwQSUwQXByaW9yX3BpcGVsaW5lJTIwJTNEJTIwS2FuZGluc2t5UHJpb3JQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTIya2FuZGluc2t5LWNvbW11bml0eSUyRmthbmRpbnNreS0yLTEtcHJpb3IlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMjB1c2Vfc2FmZXRlbnNvcnMlM0RUcnVlKS50byglMjJjdWRhJTIyKSUwQXBpcGVsaW5lJTIwJTNEJTIwS2FuZGluc2t5SW1nMkltZ1BpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTItMSUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUyQyUyMHVzZV9zYWZldGVuc29ycyUzRFRydWUpLnRvKCUyMmN1ZGElMjIp",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> KandinskyImg2ImgPipeline, KandinskyPriorPipeline

prior_pipeline = KandinskyPriorPipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-1-prior&quot;</span>, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>).to(<span class="hljs-string">&quot;cuda&quot;</span>)
pipeline = KandinskyImg2ImgPipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-1&quot;</span>, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>).to(<span class="hljs-string">&quot;cuda&quot;</span>)`,wrap:!1}}),{c(){y(t.$$.fragment)},l(s){u(t.$$.fragment,s)},m(s,d){M(t,s,d),m=!0},p:$,i(s){m||(f(t.$$.fragment,s),m=!0)},o(s){h(t.$$.fragment,s),m=!1},d(s){b(t,s)}}}function kn(g){let t,m;return t=new T({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwS2FuZGluc2t5VjIySW1nMkltZ1BpcGVsaW5lJTJDJTIwS2FuZGluc2t5UHJpb3JQaXBlbGluZSUwQSUwQXByaW9yX3BpcGVsaW5lJTIwJTNEJTIwS2FuZGluc2t5UHJpb3JQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTIya2FuZGluc2t5LWNvbW11bml0eSUyRmthbmRpbnNreS0yLTItcHJpb3IlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMjB1c2Vfc2FmZXRlbnNvcnMlM0RUcnVlKS50byglMjJjdWRhJTIyKSUwQXBpcGVsaW5lJTIwJTNEJTIwS2FuZGluc2t5VjIySW1nMkltZ1BpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTItMi1kZWNvZGVyJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTIwdXNlX3NhZmV0ZW5zb3JzJTNEVHJ1ZSkudG8oJTIyY3VkYSUyMik=",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> KandinskyV22Img2ImgPipeline, KandinskyPriorPipeline

prior_pipeline = KandinskyPriorPipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-2-prior&quot;</span>, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>).to(<span class="hljs-string">&quot;cuda&quot;</span>)
pipeline = KandinskyV22Img2ImgPipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-2-decoder&quot;</span>, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>).to(<span class="hljs-string">&quot;cuda&quot;</span>)`,wrap:!1}}),{c(){y(t.$$.fragment)},l(s){u(t.$$.fragment,s)},m(s,d){M(t,s,d),m=!0},p:$,i(s){m||(f(t.$$.fragment,s),m=!0)},o(s){h(t.$$.fragment,s),m=!1},d(s){b(t,s)}}}function wn(g){let t,m="Kandinsky 3 doesn’t require a prior model so you can directly load the image-to-image pipeline:",s,d,l;return d=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEthbmRpbnNreTNJbWcySW1nUGlwZWxpbmUlMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwbG9hZF9pbWFnZSUwQWltcG9ydCUyMHRvcmNoJTBBJTBBcGlwZWxpbmUlMjAlM0QlMjBLYW5kaW5za3kzSW1nMkltZ1BpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTMlMjIlMkMlMjB2YXJpYW50JTNEJTIyZnAxNiUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiklMEFwaXBlbGluZS5lbmFibGVfbW9kZWxfY3B1X29mZmxvYWQoKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> Kandinsky3Img2ImgPipeline
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image
<span class="hljs-keyword">import</span> torch

pipeline = Kandinsky3Img2ImgPipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-3&quot;</span>, variant=<span class="hljs-string">&quot;fp16&quot;</span>, torch_dtype=torch.float16)
pipeline.enable_model_cpu_offload()`,wrap:!1}}),{c(){t=w("p"),t.textContent=m,s=o(),y(d.$$.fragment)},l(n){t=Z(n,"P",{"data-svelte-h":!0}),U(t)!=="svelte-3bukbx"&&(t.textContent=m),s=c(n),u(d.$$.fragment,n)},m(n,r){p(n,t,r),p(n,s,r),M(d,n,r),l=!0},p:$,i(n){l||(f(d.$$.fragment,n),l=!0)},o(n){h(d.$$.fragment,n),l=!1},d(n){n&&(i(t),i(s)),b(d,n)}}}function Zn(g){let t,m,s,d,l,n;return t=new j({props:{id:"image-to-image",option:"Kandinsky 2.1",$$slots:{default:[gn]},$$scope:{ctx:g}}}),s=new j({props:{id:"image-to-image",option:"Kandinsky 2.2",$$slots:{default:[kn]},$$scope:{ctx:g}}}),l=new j({props:{id:"image-to-image",option:"Kandinsky 3",$$slots:{default:[wn]},$$scope:{ctx:g}}}),{c(){y(t.$$.fragment),m=o(),y(s.$$.fragment),d=o(),y(l.$$.fragment)},l(r){u(t.$$.fragment,r),m=c(r),u(s.$$.fragment,r),d=c(r),u(l.$$.fragment,r)},m(r,J){M(t,r,J),p(r,m,J),M(s,r,J),p(r,d,J),M(l,r,J),n=!0},p(r,J){const G={};J&2&&(G.$$scope={dirty:J,ctx:r}),t.$set(G);const W={};J&2&&(W.$$scope={dirty:J,ctx:r}),s.$set(W);const k={};J&2&&(k.$$scope={dirty:J,ctx:r}),l.$set(k)},i(r){n||(f(t.$$.fragment,r),f(s.$$.fragment,r),f(l.$$.fragment,r),n=!0)},o(r){h(t.$$.fragment,r),h(s.$$.fragment,r),h(l.$$.fragment,r),n=!1},d(r){r&&(i(m),i(d)),b(t,r),b(s,r),b(l,r)}}}function Un(g){let t,m,s,d='<img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/kandinsky-docs/img2img_fantasyland.png"/>',l;return t=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2Vycy51dGlscyUyMGltcG9ydCUyMG1ha2VfaW1hZ2VfZ3JpZCUwQSUwQWltYWdlJTIwJTNEJTIwcGlwZWxpbmUocHJvbXB0JTJDJTIwbmVnYXRpdmVfcHJvbXB0JTNEbmVnYXRpdmVfcHJvbXB0JTJDJTIwaW1hZ2UlM0RvcmlnaW5hbF9pbWFnZSUyQyUyMGltYWdlX2VtYmVkcyUzRGltYWdlX2VtYmVkcyUyQyUyMG5lZ2F0aXZlX2ltYWdlX2VtYmVkcyUzRG5lZ2F0aXZlX2ltYWdlX2VtYmVkcyUyQyUyMGhlaWdodCUzRDc2OCUyQyUyMHdpZHRoJTNENzY4JTJDJTIwc3RyZW5ndGglM0QwLjMpLmltYWdlcyU1QjAlNUQlMEFtYWtlX2ltYWdlX2dyaWQoJTVCb3JpZ2luYWxfaW1hZ2UucmVzaXplKCg1MTIlMkMlMjA1MTIpKSUyQyUyMGltYWdlLnJlc2l6ZSgoNTEyJTJDJTIwNTEyKSklNUQlMkMlMjByb3dzJTNEMSUyQyUyMGNvbHMlM0QyKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> make_image_grid

image = pipeline(prompt, negative_prompt=negative_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>).images[<span class="hljs-number">0</span>]
make_image_grid([original_image.resize((<span class="hljs-number">512</span>, <span class="hljs-number">512</span>)), image.resize((<span class="hljs-number">512</span>, <span class="hljs-number">512</span>))], rows=<span class="hljs-number">1</span>, cols=<span class="hljs-number">2</span>)`,wrap:!1}}),{c(){y(t.$$.fragment),m=o(),s=w("div"),s.innerHTML=d,this.h()},l(n){u(t.$$.fragment,n),m=c(n),s=Z(n,"DIV",{class:!0,"data-svelte-h":!0}),U(s)!=="svelte-1vh4dwd"&&(s.innerHTML=d),this.h()},h(){I(s,"class","flex justify-center")},m(n,r){M(t,n,r),p(n,m,r),p(n,s,r),l=!0},p:$,i(n){l||(f(t.$$.fragment,n),l=!0)},o(n){h(t.$$.fragment,n),l=!1},d(n){n&&(i(m),i(s)),b(t,n)}}}function Tn(g){let t,m,s,d='<img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/kandinsky-image-to-image.png"/>',l;return t=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2Vycy51dGlscyUyMGltcG9ydCUyMG1ha2VfaW1hZ2VfZ3JpZCUwQSUwQWltYWdlJTIwJTNEJTIwcGlwZWxpbmUoaW1hZ2UlM0RvcmlnaW5hbF9pbWFnZSUyQyUyMGltYWdlX2VtYmVkcyUzRGltYWdlX2VtYmVkcyUyQyUyMG5lZ2F0aXZlX2ltYWdlX2VtYmVkcyUzRG5lZ2F0aXZlX2ltYWdlX2VtYmVkcyUyQyUyMGhlaWdodCUzRDc2OCUyQyUyMHdpZHRoJTNENzY4JTJDJTIwc3RyZW5ndGglM0QwLjMpLmltYWdlcyU1QjAlNUQlMEFtYWtlX2ltYWdlX2dyaWQoJTVCb3JpZ2luYWxfaW1hZ2UucmVzaXplKCg1MTIlMkMlMjA1MTIpKSUyQyUyMGltYWdlLnJlc2l6ZSgoNTEyJTJDJTIwNTEyKSklNUQlMkMlMjByb3dzJTNEMSUyQyUyMGNvbHMlM0QyKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> make_image_grid

image = pipeline(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>).images[<span class="hljs-number">0</span>]
make_image_grid([original_image.resize((<span class="hljs-number">512</span>, <span class="hljs-number">512</span>)), image.resize((<span class="hljs-number">512</span>, <span class="hljs-number">512</span>))], rows=<span class="hljs-number">1</span>, cols=<span class="hljs-number">2</span>)`,wrap:!1}}),{c(){y(t.$$.fragment),m=o(),s=w("div"),s.innerHTML=d,this.h()},l(n){u(t.$$.fragment,n),m=c(n),s=Z(n,"DIV",{class:!0,"data-svelte-h":!0}),U(s)!=="svelte-1vux4a0"&&(s.innerHTML=d),this.h()},h(){I(s,"class","flex justify-center")},m(n,r){M(t,n,r),p(n,m,r),p(n,s,r),l=!0},p:$,i(n){l||(f(t.$$.fragment,n),l=!0)},o(n){h(t.$$.fragment,n),l=!1},d(n){n&&(i(m),i(s)),b(t,n)}}}function Wn(g){let t,m;return t=new T({props:{code:"aW1hZ2UlMjAlM0QlMjBwaXBlbGluZShwcm9tcHQlMkMlMjBuZWdhdGl2ZV9wcm9tcHQlM0RuZWdhdGl2ZV9wcm9tcHQlMkMlMjBpbWFnZSUzRGltYWdlJTJDJTIwc3RyZW5ndGglM0QwLjc1JTJDJTIwbnVtX2luZmVyZW5jZV9zdGVwcyUzRDI1KS5pbWFnZXMlNUIwJTVEJTBBaW1hZ2U=",highlighted:`image = pipeline(prompt, negative_prompt=negative_prompt, image=image, strength=<span class="hljs-number">0.75</span>, num_inference_steps=<span class="hljs-number">25</span>).images[<span class="hljs-number">0</span>]
image`,wrap:!1}}),{c(){y(t.$$.fragment)},l(s){u(t.$$.fragment,s)},m(s,d){M(t,s,d),m=!0},p:$,i(s){m||(f(t.$$.fragment,s),m=!0)},o(s){h(t.$$.fragment,s),m=!1},d(s){b(t,s)}}}function jn(g){let t,m,s,d,l,n;return t=new j({props:{id:"image-to-image",option:"Kandinsky 2.1",$$slots:{default:[Un]},$$scope:{ctx:g}}}),s=new j({props:{id:"image-to-image",option:"Kandinsky 2.2",$$slots:{default:[Tn]},$$scope:{ctx:g}}}),l=new j({props:{id:"image-to-image",option:"Kandinsky 3",$$slots:{default:[Wn]},$$scope:{ctx:g}}}),{c(){y(t.$$.fragment),m=o(),y(s.$$.fragment),d=o(),y(l.$$.fragment)},l(r){u(t.$$.fragment,r),m=c(r),u(s.$$.fragment,r),d=c(r),u(l.$$.fragment,r)},m(r,J){M(t,r,J),p(r,m,J),M(s,r,J),p(r,d,J),M(l,r,J),n=!0},p(r,J){const G={};J&2&&(G.$$scope={dirty:J,ctx:r}),t.$set(G);const W={};J&2&&(W.$$scope={dirty:J,ctx:r}),s.$set(W);const k={};J&2&&(k.$$scope={dirty:J,ctx:r}),l.$set(k)},i(r){n||(f(t.$$.fragment,r),f(s.$$.fragment,r),f(l.$$.fragment,r),n=!0)},o(r){h(t.$$.fragment,r),h(s.$$.fragment,r),h(l.$$.fragment,r),n=!1},d(r){r&&(i(m),i(d)),b(t,r),b(s,r),b(l,r)}}}function $n(g){let t,m;return t=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9QaXBlbGluZUZvckltYWdlMkltYWdlJTBBZnJvbSUyMGRpZmZ1c2Vycy51dGlscyUyMGltcG9ydCUyMG1ha2VfaW1hZ2VfZ3JpZCUyQyUyMGxvYWRfaW1hZ2UlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwQXV0b1BpcGVsaW5lRm9ySW1hZ2UySW1hZ2UuZnJvbV9wcmV0cmFpbmVkKCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMi0xJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTIwdXNlX3NhZmV0ZW5zb3JzJTNEVHJ1ZSklMEFwaXBlbGluZS5lbmFibGVfbW9kZWxfY3B1X29mZmxvYWQoKSUwQSUwQXByb21wdCUyMCUzRCUyMCUyMkElMjBmYW50YXN5JTIwbGFuZHNjYXBlJTJDJTIwQ2luZW1hdGljJTIwbGlnaHRpbmclMjIlMEFuZWdhdGl2ZV9wcm9tcHQlMjAlM0QlMjAlMjJsb3clMjBxdWFsaXR5JTJDJTIwYmFkJTIwcXVhbGl0eSUyMiUwQSUwQXVybCUyMCUzRCUyMCUyMmh0dHBzJTNBJTJGJTJGcmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSUyRkNvbXBWaXMlMkZzdGFibGUtZGlmZnVzaW9uJTJGbWFpbiUyRmFzc2V0cyUyRnN0YWJsZS1zYW1wbGVzJTJGaW1nMmltZyUyRnNrZXRjaC1tb3VudGFpbnMtaW5wdXQuanBnJTIyJTBBb3JpZ2luYWxfaW1hZ2UlMjAlM0QlMjBsb2FkX2ltYWdlKHVybCklMEElMEFvcmlnaW5hbF9pbWFnZS50aHVtYm5haWwoKDc2OCUyQyUyMDc2OCkpJTBBJTBBaW1hZ2UlMjAlM0QlMjBwaXBlbGluZShwcm9tcHQlM0Rwcm9tcHQlMkMlMjBuZWdhdGl2ZV9wcm9tcHQlM0RuZWdhdGl2ZV9wcm9tcHQlMkMlMjBpbWFnZSUzRG9yaWdpbmFsX2ltYWdlJTJDJTIwc3RyZW5ndGglM0QwLjMpLmltYWdlcyU1QjAlNUQlMEFtYWtlX2ltYWdlX2dyaWQoJTVCb3JpZ2luYWxfaW1hZ2UucmVzaXplKCg1MTIlMkMlMjA1MTIpKSUyQyUyMGltYWdlLnJlc2l6ZSgoNTEyJTJDJTIwNTEyKSklNUQlMkMlMjByb3dzJTNEMSUyQyUyMGNvbHMlM0QyKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoPipelineForImage2Image
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> make_image_grid, load_image
<span class="hljs-keyword">import</span> torch

pipeline = AutoPipelineForImage2Image.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-1&quot;</span>, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>)
pipeline.enable_model_cpu_offload()

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>

url = <span class="hljs-string">&quot;https://raw.githubusercontent.com/CompVis/stable-diffusion/main/assets/stable-samples/img2img/sketch-mountains-input.jpg&quot;</span>
original_image = load_image(url)

original_image.thumbnail((<span class="hljs-number">768</span>, <span class="hljs-number">768</span>))

image = pipeline(prompt=prompt, negative_prompt=negative_prompt, image=original_image, strength=<span class="hljs-number">0.3</span>).images[<span class="hljs-number">0</span>]
make_image_grid([original_image.resize((<span class="hljs-number">512</span>, <span class="hljs-number">512</span>)), image.resize((<span class="hljs-number">512</span>, <span class="hljs-number">512</span>))], rows=<span class="hljs-number">1</span>, cols=<span class="hljs-number">2</span>)`,wrap:!1}}),{c(){y(t.$$.fragment)},l(s){u(t.$$.fragment,s)},m(s,d){M(t,s,d),m=!0},p:$,i(s){m||(f(t.$$.fragment,s),m=!0)},o(s){h(t.$$.fragment,s),m=!1},d(s){b(t,s)}}}function Gn(g){let t,m;return t=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEF1dG9QaXBlbGluZUZvckltYWdlMkltYWdlJTBBZnJvbSUyMGRpZmZ1c2Vycy51dGlscyUyMGltcG9ydCUyMG1ha2VfaW1hZ2VfZ3JpZCUyQyUyMGxvYWRfaW1hZ2UlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwQXV0b1BpcGVsaW5lRm9ySW1hZ2UySW1hZ2UuZnJvbV9wcmV0cmFpbmVkKCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMi0yLWRlY29kZXIlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYpJTBBcGlwZWxpbmUuZW5hYmxlX21vZGVsX2NwdV9vZmZsb2FkKCklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJBJTIwZmFudGFzeSUyMGxhbmRzY2FwZSUyQyUyMENpbmVtYXRpYyUyMGxpZ2h0aW5nJTIyJTBBbmVnYXRpdmVfcHJvbXB0JTIwJTNEJTIwJTIybG93JTIwcXVhbGl0eSUyQyUyMGJhZCUyMHF1YWxpdHklMjIlMEElMEF1cmwlMjAlM0QlMjAlMjJodHRwcyUzQSUyRiUyRnJhdy5naXRodWJ1c2VyY29udGVudC5jb20lMkZDb21wVmlzJTJGc3RhYmxlLWRpZmZ1c2lvbiUyRm1haW4lMkZhc3NldHMlMkZzdGFibGUtc2FtcGxlcyUyRmltZzJpbWclMkZza2V0Y2gtbW91bnRhaW5zLWlucHV0LmpwZyUyMiUwQW9yaWdpbmFsX2ltYWdlJTIwJTNEJTIwbG9hZF9pbWFnZSh1cmwpJTBBJTBBb3JpZ2luYWxfaW1hZ2UudGh1bWJuYWlsKCg3NjglMkMlMjA3NjgpKSUwQSUwQWltYWdlJTIwJTNEJTIwcGlwZWxpbmUocHJvbXB0JTNEcHJvbXB0JTJDJTIwbmVnYXRpdmVfcHJvbXB0JTNEbmVnYXRpdmVfcHJvbXB0JTJDJTIwaW1hZ2UlM0RvcmlnaW5hbF9pbWFnZSUyQyUyMHN0cmVuZ3RoJTNEMC4zKS5pbWFnZXMlNUIwJTVEJTBBbWFrZV9pbWFnZV9ncmlkKCU1Qm9yaWdpbmFsX2ltYWdlLnJlc2l6ZSgoNTEyJTJDJTIwNTEyKSklMkMlMjBpbWFnZS5yZXNpemUoKDUxMiUyQyUyMDUxMikpJTVEJTJDJTIwcm93cyUzRDElMkMlMjBjb2xzJTNEMik=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoPipelineForImage2Image
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> make_image_grid, load_image
<span class="hljs-keyword">import</span> torch

pipeline = AutoPipelineForImage2Image.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-2-decoder&quot;</span>, torch_dtype=torch.float16)
pipeline.enable_model_cpu_offload()

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>

url = <span class="hljs-string">&quot;https://raw.githubusercontent.com/CompVis/stable-diffusion/main/assets/stable-samples/img2img/sketch-mountains-input.jpg&quot;</span>
original_image = load_image(url)

original_image.thumbnail((<span class="hljs-number">768</span>, <span class="hljs-number">768</span>))

image = pipeline(prompt=prompt, negative_prompt=negative_prompt, image=original_image, strength=<span class="hljs-number">0.3</span>).images[<span class="hljs-number">0</span>]
make_image_grid([original_image.resize((<span class="hljs-number">512</span>, <span class="hljs-number">512</span>)), image.resize((<span class="hljs-number">512</span>, <span class="hljs-number">512</span>))], rows=<span class="hljs-number">1</span>, cols=<span class="hljs-number">2</span>)`,wrap:!1}}),{c(){y(t.$$.fragment)},l(s){u(t.$$.fragment,s)},m(s,d){M(t,s,d),m=!0},p:$,i(s){m||(f(t.$$.fragment,s),m=!0)},o(s){h(t.$$.fragment,s),m=!1},d(s){b(t,s)}}}function In(g){let t,m,s,d;return t=new j({props:{id:"image-to-image",option:"Kandinsky 2.1",$$slots:{default:[$n]},$$scope:{ctx:g}}}),s=new j({props:{id:"image-to-image",option:"Kandinsky 2.2",$$slots:{default:[Gn]},$$scope:{ctx:g}}}),{c(){y(t.$$.fragment),m=o(),y(s.$$.fragment)},l(l){u(t.$$.fragment,l),m=c(l),u(s.$$.fragment,l)},m(l,n){M(t,l,n),p(l,m,n),M(s,l,n),d=!0},p(l,n){const r={};n&2&&(r.$$scope={dirty:n,ctx:l}),t.$set(r);const J={};n&2&&(J.$$scope={dirty:n,ctx:l}),s.$set(J)},i(l){d||(f(t.$$.fragment,l),f(s.$$.fragment,l),d=!0)},o(l){h(t.$$.fragment,l),h(s.$$.fragment,l),d=!1},d(l){l&&i(m),b(t,l),b(s,l)}}}function Vn(g){let t,m;return t=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEthbmRpbnNreUlucGFpbnRQaXBlbGluZSUyQyUyMEthbmRpbnNreVByaW9yUGlwZWxpbmUlMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwbG9hZF9pbWFnZSUyQyUyMG1ha2VfaW1hZ2VfZ3JpZCUwQWltcG9ydCUyMHRvcmNoJTBBaW1wb3J0JTIwbnVtcHklMjBhcyUyMG5wJTBBZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBJTBBcHJpb3JfcGlwZWxpbmUlMjAlM0QlMjBLYW5kaW5za3lQcmlvclBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTItMS1wcmlvciUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUyQyUyMHVzZV9zYWZldGVuc29ycyUzRFRydWUpLnRvKCUyMmN1ZGElMjIpJTBBcGlwZWxpbmUlMjAlM0QlMjBLYW5kaW5za3lJbnBhaW50UGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMi0xLWlucGFpbnQlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMjB1c2Vfc2FmZXRlbnNvcnMlM0RUcnVlKS50byglMjJjdWRhJTIyKQ==",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, make_image_grid
<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
<span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image

prior_pipeline = KandinskyPriorPipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-1-prior&quot;</span>, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>).to(<span class="hljs-string">&quot;cuda&quot;</span>)
pipeline = KandinskyInpaintPipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-1-inpaint&quot;</span>, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>).to(<span class="hljs-string">&quot;cuda&quot;</span>)`,wrap:!1}}),{c(){y(t.$$.fragment)},l(s){u(t.$$.fragment,s)},m(s,d){M(t,s,d),m=!0},p:$,i(s){m||(f(t.$$.fragment,s),m=!0)},o(s){h(t.$$.fragment,s),m=!1},d(s){b(t,s)}}}function Bn(g){let t,m;return t=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEthbmRpbnNreVYyMklucGFpbnRQaXBlbGluZSUyQyUyMEthbmRpbnNreVYyMlByaW9yUGlwZWxpbmUlMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwbG9hZF9pbWFnZSUyQyUyMG1ha2VfaW1hZ2VfZ3JpZCUwQWltcG9ydCUyMHRvcmNoJTBBaW1wb3J0JTIwbnVtcHklMjBhcyUyMG5wJTBBZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBJTBBcHJpb3JfcGlwZWxpbmUlMjAlM0QlMjBLYW5kaW5za3lWMjJQcmlvclBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTItMi1wcmlvciUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUyQyUyMHVzZV9zYWZldGVuc29ycyUzRFRydWUpLnRvKCUyMmN1ZGElMjIpJTBBcGlwZWxpbmUlMjAlM0QlMjBLYW5kaW5za3lWMjJJbnBhaW50UGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMi0yLWRlY29kZXItaW5wYWludCUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUyQyUyMHVzZV9zYWZldGVuc29ycyUzRFRydWUpLnRvKCUyMmN1ZGElMjIp",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> KandinskyV22InpaintPipeline, KandinskyV22PriorPipeline
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image, make_image_grid
<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
<span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image

prior_pipeline = KandinskyV22PriorPipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-2-prior&quot;</span>, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>).to(<span class="hljs-string">&quot;cuda&quot;</span>)
pipeline = KandinskyV22InpaintPipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-2-decoder-inpaint&quot;</span>, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>).to(<span class="hljs-string">&quot;cuda&quot;</span>)`,wrap:!1}}),{c(){y(t.$$.fragment)},l(s){u(t.$$.fragment,s)},m(s,d){M(t,s,d),m=!0},p:$,i(s){m||(f(t.$$.fragment,s),m=!0)},o(s){h(t.$$.fragment,s),m=!1},d(s){b(t,s)}}}function _n(g){let t,m,s,d;return t=new j({props:{id:"inpaint",option:"Kandinsky 2.1",$$slots:{default:[Vn]},$$scope:{ctx:g}}}),s=new j({props:{id:"inpaint",option:"Kandinsky 2.2",$$slots:{default:[Bn]},$$scope:{ctx:g}}}),{c(){y(t.$$.fragment),m=o(),y(s.$$.fragment)},l(l){u(t.$$.fragment,l),m=c(l),u(s.$$.fragment,l)},m(l,n){M(t,l,n),p(l,m,n),M(s,l,n),d=!0},p(l,n){const r={};n&2&&(r.$$scope={dirty:n,ctx:l}),t.$set(r);const J={};n&2&&(J.$$scope={dirty:n,ctx:l}),s.$set(J)},i(l){d||(f(t.$$.fragment,l),f(s.$$.fragment,l),d=!0)},o(l){h(t.$$.fragment,l),h(s.$$.fragment,l),d=!1},d(l){l&&i(m),b(t,l),b(s,l)}}}function vn(g){let t,m,s,d='<img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/kandinsky-docs/inpaint_cat_hat.png"/>',l;return t=new T({props:{code:"b3V0cHV0X2ltYWdlJTIwJTNEJTIwcGlwZWxpbmUocHJvbXB0JTJDJTIwaW1hZ2UlM0Rpbml0X2ltYWdlJTJDJTIwbWFza19pbWFnZSUzRG1hc2slMkMlMjAqKnByaW9yX291dHB1dCUyQyUyMGhlaWdodCUzRDc2OCUyQyUyMHdpZHRoJTNENzY4JTJDJTIwbnVtX2luZmVyZW5jZV9zdGVwcyUzRDE1MCkuaW1hZ2VzJTVCMCU1RCUwQW1hc2slMjAlM0QlMjBJbWFnZS5mcm9tYXJyYXkoKG1hc2sqMjU1KS5hc3R5cGUoJ3VpbnQ4JyklMkMlMjAnTCcpJTBBbWFrZV9pbWFnZV9ncmlkKCU1QmluaXRfaW1hZ2UlMkMlMjBtYXNrJTJDJTIwb3V0cHV0X2ltYWdlJTVEJTJDJTIwcm93cyUzRDElMkMlMjBjb2xzJTNEMyk=",highlighted:`output_image = pipeline(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>).images[<span class="hljs-number">0</span>]
mask = Image.fromarray((mask*<span class="hljs-number">255</span>).astype(<span class="hljs-string">&#x27;uint8&#x27;</span>), <span class="hljs-string">&#x27;L&#x27;</span>)
make_image_grid([init_image, mask, output_image], rows=<span class="hljs-number">1</span>, cols=<span class="hljs-number">3</span>)`,wrap:!1}}),{c(){y(t.$$.fragment),m=o(),s=w("div"),s.innerHTML=d,this.h()},l(n){u(t.$$.fragment,n),m=c(n),s=Z(n,"DIV",{class:!0,"data-svelte-h":!0}),U(s)!=="svelte-1d04i1f"&&(s.innerHTML=d),this.h()},h(){I(s,"class","flex justify-center")},m(n,r){M(t,n,r),p(n,m,r),p(n,s,r),l=!0},p:$,i(n){l||(f(t.$$.fragment,n),l=!0)},o(n){h(t.$$.fragment,n),l=!1},d(n){n&&(i(m),i(s)),b(t,n)}}}function Xn(g){let t,m,s,d='<img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/kandinskyv22-inpaint.png"/>',l;return t=new T({props:{code:"b3V0cHV0X2ltYWdlJTIwJTNEJTIwcGlwZWxpbmUoaW1hZ2UlM0Rpbml0X2ltYWdlJTJDJTIwbWFza19pbWFnZSUzRG1hc2slMkMlMjAqKnByaW9yX291dHB1dCUyQyUyMGhlaWdodCUzRDc2OCUyQyUyMHdpZHRoJTNENzY4JTJDJTIwbnVtX2luZmVyZW5jZV9zdGVwcyUzRDE1MCkuaW1hZ2VzJTVCMCU1RCUwQW1hc2slMjAlM0QlMjBJbWFnZS5mcm9tYXJyYXkoKG1hc2sqMjU1KS5hc3R5cGUoJ3VpbnQ4JyklMkMlMjAnTCcpJTBBbWFrZV9pbWFnZV9ncmlkKCU1QmluaXRfaW1hZ2UlMkMlMjBtYXNrJTJDJTIwb3V0cHV0X2ltYWdlJTVEJTJDJTIwcm93cyUzRDElMkMlMjBjb2xzJTNEMyk=",highlighted:`output_image = pipeline(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>).images[<span class="hljs-number">0</span>]
mask = Image.fromarray((mask*<span class="hljs-number">255</span>).astype(<span class="hljs-string">&#x27;uint8&#x27;</span>), <span class="hljs-string">&#x27;L&#x27;</span>)
make_image_grid([init_image, mask, output_image], rows=<span class="hljs-number">1</span>, cols=<span class="hljs-number">3</span>)`,wrap:!1}}),{c(){y(t.$$.fragment),m=o(),s=w("div"),s.innerHTML=d,this.h()},l(n){u(t.$$.fragment,n),m=c(n),s=Z(n,"DIV",{class:!0,"data-svelte-h":!0}),U(s)!=="svelte-1ajezuw"&&(s.innerHTML=d),this.h()},h(){I(s,"class","flex justify-center")},m(n,r){M(t,n,r),p(n,m,r),p(n,s,r),l=!0},p:$,i(n){l||(f(t.$$.fragment,n),l=!0)},o(n){h(t.$$.fragment,n),l=!1},d(n){n&&(i(m),i(s)),b(t,n)}}}function Rn(g){let t,m,s,d;return t=new j({props:{id:"inpaint",option:"Kandinsky 2.1",$$slots:{default:[vn]},$$scope:{ctx:g}}}),s=new j({props:{id:"inpaint",option:"Kandinsky 2.2",$$slots:{default:[Xn]},$$scope:{ctx:g}}}),{c(){y(t.$$.fragment),m=o(),y(s.$$.fragment)},l(l){u(t.$$.fragment,l),m=c(l),u(s.$$.fragment,l)},m(l,n){M(t,l,n),p(l,m,n),M(s,l,n),d=!0},p(l,n){const r={};n&2&&(r.$$scope={dirty:n,ctx:l}),t.$set(r);const J={};n&2&&(J.$$scope={dirty:n,ctx:l}),s.$set(J)},i(l){d||(f(t.$$.fragment,l),f(s.$$.fragment,l),d=!0)},o(l){h(t.$$.fragment,l),h(s.$$.fragment,l),d=!1},d(l){l&&i(m),b(t,l),b(s,l)}}}function Cn(g){let t,m;return t=new T({props:{code:"aW1wb3J0JTIwdG9yY2glMEFpbXBvcnQlMjBudW1weSUyMGFzJTIwbnAlMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwQXV0b1BpcGVsaW5lRm9ySW5wYWludGluZyUwQWZyb20lMjBkaWZmdXNlcnMudXRpbHMlMjBpbXBvcnQlMjBsb2FkX2ltYWdlJTJDJTIwbWFrZV9pbWFnZV9ncmlkJTBBJTBBcGlwZSUyMCUzRCUyMEF1dG9QaXBlbGluZUZvcklucGFpbnRpbmcuZnJvbV9wcmV0cmFpbmVkKCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMi0xLWlucGFpbnQlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYpJTBBcGlwZS5lbmFibGVfbW9kZWxfY3B1X29mZmxvYWQoKSUwQSUwQWluaXRfaW1hZ2UlMjAlM0QlMjBsb2FkX2ltYWdlKCUyMmh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZkYXRhc2V0cyUyRmhmLWludGVybmFsLXRlc3RpbmclMkZkaWZmdXNlcnMtaW1hZ2VzJTJGcmVzb2x2ZSUyRm1haW4lMkZrYW5kaW5za3klMkZjYXQucG5nJTIyKSUwQW1hc2slMjAlM0QlMjBucC56ZXJvcygoNzY4JTJDJTIwNzY4KSUyQyUyMGR0eXBlJTNEbnAuZmxvYXQzMiklMEElMjMlMjBtYXNrJTIwYXJlYSUyMGFib3ZlJTIwY2F0J3MlMjBoZWFkJTBBbWFzayU1QiUzQTI1MCUyQyUyMDI1MCUzQS0yNTAlNUQlMjAlM0QlMjAxJTBBcHJvbXB0JTIwJTNEJTIwJTIyYSUyMGhhdCUyMiUwQSUwQW91dHB1dF9pbWFnZSUyMCUzRCUyMHBpcGUocHJvbXB0JTNEcHJvbXB0JTJDJTIwaW1hZ2UlM0Rpbml0X2ltYWdlJTJDJTIwbWFza19pbWFnZSUzRG1hc2spLmltYWdlcyU1QjAlNUQlMEFtYXNrJTIwJTNEJTIwSW1hZ2UuZnJvbWFycmF5KChtYXNrKjI1NSkuYXN0eXBlKCd1aW50OCcpJTJDJTIwJ0wnKSUwQW1ha2VfaW1hZ2VfZ3JpZCglNUJpbml0X2ltYWdlJTJDJTIwbWFzayUyQyUyMG91dHB1dF9pbWFnZSU1RCUyQyUyMHJvd3MlM0QxJTJDJTIwY29scyUzRDMp",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
<span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoPipelineForInpainting
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image, make_image_grid

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

init_image = load_image(<span class="hljs-string">&quot;https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/kandinsky/cat.png&quot;</span>)
mask = np.zeros((<span class="hljs-number">768</span>, <span class="hljs-number">768</span>), dtype=np.float32)
<span class="hljs-comment"># mask area above 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">1</span>
prompt = <span class="hljs-string">&quot;a hat&quot;</span>

output_image = pipe(prompt=prompt, image=init_image, mask_image=mask).images[<span class="hljs-number">0</span>]
mask = Image.fromarray((mask*<span class="hljs-number">255</span>).astype(<span class="hljs-string">&#x27;uint8&#x27;</span>), <span class="hljs-string">&#x27;L&#x27;</span>)
make_image_grid([init_image, mask, output_image], rows=<span class="hljs-number">1</span>, cols=<span class="hljs-number">3</span>)`,wrap:!1}}),{c(){y(t.$$.fragment)},l(s){u(t.$$.fragment,s)},m(s,d){M(t,s,d),m=!0},p:$,i(s){m||(f(t.$$.fragment,s),m=!0)},o(s){h(t.$$.fragment,s),m=!1},d(s){b(t,s)}}}function Yn(g){let t,m;return t=new T({props:{code:"aW1wb3J0JTIwdG9yY2glMEFpbXBvcnQlMjBudW1weSUyMGFzJTIwbnAlMEFmcm9tJTIwUElMJTIwaW1wb3J0JTIwSW1hZ2UlMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwQXV0b1BpcGVsaW5lRm9ySW5wYWludGluZyUwQWZyb20lMjBkaWZmdXNlcnMudXRpbHMlMjBpbXBvcnQlMjBsb2FkX2ltYWdlJTJDJTIwbWFrZV9pbWFnZV9ncmlkJTBBJTBBcGlwZSUyMCUzRCUyMEF1dG9QaXBlbGluZUZvcklucGFpbnRpbmcuZnJvbV9wcmV0cmFpbmVkKCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMi0yLWRlY29kZXItaW5wYWludCUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiklMEFwaXBlLmVuYWJsZV9tb2RlbF9jcHVfb2ZmbG9hZCgpJTBBJTBBaW5pdF9pbWFnZSUyMCUzRCUyMGxvYWRfaW1hZ2UoJTIyaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRmRhdGFzZXRzJTJGaGYtaW50ZXJuYWwtdGVzdGluZyUyRmRpZmZ1c2Vycy1pbWFnZXMlMkZyZXNvbHZlJTJGbWFpbiUyRmthbmRpbnNreSUyRmNhdC5wbmclMjIpJTBBbWFzayUyMCUzRCUyMG5wLnplcm9zKCg3NjglMkMlMjA3NjgpJTJDJTIwZHR5cGUlM0RucC5mbG9hdDMyKSUwQSUyMyUyMG1hc2slMjBhcmVhJTIwYWJvdmUlMjBjYXQncyUyMGhlYWQlMEFtYXNrJTVCJTNBMjUwJTJDJTIwMjUwJTNBLTI1MCU1RCUyMCUzRCUyMDElMEFwcm9tcHQlMjAlM0QlMjAlMjJhJTIwaGF0JTIyJTBBJTBBb3V0cHV0X2ltYWdlJTIwJTNEJTIwcGlwZShwcm9tcHQlM0Rwcm9tcHQlMkMlMjBpbWFnZSUzRG9yaWdpbmFsX2ltYWdlJTJDJTIwbWFza19pbWFnZSUzRG1hc2spLmltYWdlcyU1QjAlNUQlMEFtYXNrJTIwJTNEJTIwSW1hZ2UuZnJvbWFycmF5KChtYXNrKjI1NSkuYXN0eXBlKCd1aW50OCcpJTJDJTIwJ0wnKSUwQW1ha2VfaW1hZ2VfZ3JpZCglNUJpbml0X2ltYWdlJTJDJTIwbWFzayUyQyUyMG91dHB1dF9pbWFnZSU1RCUyQyUyMHJvd3MlM0QxJTJDJTIwY29scyUzRDMp",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
<span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> AutoPipelineForInpainting
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image, make_image_grid

pipe = AutoPipelineForInpainting.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-2-decoder-inpaint&quot;</span>, torch_dtype=torch.float16)
pipe.enable_model_cpu_offload()

init_image = load_image(<span class="hljs-string">&quot;https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/kandinsky/cat.png&quot;</span>)
mask = np.zeros((<span class="hljs-number">768</span>, <span class="hljs-number">768</span>), dtype=np.float32)
<span class="hljs-comment"># mask area above 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">1</span>
prompt = <span class="hljs-string">&quot;a hat&quot;</span>

output_image = pipe(prompt=prompt, image=original_image, mask_image=mask).images[<span class="hljs-number">0</span>]
mask = Image.fromarray((mask*<span class="hljs-number">255</span>).astype(<span class="hljs-string">&#x27;uint8&#x27;</span>), <span class="hljs-string">&#x27;L&#x27;</span>)
make_image_grid([init_image, mask, output_image], rows=<span class="hljs-number">1</span>, cols=<span class="hljs-number">3</span>)`,wrap:!1}}),{c(){y(t.$$.fragment)},l(s){u(t.$$.fragment,s)},m(s,d){M(t,s,d),m=!0},p:$,i(s){m||(f(t.$$.fragment,s),m=!0)},o(s){h(t.$$.fragment,s),m=!1},d(s){b(t,s)}}}function Qn(g){let t,m,s,d;return t=new j({props:{id:"inpaint",option:"Kandinsky 2.1",$$slots:{default:[Cn]},$$scope:{ctx:g}}}),s=new j({props:{id:"inpaint",option:"Kandinsky 2.2",$$slots:{default:[Yn]},$$scope:{ctx:g}}}),{c(){y(t.$$.fragment),m=o(),y(s.$$.fragment)},l(l){u(t.$$.fragment,l),m=c(l),u(s.$$.fragment,l)},m(l,n){M(t,l,n),p(l,m,n),M(s,l,n),d=!0},p(l,n){const r={};n&2&&(r.$$scope={dirty:n,ctx:l}),t.$set(r);const J={};n&2&&(J.$$scope={dirty:n,ctx:l}),s.$set(J)},i(l){d||(f(t.$$.fragment,l),f(s.$$.fragment,l),d=!0)},o(l){h(t.$$.fragment,l),h(s.$$.fragment,l),d=!1},d(l){l&&i(m),b(t,l),b(s,l)}}}function Hn(g){let t,m;return t=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEthbmRpbnNreVByaW9yUGlwZWxpbmUlMkMlMjBLYW5kaW5za3lQaXBlbGluZSUwQWZyb20lMjBkaWZmdXNlcnMudXRpbHMlMjBpbXBvcnQlMjBsb2FkX2ltYWdlJTJDJTIwbWFrZV9pbWFnZV9ncmlkJTBBaW1wb3J0JTIwdG9yY2glMEElMEFwcmlvcl9waXBlbGluZSUyMCUzRCUyMEthbmRpbnNreVByaW9yUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMi0xLXByaW9yJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTIwdXNlX3NhZmV0ZW5zb3JzJTNEVHJ1ZSkudG8oJTIyY3VkYSUyMiklMEFpbWdfMSUyMCUzRCUyMGxvYWRfaW1hZ2UoJTIyaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRmRhdGFzZXRzJTJGaGYtaW50ZXJuYWwtdGVzdGluZyUyRmRpZmZ1c2Vycy1pbWFnZXMlMkZyZXNvbHZlJTJGbWFpbiUyRmthbmRpbnNreSUyRmNhdC5wbmclMjIpJTBBaW1nXzIlMjAlM0QlMjBsb2FkX2ltYWdlKCUyMmh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZkYXRhc2V0cyUyRmhmLWludGVybmFsLXRlc3RpbmclMkZkaWZmdXNlcnMtaW1hZ2VzJTJGcmVzb2x2ZSUyRm1haW4lMkZrYW5kaW5za3klMkZzdGFycnlfbmlnaHQuanBlZyUyMiklMEFtYWtlX2ltYWdlX2dyaWQoJTVCaW1nXzEucmVzaXplKCg1MTIlMkM1MTIpKSUyQyUyMGltZ18yLnJlc2l6ZSgoNTEyJTJDNTEyKSklNUQlMkMlMjByb3dzJTNEMSUyQyUyMGNvbHMlM0QyKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> KandinskyPriorPipeline, KandinskyPipeline
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image, make_image_grid
<span class="hljs-keyword">import</span> torch

prior_pipeline = KandinskyPriorPipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-1-prior&quot;</span>, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>).to(<span class="hljs-string">&quot;cuda&quot;</span>)
img_1 = load_image(<span class="hljs-string">&quot;https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/kandinsky/cat.png&quot;</span>)
img_2 = load_image(<span class="hljs-string">&quot;https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/kandinsky/starry_night.jpeg&quot;</span>)
make_image_grid([img_1.resize((<span class="hljs-number">512</span>,<span class="hljs-number">512</span>)), img_2.resize((<span class="hljs-number">512</span>,<span class="hljs-number">512</span>))], rows=<span class="hljs-number">1</span>, cols=<span class="hljs-number">2</span>)`,wrap:!1}}),{c(){y(t.$$.fragment)},l(s){u(t.$$.fragment,s)},m(s,d){M(t,s,d),m=!0},p:$,i(s){m||(f(t.$$.fragment,s),m=!0)},o(s){h(t.$$.fragment,s),m=!1},d(s){b(t,s)}}}function Fn(g){let t,m;return t=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEthbmRpbnNreVYyMlByaW9yUGlwZWxpbmUlMkMlMjBLYW5kaW5za3lWMjJQaXBlbGluZSUwQWZyb20lMjBkaWZmdXNlcnMudXRpbHMlMjBpbXBvcnQlMjBsb2FkX2ltYWdlJTJDJTIwbWFrZV9pbWFnZV9ncmlkJTBBaW1wb3J0JTIwdG9yY2glMEElMEFwcmlvcl9waXBlbGluZSUyMCUzRCUyMEthbmRpbnNreVYyMlByaW9yUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMi0yLXByaW9yJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTIwdXNlX3NhZmV0ZW5zb3JzJTNEVHJ1ZSkudG8oJTIyY3VkYSUyMiklMEFpbWdfMSUyMCUzRCUyMGxvYWRfaW1hZ2UoJTIyaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRmRhdGFzZXRzJTJGaGYtaW50ZXJuYWwtdGVzdGluZyUyRmRpZmZ1c2Vycy1pbWFnZXMlMkZyZXNvbHZlJTJGbWFpbiUyRmthbmRpbnNreSUyRmNhdC5wbmclMjIpJTBBaW1nXzIlMjAlM0QlMjBsb2FkX2ltYWdlKCUyMmh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZkYXRhc2V0cyUyRmhmLWludGVybmFsLXRlc3RpbmclMkZkaWZmdXNlcnMtaW1hZ2VzJTJGcmVzb2x2ZSUyRm1haW4lMkZrYW5kaW5za3klMkZzdGFycnlfbmlnaHQuanBlZyUyMiklMEFtYWtlX2ltYWdlX2dyaWQoJTVCaW1nXzEucmVzaXplKCg1MTIlMkM1MTIpKSUyQyUyMGltZ18yLnJlc2l6ZSgoNTEyJTJDNTEyKSklNUQlMkMlMjByb3dzJTNEMSUyQyUyMGNvbHMlM0QyKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> KandinskyV22PriorPipeline, KandinskyV22Pipeline
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image, make_image_grid
<span class="hljs-keyword">import</span> torch

prior_pipeline = KandinskyV22PriorPipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-2-prior&quot;</span>, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>).to(<span class="hljs-string">&quot;cuda&quot;</span>)
img_1 = load_image(<span class="hljs-string">&quot;https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/kandinsky/cat.png&quot;</span>)
img_2 = load_image(<span class="hljs-string">&quot;https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/kandinsky/starry_night.jpeg&quot;</span>)
make_image_grid([img_1.resize((<span class="hljs-number">512</span>,<span class="hljs-number">512</span>)), img_2.resize((<span class="hljs-number">512</span>,<span class="hljs-number">512</span>))], rows=<span class="hljs-number">1</span>, cols=<span class="hljs-number">2</span>)`,wrap:!1}}),{c(){y(t.$$.fragment)},l(s){u(t.$$.fragment,s)},m(s,d){M(t,s,d),m=!0},p:$,i(s){m||(f(t.$$.fragment,s),m=!0)},o(s){h(t.$$.fragment,s),m=!1},d(s){b(t,s)}}}function Nn(g){let t,m,s,d;return t=new j({props:{id:"interpolate",option:"Kandinsky 2.1",$$slots:{default:[Hn]},$$scope:{ctx:g}}}),s=new j({props:{id:"interpolate",option:"Kandinsky 2.2",$$slots:{default:[Fn]},$$scope:{ctx:g}}}),{c(){y(t.$$.fragment),m=o(),y(s.$$.fragment)},l(l){u(t.$$.fragment,l),m=c(l),u(s.$$.fragment,l)},m(l,n){M(t,l,n),p(l,m,n),M(s,l,n),d=!0},p(l,n){const r={};n&2&&(r.$$scope={dirty:n,ctx:l}),t.$set(r);const J={};n&2&&(J.$$scope={dirty:n,ctx:l}),s.$set(J)},i(l){d||(f(t.$$.fragment,l),f(s.$$.fragment,l),d=!0)},o(l){h(t.$$.fragment,l),h(s.$$.fragment,l),d=!1},d(l){l&&i(m),b(t,l),b(s,l)}}}function Sn(g){let t,m,s,d='<img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/kandinsky-docs/starry_cat.png"/>',l;return t=new T({props:{code:"JTIzJTIwcHJvbXB0JTIwY2FuJTIwYmUlMjBsZWZ0JTIwZW1wdHklMEFwcm9tcHQlMjAlM0QlMjAlMjIlMjIlMEFwcmlvcl9vdXQlMjAlM0QlMjBwcmlvcl9waXBlbGluZS5pbnRlcnBvbGF0ZShpbWFnZXNfdGV4dHMlMkMlMjB3ZWlnaHRzKSUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwS2FuZGluc2t5UGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMi0xJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTIwdXNlX3NhZmV0ZW5zb3JzJTNEVHJ1ZSkudG8oJTIyY3VkYSUyMiklMEElMEFpbWFnZSUyMCUzRCUyMHBpcGVsaW5lKHByb21wdCUyQyUyMCoqcHJpb3Jfb3V0JTJDJTIwaGVpZ2h0JTNENzY4JTJDJTIwd2lkdGglM0Q3NjgpLmltYWdlcyU1QjAlNUQlMEFpbWFnZQ==",highlighted:`<span class="hljs-comment"># prompt can be left empty</span>
prompt = <span class="hljs-string">&quot;&quot;</span>
prior_out = prior_pipeline.interpolate(images_texts, weights)

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

image = pipeline(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`,wrap:!1}}),{c(){y(t.$$.fragment),m=o(),s=w("div"),s.innerHTML=d,this.h()},l(n){u(t.$$.fragment,n),m=c(n),s=Z(n,"DIV",{class:!0,"data-svelte-h":!0}),U(s)!=="svelte-twgci5"&&(s.innerHTML=d),this.h()},h(){I(s,"class","flex justify-center")},m(n,r){M(t,n,r),p(n,m,r),p(n,s,r),l=!0},p:$,i(n){l||(f(t.$$.fragment,n),l=!0)},o(n){h(t.$$.fragment,n),l=!1},d(n){n&&(i(m),i(s)),b(t,n)}}}function zn(g){let t,m,s,d='<img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/kandinskyv22-interpolate.png"/>',l;return t=new T({props:{code:"JTIzJTIwcHJvbXB0JTIwY2FuJTIwYmUlMjBsZWZ0JTIwZW1wdHklMEFwcm9tcHQlMjAlM0QlMjAlMjIlMjIlMEFwcmlvcl9vdXQlMjAlM0QlMjBwcmlvcl9waXBlbGluZS5pbnRlcnBvbGF0ZShpbWFnZXNfdGV4dHMlMkMlMjB3ZWlnaHRzKSUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwS2FuZGluc2t5VjIyUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMi0yLWRlY29kZXIlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMjB1c2Vfc2FmZXRlbnNvcnMlM0RUcnVlKS50byglMjJjdWRhJTIyKSUwQSUwQWltYWdlJTIwJTNEJTIwcGlwZWxpbmUocHJvbXB0JTJDJTIwKipwcmlvcl9vdXQlMkMlMjBoZWlnaHQlM0Q3NjglMkMlMjB3aWR0aCUzRDc2OCkuaW1hZ2VzJTVCMCU1RCUwQWltYWdl",highlighted:`<span class="hljs-comment"># prompt can be left empty</span>
prompt = <span class="hljs-string">&quot;&quot;</span>
prior_out = prior_pipeline.interpolate(images_texts, weights)

pipeline = KandinskyV22Pipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-2-decoder&quot;</span>, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>).to(<span class="hljs-string">&quot;cuda&quot;</span>)

image = pipeline(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`,wrap:!1}}),{c(){y(t.$$.fragment),m=o(),s=w("div"),s.innerHTML=d,this.h()},l(n){u(t.$$.fragment,n),m=c(n),s=Z(n,"DIV",{class:!0,"data-svelte-h":!0}),U(s)!=="svelte-2ur4ou"&&(s.innerHTML=d),this.h()},h(){I(s,"class","flex justify-center")},m(n,r){M(t,n,r),p(n,m,r),p(n,s,r),l=!0},p:$,i(n){l||(f(t.$$.fragment,n),l=!0)},o(n){h(t.$$.fragment,n),l=!1},d(n){n&&(i(m),i(s)),b(t,n)}}}function xn(g){let t,m,s,d;return t=new j({props:{id:"interpolate",option:"Kandinsky 2.1",$$slots:{default:[Sn]},$$scope:{ctx:g}}}),s=new j({props:{id:"interpolate",option:"Kandinsky 2.2",$$slots:{default:[zn]},$$scope:{ctx:g}}}),{c(){y(t.$$.fragment),m=o(),y(s.$$.fragment)},l(l){u(t.$$.fragment,l),m=c(l),u(s.$$.fragment,l)},m(l,n){M(t,l,n),p(l,m,n),M(s,l,n),d=!0},p(l,n){const r={};n&2&&(r.$$scope={dirty:n,ctx:l}),t.$set(r);const J={};n&2&&(J.$$scope={dirty:n,ctx:l}),s.$set(J)},i(l){d||(f(t.$$.fragment,l),f(s.$$.fragment,l),d=!0)},o(l){h(t.$$.fragment,l),h(s.$$.fragment,l),d=!1},d(l){l&&i(m),b(t,l),b(s,l)}}}function En(g){let t,m,s,d,l,n,r,J,G,W,k,V="The Kandinsky models are a series of multilingual text-to-image generation models. The Kandinsky 2.0 model uses two multilingual text encoders and concatenates those results for the UNet.",hs,se,sl='<a href="../api/pipelines/kandinsky">Kandinsky 2.1</a> changes the architecture to include an image prior model (<a href="https://huggingface.co/docs/transformers/model_doc/clip" rel="nofollow"><code>CLIP</code></a>) to generate a mapping between text and image embeddings. The mapping provides better text-image alignment and it is used with the text embeddings during training, leading to higher quality results. Finally, Kandinsky 2.1 uses a <a href="https://huggingface.co/papers/2209.09002" rel="nofollow">Modulating Quantized Vectors (MoVQ)</a> decoder - which adds a spatial conditional normalization layer to increase photorealism - to decode the latents into images.',bs,te,tl='<a href="../api/pipelines/kandinsky_v22">Kandinsky 2.2</a> improves on the previous model by replacing the image encoder of the image prior model with a larger CLIP-ViT-G model to improve quality. The image prior model was also retrained on images with different resolutions and aspect ratios to generate higher-resolution images and different image sizes.',Js,le,ll='<a href="../api/pipelines/kandinsky3">Kandinsky 3</a> simplifies the architecture and shifts away from the two-stage generation process involving the prior model and diffusion model. Instead, Kandinsky 3 uses <a href="https://huggingface.co/google/flan-ul2" rel="nofollow">Flan-UL2</a> to encode text, a UNet with <a href="https://hf.co/papers/1809.11096" rel="nofollow">BigGan-deep</a> blocks, and <a href="https://github.com/ai-forever/MoVQGAN" rel="nofollow">Sber-MoVQGAN</a> to decode the latents into images. Text understanding and generated image quality are primarily achieved by using a larger text encoder and UNet.',gs,ne,nl="This guide will show you how to use the Kandinsky models for text-to-image, image-to-image, inpainting, interpolation, and more.",ks,ae,al="Before you begin, make sure you have the following libraries installed:",ws,ie,Zs,X,il='<p>Kandinsky 2.1 and 2.2 usage is very similar! The only difference is Kandinsky 2.2 doesn’t accept <code>prompt</code> as an input when decoding the latents. Instead, Kandinsky 2.2 only accepts <code>image_embeds</code> during decoding.</p> <br/> <p>Kandinsky 3 has a more concise architecture and it doesn’t require a prior model. This means it’s usage is identical to other diffusion models like <a href="sdxl">Stable Diffusion XL</a>.</p>',Us,pe,Ts,me,pl="To use the Kandinsky models for any task, you always start by setting up the prior pipeline to encode the prompt and generate the image embeddings. The prior pipeline also generates <code>negative_image_embeds</code> that correspond to the negative prompt <code>&quot;&quot;</code>. For better results, you can pass an actual <code>negative_prompt</code> to the prior pipeline, but this’ll increase the effective batch size of the prior pipeline by 2x.",Ws,R,js,re,ml='🤗 Diffusers also provides an end-to-end API with the <a href="/docs/diffusers/main/en/api/pipelines/kandinsky#diffusers.KandinskyCombinedPipeline">KandinskyCombinedPipeline</a> and <a href="/docs/diffusers/main/en/api/pipelines/kandinsky_v22#diffusers.KandinskyV22CombinedPipeline">KandinskyV22CombinedPipeline</a>, meaning you don’t have to separately load the prior and text-to-image pipeline. The combined pipeline automatically loads both the prior model and the decoder. You can still set different values for the prior pipeline with the <code>prior_guidance_scale</code> and <code>prior_num_inference_steps</code> parameters if you want.',$s,oe,rl='Use the <a href="/docs/diffusers/main/en/api/pipelines/auto_pipeline#diffusers.AutoPipelineForText2Image">AutoPipelineForText2Image</a> to automatically call the combined pipelines under the hood:',Gs,C,Is,ce,Vs,de,ol="For image-to-image, pass the initial image and text prompt to condition the image to the pipeline. Start by loading the prior pipeline:",Bs,Y,_s,ye,cl="Download an image to condition on:",vs,ue,Xs,Q,dl='<img class="rounded-xl" src="https://raw.githubusercontent.com/CompVis/stable-diffusion/main/assets/stable-samples/img2img/sketch-mountains-input.jpg"/>',Rs,Me,yl="Generate the <code>image_embeds</code> and <code>negative_image_embeds</code> with the prior pipeline:",Cs,fe,Ys,he,ul="Now pass the original image, and all the prompts and embeddings to the pipeline to generate an image:",Qs,H,Hs,be,Ml='🤗 Diffusers also provides an end-to-end API with the <a href="/docs/diffusers/main/en/api/pipelines/kandinsky#diffusers.KandinskyImg2ImgCombinedPipeline">KandinskyImg2ImgCombinedPipeline</a> and <a href="/docs/diffusers/main/en/api/pipelines/kandinsky_v22#diffusers.KandinskyV22Img2ImgCombinedPipeline">KandinskyV22Img2ImgCombinedPipeline</a>, meaning you don’t have to separately load the prior and image-to-image pipeline. The combined pipeline automatically loads both the prior model and the decoder. You can still set different values for the prior pipeline with the <code>prior_guidance_scale</code> and <code>prior_num_inference_steps</code> parameters if you want.',Fs,Je,fl='Use the <a href="/docs/diffusers/main/en/api/pipelines/auto_pipeline#diffusers.AutoPipelineForImage2Image">AutoPipelineForImage2Image</a> to automatically call the combined pipelines under the hood:',Ns,F,Ss,ge,zs,_,Ms,hl='⚠️ The Kandinsky models use ⬜️ <strong>white pixels</strong> to represent the masked area now instead of black pixels. If you are using <a href="/docs/diffusers/main/en/api/pipelines/kandinsky#diffusers.KandinskyInpaintPipeline">KandinskyInpaintPipeline</a> in production, you need to change the mask to use white pixels:',At,ke,xs,we,bl="For inpainting, you’ll need the original image, a mask of the area to replace in the original image, and a text prompt of what to inpaint. Load the prior pipeline:",Es,N,Ks,Ze,Jl="Load an initial image and create a mask:",qs,Ue,Ls,Te,gl="Generate the embeddings with the prior pipeline:",Ds,We,Ps,je,kl="Now pass the initial image, mask, and prompt and embeddings to the pipeline to generate an image:",As,S,Os,$e,wl='You can also use the end-to-end <a href="/docs/diffusers/main/en/api/pipelines/kandinsky#diffusers.KandinskyInpaintCombinedPipeline">KandinskyInpaintCombinedPipeline</a> and <a href="/docs/diffusers/main/en/api/pipelines/kandinsky_v22#diffusers.KandinskyV22InpaintCombinedPipeline">KandinskyV22InpaintCombinedPipeline</a> to call the prior and decoder pipelines together under the hood. Use the <a href="/docs/diffusers/main/en/api/pipelines/auto_pipeline#diffusers.AutoPipelineForInpainting">AutoPipelineForInpainting</a> for this:',et,z,st,Ge,tt,Ie,Zl="Interpolation allows you to explore the latent space between the image and text embeddings which is a cool way to see some of the prior model’s intermediate outputs. Load the prior pipeline and two images you’d like to interpolate:",lt,x,nt,E,Ul='<div><img class="rounded-xl" src="https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/kandinsky/cat.png"/> <figcaption class="mt-2 text-center text-sm text-gray-500">a cat</figcaption></div> <div><img class="rounded-xl" src="https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/kandinsky/starry_night.jpeg"/> <figcaption class="mt-2 text-center text-sm text-gray-500">Van Gogh&#39;s Starry Night painting</figcaption></div>',at,Ve,Tl="Specify the text or images to interpolate, and set the weights for each text or image. Experiment with the weights to see how they affect the interpolation!",it,Be,pt,_e,Wl="Call the <code>interpolate</code> function to generate the embeddings, and then pass them to the pipeline to generate the image:",mt,K,rt,ve,ot,q,jl="<p>⚠️ ControlNet is only supported for Kandinsky 2.2!</p>",ct,Xe,$l="ControlNet enables conditioning large pretrained diffusion models with additional inputs such as a depth map or edge detection. For example, you can condition Kandinsky 2.2 with a depth map so the model understands and preserves the structure of the depth image.",dt,Re,Gl="Let’s load an image and extract it’s depth map:",yt,Ce,ut,L,Il='<img class="rounded-xl" src="https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/kandinskyv22/cat.png"/>',Mt,Ye,Vl='Then you can use the <code>depth-estimation</code> <a href="https://huggingface.co/docs/transformers/main/en/main_classes/pipelines#transformers.Pipeline" rel="nofollow">Pipeline</a> from 🤗 Transformers to process the image and retrieve the depth map:',ft,Qe,ht,He,bt,Fe,Bl='Load the prior pipeline and the <a href="/docs/diffusers/main/en/api/pipelines/kandinsky_v22#diffusers.KandinskyV22ControlnetPipeline">KandinskyV22ControlnetPipeline</a>:',Jt,Ne,gt,Se,_l="Generate the image embeddings from a prompt and negative prompt:",kt,ze,wt,xe,vl='Finally, pass the image embeddings and the depth image to the <a href="/docs/diffusers/main/en/api/pipelines/kandinsky_v22#diffusers.KandinskyV22ControlnetPipeline">KandinskyV22ControlnetPipeline</a> to generate an image:',Zt,Ee,Ut,D,Xl='<img class="rounded-xl" src="https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/kandinskyv22/robot_cat_text2img.png"/>',Tt,Ke,Wt,qe,Rl="For image-to-image with ControlNet, you’ll need to use the:",jt,Le,Cl='<li><a href="/docs/diffusers/main/en/api/pipelines/kandinsky_v22#diffusers.KandinskyV22PriorEmb2EmbPipeline">KandinskyV22PriorEmb2EmbPipeline</a> to generate the image embeddings from a text prompt and an image</li> <li><a href="/docs/diffusers/main/en/api/pipelines/kandinsky_v22#diffusers.KandinskyV22ControlnetImg2ImgPipeline">KandinskyV22ControlnetImg2ImgPipeline</a> to generate an image from the initial image and the image embeddings</li>',$t,De,Yl='Process and extract a depth map of an initial image of a cat with the <code>depth-estimation</code> <a href="https://huggingface.co/docs/transformers/main/en/main_classes/pipelines#transformers.Pipeline" rel="nofollow">Pipeline</a> from 🤗 Transformers:',Gt,Pe,It,Ae,Ql='Load the prior pipeline and the <a href="/docs/diffusers/main/en/api/pipelines/kandinsky_v22#diffusers.KandinskyV22ControlnetImg2ImgPipeline">KandinskyV22ControlnetImg2ImgPipeline</a>:',Vt,Oe,Bt,es,Hl="Pass a text prompt and the initial image to the prior pipeline to generate the image embeddings:",_t,ss,vt,ts,Fl='Now you can run the <a href="/docs/diffusers/main/en/api/pipelines/kandinsky_v22#diffusers.KandinskyV22ControlnetImg2ImgPipeline">KandinskyV22ControlnetImg2ImgPipeline</a> to generate an image from the initial image and the image embeddings:',Xt,ls,Rt,P,Nl='<img class="rounded-xl" src="https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/kandinskyv22/robot_cat.png"/>',Ct,ns,Yt,as,Sl="Kandinsky is unique because it requires a prior pipeline to generate the mappings, and a second pipeline to decode the latents into an image. Optimization efforts should be focused on the second pipeline because that is where the bulk of the computation is done. Here are some tips to improve Kandinsky during inference.",Qt,is,zl='<li>Enable <a href="../optimization/xformers">xFormers</a> if you’re using PyTorch &lt; 2.0:</li>',Ht,ps,Ft,A,xl="<li>Enable <code>torch.compile</code> if you’re using PyTorch &gt;= 2.0 to automatically use scaled dot-product attention (SDPA):</li>",Nt,ms,St,rs,El='This is the same as explicitly setting the attention processor to use <a href="/docs/diffusers/main/en/api/attnprocessor#diffusers.models.attention_processor.AttnAddedKVProcessor2_0">AttnAddedKVProcessor2_0</a>:',zt,os,xt,O,Kl='<li>Offload the model to the CPU with <a href="/docs/diffusers/main/en/api/pipelines/overview#diffusers.DiffusionPipeline.enable_model_cpu_offload">enable_model_cpu_offload()</a> to avoid out-of-memory errors:</li>',Et,cs,Kt,ee,ql='<li>By default, the text-to-image pipeline uses the <a href="/docs/diffusers/main/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a> but you can replace it with another scheduler like <a href="/docs/diffusers/main/en/api/schedulers/ddpm#diffusers.DDPMScheduler">DDPMScheduler</a> to see how that affects the tradeoff between inference speed and image quality:</li>',qt,ds,Lt,ys,Dt,fs,Pt;return l=new on({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),r=new cn({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;",options:[{label:"Mixed",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers_doc/en/kandinsky.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers_doc/en/pytorch/kandinsky.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/diffusers_doc/en/tensorflow/kandinsky.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/en/kandinsky.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/en/pytorch/kandinsky.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/diffusers_doc/en/tensorflow/kandinsky.ipynb"}]}}),G=new v({props:{title:"Kandinsky",local:"kandinsky",headingTag:"h1"}}),ie=new T({props:{code:"JTIzJTIwdW5jb21tZW50JTIwdG8lMjBpbnN0YWxsJTIwdGhlJTIwbmVjZXNzYXJ5JTIwbGlicmFyaWVzJTIwaW4lMjBDb2xhYiUwQSUyMyFwaXAlMjBpbnN0YWxsJTIwLXElMjBkaWZmdXNlcnMlMjB0cmFuc2Zvcm1lcnMlMjBhY2NlbGVyYXRl",highlighted:`<span class="hljs-comment"># uncomment to install the necessary libraries in Colab</span>
<span class="hljs-comment">#!pip install -q diffusers transformers accelerate</span>`,wrap:!1}}),pe=new v({props:{title:"Text-to-image",local:"text-to-image",headingTag:"h2"}}),R=new B({props:{id:"text-to-image",options:["Kandinsky 2.1","Kandinsky 2.2","Kandinsky 3"],$$slots:{default:[fn]},$$scope:{ctx:g}}}),C=new B({props:{id:"text-to-image",options:["Kandinsky 2.1","Kandinsky 2.2"],$$slots:{default:[Jn]},$$scope:{ctx:g}}}),ce=new v({props:{title:"Image-to-image",local:"image-to-image",headingTag:"h2"}}),Y=new B({props:{id:"image-to-image",options:["Kandinsky 2.1","Kandinsky 2.2","Kandinsky 3"],$$slots:{default:[Zn]},$$scope:{ctx:g}}}),ue=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2Vycy51dGlscyUyMGltcG9ydCUyMGxvYWRfaW1hZ2UlMEElMEElMjMlMjBkb3dubG9hZCUyMGltYWdlJTBBdXJsJTIwJTNEJTIwJTIyaHR0cHMlM0ElMkYlMkZyYXcuZ2l0aHVidXNlcmNvbnRlbnQuY29tJTJGQ29tcFZpcyUyRnN0YWJsZS1kaWZmdXNpb24lMkZtYWluJTJGYXNzZXRzJTJGc3RhYmxlLXNhbXBsZXMlMkZpbWcyaW1nJTJGc2tldGNoLW1vdW50YWlucy1pbnB1dC5qcGclMjIlMEFvcmlnaW5hbF9pbWFnZSUyMCUzRCUyMGxvYWRfaW1hZ2UodXJsKSUwQW9yaWdpbmFsX2ltYWdlJTIwJTNEJTIwb3JpZ2luYWxfaW1hZ2UucmVzaXplKCg3NjglMkMlMjA1MTIpKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image

<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>
original_image = load_image(url)
original_image = original_image.resize((<span class="hljs-number">768</span>, <span class="hljs-number">512</span>))`,wrap:!1}}),fe=new T({props:{code:"cHJvbXB0JTIwJTNEJTIwJTIyQSUyMGZhbnRhc3klMjBsYW5kc2NhcGUlMkMlMjBDaW5lbWF0aWMlMjBsaWdodGluZyUyMiUwQW5lZ2F0aXZlX3Byb21wdCUyMCUzRCUyMCUyMmxvdyUyMHF1YWxpdHklMkMlMjBiYWQlMjBxdWFsaXR5JTIyJTBBJTBBaW1hZ2VfZW1iZWRzJTJDJTIwbmVnYXRpdmVfaW1hZ2VfZW1iZWRzJTIwJTNEJTIwcHJpb3JfcGlwZWxpbmUocHJvbXB0JTJDJTIwbmVnYXRpdmVfcHJvbXB0KS50b190dXBsZSgp",highlighted:`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>

image_embeds, negative_image_embeds = prior_pipeline(prompt, negative_prompt).to_tuple()`,wrap:!1}}),H=new B({props:{id:"image-to-image",options:["Kandinsky 2.1","Kandinsky 2.2","Kandinsky 3"],$$slots:{default:[jn]},$$scope:{ctx:g}}}),F=new B({props:{id:"image-to-image",options:["Kandinsky 2.1","Kandinsky 2.2"],$$slots:{default:[In]},$$scope:{ctx:g}}}),ge=new v({props:{title:"Inpainting",local:"inpainting",headingTag:"h2"}}),ke=new T({props:{code:"JTIzJTIwRm9yJTIwUElMJTIwaW5wdXQlMEFpbXBvcnQlMjBQSUwuSW1hZ2VPcHMlMEFtYXNrJTIwJTNEJTIwUElMLkltYWdlT3BzLmludmVydChtYXNrKSUwQSUwQSUyMyUyMEZvciUyMFB5VG9yY2glMjBhbmQlMjBOdW1QeSUyMGlucHV0JTBBbWFzayUyMCUzRCUyMDElMjAtJTIwbWFzaw==",highlighted:`<span class="hljs-comment"># For PIL input</span>
<span class="hljs-keyword">import</span> PIL.ImageOps
mask = PIL.ImageOps.invert(mask)

<span class="hljs-comment"># For PyTorch and NumPy input</span>
mask = <span class="hljs-number">1</span> - mask`,wrap:!1}}),N=new B({props:{id:"inpaint",options:["Kandinsky 2.1","Kandinsky 2.2"],$$slots:{default:[_n]},$$scope:{ctx:g}}}),Ue=new T({props:{code:"aW5pdF9pbWFnZSUyMCUzRCUyMGxvYWRfaW1hZ2UoJTIyaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRmRhdGFzZXRzJTJGaGYtaW50ZXJuYWwtdGVzdGluZyUyRmRpZmZ1c2Vycy1pbWFnZXMlMkZyZXNvbHZlJTJGbWFpbiUyRmthbmRpbnNreSUyRmNhdC5wbmclMjIpJTBBbWFzayUyMCUzRCUyMG5wLnplcm9zKCg3NjglMkMlMjA3NjgpJTJDJTIwZHR5cGUlM0RucC5mbG9hdDMyKSUwQSUyMyUyMG1hc2slMjBhcmVhJTIwYWJvdmUlMjBjYXQncyUyMGhlYWQlMEFtYXNrJTVCJTNBMjUwJTJDJTIwMjUwJTNBLTI1MCU1RCUyMCUzRCUyMDE=",highlighted:`init_image = load_image(<span class="hljs-string">&quot;https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/kandinsky/cat.png&quot;</span>)
mask = np.zeros((<span class="hljs-number">768</span>, <span class="hljs-number">768</span>), dtype=np.float32)
<span class="hljs-comment"># mask area above 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">1</span>`,wrap:!1}}),We=new T({props:{code:"cHJvbXB0JTIwJTNEJTIwJTIyYSUyMGhhdCUyMiUwQXByaW9yX291dHB1dCUyMCUzRCUyMHByaW9yX3BpcGVsaW5lKHByb21wdCk=",highlighted:`prompt = <span class="hljs-string">&quot;a hat&quot;</span>
prior_output = prior_pipeline(prompt)`,wrap:!1}}),S=new B({props:{id:"inpaint",options:["Kandinsky 2.1","Kandinsky 2.2"],$$slots:{default:[Rn]},$$scope:{ctx:g}}}),z=new B({props:{id:"inpaint",options:["Kandinsky 2.1","Kandinsky 2.2"],$$slots:{default:[Qn]},$$scope:{ctx:g}}}),Ge=new v({props:{title:"Interpolation",local:"interpolation",headingTag:"h2"}}),x=new B({props:{id:"interpolate",options:["Kandinsky 2.1","Kandinsky 2.2"],$$slots:{default:[Nn]},$$scope:{ctx:g}}}),Be=new T({props:{code:"aW1hZ2VzX3RleHRzJTIwJTNEJTIwJTVCJTIyYSUyMGNhdCUyMiUyQyUyMGltZ18xJTJDJTIwaW1nXzIlNUQlMEF3ZWlnaHRzJTIwJTNEJTIwJTVCMC4zJTJDJTIwMC4zJTJDJTIwMC40JTVE",highlighted:`images_texts = [<span class="hljs-string">&quot;a cat&quot;</span>, img_1, img_2]
weights = [<span class="hljs-number">0.3</span>, <span class="hljs-number">0.3</span>, <span class="hljs-number">0.4</span>]`,wrap:!1}}),K=new B({props:{id:"interpolate",options:["Kandinsky 2.1","Kandinsky 2.2"],$$slots:{default:[xn]},$$scope:{ctx:g}}}),ve=new v({props:{title:"ControlNet",local:"controlnet",headingTag:"h2"}}),Ce=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2Vycy51dGlscyUyMGltcG9ydCUyMGxvYWRfaW1hZ2UlMEElMEFpbWclMjAlM0QlMjBsb2FkX2ltYWdlKCUwQSUyMCUyMCUyMCUyMCUyMmh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZkYXRhc2V0cyUyRmhmLWludGVybmFsLXRlc3RpbmclMkZkaWZmdXNlcnMtaW1hZ2VzJTJGcmVzb2x2ZSUyRm1haW4lMkZrYW5kaW5za3l2MjIlMkZjYXQucG5nJTIyJTBBKS5yZXNpemUoKDc2OCUyQyUyMDc2OCkpJTBBaW1n",highlighted:`<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image

img = load_image(
    <span class="hljs-string">&quot;https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/kandinskyv22/cat.png&quot;</span>
).resize((<span class="hljs-number">768</span>, <span class="hljs-number">768</span>))
img`,wrap:!1}}),Qe=new T({props:{code:"aW1wb3J0JTIwdG9yY2glMEFpbXBvcnQlMjBudW1weSUyMGFzJTIwbnAlMEElMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwcGlwZWxpbmUlMEElMEFkZWYlMjBtYWtlX2hpbnQoaW1hZ2UlMkMlMjBkZXB0aF9lc3RpbWF0b3IpJTNBJTBBJTIwJTIwJTIwJTIwaW1hZ2UlMjAlM0QlMjBkZXB0aF9lc3RpbWF0b3IoaW1hZ2UpJTVCJTIyZGVwdGglMjIlNUQlMEElMjAlMjAlMjAlMjBpbWFnZSUyMCUzRCUyMG5wLmFycmF5KGltYWdlKSUwQSUyMCUyMCUyMCUyMGltYWdlJTIwJTNEJTIwaW1hZ2UlNUIlM0ElMkMlMjAlM0ElMkMlMjBOb25lJTVEJTBBJTIwJTIwJTIwJTIwaW1hZ2UlMjAlM0QlMjBucC5jb25jYXRlbmF0ZSglNUJpbWFnZSUyQyUyMGltYWdlJTJDJTIwaW1hZ2UlNUQlMkMlMjBheGlzJTNEMiklMEElMjAlMjAlMjAlMjBkZXRlY3RlZF9tYXAlMjAlM0QlMjB0b3JjaC5mcm9tX251bXB5KGltYWdlKS5mbG9hdCgpJTIwJTJGJTIwMjU1LjAlMEElMjAlMjAlMjAlMjBoaW50JTIwJTNEJTIwZGV0ZWN0ZWRfbWFwLnBlcm11dGUoMiUyQyUyMDAlMkMlMjAxKSUwQSUyMCUyMCUyMCUyMHJldHVybiUyMGhpbnQlMEElMEFkZXB0aF9lc3RpbWF0b3IlMjAlM0QlMjBwaXBlbGluZSglMjJkZXB0aC1lc3RpbWF0aW9uJTIyKSUwQWhpbnQlMjAlM0QlMjBtYWtlX2hpbnQoaW1nJTJDJTIwZGVwdGhfZXN0aW1hdG9yKS51bnNxdWVlemUoMCkuaGFsZigpLnRvKCUyMmN1ZGElMjIp",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np

<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

<span class="hljs-keyword">def</span> <span class="hljs-title function_">make_hint</span>(<span class="hljs-params">image, depth_estimator</span>):
    image = depth_estimator(image)[<span class="hljs-string">&quot;depth&quot;</span>]
    image = np.array(image)
    image = image[:, :, <span class="hljs-literal">None</span>]
    image = np.concatenate([image, image, image], axis=<span class="hljs-number">2</span>)
    detected_map = torch.from_numpy(image).<span class="hljs-built_in">float</span>() / <span class="hljs-number">255.0</span>
    hint = detected_map.permute(<span class="hljs-number">2</span>, <span class="hljs-number">0</span>, <span class="hljs-number">1</span>)
    <span class="hljs-keyword">return</span> hint

depth_estimator = pipeline(<span class="hljs-string">&quot;depth-estimation&quot;</span>)
hint = make_hint(img, depth_estimator).unsqueeze(<span class="hljs-number">0</span>).half().to(<span class="hljs-string">&quot;cuda&quot;</span>)`,wrap:!1}}),He=new v({props:{title:"Text-to-image",local:"controlnet-text-to-image",headingTag:"h3"}}),Ne=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEthbmRpbnNreVYyMlByaW9yUGlwZWxpbmUlMkMlMjBLYW5kaW5za3lWMjJDb250cm9sbmV0UGlwZWxpbmUlMEElMEFwcmlvcl9waXBlbGluZSUyMCUzRCUyMEthbmRpbnNreVYyMlByaW9yUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMi0yLXByaW9yJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTIwdXNlX3NhZmV0ZW5zb3JzJTNEVHJ1ZSUwQSkudG8oJTIyY3VkYSUyMiklMEElMEFwaXBlbGluZSUyMCUzRCUyMEthbmRpbnNreVYyMkNvbnRyb2xuZXRQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIya2FuZGluc2t5LWNvbW11bml0eSUyRmthbmRpbnNreS0yLTItY29udHJvbG5ldC1kZXB0aCUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUwQSkudG8oJTIyY3VkYSUyMik=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> KandinskyV22PriorPipeline, KandinskyV22ControlnetPipeline

prior_pipeline = KandinskyV22PriorPipeline.from_pretrained(
    <span class="hljs-string">&quot;kandinsky-community/kandinsky-2-2-prior&quot;</span>, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>
).to(<span class="hljs-string">&quot;cuda&quot;</span>)

pipeline = KandinskyV22ControlnetPipeline.from_pretrained(
    <span class="hljs-string">&quot;kandinsky-community/kandinsky-2-2-controlnet-depth&quot;</span>, torch_dtype=torch.float16
).to(<span class="hljs-string">&quot;cuda&quot;</span>)`,wrap:!1}}),ze=new T({props:{code:"cHJvbXB0JTIwJTNEJTIwJTIyQSUyMHJvYm90JTJDJTIwNGslMjBwaG90byUyMiUwQW5lZ2F0aXZlX3ByaW9yX3Byb21wdCUyMCUzRCUyMCUyMmxvd3JlcyUyQyUyMHRleHQlMkMlMjBlcnJvciUyQyUyMGNyb3BwZWQlMkMlMjB3b3JzdCUyMHF1YWxpdHklMkMlMjBsb3clMjBxdWFsaXR5JTJDJTIwanBlZyUyMGFydGlmYWN0cyUyQyUyMHVnbHklMkMlMjBkdXBsaWNhdGUlMkMlMjBtb3JiaWQlMkMlMjBtdXRpbGF0ZWQlMkMlMjBvdXQlMjBvZiUyMGZyYW1lJTJDJTIwZXh0cmElMjBmaW5nZXJzJTJDJTIwbXV0YXRlZCUyMGhhbmRzJTJDJTIwcG9vcmx5JTIwZHJhd24lMjBoYW5kcyUyQyUyMHBvb3JseSUyMGRyYXduJTIwZmFjZSUyQyUyMG11dGF0aW9uJTJDJTIwZGVmb3JtZWQlMkMlMjBibHVycnklMkMlMjBkZWh5ZHJhdGVkJTJDJTIwYmFkJTIwYW5hdG9teSUyQyUyMGJhZCUyMHByb3BvcnRpb25zJTJDJTIwZXh0cmElMjBsaW1icyUyQyUyMGNsb25lZCUyMGZhY2UlMkMlMjBkaXNmaWd1cmVkJTJDJTIwZ3Jvc3MlMjBwcm9wb3J0aW9ucyUyQyUyMG1hbGZvcm1lZCUyMGxpbWJzJTJDJTIwbWlzc2luZyUyMGFybXMlMkMlMjBtaXNzaW5nJTIwbGVncyUyQyUyMGV4dHJhJTIwYXJtcyUyQyUyMGV4dHJhJTIwbGVncyUyQyUyMGZ1c2VkJTIwZmluZ2VycyUyQyUyMHRvbyUyMG1hbnklMjBmaW5nZXJzJTJDJTIwbG9uZyUyMG5lY2slMkMlMjB1c2VybmFtZSUyQyUyMHdhdGVybWFyayUyQyUyMHNpZ25hdHVyZSUyMiUwQSUwQWdlbmVyYXRvciUyMCUzRCUyMHRvcmNoLkdlbmVyYXRvcihkZXZpY2UlM0QlMjJjdWRhJTIyKS5tYW51YWxfc2VlZCg0MyklMEElMEFpbWFnZV9lbWIlMkMlMjB6ZXJvX2ltYWdlX2VtYiUyMCUzRCUyMHByaW9yX3BpcGVsaW5lKCUwQSUyMCUyMCUyMCUyMHByb21wdCUzRHByb21wdCUyQyUyMG5lZ2F0aXZlX3Byb21wdCUzRG5lZ2F0aXZlX3ByaW9yX3Byb21wdCUyQyUyMGdlbmVyYXRvciUzRGdlbmVyYXRvciUwQSkudG9fdHVwbGUoKQ==",highlighted:`prompt = <span class="hljs-string">&quot;A robot, 4k photo&quot;</span>
negative_prior_prompt = <span class="hljs-string">&quot;lowres, text, error, cropped, worst quality, low quality, jpeg artifacts, ugly, duplicate, morbid, mutilated, out of frame, extra fingers, mutated hands, poorly drawn hands, poorly drawn face, mutation, deformed, blurry, dehydrated, bad anatomy, bad proportions, extra limbs, cloned face, disfigured, gross proportions, malformed limbs, missing arms, missing legs, extra arms, extra legs, fused fingers, too many fingers, long neck, username, watermark, signature&quot;</span>

generator = torch.Generator(device=<span class="hljs-string">&quot;cuda&quot;</span>).manual_seed(<span class="hljs-number">43</span>)

image_emb, zero_image_emb = prior_pipeline(
    prompt=prompt, negative_prompt=negative_prior_prompt, generator=generator
).to_tuple()`,wrap:!1}}),Ee=new T({props:{code:"aW1hZ2UlMjAlM0QlMjBwaXBlbGluZShpbWFnZV9lbWJlZHMlM0RpbWFnZV9lbWIlMkMlMjBuZWdhdGl2ZV9pbWFnZV9lbWJlZHMlM0R6ZXJvX2ltYWdlX2VtYiUyQyUyMGhpbnQlM0RoaW50JTJDJTIwbnVtX2luZmVyZW5jZV9zdGVwcyUzRDUwJTJDJTIwZ2VuZXJhdG9yJTNEZ2VuZXJhdG9yJTJDJTIwaGVpZ2h0JTNENzY4JTJDJTIwd2lkdGglM0Q3NjgpLmltYWdlcyU1QjAlNUQlMEFpbWFnZQ==",highlighted:`image = pipeline(image_embeds=image_emb, negative_image_embeds=zero_image_emb, hint=hint, num_inference_steps=<span class="hljs-number">50</span>, generator=generator, height=<span class="hljs-number">768</span>, width=<span class="hljs-number">768</span>).images[<span class="hljs-number">0</span>]
image`,wrap:!1}}),Ke=new v({props:{title:"Image-to-image",local:"controlnet-image-to-image",headingTag:"h3"}}),Pe=new T({props:{code:"aW1wb3J0JTIwdG9yY2glMEFpbXBvcnQlMjBudW1weSUyMGFzJTIwbnAlMEElMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwS2FuZGluc2t5VjIyUHJpb3JFbWIyRW1iUGlwZWxpbmUlMkMlMjBLYW5kaW5za3lWMjJDb250cm9sbmV0SW1nMkltZ1BpcGVsaW5lJTBBZnJvbSUyMGRpZmZ1c2Vycy51dGlscyUyMGltcG9ydCUyMGxvYWRfaW1hZ2UlMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwcGlwZWxpbmUlMEElMEFpbWclMjAlM0QlMjBsb2FkX2ltYWdlKCUwQSUyMCUyMCUyMCUyMCUyMmh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZkYXRhc2V0cyUyRmhmLWludGVybmFsLXRlc3RpbmclMkZkaWZmdXNlcnMtaW1hZ2VzJTJGcmVzb2x2ZSUyRm1haW4lMkZrYW5kaW5za3l2MjIlMkZjYXQucG5nJTIyJTBBKS5yZXNpemUoKDc2OCUyQyUyMDc2OCkpJTBBJTBBZGVmJTIwbWFrZV9oaW50KGltYWdlJTJDJTIwZGVwdGhfZXN0aW1hdG9yKSUzQSUwQSUyMCUyMCUyMCUyMGltYWdlJTIwJTNEJTIwZGVwdGhfZXN0aW1hdG9yKGltYWdlKSU1QiUyMmRlcHRoJTIyJTVEJTBBJTIwJTIwJTIwJTIwaW1hZ2UlMjAlM0QlMjBucC5hcnJheShpbWFnZSklMEElMjAlMjAlMjAlMjBpbWFnZSUyMCUzRCUyMGltYWdlJTVCJTNBJTJDJTIwJTNBJTJDJTIwTm9uZSU1RCUwQSUyMCUyMCUyMCUyMGltYWdlJTIwJTNEJTIwbnAuY29uY2F0ZW5hdGUoJTVCaW1hZ2UlMkMlMjBpbWFnZSUyQyUyMGltYWdlJTVEJTJDJTIwYXhpcyUzRDIpJTBBJTIwJTIwJTIwJTIwZGV0ZWN0ZWRfbWFwJTIwJTNEJTIwdG9yY2guZnJvbV9udW1weShpbWFnZSkuZmxvYXQoKSUyMCUyRiUyMDI1NS4wJTBBJTIwJTIwJTIwJTIwaGludCUyMCUzRCUyMGRldGVjdGVkX21hcC5wZXJtdXRlKDIlMkMlMjAwJTJDJTIwMSklMEElMjAlMjAlMjAlMjByZXR1cm4lMjBoaW50JTBBJTBBZGVwdGhfZXN0aW1hdG9yJTIwJTNEJTIwcGlwZWxpbmUoJTIyZGVwdGgtZXN0aW1hdGlvbiUyMiklMEFoaW50JTIwJTNEJTIwbWFrZV9oaW50KGltZyUyQyUyMGRlcHRoX2VzdGltYXRvcikudW5zcXVlZXplKDApLmhhbGYoKS50byglMjJjdWRhJTIyKQ==",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np

<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> KandinskyV22PriorEmb2EmbPipeline, KandinskyV22ControlnetImg2ImgPipeline
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

img = load_image(
    <span class="hljs-string">&quot;https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/kandinskyv22/cat.png&quot;</span>
).resize((<span class="hljs-number">768</span>, <span class="hljs-number">768</span>))

<span class="hljs-keyword">def</span> <span class="hljs-title function_">make_hint</span>(<span class="hljs-params">image, depth_estimator</span>):
    image = depth_estimator(image)[<span class="hljs-string">&quot;depth&quot;</span>]
    image = np.array(image)
    image = image[:, :, <span class="hljs-literal">None</span>]
    image = np.concatenate([image, image, image], axis=<span class="hljs-number">2</span>)
    detected_map = torch.from_numpy(image).<span class="hljs-built_in">float</span>() / <span class="hljs-number">255.0</span>
    hint = detected_map.permute(<span class="hljs-number">2</span>, <span class="hljs-number">0</span>, <span class="hljs-number">1</span>)
    <span class="hljs-keyword">return</span> hint

depth_estimator = pipeline(<span class="hljs-string">&quot;depth-estimation&quot;</span>)
hint = make_hint(img, depth_estimator).unsqueeze(<span class="hljs-number">0</span>).half().to(<span class="hljs-string">&quot;cuda&quot;</span>)`,wrap:!1}}),Oe=new T({props:{code:"cHJpb3JfcGlwZWxpbmUlMjAlM0QlMjBLYW5kaW5za3lWMjJQcmlvckVtYjJFbWJQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIya2FuZGluc2t5LWNvbW11bml0eSUyRmthbmRpbnNreS0yLTItcHJpb3IlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMjB1c2Vfc2FmZXRlbnNvcnMlM0RUcnVlJTBBKS50byglMjJjdWRhJTIyKSUwQSUwQXBpcGVsaW5lJTIwJTNEJTIwS2FuZGluc2t5VjIyQ29udHJvbG5ldEltZzJJbWdQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIya2FuZGluc2t5LWNvbW11bml0eSUyRmthbmRpbnNreS0yLTItY29udHJvbG5ldC1kZXB0aCUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUwQSkudG8oJTIyY3VkYSUyMik=",highlighted:`prior_pipeline = KandinskyV22PriorEmb2EmbPipeline.from_pretrained(
    <span class="hljs-string">&quot;kandinsky-community/kandinsky-2-2-prior&quot;</span>, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>
).to(<span class="hljs-string">&quot;cuda&quot;</span>)

pipeline = KandinskyV22ControlnetImg2ImgPipeline.from_pretrained(
    <span class="hljs-string">&quot;kandinsky-community/kandinsky-2-2-controlnet-depth&quot;</span>, torch_dtype=torch.float16
).to(<span class="hljs-string">&quot;cuda&quot;</span>)`,wrap:!1}}),ss=new T({props:{code:"cHJvbXB0JTIwJTNEJTIwJTIyQSUyMHJvYm90JTJDJTIwNGslMjBwaG90byUyMiUwQW5lZ2F0aXZlX3ByaW9yX3Byb21wdCUyMCUzRCUyMCUyMmxvd3JlcyUyQyUyMHRleHQlMkMlMjBlcnJvciUyQyUyMGNyb3BwZWQlMkMlMjB3b3JzdCUyMHF1YWxpdHklMkMlMjBsb3clMjBxdWFsaXR5JTJDJTIwanBlZyUyMGFydGlmYWN0cyUyQyUyMHVnbHklMkMlMjBkdXBsaWNhdGUlMkMlMjBtb3JiaWQlMkMlMjBtdXRpbGF0ZWQlMkMlMjBvdXQlMjBvZiUyMGZyYW1lJTJDJTIwZXh0cmElMjBmaW5nZXJzJTJDJTIwbXV0YXRlZCUyMGhhbmRzJTJDJTIwcG9vcmx5JTIwZHJhd24lMjBoYW5kcyUyQyUyMHBvb3JseSUyMGRyYXduJTIwZmFjZSUyQyUyMG11dGF0aW9uJTJDJTIwZGVmb3JtZWQlMkMlMjBibHVycnklMkMlMjBkZWh5ZHJhdGVkJTJDJTIwYmFkJTIwYW5hdG9teSUyQyUyMGJhZCUyMHByb3BvcnRpb25zJTJDJTIwZXh0cmElMjBsaW1icyUyQyUyMGNsb25lZCUyMGZhY2UlMkMlMjBkaXNmaWd1cmVkJTJDJTIwZ3Jvc3MlMjBwcm9wb3J0aW9ucyUyQyUyMG1hbGZvcm1lZCUyMGxpbWJzJTJDJTIwbWlzc2luZyUyMGFybXMlMkMlMjBtaXNzaW5nJTIwbGVncyUyQyUyMGV4dHJhJTIwYXJtcyUyQyUyMGV4dHJhJTIwbGVncyUyQyUyMGZ1c2VkJTIwZmluZ2VycyUyQyUyMHRvbyUyMG1hbnklMjBmaW5nZXJzJTJDJTIwbG9uZyUyMG5lY2slMkMlMjB1c2VybmFtZSUyQyUyMHdhdGVybWFyayUyQyUyMHNpZ25hdHVyZSUyMiUwQSUwQWdlbmVyYXRvciUyMCUzRCUyMHRvcmNoLkdlbmVyYXRvcihkZXZpY2UlM0QlMjJjdWRhJTIyKS5tYW51YWxfc2VlZCg0MyklMEElMEFpbWdfZW1iJTIwJTNEJTIwcHJpb3JfcGlwZWxpbmUocHJvbXB0JTNEcHJvbXB0JTJDJTIwaW1hZ2UlM0RpbWclMkMlMjBzdHJlbmd0aCUzRDAuODUlMkMlMjBnZW5lcmF0b3IlM0RnZW5lcmF0b3IpJTBBbmVnYXRpdmVfZW1iJTIwJTNEJTIwcHJpb3JfcGlwZWxpbmUocHJvbXB0JTNEbmVnYXRpdmVfcHJpb3JfcHJvbXB0JTJDJTIwaW1hZ2UlM0RpbWclMkMlMjBzdHJlbmd0aCUzRDElMkMlMjBnZW5lcmF0b3IlM0RnZW5lcmF0b3Ip",highlighted:`prompt = <span class="hljs-string">&quot;A robot, 4k photo&quot;</span>
negative_prior_prompt = <span class="hljs-string">&quot;lowres, text, error, cropped, worst quality, low quality, jpeg artifacts, ugly, duplicate, morbid, mutilated, out of frame, extra fingers, mutated hands, poorly drawn hands, poorly drawn face, mutation, deformed, blurry, dehydrated, bad anatomy, bad proportions, extra limbs, cloned face, disfigured, gross proportions, malformed limbs, missing arms, missing legs, extra arms, extra legs, fused fingers, too many fingers, long neck, username, watermark, signature&quot;</span>

generator = torch.Generator(device=<span class="hljs-string">&quot;cuda&quot;</span>).manual_seed(<span class="hljs-number">43</span>)

img_emb = prior_pipeline(prompt=prompt, image=img, strength=<span class="hljs-number">0.85</span>, generator=generator)
negative_emb = prior_pipeline(prompt=negative_prior_prompt, image=img, strength=<span class="hljs-number">1</span>, generator=generator)`,wrap:!1}}),ls=new T({props:{code:"aW1hZ2UlMjAlM0QlMjBwaXBlbGluZShpbWFnZSUzRGltZyUyQyUyMHN0cmVuZ3RoJTNEMC41JTJDJTIwaW1hZ2VfZW1iZWRzJTNEaW1nX2VtYi5pbWFnZV9lbWJlZHMlMkMlMjBuZWdhdGl2ZV9pbWFnZV9lbWJlZHMlM0RuZWdhdGl2ZV9lbWIuaW1hZ2VfZW1iZWRzJTJDJTIwaGludCUzRGhpbnQlMkMlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNENTAlMkMlMjBnZW5lcmF0b3IlM0RnZW5lcmF0b3IlMkMlMjBoZWlnaHQlM0Q3NjglMkMlMjB3aWR0aCUzRDc2OCkuaW1hZ2VzJTVCMCU1RCUwQW1ha2VfaW1hZ2VfZ3JpZCglNUJpbWcucmVzaXplKCg1MTIlMkMlMjA1MTIpKSUyQyUyMGltYWdlLnJlc2l6ZSgoNTEyJTJDJTIwNTEyKSklNUQlMkMlMjByb3dzJTNEMSUyQyUyMGNvbHMlM0QyKQ==",highlighted:`image = pipeline(image=img, strength=<span class="hljs-number">0.5</span>, image_embeds=img_emb.image_embeds, negative_image_embeds=negative_emb.image_embeds, hint=hint, num_inference_steps=<span class="hljs-number">50</span>, generator=generator, height=<span class="hljs-number">768</span>, width=<span class="hljs-number">768</span>).images[<span class="hljs-number">0</span>]
make_image_grid([img.resize((<span class="hljs-number">512</span>, <span class="hljs-number">512</span>)), image.resize((<span class="hljs-number">512</span>, <span class="hljs-number">512</span>))], rows=<span class="hljs-number">1</span>, cols=<span class="hljs-number">2</span>)`,wrap:!1}}),ns=new v({props:{title:"Optimizations",local:"optimizations",headingTag:"h2"}}),ps=new T({props:{code:"JTIwJTIwZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBJTIwJTIwaW1wb3J0JTIwdG9yY2glMEElMEElMjAlMjBwaXBlJTIwJTNEJTIwRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMi0xJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2KSUwQSUyQiUyMHBpcGUuZW5hYmxlX3hmb3JtZXJzX21lbW9yeV9lZmZpY2llbnRfYXR0ZW50aW9uKCk=",highlighted:`  from diffusers import DiffusionPipeline
  import torch

  pipe = DiffusionPipeline.from_pretrained(&quot;kandinsky-community/kandinsky-2-1&quot;, torch_dtype=torch.float16)
<span class="hljs-addition">+ pipe.enable_xformers_memory_efficient_attention()</span>`,wrap:!1}}),ms=new T({props:{code:"JTIwJTIwcGlwZS51bmV0LnRvKG1lbW9yeV9mb3JtYXQlM0R0b3JjaC5jaGFubmVsc19sYXN0KSUwQSUyQiUyMHBpcGUudW5ldCUyMCUzRCUyMHRvcmNoLmNvbXBpbGUocGlwZS51bmV0JTJDJTIwbW9kZSUzRCUyMnJlZHVjZS1vdmVyaGVhZCUyMiUyQyUyMGZ1bGxncmFwaCUzRFRydWUp",highlighted:`  pipe.unet.to(memory_format=torch.channels_last)
<span class="hljs-addition">+ pipe.unet = torch.compile(pipe.unet, mode=&quot;reduce-overhead&quot;, fullgraph=True)</span>`,wrap:!1}}),os=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2Vycy5tb2RlbHMuYXR0ZW50aW9uX3Byb2Nlc3NvciUyMGltcG9ydCUyMEF0dG5BZGRlZEtWUHJvY2Vzc29yMl8wJTBBJTBBcGlwZS51bmV0LnNldF9hdHRuX3Byb2Nlc3NvcihBdHRuQWRkZWRLVlByb2Nlc3NvcjJfMCgpKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers.models.attention_processor <span class="hljs-keyword">import</span> AttnAddedKVProcessor2_0

pipe.unet.set_attn_processor(AttnAddedKVProcessor2_0())`,wrap:!1}}),cs=new T({props:{code:"JTIwJTIwZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBJTIwJTIwaW1wb3J0JTIwdG9yY2glMEElMEElMjAlMjBwaXBlJTIwJTNEJTIwRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMi0xJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2KSUwQSUyQiUyMHBpcGUuZW5hYmxlX21vZGVsX2NwdV9vZmZsb2FkKCk=",highlighted:`  from diffusers import DiffusionPipeline
  import torch

  pipe = DiffusionPipeline.from_pretrained(&quot;kandinsky-community/kandinsky-2-1&quot;, torch_dtype=torch.float16)
<span class="hljs-addition">+ pipe.enable_model_cpu_offload()</span>`,wrap:!1}}),ds=new T({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEREUE1TY2hlZHVsZXIlMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRGlmZnVzaW9uUGlwZWxpbmUlMEElMEFzY2hlZHVsZXIlMjAlM0QlMjBERFBNU2NoZWR1bGVyLmZyb21fcHJldHJhaW5lZCglMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTItMSUyMiUyQyUyMHN1YmZvbGRlciUzRCUyMmRkcG1fc2NoZWR1bGVyJTIyKSUwQXBpcGUlMjAlM0QlMjBEaWZmdXNpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTIya2FuZGluc2t5LWNvbW11bml0eSUyRmthbmRpbnNreS0yLTElMjIlMkMlMjBzY2hlZHVsZXIlM0RzY2hlZHVsZXIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMkMlMjB1c2Vfc2FmZXRlbnNvcnMlM0RUcnVlKS50byglMjJjdWRhJTIyKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DDPMScheduler
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline

scheduler = DDPMScheduler.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-1&quot;</span>, subfolder=<span class="hljs-string">&quot;ddpm_scheduler&quot;</span>)
pipe = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-1&quot;</span>, scheduler=scheduler, torch_dtype=torch.float16, use_safetensors=<span class="hljs-literal">True</span>).to(<span class="hljs-string">&quot;cuda&quot;</span>)`,wrap:!1}}),ys=new dn({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/using-diffusers/kandinsky.md"}}),{c(){t=w("meta"),m=o(),s=w("p"),d=o(),y(l.$$.fragment),n=o(),y(r.$$.fragment),J=o(),y(G.$$.fragment),W=o(),k=w("p"),k.textContent=V,hs=o(),se=w("p"),se.innerHTML=sl,bs=o(),te=w("p"),te.innerHTML=tl,Js=o(),le=w("p"),le.innerHTML=ll,gs=o(),ne=w("p"),ne.textContent=nl,ks=o(),ae=w("p"),ae.textContent=al,ws=o(),y(ie.$$.fragment),Zs=o(),X=w("blockquote"),X.innerHTML=il,Us=o(),y(pe.$$.fragment),Ts=o(),me=w("p"),me.innerHTML=pl,Ws=o(),y(R.$$.fragment),js=o(),re=w("p"),re.innerHTML=ml,$s=o(),oe=w("p"),oe.innerHTML=rl,Gs=o(),y(C.$$.fragment),Is=o(),y(ce.$$.fragment),Vs=o(),de=w("p"),de.textContent=ol,Bs=o(),y(Y.$$.fragment),_s=o(),ye=w("p"),ye.textContent=cl,vs=o(),y(ue.$$.fragment),Xs=o(),Q=w("div"),Q.innerHTML=dl,Rs=o(),Me=w("p"),Me.innerHTML=yl,Cs=o(),y(fe.$$.fragment),Ys=o(),he=w("p"),he.textContent=ul,Qs=o(),y(H.$$.fragment),Hs=o(),be=w("p"),be.innerHTML=Ml,Fs=o(),Je=w("p"),Je.innerHTML=fl,Ns=o(),y(F.$$.fragment),Ss=o(),y(ge.$$.fragment),zs=o(),_=w("blockquote"),Ms=w("p"),Ms.innerHTML=hl,At=o(),y(ke.$$.fragment),xs=o(),we=w("p"),we.textContent=bl,Es=o(),y(N.$$.fragment),Ks=o(),Ze=w("p"),Ze.textContent=Jl,qs=o(),y(Ue.$$.fragment),Ls=o(),Te=w("p"),Te.textContent=gl,Ds=o(),y(We.$$.fragment),Ps=o(),je=w("p"),je.textContent=kl,As=o(),y(S.$$.fragment),Os=o(),$e=w("p"),$e.innerHTML=wl,et=o(),y(z.$$.fragment),st=o(),y(Ge.$$.fragment),tt=o(),Ie=w("p"),Ie.textContent=Zl,lt=o(),y(x.$$.fragment),nt=o(),E=w("div"),E.innerHTML=Ul,at=o(),Ve=w("p"),Ve.textContent=Tl,it=o(),y(Be.$$.fragment),pt=o(),_e=w("p"),_e.innerHTML=Wl,mt=o(),y(K.$$.fragment),rt=o(),y(ve.$$.fragment),ot=o(),q=w("blockquote"),q.innerHTML=jl,ct=o(),Xe=w("p"),Xe.textContent=$l,dt=o(),Re=w("p"),Re.textContent=Gl,yt=o(),y(Ce.$$.fragment),ut=o(),L=w("div"),L.innerHTML=Il,Mt=o(),Ye=w("p"),Ye.innerHTML=Vl,ft=o(),y(Qe.$$.fragment),ht=o(),y(He.$$.fragment),bt=o(),Fe=w("p"),Fe.innerHTML=Bl,Jt=o(),y(Ne.$$.fragment),gt=o(),Se=w("p"),Se.textContent=_l,kt=o(),y(ze.$$.fragment),wt=o(),xe=w("p"),xe.innerHTML=vl,Zt=o(),y(Ee.$$.fragment),Ut=o(),D=w("div"),D.innerHTML=Xl,Tt=o(),y(Ke.$$.fragment),Wt=o(),qe=w("p"),qe.textContent=Rl,jt=o(),Le=w("ul"),Le.innerHTML=Cl,$t=o(),De=w("p"),De.innerHTML=Yl,Gt=o(),y(Pe.$$.fragment),It=o(),Ae=w("p"),Ae.innerHTML=Ql,Vt=o(),y(Oe.$$.fragment),Bt=o(),es=w("p"),es.textContent=Hl,_t=o(),y(ss.$$.fragment),vt=o(),ts=w("p"),ts.innerHTML=Fl,Xt=o(),y(ls.$$.fragment),Rt=o(),P=w("div"),P.innerHTML=Nl,Ct=o(),y(ns.$$.fragment),Yt=o(),as=w("p"),as.textContent=Sl,Qt=o(),is=w("ol"),is.innerHTML=zl,Ht=o(),y(ps.$$.fragment),Ft=o(),A=w("ol"),A.innerHTML=xl,Nt=o(),y(ms.$$.fragment),St=o(),rs=w("p"),rs.innerHTML=El,zt=o(),y(os.$$.fragment),xt=o(),O=w("ol"),O.innerHTML=Kl,Et=o(),y(cs.$$.fragment),Kt=o(),ee=w("ol"),ee.innerHTML=ql,qt=o(),y(ds.$$.fragment),Lt=o(),y(ys.$$.fragment),Dt=o(),fs=w("p"),this.h()},l(e){const a=rn("svelte-u9bgzb",document.head);t=Z(a,"META",{name:!0,content:!0}),a.forEach(i),m=c(e),s=Z(e,"P",{}),Ot(s).forEach(i),d=c(e),u(l.$$.fragment,e),n=c(e),u(r.$$.fragment,e),J=c(e),u(G.$$.fragment,e),W=c(e),k=Z(e,"P",{"data-svelte-h":!0}),U(k)!=="svelte-nyn2ud"&&(k.textContent=V),hs=c(e),se=Z(e,"P",{"data-svelte-h":!0}),U(se)!=="svelte-rc0qhg"&&(se.innerHTML=sl),bs=c(e),te=Z(e,"P",{"data-svelte-h":!0}),U(te)!=="svelte-1lazcye"&&(te.innerHTML=tl),Js=c(e),le=Z(e,"P",{"data-svelte-h":!0}),U(le)!=="svelte-1nmmwrx"&&(le.innerHTML=ll),gs=c(e),ne=Z(e,"P",{"data-svelte-h":!0}),U(ne)!=="svelte-1l6ivg9"&&(ne.textContent=nl),ks=c(e),ae=Z(e,"P",{"data-svelte-h":!0}),U(ae)!=="svelte-cwruts"&&(ae.textContent=al),ws=c(e),u(ie.$$.fragment,e),Zs=c(e),X=Z(e,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),U(X)!=="svelte-o4zvpu"&&(X.innerHTML=il),Us=c(e),u(pe.$$.fragment,e),Ts=c(e),me=Z(e,"P",{"data-svelte-h":!0}),U(me)!=="svelte-kq2poq"&&(me.innerHTML=pl),Ws=c(e),u(R.$$.fragment,e),js=c(e),re=Z(e,"P",{"data-svelte-h":!0}),U(re)!=="svelte-1ia5b2q"&&(re.innerHTML=ml),$s=c(e),oe=Z(e,"P",{"data-svelte-h":!0}),U(oe)!=="svelte-enihv1"&&(oe.innerHTML=rl),Gs=c(e),u(C.$$.fragment,e),Is=c(e),u(ce.$$.fragment,e),Vs=c(e),de=Z(e,"P",{"data-svelte-h":!0}),U(de)!=="svelte-1pueb9d"&&(de.textContent=ol),Bs=c(e),u(Y.$$.fragment,e),_s=c(e),ye=Z(e,"P",{"data-svelte-h":!0}),U(ye)!=="svelte-1sl9181"&&(ye.textContent=cl),vs=c(e),u(ue.$$.fragment,e),Xs=c(e),Q=Z(e,"DIV",{class:!0,"data-svelte-h":!0}),U(Q)!=="svelte-1w2zk95"&&(Q.innerHTML=dl),Rs=c(e),Me=Z(e,"P",{"data-svelte-h":!0}),U(Me)!=="svelte-ctvdye"&&(Me.innerHTML=yl),Cs=c(e),u(fe.$$.fragment,e),Ys=c(e),he=Z(e,"P",{"data-svelte-h":!0}),U(he)!=="svelte-zsncr3"&&(he.textContent=ul),Qs=c(e),u(H.$$.fragment,e),Hs=c(e),be=Z(e,"P",{"data-svelte-h":!0}),U(be)!=="svelte-1tkzfu"&&(be.innerHTML=Ml),Fs=c(e),Je=Z(e,"P",{"data-svelte-h":!0}),U(Je)!=="svelte-1mrjxh5"&&(Je.innerHTML=fl),Ns=c(e),u(F.$$.fragment,e),Ss=c(e),u(ge.$$.fragment,e),zs=c(e),_=Z(e,"BLOCKQUOTE",{class:!0});var us=Ot(_);Ms=Z(us,"P",{"data-svelte-h":!0}),U(Ms)!=="svelte-nmwstu"&&(Ms.innerHTML=hl),At=c(us),u(ke.$$.fragment,us),us.forEach(i),xs=c(e),we=Z(e,"P",{"data-svelte-h":!0}),U(we)!=="svelte-1h9m0px"&&(we.textContent=bl),Es=c(e),u(N.$$.fragment,e),Ks=c(e),Ze=Z(e,"P",{"data-svelte-h":!0}),U(Ze)!=="svelte-1lisfug"&&(Ze.textContent=Jl),qs=c(e),u(Ue.$$.fragment,e),Ls=c(e),Te=Z(e,"P",{"data-svelte-h":!0}),U(Te)!=="svelte-1seehfb"&&(Te.textContent=gl),Ds=c(e),u(We.$$.fragment,e),Ps=c(e),je=Z(e,"P",{"data-svelte-h":!0}),U(je)!=="svelte-1c90mh7"&&(je.textContent=kl),As=c(e),u(S.$$.fragment,e),Os=c(e),$e=Z(e,"P",{"data-svelte-h":!0}),U($e)!=="svelte-19cbvto"&&($e.innerHTML=wl),et=c(e),u(z.$$.fragment,e),st=c(e),u(Ge.$$.fragment,e),tt=c(e),Ie=Z(e,"P",{"data-svelte-h":!0}),U(Ie)!=="svelte-iexz0f"&&(Ie.textContent=Zl),lt=c(e),u(x.$$.fragment,e),nt=c(e),E=Z(e,"DIV",{class:!0,"data-svelte-h":!0}),U(E)!=="svelte-1c7h32m"&&(E.innerHTML=Ul),at=c(e),Ve=Z(e,"P",{"data-svelte-h":!0}),U(Ve)!=="svelte-1yz0908"&&(Ve.textContent=Tl),it=c(e),u(Be.$$.fragment,e),pt=c(e),_e=Z(e,"P",{"data-svelte-h":!0}),U(_e)!=="svelte-lrlri1"&&(_e.innerHTML=Wl),mt=c(e),u(K.$$.fragment,e),rt=c(e),u(ve.$$.fragment,e),ot=c(e),q=Z(e,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),U(q)!=="svelte-1m5vd5r"&&(q.innerHTML=jl),ct=c(e),Xe=Z(e,"P",{"data-svelte-h":!0}),U(Xe)!=="svelte-1shkert"&&(Xe.textContent=$l),dt=c(e),Re=Z(e,"P",{"data-svelte-h":!0}),U(Re)!=="svelte-191d2jn"&&(Re.textContent=Gl),yt=c(e),u(Ce.$$.fragment,e),ut=c(e),L=Z(e,"DIV",{class:!0,"data-svelte-h":!0}),U(L)!=="svelte-11gtyyz"&&(L.innerHTML=Il),Mt=c(e),Ye=Z(e,"P",{"data-svelte-h":!0}),U(Ye)!=="svelte-cpjujb"&&(Ye.innerHTML=Vl),ft=c(e),u(Qe.$$.fragment,e),ht=c(e),u(He.$$.fragment,e),bt=c(e),Fe=Z(e,"P",{"data-svelte-h":!0}),U(Fe)!=="svelte-h6d89t"&&(Fe.innerHTML=Bl),Jt=c(e),u(Ne.$$.fragment,e),gt=c(e),Se=Z(e,"P",{"data-svelte-h":!0}),U(Se)!=="svelte-ncejue"&&(Se.textContent=_l),kt=c(e),u(ze.$$.fragment,e),wt=c(e),xe=Z(e,"P",{"data-svelte-h":!0}),U(xe)!=="svelte-1x84eg0"&&(xe.innerHTML=vl),Zt=c(e),u(Ee.$$.fragment,e),Ut=c(e),D=Z(e,"DIV",{class:!0,"data-svelte-h":!0}),U(D)!=="svelte-1oo0se1"&&(D.innerHTML=Xl),Tt=c(e),u(Ke.$$.fragment,e),Wt=c(e),qe=Z(e,"P",{"data-svelte-h":!0}),U(qe)!=="svelte-1hxrtxz"&&(qe.textContent=Rl),jt=c(e),Le=Z(e,"UL",{"data-svelte-h":!0}),U(Le)!=="svelte-1wnirbi"&&(Le.innerHTML=Cl),$t=c(e),De=Z(e,"P",{"data-svelte-h":!0}),U(De)!=="svelte-1eccwor"&&(De.innerHTML=Yl),Gt=c(e),u(Pe.$$.fragment,e),It=c(e),Ae=Z(e,"P",{"data-svelte-h":!0}),U(Ae)!=="svelte-1bme2gp"&&(Ae.innerHTML=Ql),Vt=c(e),u(Oe.$$.fragment,e),Bt=c(e),es=Z(e,"P",{"data-svelte-h":!0}),U(es)!=="svelte-1ltdt5k"&&(es.textContent=Hl),_t=c(e),u(ss.$$.fragment,e),vt=c(e),ts=Z(e,"P",{"data-svelte-h":!0}),U(ts)!=="svelte-gs93x4"&&(ts.innerHTML=Fl),Xt=c(e),u(ls.$$.fragment,e),Rt=c(e),P=Z(e,"DIV",{class:!0,"data-svelte-h":!0}),U(P)!=="svelte-eey5ka"&&(P.innerHTML=Nl),Ct=c(e),u(ns.$$.fragment,e),Yt=c(e),as=Z(e,"P",{"data-svelte-h":!0}),U(as)!=="svelte-1x6zzpe"&&(as.textContent=Sl),Qt=c(e),is=Z(e,"OL",{"data-svelte-h":!0}),U(is)!=="svelte-gyrsfr"&&(is.innerHTML=zl),Ht=c(e),u(ps.$$.fragment,e),Ft=c(e),A=Z(e,"OL",{start:!0,"data-svelte-h":!0}),U(A)!=="svelte-y09ur0"&&(A.innerHTML=xl),Nt=c(e),u(ms.$$.fragment,e),St=c(e),rs=Z(e,"P",{"data-svelte-h":!0}),U(rs)!=="svelte-1ruz9lc"&&(rs.innerHTML=El),zt=c(e),u(os.$$.fragment,e),xt=c(e),O=Z(e,"OL",{start:!0,"data-svelte-h":!0}),U(O)!=="svelte-tfi0xx"&&(O.innerHTML=Kl),Et=c(e),u(cs.$$.fragment,e),Kt=c(e),ee=Z(e,"OL",{start:!0,"data-svelte-h":!0}),U(ee)!=="svelte-gz9ims"&&(ee.innerHTML=ql),qt=c(e),u(ds.$$.fragment,e),Lt=c(e),u(ys.$$.fragment,e),Dt=c(e),fs=Z(e,"P",{}),Ot(fs).forEach(i),this.h()},h(){I(t,"name","hf:doc:metadata"),I(t,"content",Kn),I(X,"class","warning"),I(Q,"class","flex justify-center"),I(_,"class","warning"),I(E,"class","flex gap-4"),I(q,"class","warning"),I(L,"class","flex justify-center"),I(D,"class","flex justify-center"),I(P,"class","flex justify-center"),I(A,"start","2"),I(O,"start","3"),I(ee,"start","4")},m(e,a){el(document.head,t),p(e,m,a),p(e,s,a),p(e,d,a),M(l,e,a),p(e,n,a),M(r,e,a),p(e,J,a),M(G,e,a),p(e,W,a),p(e,k,a),p(e,hs,a),p(e,se,a),p(e,bs,a),p(e,te,a),p(e,Js,a),p(e,le,a),p(e,gs,a),p(e,ne,a),p(e,ks,a),p(e,ae,a),p(e,ws,a),M(ie,e,a),p(e,Zs,a),p(e,X,a),p(e,Us,a),M(pe,e,a),p(e,Ts,a),p(e,me,a),p(e,Ws,a),M(R,e,a),p(e,js,a),p(e,re,a),p(e,$s,a),p(e,oe,a),p(e,Gs,a),M(C,e,a),p(e,Is,a),M(ce,e,a),p(e,Vs,a),p(e,de,a),p(e,Bs,a),M(Y,e,a),p(e,_s,a),p(e,ye,a),p(e,vs,a),M(ue,e,a),p(e,Xs,a),p(e,Q,a),p(e,Rs,a),p(e,Me,a),p(e,Cs,a),M(fe,e,a),p(e,Ys,a),p(e,he,a),p(e,Qs,a),M(H,e,a),p(e,Hs,a),p(e,be,a),p(e,Fs,a),p(e,Je,a),p(e,Ns,a),M(F,e,a),p(e,Ss,a),M(ge,e,a),p(e,zs,a),p(e,_,a),el(_,Ms),el(_,At),M(ke,_,null),p(e,xs,a),p(e,we,a),p(e,Es,a),M(N,e,a),p(e,Ks,a),p(e,Ze,a),p(e,qs,a),M(Ue,e,a),p(e,Ls,a),p(e,Te,a),p(e,Ds,a),M(We,e,a),p(e,Ps,a),p(e,je,a),p(e,As,a),M(S,e,a),p(e,Os,a),p(e,$e,a),p(e,et,a),M(z,e,a),p(e,st,a),M(Ge,e,a),p(e,tt,a),p(e,Ie,a),p(e,lt,a),M(x,e,a),p(e,nt,a),p(e,E,a),p(e,at,a),p(e,Ve,a),p(e,it,a),M(Be,e,a),p(e,pt,a),p(e,_e,a),p(e,mt,a),M(K,e,a),p(e,rt,a),M(ve,e,a),p(e,ot,a),p(e,q,a),p(e,ct,a),p(e,Xe,a),p(e,dt,a),p(e,Re,a),p(e,yt,a),M(Ce,e,a),p(e,ut,a),p(e,L,a),p(e,Mt,a),p(e,Ye,a),p(e,ft,a),M(Qe,e,a),p(e,ht,a),M(He,e,a),p(e,bt,a),p(e,Fe,a),p(e,Jt,a),M(Ne,e,a),p(e,gt,a),p(e,Se,a),p(e,kt,a),M(ze,e,a),p(e,wt,a),p(e,xe,a),p(e,Zt,a),M(Ee,e,a),p(e,Ut,a),p(e,D,a),p(e,Tt,a),M(Ke,e,a),p(e,Wt,a),p(e,qe,a),p(e,jt,a),p(e,Le,a),p(e,$t,a),p(e,De,a),p(e,Gt,a),M(Pe,e,a),p(e,It,a),p(e,Ae,a),p(e,Vt,a),M(Oe,e,a),p(e,Bt,a),p(e,es,a),p(e,_t,a),M(ss,e,a),p(e,vt,a),p(e,ts,a),p(e,Xt,a),M(ls,e,a),p(e,Rt,a),p(e,P,a),p(e,Ct,a),M(ns,e,a),p(e,Yt,a),p(e,as,a),p(e,Qt,a),p(e,is,a),p(e,Ht,a),M(ps,e,a),p(e,Ft,a),p(e,A,a),p(e,Nt,a),M(ms,e,a),p(e,St,a),p(e,rs,a),p(e,zt,a),M(os,e,a),p(e,xt,a),p(e,O,a),p(e,Et,a),M(cs,e,a),p(e,Kt,a),p(e,ee,a),p(e,qt,a),M(ds,e,a),p(e,Lt,a),M(ys,e,a),p(e,Dt,a),p(e,fs,a),Pt=!0},p(e,[a]){const us={};a&2&&(us.$$scope={dirty:a,ctx:e}),R.$set(us);const Ll={};a&2&&(Ll.$$scope={dirty:a,ctx:e}),C.$set(Ll);const Dl={};a&2&&(Dl.$$scope={dirty:a,ctx:e}),Y.$set(Dl);const Pl={};a&2&&(Pl.$$scope={dirty:a,ctx:e}),H.$set(Pl);const Al={};a&2&&(Al.$$scope={dirty:a,ctx:e}),F.$set(Al);const Ol={};a&2&&(Ol.$$scope={dirty:a,ctx:e}),N.$set(Ol);const en={};a&2&&(en.$$scope={dirty:a,ctx:e}),S.$set(en);const sn={};a&2&&(sn.$$scope={dirty:a,ctx:e}),z.$set(sn);const tn={};a&2&&(tn.$$scope={dirty:a,ctx:e}),x.$set(tn);const ln={};a&2&&(ln.$$scope={dirty:a,ctx:e}),K.$set(ln)},i(e){Pt||(f(l.$$.fragment,e),f(r.$$.fragment,e),f(G.$$.fragment,e),f(ie.$$.fragment,e),f(pe.$$.fragment,e),f(R.$$.fragment,e),f(C.$$.fragment,e),f(ce.$$.fragment,e),f(Y.$$.fragment,e),f(ue.$$.fragment,e),f(fe.$$.fragment,e),f(H.$$.fragment,e),f(F.$$.fragment,e),f(ge.$$.fragment,e),f(ke.$$.fragment,e),f(N.$$.fragment,e),f(Ue.$$.fragment,e),f(We.$$.fragment,e),f(S.$$.fragment,e),f(z.$$.fragment,e),f(Ge.$$.fragment,e),f(x.$$.fragment,e),f(Be.$$.fragment,e),f(K.$$.fragment,e),f(ve.$$.fragment,e),f(Ce.$$.fragment,e),f(Qe.$$.fragment,e),f(He.$$.fragment,e),f(Ne.$$.fragment,e),f(ze.$$.fragment,e),f(Ee.$$.fragment,e),f(Ke.$$.fragment,e),f(Pe.$$.fragment,e),f(Oe.$$.fragment,e),f(ss.$$.fragment,e),f(ls.$$.fragment,e),f(ns.$$.fragment,e),f(ps.$$.fragment,e),f(ms.$$.fragment,e),f(os.$$.fragment,e),f(cs.$$.fragment,e),f(ds.$$.fragment,e),f(ys.$$.fragment,e),Pt=!0)},o(e){h(l.$$.fragment,e),h(r.$$.fragment,e),h(G.$$.fragment,e),h(ie.$$.fragment,e),h(pe.$$.fragment,e),h(R.$$.fragment,e),h(C.$$.fragment,e),h(ce.$$.fragment,e),h(Y.$$.fragment,e),h(ue.$$.fragment,e),h(fe.$$.fragment,e),h(H.$$.fragment,e),h(F.$$.fragment,e),h(ge.$$.fragment,e),h(ke.$$.fragment,e),h(N.$$.fragment,e),h(Ue.$$.fragment,e),h(We.$$.fragment,e),h(S.$$.fragment,e),h(z.$$.fragment,e),h(Ge.$$.fragment,e),h(x.$$.fragment,e),h(Be.$$.fragment,e),h(K.$$.fragment,e),h(ve.$$.fragment,e),h(Ce.$$.fragment,e),h(Qe.$$.fragment,e),h(He.$$.fragment,e),h(Ne.$$.fragment,e),h(ze.$$.fragment,e),h(Ee.$$.fragment,e),h(Ke.$$.fragment,e),h(Pe.$$.fragment,e),h(Oe.$$.fragment,e),h(ss.$$.fragment,e),h(ls.$$.fragment,e),h(ns.$$.fragment,e),h(ps.$$.fragment,e),h(ms.$$.fragment,e),h(os.$$.fragment,e),h(cs.$$.fragment,e),h(ds.$$.fragment,e),h(ys.$$.fragment,e),Pt=!1},d(e){e&&(i(m),i(s),i(d),i(n),i(J),i(W),i(k),i(hs),i(se),i(bs),i(te),i(Js),i(le),i(gs),i(ne),i(ks),i(ae),i(ws),i(Zs),i(X),i(Us),i(Ts),i(me),i(Ws),i(js),i(re),i($s),i(oe),i(Gs),i(Is),i(Vs),i(de),i(Bs),i(_s),i(ye),i(vs),i(Xs),i(Q),i(Rs),i(Me),i(Cs),i(Ys),i(he),i(Qs),i(Hs),i(be),i(Fs),i(Je),i(Ns),i(Ss),i(zs),i(_),i(xs),i(we),i(Es),i(Ks),i(Ze),i(qs),i(Ls),i(Te),i(Ds),i(Ps),i(je),i(As),i(Os),i($e),i(et),i(st),i(tt),i(Ie),i(lt),i(nt),i(E),i(at),i(Ve),i(it),i(pt),i(_e),i(mt),i(rt),i(ot),i(q),i(ct),i(Xe),i(dt),i(Re),i(yt),i(ut),i(L),i(Mt),i(Ye),i(ft),i(ht),i(bt),i(Fe),i(Jt),i(gt),i(Se),i(kt),i(wt),i(xe),i(Zt),i(Ut),i(D),i(Tt),i(Wt),i(qe),i(jt),i(Le),i($t),i(De),i(Gt),i(It),i(Ae),i(Vt),i(Bt),i(es),i(_t),i(vt),i(ts),i(Xt),i(Rt),i(P),i(Ct),i(Yt),i(as),i(Qt),i(is),i(Ht),i(Ft),i(A),i(Nt),i(St),i(rs),i(zt),i(xt),i(O),i(Et),i(Kt),i(ee),i(qt),i(Lt),i(Dt),i(fs)),i(t),b(l,e),b(r,e),b(G,e),b(ie,e),b(pe,e),b(R,e),b(C,e),b(ce,e),b(Y,e),b(ue,e),b(fe,e),b(H,e),b(F,e),b(ge,e),b(ke),b(N,e),b(Ue,e),b(We,e),b(S,e),b(z,e),b(Ge,e),b(x,e),b(Be,e),b(K,e),b(ve,e),b(Ce,e),b(Qe,e),b(He,e),b(Ne,e),b(ze,e),b(Ee,e),b(Ke,e),b(Pe,e),b(Oe,e),b(ss,e),b(ls,e),b(ns,e),b(ps,e),b(ms,e),b(os,e),b(cs,e),b(ds,e),b(ys,e)}}}const Kn='{"title":"Kandinsky","local":"kandinsky","sections":[{"title":"Text-to-image","local":"text-to-image","sections":[],"depth":2},{"title":"Image-to-image","local":"image-to-image","sections":[],"depth":2},{"title":"Inpainting","local":"inpainting","sections":[],"depth":2},{"title":"Interpolation","local":"interpolation","sections":[],"depth":2},{"title":"ControlNet","local":"controlnet","sections":[{"title":"Text-to-image","local":"controlnet-text-to-image","sections":[],"depth":3},{"title":"Image-to-image","local":"controlnet-image-to-image","sections":[],"depth":3}],"depth":2},{"title":"Optimizations","local":"optimizations","sections":[],"depth":2}],"depth":1}';function qn(g){return an(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ta extends pn{constructor(t){super(),mn(this,t,qn,En,nn,{})}}export{ta as component};
