import{S as oi,i as si,s as ii,e as s,k as p,w as T,t as a,M as li,c as i,d as t,m as f,a as l,x as J,h as o,b as h,G as e,g as M,y as k,q as $,o as U,B as S,v as ri,L as on}from"../../../../chunks/vendor-hf-doc-builder.js";import{T as nn}from"../../../../chunks/Tip-hf-doc-builder.js";import{D as B}from"../../../../chunks/Docstring-hf-doc-builder.js";import{C as sn}from"../../../../chunks/CodeBlock-hf-doc-builder.js";import{I as ai}from"../../../../chunks/IconCopyLink-hf-doc-builder.js";import{E as an}from"../../../../chunks/ExampleCodeBlock-hf-doc-builder.js";function di(D){let d,b,c,m,y,r,u,I;return{c(){d=s("p"),b=a(`It is recommended to use this pipeline with checkpoints that have been specifically fine-tuned for inpainting, such
as `),c=s("a"),m=a("runwayml/stable-diffusion-inpainting"),y=a(`. Default
text-to-image stable diffusion checkpoints, such as
`),r=s("a"),u=a("runwayml/stable-diffusion-v1-5"),I=a(` are also compatible with
this pipeline, but might be less performant.`),this.h()},l(g){d=i(g,"P",{});var _=l(d);b=o(_,`It is recommended to use this pipeline with checkpoints that have been specifically fine-tuned for inpainting, such
as `),c=i(_,"A",{href:!0,rel:!0});var j=l(c);m=o(j,"runwayml/stable-diffusion-inpainting"),j.forEach(t),y=o(_,`. Default
text-to-image stable diffusion checkpoints, such as
`),r=i(_,"A",{href:!0,rel:!0});var E=l(r);u=o(E,"runwayml/stable-diffusion-v1-5"),E.forEach(t),I=o(_,` are also compatible with
this pipeline, but might be less performant.`),_.forEach(t),this.h()},h(){h(c,"href","https://huggingface.co/runwayml/stable-diffusion-inpainting"),h(c,"rel","nofollow"),h(r,"href","https://huggingface.co/runwayml/stable-diffusion-v1-5"),h(r,"rel","nofollow")},m(g,_){M(g,d,_),e(d,b),e(d,c),e(c,m),e(d,y),e(d,r),e(r,u),e(d,I)},d(g){g&&t(d)}}}function ci(D){let d,b,c,m,y;return m=new sn({props:{code:"aW1wb3J0JTIwUElMJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjBpbyUyMGltcG9ydCUyMEJ5dGVzSU8lMEElMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwU3RhYmxlRGlmZnVzaW9uSW5wYWludFBpcGVsaW5lJTBBJTBBJTBBZGVmJTIwZG93bmxvYWRfaW1hZ2UodXJsKSUzQSUwQSUyMCUyMCUyMCUyMHJlc3BvbnNlJTIwJTNEJTIwcmVxdWVzdHMuZ2V0KHVybCklMEElMjAlMjAlMjAlMjByZXR1cm4lMjBQSUwuSW1hZ2Uub3BlbihCeXRlc0lPKHJlc3BvbnNlLmNvbnRlbnQpKS5jb252ZXJ0KCUyMlJHQiUyMiklMEElMEElMEFpbWdfdXJsJTIwJTNEJTIwJTIyaHR0cHMlM0ElMkYlMkZyYXcuZ2l0aHVidXNlcmNvbnRlbnQuY29tJTJGQ29tcFZpcyUyRmxhdGVudC1kaWZmdXNpb24lMkZtYWluJTJGZGF0YSUyRmlucGFpbnRpbmdfZXhhbXBsZXMlMkZvdmVydHVyZS1jcmVhdGlvbnMtNXNJNmZRZ1lJdW8ucG5nJTIyJTBBbWFza191cmwlMjAlM0QlMjAlMjJodHRwcyUzQSUyRiUyRnJhdy5naXRodWJ1c2VyY29udGVudC5jb20lMkZDb21wVmlzJTJGbGF0ZW50LWRpZmZ1c2lvbiUyRm1haW4lMkZkYXRhJTJGaW5wYWludGluZ19leGFtcGxlcyUyRm92ZXJ0dXJlLWNyZWF0aW9ucy01c0k2ZlFnWUl1b19tYXNrLnBuZyUyMiUwQSUwQWluaXRfaW1hZ2UlMjAlM0QlMjBkb3dubG9hZF9pbWFnZShpbWdfdXJsKS5yZXNpemUoKDUxMiUyQyUyMDUxMikpJTBBbWFza19pbWFnZSUyMCUzRCUyMGRvd25sb2FkX2ltYWdlKG1hc2tfdXJsKS5yZXNpemUoKDUxMiUyQyUyMDUxMikpJTBBJTBBcGlwZSUyMCUzRCUyMFN0YWJsZURpZmZ1c2lvbklucGFpbnRQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIycnVud2F5bWwlMkZzdGFibGUtZGlmZnVzaW9uLWlucGFpbnRpbmclMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYlMEEpJTBBcGlwZSUyMCUzRCUyMHBpcGUudG8oJTIyY3VkYSUyMiklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJGYWNlJTIwb2YlMjBhJTIweWVsbG93JTIwY2F0JTJDJTIwaGlnaCUyMHJlc29sdXRpb24lMkMlMjBzaXR0aW5nJTIwb24lMjBhJTIwcGFyayUyMGJlbmNoJTIyJTBBaW1hZ2UlMjAlM0QlMjBwaXBlKHByb21wdCUzRHByb21wdCUyQyUyMGltYWdlJTNEaW5pdF9pbWFnZSUyQyUyMG1hc2tfaW1hZ2UlM0RtYXNrX2ltYWdlKS5pbWFnZXMlNUIwJTVE",highlighted:`<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> requests
<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> io <span class="hljs-keyword">import</span> BytesIO

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionInpaintPipeline


<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">download_image</span>(<span class="hljs-params">url</span>):
<span class="hljs-meta">... </span>    response = requests.get(url)
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> PIL.Image.<span class="hljs-built_in">open</span>(BytesIO(response.content)).convert(<span class="hljs-string">&quot;RGB&quot;</span>)


<span class="hljs-meta">&gt;&gt;&gt; </span>img_url = <span class="hljs-string">&quot;https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>mask_url = <span class="hljs-string">&quot;https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo_mask.png&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>init_image = download_image(img_url).resize((<span class="hljs-number">512</span>, <span class="hljs-number">512</span>))
<span class="hljs-meta">&gt;&gt;&gt; </span>mask_image = download_image(mask_url).resize((<span class="hljs-number">512</span>, <span class="hljs-number">512</span>))

<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = StableDiffusionInpaintPipeline.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;runwayml/stable-diffusion-inpainting&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>prompt = <span class="hljs-string">&quot;Face of a yellow cat, high resolution, sitting on a park bench&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = pipe(prompt=prompt, image=init_image, mask_image=mask_image).images[<span class="hljs-number">0</span>]`}}),{c(){d=s("p"),b=a("Examples:"),c=p(),T(m.$$.fragment)},l(r){d=i(r,"P",{});var u=l(d);b=o(u,"Examples:"),u.forEach(t),c=f(r),J(m.$$.fragment,r)},m(r,u){M(r,d,u),e(d,b),M(r,c,u),k(m,r,u),y=!0},p:on,i(r){y||($(m.$$.fragment,r),y=!0)},o(r){U(m.$$.fragment,r),y=!1},d(r){r&&t(d),r&&t(c),S(m,r)}}}function pi(D){let d,b,c,m,y;return m=new sn({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRGlmZnVzaW9uUGlwZWxpbmUlMEFmcm9tJTIweGZvcm1lcnMub3BzJTIwaW1wb3J0JTIwTWVtb3J5RWZmaWNpZW50QXR0ZW50aW9uRmxhc2hBdHRlbnRpb25PcCUwQSUwQXBpcGUlMjAlM0QlMjBEaWZmdXNpb25QaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLTItMSUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiklMEFwaXBlJTIwJTNEJTIwcGlwZS50byglMjJjdWRhJTIyKSUwQXBpcGUuZW5hYmxlX3hmb3JtZXJzX21lbW9yeV9lZmZpY2llbnRfYXR0ZW50aW9uKGF0dGVudGlvbl9vcCUzRE1lbW9yeUVmZmljaWVudEF0dGVudGlvbkZsYXNoQXR0ZW50aW9uT3ApJTBBJTIzJTIwV29ya2Fyb3VuZCUyMGZvciUyMG5vdCUyMGFjY2VwdGluZyUyMGF0dGVudGlvbiUyMHNoYXBlJTIwdXNpbmclMjBWQUUlMjBmb3IlMjBGbGFzaCUyMEF0dGVudGlvbiUwQXBpcGUudmFlLmVuYWJsZV94Zm9ybWVyc19tZW1vcnlfZWZmaWNpZW50X2F0dGVudGlvbihhdHRlbnRpb25fb3AlM0ROb25lKQ==",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">from</span> diffusers <span class="hljs-keyword">import</span> DiffusionPipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> xformers.ops <span class="hljs-keyword">import</span> MemoryEfficientAttentionFlashAttentionOp

<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = DiffusionPipeline.from_pretrained(<span class="hljs-string">&quot;stabilityai/stable-diffusion-2-1&quot;</span>, torch_dtype=torch.float16)
<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>pipe.enable_xformers_memory_efficient_attention(attention_op=MemoryEfficientAttentionFlashAttentionOp)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Workaround for not accepting attention shape using VAE for Flash Attention</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe.vae.enable_xformers_memory_efficient_attention(attention_op=<span class="hljs-literal">None</span>)`}}),{c(){d=s("p"),b=a("Examples:"),c=p(),T(m.$$.fragment)},l(r){d=i(r,"P",{});var u=l(d);b=o(u,"Examples:"),u.forEach(t),c=f(r),J(m.$$.fragment,r)},m(r,u){M(r,d,u),e(d,b),M(r,c,u),k(m,r,u),y=!0},p:on,i(r){y||($(m.$$.fragment,r),y=!0)},o(r){U(m.$$.fragment,r),y=!1},d(r){r&&t(d),r&&t(c),S(m,r)}}}function fi(D){let d,b;return{c(){d=s("p"),b=a("This function is experimental and might change in the future.")},l(c){d=i(c,"P",{});var m=l(d);b=o(m,"This function is experimental and might change in the future."),m.forEach(t)},m(c,m){M(c,d,m),e(d,b)},d(c){c&&t(d)}}}function mi(D){let d,b,c,m,y,r,u,I;return{c(){d=s("p"),b=a("It is required to be logged in ("),c=s("code"),m=a("huggingface-cli login"),y=a(") when you want to use private or "),r=s("a"),u=a(`gated
models`),I=a("."),this.h()},l(g){d=i(g,"P",{});var _=l(d);b=o(_,"It is required to be logged in ("),c=i(_,"CODE",{});var j=l(c);m=o(j,"huggingface-cli login"),j.forEach(t),y=o(_,") when you want to use private or "),r=i(_,"A",{href:!0,rel:!0});var E=l(r);u=o(E,`gated
models`),E.forEach(t),I=o(_,"."),_.forEach(t),this.h()},h(){h(r,"href","https://huggingface.co/docs/hub/models-gated#gated-models"),h(r,"rel","nofollow")},m(g,_){M(g,d,_),e(d,b),e(d,c),e(c,m),e(d,y),e(d,r),e(r,u),e(d,I)},d(g){g&&t(d)}}}function ui(D){let d,b,c,m,y,r,u,I;return u=new sn({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFN0YWJsZURpZmZ1c2lvblBpcGVsaW5lJTBBaW1wb3J0JTIwdG9yY2glMEElMEFtb2RlbF9pZCUyMCUzRCUyMCUyMnJ1bndheW1sJTJGc3RhYmxlLWRpZmZ1c2lvbi12MS01JTIyJTBBcGlwZSUyMCUzRCUyMFN0YWJsZURpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZChtb2RlbF9pZCUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNikudG8oJTIyY3VkYSUyMiklMEElMEFwaXBlLmxvYWRfdGV4dHVhbF9pbnZlcnNpb24oJTIyc2QtY29uY2VwdHMtbGlicmFyeSUyRmNhdC10b3klMjIpJTBBJTBBcHJvbXB0JTIwJTNEJTIwJTIyQSUyMCUzQ2NhdC10b3klM0UlMjBiYWNrcGFjayUyMiUwQSUwQWltYWdlJTIwJTNEJTIwcGlwZShwcm9tcHQlMkMlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNENTApLmltYWdlcyU1QjAlNUQlMEFpbWFnZS5zYXZlKCUyMmNhdC1iYWNrcGFjay5wbmclMjIp",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionPipeline
<span class="hljs-keyword">import</span> torch

model_id = <span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16).to(<span class="hljs-string">&quot;cuda&quot;</span>)

pipe.load_textual_inversion(<span class="hljs-string">&quot;sd-concepts-library/cat-toy&quot;</span>)

prompt = <span class="hljs-string">&quot;A &lt;cat-toy&gt; backpack&quot;</span>

image = pipe(prompt, num_inference_steps=<span class="hljs-number">50</span>).images[<span class="hljs-number">0</span>]
image.save(<span class="hljs-string">&quot;cat-backpack.png&quot;</span>)`}}),{c(){d=s("p"),b=a("To load a textual inversion embedding vector in "),c=s("code"),m=a("diffusers"),y=a(" format:"),r=p(),T(u.$$.fragment)},l(g){d=i(g,"P",{});var _=l(d);b=o(_,"To load a textual inversion embedding vector in "),c=i(_,"CODE",{});var j=l(c);m=o(j,"diffusers"),j.forEach(t),y=o(_," format:"),_.forEach(t),r=f(g),J(u.$$.fragment,g)},m(g,_){M(g,d,_),e(d,b),e(d,c),e(c,m),e(d,y),M(g,r,_),k(u,g,_),I=!0},p:on,i(g){I||($(u.$$.fragment,g),I=!0)},o(g){U(u.$$.fragment,g),I=!1},d(g){g&&t(d),g&&t(r),S(u,g)}}}function hi(D){let d,b,c,m,y,r,u,I;return u=new sn({props:{code:"ZnJvbSUyMGRpZmZ1c2VycyUyMGltcG9ydCUyMFN0YWJsZURpZmZ1c2lvblBpcGVsaW5lJTBBaW1wb3J0JTIwdG9yY2glMEElMEFtb2RlbF9pZCUyMCUzRCUyMCUyMnJ1bndheW1sJTJGc3RhYmxlLWRpZmZ1c2lvbi12MS01JTIyJTBBcGlwZSUyMCUzRCUyMFN0YWJsZURpZmZ1c2lvblBpcGVsaW5lLmZyb21fcHJldHJhaW5lZChtb2RlbF9pZCUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNikudG8oJTIyY3VkYSUyMiklMEElMEFwaXBlLmxvYWRfdGV4dHVhbF9pbnZlcnNpb24oJTIyLiUyRmNoYXJ0dXJuZXJ2Mi5wdCUyMiUyQyUyMHRva2VuJTNEJTIyY2hhcnR1cm5lcnYyJTIyKSUwQSUwQXByb21wdCUyMCUzRCUyMCUyMmNoYXJ0dXJuZXJ2MiUyQyUyMG11bHRpcGxlJTIwdmlld3MlMjBvZiUyMHRoZSUyMHNhbWUlMjBjaGFyYWN0ZXIlMjBpbiUyMHRoZSUyMHNhbWUlMjBvdXRmaXQlMkMlMjBhJTIwY2hhcmFjdGVyJTIwdHVybmFyb3VuZCUyMG9mJTIwYSUyMHdvbWFuJTIwd2VhcmluZyUyMGElMjBibGFjayUyMGphY2tldCUyMGFuZCUyMHJlZCUyMHNoaXJ0JTJDJTIwYmVzdCUyMHF1YWxpdHklMkMlMjBpbnRyaWNhdGUlMjBkZXRhaWxzLiUyMiUwQSUwQWltYWdlJTIwJTNEJTIwcGlwZShwcm9tcHQlMkMlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNENTApLmltYWdlcyU1QjAlNUQlMEFpbWFnZS5zYXZlKCUyMmNoYXJhY3Rlci5wbmclMjIp",highlighted:`<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionPipeline
<span class="hljs-keyword">import</span> torch

model_id = <span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>
pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16).to(<span class="hljs-string">&quot;cuda&quot;</span>)

pipe.load_textual_inversion(<span class="hljs-string">&quot;./charturnerv2.pt&quot;</span>, token=<span class="hljs-string">&quot;charturnerv2&quot;</span>)

prompt = <span class="hljs-string">&quot;charturnerv2, multiple views of the same character in the same outfit, a character turnaround of a woman wearing a black jacket and red shirt, best quality, intricate details.&quot;</span>

image = pipe(prompt, num_inference_steps=<span class="hljs-number">50</span>).images[<span class="hljs-number">0</span>]
image.save(<span class="hljs-string">&quot;character.png&quot;</span>)`}}),{c(){d=s("p"),b=a("e.g. from "),c=s("a"),m=a("civitAI"),y=a(" and then load the vector locally:"),r=p(),T(u.$$.fragment),this.h()},l(g){d=i(g,"P",{});var _=l(d);b=o(_,"e.g. from "),c=i(_,"A",{href:!0,rel:!0});var j=l(c);m=o(j,"civitAI"),j.forEach(t),y=o(_," and then load the vector locally:"),_.forEach(t),r=f(g),J(u.$$.fragment,g),this.h()},h(){h(c,"href","https://civitai.com/models/3036?modelVersionId=9857"),h(c,"rel","nofollow")},m(g,_){M(g,d,_),e(d,b),e(d,c),e(c,m),e(d,y),M(g,r,_),k(u,g,_),I=!0},p:on,i(g){I||($(u.$$.fragment,g),I=!0)},o(g){U(u.$$.fragment,g),I=!1},d(g){g&&t(d),g&&t(r),S(u,g)}}}function gi(D){let d,b,c,m,y;return{c(){d=s("p"),b=a("We support loading A1111 formatted LoRA checkpoints in a limited capacity."),c=p(),m=s("p"),y=a("This function is experimental and might change in the future.")},l(r){d=i(r,"P",{});var u=l(d);b=o(u,"We support loading A1111 formatted LoRA checkpoints in a limited capacity."),u.forEach(t),c=f(r),m=i(r,"P",{});var I=l(m);y=o(I,"This function is experimental and might change in the future."),I.forEach(t)},m(r,u){M(r,d,u),e(d,b),M(r,c,u),M(r,m,u),e(m,y)},d(r){r&&t(d),r&&t(c),r&&t(m)}}}function _i(D){let d,b,c,m,y,r,u,I;return{c(){d=s("p"),b=a("It is required to be logged in ("),c=s("code"),m=a("huggingface-cli login"),y=a(") when you want to use private or "),r=s("a"),u=a(`gated
models`),I=a("."),this.h()},l(g){d=i(g,"P",{});var _=l(d);b=o(_,"It is required to be logged in ("),c=i(_,"CODE",{});var j=l(c);m=o(j,"huggingface-cli login"),j.forEach(t),y=o(_,") when you want to use private or "),r=i(_,"A",{href:!0,rel:!0});var E=l(r);u=o(E,`gated
models`),E.forEach(t),I=o(_,"."),_.forEach(t),this.h()},h(){h(r,"href","https://huggingface.co/docs/hub/models-gated#gated-models"),h(r,"rel","nofollow")},m(g,_){M(g,d,_),e(d,b),e(d,c),e(c,m),e(d,y),e(d,r),e(r,u),e(d,I)},d(g){g&&t(d)}}}function bi(D){let d,b,c,m,y;return m=new sn({props:{code:"aW1wb3J0JTIwamF4JTBBaW1wb3J0JTIwbnVtcHklMjBhcyUyMG5wJTBBZnJvbSUyMGZsYXguamF4X3V0aWxzJTIwaW1wb3J0JTIwcmVwbGljYXRlJTBBZnJvbSUyMGZsYXgudHJhaW5pbmcuY29tbW9uX3V0aWxzJTIwaW1wb3J0JTIwc2hhcmQlMEFpbXBvcnQlMjBQSUwlMEFpbXBvcnQlMjByZXF1ZXN0cyUwQWZyb20lMjBpbyUyMGltcG9ydCUyMEJ5dGVzSU8lMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwRmxheFN0YWJsZURpZmZ1c2lvbklucGFpbnRQaXBlbGluZSUwQSUwQSUwQWRlZiUyMGRvd25sb2FkX2ltYWdlKHVybCklM0ElMEElMjAlMjAlMjAlMjByZXNwb25zZSUyMCUzRCUyMHJlcXVlc3RzLmdldCh1cmwpJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwUElMLkltYWdlLm9wZW4oQnl0ZXNJTyhyZXNwb25zZS5jb250ZW50KSkuY29udmVydCglMjJSR0IlMjIpJTBBJTBBJTBBaW1nX3VybCUyMCUzRCUyMCUyMmh0dHBzJTNBJTJGJTJGcmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSUyRkNvbXBWaXMlMkZsYXRlbnQtZGlmZnVzaW9uJTJGbWFpbiUyRmRhdGElMkZpbnBhaW50aW5nX2V4YW1wbGVzJTJGb3ZlcnR1cmUtY3JlYXRpb25zLTVzSTZmUWdZSXVvLnBuZyUyMiUwQW1hc2tfdXJsJTIwJTNEJTIwJTIyaHR0cHMlM0ElMkYlMkZyYXcuZ2l0aHVidXNlcmNvbnRlbnQuY29tJTJGQ29tcFZpcyUyRmxhdGVudC1kaWZmdXNpb24lMkZtYWluJTJGZGF0YSUyRmlucGFpbnRpbmdfZXhhbXBsZXMlMkZvdmVydHVyZS1jcmVhdGlvbnMtNXNJNmZRZ1lJdW9fbWFzay5wbmclMjIlMEElMEFpbml0X2ltYWdlJTIwJTNEJTIwZG93bmxvYWRfaW1hZ2UoaW1nX3VybCkucmVzaXplKCg1MTIlMkMlMjA1MTIpKSUwQW1hc2tfaW1hZ2UlMjAlM0QlMjBkb3dubG9hZF9pbWFnZShtYXNrX3VybCkucmVzaXplKCg1MTIlMkMlMjA1MTIpKSUwQSUwQXBpcGVsaW5lJTJDJTIwcGFyYW1zJTIwJTNEJTIwRmxheFN0YWJsZURpZmZ1c2lvbklucGFpbnRQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIyeHZqaWFydWklMkZzdGFibGUtZGlmZnVzaW9uLTItaW5wYWludGluZyUyMiUwQSklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJGYWNlJTIwb2YlMjBhJTIweWVsbG93JTIwY2F0JTJDJTIwaGlnaCUyMHJlc29sdXRpb24lMkMlMjBzaXR0aW5nJTIwb24lMjBhJTIwcGFyayUyMGJlbmNoJTIyJTBBcHJuZ19zZWVkJTIwJTNEJTIwamF4LnJhbmRvbS5QUk5HS2V5KDApJTBBbnVtX2luZmVyZW5jZV9zdGVwcyUyMCUzRCUyMDUwJTBBJTBBbnVtX3NhbXBsZXMlMjAlM0QlMjBqYXguZGV2aWNlX2NvdW50KCklMEFwcm9tcHQlMjAlM0QlMjBudW1fc2FtcGxlcyUyMColMjAlNUJwcm9tcHQlNUQlMEFpbml0X2ltYWdlJTIwJTNEJTIwbnVtX3NhbXBsZXMlMjAqJTIwJTVCaW5pdF9pbWFnZSU1RCUwQW1hc2tfaW1hZ2UlMjAlM0QlMjBudW1fc2FtcGxlcyUyMColMjAlNUJtYXNrX2ltYWdlJTVEJTBBcHJvbXB0X2lkcyUyQyUyMHByb2Nlc3NlZF9tYXNrZWRfaW1hZ2VzJTJDJTIwcHJvY2Vzc2VkX21hc2tzJTIwJTNEJTIwcGlwZWxpbmUucHJlcGFyZV9pbnB1dHMoJTBBJTIwJTIwJTIwJTIwcHJvbXB0JTJDJTIwaW5pdF9pbWFnZSUyQyUyMG1hc2tfaW1hZ2UlMEEpJTBBJTBBcGFyYW1zJTIwJTNEJTIwcmVwbGljYXRlKHBhcmFtcyklMEFwcm5nX3NlZWQlMjAlM0QlMjBqYXgucmFuZG9tLnNwbGl0KHBybmdfc2VlZCUyQyUyMGpheC5kZXZpY2VfY291bnQoKSklMEFwcm9tcHRfaWRzJTIwJTNEJTIwc2hhcmQocHJvbXB0X2lkcyklMEFwcm9jZXNzZWRfbWFza2VkX2ltYWdlcyUyMCUzRCUyMHNoYXJkKHByb2Nlc3NlZF9tYXNrZWRfaW1hZ2VzKSUwQXByb2Nlc3NlZF9tYXNrcyUyMCUzRCUyMHNoYXJkKHByb2Nlc3NlZF9tYXNrcyklMEElMEFpbWFnZXMlMjAlM0QlMjBwaXBlbGluZSglMEElMjAlMjAlMjAlMjBwcm9tcHRfaWRzJTJDJTIwcHJvY2Vzc2VkX21hc2tzJTJDJTIwcHJvY2Vzc2VkX21hc2tlZF9pbWFnZXMlMkMlMjBwYXJhbXMlMkMlMjBwcm5nX3NlZWQlMkMlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTJDJTIwaml0JTNEVHJ1ZSUwQSkuaW1hZ2VzJTBBaW1hZ2VzJTIwJTNEJTIwcGlwZWxpbmUubnVtcHlfdG9fcGlsKG5wLmFzYXJyYXkoaW1hZ2VzLnJlc2hhcGUoKG51bV9zYW1wbGVzJTJDKSUyMCUyQiUyMGltYWdlcy5zaGFwZSU1Qi0zJTNBJTVEKSkp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> jax
<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> flax.jax_utils <span class="hljs-keyword">import</span> replicate
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> flax.training.common_utils <span class="hljs-keyword">import</span> shard
<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> requests
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> io <span class="hljs-keyword">import</span> BytesIO
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> FlaxStableDiffusionInpaintPipeline


<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">download_image</span>(<span class="hljs-params">url</span>):
<span class="hljs-meta">... </span>    response = requests.get(url)
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> PIL.Image.<span class="hljs-built_in">open</span>(BytesIO(response.content)).convert(<span class="hljs-string">&quot;RGB&quot;</span>)


<span class="hljs-meta">&gt;&gt;&gt; </span>img_url = <span class="hljs-string">&quot;https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo.png&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>mask_url = <span class="hljs-string">&quot;https://raw.githubusercontent.com/CompVis/latent-diffusion/main/data/inpainting_examples/overture-creations-5sI6fQgYIuo_mask.png&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>init_image = download_image(img_url).resize((<span class="hljs-number">512</span>, <span class="hljs-number">512</span>))
<span class="hljs-meta">&gt;&gt;&gt; </span>mask_image = download_image(mask_url).resize((<span class="hljs-number">512</span>, <span class="hljs-number">512</span>))

<span class="hljs-meta">&gt;&gt;&gt; </span>pipeline, params = FlaxStableDiffusionInpaintPipeline.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;xvjiarui/stable-diffusion-2-inpainting&quot;</span>
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;Face of a yellow cat, high resolution, sitting on a park bench&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>prng_seed = jax.random.PRNGKey(<span class="hljs-number">0</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>num_inference_steps = <span class="hljs-number">50</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>num_samples = jax.device_count()
<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = num_samples * [prompt]
<span class="hljs-meta">&gt;&gt;&gt; </span>init_image = num_samples * [init_image]
<span class="hljs-meta">&gt;&gt;&gt; </span>mask_image = num_samples * [mask_image]
<span class="hljs-meta">&gt;&gt;&gt; </span>prompt_ids, processed_masked_images, processed_masks = pipeline.prepare_inputs(
<span class="hljs-meta">... </span>    prompt, init_image, mask_image
<span class="hljs-meta">... </span>)
<span class="hljs-comment"># shard inputs and rng</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>params = replicate(params)
<span class="hljs-meta">&gt;&gt;&gt; </span>prng_seed = jax.random.split(prng_seed, jax.device_count())
<span class="hljs-meta">&gt;&gt;&gt; </span>prompt_ids = shard(prompt_ids)
<span class="hljs-meta">&gt;&gt;&gt; </span>processed_masked_images = shard(processed_masked_images)
<span class="hljs-meta">&gt;&gt;&gt; </span>processed_masks = shard(processed_masks)

<span class="hljs-meta">&gt;&gt;&gt; </span>images = pipeline(
<span class="hljs-meta">... </span>    prompt_ids, processed_masks, processed_masked_images, params, prng_seed, num_inference_steps, jit=<span class="hljs-literal">True</span>
<span class="hljs-meta">... </span>).images
<span class="hljs-meta">&gt;&gt;&gt; </span>images = pipeline.numpy_to_pil(np.asarray(images.reshape((num_samples,) + images.shape[-<span class="hljs-number">3</span>:])))`}}),{c(){d=s("p"),b=a("Examples:"),c=p(),T(m.$$.fragment)},l(r){d=i(r,"P",{});var u=l(d);b=o(u,"Examples:"),u.forEach(t),c=f(r),J(m.$$.fragment,r)},m(r,u){M(r,d,u),e(d,b),M(r,c,u),k(m,r,u),y=!0},p:on,i(r){y||($(m.$$.fragment,r),y=!0)},o(r){U(m.$$.fragment,r),y=!1},d(r){r&&t(d),r&&t(c),S(m,r)}}}function yi(D){let d,b,c,m,y,r,u,I,g,_,j,E,mt,ge,En,ut,Zn,ln,Z,Wn,_e,Fn,Gn,be,Cn,Nn,ye,Bn,Xn,ve,Vn,Rn,Ke,Ln,An,rn,et,Yn,dn,H,we,ht,zn,Qn,xe,qn,Hn,Me,gt,On,Kn,Ie,ea,cn,tt,ta,pn,O,Te,_t,na,aa,Je,oa,sa,ke,bt,ia,la,$e,ra,fn,w,Ue,da,yt,ca,pa,Se,fa,nt,ma,ua,ha,vt,ga,_a,je,De,wt,ba,ya,at,va,wa,Pe,xt,xa,Ma,ot,Ia,Ta,Mt,Ja,ka,It,Ee,Tt,$a,Ua,st,Sa,ja,K,Da,V,Ze,Pa,Jt,Ea,Za,ee,Wa,R,We,Fa,kt,Ga,Ca,$t,Na,Ba,te,Fe,Xa,Ge,Va,Ut,Ra,La,Aa,G,Ce,Ya,St,za,Qa,jt,qa,Ha,Dt,Oa,Ka,ne,eo,ae,Ne,to,Pt,no,ao,P,Be,oo,z,so,Et,io,lo,Zt,ro,co,po,oe,fo,se,mo,Wt,uo,ho,ie,go,Ft,_o,bo,le,yo,X,Xe,vo,Q,wo,it,xo,Mo,Ve,Gt,Io,To,Jo,re,ko,de,$o,ce,Re,Uo,Ct,So,jo,pe,Le,Do,C,Po,Nt,Eo,Zo,Bt,Wo,Fo,Xt,Go,Co,Vt,No,Bo,Xo,fe,Ae,Vo,q,Ro,Rt,Lo,Ao,Lt,Yo,zo,mn,N,Ye,Qo,ze,qo,At,Ho,Oo,Ko,Qe,es,Yt,ts,ns,as,L,qe,os,zt,ss,is,me,un;return r=new ai({}),ge=new ai({}),Ue=new B({props:{name:"class diffusers.StableDiffusionInpaintPipeline",anchor:"diffusers.StableDiffusionInpaintPipeline",parameters:[{name:"vae",val:": AutoencoderKL"},{name:"text_encoder",val:": CLIPTextModel"},{name:"tokenizer",val:": CLIPTokenizer"},{name:"unet",val:": UNet2DConditionModel"},{name:"scheduler",val:": KarrasDiffusionSchedulers"},{name:"safety_checker",val:": StableDiffusionSafetyChecker"},{name:"feature_extractor",val:": CLIPImageProcessor"},{name:"requires_safety_checker",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.StableDiffusionInpaintPipeline.vae",description:`<strong>vae</strong> (<a href="/docs/diffusers/v0.17.0/en/api/models#diffusers.AutoencoderKL">AutoencoderKL</a>) &#x2014;
Variational Auto-Encoder (VAE) Model to encode and decode images to and from latent representations.`,name:"vae"},{anchor:"diffusers.StableDiffusionInpaintPipeline.text_encoder",description:`<strong>text_encoder</strong> (<code>CLIPTextModel</code>) &#x2014;
Frozen text-encoder. Stable Diffusion uses the text portion of
<a href="https://huggingface.co/docs/transformers/model_doc/clip#transformers.CLIPTextModel" rel="nofollow">CLIP</a>, specifically
the <a href="https://huggingface.co/openai/clip-vit-large-patch14" rel="nofollow">clip-vit-large-patch14</a> variant.`,name:"text_encoder"},{anchor:"diffusers.StableDiffusionInpaintPipeline.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.StableDiffusionInpaintPipeline.unet",description:'<strong>unet</strong> (<a href="/docs/diffusers/v0.17.0/en/api/models#diffusers.UNet2DConditionModel">UNet2DConditionModel</a>) &#x2014; Conditional U-Net architecture to denoise the encoded image latents.',name:"unet"},{anchor:"diffusers.StableDiffusionInpaintPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/v0.17.0/en/api/schedulers/overview#diffusers.SchedulerMixin">SchedulerMixin</a>) &#x2014;
A scheduler to be used in combination with <code>unet</code> to denoise the encoded image latents. Can be one of
<a href="/docs/diffusers/v0.17.0/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>, <a href="/docs/diffusers/v0.17.0/en/api/schedulers/lms_discrete#diffusers.LMSDiscreteScheduler">LMSDiscreteScheduler</a>, or <a href="/docs/diffusers/v0.17.0/en/api/schedulers/pndm#diffusers.PNDMScheduler">PNDMScheduler</a>.`,name:"scheduler"},{anchor:"diffusers.StableDiffusionInpaintPipeline.safety_checker",description:`<strong>safety_checker</strong> (<code>StableDiffusionSafetyChecker</code>) &#x2014;
Classification module that estimates whether generated images could be considered offensive or harmful.
Please, refer to the <a href="https://huggingface.co/runwayml/stable-diffusion-v1-5" rel="nofollow">model card</a> for details.`,name:"safety_checker"},{anchor:"diffusers.StableDiffusionInpaintPipeline.feature_extractor",description:`<strong>feature_extractor</strong> (<code>CLIPImageProcessor</code>) &#x2014;
Model that extracts features from generated images to be used as inputs for the <code>safety_checker</code>.`,name:"feature_extractor"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.0/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py#L156"}}),K=new nn({props:{$$slots:{default:[di]},$$scope:{ctx:D}}}),Ze=new B({props:{name:"__call__",anchor:"diffusers.StableDiffusionInpaintPipeline.__call__",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]] = None"},{name:"image",val:": typing.Union[torch.FloatTensor, PIL.Image.Image] = None"},{name:"mask_image",val:": typing.Union[torch.FloatTensor, PIL.Image.Image] = None"},{name:"height",val:": typing.Optional[int] = None"},{name:"width",val:": typing.Optional[int] = None"},{name:"strength",val:": float = 1.0"},{name:"num_inference_steps",val:": int = 50"},{name:"guidance_scale",val:": float = 7.5"},{name:"negative_prompt",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"num_images_per_prompt",val:": typing.Optional[int] = 1"},{name:"eta",val:": float = 0.0"},{name:"generator",val:": typing.Union[torch._C.Generator, typing.List[torch._C.Generator], NoneType] = None"},{name:"latents",val:": typing.Optional[torch.FloatTensor] = None"},{name:"prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"negative_prompt_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"output_type",val:": typing.Optional[str] = 'pil'"},{name:"return_dict",val:": bool = True"},{name:"callback",val:": typing.Union[typing.Callable[[int, int, torch.FloatTensor], NoneType], NoneType] = None"},{name:"callback_steps",val:": int = 1"},{name:"cross_attention_kwargs",val:": typing.Union[typing.Dict[str, typing.Any], NoneType] = None"}],parametersDescription:[{anchor:"diffusers.StableDiffusionInpaintPipeline.__call__.prompt",description:`<strong>prompt</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
The prompt or prompts to guide the image generation. If not defined, one has to pass <code>prompt_embeds</code>.
instead.`,name:"prompt"},{anchor:"diffusers.StableDiffusionInpaintPipeline.__call__.image",description:`<strong>image</strong> (<code>PIL.Image.Image</code>) &#x2014;
<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>.`,name:"image"},{anchor:"diffusers.StableDiffusionInpaintPipeline.__call__.mask_image",description:`<strong>mask_image</strong> (<code>PIL.Image.Image</code>) &#x2014;
<code>Image</code>, or tensor representing an image batch, to mask <code>image</code>. White pixels in the mask will be
repainted, while black 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>.`,name:"mask_image"},{anchor:"diffusers.StableDiffusionInpaintPipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, <em>optional</em>, defaults to self.unet.config.sample_size * self.vae_scale_factor) &#x2014;
The height in pixels of the generated image.`,name:"height"},{anchor:"diffusers.StableDiffusionInpaintPipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>, <em>optional</em>, defaults to self.unet.config.sample_size * self.vae_scale_factor) &#x2014;
The width in pixels of the generated image.`,name:"width"},{anchor:"diffusers.StableDiffusionInpaintPipeline.__call__.strength",description:`<strong>strength</strong> (<code>float</code>, <em>optional</em>, defaults to 1.) &#x2014;
Conceptually, indicates how much to transform the masked portion of 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 the masked
portion of the reference <code>image</code>.`,name:"strength"},{anchor:"diffusers.StableDiffusionInpaintPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 50) &#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.StableDiffusionInpaintPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 7.5) &#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.StableDiffusionInpaintPipeline.__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. If not defined, one has to pass
<code>negative_prompt_embeds</code>. instead. Ignored when not using guidance (i.e., ignored if <code>guidance_scale</code>
is less than <code>1</code>).`,name:"negative_prompt"},{anchor:"diffusers.StableDiffusionInpaintPipeline.__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.StableDiffusionInpaintPipeline.__call__.eta",description:`<strong>eta</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
Corresponds to parameter eta (&#x3B7;) in the DDIM paper: <a href="https://arxiv.org/abs/2010.02502" rel="nofollow">https://arxiv.org/abs/2010.02502</a>. Only applies to
<a href="/docs/diffusers/v0.17.0/en/api/schedulers/ddim#diffusers.DDIMScheduler">schedulers.DDIMScheduler</a>, will be ignored for others.`,name:"eta"},{anchor:"diffusers.StableDiffusionInpaintPipeline.__call__.generator",description:`<strong>generator</strong> (<code>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.StableDiffusionInpaintPipeline.__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.StableDiffusionInpaintPipeline.__call__.prompt_embeds",description:`<strong>prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt weighting. If not
provided, text embeddings will be generated from <code>prompt</code> input argument.`,name:"prompt_embeds"},{anchor:"diffusers.StableDiffusionInpaintPipeline.__call__.negative_prompt_embeds",description:`<strong>negative_prompt_embeds</strong> (<code>torch.FloatTensor</code>, <em>optional</em>) &#x2014;
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, <em>e.g.</em> prompt
weighting. If not provided, negative_prompt_embeds will be generated from <code>negative_prompt</code> input
argument.`,name:"negative_prompt_embeds"},{anchor:"diffusers.StableDiffusionInpaintPipeline.__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
<a href="https://pillow.readthedocs.io/en/stable/" rel="nofollow">PIL</a>: <code>PIL.Image.Image</code> or <code>np.array</code>.`,name:"output_type"},{anchor:"diffusers.StableDiffusionInpaintPipeline.__call__.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to return a <a href="/docs/diffusers/v0.17.0/en/api/pipelines/stable_diffusion/overview#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput">StableDiffusionPipelineOutput</a> instead of a
plain tuple.`,name:"return_dict"},{anchor:"diffusers.StableDiffusionInpaintPipeline.__call__.callback",description:`<strong>callback</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
A function that will be called every <code>callback_steps</code> steps during inference. The function will be
called with the following arguments: <code>callback(step: int, timestep: int, latents: torch.FloatTensor)</code>.`,name:"callback"},{anchor:"diffusers.StableDiffusionInpaintPipeline.__call__.callback_steps",description:`<strong>callback_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
The frequency at which the <code>callback</code> function will be called. If not specified, the callback will be
called at every step.`,name:"callback_steps"},{anchor:"diffusers.StableDiffusionInpaintPipeline.__call__.cross_attention_kwargs",description:`<strong>cross_attention_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
A kwargs dictionary that if specified is passed along to the <code>AttentionProcessor</code> as defined under
<code>self.processor</code> in
<a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/cross_attention.py" rel="nofollow">diffusers.cross_attention</a>.`,name:"cross_attention_kwargs"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.0/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py#L742",returnDescription:`
<p><a
  href="/docs/diffusers/v0.17.0/en/api/pipelines/stable_diffusion/overview#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"
>StableDiffusionPipelineOutput</a> if <code>return_dict</code> is True, otherwise a <code>tuple. When returning a tuple, the first element is a list with the generated images, and the second element is a list of </code>bool<code>s denoting whether the corresponding generated image likely represents "not-safe-for-work" (nsfw) content, according to the </code>safety_checker\`.</p>
`,returnType:`
<p><a
  href="/docs/diffusers/v0.17.0/en/api/pipelines/stable_diffusion/overview#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"
>StableDiffusionPipelineOutput</a> or <code>tuple</code></p>
`}}),ee=new an({props:{anchor:"diffusers.StableDiffusionInpaintPipeline.__call__.example",$$slots:{default:[ci]},$$scope:{ctx:D}}}),We=new B({props:{name:"enable_attention_slicing",anchor:"diffusers.StableDiffusionInpaintPipeline.enable_attention_slicing",parameters:[{name:"slice_size",val:": typing.Union[str, int, NoneType] = 'auto'"}],parametersDescription:[{anchor:"diffusers.StableDiffusionInpaintPipeline.enable_attention_slicing.slice_size",description:`<strong>slice_size</strong> (<code>str</code> or <code>int</code>, <em>optional</em>, defaults to <code>&quot;auto&quot;</code>) &#x2014;
When <code>&quot;auto&quot;</code>, halves the input to the attention heads, so attention will be computed in two steps. If
<code>&quot;max&quot;</code>, maximum amount of memory will be saved by running only one slice at a time. If a number is
provided, uses as many slices as <code>attention_head_dim // slice_size</code>. In this case, <code>attention_head_dim</code>
must be a multiple of <code>slice_size</code>.`,name:"slice_size"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.0/src/diffusers/pipelines/pipeline_utils.py#L1492"}}),Fe=new B({props:{name:"disable_attention_slicing",anchor:"diffusers.StableDiffusionInpaintPipeline.disable_attention_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.17.0/src/diffusers/pipelines/pipeline_utils.py#L1508"}}),Ce=new B({props:{name:"enable_xformers_memory_efficient_attention",anchor:"diffusers.StableDiffusionInpaintPipeline.enable_xformers_memory_efficient_attention",parameters:[{name:"attention_op",val:": typing.Optional[typing.Callable] = None"}],parametersDescription:[{anchor:"diffusers.StableDiffusionInpaintPipeline.enable_xformers_memory_efficient_attention.attention_op",description:`<strong>attention_op</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
Override the default <code>None</code> operator for use as <code>op</code> argument to the
<a href="https://facebookresearch.github.io/xformers/components/ops.html#xformers.ops.memory_efficient_attention" rel="nofollow"><code>memory_efficient_attention()</code></a>
function of xFormers.`,name:"attention_op"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.0/src/diffusers/pipelines/pipeline_utils.py#L1434"}}),ne=new an({props:{anchor:"diffusers.StableDiffusionInpaintPipeline.enable_xformers_memory_efficient_attention.example",$$slots:{default:[pi]},$$scope:{ctx:D}}}),Ne=new B({props:{name:"disable_xformers_memory_efficient_attention",anchor:"diffusers.StableDiffusionInpaintPipeline.disable_xformers_memory_efficient_attention",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.17.0/src/diffusers/pipelines/pipeline_utils.py#L1466"}}),Be=new B({props:{name:"load_textual_inversion",anchor:"diffusers.StableDiffusionInpaintPipeline.load_textual_inversion",parameters:[{name:"pretrained_model_name_or_path",val:": typing.Union[str, typing.List[str], typing.Dict[str, torch.Tensor], typing.List[typing.Dict[str, torch.Tensor]]]"},{name:"token",val:": typing.Union[str, typing.List[str], NoneType] = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.StableDiffusionInpaintPipeline.load_textual_inversion.pretrained_model_name_or_path",description:`<strong>pretrained_model_name_or_path</strong> (<code>str</code> or <code>os.PathLike</code> or <code>List[str or os.PathLike]</code> or <code>Dict</code> or <code>List[Dict]</code>) &#x2014;
Can be either:</p>
<ul>
<li>A string, the <em>model id</em> of a pretrained model hosted inside a model repo on huggingface.co.
Valid model ids should have an organization name, like
<code>&quot;sd-concepts-library/low-poly-hd-logos-icons&quot;</code>.</li>
<li>A path to a <em>directory</em> containing textual inversion weights, e.g.
<code>./my_text_inversion_directory/</code>.</li>
<li>A path to a <em>file</em> containing textual inversion weights, e.g. <code>./my_text_inversions.pt</code>.</li>
<li>A <a href="https://pytorch.org/tutorials/beginner/saving_loading_models.html#what-is-a-state-dict" rel="nofollow">torch state
dict</a>.</li>
</ul>
<p>Or a list of those elements.`,name:"pretrained_model_name_or_path"},{anchor:"diffusers.StableDiffusionInpaintPipeline.load_textual_inversion.token",description:`<strong>token</strong> (<code>str</code> or <code>List[str]</code>, <em>optional</em>) &#x2014;
Override the token to use for the textual inversion weights. If <code>pretrained_model_name_or_path</code> is a
list, then <code>token</code> must also be a list of equal length.`,name:"token"},{anchor:"diffusers.StableDiffusionInpaintPipeline.load_textual_inversion.weight_name",description:`<strong>weight_name</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Name of a custom weight file. This should be used in two cases:</p>
<ul>
<li>The saved textual inversion file is in <code>diffusers</code> format, but was saved under a specific weight
name, such as <code>text_inv.bin</code>.</li>
<li>The saved textual inversion file is in the &#x201C;Automatic1111&#x201D; form.</li>
</ul>`,name:"weight_name"},{anchor:"diffusers.StableDiffusionInpaintPipeline.load_textual_inversion.cache_dir",description:`<strong>cache_dir</strong> (<code>Union[str, os.PathLike]</code>, <em>optional</em>) &#x2014;
Path to a directory in which a downloaded pretrained model configuration should be cached if the
standard cache should not be used.`,name:"cache_dir"},{anchor:"diffusers.StableDiffusionInpaintPipeline.load_textual_inversion.force_download",description:`<strong>force_download</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to force the (re-)download of the model weights and configuration files, overriding the
cached versions if they exist.`,name:"force_download"},{anchor:"diffusers.StableDiffusionInpaintPipeline.load_textual_inversion.resume_download",description:`<strong>resume_download</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to delete incompletely received files. Will attempt to resume the download if such a
file exists.`,name:"resume_download"},{anchor:"diffusers.StableDiffusionInpaintPipeline.load_textual_inversion.proxies",description:`<strong>proxies</strong> (<code>Dict[str, str]</code>, <em>optional</em>) &#x2014;
A dictionary of proxy servers to use by protocol or endpoint, e.g., <code>{&apos;http&apos;: &apos;foo.bar:3128&apos;, &apos;http://hostname&apos;: &apos;foo.bar:4012&apos;}</code>. The proxies are used on each request.`,name:"proxies"},{anchor:"diffusers.StableDiffusionInpaintPipeline.load_textual_inversion.local_files_only(bool,",description:`<strong>local_files_only(<code>bool</code>,</strong> <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to only look at local files (i.e., do not try to download the model).`,name:"local_files_only(bool,"},{anchor:"diffusers.StableDiffusionInpaintPipeline.load_textual_inversion.use_auth_token",description:`<strong>use_auth_token</strong> (<code>str</code> or <em>bool</em>, <em>optional</em>) &#x2014;
The token to use as HTTP bearer authorization for remote files. If <code>True</code>, will use the token generated
when running <code>diffusers-cli login</code> (stored in <code>~/.huggingface</code>).`,name:"use_auth_token"},{anchor:"diffusers.StableDiffusionInpaintPipeline.load_textual_inversion.revision",description:`<strong>revision</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;main&quot;</code>) &#x2014;
The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a
git-based system for storing models and other artifacts on huggingface.co, so <code>revision</code> can be any
identifier allowed by git.`,name:"revision"},{anchor:"diffusers.StableDiffusionInpaintPipeline.load_textual_inversion.subfolder",description:`<strong>subfolder</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&quot;</code>) &#x2014;
In case the relevant files are located inside a subfolder of the model repo (either remote in
huggingface.co or downloaded locally), you can specify the folder name here.`,name:"subfolder"},{anchor:"diffusers.StableDiffusionInpaintPipeline.load_textual_inversion.mirror",description:`<strong>mirror</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Mirror source to accelerate downloads in China. If you are from China and have an accessibility
problem, you can set this option to resolve it. Note that we do not guarantee the timeliness or safety.
Please refer to the mirror site for more information.`,name:"mirror"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.0/src/diffusers/loaders.py#L482"}}),oe=new nn({props:{warning:!0,$$slots:{default:[fi]},$$scope:{ctx:D}}}),se=new nn({props:{$$slots:{default:[mi]},$$scope:{ctx:D}}}),ie=new an({props:{anchor:"diffusers.StableDiffusionInpaintPipeline.load_textual_inversion.example",$$slots:{default:[ui]},$$scope:{ctx:D}}}),le=new an({props:{anchor:"diffusers.StableDiffusionInpaintPipeline.load_textual_inversion.example-2",$$slots:{default:[hi]},$$scope:{ctx:D}}}),Xe=new B({props:{name:"load_lora_weights",anchor:"diffusers.StableDiffusionInpaintPipeline.load_lora_weights",parameters:[{name:"pretrained_model_name_or_path_or_dict",val:": typing.Union[str, typing.Dict[str, torch.Tensor]]"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"diffusers.StableDiffusionInpaintPipeline.load_lora_weights.pretrained_model_name_or_path_or_dict",description:`<strong>pretrained_model_name_or_path_or_dict</strong> (<code>str</code> or <code>os.PathLike</code> or <code>dict</code>) &#x2014;
Can be either:</p>
<ul>
<li>A string, the <em>model id</em> of a pretrained model hosted inside a model repo on huggingface.co.
Valid model ids should have an organization name, like <code>google/ddpm-celebahq-256</code>.</li>
<li>A path to a <em>directory</em> containing model weights saved using <code>~ModelMixin.save_config</code>, e.g.,
<code>./my_model_directory/</code>.</li>
<li>A <a href="https://pytorch.org/tutorials/beginner/saving_loading_models.html#what-is-a-state-dict" rel="nofollow">torch state
dict</a>.</li>
</ul>`,name:"pretrained_model_name_or_path_or_dict"},{anchor:"diffusers.StableDiffusionInpaintPipeline.load_lora_weights.cache_dir",description:`<strong>cache_dir</strong> (<code>Union[str, os.PathLike]</code>, <em>optional</em>) &#x2014;
Path to a directory in which a downloaded pretrained model configuration should be cached if the
standard cache should not be used.`,name:"cache_dir"},{anchor:"diffusers.StableDiffusionInpaintPipeline.load_lora_weights.force_download",description:`<strong>force_download</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to force the (re-)download of the model weights and configuration files, overriding the
cached versions if they exist.`,name:"force_download"},{anchor:"diffusers.StableDiffusionInpaintPipeline.load_lora_weights.resume_download",description:`<strong>resume_download</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to delete incompletely received files. Will attempt to resume the download if such a
file exists.`,name:"resume_download"},{anchor:"diffusers.StableDiffusionInpaintPipeline.load_lora_weights.proxies",description:`<strong>proxies</strong> (<code>Dict[str, str]</code>, <em>optional</em>) &#x2014;
A dictionary of proxy servers to use by protocol or endpoint, e.g., <code>{&apos;http&apos;: &apos;foo.bar:3128&apos;, &apos;http://hostname&apos;: &apos;foo.bar:4012&apos;}</code>. The proxies are used on each request.`,name:"proxies"},{anchor:"diffusers.StableDiffusionInpaintPipeline.load_lora_weights.local_files_only(bool,",description:`<strong>local_files_only(<code>bool</code>,</strong> <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to only look at local files (i.e., do not try to download the model).`,name:"local_files_only(bool,"},{anchor:"diffusers.StableDiffusionInpaintPipeline.load_lora_weights.use_auth_token",description:`<strong>use_auth_token</strong> (<code>str</code> or <em>bool</em>, <em>optional</em>) &#x2014;
The token to use as HTTP bearer authorization for remote files. If <code>True</code>, will use the token generated
when running <code>diffusers-cli login</code> (stored in <code>~/.huggingface</code>).`,name:"use_auth_token"},{anchor:"diffusers.StableDiffusionInpaintPipeline.load_lora_weights.revision",description:`<strong>revision</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;main&quot;</code>) &#x2014;
The specific model version to use. It can be a branch name, a tag name, or a commit id, since we use a
git-based system for storing models and other artifacts on huggingface.co, so <code>revision</code> can be any
identifier allowed by git.`,name:"revision"},{anchor:"diffusers.StableDiffusionInpaintPipeline.load_lora_weights.subfolder",description:`<strong>subfolder</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&quot;</code>) &#x2014;
In case the relevant files are located inside a subfolder of the model repo (either remote in
huggingface.co or downloaded locally), you can specify the folder name here.`,name:"subfolder"},{anchor:"diffusers.StableDiffusionInpaintPipeline.load_lora_weights.mirror",description:`<strong>mirror</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Mirror source to accelerate downloads in China. If you are from China and have an accessibility
problem, you can set this option to resolve it. Note that we do not guarantee the timeliness or safety.
Please refer to the mirror site for more information.`,name:"mirror"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.0/src/diffusers/loaders.py#L781"}}),re=new nn({props:{warning:!0,$$slots:{default:[gi]},$$scope:{ctx:D}}}),de=new nn({props:{$$slots:{default:[_i]},$$scope:{ctx:D}}}),Re=new B({props:{name:"save_lora_weights",anchor:"diffusers.StableDiffusionInpaintPipeline.save_lora_weights",parameters:[{name:"save_directory",val:": typing.Union[str, os.PathLike]"},{name:"unet_lora_layers",val:": typing.Dict[str, typing.Union[torch.nn.modules.module.Module, torch.Tensor]] = None"},{name:"text_encoder_lora_layers",val:": typing.Dict[str, torch.nn.modules.module.Module] = None"},{name:"is_main_process",val:": bool = True"},{name:"weight_name",val:": str = None"},{name:"save_function",val:": typing.Callable = None"},{name:"safe_serialization",val:": bool = False"}],parametersDescription:[{anchor:"diffusers.StableDiffusionInpaintPipeline.save_lora_weights.save_directory",description:`<strong>save_directory</strong> (<code>str</code> or <code>os.PathLike</code>) &#x2014;
Directory to which to save. Will be created if it doesn&#x2019;t exist.`,name:"save_directory"},{anchor:"diffusers.StableDiffusionInpaintPipeline.save_lora_weights.unet_lora_layers",description:`<strong>unet_lora_layers</strong> (<code>Dict[str, torch.nn.Module]</code> or <code>Dict[str, torch.Tensor]</code>) &#x2014;
State dict of the LoRA layers corresponding to the UNet. Specifying this helps to make the
serialization process easier and cleaner. Values can be both LoRA torch.nn.Modules layers or torch
weights.`,name:"unet_lora_layers"},{anchor:"diffusers.StableDiffusionInpaintPipeline.save_lora_weights.text_encoder_lora_layers",description:"<strong>text_encoder_lora_layers</strong> (<code>Dict[str, torch.nn.Module] or </code>Dict[str, torch.Tensor]<code>) -- State dict of the LoRA layers corresponding to the </code>text_encoder<code>. Since the </code>text_encoder<code>comes from</code>transformers`, we cannot rejig it. That is why we have to explicitly pass the text encoder LoRA state\ndict. Values can be both LoRA torch.nn.Modules layers or torch weights.",name:"text_encoder_lora_layers"},{anchor:"diffusers.StableDiffusionInpaintPipeline.save_lora_weights.is_main_process",description:`<strong>is_main_process</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether the process calling this is the main process or not. Useful when in distributed training like
TPUs and need to call this function on all processes. In this case, set <code>is_main_process=True</code> only on
the main process to avoid race conditions.`,name:"is_main_process"},{anchor:"diffusers.StableDiffusionInpaintPipeline.save_lora_weights.save_function",description:`<strong>save_function</strong> (<code>Callable</code>) &#x2014;
The function to use to save the state dictionary. Useful on distributed training like TPUs when one
need to replace <code>torch.save</code> by another method. Can be configured with the environment variable
<code>DIFFUSERS_SAVE_MODE</code>.`,name:"save_function"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.0/src/diffusers/loaders.py#L1201"}}),Le=new B({props:{name:"enable_model_cpu_offload",anchor:"diffusers.StableDiffusionInpaintPipeline.enable_model_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.0/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py#L324"}}),Ae=new B({props:{name:"enable_sequential_cpu_offload",anchor:"diffusers.StableDiffusionInpaintPipeline.enable_sequential_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.0/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py#L298"}}),Ye=new B({props:{name:"class diffusers.FlaxStableDiffusionInpaintPipeline",anchor:"diffusers.FlaxStableDiffusionInpaintPipeline",parameters:[{name:"vae",val:": FlaxAutoencoderKL"},{name:"text_encoder",val:": FlaxCLIPTextModel"},{name:"tokenizer",val:": CLIPTokenizer"},{name:"unet",val:": FlaxUNet2DConditionModel"},{name:"scheduler",val:": typing.Union[diffusers.schedulers.scheduling_ddim_flax.FlaxDDIMScheduler, diffusers.schedulers.scheduling_pndm_flax.FlaxPNDMScheduler, diffusers.schedulers.scheduling_lms_discrete_flax.FlaxLMSDiscreteScheduler, diffusers.schedulers.scheduling_dpmsolver_multistep_flax.FlaxDPMSolverMultistepScheduler]"},{name:"safety_checker",val:": FlaxStableDiffusionSafetyChecker"},{name:"feature_extractor",val:": CLIPImageProcessor"},{name:"dtype",val:": dtype = <class 'jax.numpy.float32'>"}],parametersDescription:[{anchor:"diffusers.FlaxStableDiffusionInpaintPipeline.vae",description:`<strong>vae</strong> (<a href="/docs/diffusers/v0.17.0/en/api/models#diffusers.FlaxAutoencoderKL">FlaxAutoencoderKL</a>) &#x2014;
Variational Auto-Encoder (VAE) Model to encode and decode images to and from latent representations.`,name:"vae"},{anchor:"diffusers.FlaxStableDiffusionInpaintPipeline.text_encoder",description:`<strong>text_encoder</strong> (<code>FlaxCLIPTextModel</code>) &#x2014;
Frozen text-encoder. Stable Diffusion uses the text portion of
<a href="https://huggingface.co/docs/transformers/model_doc/clip#transformers.FlaxCLIPTextModel" rel="nofollow">CLIP</a>,
specifically the <a href="https://huggingface.co/openai/clip-vit-large-patch14" rel="nofollow">clip-vit-large-patch14</a> variant.`,name:"text_encoder"},{anchor:"diffusers.FlaxStableDiffusionInpaintPipeline.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.FlaxStableDiffusionInpaintPipeline.unet",description:'<strong>unet</strong> (<a href="/docs/diffusers/v0.17.0/en/api/models#diffusers.FlaxUNet2DConditionModel">FlaxUNet2DConditionModel</a>) &#x2014; Conditional U-Net architecture to denoise the encoded image latents.',name:"unet"},{anchor:"diffusers.FlaxStableDiffusionInpaintPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/v0.17.0/en/api/schedulers/overview#diffusers.SchedulerMixin">SchedulerMixin</a>) &#x2014;
A scheduler to be used in combination with <code>unet</code> to denoise the encoded image latents. Can be one of
<code>FlaxDDIMScheduler</code>, <code>FlaxLMSDiscreteScheduler</code>, <code>FlaxPNDMScheduler</code>, or
<code>FlaxDPMSolverMultistepScheduler</code>.`,name:"scheduler"},{anchor:"diffusers.FlaxStableDiffusionInpaintPipeline.safety_checker",description:`<strong>safety_checker</strong> (<code>FlaxStableDiffusionSafetyChecker</code>) &#x2014;
Classification module that estimates whether generated images could be considered offensive or harmful.
Please, refer to the <a href="https://huggingface.co/runwayml/stable-diffusion-v1-5" rel="nofollow">model card</a> for details.`,name:"safety_checker"},{anchor:"diffusers.FlaxStableDiffusionInpaintPipeline.feature_extractor",description:`<strong>feature_extractor</strong> (<code>CLIPImageProcessor</code>) &#x2014;
Model that extracts features from generated images to be used as inputs for the <code>safety_checker</code>.`,name:"feature_extractor"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.0/src/diffusers/pipelines/stable_diffusion/pipeline_flax_stable_diffusion_inpaint.py#L102"}}),qe=new B({props:{name:"__call__",anchor:"diffusers.FlaxStableDiffusionInpaintPipeline.__call__",parameters:[{name:"prompt_ids",val:": array"},{name:"mask",val:": array"},{name:"masked_image",val:": array"},{name:"params",val:": typing.Union[typing.Dict, flax.core.frozen_dict.FrozenDict]"},{name:"prng_seed",val:": PRNGKeyArray"},{name:"num_inference_steps",val:": int = 50"},{name:"height",val:": typing.Optional[int] = None"},{name:"width",val:": typing.Optional[int] = None"},{name:"guidance_scale",val:": typing.Union[float, array] = 7.5"},{name:"latents",val:": array = None"},{name:"neg_prompt_ids",val:": array = None"},{name:"return_dict",val:": bool = True"},{name:"jit",val:": bool = False"}],parametersDescription:[{anchor:"diffusers.FlaxStableDiffusionInpaintPipeline.__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.FlaxStableDiffusionInpaintPipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, <em>optional</em>, defaults to self.unet.config.sample_size * self.vae_scale_factor) &#x2014;
The height in pixels of the generated image.`,name:"height"},{anchor:"diffusers.FlaxStableDiffusionInpaintPipeline.__call__.width",description:`<strong>width</strong> (<code>int</code>, <em>optional</em>, defaults to self.unet.config.sample_size * self.vae_scale_factor) &#x2014;
The width in pixels of the generated image.`,name:"width"},{anchor:"diffusers.FlaxStableDiffusionInpaintPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 50) &#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.FlaxStableDiffusionInpaintPipeline.__call__.guidance_scale",description:`<strong>guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 7.5) &#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.FlaxStableDiffusionInpaintPipeline.__call__.latents",description:`<strong>latents</strong> (<code>jnp.array</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. tensor will ge generated
by sampling using the supplied random <code>generator</code>.`,name:"latents"},{anchor:"diffusers.FlaxStableDiffusionInpaintPipeline.__call__.jit",description:`<strong>jit</strong> (<code>bool</code>, defaults to <code>False</code>) &#x2014;
Whether to run <code>pmap</code> versions of the generation and safety scoring functions. NOTE: This argument
exists because <code>__call__</code> is not yet end-to-end pmap-able. It will be removed in a future release.`,name:"jit"},{anchor:"diffusers.FlaxStableDiffusionInpaintPipeline.__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 <code>FlaxStableDiffusionPipelineOutput</code> instead of
a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.0/src/diffusers/pipelines/stable_diffusion/pipeline_flax_stable_diffusion_inpaint.py#L389",returnDescription:`
<p><code>FlaxStableDiffusionPipelineOutput</code> if <code>return_dict</code> is True, otherwise a
<code>tuple. When returning a tuple, the first element is a list with the generated images, and the second element is a list of </code>bool<code>s denoting whether the corresponding generated image likely represents "not-safe-for-work" (nsfw) content, according to the </code>safety_checker\`.</p>
`,returnType:`
<p><code>FlaxStableDiffusionPipelineOutput</code> or <code>tuple</code></p>
`}}),me=new an({props:{anchor:"diffusers.FlaxStableDiffusionInpaintPipeline.__call__.example",$$slots:{default:[bi]},$$scope:{ctx:D}}}),{c(){d=s("meta"),b=p(),c=s("h1"),m=s("a"),y=s("span"),T(r.$$.fragment),u=p(),I=s("span"),g=a("Text-Guided Image Inpainting"),_=p(),j=s("h2"),E=s("a"),mt=s("span"),T(ge.$$.fragment),En=p(),ut=s("span"),Zn=a("StableDiffusionInpaintPipeline"),ln=p(),Z=s("p"),Wn=a("The Stable Diffusion model was created by the researchers and engineers from "),_e=s("a"),Fn=a("CompVis"),Gn=a(", "),be=s("a"),Cn=a("Stability AI"),Nn=a(", "),ye=s("a"),Bn=a("runway"),Xn=a(", and "),ve=s("a"),Vn=a("LAION"),Rn=a(". The "),Ke=s("a"),Ln=a("StableDiffusionInpaintPipeline"),An=a(" lets you edit specific parts of an image by providing a mask and a text prompt using Stable Diffusion."),rn=p(),et=s("p"),Yn=a("The original codebase can be found here:"),dn=p(),H=s("ul"),we=s("li"),ht=s("em"),zn=a("Stable Diffusion V1"),Qn=a(": "),xe=s("a"),qn=a("CampVis/stable-diffusion"),Hn=p(),Me=s("li"),gt=s("em"),On=a("Stable Diffusion V2"),Kn=a(": "),Ie=s("a"),ea=a("Stability-AI/stablediffusion"),cn=p(),tt=s("p"),ta=a("Available checkpoints are:"),pn=p(),O=s("ul"),Te=s("li"),_t=s("em"),na=a("stable-diffusion-inpainting (512x512 resolution)"),aa=a(": "),Je=s("a"),oa=a("runwayml/stable-diffusion-inpainting"),sa=p(),ke=s("li"),bt=s("em"),ia=a("stable-diffusion-2-inpainting (512x512 resolution)"),la=a(": "),$e=s("a"),ra=a("stabilityai/stable-diffusion-2-inpainting"),fn=p(),w=s("div"),T(Ue.$$.fragment),da=p(),yt=s("p"),ca=a("Pipeline for text-guided image inpainting using Stable Diffusion."),pa=p(),Se=s("p"),fa=a("This model inherits from "),nt=s("a"),ma=a("DiffusionPipeline"),ua=a(`. 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.)`),ha=p(),vt=s("p"),ga=a("In addition the pipeline inherits the following loading methods:"),_a=p(),je=s("ul"),De=s("li"),wt=s("em"),ba=a("Textual-Inversion"),ya=a(": "),at=s("a"),va=a("loaders.TextualInversionLoaderMixin.load_textual_inversion()"),wa=p(),Pe=s("li"),xt=s("em"),xa=a("LoRA"),Ma=a(": "),ot=s("a"),Ia=a("loaders.LoraLoaderMixin.load_lora_weights()"),Ta=p(),Mt=s("p"),Ja=a("as well as the following saving methods:"),ka=p(),It=s("ul"),Ee=s("li"),Tt=s("em"),$a=a("LoRA"),Ua=a(": "),st=s("a"),Sa=a("loaders.LoraLoaderMixin.save_lora_weights()"),ja=p(),T(K.$$.fragment),Da=p(),V=s("div"),T(Ze.$$.fragment),Pa=p(),Jt=s("p"),Ea=a("Function invoked when calling the pipeline for generation."),Za=p(),T(ee.$$.fragment),Wa=p(),R=s("div"),T(We.$$.fragment),Fa=p(),kt=s("p"),Ga=a("Enable sliced attention computation."),Ca=p(),$t=s("p"),Na=a(`When this option is enabled, the attention module will split the input tensor in slices, to compute attention
in several steps. This is useful to save some memory in exchange for a small speed decrease.`),Ba=p(),te=s("div"),T(Fe.$$.fragment),Xa=p(),Ge=s("p"),Va=a("Disable sliced attention computation. If "),Ut=s("code"),Ra=a("enable_attention_slicing"),La=a(` was previously invoked, this method will go
back to computing attention in one step.`),Aa=p(),G=s("div"),T(Ce.$$.fragment),Ya=p(),St=s("p"),za=a("Enable memory efficient attention as implemented in xformers."),Qa=p(),jt=s("p"),qa=a(`When this option is enabled, you should observe lower GPU memory usage and a potential speed up at inference
time. Speed up at training time is not guaranteed.`),Ha=p(),Dt=s("p"),Oa=a(`Warning: When Memory Efficient Attention and Sliced attention are both enabled, the Memory Efficient Attention
is used.`),Ka=p(),T(ne.$$.fragment),eo=p(),ae=s("div"),T(Ne.$$.fragment),to=p(),Pt=s("p"),no=a("Disable memory efficient attention as implemented in xformers."),ao=p(),P=s("div"),T(Be.$$.fragment),oo=p(),z=s("p"),so=a("Load textual inversion embeddings into the text encoder of stable diffusion pipelines. Both "),Et=s("code"),io=a("diffusers"),lo=a(` and
`),Zt=s("code"),ro=a("Automatic1111"),co=a(" formats are supported (see example below)."),po=p(),T(oe.$$.fragment),fo=p(),T(se.$$.fragment),mo=p(),Wt=s("p"),uo=a("Example:"),ho=p(),T(ie.$$.fragment),go=p(),Ft=s("p"),_o=a("To load a textual inversion embedding vector in Automatic1111 format, make sure to first download the vector,"),bo=p(),T(le.$$.fragment),yo=p(),X=s("div"),T(Xe.$$.fragment),vo=p(),Q=s("p"),wo=a("Load pretrained attention processor layers (such as LoRA) into "),it=s("a"),xo=a("UNet2DConditionModel"),Mo=a(` and
`),Ve=s("a"),Gt=s("code"),Io=a("CLIPTextModel"),To=a(")."),Jo=p(),T(re.$$.fragment),ko=p(),T(de.$$.fragment),$o=p(),ce=s("div"),T(Re.$$.fragment),Uo=p(),Ct=s("p"),So=a("Save the LoRA parameters corresponding to the UNet and the text encoder."),jo=p(),pe=s("div"),T(Le.$$.fragment),Do=p(),C=s("p"),Po=a(`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),Nt=s("code"),Eo=a("enable_sequential_cpu_offload"),Zo=a(", this method moves one whole model at a time to the GPU when its "),Bt=s("code"),Wo=a("forward"),Fo=a(`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),Xt=s("code"),Go=a("enable_sequential_cpu_offload"),Co=a(", but performance is much better due to the iterative execution of the "),Vt=s("code"),No=a("unet"),Bo=a("."),Xo=p(),fe=s("div"),T(Ae.$$.fragment),Vo=p(),q=s("p"),Ro=a(`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, unet,
text_encoder, vae and safety checker have their state dicts saved to CPU and then are moved to a
`),Rt=s("code"),Lo=a("torch.device('meta') and loaded to GPU only when their specific submodule has its "),Ao=a("forward"),Lt=s("code"),Yo=a("method called. Note that offloading happens on a submodule basis. Memory savings are higher than with"),zo=a("enable_model_cpu_offload`, but performance is lower."),mn=p(),N=s("div"),T(Ye.$$.fragment),Qo=p(),ze=s("p"),qo=a("Pipeline for text-guided image inpainting using Stable Diffusion. "),At=s("em"),Ho=a("This is an experimental feature"),Oo=a("."),Ko=p(),Qe=s("p"),es=a("This model inherits from "),Yt=s("code"),ts=a("FlaxDiffusionPipeline"),ns=a(`. 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.)`),as=p(),L=s("div"),T(qe.$$.fragment),os=p(),zt=s("p"),ss=a("Function invoked when calling the pipeline for generation."),is=p(),T(me.$$.fragment),this.h()},l(n){const v=li('[data-svelte="svelte-1phssyn"]',document.head);d=i(v,"META",{name:!0,content:!0}),v.forEach(t),b=f(n),c=i(n,"H1",{class:!0});var He=l(c);m=i(He,"A",{id:!0,class:!0,href:!0});var Qt=l(m);y=i(Qt,"SPAN",{});var qt=l(y);J(r.$$.fragment,qt),qt.forEach(t),Qt.forEach(t),u=f(He),I=i(He,"SPAN",{});var Ht=l(I);g=o(Ht,"Text-Guided Image Inpainting"),Ht.forEach(t),He.forEach(t),_=f(n),j=i(n,"H2",{class:!0});var Oe=l(j);E=i(Oe,"A",{id:!0,class:!0,href:!0});var Ot=l(E);mt=i(Ot,"SPAN",{});var Kt=l(mt);J(ge.$$.fragment,Kt),Kt.forEach(t),Ot.forEach(t),En=f(Oe),ut=i(Oe,"SPAN",{});var en=l(ut);Zn=o(en,"StableDiffusionInpaintPipeline"),en.forEach(t),Oe.forEach(t),ln=f(n),Z=i(n,"P",{});var F=l(Z);Wn=o(F,"The Stable Diffusion model was created by the researchers and engineers from "),_e=i(F,"A",{href:!0,rel:!0});var tn=l(_e);Fn=o(tn,"CompVis"),tn.forEach(t),Gn=o(F,", "),be=i(F,"A",{href:!0,rel:!0});var ls=l(be);Cn=o(ls,"Stability AI"),ls.forEach(t),Nn=o(F,", "),ye=i(F,"A",{href:!0,rel:!0});var rs=l(ye);Bn=o(rs,"runway"),rs.forEach(t),Xn=o(F,", and "),ve=i(F,"A",{href:!0,rel:!0});var ds=l(ve);Vn=o(ds,"LAION"),ds.forEach(t),Rn=o(F,". The "),Ke=i(F,"A",{href:!0});var cs=l(Ke);Ln=o(cs,"StableDiffusionInpaintPipeline"),cs.forEach(t),An=o(F," lets you edit specific parts of an image by providing a mask and a text prompt using Stable Diffusion."),F.forEach(t),rn=f(n),et=i(n,"P",{});var ps=l(et);Yn=o(ps,"The original codebase can be found here:"),ps.forEach(t),dn=f(n),H=i(n,"UL",{});var hn=l(H);we=i(hn,"LI",{});var gn=l(we);ht=i(gn,"EM",{});var fs=l(ht);zn=o(fs,"Stable Diffusion V1"),fs.forEach(t),Qn=o(gn,": "),xe=i(gn,"A",{href:!0,rel:!0});var ms=l(xe);qn=o(ms,"CampVis/stable-diffusion"),ms.forEach(t),gn.forEach(t),Hn=f(hn),Me=i(hn,"LI",{});var _n=l(Me);gt=i(_n,"EM",{});var us=l(gt);On=o(us,"Stable Diffusion V2"),us.forEach(t),Kn=o(_n,": "),Ie=i(_n,"A",{href:!0,rel:!0});var hs=l(Ie);ea=o(hs,"Stability-AI/stablediffusion"),hs.forEach(t),_n.forEach(t),hn.forEach(t),cn=f(n),tt=i(n,"P",{});var gs=l(tt);ta=o(gs,"Available checkpoints are:"),gs.forEach(t),pn=f(n),O=i(n,"UL",{});var bn=l(O);Te=i(bn,"LI",{});var yn=l(Te);_t=i(yn,"EM",{});var _s=l(_t);na=o(_s,"stable-diffusion-inpainting (512x512 resolution)"),_s.forEach(t),aa=o(yn,": "),Je=i(yn,"A",{href:!0,rel:!0});var bs=l(Je);oa=o(bs,"runwayml/stable-diffusion-inpainting"),bs.forEach(t),yn.forEach(t),sa=f(bn),ke=i(bn,"LI",{});var vn=l(ke);bt=i(vn,"EM",{});var ys=l(bt);ia=o(ys,"stable-diffusion-2-inpainting (512x512 resolution)"),ys.forEach(t),la=o(vn,": "),$e=i(vn,"A",{href:!0,rel:!0});var vs=l($e);ra=o(vs,"stabilityai/stable-diffusion-2-inpainting"),vs.forEach(t),vn.forEach(t),bn.forEach(t),fn=f(n),w=i(n,"DIV",{class:!0});var x=l(w);J(Ue.$$.fragment,x),da=f(x),yt=i(x,"P",{});var ws=l(yt);ca=o(ws,"Pipeline for text-guided image inpainting using Stable Diffusion."),ws.forEach(t),pa=f(x),Se=i(x,"P",{});var wn=l(Se);fa=o(wn,"This model inherits from "),nt=i(wn,"A",{href:!0});var xs=l(nt);ma=o(xs,"DiffusionPipeline"),xs.forEach(t),ua=o(wn,`. 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.)`),wn.forEach(t),ha=f(x),vt=i(x,"P",{});var Ms=l(vt);ga=o(Ms,"In addition the pipeline inherits the following loading methods:"),Ms.forEach(t),_a=f(x),je=i(x,"UL",{});var xn=l(je);De=i(xn,"LI",{});var Mn=l(De);wt=i(Mn,"EM",{});var Is=l(wt);ba=o(Is,"Textual-Inversion"),Is.forEach(t),ya=o(Mn,": "),at=i(Mn,"A",{href:!0});var Ts=l(at);va=o(Ts,"loaders.TextualInversionLoaderMixin.load_textual_inversion()"),Ts.forEach(t),Mn.forEach(t),wa=f(xn),Pe=i(xn,"LI",{});var In=l(Pe);xt=i(In,"EM",{});var Js=l(xt);xa=o(Js,"LoRA"),Js.forEach(t),Ma=o(In,": "),ot=i(In,"A",{href:!0});var ks=l(ot);Ia=o(ks,"loaders.LoraLoaderMixin.load_lora_weights()"),ks.forEach(t),In.forEach(t),xn.forEach(t),Ta=f(x),Mt=i(x,"P",{});var $s=l(Mt);Ja=o($s,"as well as the following saving methods:"),$s.forEach(t),ka=f(x),It=i(x,"UL",{});var Us=l(It);Ee=i(Us,"LI",{});var Tn=l(Ee);Tt=i(Tn,"EM",{});var Ss=l(Tt);$a=o(Ss,"LoRA"),Ss.forEach(t),Ua=o(Tn,": "),st=i(Tn,"A",{href:!0});var js=l(st);Sa=o(js,"loaders.LoraLoaderMixin.save_lora_weights()"),js.forEach(t),Tn.forEach(t),Us.forEach(t),ja=f(x),J(K.$$.fragment,x),Da=f(x),V=i(x,"DIV",{class:!0});var lt=l(V);J(Ze.$$.fragment,lt),Pa=f(lt),Jt=i(lt,"P",{});var Ds=l(Jt);Ea=o(Ds,"Function invoked when calling the pipeline for generation."),Ds.forEach(t),Za=f(lt),J(ee.$$.fragment,lt),lt.forEach(t),Wa=f(x),R=i(x,"DIV",{class:!0});var rt=l(R);J(We.$$.fragment,rt),Fa=f(rt),kt=i(rt,"P",{});var Ps=l(kt);Ga=o(Ps,"Enable sliced attention computation."),Ps.forEach(t),Ca=f(rt),$t=i(rt,"P",{});var Es=l($t);Na=o(Es,`When this option is enabled, the attention module will split the input tensor in slices, to compute attention
in several steps. This is useful to save some memory in exchange for a small speed decrease.`),Es.forEach(t),rt.forEach(t),Ba=f(x),te=i(x,"DIV",{class:!0});var Jn=l(te);J(Fe.$$.fragment,Jn),Xa=f(Jn),Ge=i(Jn,"P",{});var kn=l(Ge);Va=o(kn,"Disable sliced attention computation. If "),Ut=i(kn,"CODE",{});var Zs=l(Ut);Ra=o(Zs,"enable_attention_slicing"),Zs.forEach(t),La=o(kn,` was previously invoked, this method will go
back to computing attention in one step.`),kn.forEach(t),Jn.forEach(t),Aa=f(x),G=i(x,"DIV",{class:!0});var A=l(G);J(Ce.$$.fragment,A),Ya=f(A),St=i(A,"P",{});var Ws=l(St);za=o(Ws,"Enable memory efficient attention as implemented in xformers."),Ws.forEach(t),Qa=f(A),jt=i(A,"P",{});var Fs=l(jt);qa=o(Fs,`When this option is enabled, you should observe lower GPU memory usage and a potential speed up at inference
time. Speed up at training time is not guaranteed.`),Fs.forEach(t),Ha=f(A),Dt=i(A,"P",{});var Gs=l(Dt);Oa=o(Gs,`Warning: When Memory Efficient Attention and Sliced attention are both enabled, the Memory Efficient Attention
is used.`),Gs.forEach(t),Ka=f(A),J(ne.$$.fragment,A),A.forEach(t),eo=f(x),ae=i(x,"DIV",{class:!0});var $n=l(ae);J(Ne.$$.fragment,$n),to=f($n),Pt=i($n,"P",{});var Cs=l(Pt);no=o(Cs,"Disable memory efficient attention as implemented in xformers."),Cs.forEach(t),$n.forEach(t),ao=f(x),P=i(x,"DIV",{class:!0});var W=l(P);J(Be.$$.fragment,W),oo=f(W),z=i(W,"P",{});var dt=l(z);so=o(dt,"Load textual inversion embeddings into the text encoder of stable diffusion pipelines. Both "),Et=i(dt,"CODE",{});var Ns=l(Et);io=o(Ns,"diffusers"),Ns.forEach(t),lo=o(dt,` and
`),Zt=i(dt,"CODE",{});var Bs=l(Zt);ro=o(Bs,"Automatic1111"),Bs.forEach(t),co=o(dt," formats are supported (see example below)."),dt.forEach(t),po=f(W),J(oe.$$.fragment,W),fo=f(W),J(se.$$.fragment,W),mo=f(W),Wt=i(W,"P",{});var Xs=l(Wt);uo=o(Xs,"Example:"),Xs.forEach(t),ho=f(W),J(ie.$$.fragment,W),go=f(W),Ft=i(W,"P",{});var Vs=l(Ft);_o=o(Vs,"To load a textual inversion embedding vector in Automatic1111 format, make sure to first download the vector,"),Vs.forEach(t),bo=f(W),J(le.$$.fragment,W),W.forEach(t),yo=f(x),X=i(x,"DIV",{class:!0});var ue=l(X);J(Xe.$$.fragment,ue),vo=f(ue),Q=i(ue,"P",{});var ct=l(Q);wo=o(ct,"Load pretrained attention processor layers (such as LoRA) into "),it=i(ct,"A",{href:!0});var Rs=l(it);xo=o(Rs,"UNet2DConditionModel"),Rs.forEach(t),Mo=o(ct,` and
`),Ve=i(ct,"A",{href:!0,rel:!0});var Ls=l(Ve);Gt=i(Ls,"CODE",{});var As=l(Gt);Io=o(As,"CLIPTextModel"),As.forEach(t),Ls.forEach(t),To=o(ct,")."),ct.forEach(t),Jo=f(ue),J(re.$$.fragment,ue),ko=f(ue),J(de.$$.fragment,ue),ue.forEach(t),$o=f(x),ce=i(x,"DIV",{class:!0});var Un=l(ce);J(Re.$$.fragment,Un),Uo=f(Un),Ct=i(Un,"P",{});var Ys=l(Ct);So=o(Ys,"Save the LoRA parameters corresponding to the UNet and the text encoder."),Ys.forEach(t),Un.forEach(t),jo=f(x),pe=i(x,"DIV",{class:!0});var Sn=l(pe);J(Le.$$.fragment,Sn),Do=f(Sn),C=i(Sn,"P",{});var Y=l(C);Po=o(Y,`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),Nt=i(Y,"CODE",{});var zs=l(Nt);Eo=o(zs,"enable_sequential_cpu_offload"),zs.forEach(t),Zo=o(Y,", this method moves one whole model at a time to the GPU when its "),Bt=i(Y,"CODE",{});var Qs=l(Bt);Wo=o(Qs,"forward"),Qs.forEach(t),Fo=o(Y,`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),Xt=i(Y,"CODE",{});var qs=l(Xt);Go=o(qs,"enable_sequential_cpu_offload"),qs.forEach(t),Co=o(Y,", but performance is much better due to the iterative execution of the "),Vt=i(Y,"CODE",{});var Hs=l(Vt);No=o(Hs,"unet"),Hs.forEach(t),Bo=o(Y,"."),Y.forEach(t),Sn.forEach(t),Xo=f(x),fe=i(x,"DIV",{class:!0});var jn=l(fe);J(Ae.$$.fragment,jn),Vo=f(jn),q=i(jn,"P",{});var pt=l(q);Ro=o(pt,`Offloads all models to CPU using accelerate, significantly reducing memory usage. When called, unet,
text_encoder, vae and safety checker have their state dicts saved to CPU and then are moved to a
`),Rt=i(pt,"CODE",{});var Os=l(Rt);Lo=o(Os,"torch.device('meta') and loaded to GPU only when their specific submodule has its "),Os.forEach(t),Ao=o(pt,"forward"),Lt=i(pt,"CODE",{});var Ks=l(Lt);Yo=o(Ks,"method called. Note that offloading happens on a submodule basis. Memory savings are higher than with"),Ks.forEach(t),zo=o(pt,"enable_model_cpu_offload`, but performance is lower."),pt.forEach(t),jn.forEach(t),x.forEach(t),mn=f(n),N=i(n,"DIV",{class:!0});var he=l(N);J(Ye.$$.fragment,he),Qo=f(he),ze=i(he,"P",{});var Dn=l(ze);qo=o(Dn,"Pipeline for text-guided image inpainting using Stable Diffusion. "),At=i(Dn,"EM",{});var ei=l(At);Ho=o(ei,"This is an experimental feature"),ei.forEach(t),Oo=o(Dn,"."),Dn.forEach(t),Ko=f(he),Qe=i(he,"P",{});var Pn=l(Qe);es=o(Pn,"This model inherits from "),Yt=i(Pn,"CODE",{});var ti=l(Yt);ts=o(ti,"FlaxDiffusionPipeline"),ti.forEach(t),ns=o(Pn,`. 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.)`),Pn.forEach(t),as=f(he),L=i(he,"DIV",{class:!0});var ft=l(L);J(qe.$$.fragment,ft),os=f(ft),zt=i(ft,"P",{});var ni=l(zt);ss=o(ni,"Function invoked when calling the pipeline for generation."),ni.forEach(t),is=f(ft),J(me.$$.fragment,ft),ft.forEach(t),he.forEach(t),this.h()},h(){h(d,"name","hf:doc:metadata"),h(d,"content",JSON.stringify(vi)),h(m,"id","textguided-image-inpainting"),h(m,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(m,"href","#textguided-image-inpainting"),h(c,"class","relative group"),h(E,"id","diffusers.StableDiffusionInpaintPipeline"),h(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"),h(E,"href","#diffusers.StableDiffusionInpaintPipeline"),h(j,"class","relative group"),h(_e,"href","https://github.com/CompVis"),h(_e,"rel","nofollow"),h(be,"href","https://stability.ai/"),h(be,"rel","nofollow"),h(ye,"href","https://github.com/runwayml"),h(ye,"rel","nofollow"),h(ve,"href","https://laion.ai/"),h(ve,"rel","nofollow"),h(Ke,"href","/docs/diffusers/v0.17.0/en/api/pipelines/stable_diffusion/inpaint#diffusers.StableDiffusionInpaintPipeline"),h(xe,"href","https://github.com/runwayml/stable-diffusion#inpainting-with-stable-diffusion"),h(xe,"rel","nofollow"),h(Ie,"href","https://github.com/Stability-AI/stablediffusion#image-inpainting-with-stable-diffusion"),h(Ie,"rel","nofollow"),h(Je,"href","https://huggingface.co/runwayml/stable-diffusion-inpainting"),h(Je,"rel","nofollow"),h($e,"href","https://huggingface.co/stabilityai/stable-diffusion-2-inpainting"),h($e,"rel","nofollow"),h(nt,"href","/docs/diffusers/v0.17.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),h(at,"href","/docs/diffusers/v0.17.0/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline.load_textual_inversion"),h(ot,"href","/docs/diffusers/v0.17.0/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline.load_lora_weights"),h(st,"href","/docs/diffusers/v0.17.0/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline.save_lora_weights"),h(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(R,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(te,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(ae,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(it,"href","/docs/diffusers/v0.17.0/en/api/models#diffusers.UNet2DConditionModel"),h(Ve,"href","https://huggingface.co/docs/transformers/model_doc/clip#transformers.CLIPTextModel"),h(Ve,"rel","nofollow"),h(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(ce,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(pe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(fe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(w,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),h(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(n,v){e(document.head,d),M(n,b,v),M(n,c,v),e(c,m),e(m,y),k(r,y,null),e(c,u),e(c,I),e(I,g),M(n,_,v),M(n,j,v),e(j,E),e(E,mt),k(ge,mt,null),e(j,En),e(j,ut),e(ut,Zn),M(n,ln,v),M(n,Z,v),e(Z,Wn),e(Z,_e),e(_e,Fn),e(Z,Gn),e(Z,be),e(be,Cn),e(Z,Nn),e(Z,ye),e(ye,Bn),e(Z,Xn),e(Z,ve),e(ve,Vn),e(Z,Rn),e(Z,Ke),e(Ke,Ln),e(Z,An),M(n,rn,v),M(n,et,v),e(et,Yn),M(n,dn,v),M(n,H,v),e(H,we),e(we,ht),e(ht,zn),e(we,Qn),e(we,xe),e(xe,qn),e(H,Hn),e(H,Me),e(Me,gt),e(gt,On),e(Me,Kn),e(Me,Ie),e(Ie,ea),M(n,cn,v),M(n,tt,v),e(tt,ta),M(n,pn,v),M(n,O,v),e(O,Te),e(Te,_t),e(_t,na),e(Te,aa),e(Te,Je),e(Je,oa),e(O,sa),e(O,ke),e(ke,bt),e(bt,ia),e(ke,la),e(ke,$e),e($e,ra),M(n,fn,v),M(n,w,v),k(Ue,w,null),e(w,da),e(w,yt),e(yt,ca),e(w,pa),e(w,Se),e(Se,fa),e(Se,nt),e(nt,ma),e(Se,ua),e(w,ha),e(w,vt),e(vt,ga),e(w,_a),e(w,je),e(je,De),e(De,wt),e(wt,ba),e(De,ya),e(De,at),e(at,va),e(je,wa),e(je,Pe),e(Pe,xt),e(xt,xa),e(Pe,Ma),e(Pe,ot),e(ot,Ia),e(w,Ta),e(w,Mt),e(Mt,Ja),e(w,ka),e(w,It),e(It,Ee),e(Ee,Tt),e(Tt,$a),e(Ee,Ua),e(Ee,st),e(st,Sa),e(w,ja),k(K,w,null),e(w,Da),e(w,V),k(Ze,V,null),e(V,Pa),e(V,Jt),e(Jt,Ea),e(V,Za),k(ee,V,null),e(w,Wa),e(w,R),k(We,R,null),e(R,Fa),e(R,kt),e(kt,Ga),e(R,Ca),e(R,$t),e($t,Na),e(w,Ba),e(w,te),k(Fe,te,null),e(te,Xa),e(te,Ge),e(Ge,Va),e(Ge,Ut),e(Ut,Ra),e(Ge,La),e(w,Aa),e(w,G),k(Ce,G,null),e(G,Ya),e(G,St),e(St,za),e(G,Qa),e(G,jt),e(jt,qa),e(G,Ha),e(G,Dt),e(Dt,Oa),e(G,Ka),k(ne,G,null),e(w,eo),e(w,ae),k(Ne,ae,null),e(ae,to),e(ae,Pt),e(Pt,no),e(w,ao),e(w,P),k(Be,P,null),e(P,oo),e(P,z),e(z,so),e(z,Et),e(Et,io),e(z,lo),e(z,Zt),e(Zt,ro),e(z,co),e(P,po),k(oe,P,null),e(P,fo),k(se,P,null),e(P,mo),e(P,Wt),e(Wt,uo),e(P,ho),k(ie,P,null),e(P,go),e(P,Ft),e(Ft,_o),e(P,bo),k(le,P,null),e(w,yo),e(w,X),k(Xe,X,null),e(X,vo),e(X,Q),e(Q,wo),e(Q,it),e(it,xo),e(Q,Mo),e(Q,Ve),e(Ve,Gt),e(Gt,Io),e(Q,To),e(X,Jo),k(re,X,null),e(X,ko),k(de,X,null),e(w,$o),e(w,ce),k(Re,ce,null),e(ce,Uo),e(ce,Ct),e(Ct,So),e(w,jo),e(w,pe),k(Le,pe,null),e(pe,Do),e(pe,C),e(C,Po),e(C,Nt),e(Nt,Eo),e(C,Zo),e(C,Bt),e(Bt,Wo),e(C,Fo),e(C,Xt),e(Xt,Go),e(C,Co),e(C,Vt),e(Vt,No),e(C,Bo),e(w,Xo),e(w,fe),k(Ae,fe,null),e(fe,Vo),e(fe,q),e(q,Ro),e(q,Rt),e(Rt,Lo),e(q,Ao),e(q,Lt),e(Lt,Yo),e(q,zo),M(n,mn,v),M(n,N,v),k(Ye,N,null),e(N,Qo),e(N,ze),e(ze,qo),e(ze,At),e(At,Ho),e(ze,Oo),e(N,Ko),e(N,Qe),e(Qe,es),e(Qe,Yt),e(Yt,ts),e(Qe,ns),e(N,as),e(N,L),k(qe,L,null),e(L,os),e(L,zt),e(zt,ss),e(L,is),k(me,L,null),un=!0},p(n,[v]){const He={};v&2&&(He.$$scope={dirty:v,ctx:n}),K.$set(He);const Qt={};v&2&&(Qt.$$scope={dirty:v,ctx:n}),ee.$set(Qt);const qt={};v&2&&(qt.$$scope={dirty:v,ctx:n}),ne.$set(qt);const Ht={};v&2&&(Ht.$$scope={dirty:v,ctx:n}),oe.$set(Ht);const Oe={};v&2&&(Oe.$$scope={dirty:v,ctx:n}),se.$set(Oe);const Ot={};v&2&&(Ot.$$scope={dirty:v,ctx:n}),ie.$set(Ot);const Kt={};v&2&&(Kt.$$scope={dirty:v,ctx:n}),le.$set(Kt);const en={};v&2&&(en.$$scope={dirty:v,ctx:n}),re.$set(en);const F={};v&2&&(F.$$scope={dirty:v,ctx:n}),de.$set(F);const tn={};v&2&&(tn.$$scope={dirty:v,ctx:n}),me.$set(tn)},i(n){un||($(r.$$.fragment,n),$(ge.$$.fragment,n),$(Ue.$$.fragment,n),$(K.$$.fragment,n),$(Ze.$$.fragment,n),$(ee.$$.fragment,n),$(We.$$.fragment,n),$(Fe.$$.fragment,n),$(Ce.$$.fragment,n),$(ne.$$.fragment,n),$(Ne.$$.fragment,n),$(Be.$$.fragment,n),$(oe.$$.fragment,n),$(se.$$.fragment,n),$(ie.$$.fragment,n),$(le.$$.fragment,n),$(Xe.$$.fragment,n),$(re.$$.fragment,n),$(de.$$.fragment,n),$(Re.$$.fragment,n),$(Le.$$.fragment,n),$(Ae.$$.fragment,n),$(Ye.$$.fragment,n),$(qe.$$.fragment,n),$(me.$$.fragment,n),un=!0)},o(n){U(r.$$.fragment,n),U(ge.$$.fragment,n),U(Ue.$$.fragment,n),U(K.$$.fragment,n),U(Ze.$$.fragment,n),U(ee.$$.fragment,n),U(We.$$.fragment,n),U(Fe.$$.fragment,n),U(Ce.$$.fragment,n),U(ne.$$.fragment,n),U(Ne.$$.fragment,n),U(Be.$$.fragment,n),U(oe.$$.fragment,n),U(se.$$.fragment,n),U(ie.$$.fragment,n),U(le.$$.fragment,n),U(Xe.$$.fragment,n),U(re.$$.fragment,n),U(de.$$.fragment,n),U(Re.$$.fragment,n),U(Le.$$.fragment,n),U(Ae.$$.fragment,n),U(Ye.$$.fragment,n),U(qe.$$.fragment,n),U(me.$$.fragment,n),un=!1},d(n){t(d),n&&t(b),n&&t(c),S(r),n&&t(_),n&&t(j),S(ge),n&&t(ln),n&&t(Z),n&&t(rn),n&&t(et),n&&t(dn),n&&t(H),n&&t(cn),n&&t(tt),n&&t(pn),n&&t(O),n&&t(fn),n&&t(w),S(Ue),S(K),S(Ze),S(ee),S(We),S(Fe),S(Ce),S(ne),S(Ne),S(Be),S(oe),S(se),S(ie),S(le),S(Xe),S(re),S(de),S(Re),S(Le),S(Ae),n&&t(mn),n&&t(N),S(Ye),S(qe),S(me)}}}const vi={local:"textguided-image-inpainting",sections:[{local:"diffusers.StableDiffusionInpaintPipeline",title:"StableDiffusionInpaintPipeline"}],title:"Text-Guided Image Inpainting"};function wi(D){return ri(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class $i extends oi{constructor(d){super();si(this,d,wi,yi,ii,{})}}export{$i as default,vi as metadata};
