import{S as Na,i as ga,s as Sa,e as r,k as h,w,t as c,M as Va,c as s,d as l,m as M,a as o,x as f,h as i,b as n,G as a,g as p,y,L as Ra,q as m,o as d,B as J,v as Qa}from"../chunks/vendor-hf-doc-builder.js";import{I as re}from"../chunks/IconCopyLink-hf-doc-builder.js";import{C as S}from"../chunks/CodeBlock-hf-doc-builder.js";function Fa(ta){let v,Ce,T,B,Me,V,ml,we,dl,Ze,k,Jl,R,ul,jl,Ge,U,E,fe,Q,vl,ye,Tl,We,se,Ul,Xe,F,Ye,u,bl,me,Al,$l,de,Il,_l,Ne,H,ge,b,C,Je,x,Bl,ue,kl,Se,Z,El,je,Cl,Zl,Ve,z,Re,A,G,ve,P,Gl,Te,Wl,Qe,j,Xl,Ue,Yl,Nl,be,gl,Sl,Fe,K,He,oe,Vl,xe,D,ze,$,W,Ae,q,Rl,$e,Ql,Pe,pe,Fl,Ke,I,X,Ie,L,Hl,_e,xl,De,ce,zl,qe,O,Le,ie,Pl,Oe,ee,el,_,Y,Be,le,Kl,ke,Dl,ll,N,ql,Ee,Ll,Ol,al,ae,tl,g,ea,te,la,aa,rl;return V=new re({}),Q=new re({}),F=new S({props:{code:"cGlwJTIwaW5zdGFsbCUyMGFjY2VsZXJhdGU=",highlighted:"pip install accelerate"}}),H=new S({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKQ==",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()`}}),x=new re({}),z=new S({props:{code:"dHJhaW5fZGF0YWxvYWRlciUyQyUyMGV2YWxfZGF0YWxvYWRlciUyQyUyMG1vZGVsJTJDJTIwb3B0aW1pemVyJTIwJTNEJTIwYWNjZWxlcmF0b3IucHJlcGFyZSglMEElMjAlMjAlMjAlMjB0cmFpbl9kYXRhbG9hZGVyJTJDJTIwZXZhbF9kYXRhbG9hZGVyJTJDJTIwbW9kZWwlMkMlMjBvcHRpbWl6ZXIlMEEp",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>)`}}),P=new re({}),K=new S({props:{code:"Zm9yJTIwZXBvY2glMjBpbiUyMHJhbmdlKG51bV9lcG9jaHMpJTNBJTBBJTIwJTIwJTIwJTIwZm9yJTIwYmF0Y2glMjBpbiUyMHRyYWluX2RhdGFsb2FkZXIlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKipiYXRjaCklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBsb3NzJTIwJTNEJTIwb3V0cHV0cy5sb3NzJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwYWNjZWxlcmF0b3IuYmFja3dhcmQobG9zcyklMEElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBvcHRpbWl6ZXIuc3RlcCgpJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwbHJfc2NoZWR1bGVyLnN0ZXAoKSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMG9wdGltaXplci56ZXJvX2dyYWQoKSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHByb2dyZXNzX2Jhci51cGRhdGUoMSk=",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>)`}}),D=new S({props:{code:"JTJCJTIwZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUyMCUyMGZyb20lMjB0cmFuc2Zvcm1lcnMlMjBpbXBvcnQlMjBBZGFtVyUyQyUyMEF1dG9Nb2RlbEZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24lMkMlMjBnZXRfc2NoZWR1bGVyJTBBJTBBJTJCJTIwYWNjZWxlcmF0b3IlMjAlM0QlMjBBY2NlbGVyYXRvcigpJTBBJTBBJTIwJTIwbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZChjaGVja3BvaW50JTJDJTIwbnVtX2xhYmVscyUzRDIpJTBBJTIwJTIwb3B0aW1pemVyJTIwJTNEJTIwQWRhbVcobW9kZWwucGFyYW1ldGVycygpJTJDJTIwbHIlM0QzZS01KSUwQSUwQS0lMjBkZXZpY2UlMjAlM0QlMjB0b3JjaC5kZXZpY2UoJTIyY3VkYSUyMiklMjBpZiUyMHRvcmNoLmN1ZGEuaXNfYXZhaWxhYmxlKCklMjBlbHNlJTIwdG9yY2guZGV2aWNlKCUyMmNwdSUyMiklMEEtJTIwbW9kZWwudG8oZGV2aWNlKSUwQSUwQSUyQiUyMHRyYWluX2RhdGFsb2FkZXIlMkMlMjBldmFsX2RhdGFsb2FkZXIlMkMlMjBtb2RlbCUyQyUyMG9wdGltaXplciUyMCUzRCUyMGFjY2VsZXJhdG9yLnByZXBhcmUoJTBBJTJCJTIwJTIwJTIwJTIwJTIwdHJhaW5fZGF0YWxvYWRlciUyQyUyMGV2YWxfZGF0YWxvYWRlciUyQyUyMG1vZGVsJTJDJTIwb3B0aW1pemVyJTBBJTJCJTIwKSUwQSUwQSUyMCUyMG51bV9lcG9jaHMlMjAlM0QlMjAzJTBBJTIwJTIwbnVtX3RyYWluaW5nX3N0ZXBzJTIwJTNEJTIwbnVtX2Vwb2NocyUyMColMjBsZW4odHJhaW5fZGF0YWxvYWRlciklMEElMjAlMjBscl9zY2hlZHVsZXIlMjAlM0QlMjBnZXRfc2NoZWR1bGVyKCUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMmxpbmVhciUyMiUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMG9wdGltaXplciUzRG9wdGltaXplciUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMG51bV93YXJtdXBfc3RlcHMlM0QwJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwbnVtX3RyYWluaW5nX3N0ZXBzJTNEbnVtX3RyYWluaW5nX3N0ZXBzJTBBJTIwJTIwKSUwQSUwQSUyMCUyMHByb2dyZXNzX2JhciUyMCUzRCUyMHRxZG0ocmFuZ2UobnVtX3RyYWluaW5nX3N0ZXBzKSklMEElMEElMjAlMjBtb2RlbC50cmFpbigpJTBBJTIwJTIwZm9yJTIwZXBvY2glMjBpbiUyMHJhbmdlKG51bV9lcG9jaHMpJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwZm9yJTIwYmF0Y2glMjBpbiUyMHRyYWluX2RhdGFsb2FkZXIlM0ElMEEtJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwYmF0Y2glMjAlM0QlMjAlN0JrJTNBJTIwdi50byhkZXZpY2UpJTIwZm9yJTIwayUyQyUyMHYlMjBpbiUyMGJhdGNoLml0ZW1zKCklN0QlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBvdXRwdXRzJTIwJTNEJTIwbW9kZWwoKipiYXRjaCklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBsb3NzJTIwJTNEJTIwb3V0cHV0cy5sb3NzJTBBLSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGxvc3MuYmFja3dhcmQoKSUwQSUyQiUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGFjY2VsZXJhdG9yLmJhY2t3YXJkKGxvc3MpJTBBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwb3B0aW1pemVyLnN0ZXAoKSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGxyX3NjaGVkdWxlci5zdGVwKCklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBvcHRpbWl6ZXIuemVyb19ncmFkKCklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBwcm9ncmVzc19iYXIudXBkYXRlKDEp",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)`}}),q=new re({}),L=new re({}),O=new S({props:{code:"YWNjZWxlcmF0ZSUyMGNvbmZpZw==",highlighted:"accelerate config"}}),ee=new S({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMHRyYWluLnB5",highlighted:"accelerate launch train.py"}}),le=new re({}),ae=new S({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBub3RlYm9va19sYXVuY2hlciUwQSUwQW5vdGVib29rX2xhdW5jaGVyKHRyYWluaW5nX2Z1bmN0aW9uKQ==",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(){v=r("meta"),Ce=h(),T=r("h1"),B=r("a"),Me=r("span"),w(V.$$.fragment),ml=h(),we=r("span"),dl=c("\u{1F917} Accelerate\uB97C \uD65C\uC6A9\uD55C \uBD84\uC0B0 \uD559\uC2B5"),Ze=h(),k=r("p"),Jl=c("\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 "),R=r("a"),ul=c("\u{1F917} Accelerate"),jl=c(" \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."),Ge=h(),U=r("h2"),E=r("a"),fe=r("span"),w(Q.$$.fragment),vl=h(),ye=r("span"),Tl=c("\uC124\uC815"),We=h(),se=r("p"),Ul=c("\u{1F917} Accelerate \uC124\uCE58 \uC2DC\uC791\uD558\uAE30:"),Xe=h(),w(F.$$.fragment),Ye=h(),u=r("p"),bl=c("\uADF8 \uB2E4\uC74C, "),me=r("code"),Al=c("Accelerator"),$l=c(" \uAC1D\uCCB4\uB97C \uBD88\uB7EC\uC624\uACE0 \uC0DD\uC131\uD569\uB2C8\uB2E4. "),de=r("code"),Il=c("Accelerator"),_l=c("\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."),Ne=h(),w(H.$$.fragment),ge=h(),b=r("h2"),C=r("a"),Je=r("span"),w(x.$$.fragment),Bl=h(),ue=r("span"),kl=c("\uAC00\uC18D\uD654\uB97C \uC704\uD55C \uC900\uBE44"),Se=h(),Z=r("p"),El=c("\uB2E4\uC74C \uB2E8\uACC4\uB294 \uAD00\uB828\uB41C \uBAA8\uB4E0 \uD6C8\uB828 \uAC1D\uCCB4\uB97C "),je=r("code"),Cl=c("prepare"),Zl=c(" \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:"),Ve=h(),w(z.$$.fragment),Re=h(),A=r("h2"),G=r("a"),ve=r("span"),w(P.$$.fragment),Gl=h(),Te=r("span"),Wl=c("\uBC31\uC6CC\uB4DC(Backward)"),Qe=h(),j=r("p"),Xl=c("\uB9C8\uC9C0\uB9C9\uC73C\uB85C \uD6C8\uB828 \uB8E8\uD504\uC758 \uC77C\uBC18\uC801\uC778 "),Ue=r("code"),Yl=c("loss.backward()"),Nl=c("\uB97C \u{1F917} Accelerate\uC758 "),be=r("code"),gl=c("backward"),Sl=c(" \uBA54\uC18C\uB4DC\uB85C \uB300\uCCB4\uD558\uAE30\uB9CC \uD558\uBA74 \uB429\uB2C8\uB2E4:"),Fe=h(),w(K.$$.fragment),He=h(),oe=r("p"),Vl=c("\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!"),xe=h(),w(D.$$.fragment),ze=h(),$=r("h2"),W=r("a"),Ae=r("span"),w(q.$$.fragment),Rl=h(),$e=r("span"),Ql=c("\uD559\uC2B5"),Pe=h(),pe=r("p"),Fl=c("\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."),Ke=h(),I=r("h3"),X=r("a"),Ie=r("span"),w(L.$$.fragment),Hl=h(),_e=r("span"),xl=c("\uC2A4\uD06C\uB9BD\uD2B8\uB85C \uD559\uC2B5\uD558\uAE30"),De=h(),ce=r("p"),zl=c("\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:"),qe=h(),w(O.$$.fragment),Le=h(),ie=r("p"),Pl=c("Then launch your training with:"),Oe=h(),w(ee.$$.fragment),el=h(),_=r("h3"),Y=r("a"),Be=r("span"),w(le.$$.fragment),Kl=h(),ke=r("span"),Dl=c("\uB178\uD2B8\uBD81\uC73C\uB85C \uD559\uC2B5\uD558\uAE30"),ll=h(),N=r("p"),ql=c("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 "),Ee=r("code"),Ll=c("notebook_launcher"),Ol=c("\uC5D0 \uC804\uB2EC\uD558\uC138\uC694:"),al=h(),w(ae.$$.fragment),tl=h(),g=r("p"),ea=c("\u{1F917} Accelerate \uBC0F \uB2E4\uC591\uD55C \uAE30\uB2A5\uC5D0 \uB300\uD55C \uC790\uC138\uD55C \uB0B4\uC6A9\uC740 "),te=r("a"),la=c("documentation"),aa=c("\uB97C \uCC38\uC870\uD558\uC138\uC694."),this.h()},l(e){const t=Va('[data-svelte="svelte-1phssyn"]',document.head);v=s(t,"META",{name:!0,content:!0}),t.forEach(l),Ce=M(e),T=s(e,"H1",{class:!0});var sl=o(T);B=s(sl,"A",{id:!0,class:!0,href:!0});var ra=o(B);Me=s(ra,"SPAN",{});var sa=o(Me);f(V.$$.fragment,sa),sa.forEach(l),ra.forEach(l),ml=M(sl),we=s(sl,"SPAN",{});var oa=o(we);dl=i(oa,"\u{1F917} Accelerate\uB97C \uD65C\uC6A9\uD55C \uBD84\uC0B0 \uD559\uC2B5"),oa.forEach(l),sl.forEach(l),Ze=M(e),k=s(e,"P",{});var ol=o(k);Jl=i(ol,"\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 "),R=s(ol,"A",{href:!0,rel:!0});var pa=o(R);ul=i(pa,"\u{1F917} Accelerate"),pa.forEach(l),jl=i(ol," \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."),ol.forEach(l),Ge=M(e),U=s(e,"H2",{class:!0});var pl=o(U);E=s(pl,"A",{id:!0,class:!0,href:!0});var ca=o(E);fe=s(ca,"SPAN",{});var ia=o(fe);f(Q.$$.fragment,ia),ia.forEach(l),ca.forEach(l),vl=M(pl),ye=s(pl,"SPAN",{});var na=o(ye);Tl=i(na,"\uC124\uC815"),na.forEach(l),pl.forEach(l),We=M(e),se=s(e,"P",{});var ha=o(se);Ul=i(ha,"\u{1F917} Accelerate \uC124\uCE58 \uC2DC\uC791\uD558\uAE30:"),ha.forEach(l),Xe=M(e),f(F.$$.fragment,e),Ye=M(e),u=s(e,"P",{});var ne=o(u);bl=i(ne,"\uADF8 \uB2E4\uC74C, "),me=s(ne,"CODE",{});var Ma=o(me);Al=i(Ma,"Accelerator"),Ma.forEach(l),$l=i(ne," \uAC1D\uCCB4\uB97C \uBD88\uB7EC\uC624\uACE0 \uC0DD\uC131\uD569\uB2C8\uB2E4. "),de=s(ne,"CODE",{});var wa=o(de);Il=i(wa,"Accelerator"),wa.forEach(l),_l=i(ne,"\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."),ne.forEach(l),Ne=M(e),f(H.$$.fragment,e),ge=M(e),b=s(e,"H2",{class:!0});var cl=o(b);C=s(cl,"A",{id:!0,class:!0,href:!0});var fa=o(C);Je=s(fa,"SPAN",{});var ya=o(Je);f(x.$$.fragment,ya),ya.forEach(l),fa.forEach(l),Bl=M(cl),ue=s(cl,"SPAN",{});var ma=o(ue);kl=i(ma,"\uAC00\uC18D\uD654\uB97C \uC704\uD55C \uC900\uBE44"),ma.forEach(l),cl.forEach(l),Se=M(e),Z=s(e,"P",{});var il=o(Z);El=i(il,"\uB2E4\uC74C \uB2E8\uACC4\uB294 \uAD00\uB828\uB41C \uBAA8\uB4E0 \uD6C8\uB828 \uAC1D\uCCB4\uB97C "),je=s(il,"CODE",{});var da=o(je);Cl=i(da,"prepare"),da.forEach(l),Zl=i(il," \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:"),il.forEach(l),Ve=M(e),f(z.$$.fragment,e),Re=M(e),A=s(e,"H2",{class:!0});var nl=o(A);G=s(nl,"A",{id:!0,class:!0,href:!0});var Ja=o(G);ve=s(Ja,"SPAN",{});var ua=o(ve);f(P.$$.fragment,ua),ua.forEach(l),Ja.forEach(l),Gl=M(nl),Te=s(nl,"SPAN",{});var ja=o(Te);Wl=i(ja,"\uBC31\uC6CC\uB4DC(Backward)"),ja.forEach(l),nl.forEach(l),Qe=M(e),j=s(e,"P",{});var he=o(j);Xl=i(he,"\uB9C8\uC9C0\uB9C9\uC73C\uB85C \uD6C8\uB828 \uB8E8\uD504\uC758 \uC77C\uBC18\uC801\uC778 "),Ue=s(he,"CODE",{});var va=o(Ue);Yl=i(va,"loss.backward()"),va.forEach(l),Nl=i(he,"\uB97C \u{1F917} Accelerate\uC758 "),be=s(he,"CODE",{});var Ta=o(be);gl=i(Ta,"backward"),Ta.forEach(l),Sl=i(he," \uBA54\uC18C\uB4DC\uB85C \uB300\uCCB4\uD558\uAE30\uB9CC \uD558\uBA74 \uB429\uB2C8\uB2E4:"),he.forEach(l),Fe=M(e),f(K.$$.fragment,e),He=M(e),oe=s(e,"P",{});var Ua=o(oe);Vl=i(Ua,"\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!"),Ua.forEach(l),xe=M(e),f(D.$$.fragment,e),ze=M(e),$=s(e,"H2",{class:!0});var hl=o($);W=s(hl,"A",{id:!0,class:!0,href:!0});var ba=o(W);Ae=s(ba,"SPAN",{});var Aa=o(Ae);f(q.$$.fragment,Aa),Aa.forEach(l),ba.forEach(l),Rl=M(hl),$e=s(hl,"SPAN",{});var $a=o($e);Ql=i($a,"\uD559\uC2B5"),$a.forEach(l),hl.forEach(l),Pe=M(e),pe=s(e,"P",{});var Ia=o(pe);Fl=i(Ia,"\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."),Ia.forEach(l),Ke=M(e),I=s(e,"H3",{class:!0});var Ml=o(I);X=s(Ml,"A",{id:!0,class:!0,href:!0});var _a=o(X);Ie=s(_a,"SPAN",{});var Ba=o(Ie);f(L.$$.fragment,Ba),Ba.forEach(l),_a.forEach(l),Hl=M(Ml),_e=s(Ml,"SPAN",{});var ka=o(_e);xl=i(ka,"\uC2A4\uD06C\uB9BD\uD2B8\uB85C \uD559\uC2B5\uD558\uAE30"),ka.forEach(l),Ml.forEach(l),De=M(e),ce=s(e,"P",{});var Ea=o(ce);zl=i(Ea,"\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:"),Ea.forEach(l),qe=M(e),f(O.$$.fragment,e),Le=M(e),ie=s(e,"P",{});var Ca=o(ie);Pl=i(Ca,"Then launch your training with:"),Ca.forEach(l),Oe=M(e),f(ee.$$.fragment,e),el=M(e),_=s(e,"H3",{class:!0});var wl=o(_);Y=s(wl,"A",{id:!0,class:!0,href:!0});var Za=o(Y);Be=s(Za,"SPAN",{});var Ga=o(Be);f(le.$$.fragment,Ga),Ga.forEach(l),Za.forEach(l),Kl=M(wl),ke=s(wl,"SPAN",{});var Wa=o(ke);Dl=i(Wa,"\uB178\uD2B8\uBD81\uC73C\uB85C \uD559\uC2B5\uD558\uAE30"),Wa.forEach(l),wl.forEach(l),ll=M(e),N=s(e,"P",{});var fl=o(N);ql=i(fl,"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 "),Ee=s(fl,"CODE",{});var Xa=o(Ee);Ll=i(Xa,"notebook_launcher"),Xa.forEach(l),Ol=i(fl,"\uC5D0 \uC804\uB2EC\uD558\uC138\uC694:"),fl.forEach(l),al=M(e),f(ae.$$.fragment,e),tl=M(e),g=s(e,"P",{});var yl=o(g);ea=i(yl,"\u{1F917} Accelerate \uBC0F \uB2E4\uC591\uD55C \uAE30\uB2A5\uC5D0 \uB300\uD55C \uC790\uC138\uD55C \uB0B4\uC6A9\uC740 "),te=s(yl,"A",{href:!0,rel:!0});var Ya=o(te);la=i(Ya,"documentation"),Ya.forEach(l),aa=i(yl,"\uB97C \uCC38\uC870\uD558\uC138\uC694."),yl.forEach(l),this.h()},h(){n(v,"name","hf:doc:metadata"),n(v,"content",JSON.stringify(Ha)),n(B,"id","distributed-training-with-accelerate"),n(B,"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"),n(B,"href","#distributed-training-with-accelerate"),n(T,"class","relative group"),n(R,"href","https://huggingface.co/docs/accelerate"),n(R,"rel","nofollow"),n(E,"id","setup"),n(E,"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"),n(E,"href","#setup"),n(U,"class","relative group"),n(C,"id","prepare-to-accelerate"),n(C,"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"),n(C,"href","#prepare-to-accelerate"),n(b,"class","relative group"),n(G,"id","backward"),n(G,"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"),n(G,"href","#backward"),n(A,"class","relative group"),n(W,"id","train"),n(W,"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"),n(W,"href","#train"),n($,"class","relative group"),n(X,"id","train-with-a-script"),n(X,"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"),n(X,"href","#train-with-a-script"),n(I,"class","relative group"),n(Y,"id","train-with-a-notebook"),n(Y,"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"),n(Y,"href","#train-with-a-notebook"),n(_,"class","relative group"),n(te,"href","https://huggingface.co/docs/accelerate"),n(te,"rel","nofollow")},m(e,t){a(document.head,v),p(e,Ce,t),p(e,T,t),a(T,B),a(B,Me),y(V,Me,null),a(T,ml),a(T,we),a(we,dl),p(e,Ze,t),p(e,k,t),a(k,Jl),a(k,R),a(R,ul),a(k,jl),p(e,Ge,t),p(e,U,t),a(U,E),a(E,fe),y(Q,fe,null),a(U,vl),a(U,ye),a(ye,Tl),p(e,We,t),p(e,se,t),a(se,Ul),p(e,Xe,t),y(F,e,t),p(e,Ye,t),p(e,u,t),a(u,bl),a(u,me),a(me,Al),a(u,$l),a(u,de),a(de,Il),a(u,_l),p(e,Ne,t),y(H,e,t),p(e,ge,t),p(e,b,t),a(b,C),a(C,Je),y(x,Je,null),a(b,Bl),a(b,ue),a(ue,kl),p(e,Se,t),p(e,Z,t),a(Z,El),a(Z,je),a(je,Cl),a(Z,Zl),p(e,Ve,t),y(z,e,t),p(e,Re,t),p(e,A,t),a(A,G),a(G,ve),y(P,ve,null),a(A,Gl),a(A,Te),a(Te,Wl),p(e,Qe,t),p(e,j,t),a(j,Xl),a(j,Ue),a(Ue,Yl),a(j,Nl),a(j,be),a(be,gl),a(j,Sl),p(e,Fe,t),y(K,e,t),p(e,He,t),p(e,oe,t),a(oe,Vl),p(e,xe,t),y(D,e,t),p(e,ze,t),p(e,$,t),a($,W),a(W,Ae),y(q,Ae,null),a($,Rl),a($,$e),a($e,Ql),p(e,Pe,t),p(e,pe,t),a(pe,Fl),p(e,Ke,t),p(e,I,t),a(I,X),a(X,Ie),y(L,Ie,null),a(I,Hl),a(I,_e),a(_e,xl),p(e,De,t),p(e,ce,t),a(ce,zl),p(e,qe,t),y(O,e,t),p(e,Le,t),p(e,ie,t),a(ie,Pl),p(e,Oe,t),y(ee,e,t),p(e,el,t),p(e,_,t),a(_,Y),a(Y,Be),y(le,Be,null),a(_,Kl),a(_,ke),a(ke,Dl),p(e,ll,t),p(e,N,t),a(N,ql),a(N,Ee),a(Ee,Ll),a(N,Ol),p(e,al,t),y(ae,e,t),p(e,tl,t),p(e,g,t),a(g,ea),a(g,te),a(te,la),a(g,aa),rl=!0},p:Ra,i(e){rl||(m(V.$$.fragment,e),m(Q.$$.fragment,e),m(F.$$.fragment,e),m(H.$$.fragment,e),m(x.$$.fragment,e),m(z.$$.fragment,e),m(P.$$.fragment,e),m(K.$$.fragment,e),m(D.$$.fragment,e),m(q.$$.fragment,e),m(L.$$.fragment,e),m(O.$$.fragment,e),m(ee.$$.fragment,e),m(le.$$.fragment,e),m(ae.$$.fragment,e),rl=!0)},o(e){d(V.$$.fragment,e),d(Q.$$.fragment,e),d(F.$$.fragment,e),d(H.$$.fragment,e),d(x.$$.fragment,e),d(z.$$.fragment,e),d(P.$$.fragment,e),d(K.$$.fragment,e),d(D.$$.fragment,e),d(q.$$.fragment,e),d(L.$$.fragment,e),d(O.$$.fragment,e),d(ee.$$.fragment,e),d(le.$$.fragment,e),d(ae.$$.fragment,e),rl=!1},d(e){l(v),e&&l(Ce),e&&l(T),J(V),e&&l(Ze),e&&l(k),e&&l(Ge),e&&l(U),J(Q),e&&l(We),e&&l(se),e&&l(Xe),J(F,e),e&&l(Ye),e&&l(u),e&&l(Ne),J(H,e),e&&l(ge),e&&l(b),J(x),e&&l(Se),e&&l(Z),e&&l(Ve),J(z,e),e&&l(Re),e&&l(A),J(P),e&&l(Qe),e&&l(j),e&&l(Fe),J(K,e),e&&l(He),e&&l(oe),e&&l(xe),J(D,e),e&&l(ze),e&&l($),J(q),e&&l(Pe),e&&l(pe),e&&l(Ke),e&&l(I),J(L),e&&l(De),e&&l(ce),e&&l(qe),J(O,e),e&&l(Le),e&&l(ie),e&&l(Oe),J(ee,e),e&&l(el),e&&l(_),J(le),e&&l(ll),e&&l(N),e&&l(al),J(ae,e),e&&l(tl),e&&l(g)}}}const Ha={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 xa(ta){return Qa(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Da extends Na{constructor(v){super();ga(this,v,xa,Fa,Sa,{})}}export{Da as default,Ha as metadata};
