import{s as lt,n as ot,o as st}from"../chunks/scheduler.9bc65507.js";import{S as ht,i as ut,g as a,s as l,u as V,A as ft,h as r,f as t,c as o,j as u,v as Y,y as f,k as s,o as h,a as i,w as Z,d as ee,t as te,x as ne}from"../chunks/index.78c82d43.js";import{I as ie}from"../chunks/IconCopyLink.bedaa44d.js";function pt(He){let p,ae,j,re,c,_,B,C,ke,z,Le="Performance and Scalability",le,b,Me=`Training large transformer models and deploying them to production present various challenges.<br/>
During training, the model may require more GPU memory than available or exhibit slow training speed. In the deployment
phase, the model can struggle to handle the required throughput in a production environment.`,oe,$,Ie=`This documentation aims to assist you in overcoming these challenges and finding the optimal setting for your use-case.
The guides are divided into training and inference sections, as each comes with different challenges and solutions.
Within each section you’ll find separate guides for different hardware configurations, such as single GPU vs. multi-GPU
for training or CPU vs. GPU for inference.`,se,U,Ne="Use this document as your starting point to navigate further to the methods that match your scenario.",he,d,w,D,T,Ae,W,qe="Training",ue,k,ze=`Training large transformer models efficiently requires an accelerator such as a GPU or TPU. The most common case is where
you have a single GPU. The methods that you can apply to improve training efficiency on a single GPU extend to other setups
such as multiple GPU. However, there are also techniques that are specific to multi-GPU or CPU training. We cover them in
separate sections.`,fe,A,We='<li><a href="perf_train_gpu_one">Methods and tools for efficient training on a single GPU</a>: start here to learn common approaches that can help optimize GPU memory utilization, speed up the training, or both.</li> <li><a href="perf_train_gpu_many">Multi-GPU training section</a>: explore this section to learn about further optimization methods that apply to a multi-GPU settings, such as data, tensor, and pipeline parallelism.</li> <li><a href="perf_train_cpu">CPU training section</a>: learn about mixed precision training on CPU.</li> <li><a href="perf_train_cpu_many">Efficient Training on Multiple CPUs</a>: learn about distributed CPU training.</li> <li><a href="perf_train_tpu_tf">Training on TPU with TensorFlow</a>: if you are new to TPUs, refer to this section for an opinionated introduction to training on TPUs and using XLA.</li> <li><a href="perf_hardware">Custom hardware for training</a>: find tips and tricks when building your own deep learning rig.</li> <li><a href="hpo_train">Hyperparameter Search using Trainer API</a></li>',pe,m,y,J,E,Ee,F,Fe="Inference",ce,S,Re=`Efficient inference with large models in a production environment can be as challenging as training them. In the following
sections we go through the steps to run inference on CPU and single/multi-GPU setups.`,de,G,Xe='<li><a href="perf_infer_cpu">Inference on a single CPU</a></li> <li><a href="perf_infer_gpu_one">Inference on a single GPU</a></li> <li><a href="perf_infer_gpu_many">Multi-GPU inference</a></li> <li><a href="tf_xla">XLA Integration for TensorFlow Models</a></li>',me,v,x,O,H,Se,R,je="Training and inference",ve,L,Be="Here you’ll find techniques, tips and tricks that apply whether you are training a model, or running inference with it.",ge,M,De='<li><a href="big_models">Instantiating a big model</a></li> <li><a href="debugging">Troubleshooting performance issues</a></li>',_e,g,P,K,I,Ge,X,Je="Contribute",we,N,Oe=`This document is far from being complete and a lot more needs to be added, so if you have additions or corrections to
make please don’t hesitate to open a PR or if you aren’t sure start an Issue and we can discuss the details there.`,ye,q,Ke=`When making contributions that A is better than B, please try to include a reproducible benchmark and/or a link to the
source of that information (unless it comes directly from you).`,xe,Q,Pe;return C=new ie({}),T=new ie({}),E=new ie({}),H=new ie({}),I=new ie({}),{c(){p=a("meta"),ae=l(),j=a("p"),re=l(),c=a("h1"),_=a("a"),B=a("span"),V(C.$$.fragment),ke=l(),z=a("span"),z.textContent=Le,le=l(),b=a("p"),b.innerHTML=Me,oe=l(),$=a("p"),$.textContent=Ie,se=l(),U=a("p"),U.textContent=Ne,he=l(),d=a("h2"),w=a("a"),D=a("span"),V(T.$$.fragment),Ae=l(),W=a("span"),W.textContent=qe,ue=l(),k=a("p"),k.textContent=ze,fe=l(),A=a("ul"),A.innerHTML=We,pe=l(),m=a("h2"),y=a("a"),J=a("span"),V(E.$$.fragment),Ee=l(),F=a("span"),F.textContent=Fe,ce=l(),S=a("p"),S.textContent=Re,de=l(),G=a("ul"),G.innerHTML=Xe,me=l(),v=a("h2"),x=a("a"),O=a("span"),V(H.$$.fragment),Se=l(),R=a("span"),R.textContent=je,ve=l(),L=a("p"),L.textContent=Be,ge=l(),M=a("ul"),M.innerHTML=De,_e=l(),g=a("h2"),P=a("a"),K=a("span"),V(I.$$.fragment),Ge=l(),X=a("span"),X.textContent=Je,we=l(),N=a("p"),N.textContent=Oe,ye=l(),q=a("p"),q.textContent=Ke,xe=l(),Q=a("p"),this.h()},l(e){const n=ft("svelte-1phssyn",document.head);p=r(n,"META",{name:!0,content:!0}),n.forEach(t),ae=o(e),j=r(e,"P",{}),u(j).forEach(t),re=o(e),c=r(e,"H1",{class:!0});var Ce=u(c);_=r(Ce,"A",{id:!0,class:!0,href:!0});var Qe=u(_);B=r(Qe,"SPAN",{});var Ve=u(B);Y(C.$$.fragment,Ve),Ve.forEach(t),Qe.forEach(t),ke=o(Ce),z=r(Ce,"SPAN",{"data-svelte-h":!0}),f(z)!=="svelte-uoltvn"&&(z.textContent=Le),Ce.forEach(t),le=o(e),b=r(e,"P",{"data-svelte-h":!0}),f(b)!=="svelte-1wq4i4b"&&(b.innerHTML=Me),oe=o(e),$=r(e,"P",{"data-svelte-h":!0}),f($)!=="svelte-g5ptwa"&&($.textContent=Ie),se=o(e),U=r(e,"P",{"data-svelte-h":!0}),f(U)!=="svelte-6nd06u"&&(U.textContent=Ne),he=o(e),d=r(e,"H2",{class:!0});var be=u(d);w=r(be,"A",{id:!0,class:!0,href:!0});var Ye=u(w);D=r(Ye,"SPAN",{});var Ze=u(D);Y(T.$$.fragment,Ze),Ze.forEach(t),Ye.forEach(t),Ae=o(be),W=r(be,"SPAN",{"data-svelte-h":!0}),f(W)!=="svelte-1q1s287"&&(W.textContent=qe),be.forEach(t),ue=o(e),k=r(e,"P",{"data-svelte-h":!0}),f(k)!=="svelte-1hwmwxf"&&(k.textContent=ze),fe=o(e),A=r(e,"UL",{"data-svelte-h":!0}),f(A)!=="svelte-uklrf2"&&(A.innerHTML=We),pe=o(e),m=r(e,"H2",{class:!0});var $e=u(m);y=r($e,"A",{id:!0,class:!0,href:!0});var et=u(y);J=r(et,"SPAN",{});var tt=u(J);Y(E.$$.fragment,tt),tt.forEach(t),et.forEach(t),Ee=o($e),F=r($e,"SPAN",{"data-svelte-h":!0}),f(F)!=="svelte-199uz7g"&&(F.textContent=Fe),$e.forEach(t),ce=o(e),S=r(e,"P",{"data-svelte-h":!0}),f(S)!=="svelte-l8wb5c"&&(S.textContent=Re),de=o(e),G=r(e,"UL",{"data-svelte-h":!0}),f(G)!=="svelte-slh3iy"&&(G.innerHTML=Xe),me=o(e),v=r(e,"H2",{class:!0});var Ue=u(v);x=r(Ue,"A",{id:!0,class:!0,href:!0});var nt=u(x);O=r(nt,"SPAN",{});var it=u(O);Y(H.$$.fragment,it),it.forEach(t),nt.forEach(t),Se=o(Ue),R=r(Ue,"SPAN",{"data-svelte-h":!0}),f(R)!=="svelte-rmmet9"&&(R.textContent=je),Ue.forEach(t),ve=o(e),L=r(e,"P",{"data-svelte-h":!0}),f(L)!=="svelte-47g9l2"&&(L.textContent=Be),ge=o(e),M=r(e,"UL",{"data-svelte-h":!0}),f(M)!=="svelte-nwukeg"&&(M.innerHTML=De),_e=o(e),g=r(e,"H2",{class:!0});var Te=u(g);P=r(Te,"A",{id:!0,class:!0,href:!0});var at=u(P);K=r(at,"SPAN",{});var rt=u(K);Y(I.$$.fragment,rt),rt.forEach(t),at.forEach(t),Ge=o(Te),X=r(Te,"SPAN",{"data-svelte-h":!0}),f(X)!=="svelte-1ya9eos"&&(X.textContent=Je),Te.forEach(t),we=o(e),N=r(e,"P",{"data-svelte-h":!0}),f(N)!=="svelte-1v03uxh"&&(N.textContent=Oe),ye=o(e),q=r(e,"P",{"data-svelte-h":!0}),f(q)!=="svelte-uw4rm0"&&(q.textContent=Ke),xe=o(e),Q=r(e,"P",{}),u(Q).forEach(t),this.h()},h(){s(p,"name","hf:doc:metadata"),s(p,"content",JSON.stringify(ct)),s(_,"id","performance-and-scalability"),s(_,"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"),s(_,"href","#performance-and-scalability"),s(c,"class","relative group"),s(w,"id","training"),s(w,"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"),s(w,"href","#training"),s(d,"class","relative group"),s(y,"id","inference"),s(y,"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"),s(y,"href","#inference"),s(m,"class","relative group"),s(x,"id","training-and-inference"),s(x,"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"),s(x,"href","#training-and-inference"),s(v,"class","relative group"),s(P,"id","contribute"),s(P,"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"),s(P,"href","#contribute"),s(g,"class","relative group")},m(e,n){h(document.head,p),i(e,ae,n),i(e,j,n),i(e,re,n),i(e,c,n),h(c,_),h(_,B),Z(C,B,null),h(c,ke),h(c,z),i(e,le,n),i(e,b,n),i(e,oe,n),i(e,$,n),i(e,se,n),i(e,U,n),i(e,he,n),i(e,d,n),h(d,w),h(w,D),Z(T,D,null),h(d,Ae),h(d,W),i(e,ue,n),i(e,k,n),i(e,fe,n),i(e,A,n),i(e,pe,n),i(e,m,n),h(m,y),h(y,J),Z(E,J,null),h(m,Ee),h(m,F),i(e,ce,n),i(e,S,n),i(e,de,n),i(e,G,n),i(e,me,n),i(e,v,n),h(v,x),h(x,O),Z(H,O,null),h(v,Se),h(v,R),i(e,ve,n),i(e,L,n),i(e,ge,n),i(e,M,n),i(e,_e,n),i(e,g,n),h(g,P),h(P,K),Z(I,K,null),h(g,Ge),h(g,X),i(e,we,n),i(e,N,n),i(e,ye,n),i(e,q,n),i(e,xe,n),i(e,Q,n),Pe=!0},p:ot,i(e){Pe||(ee(C.$$.fragment,e),ee(T.$$.fragment,e),ee(E.$$.fragment,e),ee(H.$$.fragment,e),ee(I.$$.fragment,e),Pe=!0)},o(e){te(C.$$.fragment,e),te(T.$$.fragment,e),te(E.$$.fragment,e),te(H.$$.fragment,e),te(I.$$.fragment,e),Pe=!1},d(e){e&&(t(ae),t(j),t(re),t(c),t(le),t(b),t(oe),t($),t(se),t(U),t(he),t(d),t(ue),t(k),t(fe),t(A),t(pe),t(m),t(ce),t(S),t(de),t(G),t(me),t(v),t(ve),t(L),t(ge),t(M),t(_e),t(g),t(we),t(N),t(ye),t(q),t(xe),t(Q)),t(p),ne(C),ne(T),ne(E),ne(H),ne(I)}}}const ct={local:"performance-and-scalability",sections:[{local:"training",title:"Training"},{local:"inference",title:"Inference"},{local:"training-and-inference",title:"Training and inference"},{local:"contribute",title:"Contribute"}],title:"Performance and Scalability"};function dt(He){return st(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class _t extends ht{constructor(p){super(),ut(this,p,dt,pt,lt,{})}}export{_t as component};
