import{s as rt,o as ot,n as K}from"../chunks/scheduler.182ea377.js";import{S as ct,i as Tt,g as f,s as c,r as h,A as wt,h as J,f as n,c as T,j as Mt,u,x as m,k as it,y as ft,a as p,v as U,d as j,t as C,w as I}from"../chunks/index.abf12888.js";import{C as L}from"../chunks/CodeBlock.57fe6e13.js";import{H as dt}from"../chunks/Heading.16916d63.js";import{H as Jt,a as q}from"../chunks/HfOption.fc88c804.js";function mt(y){let l,w="Accelerate <code>PixArtAlphaPipeline</code> with T-GATE:",d,s,M;return s=new L({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwUGl4QXJ0QWxwaGFQaXBlbGluZSUwQWZyb20lMjB0Z2F0ZSUyMGltcG9ydCUyMFRnYXRlUGl4QXJ0TG9hZGVyJTBBJTBBcGlwZSUyMCUzRCUyMFBpeEFydEFscGhhUGlwZWxpbmUuZnJvbV9wcmV0cmFpbmVkKCUyMlBpeEFydC1hbHBoYSUyRlBpeEFydC1YTC0yLTEwMjQtTVMlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmZsb2F0MTYpJTBBJTBBZ2F0ZV9zdGVwJTIwJTNEJTIwOCUwQWluZmVyZW5jZV9zdGVwJTIwJTNEJTIwMjUlMEFwaXBlJTIwJTNEJTIwVGdhdGVQaXhBcnRMb2FkZXIoJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwcGlwZSUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMGdhdGVfc3RlcCUzRGdhdGVfc3RlcCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0RpbmZlcmVuY2Vfc3RlcCUyQyUwQSkudG8oJTIyY3VkYSUyMiklMEElMEFpbWFnZSUyMCUzRCUyMHBpcGUudGdhdGUoJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIyQW4lMjBhbHBhY2ElMjBtYWRlJTIwb2YlMjBjb2xvcmZ1bCUyMGJ1aWxkaW5nJTIwYmxvY2tzJTJDJTIwY3liZXJwdW5rLiUyMiUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGdhdGVfc3RlcCUzRGdhdGVfc3RlcCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0RpbmZlcmVuY2Vfc3RlcCUyQyUwQSkuaW1hZ2VzJTVCMCU1RA==",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> PixArtAlphaPipeline
<span class="hljs-keyword">from</span> tgate <span class="hljs-keyword">import</span> TgatePixArtLoader

pipe = PixArtAlphaPipeline.from_pretrained(<span class="hljs-string">&quot;PixArt-alpha/PixArt-XL-2-1024-MS&quot;</span>, torch_dtype=torch.float16)

gate_step = <span class="hljs-number">8</span>
inference_step = <span class="hljs-number">25</span>
pipe = TgatePixArtLoader(
       pipe,
       gate_step=gate_step,
       num_inference_steps=inference_step,
).to(<span class="hljs-string">&quot;cuda&quot;</span>)

image = pipe.tgate(
       <span class="hljs-string">&quot;An alpaca made of colorful building blocks, cyberpunk.&quot;</span>,
        gate_step=gate_step,
       num_inference_steps=inference_step,
).images[<span class="hljs-number">0</span>]`,wrap:!1}}),{c(){l=f("p"),l.innerHTML=w,d=c(),h(s.$$.fragment)},l(e){l=J(e,"P",{"data-svelte-h":!0}),m(l)!=="svelte-10eb54u"&&(l.innerHTML=w),d=T(e),u(s.$$.fragment,e)},m(e,r){p(e,l,r),p(e,d,r),U(s,e,r),M=!0},p:K,i(e){M||(j(s.$$.fragment,e),M=!0)},o(e){C(s.$$.fragment,e),M=!1},d(e){e&&(n(l),n(d)),I(s,e)}}}function yt(y){let l,w="Accelerate <code>StableDiffusionXLPipeline</code> with T-GATE:",d,s,M;return s=new L({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJz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3N0ZXBzJTNEaW5mZXJlbmNlX3N0ZXAlMkMlMEEpLnRvKCUyMmN1ZGElMjIpJTBBJTBBaW1hZ2UlMjAlM0QlMjBwaXBlLnRnYXRlKCUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMkFzdHJvbmF1dCUyMGluJTIwYSUyMGp1bmdsZSUyQyUyMGNvbGQlMjBjb2xvciUyMHBhbGV0dGUlMkMlMjBtdXRlZCUyMGNvbG9ycyUyQyUyMGRldGFpbGVkJTJDJTIwOGsuJTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwZ2F0ZV9zdGVwJTNEZ2F0ZV9zdGVwJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwbnVtX2luZmVyZW5jZV9zdGVwcyUzRGluZmVyZW5jZV9zdGVwJTBBKS5pbWFnZXMlNUIwJTVE",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionXLPipeline
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DPMSolverMultistepScheduler
<span class="hljs-keyword">from</span> tgate <span class="hljs-keyword">import</span> TgateSDXLLoader

pipe = StableDiffusionXLPipeline.from_pretrained(
            <span class="hljs-string">&quot;stabilityai/stable-diffusion-xl-base-1.0&quot;</span>,
            torch_dtype=torch.float16,
            variant=<span class="hljs-string">&quot;fp16&quot;</span>,
            use_safetensors=<span class="hljs-literal">True</span>,
)
pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)

gate_step = <span class="hljs-number">10</span>
inference_step = <span class="hljs-number">25</span>
pipe = TgateSDXLLoader(
       pipe,
       gate_step=gate_step,
       num_inference_steps=inference_step,
).to(<span class="hljs-string">&quot;cuda&quot;</span>)

image = pipe.tgate(
        <span class="hljs-string">&quot;Astronaut in a jungle, cold color palette, muted colors, detailed, 8k.&quot;</span>,
        gate_step=gate_step,
        num_inference_steps=inference_step
).images[<span class="hljs-number">0</span>]`,wrap:!1}}),{c(){l=f("p"),l.innerHTML=w,d=c(),h(s.$$.fragment)},l(e){l=J(e,"P",{"data-svelte-h":!0}),m(l)!=="svelte-iys01i"&&(l.innerHTML=w),d=T(e),u(s.$$.fragment,e)},m(e,r){p(e,l,r),p(e,d,r),U(s,e,r),M=!0},p:K,i(e){M||(j(s.$$.fragment,e),M=!0)},o(e){C(s.$$.fragment,e),M=!1},d(e){e&&(n(l),n(d)),I(s,e)}}}function ht(y){let l,w='Accelerate <code>StableDiffusionXLPipeline</code> with <a href="https://github.com/horseee/DeepCache" rel="nofollow">DeepCache</a> and T-GATE:',d,s,M;return s=new L({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwU3RhYmxlRGlmZnVzaW9uWExQaXBlbGluZSUwQWZyb20lMjBkaWZmdXNlcnMlMjBpbXBvcnQlMjBEUE1Tb2x2ZXJNdWx0aXN0ZXBTY2hlZHVsZXIlMEFmcm9tJTIwdGdhdGUlMjBpbXBvcnQlMjBUZ2F0ZVNEWExEZWVwQ2FjaGVMb2FkZXIlMEElMEFwaXBlJTIwJTNEJTIwU3RhYmxlRGlmZnVzaW9uWExQaXBlbGluZS5mcm9tX3ByZXRyYWluZWQoJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIyc3RhYmlsaXR5YWklMkZzdGFibGUtZGlmZnVzaW9uLXhsLWJhc2UtMS4wJTIyJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwdG9yY2hfZHR5cGUlM0R0b3JjaC5mbG9hdDE2JTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwdmFyaWFudCUzRCUyMmZwMTYlMjIlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjB1c2Vfc2FmZXRlbnNvcnMlM0RUcnVlJTJDJTBBKSUwQXBpcGUuc2NoZWR1bGVyJTIwJTNEJTIwRFBNU29sdmVyTXVsdGlzdGVwU2NoZWR1bGVyLmZyb21fY29uZmlnKHBpcGUuc2NoZWR1bGVyLmNvbmZpZyklMEElMEFnYXRlX3N0ZXAlMjAlM0QlMjAxMCUwQWluZmVyZW5jZV9zdGVwJTIwJTNEJTIwMjUlMEFwaXBlJTIwJTNEJTIwVGdhdGVTRFhMRGVlcENhY2hlTG9hZGVyKCUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMHBpcGUlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjBjYWNoZV9pbnRlcnZhbCUzRDMlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjBjYWNoZV9icmFuY2hfaWQlM0QwJTJDJTBBKS50byglMjJjdWRhJTIyKSUwQSUwQWltYWdlJTIwJTNEJTIwcGlwZS50Z2F0ZSglMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJBc3Ryb25hdXQlMjBpbiUyMGElMjBqdW5nbGUlMkMlMjBjb2xkJTIwY29sb3IlMjBwYWxldHRlJTJDJTIwbXV0ZWQlMjBjb2xvcnMlMkMlMjBkZXRhaWxlZCUyQyUyMDhrLiUyMiUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGdhdGVfc3RlcCUzRGdhdGVfc3RlcCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0RpbmZlcmVuY2Vfc3RlcCUwQSkuaW1hZ2VzJTVCMCU1RA==",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionXLPipeline
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DPMSolverMultistepScheduler
<span class="hljs-keyword">from</span> tgate <span class="hljs-keyword">import</span> TgateSDXLDeepCacheLoader

pipe = StableDiffusionXLPipeline.from_pretrained(
            <span class="hljs-string">&quot;stabilityai/stable-diffusion-xl-base-1.0&quot;</span>,
            torch_dtype=torch.float16,
            variant=<span class="hljs-string">&quot;fp16&quot;</span>,
            use_safetensors=<span class="hljs-literal">True</span>,
)
pipe.scheduler = DPMSolverMultistepScheduler.from_config(pipe.scheduler.config)

gate_step = <span class="hljs-number">10</span>
inference_step = <span class="hljs-number">25</span>
pipe = TgateSDXLDeepCacheLoader(
       pipe,
       cache_interval=<span class="hljs-number">3</span>,
       cache_branch_id=<span class="hljs-number">0</span>,
).to(<span class="hljs-string">&quot;cuda&quot;</span>)

image = pipe.tgate(
        <span class="hljs-string">&quot;Astronaut in a jungle, cold color palette, muted colors, detailed, 8k.&quot;</span>,
        gate_step=gate_step,
        num_inference_steps=inference_step
).images[<span class="hljs-number">0</span>]`,wrap:!1}}),{c(){l=f("p"),l.innerHTML=w,d=c(),h(s.$$.fragment)},l(e){l=J(e,"P",{"data-svelte-h":!0}),m(l)!=="svelte-tcx4pu"&&(l.innerHTML=w),d=T(e),u(s.$$.fragment,e)},m(e,r){p(e,l,r),p(e,d,r),U(s,e,r),M=!0},p:K,i(e){M||(j(s.$$.fragment,e),M=!0)},o(e){C(s.$$.fragment,e),M=!1},d(e){e&&(n(l),n(d)),I(s,e)}}}function ut(y){let l,w="Accelerate <code>latent-consistency/lcm-sdxl</code> with T-GATE:",d,s,M;return s=new L({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwZGlmZnVzZXJzJTIwaW1wb3J0JTIwU3RhYmxlRGlmZnVzaW9uWExQaXBlbGluZSUwQWZyb20lMjBkaWZmdXNlcnMlMjBpbXBvcnQlMjBVTmV0MkRDb25kaXRpb25Nb2RlbCUyQyUyMExDTVNjaGVkdWxlciUwQWZyb20lMjBkaWZmdXNlcnMlMjBpbXBvcnQlMjBEUE1Tb2x2ZXJNdWx0aXN0ZXBTY2hlZHVsZXIlMEFmcm9tJTIwdGdhdGUlMjBpb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AlMjAlMjBsY20lM0RUcnVlJTBBKS50byglMjJjdWRhJTIyKSUwQSUwQWltYWdlJTIwJTNEJTIwcGlwZS50Z2F0ZSglMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJBc3Ryb25hdXQlMjBpbiUyMGElMjBqdW5nbGUlMkMlMjBjb2xkJTIwY29sb3IlMjBwYWxldHRlJTJDJTIwbXV0ZWQlMjBjb2xvcnMlMkMlMjBkZXRhaWxlZCUyQyUyMDhrLiUyMiUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGdhdGVfc3RlcCUzRGdhdGVfc3RlcCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMG51bV9pbmZlcmVuY2Vfc3RlcHMlM0RpbmZlcmVuY2Vfc3RlcCUwQSkuaW1hZ2VzJTVCMCU1RA==",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> StableDiffusionXLPipeline
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> UNet2DConditionModel, LCMScheduler
<span class="hljs-keyword">from</span> diffusers <span class="hljs-keyword">import</span> DPMSolverMultistepScheduler
<span class="hljs-keyword">from</span> tgate <span class="hljs-keyword">import</span> TgateSDXLLoader

unet = UNet2DConditionModel.from_pretrained(
    <span class="hljs-string">&quot;latent-consistency/lcm-sdxl&quot;</span>,
    torch_dtype=torch.float16,
    variant=<span class="hljs-string">&quot;fp16&quot;</span>,
)
pipe = StableDiffusionXLPipeline.from_pretrained(
    <span class="hljs-string">&quot;stabilityai/stable-diffusion-xl-base-1.0&quot;</span>,
    unet=unet,
    torch_dtype=torch.float16,
    variant=<span class="hljs-string">&quot;fp16&quot;</span>,
)
pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config)

gate_step = <span class="hljs-number">1</span>
inference_step = <span class="hljs-number">4</span>
pipe = TgateSDXLLoader(
       pipe,
       gate_step=gate_step,
       num_inference_steps=inference_step,
       lcm=<span class="hljs-literal">True</span>
).to(<span class="hljs-string">&quot;cuda&quot;</span>)

image = pipe.tgate(
        <span class="hljs-string">&quot;Astronaut in a jungle, cold color palette, muted colors, detailed, 8k.&quot;</span>,
        gate_step=gate_step,
        num_inference_steps=inference_step
).images[<span class="hljs-number">0</span>]`,wrap:!1}}),{c(){l=f("p"),l.innerHTML=w,d=c(),h(s.$$.fragment)},l(e){l=J(e,"P",{"data-svelte-h":!0}),m(l)!=="svelte-13iqzli"&&(l.innerHTML=w),d=T(e),u(s.$$.fragment,e)},m(e,r){p(e,l,r),p(e,d,r),U(s,e,r),M=!0},p:K,i(e){M||(j(s.$$.fragment,e),M=!0)},o(e){C(s.$$.fragment,e),M=!1},d(e){e&&(n(l),n(d)),I(s,e)}}}function Ut(y){let l,w,d,s,M,e,r,G;return l=new q({props:{id:"pipelines",option:"PixArt",$$slots:{default:[mt]},$$scope:{ctx:y}}}),d=new q({props:{id:"pipelines",option:"Stable Diffusion XL",$$slots:{default:[yt]},$$scope:{ctx:y}}}),M=new q({props:{id:"pipelines",option:"StableDiffusionXL with DeepCache",$$slots:{default:[ht]},$$scope:{ctx:y}}}),r=new q({props:{id:"pipelines",option:"Latent Consistency Model",$$slots:{default:[ut]},$$scope:{ctx:y}}}),{c(){h(l.$$.fragment),w=c(),h(d.$$.fragment),s=c(),h(M.$$.fragment),e=c(),h(r.$$.fragment)},l(a){u(l.$$.fragment,a),w=T(a),u(d.$$.fragment,a),s=T(a),u(M.$$.fragment,a),e=T(a),u(r.$$.fragment,a)},m(a,o){U(l,a,o),p(a,w,o),U(d,a,o),p(a,s,o),U(M,a,o),p(a,e,o),U(r,a,o),G=!0},p(a,o){const _={};o&2&&(_.$$scope={dirty:o,ctx:a}),l.$set(_);const B={};o&2&&(B.$$scope={dirty:o,ctx:a}),d.$set(B);const b={};o&2&&(b.$$scope={dirty:o,ctx:a}),M.$set(b);const A={};o&2&&(A.$$scope={dirty:o,ctx:a}),r.$set(A)},i(a){G||(j(l.$$.fragment,a),j(d.$$.fragment,a),j(M.$$.fragment,a),j(r.$$.fragment,a),G=!0)},o(a){C(l.$$.fragment,a),C(d.$$.fragment,a),C(M.$$.fragment,a),C(r.$$.fragment,a),G=!1},d(a){a&&(n(w),n(s),n(e)),I(l,a),I(d,a),I(M,a),I(r,a)}}}function jt(y){let l,w,d,s,M,e,r,G='<a href="https://github.com/HaozheLiu-ST/T-GATE/tree/main" rel="nofollow">T-GATE</a> accelerates inference for <a href="../api/pipelines/stable_diffusion/overview">Stable Diffusion</a>, <a href="../api/pipelines/pixart">PixArt</a>, and <a href="../api/pipelines/latent_consistency_models.md">Latency Consistency Model</a> pipelines by skipping the cross-attention calculation once it converges. This method doesn’t require any additional training and it can speed up inference from 10-50%. T-GATE is also compatible with other optimization methods like <a href="./deepcache">DeepCache</a>.',a,o,_="Before you begin, make sure you install T-GATE.",B,b,A,V,O="To use T-GATE with a pipeline, you need to use its corresponding loader.",x,X,tt="<thead><tr><th>Pipeline</th> <th>T-GATE Loader</th></tr></thead> <tbody><tr><td>PixArt</td> <td>TgatePixArtLoader</td></tr> <tr><td>Stable Diffusion XL</td> <td>TgateSDXLLoader</td></tr> <tr><td>Stable Diffusion XL + DeepCache</td> <td>TgateSDXLDeepCacheLoader</td></tr> <tr><td>Stable Diffusion</td> <td>TgateSDLoader</td></tr> <tr><td>Stable Diffusion + DeepCache</td> <td>TgateSDDeepCacheLoader</td></tr></tbody>",D,E,et="Next, create a <code>TgateLoader</code> with a pipeline, the gate step (the time step to stop calculating the cross attention), and the number of inference steps. Then call the <code>tgate</code> method on the pipeline with a prompt, gate step, and the number of inference steps.",Q,$,lt="Let’s see how to enable this for several different pipelines.",Y,Z,F,g,st='T-GATE also supports <a href="/docs/diffusers/main/en/api/pipelines/stable_diffusion/text2img#diffusers.StableDiffusionPipeline">StableDiffusionPipeline</a> and <a href="https://hf.co/PixArt-alpha/PixArt-LCM-XL-2-1024-MS" rel="nofollow">PixArt-alpha/PixArt-LCM-XL-2-1024-MS</a>.',N,R,v,W,at="<thead><tr><th>Model</th> <th>MACs</th> <th>Param</th> <th>Latency</th> <th>Zero-shot 10K-FID on MS-COCO</th></tr></thead> <tbody><tr><td>SD-1.5</td> <td>16.938T</td> <td>859.520M</td> <td>7.032s</td> <td>23.927</td></tr> <tr><td>SD-1.5 w/ T-GATE</td> <td>9.875T</td> <td>815.557M</td> <td>4.313s</td> <td>20.789</td></tr> <tr><td>SD-2.1</td> <td>38.041T</td> <td>865.785M</td> <td>16.121s</td> <td>22.609</td></tr> <tr><td>SD-2.1 w/ T-GATE</td> <td>22.208T</td> <td>815.433 M</td> <td>9.878s</td> <td>19.940</td></tr> <tr><td>SD-XL</td> <td>149.438T</td> <td>2.570B</td> <td>53.187s</td> <td>24.628</td></tr> <tr><td>SD-XL w/ T-GATE</td> <td>84.438T</td> <td>2.024B</td> <td>27.932s</td> <td>22.738</td></tr> <tr><td>Pixart-Alpha</td> <td>107.031T</td> <td>611.350M</td> <td>61.502s</td> <td>38.669</td></tr> <tr><td>Pixart-Alpha w/ T-GATE</td> <td>65.318T</td> <td>462.585M</td> <td>37.867s</td> <td>35.825</td></tr> <tr><td>DeepCache (SD-XL)</td> <td>57.888T</td> <td>-</td> <td>19.931s</td> <td>23.755</td></tr> <tr><td>DeepCache w/ T-GATE</td> <td>43.868T</td> <td>-</td> <td>14.666s</td> <td>23.999</td></tr> <tr><td>LCM (SD-XL)</td> <td>11.955T</td> <td>2.570B</td> <td>3.805s</td> <td>25.044</td></tr> <tr><td>LCM w/ T-GATE</td> <td>11.171T</td> <td>2.024B</td> <td>3.533s</td> <td>25.028</td></tr> <tr><td>LCM (Pixart-Alpha)</td> <td>8.563T</td> <td>611.350M</td> <td>4.733s</td> <td>36.086</td></tr> <tr><td>LCM w/ T-GATE</td> <td>7.623T</td> <td>462.585M</td> <td>4.543s</td> <td>37.048</td></tr></tbody>",z,S,nt='The latency is tested on an NVIDIA 1080TI, MACs and Params are calculated with <a href="https://github.com/MrYxJ/calculate-flops.pytorch" rel="nofollow">calflops</a>, and the FID is calculated with <a href="https://github.com/mseitzer/pytorch-fid" rel="nofollow">PytorchFID</a>.',H,k,P;return M=new dt({props:{title:"T-GATE",local:"t-gate",headingTag:"h1"}}),b=new L({props:{code:"cGlwJTIwaW5zdGFsbCUyMHRnYXRlJTBBcGlwJTIwaW5zdGFsbCUyMC1VJTIwcHl0b3JjaCUyMGRpZmZ1c2VycyUyMHRyYW5zZm9ybWVycyUyMGFjY2VsZXJhdGUlMjBEZWVwQ2FjaGU=",highlighted:`pip install tgate
pip install -U pytorch diffusers transformers accelerate DeepCache`,wrap:!1}}),Z=new Jt({props:{id:"pipelines",options:["PixArt","Stable Diffusion XL","StableDiffusionXL with DeepCache","Latent Consistency Model"],$$slots:{default:[Ut]},$$scope:{ctx:y}}}),R=new dt({props:{title:"Benchmarks",local:"benchmarks",headingTag:"h2"}}),{c(){l=f("meta"),w=c(),d=f("p"),s=c(),h(M.$$.fragment),e=c(),r=f("p"),r.innerHTML=G,a=c(),o=f("p"),o.textContent=_,B=c(),h(b.$$.fragment),A=c(),V=f("p"),V.textContent=O,x=c(),X=f("table"),X.innerHTML=tt,D=c(),E=f("p"),E.innerHTML=et,Q=c(),$=f("p"),$.textContent=lt,Y=c(),h(Z.$$.fragment),F=c(),g=f("p"),g.innerHTML=st,N=c(),h(R.$$.fragment),v=c(),W=f("table"),W.innerHTML=at,z=c(),S=f("p"),S.innerHTML=nt,H=c(),k=f("p"),this.h()},l(t){const i=wt("svelte-u9bgzb",document.head);l=J(i,"META",{name:!0,content:!0}),i.forEach(n),w=T(t),d=J(t,"P",{}),Mt(d).forEach(n),s=T(t),u(M.$$.fragment,t),e=T(t),r=J(t,"P",{"data-svelte-h":!0}),m(r)!=="svelte-1qox7gi"&&(r.innerHTML=G),a=T(t),o=J(t,"P",{"data-svelte-h":!0}),m(o)!=="svelte-rx8j02"&&(o.textContent=_),B=T(t),u(b.$$.fragment,t),A=T(t),V=J(t,"P",{"data-svelte-h":!0}),m(V)!=="svelte-113mmog"&&(V.textContent=O),x=T(t),X=J(t,"TABLE",{"data-svelte-h":!0}),m(X)!=="svelte-17jk9ut"&&(X.innerHTML=tt),D=T(t),E=J(t,"P",{"data-svelte-h":!0}),m(E)!=="svelte-1uere4x"&&(E.innerHTML=et),Q=T(t),$=J(t,"P",{"data-svelte-h":!0}),m($)!=="svelte-1tyd5nl"&&($.textContent=lt),Y=T(t),u(Z.$$.fragment,t),F=T(t),g=J(t,"P",{"data-svelte-h":!0}),m(g)!=="svelte-1prc9kg"&&(g.innerHTML=st),N=T(t),u(R.$$.fragment,t),v=T(t),W=J(t,"TABLE",{"data-svelte-h":!0}),m(W)!=="svelte-7mhhwa"&&(W.innerHTML=at),z=T(t),S=J(t,"P",{"data-svelte-h":!0}),m(S)!=="svelte-17hd8in"&&(S.innerHTML=nt),H=T(t),k=J(t,"P",{}),Mt(k).forEach(n),this.h()},h(){it(l,"name","hf:doc:metadata"),it(l,"content",Ct)},m(t,i){ft(document.head,l),p(t,w,i),p(t,d,i),p(t,s,i),U(M,t,i),p(t,e,i),p(t,r,i),p(t,a,i),p(t,o,i),p(t,B,i),U(b,t,i),p(t,A,i),p(t,V,i),p(t,x,i),p(t,X,i),p(t,D,i),p(t,E,i),p(t,Q,i),p(t,$,i),p(t,Y,i),U(Z,t,i),p(t,F,i),p(t,g,i),p(t,N,i),U(R,t,i),p(t,v,i),p(t,W,i),p(t,z,i),p(t,S,i),p(t,H,i),p(t,k,i),P=!0},p(t,[i]){const pt={};i&2&&(pt.$$scope={dirty:i,ctx:t}),Z.$set(pt)},i(t){P||(j(M.$$.fragment,t),j(b.$$.fragment,t),j(Z.$$.fragment,t),j(R.$$.fragment,t),P=!0)},o(t){C(M.$$.fragment,t),C(b.$$.fragment,t),C(Z.$$.fragment,t),C(R.$$.fragment,t),P=!1},d(t){t&&(n(w),n(d),n(s),n(e),n(r),n(a),n(o),n(B),n(A),n(V),n(x),n(X),n(D),n(E),n(Q),n($),n(Y),n(F),n(g),n(N),n(v),n(W),n(z),n(S),n(H),n(k)),n(l),I(M,t),I(b,t),I(Z,t),I(R,t)}}}const Ct='{"title":"T-GATE","local":"t-gate","sections":[{"title":"Benchmarks","local":"benchmarks","sections":[],"depth":2}],"depth":1}';function It(y){return ot(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Vt extends ct{constructor(l){super(),Tt(this,l,It,jt,rt,{})}}export{Vt as component};
