import{S as ps,i as cs,s as us,e as a,k as u,w as h,t as s,M as fs,c as i,d as t,m as f,a as n,x as d,h as r,b as c,N as os,G as l,g as p,y as m,L as hs,q as y,o as w,B as _,v as ds}from"../../chunks/vendor-hf-doc-builder.js";import{I as qe}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{C as E}from"../../chunks/CodeBlock-hf-doc-builder.js";function ms(Ai){let C,At,N,A,Oe,K,Sl,Ke,Gl,Bt,ee,te,Fl,Vl,Yt,le,ae,Bi,St,ke,Ql,Gt,ie,ne,Yi,Ft,x,Dl,et,Pl,zl,se,Ll,Hl,Vt,Ae,tt,J,ql,lt,Ol,Kl,re,ea,ta,oe,la,aa,pe,ia,na,Qt,j,B,at,ce,sa,it,ra,Dt,$,Y,nt,ue,oa,st,pa,Pt,Be,ca,zt,Ye,rt,ua,Lt,S,fa,ot,ha,da,Ht,fe,qt,Se,ma,Ot,he,Kt,Ge,ya,el,de,tl,G,wa,me,_a,Ma,ll,ye,al,Fe,Ja,il,we,nl,Ve,Ta,sl,_e,rl,R,F,pt,Me,ga,ct,ba,ol,T,Ua,Je,va,Ea,Te,xa,Wa,Qe,Za,Ia,pl,g,Ca,ut,Na,ja,ge,ft,$a,Ra,ht,Xa,ka,cl,be,ul,M,Aa,dt,Ba,Ya,mt,Sa,Ga,yt,Fa,Va,wt,Qa,Da,fl,Ue,hl,V,Pa,_t,za,La,dl,ve,ml,b,Ha,Mt,qa,Oa,Jt,Ka,ei,Tt,ti,li,yl,Ee,xe,ai,ii,wl,De,gt,bt,ni,_l,X,Q,Ut,We,si,vt,ri,Ml,v,Et,oi,pi,Ze,ci,ui,xt,fi,hi,Jl,Ie,Tl,k,D,Wt,Ce,di,Zt,mi,gl,Pe,yi,bl,Ne,Ul,P,wi,je,_i,Mi,vl,ze,Ji,El,W,It,Ct,Ti,gi,Nt,jt,bi,Ui,$t,Rt,vi,xl,U,Ei,Xt,xi,Wi,kt,Zi,Ii,$e,Ci,Ni,Wl,z,ji,Re,$i,Ri,Zl;return K=new qe({}),ce=new qe({}),ue=new qe({}),fe=new E({props:{code:"Z2l0JTIwY2xvbmUlMjBodHRwcyUzQSUyRiUyRmdpdGh1Yi5jb20lMkZodWdnaW5nZmFjZSUyRmRpZmZ1c2VycyUwQWNkJTIwZGlmZnVzZXJzJTBBcGlwJTIwaW5zdGFsbCUyMC1lJTIwLg==",highlighted:`git <span class="hljs-built_in">clone</span> https://github.com/huggingface/diffusers
<span class="hljs-built_in">cd</span> diffusers
pip install -e .`}}),he=new E({props:{code:"Y2QlMjBleGFtcGxlcyUyRmluc3RydWN0X3BpeDJwaXg=",highlighted:'<span class="hljs-built_in">cd</span> examples/instruct_pix2pix'}}),de=new E({props:{code:"cGlwJTIwaW5zdGFsbCUyMC1yJTIwcmVxdWlyZW1lbnRzLnR4dA==",highlighted:"pip install -r requirements.txt"}}),ye=new E({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZw==",highlighted:"accelerate config"}}),we=new E({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZyUyMGRlZmF1bHQ=",highlighted:"accelerate config default"}}),_e=new E({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUudXRpbHMlMjBpbXBvcnQlMjB3cml0ZV9iYXNpY19jb25maWclMEElMEF3cml0ZV9iYXNpY19jb25maWcoKQ==",highlighted:`<span class="hljs-keyword">from</span> accelerate.utils <span class="hljs-keyword">import</span> write_basic_config

write_basic_config()`}}),Me=new qe({}),be=new E({props:{code:"ZXhwb3J0JTIwTU9ERUxfTkFNRSUzRCUyMnJ1bndheW1sJTJGc3RhYmxlLWRpZmZ1c2lvbi12MS01JTIyJTBBZXhwb3J0JTIwREFUQVNFVF9JRCUzRCUyMmZ1c2luZyUyRmluc3RydWN0cGl4MnBpeC0xMDAwLXNhbXBsZXMlMjI=",highlighted:`<span class="hljs-built_in">export</span> MODEL_NAME=<span class="hljs-string">&quot;runwayml/stable-diffusion-v1-5&quot;</span>
<span class="hljs-built_in">export</span> DATASET_ID=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wQSUyMCUyMCUyMCUyMC0tc2VlZCUzRDQyJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1wdXNoX3RvX2h1Yg==",highlighted:`accelerate launch --mixed_precision=<span class="hljs-string">&quot;fp16&quot;</span> train_instruct_pix2pix.py \\
    --pretrained_model_name_or_path=<span class="hljs-variable">$MODEL_NAME</span> \\
    --dataset_name=<span class="hljs-variable">$DATASET_ID</span> \\
    --enable_xformers_memory_efficient_attention \\
    --resolution=256 --random_flip \\
    --train_batch_size=4 --gradient_accumulation_steps=4 --gradient_checkpointing \\
    --max_train_steps=15000 \\
    --checkpointing_steps=5000 --checkpoints_total_limit=1 \\
    --learning_rate=5e-05 --max_grad_norm=1 --lr_warmup_steps=0 \\
    --conditioning_dropout_prob=0.05 \\
    --mixed_precision=fp16 \\
    --seed=42 \\
    --push_to_hub`}}),ve=new E({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMC0tbWl4ZWRfcHJlY2lzaW9uJTNEJTIyZnAxNiUyMiUyMHRyYWluX2luc3RydWN0X3BpeDJwaXgucHklMjAlNUMlMEElMjAlMjAlMjAlMjAtLXByZXRyYWluZWRfbW9kZWxfbmFtZV9vcl9wYXRoJTNEJTI0TU9ERUxfTkFNRSUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tZGF0YXNldF9uYW1lJTNEJTI0REFUQVNFVF9JRCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tZW5hYmxlX3hmb3JtZXJzX21lbW9yeV9lZmZpY2llbnRfYXR0ZW50aW9uJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1yZXNvbHV0aW9uJTNEMjU2JTIwLS1yYW5kb21fZmxpcCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tdHJhaW5fYmF0Y2hfc2l6ZSUzRDQlMjAtLWdyYWRpZW50X2FjY3VtdWxhdGlvbl9zdGVwcyUzRDQlMjAtLWdyYWRpZW50X2NoZWNrcG9pbnRpbmclMjAlNUMlMEElMjAlMjAlMjAlMjAtLW1heF90cmFpbl9zdGVwcyUzRDE1MDAwJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1jaGVja3BvaW50aW5nX3N0ZXBzJTNENTAwMCUyMC0tY2hlY2twb2ludHNfdG90YWxfbGltaXQlM0QxJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1sZWFybmluZ19yYXRlJTNENWUtMDUlMjAtLW1heF9ncmFkX25vcm0lM0QxJTIwLS1scl93YXJtdXBfc3RlcHMlM0QwJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1jb25kaXRpb25pbmdfZHJvcG91dF9wcm9iJTNEMC4wNSUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tbWl4ZWRfcHJlY2lzaW9uJTNEZnAxNiUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tdmFsX2ltYWdlX3VybCUzRCUyMmh0dHBzJTNBJTJGJTJGaGYuY28lMkZkYXRhc2V0cyUyRmRpZmZ1c2VycyUyRmRpZmZ1c2Vycy1pbWFnZXMtZG9jcyUyRnJlc29sdmUlMkZtYWluJTJGbW91bnRhaW4ucG5nJTIyJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS12YWxpZGF0aW9uX3Byb21wdCUzRCUyMm1ha2UlMjB0aGUlMjBtb3VudGFpbnMlMjBzbm93eSUyMiUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tc2VlZCUzRDQyJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1yZXBvcnRfdG8lM0R3YW5kYiUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tcHVzaF90b19odWI=",highlighted:`accelerate launch --mixed_precision=<span class="hljs-string">&quot;fp16&quot;</span> train_instruct_pix2pix.py \\
    --pretrained_model_name_or_path=<span class="hljs-variable">$MODEL_NAME</span> \\
    --dataset_name=<span class="hljs-variable">$DATASET_ID</span> \\
    --enable_xformers_memory_efficient_attention \\
    --resolution=256 --random_flip \\
    --train_batch_size=4 --gradient_accumulation_steps=4 --gradient_checkpointing \\
    --max_train_steps=15000 \\
    --checkpointing_steps=5000 --checkpoints_total_limit=1 \\
    --learning_rate=5e-05 --max_grad_norm=1 --lr_warmup_steps=0 \\
    --conditioning_dropout_prob=0.05 \\
    --mixed_precision=fp16 \\
    --val_image_url=<span class="hljs-string">&quot;https://hf.co/datasets/diffusers/diffusers-images-docs/resolve/main/mountain.png&quot;</span> \\
    --validation_prompt=<span class="hljs-string">&quot;make the mountains snowy&quot;</span> \\
    --seed=42 \\
    --report_to=wandb \\
    --push_to_hub`}}),We=new qe({}),Ie=new E({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMC0tbWl4ZWRfcHJlY2lzaW9uJTNEJTIyZnAxNiUyMiUyMC0tbXVsdGlfZ3B1JTIwdHJhaW5faW5zdHJ1Y3RfcGl4MnBpeC5weSUyMCU1QyUwQSUyMC0tcHJldHJhaW5lZF9tb2RlbF9uYW1lX29yX3BhdGglM0RydW53YXltbCUyRnN0YWJsZS1kaWZmdXNpb24tdjEtNSUyMCU1QyUwQSUyMC0tZGF0YXNldF9uYW1lJTNEc2F5YWtwYXVsJTJGaW5zdHJ1Y3RwaXgycGl4LTEwMDAtc2FtcGxlcyUyMCU1QyUwQSUyMC0tdXNlX2VtYSUyMCU1QyUwQSUyMC0tZW5hYmxlX3hmb3JtZXJzX21lbW9yeV9lZmZpY2llbnRfYXR0ZW50aW9uJTIwJTVDJTBBJTIwLS1yZXNvbHV0aW9uJTNENTEyJTIwLS1yYW5kb21fZmxpcCUyMCU1QyUwQSUyMC0tdHJhaW5fYmF0Y2hfc2l6ZSUzRDQlMjAtLWdyYWRpZW50X2FjY3VtdWxhdGlvbl9zdGVwcyUzRDQlMjAtLWdyYWRpZW50X2NoZWNrcG9pbnRpbmclMjAlNUMlMEElMjAtLW1heF90cmFpbl9zdGVwcyUzRDE1MDAwJTIwJTVDJTBBJTIwLS1jaGVja3BvaW50aW5nX3N0ZXBzJTNENTAwMCUyMC0tY2hlY2twb2ludHNfdG90YWxfbGltaXQlM0QxJTIwJTVDJTBBJTIwLS1sZWFybmluZ19yYXRlJTNENWUtMDUlMjAtLWxyX3dhcm11cF9zdGVwcyUzRDAlMjAlNUMlMEElMjAtLWNvbmRpdGlvbmluZ19kcm9wb3V0X3Byb2IlM0QwLjA1JTIwJTVDJTBBJTIwLS1taXhlZF9wcmVjaXNpb24lM0RmcDE2JTIwJTVDJTBBJTIwLS1zZWVkJTNENDIlMjAlNUMlMEElMjAtLXB1c2hfdG9faHVi",highlighted:`accelerate launch --mixed_precision=<span class="hljs-string">&quot;fp16&quot;</span> --multi_gpu train_instruct_pix2pix.py \\
 --pretrained_model_name_or_path=runwayml/stable-diffusion-v1-5 \\
 --dataset_name=sayakpaul/instructpix2pix-1000-samples \\
 --use_ema \\
 --enable_xformers_memory_efficient_attention \\
 --resolution=512 --random_flip \\
 --train_batch_size=4 --gradient_accumulation_steps=4 --gradient_checkpointing \\
 --max_train_steps=15000 \\
 --checkpointing_steps=5000 --checkpoints_total_limit=1 \\
 --learning_rate=5e-05 --lr_warmup_steps=0 \\
 --conditioning_dropout_prob=0.05 \\
 --mixed_precision=fp16 \\
 --seed=42 \\
 --push_to_hub`}}),Ce=new qe({}),Ne=new E({props:{code:"aW1wb3J0JTIwUElMJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjBkaWZmdXNlcnMlMjBpbXBvcnQlMjBTdGFibGVEaWZmdXNpb25JbnN0cnVjdFBpeDJQaXhQaXBlbGluZSUwQSUwQW1vZGVsX2lkJTIwJTNEJTIwJTIyeW91cl9tb2RlbF9pZCUyMiUyMCUyMCUyMyUyMCUzQy0lMjByZXBsYWNlJTIwdGhpcyUwQXBpcGUlMjAlM0QlMjBTdGFibGVEaWZmdXNpb25JbnN0cnVjdFBpeDJQaXhQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQobW9kZWxfaWQlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYpLnRvK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BzJTJDJTBBJTIwJTIwJTIwaW1hZ2VfZ3VpZGFuY2Vfc2NhbGUlM0RpbWFnZV9ndWlkYW5jZV9zY2FsZSUyQyUwQSUyMCUyMCUyMGd1aWRhbmNlX3NjYWxlJTNEZ3VpZGFuY2Vfc2NhbGUlMkMlMEElMjAlMjAlMjBnZW5lcmF0b3IlM0RnZW5lcmF0b3IlMkMlMEEpLmltYWdlcyU1QjAlNUQlMEFlZGl0ZWRfaW1hZ2Uuc2F2ZSglMjJlZGl0ZWRfaW1hZ2UucG5nJTIyKQ==",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;your_model_id&quot;</span>  <span class="hljs-comment"># &lt;- replace this</span>
pipe = StableDiffusionInstructPix2PixPipeline.from_pretrained(model_id, torch_dtype=torch.float16).to(<span class="hljs-string">&quot;cuda&quot;</span>)
generator = torch.Generator(<span class="hljs-string">&quot;cuda&quot;</span>).manual_seed(<span class="hljs-number">0</span>)

url = <span class="hljs-string">&quot;https://huggingface.co/datasets/sayakpaul/sample-datasets/resolve/main/test_pix2pix_4.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;wipe out the lake&quot;</span>
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">10</span>

edited_image = pipe(
   prompt,
   image=image,
   num_inference_steps=num_inference_steps,
   image_guidance_scale=image_guidance_scale,
   guidance_scale=guidance_scale,
   generator=generator,
).images[<span class="hljs-number">0</span>]
edited_image.save(<span class="hljs-string">&quot;edited_image.png&quot;</span>)`}}),{c(){C=a("meta"),At=u(),N=a("h1"),A=a("a"),Oe=a("span"),h(K.$$.fragment),Sl=u(),Ke=a("span"),Gl=s("InstructPix2Pix"),Bt=u(),ee=a("p"),te=a("a"),Fl=s("InstructPix2Pix"),Vl=s(" is a method to fine-tune text-conditioned diffusion models such that they can follow an edit instruction for an input image. Models fine-tuned using this method take the following as inputs:"),Yt=u(),le=a("p"),ae=a("img"),St=u(),ke=a("p"),Ql=s("The output is an \u201Cedited\u201D image that reflects the edit instruction applied on the input image:"),Gt=u(),ie=a("p"),ne=a("img"),Ft=u(),x=a("p"),Dl=s("The "),et=a("code"),Pl=s("train_instruct_pix2pix.py"),zl=s(" script (you can find the it "),se=a("a"),Ll=s("here"),Hl=s(") shows how to implement the training procedure and adapt it for Stable Diffusion."),Vt=u(),Ae=a("p"),tt=a("strong"),J=a("em"),ql=s("Disclaimer: Even though "),lt=a("code"),Ol=s("train_instruct_pix2pix.py"),Kl=s(` implements the InstructPix2Pix
training procedure while being faithful to the `),re=a("a"),ea=s("original implementation"),ta=s(" we have only tested it on a "),oe=a("a"),la=s("small-scale dataset"),aa=s(". This can impact the end results. For better results, we recommend longer training runs with a larger dataset. "),pe=a("a"),ia=s("Here"),na=s(" you can find a large dataset for InstructPix2Pix training."),Qt=u(),j=a("h2"),B=a("a"),at=a("span"),h(ce.$$.fragment),sa=u(),it=a("span"),ra=s("Running locally with PyTorch"),Dt=u(),$=a("h3"),Y=a("a"),nt=a("span"),h(ue.$$.fragment),oa=u(),st=a("span"),pa=s("Installing the dependencies"),Pt=u(),Be=a("p"),ca=s("Before running the scripts, make sure to install the library\u2019s training dependencies:"),zt=u(),Ye=a("p"),rt=a("strong"),ua=s("Important"),Lt=u(),S=a("p"),fa=s("To make sure you can successfully run the latest versions of the example scripts, we highly recommend "),ot=a("strong"),ha=s("installing from source"),da=s(" and keeping the install up to date as we update the example scripts frequently and install some example-specific requirements. To do this, execute the following steps in a new virtual environment:"),Ht=u(),h(fe.$$.fragment),qt=u(),Se=a("p"),ma=s("Then cd in the example folder"),Ot=u(),h(he.$$.fragment),Kt=u(),Ge=a("p"),ya=s("Now run"),el=u(),h(de.$$.fragment),tl=u(),G=a("p"),wa=s("And initialize an "),me=a("a"),_a=s("\u{1F917}Accelerate"),Ma=s(" environment with:"),ll=u(),h(ye.$$.fragment),al=u(),Fe=a("p"),Ja=s("Or for a default accelerate configuration without answering questions about your environment"),il=u(),h(we.$$.fragment),nl=u(),Ve=a("p"),Ta=s("Or if your environment doesn\u2019t support an interactive shell e.g. a notebook"),sl=u(),h(_e.$$.fragment),rl=u(),R=a("h3"),F=a("a"),pt=a("span"),h(Me.$$.fragment),ga=u(),ct=a("span"),ba=s("Toy example"),ol=u(),T=a("p"),Ua=s("As mentioned before, we\u2019ll use a "),Je=a("a"),va=s("small toy dataset"),Ea=s(` for training. The dataset
is a smaller version of the `),Te=a("a"),xa=s("original dataset"),Wa=s(" used in the InstructPix2Pix paper. To use your own dataset, take a look at the "),Qe=a("a"),Za=s("Create a dataset for training"),Ia=s(" guide."),pl=u(),g=a("p"),Ca=s("Specify the "),ut=a("code"),Na=s("MODEL_NAME"),ja=s(" environment variable (either a Hub model repository id or a path to the directory containing the model weights) and pass it to the "),ge=a("a"),ft=a("code"),$a=s("pretrained_model_name_or_path"),Ra=s(" argument. You\u2019ll also need to specify the dataset name in "),ht=a("code"),Xa=s("DATASET_ID"),ka=s(":"),cl=u(),h(be.$$.fragment),ul=u(),M=a("p"),Aa=s("Now, we can launch training. The script saves all the components ("),dt=a("code"),Ba=s("feature_extractor"),Ya=s(", "),mt=a("code"),Sa=s("scheduler"),Ga=s(", "),yt=a("code"),Fa=s("text_encoder"),Va=s(", "),wt=a("code"),Qa=s("unet"),Da=s(", etc) in a subfolder in your repository."),fl=u(),h(Ue.$$.fragment),hl=u(),V=a("p"),Pa=s(`Additionally, we support performing validation inference to monitor training progress
with Weights and Biases. You can enable this feature with `),_t=a("code"),za=s('report_to="wandb"'),La=s(":"),dl=u(),h(ve.$$.fragment),ml=u(),b=a("p"),Ha=s("We recommend this type of validation as it can be useful for model debugging. Note that you need "),Mt=a("code"),qa=s("wandb"),Oa=s(" installed to use this. You can install "),Jt=a("code"),Ka=s("wandb"),ei=s(" by running "),Tt=a("code"),ti=s("pip install wandb"),li=s("."),yl=u(),Ee=a("p"),xe=a("a"),ai=s("Here"),ii=s(", you can find an example training run that includes some validation samples and the training hyperparameters."),wl=u(),De=a("p"),gt=a("strong"),bt=a("em"),ni=s("Note: In the original paper, the authors observed that even when the model is trained with an image resolution of 256x256, it generalizes well to bigger resolutions such as 512x512. This is likely because of the larger dataset they used during training."),_l=u(),X=a("h2"),Q=a("a"),Ut=a("span"),h(We.$$.fragment),si=u(),vt=a("span"),ri=s("Training with multiple GPUs"),Ml=u(),v=a("p"),Et=a("code"),oi=s("accelerate"),pi=s(" allows for seamless multi-GPU training. Follow the instructions "),Ze=a("a"),ci=s("here"),ui=s(`
for running distributed training with `),xt=a("code"),fi=s("accelerate"),hi=s(". Here is an example command:"),Jl=u(),h(Ie.$$.fragment),Tl=u(),k=a("h2"),D=a("a"),Wt=a("span"),h(Ce.$$.fragment),di=u(),Zt=a("span"),mi=s("Inference"),gl=u(),Pe=a("p"),yi=s("Once training is complete, we can perform inference:"),bl=u(),h(Ne.$$.fragment),Ul=u(),P=a("p"),wi=s(`An example model repo obtained using this training script can be found
here - `),je=a("a"),_i=s("sayakpaul/instruct-pix2pix"),Mi=s("."),vl=u(),ze=a("p"),Ji=s(`We encourage you to play with the following three parameters to control
speed and quality during performance:`),El=u(),W=a("ul"),It=a("li"),Ct=a("code"),Ti=s("num_inference_steps"),gi=u(),Nt=a("li"),jt=a("code"),bi=s("image_guidance_scale"),Ui=u(),$t=a("li"),Rt=a("code"),vi=s("guidance_scale"),xl=u(),U=a("p"),Ei=s("Particularly, "),Xt=a("code"),xi=s("image_guidance_scale"),Wi=s(" and "),kt=a("code"),Zi=s("guidance_scale"),Ii=s(` can have a profound impact
on the generated (\u201Cedited\u201D) image (see `),$e=a("a"),Ci=s("here"),Ni=s(" for an example)."),Wl=u(),z=a("p"),ji=s("If you\u2019re looking for some interesting ways to use the InstructPix2Pix training methodology, we welcome you to check out this blog post: "),Re=a("a"),$i=s("Instruction-tuning Stable Diffusion with InstructPix2Pix"),Ri=s("."),this.h()},l(e){const o=fs('[data-svelte="svelte-1phssyn"]',document.head);C=i(o,"META",{name:!0,content:!0}),o.forEach(t),At=f(e),N=i(e,"H1",{class:!0});var Il=n(N);A=i(Il,"A",{id:!0,class:!0,href:!0});var Si=n(A);Oe=i(Si,"SPAN",{});var Gi=n(Oe);d(K.$$.fragment,Gi),Gi.forEach(t),Si.forEach(t),Sl=f(Il),Ke=i(Il,"SPAN",{});var Fi=n(Ke);Gl=r(Fi,"InstructPix2Pix"),Fi.forEach(t),Il.forEach(t),Bt=f(e),ee=i(e,"P",{});var Xi=n(ee);te=i(Xi,"A",{href:!0,rel:!0});var Vi=n(te);Fl=r(Vi,"InstructPix2Pix"),Vi.forEach(t),Vl=r(Xi," is a method to fine-tune text-conditioned diffusion models such that they can follow an edit instruction for an input image. Models fine-tuned using this method take the following as inputs:"),Xi.forEach(t),Yt=f(e),le=i(e,"P",{align:!0});var Qi=n(le);ae=i(Qi,"IMG",{src:!0,alt:!0,width:!0}),Qi.forEach(t),St=f(e),ke=i(e,"P",{});var Di=n(ke);Ql=r(Di,"The output is an \u201Cedited\u201D image that reflects the edit instruction applied on the input image:"),Di.forEach(t),Gt=f(e),ie=i(e,"P",{align:!0});var Pi=n(ie);ne=i(Pi,"IMG",{src:!0,alt:!0,width:!0}),Pi.forEach(t),Ft=f(e),x=i(e,"P",{});var Le=n(x);Dl=r(Le,"The "),et=i(Le,"CODE",{});var zi=n(et);Pl=r(zi,"train_instruct_pix2pix.py"),zi.forEach(t),zl=r(Le," script (you can find the it "),se=i(Le,"A",{href:!0,rel:!0});var Li=n(se);Ll=r(Li,"here"),Li.forEach(t),Hl=r(Le,") shows how to implement the training procedure and adapt it for Stable Diffusion."),Le.forEach(t),Vt=f(e),Ae=i(e,"P",{});var Hi=n(Ae);tt=i(Hi,"STRONG",{});var qi=n(tt);J=i(qi,"EM",{});var Z=n(J);ql=r(Z,"Disclaimer: Even though "),lt=i(Z,"CODE",{});var Oi=n(lt);Ol=r(Oi,"train_instruct_pix2pix.py"),Oi.forEach(t),Kl=r(Z,` implements the InstructPix2Pix
training procedure while being faithful to the `),re=i(Z,"A",{href:!0,rel:!0});var Ki=n(re);ea=r(Ki,"original implementation"),Ki.forEach(t),ta=r(Z," we have only tested it on a "),oe=i(Z,"A",{href:!0,rel:!0});var en=n(oe);la=r(en,"small-scale dataset"),en.forEach(t),aa=r(Z,". This can impact the end results. For better results, we recommend longer training runs with a larger dataset. "),pe=i(Z,"A",{href:!0,rel:!0});var tn=n(pe);ia=r(tn,"Here"),tn.forEach(t),na=r(Z," you can find a large dataset for InstructPix2Pix training."),Z.forEach(t),qi.forEach(t),Hi.forEach(t),Qt=f(e),j=i(e,"H2",{class:!0});var Cl=n(j);B=i(Cl,"A",{id:!0,class:!0,href:!0});var ln=n(B);at=i(ln,"SPAN",{});var an=n(at);d(ce.$$.fragment,an),an.forEach(t),ln.forEach(t),sa=f(Cl),it=i(Cl,"SPAN",{});var nn=n(it);ra=r(nn,"Running locally with PyTorch"),nn.forEach(t),Cl.forEach(t),Dt=f(e),$=i(e,"H3",{class:!0});var Nl=n($);Y=i(Nl,"A",{id:!0,class:!0,href:!0});var sn=n(Y);nt=i(sn,"SPAN",{});var rn=n(nt);d(ue.$$.fragment,rn),rn.forEach(t),sn.forEach(t),oa=f(Nl),st=i(Nl,"SPAN",{});var on=n(st);pa=r(on,"Installing the dependencies"),on.forEach(t),Nl.forEach(t),Pt=f(e),Be=i(e,"P",{});var pn=n(Be);ca=r(pn,"Before running the scripts, make sure to install the library\u2019s training dependencies:"),pn.forEach(t),zt=f(e),Ye=i(e,"P",{});var cn=n(Ye);rt=i(cn,"STRONG",{});var un=n(rt);ua=r(un,"Important"),un.forEach(t),cn.forEach(t),Lt=f(e),S=i(e,"P",{});var jl=n(S);fa=r(jl,"To make sure you can successfully run the latest versions of the example scripts, we highly recommend "),ot=i(jl,"STRONG",{});var fn=n(ot);ha=r(fn,"installing from source"),fn.forEach(t),da=r(jl," and keeping the install up to date as we update the example scripts frequently and install some example-specific requirements. To do this, execute the following steps in a new virtual environment:"),jl.forEach(t),Ht=f(e),d(fe.$$.fragment,e),qt=f(e),Se=i(e,"P",{});var hn=n(Se);ma=r(hn,"Then cd in the example folder"),hn.forEach(t),Ot=f(e),d(he.$$.fragment,e),Kt=f(e),Ge=i(e,"P",{});var dn=n(Ge);ya=r(dn,"Now run"),dn.forEach(t),el=f(e),d(de.$$.fragment,e),tl=f(e),G=i(e,"P",{});var $l=n(G);wa=r($l,"And initialize an "),me=i($l,"A",{href:!0,rel:!0});var mn=n(me);_a=r(mn,"\u{1F917}Accelerate"),mn.forEach(t),Ma=r($l," environment with:"),$l.forEach(t),ll=f(e),d(ye.$$.fragment,e),al=f(e),Fe=i(e,"P",{});var yn=n(Fe);Ja=r(yn,"Or for a default accelerate configuration without answering questions about your environment"),yn.forEach(t),il=f(e),d(we.$$.fragment,e),nl=f(e),Ve=i(e,"P",{});var wn=n(Ve);Ta=r(wn,"Or if your environment doesn\u2019t support an interactive shell e.g. a notebook"),wn.forEach(t),sl=f(e),d(_e.$$.fragment,e),rl=f(e),R=i(e,"H3",{class:!0});var Rl=n(R);F=i(Rl,"A",{id:!0,class:!0,href:!0});var _n=n(F);pt=i(_n,"SPAN",{});var Mn=n(pt);d(Me.$$.fragment,Mn),Mn.forEach(t),_n.forEach(t),ga=f(Rl),ct=i(Rl,"SPAN",{});var Jn=n(ct);ba=r(Jn,"Toy example"),Jn.forEach(t),Rl.forEach(t),ol=f(e),T=i(e,"P",{});var L=n(T);Ua=r(L,"As mentioned before, we\u2019ll use a "),Je=i(L,"A",{href:!0,rel:!0});var Tn=n(Je);va=r(Tn,"small toy dataset"),Tn.forEach(t),Ea=r(L,` for training. The dataset
is a smaller version of the `),Te=i(L,"A",{href:!0,rel:!0});var gn=n(Te);xa=r(gn,"original dataset"),gn.forEach(t),Wa=r(L," used in the InstructPix2Pix paper. To use your own dataset, take a look at the "),Qe=i(L,"A",{href:!0});var bn=n(Qe);Za=r(bn,"Create a dataset for training"),bn.forEach(t),Ia=r(L," guide."),L.forEach(t),pl=f(e),g=i(e,"P",{});var H=n(g);Ca=r(H,"Specify the "),ut=i(H,"CODE",{});var Un=n(ut);Na=r(Un,"MODEL_NAME"),Un.forEach(t),ja=r(H," environment variable (either a Hub model repository id or a path to the directory containing the model weights) and pass it to the "),ge=i(H,"A",{href:!0,rel:!0});var vn=n(ge);ft=i(vn,"CODE",{});var En=n(ft);$a=r(En,"pretrained_model_name_or_path"),En.forEach(t),vn.forEach(t),Ra=r(H," argument. You\u2019ll also need to specify the dataset name in "),ht=i(H,"CODE",{});var xn=n(ht);Xa=r(xn,"DATASET_ID"),xn.forEach(t),ka=r(H,":"),H.forEach(t),cl=f(e),d(be.$$.fragment,e),ul=f(e),M=i(e,"P",{});var I=n(M);Aa=r(I,"Now, we can launch training. The script saves all the components ("),dt=i(I,"CODE",{});var Wn=n(dt);Ba=r(Wn,"feature_extractor"),Wn.forEach(t),Ya=r(I,", "),mt=i(I,"CODE",{});var Zn=n(mt);Sa=r(Zn,"scheduler"),Zn.forEach(t),Ga=r(I,", "),yt=i(I,"CODE",{});var In=n(yt);Fa=r(In,"text_encoder"),In.forEach(t),Va=r(I,", "),wt=i(I,"CODE",{});var Cn=n(wt);Qa=r(Cn,"unet"),Cn.forEach(t),Da=r(I,", etc) in a subfolder in your repository."),I.forEach(t),fl=f(e),d(Ue.$$.fragment,e),hl=f(e),V=i(e,"P",{});var Xl=n(V);Pa=r(Xl,`Additionally, we support performing validation inference to monitor training progress
with Weights and Biases. You can enable this feature with `),_t=i(Xl,"CODE",{});var Nn=n(_t);za=r(Nn,'report_to="wandb"'),Nn.forEach(t),La=r(Xl,":"),Xl.forEach(t),dl=f(e),d(ve.$$.fragment,e),ml=f(e),b=i(e,"P",{});var q=n(b);Ha=r(q,"We recommend this type of validation as it can be useful for model debugging. Note that you need "),Mt=i(q,"CODE",{});var jn=n(Mt);qa=r(jn,"wandb"),jn.forEach(t),Oa=r(q," installed to use this. You can install "),Jt=i(q,"CODE",{});var $n=n(Jt);Ka=r($n,"wandb"),$n.forEach(t),ei=r(q," by running "),Tt=i(q,"CODE",{});var Rn=n(Tt);ti=r(Rn,"pip install wandb"),Rn.forEach(t),li=r(q,"."),q.forEach(t),yl=f(e),Ee=i(e,"P",{});var ki=n(Ee);xe=i(ki,"A",{href:!0,rel:!0});var Xn=n(xe);ai=r(Xn,"Here"),Xn.forEach(t),ii=r(ki,", you can find an example training run that includes some validation samples and the training hyperparameters."),ki.forEach(t),wl=f(e),De=i(e,"P",{});var kn=n(De);gt=i(kn,"STRONG",{});var An=n(gt);bt=i(An,"EM",{});var Bn=n(bt);ni=r(Bn,"Note: In the original paper, the authors observed that even when the model is trained with an image resolution of 256x256, it generalizes well to bigger resolutions such as 512x512. This is likely because of the larger dataset they used during training."),Bn.forEach(t),An.forEach(t),kn.forEach(t),_l=f(e),X=i(e,"H2",{class:!0});var kl=n(X);Q=i(kl,"A",{id:!0,class:!0,href:!0});var Yn=n(Q);Ut=i(Yn,"SPAN",{});var Sn=n(Ut);d(We.$$.fragment,Sn),Sn.forEach(t),Yn.forEach(t),si=f(kl),vt=i(kl,"SPAN",{});var Gn=n(vt);ri=r(Gn,"Training with multiple GPUs"),Gn.forEach(t),kl.forEach(t),Ml=f(e),v=i(e,"P",{});var Xe=n(v);Et=i(Xe,"CODE",{});var Fn=n(Et);oi=r(Fn,"accelerate"),Fn.forEach(t),pi=r(Xe," allows for seamless multi-GPU training. Follow the instructions "),Ze=i(Xe,"A",{href:!0,rel:!0});var Vn=n(Ze);ci=r(Vn,"here"),Vn.forEach(t),ui=r(Xe,`
for running distributed training with `),xt=i(Xe,"CODE",{});var Qn=n(xt);fi=r(Qn,"accelerate"),Qn.forEach(t),hi=r(Xe,". Here is an example command:"),Xe.forEach(t),Jl=f(e),d(Ie.$$.fragment,e),Tl=f(e),k=i(e,"H2",{class:!0});var Al=n(k);D=i(Al,"A",{id:!0,class:!0,href:!0});var Dn=n(D);Wt=i(Dn,"SPAN",{});var Pn=n(Wt);d(Ce.$$.fragment,Pn),Pn.forEach(t),Dn.forEach(t),di=f(Al),Zt=i(Al,"SPAN",{});var zn=n(Zt);mi=r(zn,"Inference"),zn.forEach(t),Al.forEach(t),gl=f(e),Pe=i(e,"P",{});var Ln=n(Pe);yi=r(Ln,"Once training is complete, we can perform inference:"),Ln.forEach(t),bl=f(e),d(Ne.$$.fragment,e),Ul=f(e),P=i(e,"P",{});var Bl=n(P);wi=r(Bl,`An example model repo obtained using this training script can be found
here - `),je=i(Bl,"A",{href:!0,rel:!0});var Hn=n(je);_i=r(Hn,"sayakpaul/instruct-pix2pix"),Hn.forEach(t),Mi=r(Bl,"."),Bl.forEach(t),vl=f(e),ze=i(e,"P",{});var qn=n(ze);Ji=r(qn,`We encourage you to play with the following three parameters to control
speed and quality during performance:`),qn.forEach(t),El=f(e),W=i(e,"UL",{});var He=n(W);It=i(He,"LI",{});var On=n(It);Ct=i(On,"CODE",{});var Kn=n(Ct);Ti=r(Kn,"num_inference_steps"),Kn.forEach(t),On.forEach(t),gi=f(He),Nt=i(He,"LI",{});var es=n(Nt);jt=i(es,"CODE",{});var ts=n(jt);bi=r(ts,"image_guidance_scale"),ts.forEach(t),es.forEach(t),Ui=f(He),$t=i(He,"LI",{});var ls=n($t);Rt=i(ls,"CODE",{});var as=n(Rt);vi=r(as,"guidance_scale"),as.forEach(t),ls.forEach(t),He.forEach(t),xl=f(e),U=i(e,"P",{});var O=n(U);Ei=r(O,"Particularly, "),Xt=i(O,"CODE",{});var is=n(Xt);xi=r(is,"image_guidance_scale"),is.forEach(t),Wi=r(O," and "),kt=i(O,"CODE",{});var ns=n(kt);Zi=r(ns,"guidance_scale"),ns.forEach(t),Ii=r(O,` can have a profound impact
on the generated (\u201Cedited\u201D) image (see `),$e=i(O,"A",{href:!0,rel:!0});var ss=n($e);Ci=r(ss,"here"),ss.forEach(t),Ni=r(O," for an example)."),O.forEach(t),Wl=f(e),z=i(e,"P",{});var Yl=n(z);ji=r(Yl,"If you\u2019re looking for some interesting ways to use the InstructPix2Pix training methodology, we welcome you to check out this blog post: "),Re=i(Yl,"A",{href:!0,rel:!0});var rs=n(Re);$i=r(rs,"Instruction-tuning Stable Diffusion with InstructPix2Pix"),rs.forEach(t),Ri=r(Yl,"."),Yl.forEach(t),this.h()},h(){c(C,"name","hf:doc:metadata"),c(C,"content",JSON.stringify(ys)),c(A,"id","instructpix2pix"),c(A,"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(A,"href","#instructpix2pix"),c(N,"class","relative group"),c(te,"href","https://arxiv.org/abs/2211.09800"),c(te,"rel","nofollow"),os(ae.src,Bi="https://huggingface.co/datasets/diffusers/docs-images/resolve/main/evaluation_diffusion_models/edit-instruction.png")||c(ae,"src",Bi),c(ae,"alt","instructpix2pix-inputs"),c(ae,"width","600"),c(le,"align","center"),os(ne.src,Yi="https://huggingface.co/datasets/diffusers/docs-images/resolve/main/output-gs%407-igs%401-steps%4050.png")||c(ne,"src",Yi),c(ne,"alt","instructpix2pix-output"),c(ne,"width","600"),c(ie,"align","center"),c(se,"href","https://github.com/huggingface/diffusers/blob/main/examples/instruct_pix2pix/train_instruct_pix2pix.py"),c(se,"rel","nofollow"),c(re,"href","https://github.com/timothybrooks/instruct-pix2pix"),c(re,"rel","nofollow"),c(oe,"href","https://huggingface.co/datasets/fusing/instructpix2pix-1000-samples"),c(oe,"rel","nofollow"),c(pe,"href","https://huggingface.co/datasets/timbrooks/instructpix2pix-clip-filtered"),c(pe,"rel","nofollow"),c(B,"id","running-locally-with-pytorch"),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","#running-locally-with-pytorch"),c(j,"class","relative group"),c(Y,"id","installing-the-dependencies"),c(Y,"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(Y,"href","#installing-the-dependencies"),c($,"class","relative group"),c(me,"href","https://github.com/huggingface/accelerate/"),c(me,"rel","nofollow"),c(F,"id","toy-example"),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","#toy-example"),c(R,"class","relative group"),c(Je,"href","https://huggingface.co/datasets/fusing/instructpix2pix-1000-samples"),c(Je,"rel","nofollow"),c(Te,"href","https://huggingface.co/datasets/timbrooks/instructpix2pix-clip-filtered"),c(Te,"rel","nofollow"),c(Qe,"href","create_dataset"),c(ge,"href","https://huggingface.co/docs/diffusers/en/api/diffusion_pipeline#diffusers.DiffusionPipeline.from_pretrained.pretrained_model_name_or_path"),c(ge,"rel","nofollow"),c(xe,"href","https://wandb.ai/sayakpaul/instruct-pix2pix/runs/ctr3kovq"),c(xe,"rel","nofollow"),c(Q,"id","training-with-multiple-gpus"),c(Q,"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(Q,"href","#training-with-multiple-gpus"),c(X,"class","relative group"),c(Ze,"href","https://huggingface.co/docs/accelerate/basic_tutorials/launch"),c(Ze,"rel","nofollow"),c(D,"id","inference"),c(D,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(D,"href","#inference"),c(k,"class","relative group"),c(je,"href","https://huggingface.co/sayakpaul/instruct-pix2pix"),c(je,"rel","nofollow"),c($e,"href","https://twitter.com/RisingSayak/status/1628392199196151808?s=20"),c($e,"rel","nofollow"),c(Re,"href","https://huggingface.co/blog/instruction-tuning-sd"),c(Re,"rel","nofollow")},m(e,o){l(document.head,C),p(e,At,o),p(e,N,o),l(N,A),l(A,Oe),m(K,Oe,null),l(N,Sl),l(N,Ke),l(Ke,Gl),p(e,Bt,o),p(e,ee,o),l(ee,te),l(te,Fl),l(ee,Vl),p(e,Yt,o),p(e,le,o),l(le,ae),p(e,St,o),p(e,ke,o),l(ke,Ql),p(e,Gt,o),p(e,ie,o),l(ie,ne),p(e,Ft,o),p(e,x,o),l(x,Dl),l(x,et),l(et,Pl),l(x,zl),l(x,se),l(se,Ll),l(x,Hl),p(e,Vt,o),p(e,Ae,o),l(Ae,tt),l(tt,J),l(J,ql),l(J,lt),l(lt,Ol),l(J,Kl),l(J,re),l(re,ea),l(J,ta),l(J,oe),l(oe,la),l(J,aa),l(J,pe),l(pe,ia),l(J,na),p(e,Qt,o),p(e,j,o),l(j,B),l(B,at),m(ce,at,null),l(j,sa),l(j,it),l(it,ra),p(e,Dt,o),p(e,$,o),l($,Y),l(Y,nt),m(ue,nt,null),l($,oa),l($,st),l(st,pa),p(e,Pt,o),p(e,Be,o),l(Be,ca),p(e,zt,o),p(e,Ye,o),l(Ye,rt),l(rt,ua),p(e,Lt,o),p(e,S,o),l(S,fa),l(S,ot),l(ot,ha),l(S,da),p(e,Ht,o),m(fe,e,o),p(e,qt,o),p(e,Se,o),l(Se,ma),p(e,Ot,o),m(he,e,o),p(e,Kt,o),p(e,Ge,o),l(Ge,ya),p(e,el,o),m(de,e,o),p(e,tl,o),p(e,G,o),l(G,wa),l(G,me),l(me,_a),l(G,Ma),p(e,ll,o),m(ye,e,o),p(e,al,o),p(e,Fe,o),l(Fe,Ja),p(e,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wi),l(P,je),l(je,_i),l(P,Mi),p(e,vl,o),p(e,ze,o),l(ze,Ji),p(e,El,o),p(e,W,o),l(W,It),l(It,Ct),l(Ct,Ti),l(W,gi),l(W,Nt),l(Nt,jt),l(jt,bi),l(W,Ui),l(W,$t),l($t,Rt),l(Rt,vi),p(e,xl,o),p(e,U,o),l(U,Ei),l(U,Xt),l(Xt,xi),l(U,Wi),l(U,kt),l(kt,Zi),l(U,Ii),l(U,$e),l($e,Ci),l(U,Ni),p(e,Wl,o),p(e,z,o),l(z,ji),l(z,Re),l(Re,$i),l(z,Ri),Zl=!0},p:hs,i(e){Zl||(y(K.$$.fragment,e),y(ce.$$.fragment,e),y(ue.$$.fragment,e),y(fe.$$.fragment,e),y(he.$$.fragment,e),y(de.$$.fragment,e),y(ye.$$.fragment,e),y(we.$$.fragment,e),y(_e.$$.fragment,e),y(Me.$$.fragment,e),y(be.$$.fragment,e),y(Ue.$$.fragment,e),y(ve.$$.fragment,e),y(We.$$.fragment,e),y(Ie.$$.fragment,e),y(Ce.$$.fragment,e),y(Ne.$$.fragment,e),Zl=!0)},o(e){w(K.$$.fragment,e),w(ce.$$.fragment,e),w(ue.$$.fragment,e),w(fe.$$.fragment,e),w(he.$$.fragment,e),w(de.$$.fragment,e),w(ye.$$.fragment,e),w(we.$$.fragment,e),w(_e.$$.fragment,e),w(Me.$$.fragment,e),w(be.$$.fragment,e),w(Ue.$$.fragment,e),w(ve.$$.fragment,e),w(We.$$.fragment,e),w(Ie.$$.fragment,e),w(Ce.$$.fragment,e),w(Ne.$$.fragment,e),Zl=!1},d(e){t(C),e&&t(At),e&&t(N),_(K),e&&t(Bt),e&&t(ee),e&&t(Yt),e&&t(le),e&&t(St),e&&t(ke),e&&t(Gt),e&&t(ie),e&&t(Ft),e&&t(x),e&&t(Vt),e&&t(Ae),e&&t(Qt),e&&t(j),_(ce),e&&t(Dt),e&&t($),_(ue),e&&t(Pt),e&&t(Be),e&&t(zt),e&&t(Ye),e&&t(Lt),e&&t(S),e&&t(Ht),_(fe,e),e&&t(qt),e&&t(Se),e&&t(Ot),_(he,e),e&&t(Kt),e&&t(Ge),e&&t(el),_(de,e),e&&t(tl),e&&t(G),e&&t(ll),_(ye,e),e&&t(al),e&&t(Fe),e&&t(il),_(we,e),e&&t(nl),e&&t(Ve),e&&t(sl),_(_e,e),e&&t(rl),e&&t(R),_(Me),e&&t(ol),e&&t(T),e&&t(pl),e&&t(g),e&&t(cl),_(be,e),e&&t(ul),e&&t(M),e&&t(fl),_(Ue,e),e&&t(hl),e&&t(V),e&&t(dl),_(ve,e),e&&t(ml),e&&t(b),e&&t(yl),e&&t(Ee),e&&t(wl),e&&t(De),e&&t(_l),e&&t(X),_(We),e&&t(Ml),e&&t(v),e&&t(Jl),_(Ie,e),e&&t(Tl),e&&t(k),_(Ce),e&&t(gl),e&&t(Pe),e&&t(bl),_(Ne,e),e&&t(Ul),e&&t(P),e&&t(vl),e&&t(ze),e&&t(El),e&&t(W),e&&t(xl),e&&t(U),e&&t(Wl),e&&t(z)}}}const ys={local:"instructpix2pix",sections:[{local:"running-locally-with-pytorch",sections:[{local:"installing-the-dependencies",title:"Installing the dependencies"},{local:"toy-example",title:"Toy example"}],title:"Running locally with PyTorch"}],title:"InstructPix2Pix "};function ws(Ai){return ds(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ts extends ps{constructor(C){super();cs(this,C,ws,ms,us,{})}}export{Ts as default,ys as metadata};
