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 b,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.ffac8efa.js";import{H as X,E as oe}from"../chunks/EditOnGithub.91d95064.js";function pe(k){let n,d='Learn more about using DeepSpeed with <a href="/docs/transformers/v4.42.4/en/main_classes/trainer#transformers.Trainer">Trainer</a> in the <a href="../deepspeed">DeepSpeed</a> guide.';return{c(){n=l("p"),n.innerHTML=d},l(p){n=m(p,"P",{"data-svelte-h":!0}),y(n)!=="svelte-npg6ic"&&(n.innerHTML=d)},m(p,T){a(p,n,T)},p:te,d(p){p&&r(n)}}}function fe(k){let n,d,p,T,g,E,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/v4.42.4/en/main_classes/trainer#transformers.Trainer">Trainer</a> class and most of the setup is automatically taken care of for you.',j,h,F='However, if you want to use DeepSpeed without the <a href="/docs/transformers/v4.42.4/en/main_classes/trainer#transformers.Trainer">Trainer</a>, Transformers provides a <code>HfDeepSpeedConfig</code> class.',q,c,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/v4.42.4/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/v4.42.4/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,v,R,H,G;return g=new X({props:{title:"DeepSpeed",local:"deepspeed",headingTag:"h1"}}),c=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/v4.42.4/src/transformers/integrations/deepspeed.py#L59"}}),v=new oe({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/main_classes/deepspeed.md"}}),{c(){n=l("meta"),d=i(),p=l("p"),T=i(),C(g.$$.fragment),E=i(),u=l("p"),u.innerHTML=B,j=i(),h=l("p"),h.innerHTML=F,q=i(),C(c.$$.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(v.$$.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),d=o(e),p=m(e,"P",{}),N(p).forEach(r),T=o(e),x(g.$$.fragment,e),E=o(e),u=m(e,"P",{"data-svelte-h":!0}),y(u)!=="svelte-upz71r"&&(u.innerHTML=B),j=o(e),h=m(e,"P",{"data-svelte-h":!0}),y(h)!=="svelte-y4fslw"&&(h.innerHTML=F),q=o(e),x(c.$$.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}),y(D)!=="svelte-g6t8ro"&&(D.textContent=J),I=o(f),w=m(f,"P",{"data-svelte-h":!0}),y(w)!=="svelte-xzx2jk"&&(w.innerHTML=K),V=o(f),S=m(f,"P",{"data-svelte-h":!0}),y(S)!=="svelte-1hmo7mg"&&(S.innerHTML=Q),f.forEach(r),O=o(e),x(v.$$.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){b(document.head,n),a(e,d,t),a(e,p,t),a(e,T,t),P(g,e,t),a(e,E,t),a(e,u,t),a(e,j,t),a(e,h,t),a(e,q,t),P(c,e,t),a(e,A,t),P($,e,t),a(e,U,t),a(e,s,t),P(_,s,null),b(s,Z),b(s,D),b(s,I),b(s,w),b(s,V),b(s,S),a(e,O,t),P(v,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}),c.$set(f)},i(e){G||(L(g.$$.fragment,e),L(c.$$.fragment,e),L($.$$.fragment,e),L(_.$$.fragment,e),L(v.$$.fragment,e),G=!0)},o(e){M(g.$$.fragment,e),M(c.$$.fragment,e),M($.$$.fragment,e),M(_.$$.fragment,e),M(v.$$.fragment,e),G=!1},d(e){e&&(r(d),r(p),r(T),r(E),r(u),r(j),r(h),r(q),r(A),r(U),r(s),r(O),r(R),r(H)),r(n),z(g,e),z(c,e),z($,e),z(_),z(v,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};
