import{s as Y,o as ee,n as te}from"../chunks/scheduler.9bc65507.js";import{S as ne,i as ae,g as l,s as i,r as C,A as re,h as m,f as n,c as o,j as N,u as x,x as H,k as W,y as v,a as r,v as P,d as L,t as M,w as k}from"../chunks/index.707bf1b6.js";import{T as se}from"../chunks/Tip.c2ecdbf4.js";import{D as ie}from"../chunks/Docstring.570ddb64.js";import{H as X,E as oe}from"../chunks/EditOnGithub.922df6ba.js";function pe(z){let a,c='Learn more about using DeepSpeed with <a href="/docs/transformers/main/en/main_classes/trainer#transformers.Trainer">Trainer</a> in the <a href="../deepspeed">DeepSpeed</a> guide.';return{c(){a=l("p"),a.innerHTML=c},l(p){a=m(p,"P",{"data-svelte-h":!0}),H(a)!=="svelte-1bvvaxn"&&(a.innerHTML=c)},m(p,T){r(p,a,T)},p:te,d(p){p&&n(a)}}}function fe(z){let a,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/main/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/main/en/main_classes/trainer#transformers.Trainer">Trainer</a>, Transformers provides a <code>HfDeepSpeedConfig</code> class.',j,d,A,$,U,s,_,Z,D,J="This object contains a DeepSpeed configuration dictionary and can be quickly queried for things like zero stage.",I,w,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/main/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/main/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,y,G;return g=new X({props:{title:"DeepSpeed",local:"deepspeed",headingTag:"h1"}}),d=new se({props:{$$slots:{default:[pe]},$$scope:{ctx:z}}}),$=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/main/src/transformers/integrations/deepspeed.py#L58"}}),b=new oe({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/main_classes/deepspeed.md"}}),{c(){a=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(),D=l("p"),D.textContent=J,I=i(),w=l("p"),w.innerHTML=K,V=i(),S=l("p"),S.innerHTML=Q,O=i(),C(b.$$.fragment),R=i(),y=l("p"),this.h()},l(e){const t=re("svelte-u9bgzb",document.head);a=m(t,"META",{name:!0,content:!0}),t.forEach(n),c=o(e),p=m(e,"P",{}),N(p).forEach(n),T=o(e),x(g.$$.fragment,e),q=o(e),u=m(e,"P",{"data-svelte-h":!0}),H(u)!=="svelte-117asva"&&(u.innerHTML=B),E=o(e),h=m(e,"P",{"data-svelte-h":!0}),H(h)!=="svelte-1q4kp4d"&&(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),D=m(f,"P",{"data-svelte-h":!0}),H(D)!=="svelte-g6t8ro"&&(D.textContent=J),I=o(f),w=m(f,"P",{"data-svelte-h":!0}),H(w)!=="svelte-xzx2jk"&&(w.innerHTML=K),V=o(f),S=m(f,"P",{"data-svelte-h":!0}),H(S)!=="svelte-1q5z43w"&&(S.innerHTML=Q),f.forEach(n),O=o(e),x(b.$$.fragment,e),R=o(e),y=m(e,"P",{}),N(y).forEach(n),this.h()},h(){W(a,"name","hf:doc:metadata"),W(a,"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,a),r(e,c,t),r(e,p,t),r(e,T,t),P(g,e,t),r(e,q,t),r(e,u,t),r(e,E,t),r(e,h,t),r(e,j,t),P(d,e,t),r(e,A,t),P($,e,t),r(e,U,t),r(e,s,t),P(_,s,null),v(s,Z),v(s,D),v(s,I),v(s,w),v(s,V),v(s,S),r(e,O,t),P(b,e,t),r(e,R,t),r(e,y,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&&(n(c),n(p),n(T),n(q),n(u),n(E),n(h),n(j),n(A),n(U),n(s),n(O),n(R),n(y)),n(a),k(g,e),k(d,e),k($,e),k(_),k(b,e)}}}const le='{"title":"DeepSpeed","local":"deepspeed","sections":[{"title":"HfDeepSpeedConfig","local":"transformers.integrations.HfDeepSpeedConfig","sections":[],"depth":2}],"depth":1}';function me(z){return ee(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class $e extends ne{constructor(a){super(),ae(this,a,me,fe,Y,{})}}export{$e as component};
