import{S as hi,i as gi,s as _i,e as s,k as c,w,t as l,M as bi,c as o,d as n,m as f,a as i,x as v,h as r,b as u,G as e,g as y,y as x,q as I,o as M,B as J,v as yi,L as Gt}from"../../../../chunks/vendor-hf-doc-builder.js";import{T as On}from"../../../../chunks/Tip-hf-doc-builder.js";import{D as Z}from"../../../../chunks/Docstring-hf-doc-builder.js";import{C as Nt}from"../../../../chunks/CodeBlock-hf-doc-builder.js";import{I as Wt}from"../../../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Ft}from"../../../../chunks/ExampleCodeBlock-hf-doc-builder.js";function wi(k){let p,_,h,d,b,a,m,N,V,ce,H,L,fe,W,S,te,A;return{c(){p=s("p"),_=l("Make sure to check out the Stable Diffusion "),h=s("a"),d=l("Tips"),b=l(" section to learn how to explore the tradeoff between scheduler speed and quality, and how to reuse pipeline components efficiently!"),a=c(),m=s("p"),N=l("If you\u2019re interested in using one of the official checkpoints for a task, explore the "),V=s("a"),ce=l("CompVis"),H=l(", "),L=s("a"),fe=l("Runway"),W=l(", and "),S=s("a"),te=l("Stability AI"),A=l(" Hub organizations!"),this.h()},l(j){p=o(j,"P",{});var E=i(p);_=r(E,"Make sure to check out the Stable Diffusion "),h=o(E,"A",{href:!0});var gt=i(h);d=r(gt,"Tips"),gt.forEach(n),b=r(E," section to learn how to explore the tradeoff between scheduler speed and quality, and how to reuse pipeline components efficiently!"),E.forEach(n),a=f(j),m=o(j,"P",{});var F=i(m);N=r(F,"If you\u2019re interested in using one of the official checkpoints for a task, explore the "),V=o(F,"A",{href:!0,rel:!0});var G=i(V);ce=r(G,"CompVis"),G.forEach(n),H=r(F,", "),L=o(F,"A",{href:!0,rel:!0});var _t=i(L);fe=r(_t,"Runway"),_t.forEach(n),W=r(F,", and "),S=o(F,"A",{href:!0,rel:!0});var q=i(S);te=r(q,"Stability AI"),q.forEach(n),A=r(F," Hub organizations!"),F.forEach(n),this.h()},h(){u(h,"href","overview#tips"),u(V,"href","https://huggingface.co/CompVis"),u(V,"rel","nofollow"),u(L,"href","https://huggingface.co/runwayml"),u(L,"rel","nofollow"),u(S,"href","https://huggingface.co/stabilityai"),u(S,"rel","nofollow")},m(j,E){y(j,p,E),e(p,_),e(p,h),e(h,d),e(p,b),y(j,a,E),y(j,m,E),e(m,N),e(m,V),e(V,ce),e(m,H),e(m,L),e(L,fe),e(m,W),e(m,S),e(S,te),e(m,A)},d(j){j&&n(p),j&&n(a),j&&n(m)}}}function vi(k){let p,_,h,d,b;return d=new Nt({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(){p=s("p"),_=l("Examples:"),h=c(),w(d.$$.fragment)},l(a){p=o(a,"P",{});var m=i(p);_=r(m,"Examples:"),m.forEach(n),h=f(a),v(d.$$.fragment,a)},m(a,m){y(a,p,m),e(p,_),y(a,h,m),x(d,a,m),b=!0},p:Gt,i(a){b||(I(d.$$.fragment,a),b=!0)},o(a){M(d.$$.fragment,a),b=!1},d(a){a&&n(p),a&&n(h),J(d,a)}}}function xi(k){let p,_,h,d,b;return{c(){p=s("p"),_=l("\u26A0\uFE0F Don\u2019t enable attention slicing if you\u2019re already using "),h=s("code"),d=l("scaled_dot_product_attention"),b=l(` (SDPA) from PyTorch
2.0 or xFormers. These attention computations are already very memory efficient so you won\u2019t need to enable
this function. If you enable attention slicing with SDPA or xFormers, it can lead to serious slow downs!`)},l(a){p=o(a,"P",{});var m=i(p);_=r(m,"\u26A0\uFE0F Don\u2019t enable attention slicing if you\u2019re already using "),h=o(m,"CODE",{});var N=i(h);d=r(N,"scaled_dot_product_attention"),N.forEach(n),b=r(m,` (SDPA) from PyTorch
2.0 or xFormers. These attention computations are already very memory efficient so you won\u2019t need to enable
this function. If you enable attention slicing with SDPA or xFormers, it can lead to serious slow downs!`),m.forEach(n)},m(a,m){y(a,p,m),e(p,_),e(p,h),e(h,d),e(p,b)},d(a){a&&n(p)}}}function Ii(k){let p,_,h,d,b;return d=new Nt({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwU3RhYmxlRGlmZnVzaW9uUGlwZWxpbmUlMEElMEFwaXBlJTIwJTNEJTIwU3RhYmxlRGlmZnVzaW9uUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMnJ1bndheW1sJTJGc3RhYmxlLWRpZmZ1c2lvbi12MS01JTIyJTJDJTBBJTIwJTIwJTIwJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTBBJTIwJTIwJTIwJTIwdXNlX3NhZmV0ZW5zb3JzJTNEVHJ1ZSUyQyUwQSklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJhJTIwcGhvdG8lMjBvZiUyMGFuJTIwYXN0cm9uYXV0JTIwcmlkaW5nJTIwYSUyMGhvcnNlJTIwb24lMjBtYXJzJTIyJTBBcGlwZS5lbmFibGVfYXR0ZW50aW9uX3NsaWNpbmcoKSUwQWltYWdlJTIwJTNEJTIwcGlwZShwcm9tcHQpLmltYWdlcyU1QjAlNUQ=",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> StableDiffusionPipeline

<span class="hljs-meta">&gt;&gt;&gt; </span>pipe = StableDiffusionPipeline.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>,
<span class="hljs-meta">... </span>    torch_dtype=torch.float16,
<span class="hljs-meta">... </span>    use_safetensors=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;a photo of an astronaut riding a horse on mars&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>pipe.enable_attention_slicing()
<span class="hljs-meta">&gt;&gt;&gt; </span>image = pipe(prompt).images[<span class="hljs-number">0</span>]`}}),{c(){p=s("p"),_=l("Examples:"),h=c(),w(d.$$.fragment)},l(a){p=o(a,"P",{});var m=i(p);_=r(m,"Examples:"),m.forEach(n),h=f(a),v(d.$$.fragment,a)},m(a,m){y(a,p,m),e(p,_),y(a,h,m),x(d,a,m),b=!0},p:Gt,i(a){b||(I(d.$$.fragment,a),b=!0)},o(a){M(d.$$.fragment,a),b=!1},d(a){a&&n(p),a&&n(h),J(d,a)}}}function Mi(k){let p,_;return{c(){p=s("p"),_=l(`\u26A0\uFE0F When memory efficient attention and sliced attention are both enabled, memory efficient attention takes
precedent.`)},l(h){p=o(h,"P",{});var d=i(p);_=r(d,`\u26A0\uFE0F When memory efficient attention and sliced attention are both enabled, memory efficient attention takes
precedent.`),d.forEach(n)},m(h,d){y(h,p,d),e(p,_)},d(h){h&&n(p)}}}function Ji(k){let p,_,h,d,b;return d=new Nt({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(){p=s("p"),_=l("Examples:"),h=c(),w(d.$$.fragment)},l(a){p=o(a,"P",{});var m=i(p);_=r(m,"Examples:"),m.forEach(n),h=f(a),v(d.$$.fragment,a)},m(a,m){y(a,p,m),e(p,_),y(a,h,m),x(d,a,m),b=!0},p:Gt,i(a){b||(I(d.$$.fragment,a),b=!0)},o(a){M(d.$$.fragment,a),b=!1},d(a){a&&n(p),a&&n(h),J(d,a)}}}function $i(k){let p,_,h,d,b;return d=new Nt({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(){p=s("p"),_=l("To load a textual inversion embedding vector in \u{1F917} Diffusers format:"),h=c(),w(d.$$.fragment)},l(a){p=o(a,"P",{});var m=i(p);_=r(m,"To load a textual inversion embedding vector in \u{1F917} Diffusers format:"),m.forEach(n),h=f(a),v(d.$$.fragment,a)},m(a,m){y(a,p,m),e(p,_),y(a,h,m),x(d,a,m),b=!0},p:Gt,i(a){b||(I(d.$$.fragment,a),b=!0)},o(a){M(d.$$.fragment,a),b=!1},d(a){a&&n(p),a&&n(h),J(d,a)}}}function Ti(k){let p,_,h,d,b;return d=new Nt({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(){p=s("p"),_=l("locally:"),h=c(),w(d.$$.fragment)},l(a){p=o(a,"P",{});var m=i(p);_=r(m,"locally:"),m.forEach(n),h=f(a),v(d.$$.fragment,a)},m(a,m){y(a,p,m),e(p,_),y(a,h,m),x(d,a,m),b=!0},p:Gt,i(a){b||(I(d.$$.fragment,a),b=!0)},o(a){M(d.$$.fragment,a),b=!1},d(a){a&&n(p),a&&n(h),J(d,a)}}}function ki(k){let p,_;return{c(){p=s("p"),_=l("\u{1F9EA} This is an experimental feature!")},l(h){p=o(h,"P",{});var d=i(p);_=r(d,"\u{1F9EA} This is an experimental feature!"),d.forEach(n)},m(h,d){y(h,p,d),e(p,_)},d(h){h&&n(p)}}}function Si(k){let p,_,h,d,b;return d=new Nt({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(){p=s("p"),_=l("Examples:"),h=c(),w(d.$$.fragment)},l(a){p=o(a,"P",{});var m=i(p);_=r(m,"Examples:"),m.forEach(n),h=f(a),v(d.$$.fragment,a)},m(a,m){y(a,p,m),e(p,_),y(a,h,m),x(d,a,m),b=!0},p:Gt,i(a){b||(I(d.$$.fragment,a),b=!0)},o(a){M(d.$$.fragment,a),b=!1},d(a){a&&n(p),a&&n(h),J(d,a)}}}function Di(k){let p,_,h,d,b,a,m,N,V,ce,H,L,fe,W,S,te,A,j,E,gt,F,G,_t,q,Kn,ea,We,ta,na,In,ue,Mn,ne,me,Bt,Fe,aa,Xt,sa,Jn,$,Ge,oa,Ct,ia,la,Ne,ra,bt,pa,da,ca,Rt,fa,ua,ae,yt,wt,ma,ha,ga,vt,xt,_a,ba,ya,It,Mt,wa,va,xa,O,Be,Ia,Vt,Ma,Ja,he,$a,B,Xe,Ta,Lt,ka,Sa,ge,Da,_e,Ua,be,Ce,ja,Re,Pa,At,Za,Ea,Wa,X,Ve,Fa,Le,Ga,Ae,Na,Ba,Xa,ye,Ca,we,Ra,ve,Ye,Va,ze,La,Qe,Aa,Ya,za,D,He,Qa,qe,Ha,Jt,qa,Oa,Ka,Yt,es,ts,xe,ns,Oe,as,Ke,ss,os,is,Ie,ls,U,et,rs,Y,ps,zt,ds,cs,Qt,fs,us,Ht,ms,hs,gs,tt,_s,qt,bs,ys,ws,nt,vs,$t,xs,Is,Ms,se,Js,Tt,$s,Ts,Ot,ks,Ss,Ds,oe,Us,kt,js,Ps,Kt,Zs,Es,Ws,Me,at,Fs,en,Gs,Ns,Je,st,Bs,z,Xs,tn,Cs,Rs,nn,Vs,Ls,an,As,Ys,$n,ie,$e,sn,ot,zs,on,Qs,Tn,le,it,Hs,ln,qs,kn,re,Te,rn,lt,Os,pn,Ks,Sn,P,rt,eo,dn,to,no,ke,ao,pt,so,St,oo,io,lo,K,dt,ro,cn,po,co,Se,Dn,pe,De,fn,ct,fo,un,uo,Un,Q,ft,mo,mn,ho,go,Ue,ut,_o,hn,bo,jn;return a=new Wt({}),A=new Wt({}),ue=new On({props:{$$slots:{default:[wi]},$$scope:{ctx:k}}}),Fe=new Wt({}),Ge=new Z({props:{name:"class diffusers.StableDiffusionInpaintPipeline",anchor:"diffusers.StableDiffusionInpaintPipeline",parameters:[{name:"vae",val:": typing.Union[diffusers.models.autoencoder_kl.AutoencoderKL, diffusers.models.autoencoder_asym_kl.AsymmetricAutoencoderKL]"},{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> ([<code>AutoencoderKL</code>, <code>AsymmetricAutoencoderKL</code>]) &#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 (<a href="https://huggingface.co/openai/clip-vit-large-patch14" rel="nofollow">clip-vit-large-patch14</a>).`,name:"text_encoder"},{anchor:"diffusers.StableDiffusionInpaintPipeline.tokenizer",description:`<strong>tokenizer</strong> (<a href="https://huggingface.co/docs/transformers/v4.31.0/en/model_doc/clip#transformers.CLIPTokenizer" rel="nofollow">CLIPTokenizer</a>) &#x2014;
A <code>CLIPTokenizer</code> to tokenize text.`,name:"tokenizer"},{anchor:"diffusers.StableDiffusionInpaintPipeline.unet",description:`<strong>unet</strong> (<a href="/docs/diffusers/v0.20.0/en/api/models/unet2d-cond#diffusers.UNet2DConditionModel">UNet2DConditionModel</a>) &#x2014;
A <code>UNet2DConditionModel</code> to denoise the encoded image latents.`,name:"unet"},{anchor:"diffusers.StableDiffusionInpaintPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/v0.20.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.20.0/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>, <a href="/docs/diffusers/v0.20.0/en/api/schedulers/lms_discrete#diffusers.LMSDiscreteScheduler">LMSDiscreteScheduler</a>, or <a href="/docs/diffusers/v0.20.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 more details
about a model&#x2019;s potential harms.`,name:"safety_checker"},{anchor:"diffusers.StableDiffusionInpaintPipeline.feature_extractor",description:`<strong>feature_extractor</strong> (<a href="https://huggingface.co/docs/transformers/v4.31.0/en/model_doc/clip#transformers.CLIPImageProcessor" rel="nofollow">CLIPImageProcessor</a>) &#x2014;
A <code>CLIPImageProcessor</code> to extract features from generated images; used as inputs to the <code>safety_checker</code>.`,name:"feature_extractor"}],source:"https://github.com/huggingface/diffusers/blob/v0.20.0/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py#L155"}}),Be=new Z({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[typing.List[str], 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 image generation. If not defined, you need to pass <code>prompt_embeds</code>.`,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 to be inpainted (which parts of the image to 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 are repainted
while black pixels are preserved. If <code>mask_image</code> is a PIL image, it is 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 <code>self.unet.config.sample_size * self.vae_scale_factor</code>) &#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 <code>self.unet.config.sample_size * self.vae_scale_factor</code>) &#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.0) &#x2014;
Indicates extent to transform the reference <code>image</code>. Must be between 0 and 1. <code>image</code> is used as a
starting point and more noise is added the higher 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 is maximum and the denoising
process runs for the full number of iterations specified in <code>num_inference_steps</code>. A value of 1
essentially ignores <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. This parameter is modulated by <code>strength</code>.`,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;
A higher guidance scale value encourages the model to generate images closely linked to the text
<code>prompt</code> at the expense of lower image quality. Guidance scale is enabled when <code>guidance_scale &gt; 1</code>.`,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 to guide what to not include in image generation. If not defined, you need to
pass <code>negative_prompt_embeds</code> instead. Ignored when not using guidance (<code>guidance_scale &lt; 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;) from the <a href="https://arxiv.org/abs/2010.02502" rel="nofollow">DDIM</a> paper. Only applies
to the <a href="/docs/diffusers/v0.20.0/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>, and is ignored in other schedulers.`,name:"eta"},{anchor:"diffusers.StableDiffusionInpaintPipeline.__call__.generator",description:`<strong>generator</strong> (<code>torch.Generator</code> or <code>List[torch.Generator]</code>, <em>optional</em>) &#x2014;
A <a href="https://pytorch.org/docs/stable/generated/torch.Generator.html" rel="nofollow"><code>torch.Generator</code></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 is 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 (prompt weighting). If not
provided, text embeddings are generated from the <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 (prompt weighting). If
not provided, <code>negative_prompt_embeds</code> are generated from the <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 generated image. Choose between <code>PIL.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.20.0/en/api/pipelines/stable_diffusion/upscale#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 calls every <code>callback_steps</code> steps during inference. The function is 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 is called. If not specified, the callback is 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 in
<a href="https://github.com/huggingface/diffusers/blob/main/src/diffusers/models/attention_processor.py" rel="nofollow"><code>self.processor</code></a>.`,name:"cross_attention_kwargs"}],source:"https://github.com/huggingface/diffusers/blob/v0.20.0/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py#L678",returnDescription:`
<p>If <code>return_dict</code> is <code>True</code>, <a
  href="/docs/diffusers/v0.20.0/en/api/pipelines/stable_diffusion/upscale#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"
>StableDiffusionPipelineOutput</a> is returned,
otherwise a <code>tuple</code> is returned where the first element is a list with the generated images and the
second element is a list of <code>bool</code>s indicating whether the corresponding generated image contains
\u201Cnot-safe-for-work\u201D (nsfw) content.</p>
`,returnType:`
<p><a
  href="/docs/diffusers/v0.20.0/en/api/pipelines/stable_diffusion/upscale#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"
>StableDiffusionPipelineOutput</a> or <code>tuple</code></p>
`}}),he=new Ft({props:{anchor:"diffusers.StableDiffusionInpaintPipeline.__call__.example",$$slots:{default:[vi]},$$scope:{ctx:k}}}),Xe=new Z({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.20.0/src/diffusers/pipelines/pipeline_utils.py#L1688"}}),ge=new On({props:{warning:!0,$$slots:{default:[xi]},$$scope:{ctx:k}}}),_e=new Ft({props:{anchor:"diffusers.StableDiffusionInpaintPipeline.enable_attention_slicing.example",$$slots:{default:[Ii]},$$scope:{ctx:k}}}),Ce=new Z({props:{name:"disable_attention_slicing",anchor:"diffusers.StableDiffusionInpaintPipeline.disable_attention_slicing",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.20.0/src/diffusers/pipelines/pipeline_utils.py#L1728"}}),Ve=new Z({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.20.0/src/diffusers/pipelines/pipeline_utils.py#L1627"}}),ye=new On({props:{warning:!0,$$slots:{default:[Mi]},$$scope:{ctx:k}}}),we=new Ft({props:{anchor:"diffusers.StableDiffusionInpaintPipeline.enable_xformers_memory_efficient_attention.example",$$slots:{default:[Ji]},$$scope:{ctx:k}}}),Ye=new Z({props:{name:"disable_xformers_memory_efficient_attention",anchor:"diffusers.StableDiffusionInpaintPipeline.disable_xformers_memory_efficient_attention",parameters:[],source:"https://github.com/huggingface/diffusers/blob/v0.20.0/src/diffusers/pipelines/pipeline_utils.py#L1662"}}),He=new Z({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 one of the following or a list of them:</p>
<ul>
<li>A string, the <em>model id</em> (for example <code>sd-concepts-library/low-poly-hd-logos-icons</code>) of a
pretrained model hosted on the Hub.</li>
<li>A path to a <em>directory</em> (for example <code>./my_text_inversion_directory/</code>) containing the textual
inversion weights.</li>
<li>A path to a <em>file</em> (for example <code>./my_text_inversions.pt</code>) containing textual inversion weights.</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"},{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 when:</p>
<ul>
<li>The saved textual inversion file is in &#x1F917; Diffusers 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 Automatic1111 format.</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 where a downloaded pretrained model configuration is cached if the standard cache
is not 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 resume downloading the model weights and configuration files. If set to <code>False</code>, any
incompletely downloaded files are deleted.`,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, for example, <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",description:`<strong>local_files_only</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to only load local model weights and configuration files or not. If set to <code>True</code>, the model
won&#x2019;t be downloaded from the Hub.`,name:"local_files_only"},{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>, the token generated from
<code>diffusers-cli login</code> (stored in <code>~/.huggingface</code>) is used.`,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, a commit id, or 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;
The subfolder location of a model file within a larger model repository on the Hub or locally.`,name:"subfolder"},{anchor:"diffusers.StableDiffusionInpaintPipeline.load_textual_inversion.mirror",description:`<strong>mirror</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Mirror source to resolve accessibility issues if you&#x2019;re downloading a model in China. We do not
guarantee the timeliness or safety of the source, and you should refer to the mirror site for more
information.`,name:"mirror"}],source:"https://github.com/huggingface/diffusers/blob/v0.20.0/src/diffusers/loaders.py#L634"}}),xe=new Ft({props:{anchor:"diffusers.StableDiffusionInpaintPipeline.load_textual_inversion.example",$$slots:{default:[$i]},$$scope:{ctx:k}}}),Ie=new Ft({props:{anchor:"diffusers.StableDiffusionInpaintPipeline.load_textual_inversion.example-2",$$slots:{default:[Ti]},$$scope:{ctx:k}}}),et=new Z({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;
See <a href="/docs/diffusers/v0.20.0/en/api/loaders#diffusers.loaders.LoraLoaderMixin.lora_state_dict">lora_state_dict()</a>.`,name:"pretrained_model_name_or_path_or_dict"},{anchor:"diffusers.StableDiffusionInpaintPipeline.load_lora_weights.kwargs",description:`<strong>kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
See <a href="/docs/diffusers/v0.20.0/en/api/loaders#diffusers.loaders.LoraLoaderMixin.lora_state_dict">lora_state_dict()</a>.`,name:"kwargs"}],source:"https://github.com/huggingface/diffusers/blob/v0.20.0/src/diffusers/loaders.py#L906"}}),at=new Z({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 = True"}],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 save LoRA parameters to. 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 <code>unet</code>.`,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]</code> or <code>Dict[str, torch.Tensor]</code>) &#x2014;
State dict of the LoRA layers corresponding to the <code>text_encoder</code>. Must explicitly pass the text
encoder LoRA state dict because it comes from &#x1F917; Transformers.`,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 during distributed training and you
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 during distributed training when you need to
replace <code>torch.save</code> with another method. Can be configured with the environment variable
<code>DIFFUSERS_SAVE_MODE</code>.`,name:"save_function"},{anchor:"diffusers.StableDiffusionInpaintPipeline.save_lora_weights.safe_serialization",description:`<strong>safe_serialization</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to save the model using <code>safetensors</code> or the traditional PyTorch way with <code>pickle</code>.`,name:"safe_serialization"}],source:"https://github.com/huggingface/diffusers/blob/v0.20.0/src/diffusers/loaders.py#L1410"}}),st=new Z({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.20.0/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_inpaint.py#L286"}}),ot=new Wt({}),it=new Z({props:{name:"class diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput",anchor:"diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput",parameters:[{name:"images",val:": typing.Union[typing.List[PIL.Image.Image], numpy.ndarray]"},{name:"nsfw_content_detected",val:": typing.Optional[typing.List[bool]]"}],parametersDescription:[{anchor:"diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput.images",description:`<strong>images</strong> (<code>List[PIL.Image.Image]</code> or <code>np.ndarray</code>) &#x2014;
List of denoised PIL images of length <code>batch_size</code> or NumPy array of shape <code>(batch_size, height, width, num_channels)</code>.`,name:"images"},{anchor:"diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput.nsfw_content_detected",description:`<strong>nsfw_content_detected</strong> (<code>List[bool]</code>) &#x2014;
List indicating whether the corresponding generated image contains &#x201C;not-safe-for-work&#x201D; (nsfw) content or
<code>None</code> if safety checking could not be performed.`,name:"nsfw_content_detected"}],source:"https://github.com/huggingface/diffusers/blob/v0.20.0/src/diffusers/pipelines/stable_diffusion/__init__.py#L22"}}),lt=new Wt({}),rt=new Z({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.20.0/en/api/models/autoencoderkl#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> (<a href="https://huggingface.co/docs/transformers/v4.31.0/en/model_doc/clip#transformers.FlaxCLIPTextModel" rel="nofollow">FlaxCLIPTextModel</a>) &#x2014;
Frozen text-encoder (<a href="https://huggingface.co/openai/clip-vit-large-patch14" rel="nofollow">clip-vit-large-patch14</a>).`,name:"text_encoder"},{anchor:"diffusers.FlaxStableDiffusionInpaintPipeline.tokenizer",description:`<strong>tokenizer</strong> (<a href="https://huggingface.co/docs/transformers/v4.31.0/en/model_doc/clip#transformers.CLIPTokenizer" rel="nofollow">CLIPTokenizer</a>) &#x2014;
A <code>CLIPTokenizer</code> to tokenize text.`,name:"tokenizer"},{anchor:"diffusers.FlaxStableDiffusionInpaintPipeline.unet",description:`<strong>unet</strong> (<a href="/docs/diffusers/v0.20.0/en/api/models/unet2d-cond#diffusers.FlaxUNet2DConditionModel">FlaxUNet2DConditionModel</a>) &#x2014;
A <code>FlaxUNet2DConditionModel</code> to denoise the encoded image latents.`,name:"unet"},{anchor:"diffusers.FlaxStableDiffusionInpaintPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/v0.20.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 more details
about a model&#x2019;s potential harms.`,name:"safety_checker"},{anchor:"diffusers.FlaxStableDiffusionInpaintPipeline.feature_extractor",description:`<strong>feature_extractor</strong> (<a href="https://huggingface.co/docs/transformers/v4.31.0/en/model_doc/clip#transformers.CLIPImageProcessor" rel="nofollow">CLIPImageProcessor</a>) &#x2014;
A <code>CLIPImageProcessor</code> to extract features from generated images; used as inputs to the <code>safety_checker</code>.`,name:"feature_extractor"}],source:"https://github.com/huggingface/diffusers/blob/v0.20.0/src/diffusers/pipelines/stable_diffusion/pipeline_flax_stable_diffusion_inpaint.py#L102"}}),ke=new On({props:{warning:!0,$$slots:{default:[ki]},$$scope:{ctx:k}}}),dt=new Z({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 image generation.`,name:"prompt"},{anchor:"diffusers.FlaxStableDiffusionInpaintPipeline.__call__.height",description:`<strong>height</strong> (<code>int</code>, <em>optional</em>, defaults to <code>self.unet.config.sample_size * self.vae_scale_factor</code>) &#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 <code>self.unet.config.sample_size * self.vae_scale_factor</code>) &#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. This parameter is modulated by <code>strength</code>.`,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;
A higher guidance scale value encourages the model to generate images closely linked to the text
<code>prompt</code> at the expense of lower image quality. Guidance scale is enabled when <code>guidance_scale &gt; 1</code>.`,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. If not provided, a latents
array is 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.</p>
<div class="course-tip course-tip-orange bg-gradient-to-br dark:bg-gradient-to-r before:border-orange-500 dark:before:border-orange-800 from-orange-50 dark:from-gray-900 to-white dark:to-gray-950 border border-orange-50 text-orange-700 dark:text-gray-400">
						
<p>This argument exists because <code>__call__</code> is not yet end-to-end pmap-able. It will be removed in a
future release.</p>

					</div>`,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 <a href="/docs/diffusers/v0.20.0/en/api/pipelines/stable_diffusion/text2img#diffusers.pipelines.stable_diffusion.FlaxStableDiffusionPipelineOutput">FlaxStableDiffusionPipelineOutput</a> instead of
a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/diffusers/blob/v0.20.0/src/diffusers/pipelines/stable_diffusion/pipeline_flax_stable_diffusion_inpaint.py#L394",returnDescription:`
<p>If <code>return_dict</code> is <code>True</code>, <a
  href="/docs/diffusers/v0.20.0/en/api/pipelines/stable_diffusion/text2img#diffusers.pipelines.stable_diffusion.FlaxStableDiffusionPipelineOutput"
>FlaxStableDiffusionPipelineOutput</a> is
returned, otherwise a <code>tuple</code> is returned where the first element is a list with the generated images
and the second element is a list of <code>bool</code>s indicating whether the corresponding generated image
contains \u201Cnot-safe-for-work\u201D (nsfw) content.</p>
`,returnType:`
<p><a
  href="/docs/diffusers/v0.20.0/en/api/pipelines/stable_diffusion/text2img#diffusers.pipelines.stable_diffusion.FlaxStableDiffusionPipelineOutput"
>FlaxStableDiffusionPipelineOutput</a> or <code>tuple</code></p>
`}}),Se=new Ft({props:{anchor:"diffusers.FlaxStableDiffusionInpaintPipeline.__call__.example",$$slots:{default:[Si]},$$scope:{ctx:k}}}),ct=new Wt({}),ft=new Z({props:{name:"class diffusers.pipelines.stable_diffusion.FlaxStableDiffusionPipelineOutput",anchor:"diffusers.pipelines.stable_diffusion.FlaxStableDiffusionPipelineOutput",parameters:[{name:"images",val:": ndarray"},{name:"nsfw_content_detected",val:": typing.List[bool]"}],parametersDescription:[{anchor:"diffusers.pipelines.stable_diffusion.FlaxStableDiffusionPipelineOutput.images",description:`<strong>images</strong> (<code>np.ndarray</code>) &#x2014;
Denoised images of array shape of <code>(batch_size, height, width, num_channels)</code>.`,name:"images"},{anchor:"diffusers.pipelines.stable_diffusion.FlaxStableDiffusionPipelineOutput.nsfw_content_detected",description:`<strong>nsfw_content_detected</strong> (<code>List[bool]</code>) &#x2014;
List indicating whether the corresponding generated image contains &#x201C;not-safe-for-work&#x201D; (nsfw) content
or <code>None</code> if safety checking could not be performed.`,name:"nsfw_content_detected"}],source:"https://github.com/huggingface/diffusers/blob/v0.20.0/src/diffusers/pipelines/stable_diffusion/__init__.py#L118"}}),ut=new Z({props:{name:"replace",anchor:"diffusers.pipelines.stable_diffusion.FlaxStableDiffusionPipelineOutput.replace",parameters:[{name:"**updates",val:""}],source:"https://github.com/huggingface/diffusers/blob/v0.20.0/src/flax/struct.py#L111"}}),{c(){p=s("meta"),_=c(),h=s("h1"),d=s("a"),b=s("span"),w(a.$$.fragment),m=c(),N=s("span"),V=l("Inpainting"),ce=c(),H=s("p"),L=l("The Stable Diffusion model can also be applied to inpainting which lets you edit specific parts of an image by providing a mask and a text prompt using Stable Diffusion."),fe=c(),W=s("h2"),S=s("a"),te=s("span"),w(A.$$.fragment),j=c(),E=s("span"),gt=l("Tips"),F=c(),G=s("p"),_t=l(`It is recommended to use this pipeline with checkpoints that have been specifically fine-tuned for inpainting, such
as `),q=s("a"),Kn=l("runwayml/stable-diffusion-inpainting"),ea=l(`. Default
text-to-image Stable Diffusion checkpoints, such as
`),We=s("a"),ta=l("runwayml/stable-diffusion-v1-5"),na=l(" are also compatible but they might be less performant."),In=c(),w(ue.$$.fragment),Mn=c(),ne=s("h2"),me=s("a"),Bt=s("span"),w(Fe.$$.fragment),aa=c(),Xt=s("span"),sa=l("StableDiffusionInpaintPipeline"),Jn=c(),$=s("div"),w(Ge.$$.fragment),oa=c(),Ct=s("p"),ia=l("Pipeline for text-guided image inpainting using Stable Diffusion."),la=c(),Ne=s("p"),ra=l("This model inherits from "),bt=s("a"),pa=l("DiffusionPipeline"),da=l(`. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).`),ca=c(),Rt=s("p"),fa=l("The pipeline also inherits the following loading methods:"),ua=c(),ae=s("ul"),yt=s("li"),wt=s("a"),ma=l("load_textual_inversion()"),ha=l(" for loading textual inversion embeddings"),ga=c(),vt=s("li"),xt=s("a"),_a=l("load_lora_weights()"),ba=l(" for loading LoRA weights"),ya=c(),It=s("li"),Mt=s("a"),wa=l("save_lora_weights()"),va=l(" for saving LoRA weights"),xa=c(),O=s("div"),w(Be.$$.fragment),Ia=c(),Vt=s("p"),Ma=l("The call function to the pipeline for generation."),Ja=c(),w(he.$$.fragment),$a=c(),B=s("div"),w(Xe.$$.fragment),Ta=c(),Lt=s("p"),ka=l(`Enable sliced attention computation. When this option is enabled, the attention module splits the input tensor
in slices to compute attention in several steps. For more than one attention head, the computation is performed
sequentially over each head. This is useful to save some memory in exchange for a small speed decrease.`),Sa=c(),w(ge.$$.fragment),Da=c(),w(_e.$$.fragment),Ua=c(),be=s("div"),w(Ce.$$.fragment),ja=c(),Re=s("p"),Pa=l("Disable sliced attention computation. If "),At=s("code"),Za=l("enable_attention_slicing"),Ea=l(` was previously called, attention is
computed in one step.`),Wa=c(),X=s("div"),w(Ve.$$.fragment),Fa=c(),Le=s("p"),Ga=l("Enable memory efficient attention from "),Ae=s("a"),Na=l("xFormers"),Ba=l(`. When this
option is enabled, you should observe lower GPU memory usage and a potential speed up during inference. Speed
up during training is not guaranteed.`),Xa=c(),w(ye.$$.fragment),Ca=c(),w(we.$$.fragment),Ra=c(),ve=s("div"),w(Ye.$$.fragment),Va=c(),ze=s("p"),La=l("Disable memory efficient attention from "),Qe=s("a"),Aa=l("xFormers"),Ya=l("."),za=c(),D=s("div"),w(He.$$.fragment),Qa=c(),qe=s("p"),Ha=l("Load textual inversion embeddings into the text encoder of "),Jt=s("a"),qa=l("StableDiffusionPipeline"),Oa=l(` (both \u{1F917} Diffusers and
Automatic1111 formats are supported).`),Ka=c(),Yt=s("p"),es=l("Example:"),ts=c(),w(xe.$$.fragment),ns=c(),Oe=s("p"),as=l(`To load a textual inversion embedding vector in Automatic1111 format, make sure to download the vector first
(for example from `),Ke=s("a"),ss=l("civitAI"),os=l(") and then load the vector"),is=c(),w(Ie.$$.fragment),ls=c(),U=s("div"),w(et.$$.fragment),rs=c(),Y=s("p"),ps=l("Load LoRA weights specified in "),zt=s("code"),ds=l("pretrained_model_name_or_path_or_dict"),cs=l(" into "),Qt=s("code"),fs=l("self.unet"),us=l(` and
`),Ht=s("code"),ms=l("self.text_encoder"),hs=l("."),gs=c(),tt=s("p"),_s=l("All kwargs are forwarded to "),qt=s("code"),bs=l("self.lora_state_dict"),ys=l("."),ws=c(),nt=s("p"),vs=l("See "),$t=s("a"),xs=l("lora_state_dict()"),Is=l(" for more details on how the state dict is loaded."),Ms=c(),se=s("p"),Js=l("See "),Tt=s("a"),$s=l("load_lora_into_unet()"),Ts=l(` for more details on how the state dict is loaded into
`),Ot=s("code"),ks=l("self.unet"),Ss=l("."),Ds=c(),oe=s("p"),Us=l("See "),kt=s("a"),js=l("load_lora_into_text_encoder()"),Ps=l(` for more details on how the state dict is loaded
into `),Kt=s("code"),Zs=l("self.text_encoder"),Es=l("."),Ws=c(),Me=s("div"),w(at.$$.fragment),Fs=c(),en=s("p"),Gs=l("Save the LoRA parameters corresponding to the UNet and text encoder."),Ns=c(),Je=s("div"),w(st.$$.fragment),Bs=c(),z=s("p"),Xs=l(`Offload all models to CPU to reduce memory usage with a low impact on performance. Moves one whole model at a
time to the GPU when its `),tn=s("code"),Cs=l("forward"),Rs=l(` method is called, and the model remains in GPU until the next model runs.
Memory savings are lower than using `),nn=s("code"),Vs=l("enable_sequential_cpu_offload"),Ls=l(`, but performance is much better due to the
iterative execution of the `),an=s("code"),As=l("unet"),Ys=l("."),$n=c(),ie=s("h2"),$e=s("a"),sn=s("span"),w(ot.$$.fragment),zs=c(),on=s("span"),Qs=l("StableDiffusionPipelineOutput"),Tn=c(),le=s("div"),w(it.$$.fragment),Hs=c(),ln=s("p"),qs=l("Output class for Stable Diffusion pipelines."),kn=c(),re=s("h2"),Te=s("a"),rn=s("span"),w(lt.$$.fragment),Os=c(),pn=s("span"),Ks=l("FlaxStableDiffusionInpaintPipeline"),Sn=c(),P=s("div"),w(rt.$$.fragment),eo=c(),dn=s("p"),to=l("Flax-based pipeline for text-guided image inpainting using Stable Diffusion."),no=c(),w(ke.$$.fragment),ao=c(),pt=s("p"),so=l("This model inherits from "),St=s("a"),oo=l("FlaxDiffusionPipeline"),io=l(`. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).`),lo=c(),K=s("div"),w(dt.$$.fragment),ro=c(),cn=s("p"),po=l("Function invoked when calling the pipeline for generation."),co=c(),w(Se.$$.fragment),Dn=c(),pe=s("h2"),De=s("a"),fn=s("span"),w(ct.$$.fragment),fo=c(),un=s("span"),uo=l("FlaxStableDiffusionPipelineOutput"),Un=c(),Q=s("div"),w(ft.$$.fragment),mo=c(),mn=s("p"),ho=l("Output class for Flax-based Stable Diffusion pipelines."),go=c(),Ue=s("div"),w(ut.$$.fragment),_o=c(),hn=s("p"),bo=l("\u201CReturns a new object replacing the specified fields with new values."),this.h()},l(t){const g=bi('[data-svelte="svelte-1phssyn"]',document.head);p=o(g,"META",{name:!0,content:!0}),g.forEach(n),_=f(t),h=o(t,"H1",{class:!0});var mt=i(h);d=o(mt,"A",{id:!0,class:!0,href:!0});var gn=i(d);b=o(gn,"SPAN",{});var _n=i(b);v(a.$$.fragment,_n),_n.forEach(n),gn.forEach(n),m=f(mt),N=o(mt,"SPAN",{});var bn=i(N);V=r(bn,"Inpainting"),bn.forEach(n),mt.forEach(n),ce=f(t),H=o(t,"P",{});var yn=i(H);L=r(yn,"The Stable Diffusion model can also be applied to inpainting which lets you edit specific parts of an image by providing a mask and a text prompt using Stable Diffusion."),yn.forEach(n),fe=f(t),W=o(t,"H2",{class:!0});var ht=i(W);S=o(ht,"A",{id:!0,class:!0,href:!0});var wn=i(S);te=o(wn,"SPAN",{});var vn=i(te);v(A.$$.fragment,vn),vn.forEach(n),wn.forEach(n),j=f(ht),E=o(ht,"SPAN",{});var xn=i(E);gt=r(xn,"Tips"),xn.forEach(n),ht.forEach(n),F=f(t),G=o(t,"P",{});var de=i(G);_t=r(de,`It is recommended to use this pipeline with checkpoints that have been specifically fine-tuned for inpainting, such
as `),q=o(de,"A",{href:!0,rel:!0});var xo=i(q);Kn=r(xo,"runwayml/stable-diffusion-inpainting"),xo.forEach(n),ea=r(de,`. Default
text-to-image Stable Diffusion checkpoints, such as
`),We=o(de,"A",{href:!0,rel:!0});var Io=i(We);ta=r(Io,"runwayml/stable-diffusion-v1-5"),Io.forEach(n),na=r(de," are also compatible but they might be less performant."),de.forEach(n),In=f(t),v(ue.$$.fragment,t),Mn=f(t),ne=o(t,"H2",{class:!0});var Pn=i(ne);me=o(Pn,"A",{id:!0,class:!0,href:!0});var Mo=i(me);Bt=o(Mo,"SPAN",{});var Jo=i(Bt);v(Fe.$$.fragment,Jo),Jo.forEach(n),Mo.forEach(n),aa=f(Pn),Xt=o(Pn,"SPAN",{});var $o=i(Xt);sa=r($o,"StableDiffusionInpaintPipeline"),$o.forEach(n),Pn.forEach(n),Jn=f(t),$=o(t,"DIV",{class:!0});var T=i($);v(Ge.$$.fragment,T),oa=f(T),Ct=o(T,"P",{});var To=i(Ct);ia=r(To,"Pipeline for text-guided image inpainting using Stable Diffusion."),To.forEach(n),la=f(T),Ne=o(T,"P",{});var Zn=i(Ne);ra=r(Zn,"This model inherits from "),bt=o(Zn,"A",{href:!0});var ko=i(bt);pa=r(ko,"DiffusionPipeline"),ko.forEach(n),da=r(Zn,`. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).`),Zn.forEach(n),ca=f(T),Rt=o(T,"P",{});var So=i(Rt);fa=r(So,"The pipeline also inherits the following loading methods:"),So.forEach(n),ua=f(T),ae=o(T,"UL",{});var Dt=i(ae);yt=o(Dt,"LI",{});var yo=i(yt);wt=o(yo,"A",{href:!0});var Do=i(wt);ma=r(Do,"load_textual_inversion()"),Do.forEach(n),ha=r(yo," for loading textual inversion embeddings"),yo.forEach(n),ga=f(Dt),vt=o(Dt,"LI",{});var wo=i(vt);xt=o(wo,"A",{href:!0});var Uo=i(xt);_a=r(Uo,"load_lora_weights()"),Uo.forEach(n),ba=r(wo," for loading LoRA weights"),wo.forEach(n),ya=f(Dt),It=o(Dt,"LI",{});var vo=i(It);Mt=o(vo,"A",{href:!0});var jo=i(Mt);wa=r(jo,"save_lora_weights()"),jo.forEach(n),va=r(vo," for saving LoRA weights"),vo.forEach(n),Dt.forEach(n),xa=f(T),O=o(T,"DIV",{class:!0});var Ut=i(O);v(Be.$$.fragment,Ut),Ia=f(Ut),Vt=o(Ut,"P",{});var Po=i(Vt);Ma=r(Po,"The call function to the pipeline for generation."),Po.forEach(n),Ja=f(Ut),v(he.$$.fragment,Ut),Ut.forEach(n),$a=f(T),B=o(T,"DIV",{class:!0});var je=i(B);v(Xe.$$.fragment,je),Ta=f(je),Lt=o(je,"P",{});var Zo=i(Lt);ka=r(Zo,`Enable sliced attention computation. When this option is enabled, the attention module splits the input tensor
in slices to compute attention in several steps. For more than one attention head, the computation is performed
sequentially over each head. This is useful to save some memory in exchange for a small speed decrease.`),Zo.forEach(n),Sa=f(je),v(ge.$$.fragment,je),Da=f(je),v(_e.$$.fragment,je),je.forEach(n),Ua=f(T),be=o(T,"DIV",{class:!0});var En=i(be);v(Ce.$$.fragment,En),ja=f(En),Re=o(En,"P",{});var Wn=i(Re);Pa=r(Wn,"Disable sliced attention computation. If "),At=o(Wn,"CODE",{});var Eo=i(At);Za=r(Eo,"enable_attention_slicing"),Eo.forEach(n),Ea=r(Wn,` was previously called, attention is
computed in one step.`),Wn.forEach(n),En.forEach(n),Wa=f(T),X=o(T,"DIV",{class:!0});var Pe=i(X);v(Ve.$$.fragment,Pe),Fa=f(Pe),Le=o(Pe,"P",{});var Fn=i(Le);Ga=r(Fn,"Enable memory efficient attention from "),Ae=o(Fn,"A",{href:!0,rel:!0});var Wo=i(Ae);Na=r(Wo,"xFormers"),Wo.forEach(n),Ba=r(Fn,`. When this
option is enabled, you should observe lower GPU memory usage and a potential speed up during inference. Speed
up during training is not guaranteed.`),Fn.forEach(n),Xa=f(Pe),v(ye.$$.fragment,Pe),Ca=f(Pe),v(we.$$.fragment,Pe),Pe.forEach(n),Ra=f(T),ve=o(T,"DIV",{class:!0});var Gn=i(ve);v(Ye.$$.fragment,Gn),Va=f(Gn),ze=o(Gn,"P",{});var Nn=i(ze);La=r(Nn,"Disable memory efficient attention from "),Qe=o(Nn,"A",{href:!0,rel:!0});var Fo=i(Qe);Aa=r(Fo,"xFormers"),Fo.forEach(n),Ya=r(Nn,"."),Nn.forEach(n),Gn.forEach(n),za=f(T),D=o(T,"DIV",{class:!0});var C=i(D);v(He.$$.fragment,C),Qa=f(C),qe=o(C,"P",{});var Bn=i(qe);Ha=r(Bn,"Load textual inversion embeddings into the text encoder of "),Jt=o(Bn,"A",{href:!0});var Go=i(Jt);qa=r(Go,"StableDiffusionPipeline"),Go.forEach(n),Oa=r(Bn,` (both \u{1F917} Diffusers and
Automatic1111 formats are supported).`),Bn.forEach(n),Ka=f(C),Yt=o(C,"P",{});var No=i(Yt);es=r(No,"Example:"),No.forEach(n),ts=f(C),v(xe.$$.fragment,C),ns=f(C),Oe=o(C,"P",{});var Xn=i(Oe);as=r(Xn,`To load a textual inversion embedding vector in Automatic1111 format, make sure to download the vector first
(for example from `),Ke=o(Xn,"A",{href:!0,rel:!0});var Bo=i(Ke);ss=r(Bo,"civitAI"),Bo.forEach(n),os=r(Xn,") and then load the vector"),Xn.forEach(n),is=f(C),v(Ie.$$.fragment,C),C.forEach(n),ls=f(T),U=o(T,"DIV",{class:!0});var R=i(U);v(et.$$.fragment,R),rs=f(R),Y=o(R,"P",{});var Ze=i(Y);ps=r(Ze,"Load LoRA weights specified in "),zt=o(Ze,"CODE",{});var Xo=i(zt);ds=r(Xo,"pretrained_model_name_or_path_or_dict"),Xo.forEach(n),cs=r(Ze," into "),Qt=o(Ze,"CODE",{});var Co=i(Qt);fs=r(Co,"self.unet"),Co.forEach(n),us=r(Ze,` and
`),Ht=o(Ze,"CODE",{});var Ro=i(Ht);ms=r(Ro,"self.text_encoder"),Ro.forEach(n),hs=r(Ze,"."),Ze.forEach(n),gs=f(R),tt=o(R,"P",{});var Cn=i(tt);_s=r(Cn,"All kwargs are forwarded to "),qt=o(Cn,"CODE",{});var Vo=i(qt);bs=r(Vo,"self.lora_state_dict"),Vo.forEach(n),ys=r(Cn,"."),Cn.forEach(n),ws=f(R),nt=o(R,"P",{});var Rn=i(nt);vs=r(Rn,"See "),$t=o(Rn,"A",{href:!0});var Lo=i($t);xs=r(Lo,"lora_state_dict()"),Lo.forEach(n),Is=r(Rn," for more details on how the state dict is loaded."),Rn.forEach(n),Ms=f(R),se=o(R,"P",{});var jt=i(se);Js=r(jt,"See "),Tt=o(jt,"A",{href:!0});var Ao=i(Tt);$s=r(Ao,"load_lora_into_unet()"),Ao.forEach(n),Ts=r(jt,` for more details on how the state dict is loaded into
`),Ot=o(jt,"CODE",{});var Yo=i(Ot);ks=r(Yo,"self.unet"),Yo.forEach(n),Ss=r(jt,"."),jt.forEach(n),Ds=f(R),oe=o(R,"P",{});var Pt=i(oe);Us=r(Pt,"See "),kt=o(Pt,"A",{href:!0});var zo=i(kt);js=r(zo,"load_lora_into_text_encoder()"),zo.forEach(n),Ps=r(Pt,` for more details on how the state dict is loaded
into `),Kt=o(Pt,"CODE",{});var Qo=i(Kt);Zs=r(Qo,"self.text_encoder"),Qo.forEach(n),Es=r(Pt,"."),Pt.forEach(n),R.forEach(n),Ws=f(T),Me=o(T,"DIV",{class:!0});var Vn=i(Me);v(at.$$.fragment,Vn),Fs=f(Vn),en=o(Vn,"P",{});var Ho=i(en);Gs=r(Ho,"Save the LoRA parameters corresponding to the UNet and text encoder."),Ho.forEach(n),Vn.forEach(n),Ns=f(T),Je=o(T,"DIV",{class:!0});var Ln=i(Je);v(st.$$.fragment,Ln),Bs=f(Ln),z=o(Ln,"P",{});var Ee=i(z);Xs=r(Ee,`Offload all models to CPU to reduce memory usage with a low impact on performance. Moves one whole model at a
time to the GPU when its `),tn=o(Ee,"CODE",{});var qo=i(tn);Cs=r(qo,"forward"),qo.forEach(n),Rs=r(Ee,` method is called, and the model remains in GPU until the next model runs.
Memory savings are lower than using `),nn=o(Ee,"CODE",{});var Oo=i(nn);Vs=r(Oo,"enable_sequential_cpu_offload"),Oo.forEach(n),Ls=r(Ee,`, but performance is much better due to the
iterative execution of the `),an=o(Ee,"CODE",{});var Ko=i(an);As=r(Ko,"unet"),Ko.forEach(n),Ys=r(Ee,"."),Ee.forEach(n),Ln.forEach(n),T.forEach(n),$n=f(t),ie=o(t,"H2",{class:!0});var An=i(ie);$e=o(An,"A",{id:!0,class:!0,href:!0});var ei=i($e);sn=o(ei,"SPAN",{});var ti=i(sn);v(ot.$$.fragment,ti),ti.forEach(n),ei.forEach(n),zs=f(An),on=o(An,"SPAN",{});var ni=i(on);Qs=r(ni,"StableDiffusionPipelineOutput"),ni.forEach(n),An.forEach(n),Tn=f(t),le=o(t,"DIV",{class:!0});var Yn=i(le);v(it.$$.fragment,Yn),Hs=f(Yn),ln=o(Yn,"P",{});var ai=i(ln);qs=r(ai,"Output class for Stable Diffusion pipelines."),ai.forEach(n),Yn.forEach(n),kn=f(t),re=o(t,"H2",{class:!0});var zn=i(re);Te=o(zn,"A",{id:!0,class:!0,href:!0});var si=i(Te);rn=o(si,"SPAN",{});var oi=i(rn);v(lt.$$.fragment,oi),oi.forEach(n),si.forEach(n),Os=f(zn),pn=o(zn,"SPAN",{});var ii=i(pn);Ks=r(ii,"FlaxStableDiffusionInpaintPipeline"),ii.forEach(n),zn.forEach(n),Sn=f(t),P=o(t,"DIV",{class:!0});var ee=i(P);v(rt.$$.fragment,ee),eo=f(ee),dn=o(ee,"P",{});var li=i(dn);to=r(li,"Flax-based pipeline for text-guided image inpainting using Stable Diffusion."),li.forEach(n),no=f(ee),v(ke.$$.fragment,ee),ao=f(ee),pt=o(ee,"P",{});var Qn=i(pt);so=r(Qn,"This model inherits from "),St=o(Qn,"A",{href:!0});var ri=i(St);oo=r(ri,"FlaxDiffusionPipeline"),ri.forEach(n),io=r(Qn,`. Check the superclass documentation for the generic methods
implemented for all pipelines (downloading, saving, running on a particular device, etc.).`),Qn.forEach(n),lo=f(ee),K=o(ee,"DIV",{class:!0});var Zt=i(K);v(dt.$$.fragment,Zt),ro=f(Zt),cn=o(Zt,"P",{});var pi=i(cn);po=r(pi,"Function invoked when calling the pipeline for generation."),pi.forEach(n),co=f(Zt),v(Se.$$.fragment,Zt),Zt.forEach(n),ee.forEach(n),Dn=f(t),pe=o(t,"H2",{class:!0});var Hn=i(pe);De=o(Hn,"A",{id:!0,class:!0,href:!0});var di=i(De);fn=o(di,"SPAN",{});var ci=i(fn);v(ct.$$.fragment,ci),ci.forEach(n),di.forEach(n),fo=f(Hn),un=o(Hn,"SPAN",{});var fi=i(un);uo=r(fi,"FlaxStableDiffusionPipelineOutput"),fi.forEach(n),Hn.forEach(n),Un=f(t),Q=o(t,"DIV",{class:!0});var Et=i(Q);v(ft.$$.fragment,Et),mo=f(Et),mn=o(Et,"P",{});var ui=i(mn);ho=r(ui,"Output class for Flax-based Stable Diffusion pipelines."),ui.forEach(n),go=f(Et),Ue=o(Et,"DIV",{class:!0});var qn=i(Ue);v(ut.$$.fragment,qn),_o=f(qn),hn=o(qn,"P",{});var mi=i(hn);bo=r(mi,"\u201CReturns a new object replacing the specified fields with new values."),mi.forEach(n),qn.forEach(n),Et.forEach(n),this.h()},h(){u(p,"name","hf:doc:metadata"),u(p,"content",JSON.stringify(Ui)),u(d,"id","inpainting"),u(d,"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"),u(d,"href","#inpainting"),u(h,"class","relative group"),u(S,"id","tips"),u(S,"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"),u(S,"href","#tips"),u(W,"class","relative group"),u(q,"href","https://huggingface.co/runwayml/stable-diffusion-inpainting"),u(q,"rel","nofollow"),u(We,"href","https://huggingface.co/runwayml/stable-diffusion-v1-5"),u(We,"rel","nofollow"),u(me,"id","diffusers.StableDiffusionInpaintPipeline"),u(me,"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"),u(me,"href","#diffusers.StableDiffusionInpaintPipeline"),u(ne,"class","relative group"),u(bt,"href","/docs/diffusers/v0.20.0/en/api/pipelines/overview#diffusers.DiffusionPipeline"),u(wt,"href","/docs/diffusers/v0.20.0/en/api/pipelines/stable_diffusion/depth2img#diffusers.StableDiffusionDepth2ImgPipeline.load_textual_inversion"),u(xt,"href","/docs/diffusers/v0.20.0/en/api/pipelines/stable_diffusion/depth2img#diffusers.StableDiffusionDepth2ImgPipeline.load_lora_weights"),u(Mt,"href","/docs/diffusers/v0.20.0/en/api/pipelines/stable_diffusion/depth2img#diffusers.StableDiffusionDepth2ImgPipeline.save_lora_weights"),u(O,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(B,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(be,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(Ae,"href","https://facebookresearch.github.io/xformers/"),u(Ae,"rel","nofollow"),u(X,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(Qe,"href","https://facebookresearch.github.io/xformers/"),u(Qe,"rel","nofollow"),u(ve,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(Jt,"href","/docs/diffusers/v0.20.0/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline"),u(Ke,"href","https://civitai.com/models/3036?modelVersionId=9857"),u(Ke,"rel","nofollow"),u(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u($t,"href","/docs/diffusers/v0.20.0/en/api/loaders#diffusers.loaders.LoraLoaderMixin.lora_state_dict"),u(Tt,"href","/docs/diffusers/v0.20.0/en/api/loaders#diffusers.loaders.LoraLoaderMixin.load_lora_into_unet"),u(kt,"href","/docs/diffusers/v0.20.0/en/api/loaders#diffusers.loaders.LoraLoaderMixin.load_lora_into_text_encoder"),u(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(Me,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(Je,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u($e,"id","diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"),u($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"),u($e,"href","#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"),u(ie,"class","relative group"),u(le,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(Te,"id","diffusers.FlaxStableDiffusionInpaintPipeline"),u(Te,"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"),u(Te,"href","#diffusers.FlaxStableDiffusionInpaintPipeline"),u(re,"class","relative group"),u(St,"href","/docs/diffusers/v0.20.0/en/api/pipelines/overview#diffusers.FlaxDiffusionPipeline"),u(K,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(De,"id","diffusers.pipelines.stable_diffusion.FlaxStableDiffusionPipelineOutput"),u(De,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),u(De,"href","#diffusers.pipelines.stable_diffusion.FlaxStableDiffusionPipelineOutput"),u(pe,"class","relative group"),u(Ue,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),u(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(t,g){e(document.head,p),y(t,_,g),y(t,h,g),e(h,d),e(d,b),x(a,b,null),e(h,m),e(h,N),e(N,V),y(t,ce,g),y(t,H,g),e(H,L),y(t,fe,g),y(t,W,g),e(W,S),e(S,te),x(A,te,null),e(W,j),e(W,E),e(E,gt),y(t,F,g),y(t,G,g),e(G,_t),e(G,q),e(q,Kn),e(G,ea),e(G,We),e(We,ta),e(G,na),y(t,In,g),x(ue,t,g),y(t,Mn,g),y(t,ne,g),e(ne,me),e(me,Bt),x(Fe,Bt,null),e(ne,aa),e(ne,Xt),e(Xt,sa),y(t,Jn,g),y(t,$,g),x(Ge,$,null),e($,oa),e($,Ct),e(Ct,ia),e($,la),e($,Ne),e(Ne,ra),e(Ne,bt),e(bt,pa),e(Ne,da),e($,ca),e($,Rt),e(Rt,fa),e($,ua),e($,ae),e(ae,yt),e(yt,wt),e(wt,ma),e(yt,ha),e(ae,ga),e(ae,vt),e(vt,xt),e(xt,_a),e(vt,ba),e(ae,ya),e(ae,It),e(It,Mt),e(Mt,wa),e(It,va),e($,xa),e($,O),x(Be,O,null),e(O,Ia),e(O,Vt),e(Vt,Ma),e(O,Ja),x(he,O,null),e($,$a),e($,B),x(Xe,B,null),e(B,Ta),e(B,Lt),e(Lt,ka),e(B,Sa),x(ge,B,null),e(B,Da),x(_e,B,null),e($,Ua),e($,be),x(Ce,be,null),e(be,ja),e(be,Re),e(Re,Pa),e(Re,At),e(At,Za),e(Re,Ea),e($,Wa),e($,X),x(Ve,X,null),e(X,Fa),e(X,Le),e(Le,Ga),e(Le,Ae),e(Ae,Na),e(Le,Ba),e(X,Xa),x(ye,X,null),e(X,Ca),x(we,X,null),e($,Ra),e($,ve),x(Ye,ve,null),e(ve,Va),e(ve,ze),e(ze,La),e(ze,Qe),e(Qe,Aa),e(ze,Ya),e($,za),e($,D),x(He,D,null),e(D,Qa),e(D,qe),e(qe,Ha),e(qe,Jt),e(Jt,qa),e(qe,Oa),e(D,Ka),e(D,Yt),e(Yt,es),e(D,ts),x(xe,D,null),e(D,ns),e(D,Oe),e(Oe,as),e(Oe,Ke),e(Ke,ss),e(Oe,os),e(D,is),x(Ie,D,null),e($,ls),e($,U),x(et,U,null),e(U,rs),e(U,Y),e(Y,ps),e(Y,zt),e(zt,ds),e(Y,cs),e(Y,Qt),e(Qt,fs),e(Y,us),e(Y,Ht),e(Ht,ms),e(Y,hs),e(U,gs),e(U,tt),e(tt,_s),e(tt,qt),e(qt,bs),e(tt,ys),e(U,ws),e(U,nt),e(nt,vs),e(nt,$t),e($t,xs),e(nt,Is),e(U,Ms),e(U,se),e(se,Js),e(se,Tt),e(Tt,$s),e(se,Ts),e(se,Ot),e(Ot,ks),e(se,Ss),e(U,Ds),e(U,oe),e(oe,Us),e(oe,kt),e(kt,js),e(oe,Ps),e(oe,Kt),e(Kt,Zs),e(oe,Es),e($,Ws),e($,Me),x(at,Me,null),e(Me,Fs),e(Me,en),e(en,Gs),e($,Ns),e($,Je),x(st,Je,null),e(Je,Bs),e(Je,z),e(z,Xs),e(z,tn),e(tn,Cs),e(z,Rs),e(z,nn),e(nn,Vs),e(z,Ls),e(z,an),e(an,As),e(z,Ys),y(t,$n,g),y(t,ie,g),e(ie,$e),e($e,sn),x(ot,sn,null),e(ie,zs),e(ie,on),e(on,Qs),y(t,Tn,g),y(t,le,g),x(it,le,null),e(le,Hs),e(le,ln),e(ln,qs),y(t,kn,g),y(t,re,g),e(re,Te),e(Te,rn),x(lt,rn,null),e(re,Os),e(re,pn),e(pn,Ks),y(t,Sn,g),y(t,P,g),x(rt,P,null),e(P,eo),e(P,dn),e(dn,to),e(P,no),x(ke,P,null),e(P,ao),e(P,pt),e(pt,so),e(pt,St),e(St,oo),e(pt,io),e(P,lo),e(P,K),x(dt,K,null),e(K,ro),e(K,cn),e(cn,po),e(K,co),x(Se,K,null),y(t,Dn,g),y(t,pe,g),e(pe,De),e(De,fn),x(ct,fn,null),e(pe,fo),e(pe,un),e(un,uo),y(t,Un,g),y(t,Q,g),x(ft,Q,null),e(Q,mo),e(Q,mn),e(mn,ho),e(Q,go),e(Q,Ue),x(ut,Ue,null),e(Ue,_o),e(Ue,hn),e(hn,bo),jn=!0},p(t,[g]){const mt={};g&2&&(mt.$$scope={dirty:g,ctx:t}),ue.$set(mt);const gn={};g&2&&(gn.$$scope={dirty:g,ctx:t}),he.$set(gn);const _n={};g&2&&(_n.$$scope={dirty:g,ctx:t}),ge.$set(_n);const bn={};g&2&&(bn.$$scope={dirty:g,ctx:t}),_e.$set(bn);const yn={};g&2&&(yn.$$scope={dirty:g,ctx:t}),ye.$set(yn);const ht={};g&2&&(ht.$$scope={dirty:g,ctx:t}),we.$set(ht);const wn={};g&2&&(wn.$$scope={dirty:g,ctx:t}),xe.$set(wn);const vn={};g&2&&(vn.$$scope={dirty:g,ctx:t}),Ie.$set(vn);const xn={};g&2&&(xn.$$scope={dirty:g,ctx:t}),ke.$set(xn);const de={};g&2&&(de.$$scope={dirty:g,ctx:t}),Se.$set(de)},i(t){jn||(I(a.$$.fragment,t),I(A.$$.fragment,t),I(ue.$$.fragment,t),I(Fe.$$.fragment,t),I(Ge.$$.fragment,t),I(Be.$$.fragment,t),I(he.$$.fragment,t),I(Xe.$$.fragment,t),I(ge.$$.fragment,t),I(_e.$$.fragment,t),I(Ce.$$.fragment,t),I(Ve.$$.fragment,t),I(ye.$$.fragment,t),I(we.$$.fragment,t),I(Ye.$$.fragment,t),I(He.$$.fragment,t),I(xe.$$.fragment,t),I(Ie.$$.fragment,t),I(et.$$.fragment,t),I(at.$$.fragment,t),I(st.$$.fragment,t),I(ot.$$.fragment,t),I(it.$$.fragment,t),I(lt.$$.fragment,t),I(rt.$$.fragment,t),I(ke.$$.fragment,t),I(dt.$$.fragment,t),I(Se.$$.fragment,t),I(ct.$$.fragment,t),I(ft.$$.fragment,t),I(ut.$$.fragment,t),jn=!0)},o(t){M(a.$$.fragment,t),M(A.$$.fragment,t),M(ue.$$.fragment,t),M(Fe.$$.fragment,t),M(Ge.$$.fragment,t),M(Be.$$.fragment,t),M(he.$$.fragment,t),M(Xe.$$.fragment,t),M(ge.$$.fragment,t),M(_e.$$.fragment,t),M(Ce.$$.fragment,t),M(Ve.$$.fragment,t),M(ye.$$.fragment,t),M(we.$$.fragment,t),M(Ye.$$.fragment,t),M(He.$$.fragment,t),M(xe.$$.fragment,t),M(Ie.$$.fragment,t),M(et.$$.fragment,t),M(at.$$.fragment,t),M(st.$$.fragment,t),M(ot.$$.fragment,t),M(it.$$.fragment,t),M(lt.$$.fragment,t),M(rt.$$.fragment,t),M(ke.$$.fragment,t),M(dt.$$.fragment,t),M(Se.$$.fragment,t),M(ct.$$.fragment,t),M(ft.$$.fragment,t),M(ut.$$.fragment,t),jn=!1},d(t){n(p),t&&n(_),t&&n(h),J(a),t&&n(ce),t&&n(H),t&&n(fe),t&&n(W),J(A),t&&n(F),t&&n(G),t&&n(In),J(ue,t),t&&n(Mn),t&&n(ne),J(Fe),t&&n(Jn),t&&n($),J(Ge),J(Be),J(he),J(Xe),J(ge),J(_e),J(Ce),J(Ve),J(ye),J(we),J(Ye),J(He),J(xe),J(Ie),J(et),J(at),J(st),t&&n($n),t&&n(ie),J(ot),t&&n(Tn),t&&n(le),J(it),t&&n(kn),t&&n(re),J(lt),t&&n(Sn),t&&n(P),J(rt),J(ke),J(dt),J(Se),t&&n(Dn),t&&n(pe),J(ct),t&&n(Un),t&&n(Q),J(ft),J(ut)}}}const Ui={local:"inpainting",sections:[{local:"tips",title:"Tips"},{local:"diffusers.StableDiffusionInpaintPipeline",title:"StableDiffusionInpaintPipeline"},{local:"diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput",title:"StableDiffusionPipelineOutput"},{local:"diffusers.FlaxStableDiffusionInpaintPipeline",title:"FlaxStableDiffusionInpaintPipeline"},{local:"diffusers.pipelines.stable_diffusion.FlaxStableDiffusionPipelineOutput",title:"FlaxStableDiffusionPipelineOutput"}],title:"Inpainting"};function ji(k){return yi(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ni extends hi{constructor(p){super();gi(this,p,ji,Di,_i,{})}}export{Ni as default,Ui as metadata};
