import{S as Ut,i as Dt,s as Ft,e as l,k as h,w as m,t as n,M as Bt,c as s,d as a,m as f,a as o,x as d,h as p,b as c,G as t,g as i,y as u,L as Gt,q as _,o as v,B as $,v as Wt}from"../chunks/vendor-hf-doc-builder.js";import{I as le}from"../chunks/IconCopyLink-hf-doc-builder.js";import{C as F}from"../chunks/CodeBlock-hf-doc-builder.js";function Lt(rt){let g,Ne,k,S,fe,B,_a,me,va,xe,C,$a,G,wa,ba,He,A,q,de,W,ga,ue,ka,Te,se,Aa,Me,L,Oe,w,Ea,_e,ya,ja,ve,Pa,za,Ue,I,De,E,N,$e,J,Sa,we,Ca,Fe,x,qa,be,Na,xa,Be,R,Ge,y,H,ge,K,Ha,ke,Ta,We,b,Ma,Ae,Oa,Ua,Ee,Da,Fa,Le,Q,Ie,oe,Ba,Je,V,Re,j,T,ye,X,Ga,je,Wa,Ke,ie,La,Qe,P,M,Pe,Y,Ia,ze,Ja,Ve,ne,Ra,Xe,Z,Ye,pe,Ka,Ze,ee,ea,z,O,Se,ae,Qa,Ce,Va,aa,U,Xa,qe,Ya,Za,ta,te,ra,D,et,re,at,tt,la;return B=new le({}),W=new le({}),L=new F({props:{code:"pip install accelerate",highlighted:"pip install accelerate"}}),I=new F({props:{code:`from accelerate import Accelerator

accelerator = Accelerator()`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator

<span class="hljs-meta">&gt;&gt;&gt; </span>accelerator = Accelerator()`}}),J=new le({}),R=new F({props:{code:`train_dataloader, eval_dataloader, model, optimizer = accelerator.prepare(
    train_dataloader, eval_dataloader, model, optimizer
)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>train_dataloader, eval_dataloader, model, optimizer = accelerator.prepare(
<span class="hljs-meta">... </span>    train_dataloader, eval_dataloader, model, optimizer
<span class="hljs-meta">... </span>)`}}),K=new le({}),Q=new F({props:{code:`for epoch in range(num_epochs):
    for batch in train_dataloader:
        outputs = model(**batch)
        loss = outputs.loss
        accelerator.backward(loss)

        optimizer.step()
        lr_scheduler.step()
        optimizer.zero_grad()
        progress_bar.update(1)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> epoch <span class="hljs-keyword">in</span> <span class="hljs-built_in">range</span>(num_epochs):
<span class="hljs-meta">... </span>    <span class="hljs-keyword">for</span> batch <span class="hljs-keyword">in</span> train_dataloader:
<span class="hljs-meta">... </span>        outputs = model(**batch)
<span class="hljs-meta">... </span>        loss = outputs.loss
<span class="hljs-meta">... </span>        accelerator.backward(loss)

<span class="hljs-meta">... </span>        optimizer.step()
<span class="hljs-meta">... </span>        lr_scheduler.step()
<span class="hljs-meta">... </span>        optimizer.zero_grad()
<span class="hljs-meta">... </span>        progress_bar.update(<span class="hljs-number">1</span>)`}}),V=new F({props:{code:`+ from accelerate import Accelerator
  from transformers import AdamW, AutoModelForSequenceClassification, get_scheduler

+ accelerator = Accelerator()

  model = AutoModelForSequenceClassification.from_pretrained(checkpoint, num_labels=2)
  optimizer = AdamW(model.parameters(), lr=3e-5)

- device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
- model.to(device)

+ train_dataloader, eval_dataloader, model, optimizer = accelerator.prepare(
+     train_dataloader, eval_dataloader, model, optimizer
+ )

  num_epochs = 3
  num_training_steps = num_epochs * len(train_dataloader)
  lr_scheduler = get_scheduler(
      "linear",
      optimizer=optimizer,
      num_warmup_steps=0,
      num_training_steps=num_training_steps
  )

  progress_bar = tqdm(range(num_training_steps))

  model.train()
  for epoch in range(num_epochs):
      for batch in train_dataloader:
-         batch = {k: v.to(device) for k, v in batch.items()}
          outputs = model(**batch)
          loss = outputs.loss
-         loss.backward()
+         accelerator.backward(loss)

          optimizer.step()
          lr_scheduler.step()
          optimizer.zero_grad()
          progress_bar.update(1)`,highlighted:`<span class="hljs-addition">+ from accelerate import Accelerator</span>
  from transformers import AdamW, AutoModelForSequenceClassification, get_scheduler

<span class="hljs-addition">+ accelerator = Accelerator()</span>

  model = AutoModelForSequenceClassification.from_pretrained(checkpoint, num_labels=2)
  optimizer = AdamW(model.parameters(), lr=3e-5)

<span class="hljs-deletion">- device = torch.device(&quot;cuda&quot;) if torch.cuda.is_available() else torch.device(&quot;cpu&quot;)</span>
<span class="hljs-deletion">- model.to(device)</span>

<span class="hljs-addition">+ train_dataloader, eval_dataloader, model, optimizer = accelerator.prepare(</span>
<span class="hljs-addition">+     train_dataloader, eval_dataloader, model, optimizer</span>
<span class="hljs-addition">+ )</span>

  num_epochs = 3
  num_training_steps = num_epochs * len(train_dataloader)
  lr_scheduler = get_scheduler(
      &quot;linear&quot;,
      optimizer=optimizer,
      num_warmup_steps=0,
      num_training_steps=num_training_steps
  )

  progress_bar = tqdm(range(num_training_steps))

  model.train()
  for epoch in range(num_epochs):
      for batch in train_dataloader:
<span class="hljs-deletion">-         batch = {k: v.to(device) for k, v in batch.items()}</span>
          outputs = model(**batch)
          loss = outputs.loss
<span class="hljs-deletion">-         loss.backward()</span>
<span class="hljs-addition">+         accelerator.backward(loss)</span>

          optimizer.step()
          lr_scheduler.step()
          optimizer.zero_grad()
          progress_bar.update(1)`}}),X=new le({}),Y=new le({}),Z=new F({props:{code:"accelerate config",highlighted:"accelerate config"}}),ee=new F({props:{code:"accelerate launch train.py",highlighted:"accelerate launch train.py"}}),ae=new le({}),te=new F({props:{code:`from accelerate import notebook_launcher

notebook_launcher(training_function)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> notebook_launcher

<span class="hljs-meta">&gt;&gt;&gt; </span>notebook_launcher(training_function)`}}),{c(){g=l("meta"),Ne=h(),k=l("h1"),S=l("a"),fe=l("span"),m(B.$$.fragment),_a=h(),me=l("span"),va=n("\u{1F917} Accelerate\uB97C \uD65C\uC6A9\uD55C \uBD84\uC0B0 \uD559\uC2B5"),xe=h(),C=l("p"),$a=n("\uBAA8\uB378\uC774 \uCEE4\uC9C0\uBA74\uC11C \uBCD1\uB82C \uCC98\uB9AC\uB294 \uC81C\uD55C\uB41C \uD558\uB4DC\uC6E8\uC5B4\uC5D0\uC11C \uB354 \uD070 \uBAA8\uB378\uC744 \uD6C8\uB828\uD558\uACE0 \uD6C8\uB828 \uC18D\uB3C4\uB97C \uBA87 \uBC30\uB85C \uAC00\uC18D\uD654\uD558\uAE30 \uC704\uD55C \uC804\uB7B5\uC73C\uB85C \uB4F1\uC7A5\uD588\uC2B5\uB2C8\uB2E4. Hugging Face\uC5D0\uC11C\uB294 \uC0AC\uC6A9\uC790\uAC00 \uD558\uB098\uC758 \uBA38\uC2E0\uC5D0 \uC5EC\uB7EC \uAC1C\uC758 GPU\uB97C \uC0AC\uC6A9\uD558\uB4E0 \uC5EC\uB7EC \uBA38\uC2E0\uC5D0 \uC5EC\uB7EC \uAC1C\uC758 GPU\uB97C \uC0AC\uC6A9\uD558\uB4E0 \uBAA8\uB4E0 \uC720\uD615\uC758 \uBD84\uC0B0 \uC124\uC815\uC5D0\uC11C \u{1F917} Transformers \uBAA8\uB378\uC744 \uC27D\uAC8C \uD6C8\uB828\uD560 \uC218 \uC788\uB3C4\uB85D \uB3D5\uAE30 \uC704\uD574 "),G=l("a"),wa=n("\u{1F917} Accelerate"),ba=n(" \uB77C\uC774\uBE0C\uB7EC\uB9AC\uB97C \uB9CC\uB4E4\uC5C8\uC2B5\uB2C8\uB2E4. \uC774 \uD29C\uD1A0\uB9AC\uC5BC\uC5D0\uC11C\uB294 \uBD84\uC0B0 \uD658\uACBD\uC5D0\uC11C \uD6C8\uB828\uD560 \uC218 \uC788\uB3C4\uB85D \uAE30\uBCF8 PyTorch \uD6C8\uB828 \uB8E8\uD504\uB97C \uCEE4\uC2A4\uD130\uB9C8\uC774\uC988\uD558\uB294 \uBC29\uBC95\uC744 \uC54C\uC544\uBD05\uC2DC\uB2E4."),He=h(),A=l("h2"),q=l("a"),de=l("span"),m(W.$$.fragment),ga=h(),ue=l("span"),ka=n("\uC124\uC815"),Te=h(),se=l("p"),Aa=n("\u{1F917} Accelerate \uC124\uCE58 \uC2DC\uC791\uD558\uAE30:"),Me=h(),m(L.$$.fragment),Oe=h(),w=l("p"),Ea=n("\uADF8 \uB2E4\uC74C, "),_e=l("code"),ya=n("Accelerator"),ja=n(" \uAC1D\uCCB4\uB97C \uBD88\uB7EC\uC624\uACE0 \uC0DD\uC131\uD569\uB2C8\uB2E4. "),ve=l("code"),Pa=n("Accelerator"),za=n("\uB294 \uC790\uB3D9\uC73C\uB85C \uBD84\uC0B0 \uC124\uC815 \uC720\uD615\uC744 \uAC10\uC9C0\uD558\uACE0 \uD6C8\uB828\uC5D0 \uD544\uC694\uD55C \uBAA8\uB4E0 \uAD6C\uC131 \uC694\uC18C\uB97C \uCD08\uAE30\uD654\uD569\uB2C8\uB2E4. \uC7A5\uCE58\uC5D0 \uBAA8\uB378\uC744 \uBA85\uC2DC\uC801\uC73C\uB85C \uBC30\uCE58\uD560 \uD544\uC694\uB294 \uC5C6\uC2B5\uB2C8\uB2E4."),Ue=h(),m(I.$$.fragment),De=h(),E=l("h2"),N=l("a"),$e=l("span"),m(J.$$.fragment),Sa=h(),we=l("span"),Ca=n("\uAC00\uC18D\uD654\uB97C \uC704\uD55C \uC900\uBE44"),Fe=h(),x=l("p"),qa=n("\uB2E4\uC74C \uB2E8\uACC4\uB294 \uAD00\uB828\uB41C \uBAA8\uB4E0 \uD6C8\uB828 \uAC1D\uCCB4\uB97C "),be=l("code"),Na=n("prepare"),xa=n(" \uBA54\uC18C\uB4DC\uC5D0 \uC804\uB2EC\uD558\uB294 \uAC83\uC785\uB2C8\uB2E4. \uC5EC\uAE30\uC5D0\uB294 \uD6C8\uB828 \uBC0F \uD3C9\uAC00 \uB370\uC774\uD130\uB85C\uB354, \uBAA8\uB378 \uBC0F \uC635\uD2F0\uB9C8\uC774\uC800\uAC00 \uD3EC\uD568\uB429\uB2C8\uB2E4:"),Be=h(),m(R.$$.fragment),Ge=h(),y=l("h2"),H=l("a"),ge=l("span"),m(K.$$.fragment),Ha=h(),ke=l("span"),Ta=n("\uBC31\uC6CC\uB4DC(Backward)"),We=h(),b=l("p"),Ma=n("\uB9C8\uC9C0\uB9C9\uC73C\uB85C \uD6C8\uB828 \uB8E8\uD504\uC758 \uC77C\uBC18\uC801\uC778 "),Ae=l("code"),Oa=n("loss.backward()"),Ua=n("\uB97C \u{1F917} Accelerate\uC758 "),Ee=l("code"),Da=n("backward"),Fa=n(" \uBA54\uC18C\uB4DC\uB85C \uB300\uCCB4\uD558\uAE30\uB9CC \uD558\uBA74 \uB429\uB2C8\uB2E4:"),Le=h(),m(Q.$$.fragment),Ie=h(),oe=l("p"),Ba=n("\uB2E4\uC74C \uCF54\uB4DC\uC5D0\uC11C \uBCFC \uC218 \uC788\uB4EF\uC774, \uD6C8\uB828 \uB8E8\uD504\uC5D0 \uCF54\uB4DC \uB124 \uC904\uB9CC \uCD94\uAC00\uD558\uBA74 \uBD84\uC0B0 \uD559\uC2B5\uC744 \uD65C\uC131\uD654\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4!"),Je=h(),m(V.$$.fragment),Re=h(),j=l("h2"),T=l("a"),ye=l("span"),m(X.$$.fragment),Ga=h(),je=l("span"),Wa=n("\uD559\uC2B5"),Ke=h(),ie=l("p"),La=n("\uAD00\uB828 \uCF54\uB4DC\uB97C \uCD94\uAC00\uD55C \uD6C4\uC5D0\uB294 \uC2A4\uD06C\uB9BD\uD2B8\uB098 Colaboratory\uC640 \uAC19\uC740 \uB178\uD2B8\uBD81\uC5D0\uC11C \uD6C8\uB828\uC744 \uC2DC\uC791\uD558\uC138\uC694."),Qe=h(),P=l("h3"),M=l("a"),Pe=l("span"),m(Y.$$.fragment),Ia=h(),ze=l("span"),Ja=n("\uC2A4\uD06C\uB9BD\uD2B8\uB85C \uD559\uC2B5\uD558\uAE30"),Ve=h(),ne=l("p"),Ra=n("\uC2A4\uD06C\uB9BD\uD2B8\uC5D0\uC11C \uD6C8\uB828\uC744 \uC2E4\uD589\uD558\uB294 \uACBD\uC6B0, \uB2E4\uC74C \uBA85\uB839\uC744 \uC2E4\uD589\uD558\uC5EC \uAD6C\uC131 \uD30C\uC77C\uC744 \uC0DD\uC131\uD558\uACE0 \uC800\uC7A5\uD569\uB2C8\uB2E4:"),Xe=h(),m(Z.$$.fragment),Ye=h(),pe=l("p"),Ka=n("Then launch your training with:"),Ze=h(),m(ee.$$.fragment),ea=h(),z=l("h3"),O=l("a"),Se=l("span"),m(ae.$$.fragment),Qa=h(),Ce=l("span"),Va=n("\uB178\uD2B8\uBD81\uC73C\uB85C \uD559\uC2B5\uD558\uAE30"),aa=h(),U=l("p"),Xa=n("Collaboratory\uC758 TPU\uB97C \uC0AC\uC6A9\uD558\uB824\uB294 \uACBD\uC6B0, \uB178\uD2B8\uBD81\uC5D0\uC11C\uB3C4 \u{1F917} Accelerate\uB97C \uC2E4\uD589\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4. \uD6C8\uB828\uC744 \uB2F4\uB2F9\uD558\uB294 \uBAA8\uB4E0 \uCF54\uB4DC\uB97C \uD568\uC218\uB85C \uAC10\uC2F8\uC11C "),qe=l("code"),Ya=n("notebook_launcher"),Za=n("\uC5D0 \uC804\uB2EC\uD558\uC138\uC694:"),ta=h(),m(te.$$.fragment),ra=h(),D=l("p"),et=n("\u{1F917} Accelerate \uBC0F \uB2E4\uC591\uD55C \uAE30\uB2A5\uC5D0 \uB300\uD55C \uC790\uC138\uD55C \uB0B4\uC6A9\uC740 "),re=l("a"),at=n("documentation"),tt=n("\uB97C \uCC38\uC870\uD558\uC138\uC694."),this.h()},l(e){const r=Bt('[data-svelte="svelte-1phssyn"]',document.head);g=s(r,"META",{name:!0,content:!0}),r.forEach(a),Ne=f(e),k=s(e,"H1",{class:!0});var sa=o(k);S=s(sa,"A",{id:!0,class:!0,href:!0});var lt=o(S);fe=s(lt,"SPAN",{});var st=o(fe);d(B.$$.fragment,st),st.forEach(a),lt.forEach(a),_a=f(sa),me=s(sa,"SPAN",{});var ot=o(me);va=p(ot,"\u{1F917} Accelerate\uB97C \uD65C\uC6A9\uD55C \uBD84\uC0B0 \uD559\uC2B5"),ot.forEach(a),sa.forEach(a),xe=f(e),C=s(e,"P",{});var oa=o(C);$a=p(oa,"\uBAA8\uB378\uC774 \uCEE4\uC9C0\uBA74\uC11C \uBCD1\uB82C \uCC98\uB9AC\uB294 \uC81C\uD55C\uB41C \uD558\uB4DC\uC6E8\uC5B4\uC5D0\uC11C \uB354 \uD070 \uBAA8\uB378\uC744 \uD6C8\uB828\uD558\uACE0 \uD6C8\uB828 \uC18D\uB3C4\uB97C \uBA87 \uBC30\uB85C \uAC00\uC18D\uD654\uD558\uAE30 \uC704\uD55C \uC804\uB7B5\uC73C\uB85C \uB4F1\uC7A5\uD588\uC2B5\uB2C8\uB2E4. Hugging Face\uC5D0\uC11C\uB294 \uC0AC\uC6A9\uC790\uAC00 \uD558\uB098\uC758 \uBA38\uC2E0\uC5D0 \uC5EC\uB7EC \uAC1C\uC758 GPU\uB97C \uC0AC\uC6A9\uD558\uB4E0 \uC5EC\uB7EC \uBA38\uC2E0\uC5D0 \uC5EC\uB7EC \uAC1C\uC758 GPU\uB97C \uC0AC\uC6A9\uD558\uB4E0 \uBAA8\uB4E0 \uC720\uD615\uC758 \uBD84\uC0B0 \uC124\uC815\uC5D0\uC11C \u{1F917} Transformers \uBAA8\uB378\uC744 \uC27D\uAC8C \uD6C8\uB828\uD560 \uC218 \uC788\uB3C4\uB85D \uB3D5\uAE30 \uC704\uD574 "),G=s(oa,"A",{href:!0,rel:!0});var it=o(G);wa=p(it,"\u{1F917} Accelerate"),it.forEach(a),ba=p(oa," \uB77C\uC774\uBE0C\uB7EC\uB9AC\uB97C \uB9CC\uB4E4\uC5C8\uC2B5\uB2C8\uB2E4. \uC774 \uD29C\uD1A0\uB9AC\uC5BC\uC5D0\uC11C\uB294 \uBD84\uC0B0 \uD658\uACBD\uC5D0\uC11C \uD6C8\uB828\uD560 \uC218 \uC788\uB3C4\uB85D \uAE30\uBCF8 PyTorch \uD6C8\uB828 \uB8E8\uD504\uB97C \uCEE4\uC2A4\uD130\uB9C8\uC774\uC988\uD558\uB294 \uBC29\uBC95\uC744 \uC54C\uC544\uBD05\uC2DC\uB2E4."),oa.forEach(a),He=f(e),A=s(e,"H2",{class:!0});var ia=o(A);q=s(ia,"A",{id:!0,class:!0,href:!0});var nt=o(q);de=s(nt,"SPAN",{});var pt=o(de);d(W.$$.fragment,pt),pt.forEach(a),nt.forEach(a),ga=f(ia),ue=s(ia,"SPAN",{});var ct=o(ue);ka=p(ct,"\uC124\uC815"),ct.forEach(a),ia.forEach(a),Te=f(e),se=s(e,"P",{});var ht=o(se);Aa=p(ht,"\u{1F917} Accelerate \uC124\uCE58 \uC2DC\uC791\uD558\uAE30:"),ht.forEach(a),Me=f(e),d(L.$$.fragment,e),Oe=f(e),w=s(e,"P",{});var ce=o(w);Ea=p(ce,"\uADF8 \uB2E4\uC74C, "),_e=s(ce,"CODE",{});var ft=o(_e);ya=p(ft,"Accelerator"),ft.forEach(a),ja=p(ce," \uAC1D\uCCB4\uB97C \uBD88\uB7EC\uC624\uACE0 \uC0DD\uC131\uD569\uB2C8\uB2E4. "),ve=s(ce,"CODE",{});var mt=o(ve);Pa=p(mt,"Accelerator"),mt.forEach(a),za=p(ce,"\uB294 \uC790\uB3D9\uC73C\uB85C \uBD84\uC0B0 \uC124\uC815 \uC720\uD615\uC744 \uAC10\uC9C0\uD558\uACE0 \uD6C8\uB828\uC5D0 \uD544\uC694\uD55C \uBAA8\uB4E0 \uAD6C\uC131 \uC694\uC18C\uB97C \uCD08\uAE30\uD654\uD569\uB2C8\uB2E4. \uC7A5\uCE58\uC5D0 \uBAA8\uB378\uC744 \uBA85\uC2DC\uC801\uC73C\uB85C \uBC30\uCE58\uD560 \uD544\uC694\uB294 \uC5C6\uC2B5\uB2C8\uB2E4."),ce.forEach(a),Ue=f(e),d(I.$$.fragment,e),De=f(e),E=s(e,"H2",{class:!0});var na=o(E);N=s(na,"A",{id:!0,class:!0,href:!0});var dt=o(N);$e=s(dt,"SPAN",{});var ut=o($e);d(J.$$.fragment,ut),ut.forEach(a),dt.forEach(a),Sa=f(na),we=s(na,"SPAN",{});var _t=o(we);Ca=p(_t,"\uAC00\uC18D\uD654\uB97C \uC704\uD55C \uC900\uBE44"),_t.forEach(a),na.forEach(a),Fe=f(e),x=s(e,"P",{});var pa=o(x);qa=p(pa,"\uB2E4\uC74C \uB2E8\uACC4\uB294 \uAD00\uB828\uB41C \uBAA8\uB4E0 \uD6C8\uB828 \uAC1D\uCCB4\uB97C "),be=s(pa,"CODE",{});var vt=o(be);Na=p(vt,"prepare"),vt.forEach(a),xa=p(pa," \uBA54\uC18C\uB4DC\uC5D0 \uC804\uB2EC\uD558\uB294 \uAC83\uC785\uB2C8\uB2E4. \uC5EC\uAE30\uC5D0\uB294 \uD6C8\uB828 \uBC0F \uD3C9\uAC00 \uB370\uC774\uD130\uB85C\uB354, \uBAA8\uB378 \uBC0F \uC635\uD2F0\uB9C8\uC774\uC800\uAC00 \uD3EC\uD568\uB429\uB2C8\uB2E4:"),pa.forEach(a),Be=f(e),d(R.$$.fragment,e),Ge=f(e),y=s(e,"H2",{class:!0});var ca=o(y);H=s(ca,"A",{id:!0,class:!0,href:!0});var $t=o(H);ge=s($t,"SPAN",{});var wt=o(ge);d(K.$$.fragment,wt),wt.forEach(a),$t.forEach(a),Ha=f(ca),ke=s(ca,"SPAN",{});var bt=o(ke);Ta=p(bt,"\uBC31\uC6CC\uB4DC(Backward)"),bt.forEach(a),ca.forEach(a),We=f(e),b=s(e,"P",{});var he=o(b);Ma=p(he,"\uB9C8\uC9C0\uB9C9\uC73C\uB85C \uD6C8\uB828 \uB8E8\uD504\uC758 \uC77C\uBC18\uC801\uC778 "),Ae=s(he,"CODE",{});var gt=o(Ae);Oa=p(gt,"loss.backward()"),gt.forEach(a),Ua=p(he,"\uB97C \u{1F917} Accelerate\uC758 "),Ee=s(he,"CODE",{});var kt=o(Ee);Da=p(kt,"backward"),kt.forEach(a),Fa=p(he," \uBA54\uC18C\uB4DC\uB85C \uB300\uCCB4\uD558\uAE30\uB9CC \uD558\uBA74 \uB429\uB2C8\uB2E4:"),he.forEach(a),Le=f(e),d(Q.$$.fragment,e),Ie=f(e),oe=s(e,"P",{});var At=o(oe);Ba=p(At,"\uB2E4\uC74C \uCF54\uB4DC\uC5D0\uC11C \uBCFC \uC218 \uC788\uB4EF\uC774, \uD6C8\uB828 \uB8E8\uD504\uC5D0 \uCF54\uB4DC \uB124 \uC904\uB9CC \uCD94\uAC00\uD558\uBA74 \uBD84\uC0B0 \uD559\uC2B5\uC744 \uD65C\uC131\uD654\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4!"),At.forEach(a),Je=f(e),d(V.$$.fragment,e),Re=f(e),j=s(e,"H2",{class:!0});var ha=o(j);T=s(ha,"A",{id:!0,class:!0,href:!0});var Et=o(T);ye=s(Et,"SPAN",{});var yt=o(ye);d(X.$$.fragment,yt),yt.forEach(a),Et.forEach(a),Ga=f(ha),je=s(ha,"SPAN",{});var jt=o(je);Wa=p(jt,"\uD559\uC2B5"),jt.forEach(a),ha.forEach(a),Ke=f(e),ie=s(e,"P",{});var Pt=o(ie);La=p(Pt,"\uAD00\uB828 \uCF54\uB4DC\uB97C \uCD94\uAC00\uD55C \uD6C4\uC5D0\uB294 \uC2A4\uD06C\uB9BD\uD2B8\uB098 Colaboratory\uC640 \uAC19\uC740 \uB178\uD2B8\uBD81\uC5D0\uC11C \uD6C8\uB828\uC744 \uC2DC\uC791\uD558\uC138\uC694."),Pt.forEach(a),Qe=f(e),P=s(e,"H3",{class:!0});var fa=o(P);M=s(fa,"A",{id:!0,class:!0,href:!0});var zt=o(M);Pe=s(zt,"SPAN",{});var St=o(Pe);d(Y.$$.fragment,St),St.forEach(a),zt.forEach(a),Ia=f(fa),ze=s(fa,"SPAN",{});var Ct=o(ze);Ja=p(Ct,"\uC2A4\uD06C\uB9BD\uD2B8\uB85C \uD559\uC2B5\uD558\uAE30"),Ct.forEach(a),fa.forEach(a),Ve=f(e),ne=s(e,"P",{});var qt=o(ne);Ra=p(qt,"\uC2A4\uD06C\uB9BD\uD2B8\uC5D0\uC11C \uD6C8\uB828\uC744 \uC2E4\uD589\uD558\uB294 \uACBD\uC6B0, \uB2E4\uC74C \uBA85\uB839\uC744 \uC2E4\uD589\uD558\uC5EC \uAD6C\uC131 \uD30C\uC77C\uC744 \uC0DD\uC131\uD558\uACE0 \uC800\uC7A5\uD569\uB2C8\uB2E4:"),qt.forEach(a),Xe=f(e),d(Z.$$.fragment,e),Ye=f(e),pe=s(e,"P",{});var Nt=o(pe);Ka=p(Nt,"Then launch your training with:"),Nt.forEach(a),Ze=f(e),d(ee.$$.fragment,e),ea=f(e),z=s(e,"H3",{class:!0});var ma=o(z);O=s(ma,"A",{id:!0,class:!0,href:!0});var xt=o(O);Se=s(xt,"SPAN",{});var Ht=o(Se);d(ae.$$.fragment,Ht),Ht.forEach(a),xt.forEach(a),Qa=f(ma),Ce=s(ma,"SPAN",{});var Tt=o(Ce);Va=p(Tt,"\uB178\uD2B8\uBD81\uC73C\uB85C \uD559\uC2B5\uD558\uAE30"),Tt.forEach(a),ma.forEach(a),aa=f(e),U=s(e,"P",{});var da=o(U);Xa=p(da,"Collaboratory\uC758 TPU\uB97C \uC0AC\uC6A9\uD558\uB824\uB294 \uACBD\uC6B0, \uB178\uD2B8\uBD81\uC5D0\uC11C\uB3C4 \u{1F917} Accelerate\uB97C \uC2E4\uD589\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4. \uD6C8\uB828\uC744 \uB2F4\uB2F9\uD558\uB294 \uBAA8\uB4E0 \uCF54\uB4DC\uB97C \uD568\uC218\uB85C \uAC10\uC2F8\uC11C "),qe=s(da,"CODE",{});var Mt=o(qe);Ya=p(Mt,"notebook_launcher"),Mt.forEach(a),Za=p(da,"\uC5D0 \uC804\uB2EC\uD558\uC138\uC694:"),da.forEach(a),ta=f(e),d(te.$$.fragment,e),ra=f(e),D=s(e,"P",{});var ua=o(D);et=p(ua,"\u{1F917} Accelerate \uBC0F \uB2E4\uC591\uD55C \uAE30\uB2A5\uC5D0 \uB300\uD55C \uC790\uC138\uD55C \uB0B4\uC6A9\uC740 "),re=s(ua,"A",{href:!0,rel:!0});var Ot=o(re);at=p(Ot,"documentation"),Ot.forEach(a),tt=p(ua,"\uB97C \uCC38\uC870\uD558\uC138\uC694."),ua.forEach(a),this.h()},h(){c(g,"name","hf:doc:metadata"),c(g,"content",JSON.stringify(It)),c(S,"id","distributed-training-with-accelerate"),c(S,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(S,"href","#distributed-training-with-accelerate"),c(k,"class","relative group"),c(G,"href","https://huggingface.co/docs/accelerate"),c(G,"rel","nofollow"),c(q,"id","setup"),c(q,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(q,"href","#setup"),c(A,"class","relative group"),c(N,"id","prepare-to-accelerate"),c(N,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(N,"href","#prepare-to-accelerate"),c(E,"class","relative group"),c(H,"id","backward"),c(H,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(H,"href","#backward"),c(y,"class","relative group"),c(T,"id","train"),c(T,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(T,"href","#train"),c(j,"class","relative group"),c(M,"id","train-with-a-script"),c(M,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(M,"href","#train-with-a-script"),c(P,"class","relative group"),c(O,"id","train-with-a-notebook"),c(O,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(O,"href","#train-with-a-notebook"),c(z,"class","relative group"),c(re,"href","https://huggingface.co/docs/accelerate"),c(re,"rel","nofollow")},m(e,r){t(document.head,g),i(e,Ne,r),i(e,k,r),t(k,S),t(S,fe),u(B,fe,null),t(k,_a),t(k,me),t(me,va),i(e,xe,r),i(e,C,r),t(C,$a),t(C,G),t(G,wa),t(C,ba),i(e,He,r),i(e,A,r),t(A,q),t(q,de),u(W,de,null),t(A,ga),t(A,ue),t(ue,ka),i(e,Te,r),i(e,se,r),t(se,Aa),i(e,Me,r),u(L,e,r),i(e,Oe,r),i(e,w,r),t(w,Ea),t(w,_e),t(_e,ya),t(w,ja),t(w,ve),t(ve,Pa),t(w,za),i(e,Ue,r),u(I,e,r),i(e,De,r),i(e,E,r),t(E,N),t(N,$e),u(J,$e,null),t(E,Sa),t(E,we),t(we,Ca),i(e,Fe,r),i(e,x,r),t(x,qa),t(x,be),t(be,Na),t(x,xa),i(e,Be,r),u(R,e,r),i(e,Ge,r),i(e,y,r),t(y,H),t(H,ge),u(K,ge,null),t(y,Ha),t(y,ke),t(ke,Ta),i(e,We,r),i(e,b,r),t(b,Ma),t(b,Ae),t(Ae,Oa),t(b,Ua),t(b,Ee),t(Ee,Da),t(b,Fa),i(e,Le,r),u(Q,e,r),i(e,Ie,r),i(e,oe,r),t(oe,Ba),i(e,Je,r),u(V,e,r),i(e,Re,r),i(e,j,r),t(j,T),t(T,ye),u(X,ye,null),t(j,Ga),t(j,je),t(je,Wa),i(e,Ke,r),i(e,ie,r),t(ie,La),i(e,Qe,r),i(e,P,r),t(P,M),t(M,Pe),u(Y,Pe,null),t(P,Ia),t(P,ze),t(ze,Ja),i(e,Ve,r),i(e,ne,r),t(ne,Ra),i(e,Xe,r),u(Z,e,r),i(e,Ye,r),i(e,pe,r),t(pe,Ka),i(e,Ze,r),u(ee,e,r),i(e,ea,r),i(e,z,r),t(z,O),t(O,Se),u(ae,Se,null),t(z,Qa),t(z,Ce),t(Ce,Va),i(e,aa,r),i(e,U,r),t(U,Xa),t(U,qe),t(qe,Ya),t(U,Za),i(e,ta,r),u(te,e,r),i(e,ra,r),i(e,D,r),t(D,et),t(D,re),t(re,at),t(D,tt),la=!0},p:Gt,i(e){la||(_(B.$$.fragment,e),_(W.$$.fragment,e),_(L.$$.fragment,e),_(I.$$.fragment,e),_(J.$$.fragment,e),_(R.$$.fragment,e),_(K.$$.fragment,e),_(Q.$$.fragment,e),_(V.$$.fragment,e),_(X.$$.fragment,e),_(Y.$$.fragment,e),_(Z.$$.fragment,e),_(ee.$$.fragment,e),_(ae.$$.fragment,e),_(te.$$.fragment,e),la=!0)},o(e){v(B.$$.fragment,e),v(W.$$.fragment,e),v(L.$$.fragment,e),v(I.$$.fragment,e),v(J.$$.fragment,e),v(R.$$.fragment,e),v(K.$$.fragment,e),v(Q.$$.fragment,e),v(V.$$.fragment,e),v(X.$$.fragment,e),v(Y.$$.fragment,e),v(Z.$$.fragment,e),v(ee.$$.fragment,e),v(ae.$$.fragment,e),v(te.$$.fragment,e),la=!1},d(e){a(g),e&&a(Ne),e&&a(k),$(B),e&&a(xe),e&&a(C),e&&a(He),e&&a(A),$(W),e&&a(Te),e&&a(se),e&&a(Me),$(L,e),e&&a(Oe),e&&a(w),e&&a(Ue),$(I,e),e&&a(De),e&&a(E),$(J),e&&a(Fe),e&&a(x),e&&a(Be),$(R,e),e&&a(Ge),e&&a(y),$(K),e&&a(We),e&&a(b),e&&a(Le),$(Q,e),e&&a(Ie),e&&a(oe),e&&a(Je),$(V,e),e&&a(Re),e&&a(j),$(X),e&&a(Ke),e&&a(ie),e&&a(Qe),e&&a(P),$(Y),e&&a(Ve),e&&a(ne),e&&a(Xe),$(Z,e),e&&a(Ye),e&&a(pe),e&&a(Ze),$(ee,e),e&&a(ea),e&&a(z),$(ae),e&&a(aa),e&&a(U),e&&a(ta),$(te,e),e&&a(ra),e&&a(D)}}}const It={local:"distributed-training-with-accelerate",sections:[{local:"setup",title:"\uC124\uC815"},{local:"prepare-to-accelerate",title:"\uAC00\uC18D\uD654\uB97C \uC704\uD55C \uC900\uBE44"},{local:"backward",title:"\uBC31\uC6CC\uB4DC(Backward)"},{local:"train",sections:[{local:"train-with-a-script",title:"\uC2A4\uD06C\uB9BD\uD2B8\uB85C \uD559\uC2B5\uD558\uAE30"},{local:"train-with-a-notebook",title:"\uB178\uD2B8\uBD81\uC73C\uB85C \uD559\uC2B5\uD558\uAE30"}],title:"\uD559\uC2B5"}],title:"\u{1F917} Accelerate\uB97C \uD65C\uC6A9\uD55C \uBD84\uC0B0 \uD559\uC2B5"};function Jt(rt){return Wt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Vt extends Ut{constructor(g){super();Dt(this,g,Jt,Lt,Ft,{})}}export{Vt as default,It as metadata};
