import{S as As,i as ks,s as Ss,e as a,k as f,w as h,t as s,M as Bs,c as i,d as t,m as u,a as n,x as d,h as r,b as c,N as Xs,G as l,g as p,y as m,L as Ys,q as y,o as w,B as _,v as Gs}from"../../chunks/vendor-hf-doc-builder.js";import{I as De}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{C as x}from"../../chunks/CodeBlock-hf-doc-builder.js";function Fs(rn){let C,Lt,j,B,nt,ae,ea,st,ta,zt,ie,ne,la,aa,Ht,se,re,on,qt,Ve,ia,Ot,oe,pe,pn,Kt,W,na,rt,sa,ra,ce,oa,pa,el,Pe,ot,J,ca,pt,fa,ua,fe,ha,da,ue,ma,ya,he,wa,_a,tl,$,Y,ct,de,Ma,ft,Ja,ll,R,G,ut,me,ga,ht,ba,al,Qe,Ta,il,Le,dt,va,nl,F,Ua,mt,Ea,xa,sl,ye,rl,ze,Wa,ol,we,pl,He,Za,cl,_e,fl,D,Ia,Me,Na,Ca,ul,Je,hl,qe,ja,dl,ge,ml,Oe,$a,yl,be,wl,X,V,yt,Te,Ra,wt,Xa,_l,g,Aa,ve,ka,Sa,Ue,Ba,Ya,Ke,Ga,Fa,Ml,b,Da,_t,Va,Pa,Ee,Mt,Qa,La,Jt,za,Ha,Jl,xe,gl,M,qa,gt,Oa,Ka,bt,ei,ti,Tt,li,ai,vt,ii,ni,bl,We,Tl,P,si,Ut,ri,oi,vl,Ze,Ul,T,pi,Et,ci,fi,xt,ui,hi,Wt,di,mi,El,Ie,Ne,yi,wi,xl,et,Zt,It,_i,Wl,A,Q,Nt,Ce,Mi,Ct,Ji,Zl,E,jt,gi,bi,je,Ti,vi,$t,Ui,Ei,Il,$e,Nl,k,L,Rt,Re,xi,Xt,Wi,Cl,tt,Zi,jl,Xe,$l,z,Ii,Ae,Ni,Ci,Rl,lt,ji,Xl,Z,At,kt,$i,Ri,St,Bt,Xi,Ai,Yt,Gt,ki,Al,v,Si,Ft,Bi,Yi,Dt,Gi,Fi,ke,Di,Vi,kl,H,Pi,Se,Qi,Li,Sl,S,q,Vt,Be,zi,Pt,Hi,Bl,U,qi,Ye,Oi,Ki,Qt,en,tn,Ge,ln,an,Yl;return ae=new De({}),de=new De({}),me=new De({}),ye=new x({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 .`}}),we=new x({props:{code:"Y2QlMjBleGFtcGxlcyUyRmluc3RydWN0X3BpeDJwaXg=",highlighted:'<span class="hljs-built_in">cd</span> examples/instruct_pix2pix'}}),_e=new x({props:{code:"cGlwJTIwaW5zdGFsbCUyMC1yJTIwcmVxdWlyZW1lbnRzLnR4dA==",highlighted:"pip install -r requirements.txt"}}),Je=new x({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZw==",highlighted:"accelerate config"}}),ge=new x({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZyUyMGRlZmF1bHQ=",highlighted:"accelerate config default"}}),be=new x({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUudXRpbHMlMjBpbXBvcnQlMjB3cml0ZV9iYXNpY19jb25maWclMEElMEF3cml0ZV9iYXNpY19jb25maWcoKQ==",highlighted:`<span class="hljs-keyword">from</span> accelerate.utils <span class="hljs-keyword">import</span> write_basic_config

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