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