import{S as Ui,i as ki,s as Ji,e as n,k as c,w as M,t as s,M as Si,c as a,d as t,m as p,a as i,x as T,h as r,b as f,G as e,g as v,y as $,q as E,o as U,B as k,v as Di,L as Ta}from"../../../chunks/vendor-hf-doc-builder.js";import{T as vo}from"../../../chunks/Tip-hf-doc-builder.js";import{D as Le}from"../../../chunks/Docstring-hf-doc-builder.js";import{C as wo}from"../../../chunks/CodeBlock-hf-doc-builder.js";import{I as Yt}from"../../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Ma}from"../../../chunks/ExampleCodeBlock-hf-doc-builder.js";function ji(D){let l,w,u,h,y;return h=new wo({props:{code:"aW1wb3J0JTIwUElMJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjBpbyUyMGltcG9ydCUyMEJ5dGVzSU8lMEElMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwU3RhYmxlRGlmZnVzaW9uSW5zdHJ1Y3RQaXgyUGl4UGlwZWxpbmUlMEElMEElMEFkZWYlMjBkb3dubG9hZF9pbWFnZSh1cmwpJTNBJTBBJTIwJTIwJTIwJTIwcmVzcG9uc2UlMjAlM0QlMjByZXF1ZXN0cy5nZXQodXJsKSUwQSUyMCUyMCUyMCUyMHJldHVybiUyMFBJTC5JbWFnZS5vcGVuKEJ5dGVzSU8ocmVzcG9uc2UuY29udGVudCkpLmNvbnZlcnQoJTIyUkdCJTIyKSUwQSUwQSUwQWltZ191cmwlMjAlM0QlMjAlMjJodHRwcyUzQSUyRiUyRmh1Z2dpbmdmYWNlLmNvJTJGZGF0YXNldHMlMkZkaWZmdXNlcnMlMkZkaWZmdXNlcnMtaW1hZ2VzLWRvY3MlMkZyZXNvbHZlJTJGbWFpbiUyRm1vdW50YWluLnBuZyUyMiUwQSUwQWltYWdlJTIwJTNEJTIwZG93bmxvYWRfaW1hZ2UoaW1nX3VybCkucmVzaXplKCg1MTIlMkMlMjA1MTIpKSUwQSUwQXBpcGUlMjAlM0QlMjBTdGFibGVEaWZmdXNpb25JbnN0cnVjdFBpeDJQaXhQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIydGltYnJvb2tzJTJGaW5zdHJ1Y3QtcGl4MnBpeCUyMiUyQyUyMHRvcmNoX2R0eXBlJTNEdG9yY2guZmxvYXQxNiUwQSklMEFwaXBlJTIwJTNEJTIwcGlwZS50byglMjJjdWRhJTIyKSUwQSUwQXByb21wdCUyMCUzRCUyMCUyMm1ha2UlMjB0aGUlMjBtb3VudGFpbnMlMjBzbm93eSUyMiUwQWltYWdlJTIwJTNEJTIwcGlwZShwcm9tcHQlM0Rwcm9tcHQlMkMlMjBpbWFnZSUzRGltYWdlKS5pbWFnZXMlNUIwJTVE",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> StableDiffusionInstructPix2PixPipeline


<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://huggingface.co/datasets/diffusers/diffusers-images-docs/resolve/main/mountain.png&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>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>pipe = StableDiffusionInstructPix2PixPipeline.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;timbrooks/instruct-pix2pix&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;make the mountains snowy&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = pipe(prompt=prompt, image=image).images[<span class="hljs-number">0</span>]`}}),{c(){l=n("p"),w=s("Examples:"),u=c(),M(h.$$.fragment)},l(d){l=a(d,"P",{});var _=i(l);w=r(_,"Examples:"),_.forEach(t),u=p(d),T(h.$$.fragment,d)},m(d,_){v(d,l,_),e(l,w),v(d,u,_),$(h,d,_),y=!0},p:Ta,i(d){y||(E(h.$$.fragment,d),y=!0)},o(d){U(h.$$.fragment,d),y=!1},d(d){d&&t(l),d&&t(u),k(h,d)}}}function Wi(D){let l,w;return{c(){l=n("p"),w=s("This function is experimental and might change in the future.")},l(u){l=a(u,"P",{});var h=i(l);w=r(h,"This function is experimental and might change in the future."),h.forEach(t)},m(u,h){v(u,l,h),e(l,w)},d(u){u&&t(l)}}}function Zi(D){let l,w,u,h,y,d,_,P;return{c(){l=n("p"),w=s("It is required to be logged in ("),u=n("code"),h=s("huggingface-cli login"),y=s(") when you want to use private or "),d=n("a"),_=s(`gated
models`),P=s("."),this.h()},l(m){l=a(m,"P",{});var b=i(l);w=r(b,"It is required to be logged in ("),u=a(b,"CODE",{});var J=i(u);h=r(J,"huggingface-cli login"),J.forEach(t),y=r(b,") when you want to use private or "),d=a(b,"A",{href:!0,rel:!0});var W=i(d);_=r(W,`gated
models`),W.forEach(t),P=r(b,"."),b.forEach(t),this.h()},h(){f(d,"href","https://huggingface.co/docs/hub/models-gated#gated-models"),f(d,"rel","nofollow")},m(m,b){v(m,l,b),e(l,w),e(l,u),e(u,h),e(l,y),e(l,d),e(d,_),e(l,P)},d(m){m&&t(l)}}}function Ci(D){let l,w,u,h,y,d,_,P;return _=new wo({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(){l=n("p"),w=s("To load a textual inversion embedding vector in "),u=n("code"),h=s("diffusers"),y=s(" format:"),d=c(),M(_.$$.fragment)},l(m){l=a(m,"P",{});var b=i(l);w=r(b,"To load a textual inversion embedding vector in "),u=a(b,"CODE",{});var J=i(u);h=r(J,"diffusers"),J.forEach(t),y=r(b," format:"),b.forEach(t),d=p(m),T(_.$$.fragment,m)},m(m,b){v(m,l,b),e(l,w),e(l,u),e(u,h),e(l,y),v(m,d,b),$(_,m,b),P=!0},p:Ta,i(m){P||(E(_.$$.fragment,m),P=!0)},o(m){U(_.$$.fragment,m),P=!1},d(m){m&&t(l),m&&t(d),k(_,m)}}}function Ni(D){let l,w,u,h,y,d,_,P;return _=new wo({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(){l=n("p"),w=s("e.g. from "),u=n("a"),h=s("civitAI"),y=s(" and then load the vector locally:"),d=c(),M(_.$$.fragment),this.h()},l(m){l=a(m,"P",{});var b=i(l);w=r(b,"e.g. from "),u=a(b,"A",{href:!0,rel:!0});var J=i(u);h=r(J,"civitAI"),J.forEach(t),y=r(b," and then load the vector locally:"),b.forEach(t),d=p(m),T(_.$$.fragment,m),this.h()},h(){f(u,"href","https://civitai.com/models/3036?modelVersionId=9857"),f(u,"rel","nofollow")},m(m,b){v(m,l,b),e(l,w),e(l,u),e(u,h),e(l,y),v(m,d,b),$(_,m,b),P=!0},p:Ta,i(m){P||(E(_.$$.fragment,m),P=!0)},o(m){U(_.$$.fragment,m),P=!1},d(m){m&&t(l),m&&t(d),k(_,m)}}}function Li(D){let l,w,u,h,y;return{c(){l=n("p"),w=s("We support loading A1111 formatted LoRA checkpoints in a limited capacity."),u=c(),h=n("p"),y=s("This function is experimental and might change in the future.")},l(d){l=a(d,"P",{});var _=i(l);w=r(_,"We support loading A1111 formatted LoRA checkpoints in a limited capacity."),_.forEach(t),u=p(d),h=a(d,"P",{});var P=i(h);y=r(P,"This function is experimental and might change in the future."),P.forEach(t)},m(d,_){v(d,l,_),e(l,w),v(d,u,_),v(d,h,_),e(h,y)},d(d){d&&t(l),d&&t(u),d&&t(h)}}}function Bi(D){let l,w,u,h,y,d,_,P;return{c(){l=n("p"),w=s("It is required to be logged in ("),u=n("code"),h=s("huggingface-cli login"),y=s(") when you want to use private or "),d=n("a"),_=s(`gated
models`),P=s("."),this.h()},l(m){l=a(m,"P",{});var b=i(l);w=r(b,"It is required to be logged in ("),u=a(b,"CODE",{});var J=i(u);h=r(J,"huggingface-cli login"),J.forEach(t),y=r(b,") when you want to use private or "),d=a(b,"A",{href:!0,rel:!0});var W=i(d);_=r(W,`gated
models`),W.forEach(t),P=r(b,"."),b.forEach(t),this.h()},h(){f(d,"href","https://huggingface.co/docs/hub/models-gated#gated-models"),f(d,"rel","nofollow")},m(m,b){v(m,l,b),e(l,w),e(l,u),e(u,h),e(l,y),e(l,d),e(d,_),e(l,P)},d(m){m&&t(l)}}}function Gi(D){let l,w,u,h,y,d,_,P,m,b,J,W,st,pe,xo,rt,yo,Qt,fe,ue,Po,Io,Vt,Be,Mo,zt,Ge,lt,To,Ht,Ae,$o,Ot,C,Fe,me,Eo,Uo,ko,Re,he,Jo,So,Do,qe,ge,jo,Wo,Zo,Xe,_e,Co,No,Kt,G,V,dt,be,Lo,ct,Bo,eo,z,pt,A,ft,Go,Ao,ut,Fo,Ro,Ye,qo,Xo,mt,F,ht,ve,Yo,Qo,gt,_t,Vo,zo,Qe,we,Ho,to,R,H,bt,xe,Oo,vt,Ko,oo,ye,no,q,O,wt,Pe,en,xt,tn,ao,x,Ie,on,yt,nn,an,Me,sn,Ve,rn,ln,dn,Pt,cn,pn,Te,$e,It,fn,un,ze,mn,hn,Ee,Mt,gn,_n,He,bn,vn,Tt,wn,xn,$t,Ue,Et,yn,Pn,Oe,In,Mn,L,ke,Tn,Ut,$n,En,K,Un,S,Je,kn,X,Jn,kt,Sn,Dn,Jt,jn,Wn,Zn,ee,Cn,te,Nn,St,Ln,Bn,oe,Gn,Dt,An,Fn,ne,Rn,N,Se,qn,Y,Xn,Ke,Yn,Qn,De,jt,Vn,zn,Hn,ae,On,ie,Kn,se,je,ea,Wt,ta,oa,re,We,na,Z,aa,Zt,ia,sa,Ct,ra,la,Nt,da,ca,Lt,pa,fa,ua,le,Ze,ma,Q,ha,Bt,ga,_a,Gt,ba,va,io;return d=new Yt({}),pe=new Yt({}),be=new Yt({}),xe=new Yt({}),ye=new wo({props:{code:"aW1wb3J0JTIwUElMJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjBkaWZmdXNlcnMlMjBpbXBvcnQlMjBTdGFibGVEaWZmdXNpb25JbnN0cnVjdFBpeDJQaXhQaXBlbGluZSUwQSUwQW1vZGVsX2lkJTIwJTNEJTIwJTIydGltYnJvb2tzJTJGaW5zdHJ1Y3QtcGl4MnBpeCUyMiUwQXBpcGUlMjAlM0QlMjBTdGFibGVEaWZmdXNpb25JbnN0cnVjdFBpeDJQaXhQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQobW9kZWxfaWQlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYpLnRvKCUyMmN1ZGElMjIpJTBBJTBBdXJsJTIwJTNEJTIwJTIyaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRmRhdGFzZXRzJTJGZGlmZnVzZXJzJTJGZGlmZnVzZXJzLWltYWdlcy1kb2NzJTJGcmVzb2x2ZSUyRm1haW4lMkZtb3VudGFpbi5wbmclMjIlMEElMEElMEFkZWYlMjBkb3dubG9hZF9pbWFnZSh1cmwpJTNBJTBBJTIwJTIwJTIwJTIwaW1hZ2UlMjAlM0QlMjBQSUwuSW1hZ2Uub3BlbihyZXF1ZXN0cy5nZXQodXJsJTJDJTIwc3RyZWFtJTNEVHJ1ZSkucmF3KSUwQSUyMCUyMCUyMCUyMGltYWdlJTIwJTNEJTIwUElMLkltYWdlT3BzLmV4aWZfdHJhbnNwb3NlKGltYWdlKSUwQSUyMCUyMCUyMCUyMGltYWdlJTIwJTNEJTIwaW1hZ2UuY29udmVydCglMjJSR0IlMjIpJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwaW1hZ2UlMEElMEElMEFpbWFnZSUyMCUzRCUyMGRvd25sb2FkX2ltYWdlKHVybCklMEElMEFwcm9tcHQlMjAlM0QlMjAlMjJtYWtlJTIwdGhlJTIwbW91bnRhaW5zJTIwc25vd3klMjIlMEFpbWFnZXMlMjAlM0QlMjBwaXBlKHByb21wdCUyQyUyMGltYWdlJTNEaW1hZ2UlMkMlMjBudW1faW5mZXJlbmNlX3N0ZXBzJTNEMjAlMkMlMjBpbWFnZV9ndWlkYW5jZV9zY2FsZSUzRDEuNSUyQyUyMGd1aWRhbmNlX3NjYWxlJTNENykuaW1hZ2VzJTBBaW1hZ2VzJTVCMCU1RC5zYXZlKCUyMnNub3d5X21vdW50YWlucy5wbmclMjIp",highlighted:`<span class="hljs-keyword">import</span> PIL
<span class="hljs-keyword">import</span> requests
<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionInstructPix2PixPipeline

model_id = <span class="hljs-string">&quot;timbrooks/instruct-pix2pix&quot;</span>
pipe = StableDiffusionInstructPix2PixPipeline.from_pretrained(model_id, torch_dtype=torch.float16).to(<span class="hljs-string">&quot;cuda&quot;</span>)

url = <span class="hljs-string">&quot;https://huggingface.co/datasets/diffusers/diffusers-images-docs/resolve/main/mountain.png&quot;</span>


<span class="hljs-keyword">def</span> <span class="hljs-title function_">download_image</span>(<span class="hljs-params">url</span>):
    image = PIL.Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw)
    image = PIL.ImageOps.exif_transpose(image)
    image = image.convert(<span class="hljs-string">&quot;RGB&quot;</span>)
    <span class="hljs-keyword">return</span> image


image = download_image(url)

prompt = <span class="hljs-string">&quot;make the mountains snowy&quot;</span>
images = pipe(prompt, image=image, num_inference_steps=<span class="hljs-number">20</span>, image_guidance_scale=<span class="hljs-number">1.5</span>, guidance_scale=<span class="hljs-number">7</span>).images
images[<span class="hljs-number">0</span>].save(<span class="hljs-string">&quot;snowy_mountains.png&quot;</span>)`}}),Pe=new Yt({}),Ie=new Le({props:{name:"class diffusers.StableDiffusionInstructPix2PixPipeline",anchor:"diffusers.StableDiffusionInstructPix2PixPipeline",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.StableDiffusionInstructPix2PixPipeline.vae",description:`<strong>vae</strong> (<a href="/docs/diffusers/v0.17.1/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.StableDiffusionInstructPix2PixPipeline.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.StableDiffusionInstructPix2PixPipeline.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.StableDiffusionInstructPix2PixPipeline.unet",description:'<strong>unet</strong> (<a href="/docs/diffusers/v0.17.1/en/api/models#diffusers.UNet2DConditionModel">UNet2DConditionModel</a>) &#x2014; Conditional U-Net architecture to denoise the encoded image latents.',name:"unet"},{anchor:"diffusers.StableDiffusionInstructPix2PixPipeline.scheduler",description:`<strong>scheduler</strong> (<a href="/docs/diffusers/v0.17.1/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.1/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>, <a href="/docs/diffusers/v0.17.1/en/api/schedulers/lms_discrete#diffusers.LMSDiscreteScheduler">LMSDiscreteScheduler</a>, or <a href="/docs/diffusers/v0.17.1/en/api/schedulers/pndm#diffusers.PNDMScheduler">PNDMScheduler</a>.`,name:"scheduler"},{anchor:"diffusers.StableDiffusionInstructPix2PixPipeline.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.StableDiffusionInstructPix2PixPipeline.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.1/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_instruct_pix2pix.py#L71"}}),ke=new Le({props:{name:"__call__",anchor:"diffusers.StableDiffusionInstructPix2PixPipeline.__call__",parameters:[{name:"prompt",val:": typing.Union[str, typing.List[str]] = None"},{name:"image",val:": typing.Union[torch.FloatTensor, PIL.Image.Image, numpy.ndarray, typing.List[torch.FloatTensor], typing.List[PIL.Image.Image], typing.List[numpy.ndarray]] = None"},{name:"num_inference_steps",val:": int = 100"},{name:"guidance_scale",val:": float = 7.5"},{name:"image_guidance_scale",val:": float = 1.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"}],parametersDescription:[{anchor:"diffusers.StableDiffusionInstructPix2PixPipeline.__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.StableDiffusionInstructPix2PixPipeline.__call__.image",description:`<strong>image</strong> (<code>torch.FloatTensor</code> <code>np.ndarray</code>, <code>PIL.Image.Image</code>, <code>List[torch.FloatTensor]</code>, <code>List[PIL.Image.Image]</code>, or <code>List[np.ndarray]</code>) &#x2014;
<code>Image</code>, or tensor representing an image batch which will be repainted according to <code>prompt</code>. Can also
accpet image latents as <code>image</code>, if passing latents directly, it will not be encoded again.`,name:"image"},{anchor:"diffusers.StableDiffusionInstructPix2PixPipeline.__call__.num_inference_steps",description:`<strong>num_inference_steps</strong> (<code>int</code>, <em>optional</em>, defaults to 100) &#x2014;
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.`,name:"num_inference_steps"},{anchor:"diffusers.StableDiffusionInstructPix2PixPipeline.__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. This pipeline requires a value of at least <code>1</code>.`,name:"guidance_scale"},{anchor:"diffusers.StableDiffusionInstructPix2PixPipeline.__call__.image_guidance_scale",description:`<strong>image_guidance_scale</strong> (<code>float</code>, <em>optional</em>, defaults to 1.5) &#x2014;
Image guidance scale is to push the generated image towards the inital image <code>image</code>. Image guidance
scale is enabled by setting <code>image_guidance_scale &gt; 1</code>. Higher image guidance scale encourages to
generate images that are closely linked to the source image <code>image</code>, usually at the expense of lower
image quality. This pipeline requires a value of at least <code>1</code>.`,name:"image_guidance_scale"},{anchor:"diffusers.StableDiffusionInstructPix2PixPipeline.__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.StableDiffusionInstructPix2PixPipeline.__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.StableDiffusionInstructPix2PixPipeline.__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.1/en/api/schedulers/ddim#diffusers.DDIMScheduler">schedulers.DDIMScheduler</a>, will be ignored for others.`,name:"eta"},{anchor:"diffusers.StableDiffusionInstructPix2PixPipeline.__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.StableDiffusionInstructPix2PixPipeline.__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.StableDiffusionInstructPix2PixPipeline.__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.StableDiffusionInstructPix2PixPipeline.__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.StableDiffusionInstructPix2PixPipeline.__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.StableDiffusionInstructPix2PixPipeline.__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.1/en/api/pipelines/stable_diffusion/overview#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput">StableDiffusionPipelineOutput</a> instead of a
plain tuple.`,name:"return_dict"},{anchor:"diffusers.StableDiffusionInstructPix2PixPipeline.__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.StableDiffusionInstructPix2PixPipeline.__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"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.1/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_instruct_pix2pix.py#L149",returnDescription:`
<p><a
  href="/docs/diffusers/v0.17.1/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.1/en/api/pipelines/stable_diffusion/overview#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"
>StableDiffusionPipelineOutput</a> or <code>tuple</code></p>
`}}),K=new Ma({props:{anchor:"diffusers.StableDiffusionInstructPix2PixPipeline.__call__.example",$$slots:{default:[ji]},$$scope:{ctx:D}}}),Je=new Le({props:{name:"load_textual_inversion",anchor:"diffusers.StableDiffusionInstructPix2PixPipeline.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.StableDiffusionInstructPix2PixPipeline.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.StableDiffusionInstructPix2PixPipeline.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.StableDiffusionInstructPix2PixPipeline.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.StableDiffusionInstructPix2PixPipeline.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.StableDiffusionInstructPix2PixPipeline.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.StableDiffusionInstructPix2PixPipeline.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.StableDiffusionInstructPix2PixPipeline.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.StableDiffusionInstructPix2PixPipeline.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.StableDiffusionInstructPix2PixPipeline.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.StableDiffusionInstructPix2PixPipeline.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.StableDiffusionInstructPix2PixPipeline.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.StableDiffusionInstructPix2PixPipeline.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.1/src/diffusers/loaders.py#L482"}}),ee=new vo({props:{warning:!0,$$slots:{default:[Wi]},$$scope:{ctx:D}}}),te=new vo({props:{$$slots:{default:[Zi]},$$scope:{ctx:D}}}),oe=new Ma({props:{anchor:"diffusers.StableDiffusionInstructPix2PixPipeline.load_textual_inversion.example",$$slots:{default:[Ci]},$$scope:{ctx:D}}}),ne=new Ma({props:{anchor:"diffusers.StableDiffusionInstructPix2PixPipeline.load_textual_inversion.example-2",$$slots:{default:[Ni]},$$scope:{ctx:D}}}),Se=new Le({props:{name:"load_lora_weights",anchor:"diffusers.StableDiffusionInstructPix2PixPipeline.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.StableDiffusionInstructPix2PixPipeline.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.StableDiffusionInstructPix2PixPipeline.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.StableDiffusionInstructPix2PixPipeline.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.StableDiffusionInstructPix2PixPipeline.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.StableDiffusionInstructPix2PixPipeline.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.StableDiffusionInstructPix2PixPipeline.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.StableDiffusionInstructPix2PixPipeline.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.StableDiffusionInstructPix2PixPipeline.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.StableDiffusionInstructPix2PixPipeline.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.StableDiffusionInstructPix2PixPipeline.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.1/src/diffusers/loaders.py#L781"}}),ae=new vo({props:{warning:!0,$$slots:{default:[Li]},$$scope:{ctx:D}}}),ie=new vo({props:{$$slots:{default:[Bi]},$$scope:{ctx:D}}}),je=new Le({props:{name:"save_lora_weights",anchor:"diffusers.StableDiffusionInstructPix2PixPipeline.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.StableDiffusionInstructPix2PixPipeline.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.StableDiffusionInstructPix2PixPipeline.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.StableDiffusionInstructPix2PixPipeline.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.StableDiffusionInstructPix2PixPipeline.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.StableDiffusionInstructPix2PixPipeline.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.1/src/diffusers/loaders.py#L1201"}}),We=new Le({props:{name:"enable_model_cpu_offload",anchor:"diffusers.StableDiffusionInstructPix2PixPipeline.enable_model_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.1/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_instruct_pix2pix.py#L458"}}),Ze=new Le({props:{name:"enable_sequential_cpu_offload",anchor:"diffusers.StableDiffusionInstructPix2PixPipeline.enable_sequential_cpu_offload",parameters:[{name:"gpu_id",val:" = 0"}],source:"https://github.com/huggingface/diffusers/blob/v0.17.1/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_instruct_pix2pix.py#L432"}}),{c(){l=n("meta"),w=c(),u=n("h1"),h=n("a"),y=n("span"),M(d.$$.fragment),_=c(),P=n("span"),m=s("InstructPix2Pix: Learning to Follow Image Editing Instructions"),b=c(),J=n("h2"),W=n("a"),st=n("span"),M(pe.$$.fragment),xo=c(),rt=n("span"),yo=s("Overview"),Qt=c(),fe=n("p"),ue=n("a"),Po=s("InstructPix2Pix: Learning to Follow Image Editing Instructions"),Io=s(" by Tim Brooks, Aleksander Holynski and Alexei A. Efros."),Vt=c(),Be=n("p"),Mo=s("The abstract of the paper is the following:"),zt=c(),Ge=n("p"),lt=n("em"),To=s("We propose a method for editing images from human instructions: given an input image and a written instruction that tells the model what to do, our model follows these instructions to edit the image. To obtain training data for this problem, we combine the knowledge of two large pretrained models \u2014 a language model (GPT-3) and a text-to-image model (Stable Diffusion) \u2014 to generate a large dataset of image editing examples. Our conditional diffusion model, InstructPix2Pix, is trained on our generated data, and generalizes to real images and user-written instructions at inference time. Since it performs edits in the forward pass and does not require per example fine-tuning or inversion, our model edits images quickly, in a matter of seconds. We show compelling editing results for a diverse collection of input images and written instructions."),Ht=c(),Ae=n("p"),$o=s("Resources:"),Ot=c(),C=n("ul"),Fe=n("li"),me=n("a"),Eo=s("Project Page"),Uo=s("."),ko=c(),Re=n("li"),he=n("a"),Jo=s("Paper"),So=s("."),Do=c(),qe=n("li"),ge=n("a"),jo=s("Original Code"),Wo=s("."),Zo=c(),Xe=n("li"),_e=n("a"),Co=s("Demo"),No=s("."),Kt=c(),G=n("h2"),V=n("a"),dt=n("span"),M(be.$$.fragment),Lo=c(),ct=n("span"),Bo=s("Available Pipelines:"),eo=c(),z=n("table"),pt=n("thead"),A=n("tr"),ft=n("th"),Go=s("Pipeline"),Ao=c(),ut=n("th"),Fo=s("Tasks"),Ro=c(),Ye=n("th"),qo=s("Demo"),Xo=c(),mt=n("tbody"),F=n("tr"),ht=n("td"),ve=n("a"),Yo=s("StableDiffusionInstructPix2PixPipeline"),Qo=c(),gt=n("td"),_t=n("em"),Vo=s("Text-Based Image Editing"),zo=c(),Qe=n("td"),we=n("a"),Ho=s("\u{1F917} Space"),to=c(),R=n("h2"),H=n("a"),bt=n("span"),M(xe.$$.fragment),Oo=c(),vt=n("span"),Ko=s("Usage example"),oo=c(),M(ye.$$.fragment),no=c(),q=n("h2"),O=n("a"),wt=n("span"),M(Pe.$$.fragment),en=c(),xt=n("span"),tn=s("StableDiffusionInstructPix2PixPipeline"),ao=c(),x=n("div"),M(Ie.$$.fragment),on=c(),yt=n("p"),nn=s("Pipeline for pixel-level image editing by following text instructions. Based on Stable Diffusion."),an=c(),Me=n("p"),sn=s("This model inherits from "),Ve=n("a"),rn=s("DiffusionPipeline"),ln=s(`. 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.)`),dn=c(),Pt=n("p"),cn=s("In addition the pipeline inherits the following loading methods:"),pn=c(),Te=n("ul"),$e=n("li"),It=n("em"),fn=s("Textual-Inversion"),un=s(": "),ze=n("a"),mn=s("loaders.TextualInversionLoaderMixin.load_textual_inversion()"),hn=c(),Ee=n("li"),Mt=n("em"),gn=s("LoRA"),_n=s(": "),He=n("a"),bn=s("loaders.LoraLoaderMixin.load_lora_weights()"),vn=c(),Tt=n("p"),wn=s("as well as the following saving methods:"),xn=c(),$t=n("ul"),Ue=n("li"),Et=n("em"),yn=s("LoRA"),Pn=s(": "),Oe=n("a"),In=s("loaders.LoraLoaderMixin.save_lora_weights()"),Mn=c(),L=n("div"),M(ke.$$.fragment),Tn=c(),Ut=n("p"),$n=s("Function invoked when calling the pipeline for generation."),En=c(),M(K.$$.fragment),Un=c(),S=n("div"),M(Je.$$.fragment),kn=c(),X=n("p"),Jn=s("Load textual inversion embeddings into the text encoder of stable diffusion pipelines. Both "),kt=n("code"),Sn=s("diffusers"),Dn=s(` and
`),Jt=n("code"),jn=s("Automatic1111"),Wn=s(" formats are supported (see example below)."),Zn=c(),M(ee.$$.fragment),Cn=c(),M(te.$$.fragment),Nn=c(),St=n("p"),Ln=s("Example:"),Bn=c(),M(oe.$$.fragment),Gn=c(),Dt=n("p"),An=s("To load a textual inversion embedding vector in Automatic1111 format, make sure to first download the vector,"),Fn=c(),M(ne.$$.fragment),Rn=c(),N=n("div"),M(Se.$$.fragment),qn=c(),Y=n("p"),Xn=s("Load pretrained attention processor layers (such as LoRA) into "),Ke=n("a"),Yn=s("UNet2DConditionModel"),Qn=s(` and
`),De=n("a"),jt=n("code"),Vn=s("CLIPTextModel"),zn=s(")."),Hn=c(),M(ae.$$.fragment),On=c(),M(ie.$$.fragment),Kn=c(),se=n("div"),M(je.$$.fragment),ea=c(),Wt=n("p"),ta=s("Save the LoRA parameters corresponding to the UNet and the text encoder."),oa=c(),re=n("div"),M(We.$$.fragment),na=c(),Z=n("p"),aa=s(`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),Zt=n("code"),ia=s("enable_sequential_cpu_offload"),sa=s(", this method moves one whole model at a time to the GPU when its "),Ct=n("code"),ra=s("forward"),la=s(`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),Nt=n("code"),da=s("enable_sequential_cpu_offload"),ca=s(", but performance is much better due to the iterative execution of the "),Lt=n("code"),pa=s("unet"),fa=s("."),ua=c(),le=n("div"),M(Ze.$$.fragment),ma=c(),Q=n("p"),ha=s(`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
`),Bt=n("code"),ga=s("torch.device('meta') and loaded to GPU only when their specific submodule has its "),_a=s("forward"),Gt=n("code"),ba=s("method called. Note that offloading happens on a submodule basis. Memory savings are higher than with"),va=s("enable_model_cpu_offload`, but performance is lower."),this.h()},l(o){const g=Si('[data-svelte="svelte-1phssyn"]',document.head);l=a(g,"META",{name:!0,content:!0}),g.forEach(t),w=p(o),u=a(o,"H1",{class:!0});var Ce=i(u);h=a(Ce,"A",{id:!0,class:!0,href:!0});var At=i(h);y=a(At,"SPAN",{});var Ft=i(y);T(d.$$.fragment,Ft),Ft.forEach(t),At.forEach(t),_=p(Ce),P=a(Ce,"SPAN",{});var Rt=i(P);m=r(Rt,"InstructPix2Pix: Learning to Follow Image Editing Instructions"),Rt.forEach(t),Ce.forEach(t),b=p(o),J=a(o,"H2",{class:!0});var Ne=i(J);W=a(Ne,"A",{id:!0,class:!0,href:!0});var qt=i(W);st=a(qt,"SPAN",{});var Xt=i(st);T(pe.$$.fragment,Xt),Xt.forEach(t),qt.forEach(t),xo=p(Ne),rt=a(Ne,"SPAN",{});var $a=i(rt);yo=r($a,"Overview"),$a.forEach(t),Ne.forEach(t),Qt=p(o),fe=a(o,"P",{});var wa=i(fe);ue=a(wa,"A",{href:!0,rel:!0});var Ea=i(ue);Po=r(Ea,"InstructPix2Pix: Learning to Follow Image Editing Instructions"),Ea.forEach(t),Io=r(wa," by Tim Brooks, Aleksander Holynski and Alexei A. Efros."),wa.forEach(t),Vt=p(o),Be=a(o,"P",{});var Ua=i(Be);Mo=r(Ua,"The abstract of the paper is the following:"),Ua.forEach(t),zt=p(o),Ge=a(o,"P",{});var ka=i(Ge);lt=a(ka,"EM",{});var Ja=i(lt);To=r(Ja,"We propose a method for editing images from human instructions: given an input image and a written instruction that tells the model what to do, our model follows these instructions to edit the image. To obtain training data for this problem, we combine the knowledge of two large pretrained models \u2014 a language model (GPT-3) and a text-to-image model (Stable Diffusion) \u2014 to generate a large dataset of image editing examples. Our conditional diffusion model, InstructPix2Pix, is trained on our generated data, and generalizes to real images and user-written instructions at inference time. Since it performs edits in the forward pass and does not require per example fine-tuning or inversion, our model edits images quickly, in a matter of seconds. We show compelling editing results for a diverse collection of input images and written instructions."),Ja.forEach(t),ka.forEach(t),Ht=p(o),Ae=a(o,"P",{});var Sa=i(Ae);$o=r(Sa,"Resources:"),Sa.forEach(t),Ot=p(o),C=a(o,"UL",{});var de=i(C);Fe=a(de,"LI",{});var xa=i(Fe);me=a(xa,"A",{href:!0,rel:!0});var Da=i(me);Eo=r(Da,"Project Page"),Da.forEach(t),Uo=r(xa,"."),xa.forEach(t),ko=p(de),Re=a(de,"LI",{});var ya=i(Re);he=a(ya,"A",{href:!0,rel:!0});var ja=i(he);Jo=r(ja,"Paper"),ja.forEach(t),So=r(ya,"."),ya.forEach(t),Do=p(de),qe=a(de,"LI",{});var Pa=i(qe);ge=a(Pa,"A",{href:!0,rel:!0});var Wa=i(ge);jo=r(Wa,"Original Code"),Wa.forEach(t),Wo=r(Pa,"."),Pa.forEach(t),Zo=p(de),Xe=a(de,"LI",{});var Ia=i(Xe);_e=a(Ia,"A",{href:!0,rel:!0});var Za=i(_e);Co=r(Za,"Demo"),Za.forEach(t),No=r(Ia,"."),Ia.forEach(t),de.forEach(t),Kt=p(o),G=a(o,"H2",{class:!0});var so=i(G);V=a(so,"A",{id:!0,class:!0,href:!0});var Ca=i(V);dt=a(Ca,"SPAN",{});var Na=i(dt);T(be.$$.fragment,Na),Na.forEach(t),Ca.forEach(t),Lo=p(so),ct=a(so,"SPAN",{});var La=i(ct);Bo=r(La,"Available Pipelines:"),La.forEach(t),so.forEach(t),eo=p(o),z=a(o,"TABLE",{});var ro=i(z);pt=a(ro,"THEAD",{});var Ba=i(pt);A=a(Ba,"TR",{});var et=i(A);ft=a(et,"TH",{});var Ga=i(ft);Go=r(Ga,"Pipeline"),Ga.forEach(t),Ao=p(et),ut=a(et,"TH",{});var Aa=i(ut);Fo=r(Aa,"Tasks"),Aa.forEach(t),Ro=p(et),Ye=a(et,"TH",{align:!0});var Fa=i(Ye);qo=r(Fa,"Demo"),Fa.forEach(t),et.forEach(t),Ba.forEach(t),Xo=p(ro),mt=a(ro,"TBODY",{});var Ra=i(mt);F=a(Ra,"TR",{});var tt=i(F);ht=a(tt,"TD",{});var qa=i(ht);ve=a(qa,"A",{href:!0,rel:!0});var Xa=i(ve);Yo=r(Xa,"StableDiffusionInstructPix2PixPipeline"),Xa.forEach(t),qa.forEach(t),Qo=p(tt),gt=a(tt,"TD",{});var Ya=i(gt);_t=a(Ya,"EM",{});var Qa=i(_t);Vo=r(Qa,"Text-Based Image Editing"),Qa.forEach(t),Ya.forEach(t),zo=p(tt),Qe=a(tt,"TD",{align:!0});var Va=i(Qe);we=a(Va,"A",{href:!0,rel:!0});var za=i(we);Ho=r(za,"\u{1F917} Space"),za.forEach(t),Va.forEach(t),tt.forEach(t),Ra.forEach(t),ro.forEach(t),to=p(o),R=a(o,"H2",{class:!0});var lo=i(R);H=a(lo,"A",{id:!0,class:!0,href:!0});var Ha=i(H);bt=a(Ha,"SPAN",{});var Oa=i(bt);T(xe.$$.fragment,Oa),Oa.forEach(t),Ha.forEach(t),Oo=p(lo),vt=a(lo,"SPAN",{});var Ka=i(vt);Ko=r(Ka,"Usage example"),Ka.forEach(t),lo.forEach(t),oo=p(o),T(ye.$$.fragment,o),no=p(o),q=a(o,"H2",{class:!0});var co=i(q);O=a(co,"A",{id:!0,class:!0,href:!0});var ei=i(O);wt=a(ei,"SPAN",{});var ti=i(wt);T(Pe.$$.fragment,ti),ti.forEach(t),ei.forEach(t),en=p(co),xt=a(co,"SPAN",{});var oi=i(xt);tn=r(oi,"StableDiffusionInstructPix2PixPipeline"),oi.forEach(t),co.forEach(t),ao=p(o),x=a(o,"DIV",{class:!0});var I=i(x);T(Ie.$$.fragment,I),on=p(I),yt=a(I,"P",{});var ni=i(yt);nn=r(ni,"Pipeline for pixel-level image editing by following text instructions. Based on Stable Diffusion."),ni.forEach(t),an=p(I),Me=a(I,"P",{});var po=i(Me);sn=r(po,"This model inherits from "),Ve=a(po,"A",{href:!0});var ai=i(Ve);rn=r(ai,"DiffusionPipeline"),ai.forEach(t),ln=r(po,`. 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.)`),po.forEach(t),dn=p(I),Pt=a(I,"P",{});var ii=i(Pt);cn=r(ii,"In addition the pipeline inherits the following loading methods:"),ii.forEach(t),pn=p(I),Te=a(I,"UL",{});var fo=i(Te);$e=a(fo,"LI",{});var uo=i($e);It=a(uo,"EM",{});var si=i(It);fn=r(si,"Textual-Inversion"),si.forEach(t),un=r(uo,": "),ze=a(uo,"A",{href:!0});var ri=i(ze);mn=r(ri,"loaders.TextualInversionLoaderMixin.load_textual_inversion()"),ri.forEach(t),uo.forEach(t),hn=p(fo),Ee=a(fo,"LI",{});var mo=i(Ee);Mt=a(mo,"EM",{});var li=i(Mt);gn=r(li,"LoRA"),li.forEach(t),_n=r(mo,": "),He=a(mo,"A",{href:!0});var di=i(He);bn=r(di,"loaders.LoraLoaderMixin.load_lora_weights()"),di.forEach(t),mo.forEach(t),fo.forEach(t),vn=p(I),Tt=a(I,"P",{});var ci=i(Tt);wn=r(ci,"as well as the following saving methods:"),ci.forEach(t),xn=p(I),$t=a(I,"UL",{});var pi=i($t);Ue=a(pi,"LI",{});var ho=i(Ue);Et=a(ho,"EM",{});var fi=i(Et);yn=r(fi,"LoRA"),fi.forEach(t),Pn=r(ho,": "),Oe=a(ho,"A",{href:!0});var ui=i(Oe);In=r(ui,"loaders.LoraLoaderMixin.save_lora_weights()"),ui.forEach(t),ho.forEach(t),pi.forEach(t),Mn=p(I),L=a(I,"DIV",{class:!0});var ot=i(L);T(ke.$$.fragment,ot),Tn=p(ot),Ut=a(ot,"P",{});var mi=i(Ut);$n=r(mi,"Function invoked when calling the pipeline for generation."),mi.forEach(t),En=p(ot),T(K.$$.fragment,ot),ot.forEach(t),Un=p(I),S=a(I,"DIV",{class:!0});var j=i(S);T(Je.$$.fragment,j),kn=p(j),X=a(j,"P",{});var nt=i(X);Jn=r(nt,"Load textual inversion embeddings into the text encoder of stable diffusion pipelines. Both "),kt=a(nt,"CODE",{});var hi=i(kt);Sn=r(hi,"diffusers"),hi.forEach(t),Dn=r(nt,` and
`),Jt=a(nt,"CODE",{});var gi=i(Jt);jn=r(gi,"Automatic1111"),gi.forEach(t),Wn=r(nt," formats are supported (see example below)."),nt.forEach(t),Zn=p(j),T(ee.$$.fragment,j),Cn=p(j),T(te.$$.fragment,j),Nn=p(j),St=a(j,"P",{});var _i=i(St);Ln=r(_i,"Example:"),_i.forEach(t),Bn=p(j),T(oe.$$.fragment,j),Gn=p(j),Dt=a(j,"P",{});var bi=i(Dt);An=r(bi,"To load a textual inversion embedding vector in Automatic1111 format, make sure to first download the vector,"),bi.forEach(t),Fn=p(j),T(ne.$$.fragment,j),j.forEach(t),Rn=p(I),N=a(I,"DIV",{class:!0});var ce=i(N);T(Se.$$.fragment,ce),qn=p(ce),Y=a(ce,"P",{});var at=i(Y);Xn=r(at,"Load pretrained attention processor layers (such as LoRA) into "),Ke=a(at,"A",{href:!0});var vi=i(Ke);Yn=r(vi,"UNet2DConditionModel"),vi.forEach(t),Qn=r(at,` and
`),De=a(at,"A",{href:!0,rel:!0});var wi=i(De);jt=a(wi,"CODE",{});var xi=i(jt);Vn=r(xi,"CLIPTextModel"),xi.forEach(t),wi.forEach(t),zn=r(at,")."),at.forEach(t),Hn=p(ce),T(ae.$$.fragment,ce),On=p(ce),T(ie.$$.fragment,ce),ce.forEach(t),Kn=p(I),se=a(I,"DIV",{class:!0});var go=i(se);T(je.$$.fragment,go),ea=p(go),Wt=a(go,"P",{});var yi=i(Wt);ta=r(yi,"Save the LoRA parameters corresponding to the UNet and the text encoder."),yi.forEach(t),go.forEach(t),oa=p(I),re=a(I,"DIV",{class:!0});var _o=i(re);T(We.$$.fragment,_o),na=p(_o),Z=a(_o,"P",{});var B=i(Z);aa=r(B,`Offloads all models to CPU using accelerate, reducing memory usage with a low impact on performance. Compared
to `),Zt=a(B,"CODE",{});var Pi=i(Zt);ia=r(Pi,"enable_sequential_cpu_offload"),Pi.forEach(t),sa=r(B,", this method moves one whole model at a time to the GPU when its "),Ct=a(B,"CODE",{});var Ii=i(Ct);ra=r(Ii,"forward"),Ii.forEach(t),la=r(B,`
method is called, and the model remains in GPU until the next model runs. Memory savings are lower than with
`),Nt=a(B,"CODE",{});var Mi=i(Nt);da=r(Mi,"enable_sequential_cpu_offload"),Mi.forEach(t),ca=r(B,", but performance is much better due to the iterative execution of the "),Lt=a(B,"CODE",{});var Ti=i(Lt);pa=r(Ti,"unet"),Ti.forEach(t),fa=r(B,"."),B.forEach(t),_o.forEach(t),ua=p(I),le=a(I,"DIV",{class:!0});var bo=i(le);T(Ze.$$.fragment,bo),ma=p(bo),Q=a(bo,"P",{});var it=i(Q);ha=r(it,`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
`),Bt=a(it,"CODE",{});var $i=i(Bt);ga=r($i,"torch.device('meta') and loaded to GPU only when their specific submodule has its "),$i.forEach(t),_a=r(it,"forward"),Gt=a(it,"CODE",{});var Ei=i(Gt);ba=r(Ei,"method called. Note that offloading happens on a submodule basis. Memory savings are higher than with"),Ei.forEach(t),va=r(it,"enable_model_cpu_offload`, but performance is lower."),it.forEach(t),bo.forEach(t),I.forEach(t),this.h()},h(){f(l,"name","hf:doc:metadata"),f(l,"content",JSON.stringify(Ai)),f(h,"id","instructpix2pix-learning-to-follow-image-editing-instructions"),f(h,"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"),f(h,"href","#instructpix2pix-learning-to-follow-image-editing-instructions"),f(u,"class","relative group"),f(W,"id","overview"),f(W,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),f(W,"href","#overview"),f(J,"class","relative group"),f(ue,"href","https://arxiv.org/abs/2211.09800"),f(ue,"rel","nofollow"),f(me,"href","https://www.timothybrooks.com/instruct-pix2pix"),f(me,"rel","nofollow"),f(he,"href","https://arxiv.org/abs/2211.09800"),f(he,"rel","nofollow"),f(ge,"href","https://github.com/timothybrooks/instruct-pix2pix"),f(ge,"rel","nofollow"),f(_e,"href","https://huggingface.co/spaces/timbrooks/instruct-pix2pix"),f(_e,"rel","nofollow"),f(V,"id","available-pipelines"),f(V,"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"),f(V,"href","#available-pipelines"),f(G,"class","relative group"),f(Ye,"align","center"),f(ve,"href","https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_instruct_pix2pix.py"),f(ve,"rel","nofollow"),f(we,"href","https://huggingface.co/spaces/timbrooks/instruct-pix2pix"),f(we,"rel","nofollow"),f(Qe,"align","center"),f(H,"id","usage-example"),f(H,"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"),f(H,"href","#usage-example"),f(R,"class","relative group"),f(O,"id","diffusers.StableDiffusionInstructPix2PixPipeline"),f(O,"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"),f(O,"href","#diffusers.StableDiffusionInstructPix2PixPipeline"),f(q,"class","relative group"),f(Ve,"href","/docs/diffusers/v0.17.1/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),f(ze,"href","/docs/diffusers/v0.17.1/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline.load_textual_inversion"),f(He,"href","/docs/diffusers/v0.17.1/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline.load_lora_weights"),f(Oe,"href","/docs/diffusers/v0.17.1/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline.save_lora_weights"),f(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(Ke,"href","/docs/diffusers/v0.17.1/en/api/models#diffusers.UNet2DConditionModel"),f(De,"href","https://huggingface.co/docs/transformers/model_doc/clip#transformers.CLIPTextModel"),f(De,"rel","nofollow"),f(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(se,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(re,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(le,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),f(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(o,g){e(document.head,l),v(o,w,g),v(o,u,g),e(u,h),e(h,y),$(d,y,null),e(u,_),e(u,P),e(P,m),v(o,b,g),v(o,J,g),e(J,W),e(W,st),$(pe,st,null),e(J,xo),e(J,rt),e(rt,yo),v(o,Qt,g),v(o,fe,g),e(fe,ue),e(ue,Po),e(fe,Io),v(o,Vt,g),v(o,Be,g),e(Be,Mo),v(o,zt,g),v(o,Ge,g),e(Ge,lt),e(lt,To),v(o,Ht,g),v(o,Ae,g),e(Ae,$o),v(o,Ot,g),v(o,C,g),e(C,Fe),e(Fe,me),e(me,Eo),e(Fe,Uo),e(C,ko),e(C,Re),e(Re,he),e(he,Jo),e(Re,So),e(C,Do),e(C,qe),e(qe,ge),e(ge,jo),e(qe,Wo),e(C,Zo),e(C,Xe),e(Xe,_e),e(_e,Co),e(Xe,No),v(o,Kt,g),v(o,G,g),e(G,V),e(V,dt),$(be,dt,null),e(G,Lo),e(G,ct),e(ct,Bo),v(o,eo,g),v(o,z,g),e(z,pt),e(pt,A),e(A,ft),e(ft,Go),e(A,Ao),e(A,ut),e(ut,Fo),e(A,Ro),e(A,Ye),e(Ye,qo),e(z,Xo),e(z,mt),e(mt,F),e(F,ht),e(ht,ve),e(ve,Yo),e(F,Qo),e(F,gt),e(gt,_t),e(_t,Vo),e(F,zo),e(F,Qe),e(Qe,we),e(we,Ho),v(o,to,g),v(o,R,g),e(R,H),e(H,bt),$(xe,bt,null),e(R,Oo),e(R,vt),e(vt,Ko),v(o,oo,g),$(ye,o,g),v(o,no,g),v(o,q,g),e(q,O),e(O,wt),$(Pe,wt,null),e(q,en),e(q,xt),e(xt,tn),v(o,ao,g),v(o,x,g),$(Ie,x,null),e(x,on),e(x,yt),e(yt,nn),e(x,an),e(x,Me),e(Me,sn),e(Me,Ve),e(Ve,rn),e(Me,ln),e(x,dn),e(x,Pt),e(Pt,cn),e(x,pn),e(x,Te),e(Te,$e),e($e,It),e(It,fn),e($e,un),e($e,ze),e(ze,mn),e(Te,hn),e(Te,Ee),e(Ee,Mt),e(Mt,gn),e(Ee,_n),e(Ee,He),e(He,bn),e(x,vn),e(x,Tt),e(Tt,wn),e(x,xn),e(x,$t),e($t,Ue),e(Ue,Et),e(Et,yn),e(Ue,Pn),e(Ue,Oe),e(Oe,In),e(x,Mn),e(x,L),$(ke,L,null),e(L,Tn),e(L,Ut),e(Ut,$n),e(L,En),$(K,L,null),e(x,Un),e(x,S),$(Je,S,null),e(S,kn),e(S,X),e(X,Jn),e(X,kt),e(kt,Sn),e(X,Dn),e(X,Jt),e(Jt,jn),e(X,Wn),e(S,Zn),$(ee,S,null),e(S,Cn),$(te,S,null),e(S,Nn),e(S,St),e(St,Ln),e(S,Bn),$(oe,S,null),e(S,Gn),e(S,Dt),e(Dt,An),e(S,Fn),$(ne,S,null),e(x,Rn),e(x,N),$(Se,N,null),e(N,qn),e(N,Y),e(Y,Xn),e(Y,Ke),e(Ke,Yn),e(Y,Qn),e(Y,De),e(De,jt),e(jt,Vn),e(Y,zn),e(N,Hn),$(ae,N,null),e(N,On),$(ie,N,null),e(x,Kn),e(x,se),$(je,se,null),e(se,ea),e(se,Wt),e(Wt,ta),e(x,oa),e(x,re),$(We,re,null),e(re,na),e(re,Z),e(Z,aa),e(Z,Zt),e(Zt,ia),e(Z,sa),e(Z,Ct),e(Ct,ra),e(Z,la),e(Z,Nt),e(Nt,da),e(Z,ca),e(Z,Lt),e(Lt,pa),e(Z,fa),e(x,ua),e(x,le),$(Ze,le,null),e(le,ma),e(le,Q),e(Q,ha),e(Q,Bt),e(Bt,ga),e(Q,_a),e(Q,Gt),e(Gt,ba),e(Q,va),io=!0},p(o,[g]){const Ce={};g&2&&(Ce.$$scope={dirty:g,ctx:o}),K.$set(Ce);const At={};g&2&&(At.$$scope={dirty:g,ctx:o}),ee.$set(At);const Ft={};g&2&&(Ft.$$scope={dirty:g,ctx:o}),te.$set(Ft);const Rt={};g&2&&(Rt.$$scope={dirty:g,ctx:o}),oe.$set(Rt);const Ne={};g&2&&(Ne.$$scope={dirty:g,ctx:o}),ne.$set(Ne);const qt={};g&2&&(qt.$$scope={dirty:g,ctx:o}),ae.$set(qt);const Xt={};g&2&&(Xt.$$scope={dirty:g,ctx:o}),ie.$set(Xt)},i(o){io||(E(d.$$.fragment,o),E(pe.$$.fragment,o),E(be.$$.fragment,o),E(xe.$$.fragment,o),E(ye.$$.fragment,o),E(Pe.$$.fragment,o),E(Ie.$$.fragment,o),E(ke.$$.fragment,o),E(K.$$.fragment,o),E(Je.$$.fragment,o),E(ee.$$.fragment,o),E(te.$$.fragment,o),E(oe.$$.fragment,o),E(ne.$$.fragment,o),E(Se.$$.fragment,o),E(ae.$$.fragment,o),E(ie.$$.fragment,o),E(je.$$.fragment,o),E(We.$$.fragment,o),E(Ze.$$.fragment,o),io=!0)},o(o){U(d.$$.fragment,o),U(pe.$$.fragment,o),U(be.$$.fragment,o),U(xe.$$.fragment,o),U(ye.$$.fragment,o),U(Pe.$$.fragment,o),U(Ie.$$.fragment,o),U(ke.$$.fragment,o),U(K.$$.fragment,o),U(Je.$$.fragment,o),U(ee.$$.fragment,o),U(te.$$.fragment,o),U(oe.$$.fragment,o),U(ne.$$.fragment,o),U(Se.$$.fragment,o),U(ae.$$.fragment,o),U(ie.$$.fragment,o),U(je.$$.fragment,o),U(We.$$.fragment,o),U(Ze.$$.fragment,o),io=!1},d(o){t(l),o&&t(w),o&&t(u),k(d),o&&t(b),o&&t(J),k(pe),o&&t(Qt),o&&t(fe),o&&t(Vt),o&&t(Be),o&&t(zt),o&&t(Ge),o&&t(Ht),o&&t(Ae),o&&t(Ot),o&&t(C),o&&t(Kt),o&&t(G),k(be),o&&t(eo),o&&t(z),o&&t(to),o&&t(R),k(xe),o&&t(oo),k(ye,o),o&&t(no),o&&t(q),k(Pe),o&&t(ao),o&&t(x),k(Ie),k(ke),k(K),k(Je),k(ee),k(te),k(oe),k(ne),k(Se),k(ae),k(ie),k(je),k(We),k(Ze)}}}const Ai={local:"instructpix2pix-learning-to-follow-image-editing-instructions",sections:[{local:"overview",title:"Overview"},{local:"available-pipelines",title:"Available Pipelines:"},{local:"usage-example",title:"Usage example"},{local:"diffusers.StableDiffusionInstructPix2PixPipeline",title:"StableDiffusionInstructPix2PixPipeline"}],title:"InstructPix2Pix: Learning to Follow Image Editing Instructions"};function Fi(D){return Di(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class zi extends Ui{constructor(l){super();ki(this,l,Fi,Gi,Ji,{})}}export{zi as default,Ai as metadata};
