import{s as Y,o as ee,n as te}from"../chunks/scheduler.25b97de1.js";import{S as re,i as ne,g as l,s as i,r as C,A as ae,h as m,f as r,c as o,j as N,u as x,x as y,k as W,y as v,a,v as P,d as L,t as M,w as z}from"../chunks/index.d9030fc9.js";import{T as se}from"../chunks/Tip.baa67368.js";import{D as ie}from"../chunks/Docstring.e257edda.js";import{H as X,E as oe}from"../chunks/EditOnGithub.91d95064.js";function pe(k){let n,c='Learn more about using DeepSpeed with <a href="/docs/transformers/pr_30530/en/main_classes/trainer#transformers.Trainer">Trainer</a> in the <a href="../deepspeed">DeepSpeed</a> guide.';return{c(){n=l("p"),n.innerHTML=c},l(p){n=m(p,"P",{"data-svelte-h":!0}),y(n)!=="svelte-1yx6bwg"&&(n.innerHTML=c)},m(p,T){a(p,n,T)},p:te,d(p){p&&r(n)}}}function fe(k){let n,c,p,T,g,q,u,B='<a href="https://github.com/microsoft/DeepSpeed" rel="nofollow">DeepSpeed</a>, powered by Zero Redundancy Optimizer (ZeRO), is an optimization library for training and fitting very large models onto a GPU. It is available in several ZeRO stages, where each stage progressively saves more GPU memory by partitioning the optimizer state, gradients, parameters, and enabling offloading to a CPU or NVMe. DeepSpeed is integrated with the <a href="/docs/transformers/pr_30530/en/main_classes/trainer#transformers.Trainer">Trainer</a> class and most of the setup is automatically taken care of for you.',E,h,F='However, if you want to use DeepSpeed without the <a href="/docs/transformers/pr_30530/en/main_classes/trainer#transformers.Trainer">Trainer</a>, Transformers provides a <code>HfDeepSpeedConfig</code> class.',j,d,A,_,U,s,$,Z,w,J="This object contains a DeepSpeed configuration dictionary and can be quickly queried for things like zero stage.",I,D,K=`A <code>weakref</code> of this object is stored in the module’s globals to be able to access the config from areas where
things like the Trainer object is not available (e.g. <code>from_pretrained</code> and <code>_get_resized_embeddings</code>). Therefore
it’s important that this object remains alive while the program is still running.`,V,S,Q=`<a href="/docs/transformers/pr_30530/en/main_classes/trainer#transformers.Trainer">Trainer</a> uses the <code>HfTrainerDeepSpeedConfig</code> subclass instead. That subclass has logic to sync the configuration
with values of <a href="/docs/transformers/pr_30530/en/main_classes/trainer#transformers.TrainingArguments">TrainingArguments</a> by replacing special placeholder values: <code>&quot;auto&quot;</code>. Without this special logic
the DeepSpeed configuration is not modified in any way.`,O,b,R,H,G;return g=new X({props:{title:"DeepSpeed",local:"deepspeed",headingTag:"h1"}}),d=new se({props:{$$slots:{default:[pe]},$$scope:{ctx:k}}}),_=new X({props:{title:"HfDeepSpeedConfig",local:"transformers.integrations.HfDeepSpeedConfig",headingTag:"h2"}}),$=new ie({props:{name:"class transformers.integrations.HfDeepSpeedConfig",anchor:"transformers.integrations.HfDeepSpeedConfig",parameters:[{name:"config_file_or_dict",val:""}],parametersDescription:[{anchor:"transformers.integrations.HfDeepSpeedConfig.config_file_or_dict",description:"<strong>config_file_or_dict</strong> (<code>Union[str, Dict]</code>) &#x2014; path to DeepSpeed config file or dict.",name:"config_file_or_dict"}],source:"https://github.com/huggingface/transformers/blob/vr_30530/src/transformers/integrations/deepspeed.py#L59"}}),b=new oe({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/main_classes/deepspeed.md"}}),{c(){n=l("meta"),c=i(),p=l("p"),T=i(),C(g.$$.fragment),q=i(),u=l("p"),u.innerHTML=B,E=i(),h=l("p"),h.innerHTML=F,j=i(),C(d.$$.fragment),A=i(),C(_.$$.fragment),U=i(),s=l("div"),C($.$$.fragment),Z=i(),w=l("p"),w.textContent=J,I=i(),D=l("p"),D.innerHTML=K,V=i(),S=l("p"),S.innerHTML=Q,O=i(),C(b.$$.fragment),R=i(),H=l("p"),this.h()},l(e){const t=ae("svelte-u9bgzb",document.head);n=m(t,"META",{name:!0,content:!0}),t.forEach(r),c=o(e),p=m(e,"P",{}),N(p).forEach(r),T=o(e),x(g.$$.fragment,e),q=o(e),u=m(e,"P",{"data-svelte-h":!0}),y(u)!=="svelte-18dpg6d"&&(u.innerHTML=B),E=o(e),h=m(e,"P",{"data-svelte-h":!0}),y(h)!=="svelte-wqmzaq"&&(h.innerHTML=F),j=o(e),x(d.$$.fragment,e),A=o(e),x(_.$$.fragment,e),U=o(e),s=m(e,"DIV",{class:!0});var f=N(s);x($.$$.fragment,f),Z=o(f),w=m(f,"P",{"data-svelte-h":!0}),y(w)!=="svelte-g6t8ro"&&(w.textContent=J),I=o(f),D=m(f,"P",{"data-svelte-h":!0}),y(D)!=="svelte-xzx2jk"&&(D.innerHTML=K),V=o(f),S=m(f,"P",{"data-svelte-h":!0}),y(S)!=="svelte-1wm7sfw"&&(S.innerHTML=Q),f.forEach(r),O=o(e),x(b.$$.fragment,e),R=o(e),H=m(e,"P",{}),N(H).forEach(r),this.h()},h(){W(n,"name","hf:doc:metadata"),W(n,"content",le),W(s,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,t){v(document.head,n),a(e,c,t),a(e,p,t),a(e,T,t),P(g,e,t),a(e,q,t),a(e,u,t),a(e,E,t),a(e,h,t),a(e,j,t),P(d,e,t),a(e,A,t),P(_,e,t),a(e,U,t),a(e,s,t),P($,s,null),v(s,Z),v(s,w),v(s,I),v(s,D),v(s,V),v(s,S),a(e,O,t),P(b,e,t),a(e,R,t),a(e,H,t),G=!0},p(e,[t]){const f={};t&2&&(f.$$scope={dirty:t,ctx:e}),d.$set(f)},i(e){G||(L(g.$$.fragment,e),L(d.$$.fragment,e),L(_.$$.fragment,e),L($.$$.fragment,e),L(b.$$.fragment,e),G=!0)},o(e){M(g.$$.fragment,e),M(d.$$.fragment,e),M(_.$$.fragment,e),M($.$$.fragment,e),M(b.$$.fragment,e),G=!1},d(e){e&&(r(c),r(p),r(T),r(q),r(u),r(E),r(h),r(j),r(A),r(U),r(s),r(O),r(R),r(H)),r(n),z(g,e),z(d,e),z(_,e),z($),z(b,e)}}}const le='{"title":"DeepSpeed","local":"deepspeed","sections":[{"title":"HfDeepSpeedConfig","local":"transformers.integrations.HfDeepSpeedConfig","sections":[],"depth":2}],"depth":1}';function me(k){return ee(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class _e extends re{constructor(n){super(),ne(this,n,me,fe,Y,{})}}export{_e as component};
