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 ye,a as i,v as M,d as L,t as H,w as I}from"../chunks/index.d9030fc9.js";import{H as q,E as Ce}from"../chunks/EditOnGithub.91d95064.js";function we(ne){let f,A,k,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_one">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,y,me='<li><a href="big_models">Instantiating a big model</a></li> <li><a href="debugging">Troubleshooting performance issues</a></li>',Q,C,V,w,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,x,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"}}),C=new q({props:{title:"Contribute",local:"contribute",headingTag:"h2"}}),T=new Ce({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/performance.md"}}),{c(){f=l("meta"),A=a(),k=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(),y=l("ul"),y.innerHTML=me,Q=a(),U(C.$$.fragment),V=a(),w=l("p"),w.textContent=pe,Y=a(),x=l("p"),x.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),k=o(e,"P",{}),ce(k).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-1ie01z1"&&(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),y=o(e,"UL",{"data-svelte-h":!0}),s(y)!=="svelte-nwukeg"&&(y.innerHTML=me),Q=r(e),G(C.$$.fragment,e),V=r(e),w=o(e,"P",{"data-svelte-h":!0}),s(w)!=="svelte-1v03uxh"&&(w.textContent=pe),Y=r(e),x=o(e,"P",{"data-svelte-h":!0}),s(x)!=="svelte-uw4rm0"&&(x.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",xe)},m(e,t){ye(document.head,f),i(e,A,t),i(e,k,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,y,t),i(e,Q,t),M(C,e,t),i(e,V,t),i(e,w,t),i(e,Y,t),i(e,x,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(C.$$.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(C.$$.fragment,e),H(T.$$.fragment,e),te=!1},d(e){e&&(n(A),n(k),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(y),n(Q),n(V),n(w),n(Y),n(x),n(Z),n(ee),n(E)),n(f),I(u,e),I(c,e),I(_,e),I(v,e),I(C,e),I(T,e)}}}const xe='{"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,we,ge,{})}}export{Le as component};
