import{s as ke,o as Ie}from"../chunks/scheduler.eb244325.js";import{S as _e,i as Le,e as s,s as i,c as f,h as Me,a as l,d as n,b as a,f as ve,g as h,j as u,k as be,l as Ce,m as o,n as p,t as g,o as d,p as y,r as Pe,u as Ge}from"../chunks/index.661680a1.js";import{T as He}from"../chunks/Tip.76637dd3.js";import{C as qe,H as A,E as Se}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.338b442f.js";function ze(O){let r;return{c(){r=Pe(`Note that there's a caveat: say you're deploying \`meta-llama/Llama-3.3-70B-Instruct\`, which has a context length of 128k tokens.
But you're on a GPU where you can only fit the model's context three times in memory. So if you want to serve the model with full context length,
you can only serve up to 3 concurrent requests. In some cases, it's fine to drop the maximum context length to 64k tokens, which would
allow the server to process 6 concurrent requests.
You can configure this by setting max input length to 64k and then let TGI auto-configure the rest.`)},l(c){r=Ge(c,`Note that there's a caveat: say you're deploying \`meta-llama/Llama-3.3-70B-Instruct\`, which has a context length of 128k tokens.
But you're on a GPU where you can only fit the model's context three times in memory. So if you want to serve the model with full context length,
you can only serve up to 3 concurrent requests. In some cases, it's fine to drop the maximum context length to 64k tokens, which would
allow the server to process 6 concurrent requests.
You can configure this by setting max input length to 64k and then let TGI auto-configure the rest.`)},m(c,$){o(c,r,$)},d(c){c&&n(r)}}}function Be(O){let r,c,$,N,T,R,x,F,w,ue=`TGI is a production-grade inference engine built in Rust and Python, designed for high-performance
serving of open-source LLMs (e.g. LLaMA, Falcon, StarCoder, BLOOM and many more).
The core features that make TGI a good choice are:`,j,v,ce="<li><strong>Continuous batching + streaming</strong>: Dynamically groups in-flight requests and streams tokens via Server-Sent Events (SSE)</li> <li><strong>Optimized attention &amp; decoding</strong>: TGI uses Flash Attention, Paged Attention, KV-caching, and custom CUDA kernels for latency and memory efficiency</li> <li><strong>Quantization &amp; weight loading speed</strong>: Supports quantizations methods like bitsandbytes and GPTQ and uses Safetensors to reduce load times</li> <li><strong>Production readiness</strong>: Fully OpenAI-compatible <code>/v1/chat</code> or <code>/v1/completions</code> APIs, Prometheus metrics, OpenTelemetry tracing, watermarking, logit controls, JSON schema guidance</li>",Q,b,me=`By default, the TGI version will be the latest available one (with some delay). But you can also specify a different version by <a href="https://raw.githubusercontent.com/not-here" rel="nofollow">changing
the container URL</a>`,W,k,Y,I,fe=`When selecting a model to deploy, the Inference Endpoints UI automatically checks whether a model is supported by TGI. If it is, you’ll see
the option presented under <code>Container Configuration</code> where you can change the following settings:`,D,_,he='<img src="https://raw.githubusercontent.com/huggingface/hf-endpoints-documentation/main/assets/tgi/tgi_config.png" alt="config"/>',Z,L,pe=`<li><strong>Quantization</strong>: Which quantization method, if any, to use for the model.</li> <li><strong>Max Number of Tokens (per query)</strong>: Changes the maximum amount of tokens a request can contain.
For example a value of <code>1512</code> means users can send either a prompt of <code>1000</code> tokens and generate <code>512</code> new tokens,
or send a prompt of <code>1</code> token and generate <code>1511</code> new tokens. The larger this value, the larger amount each request
will be in your RAM and the less effective batching can be.</li> <li><strong>Max Input Tokens (per query)</strong>: The maximum number of input tokens, meaning the amount of tokens in the prompt.</li> <li><strong>Max Batch Prefill Tokens</strong>: Limits the number of tokens for the prefill operation. Prefill tokens are the ones sent in with the user prompt.</li> <li><strong>Max Batch Total Tokens</strong>: This changes the total amount of potential tokens within a batch. Together with <code>Max Number of Tokens</code>,
this determines how many concurrent requests you can serve. If you set <code>Max Number of Tokens</code> to 100 and <code>Max Batch Total Tokens</code> to 100 as well,
you can only serve one request at a time.</li>`,J,M,ge=`In general zero-configuration (see below) is recommended for most cases. TGI supports several other configuration parameters and you’ll find a complete list
in the <a href="https://huggingface.co/docs/text-generation-inference/reference/launcher#text-generation-launcher-arguments" rel="nofollow">TGI documentation</a>. These can all be
set by passing the values as environment variables to the container, <a href="https://huggingface.co/no-link-yet" rel="nofollow">link to guide</a>.`,K,C,V,P,de=`Introduced in TGI v3, the zero-config mode helps you get the most out of your hardware without manual configuration and trial & error.
If you leave the values undefined, TGI will on server startup automatically (based on the hardware it’s running on) select the maximal possible values
for the max input lenght, max number of tokens, max batch prefill tokens and max batch total tokens. This means that you’ll use your hardware to it’s full capacity.`,X,m,ee,G,te,H,ye="You can find the models that are supported by TGI:",ne,q,$e='<li>Browse supported models on the <a href="https://huggingface.co/models?apps=tgi&amp;sort=trending" rel="nofollow">Hugging Face Hub</a></li> <li>In the TGI documentation under the <a href="https://huggingface.co/docs/text-generation-inference/supported_models" rel="nofollow">supported models</a> section</li> <li>A selection of popular models in the <a href="https://endpoints.huggingface.co/huggingface/catalog" rel="nofollow">Inference Endpoints Catalog</a></li>',oe,S,Te=`If a model is supported by TGI, the Inference Endpoints UI will indicate this by disabling/enabling the selection under <code>Container Type</code> configuration.
<img src="https://raw.githubusercontent.com/huggingface/hf-endpoints-documentation/main/assets/tgi/tgi_selection.png" alt="selection"/>`,ie,z,ae,B,xe='We also recommend reading the <a href="https://huggingface.co/docs/text-generation-inference" rel="nofollow">TGI documentation</a> for more in-depth information.',se,E,le,U,re;return T=new qe({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),x=new A({props:{title:"Text Generation Inference (TGI)",local:"text-generation-inference-tgi",headingTag:"h1"}}),k=new A({props:{title:"Configuration",local:"configuration",headingTag:"h2"}}),C=new A({props:{title:"Zero configuration",local:"zero-configuration",headingTag:"h2"}}),m=new He({props:{$$slots:{default:[ze]},$$scope:{ctx:O}}}),G=new A({props:{title:"Supported models",local:"supported-models",headingTag:"h2"}}),z=new A({props:{title:"References",local:"references",headingTag:"h2"}}),E=new Se({props:{source:"https://github.com/huggingface/hf-endpoints-documentation/blob/main/docs/source/engines/tgi.md"}}),{c(){r=s("meta"),c=i(),$=s("p"),N=i(),f(T.$$.fragment),R=i(),f(x.$$.fragment),F=i(),w=s("p"),w.textContent=ue,j=i(),v=s("ul"),v.innerHTML=ce,Q=i(),b=s("p"),b.innerHTML=me,W=i(),f(k.$$.fragment),Y=i(),I=s("p"),I.innerHTML=fe,D=i(),_=s("p"),_.innerHTML=he,Z=i(),L=s("ul"),L.innerHTML=pe,J=i(),M=s("p"),M.innerHTML=ge,K=i(),f(C.$$.fragment),V=i(),P=s("p"),P.textContent=de,X=i(),f(m.$$.fragment),ee=i(),f(G.$$.fragment),te=i(),H=s("p"),H.textContent=ye,ne=i(),q=s("ul"),q.innerHTML=$e,oe=i(),S=s("p"),S.innerHTML=Te,ie=i(),f(z.$$.fragment),ae=i(),B=s("p"),B.innerHTML=xe,se=i(),f(E.$$.fragment),le=i(),U=s("p"),this.h()},l(e){const t=Me("svelte-u9bgzb",document.head);r=l(t,"META",{name:!0,content:!0}),t.forEach(n),c=a(e),$=l(e,"P",{}),ve($).forEach(n),N=a(e),h(T.$$.fragment,e),R=a(e),h(x.$$.fragment,e),F=a(e),w=l(e,"P",{"data-svelte-h":!0}),u(w)!=="svelte-1j6m1nq"&&(w.textContent=ue),j=a(e),v=l(e,"UL",{"data-svelte-h":!0}),u(v)!=="svelte-lswtjz"&&(v.innerHTML=ce),Q=a(e),b=l(e,"P",{"data-svelte-h":!0}),u(b)!=="svelte-159wehp"&&(b.innerHTML=me),W=a(e),h(k.$$.fragment,e),Y=a(e),I=l(e,"P",{"data-svelte-h":!0}),u(I)!=="svelte-8ibp2c"&&(I.innerHTML=fe),D=a(e),_=l(e,"P",{"data-svelte-h":!0}),u(_)!=="svelte-12tkryh"&&(_.innerHTML=he),Z=a(e),L=l(e,"UL",{"data-svelte-h":!0}),u(L)!=="svelte-1vkh47x"&&(L.innerHTML=pe),J=a(e),M=l(e,"P",{"data-svelte-h":!0}),u(M)!=="svelte-1b37qua"&&(M.innerHTML=ge),K=a(e),h(C.$$.fragment,e),V=a(e),P=l(e,"P",{"data-svelte-h":!0}),u(P)!=="svelte-1d6c15z"&&(P.textContent=de),X=a(e),h(m.$$.fragment,e),ee=a(e),h(G.$$.fragment,e),te=a(e),H=l(e,"P",{"data-svelte-h":!0}),u(H)!=="svelte-ta9nlr"&&(H.textContent=ye),ne=a(e),q=l(e,"UL",{"data-svelte-h":!0}),u(q)!=="svelte-9499tw"&&(q.innerHTML=$e),oe=a(e),S=l(e,"P",{"data-svelte-h":!0}),u(S)!=="svelte-1qn69p6"&&(S.innerHTML=Te),ie=a(e),h(z.$$.fragment,e),ae=a(e),B=l(e,"P",{"data-svelte-h":!0}),u(B)!=="svelte-zwya3k"&&(B.innerHTML=xe),se=a(e),h(E.$$.fragment,e),le=a(e),U=l(e,"P",{}),ve(U).forEach(n),this.h()},h(){be(r,"name","hf:doc:metadata"),be(r,"content",Ee)},m(e,t){Ce(document.head,r),o(e,c,t),o(e,$,t),o(e,N,t),p(T,e,t),o(e,R,t),p(x,e,t),o(e,F,t),o(e,w,t),o(e,j,t),o(e,v,t),o(e,Q,t),o(e,b,t),o(e,W,t),p(k,e,t),o(e,Y,t),o(e,I,t),o(e,D,t),o(e,_,t),o(e,Z,t),o(e,L,t),o(e,J,t),o(e,M,t),o(e,K,t),p(C,e,t),o(e,V,t),o(e,P,t),o(e,X,t),p(m,e,t),o(e,ee,t),p(G,e,t),o(e,te,t),o(e,H,t),o(e,ne,t),o(e,q,t),o(e,oe,t),o(e,S,t),o(e,ie,t),p(z,e,t),o(e,ae,t),o(e,B,t),o(e,se,t),p(E,e,t),o(e,le,t),o(e,U,t),re=!0},p(e,[t]){const we={};t&2&&(we.$$scope={dirty:t,ctx:e}),m.$set(we)},i(e){re||(g(T.$$.fragment,e),g(x.$$.fragment,e),g(k.$$.fragment,e),g(C.$$.fragment,e),g(m.$$.fragment,e),g(G.$$.fragment,e),g(z.$$.fragment,e),g(E.$$.fragment,e),re=!0)},o(e){d(T.$$.fragment,e),d(x.$$.fragment,e),d(k.$$.fragment,e),d(C.$$.fragment,e),d(m.$$.fragment,e),d(G.$$.fragment,e),d(z.$$.fragment,e),d(E.$$.fragment,e),re=!1},d(e){e&&(n(c),n($),n(N),n(R),n(F),n(w),n(j),n(v),n(Q),n(b),n(W),n(Y),n(I),n(D),n(_),n(Z),n(L),n(J),n(M),n(K),n(V),n(P),n(X),n(ee),n(te),n(H),n(ne),n(q),n(oe),n(S),n(ie),n(ae),n(B),n(se),n(le),n(U)),n(r),y(T,e),y(x,e),y(k,e),y(C,e),y(m,e),y(G,e),y(z,e),y(E,e)}}}const Ee='{"title":"Text Generation Inference (TGI)","local":"text-generation-inference-tgi","sections":[{"title":"Configuration","local":"configuration","sections":[],"depth":2},{"title":"Zero configuration","local":"zero-configuration","sections":[],"depth":2},{"title":"Supported models","local":"supported-models","sections":[],"depth":2},{"title":"References","local":"references","sections":[],"depth":2}],"depth":1}';function Ue(O){return Ie(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Fe extends _e{constructor(r){super(),Le(this,r,Ue,Be,ke,{})}}export{Fe as component};
