Buckets:
| import{s as Ne,n as ke,o as Fe}from"../chunks/scheduler.defa9a21.js";import{S as Te,i as Ee,g as l,s as r,r as u,A as Le,h as s,f as t,c as o,j as g,u as h,x as C,k as v,y as a,a as c,v as b,d as $,t as y,w as x}from"../chunks/index.fe795e71.js";import{D as M}from"../chunks/Docstring.170994c1.js";import{H as Ue,E as He}from"../chunks/EditOnGithub.0f575778.js";function Me(be){let p,J,q,K,S,Q,_,N,ie,z,$e="Enables RAM efficient loading of Hugging Face models for FSDP in the environment.",X,f,k,ce,I,ye="Disables RAM efficient loading of Hugging Face models for FSDP in the environment.",Y,d,F,de,V,xe=`Merge the weights from sharded FSDP model checkpoints into a single combined checkpoint. Should be used if | |
| <code>SHARDED_STATE_DICT</code> was used for the model. Weights will be saved to <code>{output_path}/model.safetensors</code> if | |
| <code>safe_serialization</code> else <code>pytorch_model.bin</code>.`,me,A,we="Note: this is a CPU-bound process.",Z,i,T,pe,O,Pe="This plugin is used to enable fully sharded data parallelism.",_e,w,E,fe,R,De=`Given <code>model</code>, creates an <code>auto_wrap_policy</code> baesd on the passed in policy and if we can use the | |
| <code>transformer_cls_to_wrap</code>`,ue,P,L,ge,W,Ce="Sets the mixed precision policy for FSDP",he,D,U,ve,G,Se="Set the state dict config based on the <code>StateDictType</code>.",ee,H,te,B,ae;return S=new Ue({props:{title:"Utilities for Fully Sharded Data Parallelism",local:"accelerate.utils.enable_fsdp_ram_efficient_loading",headingTag:"h1"}}),N=new M({props:{name:"accelerate.utils.enable_fsdp_ram_efficient_loading",anchor:"accelerate.utils.enable_fsdp_ram_efficient_loading",parameters:[],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/utils/fsdp_utils.py#L30"}}),k=new M({props:{name:"accelerate.utils.disable_fsdp_ram_efficient_loading",anchor:"accelerate.utils.disable_fsdp_ram_efficient_loading",parameters:[],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/utils/fsdp_utils.py#L40"}}),F=new M({props:{name:"accelerate.utils.merge_fsdp_weights",anchor:"accelerate.utils.merge_fsdp_weights",parameters:[{name:"checkpoint_dir",val:": str"},{name:"output_path",val:": str"},{name:"safe_serialization",val:": bool = True"},{name:"remove_checkpoint_dir",val:": bool = False"}],parametersDescription:[{anchor:"accelerate.utils.merge_fsdp_weights.checkpoint_dir",description:`<strong>checkpoint_dir</strong> (<code>str</code>) — | |
| The directory containing the FSDP checkpoints (can be either the model or optimizer).`,name:"checkpoint_dir"},{anchor:"accelerate.utils.merge_fsdp_weights.output_path",description:`<strong>output_path</strong> (<code>str</code>) — | |
| The path to save the merged checkpoint.`,name:"output_path"},{anchor:"accelerate.utils.merge_fsdp_weights.safe_serialization",description:`<strong>safe_serialization</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) — | |
| Whether to save the merged weights with safetensors (recommended).`,name:"safe_serialization"},{anchor:"accelerate.utils.merge_fsdp_weights.remove_checkpoint_dir",description:`<strong>remove_checkpoint_dir</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) — | |
| Whether to remove the checkpoint directory after merging.`,name:"remove_checkpoint_dir"}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/utils/fsdp_utils.py#L274"}}),T=new M({props:{name:"class accelerate.FullyShardedDataParallelPlugin",anchor:"accelerate.FullyShardedDataParallelPlugin",parameters:[{name:"sharding_strategy",val:": Union = None"},{name:"backward_prefetch",val:": Union = None"},{name:"mixed_precision_policy",val:": Union = None"},{name:"auto_wrap_policy",val:": Union = None"},{name:"cpu_offload",val:": Union = None"},{name:"ignored_modules",val:": Optional = None"},{name:"state_dict_type",val:": Union = None"},{name:"state_dict_config",val:": Union = None"},{name:"optim_state_dict_config",val:": Union = None"},{name:"limit_all_gathers",val:": bool = True"},{name:"use_orig_params",val:": bool = None"},{name:"param_init_fn",val:": Optional = None"},{name:"sync_module_states",val:": bool = None"},{name:"forward_prefetch",val:": bool = None"},{name:"activation_checkpointing",val:": bool = None"},{name:"cpu_ram_efficient_loading",val:": bool = None"},{name:"transformer_cls_names_to_wrap",val:": Optional = None"},{name:"min_num_params",val:": Optional = None"}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/utils/dataclasses.py#L1307"}}),E=new M({props:{name:"set_auto_wrap_policy",anchor:"accelerate.FullyShardedDataParallelPlugin.set_auto_wrap_policy",parameters:[{name:"model",val:""}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/utils/dataclasses.py#L1585"}}),L=new M({props:{name:"set_mixed_precision",anchor:"accelerate.FullyShardedDataParallelPlugin.set_mixed_precision",parameters:[{name:"mixed_precision",val:""},{name:"buffer_autocast",val:" = False"},{name:"override",val:" = False"}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/utils/dataclasses.py#L1616"}}),U=new M({props:{name:"set_state_dict_type",anchor:"accelerate.FullyShardedDataParallelPlugin.set_state_dict_type",parameters:[{name:"state_dict_type",val:" = None"}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/utils/dataclasses.py#L1549"}}),H=new He({props:{source:"https://github.com/huggingface/accelerate/blob/main/docs/source/package_reference/fsdp.md"}}),{c(){p=l("meta"),J=r(),q=l("p"),K=r(),u(S.$$.fragment),Q=r(),_=l("div"),u(N.$$.fragment),ie=r(),z=l("p"),z.textContent=$e,X=r(),f=l("div"),u(k.$$.fragment),ce=r(),I=l("p"),I.textContent=ye,Y=r(),d=l("div"),u(F.$$.fragment),de=r(),V=l("p"),V.innerHTML=xe,me=r(),A=l("p"),A.textContent=we,Z=r(),i=l("div"),u(T.$$.fragment),pe=r(),O=l("p"),O.textContent=Pe,_e=r(),w=l("div"),u(E.$$.fragment),fe=r(),R=l("p"),R.innerHTML=De,ue=r(),P=l("div"),u(L.$$.fragment),ge=r(),W=l("p"),W.textContent=Ce,he=r(),D=l("div"),u(U.$$.fragment),ve=r(),G=l("p"),G.innerHTML=Se,ee=r(),u(H.$$.fragment),te=r(),B=l("p"),this.h()},l(e){const n=Le("svelte-u9bgzb",document.head);p=s(n,"META",{name:!0,content:!0}),n.forEach(t),J=o(e),q=s(e,"P",{}),g(q).forEach(t),K=o(e),h(S.$$.fragment,e),Q=o(e),_=s(e,"DIV",{class:!0});var ne=g(_);h(N.$$.fragment,ne),ie=o(ne),z=s(ne,"P",{"data-svelte-h":!0}),C(z)!=="svelte-1lsbcnp"&&(z.textContent=$e),ne.forEach(t),X=o(e),f=s(e,"DIV",{class:!0});var re=g(f);h(k.$$.fragment,re),ce=o(re),I=s(re,"P",{"data-svelte-h":!0}),C(I)!=="svelte-o9zxg8"&&(I.textContent=ye),re.forEach(t),Y=o(e),d=s(e,"DIV",{class:!0});var j=g(d);h(F.$$.fragment,j),de=o(j),V=s(j,"P",{"data-svelte-h":!0}),C(V)!=="svelte-lbcivn"&&(V.innerHTML=xe),me=o(j),A=s(j,"P",{"data-svelte-h":!0}),C(A)!=="svelte-s693kt"&&(A.textContent=we),j.forEach(t),Z=o(e),i=s(e,"DIV",{class:!0});var m=g(i);h(T.$$.fragment,m),pe=o(m),O=s(m,"P",{"data-svelte-h":!0}),C(O)!=="svelte-da89af"&&(O.textContent=Pe),_e=o(m),w=s(m,"DIV",{class:!0});var oe=g(w);h(E.$$.fragment,oe),fe=o(oe),R=s(oe,"P",{"data-svelte-h":!0}),C(R)!=="svelte-i24l23"&&(R.innerHTML=De),oe.forEach(t),ue=o(m),P=s(m,"DIV",{class:!0});var le=g(P);h(L.$$.fragment,le),ge=o(le),W=s(le,"P",{"data-svelte-h":!0}),C(W)!=="svelte-1oofbyv"&&(W.textContent=Ce),le.forEach(t),he=o(m),D=s(m,"DIV",{class:!0});var se=g(D);h(U.$$.fragment,se),ve=o(se),G=s(se,"P",{"data-svelte-h":!0}),C(G)!=="svelte-1ugzx3"&&(G.innerHTML=Se),se.forEach(t),m.forEach(t),ee=o(e),h(H.$$.fragment,e),te=o(e),B=s(e,"P",{}),g(B).forEach(t),this.h()},h(){v(p,"name","hf:doc:metadata"),v(p,"content",ze),v(_,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(f,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(d,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(w,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),v(i,"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,n){a(document.head,p),c(e,J,n),c(e,q,n),c(e,K,n),b(S,e,n),c(e,Q,n),c(e,_,n),b(N,_,null),a(_,ie),a(_,z),c(e,X,n),c(e,f,n),b(k,f,null),a(f,ce),a(f,I),c(e,Y,n),c(e,d,n),b(F,d,null),a(d,de),a(d,V),a(d,me),a(d,A),c(e,Z,n),c(e,i,n),b(T,i,null),a(i,pe),a(i,O),a(i,_e),a(i,w),b(E,w,null),a(w,fe),a(w,R),a(i,ue),a(i,P),b(L,P,null),a(P,ge),a(P,W),a(i,he),a(i,D),b(U,D,null),a(D,ve),a(D,G),c(e,ee,n),b(H,e,n),c(e,te,n),c(e,B,n),ae=!0},p:ke,i(e){ae||($(S.$$.fragment,e),$(N.$$.fragment,e),$(k.$$.fragment,e),$(F.$$.fragment,e),$(T.$$.fragment,e),$(E.$$.fragment,e),$(L.$$.fragment,e),$(U.$$.fragment,e),$(H.$$.fragment,e),ae=!0)},o(e){y(S.$$.fragment,e),y(N.$$.fragment,e),y(k.$$.fragment,e),y(F.$$.fragment,e),y(T.$$.fragment,e),y(E.$$.fragment,e),y(L.$$.fragment,e),y(U.$$.fragment,e),y(H.$$.fragment,e),ae=!1},d(e){e&&(t(J),t(q),t(K),t(Q),t(_),t(X),t(f),t(Y),t(d),t(Z),t(i),t(ee),t(te),t(B)),t(p),x(S,e),x(N),x(k),x(F),x(T),x(E),x(L),x(U),x(H,e)}}}const ze='{"title":"Utilities for Fully Sharded Data Parallelism","local":"accelerate.utils.enable_fsdp_ram_efficient_loading","sections":[],"depth":1}';function Ie(be){return Fe(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class We extends Te{constructor(p){super(),Ee(this,p,Ie,Me,Ne,{})}}export{We as component}; | |
Xet Storage Details
- Size:
- 9.63 kB
- Xet hash:
- 831c1d760453981c4b94799df9c41397789e9aeaaa5a1cd9e61c1ded4f5706e8
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.