import{s as Ol,o as en,n as $}from"../chunks/scheduler.8c3d61f6.js";import{S as sn,i as tn,g as k,s as c,r as u,A as ln,h as w,f as i,c as d,j as Al,u as M,x as U,k as V,y as nn,a as p,v as f,d as h,t as b,w as J}from"../chunks/index.da70eac4.js";import{T as Kt}from"../chunks/Tip.1d9b8c37.js";import{C as T}from"../chunks/CodeBlock.00a903b3.js";import{D as an}from"../chunks/DocNotebookDropdown.02900f6b.js";import{H as _,E as pn}from"../chunks/EditOnGithub.1e64e623.js";import{H as B,a as G}from"../chunks/HfOption.c1483eb1.js";function mn(g){let t,m="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.",s,o,l,n,r='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>.';return{c(){t=k("p"),t.innerHTML=m,s=c(),o=k("br"),l=c(),n=k("p"),n.innerHTML=r},l(y){t=w(y,"P",{"data-svelte-h":!0}),U(t)!=="svelte-enep6a"&&(t.innerHTML=m),s=d(y),o=w(y,"BR",{}),l=d(y),n=w(y,"P",{"data-svelte-h":!0}),U(n)!=="svelte-1b2tsxz"&&(n.innerHTML=r)},m(y,W){p(y,t,W),p(y,s,W),p(y,o,W),p(y,l,W),p(y,n,W)},p:$,d(y){y&&(i(t),i(s),i(o),i(l),i(n))}}}function rn(g){let t,m,s,o='Now pass all the prompts and embeddings to the <a href="/docs/diffusers/v0.30.2/en/api/pipelines/kandinsky#diffusers.KandinskyPipeline">KandinskyPipeline</a> to generate an image:',l,n,r,y,W='<img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/kandinsky-docs/cheeseburger.png"/>',I;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(){u(t.$$.fragment),m=c(),s=k("p"),s.innerHTML=o,l=c(),u(n.$$.fragment),r=c(),y=k("div"),y.innerHTML=W,this.h()},l(Z){M(t.$$.fragment,Z),m=d(Z),s=w(Z,"P",{"data-svelte-h":!0}),U(s)!=="svelte-w2d5h2"&&(s.innerHTML=o),l=d(Z),M(n.$$.fragment,Z),r=d(Z),y=w(Z,"DIV",{class:!0,"data-svelte-h":!0}),U(y)!=="svelte-i75i2v"&&(y.innerHTML=W),this.h()},h(){V(y,"class","flex justify-center")},m(Z,j){f(t,Z,j),p(Z,m,j),p(Z,s,j),p(Z,l,j),f(n,Z,j),p(Z,r,j),p(Z,y,j),I=!0},p:$,i(Z){I||(h(t.$$.fragment,Z),h(n.$$.fragment,Z),I=!0)},o(Z){b(t.$$.fragment,Z),b(n.$$.fragment,Z),I=!1},d(Z){Z&&(i(m),i(s),i(l),i(r),i(y)),J(t,Z),J(n,Z)}}}function on(g){let t,m,s,o='Pass the <code>image_embeds</code> and <code>negative_image_embeds</code> to the <a href="/docs/diffusers/v0.30.2/en/api/pipelines/kandinsky_v22#diffusers.KandinskyV22Pipeline">KandinskyV22Pipeline</a> to generate an image:',l,n,r,y,W='<img class="rounded-xl" src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/kandinsky-text-to-image.png"/>',I;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(){u(t.$$.fragment),m=c(),s=k("p"),s.innerHTML=o,l=c(),u(n.$$.fragment),r=c(),y=k("div"),y.innerHTML=W,this.h()},l(Z){M(t.$$.fragment,Z),m=d(Z),s=w(Z,"P",{"data-svelte-h":!0}),U(s)!=="svelte-17m7jfr"&&(s.innerHTML=o),l=d(Z),M(n.$$.fragment,Z),r=d(Z),y=w(Z,"DIV",{class:!0,"data-svelte-h":!0}),U(y)!=="svelte-kkab9k"&&(y.innerHTML=W),this.h()},h(){V(y,"class","flex justify-center")},m(Z,j){f(t,Z,j),p(Z,m,j),p(Z,s,j),p(Z,l,j),f(n,Z,j),p(Z,r,j),p(Z,y,j),I=!0},p:$,i(Z){I||(h(t.$$.fragment,Z),h(n.$$.fragment,Z),I=!0)},o(Z){b(t.$$.fragment,Z),b(n.$$.fragment,Z),I=!1},d(Z){Z&&(i(m),i(s),i(l),i(r),i(y)),J(t,Z),J(n,Z)}}}function cn(g){let t,m='Kandinsky 3 doesn’t require a prior model so you can directly load the <a href="/docs/diffusers/v0.30.2/en/api/pipelines/kandinsky3#diffusers.Kandinsky3Pipeline">Kandinsky3Pipeline</a> and pass a prompt to generate an image:',s,o,l;return o=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=k("p"),t.innerHTML=m,s=c(),u(o.$$.fragment)},l(n){t=w(n,"P",{"data-svelte-h":!0}),U(t)!=="svelte-1no0jxt"&&(t.innerHTML=m),s=d(n),M(o.$$.fragment,n)},m(n,r){p(n,t,r),p(n,s,r),f(o,n,r),l=!0},p:$,i(n){l||(h(o.$$.fragment,n),l=!0)},o(n){b(o.$$.fragment,n),l=!1},d(n){n&&(i(t),i(s)),J(o,n)}}}function dn(g){let t,m,s,o,l,n;return t=new G({props:{id:"text-to-image",option:"Kandinsky 2.1",$$slots:{default:[rn]},$$scope:{ctx:g}}}),s=new G({props:{id:"text-to-image",option:"Kandinsky 2.2",$$slots:{default:[on]},$$scope:{ctx:g}}}),l=new G({props:{id:"text-to-image",option:"Kandinsky 3",$$slots:{default:[cn]},$$scope:{ctx:g}}}),{c(){u(t.$$.fragment),m=c(),u(s.$$.fragment),o=c(),u(l.$$.fragment)},l(r){M(t.$$.fragment,r),m=d(r),M(s.$$.fragment,r),o=d(r),M(l.$$.fragment,r)},m(r,y){f(t,r,y),p(r,m,y),f(s,r,y),p(r,o,y),f(l,r,y),n=!0},p(r,y){const W={};y&2&&(W.$$scope={dirty:y,ctx:r}),t.$set(W);const I={};y&2&&(I.$$scope={dirty:y,ctx:r}),s.$set(I);const Z={};y&2&&(Z.$$scope={dirty:y,ctx:r}),l.$set(Z)},i(r){n||(h(t.$$.fragment,r),h(s.$$.fragment,r),h(l.$$.fragment,r),n=!0)},o(r){b(t.$$.fragment,r),b(s.$$.fragment,r),b(l.$$.fragment,r),n=!1},d(r){r&&(i(m),i(o)),J(t,r),J(s,r),J(l,r)}}}function yn(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(){u(t.$$.fragment)},l(s){M(t.$$.fragment,s)},m(s,o){f(t,s,o),m=!0},p:$,i(s){m||(h(t.$$.fragment,s),m=!0)},o(s){b(t.$$.fragment,s),m=!1},d(s){J(t,s)}}}function un(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(){u(t.$$.fragment)},l(s){M(t.$$.fragment,s)},m(s,o){f(t,s,o),m=!0},p:$,i(s){m||(h(t.$$.fragment,s),m=!0)},o(s){b(t.$$.fragment,s),m=!1},d(s){J(t,s)}}}function Mn(g){let t,m,s,o;return t=new G({props:{id:"text-to-image",option:"Kandinsky 2.1",$$slots:{default:[yn]},$$scope:{ctx:g}}}),s=new G({props:{id:"text-to-image",option:"Kandinsky 2.2",$$slots:{default:[un]},$$scope:{ctx:g}}}),{c(){u(t.$$.fragment),m=c(),u(s.$$.fragment)},l(l){M(t.$$.fragment,l),m=d(l),M(s.$$.fragment,l)},m(l,n){f(t,l,n),p(l,m,n),f(s,l,n),o=!0},p(l,n){const r={};n&2&&(r.$$scope={dirty:n,ctx:l}),t.$set(r);const y={};n&2&&(y.$$scope={dirty:n,ctx:l}),s.$set(y)},i(l){o||(h(t.$$.fragment,l),h(s.$$.fragment,l),o=!0)},o(l){b(t.$$.fragment,l),b(s.$$.fragment,l),o=!1},d(l){l&&i(m),J(t,l),J(s,l)}}}function fn(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(){u(t.$$.fragment)},l(s){M(t.$$.fragment,s)},m(s,o){f(t,s,o),m=!0},p:$,i(s){m||(h(t.$$.fragment,s),m=!0)},o(s){b(t.$$.fragment,s),m=!1},d(s){J(t,s)}}}function hn(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(){u(t.$$.fragment)},l(s){M(t.$$.fragment,s)},m(s,o){f(t,s,o),m=!0},p:$,i(s){m||(h(t.$$.fragment,s),m=!0)},o(s){b(t.$$.fragment,s),m=!1},d(s){J(t,s)}}}function bn(g){let t,m="Kandinsky 3 doesn’t require a prior model so you can directly load the image-to-image pipeline:",s,o,l;return o=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=k("p"),t.textContent=m,s=c(),u(o.$$.fragment)},l(n){t=w(n,"P",{"data-svelte-h":!0}),U(t)!=="svelte-3bukbx"&&(t.textContent=m),s=d(n),M(o.$$.fragment,n)},m(n,r){p(n,t,r),p(n,s,r),f(o,n,r),l=!0},p:$,i(n){l||(h(o.$$.fragment,n),l=!0)},o(n){b(o.$$.fragment,n),l=!1},d(n){n&&(i(t),i(s)),J(o,n)}}}function Jn(g){let t,m,s,o,l,n;return t=new G({props:{id:"image-to-image",option:"Kandinsky 2.1",$$slots:{default:[fn]},$$scope:{ctx:g}}}),s=new G({props:{id:"image-to-image",option:"Kandinsky 2.2",$$slots:{default:[hn]},$$scope:{ctx:g}}}),l=new G({props:{id:"image-to-image",option:"Kandinsky 3",$$slots:{default:[bn]},$$scope:{ctx:g}}}),{c(){u(t.$$.fragment),m=c(),u(s.$$.fragment),o=c(),u(l.$$.fragment)},l(r){M(t.$$.fragment,r),m=d(r),M(s.$$.fragment,r),o=d(r),M(l.$$.fragment,r)},m(r,y){f(t,r,y),p(r,m,y),f(s,r,y),p(r,o,y),f(l,r,y),n=!0},p(r,y){const W={};y&2&&(W.$$scope={dirty:y,ctx:r}),t.$set(W);const I={};y&2&&(I.$$scope={dirty:y,ctx:r}),s.$set(I);const Z={};y&2&&(Z.$$scope={dirty:y,ctx:r}),l.$set(Z)},i(r){n||(h(t.$$.fragment,r),h(s.$$.fragment,r),h(l.$$.fragment,r),n=!0)},o(r){b(t.$$.fragment,r),b(s.$$.fragment,r),b(l.$$.fragment,r),n=!1},d(r){r&&(i(m),i(o)),J(t,r),J(s,r),J(l,r)}}}function gn(g){let t,m,s,o='<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(){u(t.$$.fragment),m=c(),s=k("div"),s.innerHTML=o,this.h()},l(n){M(t.$$.fragment,n),m=d(n),s=w(n,"DIV",{class:!0,"data-svelte-h":!0}),U(s)!=="svelte-1vh4dwd"&&(s.innerHTML=o),this.h()},h(){V(s,"class","flex justify-center")},m(n,r){f(t,n,r),p(n,m,r),p(n,s,r),l=!0},p:$,i(n){l||(h(t.$$.fragment,n),l=!0)},o(n){b(t.$$.fragment,n),l=!1},d(n){n&&(i(m),i(s)),J(t,n)}}}function kn(g){let t,m,s,o='<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(){u(t.$$.fragment),m=c(),s=k("div"),s.innerHTML=o,this.h()},l(n){M(t.$$.fragment,n),m=d(n),s=w(n,"DIV",{class:!0,"data-svelte-h":!0}),U(s)!=="svelte-1vux4a0"&&(s.innerHTML=o),this.h()},h(){V(s,"class","flex justify-center")},m(n,r){f(t,n,r),p(n,m,r),p(n,s,r),l=!0},p:$,i(n){l||(h(t.$$.fragment,n),l=!0)},o(n){b(t.$$.fragment,n),l=!1},d(n){n&&(i(m),i(s)),J(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(){u(t.$$.fragment)},l(s){M(t.$$.fragment,s)},m(s,o){f(t,s,o),m=!0},p:$,i(s){m||(h(t.$$.fragment,s),m=!0)},o(s){b(t.$$.fragment,s),m=!1},d(s){J(t,s)}}}function Zn(g){let t,m,s,o,l,n;return t=new G({props:{id:"image-to-image",option:"Kandinsky 2.1",$$slots:{default:[gn]},$$scope:{ctx:g}}}),s=new G({props:{id:"image-to-image",option:"Kandinsky 2.2",$$slots:{default:[kn]},$$scope:{ctx:g}}}),l=new G({props:{id:"image-to-image",option:"Kandinsky 3",$$slots:{default:[wn]},$$scope:{ctx:g}}}),{c(){u(t.$$.fragment),m=c(),u(s.$$.fragment),o=c(),u(l.$$.fragment)},l(r){M(t.$$.fragment,r),m=d(r),M(s.$$.fragment,r),o=d(r),M(l.$$.fragment,r)},m(r,y){f(t,r,y),p(r,m,y),f(s,r,y),p(r,o,y),f(l,r,y),n=!0},p(r,y){const W={};y&2&&(W.$$scope={dirty:y,ctx:r}),t.$set(W);const I={};y&2&&(I.$$scope={dirty:y,ctx:r}),s.$set(I);const Z={};y&2&&(Z.$$scope={dirty:y,ctx:r}),l.$set(Z)},i(r){n||(h(t.$$.fragment,r),h(s.$$.fragment,r),h(l.$$.fragment,r),n=!0)},o(r){b(t.$$.fragment,r),b(s.$$.fragment,r),b(l.$$.fragment,r),n=!1},d(r){r&&(i(m),i(o)),J(t,r),J(s,r),J(l,r)}}}function Un(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(){u(t.$$.fragment)},l(s){M(t.$$.fragment,s)},m(s,o){f(t,s,o),m=!0},p:$,i(s){m||(h(t.$$.fragment,s),m=!0)},o(s){b(t.$$.fragment,s),m=!1},d(s){J(t,s)}}}function Tn(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(){u(t.$$.fragment)},l(s){M(t.$$.fragment,s)},m(s,o){f(t,s,o),m=!0},p:$,i(s){m||(h(t.$$.fragment,s),m=!0)},o(s){b(t.$$.fragment,s),m=!1},d(s){J(t,s)}}}function Wn(g){let t,m,s,o;return t=new G({props:{id:"image-to-image",option:"Kandinsky 2.1",$$slots:{default:[Un]},$$scope:{ctx:g}}}),s=new G({props:{id:"image-to-image",option:"Kandinsky 2.2",$$slots:{default:[Tn]},$$scope:{ctx:g}}}),{c(){u(t.$$.fragment),m=c(),u(s.$$.fragment)},l(l){M(t.$$.fragment,l),m=d(l),M(s.$$.fragment,l)},m(l,n){f(t,l,n),p(l,m,n),f(s,l,n),o=!0},p(l,n){const r={};n&2&&(r.$$scope={dirty:n,ctx:l}),t.$set(r);const y={};n&2&&(y.$$scope={dirty:n,ctx:l}),s.$set(y)},i(l){o||(h(t.$$.fragment,l),h(s.$$.fragment,l),o=!0)},o(l){b(t.$$.fragment,l),b(s.$$.fragment,l),o=!1},d(l){l&&i(m),J(t,l),J(s,l)}}}function $n(g){let t,m='⚠️ 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/v0.30.2/en/api/pipelines/kandinsky#diffusers.KandinskyInpaintPipeline">KandinskyInpaintPipeline</a> in production, you need to change the mask to use white pixels:',s,o,l;return o=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}}),{c(){t=k("p"),t.innerHTML=m,s=c(),u(o.$$.fragment)},l(n){t=w(n,"P",{"data-svelte-h":!0}),U(t)!=="svelte-zg12tw"&&(t.innerHTML=m),s=d(n),M(o.$$.fragment,n)},m(n,r){p(n,t,r),p(n,s,r),f(o,n,r),l=!0},p:$,i(n){l||(h(o.$$.fragment,n),l=!0)},o(n){b(o.$$.fragment,n),l=!1},d(n){n&&(i(t),i(s)),J(o,n)}}}function jn(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(){u(t.$$.fragment)},l(s){M(t.$$.fragment,s)},m(s,o){f(t,s,o),m=!0},p:$,i(s){m||(h(t.$$.fragment,s),m=!0)},o(s){b(t.$$.fragment,s),m=!1},d(s){J(t,s)}}}function Gn(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(){u(t.$$.fragment)},l(s){M(t.$$.fragment,s)},m(s,o){f(t,s,o),m=!0},p:$,i(s){m||(h(t.$$.fragment,s),m=!0)},o(s){b(t.$$.fragment,s),m=!1},d(s){J(t,s)}}}function In(g){let t,m,s,o;return t=new G({props:{id:"inpaint",option:"Kandinsky 2.1",$$slots:{default:[jn]},$$scope:{ctx:g}}}),s=new G({props:{id:"inpaint",option:"Kandinsky 2.2",$$slots:{default:[Gn]},$$scope:{ctx:g}}}),{c(){u(t.$$.fragment),m=c(),u(s.$$.fragment)},l(l){M(t.$$.fragment,l),m=d(l),M(s.$$.fragment,l)},m(l,n){f(t,l,n),p(l,m,n),f(s,l,n),o=!0},p(l,n){const r={};n&2&&(r.$$scope={dirty:n,ctx:l}),t.$set(r);const y={};n&2&&(y.$$scope={dirty:n,ctx:l}),s.$set(y)},i(l){o||(h(t.$$.fragment,l),h(s.$$.fragment,l),o=!0)},o(l){b(t.$$.fragment,l),b(s.$$.fragment,l),o=!1},d(l){l&&i(m),J(t,l),J(s,l)}}}function Vn(g){let t,m,s,o='<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(){u(t.$$.fragment),m=c(),s=k("div"),s.innerHTML=o,this.h()},l(n){M(t.$$.fragment,n),m=d(n),s=w(n,"DIV",{class:!0,"data-svelte-h":!0}),U(s)!=="svelte-1d04i1f"&&(s.innerHTML=o),this.h()},h(){V(s,"class","flex justify-center")},m(n,r){f(t,n,r),p(n,m,r),p(n,s,r),l=!0},p:$,i(n){l||(h(t.$$.fragment,n),l=!0)},o(n){b(t.$$.fragment,n),l=!1},d(n){n&&(i(m),i(s)),J(t,n)}}}function Bn(g){let t,m,s,o='<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(){u(t.$$.fragment),m=c(),s=k("div"),s.innerHTML=o,this.h()},l(n){M(t.$$.fragment,n),m=d(n),s=w(n,"DIV",{class:!0,"data-svelte-h":!0}),U(s)!=="svelte-1ajezuw"&&(s.innerHTML=o),this.h()},h(){V(s,"class","flex justify-center")},m(n,r){f(t,n,r),p(n,m,r),p(n,s,r),l=!0},p:$,i(n){l||(h(t.$$.fragment,n),l=!0)},o(n){b(t.$$.fragment,n),l=!1},d(n){n&&(i(m),i(s)),J(t,n)}}}function _n(g){let t,m,s,o;return t=new G({props:{id:"inpaint",option:"Kandinsky 2.1",$$slots:{default:[Vn]},$$scope:{ctx:g}}}),s=new G({props:{id:"inpaint",option:"Kandinsky 2.2",$$slots:{default:[Bn]},$$scope:{ctx:g}}}),{c(){u(t.$$.fragment),m=c(),u(s.$$.fragment)},l(l){M(t.$$.fragment,l),m=d(l),M(s.$$.fragment,l)},m(l,n){f(t,l,n),p(l,m,n),f(s,l,n),o=!0},p(l,n){const r={};n&2&&(r.$$scope={dirty:n,ctx:l}),t.$set(r);const y={};n&2&&(y.$$scope={dirty:n,ctx:l}),s.$set(y)},i(l){o||(h(t.$$.fragment,l),h(s.$$.fragment,l),o=!0)},o(l){b(t.$$.fragment,l),b(s.$$.fragment,l),o=!1},d(l){l&&i(m),J(t,l),J(s,l)}}}function vn(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(){u(t.$$.fragment)},l(s){M(t.$$.fragment,s)},m(s,o){f(t,s,o),m=!0},p:$,i(s){m||(h(t.$$.fragment,s),m=!0)},o(s){b(t.$$.fragment,s),m=!1},d(s){J(t,s)}}}function Xn(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(){u(t.$$.fragment)},l(s){M(t.$$.fragment,s)},m(s,o){f(t,s,o),m=!0},p:$,i(s){m||(h(t.$$.fragment,s),m=!0)},o(s){b(t.$$.fragment,s),m=!1},d(s){J(t,s)}}}function Rn(g){let t,m,s,o;return t=new G({props:{id:"inpaint",option:"Kandinsky 2.1",$$slots:{default:[vn]},$$scope:{ctx:g}}}),s=new G({props:{id:"inpaint",option:"Kandinsky 2.2",$$slots:{default:[Xn]},$$scope:{ctx:g}}}),{c(){u(t.$$.fragment),m=c(),u(s.$$.fragment)},l(l){M(t.$$.fragment,l),m=d(l),M(s.$$.fragment,l)},m(l,n){f(t,l,n),p(l,m,n),f(s,l,n),o=!0},p(l,n){const r={};n&2&&(r.$$scope={dirty:n,ctx:l}),t.$set(r);const y={};n&2&&(y.$$scope={dirty:n,ctx:l}),s.$set(y)},i(l){o||(h(t.$$.fragment,l),h(s.$$.fragment,l),o=!0)},o(l){b(t.$$.fragment,l),b(s.$$.fragment,l),o=!1},d(l){l&&i(m),J(t,l),J(s,l)}}}function Cn(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(){u(t.$$.fragment)},l(s){M(t.$$.fragment,s)},m(s,o){f(t,s,o),m=!0},p:$,i(s){m||(h(t.$$.fragment,s),m=!0)},o(s){b(t.$$.fragment,s),m=!1},d(s){J(t,s)}}}function Yn(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(){u(t.$$.fragment)},l(s){M(t.$$.fragment,s)},m(s,o){f(t,s,o),m=!0},p:$,i(s){m||(h(t.$$.fragment,s),m=!0)},o(s){b(t.$$.fragment,s),m=!1},d(s){J(t,s)}}}function Qn(g){let t,m,s,o;return t=new G({props:{id:"interpolate",option:"Kandinsky 2.1",$$slots:{default:[Cn]},$$scope:{ctx:g}}}),s=new G({props:{id:"interpolate",option:"Kandinsky 2.2",$$slots:{default:[Yn]},$$scope:{ctx:g}}}),{c(){u(t.$$.fragment),m=c(),u(s.$$.fragment)},l(l){M(t.$$.fragment,l),m=d(l),M(s.$$.fragment,l)},m(l,n){f(t,l,n),p(l,m,n),f(s,l,n),o=!0},p(l,n){const r={};n&2&&(r.$$scope={dirty:n,ctx:l}),t.$set(r);const y={};n&2&&(y.$$scope={dirty:n,ctx:l}),s.$set(y)},i(l){o||(h(t.$$.fragment,l),h(s.$$.fragment,l),o=!0)},o(l){b(t.$$.fragment,l),b(s.$$.fragment,l),o=!1},d(l){l&&i(m),J(t,l),J(s,l)}}}function Hn(g){let t,m,s,o='<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(){u(t.$$.fragment),m=c(),s=k("div"),s.innerHTML=o,this.h()},l(n){M(t.$$.fragment,n),m=d(n),s=w(n,"DIV",{class:!0,"data-svelte-h":!0}),U(s)!=="svelte-twgci5"&&(s.innerHTML=o),this.h()},h(){V(s,"class","flex justify-center")},m(n,r){f(t,n,r),p(n,m,r),p(n,s,r),l=!0},p:$,i(n){l||(h(t.$$.fragment,n),l=!0)},o(n){b(t.$$.fragment,n),l=!1},d(n){n&&(i(m),i(s)),J(t,n)}}}function Fn(g){let t,m,s,o='<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(){u(t.$$.fragment),m=c(),s=k("div"),s.innerHTML=o,this.h()},l(n){M(t.$$.fragment,n),m=d(n),s=w(n,"DIV",{class:!0,"data-svelte-h":!0}),U(s)!=="svelte-2ur4ou"&&(s.innerHTML=o),this.h()},h(){V(s,"class","flex justify-center")},m(n,r){f(t,n,r),p(n,m,r),p(n,s,r),l=!0},p:$,i(n){l||(h(t.$$.fragment,n),l=!0)},o(n){b(t.$$.fragment,n),l=!1},d(n){n&&(i(m),i(s)),J(t,n)}}}function Nn(g){let t,m,s,o;return t=new G({props:{id:"interpolate",option:"Kandinsky 2.1",$$slots:{default:[Hn]},$$scope:{ctx:g}}}),s=new G({props:{id:"interpolate",option:"Kandinsky 2.2",$$slots:{default:[Fn]},$$scope:{ctx:g}}}),{c(){u(t.$$.fragment),m=c(),u(s.$$.fragment)},l(l){M(t.$$.fragment,l),m=d(l),M(s.$$.fragment,l)},m(l,n){f(t,l,n),p(l,m,n),f(s,l,n),o=!0},p(l,n){const r={};n&2&&(r.$$scope={dirty:n,ctx:l}),t.$set(r);const y={};n&2&&(y.$$scope={dirty:n,ctx:l}),s.$set(y)},i(l){o||(h(t.$$.fragment,l),h(s.$$.fragment,l),o=!0)},o(l){b(t.$$.fragment,l),b(s.$$.fragment,l),o=!1},d(l){l&&i(m),J(t,l),J(s,l)}}}function Sn(g){let t,m="⚠️ ControlNet is only supported for Kandinsky 2.2!";return{c(){t=k("p"),t.textContent=m},l(s){t=w(s,"P",{"data-svelte-h":!0}),U(t)!=="svelte-ms5sxh"&&(t.textContent=m)},m(s,o){p(s,t,o)},p:$,d(s){s&&i(t)}}}function zn(g){let t,m,s,o,l,n,r,y,W,I="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.",Z,j,qt='<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.',ys,se,Lt='<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.',us,te,Dt='<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.',Ms,le,Pt="This guide will show you how to use the Kandinsky models for text-to-image, image-to-image, inpainting, interpolation, and more.",fs,ne,At="Before you begin, make sure you have the following libraries installed:",hs,ae,bs,v,Js,ie,gs,pe,Ot="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.",ks,X,ws,me,el='🤗 Diffusers also provides an end-to-end API with the <a href="/docs/diffusers/v0.30.2/en/api/pipelines/kandinsky#diffusers.KandinskyCombinedPipeline">KandinskyCombinedPipeline</a> and <a href="/docs/diffusers/v0.30.2/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.',Zs,re,sl='Use the <a href="/docs/diffusers/v0.30.2/en/api/pipelines/auto_pipeline#diffusers.AutoPipelineForText2Image">AutoPipelineForText2Image</a> to automatically call the combined pipelines under the hood:',Us,R,Ts,oe,Ws,ce,tl="For image-to-image, pass the initial image and text prompt to condition the image to the pipeline. Start by loading the prior pipeline:",$s,C,js,de,ll="Download an image to condition on:",Gs,ye,Is,Y,nl='<img class="rounded-xl" src="https://raw.githubusercontent.com/CompVis/stable-diffusion/main/assets/stable-samples/img2img/sketch-mountains-input.jpg"/>',Vs,ue,al="Generate the <code>image_embeds</code> and <code>negative_image_embeds</code> with the prior pipeline:",Bs,Me,_s,fe,il="Now pass the original image, and all the prompts and embeddings to the pipeline to generate an image:",vs,Q,Xs,he,pl='🤗 Diffusers also provides an end-to-end API with the <a href="/docs/diffusers/v0.30.2/en/api/pipelines/kandinsky#diffusers.KandinskyImg2ImgCombinedPipeline">KandinskyImg2ImgCombinedPipeline</a> and <a href="/docs/diffusers/v0.30.2/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.',Rs,be,ml='Use the <a href="/docs/diffusers/v0.30.2/en/api/pipelines/auto_pipeline#diffusers.AutoPipelineForImage2Image">AutoPipelineForImage2Image</a> to automatically call the combined pipelines under the hood:',Cs,H,Ys,Je,Qs,F,Hs,ge,rl="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:",Fs,N,Ns,ke,ol="Load an initial image and create a mask:",Ss,we,zs,Ze,cl="Generate the embeddings with the prior pipeline:",xs,Ue,Es,Te,dl="Now pass the initial image, mask, and prompt and embeddings to the pipeline to generate an image:",Ks,S,qs,We,yl='You can also use the end-to-end <a href="/docs/diffusers/v0.30.2/en/api/pipelines/kandinsky#diffusers.KandinskyInpaintCombinedPipeline">KandinskyInpaintCombinedPipeline</a> and <a href="/docs/diffusers/v0.30.2/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/v0.30.2/en/api/pipelines/auto_pipeline#diffusers.AutoPipelineForInpainting">AutoPipelineForInpainting</a> for this:',Ls,z,Ds,$e,Ps,je,ul="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:",As,x,Os,E,Ml='<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>',et,Ge,fl="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!",st,Ie,tt,Ve,hl="Call the <code>interpolate</code> function to generate the embeddings, and then pass them to the pipeline to generate the image:",lt,K,nt,Be,at,q,it,_e,bl="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.",pt,ve,Jl="Let’s load an image and extract it’s depth map:",mt,Xe,rt,L,gl='<img class="rounded-xl" src="https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/kandinskyv22/cat.png"/>',ot,Re,kl='Then you can use the <code>depth-estimation</code> <a href="https://huggingface.co/docs/transformers/v4.44.2/en/main_classes/pipelines#transformers.Pipeline" rel="nofollow">Pipeline</a> from 🤗 Transformers to process the image and retrieve the depth map:',ct,Ce,dt,Ye,yt,Qe,wl='Load the prior pipeline and the <a href="/docs/diffusers/v0.30.2/en/api/pipelines/kandinsky_v22#diffusers.KandinskyV22ControlnetPipeline">KandinskyV22ControlnetPipeline</a>:',ut,He,Mt,Fe,Zl="Generate the image embeddings from a prompt and negative prompt:",ft,Ne,ht,Se,Ul='Finally, pass the image embeddings and the depth image to the <a href="/docs/diffusers/v0.30.2/en/api/pipelines/kandinsky_v22#diffusers.KandinskyV22ControlnetPipeline">KandinskyV22ControlnetPipeline</a> to generate an image:',bt,ze,Jt,D,Tl='<img class="rounded-xl" src="https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/kandinskyv22/robot_cat_text2img.png"/>',gt,xe,kt,Ee,Wl="For image-to-image with ControlNet, you’ll need to use the:",wt,Ke,$l='<li><a href="/docs/diffusers/v0.30.2/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/v0.30.2/en/api/pipelines/kandinsky_v22#diffusers.KandinskyV22ControlnetImg2ImgPipeline">KandinskyV22ControlnetImg2ImgPipeline</a> to generate an image from the initial image and the image embeddings</li>',Zt,qe,jl='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/v4.44.2/en/main_classes/pipelines#transformers.Pipeline" rel="nofollow">Pipeline</a> from 🤗 Transformers:',Ut,Le,Tt,De,Gl='Load the prior pipeline and the <a href="/docs/diffusers/v0.30.2/en/api/pipelines/kandinsky_v22#diffusers.KandinskyV22ControlnetImg2ImgPipeline">KandinskyV22ControlnetImg2ImgPipeline</a>:',Wt,Pe,$t,Ae,Il="Pass a text prompt and the initial image to the prior pipeline to generate the image embeddings:",jt,Oe,Gt,es,Vl='Now you can run the <a href="/docs/diffusers/v0.30.2/en/api/pipelines/kandinsky_v22#diffusers.KandinskyV22ControlnetImg2ImgPipeline">KandinskyV22ControlnetImg2ImgPipeline</a> to generate an image from the initial image and the image embeddings:',It,ss,Vt,P,Bl='<img class="rounded-xl" src="https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/kandinskyv22/robot_cat.png"/>',Bt,ts,_t,ls,_l="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.",vt,ns,vl='<li>Enable <a href="../optimization/xformers">xFormers</a> if you’re using PyTorch &lt; 2.0:</li>',Xt,as,Rt,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>",Ct,is,Yt,ps,Rl='This is the same as explicitly setting the attention processor to use <a href="/docs/diffusers/v0.30.2/en/api/attnprocessor#diffusers.models.attention_processor.AttnAddedKVProcessor2_0">AttnAddedKVProcessor2_0</a>:',Qt,ms,Ht,O,Cl='<li>Offload the model to the CPU with <a href="/docs/diffusers/v0.30.2/en/api/pipelines/overview#diffusers.DiffusionPipeline.enable_model_cpu_offload">enable_model_cpu_offload()</a> to avoid out-of-memory errors:</li>',Ft,rs,Nt,ee,Yl='<li>By default, the text-to-image pipeline uses the <a href="/docs/diffusers/v0.30.2/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a> but you can replace it with another scheduler like <a href="/docs/diffusers/v0.30.2/en/api/schedulers/ddpm#diffusers.DDPMScheduler">DDPMScheduler</a> to see how that affects the tradeoff between inference speed and image quality:</li>',St,os,zt,cs,xt,ds,Et;return l=new _({props:{title:"Kandinsky",local:"kandinsky",headingTag:"h1"}}),r=new an({props:{classNames:"absolute z-10 right-0 top-0",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"}]}}),ae=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}}),v=new Kt({props:{warning:!0,$$slots:{default:[mn]},$$scope:{ctx:g}}}),ie=new _({props:{title:"Text-to-image",local:"text-to-image",headingTag:"h2"}}),X=new B({props:{id:"text-to-image",options:["Kandinsky 2.1","Kandinsky 2.2","Kandinsky 3"],$$slots:{default:[dn]},$$scope:{ctx:g}}}),R=new B({props:{id:"text-to-image",options:["Kandinsky 2.1","Kandinsky 2.2"],$$slots:{default:[Mn]},$$scope:{ctx:g}}}),oe=new _({props:{title:"Image-to-image",local:"image-to-image",headingTag:"h2"}}),C=new B({props:{id:"image-to-image",options:["Kandinsky 2.1","Kandinsky 2.2","Kandinsky 3"],$$slots:{default:[Jn]},$$scope:{ctx:g}}}),ye=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}}),Me=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}}),Q=new B({props:{id:"image-to-image",options:["Kandinsky 2.1","Kandinsky 2.2","Kandinsky 3"],$$slots:{default:[Zn]},$$scope:{ctx:g}}}),H=new B({props:{id:"image-to-image",options:["Kandinsky 2.1","Kandinsky 2.2"],$$slots:{default:[Wn]},$$scope:{ctx:g}}}),Je=new _({props:{title:"Inpainting",local:"inpainting",headingTag:"h2"}}),F=new Kt({props:{warning:!0,$$slots:{default:[$n]},$$scope:{ctx:g}}}),N=new B({props:{id:"inpaint",options:["Kandinsky 2.1","Kandinsky 2.2"],$$slots:{default:[In]},$$scope:{ctx:g}}}),we=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}}),Ue=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:[_n]},$$scope:{ctx:g}}}),z=new B({props:{id:"inpaint",options:["Kandinsky 2.1","Kandinsky 2.2"],$$slots:{default:[Rn]},$$scope:{ctx:g}}}),$e=new _({props:{title:"Interpolation",local:"interpolation",headingTag:"h2"}}),x=new B({props:{id:"interpolate",options:["Kandinsky 2.1","Kandinsky 2.2"],$$slots:{default:[Qn]},$$scope:{ctx:g}}}),Ie=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:[Nn]},$$scope:{ctx:g}}}),Be=new _({props:{title:"ControlNet",local:"controlnet",headingTag:"h2"}}),q=new Kt({props:{warning:!0,$$slots:{default:[Sn]},$$scope:{ctx:g}}}),Xe=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}}),Ce=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}}),Ye=new _({props:{title:"Text-to-image",local:"controlnet-text-to-image",headingTag:"h3"}}),He=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}}),Ne=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}}),ze=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}}),xe=new _({props:{title:"Image-to-image",local:"controlnet-image-to-image",headingTag:"h3"}}),Le=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}}),Pe=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}}),Oe=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}}),ss=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}}),ts=new _({props:{title:"Optimizations",local:"optimizations",headingTag:"h2"}}),as=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}}),is=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}}),ms=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}}),rs=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}}),os=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}}),cs=new pn({props:{source:"https://github.com/huggingface/diffusers/blob/main/docs/source/en/using-diffusers/kandinsky.md"}}),{c(){t=k("meta"),m=c(),s=k("p"),o=c(),u(l.$$.fragment),n=c(),u(r.$$.fragment),y=c(),W=k("p"),W.textContent=I,Z=c(),j=k("p"),j.innerHTML=qt,ys=c(),se=k("p"),se.innerHTML=Lt,us=c(),te=k("p"),te.innerHTML=Dt,Ms=c(),le=k("p"),le.textContent=Pt,fs=c(),ne=k("p"),ne.textContent=At,hs=c(),u(ae.$$.fragment),bs=c(),u(v.$$.fragment),Js=c(),u(ie.$$.fragment),gs=c(),pe=k("p"),pe.innerHTML=Ot,ks=c(),u(X.$$.fragment),ws=c(),me=k("p"),me.innerHTML=el,Zs=c(),re=k("p"),re.innerHTML=sl,Us=c(),u(R.$$.fragment),Ts=c(),u(oe.$$.fragment),Ws=c(),ce=k("p"),ce.textContent=tl,$s=c(),u(C.$$.fragment),js=c(),de=k("p"),de.textContent=ll,Gs=c(),u(ye.$$.fragment),Is=c(),Y=k("div"),Y.innerHTML=nl,Vs=c(),ue=k("p"),ue.innerHTML=al,Bs=c(),u(Me.$$.fragment),_s=c(),fe=k("p"),fe.textContent=il,vs=c(),u(Q.$$.fragment),Xs=c(),he=k("p"),he.innerHTML=pl,Rs=c(),be=k("p"),be.innerHTML=ml,Cs=c(),u(H.$$.fragment),Ys=c(),u(Je.$$.fragment),Qs=c(),u(F.$$.fragment),Hs=c(),ge=k("p"),ge.textContent=rl,Fs=c(),u(N.$$.fragment),Ns=c(),ke=k("p"),ke.textContent=ol,Ss=c(),u(we.$$.fragment),zs=c(),Ze=k("p"),Ze.textContent=cl,xs=c(),u(Ue.$$.fragment),Es=c(),Te=k("p"),Te.textContent=dl,Ks=c(),u(S.$$.fragment),qs=c(),We=k("p"),We.innerHTML=yl,Ls=c(),u(z.$$.fragment),Ds=c(),u($e.$$.fragment),Ps=c(),je=k("p"),je.textContent=ul,As=c(),u(x.$$.fragment),Os=c(),E=k("div"),E.innerHTML=Ml,et=c(),Ge=k("p"),Ge.textContent=fl,st=c(),u(Ie.$$.fragment),tt=c(),Ve=k("p"),Ve.innerHTML=hl,lt=c(),u(K.$$.fragment),nt=c(),u(Be.$$.fragment),at=c(),u(q.$$.fragment),it=c(),_e=k("p"),_e.textContent=bl,pt=c(),ve=k("p"),ve.textContent=Jl,mt=c(),u(Xe.$$.fragment),rt=c(),L=k("div"),L.innerHTML=gl,ot=c(),Re=k("p"),Re.innerHTML=kl,ct=c(),u(Ce.$$.fragment),dt=c(),u(Ye.$$.fragment),yt=c(),Qe=k("p"),Qe.innerHTML=wl,ut=c(),u(He.$$.fragment),Mt=c(),Fe=k("p"),Fe.textContent=Zl,ft=c(),u(Ne.$$.fragment),ht=c(),Se=k("p"),Se.innerHTML=Ul,bt=c(),u(ze.$$.fragment),Jt=c(),D=k("div"),D.innerHTML=Tl,gt=c(),u(xe.$$.fragment),kt=c(),Ee=k("p"),Ee.textContent=Wl,wt=c(),Ke=k("ul"),Ke.innerHTML=$l,Zt=c(),qe=k("p"),qe.innerHTML=jl,Ut=c(),u(Le.$$.fragment),Tt=c(),De=k("p"),De.innerHTML=Gl,Wt=c(),u(Pe.$$.fragment),$t=c(),Ae=k("p"),Ae.textContent=Il,jt=c(),u(Oe.$$.fragment),Gt=c(),es=k("p"),es.innerHTML=Vl,It=c(),u(ss.$$.fragment),Vt=c(),P=k("div"),P.innerHTML=Bl,Bt=c(),u(ts.$$.fragment),_t=c(),ls=k("p"),ls.textContent=_l,vt=c(),ns=k("ol"),ns.innerHTML=vl,Xt=c(),u(as.$$.fragment),Rt=c(),A=k("ol"),A.innerHTML=Xl,Ct=c(),u(is.$$.fragment),Yt=c(),ps=k("p"),ps.innerHTML=Rl,Qt=c(),u(ms.$$.fragment),Ht=c(),O=k("ol"),O.innerHTML=Cl,Ft=c(),u(rs.$$.fragment),Nt=c(),ee=k("ol"),ee.innerHTML=Yl,St=c(),u(os.$$.fragment),zt=c(),u(cs.$$.fragment),xt=c(),ds=k("p"),this.h()},l(e){const a=ln("svelte-u9bgzb",document.head);t=w(a,"META",{name:!0,content:!0}),a.forEach(i),m=d(e),s=w(e,"P",{}),Al(s).forEach(i),o=d(e),M(l.$$.fragment,e),n=d(e),M(r.$$.fragment,e),y=d(e),W=w(e,"P",{"data-svelte-h":!0}),U(W)!=="svelte-nyn2ud"&&(W.textContent=I),Z=d(e),j=w(e,"P",{"data-svelte-h":!0}),U(j)!=="svelte-rc0qhg"&&(j.innerHTML=qt),ys=d(e),se=w(e,"P",{"data-svelte-h":!0}),U(se)!=="svelte-1lazcye"&&(se.innerHTML=Lt),us=d(e),te=w(e,"P",{"data-svelte-h":!0}),U(te)!=="svelte-1nmmwrx"&&(te.innerHTML=Dt),Ms=d(e),le=w(e,"P",{"data-svelte-h":!0}),U(le)!=="svelte-1l6ivg9"&&(le.textContent=Pt),fs=d(e),ne=w(e,"P",{"data-svelte-h":!0}),U(ne)!=="svelte-cwruts"&&(ne.textContent=At),hs=d(e),M(ae.$$.fragment,e),bs=d(e),M(v.$$.fragment,e),Js=d(e),M(ie.$$.fragment,e),gs=d(e),pe=w(e,"P",{"data-svelte-h":!0}),U(pe)!=="svelte-kq2poq"&&(pe.innerHTML=Ot),ks=d(e),M(X.$$.fragment,e),ws=d(e),me=w(e,"P",{"data-svelte-h":!0}),U(me)!=="svelte-14ig3au"&&(me.innerHTML=el),Zs=d(e),re=w(e,"P",{"data-svelte-h":!0}),U(re)!=="svelte-lc0rfp"&&(re.innerHTML=sl),Us=d(e),M(R.$$.fragment,e),Ts=d(e),M(oe.$$.fragment,e),Ws=d(e),ce=w(e,"P",{"data-svelte-h":!0}),U(ce)!=="svelte-1pueb9d"&&(ce.textContent=tl),$s=d(e),M(C.$$.fragment,e),js=d(e),de=w(e,"P",{"data-svelte-h":!0}),U(de)!=="svelte-1sl9181"&&(de.textContent=ll),Gs=d(e),M(ye.$$.fragment,e),Is=d(e),Y=w(e,"DIV",{class:!0,"data-svelte-h":!0}),U(Y)!=="svelte-1w2zk95"&&(Y.innerHTML=nl),Vs=d(e),ue=w(e,"P",{"data-svelte-h":!0}),U(ue)!=="svelte-ctvdye"&&(ue.innerHTML=al),Bs=d(e),M(Me.$$.fragment,e),_s=d(e),fe=w(e,"P",{"data-svelte-h":!0}),U(fe)!=="svelte-zsncr3"&&(fe.textContent=il),vs=d(e),M(Q.$$.fragment,e),Xs=d(e),he=w(e,"P",{"data-svelte-h":!0}),U(he)!=="svelte-iiciiy"&&(he.innerHTML=pl),Rs=d(e),be=w(e,"P",{"data-svelte-h":!0}),U(be)!=="svelte-tn86p"&&(be.innerHTML=ml),Cs=d(e),M(H.$$.fragment,e),Ys=d(e),M(Je.$$.fragment,e),Qs=d(e),M(F.$$.fragment,e),Hs=d(e),ge=w(e,"P",{"data-svelte-h":!0}),U(ge)!=="svelte-1h9m0px"&&(ge.textContent=rl),Fs=d(e),M(N.$$.fragment,e),Ns=d(e),ke=w(e,"P",{"data-svelte-h":!0}),U(ke)!=="svelte-1lisfug"&&(ke.textContent=ol),Ss=d(e),M(we.$$.fragment,e),zs=d(e),Ze=w(e,"P",{"data-svelte-h":!0}),U(Ze)!=="svelte-1seehfb"&&(Ze.textContent=cl),xs=d(e),M(Ue.$$.fragment,e),Es=d(e),Te=w(e,"P",{"data-svelte-h":!0}),U(Te)!=="svelte-1c90mh7"&&(Te.textContent=dl),Ks=d(e),M(S.$$.fragment,e),qs=d(e),We=w(e,"P",{"data-svelte-h":!0}),U(We)!=="svelte-1q4q5bm"&&(We.innerHTML=yl),Ls=d(e),M(z.$$.fragment,e),Ds=d(e),M($e.$$.fragment,e),Ps=d(e),je=w(e,"P",{"data-svelte-h":!0}),U(je)!=="svelte-iexz0f"&&(je.textContent=ul),As=d(e),M(x.$$.fragment,e),Os=d(e),E=w(e,"DIV",{class:!0,"data-svelte-h":!0}),U(E)!=="svelte-1c7h32m"&&(E.innerHTML=Ml),et=d(e),Ge=w(e,"P",{"data-svelte-h":!0}),U(Ge)!=="svelte-1yz0908"&&(Ge.textContent=fl),st=d(e),M(Ie.$$.fragment,e),tt=d(e),Ve=w(e,"P",{"data-svelte-h":!0}),U(Ve)!=="svelte-lrlri1"&&(Ve.innerHTML=hl),lt=d(e),M(K.$$.fragment,e),nt=d(e),M(Be.$$.fragment,e),at=d(e),M(q.$$.fragment,e),it=d(e),_e=w(e,"P",{"data-svelte-h":!0}),U(_e)!=="svelte-1shkert"&&(_e.textContent=bl),pt=d(e),ve=w(e,"P",{"data-svelte-h":!0}),U(ve)!=="svelte-191d2jn"&&(ve.textContent=Jl),mt=d(e),M(Xe.$$.fragment,e),rt=d(e),L=w(e,"DIV",{class:!0,"data-svelte-h":!0}),U(L)!=="svelte-11gtyyz"&&(L.innerHTML=gl),ot=d(e),Re=w(e,"P",{"data-svelte-h":!0}),U(Re)!=="svelte-18l23eu"&&(Re.innerHTML=kl),ct=d(e),M(Ce.$$.fragment,e),dt=d(e),M(Ye.$$.fragment,e),yt=d(e),Qe=w(e,"P",{"data-svelte-h":!0}),U(Qe)!=="svelte-er376f"&&(Qe.innerHTML=wl),ut=d(e),M(He.$$.fragment,e),Mt=d(e),Fe=w(e,"P",{"data-svelte-h":!0}),U(Fe)!=="svelte-ncejue"&&(Fe.textContent=Zl),ft=d(e),M(Ne.$$.fragment,e),ht=d(e),Se=w(e,"P",{"data-svelte-h":!0}),U(Se)!=="svelte-1s44tw2"&&(Se.innerHTML=Ul),bt=d(e),M(ze.$$.fragment,e),Jt=d(e),D=w(e,"DIV",{class:!0,"data-svelte-h":!0}),U(D)!=="svelte-1oo0se1"&&(D.innerHTML=Tl),gt=d(e),M(xe.$$.fragment,e),kt=d(e),Ee=w(e,"P",{"data-svelte-h":!0}),U(Ee)!=="svelte-1hxrtxz"&&(Ee.textContent=Wl),wt=d(e),Ke=w(e,"UL",{"data-svelte-h":!0}),U(Ke)!=="svelte-1ypjfo2"&&(Ke.innerHTML=$l),Zt=d(e),qe=w(e,"P",{"data-svelte-h":!0}),U(qe)!=="svelte-7gf5ea"&&(qe.innerHTML=jl),Ut=d(e),M(Le.$$.fragment,e),Tt=d(e),De=w(e,"P",{"data-svelte-h":!0}),U(De)!=="svelte-1uk08f"&&(De.innerHTML=Gl),Wt=d(e),M(Pe.$$.fragment,e),$t=d(e),Ae=w(e,"P",{"data-svelte-h":!0}),U(Ae)!=="svelte-1ltdt5k"&&(Ae.textContent=Il),jt=d(e),M(Oe.$$.fragment,e),Gt=d(e),es=w(e,"P",{"data-svelte-h":!0}),U(es)!=="svelte-gty018"&&(es.innerHTML=Vl),It=d(e),M(ss.$$.fragment,e),Vt=d(e),P=w(e,"DIV",{class:!0,"data-svelte-h":!0}),U(P)!=="svelte-eey5ka"&&(P.innerHTML=Bl),Bt=d(e),M(ts.$$.fragment,e),_t=d(e),ls=w(e,"P",{"data-svelte-h":!0}),U(ls)!=="svelte-1x6zzpe"&&(ls.textContent=_l),vt=d(e),ns=w(e,"OL",{"data-svelte-h":!0}),U(ns)!=="svelte-gyrsfr"&&(ns.innerHTML=vl),Xt=d(e),M(as.$$.fragment,e),Rt=d(e),A=w(e,"OL",{start:!0,"data-svelte-h":!0}),U(A)!=="svelte-y09ur0"&&(A.innerHTML=Xl),Ct=d(e),M(is.$$.fragment,e),Yt=d(e),ps=w(e,"P",{"data-svelte-h":!0}),U(ps)!=="svelte-4116tk"&&(ps.innerHTML=Rl),Qt=d(e),M(ms.$$.fragment,e),Ht=d(e),O=w(e,"OL",{start:!0,"data-svelte-h":!0}),U(O)!=="svelte-30h7mn"&&(O.innerHTML=Cl),Ft=d(e),M(rs.$$.fragment,e),Nt=d(e),ee=w(e,"OL",{start:!0,"data-svelte-h":!0}),U(ee)!=="svelte-h5clc4"&&(ee.innerHTML=Yl),St=d(e),M(os.$$.fragment,e),zt=d(e),M(cs.$$.fragment,e),xt=d(e),ds=w(e,"P",{}),Al(ds).forEach(i),this.h()},h(){V(t,"name","hf:doc:metadata"),V(t,"content",xn),V(Y,"class","flex justify-center"),V(E,"class","flex gap-4"),V(L,"class","flex justify-center"),V(D,"class","flex justify-center"),V(P,"class","flex justify-center"),V(A,"start","2"),V(O,"start","3"),V(ee,"start","4")},m(e,a){nn(document.head,t),p(e,m,a),p(e,s,a),p(e,o,a),f(l,e,a),p(e,n,a),f(r,e,a),p(e,y,a),p(e,W,a),p(e,Z,a),p(e,j,a),p(e,ys,a),p(e,se,a),p(e,us,a),p(e,te,a),p(e,Ms,a),p(e,le,a),p(e,fs,a),p(e,ne,a),p(e,hs,a),f(ae,e,a),p(e,bs,a),f(v,e,a),p(e,Js,a),f(ie,e,a),p(e,gs,a),p(e,pe,a),p(e,ks,a),f(X,e,a),p(e,ws,a),p(e,me,a),p(e,Zs,a),p(e,re,a),p(e,Us,a),f(R,e,a),p(e,Ts,a),f(oe,e,a),p(e,Ws,a),p(e,ce,a),p(e,$s,a),f(C,e,a),p(e,js,a),p(e,de,a),p(e,Gs,a),f(ye,e,a),p(e,Is,a),p(e,Y,a),p(e,Vs,a),p(e,ue,a),p(e,Bs,a),f(Me,e,a),p(e,_s,a),p(e,fe,a),p(e,vs,a),f(Q,e,a),p(e,Xs,a),p(e,he,a),p(e,Rs,a),p(e,be,a),p(e,Cs,a),f(H,e,a),p(e,Ys,a),f(Je,e,a),p(e,Qs,a),f(F,e,a),p(e,Hs,a),p(e,ge,a),p(e,Fs,a),f(N,e,a),p(e,Ns,a),p(e,ke,a),p(e,Ss,a),f(we,e,a),p(e,zs,a),p(e,Ze,a),p(e,xs,a),f(Ue,e,a),p(e,Es,a),p(e,Te,a),p(e,Ks,a),f(S,e,a),p(e,qs,a),p(e,We,a),p(e,Ls,a),f(z,e,a),p(e,Ds,a),f($e,e,a),p(e,Ps,a),p(e,je,a),p(e,As,a),f(x,e,a),p(e,Os,a),p(e,E,a),p(e,et,a),p(e,Ge,a),p(e,st,a),f(Ie,e,a),p(e,tt,a),p(e,Ve,a),p(e,lt,a),f(K,e,a),p(e,nt,a),f(Be,e,a),p(e,at,a),f(q,e,a),p(e,it,a),p(e,_e,a),p(e,pt,a),p(e,ve,a),p(e,mt,a),f(Xe,e,a),p(e,rt,a),p(e,L,a),p(e,ot,a),p(e,Re,a),p(e,ct,a),f(Ce,e,a),p(e,dt,a),f(Ye,e,a),p(e,yt,a),p(e,Qe,a),p(e,ut,a),f(He,e,a),p(e,Mt,a),p(e,Fe,a),p(e,ft,a),f(Ne,e,a),p(e,ht,a),p(e,Se,a),p(e,bt,a),f(ze,e,a),p(e,Jt,a),p(e,D,a),p(e,gt,a),f(xe,e,a),p(e,kt,a),p(e,Ee,a),p(e,wt,a),p(e,Ke,a),p(e,Zt,a),p(e,qe,a),p(e,Ut,a),f(Le,e,a),p(e,Tt,a),p(e,De,a),p(e,Wt,a),f(Pe,e,a),p(e,$t,a),p(e,Ae,a),p(e,jt,a),f(Oe,e,a),p(e,Gt,a),p(e,es,a),p(e,It,a),f(ss,e,a),p(e,Vt,a),p(e,P,a),p(e,Bt,a),f(ts,e,a),p(e,_t,a),p(e,ls,a),p(e,vt,a),p(e,ns,a),p(e,Xt,a),f(as,e,a),p(e,Rt,a),p(e,A,a),p(e,Ct,a),f(is,e,a),p(e,Yt,a),p(e,ps,a),p(e,Qt,a),f(ms,e,a),p(e,Ht,a),p(e,O,a),p(e,Ft,a),f(rs,e,a),p(e,Nt,a),p(e,ee,a),p(e,St,a),f(os,e,a),p(e,zt,a),f(cs,e,a),p(e,xt,a),p(e,ds,a),Et=!0},p(e,[a]){const Ql={};a&2&&(Ql.$$scope={dirty:a,ctx:e}),v.$set(Ql);const Hl={};a&2&&(Hl.$$scope={dirty:a,ctx:e}),X.$set(Hl);const Fl={};a&2&&(Fl.$$scope={dirty:a,ctx:e}),R.$set(Fl);const Nl={};a&2&&(Nl.$$scope={dirty:a,ctx:e}),C.$set(Nl);const Sl={};a&2&&(Sl.$$scope={dirty:a,ctx:e}),Q.$set(Sl);const zl={};a&2&&(zl.$$scope={dirty:a,ctx:e}),H.$set(zl);const xl={};a&2&&(xl.$$scope={dirty:a,ctx:e}),F.$set(xl);const El={};a&2&&(El.$$scope={dirty:a,ctx:e}),N.$set(El);const Kl={};a&2&&(Kl.$$scope={dirty:a,ctx:e}),S.$set(Kl);const ql={};a&2&&(ql.$$scope={dirty:a,ctx:e}),z.$set(ql);const Ll={};a&2&&(Ll.$$scope={dirty:a,ctx:e}),x.$set(Ll);const Dl={};a&2&&(Dl.$$scope={dirty:a,ctx:e}),K.$set(Dl);const Pl={};a&2&&(Pl.$$scope={dirty:a,ctx:e}),q.$set(Pl)},i(e){Et||(h(l.$$.fragment,e),h(r.$$.fragment,e),h(ae.$$.fragment,e),h(v.$$.fragment,e),h(ie.$$.fragment,e),h(X.$$.fragment,e),h(R.$$.fragment,e),h(oe.$$.fragment,e),h(C.$$.fragment,e),h(ye.$$.fragment,e),h(Me.$$.fragment,e),h(Q.$$.fragment,e),h(H.$$.fragment,e),h(Je.$$.fragment,e),h(F.$$.fragment,e),h(N.$$.fragment,e),h(we.$$.fragment,e),h(Ue.$$.fragment,e),h(S.$$.fragment,e),h(z.$$.fragment,e),h($e.$$.fragment,e),h(x.$$.fragment,e),h(Ie.$$.fragment,e),h(K.$$.fragment,e),h(Be.$$.fragment,e),h(q.$$.fragment,e),h(Xe.$$.fragment,e),h(Ce.$$.fragment,e),h(Ye.$$.fragment,e),h(He.$$.fragment,e),h(Ne.$$.fragment,e),h(ze.$$.fragment,e),h(xe.$$.fragment,e),h(Le.$$.fragment,e),h(Pe.$$.fragment,e),h(Oe.$$.fragment,e),h(ss.$$.fragment,e),h(ts.$$.fragment,e),h(as.$$.fragment,e),h(is.$$.fragment,e),h(ms.$$.fragment,e),h(rs.$$.fragment,e),h(os.$$.fragment,e),h(cs.$$.fragment,e),Et=!0)},o(e){b(l.$$.fragment,e),b(r.$$.fragment,e),b(ae.$$.fragment,e),b(v.$$.fragment,e),b(ie.$$.fragment,e),b(X.$$.fragment,e),b(R.$$.fragment,e),b(oe.$$.fragment,e),b(C.$$.fragment,e),b(ye.$$.fragment,e),b(Me.$$.fragment,e),b(Q.$$.fragment,e),b(H.$$.fragment,e),b(Je.$$.fragment,e),b(F.$$.fragment,e),b(N.$$.fragment,e),b(we.$$.fragment,e),b(Ue.$$.fragment,e),b(S.$$.fragment,e),b(z.$$.fragment,e),b($e.$$.fragment,e),b(x.$$.fragment,e),b(Ie.$$.fragment,e),b(K.$$.fragment,e),b(Be.$$.fragment,e),b(q.$$.fragment,e),b(Xe.$$.fragment,e),b(Ce.$$.fragment,e),b(Ye.$$.fragment,e),b(He.$$.fragment,e),b(Ne.$$.fragment,e),b(ze.$$.fragment,e),b(xe.$$.fragment,e),b(Le.$$.fragment,e),b(Pe.$$.fragment,e),b(Oe.$$.fragment,e),b(ss.$$.fragment,e),b(ts.$$.fragment,e),b(as.$$.fragment,e),b(is.$$.fragment,e),b(ms.$$.fragment,e),b(rs.$$.fragment,e),b(os.$$.fragment,e),b(cs.$$.fragment,e),Et=!1},d(e){e&&(i(m),i(s),i(o),i(n),i(y),i(W),i(Z),i(j),i(ys),i(se),i(us),i(te),i(Ms),i(le),i(fs),i(ne),i(hs),i(bs),i(Js),i(gs),i(pe),i(ks),i(ws),i(me),i(Zs),i(re),i(Us),i(Ts),i(Ws),i(ce),i($s),i(js),i(de),i(Gs),i(Is),i(Y),i(Vs),i(ue),i(Bs),i(_s),i(fe),i(vs),i(Xs),i(he),i(Rs),i(be),i(Cs),i(Ys),i(Qs),i(Hs),i(ge),i(Fs),i(Ns),i(ke),i(Ss),i(zs),i(Ze),i(xs),i(Es),i(Te),i(Ks),i(qs),i(We),i(Ls),i(Ds),i(Ps),i(je),i(As),i(Os),i(E),i(et),i(Ge),i(st),i(tt),i(Ve),i(lt),i(nt),i(at),i(it),i(_e),i(pt),i(ve),i(mt),i(rt),i(L),i(ot),i(Re),i(ct),i(dt),i(yt),i(Qe),i(ut),i(Mt),i(Fe),i(ft),i(ht),i(Se),i(bt),i(Jt),i(D),i(gt),i(kt),i(Ee),i(wt),i(Ke),i(Zt),i(qe),i(Ut),i(Tt),i(De),i(Wt),i($t),i(Ae),i(jt),i(Gt),i(es),i(It),i(Vt),i(P),i(Bt),i(_t),i(ls),i(vt),i(ns),i(Xt),i(Rt),i(A),i(Ct),i(Yt),i(ps),i(Qt),i(Ht),i(O),i(Ft),i(Nt),i(ee),i(St),i(zt),i(xt),i(ds)),i(t),J(l,e),J(r,e),J(ae,e),J(v,e),J(ie,e),J(X,e),J(R,e),J(oe,e),J(C,e),J(ye,e),J(Me,e),J(Q,e),J(H,e),J(Je,e),J(F,e),J(N,e),J(we,e),J(Ue,e),J(S,e),J(z,e),J($e,e),J(x,e),J(Ie,e),J(K,e),J(Be,e),J(q,e),J(Xe,e),J(Ce,e),J(Ye,e),J(He,e),J(Ne,e),J(ze,e),J(xe,e),J(Le,e),J(Pe,e),J(Oe,e),J(ss,e),J(ts,e),J(as,e),J(is,e),J(ms,e),J(rs,e),J(os,e),J(cs,e)}}}const xn='{"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 En(g){return en(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ea extends sn{constructor(t){super(),tn(this,t,En,zn,Ol,{})}}export{ea as component};
