import{s as Be,o as Oe}from"../chunks/scheduler.eb244325.js";import{S as Ue,i as Ae,e as l,s as i,c as f,h as Fe,a as s,d as n,b as a,f as ze,g as m,j as r,k as we,l as Ne,m as o,n as h,t as p,o as g,p as d,r as Re,u as Qe}from"../chunks/index.661680a1.js";import{T as Ye}from"../chunks/Tip.76637dd3.js";import{C as je,H as R,E as We}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.f2fe41ba.js";function De(Y){let u;return{c(){u=Re(`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){u=Qe(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,w){o(c,u,w)},d(c){c&&n(u)}}}function Ke(Y){let u,c,w,j,T,W,x,D,$,Te='<p>Text Generation Inference is in <a href="https://huggingface.co/docs/text-generation-inference/index" rel="nofollow">maintenance mode</a> as of 12/11/2025. This means that only pull requests for minor bug fixes, documentation improvements, and lightweight maintenance tasks will be accepted.</p> <p>For Inference Endpoints, we recommend using our available inference engine options, such as <a href="https://huggingface.co/docs/inference-endpoints/engines/vllm" rel="nofollow">vLLM</a> or <a href="https://huggingface.co/docs/inference-endpoints/engines/sglang" rel="nofollow">SGLang</a>, as alternatives.</p> <p>Below is a quick migration guide if you already have an Inference Endpoint deployed with TGI.</p>',K,v,Z,b,xe=`Here are the steps to migrate an Inference Endpoint from TGI to vLLM.
Since the Inference Engine cannot be changed on an existing Inference Endpoint, you must create a new one to complete the transition.`,J,I,ve="<li>Create a new Inference Endpoint with the same model, selecting vLLM as the Inference Engine. You can typically use the same hardware and configuration.</li> <li>Once the new Inference Endpoint is running, make a few test calls to ensure it functions correctly.</li> <li>Switch traffic from the old Inference Endpoint to the new one.</li> <li>Finally, pause or delete the old Inference Endpoint.</li>",V,k,X,L,be=`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:`,ee,M,Ie="<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>",te,C,ke=`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>`,ne,_,oe,G,Le=`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:`,ie,H,Me='<img src="https://raw.githubusercontent.com/huggingface/hf-endpoints-documentation/main/assets/tgi/tgi_config.png" alt="config"/>',ae,P,Ce=`<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>`,le,E,_e=`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>.`,se,q,re,S,Ge=`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.`,ue,y,ce,z,fe,B,He="You can find the models that are supported by TGI:",me,O,Pe='<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>',he,U,Ee=`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"/>`,pe,A,ge,F,qe='We also recommend reading the <a href="https://huggingface.co/docs/text-generation-inference" rel="nofollow">TGI documentation</a> for more in-depth information.',de,N,$e,Q,ye;return T=new je({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),x=new R({props:{title:"Text Generation Inference (TGI)",local:"text-generation-inference-tgi",headingTag:"h1"}}),v=new R({props:{title:"Migration Guide",local:"migration-guide",headingTag:"h2"}}),k=new R({props:{title:"Introduction",local:"introduction",headingTag:"h2"}}),_=new R({props:{title:"Configuration",local:"configuration",headingTag:"h2"}}),q=new R({props:{title:"Zero configuration",local:"zero-configuration",headingTag:"h2"}}),y=new Ye({props:{$$slots:{default:[De]},$$scope:{ctx:Y}}}),z=new R({props:{title:"Supported models",local:"supported-models",headingTag:"h2"}}),A=new R({props:{title:"References",local:"references",headingTag:"h2"}}),N=new We({props:{source:"https://github.com/huggingface/hf-endpoints-documentation/blob/main/docs/source/engines/tgi.md"}}),{c(){u=l("meta"),c=i(),w=l("p"),j=i(),f(T.$$.fragment),W=i(),f(x.$$.fragment),D=i(),$=l("blockquote"),$.innerHTML=Te,K=i(),f(v.$$.fragment),Z=i(),b=l("p"),b.textContent=xe,J=i(),I=l("ol"),I.innerHTML=ve,V=i(),f(k.$$.fragment),X=i(),L=l("p"),L.textContent=be,ee=i(),M=l("ul"),M.innerHTML=Ie,te=i(),C=l("p"),C.innerHTML=ke,ne=i(),f(_.$$.fragment),oe=i(),G=l("p"),G.innerHTML=Le,ie=i(),H=l("p"),H.innerHTML=Me,ae=i(),P=l("ul"),P.innerHTML=Ce,le=i(),E=l("p"),E.innerHTML=_e,se=i(),f(q.$$.fragment),re=i(),S=l("p"),S.textContent=Ge,ue=i(),f(y.$$.fragment),ce=i(),f(z.$$.fragment),fe=i(),B=l("p"),B.textContent=He,me=i(),O=l("ul"),O.innerHTML=Pe,he=i(),U=l("p"),U.innerHTML=Ee,pe=i(),f(A.$$.fragment),ge=i(),F=l("p"),F.innerHTML=qe,de=i(),f(N.$$.fragment),$e=i(),Q=l("p"),this.h()},l(e){const t=Fe("svelte-u9bgzb",document.head);u=s(t,"META",{name:!0,content:!0}),t.forEach(n),c=a(e),w=s(e,"P",{}),ze(w).forEach(n),j=a(e),m(T.$$.fragment,e),W=a(e),m(x.$$.fragment,e),D=a(e),$=s(e,"BLOCKQUOTE",{class:!0,"data-svelte-h":!0}),r($)!=="svelte-1xfuath"&&($.innerHTML=Te),K=a(e),m(v.$$.fragment,e),Z=a(e),b=s(e,"P",{"data-svelte-h":!0}),r(b)!=="svelte-tuab0f"&&(b.textContent=xe),J=a(e),I=s(e,"OL",{"data-svelte-h":!0}),r(I)!=="svelte-161a24c"&&(I.innerHTML=ve),V=a(e),m(k.$$.fragment,e),X=a(e),L=s(e,"P",{"data-svelte-h":!0}),r(L)!=="svelte-1j6m1nq"&&(L.textContent=be),ee=a(e),M=s(e,"UL",{"data-svelte-h":!0}),r(M)!=="svelte-lswtjz"&&(M.innerHTML=Ie),te=a(e),C=s(e,"P",{"data-svelte-h":!0}),r(C)!=="svelte-159wehp"&&(C.innerHTML=ke),ne=a(e),m(_.$$.fragment,e),oe=a(e),G=s(e,"P",{"data-svelte-h":!0}),r(G)!=="svelte-8ibp2c"&&(G.innerHTML=Le),ie=a(e),H=s(e,"P",{"data-svelte-h":!0}),r(H)!=="svelte-12tkryh"&&(H.innerHTML=Me),ae=a(e),P=s(e,"UL",{"data-svelte-h":!0}),r(P)!=="svelte-1vkh47x"&&(P.innerHTML=Ce),le=a(e),E=s(e,"P",{"data-svelte-h":!0}),r(E)!=="svelte-1b37qua"&&(E.innerHTML=_e),se=a(e),m(q.$$.fragment,e),re=a(e),S=s(e,"P",{"data-svelte-h":!0}),r(S)!=="svelte-1d6c15z"&&(S.textContent=Ge),ue=a(e),m(y.$$.fragment,e),ce=a(e),m(z.$$.fragment,e),fe=a(e),B=s(e,"P",{"data-svelte-h":!0}),r(B)!=="svelte-ta9nlr"&&(B.textContent=He),me=a(e),O=s(e,"UL",{"data-svelte-h":!0}),r(O)!=="svelte-9499tw"&&(O.innerHTML=Pe),he=a(e),U=s(e,"P",{"data-svelte-h":!0}),r(U)!=="svelte-1qn69p6"&&(U.innerHTML=Ee),pe=a(e),m(A.$$.fragment,e),ge=a(e),F=s(e,"P",{"data-svelte-h":!0}),r(F)!=="svelte-zwya3k"&&(F.innerHTML=qe),de=a(e),m(N.$$.fragment,e),$e=a(e),Q=s(e,"P",{}),ze(Q).forEach(n),this.h()},h(){we(u,"name","hf:doc:metadata"),we(u,"content",Ze),we($,"class","caution")},m(e,t){Ne(document.head,u),o(e,c,t),o(e,w,t),o(e,j,t),h(T,e,t),o(e,W,t),h(x,e,t),o(e,D,t),o(e,$,t),o(e,K,t),h(v,e,t),o(e,Z,t),o(e,b,t),o(e,J,t),o(e,I,t),o(e,V,t),h(k,e,t),o(e,X,t),o(e,L,t),o(e,ee,t),o(e,M,t),o(e,te,t),o(e,C,t),o(e,ne,t),h(_,e,t),o(e,oe,t),o(e,G,t),o(e,ie,t),o(e,H,t),o(e,ae,t),o(e,P,t),o(e,le,t),o(e,E,t),o(e,se,t),h(q,e,t),o(e,re,t),o(e,S,t),o(e,ue,t),h(y,e,t),o(e,ce,t),h(z,e,t),o(e,fe,t),o(e,B,t),o(e,me,t),o(e,O,t),o(e,he,t),o(e,U,t),o(e,pe,t),h(A,e,t),o(e,ge,t),o(e,F,t),o(e,de,t),h(N,e,t),o(e,$e,t),o(e,Q,t),ye=!0},p(e,[t]){const Se={};t&2&&(Se.$$scope={dirty:t,ctx:e}),y.$set(Se)},i(e){ye||(p(T.$$.fragment,e),p(x.$$.fragment,e),p(v.$$.fragment,e),p(k.$$.fragment,e),p(_.$$.fragment,e),p(q.$$.fragment,e),p(y.$$.fragment,e),p(z.$$.fragment,e),p(A.$$.fragment,e),p(N.$$.fragment,e),ye=!0)},o(e){g(T.$$.fragment,e),g(x.$$.fragment,e),g(v.$$.fragment,e),g(k.$$.fragment,e),g(_.$$.fragment,e),g(q.$$.fragment,e),g(y.$$.fragment,e),g(z.$$.fragment,e),g(A.$$.fragment,e),g(N.$$.fragment,e),ye=!1},d(e){e&&(n(c),n(w),n(j),n(W),n(D),n($),n(K),n(Z),n(b),n(J),n(I),n(V),n(X),n(L),n(ee),n(M),n(te),n(C),n(ne),n(oe),n(G),n(ie),n(H),n(ae),n(P),n(le),n(E),n(se),n(re),n(S),n(ue),n(ce),n(fe),n(B),n(me),n(O),n(he),n(U),n(pe),n(ge),n(F),n(de),n($e),n(Q)),n(u),d(T,e),d(x,e),d(v,e),d(k,e),d(_,e),d(q,e),d(y,e),d(z,e),d(A,e),d(N,e)}}}const Ze='{"title":"Text Generation Inference (TGI)","local":"text-generation-inference-tgi","sections":[{"title":"Migration Guide","local":"migration-guide","sections":[],"depth":2},{"title":"Introduction","local":"introduction","sections":[],"depth":2},{"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 Je(Y){return Oe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class nt extends Ue{constructor(u){super(),Ae(this,u,Je,Ke,Be,{})}}export{nt as component};
