import{s as ge,n as _e,o as $e}from"../chunks/scheduler.25b97de1.js";import{S as Pe,i as ve,g as l,s as a,r as U,A as be,h as o,f as n,c as r,j as ce,u as G,x as s,k as de,y as xe,a as i,v as M,d as L,t as H,w as k}from"../chunks/index.d9030fc9.js";import{H as q,E as ye}from"../chunks/EditOnGithub.91d95064.js";function Ce(ne){let f,A,I,S,u,z,m,ie=`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.`,W,p,ae=`This documentation aims to assist you in overcoming these challenges and finding the optimal settings 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.`,F,h,re="Use this document as your starting point to navigate further to the methods that match your scenario.",R,c,X,d,le=`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.`,j,g,oe='<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>',B,_,D,$,se=`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.`,O,P,fe='<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_multi">Multi-GPU inference</a></li> <li><a href="tf_xla">XLA Integration for TensorFlow Models</a></li>',J,v,K,b,ue="Here you’ll find techniques, tips and tricks that apply whether you are training a model, or running inference with it.",N,x,me='<li><a href="big_models">Instantiating a big model</a></li> <li><a href="debugging">Troubleshooting performance issues</a></li>',Q,y,V,C,pe=`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.`,Y,w,he=`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).`,Z,T,ee,E,te;return u=new q({props:{title:"Performance and Scalability",local:"performance-and-scalability",headingTag:"h1"}}),c=new q({props:{title:"Training",local:"training",headingTag:"h2"}}),_=new q({props:{title:"Inference",local:"inference",headingTag:"h2"}}),v=new q({props:{title:"Training and inference",local:"training-and-inference",headingTag:"h2"}}),y=new q({props:{title:"Contribute",local:"contribute",headingTag:"h2"}}),T=new ye({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/performance.md"}}),{c(){f=l("meta"),A=a(),I=l("p"),S=a(),U(u.$$.fragment),z=a(),m=l("p"),m.innerHTML=ie,W=a(),p=l("p"),p.textContent=ae,F=a(),h=l("p"),h.textContent=re,R=a(),U(c.$$.fragment),X=a(),d=l("p"),d.textContent=le,j=a(),g=l("ul"),g.innerHTML=oe,B=a(),U(_.$$.fragment),D=a(),$=l("p"),$.textContent=se,O=a(),P=l("ul"),P.innerHTML=fe,J=a(),U(v.$$.fragment),K=a(),b=l("p"),b.textContent=ue,N=a(),x=l("ul"),x.innerHTML=me,Q=a(),U(y.$$.fragment),V=a(),C=l("p"),C.textContent=pe,Y=a(),w=l("p"),w.textContent=he,Z=a(),U(T.$$.fragment),ee=a(),E=l("p"),this.h()},l(e){const t=be("svelte-u9bgzb",document.head);f=o(t,"META",{name:!0,content:!0}),t.forEach(n),A=r(e),I=o(e,"P",{}),ce(I).forEach(n),S=r(e),G(u.$$.fragment,e),z=r(e),m=o(e,"P",{"data-svelte-h":!0}),s(m)!=="svelte-1wq4i4b"&&(m.innerHTML=ie),W=r(e),p=o(e,"P",{"data-svelte-h":!0}),s(p)!=="svelte-9s4brt"&&(p.textContent=ae),F=r(e),h=o(e,"P",{"data-svelte-h":!0}),s(h)!=="svelte-6nd06u"&&(h.textContent=re),R=r(e),G(c.$$.fragment,e),X=r(e),d=o(e,"P",{"data-svelte-h":!0}),s(d)!=="svelte-1hwmwxf"&&(d.textContent=le),j=r(e),g=o(e,"UL",{"data-svelte-h":!0}),s(g)!=="svelte-uklrf2"&&(g.innerHTML=oe),B=r(e),G(_.$$.fragment,e),D=r(e),$=o(e,"P",{"data-svelte-h":!0}),s($)!=="svelte-l8wb5c"&&($.textContent=se),O=r(e),P=o(e,"UL",{"data-svelte-h":!0}),s(P)!=="svelte-1raexgk"&&(P.innerHTML=fe),J=r(e),G(v.$$.fragment,e),K=r(e),b=o(e,"P",{"data-svelte-h":!0}),s(b)!=="svelte-47g9l2"&&(b.textContent=ue),N=r(e),x=o(e,"UL",{"data-svelte-h":!0}),s(x)!=="svelte-nwukeg"&&(x.innerHTML=me),Q=r(e),G(y.$$.fragment,e),V=r(e),C=o(e,"P",{"data-svelte-h":!0}),s(C)!=="svelte-1v03uxh"&&(C.textContent=pe),Y=r(e),w=o(e,"P",{"data-svelte-h":!0}),s(w)!=="svelte-uw4rm0"&&(w.textContent=he),Z=r(e),G(T.$$.fragment,e),ee=r(e),E=o(e,"P",{}),ce(E).forEach(n),this.h()},h(){de(f,"name","hf:doc:metadata"),de(f,"content",we)},m(e,t){xe(document.head,f),i(e,A,t),i(e,I,t),i(e,S,t),M(u,e,t),i(e,z,t),i(e,m,t),i(e,W,t),i(e,p,t),i(e,F,t),i(e,h,t),i(e,R,t),M(c,e,t),i(e,X,t),i(e,d,t),i(e,j,t),i(e,g,t),i(e,B,t),M(_,e,t),i(e,D,t),i(e,$,t),i(e,O,t),i(e,P,t),i(e,J,t),M(v,e,t),i(e,K,t),i(e,b,t),i(e,N,t),i(e,x,t),i(e,Q,t),M(y,e,t),i(e,V,t),i(e,C,t),i(e,Y,t),i(e,w,t),i(e,Z,t),M(T,e,t),i(e,ee,t),i(e,E,t),te=!0},p:_e,i(e){te||(L(u.$$.fragment,e),L(c.$$.fragment,e),L(_.$$.fragment,e),L(v.$$.fragment,e),L(y.$$.fragment,e),L(T.$$.fragment,e),te=!0)},o(e){H(u.$$.fragment,e),H(c.$$.fragment,e),H(_.$$.fragment,e),H(v.$$.fragment,e),H(y.$$.fragment,e),H(T.$$.fragment,e),te=!1},d(e){e&&(n(A),n(I),n(S),n(z),n(m),n(W),n(p),n(F),n(h),n(R),n(X),n(d),n(j),n(g),n(B),n(D),n($),n(O),n(P),n(J),n(K),n(b),n(N),n(x),n(Q),n(V),n(C),n(Y),n(w),n(Z),n(ee),n(E)),n(f),k(u,e),k(c,e),k(_,e),k(v,e),k(y,e),k(T,e)}}}const we='{"title":"Performance and Scalability","local":"performance-and-scalability","sections":[{"title":"Training","local":"training","sections":[],"depth":2},{"title":"Inference","local":"inference","sections":[],"depth":2},{"title":"Training and inference","local":"training-and-inference","sections":[],"depth":2},{"title":"Contribute","local":"contribute","sections":[],"depth":2}],"depth":1}';function Te(ne){return $e(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Le extends Pe{constructor(f){super(),ve(this,f,Te,Ce,ge,{})}}export{Le as component};
