import{S as Br,i as Hr,s as zr,e as i,k as p,w as x,t,M as Rr,c as r,d as o,m as f,a as l,x as P,h as a,b as c,G as e,g as m,y,q as I,o as D,B as k,v as Wr,L as Vr}from"../../../../chunks/vendor-hf-doc-builder.js";import{D as Ws}from"../../../../chunks/Docstring-hf-doc-builder.js";import{C as Ur}from"../../../../chunks/CodeBlock-hf-doc-builder.js";import{I as Zt}from"../../../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Kr}from"../../../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Jr(ea){let g,M,b,_,$;return _=new Ur({props:{code:`import PIL
import requests
import torch
from io import BytesIO

from diffusers import StableDiffusionInstructPix2PixPipeline


def download_image(url):
    response = requests.get(url)
    return PIL.Image.open(BytesIO(response.content)).convert("RGB")


img_url = "https://huggingface.co/datasets/diffusers/diffusers-images-docs/resolve/main/mountain.png"

image = download_image(img_url).resize((512, 512))

pipe = StableDiffusionInstructPix2PixPipeline.from_pretrained(
    "timbrooks/instruct-pix2pix", torch_dtype=torch.float16
)
pipe = pipe.to("cuda")

prompt = "make the mountains snowy"
image = pipe(prompt=prompt, image=image).images[0]`,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(){g=i("p"),M=t("Examples:"),b=p(),x(_.$$.fragment)},l(h){g=r(h,"P",{});var C=l(g);M=a(C,"Examples:"),C.forEach(o),b=f(h),P(_.$$.fragment,h)},m(h,C){m(h,g,C),e(g,M),m(h,b,C),y(_,h,C),$=!0},p:Vr,i(h){$||(I(_.$$.fragment,h),$=!0)},o(h){D(_.$$.fragment,h),$=!1},d(h){h&&o(g),h&&o(b),k(_,h)}}}function Yr(ea){let g,M,b,_,$,h,C,Te,xa,ta,T,N,Oe,V,Pa,je,ya,aa,K,J,Ia,Da,oa,_e,ka,na,ve,Le,$a,sa,be,Ca,ia,w,we,Y,Sa,Ta,Oa,Ee,Q,ja,La,qa,xe,X,Aa,Ma,Na,Pe,Z,Fa,Ga,ra,O,F,qe,ee,Ua,Ae,Ba,la,G,Me,j,Ne,Ha,za,Fe,Ra,Wa,ye,Va,Ka,Ge,L,Ue,te,Ja,Ya,Be,He,Qa,Xa,Ie,ae,Za,da,q,U,ze,oe,eo,Re,to,ca,ne,pa,A,B,We,se,ao,Ve,oo,fa,v,ie,no,Ke,so,io,re,ro,De,lo,co,po,E,le,fo,Je,uo,mo,n,ho,Ye,go,_o,Qe,vo,bo,Xe,wo,Eo,Ze,xo,Po,et,yo,Io,tt,Do,ko,at,$o,Co,de,So,To,ot,Oo,jo,nt,Lo,qo,ce,Ao,Mo,st,No,Fo,it,Go,Uo,rt,Bo,Ho,lt,zo,Ro,dt,Wo,Vo,ct,Ko,Jo,pt,Yo,Qo,ft,Xo,Zo,ut,en,tn,mt,an,on,ht,nn,sn,gt,rn,ln,_t,dn,cn,vt,pn,fn,bt,un,mn,wt,hn,gn,Et,_n,vn,xt,bn,wn,Pt,En,xn,pe,Pn,yn,ke,In,Dn,yt,kn,$n,It,Cn,Sn,fe,Tn,On,Dt,jn,Ln,kt,qn,An,$t,Mn,Nn,Ct,Fn,Gn,St,Un,Bn,Tt,Hn,zn,Ot,Rn,Wn,jt,Vn,Kn,Lt,Jn,Yn,qt,Qn,Xn,At,Zn,es,Mt,ts,as,Nt,os,ns,Ft,ss,is,ue,rs,ls,Gt,ds,cs,Ut,ps,fs,Bt,us,ms,Ht,hs,gs,zt,_s,vs,$e,bs,ws,Rt,Es,xs,Wt,Ps,ys,Vt,Is,Ds,Kt,ks,$s,Jt,Cs,Ss,Yt,Ts,Os,Qt,js,Ls,qs,H,As,z,me,Ms,he,Ns,Xt,Fs,Gs,ua;return h=new Zt({}),V=new Zt({}),ee=new Zt({}),oe=new Zt({}),ne=new Ur({props:{code:`import PIL
import requests
import torch
from diffusers import StableDiffusionInstructPix2PixPipeline

model_id = "timbrooks/instruct-pix2pix"
pipe = StableDiffusionInstructPix2PixPipeline.from_pretrained(model_id, torch_dtype=torch.float16).to("cuda")

url = "https://huggingface.co/datasets/diffusers/diffusers-images-docs/resolve/main/mountain.png"


def download_image(url):
    image = PIL.Image.open(requests.get(url, stream=True).raw)
    image = PIL.ImageOps.exif_transpose(image)
    image = image.convert("RGB")
    return image


image = download_image(url)

prompt = "make the mountains snowy"
edit = pipe(prompt, image=image, num_inference_steps=20, image_guidance_scale=1.5, guidance_scale=7).images[0]
images[0].save("snowy_mountains.png")`,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>
edit = 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[<span class="hljs-number">0</span>]
images[<span class="hljs-number">0</span>].save(<span class="hljs-string">&quot;snowy_mountains.png&quot;</span>)`}}),se=new Zt({}),ie=new Ws({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:": CLIPFeatureExtractor"},{name:"requires_safety_checker",val:": bool = True"}],parametersDescription:[{anchor:"diffusers.StableDiffusionInstructPix2PixPipeline.vae",description:`<strong>vae</strong> (<a href="/docs/diffusers/v0.12.0/en/api/models#diffusers.AutoencoderKL">AutoencoderKL</a>) &#x2014;
Variational Auto-Encoder (VAE) Model to encode and decode images to and from latent representations.`,name:"vae"},{anchor:"diffusers.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.12.0/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.12.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.12.0/en/api/schedulers/ddim#diffusers.DDIMScheduler">DDIMScheduler</a>, <a href="/docs/diffusers/v0.12.0/en/api/schedulers/lms_discrete#diffusers.LMSDiscreteScheduler">LMSDiscreteScheduler</a>, or <a href="/docs/diffusers/v0.12.0/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>CLIPFeatureExtractor</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.12.0/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_instruct_pix2pix.py#L57"}}),le=new Ws({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] = 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:": typing.Optional[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"}],source:"https://github.com/huggingface/diffusers/blob/v0.12.0/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_instruct_pix2pix.py#L127",returnDescription:`
<p><a
  href="/docs/diffusers/v0.12.0/en/api/pipelines/stable_diffusion/overview#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"
>StableDiffusionPipelineOutput</a> if <code>return_dict</code> is True, otherwise a <code>tuple. When returning a tuple, the first element is a list with the generated images, and the second element is a list of </code>bool<code>s denoting whether the corresponding generated image likely represents "not-safe-for-work" (nsfw) content, according to the </code>safety_checker\`.</p>
`,returnType:`
<p><a
  href="/docs/diffusers/v0.12.0/en/api/pipelines/stable_diffusion/overview#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"
>StableDiffusionPipelineOutput</a> or <code>tuple</code></p>
`}}),H=new Kr({props:{anchor:"diffusers.StableDiffusionInstructPix2PixPipeline.__call__.example",$$slots:{default:[Jr]},$$scope:{ctx:ea}}}),me=new Ws({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.12.0/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_instruct_pix2pix.py#L383"}}),{c(){g=i("meta"),M=p(),b=i("h1"),_=i("a"),$=i("span"),x(h.$$.fragment),C=p(),Te=i("span"),xa=t("InstructPix2Pix: Learning to Follow Image Editing Instructions"),ta=p(),T=i("h2"),N=i("a"),Oe=i("span"),x(V.$$.fragment),Pa=p(),je=i("span"),ya=t("Overview"),aa=p(),K=i("p"),J=i("a"),Ia=t("InstructPix2Pix: Learning to Follow Image Editing Instructions"),Da=t(" by Tim Brooks, Aleksander Holynski and Alexei A. Efros."),oa=p(),_e=i("p"),ka=t("The abstract of the paper is the following:"),na=p(),ve=i("p"),Le=i("em"),$a=t("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."),sa=p(),be=i("p"),Ca=t("Resources:"),ia=p(),w=i("ul"),we=i("li"),Y=i("a"),Sa=t("Project Page"),Ta=t("."),Oa=p(),Ee=i("li"),Q=i("a"),ja=t("Paper"),La=t("."),qa=p(),xe=i("li"),X=i("a"),Aa=t("Original Code"),Ma=t("."),Na=p(),Pe=i("li"),Z=i("a"),Fa=t("Demo"),Ga=t("."),ra=p(),O=i("h2"),F=i("a"),qe=i("span"),x(ee.$$.fragment),Ua=p(),Ae=i("span"),Ba=t("Available Pipelines:"),la=p(),G=i("table"),Me=i("thead"),j=i("tr"),Ne=i("th"),Ha=t("Pipeline"),za=p(),Fe=i("th"),Ra=t("Tasks"),Wa=p(),ye=i("th"),Va=t("Demo"),Ka=p(),Ge=i("tbody"),L=i("tr"),Ue=i("td"),te=i("a"),Ja=t("StableDiffusionInstructPix2PixPipeline"),Ya=p(),Be=i("td"),He=i("em"),Qa=t("Text-Based Image Editing"),Xa=p(),Ie=i("td"),ae=i("a"),Za=t("\u{1F917} Space"),da=p(),q=i("h2"),U=i("a"),ze=i("span"),x(oe.$$.fragment),eo=p(),Re=i("span"),to=t("Usage example"),ca=p(),x(ne.$$.fragment),pa=p(),A=i("h2"),B=i("a"),We=i("span"),x(se.$$.fragment),ao=p(),Ve=i("span"),oo=t("StableDiffusionInstructPix2PixPipeline"),fa=p(),v=i("div"),x(ie.$$.fragment),no=p(),Ke=i("p"),so=t("Pipeline for pixel-level image editing by following text instructions. Based on Stable Diffusion."),io=p(),re=i("p"),ro=t("This model inherits from "),De=i("a"),lo=t("DiffusionPipeline"),co=t(`. 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=p(),E=i("div"),x(le.$$.fragment),fo=p(),Je=i("p"),uo=t("Function invoked when calling the pipeline for generation."),mo=p(),n=i("p"),ho=t("image ("),Ye=i("code"),go=t("PIL.Image.Image"),_o=t(`):
`),Qe=i("code"),vo=t("Image"),bo=t(", or tensor representing an image batch which will be repainted according to "),Xe=i("code"),wo=t("prompt"),Eo=t(`.
num_inference_steps (`),Ze=i("code"),xo=t("int"),Po=t(", "),et=i("em"),yo=t("optional"),Io=t(`, defaults to 100):
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.
guidance_scale (`),tt=i("code"),Do=t("float"),ko=t(", "),at=i("em"),$o=t("optional"),Co=t(`, defaults to 7.5):
Guidance scale as defined in `),de=i("a"),So=t("Classifier-Free Diffusion Guidance"),To=t(`.
`),ot=i("code"),Oo=t("guidance_scale"),jo=t(" is defined as "),nt=i("code"),Lo=t("w"),qo=t(" of equation 2. of "),ce=i("a"),Ao=t(`Imagen
Paper`),Mo=t(". Guidance scale is enabled by setting "),st=i("code"),No=t("guidance_scale > 1"),Fo=t(". Higher guidance scale encourages to generate images that are closely linked to the text "),it=i("code"),Go=t("prompt"),Uo=t(`,
usually at the expense of lower image quality. This pipeline requires a value of at least `),rt=i("code"),Bo=t("1"),Ho=t(`.
image_guidance_scale (`),lt=i("code"),zo=t("float"),Ro=t(", "),dt=i("em"),Wo=t("optional"),Vo=t(`, defaults to 1.5):
Image guidance scale is to push the generated image towards the inital image `),ct=i("code"),Ko=t("image"),Jo=t(`. Image guidance
scale is enabled by setting `),pt=i("code"),Yo=t("image_guidance_scale > 1"),Qo=t(`. Higher image guidance scale encourages to
generate images that are closely linked to the source image `),ft=i("code"),Xo=t("image"),Zo=t(`, usually at the expense of lower
image quality. This pipeline requires a value of at least `),ut=i("code"),en=t("1"),tn=t(`.
negative_prompt (`),mt=i("code"),an=t("str"),on=t(" or "),ht=i("code"),nn=t("List[str]"),sn=t(", "),gt=i("em"),rn=t("optional"),ln=t(`):
The prompt or prompts not to guide the image generation. If not defined, one has to pass
`),_t=i("code"),dn=t("negative_prompt_embeds"),cn=t(". instead. Ignored when not using guidance (i.e., ignored if "),vt=i("code"),pn=t("guidance_scale"),fn=t(`
is less than `),bt=i("code"),un=t("1"),mn=t(`).
num_images_per_prompt (`),wt=i("code"),hn=t("int"),gn=t(", "),Et=i("em"),_n=t("optional"),vn=t(`, defaults to 1):
The number of images to generate per prompt.
eta (`),xt=i("code"),bn=t("float"),wn=t(", "),Pt=i("em"),En=t("optional"),xn=t(`, defaults to 0.0):
Corresponds to parameter eta (\u03B7) in the DDIM paper: `),pe=i("a"),Pn=t("https://arxiv.org/abs/2010.02502"),yn=t(`. Only applies to
`),ke=i("a"),In=t("schedulers.DDIMScheduler"),Dn=t(`, will be ignored for others.
generator (`),yt=i("code"),kn=t("torch.Generator"),$n=t(", "),It=i("em"),Cn=t("optional"),Sn=t(`):
One or a list of `),fe=i("a"),Tn=t("torch generator(s)"),On=t(`
to make generation deterministic.
latents (`),Dt=i("code"),jn=t("torch.FloatTensor"),Ln=t(", "),kt=i("em"),qn=t("optional"),An=t(`):
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 `),$t=i("code"),Mn=t("generator"),Nn=t(`.
prompt_embeds (`),Ct=i("code"),Fn=t("torch.FloatTensor"),Gn=t(", "),St=i("em"),Un=t("optional"),Bn=t(`):
Pre-generated text embeddings. Can be used to easily tweak text inputs, `),Tt=i("em"),Hn=t("e.g."),zn=t(` prompt weighting. If not
provided, text embeddings will be generated from `),Ot=i("code"),Rn=t("prompt"),Wn=t(` input argument.
negative_prompt_embeds (`),jt=i("code"),Vn=t("torch.FloatTensor"),Kn=t(", "),Lt=i("em"),Jn=t("optional"),Yn=t(`):
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, `),qt=i("em"),Qn=t("e.g."),Xn=t(` prompt
weighting. If not provided, negative_prompt_embeds will be generated from `),At=i("code"),Zn=t("negative_prompt"),es=t(` input
argument.
output_type (`),Mt=i("code"),ts=t("str"),as=t(", "),Nt=i("em"),os=t("optional"),ns=t(", defaults to "),Ft=i("code"),ss=t('"pil"'),is=t(`):
The output format of the generate image. Choose between
`),ue=i("a"),rs=t("PIL"),ls=t(": "),Gt=i("code"),ds=t("PIL.Image.Image"),cs=t(" or "),Ut=i("code"),ps=t("np.array"),fs=t(`.
return_dict (`),Bt=i("code"),us=t("bool"),ms=t(", "),Ht=i("em"),hs=t("optional"),gs=t(", defaults to "),zt=i("code"),_s=t("True"),vs=t(`):
Whether or not to return a `),$e=i("a"),bs=t("StableDiffusionPipelineOutput"),ws=t(` instead of a
plain tuple.
callback (`),Rt=i("code"),Es=t("Callable"),xs=t(", "),Wt=i("em"),Ps=t("optional"),ys=t(`):
A function that will be called every `),Vt=i("code"),Is=t("callback_steps"),Ds=t(` steps during inference. The function will be
called with the following arguments: `),Kt=i("code"),ks=t("callback(step: int, timestep: int, latents: torch.FloatTensor)"),$s=t(`.
callback_steps (`),Jt=i("code"),Cs=t("int"),Ss=t(", "),Yt=i("em"),Ts=t("optional"),Os=t(`, defaults to 1):
The frequency at which the `),Qt=i("code"),js=t("callback"),Ls=t(` function will be called. If not specified, the callback will be
called at every step.`),qs=p(),x(H.$$.fragment),As=p(),z=i("div"),x(me.$$.fragment),Ms=p(),he=i("p"),Ns=t(`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
`),Xt=i("code"),Fs=t("torch.device('meta') and loaded to GPU only when their specific submodule has its "),Gs=t("forward` method called."),this.h()},l(d){const u=Rr('[data-svelte="svelte-1phssyn"]',document.head);g=r(u,"META",{name:!0,content:!0}),u.forEach(o),M=f(d),b=r(d,"H1",{class:!0});var ge=l(b);_=r(ge,"A",{id:!0,class:!0,href:!0});var Vs=l(_);$=r(Vs,"SPAN",{});var Ks=l($);P(h.$$.fragment,Ks),Ks.forEach(o),Vs.forEach(o),C=f(ge),Te=r(ge,"SPAN",{});var Js=l(Te);xa=a(Js,"InstructPix2Pix: Learning to Follow Image Editing Instructions"),Js.forEach(o),ge.forEach(o),ta=f(d),T=r(d,"H2",{class:!0});var ma=l(T);N=r(ma,"A",{id:!0,class:!0,href:!0});var Ys=l(N);Oe=r(Ys,"SPAN",{});var Qs=l(Oe);P(V.$$.fragment,Qs),Qs.forEach(o),Ys.forEach(o),Pa=f(ma),je=r(ma,"SPAN",{});var Xs=l(je);ya=a(Xs,"Overview"),Xs.forEach(o),ma.forEach(o),aa=f(d),K=r(d,"P",{});var Us=l(K);J=r(Us,"A",{href:!0,rel:!0});var Zs=l(J);Ia=a(Zs,"InstructPix2Pix: Learning to Follow Image Editing Instructions"),Zs.forEach(o),Da=a(Us," by Tim Brooks, Aleksander Holynski and Alexei A. Efros."),Us.forEach(o),oa=f(d),_e=r(d,"P",{});var ei=l(_e);ka=a(ei,"The abstract of the paper is the following:"),ei.forEach(o),na=f(d),ve=r(d,"P",{});var ti=l(ve);Le=r(ti,"EM",{});var ai=l(Le);$a=a(ai,"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."),ai.forEach(o),ti.forEach(o),sa=f(d),be=r(d,"P",{});var oi=l(be);Ca=a(oi,"Resources:"),oi.forEach(o),ia=f(d),w=r(d,"UL",{});var R=l(w);we=r(R,"LI",{});var Bs=l(we);Y=r(Bs,"A",{href:!0,rel:!0});var ni=l(Y);Sa=a(ni,"Project Page"),ni.forEach(o),Ta=a(Bs,"."),Bs.forEach(o),Oa=f(R),Ee=r(R,"LI",{});var Hs=l(Ee);Q=r(Hs,"A",{href:!0,rel:!0});var si=l(Q);ja=a(si,"Paper"),si.forEach(o),La=a(Hs,"."),Hs.forEach(o),qa=f(R),xe=r(R,"LI",{});var zs=l(xe);X=r(zs,"A",{href:!0,rel:!0});var ii=l(X);Aa=a(ii,"Original Code"),ii.forEach(o),Ma=a(zs,"."),zs.forEach(o),Na=f(R),Pe=r(R,"LI",{});var Rs=l(Pe);Z=r(Rs,"A",{href:!0,rel:!0});var ri=l(Z);Fa=a(ri,"Demo"),ri.forEach(o),Ga=a(Rs,"."),Rs.forEach(o),R.forEach(o),ra=f(d),O=r(d,"H2",{class:!0});var ha=l(O);F=r(ha,"A",{id:!0,class:!0,href:!0});var li=l(F);qe=r(li,"SPAN",{});var di=l(qe);P(ee.$$.fragment,di),di.forEach(o),li.forEach(o),Ua=f(ha),Ae=r(ha,"SPAN",{});var ci=l(Ae);Ba=a(ci,"Available Pipelines:"),ci.forEach(o),ha.forEach(o),la=f(d),G=r(d,"TABLE",{});var ga=l(G);Me=r(ga,"THEAD",{});var pi=l(Me);j=r(pi,"TR",{});var Ce=l(j);Ne=r(Ce,"TH",{});var fi=l(Ne);Ha=a(fi,"Pipeline"),fi.forEach(o),za=f(Ce),Fe=r(Ce,"TH",{});var ui=l(Fe);Ra=a(ui,"Tasks"),ui.forEach(o),Wa=f(Ce),ye=r(Ce,"TH",{align:!0});var mi=l(ye);Va=a(mi,"Demo"),mi.forEach(o),Ce.forEach(o),pi.forEach(o),Ka=f(ga),Ge=r(ga,"TBODY",{});var hi=l(Ge);L=r(hi,"TR",{});var Se=l(L);Ue=r(Se,"TD",{});var gi=l(Ue);te=r(gi,"A",{href:!0,rel:!0});var _i=l(te);Ja=a(_i,"StableDiffusionInstructPix2PixPipeline"),_i.forEach(o),gi.forEach(o),Ya=f(Se),Be=r(Se,"TD",{});var vi=l(Be);He=r(vi,"EM",{});var bi=l(He);Qa=a(bi,"Text-Based Image Editing"),bi.forEach(o),vi.forEach(o),Xa=f(Se),Ie=r(Se,"TD",{align:!0});var wi=l(Ie);ae=r(wi,"A",{href:!0,rel:!0});var Ei=l(ae);Za=a(Ei,"\u{1F917} Space"),Ei.forEach(o),wi.forEach(o),Se.forEach(o),hi.forEach(o),ga.forEach(o),da=f(d),q=r(d,"H2",{class:!0});var _a=l(q);U=r(_a,"A",{id:!0,class:!0,href:!0});var xi=l(U);ze=r(xi,"SPAN",{});var Pi=l(ze);P(oe.$$.fragment,Pi),Pi.forEach(o),xi.forEach(o),eo=f(_a),Re=r(_a,"SPAN",{});var yi=l(Re);to=a(yi,"Usage example"),yi.forEach(o),_a.forEach(o),ca=f(d),P(ne.$$.fragment,d),pa=f(d),A=r(d,"H2",{class:!0});var va=l(A);B=r(va,"A",{id:!0,class:!0,href:!0});var Ii=l(B);We=r(Ii,"SPAN",{});var Di=l(We);P(se.$$.fragment,Di),Di.forEach(o),Ii.forEach(o),ao=f(va),Ve=r(va,"SPAN",{});var ki=l(Ve);oo=a(ki,"StableDiffusionInstructPix2PixPipeline"),ki.forEach(o),va.forEach(o),fa=f(d),v=r(d,"DIV",{class:!0});var S=l(v);P(ie.$$.fragment,S),no=f(S),Ke=r(S,"P",{});var $i=l(Ke);so=a($i,"Pipeline for pixel-level image editing by following text instructions. Based on Stable Diffusion."),$i.forEach(o),io=f(S),re=r(S,"P",{});var ba=l(re);ro=a(ba,"This model inherits from "),De=r(ba,"A",{href:!0});var Ci=l(De);lo=a(Ci,"DiffusionPipeline"),Ci.forEach(o),co=a(ba,`. 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.)`),ba.forEach(o),po=f(S),E=r(S,"DIV",{class:!0});var W=l(E);P(le.$$.fragment,W),fo=f(W),Je=r(W,"P",{});var Si=l(Je);uo=a(Si,"Function invoked when calling the pipeline for generation."),Si.forEach(o),mo=f(W),n=r(W,"P",{});var s=l(n);ho=a(s,"image ("),Ye=r(s,"CODE",{});var Ti=l(Ye);go=a(Ti,"PIL.Image.Image"),Ti.forEach(o),_o=a(s,`):
`),Qe=r(s,"CODE",{});var Oi=l(Qe);vo=a(Oi,"Image"),Oi.forEach(o),bo=a(s,", or tensor representing an image batch which will be repainted according to "),Xe=r(s,"CODE",{});var ji=l(Xe);wo=a(ji,"prompt"),ji.forEach(o),Eo=a(s,`.
num_inference_steps (`),Ze=r(s,"CODE",{});var Li=l(Ze);xo=a(Li,"int"),Li.forEach(o),Po=a(s,", "),et=r(s,"EM",{});var qi=l(et);yo=a(qi,"optional"),qi.forEach(o),Io=a(s,`, defaults to 100):
The number of denoising steps. More denoising steps usually lead to a higher quality image at the
expense of slower inference.
guidance_scale (`),tt=r(s,"CODE",{});var Ai=l(tt);Do=a(Ai,"float"),Ai.forEach(o),ko=a(s,", "),at=r(s,"EM",{});var Mi=l(at);$o=a(Mi,"optional"),Mi.forEach(o),Co=a(s,`, defaults to 7.5):
Guidance scale as defined in `),de=r(s,"A",{href:!0,rel:!0});var Ni=l(de);So=a(Ni,"Classifier-Free Diffusion Guidance"),Ni.forEach(o),To=a(s,`.
`),ot=r(s,"CODE",{});var Fi=l(ot);Oo=a(Fi,"guidance_scale"),Fi.forEach(o),jo=a(s," is defined as "),nt=r(s,"CODE",{});var Gi=l(nt);Lo=a(Gi,"w"),Gi.forEach(o),qo=a(s," of equation 2. of "),ce=r(s,"A",{href:!0,rel:!0});var Ui=l(ce);Ao=a(Ui,`Imagen
Paper`),Ui.forEach(o),Mo=a(s,". Guidance scale is enabled by setting "),st=r(s,"CODE",{});var Bi=l(st);No=a(Bi,"guidance_scale > 1"),Bi.forEach(o),Fo=a(s,". Higher guidance scale encourages to generate images that are closely linked to the text "),it=r(s,"CODE",{});var Hi=l(it);Go=a(Hi,"prompt"),Hi.forEach(o),Uo=a(s,`,
usually at the expense of lower image quality. This pipeline requires a value of at least `),rt=r(s,"CODE",{});var zi=l(rt);Bo=a(zi,"1"),zi.forEach(o),Ho=a(s,`.
image_guidance_scale (`),lt=r(s,"CODE",{});var Ri=l(lt);zo=a(Ri,"float"),Ri.forEach(o),Ro=a(s,", "),dt=r(s,"EM",{});var Wi=l(dt);Wo=a(Wi,"optional"),Wi.forEach(o),Vo=a(s,`, defaults to 1.5):
Image guidance scale is to push the generated image towards the inital image `),ct=r(s,"CODE",{});var Vi=l(ct);Ko=a(Vi,"image"),Vi.forEach(o),Jo=a(s,`. Image guidance
scale is enabled by setting `),pt=r(s,"CODE",{});var Ki=l(pt);Yo=a(Ki,"image_guidance_scale > 1"),Ki.forEach(o),Qo=a(s,`. Higher image guidance scale encourages to
generate images that are closely linked to the source image `),ft=r(s,"CODE",{});var Ji=l(ft);Xo=a(Ji,"image"),Ji.forEach(o),Zo=a(s,`, usually at the expense of lower
image quality. This pipeline requires a value of at least `),ut=r(s,"CODE",{});var Yi=l(ut);en=a(Yi,"1"),Yi.forEach(o),tn=a(s,`.
negative_prompt (`),mt=r(s,"CODE",{});var Qi=l(mt);an=a(Qi,"str"),Qi.forEach(o),on=a(s," or "),ht=r(s,"CODE",{});var Xi=l(ht);nn=a(Xi,"List[str]"),Xi.forEach(o),sn=a(s,", "),gt=r(s,"EM",{});var Zi=l(gt);rn=a(Zi,"optional"),Zi.forEach(o),ln=a(s,`):
The prompt or prompts not to guide the image generation. If not defined, one has to pass
`),_t=r(s,"CODE",{});var er=l(_t);dn=a(er,"negative_prompt_embeds"),er.forEach(o),cn=a(s,". instead. Ignored when not using guidance (i.e., ignored if "),vt=r(s,"CODE",{});var tr=l(vt);pn=a(tr,"guidance_scale"),tr.forEach(o),fn=a(s,`
is less than `),bt=r(s,"CODE",{});var ar=l(bt);un=a(ar,"1"),ar.forEach(o),mn=a(s,`).
num_images_per_prompt (`),wt=r(s,"CODE",{});var or=l(wt);hn=a(or,"int"),or.forEach(o),gn=a(s,", "),Et=r(s,"EM",{});var nr=l(Et);_n=a(nr,"optional"),nr.forEach(o),vn=a(s,`, defaults to 1):
The number of images to generate per prompt.
eta (`),xt=r(s,"CODE",{});var sr=l(xt);bn=a(sr,"float"),sr.forEach(o),wn=a(s,", "),Pt=r(s,"EM",{});var ir=l(Pt);En=a(ir,"optional"),ir.forEach(o),xn=a(s,`, defaults to 0.0):
Corresponds to parameter eta (\u03B7) in the DDIM paper: `),pe=r(s,"A",{href:!0,rel:!0});var rr=l(pe);Pn=a(rr,"https://arxiv.org/abs/2010.02502"),rr.forEach(o),yn=a(s,`. Only applies to
`),ke=r(s,"A",{href:!0});var lr=l(ke);In=a(lr,"schedulers.DDIMScheduler"),lr.forEach(o),Dn=a(s,`, will be ignored for others.
generator (`),yt=r(s,"CODE",{});var dr=l(yt);kn=a(dr,"torch.Generator"),dr.forEach(o),$n=a(s,", "),It=r(s,"EM",{});var cr=l(It);Cn=a(cr,"optional"),cr.forEach(o),Sn=a(s,`):
One or a list of `),fe=r(s,"A",{href:!0,rel:!0});var pr=l(fe);Tn=a(pr,"torch generator(s)"),pr.forEach(o),On=a(s,`
to make generation deterministic.
latents (`),Dt=r(s,"CODE",{});var fr=l(Dt);jn=a(fr,"torch.FloatTensor"),fr.forEach(o),Ln=a(s,", "),kt=r(s,"EM",{});var ur=l(kt);qn=a(ur,"optional"),ur.forEach(o),An=a(s,`):
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 `),$t=r(s,"CODE",{});var mr=l($t);Mn=a(mr,"generator"),mr.forEach(o),Nn=a(s,`.
prompt_embeds (`),Ct=r(s,"CODE",{});var hr=l(Ct);Fn=a(hr,"torch.FloatTensor"),hr.forEach(o),Gn=a(s,", "),St=r(s,"EM",{});var gr=l(St);Un=a(gr,"optional"),gr.forEach(o),Bn=a(s,`):
Pre-generated text embeddings. Can be used to easily tweak text inputs, `),Tt=r(s,"EM",{});var _r=l(Tt);Hn=a(_r,"e.g."),_r.forEach(o),zn=a(s,` prompt weighting. If not
provided, text embeddings will be generated from `),Ot=r(s,"CODE",{});var vr=l(Ot);Rn=a(vr,"prompt"),vr.forEach(o),Wn=a(s,` input argument.
negative_prompt_embeds (`),jt=r(s,"CODE",{});var br=l(jt);Vn=a(br,"torch.FloatTensor"),br.forEach(o),Kn=a(s,", "),Lt=r(s,"EM",{});var wr=l(Lt);Jn=a(wr,"optional"),wr.forEach(o),Yn=a(s,`):
Pre-generated negative text embeddings. Can be used to easily tweak text inputs, `),qt=r(s,"EM",{});var Er=l(qt);Qn=a(Er,"e.g."),Er.forEach(o),Xn=a(s,` prompt
weighting. If not provided, negative_prompt_embeds will be generated from `),At=r(s,"CODE",{});var xr=l(At);Zn=a(xr,"negative_prompt"),xr.forEach(o),es=a(s,` input
argument.
output_type (`),Mt=r(s,"CODE",{});var Pr=l(Mt);ts=a(Pr,"str"),Pr.forEach(o),as=a(s,", "),Nt=r(s,"EM",{});var yr=l(Nt);os=a(yr,"optional"),yr.forEach(o),ns=a(s,", defaults to "),Ft=r(s,"CODE",{});var Ir=l(Ft);ss=a(Ir,'"pil"'),Ir.forEach(o),is=a(s,`):
The output format of the generate image. Choose between
`),ue=r(s,"A",{href:!0,rel:!0});var Dr=l(ue);rs=a(Dr,"PIL"),Dr.forEach(o),ls=a(s,": "),Gt=r(s,"CODE",{});var kr=l(Gt);ds=a(kr,"PIL.Image.Image"),kr.forEach(o),cs=a(s," or "),Ut=r(s,"CODE",{});var $r=l(Ut);ps=a($r,"np.array"),$r.forEach(o),fs=a(s,`.
return_dict (`),Bt=r(s,"CODE",{});var Cr=l(Bt);us=a(Cr,"bool"),Cr.forEach(o),ms=a(s,", "),Ht=r(s,"EM",{});var Sr=l(Ht);hs=a(Sr,"optional"),Sr.forEach(o),gs=a(s,", defaults to "),zt=r(s,"CODE",{});var Tr=l(zt);_s=a(Tr,"True"),Tr.forEach(o),vs=a(s,`):
Whether or not to return a `),$e=r(s,"A",{href:!0});var Or=l($e);bs=a(Or,"StableDiffusionPipelineOutput"),Or.forEach(o),ws=a(s,` instead of a
plain tuple.
callback (`),Rt=r(s,"CODE",{});var jr=l(Rt);Es=a(jr,"Callable"),jr.forEach(o),xs=a(s,", "),Wt=r(s,"EM",{});var Lr=l(Wt);Ps=a(Lr,"optional"),Lr.forEach(o),ys=a(s,`):
A function that will be called every `),Vt=r(s,"CODE",{});var qr=l(Vt);Is=a(qr,"callback_steps"),qr.forEach(o),Ds=a(s,` steps during inference. The function will be
called with the following arguments: `),Kt=r(s,"CODE",{});var Ar=l(Kt);ks=a(Ar,"callback(step: int, timestep: int, latents: torch.FloatTensor)"),Ar.forEach(o),$s=a(s,`.
callback_steps (`),Jt=r(s,"CODE",{});var Mr=l(Jt);Cs=a(Mr,"int"),Mr.forEach(o),Ss=a(s,", "),Yt=r(s,"EM",{});var Nr=l(Yt);Ts=a(Nr,"optional"),Nr.forEach(o),Os=a(s,`, defaults to 1):
The frequency at which the `),Qt=r(s,"CODE",{});var Fr=l(Qt);js=a(Fr,"callback"),Fr.forEach(o),Ls=a(s,` function will be called. If not specified, the callback will be
called at every step.`),s.forEach(o),qs=f(W),P(H.$$.fragment,W),W.forEach(o),As=f(S),z=r(S,"DIV",{class:!0});var wa=l(z);P(me.$$.fragment,wa),Ms=f(wa),he=r(wa,"P",{});var Ea=l(he);Ns=a(Ea,`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
`),Xt=r(Ea,"CODE",{});var Gr=l(Xt);Fs=a(Gr,"torch.device('meta') and loaded to GPU only when their specific submodule has its "),Gr.forEach(o),Gs=a(Ea,"forward` method called."),Ea.forEach(o),wa.forEach(o),S.forEach(o),this.h()},h(){c(g,"name","hf:doc:metadata"),c(g,"content",JSON.stringify(Qr)),c(_,"id","instructpix2pix-learning-to-follow-image-editing-instructions"),c(_,"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"),c(_,"href","#instructpix2pix-learning-to-follow-image-editing-instructions"),c(b,"class","relative group"),c(N,"id","overview"),c(N,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(N,"href","#overview"),c(T,"class","relative group"),c(J,"href","https://arxiv.org/abs/2211.09800"),c(J,"rel","nofollow"),c(Y,"href","https://www.timothybrooks.com/instruct-pix2pix"),c(Y,"rel","nofollow"),c(Q,"href","https://arxiv.org/abs/2211.09800"),c(Q,"rel","nofollow"),c(X,"href","https://github.com/timothybrooks/instruct-pix2pix"),c(X,"rel","nofollow"),c(Z,"href","https://huggingface.co/spaces/timbrooks/instruct-pix2pix"),c(Z,"rel","nofollow"),c(F,"id","available-pipelines"),c(F,"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"),c(F,"href","#available-pipelines"),c(O,"class","relative group"),c(ye,"align","center"),c(te,"href","https://github.com/huggingface/diffusers/blob/main/src/diffusers/pipelines/stable_diffusion/pipeline_stable_diffusion_instruct_pix2pix.py"),c(te,"rel","nofollow"),c(ae,"href","https://huggingface.co/spaces/timbrooks/instruct-pix2pix"),c(ae,"rel","nofollow"),c(Ie,"align","center"),c(U,"id","usage-example"),c(U,"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"),c(U,"href","#usage-example"),c(q,"class","relative group"),c(B,"id","diffusers.StableDiffusionInstructPix2PixPipeline"),c(B,"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"),c(B,"href","#diffusers.StableDiffusionInstructPix2PixPipeline"),c(A,"class","relative group"),c(De,"href","/docs/diffusers/v0.12.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),c(de,"href","https://arxiv.org/abs/2207.12598"),c(de,"rel","nofollow"),c(ce,"href","https://arxiv.org/pdf/2205.11487.pdf"),c(ce,"rel","nofollow"),c(pe,"href","https://arxiv.org/abs/2010.02502"),c(pe,"rel","nofollow"),c(ke,"href","/docs/diffusers/v0.12.0/en/api/schedulers/ddim#diffusers.DDIMScheduler"),c(fe,"href","https://pytorch.org/docs/stable/generated/torch.Generator.html"),c(fe,"rel","nofollow"),c(ue,"href","https://pillow.readthedocs.io/en/stable/"),c(ue,"rel","nofollow"),c($e,"href","/docs/diffusers/v0.12.0/en/api/pipelines/stable_diffusion/overview#diffusers.pipelines.stable_diffusion.StableDiffusionPipelineOutput"),c(E,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(v,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(d,u){e(document.head,g),m(d,M,u),m(d,b,u),e(b,_),e(_,$),y(h,$,null),e(b,C),e(b,Te),e(Te,xa),m(d,ta,u),m(d,T,u),e(T,N),e(N,Oe),y(V,Oe,null),e(T,Pa),e(T,je),e(je,ya),m(d,aa,u),m(d,K,u),e(K,J),e(J,Ia),e(K,Da),m(d,oa,u),m(d,_e,u),e(_e,ka),m(d,na,u),m(d,ve,u),e(ve,Le),e(Le,$a),m(d,sa,u),m(d,be,u),e(be,Ca),m(d,ia,u),m(d,w,u),e(w,we),e(we,Y),e(Y,Sa),e(we,Ta),e(w,Oa),e(w,Ee),e(Ee,Q),e(Q,ja),e(Ee,La),e(w,qa),e(w,xe),e(xe,X),e(X,Aa),e(xe,Ma),e(w,Na),e(w,Pe),e(Pe,Z),e(Z,Fa),e(Pe,Ga),m(d,ra,u),m(d,O,u),e(O,F),e(F,qe),y(ee,qe,null),e(O,Ua),e(O,Ae),e(Ae,Ba),m(d,la,u),m(d,G,u),e(G,Me),e(Me,j),e(j,Ne),e(Ne,Ha),e(j,za),e(j,Fe),e(Fe,Ra),e(j,Wa),e(j,ye),e(ye,Va),e(G,Ka),e(G,Ge),e(Ge,L),e(L,Ue),e(Ue,te),e(te,Ja),e(L,Ya),e(L,Be),e(Be,He),e(He,Qa),e(L,Xa),e(L,Ie),e(Ie,ae),e(ae,Za),m(d,da,u),m(d,q,u),e(q,U),e(U,ze),y(oe,ze,null),e(q,eo),e(q,Re),e(Re,to),m(d,ca,u),y(ne,d,u),m(d,pa,u),m(d,A,u),e(A,B),e(B,We),y(se,We,null),e(A,ao),e(A,Ve),e(Ve,oo),m(d,fa,u),m(d,v,u),y(ie,v,null),e(v,no),e(v,Ke),e(Ke,so),e(v,io),e(v,re),e(re,ro),e(re,De),e(De,lo),e(re,co),e(v,po),e(v,E),y(le,E,null),e(E,fo),e(E,Je),e(Je,uo),e(E,mo),e(E,n),e(n,ho),e(n,Ye),e(Ye,go),e(n,_o),e(n,Qe),e(Qe,vo),e(n,bo),e(n,Xe),e(Xe,wo),e(n,Eo),e(n,Ze),e(Ze,xo),e(n,Po),e(n,et),e(et,yo),e(n,Io),e(n,tt),e(tt,Do),e(n,ko),e(n,at),e(at,$o),e(n,Co),e(n,de),e(de,So),e(n,To),e(n,ot),e(ot,Oo),e(n,jo),e(n,nt),e(nt,Lo),e(n,qo),e(n,ce),e(ce,Ao),e(n,Mo),e(n,st),e(st,No),e(n,Fo),e(n,it),e(it,Go),e(n,Uo),e(n,rt),e(rt,Bo),e(n,Ho),e(n,lt),e(lt,zo),e(n,Ro),e(n,dt),e(dt,Wo),e(n,Vo),e(n,ct),e(ct,Ko),e(n,Jo),e(n,pt),e(pt,Yo),e(n,Qo),e(n,ft),e(ft,Xo),e(n,Zo),e(n,ut),e(ut,en),e(n,tn),e(n,mt),e(mt,an),e(n,on),e(n,ht),e(ht,nn),e(n,sn),e(n,gt),e(gt,rn),e(n,ln),e(n,_t),e(_t,dn),e(n,cn),e(n,vt),e(vt,pn),e(n,fn),e(n,bt),e(bt,un),e(n,mn),e(n,wt),e(wt,hn),e(n,gn),e(n,Et),e(Et,_n),e(n,vn),e(n,xt),e(xt,bn),e(n,wn),e(n,Pt),e(Pt,En),e(n,xn),e(n,pe),e(pe,Pn),e(n,yn),e(n,ke),e(ke,In),e(n,Dn),e(n,yt),e(yt,kn),e(n,$n),e(n,It),e(It,Cn),e(n,Sn),e(n,fe),e(fe,Tn),e(n,On),e(n,Dt),e(Dt,jn),e(n,Ln),e(n,kt),e(kt,qn),e(n,An),e(n,$t),e($t,Mn),e(n,Nn),e(n,Ct),e(Ct,Fn),e(n,Gn),e(n,St),e(St,Un),e(n,Bn),e(n,Tt),e(Tt,Hn),e(n,zn),e(n,Ot),e(Ot,Rn),e(n,Wn),e(n,jt),e(jt,Vn),e(n,Kn),e(n,Lt),e(Lt,Jn),e(n,Yn),e(n,qt),e(qt,Qn),e(n,Xn),e(n,At),e(At,Zn),e(n,es),e(n,Mt),e(Mt,ts),e(n,as),e(n,Nt),e(Nt,os),e(n,ns),e(n,Ft),e(Ft,ss),e(n,is),e(n,ue),e(ue,rs),e(n,ls),e(n,Gt),e(Gt,ds),e(n,cs),e(n,Ut),e(Ut,ps),e(n,fs),e(n,Bt),e(Bt,us),e(n,ms),e(n,Ht),e(Ht,hs),e(n,gs),e(n,zt),e(zt,_s),e(n,vs),e(n,$e),e($e,bs),e(n,ws),e(n,Rt),e(Rt,Es),e(n,xs),e(n,Wt),e(Wt,Ps),e(n,ys),e(n,Vt),e(Vt,Is),e(n,Ds),e(n,Kt),e(Kt,ks),e(n,$s),e(n,Jt),e(Jt,Cs),e(n,Ss),e(n,Yt),e(Yt,Ts),e(n,Os),e(n,Qt),e(Qt,js),e(n,Ls),e(E,qs),y(H,E,null),e(v,As),e(v,z),y(me,z,null),e(z,Ms),e(z,he),e(he,Ns),e(he,Xt),e(Xt,Fs),e(he,Gs),ua=!0},p(d,[u]){const ge={};u&2&&(ge.$$scope={dirty:u,ctx:d}),H.$set(ge)},i(d){ua||(I(h.$$.fragment,d),I(V.$$.fragment,d),I(ee.$$.fragment,d),I(oe.$$.fragment,d),I(ne.$$.fragment,d),I(se.$$.fragment,d),I(ie.$$.fragment,d),I(le.$$.fragment,d),I(H.$$.fragment,d),I(me.$$.fragment,d),ua=!0)},o(d){D(h.$$.fragment,d),D(V.$$.fragment,d),D(ee.$$.fragment,d),D(oe.$$.fragment,d),D(ne.$$.fragment,d),D(se.$$.fragment,d),D(ie.$$.fragment,d),D(le.$$.fragment,d),D(H.$$.fragment,d),D(me.$$.fragment,d),ua=!1},d(d){o(g),d&&o(M),d&&o(b),k(h),d&&o(ta),d&&o(T),k(V),d&&o(aa),d&&o(K),d&&o(oa),d&&o(_e),d&&o(na),d&&o(ve),d&&o(sa),d&&o(be),d&&o(ia),d&&o(w),d&&o(ra),d&&o(O),k(ee),d&&o(la),d&&o(G),d&&o(da),d&&o(q),k(oe),d&&o(ca),k(ne,d),d&&o(pa),d&&o(A),k(se),d&&o(fa),d&&o(v),k(ie),k(le),k(H),k(me)}}}const Qr={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 Xr(ea){return Wr(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class nl extends Br{constructor(g){super();Hr(this,g,Xr,Yr,zr,{})}}export{nl as default,Qr as metadata};
