import{S as Vv,i as Pv,s as Cv,e as a,k as p,w as u,t as l,M as $v,c as s,d as n,m as d,a as i,x as f,h as o,b as m,N as ce,G as t,g as c,y,q as b,o as M,B as _,v as xv,L as ee}from"../../../chunks/vendor-hf-doc-builder.js";import{T as Bv}from"../../../chunks/Tip-hf-doc-builder.js";import{D as U}from"../../../chunks/Docstring-hf-doc-builder.js";import{C as j}from"../../../chunks/CodeBlock-hf-doc-builder.js";import{I as B}from"../../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Ue}from"../../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Rv(I){let g,v,k,w,T,h,J,H,$,te;return $=new j({props:{code:"c2NoZWR1bGVyJTIwJTNEJTIwRERQTVNjaGVkdWxlci5mcm9tX3ByZXRyYWluZWQoJTIya2FuZGluc2t5LWNvbW11bml0eSUyRmthbmRpbnNreS0yLTElMjIlMkMlMjBzdWJmb2xkZXIlM0QlMjJkZHBtX3NjaGVkdWxlciUyMiklMEF0MmlfcGlwZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTItMSUyMiUyQyUyMHNjaGVkdWxlciUzRHNjaGVkdWxlciUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUwQSklMEF0MmlfcGlwZS50byglMjJjdWRhJTIyKQ==",highlighted:`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>)
t2i_pipe = DiffusionPipeline.from_pretrained(
    <span class="hljs-string">&quot;kandinsky-community/kandinsky-2-1&quot;</span>, scheduler=scheduler, torch_dtype=torch.float16
)
t2i_pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)`}}),{c(){g=a("p"),v=l("By default, the text-to-image pipeline use "),k=a("a"),w=l("DDIMScheduler"),T=l(", you can change the scheduler to "),h=a("a"),J=l("DDPMScheduler"),H=p(),u($.$$.fragment),this.h()},l(Z){g=s(Z,"P",{});var E=i(g);v=o(E,"By default, the text-to-image pipeline use "),k=s(E,"A",{href:!0});var me=i(k);w=o(me,"DDIMScheduler"),me.forEach(n),T=o(E,", you can change the scheduler to "),h=s(E,"A",{href:!0});var A=i(h);J=o(A,"DDPMScheduler"),A.forEach(n),E.forEach(n),H=d(Z),f($.$$.fragment,Z),this.h()},h(){m(k,"href","/docs/diffusers/v0.18.0/en/api/schedulers/ddim#diffusers.DDIMScheduler"),m(h,"href","/docs/diffusers/v0.18.0/en/api/schedulers/ddpm#diffusers.DDPMScheduler")},m(Z,E){c(Z,g,E),t(g,v),t(g,k),t(k,w),t(g,T),t(g,h),t(h,J),c(Z,H,E),y($,Z,E),te=!0},p:ee,i(Z){te||(b($.$$.fragment,Z),te=!0)},o(Z){M($.$$.fragment,Z),te=!1},d(Z){Z&&n(g),Z&&n(H),_($,Z)}}}function Xv(I){let g,v,k,w,T,h,J,H,$,te,Z,E,me,A,Tt,D,Nn,We,L,Yn,ne,Kn,Sn,he,je,vt;return je=new j({props:{code:"cHJvbXB0JTIwJTNEJTIwJTIyQSUyMGFsaWVuJTIwY2hlZXNlYnVyZ2VyJTIwY3JlYXR1cmUlMjBlYXRpbmclMjBpdHNlbGYlMkMlMjBjbGF5bWF0aW9uJTJDJTIwY2luZW1hdGljJTJDJTIwbW9vZHklMjBsaWdodGluZyUyMiUwQW5lZ2F0aXZlX3Byb21wdCUyMCUzRCUyMCUyMmxvdyUyMHF1YWxpdHklMkMlMjBiYWQlMjBxdWFsaXR5JTIyJTBBJTBBaW1hZ2VfZW1iZWRzJTJDJTIwbmVnYXRpdmVfaW1hZ2VfZW1iZWRzJTIwJTNEJTIwcGlwZV9wcmlvcihwcm9tcHQlMkMlMjBuZWdhdGl2ZV9wcm9tcHQlMkMlMjBndWlkYW5jZV9zY2FsZSUzRDEuMCkudG9fdHVwbGUoKQ==",highlighted:`prompt = <span class="hljs-string">&quot;A alien cheeseburger creature eating itself, claymation, cinematic, moody lighting&quot;</span>
negative_prompt = <span class="hljs-string">&quot;low quality, bad quality&quot;</span>

image_embeds, negative_image_embeds = pipe_prior(prompt, negative_prompt, guidance_scale=<span class="hljs-number">1.0</span>).to_tuple()`}}),{c(){g=a("p"),v=l("The text-to-image pipeline expects both "),k=a("code"),w=l("image_embeds"),T=l(", "),h=a("code"),J=l("negative_image_embeds"),H=l(` and the original
`),$=a("code"),te=l("prompt"),Z=l(` as the text-to-image pipeline uses another text encoder to better guide the second diffusion
process of `),E=a("code"),me=l("t2i_pipe"),A=l("."),Tt=p(),D=a("p"),Nn=l("By default, the prior returns unconditioned negative image embeddings corresponding to the negative prompt of "),We=a("code"),L=l('""'),Yn=l(`.
For better results, you can also pass a `),ne=a("code"),Kn=l("negative_prompt"),Sn=l(` to the prior. This will increase the effective batch size
of the prior by a factor of 2.`),he=p(),u(je.$$.fragment)},l(W){g=s(W,"P",{});var G=i(g);v=o(G,"The text-to-image pipeline expects both "),k=s(G,"CODE",{});var Ti=i(k);w=o(Ti,"image_embeds"),Ti.forEach(n),T=o(G,", "),h=s(G,"CODE",{});var Ge=i(h);J=o(Ge,"negative_image_embeds"),Ge.forEach(n),H=o(G,` and the original
`),$=s(G,"CODE",{});var vi=i($);te=o(vi,"prompt"),vi.forEach(n),Z=o(G,` as the text-to-image pipeline uses another text encoder to better guide the second diffusion
process of `),E=s(G,"CODE",{});var Ui=i(E);me=o(Ui,"t2i_pipe"),Ui.forEach(n),A=o(G,"."),G.forEach(n),Tt=d(W),D=s(W,"P",{});var Ie=i(D);Nn=o(Ie,"By default, the prior returns unconditioned negative image embeddings corresponding to the negative prompt of "),We=s(Ie,"CODE",{});var V=i(We);L=o(V,'""'),V.forEach(n),Yn=o(Ie,`.
For better results, you can also pass a `),ne=s(Ie,"CODE",{});var ji=i(ne);Kn=o(ji,"negative_prompt"),ji.forEach(n),Sn=o(Ie,` to the prior. This will increase the effective batch size
of the prior by a factor of 2.`),Ie.forEach(n),he=d(W),f(je.$$.fragment,W)},m(W,G){c(W,g,G),t(g,v),t(g,k),t(k,w),t(g,T),t(g,h),t(h,J),t(g,H),t(g,$),t($,te),t(g,Z),t(g,E),t(E,me),t(g,A),c(W,Tt,G),c(W,D,G),t(D,Nn),t(D,We),t(We,L),t(D,Yn),t(D,ne),t(ne,Kn),t(D,Sn),c(W,he,G),y(je,W,G),vt=!0},p:ee,i(W){vt||(b(je.$$.fragment,W),vt=!0)},o(W){M(je.$$.fragment,W),vt=!1},d(W){W&&n(g),W&&n(Tt),W&&n(D),W&&n(he),_(je,W)}}}function Fv(I){let g,v,k,w,T;return w=new j({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEthbmRpbnNreVYyMlBpcGVsaW5lJTJDJTIwS2FuZGluc2t5VjIyUHJpb3JQaXBlbGluZSUwQWltcG9ydCUyMHRvcmNoJTBBJTBBcGlwZV9wcmlvciUyMCUzRCUyMEthbmRpbnNreVYyMlByaW9yUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMi0yLXByaW9yJTIyKSUwQXBpcGVfcHJpb3IudG8oJTIyY3VkYSUyMiklMEFwcm9tcHQlMjAlM0QlMjAlMjJyZWQlMjBjYXQlMkMlMjA0ayUyMHBob3RvJTIyJTBBb3V0JTIwJTNEJTIwcGlwZV9wcmlvcihwcm9tcHQpJTBBaW1hZ2VfZW1iJTIwJTNEJTIwb3V0LmltYWdlX2VtYmVkcyUwQXplcm9faW1hZ2VfZW1iJTIwJTNEJTIwb3V0Lm5lZ2F0aXZlX2ltYWdlX2VtYmVkcyUwQXBpcGUlMjAlM0QlMjBLYW5kaW5za3lWMjJQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTIya2FuZGluc2t5LWNvbW11bml0eSUyRmthbmRpbnNreS0yLTItZGVjb2RlciUyMiklMEFwaXBlLnRvKCUyMmN1ZGElMjIpJTBBaW1hZ2UlMjAlM0QlMjBwaXBlKCUwQSUyMCUyMCUyMCUyMGltYWdlX2VtYmVkcyUzRGltYWdlX2VtYiUyQyUwQSUyMCUyMCUyMCUyMG5lZ2F0aXZlX2ltYWdlX2VtYmVkcyUzRHplcm9faW1hZ2VfZW1iJTJDJTBBJTIwJTIwJTIwJTIwaGVpZ2h0JTNENzY4JTJDJTBBJTIwJTIwJTIwJTIwd2lkdGglM0Q3NjglMkMlMEElMjAlMjAlMjAlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNENTAlMkMlMEEpLmltYWdlcyUwQWltYWdlJTVCMCU1RC5zYXZlKCUyMmNhdC5wbmclMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> KandinskyV22Pipeline, KandinskyV22PriorPipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>pipe_prior = KandinskyV22PriorPipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-2-prior&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe_prior.to(<span class="hljs-string">&quot;cuda&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;red cat, 4k photo&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>out = pipe_prior(prompt)
<span class="hljs-meta">&gt;&gt;&gt; </span>image_emb = out.image_embeds
<span class="hljs-meta">&gt;&gt;&gt; </span>zero_image_emb = out.negative_image_embeds
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = KandinskyV22Pipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-2-decoder&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>image = pipe(
<span class="hljs-meta">... </span>    image_embeds=image_emb,
<span class="hljs-meta">... </span>    negative_image_embeds=zero_image_emb,
<span class="hljs-meta">... </span>    height=<span class="hljs-number">768</span>,
<span class="hljs-meta">... </span>    width=<span class="hljs-number">768</span>,
<span class="hljs-meta">... </span>    num_inference_steps=<span class="hljs-number">50</span>,
<span class="hljs-meta">... </span>).images
<span class="hljs-meta">&gt;&gt;&gt; </span>image[<span class="hljs-number">0</span>].save(<span class="hljs-string">&quot;cat.png&quot;</span>)`}}),{c(){g=a("p"),v=l("Examples:"),k=p(),u(w.$$.fragment)},l(h){g=s(h,"P",{});var J=i(g);v=o(J,"Examples:"),J.forEach(n),k=d(h),f(w.$$.fragment,h)},m(h,J){c(h,g,J),t(g,v),c(h,k,J),y(w,h,J),T=!0},p:ee,i(h){T||(b(w.$$.fragment,h),T=!0)},o(h){M(w.$$.fragment,h),T=!1},d(h){h&&n(g),h&&n(k),_(w,h)}}}function Qv(I){let g,v,k,w,T;return w=new j({props:{code:"aW1wb3J0JTIwdG9yY2glMEFpbXBvcnQlMjBudW1weSUyMGFzJTIwbnAlMEElMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwS2FuZGluc2t5VjIyUHJpb3JQaXBlbGluZSUyQyUyMEthbmRpbnNreVYyMkNvbnRyb2xuZXRQaXBlbGluZSUwQWZyb20lMjB0cmFuc2Zvcm1lcnMlMjBpbXBvcnQlMjBwaXBlbGluZSUwQWZyb20lMjBkaWZmdXNlcnMudXRpbHMlMjBpbXBvcnQlMjBsb2FkX2ltYWdlJTBBJTBBJTBBZGVmJTIwbWFrZV9oaW50KGltYWdlJTJDJTIwZGVwdGhfZXN0aW1hdG9yKSUzQSUwQSUyMCUyMCUyMCUyMGltYWdlJTIwJTNEJTIwZGVwdGhfZXN0aW1hdG9yKGltYWdlKSU1QiUyMmRlcHRoJTIyJTVEJTBBJTIwJTIwJTIwJTIwaW1hZ2UlMj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yJTJDJTBBJTIwJTIwJTIwJTIwaGVpZ2h0JTNENzY4JTJDJTBBJTIwJTIwJTIwJTIwd2lkdGglM0Q3NjglMkMlMEEpLmltYWdlcyUwQSUwQWltYWdlcyU1QjAlNUQuc2F2ZSglMjJyb2JvdF9jYXQucG5nJTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> KandinskyV22PriorPipeline, KandinskyV22ControlnetPipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image


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


<span class="hljs-meta">&gt;&gt;&gt; </span>depth_estimator = pipeline(<span class="hljs-string">&quot;depth-estimation&quot;</span>)

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

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


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

<span class="hljs-meta">&gt;&gt;&gt; </span>hint = make_hint(img, depth_estimator).unsqueeze(<span class="hljs-number">0</span>).half().to(<span class="hljs-string">&quot;cuda&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;A robot, 4k photo&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </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>

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

<span class="hljs-meta">&gt;&gt;&gt; </span>image_emb, zero_image_emb = pipe_prior(
<span class="hljs-meta">... </span>    prompt=prompt, negative_prompt=negative_prior_prompt, generator=generator
<span class="hljs-meta">... </span>).to_tuple()

<span class="hljs-meta">&gt;&gt;&gt; </span>images = pipe(
<span class="hljs-meta">... </span>    image_embeds=image_emb,
<span class="hljs-meta">... </span>    negative_image_embeds=zero_image_emb,
<span class="hljs-meta">... </span>    hint=hint,
<span class="hljs-meta">... </span>    num_inference_steps=<span class="hljs-number">50</span>,
<span class="hljs-meta">... </span>    generator=generator,
<span class="hljs-meta">... </span>    height=<span class="hljs-number">768</span>,
<span class="hljs-meta">... </span>    width=<span class="hljs-number">768</span>,
<span class="hljs-meta">... </span>).images

<span class="hljs-meta">&gt;&gt;&gt; </span>images[<span class="hljs-number">0</span>].save(<span class="hljs-string">&quot;robot_cat.png&quot;</span>)`}}),{c(){g=a("p"),v=l("Examples:"),k=p(),u(w.$$.fragment)},l(h){g=s(h,"P",{});var J=i(g);v=o(J,"Examples:"),J.forEach(n),k=d(h),f(w.$$.fragment,h)},m(h,J){c(h,g,J),t(g,v),c(h,k,J),y(w,h,J),T=!0},p:ee,i(h){T||(b(w.$$.fragment,h),T=!0)},o(h){M(w.$$.fragment,h),T=!1},d(h){h&&n(g),h&&n(k),_(w,h)}}}function Nv(I){let g,v,k,w,T;return w=new j({props:{code:"aW1wb3J0JTIwdG9yY2glMEFpbXBvcnQlMjBudW1weSUyMGFzJTIwbnAlMEElMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwS2FuZGluc2t5VjIyUHJpb3JFbWIyRW1iUGlwZWxpbmUlMkMlMjBLYW5kaW5za3lWMjJDb250cm9sbmV0SW1nMkltZ1BpcGVsaW5lJTBBZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBZnJvbS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3RoJTNEMSUyQyUyMGdlbmVyYXRvciUzRGdlbmVyYXRvciklMEElMEFpbWFnZXMlMjAlM0QlMjBwaXBlKCUwQSUyMCUyMCUyMCUyMGltYWdlJTNEaW1nJTJDJTBBJTIwJTIwJTIwJTIwc3RyZW5ndGglM0QwLjUlMkMlMEElMjAlMjAlMjAlMjBpbWFnZV9lbWJlZHMlM0RpbWdfZW1iLmltYWdlX2VtYmVkcyUyQyUwQSUyMCUyMCUyMCUyMG5lZ2F0aXZlX2ltYWdlX2VtYmVkcyUzRG5lZ2F0aXZlX2VtYi5pbWFnZV9lbWJlZHMlMkMlMEElMjAlMjAlMjAlMjBoaW50JTNEaGludCUyQyUwQSUyMCUyMCUyMCUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0Q1MCUyQyUwQSUyMCUyMCUyMCUyMGdlbmVyYXRvciUzRGdlbmVyYXRvciUyQyUwQSUyMCUyMCUyMCUyMGhlaWdodCUzRDc2OCUyQyUwQSUyMCUyMCUyMCUyMHdpZHRoJTNENzY4JTJDJTBBKS5pbWFnZXMlMEElMEFpbWFnZXMlNUIwJTVELnNhdmUoJTIycm9ib3RfY2F0LnBuZyUyMik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np

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


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


<span class="hljs-meta">&gt;&gt;&gt; </span>depth_estimator = pipeline(<span class="hljs-string">&quot;depth-estimation&quot;</span>)

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

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

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


<span class="hljs-meta">&gt;&gt;&gt; </span>hint = make_hint(img, depth_estimator).unsqueeze(<span class="hljs-number">0</span>).half().to(<span class="hljs-string">&quot;cuda&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;A robot, 4k photo&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </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>

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

<span class="hljs-meta">&gt;&gt;&gt; </span>img_emb = pipe_prior(prompt=prompt, image=img, strength=<span class="hljs-number">0.85</span>, generator=generator)
<span class="hljs-meta">&gt;&gt;&gt; </span>negative_emb = pipe_prior(prompt=negative_prior_prompt, image=img, strength=<span class="hljs-number">1</span>, generator=generator)

<span class="hljs-meta">&gt;&gt;&gt; </span>images = pipe(
<span class="hljs-meta">... </span>    image=img,
<span class="hljs-meta">... </span>    strength=<span class="hljs-number">0.5</span>,
<span class="hljs-meta">... </span>    image_embeds=img_emb.image_embeds,
<span class="hljs-meta">... </span>    negative_image_embeds=negative_emb.image_embeds,
<span class="hljs-meta">... </span>    hint=hint,
<span class="hljs-meta">... </span>    num_inference_steps=<span class="hljs-number">50</span>,
<span class="hljs-meta">... </span>    generator=generator,
<span class="hljs-meta">... </span>    height=<span class="hljs-number">768</span>,
<span class="hljs-meta">... </span>    width=<span class="hljs-number">768</span>,
<span class="hljs-meta">... </span>).images

<span class="hljs-meta">&gt;&gt;&gt; </span>images[<span class="hljs-number">0</span>].save(<span class="hljs-string">&quot;robot_cat.png&quot;</span>)`}}),{c(){g=a("p"),v=l("Examples:"),k=p(),u(w.$$.fragment)},l(h){g=s(h,"P",{});var J=i(g);v=o(J,"Examples:"),J.forEach(n),k=d(h),f(w.$$.fragment,h)},m(h,J){c(h,g,J),t(g,v),c(h,k,J),y(w,h,J),T=!0},p:ee,i(h){T||(b(w.$$.fragment,h),T=!0)},o(h){M(w.$$.fragment,h),T=!1},d(h){h&&n(g),h&&n(k),_(w,h)}}}function Yv(I){let g,v,k,w,T;return w=new j({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEthbmRpbnNreVYyMkltZzJJbWdQaXBlbGluZSUyQyUyMEthbmRpbnNreVYyMlByaW9yUGlwZWxpbmUlMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwbG9hZF9pbWFnZSUwQWltcG9ydCUyMHRvcmNoJTBBJTBBcGlwZV9wcmlvciUyMCUzRCUyMEthbmRpbnNreVYyMlByaW9yUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMi0yLXByaW9yJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTBBKSUwQXBpcGVfcHJpb3IudG8oJTIyY3VkYSUyMiklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJBJTIwcmVkJTIwY2FydG9vbiUyMGZyb2clMkMlMjA0ayUyMiUwQWltYWdlX2VtYiUyQyUyMHplcm9faW1hZ2VfZW1iJTIwJTNEJTIwcGlwZV9wcmlvcihwcm9tcHQlMkMlMjByZXR1cm5fZGljdCUzREZhbHNlKSUwQSUwQXBpcGUlMjAlM0QlMjBLYW5kaW5za3lWMjJJbWcySW1nUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMi0yLWRlY29kZXIlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMEEpJTBBcGlwZS50byglMjJjdWRhJTIyKSUwQSUwQWluaXRfaW1hZ2UlMjAlM0QlMjBsb2FkX2ltYWdlKCUwQSUyMCUyMCUyMCUyMCUyMmh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZkYXRhc2V0cyUyRmhmLWludGVybmFsLXRlc3RpbmclMkZkaWZmdXNlcnMtaW1hZ2VzJTJGcmVzb2x2ZSUyRm1haW4lMjIlMEElMjAlMjAlMjAlMjAlMjIlMkZrYW5kaW5za3klMkZmcm9nLnBuZyUyMiUwQSklMEElMEFpbWFnZSUyMCUzRCUyMHBpcGUoJTBBJTIwJTIwJTIwJTIwaW1hZ2UlM0Rpbml0X2ltYWdlJTJDJTBBJTIwJTIwJTIwJTIwaW1hZ2VfZW1iZWRzJTNEaW1hZ2VfZW1iJTJDJTBBJTIwJTIwJTIwJTIwbmVnYXRpdmVfaW1hZ2VfZW1iZWRzJTNEemVyb19pbWFnZV9lbWIlMkMlMEElMjAlMjAlMjAlMjBoZWlnaHQlM0Q3NjglMkMlMEElMjAlMjAlMjAlMjB3aWR0aCUzRDc2OCUyQyUwQSUyMCUyMCUyMCUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0QxMDAlMkMlMEElMjAlMjAlMjAlMjBzdHJlbmd0aCUzRDAuMiUyQyUwQSkuaW1hZ2VzJTBBJTBBaW1hZ2UlNUIwJTVELnNhdmUoJTIycmVkX2Zyb2cucG5nJTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> KandinskyV22Img2ImgPipeline, KandinskyV22PriorPipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

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

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

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

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

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

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

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

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

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

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

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span>image = out.images[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>image.save(<span class="hljs-string">&quot;cat_with_hat.png&quot;</span>)`}}),{c(){g=a("p"),v=l("Examples:"),k=p(),u(w.$$.fragment)},l(h){g=s(h,"P",{});var J=i(g);v=o(J,"Examples:"),J.forEach(n),k=d(h),f(w.$$.fragment,h)},m(h,J){c(h,g,J),t(g,v),c(h,k,J),y(w,h,J),T=!0},p:ee,i(h){T||(b(w.$$.fragment,h),T=!0)},o(h){M(w.$$.fragment,h),T=!1},d(h){h&&n(g),h&&n(k),_(w,h)}}}function Sv(I){let g,v,k,w,T;return w=new j({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEthbmRpbnNreVYyMlBpcGVsaW5lJTJDJTIwS2FuZGluc2t5VjIyUHJpb3JFbWIyRW1iUGlwZWxpbmUlMEFpbXBvcnQlMjB0b3JjaCUwQSUwQXBpcGVfcHJpb3IlMjAlM0QlMjBLYW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iZWRzJTNEbmVnYXRpdmVfaW1hZ2VfZW1iJTJDJTBBJTIwJTIwJTIwJTIwaGVpZ2h0JTNENzY4JTJDJTBBJTIwJTIwJTIwJTIwd2lkdGglM0Q3NjglMkMlMEElMjAlMjAlMjAlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNEMTAwJTJDJTBBKS5pbWFnZXMlMEElMEFpbWFnZSU1QjAlNUQuc2F2ZSglMjJjYXQucG5nJTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> KandinskyV22Pipeline, KandinskyV22PriorEmb2EmbPipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

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

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;red cat, 4k photo&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>img = load_image(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main&quot;</span>
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;/kandinsky/cat.png&quot;</span>
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>image_emb, nagative_image_emb = pipe_prior(prompt, image=img, strength=<span class="hljs-number">0.2</span>).to_tuple()

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span>image = out.images[<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>image.save(<span class="hljs-string">&quot;cat_with_hat.png&quot;</span>)`}}),{c(){g=a("p"),v=l("Examples:"),k=p(),u(w.$$.fragment)},l(h){g=s(h,"P",{});var J=i(g);v=o(J,"Examples:"),J.forEach(n),k=d(h),f(w.$$.fragment,h)},m(h,J){c(h,g,J),t(g,v),c(h,k,J),y(w,h,J),T=!0},p:ee,i(h){T||(b(w.$$.fragment,h),T=!0)},o(h){M(w.$$.fragment,h),T=!1},d(h){h&&n(g),h&&n(k),_(w,h)}}}function Ov(I){let g,v,k,w,T,h,J,H,$,te,Z,E,me,A,Tt,D,Nn,We,L,Yn,ne,Kn,Sn,he,je,vt,W,G,Ti,Ge,vi,Ui,Ie,V,ji,qn,Vh,Ph,Dn,Ch,$h,zn,xh,Rh,Hn,Xh,Fh,An,Qh,Nh,Ln,Yh,Kh,On,Sh,td,nt,Ut,no,ea,qh,ao,Dh,nd,Ii,zh,ad,at,jt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Bp,i2,l2,Vp,o2,r2,Pp,p2,d2,c2,Cn,ci,m2,mi,h2,Cp,g2,u2,nm,Jt,$n,$p,hi,f2,xp,y2,am,q,gi,b2,Rp,M2,_2,ui,w2,Xl,J2,k2,T2,Se,fi,v2,Xp,U2,j2,xn,I2,Rn,yi,Z2,de,W2,Fp,G2,E2,Qp,B2,V2,Np,P2,C2,Yp,$2,x2,R2,Xn,bi,X2,Mi,F2,Kp,Q2,N2,sm;return h=new B({}),A=new B({}),ea=new B({}),ta=new B({}),aa=new j({props:{code:"cHJvbXB0JTIwJTNEJTIwJTIyQSUyMGFsaWVuJTIwY2hlZXNlYnVyZ2VyJTIwY3JlYXR1cmUlMjBlYXRpbmclMjBpdHNlbGYlMkMlMjBjbGF5bWF0aW9uJTJDJTIwY2luZW1hdGljJTJDJTIwbW9vZHklMjBsaWdodGluZyUyMg==",highlighted:'prompt = <span class="hljs-string">&quot;A alien cheeseburger creature eating itself, claymation, cinematic, moody lighting&quot;</span>'}}),sa=new j({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBaW1wb3J0JTIwdG9yY2glMEElMEFwaXBlX3ByaW9yJTIwJTNEJTIwRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMi0xLXByaW9yJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2KSUwQXBpcGVfcHJpb3IudG8oJTIyY3VkYSUyMiklMEElMEF0MmlfcGlwZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTItMSUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiklMEF0MmlfcGlwZS50byglMjJjdWRhJTIyKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline
<span class="hljs-keyword">import</span> torch

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

t2i_pipe = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-1&quot;</span>, torch_dtype=torch.float16)
t2i_pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)`}}),It=new Bv({props:{warning:!0,$$slots:{default:[Rv]},$$scope:{ctx:I}}}),ia=new j({props:{code:"aW1hZ2VfZW1iZWRzJTJDJTIwbmVnYXRpdmVfaW1hZ2VfZW1iZWRzJTIwJTNEJTIwcGlwZV9wcmlvcihwcm9tcHQlMkMlMjBndWlkYW5jZV9zY2FsZSUzRDEuMCkudG9fdHVwbGUoKQ==",highlighted:'image_embeds, negative_image_embeds = pipe_prior(prompt, guidance_scale=<span class="hljs-number">1.0</span>).to_tuple()'}}),Zt=new Bv({props:{warning:!0,$$slots:{default:[Xv]},$$scope:{ctx:I}}}),la=new j({props:{code:"aW1hZ2UlMjAlM0QlMjB0MmlfcGlwZSglMEElMjAlMjAlMjAlMjBwcm9tcHQlMkMlMjBpbWFnZV9lbWJlZHMlM0RpbWFnZV9lbWJlZHMlMkMlMjBuZWdhdGl2ZV9pbWFnZV9lbWJlZHMlM0RuZWdhdGl2ZV9pbWFnZV9lbWJlZHMlMkMlMjBoZWlnaHQlM0Q3NjglMkMlMjB3aWR0aCUzRDc2OCUwQSkuaW1hZ2VzJTVCMCU1RCUwQWltYWdlLnNhdmUoJTIyY2hlZXNlYnVyZ2VyX21vbnN0ZXIucG5nJTIyKQ==",highlighted:`image = t2i_pipe(
    prompt, 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.save(<span class="hljs-string">&quot;cheeseburger_monster.png&quot;</span>)`}}),oa=new j({props:{code:"cHJvbXB0JTIwJTNEJTIwJTIyYmlyZCUyMGV5ZSUyMHZpZXclMjBzaG90JTIwb2YlMjBhJTIwZnVsbCUyMGJvZHklMjB3b21hbiUyMHdpdGglMjBjeWFuJTIwbGlnaHQlMjBvcmFuZ2UlMjBtYWdlbnRhJTIwbWFrZXVwJTJDJTIwZGlnaXRhbCUyMGFydCUyQyUyMGxvbmclMjBicmFpZGVkJTIwaGFpciUyMGhlciUyMGZhY2UlMjBzZXBhcmF0ZWQlMjBieSUyMG1ha2V1cCUyMGluJTIwdGhlJTIwc3R5bGUlMjBvZiUyMHlpbiUyMFlhbmclMjBzdXJyZWFsaXNtJTJDJTIwc3ltbWV0cmljYWwlMjBmYWNlJTJDJTIwcmVhbCUyMGltYWdlJTJDJTIwY29udHJhc3RpbmclMjB0b25lJTJDJTIwcGFzdGVsJTIwZ3JhZGllbnQlMjBiYWNrZ3JvdW5kJTIy",highlighted:'prompt = <span class="hljs-string">&quot;bird eye view shot of a full body woman with cyan light orange magenta makeup, digital art, long braided hair her face separated by makeup in the style of yin Yang surrealism, symmetrical face, real image, contrasting tone, pastel gradient background&quot;</span>'}}),ra=new j({props:{code:"cHJvbXB0JTIwJTNEJTIwJTIyQSUyMGNhciUyMGV4cGxvZGluZyUyMGludG8lMjBjb2xvcmZ1bCUyMGR1c3QlMjI=",highlighted:'prompt = <span class="hljs-string">&quot;A car exploding into colorful dust&quot;</span>'}}),pa=new j({props:{code:"cHJvbXB0JTIwJTNEJTIwJTIyZWRpdG9yaWFsJTIwcGhvdG9ncmFwaHklMjBvZiUyMGFuJTIwb3JnYW5pYyUyQyUyMGFsbW9zdCUyMGxpcXVpZCUyMHNtb2tlJTIwc3R5bGUlMjBhcm1jaGFpciUyMg==",highlighted:'prompt = <span class="hljs-string">&quot;editorial photography of an organic, almost liquid smoke style armchair&quot;</span>'}}),da=new j({props:{code:"cHJvbXB0JTIwJTNEJTIwJTIyYmlyZHMlMjBleWUlMjB2aWV3JTIwb2YlMjBhJTIwcXVpbHRlZCUyMHBhcGVyJTIwc3R5bGUlMjBhbGllbiUyMHBsYW5ldCUyMGxhbmRzY2FwZSUyQyUyMHZpYnJhbnQlMjBjb2xvdXJzJTJDJTIwQ2luZW1hdGljJTIwbGlnaHRpbmclMjI=",highlighted:'prompt = <span class="hljs-string">&quot;birds eye view of a quilted paper style alien planet landscape, vibrant colours, Cinematic lighting&quot;</span>'}}),ca=new B({}),ma=new j({props:{code:"ZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFmcm9tJTIwaW8lMjBpbXBvcnQlMjBCeXRlc0lPJTBBJTBBJTIzJTIwZG93bmxvYWQlMjBpbWFnZSUwQXVybCUyMCUzRCUyMCUyMmh0dHBzJTNBJTJGJTJGcmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSUyRkNvbXBWaXMlMkZzdGFibGUtZGlmZnVzaW9uJTJGbWFpbiUyRmFzc2V0cyUyRnN0YWJsZS1zYW1wbGVzJTJGaW1nMmltZyUyRnNrZXRjaC1tb3VudGFpbnMtaW5wdXQuanBnJTIyJTBBcmVzcG9uc2UlMjAlM0QlMjByZXF1ZXN0cy5nZXQodXJsKSUwQW9yaWdpbmFsX2ltYWdlJTIwJTNEJTIwSW1hZ2Uub3BlbihCeXRlc0lPKHJlc3BvbnNlLmNvbnRlbnQpKS5jb252ZXJ0KCUyMlJHQiUyMiklMEFvcmlnaW5hbF9pbWFnZSUyMCUzRCUyMG9yaWdpbmFsX2ltYWdlLnJlc2l6ZSgoNzY4JTJDJTIwNTEyKSk=",highlighted:`<span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-keyword">import</span> requests
<span class="hljs-keyword">from</span> io <span class="hljs-keyword">import</span> BytesIO

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

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

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

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

image_embeds, negative_image_embeds = pipe_prior(prompt, negative_prompt).to_tuple()

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

out.images[<span class="hljs-number">0</span>].save(<span class="hljs-string">&quot;fantasy_land.png&quot;</span>)`}}),ga=new B({}),ua=new j({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEthbmRpbnNreUlucGFpbnRQaXBlbGluZSUyQyUyMEthbmRpbnNreVByaW9yUGlwZWxpbmUlMEFmcm9tJTIwZGlmZnVzZXJzLnV0aWxzJTIwaW1wb3J0JTIwbG9hZF9pbWFnZSUwQWltcG9ydCUyMHRvcmNoJTBBaW1wb3J0JTIwbnVtcHklMjBhcyUyMG5wJTBBJTBBcGlwZV9wcmlvciUyMCUzRCUyMEthbmRpbnNreVByaW9yUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMi0xLXByaW9yJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTBBKSUwQXBpcGVfcHJpb3IudG8oJTIyY3VkYSUyMiklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJhJTIwaGF0JTIyJTBBcHJpb3Jfb3V0cHV0JTIwJTNEJTIwcGlwZV9wcmlvcihwcm9tcHQpJTBBJTBBcGlwZSUyMCUzRCUyMEthbmRpbnNreUlucGFpbnRQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTIya2FuZGluc2t5LWNvbW11bml0eSUyRmthbmRpbnNreS0yLTEtaW5wYWludCUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiklMEFwaXBlLnRvKCUyMmN1ZGElMjIpJTBBJTBBaW5pdF9pbWFnZSUyMCUzRCUyMGxvYWRfaW1hZ2UoJTBBJTIwJTIwJTIwJTIwJTIyaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRmRhdGFzZXRzJTJGaGYtaW50ZXJuYWwtdGVzdGluZyUyRmRpZmZ1c2Vycy1pbWFnZXMlMkZyZXNvbHZlJTJGbWFpbiUyMiUyMCUyMiUyRmthbmRpbnNreSUyRmNhdC5wbmclMjIlMEEpJTBBJTBBbWFzayUyMCUzRCUyMG5wLm9uZXMoKDc2OCUyQyUyMDc2OCklMkMlMjBkdHlwZSUzRG5wLmZsb2F0MzIpJTBBJTIzJTIwTGV0J3MlMjBtYXNrJTIwb3V0JTIwYW4lMjBhcmVhJTIwYWJvdmUlMjB0aGUlMjBjYXQncyUyMGhlYWQlMEFtYXNrJTVCJTNBMjUwJTJDJTIwMjUwJTNBLTI1MCU1RCUyMCUzRCUyMDAlMEElMEFvdXQlMjAlM0QlMjBwaXBlKCUwQSUyMCUyMCUyMCUyMHByb21wdCUyQyUwQSUyMCUyMCUyMCUyMGltYWdlJTNEaW5pdF9pbWFnZSUyQyUwQSUyMCUyMCUyMCUyMG1hc2tfaW1hZ2UlM0RtYXNrJTJDJTBBJTIwJTIwJTIwJTIwKipwcmlvcl9vdXRwdXQlMkMlMEElMjAlMjAlMjAlMjBoZWlnaHQlM0Q3NjglMkMlMEElMjAlMjAlMjAlMjB3aWR0aCUzRDc2OCUyQyUwQSUyMCUyMCUyMCUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0QxNTAlMkMlMEEpJTBBJTBBaW1hZ2UlMjAlM0QlMjBvdXQuaW1hZ2VzJTVCMCU1RCUwQWltYWdlLnNhdmUoJTIyY2F0X3dpdGhfaGF0LnBuZyUyMik=",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> KandinskyInpaintPipeline, KandinskyPriorPipeline
<span class="hljs-keyword">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image
<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np

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

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

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

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

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

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

image = out.images[<span class="hljs-number">0</span>]
image.save(<span class="hljs-string">&quot;cat_with_hat.png&quot;</span>)`}}),fa=new B({}),ya=new j({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEthbmRpbnNreVByaW9yUGlwZWxpbmUlMkMlMjBLYW5kaW5za3lQaXBlbGluZSUwQWZyb20lMjBkaWZmdXNlcnMudXRpbHMlMjBpbXBvcnQlMjBsb2FkX2ltYWdlJTBBaW1wb3J0JTIwUElMJTBBJTBBaW1wb3J0JTIwdG9yY2glMEElMEFwaXBlX3ByaW9yJTIwJTNEJTIwS2FuZGluc2t5UHJpb3JQaXBlbGluZS5mc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IwLjMlMkMlMjAwLjMlMkMlMjAwLjQlNUQlMEElMEElMjMlMjBXZSUyMGNhbiUyMGxlYXZlJTIwdGhlJTIwcHJvbXB0JTIwZW1wdHklMEFwcm9tcHQlMjAlM0QlMjAlMjIlMjIlMEFwcmlvcl9vdXQlMjAlM0QlMjBwaXBlX3ByaW9yLmludGVycG9sYXRlKGltYWdlc190ZXh0cyUyQyUyMHdlaWdodHMpJTBBJTBBcGlwZSUyMCUzRCUyMEthbmRpbnNreVBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTItMSUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiklMEFwaXBlLnRvKCUyMmN1ZGElMjIpJTBBJTBBaW1hZ2UlMjAlM0QlMjBwaXBlKHByb21wdCUyQyUyMCoqcHJpb3Jfb3V0JTJDJTIwaGVpZ2h0JTNENzY4JTJDJTIwd2lkdGglM0Q3NjgpLmltYWdlcyU1QjAlNUQlMEElMEFpbWFnZS5zYXZlKCUyMnN0YXJyeV9jYXQucG5nJTIyKQ==",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
<span class="hljs-keyword">import</span> PIL

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

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

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

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

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

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

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

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

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

image.save(<span class="hljs-string">&quot;starry_cat.png&quot;</span>)`}}),ba=new B({}),Ma=new j({props:{code:"ZnJvbSUyMGRpZmZ1c2Vycy51dGlscyUyMGltcG9ydCUyMGxvYWRfaW1hZ2UlMEElMEFpbWclMjAlM0QlMjBsb2FkX2ltYWdlKCUwQSUyMCUyMCUyMCUyMCUyMmh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZkYXRhc2V0cyUyRmhmLWludGVybmFsLXRlc3RpbmclMkZkaWZmdXNlcnMtaW1hZ2VzJTJGcmVzb2x2ZSUyRm1haW4lMkZrYW5kaW5za3l2MjIlMkZjYXQucG5nJTIyJTBBKS5yZXNpemUoKDc2OCUyQyUyMDc2OCkp",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>))`}}),_a=new j({props:{code:"aW1wb3J0JTIwdG9yY2glMEFp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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">from</span> diffusers.utils <span class="hljs-keyword">import</span> load_image


<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>)`}}),wa=new j({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMEthbmRpbnNreVYyMlByaW9yUGlwZWxpbmUlMkMlMjBLYW5kaW5za3lWMjJDb250cm9sbmV0UGlwZWxpbmUlMEElMEFwaXBlX3ByaW9yJTIwJTNEJTIwS2FuZGluc2t5VjIyUHJpb3JQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIya2FuZGluc2t5LWNvbW11bml0eSUyRmthbmRpbnNreS0yLTItcHJpb3IlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMEEpJTBBcGlwZV9wcmlvciUyMCUzRCUyMHBpcGVfcHJpb3IudG8oJTIyY3VkYSUyMiklMEElMEFwaXBlJTIwJTNEJTIwS2FuZGluc2t5VjIyQ29udHJvbG5ldFBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTItMi1jb250cm9sbmV0LWRlcHRoJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTBBKSUwQXBpcGUlMjAlM0QlMjBwaXBlLnRvKCUyMmN1ZGElMjIp",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> KandinskyV22PriorPipeline, KandinskyV22ControlnetPipeline

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

pipe = KandinskyV22ControlnetPipeline.from_pretrained(
    <span class="hljs-string">&quot;kandinsky-community/kandinsky-2-2-controlnet-depth&quot;</span>, torch_dtype=torch.float16
)
pipe = pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)`}}),Ja=new j({props:{code:"cHJvbXB0JTIwJTNEJTIwJTIyQSUyMHJvYm90JTJDJTIwNGslMjBwaG90byUyMiUwQSUwQW5lZ2F0aXZlX3ByaW9yX3Byb21wdCUyMCUzRCUyMCUyMmxvd3JlcyUyQyUyMHRleHQlMkMlMjBlcnJvciUyQyUyMGNyb3BwZWQlMkMlMjB3b3JzdCUyMHF1YWxpdHklMkMlMjBsb3clMjBxdWFsaXR5JTJDJTIwanBlZyUyMGFydGlmYWN0cyUyQyUyMHVnbHklMkMlMjBkdXBsaWNhdGUlMkMlMjBtb3JiaWQlMkMlMjBtdXRpbGF0ZWQlMkMlMjBvdXQlMjBvZiUyMGZyYW1lJTJDJTIwZXh0cmElMjBmaW5nZXJzJTJDJTIwbXV0YXRlZCUyMGhhbmRzJTJDJTIwcG9vcmx5JTIwZHJhd24lMjBoYW5kcyUyQyUyMHBvb3JseSUyMGRyYXduJTIwZmFjZSUyQyUyMG11dGF0aW9uJTJDJTIwZGVmb3JtZWQlMkMlMjBibHVycnklMkMlMjBkZWh5ZHJhdGVkJTJDJTIwYmFkJTIwYW5hdG9teSUyQyUyMGJhZCUyMHByb3BvcnRpb25zJTJDJTIwZXh0cmElMjBsaW1icyUyQyUyMGNsb25lZCUyMGZhY2UlMkMlMjBkaXNmaWd1cmVkJTJDJTIwZ3Jvc3MlMjBwcm9wb3J0aW9ucyUyQyUyMG1hbGZvcm1lZCUyMGxpbWJzJTJDJTIwbWlzc2luZyUyMGFybXMlMkMlMjBtaXNzaW5nJTIwbGVncyUyQyUyMGV4dHJhJTIwYXJtcyUyQyUyMGV4dHJhJTIwbGVncyUyQyUyMGZ1c2VkJTIwZmluZ2VycyUyQyUyMHRvbyUyMG1hbnklMjBmaW5nZXJzJTJDJTIwbG9uZyUyMG5lY2slMkMlMjB1c2VybmFtZSUyQyUyMHdhdGVybWFyayUyQyUyMHNpZ25hdHVyZSUyMiUwQSUwQWdlbmVyYXRvciUyMCUzRCUyMHRvcmNoLkdlbmVyYXRvcihkZXZpY2UlM0QlMjJjdWRhJTIyKS5tYW51YWxfc2VlZCg0MyklMEFpbWFnZV9lbWIlMkMlMjB6ZXJvX2ltYWdlX2VtYiUyMCUzRCUyMHBpcGVfcHJpb3IoJTBBJTIwJTIwJTIwJTIwcHJvbXB0JTNEcHJvbXB0JTJDJTIwbmVnYXRpdmVfcHJvbXB0JTNEbmVnYXRpdmVfcHJpb3JfcHJvbXB0JTJDJTIwZ2VuZXJhdG9yJTNEZ2VuZXJhdG9yJTBBKS50b190dXBsZSgp",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 = pipe_prior(
    prompt=prompt, negative_prompt=negative_prior_prompt, generator=generator
).to_tuple()`}}),ka=new j({props:{code:"aW1hZ2VzJTIwJTNEJTIwcGlwZSglMEElMjAlMjAlMjAlMjBpbWFnZV9lbWJlZHMlM0RpbWFnZV9lbWIlMkMlMEElMjAlMjAlMjAlMjBuZWdhdGl2ZV9pbWFnZV9lbWJlZHMlM0R6ZXJvX2ltYWdlX2VtYiUyQyUwQSUyMCUyMCUyMCUyMGhpbnQlM0RoaW50JTJDJTBBJTIwJTIwJTIwJTIwbnVtX2luZmVyZW5jZV9zdGVwcyUzRDUwJTJDJTBBJTIwJTIwJTIwJTIwZ2VuZXJhdG9yJTNEZ2VuZXJhdG9yJTJDJTBBJTIwJTIwJTIwJTIwaGVpZ2h0JTNENzY4JTJDJTBBJTIwJTIwJTIwJTIwd2lkdGglM0Q3NjglMkMlMEEpLmltYWdlcyUwQSUwQWltYWdlcyU1QjAlNUQuc2F2ZSglMjJyb2JvdF9jYXQucG5nJTIyKQ==",highlighted:`images = pipe(
    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

images[<span class="hljs-number">0</span>].save(<span class="hljs-string">&quot;robot_cat.png&quot;</span>)`}}),va=new B({}),Ua=new j({props:{code:" ",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&quot;</span> <span class="hljs-string">&quot;/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>)

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

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

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>)

<span class="hljs-comment"># run prior pipeline</span>

img_emb = pipe_prior(prompt=prompt, image=img, strength=<span class="hljs-number">0.85</span>, generator=generator)
negative_emb = pipe_prior(prompt=negative_prior_prompt, image=img, strength=<span class="hljs-number">1</span>, generator=generator)

<span class="hljs-comment"># run controlnet img2img pipeline</span>
images = pipe(
    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

images[<span class="hljs-number">0</span>].save(<span class="hljs-string">&quot;robot_cat.png&quot;</span>)`}}),ja=new B({}),Ia=new j({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBaW1wb3J0JTIwdG9yY2glMEElMEFwaXBlX3ByaW9yJTIwJTNEJTIwRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMmthbmRpbnNreS1jb21tdW5pdHklMkZrYW5kaW5za3ktMi0yLXByaW9yJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2KSUwQXBpcGVfcHJpb3IudG8oJTIyY3VkYSUyMiklMEElMEF0MmlfcGlwZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTItMi1kZWNvZGVyJTIyJTJDJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2KSUwQXQyaV9waXBlLnRvKCUyMmN1ZGElMjIp",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline
<span class="hljs-keyword">import</span> torch

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

t2i_pipe = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;kandinsky-community/kandinsky-2-2-decoder&quot;</span>, torch_dtype=torch.float16)
t2i_pipe.to(<span class="hljs-string">&quot;cuda&quot;</span>)`}}),Za=new j({props:{code:"cHJvbXB0JTIwJTNEJTIwJTIycG9ydHJhaXQlMjBvZiUyMGElMjB3b21lbiUyQyUyMGJsdWUlMjBleWVzJTJDJTIwY2luZW1hdGljJTIyJTBBbmVnYXRpdmVfcHJvbXB0JTIwJTNEJTIwJTIybG93JTIwcXVhbGl0eSUyQyUyMGJhZCUyMHF1YWxpdHklMjIlMEElMEFpbWFnZV9lbWJlZHMlMkMlMjBuZWdhdGl2ZV9pbWFnZV9lbWJlZHMlMjAlM0QlMjBwaXBlX3ByaW9yKHByb21wdCUyQyUyMGd1aWRhbmNlX3NjYWxlJTNEMS4wKS50b190dXBsZSgp",highlighted:`prompt = <span class="hljs-string">&quot;portrait of a women, blue eyes, cinematic&quot;</span>
negative_prompt = <span class="hljs-string">&quot;low quality, bad quality&quot;</span>

image_embeds, negative_image_embeds = pipe_prior(prompt, guidance_scale=<span class="hljs-number">1.0</span>).to_tuple()`}}),Wa=new j({props:{code:"aW1hZ2UlMjAlM0QlMjB0MmlfcGlwZShpbWFnZV9lbWJlZHMlM0RpbWFnZV9lbWJlZHMlMkMlMjBuZWdhdGl2ZV9pbWFnZV9lbWJlZHMlM0RuZWdhdGl2ZV9pbWFnZV9lbWJlZHMlMkMlMjBoZWlnaHQlM0Q3NjglMkMlMjB3aWR0aCUzRDc2OCkuaW1hZ2VzJTVCJTBBJTIwJTIwJTIwJTIwMCUwQSU1RCUwQWltYWdlLnNhdmUoJTIycG9ydHJhaXQucG5nJTIyKQ==",highlighted:`image = t2i_pipe(<span class="hljs-attribute">image_embeds</span>=image_embeds, <span class="hljs-attribute">negative_image_embeds</span>=negative_image_embeds, <span class="hljs-attribute">height</span>=768, <span class="hljs-attribute">width</span>=768).images[
    0
]
image.save(<span class="hljs-string">&quot;portrait.png&quot;</span>)`}}),Ga=new B({}),Ba=new j({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMERpZmZ1c2lvblBpcGVsaW5lJTBBaW1wb3J0JTIwdG9yY2glMEElMEF0MmlfcGlwZSUyMCUzRCUyMERpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZCglMjJrYW5kaW5za3ktY29tbXVuaXR5JTJGa2FuZGluc2t5LTItMSUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiklMEF0MmlfcGlwZS5lbmFibGVfeGZvcm1lcnNfbWVtb3J5X2VmZmljaWVudF9hdHRlbnRpb24oKQ==",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline
<span class="hljs-keyword">import</span> torch

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

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

t2i_pipe.unet.set_attn_processor(AttnAddedKVProcessor())`}}),$a=new j({props:{code:"dDJpX3BpcGUudW5ldC50byhtZW1vcnlfZm9ybWF0JTNEdG9yY2guY2hhbm5lbHNfbGFzdCklMEF0MmlfcGlwZS51bmV0JTIwJTNEJTIwdG9yY2guY29tcGlsZSh0MmlfcGlwZS51bmV0JTJDJTIwbW9kZSUzRCUyMnJlZHVjZS1vdmVyaGVhZCUyMiUyQyUyMGZ1bGxncmFwaCUzRFRydWUp",highlighted:`t2i_pipe.unet.to(memory_format=torch.channels_last)
t2i_pipe.unet = torch.<span class="hljs-built_in">compile</span>(t2i_pipe.unet, mode=<span class="hljs-string">&quot;reduce-overhead&quot;</span>, fullgraph=<span class="hljs-literal">True</span>)`}}),Ra=new B({}),as=new B({}),ss=new U({props:{name:"class diffusers.KandinskyV22Pipeline",anchor:"diffusers.KandinskyV22Pipeline",parameters:[{name:"unet",val:": UNet2DConditionModel"},{name:"scheduler",val:": DDPMScheduler"},{name:"movq",val:": VQModel"}],parametersDescription:[{anchor:"diffusers.KandinskyV22Pipeline.scheduler",description:`<strong>scheduler</strong> (Union[<code>DDIMScheduler</code>,<code>DDPMScheduler</code>]) &#x2014;
A scheduler to be used in combination with <code>unet</code> to generate image latents.`,name:"scheduler"},{anchor:"diffusers.KandinskyV22Pipeline.unet",description:`<strong>unet</strong> (<a href="/docs/diffusers/v0.18.0/en/api/models/unet2d-cond#diffusers.UNet2DConditionModel">UNet2DConditionModel</a>) &#x2014;
Conditional U-Net architecture to denoise the image embedding.`,name:"unet"},{anchor:"diffusers.KandinskyV22Pipeline.movq",description:`<strong>movq</strong> (<a href="/docs/diffusers/v0.18.0/en/api/models/vq#diffusers.VQModel">VQModel</a>) &#x2014;
MoVQ Decoder to generate the image from the latents.`,name:"movq"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2.py#L70"}}),ls=new U({props:{name:"__call__",anchor:"diffusers.KandinskyV22Pipeline.__call__",parameters:[{name:"image_embeds",val:": typing.Union[torch.FloatTensor, typing.List[torch.FloatTensor]]"},{name:"negative_image_embeds",val:": typing.Union[torch.FloatTensor, typing.List[torch.FloatTensor]]"},{name:"height",val:": int = 512"},{name:"width",val:": int = 512"},{name:"num_inference_steps",val:": int = 100"},{name:"guidance_scale",val:": float = 4.0"},{name:"num_images_per_prompt",val:": int = 1"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"latents",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_type",val:": typing.Optional[str] = 'pil'"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.KandinskyV22Pipeline.__call__.Function",description:`<strong>Function</strong> invoked when calling the pipeline for generation. &#x2014;
image_embeds (<code>torch.FloatTensor</code> or <code>List[torch.FloatTensor]</code>):
The clip image embeddings for text prompt, that will be used to condition the image generation.
negative_image_embeds (<code>torch.FloatTensor</code> or <code>List[torch.FloatTensor]</code>):
The clip image embeddings for negative text prompt, will be used to condition the image generation.
height (<code>int</code>, <em>optional</em>, defaults to 512):
The height in pixels of the generated image.
width (<code>int</code>, <em>optional</em>, defaults to 512):
The width in pixels of the generated image.
num_inference_steps (<code>int</code>, <em>optional</em>, defaults to 100):
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.
guidance_scale (<code>float</code>, <em>optional</em>, defaults to 4.0):
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.
num_images_per_prompt (<code>int</code>, <em>optional</em>, defaults to 1):
The number of images to generate per prompt.
generator (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>):
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.
latents (<code>torch.FloatTensor</code>, <em>optional</em>):
Pre-generated noisy latents, sampled from a Gaussian distribution, to be used as inputs for image
generation. Can be used to tweak the same generation with different prompts. If not provided, a latents
tensor will ge generated by sampling using the supplied random <code>generator</code>.
output_type (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pil&quot;</code>):
The output format of the generate image. Choose between: <code>&quot;pil&quot;</code> (<code>PIL.Image.Image</code>), <code>&quot;np&quot;</code>
(<code>np.array</code>) or <code>&quot;pt&quot;</code> (<code>torch.Tensor</code>).
return_dict (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>):
Whether or not to return a <a href="/docs/diffusers/v0.18.0/en/api/outputs#diffusers.ImagePipelineOutput">ImagePipelineOutput</a> instead of a plain tuple.`,name:"Function"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2.py#L178",returnType:`
<p><a
  href="/docs/diffusers/v0.18.0/en/api/outputs#diffusers.ImagePipelineOutput"
>ImagePipelineOutput</a> or <code>tuple</code></p>
`}}),Ot=new Ue({props:{anchor:"diffusers.KandinskyV22Pipeline.__call__.example",$$slots:{default:[Fv]},$$scope:{ctx:I}}}),os=new U({props:{name:"enable_model_cpu_offload",anchor:"diffusers.KandinskyV22Pipeline.enable_model_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2.py#L134"}}),rs=new U({props:{name:"enable_sequential_cpu_offload",anchor:"diffusers.KandinskyV22Pipeline.enable_sequential_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2.py#L113"}}),ds=new B({}),cs=new U({props:{name:"class diffusers.KandinskyV22ControlnetPipeline",anchor:"diffusers.KandinskyV22ControlnetPipeline",parameters:[{name:"unet",val:": UNet2DConditionModel"},{name:"scheduler",val:": DDPMScheduler"},{name:"movq",val:": VQModel"}],parametersDescription:[{anchor:"diffusers.KandinskyV22ControlnetPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/v0.18.0/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>) &#x2014;
A scheduler to be used in combination with <code>unet</code> to generate image latents.`,name:"scheduler"},{anchor:"diffusers.KandinskyV22ControlnetPipeline.unet",description:`<strong>unet</strong> (<a href="/docs/diffusers/v0.18.0/en/api/models/unet2d-cond#diffusers.UNet2DConditionModel">UNet2DConditionModel</a>) &#x2014;
Conditional U-Net architecture to denoise the image embedding.`,name:"unet"},{anchor:"diffusers.KandinskyV22ControlnetPipeline.movq",description:`<strong>movq</strong> (<a href="/docs/diffusers/v0.18.0/en/api/models/vq#diffusers.VQModel">VQModel</a>) &#x2014;
MoVQ Decoder to generate the image from the latents.`,name:"movq"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_controlnet.py#L110"}}),hs=new U({props:{name:"__call__",anchor:"diffusers.KandinskyV22ControlnetPipeline.__call__",parameters:[{name:"image_embeds",val:": typing.Union[torch.FloatTensor, typing.List[torch.FloatTensor]]"},{name:"negative_image_embeds",val:": typing.Union[torch.FloatTensor, typing.List[torch.FloatTensor]]"},{name:"hint",val:": FloatTensor"},{name:"height",val:": int = 512"},{name:"width",val:": int = 512"},{name:"num_inference_steps",val:": int = 100"},{name:"guidance_scale",val:": float = 4.0"},{name:"num_images_per_prompt",val:": int = 1"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"latents",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_type",val:": typing.Optional[str] = 'pil'"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.KandinskyV22ControlnetPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>) &#x2014;
The prompt or prompts to guide the image generation.`,name:"prompt"},{anchor:"diffusers.KandinskyV22ControlnetPipeline.__call__.hint",description:`<strong>hint</strong> (<code>torch.FloatTensor</code>) &#x2014;
The controlnet condition.`,name:"hint"},{anchor:"diffusers.KandinskyV22ControlnetPipeline.__call__.image_embeds",description:`<strong>image_embeds</strong> (<code>torch.FloatTensor</code> or <code>List[torch.FloatTensor]</code>) &#x2014;
The clip image embeddings for text prompt, that will be used to condition the image generation.`,name:"image_embeds"},{anchor:"diffusers.KandinskyV22ControlnetPipeline.__call__.negative_image_embeds",description:`<strong>negative_image_embeds</strong> (<code>torch.FloatTensor</code> or <code>List[torch.FloatTensor]</code>) &#x2014;
The clip image embeddings for negative text prompt, will be used to condition the image generation.`,name:"negative_image_embeds"},{anchor:"diffusers.KandinskyV22ControlnetPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. Ignored when not using guidance (i.e., ignored
if <code>guidance_scale</code> is less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.KandinskyV22ControlnetPipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
The height in pixels of the generated image.`,name:"height"},{anchor:"diffusers.KandinskyV22ControlnetPipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
The width in pixels of the generated image.`,name:"width"},{anchor:"diffusers.KandinskyV22ControlnetPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 100) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.KandinskyV22ControlnetPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 4.0) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.KandinskyV22ControlnetPipeline.__call__.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.KandinskyV22ControlnetPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.KandinskyV22ControlnetPipeline.__call__.latents",description:`<strong>latents</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated noisy latents, sampled from a Gaussian distribution, to be used as inputs for image
generation. Can be used to tweak the same generation with different prompts. If not provided, a latents
tensor will ge generated by sampling using the supplied random <code>generator</code>.`,name:"latents"},{anchor:"diffusers.KandinskyV22ControlnetPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pil&quot;</code>) &#x2014;
The output format of the generate image. Choose between: <code>&quot;pil&quot;</code> (<code>PIL.Image.Image</code>), <code>&quot;np&quot;</code>
(<code>np.array</code>) or <code>&quot;pt&quot;</code> (<code>torch.Tensor</code>).`,name:"output_type"},{anchor:"diffusers.KandinskyV22ControlnetPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <a href="/docs/diffusers/v0.18.0/en/api/outputs#diffusers.ImagePipelineOutput">ImagePipelineOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_controlnet.py#L220",returnType:`
<p><a
  href="/docs/diffusers/v0.18.0/en/api/outputs#diffusers.ImagePipelineOutput"
>ImagePipelineOutput</a> or <code>tuple</code></p>
`}}),an=new Ue({props:{anchor:"diffusers.KandinskyV22ControlnetPipeline.__call__.example",$$slots:{default:[Qv]},$$scope:{ctx:I}}}),gs=new U({props:{name:"enable_model_cpu_offload",anchor:"diffusers.KandinskyV22ControlnetPipeline.enable_model_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_controlnet.py#L176"}}),us=new U({props:{name:"enable_sequential_cpu_offload",anchor:"diffusers.KandinskyV22ControlnetPipeline.enable_sequential_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_controlnet.py#L154"}}),ys=new B({}),bs=new U({props:{name:"class diffusers.KandinskyV22ControlnetImg2ImgPipeline",anchor:"diffusers.KandinskyV22ControlnetImg2ImgPipeline",parameters:[{name:"unet",val:": UNet2DConditionModel"},{name:"scheduler",val:": DDPMScheduler"},{name:"movq",val:": VQModel"}],parametersDescription:[{anchor:"diffusers.KandinskyV22ControlnetImg2ImgPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/v0.18.0/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>) &#x2014;
A scheduler to be used in combination with <code>unet</code> to generate image latents.`,name:"scheduler"},{anchor:"diffusers.KandinskyV22ControlnetImg2ImgPipeline.unet",description:`<strong>unet</strong> (<a href="/docs/diffusers/v0.18.0/en/api/models/unet2d-cond#diffusers.UNet2DConditionModel">UNet2DConditionModel</a>) &#x2014;
Conditional U-Net architecture to denoise the image embedding.`,name:"unet"},{anchor:"diffusers.KandinskyV22ControlnetImg2ImgPipeline.movq",description:`<strong>movq</strong> (<a href="/docs/diffusers/v0.18.0/en/api/models/vq#diffusers.VQModel">VQModel</a>) &#x2014;
MoVQ Decoder to generate the image from the latents.`,name:"movq"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_controlnet_img2img.py#L124"}}),_s=new U({props:{name:"__call__",anchor:"diffusers.KandinskyV22ControlnetImg2ImgPipeline.__call__",parameters:[{name:"image_embeds",val:": typing.Union[torch.FloatTensor, typing.List[torch.FloatTensor]]"},{name:"image",val:": typing.Union[torch.FloatTensor, PIL.Image.Image, typing.List[torch.FloatTensor], typing.List[PIL.Image.Image]]"},{name:"negative_image_embeds",val:": typing.Union[torch.FloatTensor, typing.List[torch.FloatTensor]]"},{name:"hint",val:": FloatTensor"},{name:"height",val:": int = 512"},{name:"width",val:": int = 512"},{name:"num_inference_steps",val:": int = 100"},{name:"guidance_scale",val:": float = 4.0"},{name:"strength",val:": float = 0.3"},{name:"num_images_per_prompt",val:": int = 1"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"output_type",val:": typing.Optional[str] = 'pil'"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.KandinskyV22ControlnetImg2ImgPipeline.__call__.image_embeds",description:`<strong>image_embeds</strong> (<code>torch.FloatTensor</code> or <code>List[torch.FloatTensor]</code>) &#x2014;
The clip image embeddings for text prompt, that will be used to condition the image generation.`,name:"image_embeds"},{anchor:"diffusers.KandinskyV22ControlnetImg2ImgPipeline.__call__.image",description:`<strong>image</strong> (<code>torch.FloatTensor</code>, <code>PIL.Image.Image</code>, <code>np.ndarray</code>, <code>List[torch.FloatTensor]</code>, <code>List[PIL.Image.Image]</code>, or <code>List[np.ndarray]</code>) &#x2014;
<code>Image</code>, or tensor representing an image batch, that will be used as the starting point for the
process. Can also accpet image latents as <code>image</code>, if passing latents directly, it will not be encoded
again.`,name:"image"},{anchor:"diffusers.KandinskyV22ControlnetImg2ImgPipeline.__call__.strength",description:`<strong>strength</strong> (<code>float</code>, <em>optional</em>, defaults to 0.8) &#x2014;
Conceptually, indicates how much to transform the reference <code>image</code>. Must be between 0 and 1. <code>image</code>
will be used as a starting point, adding more noise to it the larger the <code>strength</code>. The number of
denoising steps depends on the amount of noise initially added. When <code>strength</code> is 1, added noise will
be maximum and the denoising process will run for the full number of iterations specified in
<code>num_inference_steps</code>. A value of 1, therefore, essentially ignores <code>image</code>.`,name:"strength"},{anchor:"diffusers.KandinskyV22ControlnetImg2ImgPipeline.__call__.hint",description:`<strong>hint</strong> (<code>torch.FloatTensor</code>) &#x2014;
The controlnet condition.`,name:"hint"},{anchor:"diffusers.KandinskyV22ControlnetImg2ImgPipeline.__call__.negative_image_embeds",description:`<strong>negative_image_embeds</strong> (<code>torch.FloatTensor</code> or <code>List[torch.FloatTensor]</code>) &#x2014;
The clip image embeddings for negative text prompt, will be used to condition the image generation.`,name:"negative_image_embeds"},{anchor:"diffusers.KandinskyV22ControlnetImg2ImgPipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
The height in pixels of the generated image.`,name:"height"},{anchor:"diffusers.KandinskyV22ControlnetImg2ImgPipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
The width in pixels of the generated image.`,name:"width"},{anchor:"diffusers.KandinskyV22ControlnetImg2ImgPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 100) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.KandinskyV22ControlnetImg2ImgPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 4.0) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.KandinskyV22ControlnetImg2ImgPipeline.__call__.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.KandinskyV22ControlnetImg2ImgPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.KandinskyV22ControlnetImg2ImgPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pil&quot;</code>) &#x2014;
The output format of the generate image. Choose between: <code>&quot;pil&quot;</code> (<code>PIL.Image.Image</code>), <code>&quot;np&quot;</code>
(<code>np.array</code>) or <code>&quot;pt&quot;</code> (<code>torch.Tensor</code>).`,name:"output_type"},{anchor:"diffusers.KandinskyV22ControlnetImg2ImgPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <a href="/docs/diffusers/v0.18.0/en/api/outputs#diffusers.ImagePipelineOutput">ImagePipelineOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_controlnet_img2img.py#L275",returnType:`
<p><a
  href="/docs/diffusers/v0.18.0/en/api/outputs#diffusers.ImagePipelineOutput"
>ImagePipelineOutput</a> or <code>tuple</code></p>
`}}),rn=new Ue({props:{anchor:"diffusers.KandinskyV22ControlnetImg2ImgPipeline.__call__.example",$$slots:{default:[Nv]},$$scope:{ctx:I}}}),ws=new U({props:{name:"enable_model_cpu_offload",anchor:"diffusers.KandinskyV22ControlnetImg2ImgPipeline.enable_model_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_controlnet_img2img.py#L231"}}),Js=new U({props:{name:"enable_sequential_cpu_offload",anchor:"diffusers.KandinskyV22ControlnetImg2ImgPipeline.enable_sequential_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_controlnet_img2img.py#L209"}}),Ts=new B({}),vs=new U({props:{name:"class diffusers.KandinskyV22Img2ImgPipeline",anchor:"diffusers.KandinskyV22Img2ImgPipeline",parameters:[{name:"unet",val:": UNet2DConditionModel"},{name:"scheduler",val:": DDPMScheduler"},{name:"movq",val:": VQModel"}],parametersDescription:[{anchor:"diffusers.KandinskyV22Img2ImgPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/v0.18.0/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>) &#x2014;
A scheduler to be used in combination with <code>unet</code> to generate image latents.`,name:"scheduler"},{anchor:"diffusers.KandinskyV22Img2ImgPipeline.unet",description:`<strong>unet</strong> (<a href="/docs/diffusers/v0.18.0/en/api/models/unet2d-cond#diffusers.UNet2DConditionModel">UNet2DConditionModel</a>) &#x2014;
Conditional U-Net architecture to denoise the image embedding.`,name:"unet"},{anchor:"diffusers.KandinskyV22Img2ImgPipeline.movq",description:`<strong>movq</strong> (<a href="/docs/diffusers/v0.18.0/en/api/models/vq#diffusers.VQModel">VQModel</a>) &#x2014;
MoVQ Decoder to generate the image from the latents.`,name:"movq"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_img2img.py#L98"}}),js=new U({props:{name:"__call__",anchor:"diffusers.KandinskyV22Img2ImgPipeline.__call__",parameters:[{name:"image_embeds",val:": typing.Union[torch.FloatTensor, typing.List[torch.FloatTensor]]"},{name:"image",val:": typing.Union[torch.FloatTensor, PIL.Image.Image, typing.List[torch.FloatTensor], typing.List[PIL.Image.Image]]"},{name:"negative_image_embeds",val:": typing.Union[torch.FloatTensor, typing.List[torch.FloatTensor]]"},{name:"height",val:": int = 512"},{name:"width",val:": int = 512"},{name:"num_inference_steps",val:": int = 100"},{name:"guidance_scale",val:": float = 4.0"},{name:"strength",val:": float = 0.3"},{name:"num_images_per_prompt",val:": int = 1"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"output_type",val:": typing.Optional[str] = 'pil'"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.KandinskyV22Img2ImgPipeline.__call__.image_embeds",description:`<strong>image_embeds</strong> (<code>torch.FloatTensor</code> or <code>List[torch.FloatTensor]</code>) &#x2014;
The clip image embeddings for text prompt, that will be used to condition the image generation.`,name:"image_embeds"},{anchor:"diffusers.KandinskyV22Img2ImgPipeline.__call__.image",description:`<strong>image</strong> (<code>torch.FloatTensor</code>, <code>PIL.Image.Image</code>, <code>np.ndarray</code>, <code>List[torch.FloatTensor]</code>, <code>List[PIL.Image.Image]</code>, or <code>List[np.ndarray]</code>) &#x2014;
<code>Image</code>, or tensor representing an image batch, that will be used as the starting point for the
process. Can also accpet image latents as <code>image</code>, if passing latents directly, it will not be encoded
again.`,name:"image"},{anchor:"diffusers.KandinskyV22Img2ImgPipeline.__call__.strength",description:`<strong>strength</strong> (<code>float</code>, <em>optional</em>, defaults to 0.8) &#x2014;
Conceptually, indicates how much to transform the reference <code>image</code>. Must be between 0 and 1. <code>image</code>
will be used as a starting point, adding more noise to it the larger the <code>strength</code>. The number of
denoising steps depends on the amount of noise initially added. When <code>strength</code> is 1, added noise will
be maximum and the denoising process will run for the full number of iterations specified in
<code>num_inference_steps</code>. A value of 1, therefore, essentially ignores <code>image</code>.`,name:"strength"},{anchor:"diffusers.KandinskyV22Img2ImgPipeline.__call__.negative_image_embeds",description:`<strong>negative_image_embeds</strong> (<code>torch.FloatTensor</code> or <code>List[torch.FloatTensor]</code>) &#x2014;
The clip image embeddings for negative text prompt, will be used to condition the image generation.`,name:"negative_image_embeds"},{anchor:"diffusers.KandinskyV22Img2ImgPipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
The height in pixels of the generated image.`,name:"height"},{anchor:"diffusers.KandinskyV22Img2ImgPipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
The width in pixels of the generated image.`,name:"width"},{anchor:"diffusers.KandinskyV22Img2ImgPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 100) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.KandinskyV22Img2ImgPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 4.0) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.KandinskyV22Img2ImgPipeline.__call__.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.KandinskyV22Img2ImgPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.KandinskyV22Img2ImgPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pil&quot;</code>) &#x2014;
The output format of the generate image. Choose between: <code>&quot;pil&quot;</code> (<code>PIL.Image.Image</code>), <code>&quot;np&quot;</code>
(<code>np.array</code>) or <code>&quot;pt&quot;</code> (<code>torch.Tensor</code>).`,name:"output_type"},{anchor:"diffusers.KandinskyV22Img2ImgPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <a href="/docs/diffusers/v0.18.0/en/api/outputs#diffusers.ImagePipelineOutput">ImagePipelineOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_img2img.py#L248",returnType:`
<p><a
  href="/docs/diffusers/v0.18.0/en/api/outputs#diffusers.ImagePipelineOutput"
>ImagePipelineOutput</a> or <code>tuple</code></p>
`}}),mn=new Ue({props:{anchor:"diffusers.KandinskyV22Img2ImgPipeline.__call__.example",$$slots:{default:[Yv]},$$scope:{ctx:I}}}),Is=new U({props:{name:"enable_model_cpu_offload",anchor:"diffusers.KandinskyV22Img2ImgPipeline.enable_model_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_img2img.py#L204"}}),Zs=new U({props:{name:"enable_sequential_cpu_offload",anchor:"diffusers.KandinskyV22Img2ImgPipeline.enable_sequential_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_img2img.py#L182"}}),Gs=new B({}),Es=new U({props:{name:"class diffusers.KandinskyV22InpaintPipeline",anchor:"diffusers.KandinskyV22InpaintPipeline",parameters:[{name:"unet",val:": UNet2DConditionModel"},{name:"scheduler",val:": DDPMScheduler"},{name:"movq",val:": VQModel"}],parametersDescription:[{anchor:"diffusers.KandinskyV22InpaintPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/v0.18.0/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>) &#x2014;
A scheduler to be used in combination with <code>unet</code> to generate image latents.`,name:"scheduler"},{anchor:"diffusers.KandinskyV22InpaintPipeline.unet",description:`<strong>unet</strong> (<a href="/docs/diffusers/v0.18.0/en/api/models/unet2d-cond#diffusers.UNet2DConditionModel">UNet2DConditionModel</a>) &#x2014;
Conditional U-Net architecture to denoise the image embedding.`,name:"unet"},{anchor:"diffusers.KandinskyV22InpaintPipeline.movq",description:`<strong>movq</strong> (<a href="/docs/diffusers/v0.18.0/en/api/models/vq#diffusers.VQModel">VQModel</a>) &#x2014;
MoVQ Decoder to generate the image from the latents.`,name:"movq"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_inpainting.py#L237"}}),Vs=new U({props:{name:"__call__",anchor:"diffusers.KandinskyV22InpaintPipeline.__call__",parameters:[{name:"image_embeds",val:": typing.Union[torch.FloatTensor, typing.List[torch.FloatTensor]]"},{name:"image",val:": typing.Union[torch.FloatTensor, PIL.Image.Image]"},{name:"mask_image",val:": typing.Union[torch.FloatTensor, PIL.Image.Image, numpy.ndarray]"},{name:"negative_image_embeds",val:": typing.Union[torch.FloatTensor, typing.List[torch.FloatTensor]]"},{name:"height",val:": int = 512"},{name:"width",val:": int = 512"},{name:"num_inference_steps",val:": int = 100"},{name:"guidance_scale",val:": float = 4.0"},{name:"num_images_per_prompt",val:": int = 1"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"latents",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_type",val:": typing.Optional[str] = 'pil'"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.KandinskyV22InpaintPipeline.__call__.Function",description:`<strong>Function</strong> invoked when calling the pipeline for generation. &#x2014;
image_embeds (<code>torch.FloatTensor</code> or <code>List[torch.FloatTensor]</code>):
The clip image embeddings for text prompt, that will be used to condition the image generation.
image (<code>PIL.Image.Image</code>):
<code>Image</code>, or tensor representing an image batch which will be inpainted, <em>i.e.</em> parts of the image will
be masked out with <code>mask_image</code> and repainted according to <code>prompt</code>.
mask_image (<code>np.array</code>):
Tensor representing an image batch, to mask <code>image</code>. Black pixels in the mask will be repainted, while
white pixels will be preserved. If <code>mask_image</code> is a PIL image, it will be converted to a single
channel (luminance) before use. If it&#x2019;s a tensor, it should contain one color channel (L) instead of 3,
so the expected shape would be <code>(B, H, W, 1)</code>.
negative_image_embeds (<code>torch.FloatTensor</code> or <code>List[torch.FloatTensor]</code>):
The clip image embeddings for negative text prompt, will be used to condition the image generation.
height (<code>int</code>, <em>optional</em>, defaults to 512):
The height in pixels of the generated image.
width (<code>int</code>, <em>optional</em>, defaults to 512):
The width in pixels of the generated image.
num_inference_steps (<code>int</code>, <em>optional</em>, defaults to 100):
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.
guidance_scale (<code>float</code>, <em>optional</em>, defaults to 4.0):
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.
num_images_per_prompt (<code>int</code>, <em>optional</em>, defaults to 1):
The number of images to generate per prompt.
generator (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>):
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.
latents (<code>torch.FloatTensor</code>, <em>optional</em>):
Pre-generated noisy latents, sampled from a Gaussian distribution, to be used as inputs for image
generation. Can be used to tweak the same generation with different prompts. If not provided, a latents
tensor will ge generated by sampling using the supplied random <code>generator</code>.
output_type (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pil&quot;</code>):
The output format of the generate image. Choose between: <code>&quot;pil&quot;</code> (<code>PIL.Image.Image</code>), <code>&quot;np&quot;</code>
(<code>np.array</code>) or <code>&quot;pt&quot;</code> (<code>torch.Tensor</code>).
return_dict (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>):
Whether or not to return a <a href="/docs/diffusers/v0.18.0/en/api/outputs#diffusers.ImagePipelineOutput">ImagePipelineOutput</a> instead of a plain tuple.`,name:"Function"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_inpainting.py#L347",returnType:`
<p><a
  href="/docs/diffusers/v0.18.0/en/api/outputs#diffusers.ImagePipelineOutput"
>ImagePipelineOutput</a> or <code>tuple</code></p>
`}}),yn=new Ue({props:{anchor:"diffusers.KandinskyV22InpaintPipeline.__call__.example",$$slots:{default:[Kv]},$$scope:{ctx:I}}}),Ps=new U({props:{name:"enable_model_cpu_offload",anchor:"diffusers.KandinskyV22InpaintPipeline.enable_model_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_inpainting.py#L303"}}),Cs=new U({props:{name:"enable_sequential_cpu_offload",anchor:"diffusers.KandinskyV22InpaintPipeline.enable_sequential_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_inpainting.py#L281"}}),xs=new B({}),Rs=new B({}),Xs=new U({props:{name:"class diffusers.KandinskyV22PriorEmb2EmbPipeline",anchor:"diffusers.KandinskyV22PriorEmb2EmbPipeline",parameters:[{name:"prior",val:": PriorTransformer"},{name:"image_encoder",val:": CLIPVisionModelWithProjection"},{name:"text_encoder",val:": CLIPTextModelWithProjection"},{name:"tokenizer",val:": CLIPTokenizer"},{name:"scheduler",val:": UnCLIPScheduler"},{name:"image_processor",val:": CLIPImageProcessor"}],parametersDescription:[{anchor:"diffusers.KandinskyV22PriorEmb2EmbPipeline.prior",description:`<strong>prior</strong> (<a href="/docs/diffusers/v0.18.0/en/api/models/prior_transformer#diffusers.PriorTransformer">PriorTransformer</a>) &#x2014;
The canonincal unCLIP prior to approximate the image embedding from the text embedding.`,name:"prior"},{anchor:"diffusers.KandinskyV22PriorEmb2EmbPipeline.image_encoder",description:`<strong>image_encoder</strong> (<code>CLIPVisionModelWithProjection</code>) &#x2014;
Frozen image-encoder.`,name:"image_encoder"},{anchor:"diffusers.KandinskyV22PriorEmb2EmbPipeline.text_encoder",description:`<strong>text_encoder</strong> (<code>CLIPTextModelWithProjection</code>) &#x2014;
Frozen text-encoder.`,name:"text_encoder"},{anchor:"diffusers.KandinskyV22PriorEmb2EmbPipeline.tokenizer",description:`<strong>tokenizer</strong> (<code>CLIPTokenizer</code>) &#x2014;
Tokenizer of class
<a href="https://huggingface.co/docs/transformers/v4.21.0/en/model_doc/clip#transformers.CLIPTokenizer" rel="nofollow">CLIPTokenizer</a>.`,name:"tokenizer"},{anchor:"diffusers.KandinskyV22PriorEmb2EmbPipeline.scheduler",description:`<strong>scheduler</strong> (<code>UnCLIPScheduler</code>) &#x2014;
A scheduler to be used in combination with <code>prior</code> to generate image embedding.`,name:"scheduler"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_prior_emb2emb.py#L103"}}),Qs=new U({props:{name:"__call__",anchor:"diffusers.KandinskyV22PriorEmb2EmbPipeline.__call__",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]]"},{name:"image",val:": typing.Union[torch.Tensor, typing.List[torch.Tensor], PIL.Image.Image, typing.List[PIL.Image.Image]]"},{name:"strength",val:": float = 0.3"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"num_images_per_prompt",val:": int = 1"},{name:"num_inference_steps",val:": int = 25"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"latents",val:": typing.Optional[torch.FloatTensor] = None"},{name:"guidance_scale",val:": float = 4.0"},{name:"output_type",val:": typing.Optional[str] = 'pt'"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.KandinskyV22PriorEmb2EmbPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>) &#x2014;
The prompt or prompts to guide the image generation.`,name:"prompt"},{anchor:"diffusers.KandinskyV22PriorEmb2EmbPipeline.__call__.strength",description:`<strong>strength</strong> (<code>float</code>, <em>optional</em>, defaults to 0.8) &#x2014;
Conceptually, indicates how much to transform the reference <code>emb</code>. Must be between 0 and 1. <code>image</code>
will be used as a starting point, adding more noise to it the larger the <code>strength</code>. The number of
denoising steps depends on the amount of noise initially added.`,name:"strength"},{anchor:"diffusers.KandinskyV22PriorEmb2EmbPipeline.__call__.emb",description:`<strong>emb</strong> (<code>torch.FloatTensor</code>) &#x2014;
The image embedding.`,name:"emb"},{anchor:"diffusers.KandinskyV22PriorEmb2EmbPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. Ignored when not using guidance (i.e., ignored
if <code>guidance_scale</code> is less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.KandinskyV22PriorEmb2EmbPipeline.__call__.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.KandinskyV22PriorEmb2EmbPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 100) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.KandinskyV22PriorEmb2EmbPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.KandinskyV22PriorEmb2EmbPipeline.__call__.latents",description:`<strong>latents</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated noisy latents, sampled from a Gaussian distribution, to be used as inputs for image
generation. Can be used to tweak the same generation with different prompts. If not provided, a latents
tensor will ge generated by sampling using the supplied random <code>generator</code>.`,name:"latents"},{anchor:"diffusers.KandinskyV22PriorEmb2EmbPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 4.0) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.KandinskyV22PriorEmb2EmbPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pt&quot;</code>) &#x2014;
The output format of the generate image. Choose between: <code>&quot;np&quot;</code> (<code>np.array</code>) or <code>&quot;pt&quot;</code>
(<code>torch.Tensor</code>).`,name:"output_type"},{anchor:"diffusers.KandinskyV22PriorEmb2EmbPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <a href="/docs/diffusers/v0.18.0/en/api/outputs#diffusers.ImagePipelineOutput">ImagePipelineOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_prior_emb2emb.py#L435",returnType:`
<p><code>KandinskyPriorPipelineOutput</code> or <code>tuple</code></p>
`}}),Jn=new Ue({props:{anchor:"diffusers.KandinskyV22PriorEmb2EmbPipeline.__call__.example",$$slots:{default:[Sv]},$$scope:{ctx:I}}}),Ns=new U({props:{name:"interpolate",anchor:"diffusers.KandinskyV22PriorEmb2EmbPipeline.interpolate",parameters:[{name:"images_and_prompts",val:": typing.List[typing.Union[str, PIL.Image.Image, torch.FloatTensor]]"},{name:"weights",val:": typing.List[float]"},{name:"num_images_per_prompt",val:": int = 1"},{name:"num_inference_steps",val:": int = 25"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"latents",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_prior_prompt",val:": typing.Optional[str] = None"},{name:"negative_prompt",val:": str = ''"},{name:"guidance_scale",val:": float = 4.0"},{name:"device",val:" = None"}],parametersDescription:[{anchor:"diffusers.KandinskyV22PriorEmb2EmbPipeline.interpolate.images_and_prompts",description:`<strong>images_and_prompts</strong> (<code>List[Union[str, PIL.Image.Image, torch.FloatTensor]]</code>) &#x2014;
list of prompts and images to guide the image generation.
weights &#x2014; (<code>List[float]</code>):
list of weights for each condition in <code>images_and_prompts</code>`,name:"images_and_prompts"},{anchor:"diffusers.KandinskyV22PriorEmb2EmbPipeline.interpolate.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.KandinskyV22PriorEmb2EmbPipeline.interpolate.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 100) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.KandinskyV22PriorEmb2EmbPipeline.interpolate.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.KandinskyV22PriorEmb2EmbPipeline.interpolate.latents",description:`<strong>latents</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated noisy latents, sampled from a Gaussian distribution, to be used as inputs for image
generation. Can be used to tweak the same generation with different prompts. If not provided, a latents
tensor will ge generated by sampling using the supplied random <code>generator</code>.`,name:"latents"},{anchor:"diffusers.KandinskyV22PriorEmb2EmbPipeline.interpolate.negative_prior_prompt",description:`<strong>negative_prior_prompt</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The prompt not to guide the prior diffusion process. Ignored when not using guidance (i.e., ignored if
<code>guidance_scale</code> is less than <code>1</code>).`,name:"negative_prior_prompt"},{anchor:"diffusers.KandinskyV22PriorEmb2EmbPipeline.interpolate.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt not to guide the image generation. Ignored when not using guidance (i.e., ignored if
<code>guidance_scale</code> is less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.KandinskyV22PriorEmb2EmbPipeline.interpolate.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 4.0) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,name:"guidance_scale"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_prior_emb2emb.py#L153",returnType:`
<p><code>KandinskyPriorPipelineOutput</code> or <code>tuple</code></p>
`}}),kn=new Ue({props:{anchor:"diffusers.KandinskyV22PriorEmb2EmbPipeline.interpolate.example",$$slots:{default:[qv]},$$scope:{ctx:I}}}),Ys=new U({props:{name:"enable_sequential_cpu_offload",anchor:"diffusers.KandinskyV22PriorEmb2EmbPipeline.enable_sequential_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_prior_emb2emb.py#L297"}}),Ss=new B({}),qs=new U({props:{name:"class diffusers.KandinskyPriorPipeline",anchor:"diffusers.KandinskyPriorPipeline",parameters:[{name:"prior",val:": PriorTransformer"},{name:"image_encoder",val:": CLIPVisionModelWithProjection"},{name:"text_encoder",val:": CLIPTextModelWithProjection"},{name:"tokenizer",val:": CLIPTokenizer"},{name:"scheduler",val:": UnCLIPScheduler"},{name:"image_processor",val:": CLIPImageProcessor"}],parametersDescription:[{anchor:"diffusers.KandinskyPriorPipeline.prior",description:`<strong>prior</strong> (<a href="/docs/diffusers/v0.18.0/en/api/models/prior_transformer#diffusers.PriorTransformer">PriorTransformer</a>) &#x2014;
The canonincal unCLIP prior to approximate the image embedding from the text embedding.`,name:"prior"},{anchor:"diffusers.KandinskyPriorPipeline.image_encoder",description:`<strong>image_encoder</strong> (<code>CLIPVisionModelWithProjection</code>) &#x2014;
Frozen image-encoder.`,name:"image_encoder"},{anchor:"diffusers.KandinskyPriorPipeline.text_encoder",description:`<strong>text_encoder</strong> (<code>CLIPTextModelWithProjection</code>) &#x2014;
Frozen text-encoder.`,name:"text_encoder"},{anchor:"diffusers.KandinskyPriorPipeline.tokenizer",description:`<strong>tokenizer</strong> (<code>CLIPTokenizer</code>) &#x2014;
Tokenizer of class
<a href="https://huggingface.co/docs/transformers/v4.21.0/en/model_doc/clip#transformers.CLIPTokenizer" rel="nofollow">CLIPTokenizer</a>.`,name:"tokenizer"},{anchor:"diffusers.KandinskyPriorPipeline.scheduler",description:`<strong>scheduler</strong> (<code>UnCLIPScheduler</code>) &#x2014;
A scheduler to be used in combination with <code>prior</code> to generate image embedding.`,name:"scheduler"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/kandinsky/pipeline_kandinsky_prior.py#L129"}}),zs=new U({props:{name:"__call__",anchor:"diffusers.KandinskyPriorPipeline.__call__",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]]"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"num_images_per_prompt",val:": int = 1"},{name:"num_inference_steps",val:": int = 25"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"latents",val:": typing.Optional[torch.FloatTensor] = None"},{name:"guidance_scale",val:": float = 4.0"},{name:"output_type",val:": typing.Optional[str] = 'pt'"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.KandinskyPriorPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>) &#x2014;
The prompt or prompts to guide the image generation.`,name:"prompt"},{anchor:"diffusers.KandinskyPriorPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. Ignored when not using guidance (i.e., ignored
if <code>guidance_scale</code> is less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.KandinskyPriorPipeline.__call__.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.KandinskyPriorPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 100) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.KandinskyPriorPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.KandinskyPriorPipeline.__call__.latents",description:`<strong>latents</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated noisy latents, sampled from a Gaussian distribution, to be used as inputs for image
generation. Can be used to tweak the same generation with different prompts. If not provided, a latents
tensor will ge generated by sampling using the supplied random <code>generator</code>.`,name:"latents"},{anchor:"diffusers.KandinskyPriorPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 4.0) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.KandinskyPriorPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pt&quot;</code>) &#x2014;
The output format of the generate image. Choose between: <code>&quot;np&quot;</code> (<code>np.array</code>) or <code>&quot;pt&quot;</code>
(<code>torch.Tensor</code>).`,name:"output_type"},{anchor:"diffusers.KandinskyPriorPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <a href="/docs/diffusers/v0.18.0/en/api/outputs#diffusers.ImagePipelineOutput">ImagePipelineOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/kandinsky/pipeline_kandinsky_prior.py#L434",returnType:`
<p><code>KandinskyPriorPipelineOutput</code> or <code>tuple</code></p>
`}}),Un=new Ue({props:{anchor:"diffusers.KandinskyPriorPipeline.__call__.example",$$slots:{default:[Dv]},$$scope:{ctx:I}}}),Hs=new U({props:{name:"interpolate",anchor:"diffusers.KandinskyPriorPipeline.interpolate",parameters:[{name:"images_and_prompts",val:": typing.List[typing.Union[str, PIL.Image.Image, torch.FloatTensor]]"},{name:"weights",val:": typing.List[float]"},{name:"num_images_per_prompt",val:": int = 1"},{name:"num_inference_steps",val:": int = 25"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"latents",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_prior_prompt",val:": typing.Optional[str] = None"},{name:"negative_prompt",val:": str = ''"},{name:"guidance_scale",val:": float = 4.0"},{name:"device",val:" = None"}],parametersDescription:[{anchor:"diffusers.KandinskyPriorPipeline.interpolate.images_and_prompts",description:`<strong>images_and_prompts</strong> (<code>List[Union[str, PIL.Image.Image, torch.FloatTensor]]</code>) &#x2014;
list of prompts and images to guide the image generation.
weights &#x2014; (<code>List[float]</code>):
list of weights for each condition in <code>images_and_prompts</code>`,name:"images_and_prompts"},{anchor:"diffusers.KandinskyPriorPipeline.interpolate.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.KandinskyPriorPipeline.interpolate.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 100) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.KandinskyPriorPipeline.interpolate.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.KandinskyPriorPipeline.interpolate.latents",description:`<strong>latents</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated noisy latents, sampled from a Gaussian distribution, to be used as inputs for image
generation. Can be used to tweak the same generation with different prompts. If not provided, a latents
tensor will ge generated by sampling using the supplied random <code>generator</code>.`,name:"latents"},{anchor:"diffusers.KandinskyPriorPipeline.interpolate.negative_prior_prompt",description:`<strong>negative_prior_prompt</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The prompt not to guide the prior diffusion process. Ignored when not using guidance (i.e., ignored if
<code>guidance_scale</code> is less than <code>1</code>).`,name:"negative_prior_prompt"},{anchor:"diffusers.KandinskyPriorPipeline.interpolate.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt not to guide the image generation. Ignored when not using guidance (i.e., ignored if
<code>guidance_scale</code> is less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.KandinskyPriorPipeline.interpolate.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 4.0) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,name:"guidance_scale"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/kandinsky/pipeline_kandinsky_prior.py#L170",returnType:`
<p><code>KandinskyPriorPipelineOutput</code> or <code>tuple</code></p>
`}}),jn=new Ue({props:{anchor:"diffusers.KandinskyPriorPipeline.interpolate.example",$$slots:{default:[zv]},$$scope:{ctx:I}}}),As=new U({props:{name:"enable_sequential_cpu_offload",anchor:"diffusers.KandinskyPriorPipeline.enable_sequential_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/kandinsky/pipeline_kandinsky_prior.py#L298"}}),Os=new B({}),ei=new U({props:{name:"class diffusers.KandinskyPipeline",anchor:"diffusers.KandinskyPipeline",parameters:[{name:"text_encoder",val:": MultilingualCLIP"},{name:"tokenizer",val:": XLMRobertaTokenizer"},{name:"unet",val:": UNet2DConditionModel"},{name:"scheduler",val:": typing.Union[diffusers.schedulers.scheduling_ddim.DDIMScheduler, diffusers.schedulers.scheduling_ddpm.DDPMScheduler]"},{name:"movq",val:": VQModel"}],parametersDescription:[{anchor:"diffusers.KandinskyPipeline.text_encoder",description:`<strong>text_encoder</strong> (<code>MultilingualCLIP</code>) &#x2014;
Frozen text-encoder.`,name:"text_encoder"},{anchor:"diffusers.KandinskyPipeline.tokenizer",description:`<strong>tokenizer</strong> (<code>XLMRobertaTokenizer</code>) &#x2014;
Tokenizer of class`,name:"tokenizer"},{anchor:"diffusers.KandinskyPipeline.scheduler",description:`<strong>scheduler</strong> (Union[<code>DDIMScheduler</code>,<code>DDPMScheduler</code>]) &#x2014;
A scheduler to be used in combination with <code>unet</code> to generate image latents.`,name:"scheduler"},{anchor:"diffusers.KandinskyPipeline.unet",description:`<strong>unet</strong> (<a href="/docs/diffusers/v0.18.0/en/api/models/unet2d-cond#diffusers.UNet2DConditionModel">UNet2DConditionModel</a>) &#x2014;
Conditional U-Net architecture to denoise the image embedding.`,name:"unet"},{anchor:"diffusers.KandinskyPipeline.movq",description:`<strong>movq</strong> (<a href="/docs/diffusers/v0.18.0/en/api/models/vq#diffusers.VQModel">VQModel</a>) &#x2014;
MoVQ Decoder to generate the image from the latents.`,name:"movq"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/kandinsky/pipeline_kandinsky.py#L79"}}),ni=new U({props:{name:"__call__",anchor:"diffusers.KandinskyPipeline.__call__",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]]"},{name:"image_embeds",val:": typing.Union[torch.FloatTensor, typing.List[torch.FloatTensor]]"},{name:"negative_image_embeds",val:": typing.Union[torch.FloatTensor, typing.List[torch.FloatTensor]]"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"height",val:": int = 512"},{name:"width",val:": int = 512"},{name:"num_inference_steps",val:": int = 100"},{name:"guidance_scale",val:": float = 4.0"},{name:"num_images_per_prompt",val:": int = 1"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"latents",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_type",val:": typing.Optional[str] = 'pil'"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.KandinskyPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>) &#x2014;
The prompt or prompts to guide the image generation.`,name:"prompt"},{anchor:"diffusers.KandinskyPipeline.__call__.image_embeds",description:`<strong>image_embeds</strong> (<code>torch.FloatTensor</code> or <code>List[torch.FloatTensor]</code>) &#x2014;
The clip image embeddings for text prompt, that will be used to condition the image generation.`,name:"image_embeds"},{anchor:"diffusers.KandinskyPipeline.__call__.negative_image_embeds",description:`<strong>negative_image_embeds</strong> (<code>torch.FloatTensor</code> or <code>List[torch.FloatTensor]</code>) &#x2014;
The clip image embeddings for negative text prompt, will be used to condition the image generation.`,name:"negative_image_embeds"},{anchor:"diffusers.KandinskyPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. Ignored when not using guidance (i.e., ignored
if <code>guidance_scale</code> is less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.KandinskyPipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
The height in pixels of the generated image.`,name:"height"},{anchor:"diffusers.KandinskyPipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
The width in pixels of the generated image.`,name:"width"},{anchor:"diffusers.KandinskyPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 100) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.KandinskyPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 4.0) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.KandinskyPipeline.__call__.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.KandinskyPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.KandinskyPipeline.__call__.latents",description:`<strong>latents</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated noisy latents, sampled from a Gaussian distribution, to be used as inputs for image
generation. Can be used to tweak the same generation with different prompts. If not provided, a latents
tensor will ge generated by sampling using the supplied random <code>generator</code>.`,name:"latents"},{anchor:"diffusers.KandinskyPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pil&quot;</code>) &#x2014;
The output format of the generate image. Choose between: <code>&quot;pil&quot;</code> (<code>PIL.Image.Image</code>), <code>&quot;np&quot;</code>
(<code>np.array</code>) or <code>&quot;pt&quot;</code> (<code>torch.Tensor</code>).`,name:"output_type"},{anchor:"diffusers.KandinskyPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <a href="/docs/diffusers/v0.18.0/en/api/outputs#diffusers.ImagePipelineOutput">ImagePipelineOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/kandinsky/pipeline_kandinsky.py#L301",returnType:`
<p><a
  href="/docs/diffusers/v0.18.0/en/api/outputs#diffusers.ImagePipelineOutput"
>ImagePipelineOutput</a> or <code>tuple</code></p>
`}}),Wn=new Ue({props:{anchor:"diffusers.KandinskyPipeline.__call__.example",$$slots:{default:[Hv]},$$scope:{ctx:I}}}),ai=new U({props:{name:"enable_model_cpu_offload",anchor:"diffusers.KandinskyPipeline.enable_model_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/kandinsky/pipeline_kandinsky.py#L254"}}),si=new U({props:{name:"enable_sequential_cpu_offload",anchor:"diffusers.KandinskyPipeline.enable_sequential_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/kandinsky/pipeline_kandinsky.py#L232"}}),li=new B({}),oi=new U({props:{name:"class diffusers.KandinskyImg2ImgPipeline",anchor:"diffusers.KandinskyImg2ImgPipeline",parameters:[{name:"text_encoder",val:": MultilingualCLIP"},{name:"movq",val:": VQModel"},{name:"tokenizer",val:": XLMRobertaTokenizer"},{name:"unet",val:": UNet2DConditionModel"},{name:"scheduler",val:": DDIMScheduler"}],parametersDescription:[{anchor:"diffusers.KandinskyImg2ImgPipeline.text_encoder",description:`<strong>text_encoder</strong> (<code>MultilingualCLIP</code>) &#x2014;
Frozen text-encoder.`,name:"text_encoder"},{anchor:"diffusers.KandinskyImg2ImgPipeline.tokenizer",description:`<strong>tokenizer</strong> (<code>XLMRobertaTokenizer</code>) &#x2014;
Tokenizer of class`,name:"tokenizer"},{anchor:"diffusers.KandinskyImg2ImgPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/v0.18.0/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>) &#x2014;
A scheduler to be used in combination with <code>unet</code> to generate image latents.`,name:"scheduler"},{anchor:"diffusers.KandinskyImg2ImgPipeline.unet",description:`<strong>unet</strong> (<a href="/docs/diffusers/v0.18.0/en/api/models/unet2d-cond#diffusers.UNet2DConditionModel">UNet2DConditionModel</a>) &#x2014;
Conditional U-Net architecture to denoise the image embedding.`,name:"unet"},{anchor:"diffusers.KandinskyImg2ImgPipeline.movq",description:`<strong>movq</strong> (<a href="/docs/diffusers/v0.18.0/en/api/models/vq#diffusers.VQModel">VQModel</a>) &#x2014;
MoVQ image encoder and decoder`,name:"movq"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/kandinsky/pipeline_kandinsky_img2img.py#L101"}}),pi=new U({props:{name:"__call__",anchor:"diffusers.KandinskyImg2ImgPipeline.__call__",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]]"},{name:"image",val:": typing.Union[torch.FloatTensor, PIL.Image.Image, typing.List[torch.FloatTensor], typing.List[PIL.Image.Image]]"},{name:"image_embeds",val:": FloatTensor"},{name:"negative_image_embeds",val:": FloatTensor"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"height",val:": int = 512"},{name:"width",val:": int = 512"},{name:"num_inference_steps",val:": int = 100"},{name:"strength",val:": float = 0.3"},{name:"guidance_scale",val:": float = 7.0"},{name:"num_images_per_prompt",val:": int = 1"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"output_type",val:": typing.Optional[str] = 'pil'"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.KandinskyImg2ImgPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>) &#x2014;
The prompt or prompts to guide the image generation.`,name:"prompt"},{anchor:"diffusers.KandinskyImg2ImgPipeline.__call__.image",description:`<strong>image</strong> (<code>torch.FloatTensor</code>, <code>PIL.Image.Image</code>) &#x2014;
<code>Image</code>, or tensor representing an image batch, that will be used as the starting point for the
process.`,name:"image"},{anchor:"diffusers.KandinskyImg2ImgPipeline.__call__.image_embeds",description:`<strong>image_embeds</strong> (<code>torch.FloatTensor</code> or <code>List[torch.FloatTensor]</code>) &#x2014;
The clip image embeddings for text prompt, that will be used to condition the image generation.`,name:"image_embeds"},{anchor:"diffusers.KandinskyImg2ImgPipeline.__call__.negative_image_embeds",description:`<strong>negative_image_embeds</strong> (<code>torch.FloatTensor</code> or <code>List[torch.FloatTensor]</code>) &#x2014;
The clip image embeddings for negative text prompt, will be used to condition the image generation.`,name:"negative_image_embeds"},{anchor:"diffusers.KandinskyImg2ImgPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. Ignored when not using guidance (i.e., ignored
if <code>guidance_scale</code> is less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.KandinskyImg2ImgPipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
The height in pixels of the generated image.`,name:"height"},{anchor:"diffusers.KandinskyImg2ImgPipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
The width in pixels of the generated image.`,name:"width"},{anchor:"diffusers.KandinskyImg2ImgPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 100) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.KandinskyImg2ImgPipeline.__call__.strength",description:`<strong>strength</strong> (<code>float</code>, <em>optional</em>, defaults to 0.3) &#x2014;
Conceptually, indicates how much to transform the reference <code>image</code>. Must be between 0 and 1. <code>image</code>
will be used as a starting point, adding more noise to it the larger the <code>strength</code>. The number of
denoising steps depends on the amount of noise initially added. When <code>strength</code> is 1, added noise will
be maximum and the denoising process will run for the full number of iterations specified in
<code>num_inference_steps</code>. A value of 1, therefore, essentially ignores <code>image</code>.`,name:"strength"},{anchor:"diffusers.KandinskyImg2ImgPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 4.0) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.KandinskyImg2ImgPipeline.__call__.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.KandinskyImg2ImgPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.KandinskyImg2ImgPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pil&quot;</code>) &#x2014;
The output format of the generate image. Choose between: <code>&quot;pil&quot;</code> (<code>PIL.Image.Image</code>), <code>&quot;np&quot;</code>
(<code>np.array</code>) or <code>&quot;pt&quot;</code> (<code>torch.Tensor</code>).`,name:"output_type"},{anchor:"diffusers.KandinskyImg2ImgPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <a href="/docs/diffusers/v0.18.0/en/api/outputs#diffusers.ImagePipelineOutput">ImagePipelineOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/kandinsky/pipeline_kandinsky_img2img.py#L363",returnType:`
<p><a
  href="/docs/diffusers/v0.18.0/en/api/outputs#diffusers.ImagePipelineOutput"
>ImagePipelineOutput</a> or <code>tuple</code></p>
`}}),Vn=new Ue({props:{anchor:"diffusers.KandinskyImg2ImgPipeline.__call__.example",$$slots:{default:[Av]},$$scope:{ctx:I}}}),di=new U({props:{name:"enable_model_cpu_offload",anchor:"diffusers.KandinskyImg2ImgPipeline.enable_model_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/kandinsky/pipeline_kandinsky_img2img.py#L289"}}),ci=new U({props:{name:"enable_sequential_cpu_offload",anchor:"diffusers.KandinskyImg2ImgPipeline.enable_sequential_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/kandinsky/pipeline_kandinsky_img2img.py#L267"}}),hi=new B({}),gi=new U({props:{name:"class diffusers.KandinskyInpaintPipeline",anchor:"diffusers.KandinskyInpaintPipeline",parameters:[{name:"text_encoder",val:": MultilingualCLIP"},{name:"movq",val:": VQModel"},{name:"tokenizer",val:": XLMRobertaTokenizer"},{name:"unet",val:": UNet2DConditionModel"},{name:"scheduler",val:": DDIMScheduler"}],parametersDescription:[{anchor:"diffusers.KandinskyInpaintPipeline.text_encoder",description:`<strong>text_encoder</strong> (<code>MultilingualCLIP</code>) &#x2014;
Frozen text-encoder.`,name:"text_encoder"},{anchor:"diffusers.KandinskyInpaintPipeline.tokenizer",description:`<strong>tokenizer</strong> (<code>XLMRobertaTokenizer</code>) &#x2014;
Tokenizer of class`,name:"tokenizer"},{anchor:"diffusers.KandinskyInpaintPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/v0.18.0/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>) &#x2014;
A scheduler to be used in combination with <code>unet</code> to generate image latents.`,name:"scheduler"},{anchor:"diffusers.KandinskyInpaintPipeline.unet",description:`<strong>unet</strong> (<a href="/docs/diffusers/v0.18.0/en/api/models/unet2d-cond#diffusers.UNet2DConditionModel">UNet2DConditionModel</a>) &#x2014;
Conditional U-Net architecture to denoise the image embedding.`,name:"unet"},{anchor:"diffusers.KandinskyInpaintPipeline.movq",description:`<strong>movq</strong> (<a href="/docs/diffusers/v0.18.0/en/api/models/vq#diffusers.VQModel">VQModel</a>) &#x2014;
MoVQ image encoder and decoder`,name:"movq"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/kandinsky/pipeline_kandinsky_inpaint.py#L239"}}),fi=new U({props:{name:"__call__",anchor:"diffusers.KandinskyInpaintPipeline.__call__",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]]"},{name:"image",val:": typing.Union[torch.FloatTensor, PIL.Image.Image]"},{name:"mask_image",val:": typing.Union[torch.FloatTensor, PIL.Image.Image, numpy.ndarray]"},{name:"image_embeds",val:": FloatTensor"},{name:"negative_image_embeds",val:": FloatTensor"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"height",val:": int = 512"},{name:"width",val:": int = 512"},{name:"num_inference_steps",val:": int = 100"},{name:"guidance_scale",val:": float = 4.0"},{name:"num_images_per_prompt",val:": int = 1"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"latents",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_type",val:": typing.Optional[str] = 'pil'"},{name:"return_dict",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.KandinskyInpaintPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>) &#x2014;
The prompt or prompts to guide the image generation.`,name:"prompt"},{anchor:"diffusers.KandinskyInpaintPipeline.__call__.image",description:`<strong>image</strong> (<code>torch.FloatTensor</code>, <code>PIL.Image.Image</code> or <code>np.ndarray</code>) &#x2014;
<code>Image</code>, or tensor representing an image batch, that will be used as the starting point for the
process.`,name:"image"},{anchor:"diffusers.KandinskyInpaintPipeline.__call__.mask_image",description:`<strong>mask_image</strong> (<code>PIL.Image.Image</code>,<code>torch.FloatTensor</code> or <code>np.ndarray</code>) &#x2014;
<code>Image</code>, or a tensor representing an image batch, to mask <code>image</code>. White pixels in the mask will be
repainted, while black pixels will be preserved. You can pass a pytorch tensor as mask only if the
image you passed is a pytorch tensor, and it should contain one color channel (L) instead of 3, so the
expected shape would be either <code>(B, 1, H, W,)</code>, <code>(B, H, W)</code>, <code>(1, H, W)</code> or <code>(H, W)</code> If image is an PIL
image or numpy array, mask should also be a either PIL image or numpy array. If it is a PIL image, it
will be converted to a single channel (luminance) before use. If it is a nummpy array, the expected
shape is <code>(H, W)</code>.`,name:"mask_image"},{anchor:"diffusers.KandinskyInpaintPipeline.__call__.image_embeds",description:`<strong>image_embeds</strong> (<code>torch.FloatTensor</code> or <code>List[torch.FloatTensor]</code>) &#x2014;
The clip image embeddings for text prompt, that will be used to condition the image generation.`,name:"image_embeds"},{anchor:"diffusers.KandinskyInpaintPipeline.__call__.negative_image_embeds",description:`<strong>negative_image_embeds</strong> (<code>torch.FloatTensor</code> or <code>List[torch.FloatTensor]</code>) &#x2014;
The clip image embeddings for negative text prompt, will be used to condition the image generation.`,name:"negative_image_embeds"},{anchor:"diffusers.KandinskyInpaintPipeline.__call__.negative_prompt",description:`<strong>negative_prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts not to guide the image generation. Ignored when not using guidance (i.e., ignored
if <code>guidance_scale</code> is less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.KandinskyInpaintPipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
The height in pixels of the generated image.`,name:"height"},{anchor:"diffusers.KandinskyInpaintPipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>, <em>optional</em>, defaults to 512) &#x2014;
The width in pixels of the generated image.`,name:"width"},{anchor:"diffusers.KandinskyInpaintPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 100) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.KandinskyInpaintPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 4.0) &#x2014;
Guidance scale as defined in <a href="https://arxiv.org/abs/2207.12598" rel="nofollow">Classifier-Free Diffusion Guidance</a>.
<code>guidance_scale</code> is defined as <code>w</code> of equation 2. of <a href="https://arxiv.org/pdf/2205.11487.pdf" rel="nofollow">Imagen
Paper</a>. Guidance scale is enabled by setting <code>guidance_scale &gt; 1</code>. Higher guidance scale encourages to generate images that are closely linked to the text <code>prompt</code>,
usually at the expense of lower image quality.`,name:"guidance_scale"},{anchor:"diffusers.KandinskyInpaintPipeline.__call__.num_images_per_prompt",description:`<strong>num_images_per_prompt</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The number of images to generate per prompt.`,name:"num_images_per_prompt"},{anchor:"diffusers.KandinskyInpaintPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
One or a list of <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow">torch generator(s)</a>
to make generation deterministic.`,name:"generator"},{anchor:"diffusers.KandinskyInpaintPipeline.__call__.latents",description:`<strong>latents</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated noisy latents, sampled from a Gaussian distribution, to be used as inputs for image
generation. Can be used to tweak the same generation with different prompts. If not provided, a latents
tensor will ge generated by sampling using the supplied random <code>generator</code>.`,name:"latents"},{anchor:"diffusers.KandinskyInpaintPipeline.__call__.output_type",description:`<strong>output_type</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;pil&quot;</code>) &#x2014;
The output format of the generate image. Choose between: <code>&quot;pil&quot;</code> (<code>PIL.Image.Image</code>), <code>&quot;np&quot;</code>
(<code>np.array</code>) or <code>&quot;pt&quot;</code> (<code>torch.Tensor</code>).`,name:"output_type"},{anchor:"diffusers.KandinskyInpaintPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <a href="/docs/diffusers/v0.18.0/en/api/outputs#diffusers.ImagePipelineOutput">ImagePipelineOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/kandinsky/pipeline_kandinsky_inpaint.py#L461",returnType:`
<p><a
  href="/docs/diffusers/v0.18.0/en/api/outputs#diffusers.ImagePipelineOutput"
>ImagePipelineOutput</a> or <code>tuple</code></p>
`}}),xn=new Ue({props:{anchor:"diffusers.KandinskyInpaintPipeline.__call__.example",$$slots:{default:[Lv]},$$scope:{ctx:I}}}),yi=new U({props:{name:"enable_model_cpu_offload",anchor:"diffusers.KandinskyInpaintPipeline.enable_model_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/kandinsky/pipeline_kandinsky_inpaint.py#L414"}}),bi=new U({props:{name:"enable_sequential_cpu_offload",anchor:"diffusers.KandinskyInpaintPipeline.enable_sequential_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.18.0/src/diffusers/pipelines/kandinsky/pipeline_kandinsky_inpaint.py#L392"}}),{c(){g=a("meta"),v=p(),k=a("h1"),w=a("a"),T=a("span"),u(h.$$.fragment),J=p(),H=a("span"),$=l("Kandinsky"),te=p(),Z=a("h2"),E=a("a"),me=a("span"),u(A.$$.fragment),Tt=p(),D=a("span"),Nn=l("Overview"),We=p(),L=a("p"),Yn=l("Kandinsky inherits best practices from "),ne=a("a"),Kn=l("DALL-E 2"),Sn=l(" and "),he=a("a"),je=l("Latent Diffusion"),vt=l(", while introducing some new ideas."),W=p(),G=a("p"),Ti=l("It uses "),Ge=a("a"),vi=l("CLIP"),Ui=l(" for encoding images and text, and a diffusion image prior (mapping) between latent spaces of CLIP modalities. This approach enhances the visual performance of the model and unveils new horizons in blending images and text-guided image manipulation."),Ie=p(),V=a("p"),ji=l("The Kandinsky model is created by "),qn=a("a"),Vh=l("Arseniy Shakhmatov"),Ph=l(", "),Dn=a("a"),Ch=l("Anton Razzhigaev"),$h=l(", "),zn=a("a"),xh=l("Aleksandr Nikolich"),Rh=l(", "),Hn=a("a"),Xh=l("Igor Pavlov"),Fh=l(", "),An=a("a"),Qh=l("Andrey Kuznetsov"),Nh=l(" and "),Ln=a("a"),Yh=l("Denis Dimitrov"),Kh=l(". The original codebase can be found "),On=a("a"),Sh=l("here"),td=p(),nt=a("h2"),Ut=a("a"),no=a("span"),u(ea.$$.fragment),qh=p(),ao=a("span"),Dh=l("Usage example"),nd=p(),Ii=a("p"),zh=l("In the following, we will walk you through some examples of how to use the Kandinsky pipelines to create some visually aesthetic artwork."),ad=p(),at=a("h3"),jt=a("a"),so=a("span"),u(ta.$$.fragment),Hh=p(),io=a("span"),Ah=l("Text-to-Image Generation"),sd=p(),ge=a("p"),Lh=l("For text-to-image generation, we need to use both "),Zi=a("a"),Oh=l("KandinskyPriorPipeline"),eg=l(" and "),Wi=a("a"),tg=l("KandinskyPipeline"),ng=l(`.
The first step is to encode text prompts with CLIP and then diffuse the CLIP text embeddings to CLIP image embeddings,
as first proposed in `),na=a("a"),ag=l("DALL-E 2"),sg=l(`.
Let\u2019s throw a fun prompt at Kandinsky to see what it comes up with.`),id=p(),u(aa.$$.fragment),ld=p(),Gi=a("p"),ig=l(`First, let\u2019s instantiate the prior pipeline and the text-to-image pipeline. Both
pipelines are diffusion models.`),od=p(),u(sa.$$.fragment),rd=p(),u(It.$$.fragment),pd=p(),Ei=a("p"),lg=l(`Now we pass the prompt through the prior to generate image embeddings. The prior
returns both the image embeddings corresponding to the prompt and negative/unconditional image
embeddings corresponding to an empty string.`),dd=p(),u(ia.$$.fragment),cd=p(),u(Zt.$$.fragment),md=p(),Wt=a("p"),og=l(`Next, we can pass the embeddings as well as the prompt to the text-to-image pipeline. Remember that
in case you are using a customized negative prompt, that you should pass this one also to the text-to-image pipelines
with `),lo=a("code"),rg=l("negative_prompt=negative_prompt"),pg=l(":"),hd=p(),u(la.$$.fragment),gd=p(),Bi=a("p"),dg=l("One cheeseburger monster coming up! Enjoy!"),ud=p(),Vi=a("p"),Pi=a("img"),fd=p(),Ci=a("p"),cg=l("The Kandinsky model works extremely well with creative prompts. Here is some of the amazing art that can be created using the exact same process but with different prompts."),yd=p(),u(oa.$$.fragment),bd=p(),$i=a("p"),xi=a("img"),Md=p(),u(ra.$$.fragment),_d=p(),Ri=a("p"),Xi=a("img"),wd=p(),u(pa.$$.fragment),Jd=p(),Fi=a("p"),Qi=a("img"),kd=p(),u(da.$$.fragment),Td=p(),Ni=a("p"),Yi=a("img"),vd=p(),st=a("h3"),Gt=a("a"),oo=a("span"),u(ca.$$.fragment),mg=p(),ro=a("span"),hg=l("Text Guided Image-to-Image Generation"),Ud=p(),Et=a("p"),gg=l("The same Kandinsky model weights can be used for text-guided image-to-image translation. In this case, just make sure to load the weights using the "),Ki=a("a"),ug=l("KandinskyImg2ImgPipeline"),fg=l(" pipeline."),jd=p(),Ze=a("p"),po=a("strong"),yg=l("Note"),bg=l(`: You can also directly move the weights of the text-to-image pipelines to the image-to-image pipelines
without loading them twice by making use of the `),Si=a("a"),Mg=l("components"),_g=l(" function as explained "),qi=a("a"),wg=l("here"),Jg=l("."),Id=p(),Di=a("p"),kg=l("Let\u2019s download an image."),Zd=p(),u(ma.$$.fragment),Wd=p(),zi=a("p"),Hi=a("img"),Gd=p(),u(ha.$$.fragment),Ed=p(),Ai=a("p"),Li=a("img"),Bd=p(),it=a("h3"),Bt=a("a"),co=a("span"),u(ga.$$.fragment),Tg=p(),mo=a("span"),vg=l("Text Guided Inpainting Generation"),Vd=p(),Vt=a("p"),Ug=l("You can use "),Oi=a("a"),jg=l("KandinskyInpaintPipeline"),Ig=l(" to edit images. In this example, we will add a hat to the portrait of a cat."),Pd=p(),u(ua.$$.fragment),Cd=p(),el=a("p"),tl=a("img"),$d=p(),lt=a("h3"),Pt=a("a"),ho=a("span"),u(fa.$$.fragment),Zg=p(),go=a("span"),Wg=l("Interpolate"),xd=p(),Ct=a("p"),Gg=l("The "),nl=a("a"),Eg=l("KandinskyPriorPipeline"),Bg=l(" also comes with a cool utility function that will allow you to interpolate the latent space of different images and texts super easily. Here is an example of how you can create an Impressionist-style portrait for your pet based on \u201CThe Starry Night\u201D."),Rd=p(),Ee=a("p"),Vg=l("Note that you can interpolate between texts and images - in the below example, we passed a text prompt \u201Ca cat\u201D and two images to the "),uo=a("code"),Pg=l("interplate"),Cg=l(" function, along with a "),fo=a("code"),$g=l("weights"),xg=l(" variable containing the corresponding weights for each condition we interplate."),Xd=p(),u(ya.$$.fragment),Fd=p(),al=a("p"),sl=a("img"),Qd=p(),ot=a("h3"),$t=a("a"),yo=a("span"),u(ba.$$.fragment),Rg=p(),bo=a("span"),Xg=l("Text-to-Image Generation with ControlNet Conditioning"),Nd=p(),xt=a("p"),Fg=l("In the following, we give a simple example of how to use "),il=a("a"),Qg=l("KandinskyV22ControlnetPipeline"),Ng=l(" to add control to the text-to-image generation with a depth image."),Yd=p(),ll=a("p"),Yg=l("First, let\u2019s take an image and extract its depth map."),Kd=p(),u(Ma.$$.fragment),Sd=p(),ol=a("p"),rl=a("img"),qd=p(),Rt=a("p"),Kg=l("We can use the "),Mo=a("code"),Sg=l("depth-estimation"),qg=l(" pipeline from transformers to process the image and retrieve its depth map."),Dd=p(),u(_a.$$.fragment),zd=p(),pl=a("p"),Dg=l("Now, we load the prior pipeline and the text-to-image controlnet pipeline"),Hd=p(),u(wa.$$.fragment),Ad=p(),dl=a("p"),zg=l("We pass the prompt and negative prompt through the prior to generate image embeddings"),Ld=p(),u(Ja.$$.fragment),Od=p(),Xt=a("p"),Hg=l("Now we can pass the image embeddings and the depth image we extracted to the controlnet pipeline. With Kandinsky 2.2, only prior pipelines accept "),_o=a("code"),Ag=l("prompt"),Lg=l(" input. You do not need to pass the prompt to the controlnet pipeline."),ec=p(),u(ka.$$.fragment),tc=p(),Ta=a("p"),Og=l(`The output image looks as follow:
`),cl=a("img"),nc=p(),rt=a("h3"),Ft=a("a"),wo=a("span"),u(va.$$.fragment),eu=p(),Jo=a("span"),tu=l("Image-to-Image Generation with ControlNet Conditioning"),ac=p(),Be=a("p"),nu=l("Kandinsky 2.2 also includes a "),ml=a("a"),au=l("KandinskyV22ControlnetImg2ImgPipeline"),su=l(" that will allow you to add control to the image generation process with both the image and its depth map. This pipeline works really well with "),hl=a("a"),iu=l("KandinskyV22PriorEmb2EmbPipeline"),lu=l(", which generates image embeddings based on both a text prompt and an image."),sc=p(),gl=a("p"),ou=l("For our robot cat example, we will pass the prompt and cat image together to the prior pipeline to generate an image embedding. We will then use that image embedding and the depth map of the cat to further control the image generation process."),ic=p(),ul=a("p"),ru=l("We can use the same cat image and its depth map from the last example."),lc=p(),u(Ua.$$.fragment),oc=p(),fl=a("p"),pu=l("Here is the output. Compared with the output from our text-to-image controlnet example, it kept a lot more cat facial details from the original image and worked into the robot style we asked for."),rc=p(),yl=a("p"),bl=a("img"),pc=p(),pt=a("h2"),Qt=a("a"),ko=a("span"),u(ja.$$.fragment),du=p(),To=a("span"),cu=l("Kandinsky 2.2"),dc=p(),ue=a("p"),mu=l("The Kandinsky 2.2 release includes robust new text-to-image models that support text-to-image generation, image-to-image generation, image interpolation, and text-guided image inpainting. The general workflow to perform these tasks using Kandinsky 2.2 is the same as in Kandinsky 2.1. First, you will need to use a prior pipeline to generate image embeddings based on your text prompt, and then use one of the image decoding pipelines to generate the output image. The only difference is that in Kandinsky 2.2, all of the decoding pipelines no longer accept the "),vo=a("code"),hu=l("prompt"),gu=l(" input, and the image generation process is conditioned with only "),Uo=a("code"),uu=l("image_embeds"),fu=l(" and "),jo=a("code"),yu=l("negative_image_embeds"),bu=l("."),cc=p(),Ml=a("p"),Mu=l("Let\u2019s look at an example of how to perform text-to-image generation using Kandinsky 2.2."),mc=p(),_l=a("p"),_u=l("First, let\u2019s create the prior pipeline and text-to-image pipeline with Kandinsky 2.2 checkpoints."),hc=p(),u(Ia.$$.fragment),gc=p(),Nt=a("p"),wu=l("You can then use "),Io=a("code"),Ju=l("pipe_prior"),ku=l(" to generate image embeddings."),uc=p(),u(Za.$$.fragment),fc=p(),Yt=a("p"),Tu=l("Now you can pass these embeddings to the text-to-image pipeline. When using Kandinsky 2.2 you don\u2019t need to pass the "),Zo=a("code"),vu=l("prompt"),Uu=l(" (but you do with the previous version, Kandinsky 2.1)."),yc=p(),u(Wa.$$.fragment),bc=p(),wl=a("p"),Jl=a("img"),Mc=p(),kl=a("p"),ju=l("We used the text-to-image pipeline as an example, but the same process applies to all decoding pipelines in Kandinsky 2.2. For more information, please refer to our API section for each pipeline."),_c=p(),dt=a("h2"),Kt=a("a"),Wo=a("span"),u(Ga.$$.fragment),Iu=p(),Go=a("span"),Zu=l("Optimization"),wc=p(),O=a("p"),Wu=l("Running Kandinsky in inference requires running both a first prior pipeline: "),Tl=a("a"),Gu=l("KandinskyPriorPipeline"),Eu=l(`
and a second image decoding pipeline which is one of `),vl=a("a"),Bu=l("KandinskyPipeline"),Vu=l(", "),Ul=a("a"),Pu=l("KandinskyImg2ImgPipeline"),Cu=l(", or "),jl=a("a"),$u=l("KandinskyInpaintPipeline"),xu=l("."),Jc=p(),Il=a("p"),Ru=l(`The bulk of the computation time will always be the second image decoding pipeline, so when looking
into optimizing the model, one should look into the second image decoding pipeline.`),kc=p(),St=a("p"),Xu=l("When running with PyTorch < 2.0, we strongly recommend making use of "),Ea=a("a"),Eo=a("code"),Fu=l("xformers"),Qu=l(`
to speed-up the optimization. This can be done by simply running:`),Tc=p(),u(Ba.$$.fragment),vc=p(),qt=a("p"),Nu=l(`When running on PyTorch >= 2.0, PyTorch\u2019s SDPA attention will automatically be used. For more information on
PyTorch\u2019s SDPA, feel free to have a look at `),Va=a("a"),Yu=l("this blog post"),Ku=l("."),Uc=p(),Zl=a("p"),Su=l("To have explicit control , you can also manually set the pipeline to use PyTorch\u2019s 2.0 efficient attention:"),jc=p(),u(Pa.$$.fragment),Ic=p(),Ve=a("p"),qu=l("The slowest and most memory intense attention processor is the default "),Bo=a("code"),Du=l("AttnAddedKVProcessor"),zu=l(` processor.
We do `),Vo=a("strong"),Hu=l("not"),Au=l(` recommend using it except for testing purposes or cases where very high determistic behaviour is desired.
You can set it with:`),Zc=p(),u(Ca.$$.fragment),Wc=p(),Pe=a("p"),Lu=l("With PyTorch >= 2.0, you can also use Kandinsky with "),Po=a("code"),Ou=l("torch.compile"),ef=l(` which depending
on your hardware can signficantly speed-up your inference time once the model is compiled.
To use Kandinsksy with `),Co=a("code"),tf=l("torch.compile"),nf=l(", you can do:"),Gc=p(),u($a.$$.fragment),Ec=p(),Dt=a("p"),af=l(`After compilation you should see a very fast inference time. For more information,
feel free to have a look at `),xa=a("a"),sf=l("Our PyTorch 2.0 benchmark"),lf=l("."),Bc=p(),ct=a("h2"),zt=a("a"),$o=a("span"),u(Ra.$$.fragment),of=p(),xo=a("span"),rf=l("Available Pipelines:"),Vc=p(),Ht=a("table"),Ro=a("thead"),Xa=a("tr"),Xo=a("th"),pf=l("Pipeline"),df=p(),Fo=a("th"),cf=l("Tasks"),mf=p(),P=a("tbody"),Fa=a("tr"),Qo=a("td"),Qa=a("a"),hf=l("pipeline_kandinsky2_2.py"),gf=p(),No=a("td"),Yo=a("em"),uf=l("Text-to-Image Generation"),ff=p(),Na=a("tr"),Ko=a("td"),Ya=a("a"),yf=l("pipeline_kandinsky.py"),bf=p(),So=a("td"),qo=a("em"),Mf=l("Text-to-Image Generation"),_f=p(),Ka=a("tr"),Do=a("td"),Sa=a("a"),wf=l("pipeline_kandinsky2_2_inpaint.py"),Jf=p(),zo=a("td"),Ho=a("em"),kf=l("Image-Guided Image Generation"),Tf=p(),qa=a("tr"),Ao=a("td"),Da=a("a"),vf=l("pipeline_kandinsky_inpaint.py"),Uf=p(),Lo=a("td"),Oo=a("em"),jf=l("Image-Guided Image Generation"),If=p(),za=a("tr"),er=a("td"),Ha=a("a"),Zf=l("pipeline_kandinsky2_2_img2img.py"),Wf=p(),tr=a("td"),nr=a("em"),Gf=l("Image-Guided Image Generation"),Ef=p(),Aa=a("tr"),ar=a("td"),La=a("a"),Bf=l("pipeline_kandinsky_img2img.py"),Vf=p(),sr=a("td"),ir=a("em"),Pf=l("Image-Guided Image Generation"),Cf=p(),Oa=a("tr"),lr=a("td"),es=a("a"),$f=l("pipeline_kandinsky2_2_controlnet.py"),xf=p(),or=a("td"),rr=a("em"),Rf=l("Image-Guided Image Generation"),Xf=p(),ts=a("tr"),pr=a("td"),ns=a("a"),Ff=l("pipeline_kandinsky2_2_controlnet_img2img.py"),Qf=p(),dr=a("td"),cr=a("em"),Nf=l("Image-Guided Image Generation"),Pc=p(),mt=a("h3"),At=a("a"),mr=a("span"),u(as.$$.fragment),Yf=p(),hr=a("span"),Kf=l("KandinskyV22Pipeline"),Cc=p(),x=a("div"),u(ss.$$.fragment),Sf=p(),gr=a("p"),qf=l("Pipeline for text-to-image generation using Kandinsky"),Df=p(),is=a("p"),zf=l("This model inherits from "),Wl=a("a"),Hf=l("DiffusionPipeline"),Af=l(`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),Lf=p(),Lt=a("div"),u(ls.$$.fragment),Of=p(),u(Ot.$$.fragment),ey=p(),en=a("div"),u(os.$$.fragment),ty=p(),ae=a("p"),ny=l(`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),ur=a("code"),ay=l("enable_sequential_cpu_offload"),sy=l(", this method moves one whole model at a time to the GPU when its "),fr=a("code"),iy=l("forward"),ly=l(`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),yr=a("code"),oy=l("enable_sequential_cpu_offload"),ry=l(", but performance is much better due to the iterative execution of the "),br=a("code"),py=l("unet"),dy=l("."),cy=p(),tn=a("div"),u(rs.$$.fragment),my=p(),ps=a("p"),hy=l(`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, the pipeline\u2019s
models have their state dicts saved to CPU and then are moved to a `),Mr=a("code"),gy=l("torch.device('meta') and loaded to GPU only when their specific submodule has its "),uy=l("forward` method called."),$c=p(),ht=a("h3"),nn=a("a"),_r=a("span"),u(ds.$$.fragment),fy=p(),wr=a("span"),yy=l("KandinskyV22ControlnetPipeline"),xc=p(),R=a("div"),u(cs.$$.fragment),by=p(),Jr=a("p"),My=l("Pipeline for text-to-image generation using Kandinsky"),_y=p(),ms=a("p"),wy=l("This model inherits from "),Gl=a("a"),Jy=l("DiffusionPipeline"),ky=l(`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),Ty=p(),Ce=a("div"),u(hs.$$.fragment),vy=p(),kr=a("p"),Uy=l("Function invoked when calling the pipeline for generation."),jy=p(),u(an.$$.fragment),Iy=p(),sn=a("div"),u(gs.$$.fragment),Zy=p(),se=a("p"),Wy=l(`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),Tr=a("code"),Gy=l("enable_sequential_cpu_offload"),Ey=l(", this method moves one whole model at a time to the GPU when its "),vr=a("code"),By=l("forward"),Vy=l(`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),Ur=a("code"),Py=l("enable_sequential_cpu_offload"),Cy=l(", but performance is much better due to the iterative execution of the "),jr=a("code"),$y=l("unet"),xy=l("."),Ry=p(),ln=a("div"),u(us.$$.fragment),Xy=p(),fs=a("p"),Fy=l(`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, the pipeline\u2019s
models have their state dicts saved to CPU and then are moved to a `),Ir=a("code"),Qy=l("torch.device('meta') and loaded to GPU only when their specific submodule has its "),Ny=l("forward` method called."),Rc=p(),gt=a("h3"),on=a("a"),Zr=a("span"),u(ys.$$.fragment),Yy=p(),Wr=a("span"),Ky=l("KandinskyV22ControlnetImg2ImgPipeline"),Xc=p(),X=a("div"),u(bs.$$.fragment),Sy=p(),Gr=a("p"),qy=l("Pipeline for image-to-image generation using Kandinsky"),Dy=p(),Ms=a("p"),zy=l("This model inherits from "),El=a("a"),Hy=l("DiffusionPipeline"),Ay=l(`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),Ly=p(),$e=a("div"),u(_s.$$.fragment),Oy=p(),Er=a("p"),eb=l("Function invoked when calling the pipeline for generation."),tb=p(),u(rn.$$.fragment),nb=p(),pn=a("div"),u(ws.$$.fragment),ab=p(),ie=a("p"),sb=l(`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),Br=a("code"),ib=l("enable_sequential_cpu_offload"),lb=l(", this method moves one whole model at a time to the GPU when its "),Vr=a("code"),ob=l("forward"),rb=l(`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),Pr=a("code"),pb=l("enable_sequential_cpu_offload"),db=l(", but performance is much better due to the iterative execution of the "),Cr=a("code"),cb=l("unet"),mb=l("."),hb=p(),dn=a("div"),u(Js.$$.fragment),gb=p(),ks=a("p"),ub=l(`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, the pipeline\u2019s
models have their state dicts saved to CPU and then are moved to a `),$r=a("code"),fb=l("torch.device('meta') and loaded to GPU only when their specific submodule has its "),yb=l("forward` method called."),Fc=p(),ut=a("h3"),cn=a("a"),xr=a("span"),u(Ts.$$.fragment),bb=p(),Rr=a("span"),Mb=l("KandinskyV22Img2ImgPipeline"),Qc=p(),F=a("div"),u(vs.$$.fragment),_b=p(),Xr=a("p"),wb=l("Pipeline for image-to-image generation using Kandinsky"),Jb=p(),Us=a("p"),kb=l("This model inherits from "),Bl=a("a"),Tb=l("DiffusionPipeline"),vb=l(`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),Ub=p(),xe=a("div"),u(js.$$.fragment),jb=p(),Fr=a("p"),Ib=l("Function invoked when calling the pipeline for generation."),Zb=p(),u(mn.$$.fragment),Wb=p(),hn=a("div"),u(Is.$$.fragment),Gb=p(),le=a("p"),Eb=l(`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),Qr=a("code"),Bb=l("enable_sequential_cpu_offload"),Vb=l(", this method moves one whole model at a time to the GPU when its "),Nr=a("code"),Pb=l("forward"),Cb=l(`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),Yr=a("code"),$b=l("enable_sequential_cpu_offload"),xb=l(", but performance is much better due to the iterative execution of the "),Kr=a("code"),Rb=l("unet"),Xb=l("."),Fb=p(),gn=a("div"),u(Zs.$$.fragment),Qb=p(),Ws=a("p"),Nb=l(`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, the pipeline\u2019s
models have their state dicts saved to CPU and then are moved to a `),Sr=a("code"),Yb=l("torch.device('meta') and loaded to GPU only when their specific submodule has its "),Kb=l("forward` method called."),Nc=p(),ft=a("h3"),un=a("a"),qr=a("span"),u(Gs.$$.fragment),Sb=p(),Dr=a("span"),qb=l("KandinskyV22InpaintPipeline"),Yc=p(),Q=a("div"),u(Es.$$.fragment),Db=p(),zr=a("p"),zb=l("Pipeline for text-guided image inpainting using Kandinsky2.1"),Hb=p(),Bs=a("p"),Ab=l("This model inherits from "),Vl=a("a"),Lb=l("DiffusionPipeline"),Ob=l(`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),eM=p(),fn=a("div"),u(Vs.$$.fragment),tM=p(),u(yn.$$.fragment),nM=p(),bn=a("div"),u(Ps.$$.fragment),aM=p(),oe=a("p"),sM=l(`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),Hr=a("code"),iM=l("enable_sequential_cpu_offload"),lM=l(", this method moves one whole model at a time to the GPU when its "),Ar=a("code"),oM=l("forward"),rM=l(`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),Lr=a("code"),pM=l("enable_sequential_cpu_offload"),dM=l(", but performance is much better due to the iterative execution of the "),Or=a("code"),cM=l("unet"),mM=l("."),hM=p(),Mn=a("div"),u(Cs.$$.fragment),gM=p(),$s=a("p"),uM=l(`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, the pipeline\u2019s
models have their state dicts saved to CPU and then are moved to a `),ep=a("code"),fM=l("torch.device('meta') and loaded to GPU only when their specific submodule has its "),yM=l("forward` method called."),Kc=p(),yt=a("h3"),_n=a("a"),tp=a("span"),u(xs.$$.fragment),bM=p(),np=a("span"),MM=l("KandinskyV22PriorPipeline"),Sc=p(),Pl=a("p"),_M=l("[[autodoc]] ## KandinskyV22PriorPipeline"),qc=p(),Re=a("ul"),ap=a("li"),wM=l("all"),JM=p(),sp=a("li"),ip=a("strong"),kM=l("call"),TM=p(),lp=a("li"),vM=l("interpolate"),Dc=p(),bt=a("h3"),wn=a("a"),op=a("span"),u(Rs.$$.fragment),UM=p(),rp=a("span"),jM=l("KandinskyV22PriorEmb2EmbPipeline"),zc=p(),N=a("div"),u(Xs.$$.fragment),IM=p(),pp=a("p"),ZM=l("Pipeline for generating image prior for Kandinsky"),WM=p(),Fs=a("p"),GM=l("This model inherits from "),Cl=a("a"),EM=l("DiffusionPipeline"),BM=l(`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),VM=p(),Xe=a("div"),u(Qs.$$.fragment),PM=p(),dp=a("p"),CM=l("Function invoked when calling the pipeline for generation."),$M=p(),u(Jn.$$.fragment),xM=p(),Fe=a("div"),u(Ns.$$.fragment),RM=p(),cp=a("p"),XM=l("Function invoked when using the prior pipeline for interpolation."),FM=p(),u(kn.$$.fragment),QM=p(),Tn=a("div"),u(Ys.$$.fragment),NM=p(),Ks=a("p"),YM=l(`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, the pipeline\u2019s
models have their state dicts saved to CPU and then are moved to a `),mp=a("code"),KM=l("torch.device('meta') and loaded to GPU only when their specific submodule has its "),SM=l("forward` method called."),Hc=p(),Mt=a("h3"),vn=a("a"),hp=a("span"),u(Ss.$$.fragment),qM=p(),gp=a("span"),DM=l("KandinskyPriorPipeline"),Ac=p(),Y=a("div"),u(qs.$$.fragment),zM=p(),up=a("p"),HM=l("Pipeline for generating image prior for Kandinsky"),AM=p(),Ds=a("p"),LM=l("This model inherits from "),$l=a("a"),OM=l("DiffusionPipeline"),e_=l(`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),t_=p(),Qe=a("div"),u(zs.$$.fragment),n_=p(),fp=a("p"),a_=l("Function invoked when calling the pipeline for generation."),s_=p(),u(Un.$$.fragment),i_=p(),Ne=a("div"),u(Hs.$$.fragment),l_=p(),yp=a("p"),o_=l("Function invoked when using the prior pipeline for interpolation."),r_=p(),u(jn.$$.fragment),p_=p(),In=a("div"),u(As.$$.fragment),d_=p(),Ls=a("p"),c_=l(`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, the pipeline\u2019s
models have their state dicts saved to CPU and then are moved to a `),bp=a("code"),m_=l("torch.device('meta') and loaded to GPU only when their specific submodule has its "),h_=l("forward` method called."),Lc=p(),_t=a("h3"),Zn=a("a"),Mp=a("span"),u(Os.$$.fragment),g_=p(),_p=a("span"),u_=l("KandinskyPipeline"),Oc=p(),K=a("div"),u(ei.$$.fragment),f_=p(),wp=a("p"),y_=l("Pipeline for text-to-image generation using Kandinsky"),b_=p(),ti=a("p"),M_=l("This model inherits from "),xl=a("a"),__=l("DiffusionPipeline"),w_=l(`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),J_=p(),Ye=a("div"),u(ni.$$.fragment),k_=p(),Jp=a("p"),T_=l("Function invoked when calling the pipeline for generation."),v_=p(),u(Wn.$$.fragment),U_=p(),Gn=a("div"),u(ai.$$.fragment),j_=p(),re=a("p"),I_=l(`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),kp=a("code"),Z_=l("enable_sequential_cpu_offload"),W_=l(", this method moves one whole model at a time to the GPU when its "),Tp=a("code"),G_=l("forward"),E_=l(`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),vp=a("code"),B_=l("enable_sequential_cpu_offload"),V_=l(", but performance is much better due to the iterative execution of the "),Up=a("code"),P_=l("unet"),C_=l("."),$_=p(),En=a("div"),u(si.$$.fragment),x_=p(),ii=a("p"),R_=l(`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, the pipeline\u2019s
models have their state dicts saved to CPU and then are moved to a `),jp=a("code"),X_=l("torch.device('meta') and loaded to GPU only when their specific submodule has its "),F_=l("forward` method called."),em=p(),wt=a("h3"),Bn=a("a"),Ip=a("span"),u(li.$$.fragment),Q_=p(),Zp=a("span"),N_=l("KandinskyImg2ImgPipeline"),tm=p(),S=a("div"),u(oi.$$.fragment),Y_=p(),Wp=a("p"),K_=l("Pipeline for image-to-image generation using Kandinsky"),S_=p(),ri=a("p"),q_=l("This model inherits from "),Rl=a("a"),D_=l("DiffusionPipeline"),z_=l(`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),H_=p(),Ke=a("div"),u(pi.$$.fragment),A_=p(),Gp=a("p"),L_=l("Function invoked when calling the pipeline for generation."),O_=p(),u(Vn.$$.fragment),e2=p(),Pn=a("div"),u(di.$$.fragment),t2=p(),pe=a("p"),n2=l(`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),Ep=a("code"),a2=l("enable_sequential_cpu_offload"),s2=l(", this method moves one whole model at a time to the GPU when its "),Bp=a("code"),i2=l("forward"),l2=l(`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),Vp=a("code"),o2=l("enable_sequential_cpu_offload"),r2=l(", but performance is much better due to the iterative execution of the "),Pp=a("code"),p2=l("unet"),d2=l("."),c2=p(),Cn=a("div"),u(ci.$$.fragment),m2=p(),mi=a("p"),h2=l(`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, the pipeline\u2019s
models have their state dicts saved to CPU and then are moved to a `),Cp=a("code"),g2=l("torch.device('meta') and loaded to GPU only when their specific submodule has its "),u2=l("forward` method called."),nm=p(),Jt=a("h3"),$n=a("a"),$p=a("span"),u(hi.$$.fragment),f2=p(),xp=a("span"),y2=l("KandinskyInpaintPipeline"),am=p(),q=a("div"),u(gi.$$.fragment),b2=p(),Rp=a("p"),M2=l("Pipeline for text-guided image inpainting using Kandinsky2.1"),_2=p(),ui=a("p"),w2=l("This model inherits from "),Xl=a("a"),J2=l("DiffusionPipeline"),k2=l(`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),T2=p(),Se=a("div"),u(fi.$$.fragment),v2=p(),Xp=a("p"),U2=l("Function invoked when calling the pipeline for generation."),j2=p(),u(xn.$$.fragment),I2=p(),Rn=a("div"),u(yi.$$.fragment),Z2=p(),de=a("p"),W2=l(`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),Fp=a("code"),G2=l("enable_sequential_cpu_offload"),E2=l(", this method moves one whole model at a time to the GPU when its "),Qp=a("code"),B2=l("forward"),V2=l(`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),Np=a("code"),P2=l("enable_sequential_cpu_offload"),C2=l(", but performance is much better due to the iterative execution of the "),Yp=a("code"),$2=l("unet"),x2=l("."),R2=p(),Xn=a("div"),u(bi.$$.fragment),X2=p(),Mi=a("p"),F2=l(`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, the pipeline\u2019s
models have their state dicts saved to CPU and then are moved to a `),Kp=a("code"),Q2=l("torch.device('meta') and loaded to GPU only when their specific submodule has its "),N2=l("forward` method called."),this.h()},l(e){const r=$v('[data-svelte="svelte-1phssyn"]',document.head);g=s(r,"META",{name:!0,content:!0}),r.forEach(n),v=d(e),k=s(e,"H1",{class:!0});var _i=i(k);w=s(_i,"A",{id:!0,class:!0,href:!0});var Sp=i(w);T=s(Sp,"SPAN",{});var qp=i(T);f(h.$$.fragment,qp),qp.forEach(n),Sp.forEach(n),J=d(_i),H=s(_i,"SPAN",{});var Dp=i(H);$=o(Dp,"Kandinsky"),Dp.forEach(n),_i.forEach(n),te=d(e),Z=s(e,"H2",{class:!0});var wi=i(Z);E=s(wi,"A",{id:!0,class:!0,href:!0});var zp=i(E);me=s(zp,"SPAN",{});var Hp=i(me);f(A.$$.fragment,Hp),Hp.forEach(n),zp.forEach(n),Tt=d(wi),D=s(wi,"SPAN",{});var Ap=i(D);Nn=o(Ap,"Overview"),Ap.forEach(n),wi.forEach(n),We=d(e),L=s(e,"P",{});var kt=i(L);Yn=o(kt,"Kandinsky inherits best practices from "),ne=s(kt,"A",{href:!0,rel:!0});var Lp=i(ne);Kn=o(Lp,"DALL-E 2"),Lp.forEach(n),Sn=o(kt," and "),he=s(kt,"A",{href:!0,rel:!0});var Op=i(he);je=o(Op,"Latent Diffusion"),Op.forEach(n),vt=o(kt,", while introducing some new ideas."),kt.forEach(n),W=d(e),G=s(e,"P",{});var Ji=i(G);Ti=o(Ji,"It uses "),Ge=s(Ji,"A",{href:!0,rel:!0});var ed=i(Ge);vi=o(ed,"CLIP"),ed.forEach(n),Ui=o(Ji," for encoding images and text, and a diffusion image prior (mapping) between latent spaces of CLIP modalities. This approach enhances the visual performance of the model and unveils new horizons in blending images and text-guided image manipulation."),Ji.forEach(n),Ie=d(e),V=s(e,"P",{});var C=i(V);ji=o(C,"The Kandinsky model is created by "),qn=s(C,"A",{href:!0,rel:!0});var sw=i(qn);Vh=o(sw,"Arseniy Shakhmatov"),sw.forEach(n),Ph=o(C,", "),Dn=s(C,"A",{href:!0,rel:!0});var iw=i(Dn);Ch=o(iw,"Anton Razzhigaev"),iw.forEach(n),$h=o(C,", "),zn=s(C,"A",{href:!0,rel:!0});var lw=i(zn);xh=o(lw,"Aleksandr Nikolich"),lw.forEach(n),Rh=o(C,", "),Hn=s(C,"A",{href:!0,rel:!0});var ow=i(Hn);Xh=o(ow,"Igor Pavlov"),ow.forEach(n),Fh=o(C,", "),An=s(C,"A",{href:!0,rel:!0});var rw=i(An);Qh=o(rw,"Andrey Kuznetsov"),rw.forEach(n),Nh=o(C," and "),Ln=s(C,"A",{href:!0,rel:!0});var pw=i(Ln);Yh=o(pw,"Denis Dimitrov"),pw.forEach(n),Kh=o(C,". The original codebase can be found "),On=s(C,"A",{href:!0,rel:!0});var dw=i(On);Sh=o(dw,"here"),dw.forEach(n),C.forEach(n),td=d(e),nt=s(e,"H2",{class:!0});var im=i(nt);Ut=s(im,"A",{id:!0,class:!0,href:!0});var cw=i(Ut);no=s(cw,"SPAN",{});var mw=i(no);f(ea.$$.fragment,mw),mw.forEach(n),cw.forEach(n),qh=d(im),ao=s(im,"SPAN",{});var hw=i(ao);Dh=o(hw,"Usage example"),hw.forEach(n),im.forEach(n),nd=d(e),Ii=s(e,"P",{});var gw=i(Ii);zh=o(gw,"In the following, we will walk you through some examples of how to use the Kandinsky pipelines to create some visually aesthetic artwork."),gw.forEach(n),ad=d(e),at=s(e,"H3",{class:!0});var lm=i(at);jt=s(lm,"A",{id:!0,class:!0,href:!0});var uw=i(jt);so=s(uw,"SPAN",{});var fw=i(so);f(ta.$$.fragment,fw),fw.forEach(n),uw.forEach(n),Hh=d(lm),io=s(lm,"SPAN",{});var yw=i(io);Ah=o(yw,"Text-to-Image Generation"),yw.forEach(n),lm.forEach(n),sd=d(e),ge=s(e,"P",{});var Fn=i(ge);Lh=o(Fn,"For text-to-image generation, we need to use both "),Zi=s(Fn,"A",{href:!0});var bw=i(Zi);Oh=o(bw,"KandinskyPriorPipeline"),bw.forEach(n),eg=o(Fn," and "),Wi=s(Fn,"A",{href:!0});var Mw=i(Wi);tg=o(Mw,"KandinskyPipeline"),Mw.forEach(n),ng=o(Fn,`.
The first step is to encode text prompts with CLIP and then diffuse the CLIP text embeddings to CLIP image embeddings,
as first proposed in `),na=s(Fn,"A",{href:!0,rel:!0});var _w=i(na);ag=o(_w,"DALL-E 2"),_w.forEach(n),sg=o(Fn,`.
Let\u2019s throw a fun prompt at Kandinsky to see what it comes up with.`),Fn.forEach(n),id=d(e),f(aa.$$.fragment,e),ld=d(e),Gi=s(e,"P",{});var ww=i(Gi);ig=o(ww,`First, let\u2019s instantiate the prior pipeline and the text-to-image pipeline. Both
pipelines are diffusion models.`),ww.forEach(n),od=d(e),f(sa.$$.fragment,e),rd=d(e),f(It.$$.fragment,e),pd=d(e),Ei=s(e,"P",{});var Jw=i(Ei);lg=o(Jw,`Now we pass the prompt through the prior to generate image embeddings. The prior
returns both the image embeddings corresponding to the prompt and negative/unconditional image
embeddings corresponding to an empty string.`),Jw.forEach(n),dd=d(e),f(ia.$$.fragment,e),cd=d(e),f(Zt.$$.fragment,e),md=d(e),Wt=s(e,"P",{});var om=i(Wt);og=o(om,`Next, we can pass the embeddings as well as the prompt to the text-to-image pipeline. Remember that
in case you are using a customized negative prompt, that you should pass this one also to the text-to-image pipelines
with `),lo=s(om,"CODE",{});var kw=i(lo);rg=o(kw,"negative_prompt=negative_prompt"),kw.forEach(n),pg=o(om,":"),om.forEach(n),hd=d(e),f(la.$$.fragment,e),gd=d(e),Bi=s(e,"P",{});var Tw=i(Bi);dg=o(Tw,"One cheeseburger monster coming up! Enjoy!"),Tw.forEach(n),ud=d(e),Vi=s(e,"P",{});var vw=i(Vi);Pi=s(vw,"IMG",{src:!0,alt:!0}),vw.forEach(n),fd=d(e),Ci=s(e,"P",{});var Uw=i(Ci);cg=o(Uw,"The Kandinsky model works extremely well with creative prompts. Here is some of the amazing art that can be created using the exact same process but with different prompts."),Uw.forEach(n),yd=d(e),f(oa.$$.fragment,e),bd=d(e),$i=s(e,"P",{});var jw=i($i);xi=s(jw,"IMG",{src:!0,alt:!0}),jw.forEach(n),Md=d(e),f(ra.$$.fragment,e),_d=d(e),Ri=s(e,"P",{});var Iw=i(Ri);Xi=s(Iw,"IMG",{src:!0,alt:!0}),Iw.forEach(n),wd=d(e),f(pa.$$.fragment,e),Jd=d(e),Fi=s(e,"P",{});var Zw=i(Fi);Qi=s(Zw,"IMG",{src:!0,alt:!0}),Zw.forEach(n),kd=d(e),f(da.$$.fragment,e),Td=d(e),Ni=s(e,"P",{});var Ww=i(Ni);Yi=s(Ww,"IMG",{src:!0,alt:!0}),Ww.forEach(n),vd=d(e),st=s(e,"H3",{class:!0});var rm=i(st);Gt=s(rm,"A",{id:!0,class:!0,href:!0});var Gw=i(Gt);oo=s(Gw,"SPAN",{});var Ew=i(oo);f(ca.$$.fragment,Ew),Ew.forEach(n),Gw.forEach(n),mg=d(rm),ro=s(rm,"SPAN",{});var Bw=i(ro);hg=o(Bw,"Text Guided Image-to-Image Generation"),Bw.forEach(n),rm.forEach(n),Ud=d(e),Et=s(e,"P",{});var pm=i(Et);gg=o(pm,"The same Kandinsky model weights can be used for text-guided image-to-image translation. In this case, just make sure to load the weights using the "),Ki=s(pm,"A",{href:!0});var Vw=i(Ki);ug=o(Vw,"KandinskyImg2ImgPipeline"),Vw.forEach(n),fg=o(pm," pipeline."),pm.forEach(n),jd=d(e),Ze=s(e,"P",{});var ki=i(Ze);po=s(ki,"STRONG",{});var Pw=i(po);yg=o(Pw,"Note"),Pw.forEach(n),bg=o(ki,`: You can also directly move the weights of the text-to-image pipelines to the image-to-image pipelines
without loading them twice by making use of the `),Si=s(ki,"A",{href:!0});var Cw=i(Si);Mg=o(Cw,"components"),Cw.forEach(n),_g=o(ki," function as explained "),qi=s(ki,"A",{href:!0});var $w=i(qi);wg=o($w,"here"),$w.forEach(n),Jg=o(ki,"."),ki.forEach(n),Id=d(e),Di=s(e,"P",{});var xw=i(Di);kg=o(xw,"Let\u2019s download an image."),xw.forEach(n),Zd=d(e),f(ma.$$.fragment,e),Wd=d(e),zi=s(e,"P",{});var Rw=i(zi);Hi=s(Rw,"IMG",{src:!0,alt:!0}),Rw.forEach(n),Gd=d(e),f(ha.$$.fragment,e),Ed=d(e),Ai=s(e,"P",{});var Xw=i(Ai);Li=s(Xw,"IMG",{src:!0,alt:!0}),Xw.forEach(n),Bd=d(e),it=s(e,"H3",{class:!0});var dm=i(it);Bt=s(dm,"A",{id:!0,class:!0,href:!0});var Fw=i(Bt);co=s(Fw,"SPAN",{});var Qw=i(co);f(ga.$$.fragment,Qw),Qw.forEach(n),Fw.forEach(n),Tg=d(dm),mo=s(dm,"SPAN",{});var Nw=i(mo);vg=o(Nw,"Text Guided Inpainting Generation"),Nw.forEach(n),dm.forEach(n),Vd=d(e),Vt=s(e,"P",{});var cm=i(Vt);Ug=o(cm,"You can use "),Oi=s(cm,"A",{href:!0});var Yw=i(Oi);jg=o(Yw,"KandinskyInpaintPipeline"),Yw.forEach(n),Ig=o(cm," to edit images. In this example, we will add a hat to the portrait of a cat."),cm.forEach(n),Pd=d(e),f(ua.$$.fragment,e),Cd=d(e),el=s(e,"P",{});var Kw=i(el);tl=s(Kw,"IMG",{src:!0,alt:!0}),Kw.forEach(n),$d=d(e),lt=s(e,"H3",{class:!0});var mm=i(lt);Pt=s(mm,"A",{id:!0,class:!0,href:!0});var Sw=i(Pt);ho=s(Sw,"SPAN",{});var qw=i(ho);f(fa.$$.fragment,qw),qw.forEach(n),Sw.forEach(n),Zg=d(mm),go=s(mm,"SPAN",{});var Dw=i(go);Wg=o(Dw,"Interpolate"),Dw.forEach(n),mm.forEach(n),xd=d(e),Ct=s(e,"P",{});var hm=i(Ct);Gg=o(hm,"The "),nl=s(hm,"A",{href:!0});var zw=i(nl);Eg=o(zw,"KandinskyPriorPipeline"),zw.forEach(n),Bg=o(hm," also comes with a cool utility function that will allow you to interpolate the latent space of different images and texts super easily. Here is an example of how you can create an Impressionist-style portrait for your pet based on \u201CThe Starry Night\u201D."),hm.forEach(n),Rd=d(e),Ee=s(e,"P",{});var Fl=i(Ee);Vg=o(Fl,"Note that you can interpolate between texts and images - in the below example, we passed a text prompt \u201Ca cat\u201D and two images to the "),uo=s(Fl,"CODE",{});var Hw=i(uo);Pg=o(Hw,"interplate"),Hw.forEach(n),Cg=o(Fl," function, along with a "),fo=s(Fl,"CODE",{});var Aw=i(fo);$g=o(Aw,"weights"),Aw.forEach(n),xg=o(Fl," variable containing the corresponding weights for each condition we interplate."),Fl.forEach(n),Xd=d(e),f(ya.$$.fragment,e),Fd=d(e),al=s(e,"P",{});var Lw=i(al);sl=s(Lw,"IMG",{src:!0,alt:!0}),Lw.forEach(n),Qd=d(e),ot=s(e,"H3",{class:!0});var gm=i(ot);$t=s(gm,"A",{id:!0,class:!0,href:!0});var Ow=i($t);yo=s(Ow,"SPAN",{});var eJ=i(yo);f(ba.$$.fragment,eJ),eJ.forEach(n),Ow.forEach(n),Rg=d(gm),bo=s(gm,"SPAN",{});var tJ=i(bo);Xg=o(tJ,"Text-to-Image Generation with ControlNet Conditioning"),tJ.forEach(n),gm.forEach(n),Nd=d(e),xt=s(e,"P",{});var um=i(xt);Fg=o(um,"In the following, we give a simple example of how to use "),il=s(um,"A",{href:!0});var nJ=i(il);Qg=o(nJ,"KandinskyV22ControlnetPipeline"),nJ.forEach(n),Ng=o(um," to add control to the text-to-image generation with a depth image."),um.forEach(n),Yd=d(e),ll=s(e,"P",{});var aJ=i(ll);Yg=o(aJ,"First, let\u2019s take an image and extract its depth map."),aJ.forEach(n),Kd=d(e),f(Ma.$$.fragment,e),Sd=d(e),ol=s(e,"P",{});var sJ=i(ol);rl=s(sJ,"IMG",{src:!0,alt:!0}),sJ.forEach(n),qd=d(e),Rt=s(e,"P",{});var fm=i(Rt);Kg=o(fm,"We can use the "),Mo=s(fm,"CODE",{});var iJ=i(Mo);Sg=o(iJ,"depth-estimation"),iJ.forEach(n),qg=o(fm," pipeline from transformers to process the image and retrieve its depth map."),fm.forEach(n),Dd=d(e),f(_a.$$.fragment,e),zd=d(e),pl=s(e,"P",{});var lJ=i(pl);Dg=o(lJ,"Now, we load the prior pipeline and the text-to-image controlnet pipeline"),lJ.forEach(n),Hd=d(e),f(wa.$$.fragment,e),Ad=d(e),dl=s(e,"P",{});var oJ=i(dl);zg=o(oJ,"We pass the prompt and negative prompt through the prior to generate image embeddings"),oJ.forEach(n),Ld=d(e),f(Ja.$$.fragment,e),Od=d(e),Xt=s(e,"P",{});var ym=i(Xt);Hg=o(ym,"Now we can pass the image embeddings and the depth image we extracted to the controlnet pipeline. With Kandinsky 2.2, only prior pipelines accept "),_o=s(ym,"CODE",{});var rJ=i(_o);Ag=o(rJ,"prompt"),rJ.forEach(n),Lg=o(ym," input. You do not need to pass the prompt to the controlnet pipeline."),ym.forEach(n),ec=d(e),f(ka.$$.fragment,e),tc=d(e),Ta=s(e,"P",{});var Y2=i(Ta);Og=o(Y2,`The output image looks as follow:
`),cl=s(Y2,"IMG",{src:!0,alt:!0}),Y2.forEach(n),nc=d(e),rt=s(e,"H3",{class:!0});var bm=i(rt);Ft=s(bm,"A",{id:!0,class:!0,href:!0});var pJ=i(Ft);wo=s(pJ,"SPAN",{});var dJ=i(wo);f(va.$$.fragment,dJ),dJ.forEach(n),pJ.forEach(n),eu=d(bm),Jo=s(bm,"SPAN",{});var cJ=i(Jo);tu=o(cJ,"Image-to-Image Generation with ControlNet Conditioning"),cJ.forEach(n),bm.forEach(n),ac=d(e),Be=s(e,"P",{});var Ql=i(Be);nu=o(Ql,"Kandinsky 2.2 also includes a "),ml=s(Ql,"A",{href:!0});var mJ=i(ml);au=o(mJ,"KandinskyV22ControlnetImg2ImgPipeline"),mJ.forEach(n),su=o(Ql," that will allow you to add control to the image generation process with both the image and its depth map. This pipeline works really well with "),hl=s(Ql,"A",{href:!0});var hJ=i(hl);iu=o(hJ,"KandinskyV22PriorEmb2EmbPipeline"),hJ.forEach(n),lu=o(Ql,", which generates image embeddings based on both a text prompt and an image."),Ql.forEach(n),sc=d(e),gl=s(e,"P",{});var gJ=i(gl);ou=o(gJ,"For our robot cat example, we will pass the prompt and cat image together to the prior pipeline to generate an image embedding. We will then use that image embedding and the depth map of the cat to further control the image generation process."),gJ.forEach(n),ic=d(e),ul=s(e,"P",{});var uJ=i(ul);ru=o(uJ,"We can use the same cat image and its depth map from the last example."),uJ.forEach(n),lc=d(e),f(Ua.$$.fragment,e),oc=d(e),fl=s(e,"P",{});var fJ=i(fl);pu=o(fJ,"Here is the output. Compared with the output from our text-to-image controlnet example, it kept a lot more cat facial details from the original image and worked into the robot style we asked for."),fJ.forEach(n),rc=d(e),yl=s(e,"P",{});var yJ=i(yl);bl=s(yJ,"IMG",{src:!0,alt:!0}),yJ.forEach(n),pc=d(e),pt=s(e,"H2",{class:!0});var Mm=i(pt);Qt=s(Mm,"A",{id:!0,class:!0,href:!0});var bJ=i(Qt);ko=s(bJ,"SPAN",{});var MJ=i(ko);f(ja.$$.fragment,MJ),MJ.forEach(n),bJ.forEach(n),du=d(Mm),To=s(Mm,"SPAN",{});var _J=i(To);cu=o(_J,"Kandinsky 2.2"),_J.forEach(n),Mm.forEach(n),dc=d(e),ue=s(e,"P",{});var Qn=i(ue);mu=o(Qn,"The Kandinsky 2.2 release includes robust new text-to-image models that support text-to-image generation, image-to-image generation, image interpolation, and text-guided image inpainting. The general workflow to perform these tasks using Kandinsky 2.2 is the same as in Kandinsky 2.1. First, you will need to use a prior pipeline to generate image embeddings based on your text prompt, and then use one of the image decoding pipelines to generate the output image. The only difference is that in Kandinsky 2.2, all of the decoding pipelines no longer accept the "),vo=s(Qn,"CODE",{});var wJ=i(vo);hu=o(wJ,"prompt"),wJ.forEach(n),gu=o(Qn," input, and the image generation process is conditioned with only "),Uo=s(Qn,"CODE",{});var JJ=i(Uo);uu=o(JJ,"image_embeds"),JJ.forEach(n),fu=o(Qn," and "),jo=s(Qn,"CODE",{});var kJ=i(jo);yu=o(kJ,"negative_image_embeds"),kJ.forEach(n),bu=o(Qn,"."),Qn.forEach(n),cc=d(e),Ml=s(e,"P",{});var TJ=i(Ml);Mu=o(TJ,"Let\u2019s look at an example of how to perform text-to-image generation using Kandinsky 2.2."),TJ.forEach(n),mc=d(e),_l=s(e,"P",{});var vJ=i(_l);_u=o(vJ,"First, let\u2019s create the prior pipeline and text-to-image pipeline with Kandinsky 2.2 checkpoints."),vJ.forEach(n),hc=d(e),f(Ia.$$.fragment,e),gc=d(e),Nt=s(e,"P",{});var _m=i(Nt);wu=o(_m,"You can then use "),Io=s(_m,"CODE",{});var UJ=i(Io);Ju=o(UJ,"pipe_prior"),UJ.forEach(n),ku=o(_m," to generate image embeddings."),_m.forEach(n),uc=d(e),f(Za.$$.fragment,e),fc=d(e),Yt=s(e,"P",{});var wm=i(Yt);Tu=o(wm,"Now you can pass these embeddings to the text-to-image pipeline. When using Kandinsky 2.2 you don\u2019t need to pass the "),Zo=s(wm,"CODE",{});var jJ=i(Zo);vu=o(jJ,"prompt"),jJ.forEach(n),Uu=o(wm," (but you do with the previous version, Kandinsky 2.1)."),wm.forEach(n),yc=d(e),f(Wa.$$.fragment,e),bc=d(e),wl=s(e,"P",{});var IJ=i(wl);Jl=s(IJ,"IMG",{src:!0,alt:!0}),IJ.forEach(n),Mc=d(e),kl=s(e,"P",{});var ZJ=i(kl);ju=o(ZJ,"We used the text-to-image pipeline as an example, but the same process applies to all decoding pipelines in Kandinsky 2.2. For more information, please refer to our API section for each pipeline."),ZJ.forEach(n),_c=d(e),dt=s(e,"H2",{class:!0});var Jm=i(dt);Kt=s(Jm,"A",{id:!0,class:!0,href:!0});var WJ=i(Kt);Wo=s(WJ,"SPAN",{});var GJ=i(Wo);f(Ga.$$.fragment,GJ),GJ.forEach(n),WJ.forEach(n),Iu=d(Jm),Go=s(Jm,"SPAN",{});var EJ=i(Go);Zu=o(EJ,"Optimization"),EJ.forEach(n),Jm.forEach(n),wc=d(e),O=s(e,"P",{});var qe=i(O);Wu=o(qe,"Running Kandinsky in inference requires running both a first prior pipeline: "),Tl=s(qe,"A",{href:!0});var BJ=i(Tl);Gu=o(BJ,"KandinskyPriorPipeline"),BJ.forEach(n),Eu=o(qe,`
and a second image decoding pipeline which is one of `),vl=s(qe,"A",{href:!0});var VJ=i(vl);Bu=o(VJ,"KandinskyPipeline"),VJ.forEach(n),Vu=o(qe,", "),Ul=s(qe,"A",{href:!0});var PJ=i(Ul);Pu=o(PJ,"KandinskyImg2ImgPipeline"),PJ.forEach(n),Cu=o(qe,", or "),jl=s(qe,"A",{href:!0});var CJ=i(jl);$u=o(CJ,"KandinskyInpaintPipeline"),CJ.forEach(n),xu=o(qe,"."),qe.forEach(n),Jc=d(e),Il=s(e,"P",{});var $J=i(Il);Ru=o($J,`The bulk of the computation time will always be the second image decoding pipeline, so when looking
into optimizing the model, one should look into the second image decoding pipeline.`),$J.forEach(n),kc=d(e),St=s(e,"P",{});var km=i(St);Xu=o(km,"When running with PyTorch < 2.0, we strongly recommend making use of "),Ea=s(km,"A",{href:!0,rel:!0});var xJ=i(Ea);Eo=s(xJ,"CODE",{});var RJ=i(Eo);Fu=o(RJ,"xformers"),RJ.forEach(n),xJ.forEach(n),Qu=o(km,`
to speed-up the optimization. This can be done by simply running:`),km.forEach(n),Tc=d(e),f(Ba.$$.fragment,e),vc=d(e),qt=s(e,"P",{});var Tm=i(qt);Nu=o(Tm,`When running on PyTorch >= 2.0, PyTorch\u2019s SDPA attention will automatically be used. For more information on
PyTorch\u2019s SDPA, feel free to have a look at `),Va=s(Tm,"A",{href:!0,rel:!0});var XJ=i(Va);Yu=o(XJ,"this blog post"),XJ.forEach(n),Ku=o(Tm,"."),Tm.forEach(n),Uc=d(e),Zl=s(e,"P",{});var FJ=i(Zl);Su=o(FJ,"To have explicit control , you can also manually set the pipeline to use PyTorch\u2019s 2.0 efficient attention:"),FJ.forEach(n),jc=d(e),f(Pa.$$.fragment,e),Ic=d(e),Ve=s(e,"P",{});var Nl=i(Ve);qu=o(Nl,"The slowest and most memory intense attention processor is the default "),Bo=s(Nl,"CODE",{});var QJ=i(Bo);Du=o(QJ,"AttnAddedKVProcessor"),QJ.forEach(n),zu=o(Nl,` processor.
We do `),Vo=s(Nl,"STRONG",{});var NJ=i(Vo);Hu=o(NJ,"not"),NJ.forEach(n),Au=o(Nl,` recommend using it except for testing purposes or cases where very high determistic behaviour is desired.
You can set it with:`),Nl.forEach(n),Zc=d(e),f(Ca.$$.fragment,e),Wc=d(e),Pe=s(e,"P",{});var Yl=i(Pe);Lu=o(Yl,"With PyTorch >= 2.0, you can also use Kandinsky with "),Po=s(Yl,"CODE",{});var YJ=i(Po);Ou=o(YJ,"torch.compile"),YJ.forEach(n),ef=o(Yl,` which depending
on your hardware can signficantly speed-up your inference time once the model is compiled.
To use Kandinsksy with `),Co=s(Yl,"CODE",{});var KJ=i(Co);tf=o(KJ,"torch.compile"),KJ.forEach(n),nf=o(Yl,", you can do:"),Yl.forEach(n),Gc=d(e),f($a.$$.fragment,e),Ec=d(e),Dt=s(e,"P",{});var vm=i(Dt);af=o(vm,`After compilation you should see a very fast inference time. For more information,
feel free to have a look at `),xa=s(vm,"A",{href:!0,rel:!0});var SJ=i(xa);sf=o(SJ,"Our PyTorch 2.0 benchmark"),SJ.forEach(n),lf=o(vm,"."),vm.forEach(n),Bc=d(e),ct=s(e,"H2",{class:!0});var Um=i(ct);zt=s(Um,"A",{id:!0,class:!0,href:!0});var qJ=i(zt);$o=s(qJ,"SPAN",{});var DJ=i($o);f(Ra.$$.fragment,DJ),DJ.forEach(n),qJ.forEach(n),of=d(Um),xo=s(Um,"SPAN",{});var zJ=i(xo);rf=o(zJ,"Available Pipelines:"),zJ.forEach(n),Um.forEach(n),Vc=d(e),Ht=s(e,"TABLE",{});var jm=i(Ht);Ro=s(jm,"THEAD",{});var HJ=i(Ro);Xa=s(HJ,"TR",{});var Im=i(Xa);Xo=s(Im,"TH",{});var AJ=i(Xo);pf=o(AJ,"Pipeline"),AJ.forEach(n),df=d(Im),Fo=s(Im,"TH",{});var LJ=i(Fo);cf=o(LJ,"Tasks"),LJ.forEach(n),Im.forEach(n),HJ.forEach(n),mf=d(jm),P=s(jm,"TBODY",{});var z=i(P);Fa=s(z,"TR",{});var Zm=i(Fa);Qo=s(Zm,"TD",{});var OJ=i(Qo);Qa=s(OJ,"A",{href:!0,rel:!0});var ek=i(Qa);hf=o(ek,"pipeline_kandinsky2_2.py"),ek.forEach(n),OJ.forEach(n),gf=d(Zm),No=s(Zm,"TD",{});var tk=i(No);Yo=s(tk,"EM",{});var nk=i(Yo);uf=o(nk,"Text-to-Image Generation"),nk.forEach(n),tk.forEach(n),Zm.forEach(n),ff=d(z),Na=s(z,"TR",{});var Wm=i(Na);Ko=s(Wm,"TD",{});var ak=i(Ko);Ya=s(ak,"A",{href:!0,rel:!0});var sk=i(Ya);yf=o(sk,"pipeline_kandinsky.py"),sk.forEach(n),ak.forEach(n),bf=d(Wm),So=s(Wm,"TD",{});var ik=i(So);qo=s(ik,"EM",{});var lk=i(qo);Mf=o(lk,"Text-to-Image Generation"),lk.forEach(n),ik.forEach(n),Wm.forEach(n),_f=d(z),Ka=s(z,"TR",{});var Gm=i(Ka);Do=s(Gm,"TD",{});var ok=i(Do);Sa=s(ok,"A",{href:!0,rel:!0});var rk=i(Sa);wf=o(rk,"pipeline_kandinsky2_2_inpaint.py"),rk.forEach(n),ok.forEach(n),Jf=d(Gm),zo=s(Gm,"TD",{});var pk=i(zo);Ho=s(pk,"EM",{});var dk=i(Ho);kf=o(dk,"Image-Guided Image Generation"),dk.forEach(n),pk.forEach(n),Gm.forEach(n),Tf=d(z),qa=s(z,"TR",{});var Em=i(qa);Ao=s(Em,"TD",{});var ck=i(Ao);Da=s(ck,"A",{href:!0,rel:!0});var mk=i(Da);vf=o(mk,"pipeline_kandinsky_inpaint.py"),mk.forEach(n),ck.forEach(n),Uf=d(Em),Lo=s(Em,"TD",{});var hk=i(Lo);Oo=s(hk,"EM",{});var gk=i(Oo);jf=o(gk,"Image-Guided Image Generation"),gk.forEach(n),hk.forEach(n),Em.forEach(n),If=d(z),za=s(z,"TR",{});var Bm=i(za);er=s(Bm,"TD",{});var uk=i(er);Ha=s(uk,"A",{href:!0,rel:!0});var fk=i(Ha);Zf=o(fk,"pipeline_kandinsky2_2_img2img.py"),fk.forEach(n),uk.forEach(n),Wf=d(Bm),tr=s(Bm,"TD",{});var yk=i(tr);nr=s(yk,"EM",{});var bk=i(nr);Gf=o(bk,"Image-Guided Image Generation"),bk.forEach(n),yk.forEach(n),Bm.forEach(n),Ef=d(z),Aa=s(z,"TR",{});var Vm=i(Aa);ar=s(Vm,"TD",{});var Mk=i(ar);La=s(Mk,"A",{href:!0,rel:!0});var _k=i(La);Bf=o(_k,"pipeline_kandinsky_img2img.py"),_k.forEach(n),Mk.forEach(n),Vf=d(Vm),sr=s(Vm,"TD",{});var wk=i(sr);ir=s(wk,"EM",{});var Jk=i(ir);Pf=o(Jk,"Image-Guided Image Generation"),Jk.forEach(n),wk.forEach(n),Vm.forEach(n),Cf=d(z),Oa=s(z,"TR",{});var Pm=i(Oa);lr=s(Pm,"TD",{});var kk=i(lr);es=s(kk,"A",{href:!0,rel:!0});var Tk=i(es);$f=o(Tk,"pipeline_kandinsky2_2_controlnet.py"),Tk.forEach(n),kk.forEach(n),xf=d(Pm),or=s(Pm,"TD",{});var vk=i(or);rr=s(vk,"EM",{});var Uk=i(rr);Rf=o(Uk,"Image-Guided Image Generation"),Uk.forEach(n),vk.forEach(n),Pm.forEach(n),Xf=d(z),ts=s(z,"TR",{});var Cm=i(ts);pr=s(Cm,"TD",{});var jk=i(pr);ns=s(jk,"A",{href:!0,rel:!0});var Ik=i(ns);Ff=o(Ik,"pipeline_kandinsky2_2_controlnet_img2img.py"),Ik.forEach(n),jk.forEach(n),Qf=d(Cm),dr=s(Cm,"TD",{});var Zk=i(dr);cr=s(Zk,"EM",{});var Wk=i(cr);Nf=o(Wk,"Image-Guided Image Generation"),Wk.forEach(n),Zk.forEach(n),Cm.forEach(n),z.forEach(n),jm.forEach(n),Pc=d(e),mt=s(e,"H3",{class:!0});var $m=i(mt);At=s($m,"A",{id:!0,class:!0,href:!0});var Gk=i(At);mr=s(Gk,"SPAN",{});var Ek=i(mr);f(as.$$.fragment,Ek),Ek.forEach(n),Gk.forEach(n),Yf=d($m),hr=s($m,"SPAN",{});var Bk=i(hr);Kf=o(Bk,"KandinskyV22Pipeline"),Bk.forEach(n),$m.forEach(n),Cc=d(e),x=s(e,"DIV",{class:!0});var fe=i(x);f(ss.$$.fragment,fe),Sf=d(fe),gr=s(fe,"P",{});var Vk=i(gr);qf=o(Vk,"Pipeline for text-to-image generation using Kandinsky"),Vk.forEach(n),Df=d(fe),is=s(fe,"P",{});var xm=i(is);zf=o(xm,"This model inherits from "),Wl=s(xm,"A",{href:!0});var Pk=i(Wl);Hf=o(Pk,"DiffusionPipeline"),Pk.forEach(n),Af=o(xm,`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),xm.forEach(n),Lf=d(fe),Lt=s(fe,"DIV",{class:!0});var Rm=i(Lt);f(ls.$$.fragment,Rm),Of=d(Rm),f(Ot.$$.fragment,Rm),Rm.forEach(n),ey=d(fe),en=s(fe,"DIV",{class:!0});var Xm=i(en);f(os.$$.fragment,Xm),ty=d(Xm),ae=s(Xm,"P",{});var De=i(ae);ny=o(De,`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),ur=s(De,"CODE",{});var Ck=i(ur);ay=o(Ck,"enable_sequential_cpu_offload"),Ck.forEach(n),sy=o(De,", this method moves one whole model at a time to the GPU when its "),fr=s(De,"CODE",{});var $k=i(fr);iy=o($k,"forward"),$k.forEach(n),ly=o(De,`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),yr=s(De,"CODE",{});var xk=i(yr);oy=o(xk,"enable_sequential_cpu_offload"),xk.forEach(n),ry=o(De,", but performance is much better due to the iterative execution of the "),br=s(De,"CODE",{});var Rk=i(br);py=o(Rk,"unet"),Rk.forEach(n),dy=o(De,"."),De.forEach(n),Xm.forEach(n),cy=d(fe),tn=s(fe,"DIV",{class:!0});var Fm=i(tn);f(rs.$$.fragment,Fm),my=d(Fm),ps=s(Fm,"P",{});var Qm=i(ps);hy=o(Qm,`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, the pipeline\u2019s
models have their state dicts saved to CPU and then are moved to a `),Mr=s(Qm,"CODE",{});var Xk=i(Mr);gy=o(Xk,"torch.device('meta') and loaded to GPU only when their specific submodule has its "),Xk.forEach(n),uy=o(Qm,"forward` method called."),Qm.forEach(n),Fm.forEach(n),fe.forEach(n),$c=d(e),ht=s(e,"H3",{class:!0});var Nm=i(ht);nn=s(Nm,"A",{id:!0,class:!0,href:!0});var Fk=i(nn);_r=s(Fk,"SPAN",{});var Qk=i(_r);f(ds.$$.fragment,Qk),Qk.forEach(n),Fk.forEach(n),fy=d(Nm),wr=s(Nm,"SPAN",{});var Nk=i(wr);yy=o(Nk,"KandinskyV22ControlnetPipeline"),Nk.forEach(n),Nm.forEach(n),xc=d(e),R=s(e,"DIV",{class:!0});var ye=i(R);f(cs.$$.fragment,ye),by=d(ye),Jr=s(ye,"P",{});var Yk=i(Jr);My=o(Yk,"Pipeline for text-to-image generation using Kandinsky"),Yk.forEach(n),_y=d(ye),ms=s(ye,"P",{});var Ym=i(ms);wy=o(Ym,"This model inherits from "),Gl=s(Ym,"A",{href:!0});var Kk=i(Gl);Jy=o(Kk,"DiffusionPipeline"),Kk.forEach(n),ky=o(Ym,`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),Ym.forEach(n),Ty=d(ye),Ce=s(ye,"DIV",{class:!0});var Kl=i(Ce);f(hs.$$.fragment,Kl),vy=d(Kl),kr=s(Kl,"P",{});var Sk=i(kr);Uy=o(Sk,"Function invoked when calling the pipeline for generation."),Sk.forEach(n),jy=d(Kl),f(an.$$.fragment,Kl),Kl.forEach(n),Iy=d(ye),sn=s(ye,"DIV",{class:!0});var Km=i(sn);f(gs.$$.fragment,Km),Zy=d(Km),se=s(Km,"P",{});var ze=i(se);Wy=o(ze,`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),Tr=s(ze,"CODE",{});var qk=i(Tr);Gy=o(qk,"enable_sequential_cpu_offload"),qk.forEach(n),Ey=o(ze,", this method moves one whole model at a time to the GPU when its "),vr=s(ze,"CODE",{});var Dk=i(vr);By=o(Dk,"forward"),Dk.forEach(n),Vy=o(ze,`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),Ur=s(ze,"CODE",{});var zk=i(Ur);Py=o(zk,"enable_sequential_cpu_offload"),zk.forEach(n),Cy=o(ze,", but performance is much better due to the iterative execution of the "),jr=s(ze,"CODE",{});var Hk=i(jr);$y=o(Hk,"unet"),Hk.forEach(n),xy=o(ze,"."),ze.forEach(n),Km.forEach(n),Ry=d(ye),ln=s(ye,"DIV",{class:!0});var Sm=i(ln);f(us.$$.fragment,Sm),Xy=d(Sm),fs=s(Sm,"P",{});var qm=i(fs);Fy=o(qm,`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, the pipeline\u2019s
models have their state dicts saved to CPU and then are moved to a `),Ir=s(qm,"CODE",{});var Ak=i(Ir);Qy=o(Ak,"torch.device('meta') and loaded to GPU only when their specific submodule has its "),Ak.forEach(n),Ny=o(qm,"forward` method called."),qm.forEach(n),Sm.forEach(n),ye.forEach(n),Rc=d(e),gt=s(e,"H3",{class:!0});var Dm=i(gt);on=s(Dm,"A",{id:!0,class:!0,href:!0});var Lk=i(on);Zr=s(Lk,"SPAN",{});var Ok=i(Zr);f(ys.$$.fragment,Ok),Ok.forEach(n),Lk.forEach(n),Yy=d(Dm),Wr=s(Dm,"SPAN",{});var eT=i(Wr);Ky=o(eT,"KandinskyV22ControlnetImg2ImgPipeline"),eT.forEach(n),Dm.forEach(n),Xc=d(e),X=s(e,"DIV",{class:!0});var be=i(X);f(bs.$$.fragment,be),Sy=d(be),Gr=s(be,"P",{});var tT=i(Gr);qy=o(tT,"Pipeline for image-to-image generation using Kandinsky"),tT.forEach(n),Dy=d(be),Ms=s(be,"P",{});var zm=i(Ms);zy=o(zm,"This model inherits from "),El=s(zm,"A",{href:!0});var nT=i(El);Hy=o(nT,"DiffusionPipeline"),nT.forEach(n),Ay=o(zm,`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),zm.forEach(n),Ly=d(be),$e=s(be,"DIV",{class:!0});var Sl=i($e);f(_s.$$.fragment,Sl),Oy=d(Sl),Er=s(Sl,"P",{});var aT=i(Er);eb=o(aT,"Function invoked when calling the pipeline for generation."),aT.forEach(n),tb=d(Sl),f(rn.$$.fragment,Sl),Sl.forEach(n),nb=d(be),pn=s(be,"DIV",{class:!0});var Hm=i(pn);f(ws.$$.fragment,Hm),ab=d(Hm),ie=s(Hm,"P",{});var He=i(ie);sb=o(He,`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),Br=s(He,"CODE",{});var sT=i(Br);ib=o(sT,"enable_sequential_cpu_offload"),sT.forEach(n),lb=o(He,", this method moves one whole model at a time to the GPU when its "),Vr=s(He,"CODE",{});var iT=i(Vr);ob=o(iT,"forward"),iT.forEach(n),rb=o(He,`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),Pr=s(He,"CODE",{});var lT=i(Pr);pb=o(lT,"enable_sequential_cpu_offload"),lT.forEach(n),db=o(He,", but performance is much better due to the iterative execution of the "),Cr=s(He,"CODE",{});var oT=i(Cr);cb=o(oT,"unet"),oT.forEach(n),mb=o(He,"."),He.forEach(n),Hm.forEach(n),hb=d(be),dn=s(be,"DIV",{class:!0});var Am=i(dn);f(Js.$$.fragment,Am),gb=d(Am),ks=s(Am,"P",{});var Lm=i(ks);ub=o(Lm,`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, the pipeline\u2019s
models have their state dicts saved to CPU and then are moved to a `),$r=s(Lm,"CODE",{});var rT=i($r);fb=o(rT,"torch.device('meta') and loaded to GPU only when their specific submodule has its "),rT.forEach(n),yb=o(Lm,"forward` method called."),Lm.forEach(n),Am.forEach(n),be.forEach(n),Fc=d(e),ut=s(e,"H3",{class:!0});var Om=i(ut);cn=s(Om,"A",{id:!0,class:!0,href:!0});var pT=i(cn);xr=s(pT,"SPAN",{});var dT=i(xr);f(Ts.$$.fragment,dT),dT.forEach(n),pT.forEach(n),bb=d(Om),Rr=s(Om,"SPAN",{});var cT=i(Rr);Mb=o(cT,"KandinskyV22Img2ImgPipeline"),cT.forEach(n),Om.forEach(n),Qc=d(e),F=s(e,"DIV",{class:!0});var Me=i(F);f(vs.$$.fragment,Me),_b=d(Me),Xr=s(Me,"P",{});var mT=i(Xr);wb=o(mT,"Pipeline for image-to-image generation using Kandinsky"),mT.forEach(n),Jb=d(Me),Us=s(Me,"P",{});var eh=i(Us);kb=o(eh,"This model inherits from "),Bl=s(eh,"A",{href:!0});var hT=i(Bl);Tb=o(hT,"DiffusionPipeline"),hT.forEach(n),vb=o(eh,`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),eh.forEach(n),Ub=d(Me),xe=s(Me,"DIV",{class:!0});var ql=i(xe);f(js.$$.fragment,ql),jb=d(ql),Fr=s(ql,"P",{});var gT=i(Fr);Ib=o(gT,"Function invoked when calling the pipeline for generation."),gT.forEach(n),Zb=d(ql),f(mn.$$.fragment,ql),ql.forEach(n),Wb=d(Me),hn=s(Me,"DIV",{class:!0});var th=i(hn);f(Is.$$.fragment,th),Gb=d(th),le=s(th,"P",{});var Ae=i(le);Eb=o(Ae,`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),Qr=s(Ae,"CODE",{});var uT=i(Qr);Bb=o(uT,"enable_sequential_cpu_offload"),uT.forEach(n),Vb=o(Ae,", this method moves one whole model at a time to the GPU when its "),Nr=s(Ae,"CODE",{});var fT=i(Nr);Pb=o(fT,"forward"),fT.forEach(n),Cb=o(Ae,`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),Yr=s(Ae,"CODE",{});var yT=i(Yr);$b=o(yT,"enable_sequential_cpu_offload"),yT.forEach(n),xb=o(Ae,", but performance is much better due to the iterative execution of the "),Kr=s(Ae,"CODE",{});var bT=i(Kr);Rb=o(bT,"unet"),bT.forEach(n),Xb=o(Ae,"."),Ae.forEach(n),th.forEach(n),Fb=d(Me),gn=s(Me,"DIV",{class:!0});var nh=i(gn);f(Zs.$$.fragment,nh),Qb=d(nh),Ws=s(nh,"P",{});var ah=i(Ws);Nb=o(ah,`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, the pipeline\u2019s
models have their state dicts saved to CPU and then are moved to a `),Sr=s(ah,"CODE",{});var MT=i(Sr);Yb=o(MT,"torch.device('meta') and loaded to GPU only when their specific submodule has its "),MT.forEach(n),Kb=o(ah,"forward` method called."),ah.forEach(n),nh.forEach(n),Me.forEach(n),Nc=d(e),ft=s(e,"H3",{class:!0});var sh=i(ft);un=s(sh,"A",{id:!0,class:!0,href:!0});var _T=i(un);qr=s(_T,"SPAN",{});var wT=i(qr);f(Gs.$$.fragment,wT),wT.forEach(n),_T.forEach(n),Sb=d(sh),Dr=s(sh,"SPAN",{});var JT=i(Dr);qb=o(JT,"KandinskyV22InpaintPipeline"),JT.forEach(n),sh.forEach(n),Yc=d(e),Q=s(e,"DIV",{class:!0});var _e=i(Q);f(Es.$$.fragment,_e),Db=d(_e),zr=s(_e,"P",{});var kT=i(zr);zb=o(kT,"Pipeline for text-guided image inpainting using Kandinsky2.1"),kT.forEach(n),Hb=d(_e),Bs=s(_e,"P",{});var ih=i(Bs);Ab=o(ih,"This model inherits from "),Vl=s(ih,"A",{href:!0});var TT=i(Vl);Lb=o(TT,"DiffusionPipeline"),TT.forEach(n),Ob=o(ih,`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),ih.forEach(n),eM=d(_e),fn=s(_e,"DIV",{class:!0});var lh=i(fn);f(Vs.$$.fragment,lh),tM=d(lh),f(yn.$$.fragment,lh),lh.forEach(n),nM=d(_e),bn=s(_e,"DIV",{class:!0});var oh=i(bn);f(Ps.$$.fragment,oh),aM=d(oh),oe=s(oh,"P",{});var Le=i(oe);sM=o(Le,`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),Hr=s(Le,"CODE",{});var vT=i(Hr);iM=o(vT,"enable_sequential_cpu_offload"),vT.forEach(n),lM=o(Le,", this method moves one whole model at a time to the GPU when its "),Ar=s(Le,"CODE",{});var UT=i(Ar);oM=o(UT,"forward"),UT.forEach(n),rM=o(Le,`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),Lr=s(Le,"CODE",{});var jT=i(Lr);pM=o(jT,"enable_sequential_cpu_offload"),jT.forEach(n),dM=o(Le,", but performance is much better due to the iterative execution of the "),Or=s(Le,"CODE",{});var IT=i(Or);cM=o(IT,"unet"),IT.forEach(n),mM=o(Le,"."),Le.forEach(n),oh.forEach(n),hM=d(_e),Mn=s(_e,"DIV",{class:!0});var rh=i(Mn);f(Cs.$$.fragment,rh),gM=d(rh),$s=s(rh,"P",{});var ph=i($s);uM=o(ph,`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, the pipeline\u2019s
models have their state dicts saved to CPU and then are moved to a `),ep=s(ph,"CODE",{});var ZT=i(ep);fM=o(ZT,"torch.device('meta') and loaded to GPU only when their specific submodule has its "),ZT.forEach(n),yM=o(ph,"forward` method called."),ph.forEach(n),rh.forEach(n),_e.forEach(n),Kc=d(e),yt=s(e,"H3",{class:!0});var dh=i(yt);_n=s(dh,"A",{id:!0,class:!0,href:!0});var WT=i(_n);tp=s(WT,"SPAN",{});var GT=i(tp);f(xs.$$.fragment,GT),GT.forEach(n),WT.forEach(n),bM=d(dh),np=s(dh,"SPAN",{});var ET=i(np);MM=o(ET,"KandinskyV22PriorPipeline"),ET.forEach(n),dh.forEach(n),Sc=d(e),Pl=s(e,"P",{});var BT=i(Pl);_M=o(BT,"[[autodoc]] ## KandinskyV22PriorPipeline"),BT.forEach(n),qc=d(e),Re=s(e,"UL",{});var Dl=i(Re);ap=s(Dl,"LI",{});var VT=i(ap);wM=o(VT,"all"),VT.forEach(n),JM=d(Dl),sp=s(Dl,"LI",{});var PT=i(sp);ip=s(PT,"STRONG",{});var CT=i(ip);kM=o(CT,"call"),CT.forEach(n),PT.forEach(n),TM=d(Dl),lp=s(Dl,"LI",{});var $T=i(lp);vM=o($T,"interpolate"),$T.forEach(n),Dl.forEach(n),Dc=d(e),bt=s(e,"H3",{class:!0});var ch=i(bt);wn=s(ch,"A",{id:!0,class:!0,href:!0});var xT=i(wn);op=s(xT,"SPAN",{});var RT=i(op);f(Rs.$$.fragment,RT),RT.forEach(n),xT.forEach(n),UM=d(ch),rp=s(ch,"SPAN",{});var XT=i(rp);jM=o(XT,"KandinskyV22PriorEmb2EmbPipeline"),XT.forEach(n),ch.forEach(n),zc=d(e),N=s(e,"DIV",{class:!0});var we=i(N);f(Xs.$$.fragment,we),IM=d(we),pp=s(we,"P",{});var FT=i(pp);ZM=o(FT,"Pipeline for generating image prior for Kandinsky"),FT.forEach(n),WM=d(we),Fs=s(we,"P",{});var mh=i(Fs);GM=o(mh,"This model inherits from "),Cl=s(mh,"A",{href:!0});var QT=i(Cl);EM=o(QT,"DiffusionPipeline"),QT.forEach(n),BM=o(mh,`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),mh.forEach(n),VM=d(we),Xe=s(we,"DIV",{class:!0});var zl=i(Xe);f(Qs.$$.fragment,zl),PM=d(zl),dp=s(zl,"P",{});var NT=i(dp);CM=o(NT,"Function invoked when calling the pipeline for generation."),NT.forEach(n),$M=d(zl),f(Jn.$$.fragment,zl),zl.forEach(n),xM=d(we),Fe=s(we,"DIV",{class:!0});var Hl=i(Fe);f(Ns.$$.fragment,Hl),RM=d(Hl),cp=s(Hl,"P",{});var YT=i(cp);XM=o(YT,"Function invoked when using the prior pipeline for interpolation."),YT.forEach(n),FM=d(Hl),f(kn.$$.fragment,Hl),Hl.forEach(n),QM=d(we),Tn=s(we,"DIV",{class:!0});var hh=i(Tn);f(Ys.$$.fragment,hh),NM=d(hh),Ks=s(hh,"P",{});var gh=i(Ks);YM=o(gh,`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, the pipeline\u2019s
models have their state dicts saved to CPU and then are moved to a `),mp=s(gh,"CODE",{});var KT=i(mp);KM=o(KT,"torch.device('meta') and loaded to GPU only when their specific submodule has its "),KT.forEach(n),SM=o(gh,"forward` method called."),gh.forEach(n),hh.forEach(n),we.forEach(n),Hc=d(e),Mt=s(e,"H3",{class:!0});var uh=i(Mt);vn=s(uh,"A",{id:!0,class:!0,href:!0});var ST=i(vn);hp=s(ST,"SPAN",{});var qT=i(hp);f(Ss.$$.fragment,qT),qT.forEach(n),ST.forEach(n),qM=d(uh),gp=s(uh,"SPAN",{});var DT=i(gp);DM=o(DT,"KandinskyPriorPipeline"),DT.forEach(n),uh.forEach(n),Ac=d(e),Y=s(e,"DIV",{class:!0});var Je=i(Y);f(qs.$$.fragment,Je),zM=d(Je),up=s(Je,"P",{});var zT=i(up);HM=o(zT,"Pipeline for generating image prior for Kandinsky"),zT.forEach(n),AM=d(Je),Ds=s(Je,"P",{});var fh=i(Ds);LM=o(fh,"This model inherits from "),$l=s(fh,"A",{href:!0});var HT=i($l);OM=o(HT,"DiffusionPipeline"),HT.forEach(n),e_=o(fh,`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),fh.forEach(n),t_=d(Je),Qe=s(Je,"DIV",{class:!0});var Al=i(Qe);f(zs.$$.fragment,Al),n_=d(Al),fp=s(Al,"P",{});var AT=i(fp);a_=o(AT,"Function invoked when calling the pipeline for generation."),AT.forEach(n),s_=d(Al),f(Un.$$.fragment,Al),Al.forEach(n),i_=d(Je),Ne=s(Je,"DIV",{class:!0});var Ll=i(Ne);f(Hs.$$.fragment,Ll),l_=d(Ll),yp=s(Ll,"P",{});var LT=i(yp);o_=o(LT,"Function invoked when using the prior pipeline for interpolation."),LT.forEach(n),r_=d(Ll),f(jn.$$.fragment,Ll),Ll.forEach(n),p_=d(Je),In=s(Je,"DIV",{class:!0});var yh=i(In);f(As.$$.fragment,yh),d_=d(yh),Ls=s(yh,"P",{});var bh=i(Ls);c_=o(bh,`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, the pipeline\u2019s
models have their state dicts saved to CPU and then are moved to a `),bp=s(bh,"CODE",{});var OT=i(bp);m_=o(OT,"torch.device('meta') and loaded to GPU only when their specific submodule has its "),OT.forEach(n),h_=o(bh,"forward` method called."),bh.forEach(n),yh.forEach(n),Je.forEach(n),Lc=d(e),_t=s(e,"H3",{class:!0});var Mh=i(_t);Zn=s(Mh,"A",{id:!0,class:!0,href:!0});var ev=i(Zn);Mp=s(ev,"SPAN",{});var tv=i(Mp);f(Os.$$.fragment,tv),tv.forEach(n),ev.forEach(n),g_=d(Mh),_p=s(Mh,"SPAN",{});var nv=i(_p);u_=o(nv,"KandinskyPipeline"),nv.forEach(n),Mh.forEach(n),Oc=d(e),K=s(e,"DIV",{class:!0});var ke=i(K);f(ei.$$.fragment,ke),f_=d(ke),wp=s(ke,"P",{});var av=i(wp);y_=o(av,"Pipeline for text-to-image generation using Kandinsky"),av.forEach(n),b_=d(ke),ti=s(ke,"P",{});var _h=i(ti);M_=o(_h,"This model inherits from "),xl=s(_h,"A",{href:!0});var sv=i(xl);__=o(sv,"DiffusionPipeline"),sv.forEach(n),w_=o(_h,`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),_h.forEach(n),J_=d(ke),Ye=s(ke,"DIV",{class:!0});var Ol=i(Ye);f(ni.$$.fragment,Ol),k_=d(Ol),Jp=s(Ol,"P",{});var iv=i(Jp);T_=o(iv,"Function invoked when calling the pipeline for generation."),iv.forEach(n),v_=d(Ol),f(Wn.$$.fragment,Ol),Ol.forEach(n),U_=d(ke),Gn=s(ke,"DIV",{class:!0});var wh=i(Gn);f(ai.$$.fragment,wh),j_=d(wh),re=s(wh,"P",{});var Oe=i(re);I_=o(Oe,`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),kp=s(Oe,"CODE",{});var lv=i(kp);Z_=o(lv,"enable_sequential_cpu_offload"),lv.forEach(n),W_=o(Oe,", this method moves one whole model at a time to the GPU when its "),Tp=s(Oe,"CODE",{});var ov=i(Tp);G_=o(ov,"forward"),ov.forEach(n),E_=o(Oe,`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),vp=s(Oe,"CODE",{});var rv=i(vp);B_=o(rv,"enable_sequential_cpu_offload"),rv.forEach(n),V_=o(Oe,", but performance is much better due to the iterative execution of the "),Up=s(Oe,"CODE",{});var pv=i(Up);P_=o(pv,"unet"),pv.forEach(n),C_=o(Oe,"."),Oe.forEach(n),wh.forEach(n),$_=d(ke),En=s(ke,"DIV",{class:!0});var Jh=i(En);f(si.$$.fragment,Jh),x_=d(Jh),ii=s(Jh,"P",{});var kh=i(ii);R_=o(kh,`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, the pipeline\u2019s
models have their state dicts saved to CPU and then are moved to a `),jp=s(kh,"CODE",{});var dv=i(jp);X_=o(dv,"torch.device('meta') and loaded to GPU only when their specific submodule has its "),dv.forEach(n),F_=o(kh,"forward` method called."),kh.forEach(n),Jh.forEach(n),ke.forEach(n),em=d(e),wt=s(e,"H3",{class:!0});var Th=i(wt);Bn=s(Th,"A",{id:!0,class:!0,href:!0});var cv=i(Bn);Ip=s(cv,"SPAN",{});var mv=i(Ip);f(li.$$.fragment,mv),mv.forEach(n),cv.forEach(n),Q_=d(Th),Zp=s(Th,"SPAN",{});var hv=i(Zp);N_=o(hv,"KandinskyImg2ImgPipeline"),hv.forEach(n),Th.forEach(n),tm=d(e),S=s(e,"DIV",{class:!0});var Te=i(S);f(oi.$$.fragment,Te),Y_=d(Te),Wp=s(Te,"P",{});var gv=i(Wp);K_=o(gv,"Pipeline for image-to-image generation using Kandinsky"),gv.forEach(n),S_=d(Te),ri=s(Te,"P",{});var vh=i(ri);q_=o(vh,"This model inherits from "),Rl=s(vh,"A",{href:!0});var uv=i(Rl);D_=o(uv,"DiffusionPipeline"),uv.forEach(n),z_=o(vh,`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),vh.forEach(n),H_=d(Te),Ke=s(Te,"DIV",{class:!0});var eo=i(Ke);f(pi.$$.fragment,eo),A_=d(eo),Gp=s(eo,"P",{});var fv=i(Gp);L_=o(fv,"Function invoked when calling the pipeline for generation."),fv.forEach(n),O_=d(eo),f(Vn.$$.fragment,eo),eo.forEach(n),e2=d(Te),Pn=s(Te,"DIV",{class:!0});var Uh=i(Pn);f(di.$$.fragment,Uh),t2=d(Uh),pe=s(Uh,"P",{});var et=i(pe);n2=o(et,`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),Ep=s(et,"CODE",{});var yv=i(Ep);a2=o(yv,"enable_sequential_cpu_offload"),yv.forEach(n),s2=o(et,", this method moves one whole model at a time to the GPU when its "),Bp=s(et,"CODE",{});var bv=i(Bp);i2=o(bv,"forward"),bv.forEach(n),l2=o(et,`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),Vp=s(et,"CODE",{});var Mv=i(Vp);o2=o(Mv,"enable_sequential_cpu_offload"),Mv.forEach(n),r2=o(et,", but performance is much better due to the iterative execution of the "),Pp=s(et,"CODE",{});var _v=i(Pp);p2=o(_v,"unet"),_v.forEach(n),d2=o(et,"."),et.forEach(n),Uh.forEach(n),c2=d(Te),Cn=s(Te,"DIV",{class:!0});var jh=i(Cn);f(ci.$$.fragment,jh),m2=d(jh),mi=s(jh,"P",{});var Ih=i(mi);h2=o(Ih,`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, the pipeline\u2019s
models have their state dicts saved to CPU and then are moved to a `),Cp=s(Ih,"CODE",{});var wv=i(Cp);g2=o(wv,"torch.device('meta') and loaded to GPU only when their specific submodule has its "),wv.forEach(n),u2=o(Ih,"forward` method called."),Ih.forEach(n),jh.forEach(n),Te.forEach(n),nm=d(e),Jt=s(e,"H3",{class:!0});var Zh=i(Jt);$n=s(Zh,"A",{id:!0,class:!0,href:!0});var Jv=i($n);$p=s(Jv,"SPAN",{});var kv=i($p);f(hi.$$.fragment,kv),kv.forEach(n),Jv.forEach(n),f2=d(Zh),xp=s(Zh,"SPAN",{});var Tv=i(xp);y2=o(Tv,"KandinskyInpaintPipeline"),Tv.forEach(n),Zh.forEach(n),am=d(e),q=s(e,"DIV",{class:!0});var ve=i(q);f(gi.$$.fragment,ve),b2=d(ve),Rp=s(ve,"P",{});var vv=i(Rp);M2=o(vv,"Pipeline for text-guided image inpainting using Kandinsky2.1"),vv.forEach(n),_2=d(ve),ui=s(ve,"P",{});var Wh=i(ui);w2=o(Wh,"This model inherits from "),Xl=s(Wh,"A",{href:!0});var Uv=i(Xl);J2=o(Uv,"DiffusionPipeline"),Uv.forEach(n),k2=o(Wh,`. Check the superclass documentation for the generic methods the
library implements for all the pipelines (such as downloading or saving, running on a particular device, etc.)`),Wh.forEach(n),T2=d(ve),Se=s(ve,"DIV",{class:!0});var to=i(Se);f(fi.$$.fragment,to),v2=d(to),Xp=s(to,"P",{});var jv=i(Xp);U2=o(jv,"Function invoked when calling the pipeline for generation."),jv.forEach(n),j2=d(to),f(xn.$$.fragment,to),to.forEach(n),I2=d(ve),Rn=s(ve,"DIV",{class:!0});var Gh=i(Rn);f(yi.$$.fragment,Gh),Z2=d(Gh),de=s(Gh,"P",{});var tt=i(de);W2=o(tt,`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),Fp=s(tt,"CODE",{});var Iv=i(Fp);G2=o(Iv,"enable_sequential_cpu_offload"),Iv.forEach(n),E2=o(tt,", this method moves one whole model at a time to the GPU when its "),Qp=s(tt,"CODE",{});var Zv=i(Qp);B2=o(Zv,"forward"),Zv.forEach(n),V2=o(tt,`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),Np=s(tt,"CODE",{});var Wv=i(Np);P2=o(Wv,"enable_sequential_cpu_offload"),Wv.forEach(n),C2=o(tt,", but performance is much better due to the iterative execution of the "),Yp=s(tt,"CODE",{});var Gv=i(Yp);$2=o(Gv,"unet"),Gv.forEach(n),x2=o(tt,"."),tt.forEach(n),Gh.forEach(n),R2=d(ve),Xn=s(ve,"DIV",{class:!0});var Eh=i(Xn);f(bi.$$.fragment,Eh),X2=d(Eh),Mi=s(Eh,"P",{});var Bh=i(Mi);F2=o(Bh,`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, the pipeline\u2019s
models have their state dicts saved to CPU and then are moved to a `),Kp=s(Bh,"CODE",{});var Ev=i(Kp);Q2=o(Ev,"torch.device('meta') and loaded to GPU only when their specific submodule has its "),Ev.forEach(n),N2=o(Bh,"forward` method called."),Bh.forEach(n),Eh.forEach(n),ve.forEach(n),this.h()},h(){m(g,"name","hf:doc:metadata"),m(g,"content",JSON.stringify(eU)),m(w,"id","kandinsky"),m(w,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(w,"href","#kandinsky"),m(k,"class","relative group"),m(E,"id","overview"),m(E,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(E,"href","#overview"),m(Z,"class","relative group"),m(ne,"href","https://huggingface.co/papers/2204.06125"),m(ne,"rel","nofollow"),m(he,"href","https://huggingface.co/docs/diffusers/api/pipelines/latent_diffusion"),m(he,"rel","nofollow"),m(Ge,"href","https://huggingface.co/docs/transformers/model_doc/clip"),m(Ge,"rel","nofollow"),m(qn,"href","https://github.com/cene555"),m(qn,"rel","nofollow"),m(Dn,"href","https://github.com/razzant"),m(Dn,"rel","nofollow"),m(zn,"href","https://github.com/AlexWortega"),m(zn,"rel","nofollow"),m(Hn,"href","https://github.com/boomb0om"),m(Hn,"rel","nofollow"),m(An,"href","https://github.com/kuznetsoffandrey"),m(An,"rel","nofollow"),m(Ln,"href","https://github.com/denndimitrov"),m(Ln,"rel","nofollow"),m(On,"href","https://github.com/ai-forever/Kandinsky-2"),m(On,"rel","nofollow"),m(Ut,"id","usage-example"),m(Ut,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(Ut,"href","#usage-example"),m(nt,"class","relative group"),m(jt,"id","texttoimage-generation"),m(jt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(jt,"href","#texttoimage-generation"),m(at,"class","relative group"),m(Zi,"href","/docs/diffusers/v0.18.0/en/api/pipelines/kandinsky#diffusers.KandinskyPriorPipeline"),m(Wi,"href","/docs/diffusers/v0.18.0/en/api/pipelines/kandinsky#diffusers.KandinskyPipeline"),m(na,"href","https://cdn.openai.com/papers/dall-e-2.pdf"),m(na,"rel","nofollow"),ce(Pi.src,K2="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/kandinsky-docs/cheeseburger.png")||m(Pi,"src",K2),m(Pi,"alt","img"),ce(xi.src,S2="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/kandinsky-docs/hair.png")||m(xi,"src",S2),m(xi,"alt","img"),ce(Xi.src,q2="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/kandinsky-docs/dusts.png")||m(Xi,"src",q2),m(Xi,"alt","img"),ce(Qi.src,D2="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/kandinsky-docs/smokechair.png")||m(Qi,"src",D2),m(Qi,"alt","img"),ce(Yi.src,z2="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/kandinsky-docs/alienplanet.png")||m(Yi,"src",z2),m(Yi,"alt","img"),m(Gt,"id","text-guided-imagetoimage-generation"),m(Gt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(Gt,"href","#text-guided-imagetoimage-generation"),m(st,"class","relative group"),m(Ki,"href","/docs/diffusers/v0.18.0/en/api/pipelines/kandinsky#diffusers.KandinskyImg2ImgPipeline"),m(Si,"href","/docs/diffusers/v0.18.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.components"),m(qi,"href","#converting-between-different-pipelines"),ce(Hi.src,H2="https://raw.githubusercontent.com/CompVis/stable-diffusion/main/assets/stable-samples/img2img/sketch-mountains-input.jpg")||m(Hi,"src",H2),m(Hi,"alt","img"),ce(Li.src,A2="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/kandinsky-docs/img2img_fantasyland.png")||m(Li,"src",A2),m(Li,"alt","img"),m(Bt,"id","text-guided-inpainting-generation"),m(Bt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(Bt,"href","#text-guided-inpainting-generation"),m(it,"class","relative group"),m(Oi,"href","/docs/diffusers/v0.18.0/en/api/pipelines/kandinsky#diffusers.KandinskyInpaintPipeline"),ce(tl.src,L2="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/kandinsky-docs/inpaint_cat_hat.png")||m(tl,"src",L2),m(tl,"alt","img"),m(Pt,"id","interpolate"),m(Pt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(Pt,"href","#interpolate"),m(lt,"class","relative group"),m(nl,"href","/docs/diffusers/v0.18.0/en/api/pipelines/kandinsky#diffusers.KandinskyPriorPipeline"),ce(sl.src,O2="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/diffusers/kandinsky-docs/starry_cat.png")||m(sl,"src",O2),m(sl,"alt","img"),m($t,"id","texttoimage-generation-with-controlnet-conditioning"),m($t,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m($t,"href","#texttoimage-generation-with-controlnet-conditioning"),m(ot,"class","relative group"),m(il,"href","/docs/diffusers/v0.18.0/en/api/pipelines/kandinsky#diffusers.KandinskyV22ControlnetPipeline"),ce(rl.src,ew="https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/kandinskyv22/cat.png")||m(rl,"src",ew),m(rl,"alt","img"),ce(cl.src,tw="https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/kandinskyv22/robot_cat_text2img.png")||m(cl,"src",tw),m(cl,"alt","img"),m(Ft,"id","imagetoimage-generation-with-controlnet-conditioning"),m(Ft,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(Ft,"href","#imagetoimage-generation-with-controlnet-conditioning"),m(rt,"class","relative group"),m(ml,"href","/docs/diffusers/v0.18.0/en/api/pipelines/kandinsky#diffusers.KandinskyV22ControlnetImg2ImgPipeline"),m(hl,"href","/docs/diffusers/v0.18.0/en/api/pipelines/kandinsky#diffusers.KandinskyV22PriorEmb2EmbPipeline"),ce(bl.src,nw="https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/kandinskyv22/robot_cat.png")||m(bl,"src",nw),m(bl,"alt","img"),m(Qt,"id","kandinsky-22"),m(Qt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(Qt,"href","#kandinsky-22"),m(pt,"class","relative group"),ce(Jl.src,aw="https://huggingface.co/datasets/hf-internal-testing/diffusers-images/resolve/main/kandinskyv22/%20blue%20eyes.png")||m(Jl,"src",aw),m(Jl,"alt","img"),m(Kt,"id","optimization"),m(Kt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(Kt,"href","#optimization"),m(dt,"class","relative group"),m(Tl,"href","/docs/diffusers/v0.18.0/en/api/pipelines/kandinsky#diffusers.KandinskyPriorPipeline"),m(vl,"href","/docs/diffusers/v0.18.0/en/api/pipelines/kandinsky#diffusers.KandinskyPipeline"),m(Ul,"href","/docs/diffusers/v0.18.0/en/api/pipelines/kandinsky#diffusers.KandinskyImg2ImgPipeline"),m(jl,"href","/docs/diffusers/v0.18.0/en/api/pipelines/kandinsky#diffusers.KandinskyInpaintPipeline"),m(Ea,"href","https://github.com/facebookresearch/xformers"),m(Ea,"rel","nofollow"),m(Va,"href","https://pytorch.org/blog/accelerated-diffusers-pt-20/"),m(Va,"rel","nofollow"),m(xa,"href","https://huggingface.co/docs/diffusers/main/en/optimization/torch2.0"),m(xa,"rel","nofollow"),m(zt,"id","available-pipelines"),m(zt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(zt,"href","#available-pipelines"),m(ct,"class","relative group"),m(Qa,"href","https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2.py"),m(Qa,"rel","nofollow"),m(Ya,"href","https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/kandinsky/pipeline_kandinsky.py"),m(Ya,"rel","nofollow"),m(Sa,"href","https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_inpaint.py"),m(Sa,"rel","nofollow"),m(Da,"href","https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/kandinsky/pipeline_kandinsky_inpaint.py"),m(Da,"rel","nofollow"),m(Ha,"href","https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_img2img.py"),m(Ha,"rel","nofollow"),m(La,"href","https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/kandinsky/pipeline_kandinsky_img2img.py"),m(La,"rel","nofollow"),m(es,"href","https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_controlnet.py"),m(es,"rel","nofollow"),m(ns,"href","https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/kandinsky2_2/pipeline_kandinsky2_2_controlnet_img2img.py"),m(ns,"rel","nofollow"),m(At,"id","diffusers.KandinskyV22Pipeline"),m(At,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(At,"href","#diffusers.KandinskyV22Pipeline"),m(mt,"class","relative group"),m(Wl,"href","/docs/diffusers/v0.18.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),m(Lt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(en,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(tn,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(nn,"id","diffusers.KandinskyV22ControlnetPipeline"),m(nn,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(nn,"href","#diffusers.KandinskyV22ControlnetPipeline"),m(ht,"class","relative group"),m(Gl,"href","/docs/diffusers/v0.18.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),m(Ce,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(sn,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(ln,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(on,"id","diffusers.KandinskyV22ControlnetImg2ImgPipeline"),m(on,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(on,"href","#diffusers.KandinskyV22ControlnetImg2ImgPipeline"),m(gt,"class","relative group"),m(El,"href","/docs/diffusers/v0.18.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),m($e,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(pn,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(dn,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(cn,"id","diffusers.KandinskyV22Img2ImgPipeline"),m(cn,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(cn,"href","#diffusers.KandinskyV22Img2ImgPipeline"),m(ut,"class","relative group"),m(Bl,"href","/docs/diffusers/v0.18.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),m(xe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(hn,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(gn,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(un,"id","diffusers.KandinskyV22InpaintPipeline"),m(un,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(un,"href","#diffusers.KandinskyV22InpaintPipeline"),m(ft,"class","relative group"),m(Vl,"href","/docs/diffusers/v0.18.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),m(fn,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(bn,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Mn,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(_n,"id","kandinskyv22priorpipeline"),m(_n,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(_n,"href","#kandinskyv22priorpipeline"),m(yt,"class","relative group"),m(wn,"id","diffusers.KandinskyV22PriorEmb2EmbPipeline"),m(wn,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(wn,"href","#diffusers.KandinskyV22PriorEmb2EmbPipeline"),m(bt,"class","relative group"),m(Cl,"href","/docs/diffusers/v0.18.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),m(Xe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Fe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Tn,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(vn,"id","diffusers.KandinskyPriorPipeline"),m(vn,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(vn,"href","#diffusers.KandinskyPriorPipeline"),m(Mt,"class","relative group"),m($l,"href","/docs/diffusers/v0.18.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),m(Qe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Ne,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(In,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Y,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Zn,"id","diffusers.KandinskyPipeline"),m(Zn,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(Zn,"href","#diffusers.KandinskyPipeline"),m(_t,"class","relative group"),m(xl,"href","/docs/diffusers/v0.18.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),m(Ye,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Gn,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(En,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(K,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Bn,"id","diffusers.KandinskyImg2ImgPipeline"),m(Bn,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m(Bn,"href","#diffusers.KandinskyImg2ImgPipeline"),m(wt,"class","relative group"),m(Rl,"href","/docs/diffusers/v0.18.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),m(Ke,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Pn,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Cn,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m($n,"id","diffusers.KandinskyInpaintPipeline"),m($n,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),m($n,"href","#diffusers.KandinskyInpaintPipeline"),m(Jt,"class","relative group"),m(Xl,"href","/docs/diffusers/v0.18.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),m(Se,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Rn,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(Xn,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),m(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,r){t(document.head,g),c(e,v,r),c(e,k,r),t(k,w),t(w,T),y(h,T,null),t(k,J),t(k,H),t(H,$),c(e,te,r),c(e,Z,r),t(Z,E),t(E,me),y(A,me,null),t(Z,Tt),t(Z,D),t(D,Nn),c(e,We,r),c(e,L,r),t(L,Yn),t(L,ne),t(ne,Kn),t(L,Sn),t(L,he),t(he,je),t(L,vt),c(e,W,r),c(e,G,r),t(G,Ti),t(G,Ge),t(Ge,vi),t(G,Ui),c(e,Ie,r),c(e,V,r),t(V,ji),t(V,qn),t(qn,Vh),t(V,Ph),t(V,Dn),t(Dn,Ch),t(V,$h),t(V,zn),t(zn,xh),t(V,Rh),t(V,Hn),t(Hn,Xh),t(V,Fh),t(V,An),t(An,Qh),t(V,Nh),t(V,Ln),t(Ln,Yh),t(V,Kh),t(V,On),t(On,Sh),c(e,td,r),c(e,nt,r),t(nt,Ut),t(Ut,no),y(ea,no,null),t(nt,qh),t(nt,ao),t(ao,Dh),c(e,nd,r),c(e,Ii,r),t(Ii,zh),c(e,ad,r),c(e,at,r),t(at,jt),t(jt,so),y(ta,so,null),t(at,Hh),t(at,io),t(io,Ah),c(e,sd,r),c(e,ge,r),t(ge,Lh),t(ge,Zi),t(Zi,Oh),t(ge,eg),t(ge,Wi),t(Wi,tg),t(ge,ng),t(ge,na),t(na,ag),t(ge,sg),c(e,id,r),y(aa,e,r),c(e,ld,r),c(e,Gi,r),t(Gi,ig),c(e,od,r),y(sa,e,r),c(e,rd,r),y(It,e,r),c(e,pd,r),c(e,Ei,r),t(Ei,lg),c(e,dd,r),y(ia,e,r),c(e,cd,r),y(Zt,e,r),c(e,md,r),c(e,Wt,r),t(Wt,og),t(Wt,lo),t(lo,rg),t(Wt,pg),c(e,hd,r),y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Fa),t(Fa,Qo),t(Qo,Qa),t(Qa,hf),t(Fa,gf),t(Fa,No),t(No,Yo),t(Yo,uf),t(P,ff),t(P,Na),t(Na,Ko),t(Ko,Ya),t(Ya,yf),t(Na,bf),t(Na,So),t(So,qo),t(qo,Mf),t(P,_f),t(P,Ka),t(Ka,Do),t(Do,Sa),t(Sa,wf),t(Ka,Jf),t(Ka,zo),t(zo,Ho),t(Ho,kf),t(P,Tf),t(P,qa),t(qa,Ao),t(Ao,Da),t(Da,vf),t(qa,Uf),t(qa,Lo),t(Lo,Oo),t(Oo,jf),t(P,If),t(P,za),t(za,er),t(er,Ha),t(Ha,Zf),t(za,Wf),t(za,tr),t(tr,nr),t(nr,Gf),t(P,Ef),t(P,Aa),t(Aa,ar),t(ar,La),t(La,Bf),t(Aa,Vf),t(Aa,sr),t(sr,ir),t(ir,Pf),t(P,Cf),t(P,Oa),t(Oa,lr),t(lr,es),t(es,$f),t(Oa,xf),t(Oa,or),t(or,rr),t(rr,Rf),t(P,Xf),t(P,ts),t(ts,pr),t(pr,ns),t(ns,Ff),t(ts,Qf),t(ts,dr),t(dr,cr),t(cr,Nf),c(e,Pc,r),c(e,mt,r),t(mt,At),t(At,mr),y(as,mr,null),t(mt,Yf),t(mt,hr),t(hr,Kf),c(e,Cc,r),c(e,x,r),y(ss,x,null),t(x,Sf),t(x,gr),t(gr,qf),t(x,Df),t(x,is),t(is,zf),t(is,Wl),t(Wl,Hf),t(is,Af),t(x,Lf),t(x,Lt),y(ls,Lt,null),t(Lt,Of),y(Ot,Lt,null),t(x,ey),t(x,en),y(os,en,null),t(en,ty),t(en,ae),t(ae,ny),t(ae,ur),t(ur,ay),t(ae,sy),t(ae,fr),t(fr,iy),t(ae,ly),t(ae,yr),t(yr,oy),t(ae,ry),t(ae,br),t(br,py),t(ae,dy),t(x,cy),t(x,tn),y(rs,tn,null),t(tn,my),t(tn,ps),t(ps,hy),t(ps,Mr),t(Mr,gy),t(ps,uy),c(e,$c,r),c(e,ht,r),t(ht,nn),t(nn,_r),y(ds,_r,null),t(ht,fy),t(ht,wr),t(wr,yy),c(e,xc,r),c(e,R,r),y(cs,R,null),t(R,by),t(R,Jr),t(Jr,My),t(R,_y),t(R,ms),t(ms,wy),t(ms,Gl),t(Gl,Jy),t(ms,ky),t(R,Ty),t(R,Ce),y(hs,Ce,null),t(Ce,vy),t(Ce,kr),t(kr,Uy),t(Ce,jy),y(an,Ce,null),t(R,Iy),t(R,sn),y(gs,sn,null),t(sn,Zy),t(sn,se),t(se,Wy),t(se,Tr),t(Tr,Gy),t(se,Ey),t(se,vr),t(vr,By),t(se,Vy),t(se,Ur),t(Ur,Py),t(se,Cy),t(se,jr),t(jr,$y),t(se,xy),t(R,Ry),t(R,ln),y(us,ln,null),t(ln,Xy),t(ln,fs),t(fs,Fy),t(fs,Ir),t(Ir,Qy),t(fs,Ny),c(e,Rc,r),c(e,gt,r),t(gt,on),t(on,Zr),y(ys,Zr,null),t(gt,Yy),t(gt,Wr),t(Wr,Ky),c(e,Xc,r),c(e,X,r),y(bs,X,null),t(X,Sy),t(X,Gr),t(Gr,qy),t(X,Dy),t(X,Ms),t(Ms,zy),t(Ms,El),t(El,Hy),t(Ms,Ay),t(X,Ly),t(X,$e),y(_s,$e,null),t($e,Oy),t($e,Er),t(Er,eb),t($e,tb),y(rn,$e,null),t(X,nb),t(X,pn),y(ws,pn,null),t(pn,ab),t(pn,ie),t(ie,sb),t(ie,Br),t(Br,ib),t(ie,lb),t(ie,Vr),t(Vr,ob),t(ie,rb),t(ie,Pr),t(Pr,pb),t(ie,db),t(ie,Cr),t(Cr,cb),t(ie,mb),t(X,hb),t(X,dn),y(Js,dn,null),t(dn,gb),t(dn,ks),t(ks,ub),t(ks,$r),t($r,fb),t(ks,yb),c(e,Fc,r),c(e,ut,r),t(ut,cn),t(cn,xr),y(Ts,xr,null),t(ut,bb),t(ut,Rr),t(Rr,Mb),c(e,Qc,r),c(e,F,r),y(vs,F,null),t(F,_b),t(F,Xr),t(Xr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K,Gn),y(ai,Gn,null),t(Gn,j_),t(Gn,re),t(re,I_),t(re,kp),t(kp,Z_),t(re,W_),t(re,Tp),t(Tp,G_),t(re,E_),t(re,vp),t(vp,B_),t(re,V_),t(re,Up),t(Up,P_),t(re,C_),t(K,$_),t(K,En),y(si,En,null),t(En,x_),t(En,ii),t(ii,R_),t(ii,jp),t(jp,X_),t(ii,F_),c(e,em,r),c(e,wt,r),t(wt,Bn),t(Bn,Ip),y(li,Ip,null),t(wt,Q_),t(wt,Zp),t(Zp,N_),c(e,tm,r),c(e,S,r),y(oi,S,null),t(S,Y_),t(S,Wp),t(Wp,K_),t(S,S_),t(S,ri),t(ri,q_),t(ri,Rl),t(Rl,D_),t(ri,z_),t(S,H_),t(S,Ke),y(pi,Ke,null),t(Ke,A_),t(Ke,Gp),t(Gp,L_),t(Ke,O_),y(Vn,Ke,null),t(S,e2),t(S,Pn),y(di,Pn,null),t(Pn,t2),t(Pn,pe),t(pe,n2),t(pe,Ep),t(Ep,a2),t(pe,s2),t(pe,Bp),t(Bp,i2),t(pe,l2),t(pe,Vp),t(Vp,o2),t(pe,r2),t(pe,Pp),t(Pp,p2),t(pe,d2),t(S,c2),t(S,Cn),y(ci,Cn,null),t(Cn,m2),t(Cn,mi),t(mi,h2),t(mi,Cp),t(Cp,g2),t(mi,u2),c(e,nm,r),c(e,Jt,r),t(Jt,$n),t($n,$p),y(hi,$p,null),t(Jt,f2),t(Jt,xp),t(xp,y2),c(e,am,r),c(e,q,r),y(gi,q,null),t(q,b2),t(q,Rp),t(Rp,M2),t(q,_2),t(q,ui),t(ui,w2),t(ui,Xl),t(Xl,J2),t(ui,k2),t(q,T2),t(q,Se),y(fi,Se,null),t(Se,v2),t(Se,Xp),t(Xp,U2),t(Se,j2),y(xn,Se,null),t(q,I2),t(q,Rn),y(yi,Rn,null),t(Rn,Z2),t(Rn,de),t(de,W2),t(de,Fp),t(Fp,G2),t(de,E2),t(de,Qp),t(Qp,B2),t(de,V2),t(de,Np),t(Np,P2),t(de,C2),t(de,Yp),t(Yp,$2),t(de,x2),t(q,R2),t(q,Xn),y(bi,Xn,null),t(Xn,X2),t(Xn,Mi),t(Mi,F2),t(Mi,Kp),t(Kp,Q2),t(Mi,N2),sm=!0},p(e,[r]){const _i={};r&2&&(_i.$$scope={dirty:r,ctx:e}),It.$set(_i);const Sp={};r&2&&(Sp.$$scope={dirty:r,ctx:e}),Zt.$set(Sp);const qp={};r&2&&(qp.$$scope={dirty:r,ctx:e}),Ot.$set(qp);const Dp={};r&2&&(Dp.$$scope={dirty:r,ctx:e}),an.$set(Dp);const wi={};r&2&&(wi.$$scope={dirty:r,ctx:e}),rn.$set(wi);const zp={};r&2&&(zp.$$scope={dirty:r,ctx:e}),mn.$set(zp);const Hp={};r&2&&(Hp.$$scope={dirty:r,ctx:e}),yn.$set(Hp);const Ap={};r&2&&(Ap.$$scope={dirty:r,ctx:e}),Jn.$set(Ap);const kt={};r&2&&(kt.$$scope={dirty:r,ctx:e}),kn.$set(kt);const Lp={};r&2&&(Lp.$$scope={dirty:r,ctx:e}),Un.$set(Lp);const Op={};r&2&&(Op.$$scope={dirty:r,ctx:e}),jn.$set(Op);const Ji={};r&2&&(Ji.$$scope={dirty:r,ctx:e}),Wn.$set(Ji);const ed={};r&2&&(ed.$$scope={dirty:r,ctx:e}),Vn.$set(ed);const C={};r&2&&(C.$$scope={dirty:r,ctx:e}),xn.$set(C)},i(e){sm||(b(h.$$.fragment,e),b(A.$$.fragment,e),b(ea.$$.fragment,e),b(ta.$$.fragment,e),b(aa.$$.fragment,e),b(sa.$$.fragment,e),b(It.$$.fragment,e),b(ia.$$.fragment,e),b(Zt.$$.fragment,e),b(la.$$.fragment,e),b(oa.$$.fragment,e),b(ra.$$.fragment,e),b(pa.$$.fragment,e),b(da.$$.fragment,e),b(ca.$$.fragment,e),b(ma.$$.fragment,e),b(ha.$$.fragment,e),b(ga.$$.fragment,e),b(ua.$$.fragment,e),b(fa.$$.fragment,e),b(ya.$$.fragment,e),b(ba.$$.fragment,e),b(Ma.$$.fragment,e),b(_a.$$.fragment,e),b(wa.$$.fragment,e),b(Ja.$$.fragment,e),b(ka.$$.fragment,e),b(va.$$.fragment,e),b(Ua.$$.fragment,e),b(ja.$$.fragment,e),b(Ia.$$.fragment,e),b(Za.$$.fragment,e),b(Wa.$$.fragment,e),b(Ga.$$.fragment,e),b(Ba.$$.fragment,e),b(Pa.$$.fragment,e),b(Ca.$$.fragment,e),b($a.$$.fragment,e),b(Ra.$$.fragment,e),b(as.$$.fragment,e),b(ss.$$.fragment,e),b(ls.$$.fragment,e),b(Ot.$$.fragment,e),b(os.$$.fragment,e),b(rs.$$.fragment,e),b(ds.$$.fragment,e),b(cs.$$.fragment,e),b(hs.$$.fragment,e),b(an.$$.fragment,e),b(gs.$$.fragment,e),b(us.$$.fragment,e),b(ys.$$.fragment,e),b(bs.$$.fragment,e),b(_s.$$.fragment,e),b(rn.$$.fragment,e),b(ws.$$.fragment,e),b(Js.$$.fragment,e),b(Ts.$$.fragment,e),b(vs.$$.fragment,e),b(js.$$.fragment,e),b(mn.$$.fragment,e),b(Is.$$.fragment,e),b(Zs.$$.fragment,e),b(Gs.$$.fragment,e),b(Es.$$.fragment,e),b(Vs.$$.fragment,e),b(yn.$$.fragment,e),b(Ps.$$.fragment,e),b(Cs.$$.fragment,e),b(xs.$$.fragment,e),b(Rs.$$.fragment,e),b(Xs.$$.fragment,e),b(Qs.$$.fragment,e),b(Jn.$$.fragment,e),b(Ns.$$.fragment,e),b(kn.$$.fragment,e),b(Ys.$$.fragment,e),b(Ss.$$.fragment,e),b(qs.$$.fragment,e),b(zs.$$.fragment,e),b(Un.$$.fragment,e),b(Hs.$$.fragment,e),b(jn.$$.fragment,e),b(As.$$.fragment,e),b(Os.$$.fragment,e),b(ei.$$.fragment,e),b(ni.$$.fragment,e),b(Wn.$$.fragment,e),b(ai.$$.fragment,e),b(si.$$.fragment,e),b(li.$$.fragment,e),b(oi.$$.fragment,e),b(pi.$$.fragment,e),b(Vn.$$.fragment,e),b(di.$$.fragment,e),b(ci.$$.fragment,e),b(hi.$$.fragment,e),b(gi.$$.fragment,e),b(fi.$$.fragment,e),b(xn.$$.fragment,e),b(yi.$$.fragment,e),b(bi.$$.fragment,e),sm=!0)},o(e){M(h.$$.fragment,e),M(A.$$.fragment,e),M(ea.$$.fragment,e),M(ta.$$.fragment,e),M(aa.$$.fragment,e),M(sa.$$.fragment,e),M(It.$$.fragment,e),M(ia.$$.fragment,e),M(Zt.$$.fragment,e),M(la.$$.fragment,e),M(oa.$$.fragment,e),M(ra.$$.fragment,e),M(pa.$$.fragment,e),M(da.$$.fragment,e),M(ca.$$.fragment,e),M(ma.$$.fragment,e),M(ha.$$.fragment,e),M(ga.$$.fragment,e),M(ua.$$.fragment,e),M(fa.$$.fragment,e),M(ya.$$.fragment,e),M(ba.$$.fragment,e),M(Ma.$$.fragment,e),M(_a.$$.fragment,e),M(wa.$$.fragment,e),M(Ja.$$.fragment,e),M(ka.$$.fragment,e),M(va.$$.fragment,e),M(Ua.$$.fragment,e),M(ja.$$.fragment,e),M(Ia.$$.fragment,e),M(Za.$$.fragment,e),M(Wa.$$.fragment,e),M(Ga.$$.fragment,e),M(Ba.$$.fragment,e),M(Pa.$$.fragment,e),M(Ca.$$.fragment,e),M($a.$$.fragment,e),M(Ra.$$.fragment,e),M(as.$$.fragment,e),M(ss.$$.fragment,e),M(ls.$$.fragment,e),M(Ot.$$.fragment,e),M(os.$$.fragment,e),M(rs.$$.fragment,e),M(ds.$$.fragment,e),M(cs.$$.fragment,e),M(hs.$$.fragment,e),M(an.$$.fragment,e),M(gs.$$.fragment,e),M(us.$$.fragment,e),M(ys.$$.fragment,e),M(bs.$$.fragment,e),M(_s.$$.fragment,e),M(rn.$$.fragment,e),M(ws.$$.fragment,e),M(Js.$$.fragment,e),M(Ts.$$.fragment,e),M(vs.$$.fragment,e),M(js.$$.fragment,e),M(mn.$$.fragment,e),M(Is.$$.fragment,e),M(Zs.$$.fragment,e),M(Gs.$$.fragment,e),M(Es.$$.fragment,e),M(Vs.$$.fragment,e),M(yn.$$.fragment,e),M(Ps.$$.fragment,e),M(Cs.$$.fragment,e),M(xs.$$.fragment,e),M(Rs.$$.fragment,e),M(Xs.$$.fragment,e),M(Qs.$$.fragment,e),M(Jn.$$.fragment,e),M(Ns.$$.fragment,e),M(kn.$$.fragment,e),M(Ys.$$.fragment,e),M(Ss.$$.fragment,e),M(qs.$$.fragment,e),M(zs.$$.fragment,e),M(Un.$$.fragment,e),M(Hs.$$.fragment,e),M(jn.$$.fragment,e),M(As.$$.fragment,e),M(Os.$$.fragment,e),M(ei.$$.fragment,e),M(ni.$$.fragment,e),M(Wn.$$.fragment,e),M(ai.$$.fragment,e),M(si.$$.fragment,e),M(li.$$.fragment,e),M(oi.$$.fragment,e),M(pi.$$.fragment,e),M(Vn.$$.fragment,e),M(di.$$.fragment,e),M(ci.$$.fragment,e),M(hi.$$.fragment,e),M(gi.$$.fragment,e),M(fi.$$.fragment,e),M(xn.$$.fragment,e),M(yi.$$.fragment,e),M(bi.$$.fragment,e),sm=!1},d(e){n(g),e&&n(v),e&&n(k),_(h),e&&n(te),e&&n(Z),_(A),e&&n(We),e&&n(L),e&&n(W),e&&n(G),e&&n(Ie),e&&n(V),e&&n(td),e&&n(nt),_(ea),e&&n(nd),e&&n(Ii),e&&n(ad),e&&n(at),_(ta),e&&n(sd),e&&n(ge),e&&n(id),_(aa,e),e&&n(ld),e&&n(Gi),e&&n(od),_(sa,e),e&&n(rd),_(It,e),e&&n(pd),e&&n(Ei),e&&n(dd),_(ia,e),e&&n(cd),_(Zt,e),e&&n(md),e&&n(Wt),e&&n(hd),_(la,e),e&&n(gd),e&&n(Bi),e&&n(ud),e&&n(Vi),e&&n(fd),e&&n(Ci),e&&n(yd),_(oa,e),e&&n(bd),e&&n($i),e&&n(Md),_(ra,e),e&&n(_d),e&&n(Ri),e&&n(wd),_(pa,e),e&&n(Jd),e&&n(Fi),e&&n(kd),_(da,e),e&&n(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e&&n(Pe),e&&n(Gc),_($a,e),e&&n(Ec),e&&n(Dt),e&&n(Bc),e&&n(ct),_(Ra),e&&n(Vc),e&&n(Ht),e&&n(Pc),e&&n(mt),_(as),e&&n(Cc),e&&n(x),_(ss),_(ls),_(Ot),_(os),_(rs),e&&n($c),e&&n(ht),_(ds),e&&n(xc),e&&n(R),_(cs),_(hs),_(an),_(gs),_(us),e&&n(Rc),e&&n(gt),_(ys),e&&n(Xc),e&&n(X),_(bs),_(_s),_(rn),_(ws),_(Js),e&&n(Fc),e&&n(ut),_(Ts),e&&n(Qc),e&&n(F),_(vs),_(js),_(mn),_(Is),_(Zs),e&&n(Nc),e&&n(ft),_(Gs),e&&n(Yc),e&&n(Q),_(Es),_(Vs),_(yn),_(Ps),_(Cs),e&&n(Kc),e&&n(yt),_(xs),e&&n(Sc),e&&n(Pl),e&&n(qc),e&&n(Re),e&&n(Dc),e&&n(bt),_(Rs),e&&n(zc),e&&n(N),_(Xs),_(Qs),_(Jn),_(Ns),_(kn),_(Ys),e&&n(Hc),e&&n(Mt),_(Ss),e&&n(Ac),e&&n(Y),_(qs),_(zs),_(Un),_(Hs),_(jn),_(As),e&&n(Lc),e&&n(_t),_(Os),e&&n(Oc),e&&n(K),_(ei),_(ni),_(Wn),_(ai),_(si),e&&n(em),e&&n(wt),_(li),e&&n(tm),e&&n(S),_(oi),_(pi),_(Vn),_(di),_(ci),e&&n(nm),e&&n(Jt),_(hi),e&&n(am),e&&n(q),_(gi),_(fi),_(xn),_(yi),_(bi)}}}const eU={local:"kandinsky",sections:[{local:"overview",title:"Overview"},{local:"usage-example",sections:[{local:"texttoimage-generation",title:"Text-to-Image Generation"},{local:"text-guided-imagetoimage-generation",title:"Text Guided Image-to-Image Generation"},{local:"text-guided-inpainting-generation",title:"Text Guided Inpainting Generation"},{local:"interpolate",title:"Interpolate "},{local:"texttoimage-generation-with-controlnet-conditioning",title:"Text-to-Image Generation with ControlNet Conditioning"},{local:"imagetoimage-generation-with-controlnet-conditioning",title:"Image-to-Image Generation with ControlNet Conditioning"}],title:"Usage example"},{local:"kandinsky-22",title:"Kandinsky 2.2"},{local:"optimization",title:"Optimization"},{local:"available-pipelines",sections:[{local:"diffusers.KandinskyV22Pipeline",title:"KandinskyV22Pipeline"},{local:"diffusers.KandinskyV22ControlnetPipeline",title:"KandinskyV22ControlnetPipeline"},{local:"diffusers.KandinskyV22ControlnetImg2ImgPipeline",title:"KandinskyV22ControlnetImg2ImgPipeline"},{local:"diffusers.KandinskyV22Img2ImgPipeline",title:"KandinskyV22Img2ImgPipeline"},{local:"diffusers.KandinskyV22InpaintPipeline",title:"KandinskyV22InpaintPipeline"},{local:"kandinskyv22priorpipeline",title:"KandinskyV22PriorPipeline"},{local:"diffusers.KandinskyV22PriorEmb2EmbPipeline",title:"KandinskyV22PriorEmb2EmbPipeline"},{local:"diffusers.KandinskyPriorPipeline",title:"KandinskyPriorPipeline"},{local:"diffusers.KandinskyPipeline",title:"KandinskyPipeline"},{local:"diffusers.KandinskyImg2ImgPipeline",title:"KandinskyImg2ImgPipeline"},{local:"diffusers.KandinskyInpaintPipeline",title:"KandinskyInpaintPipeline"}],title:"Available Pipelines:"}],title:"Kandinsky"};function tU(I){return xv(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class rU extends Vv{constructor(g){super();Pv(this,g,tU,Ov,Cv,{})}}export{rU as default,eU as metadata};
