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horse on mars").images[0]`,highlighted:`from diffusers import StableDiffusionPipeline
import tomesd

pipeline = StableDiffusionPipeline.from_pretrained(
      &quot;runwayml/stable-diffusion-v1-5&quot;, torch_dtype=torch.float16
).to(&quot;cuda&quot;)
<span class="hljs-addition">+ tomesd.apply_patch(pipeline, ratio=0.5)</span>

image = pipeline(&quot;a photo of an astronaut riding a horse on mars&quot;).images[0]`}}),De=new er({}),be=new FE({props:{code:`- \`diffusers\` version: 0.15.1
- Python version: 3.8.16
- PyTorch version (GPU?): 1.13.1+cu116 (True)
- Huggingface_hub version: 0.13.2
- Transformers version: 4.27.2
- Accelerate version: 0.18.0
- xFormers version: 0.0.16
- tomesd version: 0.1.2`,highlighted:`- \`diffusers\` version: 0.15.1
- Python version: 3.8.16
- PyTorch version (GPU?): 1.13.1+cu116 (True)
- Huggingface_hub version: 0.13.2
- Transformers version: 4.27.2
- Accelerate version: 0.18.0
- xFormers version: 0.0.16
- tomesd version: 0.1.2`}}),Oe=new er({}),Me=new er({}),Pe=new er({}),{c(){Ct=r("meta"),ia=a(),Nt=r("h1"),Gt=r("a"),rr=r("span"),oe(ne.$$.fragment),ws=a(),lr=r("span"),Ms=s("Token Merging"),na=a(),zt=r("p"),ys=s("Token Merging (introduced in "),he=r("a"),Ps=s("Token Merging: Your ViT But Faster"),ks=s(") works by merging the redundant tokens / patches progressively in the forward pass of a Transformer-based network. It can speed up the inference latency of the underlying network."),ha=a(),K=r("p"),$s=s("After Token Merging (ToMe) was released, the authors released "),ce=r("a"),As=s("Token Merging for Fast Stable Diffusion"),Ss=s(", which introduced a version of ToMe which is more compatible with Stable Diffusion. We can use ToMe to gracefully speed up the inference latency of a "),xe=r("a"),xs=s("DiffusionPipeline"),Rs=s(". This doc discusses how to apply ToMe to the "),Re=r("a"),Hs=s("StableDiffusionPipeline"),qs=s(", the expected speedups, and the qualitative aspects of using ToMe on the "),He=r("a"),Fs=s("StableDiffusionPipeline"),Bs=s("."),ca=a(),Vt=r("h2"),Yt=r("a"),or=r("span"),oe(pe.$$.fragment),Cs=a(),ar=r("span"),Ns=s("Using ToMe"),pa=a(),St=r("p"),Vs=s("The authors of ToMe released a convenient Python library called "),ve=r("a"),dr=r("code"),Is=s("tomesd"),Ws=s(" that lets us apply ToMe to a "),qe=r("a"),Ls=s("DiffusionPipeline"),Us=s(" like so:"),va=a(),oe(ue.$$.fragment),ua=a(),Fe=r("p"),Gs=s("And that\u2019s it!"),Ea=a(),T=r("p"),sr=r("code"),zs=s("tomesd.apply_patch()"),Ys=s(" exposes "),Ee=r("a"),js=s("a number of arguments"),Qs=s(" to let us strike a balance between the pipeline inference speed and the quality of the generated tokens. Amongst those arguments, the most important one is "),fr=r("code"),Js=s("ratio"),Ks=s(". "),ir=r("code"),Xs=s("ratio"),Zs=s(" controls the number of tokens that will be merged during the forward pass. For more details on "),nr=r("code"),tf=s("tomesd"),ef=s(", please refer to the original repository "),Te=r("a"),rf=s("https://github.com/dbolya/tomesd"),lf=s(" and "),_e=r("a"),of=s("the paper"),af=s("."),Ta=a(),It=r("h2"),jt=r("a"),hr=r("span"),oe(De.$$.fragment),df=a(),Qt=r("span"),sf=s("Benchmarking "),cr=r("code"),ff=s("tomesd"),nf=s(" with "),pr=r("code"),hf=s("StableDiffusionPipeline"),_a=a(),At=r("p"),cf=s("We benchmarked the impact of using "),vr=r("code"),pf=s("tomesd"),vf=s(" on "),Be=r("a"),uf=s("StableDiffusionPipeline"),Ef=s(" along with "),me=r("a"),Tf=s("xformers"),_f=s(" across different image resolutions. We used A100 and V100 as our test GPU devices with the following development environment (with Python 3.8.5):"),Da=a(),oe(be.$$.fragment),ma=a(),Jt=r("p"),Df=s("We used this script for benchmarking: "),ge=r("a"),mf=s("https://gist.github.com/sayakpaul/27aec6bca7eb7b0e0aa4112205850335"),bf=s(". Following are our findings:"),ba=a(),Wt=r("h3"),Kt=r("a"),ur=r("span"),oe(Oe.$$.fragment),gf=a(),Er=r("span"),Of=s("A100"),ga=a(),Xt=r("table"),Tr=r("thead"),_=r("tr"),_r=r("th"),wf=s("Resolution"),Mf=a(),Dr=r("th"),yf=s("Batch size"),Pf=a(),mr=r("th"),kf=s("Vanilla"),$f=a(),br=r("th"),Af=s("ToMe"),Sf=a(),gr=r("th"),xf=s("ToMe + xFormers"),Rf=a(),Or=r("th"),Hf=s("ToMe speedup (%)"),qf=a(),wr=r("th"),Ff=s("ToMe + xFormers speedup (%)"),Bf=a(),u=r("tbody"),D=r("tr"),Mr=r("td"),Cf=s("512"),Nf=a(),yr=r("td"),Vf=s("10"),If=a(),Pr=r("td"),Wf=s("6.88"),Lf=a(),kr=r("td"),Uf=s("5.26"),Gf=a(),$r=r("td"),zf=s("4.69"),Yf=a(),Ar=r("td"),jf=s("23.54651163"),Qf=a(),Sr=r("td"),Jf=s("31.83139535"),Kf=a(),m=r("tr"),Oa=r("td"),Xf=a(),wa=r("td"),Zf=a(),Ma=r("td"),ti=a(),ya=r("td"),ei=a(),Pa=r("td"),ri=a(),ka=r("td"),li=a(),$a=r("td"),oi=a(),b=r("tr"),xr=r("td"),ai=s("768"),di=a(),Rr=r("td"),si=s("10"),fi=a(),Hr=r("td"),ii=s("OOM"),ni=a(),qr=r("td"),hi=s("14.71"),ci=a(),Fr=r("td"),pi=s("11"),vi=a(),Aa=r("td"),ui=a(),Sa=r("td"),Ei=a(),g=r("tr"),xa=r("td"),Ti=a(),Br=r("td"),_i=s("8"),Di=a(),Cr=r("td"),mi=s("OOM"),bi=a(),Nr=r("td"),gi=s("11.56"),Oi=a(),Vr=r("td"),wi=s("8.84"),Mi=a(),Ra=r("td"),yi=a(),Ha=r("td"),Pi=a(),O=r("tr"),qa=r("td"),ki=a(),Ir=r("td"),$i=s("4"),Ai=a(),Wr=r("td"),Si=s("OOM"),xi=a(),Lr=r("td"),Ri=s("5.98"),Hi=a(),Ur=r("td"),qi=s("4.66"),Fi=a(),Fa=r("td"),Bi=a(),Ba=r("td"),Ci=a(),w=r("tr"),Ca=r("td"),Ni=a(),Gr=r("td"),Vi=s("2"),Ii=a(),zr=r("td"),Wi=s("4.99"),Li=a(),Yr=r("td"),Ui=s("3.24"),Gi=a(),jr=r("td"),zi=s("3.1"),Yi=a(),Qr=r("td"),ji=s("35.07014028"),Qi=a(),Jr=r("td"),Ji=s("37.8757515"),Ki=a(),M=r("tr"),Na=r("td"),Xi=a(),Kr=r("td"),Zi=s("1"),tn=a(),Xr=r("td"),en=s("3.29"),rn=a(),Zr=r("td"),ln=s("2.24"),on=a(),tl=r("td"),an=s("2.03"),dn=a(),el=r("td"),sn=s("31.91489362"),fn=a(),rl=r("td"),nn=s("38.29787234"),hn=a(),y=r("tr"),Va=r("td"),cn=a(),Ia=r("td"),pn=a(),Wa=r("td"),vn=a(),La=r("td"),un=a(),Ua=r("td"),En=a(),Ga=r("td"),Tn=a(),za=r("td"),_n=a(),P=r("tr"),ll=r("td"),Dn=s("1024"),mn=a(),ol=r("td"),bn=s("10"),gn=a(),al=r("td"),On=s("OOM"),wn=a(),dl=r("td"),Mn=s("OOM"),yn=a(),sl=r("td"),Pn=s("OOM"),kn=a(),Ya=r("td"),$n=a(),ja=r("td"),An=a(),k=r("tr"),Qa=r("td"),Sn=a(),fl=r("td"),xn=s("8"),Rn=a(),il=r("td"),Hn=s("OOM"),qn=a(),nl=r("td"),Fn=s("OOM"),Bn=a(),hl=r("td"),Cn=s("OOM"),Nn=a(),Ja=r("td"),Vn=a(),Ka=r("td"),In=a(),$=r("tr"),Xa=r("td"),Wn=a(),cl=r("td"),Ln=s("4"),Un=a(),pl=r("td"),Gn=s("OOM"),zn=a(),vl=r("td"),Yn=s("12.51"),jn=a(),ul=r("td"),Qn=s("9.09"),Jn=a(),Za=r("td"),Kn=a(),td=r("td"),Xn=a(),A=r("tr"),ed=r("td"),Zn=a(),El=r("td"),t1=s("2"),e1=a(),Tl=r("td"),r1=s("OOM"),l1=a(),_l=r("td"),o1=s("6.52"),a1=a(),Dl=r("td"),d1=s("4.96"),s1=a(),rd=r("td"),f1=a(),ld=r("td"),i1=a(),S=r("tr"),od=r("td"),n1=a(),ml=r("td"),h1=s("1"),c1=a(),bl=r("td"),p1=s("6.4"),v1=a(),gl=r("td"),u1=s("3.61"),E1=a(),Ol=r("td"),T1=s("2.81"),_1=a(),wl=r("td"),D1=s("43.59375"),m1=a(),Ml=r("td"),b1=s("56.09375"),ad=a(),Ce=r("p"),yl=r("strong"),we=r("em"),g1=s("The timings reported here are in seconds. Speedups are calculated over the "),Pl=r("code"),O1=s("Vanilla"),w1=s(" timings."),dd=a(),Lt=r("h3"),Zt=r("a"),kl=r("span"),oe(Me.$$.fragment),M1=a(),$l=r("span"),y1=s("V100"),sd=a(),te=r("table"),Al=r("thead"),x=r("tr"),Sl=r("th"),P1=s("Resolution"),k1=a(),xl=r("th"),$1=s("Batch size"),A1=a(),Rl=r("th"),S1=s("Vanilla"),x1=a(),Hl=r("th"),R1=s("ToMe"),H1=a(),ql=r("th"),q1=s("ToMe + xFormers"),F1=a(),Fl=r("th"),B1=s("ToMe speedup (%)"),C1=a(),Bl=r("th"),N1=s("ToMe + xFormers speedup (%)"),V1=a(),p=r("tbody"),R=r("tr"),Cl=r("td"),I1=s("512"),W1=a(),Nl=r("td"),L1=s("10"),U1=a(),Vl=r("td"),G1=s("OOM"),z1=a(),Il=r("td"),Y1=s("10.03"),j1=a(),Wl=r("td"),Q1=s("9.29"),J1=a(),fd=r("td"),K1=a(),id=r("td"),X1=a(),H=r("tr"),nd=r("td"),Z1=a(),Ll=r("td"),th=s("8"),eh=a(),Ul=r("td"),rh=s("OOM"),lh=a(),Gl=r("td"),oh=s("8.05"),ah=a(),zl=r("td"),dh=s("7.47"),sh=a(),hd=r("td"),fh=a(),cd=r("td"),ih=a(),q=r("tr"),pd=r("td"),nh=a(),Yl=r("td"),hh=s("4"),ch=a(),jl=r("td"),ph=s("5.7"),vh=a(),Ql=r("td"),uh=s("4.3"),Eh=a(),Jl=r("td"),Th=s("3.98"),_h=a(),Kl=r("td"),Dh=s("24.56140351"),mh=a(),Xl=r("td"),bh=s("30.1754386"),gh=a(),F=r("tr"),vd=r("td"),Oh=a(),Zl=r("td"),wh=s("2"),Mh=a(),to=r("td"),yh=s("3.14"),Ph=a(),eo=r("td"),kh=s("2.43"),$h=a(),ro=r("td"),Ah=s("2.27"),Sh=a(),lo=r("td"),xh=s("22.61146497"),Rh=a(),oo=r("td"),Hh=s("27.70700637"),qh=a(),B=r("tr"),ud=r("td"),Fh=a(),ao=r("td"),Bh=s("1"),Ch=a(),so=r("td"),Nh=s("1.88"),Vh=a(),fo=r("td"),Ih=s("1.57"),Wh=a(),io=r("td"),Lh=s("1.57"),Uh=a(),no=r("td"),Gh=s("16.4893617"),zh=a(),ho=r("td"),Yh=s("16.4893617"),jh=a(),C=r("tr"),Ed=r("td"),Qh=a(),Td=r("td"),Jh=a(),_d=r("td"),Kh=a(),Dd=r("td"),Xh=a(),md=r("td"),Zh=a(),bd=r("td"),tc=a(),gd=r("td"),ec=a(),N=r("tr"),co=r("td"),rc=s("768"),lc=a(),po=r("td"),oc=s("10"),ac=a(),vo=r("td"),dc=s("OOM"),sc=a(),uo=r("td"),fc=s("OOM"),ic=a(),Eo=r("td"),nc=s("23.67"),hc=a(),Od=r("td"),cc=a(),wd=r("td"),pc=a(),V=r("tr"),Md=r("td"),vc=a(),To=r("td"),uc=s("8"),Ec=a(),_o=r("td"),Tc=s("OOM"),_c=a(),Do=r("td"),Dc=s("OOM"),mc=a(),mo=r("td"),bc=s("18.81"),gc=a(),yd=r("td"),Oc=a(),Pd=r("td"),wc=a(),I=r("tr"),kd=r("td"),Mc=a(),bo=r("td"),yc=s("4"),Pc=a(),go=r("td"),kc=s("OOM"),$c=a(),Oo=r("td"),Ac=s("11.81"),Sc=a(),wo=r("td"),xc=s("9.7"),Rc=a(),$d=r("td"),Hc=a(),Ad=r("td"),qc=a(),W=r("tr"),Sd=r("td"),Fc=a(),Mo=r("td"),Bc=s("2"),Cc=a(),yo=r("td"),Nc=s("OOM"),Vc=a(),Po=r("td"),Ic=s("6.27"),Wc=a(),ko=r("td"),Lc=s("5.2"),Uc=a(),xd=r("td"),Gc=a(),Rd=r("td"),zc=a(),L=r("tr"),Hd=r("td"),Yc=a(),$o=r("td"),jc=s("1"),Qc=a(),Ao=r("td"),Jc=s("5.43"),Kc=a(),So=r("td"),Xc=s("3.38"),Zc=a(),xo=r("td"),t2=s("2.82"),e2=a(),Ro=r("td"),r2=s("37.75322284"),l2=a(),Ho=r("td"),o2=s("48.06629834"),a2=a(),U=r("tr"),qd=r("td"),d2=a(),Fd=r("td"),s2=a(),Bd=r("td"),f2=a(),Cd=r("td"),i2=a(),Nd=r("td"),n2=a(),Vd=r("td"),h2=a(),Id=r("td"),c2=a(),G=r("tr"),qo=r("td"),p2=s("1024"),v2=a(),Fo=r("td"),u2=s("10"),E2=a(),Bo=r("td"),T2=s("OOM"),_2=a(),Co=r("td"),D2=s("OOM"),m2=a(),No=r("td"),b2=s("OOM"),g2=a(),Wd=r("td"),O2=a(),Ld=r("td"),w2=a(),z=r("tr"),Ud=r("td"),M2=a(),Vo=r("td"),y2=s("8"),P2=a(),Io=r("td"),k2=s("OOM"),$2=a(),Wo=r("td"),A2=s("OOM"),S2=a(),Lo=r("td"),x2=s("OOM"),R2=a(),Gd=r("td"),H2=a(),zd=r("td"),q2=a(),Y=r("tr"),Yd=r("td"),F2=a(),Uo=r("td"),B2=s("4"),C2=a(),Go=r("td"),N2=s("OOM"),V2=a(),zo=r("td"),I2=s("OOM"),W2=a(),Yo=r("td"),L2=s("19.35"),U2=a(),jd=r("td"),G2=a(),Qd=r("td"),z2=a(),j=r("tr"),Jd=r("td"),Y2=a(),jo=r("td"),j2=s("2"),Q2=a(),Qo=r("td"),J2=s("OOM"),K2=a(),Jo=r("td"),X2=s("13"),Z2=a(),Ko=r("td"),tp=s("10.78"),ep=a(),Kd=r("td"),rp=a(),Xd=r("td"),lp=a(),Q=r("tr"),Zd=r("td"),op=a(),Xo=r("td"),ap=s("1"),dp=a(),Zo=r("td"),sp=s("OOM"),fp=a(),ta=r("td"),ip=s("6.66"),np=a(),ea=r("td"),hp=s("5.54"),cp=a(),ts=r("td"),pp=a(),es=r("td"),rs=a(),xt=r("p"),vp=s("As seen in the tables above, the speedup with "),ra=r("code"),up=s("tomesd"),Ep=s(" becomes more pronounced for larger image resolutions. It is also interesting to note that with "),la=r("code"),Tp=s("tomesd"),_p=s(", it becomes possible to run the pipeline on a higher resolution, like 1024x1024."),ls=a(),ee=r("p"),Dp=s("It might be possible to speed up inference even further with "),ye=r("a"),oa=r("code"),mp=s("torch.compile()"),bp=s("."),os=a(),Ut=r("h2"),re=r("a"),aa=r("span"),oe(Pe.$$.fragment),gp=a(),da=r("span"),Op=s("Quality"),as=a(),Rt=r("p"),wp=s("As reported in "),ke=r("a"),Mp=s("the paper"),yp=s(", ToMe can preserve the quality of the generated images to a great extent while speeding up inference. By increasing the "),sa=r("code"),Pp=s("ratio"),kp=s(", it is possible to further speed up inference, but that might come at the cost of a deterioration in the image quality."),ds=a(),Ht=r("p"),$p=s("To test the quality of the generated samples using our setup, we sampled a few prompts from the \u201CParti Prompts\u201D (introduced in "),$e=r("a"),Ap=s("Parti"),Sp=s(") and performed inference with the "),Ne=r("a"),xp=s("StableDiffusionPipeline"),Rp=s(" in the following settings:"),ss=a(),qt=r("ul"),Ve=r("li"),Hp=s("Vanilla "),Ie=r("a"),qp=s("StableDiffusionPipeline"),Fp=a(),We=r("li"),Le=r("a"),Bp=s("StableDiffusionPipeline"),Cp=s(" + ToMe"),Np=a(),Ue=r("li"),Ge=r("a"),Vp=s("StableDiffusionPipeline"),Ip=s(" + ToMe + xformers"),fs=a(),ze=r("p"),Wp=s("We didn\u2019t notice any significant decrease in the quality of the generated samples. Here are samples:"),is=a(),Ye=r("p"),je=r("img"),ns=a(),Ft=r("p"),Lp=s("You can check out the generated samples "),Ae=r("a"),Up=s("here"),Gp=s(". We used "),Se=r("a"),zp=s("this script"),Yp=s(" for conducting this experiment."),this.h()},l(i){const h=VE('[data-svelte="svelte-1phssyn"]',document.head);Ct=l(h,"META",{name:!0,content:!0}),h.forEach(e),ia=d(i),Nt=l(i,"H1",{class:!0});var cs=o(Nt);Gt=l(cs,"A",{id:!0,class:!0,href:!0});var Zp=o(Gt);rr=l(Zp,"SPAN",{});var t3=o(rr);ae(ne.$$.fragment,t3),t3.forEach(e),Zp.forEach(e),ws=d(cs),lr=l(cs,"SPAN",{});var e3=o(lr);Ms=f(e3,"Token Merging"),e3.forEach(e),cs.forEach(e),na=d(i),zt=l(i,"P",{});var ps=o(zt);ys=f(ps,"Token Merging (introduced in "),he=l(ps,"A",{href:!0,rel:!0});var r3=o(he);Ps=f(r3,"Token Merging: Your ViT But Faster"),r3.forEach(e),ks=f(ps,") works by merging the redundant tokens / patches progressively in the forward pass of a Transformer-based network. It can speed up the inference latency of the underlying network."),ps.forEach(e),ha=d(i),K=l(i,"P",{});var Bt=o(K);$s=f(Bt,"After Token Merging (ToMe) was released, the authors released "),ce=l(Bt,"A",{href:!0,rel:!0});var l3=o(ce);As=f(l3,"Token Merging for Fast Stable Diffusion"),l3.forEach(e),Ss=f(Bt,", which introduced a version of ToMe which is more compatible with Stable Diffusion. We can use ToMe to gracefully speed up the inference latency of a "),xe=l(Bt,"A",{href:!0});var o3=o(xe);xs=f(o3,"DiffusionPipeline"),o3.forEach(e),Rs=f(Bt,". This doc discusses how to apply ToMe to the "),Re=l(Bt,"A",{href:!0});var a3=o(Re);Hs=f(a3,"StableDiffusionPipeline"),a3.forEach(e),qs=f(Bt,", the expected speedups, and the qualitative aspects of using ToMe on the "),He=l(Bt,"A",{href:!0});var d3=o(He);Fs=f(d3,"StableDiffusionPipeline"),d3.forEach(e),Bs=f(Bt,"."),Bt.forEach(e),ca=d(i),Vt=l(i,"H2",{class:!0});var vs=o(Vt);Yt=l(vs,"A",{id:!0,class:!0,href:!0});var s3=o(Yt);or=l(s3,"SPAN",{});var f3=o(or);ae(pe.$$.fragment,f3),f3.forEach(e),s3.forEach(e),Cs=d(vs),ar=l(vs,"SPAN",{});var i3=o(ar);Ns=f(i3,"Using ToMe"),i3.forEach(e),vs.forEach(e),pa=d(i),St=l(i,"P",{});var Qe=o(St);Vs=f(Qe,"The authors of ToMe released a convenient Python library called "),ve=l(Qe,"A",{href:!0,rel:!0});var n3=o(ve);dr=l(n3,"CODE",{});var h3=o(dr);Is=f(h3,"tomesd"),h3.forEach(e),n3.forEach(e),Ws=f(Qe," that lets us apply ToMe to a "),qe=l(Qe,"A",{href:!0});var c3=o(qe);Ls=f(c3,"DiffusionPipeline"),c3.forEach(e),Us=f(Qe," like so:"),Qe.forEach(e),va=d(i),ae(ue.$$.fragment,i),ua=d(i),Fe=l(i,"P",{});var p3=o(Fe);Gs=f(p3,"And that\u2019s it!"),p3.forEach(e),Ea=d(i),T=l(i,"P",{});var J=o(T);sr=l(J,"CODE",{});var v3=o(sr);zs=f(v3,"tomesd.apply_patch()"),v3.forEach(e),Ys=f(J," exposes "),Ee=l(J,"A",{href:!0,rel:!0});var u3=o(Ee);js=f(u3,"a number of arguments"),u3.forEach(e),Qs=f(J," to let us strike a balance between the pipeline inference speed and the quality of the generated tokens. Amongst those arguments, the most important one is "),fr=l(J,"CODE",{});var E3=o(fr);Js=f(E3,"ratio"),E3.forEach(e),Ks=f(J,". "),ir=l(J,"CODE",{});var T3=o(ir);Xs=f(T3,"ratio"),T3.forEach(e),Zs=f(J," controls the number of tokens that will be merged during the forward pass. For more details on "),nr=l(J,"CODE",{});var _3=o(nr);tf=f(_3,"tomesd"),_3.forEach(e),ef=f(J,", please refer to the original repository "),Te=l(J,"A",{href:!0,rel:!0});var D3=o(Te);rf=f(D3,"https://github.com/dbolya/tomesd"),D3.forEach(e),lf=f(J," and "),_e=l(J,"A",{href:!0,rel:!0});var m3=o(_e);of=f(m3,"the paper"),m3.forEach(e),af=f(J,"."),J.forEach(e),Ta=d(i),It=l(i,"H2",{class:!0});var us=o(It);jt=l(us,"A",{id:!0,class:!0,href:!0});var b3=o(jt);hr=l(b3,"SPAN",{});var g3=o(hr);ae(De.$$.fragment,g3),g3.forEach(e),b3.forEach(e),df=d(us),Qt=l(us,"SPAN",{});var fa=o(Qt);sf=f(fa,"Benchmarking "),cr=l(fa,"CODE",{});var O3=o(cr);ff=f(O3,"tomesd"),O3.forEach(e),nf=f(fa," with "),pr=l(fa,"CODE",{});var w3=o(pr);hf=f(w3,"StableDiffusionPipeline"),w3.forEach(e),fa.forEach(e),us.forEach(e),_a=d(i),At=l(i,"P",{});var le=o(At);cf=f(le,"We benchmarked the impact of using "),vr=l(le,"CODE",{});var M3=o(vr);pf=f(M3,"tomesd"),M3.forEach(e),vf=f(le," on "),Be=l(le,"A",{href:!0});var y3=o(Be);uf=f(y3,"StableDiffusionPipeline"),y3.forEach(e),Ef=f(le," along with "),me=l(le,"A",{href:!0,rel:!0});var P3=o(me);Tf=f(P3,"xformers"),P3.forEach(e),_f=f(le," across different image resolutions. We used A100 and V100 as our test GPU devices with the following development environment (with Python 3.8.5):"),le.forEach(e),Da=d(i),ae(be.$$.fragment,i),ma=d(i),Jt=l(i,"P",{});var Es=o(Jt);Df=f(Es,"We used this script for benchmarking: "),ge=l(Es,"A",{href:!0,rel:!0});var k3=o(ge);mf=f(k3,"https://gist.github.com/sayakpaul/27aec6bca7eb7b0e0aa4112205850335"),k3.forEach(e),bf=f(Es,". Following are our findings:"),Es.forEach(e),ba=d(i),Wt=l(i,"H3",{class:!0});var Ts=o(Wt);Kt=l(Ts,"A",{id:!0,class:!0,href:!0});var $3=o(Kt);ur=l($3,"SPAN",{});var A3=o(ur);ae(Oe.$$.fragment,A3),A3.forEach(e),$3.forEach(e),gf=d(Ts),Er=l(Ts,"SPAN",{});var S3=o(Er);Of=f(S3,"A100"),S3.forEach(e),Ts.forEach(e),ga=d(i),Xt=l(i,"TABLE",{});var _s=o(Xt);Tr=l(_s,"THEAD",{});var x3=o(Tr);_=l(x3,"TR",{});var X=o(_);_r=l(X,"TH",{});var R3=o(_r);wf=f(R3,"Resolution"),R3.forEach(e),Mf=d(X),Dr=l(X,"TH",{});var H3=o(Dr);yf=f(H3,"Batch size"),H3.forEach(e),Pf=d(X),mr=l(X,"TH",{});var q3=o(mr);kf=f(q3,"Vanilla"),q3.forEach(e),$f=d(X),br=l(X,"TH",{});var F3=o(br);Af=f(F3,"ToMe"),F3.forEach(e),Sf=d(X),gr=l(X,"TH",{});var B3=o(gr);xf=f(B3,"ToMe + xFormers"),B3.forEach(e),Rf=d(X),Or=l(X,"TH",{});var C3=o(Or);Hf=f(C3,"ToMe speedup (%)"),C3.forEach(e),qf=d(X),wr=l(X,"TH",{});var N3=o(wr);Ff=f(N3,"ToMe + xFormers speedup (%)"),N3.forEach(e),X.forEach(e),x3.forEach(e),Bf=d(_s),u=l(_s,"TBODY",{});var E=o(u);D=l(E,"TR",{});var Z=o(D);Mr=l(Z,"TD",{});var V3=o(Mr);Cf=f(V3,"512"),V3.forEach(e),Nf=d(Z),yr=l(Z,"TD",{});var I3=o(yr);Vf=f(I3,"10"),I3.forEach(e),If=d(Z),Pr=l(Z,"TD",{});var W3=o(Pr);Wf=f(W3,"6.88"),W3.forEach(e),Lf=d(Z),kr=l(Z,"TD",{});var L3=o(kr);Uf=f(L3,"5.26"),L3.forEach(e),Gf=d(Z),$r=l(Z,"TD",{});var U3=o($r);zf=f(U3,"4.69"),U3.forEach(e),Yf=d(Z),Ar=l(Z,"TD",{});var G3=o(Ar);jf=f(G3,"23.54651163"),G3.forEach(e),Qf=d(Z),Sr=l(Z,"TD",{});var z3=o(Sr);Jf=f(z3,"31.83139535"),z3.forEach(e),Z.forEach(e),Kf=d(E),m=l(E,"TR",{});var tt=o(m);Oa=l(tt,"TD",{}),o(Oa).forEach(e),Xf=d(tt),wa=l(tt,"TD",{}),o(wa).forEach(e),Zf=d(tt),Ma=l(tt,"TD",{}),o(Ma).forEach(e),ti=d(tt),ya=l(tt,"TD",{}),o(ya).forEach(e),ei=d(tt),Pa=l(tt,"TD",{}),o(Pa).forEach(e),ri=d(tt),ka=l(tt,"TD",{}),o(ka).forEach(e),li=d(tt),$a=l(tt,"TD",{}),o($a).forEach(e),tt.forEach(e),oi=d(E),b=l(E,"TR",{});var et=o(b);xr=l(et,"TD",{});var Y3=o(xr);ai=f(Y3,"768"),Y3.forEach(e),di=d(et),Rr=l(et,"TD",{});var j3=o(Rr);si=f(j3,"10"),j3.forEach(e),fi=d(et),Hr=l(et,"TD",{});var Q3=o(Hr);ii=f(Q3,"OOM"),Q3.forEach(e),ni=d(et),qr=l(et,"TD",{});var J3=o(qr);hi=f(J3,"14.71"),J3.forEach(e),ci=d(et),Fr=l(et,"TD",{});var K3=o(Fr);pi=f(K3,"11"),K3.forEach(e),vi=d(et),Aa=l(et,"TD",{}),o(Aa).forEach(e),ui=d(et),Sa=l(et,"TD",{}),o(Sa).forEach(e),et.forEach(e),Ei=d(E),g=l(E,"TR",{});var rt=o(g);xa=l(rt,"TD",{}),o(xa).forEach(e),Ti=d(rt),Br=l(rt,"TD",{});var X3=o(Br);_i=f(X3,"8"),X3.forEach(e),Di=d(rt),Cr=l(rt,"TD",{});var Z3=o(Cr);mi=f(Z3,"OOM"),Z3.forEach(e),bi=d(rt),Nr=l(rt,"TD",{});var tv=o(Nr);gi=f(tv,"11.56"),tv.forEach(e),Oi=d(rt),Vr=l(rt,"TD",{});var ev=o(Vr);wi=f(ev,"8.84"),ev.forEach(e),Mi=d(rt),Ra=l(rt,"TD",{}),o(Ra).forEach(e),yi=d(rt),Ha=l(rt,"TD",{}),o(Ha).forEach(e),rt.forEach(e),Pi=d(E),O=l(E,"TR",{});var lt=o(O);qa=l(lt,"TD",{}),o(qa).forEach(e),ki=d(lt),Ir=l(lt,"TD",{});var rv=o(Ir);$i=f(rv,"4"),rv.forEach(e),Ai=d(lt),Wr=l(lt,"TD",{});var lv=o(Wr);Si=f(lv,"OOM"),lv.forEach(e),xi=d(lt),Lr=l(lt,"TD",{});var ov=o(Lr);Ri=f(ov,"5.98"),ov.forEach(e),Hi=d(lt),Ur=l(lt,"TD",{});var av=o(Ur);qi=f(av,"4.66"),av.forEach(e),Fi=d(lt),Fa=l(lt,"TD",{}),o(Fa).forEach(e),Bi=d(lt),Ba=l(lt,"TD",{}),o(Ba).forEach(e),lt.forEach(e),Ci=d(E),w=l(E,"TR",{});var ot=o(w);Ca=l(ot,"TD",{}),o(Ca).forEach(e),Ni=d(ot),Gr=l(ot,"TD",{});var dv=o(Gr);Vi=f(dv,"2"),dv.forEach(e),Ii=d(ot),zr=l(ot,"TD",{});var sv=o(zr);Wi=f(sv,"4.99"),sv.forEach(e),Li=d(ot),Yr=l(ot,"TD",{});var fv=o(Yr);Ui=f(fv,"3.24"),fv.forEach(e),Gi=d(ot),jr=l(ot,"TD",{});var iv=o(jr);zi=f(iv,"3.1"),iv.forEach(e),Yi=d(ot),Qr=l(ot,"TD",{});var nv=o(Qr);ji=f(nv,"35.07014028"),nv.forEach(e),Qi=d(ot),Jr=l(ot,"TD",{});var hv=o(Jr);Ji=f(hv,"37.8757515"),hv.forEach(e),ot.forEach(e),Ki=d(E),M=l(E,"TR",{});var at=o(M);Na=l(at,"TD",{}),o(Na).forEach(e),Xi=d(at),Kr=l(at,"TD",{});var cv=o(Kr);Zi=f(cv,"1"),cv.forEach(e),tn=d(at),Xr=l(at,"TD",{});var pv=o(Xr);en=f(pv,"3.29"),pv.forEach(e),rn=d(at),Zr=l(at,"TD",{});var vv=o(Zr);ln=f(vv,"2.24"),vv.forEach(e),on=d(at),tl=l(at,"TD",{});var uv=o(tl);an=f(uv,"2.03"),uv.forEach(e),dn=d(at),el=l(at,"TD",{});var Ev=o(el);sn=f(Ev,"31.91489362"),Ev.forEach(e),fn=d(at),rl=l(at,"TD",{});var Tv=o(rl);nn=f(Tv,"38.29787234"),Tv.forEach(e),at.forEach(e),hn=d(E),y=l(E,"TR",{});var dt=o(y);Va=l(dt,"TD",{}),o(Va).forEach(e),cn=d(dt),Ia=l(dt,"TD",{}),o(Ia).forEach(e),pn=d(dt),Wa=l(dt,"TD",{}),o(Wa).forEach(e),vn=d(dt),La=l(dt,"TD",{}),o(La).forEach(e),un=d(dt),Ua=l(dt,"TD",{}),o(Ua).forEach(e),En=d(dt),Ga=l(dt,"TD",{}),o(Ga).forEach(e),Tn=d(dt),za=l(dt,"TD",{}),o(za).forEach(e),dt.forEach(e),_n=d(E),P=l(E,"TR",{});var st=o(P);ll=l(st,"TD",{});var _v=o(ll);Dn=f(_v,"1024"),_v.forEach(e),mn=d(st),ol=l(st,"TD",{});var Dv=o(ol);bn=f(Dv,"10"),Dv.forEach(e),gn=d(st),al=l(st,"TD",{});var mv=o(al);On=f(mv,"OOM"),mv.forEach(e),wn=d(st),dl=l(st,"TD",{});var bv=o(dl);Mn=f(bv,"OOM"),bv.forEach(e),yn=d(st),sl=l(st,"TD",{});var gv=o(sl);Pn=f(gv,"OOM"),gv.forEach(e),kn=d(st),Ya=l(st,"TD",{}),o(Ya).forEach(e),$n=d(st),ja=l(st,"TD",{}),o(ja).forEach(e),st.forEach(e),An=d(E),k=l(E,"TR",{});var ft=o(k);Qa=l(ft,"TD",{}),o(Qa).forEach(e),Sn=d(ft),fl=l(ft,"TD",{});var Ov=o(fl);xn=f(Ov,"8"),Ov.forEach(e),Rn=d(ft),il=l(ft,"TD",{});var wv=o(il);Hn=f(wv,"OOM"),wv.forEach(e),qn=d(ft),nl=l(ft,"TD",{});var Mv=o(nl);Fn=f(Mv,"OOM"),Mv.forEach(e),Bn=d(ft),hl=l(ft,"TD",{});var yv=o(hl);Cn=f(yv,"OOM"),yv.forEach(e),Nn=d(ft),Ja=l(ft,"TD",{}),o(Ja).forEach(e),Vn=d(ft),Ka=l(ft,"TD",{}),o(Ka).forEach(e),ft.forEach(e),In=d(E),$=l(E,"TR",{});var it=o($);Xa=l(it,"TD",{}),o(Xa).forEach(e),Wn=d(it),cl=l(it,"TD",{});var Pv=o(cl);Ln=f(Pv,"4"),Pv.forEach(e),Un=d(it),pl=l(it,"TD",{});var kv=o(pl);Gn=f(kv,"OOM"),kv.forEach(e),zn=d(it),vl=l(it,"TD",{});var $v=o(vl);Yn=f($v,"12.51"),$v.forEach(e),jn=d(it),ul=l(it,"TD",{});var Av=o(ul);Qn=f(Av,"9.09"),Av.forEach(e),Jn=d(it),Za=l(it,"TD",{}),o(Za).forEach(e),Kn=d(it),td=l(it,"TD",{}),o(td).forEach(e),it.forEach(e),Xn=d(E),A=l(E,"TR",{});var nt=o(A);ed=l(nt,"TD",{}),o(ed).forEach(e),Zn=d(nt),El=l(nt,"TD",{});var Sv=o(El);t1=f(Sv,"2"),Sv.forEach(e),e1=d(nt),Tl=l(nt,"TD",{});var xv=o(Tl);r1=f(xv,"OOM"),xv.forEach(e),l1=d(nt),_l=l(nt,"TD",{});var Rv=o(_l);o1=f(Rv,"6.52"),Rv.forEach(e),a1=d(nt),Dl=l(nt,"TD",{});var Hv=o(Dl);d1=f(Hv,"4.96"),Hv.forEach(e),s1=d(nt),rd=l(nt,"TD",{}),o(rd).forEach(e),f1=d(nt),ld=l(nt,"TD",{}),o(ld).forEach(e),nt.forEach(e),i1=d(E),S=l(E,"TR",{});var ht=o(S);od=l(ht,"TD",{}),o(od).forEach(e),n1=d(ht),ml=l(ht,"TD",{});var qv=o(ml);h1=f(qv,"1"),qv.forEach(e),c1=d(ht),bl=l(ht,"TD",{});var Fv=o(bl);p1=f(Fv,"6.4"),Fv.forEach(e),v1=d(ht),gl=l(ht,"TD",{});var Bv=o(gl);u1=f(Bv,"3.61"),Bv.forEach(e),E1=d(ht),Ol=l(ht,"TD",{});var Cv=o(Ol);T1=f(Cv,"2.81"),Cv.forEach(e),_1=d(ht),wl=l(ht,"TD",{});var Nv=o(wl);D1=f(Nv,"43.59375"),Nv.forEach(e),m1=d(ht),Ml=l(ht,"TD",{});var Vv=o(Ml);b1=f(Vv,"56.09375"),Vv.forEach(e),ht.forEach(e),E.forEach(e),_s.forEach(e),ad=d(i),Ce=l(i,"P",{});var Iv=o(Ce);yl=l(Iv,"STRONG",{});var Wv=o(yl);we=l(Wv,"EM",{});var Ds=o(we);g1=f(Ds,"The timings reported here are in seconds. Speedups are calculated over the "),Pl=l(Ds,"CODE",{});var Lv=o(Pl);O1=f(Lv,"Vanilla"),Lv.forEach(e),w1=f(Ds," timings."),Ds.forEach(e),Wv.forEach(e),Iv.forEach(e),dd=d(i),Lt=l(i,"H3",{class:!0});var ms=o(Lt);Zt=l(ms,"A",{id:!0,class:!0,href:!0});var Uv=o(Zt);kl=l(Uv,"SPAN",{});var Gv=o(kl);ae(Me.$$.fragment,Gv),Gv.forEach(e),Uv.forEach(e),M1=d(ms),$l=l(ms,"SPAN",{});var zv=o($l);y1=f(zv,"V100"),zv.forEach(e),ms.forEach(e),sd=d(i),te=l(i,"TABLE",{});var bs=o(te);Al=l(bs,"THEAD",{});var Yv=o(Al);x=l(Yv,"TR",{});var ct=o(x);Sl=l(ct,"TH",{});var jv=o(Sl);P1=f(jv,"Resolution"),jv.forEach(e),k1=d(ct),xl=l(ct,"TH",{});var Qv=o(xl);$1=f(Qv,"Batch size"),Qv.forEach(e),A1=d(ct),Rl=l(ct,"TH",{});var Jv=o(Rl);S1=f(Jv,"Vanilla"),Jv.forEach(e),x1=d(ct),Hl=l(ct,"TH",{});var Kv=o(Hl);R1=f(Kv,"ToMe"),Kv.forEach(e),H1=d(ct),ql=l(ct,"TH",{});var Xv=o(ql);q1=f(Xv,"ToMe + xFormers"),Xv.forEach(e),F1=d(ct),Fl=l(ct,"TH",{});var Zv=o(Fl);B1=f(Zv,"ToMe speedup (%)"),Zv.forEach(e),C1=d(ct),Bl=l(ct,"TH",{});var tu=o(Bl);N1=f(tu,"ToMe + xFormers speedup (%)"),tu.forEach(e),ct.forEach(e),Yv.forEach(e),V1=d(bs),p=l(bs,"TBODY",{});var v=o(p);R=l(v,"TR",{});var pt=o(R);Cl=l(pt,"TD",{});var eu=o(Cl);I1=f(eu,"512"),eu.forEach(e),W1=d(pt),Nl=l(pt,"TD",{});var ru=o(Nl);L1=f(ru,"10"),ru.forEach(e),U1=d(pt),Vl=l(pt,"TD",{});var lu=o(Vl);G1=f(lu,"OOM"),lu.forEach(e),z1=d(pt),Il=l(pt,"TD",{});var ou=o(Il);Y1=f(ou,"10.03"),ou.forEach(e),j1=d(pt),Wl=l(pt,"TD",{});var au=o(Wl);Q1=f(au,"9.29"),au.forEach(e),J1=d(pt),fd=l(pt,"TD",{}),o(fd).forEach(e),K1=d(pt),id=l(pt,"TD",{}),o(id).forEach(e),pt.forEach(e),X1=d(v),H=l(v,"TR",{});var vt=o(H);nd=l(vt,"TD",{}),o(nd).forEach(e),Z1=d(vt),Ll=l(vt,"TD",{});var du=o(Ll);th=f(du,"8"),du.forEach(e),eh=d(vt),Ul=l(vt,"TD",{});var su=o(Ul);rh=f(su,"OOM"),su.forEach(e),lh=d(vt),Gl=l(vt,"TD",{});var fu=o(Gl);oh=f(fu,"8.05"),fu.forEach(e),ah=d(vt),zl=l(vt,"TD",{});var iu=o(zl);dh=f(iu,"7.47"),iu.forEach(e),sh=d(vt),hd=l(vt,"TD",{}),o(hd).forEach(e),fh=d(vt),cd=l(vt,"TD",{}),o(cd).forEach(e),vt.forEach(e),ih=d(v),q=l(v,"TR",{});var ut=o(q);pd=l(ut,"TD",{}),o(pd).forEach(e),nh=d(ut),Yl=l(ut,"TD",{});var nu=o(Yl);hh=f(nu,"4"),nu.forEach(e),ch=d(ut),jl=l(ut,"TD",{});var hu=o(jl);ph=f(hu,"5.7"),hu.forEach(e),vh=d(ut),Ql=l(ut,"TD",{});var cu=o(Ql);uh=f(cu,"4.3"),cu.forEach(e),Eh=d(ut),Jl=l(ut,"TD",{});var pu=o(Jl);Th=f(pu,"3.98"),pu.forEach(e),_h=d(ut),Kl=l(ut,"TD",{});var vu=o(Kl);Dh=f(vu,"24.56140351"),vu.forEach(e),mh=d(ut),Xl=l(ut,"TD",{});var uu=o(Xl);bh=f(uu,"30.1754386"),uu.forEach(e),ut.forEach(e),gh=d(v),F=l(v,"TR",{});var Et=o(F);vd=l(Et,"TD",{}),o(vd).forEach(e),Oh=d(Et),Zl=l(Et,"TD",{});var Eu=o(Zl);wh=f(Eu,"2"),Eu.forEach(e),Mh=d(Et),to=l(Et,"TD",{});var Tu=o(to);yh=f(Tu,"3.14"),Tu.forEach(e),Ph=d(Et),eo=l(Et,"TD",{});var _u=o(eo);kh=f(_u,"2.43"),_u.forEach(e),$h=d(Et),ro=l(Et,"TD",{});var Du=o(ro);Ah=f(Du,"2.27"),Du.forEach(e),Sh=d(Et),lo=l(Et,"TD",{});var mu=o(lo);xh=f(mu,"22.61146497"),mu.forEach(e),Rh=d(Et),oo=l(Et,"TD",{});var bu=o(oo);Hh=f(bu,"27.70700637"),bu.forEach(e),Et.forEach(e),qh=d(v),B=l(v,"TR",{});var Tt=o(B);ud=l(Tt,"TD",{}),o(ud).forEach(e),Fh=d(Tt),ao=l(Tt,"TD",{});var gu=o(ao);Bh=f(gu,"1"),gu.forEach(e),Ch=d(Tt),so=l(Tt,"TD",{});var Ou=o(so);Nh=f(Ou,"1.88"),Ou.forEach(e),Vh=d(Tt),fo=l(Tt,"TD",{});var wu=o(fo);Ih=f(wu,"1.57"),wu.forEach(e),Wh=d(Tt),io=l(Tt,"TD",{});var Mu=o(io);Lh=f(Mu,"1.57"),Mu.forEach(e),Uh=d(Tt),no=l(Tt,"TD",{});var yu=o(no);Gh=f(yu,"16.4893617"),yu.forEach(e),zh=d(Tt),ho=l(Tt,"TD",{});var Pu=o(ho);Yh=f(Pu,"16.4893617"),Pu.forEach(e),Tt.forEach(e),jh=d(v),C=l(v,"TR",{});var _t=o(C);Ed=l(_t,"TD",{}),o(Ed).forEach(e),Qh=d(_t),Td=l(_t,"TD",{}),o(Td).forEach(e),Jh=d(_t),_d=l(_t,"TD",{}),o(_d).forEach(e),Kh=d(_t),Dd=l(_t,"TD",{}),o(Dd).forEach(e),Xh=d(_t),md=l(_t,"TD",{}),o(md).forEach(e),Zh=d(_t),bd=l(_t,"TD",{}),o(bd).forEach(e),tc=d(_t),gd=l(_t,"TD",{}),o(gd).forEach(e),_t.forEach(e),ec=d(v),N=l(v,"TR",{});var Dt=o(N);co=l(Dt,"TD",{});var ku=o(co);rc=f(ku,"768"),ku.forEach(e),lc=d(Dt),po=l(Dt,"TD",{});var $u=o(po);oc=f($u,"10"),$u.forEach(e),ac=d(Dt),vo=l(Dt,"TD",{});var Au=o(vo);dc=f(Au,"OOM"),Au.forEach(e),sc=d(Dt),uo=l(Dt,"TD",{});var Su=o(uo);fc=f(Su,"OOM"),Su.forEach(e),ic=d(Dt),Eo=l(Dt,"TD",{});var xu=o(Eo);nc=f(xu,"23.67"),xu.forEach(e),hc=d(Dt),Od=l(Dt,"TD",{}),o(Od).forEach(e),cc=d(Dt),wd=l(Dt,"TD",{}),o(wd).forEach(e),Dt.forEach(e),pc=d(v),V=l(v,"TR",{});var mt=o(V);Md=l(mt,"TD",{}),o(Md).forEach(e),vc=d(mt),To=l(mt,"TD",{});var Ru=o(To);uc=f(Ru,"8"),Ru.forEach(e),Ec=d(mt),_o=l(mt,"TD",{});var Hu=o(_o);Tc=f(Hu,"OOM"),Hu.forEach(e),_c=d(mt),Do=l(mt,"TD",{});var qu=o(Do);Dc=f(qu,"OOM"),qu.forEach(e),mc=d(mt),mo=l(mt,"TD",{});var Fu=o(mo);bc=f(Fu,"18.81"),Fu.forEach(e),gc=d(mt),yd=l(mt,"TD",{}),o(yd).forEach(e),Oc=d(mt),Pd=l(mt,"TD",{}),o(Pd).forEach(e),mt.forEach(e),wc=d(v),I=l(v,"TR",{});var bt=o(I);kd=l(bt,"TD",{}),o(kd).forEach(e),Mc=d(bt),bo=l(bt,"TD",{});var Bu=o(bo);yc=f(Bu,"4"),Bu.forEach(e),Pc=d(bt),go=l(bt,"TD",{});var Cu=o(go);kc=f(Cu,"OOM"),Cu.forEach(e),$c=d(bt),Oo=l(bt,"TD",{});var Nu=o(Oo);Ac=f(Nu,"11.81"),Nu.forEach(e),Sc=d(bt),wo=l(bt,"TD",{});var Vu=o(wo);xc=f(Vu,"9.7"),Vu.forEach(e),Rc=d(bt),$d=l(bt,"TD",{}),o($d).forEach(e),Hc=d(bt),Ad=l(bt,"TD",{}),o(Ad).forEach(e),bt.forEach(e),qc=d(v),W=l(v,"TR",{});var gt=o(W);Sd=l(gt,"TD",{}),o(Sd).forEach(e),Fc=d(gt),Mo=l(gt,"TD",{});var Iu=o(Mo);Bc=f(Iu,"2"),Iu.forEach(e),Cc=d(gt),yo=l(gt,"TD",{});var Wu=o(yo);Nc=f(Wu,"OOM"),Wu.forEach(e),Vc=d(gt),Po=l(gt,"TD",{});var Lu=o(Po);Ic=f(Lu,"6.27"),Lu.forEach(e),Wc=d(gt),ko=l(gt,"TD",{});var Uu=o(ko);Lc=f(Uu,"5.2"),Uu.forEach(e),Uc=d(gt),xd=l(gt,"TD",{}),o(xd).forEach(e),Gc=d(gt),Rd=l(gt,"TD",{}),o(Rd).forEach(e),gt.forEach(e),zc=d(v),L=l(v,"TR",{});var Ot=o(L);Hd=l(Ot,"TD",{}),o(Hd).forEach(e),Yc=d(Ot),$o=l(Ot,"TD",{});var Gu=o($o);jc=f(Gu,"1"),Gu.forEach(e),Qc=d(Ot),Ao=l(Ot,"TD",{});var zu=o(Ao);Jc=f(zu,"5.43"),zu.forEach(e),Kc=d(Ot),So=l(Ot,"TD",{});var Yu=o(So);Xc=f(Yu,"3.38"),Yu.forEach(e),Zc=d(Ot),xo=l(Ot,"TD",{});var ju=o(xo);t2=f(ju,"2.82"),ju.forEach(e),e2=d(Ot),Ro=l(Ot,"TD",{});var Qu=o(Ro);r2=f(Qu,"37.75322284"),Qu.forEach(e),l2=d(Ot),Ho=l(Ot,"TD",{});var Ju=o(Ho);o2=f(Ju,"48.06629834"),Ju.forEach(e),Ot.forEach(e),a2=d(v),U=l(v,"TR",{});var wt=o(U);qd=l(wt,"TD",{}),o(qd).forEach(e),d2=d(wt),Fd=l(wt,"TD",{}),o(Fd).forEach(e),s2=d(wt),Bd=l(wt,"TD",{}),o(Bd).forEach(e),f2=d(wt),Cd=l(wt,"TD",{}),o(Cd).forEach(e),i2=d(wt),Nd=l(wt,"TD",{}),o(Nd).forEach(e),n2=d(wt),Vd=l(wt,"TD",{}),o(Vd).forEach(e),h2=d(wt),Id=l(wt,"TD",{}),o(Id).forEach(e),wt.forEach(e),c2=d(v),G=l(v,"TR",{});var Mt=o(G);qo=l(Mt,"TD",{});var Ku=o(qo);p2=f(Ku,"1024"),Ku.forEach(e),v2=d(Mt),Fo=l(Mt,"TD",{});var Xu=o(Fo);u2=f(Xu,"10"),Xu.forEach(e),E2=d(Mt),Bo=l(Mt,"TD",{});var Zu=o(Bo);T2=f(Zu,"OOM"),Zu.forEach(e),_2=d(Mt),Co=l(Mt,"TD",{});var tE=o(Co);D2=f(tE,"OOM"),tE.forEach(e),m2=d(Mt),No=l(Mt,"TD",{});var eE=o(No);b2=f(eE,"OOM"),eE.forEach(e),g2=d(Mt),Wd=l(Mt,"TD",{}),o(Wd).forEach(e),O2=d(Mt),Ld=l(Mt,"TD",{}),o(Ld).forEach(e),Mt.forEach(e),w2=d(v),z=l(v,"TR",{});var yt=o(z);Ud=l(yt,"TD",{}),o(Ud).forEach(e),M2=d(yt),Vo=l(yt,"TD",{});var rE=o(Vo);y2=f(rE,"8"),rE.forEach(e),P2=d(yt),Io=l(yt,"TD",{});var lE=o(Io);k2=f(lE,"OOM"),lE.forEach(e),$2=d(yt),Wo=l(yt,"TD",{});var oE=o(Wo);A2=f(oE,"OOM"),oE.forEach(e),S2=d(yt),Lo=l(yt,"TD",{});var aE=o(Lo);x2=f(aE,"OOM"),aE.forEach(e),R2=d(yt),Gd=l(yt,"TD",{}),o(Gd).forEach(e),H2=d(yt),zd=l(yt,"TD",{}),o(zd).forEach(e),yt.forEach(e),q2=d(v),Y=l(v,"TR",{});var Pt=o(Y);Yd=l(Pt,"TD",{}),o(Yd).forEach(e),F2=d(Pt),Uo=l(Pt,"TD",{});var dE=o(Uo);B2=f(dE,"4"),dE.forEach(e),C2=d(Pt),Go=l(Pt,"TD",{});var sE=o(Go);N2=f(sE,"OOM"),sE.forEach(e),V2=d(Pt),zo=l(Pt,"TD",{});var fE=o(zo);I2=f(fE,"OOM"),fE.forEach(e),W2=d(Pt),Yo=l(Pt,"TD",{});var iE=o(Yo);L2=f(iE,"19.35"),iE.forEach(e),U2=d(Pt),jd=l(Pt,"TD",{}),o(jd).forEach(e),G2=d(Pt),Qd=l(Pt,"TD",{}),o(Qd).forEach(e),Pt.forEach(e),z2=d(v),j=l(v,"TR",{});var kt=o(j);Jd=l(kt,"TD",{}),o(Jd).forEach(e),Y2=d(kt),jo=l(kt,"TD",{});var nE=o(jo);j2=f(nE,"2"),nE.forEach(e),Q2=d(kt),Qo=l(kt,"TD",{});var hE=o(Qo);J2=f(hE,"OOM"),hE.forEach(e),K2=d(kt),Jo=l(kt,"TD",{});var cE=o(Jo);X2=f(cE,"13"),cE.forEach(e),Z2=d(kt),Ko=l(kt,"TD",{});var pE=o(Ko);tp=f(pE,"10.78"),pE.forEach(e),ep=d(kt),Kd=l(kt,"TD",{}),o(Kd).forEach(e),rp=d(kt),Xd=l(kt,"TD",{}),o(Xd).forEach(e),kt.forEach(e),lp=d(v),Q=l(v,"TR",{});var $t=o(Q);Zd=l($t,"TD",{}),o(Zd).forEach(e),op=d($t),Xo=l($t,"TD",{});var vE=o(Xo);ap=f(vE,"1"),vE.forEach(e),dp=d($t),Zo=l($t,"TD",{});var uE=o(Zo);sp=f(uE,"OOM"),uE.forEach(e),fp=d($t),ta=l($t,"TD",{});var EE=o(ta);ip=f(EE,"6.66"),EE.forEach(e),np=d($t),ea=l($t,"TD",{});var TE=o(ea);hp=f(TE,"5.54"),TE.forEach(e),cp=d($t),ts=l($t,"TD",{}),o(ts).forEach(e),pp=d($t),es=l($t,"TD",{}),o(es).forEach(e),$t.forEach(e),v.forEach(e),bs.forEach(e),rs=d(i),xt=l(i,"P",{});var Je=o(xt);vp=f(Je,"As seen in the tables above, the speedup with "),ra=l(Je,"CODE",{});var _E=o(ra);up=f(_E,"tomesd"),_E.forEach(e),Ep=f(Je," becomes more pronounced for larger image resolutions. It is also interesting to note that with "),la=l(Je,"CODE",{});var DE=o(la);Tp=f(DE,"tomesd"),DE.forEach(e),_p=f(Je,", it becomes possible to run the pipeline on a higher resolution, like 1024x1024."),Je.forEach(e),ls=d(i),ee=l(i,"P",{});var gs=o(ee);Dp=f(gs,"It might be possible to speed up inference even further with "),ye=l(gs,"A",{href:!0,rel:!0});var mE=o(ye);oa=l(mE,"CODE",{});var bE=o(oa);mp=f(bE,"torch.compile()"),bE.forEach(e),mE.forEach(e),bp=f(gs,"."),gs.forEach(e),os=d(i),Ut=l(i,"H2",{class:!0});var Os=o(Ut);re=l(Os,"A",{id:!0,class:!0,href:!0});var gE=o(re);aa=l(gE,"SPAN",{});var OE=o(aa);ae(Pe.$$.fragment,OE),OE.forEach(e),gE.forEach(e),gp=d(Os),da=l(Os,"SPAN",{});var wE=o(da);Op=f(wE,"Quality"),wE.forEach(e),Os.forEach(e),as=d(i),Rt=l(i,"P",{});var Ke=o(Rt);wp=f(Ke,"As reported in "),ke=l(Ke,"A",{href:!0,rel:!0});var ME=o(ke);Mp=f(ME,"the paper"),ME.forEach(e),yp=f(Ke,", ToMe can preserve the quality of the generated images to a great extent while speeding up inference. By increasing the "),sa=l(Ke,"CODE",{});var yE=o(sa);Pp=f(yE,"ratio"),yE.forEach(e),kp=f(Ke,", it is possible to further speed up inference, but that might come at the cost of a deterioration in the image quality."),Ke.forEach(e),ds=d(i),Ht=l(i,"P",{});var Xe=o(Ht);$p=f(Xe,"To test the quality of the generated samples using our setup, we sampled a few prompts from the \u201CParti Prompts\u201D (introduced in "),$e=l(Xe,"A",{href:!0,rel:!0});var PE=o($e);Ap=f(PE,"Parti"),PE.forEach(e),Sp=f(Xe,") and performed inference with the "),Ne=l(Xe,"A",{href:!0});var kE=o(Ne);xp=f(kE,"StableDiffusionPipeline"),kE.forEach(e),Rp=f(Xe," in the following settings:"),Xe.forEach(e),ss=d(i),qt=l(i,"UL",{});var Ze=o(qt);Ve=l(Ze,"LI",{});var jp=o(Ve);Hp=f(jp,"Vanilla "),Ie=l(jp,"A",{href:!0});var $E=o(Ie);qp=f($E,"StableDiffusionPipeline"),$E.forEach(e),jp.forEach(e),Fp=d(Ze),We=l(Ze,"LI",{});var Qp=o(We);Le=l(Qp,"A",{href:!0});var AE=o(Le);Bp=f(AE,"StableDiffusionPipeline"),AE.forEach(e),Cp=f(Qp," + ToMe"),Qp.forEach(e),Np=d(Ze),Ue=l(Ze,"LI",{});var Jp=o(Ue);Ge=l(Jp,"A",{href:!0});var SE=o(Ge);Vp=f(SE,"StableDiffusionPipeline"),SE.forEach(e),Ip=f(Jp," + ToMe + xformers"),Jp.forEach(e),Ze.forEach(e),fs=d(i),ze=l(i,"P",{});var xE=o(ze);Wp=f(xE,"We didn\u2019t notice any significant decrease in the quality of the generated samples. Here are samples:"),xE.forEach(e),is=d(i),Ye=l(i,"P",{});var RE=o(Ye);je=l(RE,"IMG",{src:!0,alt:!0}),RE.forEach(e),ns=d(i),Ft=l(i,"P",{});var tr=o(Ft);Lp=f(tr,"You can check out the generated samples "),Ae=l(tr,"A",{href:!0,rel:!0});var HE=o(Ae);Up=f(HE,"here"),HE.forEach(e),Gp=f(tr,". We used "),Se=l(tr,"A",{href:!0,rel:!0});var qE=o(Se);zp=f(qE,"this script"),qE.forEach(e),Yp=f(tr," for conducting this experiment."),tr.forEach(e),this.h()},h(){n(Ct,"name","hf:doc:metadata"),n(Ct,"content",JSON.stringify(GE)),n(Gt,"id","token-merging"),n(Gt,"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"),n(Gt,"href","#token-merging"),n(Nt,"class","relative group"),n(he,"href","https://arxiv.org/abs/2210.09461"),n(he,"rel","nofollow"),n(ce,"href","https://arxiv.org/abs/2303.17604"),n(ce,"rel","nofollow"),n(xe,"href","/docs/diffusers/v0.16.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),n(Re,"href","/docs/diffusers/v0.16.0/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline"),n(He,"href","/docs/diffusers/v0.16.0/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline"),n(Yt,"id","using-tome"),n(Yt,"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"),n(Yt,"href","#using-tome"),n(Vt,"class","relative group"),n(ve,"href","https://github.com/dbolya/tomesd"),n(ve,"rel","nofollow"),n(qe,"href","/docs/diffusers/v0.16.0/en/api/diffusion_pipeline#diffusers.DiffusionPipeline"),n(Ee,"href","https://github.com/dbolya/tomesd#usage"),n(Ee,"rel","nofollow"),n(Te,"href","https://github.com/dbolya/tomesd"),n(Te,"rel","nofollow"),n(_e,"href","https://arxiv.org/abs/2303.17604"),n(_e,"rel","nofollow"),n(jt,"id","benchmarking-tomesd-with-stablediffusionpipeline"),n(jt,"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"),n(jt,"href","#benchmarking-tomesd-with-stablediffusionpipeline"),n(It,"class","relative group"),n(Be,"href","/docs/diffusers/v0.16.0/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline"),n(me,"href","https://huggingface.co/docs/diffusers/optimization/xformers"),n(me,"rel","nofollow"),n(ge,"href","https://gist.github.com/sayakpaul/27aec6bca7eb7b0e0aa4112205850335"),n(ge,"rel","nofollow"),n(Kt,"id","a100"),n(Kt,"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"),n(Kt,"href","#a100"),n(Wt,"class","relative group"),n(Zt,"id","v100"),n(Zt,"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"),n(Zt,"href","#v100"),n(Lt,"class","relative group"),n(ye,"href","https://huggingface.co/docs/diffusers/optimization/torch2.0"),n(ye,"rel","nofollow"),n(re,"id","quality"),n(re,"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"),n(re,"href","#quality"),n(Ut,"class","relative group"),n(ke,"href","https://arxiv.org/abs/2303.17604"),n(ke,"rel","nofollow"),n($e,"href","https://parti.research.google/"),n($e,"rel","nofollow"),n(Ne,"href","/docs/diffusers/v0.16.0/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline"),n(Ie,"href","/docs/diffusers/v0.16.0/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline"),n(Le,"href","/docs/diffusers/v0.16.0/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline"),n(Ge,"href","/docs/diffusers/v0.16.0/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline"),IE(je.src,Xp="https://huggingface.co/datasets/diffusers/docs-images/resolve/main/tome/tome_samples.png")||n(je,"src",Xp),n(je,"alt","tome-samples"),n(Ae,"href","https://wandb.ai/sayakpaul/tomesd-results/runs/23j4bj3i?workspace="),n(Ae,"rel","nofollow"),n(Se,"href","https://gist.github.com/sayakpaul/8cac98d7f22399085a060992f411ecbd"),n(Se,"rel","nofollow")},m(i,h){t(document.head,Ct),c(i,ia,h),c(i,Nt,h),t(Nt,Gt),t(Gt,rr),de(ne,rr,null),t(Nt,ws),t(Nt,lr),t(lr,Ms),c(i,na,h),c(i,zt,h),t(zt,ys),t(zt,he),t(he,Ps),t(zt,ks),c(i,ha,h),c(i,K,h),t(K,$s),t(K,ce),t(ce,As),t(K,Ss),t(K,xe),t(xe,xs),t(K,Rs),t(K,Re),t(Re,Hs),t(K,qs),t(K,He),t(He,Fs),t(K,Bs),c(i,ca,h),c(i,Vt,h),t(Vt,Yt),t(Yt,or),de(pe,or,null),t(Vt,Cs),t(Vt,ar),t(ar,Ns),c(i,pa,h),c(i,St,h),t(St,Vs),t(St,ve),t(ve,dr),t(dr,Is),t(St,Ws),t(St,qe),t(qe,Ls),t(St,Us),c(i,va,h),de(ue,i,h),c(i,ua,h),c(i,Fe,h),t(Fe,Gs),c(i,Ea,h),c(i,T,h),t(T,sr),t(sr,zs),t(T,Ys),t(T,Ee),t(Ee,js),t(T,Qs),t(T,fr),t(fr,Js),t(T,Ks),t(T,ir),t(ir,Xs),t(T,Zs),t(T,nr),t(nr,tf),t(T,ef),t(T,Te),t(Te,rf),t(T,lf),t(T,_e),t(_e,of),t(T,af),c(i,Ta,h),c(i,It,h),t(It,jt),t(jt,hr),de(De,hr,null),t(It,df),t(It,Qt),t(Qt,sf),t(Qt,cr),t(cr,ff),t(Qt,nf),t(Qt,pr),t(pr,hf),c(i,_a,h),c(i,At,h),t(At,cf),t(At,vr),t(vr,pf),t(At,vf),t(At,Be),t(Be,uf),t(At,Ef),t(At,me),t(me,Tf),t(At,_f),c(i,Da,h),de(be,i,h),c(i,ma,h),c(i,Jt,h),t(Jt,Df),t(Jt,ge),t(ge,mf),t(Jt,bf),c(i,ba,h),c(i,Wt,h),t(Wt,Kt),t(Kt,ur),de(Oe,ur,null),t(Wt,gf),t(Wt,Er),t(Er,Of),c(i,ga,h),c(i,Xt,h),t(Xt,Tr),t(Tr,_),t(_,_r),t(_r,wf),t(_,Mf),t(_,Dr),t(Dr,yf),t(_,Pf),t(_,mr),t(mr,kf),t(_,$f),t(_,br),t(br,Af),t(_,Sf),t(_,gr),t(gr,xf),t(_,Rf),t(_,Or),t(Or,Hf),t(_,qf),t(_,wr),t(wr,Ff),t(Xt,Bf),t(Xt,u),t(u,D),t(D,Mr),t(Mr,Cf),t(D,Nf),t(D,yr),t(yr,Vf),t(D,If),t(D,Pr),t(Pr,Wf),t(D,Lf),t(D,kr),t(kr,Uf),t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,un),t(y,Ua),t(y,En),t(y,Ga),t(y,Tn),t(y,za),t(u,_n),t(u,P),t(P,ll),t(ll,Dn),t(P,mn),t(P,ol),t(ol,bn),t(P,gn),t(P,al),t(al,On),t(P,wn),t(P,dl),t(dl,Mn),t(P,yn),t(P,sl),t(sl,Pn),t(P,kn),t(P,Ya),t(P,$n),t(P,ja),t(u,An),t(u,k),t(k,Qa),t(k,Sn),t(k,fl),t(fl,xn),t(k,Rn),t(k,il),t(il,Hn),t(k,qn),t(k,nl),t(nl,Fn),t(k,Bn),t(k,hl),t(hl,Cn),t(k,Nn),t(k,Ja),t(k,Vn),t(k,Ka),t(u,In),t(u,$),t($,Xa),t($,Wn),t($,cl),t(cl,Ln),t($,Un),t($,pl),t(pl,Gn),t($,zn),t($,vl),t(vl,Yn),t($,jn),t($,ul),t(ul,Qn),t($,Jn),t($,Za),t($,Kn),t($,td),t(u,Xn),t(u,A),t(A,ed),t(A,Zn),t(A,El),t(El,t1),t(A,e1),t(A,Tl),t(Tl,r1),t(A,l1),t(A,_l),t(_l,o1),t(A,a1),t(A,Dl),t(Dl,d1),t(A,s1),t(A,rd),t(A,f1),t(A,ld),t(u,i1),t(u,S),t(S,od),t(S,n1),t(S,ml),t(ml,h1),t(S,c1),t(S,bl),t(bl,p1),t(S,v1),t(S,gl),t(gl,u1),t(S,E1),t(S,Ol),t(Ol,T1),t(S,_1),t(S,wl),t(wl,D1),t(S,m1),t(S,Ml),t(Ml,b1),c(i,ad,h),c(i,Ce,h),t(Ce,yl),t(yl,we),t(we,g1),t(we,Pl),t(Pl,O1),t(we,w1),c(i,dd,h),c(i,Lt,h),t(Lt,Zt),t(Zt,kl),de(Me,kl,null),t(Lt,M1),t(Lt,$l),t($l,y1),c(i,sd,h),c(i,te,h),t(te,Al),t(Al,x),t(x,Sl),t(Sl,P1),t(x,k1),t(x,xl),t(xl,$1),t(x,A1),t(x,Rl),t(Rl,S1),t(x,x1),t(x,Hl),t(Hl,R1),t(x,H1),t(x,ql),t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p),c(i,is,h),c(i,Ye,h),t(Ye,je),c(i,ns,h),c(i,Ft,h),t(Ft,Lp),t(Ft,Ae),t(Ae,Up),t(Ft,Gp),t(Ft,Se),t(Se,zp),t(Ft,Yp),hs=!0},p:WE,i(i){hs||(se(ne.$$.fragment,i),se(pe.$$.fragment,i),se(ue.$$.fragment,i),se(De.$$.fragment,i),se(be.$$.fragment,i),se(Oe.$$.fragment,i),se(Me.$$.fragment,i),se(Pe.$$.fragment,i),hs=!0)},o(i){fe(ne.$$.fragment,i),fe(pe.$$.fragment,i),fe(ue.$$.fragment,i),fe(De.$$.fragment,i),fe(be.$$.fragment,i),fe(Oe.$$.fragment,i),fe(Me.$$.fragment,i),fe(Pe.$$.fragment,i),hs=!1},d(i){e(Ct),i&&e(ia),i&&e(Nt),ie(ne),i&&e(na),i&&e(zt),i&&e(ha),i&&e(K),i&&e(ca),i&&e(Vt),ie(pe),i&&e(pa),i&&e(St),i&&e(va),ie(ue,i),i&&e(ua),i&&e(Fe),i&&e(Ea),i&&e(T),i&&e(Ta),i&&e(It),ie(De),i&&e(_a),i&&e(At),i&&e(Da),ie(be,i),i&&e(ma),i&&e(Jt),i&&e(ba),i&&e(Wt),ie(Oe),i&&e(ga),i&&e(Xt),i&&e(ad),i&&e(Ce),i&&e(dd),i&&e(Lt),ie(Me),i&&e(sd),i&&e(te),i&&e(rs),i&&e(xt),i&&e(ls),i&&e(ee),i&&e(os),i&&e(Ut),ie(Pe),i&&e(as),i&&e(Rt),i&&e(ds),i&&e(Ht),i&&e(ss),i&&e(qt),i&&e(fs),i&&e(ze),i&&e(is),i&&e(Ye),i&&e(ns),i&&e(Ft)}}}const GE={local:"token-merging",sections:[{local:"using-tome",title:"Using ToMe"},{local:"benchmarking-tomesd-with-stablediffusionpipeline",sections:[{local:"a100",title:"A100"},{local:"v100",title:"V100"}],title:"Benchmarking `tomesd` with `StableDiffusionPipeline`"},{local:"quality",title:"Quality"}],title:"Token Merging"};function zE(Kp){return LE(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class JE extends BE{constructor(Ct){super();CE(this,Ct,zE,UE,NE,{})}}export{JE as default,GE as metadata};
