import{s as ct,n as it,o as ft}from"../chunks/scheduler.9991993c.js";import{S as mt,i as dt,g as p,s as a,r as c,A as ot,h as r,f as l,c as n,j as pt,u as i,x as f,k as rt,y as ht,a as s,v as m,d,t as o,w as h}from"../chunks/index.7fc9a5e7.js";import{C as U}from"../chunks/CodeBlock.e11cba92.js";import{H as $,E as _t}from"../chunks/EditOnGithub.84ab7f0e.js";function $t(ve){let _,le,ee,se,u,ae,M,De=`<a href="https://pytorch.org/blog/introducing-pytorch-fully-sharded-data-parallel-api/" rel="nofollow">完全分片数据并行（FSDP）</a>是一种数据并行方法，
它将模型的参数、梯度和优化器状态在可用 GPU（也称为 Worker 或 <em>rank</em>）的数量上进行分片。
与<a href="https://pytorch.org/docs/stable/generated/torch.nn.parallel.DistributedDataParallel.html" rel="nofollow">分布式数据并行（DDP）</a>不同，
FSDP 减少了内存使用量，因为模型在每个 GPU 上都被复制了一次。这就提高了 GPU 内存效率，
使您能够用较少的 GPU 训练更大的模型。FSDP 已经集成到 Accelerate 中，
这是一个用于在分布式环境中轻松管理训练的库，这意味着可以从 <code>Trainer</code> 类中调用这个库。`,ne,T,Qe="在开始之前，请确保已安装 Accelerate，并且至少使用 PyTorch 2.1.0 或更高版本。",pe,j,re,g,ce,y,ke=`首先，运行 <a href="https://huggingface.co/docs/accelerate/package_reference/cli#accelerate-config" rel="nofollow"><code>accelerate config</code></a>
命令为您的训练环境创建一个配置文件。Accelerate 使用此配置文件根据您在 <code>accelerate config</code>
中选择的训练选项来自动搭建正确的训练环境。`,ie,w,fe,J,We=`运行 <code>accelerate config</code> 时，您将被提示一系列选项来配置训练环境。
本节涵盖了一些最重要的 FSDP 选项。要了解有关其他可用的 FSDP 选项的更多信息，
请查阅 <a href="https://huggingface.co/docs/transformers/main_classes/trainer#transformers.TrainingArguments.fsdp_config" rel="nofollow">fsdp_config</a> 参数。`,me,Z,de,S,Ae="FSDP 提供了多种可选择的分片策略：",oe,B,Le="<li><code>FULL_SHARD</code> - 将模型参数、梯度和优化器状态跨 Worker 进行分片；为此选项选择 <code>1</code></li> <li><code>SHARD_GRAD_OP</code>- 将梯度和优化器状态跨 Worker 进行分片；为此选项选择 <code>2</code></li> <li><code>NO_SHARD</code> - 不分片任何内容（这等同于 DDP）；为此选项选择 <code>3</code></li> <li><code>HYBRID_SHARD</code> - 在每个 Worker 中分片模型参数、梯度和优化器状态，其中每个 Worker 也有完整副本；为此选项选择 <code>4</code></li> <li><code>HYBRID_SHARD_ZERO2</code> - 在每个 Worker 中分片梯度和优化器状态，其中每个 Worker 也有完整副本；为此选项选择 <code>5</code></li>",he,C,ze="这由 <code>fsdp_sharding_strategy</code> 标志启用。",_e,b,$e,F,Ye=`当参数和梯度在不使用时可以卸载到 CPU 上，以节省更多 GPU 内存并帮助您适应即使 FSDP 也不足以容纳大型模型的情况。
在运行 <code>accelerate config</code> 时，通过设置 <code>fsdp_offload_params: true</code> 来启用此功能。`,Ue,R,ue,P,Ie=`FSDP 是通过包装网络中的每个层来应用的。通常，包装是以嵌套方式应用的，其中完整的权重在每次前向传递后被丢弃，
以便在下一层使用内存。<strong>自动包装</strong>策略是实现这一点的最简单方法，您不需要更改任何代码。
您应该选择 <code>fsdp_auto_wrap_policy: TRANSFORMER_BASED_WRAP</code> 来包装一个 Transformer 层，
并且 <code>fsdp_transformer_layer_cls_to_wrap</code> 来指定要包装的层（例如 <code>BertLayer</code>）。`,Me,V,Oe=`否则，您可以选择基于大小的包装策略，其中如果一层的参数超过一定数量，则应用 FSDP。通过设置
<code>fsdp_wrap_policy: SIZE_BASED_WRAP</code> 和 <code>min_num_param</code> 来启用此功能，将参数设置为所需的大小阈值。`,Te,H,je,X,qe=`应该使用 <code>fsdp_state_dict_type: SHARDED_STATE_DICT</code> 来保存中间检查点，
因为在排名 0 上保存完整状态字典需要很长时间，通常会导致 <code>NCCL Timeout</code> 错误，因为在广播过程中会无限期挂起。
您可以使用 \`load_state“ 方法加载分片状态字典以恢复训练。`,ge,x,ye,E,Ke="然而，当训练结束时，您希望保存完整状态字典，因为分片状态字典仅与 FSDP 兼容。",we,N,Je,G,Ze,v,et=`<a href="https://pytorch.org/xla/release/2.1/index.html" rel="nofollow">PyTorch XLA</a> 支持用于 TPUs 的 FSDP 训练，
可以通过修改由 <code>accelerate config</code> 生成的 FSDP 配置文件来启用。除了上面指定的分片策略和包装选项外，
您还可以将以下参数添加到文件中。`,Se,D,Be,Q,tt=`<a href="https://github.com/pytorch/xla/blob/2e6e183e0724818f137c8135b34ef273dea33318/torch_xla/distributed/fsdp/xla_fully_sharded_data_parallel.py#L128" rel="nofollow"><code>xla_fsdp_settings</code></a>
允许您配置用于 FSDP 的额外 XLA 特定参数。`,Ce,k,be,W,lt="FSDP 配置文件示例如下所示：",Fe,A,Re,L,st=`要启动训练，请运行 <a href="https://huggingface.co/docs/accelerate/package_reference/cli#accelerate-launch" rel="nofollow"><code>accelerate launch</code></a>
命令，它将自动使用您之前使用 <code>accelerate config</code> 创建的配置文件。`,Pe,z,Ve,Y,He,I,Xe,O,at=`FSDP 在大规模模型训练方面是一个强大的工具，您可以使用多个 GPU 或 TPU。
通过分片模型参数、优化器和梯度状态，甚至在它们不活动时将其卸载到 CPU 上，
FSDP 可以减少大规模训练的高成本。如果您希望了解更多信息，下面的内容可能会有所帮助：`,xe,q,nt=`<li>深入参考 Accelerate 指南，了解有关
<a href="https://huggingface.co/docs/accelerate/usage_guides/fsdp" rel="nofollow">FSDP</a>的更多信息。</li> <li>阅读<a href="https://pytorch.org/blog/introducing-pytorch-fully-sharded-data-parallel-api/" rel="nofollow">介绍 PyTorch 完全分片数据并行（FSDP）API</a> 博文。</li> <li>阅读<a href="https://pytorch.org/blog/scaling-pytorch-models-on-cloud-tpus-with-fsdp/" rel="nofollow">使用 FSDP 在云 TPU 上扩展 PyTorch 模型</a>博文。</li>`,Ee,K,Ne,te,Ge;return u=new $({props:{title:"完全分片数据并行",local:"完全分片数据并行",headingTag:"h1"}}),j=new U({props:{code:"cGlwJTIwaW5zdGFsbCUyMGFjY2VsZXJhdGU=",highlighted:"pip install accelerate",wrap:!1}}),g=new $({props:{title:"FSDP 配置",local:"fsdp-配置",headingTag:"h2"}}),w=new U({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZw==",highlighted:"accelerate config",wrap:!1}}),Z=new $({props:{title:"分片策略",local:"分片策略",headingTag:"h3"}}),b=new $({props:{title:"CPU 卸载",local:"cpu-卸载",headingTag:"h3"}}),R=new $({props:{title:"包装策略",local:"包装策略",headingTag:"h3"}}),H=new $({props:{title:"检查点",local:"检查点",headingTag:"h3"}}),x=new U({props:{code:"JTIzJTIwJUU1JThDJTg1JUU1JTkwJUFCJUU2JUEzJTgwJUU2JTlGJUE1JUU3JTgyJUI5JUU3JTlBJTg0JUU3JTlCJUFFJUU1JUJEJTk1JTBBYWNjZWxlcmF0b3IubG9hZF9zdGF0ZSglMjJja3B0JTIyKQ==",highlighted:`<span class="hljs-comment"># 包含检查点的目录</span>
accelerator.load_state(<span class="hljs-string">&quot;ckpt&quot;</span>)`,wrap:!1}}),N=new U({props:{code:"aWYlMjB0cmFpbmVyLmlzX2ZzZHBfZW5hYmxlZCUzQSUwQSUyMCUyMCUyMCUyMHRyYWluZXIuYWNjZWxlcmF0b3Iuc3RhdGUuZnNkcF9wbHVnaW4uc2V0X3N0YXRlX2RpY3RfdHlwZSglMjJGVUxMX1NUQVRFX0RJQ1QlMjIpJTBBJTBBdHJhaW5lci5zYXZlX21vZGVsKHNjcmlwdF9hcmdzLm91dHB1dF9kaXIp",highlighted:`<span class="hljs-keyword">if</span> trainer.is_fsdp_enabled:
    trainer.accelerator.state.fsdp_plugin.set_state_dict_type(<span class="hljs-string">&quot;FULL_STATE_DICT&quot;</span>)

trainer.save_model(script_args.output_dir)`,wrap:!1}}),G=new $({props:{title:"TPU",local:"tpu",headingTag:"h3"}}),D=new U({props:{code:"eGxhJTNBJTIwVHJ1ZSUyMCUyMyUyMCVFNSVCRiU4NSVFOSVBMSVCQiVFOCVBRSVCRSVFNyVCRCVBRSVFNCVCOCVCQSUyMFRydWUlMjAlRTQlQkIlQTUlRTUlOTAlQUYlRTclOTQlQTglMjBQeVRvcmNoJTJGWExBJTBBeGxhX2ZzZHBfc2V0dGluZ3MlM0ElMjAlMjMlMjBYTEElMjAlRTclODklQjklRTUlQUUlOUElRTclOUElODQlMjBGU0RQJTIwJUU1JThGJTgyJUU2JTk1JUIwJTBBeGxhX2ZzZHBfZ3JhZF9ja3B0JTNBJTIwVHJ1ZSUyMCUyMyUyMCVFNCVCRCVCRiVFNyU5NCVBOCVFNiVBMiVBRiVFNSVCQSVBNiVFNiVBMyU4MCVFNiU5RiVBNSVFNyU4MiVCOQ==",highlighted:`<span class="hljs-attr">xla:</span> <span class="hljs-literal">True</span> <span class="hljs-comment"># 必须设置为 True 以启用 PyTorch/XLA</span>
<span class="hljs-attr">xla_fsdp_settings:</span> <span class="hljs-comment"># XLA 特定的 FSDP 参数</span>
<span class="hljs-attr">xla_fsdp_grad_ckpt:</span> <span class="hljs-literal">True</span> <span class="hljs-comment"># 使用梯度检查点</span>`,wrap:!1}}),k=new $({props:{title:"启动训练",local:"启动训练",headingTag:"h2"}}),A=new U({props:{code:"Y29tcHV0ZV9lbnZpcm9ubWVudCUzQSUyMExPQ0FMX01BQ0hJTkUlMEFkZWJ1ZyUzQSUyMGZhbHNlJTBBZGlzdHJpYnV0ZWRfdHlwZSUzQSUyMEZTRFAlMEFkb3duY2FzdF9iZjE2JTNBJTIwJTIybm8lMjIlMEFmc2RwX2NvbmZpZyUzQSUwQSUyMCUyMGZzZHBfYXV0b193cmFwX3BvbGljeSUzQSUyMFRSQU5TRk9STUVSX0JBU0VEX1dSQVAlMEElMjAlMjBmc2RwX2JhY2t3YXJkX3ByZWZldGNoX3BvbGljeSUzQSUyMEJBQ0tXQVJEX1BSRSUwQSUyMCUyMGZzZHBfY3B1X3JhbV9lZmZpY2llbnRfbG9hZGluZyUzQSUyMHRydWUlMEElMjAlMjBmc2RwX2ZvcndhcmRfcHJlZmV0Y2glM0ElMjBmYWxzZSUwQSUyMCUyMGZzZHBfb2ZmbG9hZF9wYXJhbXMlM0ElMjB0cnVlJTBBJTIwJTIwZnNkcF9zaGFyZGluZ19zdHJhdGVneSUzQSUyMDElMEElMjAlMjBmc2RwX3N0YXRlX2RpY3RfdHlwZSUzQSUyMFNIQVJERURfU1RBVEVfRElDVCUwQSUyMCUyMGZzZHBfc3luY19tb2R1bGVfc3RhdGVzJTNBJTIwdHJ1ZSUwQSUyMCUyMGZzZHBfdHJhbnNmb3JtZXJfbGF5ZXJfY2xzX3RvX3dyYXAlM0ElMjBCZXJ0TGF5ZXIlMEElMjAlMjBmc2RwX3VzZV9vcmlnX3BhcmFtcyUzQSUyMHRydWUlMEFtYWNoaW5lX3JhbmslM0ElMjAwJTBBbWFpbl90cmFpbmluZ19mdW5jdGlvbiUzQSUyMG1haW4lMEFtaXhlZF9wcmVjaXNpb24lM0ElMjBiZjE2JTBBbnVtX21hY2hpbmVzJTNBJTIwMSUwQW51bV9wcm9jZXNzZXMlM0ElMjAyJTBBcmR6dl9iYWNrZW5kJTNBJTIwc3RhdGljJTBBc2FtZV9uZXR3b3JrJTNBJTIwdHJ1ZSUwQXRwdV9lbnYlM0ElMjAlNUIlNUQlMEF0cHVfdXNlX2NsdXN0ZXIlM0ElMjBmYWxzZSUwQXRwdV91c2Vfc3VkbyUzQSUyMGZhbHNlJTBBdXNlX2NwdSUzQSUyMGZhbHNl",highlighted:`<span class="hljs-attr">compute_environment:</span> <span class="hljs-string">LOCAL_MACHINE</span>
<span class="hljs-attr">debug:</span> <span class="hljs-literal">false</span>
<span class="hljs-attr">distributed_type:</span> <span class="hljs-string">FSDP</span>
<span class="hljs-attr">downcast_bf16:</span> <span class="hljs-string">&quot;no&quot;</span>
<span class="hljs-attr">fsdp_config:</span>
  <span class="hljs-attr">fsdp_auto_wrap_policy:</span> <span class="hljs-string">TRANSFORMER_BASED_WRAP</span>
  <span class="hljs-attr">fsdp_backward_prefetch_policy:</span> <span class="hljs-string">BACKWARD_PRE</span>
  <span class="hljs-attr">fsdp_cpu_ram_efficient_loading:</span> <span class="hljs-literal">true</span>
  <span class="hljs-attr">fsdp_forward_prefetch:</span> <span class="hljs-literal">false</span>
  <span class="hljs-attr">fsdp_offload_params:</span> <span class="hljs-literal">true</span>
  <span class="hljs-attr">fsdp_sharding_strategy:</span> <span class="hljs-number">1</span>
  <span class="hljs-attr">fsdp_state_dict_type:</span> <span class="hljs-string">SHARDED_STATE_DICT</span>
  <span class="hljs-attr">fsdp_sync_module_states:</span> <span class="hljs-literal">true</span>
  <span class="hljs-attr">fsdp_transformer_layer_cls_to_wrap:</span> <span class="hljs-string">BertLayer</span>
  <span class="hljs-attr">fsdp_use_orig_params:</span> <span class="hljs-literal">true</span>
<span class="hljs-attr">machine_rank:</span> <span class="hljs-number">0</span>
<span class="hljs-attr">main_training_function:</span> <span class="hljs-string">main</span>
<span class="hljs-attr">mixed_precision:</span> <span class="hljs-string">bf16</span>
<span class="hljs-attr">num_machines:</span> <span class="hljs-number">1</span>
<span class="hljs-attr">num_processes:</span> <span class="hljs-number">2</span>
<span class="hljs-attr">rdzv_backend:</span> <span class="hljs-string">static</span>
<span class="hljs-attr">same_network:</span> <span class="hljs-literal">true</span>
<span class="hljs-attr">tpu_env:</span> []
<span class="hljs-attr">tpu_use_cluster:</span> <span class="hljs-literal">false</span>
<span class="hljs-attr">tpu_use_sudo:</span> <span class="hljs-literal">false</span>
<span class="hljs-attr">use_cpu:</span> <span class="hljs-literal">false</span>`,wrap:!1}}),z=new U({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMG15LXRyYWluZXItc2NyaXB0LnB5",highlighted:"accelerate launch my-trainer-script.py",wrap:!1}}),Y=new U({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMC0tZnNkcCUzRCUyMmZ1bGwlMjBzaGFyZCUyMiUyMC0tZnNkcF9jb25maWclM0QlMjJwYXRoJTJGdG8lMkZmc2RwX2NvbmZpZyUyRiUyMG15LXRyYWluZXItc2NyaXB0LnB5",highlighted:'accelerate launch --fsdp=<span class="hljs-string">&quot;full shard&quot;</span> --fsdp_config=<span class="hljs-string">&quot;path/to/fsdp_config/ my-trainer-script.py</span>',wrap:!1}}),I=new $({props:{title:"下一步",local:"下一步",headingTag:"h2"}}),K=new _t({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/zh/fsdp.md"}}),{c(){_=p("meta"),le=a(),ee=p("p"),se=a(),c(u.$$.fragment),ae=a(),M=p("p"),M.innerHTML=De,ne=a(),T=p("p"),T.textContent=Qe,pe=a(),c(j.$$.fragment),re=a(),c(g.$$.fragment),ce=a(),y=p("p"),y.innerHTML=ke,ie=a(),c(w.$$.fragment),fe=a(),J=p("p"),J.innerHTML=We,me=a(),c(Z.$$.fragment),de=a(),S=p("p"),S.textContent=Ae,oe=a(),B=p("ul"),B.innerHTML=Le,he=a(),C=p("p"),C.innerHTML=ze,_e=a(),c(b.$$.fragment),$e=a(),F=p("p"),F.innerHTML=Ye,Ue=a(),c(R.$$.fragment),ue=a(),P=p("p"),P.innerHTML=Ie,Me=a(),V=p("p"),V.innerHTML=Oe,Te=a(),c(H.$$.fragment),je=a(),X=p("p"),X.innerHTML=qe,ge=a(),c(x.$$.fragment),ye=a(),E=p("p"),E.textContent=Ke,we=a(),c(N.$$.fragment),Je=a(),c(G.$$.fragment),Ze=a(),v=p("p"),v.innerHTML=et,Se=a(),c(D.$$.fragment),Be=a(),Q=p("p"),Q.innerHTML=tt,Ce=a(),c(k.$$.fragment),be=a(),W=p("p"),W.textContent=lt,Fe=a(),c(A.$$.fragment),Re=a(),L=p("p"),L.innerHTML=st,Pe=a(),c(z.$$.fragment),Ve=a(),c(Y.$$.fragment),He=a(),c(I.$$.fragment),Xe=a(),O=p("p"),O.textContent=at,xe=a(),q=p("ul"),q.innerHTML=nt,Ee=a(),c(K.$$.fragment),Ne=a(),te=p("p"),this.h()},l(e){const t=ot("svelte-u9bgzb",document.head);_=r(t,"META",{name:!0,content:!0}),t.forEach(l),le=n(e),ee=r(e,"P",{}),pt(ee).forEach(l),se=n(e),i(u.$$.fragment,e),ae=n(e),M=r(e,"P",{"data-svelte-h":!0}),f(M)!=="svelte-130rbfi"&&(M.innerHTML=De),ne=n(e),T=r(e,"P",{"data-svelte-h":!0}),f(T)!=="svelte-1n4z3n9"&&(T.textContent=Qe),pe=n(e),i(j.$$.fragment,e),re=n(e),i(g.$$.fragment,e),ce=n(e),y=r(e,"P",{"data-svelte-h":!0}),f(y)!=="svelte-1o6qixw"&&(y.innerHTML=ke),ie=n(e),i(w.$$.fragment,e),fe=n(e),J=r(e,"P",{"data-svelte-h":!0}),f(J)!=="svelte-2mox0k"&&(J.innerHTML=We),me=n(e),i(Z.$$.fragment,e),de=n(e),S=r(e,"P",{"data-svelte-h":!0}),f(S)!=="svelte-18ncnte"&&(S.textContent=Ae),oe=n(e),B=r(e,"UL",{"data-svelte-h":!0}),f(B)!=="svelte-7jg32h"&&(B.innerHTML=Le),he=n(e),C=r(e,"P",{"data-svelte-h":!0}),f(C)!=="svelte-isacvu"&&(C.innerHTML=ze),_e=n(e),i(b.$$.fragment,e),$e=n(e),F=r(e,"P",{"data-svelte-h":!0}),f(F)!=="svelte-13eqbk2"&&(F.innerHTML=Ye),Ue=n(e),i(R.$$.fragment,e),ue=n(e),P=r(e,"P",{"data-svelte-h":!0}),f(P)!=="svelte-1xtp75a"&&(P.innerHTML=Ie),Me=n(e),V=r(e,"P",{"data-svelte-h":!0}),f(V)!=="svelte-wtqcp1"&&(V.innerHTML=Oe),Te=n(e),i(H.$$.fragment,e),je=n(e),X=r(e,"P",{"data-svelte-h":!0}),f(X)!=="svelte-tanzhp"&&(X.innerHTML=qe),ge=n(e),i(x.$$.fragment,e),ye=n(e),E=r(e,"P",{"data-svelte-h":!0}),f(E)!=="svelte-1e8kodj"&&(E.textContent=Ke),we=n(e),i(N.$$.fragment,e),Je=n(e),i(G.$$.fragment,e),Ze=n(e),v=r(e,"P",{"data-svelte-h":!0}),f(v)!=="svelte-l882fb"&&(v.innerHTML=et),Se=n(e),i(D.$$.fragment,e),Be=n(e),Q=r(e,"P",{"data-svelte-h":!0}),f(Q)!=="svelte-1fe7485"&&(Q.innerHTML=tt),Ce=n(e),i(k.$$.fragment,e),be=n(e),W=r(e,"P",{"data-svelte-h":!0}),f(W)!=="svelte-12574pf"&&(W.textContent=lt),Fe=n(e),i(A.$$.fragment,e),Re=n(e),L=r(e,"P",{"data-svelte-h":!0}),f(L)!=="svelte-1244lfp"&&(L.innerHTML=st),Pe=n(e),i(z.$$.fragment,e),Ve=n(e),i(Y.$$.fragment,e),He=n(e),i(I.$$.fragment,e),Xe=n(e),O=r(e,"P",{"data-svelte-h":!0}),f(O)!=="svelte-qjrava"&&(O.textContent=at),xe=n(e),q=r(e,"UL",{"data-svelte-h":!0}),f(q)!=="svelte-w3rkgj"&&(q.innerHTML=nt),Ee=n(e),i(K.$$.fragment,e),Ne=n(e),te=r(e,"P",{}),pt(te).forEach(l),this.h()},h(){rt(_,"name","hf:doc:metadata"),rt(_,"content",Ut)},m(e,t){ht(document.head,_),s(e,le,t),s(e,ee,t),s(e,se,t),m(u,e,t),s(e,ae,t),s(e,M,t),s(e,ne,t),s(e,T,t),s(e,pe,t),m(j,e,t),s(e,re,t),m(g,e,t),s(e,ce,t),s(e,y,t),s(e,ie,t),m(w,e,t),s(e,fe,t),s(e,J,t),s(e,me,t),m(Z,e,t),s(e,de,t),s(e,S,t),s(e,oe,t),s(e,B,t),s(e,he,t),s(e,C,t),s(e,_e,t),m(b,e,t),s(e,$e,t),s(e,F,t),s(e,Ue,t),m(R,e,t),s(e,ue,t),s(e,P,t),s(e,Me,t),s(e,V,t),s(e,Te,t),m(H,e,t),s(e,je,t),s(e,X,t),s(e,ge,t),m(x,e,t),s(e,ye,t),s(e,E,t),s(e,we,t),m(N,e,t),s(e,Je,t),m(G,e,t),s(e,Ze,t),s(e,v,t),s(e,Se,t),m(D,e,t),s(e,Be,t),s(e,Q,t),s(e,Ce,t),m(k,e,t),s(e,be,t),s(e,W,t),s(e,Fe,t),m(A,e,t),s(e,Re,t),s(e,L,t),s(e,Pe,t),m(z,e,t),s(e,Ve,t),m(Y,e,t),s(e,He,t),m(I,e,t),s(e,Xe,t),s(e,O,t),s(e,xe,t),s(e,q,t),s(e,Ee,t),m(K,e,t),s(e,Ne,t),s(e,te,t),Ge=!0},p:it,i(e){Ge||(d(u.$$.fragment,e),d(j.$$.fragment,e),d(g.$$.fragment,e),d(w.$$.fragment,e),d(Z.$$.fragment,e),d(b.$$.fragment,e),d(R.$$.fragment,e),d(H.$$.fragment,e),d(x.$$.fragment,e),d(N.$$.fragment,e),d(G.$$.fragment,e),d(D.$$.fragment,e),d(k.$$.fragment,e),d(A.$$.fragment,e),d(z.$$.fragment,e),d(Y.$$.fragment,e),d(I.$$.fragment,e),d(K.$$.fragment,e),Ge=!0)},o(e){o(u.$$.fragment,e),o(j.$$.fragment,e),o(g.$$.fragment,e),o(w.$$.fragment,e),o(Z.$$.fragment,e),o(b.$$.fragment,e),o(R.$$.fragment,e),o(H.$$.fragment,e),o(x.$$.fragment,e),o(N.$$.fragment,e),o(G.$$.fragment,e),o(D.$$.fragment,e),o(k.$$.fragment,e),o(A.$$.fragment,e),o(z.$$.fragment,e),o(Y.$$.fragment,e),o(I.$$.fragment,e),o(K.$$.fragment,e),Ge=!1},d(e){e&&(l(le),l(ee),l(se),l(ae),l(M),l(ne),l(T),l(pe),l(re),l(ce),l(y),l(ie),l(fe),l(J),l(me),l(de),l(S),l(oe),l(B),l(he),l(C),l(_e),l($e),l(F),l(Ue),l(ue),l(P),l(Me),l(V),l(Te),l(je),l(X),l(ge),l(ye),l(E),l(we),l(Je),l(Ze),l(v),l(Se),l(Be),l(Q),l(Ce),l(be),l(W),l(Fe),l(Re),l(L),l(Pe),l(Ve),l(He),l(Xe),l(O),l(xe),l(q),l(Ee),l(Ne),l(te)),l(_),h(u,e),h(j,e),h(g,e),h(w,e),h(Z,e),h(b,e),h(R,e),h(H,e),h(x,e),h(N,e),h(G,e),h(D,e),h(k,e),h(A,e),h(z,e),h(Y,e),h(I,e),h(K,e)}}}const Ut='{"title":"完全分片数据并行","local":"完全分片数据并行","sections":[{"title":"FSDP 配置","local":"fsdp-配置","sections":[{"title":"分片策略","local":"分片策略","sections":[],"depth":3},{"title":"CPU 卸载","local":"cpu-卸载","sections":[],"depth":3},{"title":"包装策略","local":"包装策略","sections":[],"depth":3},{"title":"检查点","local":"检查点","sections":[],"depth":3},{"title":"TPU","local":"tpu","sections":[],"depth":3}],"depth":2},{"title":"启动训练","local":"启动训练","sections":[],"depth":2},{"title":"下一步","local":"下一步","sections":[],"depth":2}],"depth":1}';function ut(ve){return ft(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class yt extends mt{constructor(_){super(),dt(this,_,ut,$t,ct,{})}}export{yt as component};
