import{s as Rp,o as Ep,n as T}from"../chunks/scheduler.defa9a21.js";import{S as Sp,i as Hp,g as i,s as n,r as g,A as Lp,h as d,f as h,c,j as U,u,x as j,k as x,y as l,a as w,v as f,d as b,t as $,w as y}from"../chunks/index.fe795e71.js";import{T as Se}from"../chunks/Tip.179eb360.js";import{D as k}from"../chunks/Docstring.90d6fe5c.js";import{C as B}from"../chunks/CodeBlock.204b6c34.js";import{E as G}from"../chunks/ExampleCodeBlock.f6fae62d.js";import{H as fo,E as Pp}from"../chunks/getInferenceSnippets.2234a8dd.js";function Dp(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoZ3JhZGllbnRfYWNjdW11bGF0aW9uX3N0ZXBzJTNEMSklMEFkYXRhbG9hZGVyJTJDJTIwbW9kZWwlMkMlMjBvcHRpbWl6ZXIlMkMlMjBzY2hlZHVsZXIlMjAlM0QlMjBhY2NlbGVyYXRvci5wcmVwYXJlKGRhdGFsb2FkZXIlMkMlMjBtb2RlbCUyQyUyMG9wdGltaXplciUyQyUyMHNjaGVkdWxlciklMEElMEFmb3IlMjBpbnB1dCUyQyUyMG91dHB1dCUyMGluJTIwZGF0YWxvYWRlciUzQSUwQSUyMCUyMCUyMCUyMHdpdGglMjBhY2NlbGVyYXRvci5hY2N1bXVsYXRlKG1vZGVsKSUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMG91dHB1dHMlMjAlM0QlMjBtb2RlbChpbnB1dCklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBsb3NzJTIwJTNEJTIwbG9zc19mdW5jKG91dHB1dHMpJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwbG9zcy5iYWNrd2FyZCgpJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwb3B0aW1pemVyLnN0ZXAoKSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHNjaGVkdWxlci5zdGVwKCklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBvcHRpbWl6ZXIuemVyb19ncmFkKCk=",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(gradient_accumulation_steps=<span class="hljs-number">1</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>dataloader, model, optimizer, scheduler = accelerator.prepare(dataloader, model, optimizer, scheduler)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> <span class="hljs-built_in">input</span>, output <span class="hljs-keyword">in</span> dataloader:
<span class="hljs-meta">... </span>    <span class="hljs-keyword">with</span> accelerator.accumulate(model):
<span class="hljs-meta">... </span>        outputs = model(<span class="hljs-built_in">input</span>)
<span class="hljs-meta">... </span>        loss = loss_func(outputs)
<span class="hljs-meta">... </span>        loss.backward()
<span class="hljs-meta">... </span>        optimizer.step()
<span class="hljs-meta">... </span>        scheduler.step()
<span class="hljs-meta">... </span>        optimizer.zero_grad()`,wrap:!1}}),{c(){t=i("p"),t.textContent=m,r=n(),g(a.$$.fragment)},l(e){t=d(e,"P",{"data-svelte-h":!0}),j(t)!=="svelte-11lpom8"&&(t.textContent=m),r=c(e),u(a.$$.fragment,e)},m(e,p){w(e,t,p),w(e,r,p),f(a,e,p),o=!0},p:T,i(e){o||(b(a.$$.fragment,e),o=!0)},o(e){$(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),y(a,e)}}}function Kp(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IobWl4ZWRfcHJlY2lzaW9uJTNEJTIyZnAxNiUyMiklMEF3aXRoJTIwYWNjZWxlcmF0b3IuYXV0b2Nhc3QoKSUzQSUwQSUyMCUyMCUyMCUyMHRyYWluKCk=",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(mixed_precision=<span class="hljs-string">&quot;fp16&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> accelerator.autocast():
<span class="hljs-meta">... </span>    train()`,wrap:!1}}),{c(){t=i("p"),t.textContent=m,r=n(),g(a.$$.fragment)},l(e){t=d(e,"P",{"data-svelte-h":!0}),j(t)!=="svelte-11lpom8"&&(t.textContent=m),r=c(e),u(a.$$.fragment,e)},m(e,p){w(e,t,p),w(e,r,p),f(a,e,p),o=!0},p:T,i(e){o||(b(a.$$.fragment,e),o=!0)},o(e){$(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),y(a,e)}}}function qp(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoZ3JhZGllbnRfYWNjdW11bGF0aW9uX3N0ZXBzJTNEMiklMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoaW5wdXRzKSUwQWxvc3MlMjAlM0QlMjBsb3NzX2ZuKG91dHB1dHMlMkMlMjBsYWJlbHMpJTBBYWNjZWxlcmF0b3IuYmFja3dhcmQobG9zcyk=",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(gradient_accumulation_steps=<span class="hljs-number">2</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = loss_fn(outputs, labels)
<span class="hljs-meta">&gt;&gt;&gt; </span>accelerator.backward(loss)`,wrap:!1}}),{c(){t=i("p"),t.textContent=m,r=n(),g(a.$$.fragment)},l(e){t=d(e,"P",{"data-svelte-h":!0}),j(t)!=="svelte-11lpom8"&&(t.textContent=m),r=c(e),u(a.$$.fragment,e)},m(e,p){w(e,t,p),w(e,r,p),f(a,e,p),o=!0},p:T,i(e){o||(b(a.$$.fragment,e),o=!0)},o(e){$(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),y(a,e)}}}function Op(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKSUwQSUyMyUyMEFzc3VtZSUyMGxhdGVyJTIwaW4lMjB0aGUlMjB0cmFpbmluZyUyMHNjcmlwdCUwQSUyMyUyMCU2MHNob3VsZF9kb19icmVha3BvaW50JTYwJTIwaXMlMjBhJTIwY3VzdG9tJTIwZnVuY3Rpb24lMjB0byUyMG1vbml0b3IlMjB3aGVuJTIwdG8lMjBicmVhayUyQyUwQSUyMyUyMGUuZy4lMjB3aGVuJTIwdGhlJTIwbG9zcyUyMGlzJTIwTmFOJTBBaWYlMjBzaG91bGRfZG9fYnJlYWtwb2ludChsb3NzKSUzQSUwQSUyMCUyMCUyMCUyMGFjY2VsZXJhdG9yLnNldF90cmlnZ2VyKCklMEElMjMlMjBBc3N1bWUlMjBsYXRlciUyMGluJTIwdGhlJTIwdHJhaW5pbmclMjBzY3JpcHQlMEFpZiUyMGFjY2VsZXJhdG9yLmNoZWNrX3RyaWdnZXIoKSUzQSUwQSUyMCUyMCUyMCUyMGJyZWFr",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()
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Assume later in the training script</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># \`should_do_breakpoint\` is a custom function to monitor when to break,</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># e.g. when the loss is NaN</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">if</span> should_do_breakpoint(loss):
<span class="hljs-meta">... </span>    accelerator.set_trigger()
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Assume later in the training script</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">if</span> accelerator.check_trigger():
<span class="hljs-meta">... </span>    <span class="hljs-keyword">break</span>`,wrap:!1}}),{c(){t=i("p"),t.textContent=m,r=n(),g(a.$$.fragment)},l(e){t=d(e,"P",{"data-svelte-h":!0}),j(t)!=="svelte-11lpom8"&&(t.textContent=m),r=c(e),u(a.$$.fragment,e)},m(e,p){w(e,t,p),w(e,r,p),f(a,e,p),o=!0},p:T,i(e){o||(b(a.$$.fragment,e),o=!0)},o(e){$(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),y(a,e)}}}function ei(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKSUwQW1vZGVsJTJDJTIwb3B0aW1pemVyJTJDJTIwc2NoZWR1bGVyJTIwJTNEJTIwLi4uJTBBbW9kZWwlMkMlMjBvcHRpbWl6ZXIlMkMlMjBzY2hlZHVsZXIlMjAlM0QlMjBhY2NlbGVyYXRvci5wcmVwYXJlKG1vZGVsJTJDJTIwb3B0aW1pemVyJTJDJTIwc2NoZWR1bGVyKSUwQW1vZGVsJTJDJTIwb3B0aW1pemVyJTJDJTIwc2NoZWR1bGVyJTIwJTNEJTIwYWNjZWxlcmF0b3IuY2xlYXIobW9kZWwlMkMlMjBvcHRpbWl6ZXIlMkMlMjBzY2hlZHVsZXIp",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()
<span class="hljs-meta">&gt;&gt;&gt; </span>model, optimizer, scheduler = ...
<span class="hljs-meta">&gt;&gt;&gt; </span>model, optimizer, scheduler = accelerator.prepare(model, optimizer, scheduler)
<span class="hljs-meta">&gt;&gt;&gt; </span>model, optimizer, scheduler = accelerator.clear(model, optimizer, scheduler)`,wrap:!1}}),{c(){t=i("p"),t.textContent=m,r=n(),g(a.$$.fragment)},l(e){t=d(e,"P",{"data-svelte-h":!0}),j(t)!=="svelte-11lpom8"&&(t.textContent=m),r=c(e),u(a.$$.fragment,e)},m(e,p){w(e,t,p),w(e,r,p),f(a,e,p),o=!0},p:T,i(e){o||(b(a.$$.fragment,e),o=!0)},o(e){$(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),y(a,e)}}}function ti(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoZ3JhZGllbnRfYWNjdW11bGF0aW9uX3N0ZXBzJTNEMiklMEFkYXRhbG9hZGVyJTJDJTIwbW9kZWwlMkMlMjBvcHRpbWl6ZXIlMkMlMjBzY2hlZHVsZXIlMjAlM0QlMjBhY2NlbGVyYXRvci5wcmVwYXJlKGRhdGFsb2FkZXIlMkMlMjBtb2RlbCUyQyUyMG9wdGltaXplciUyQyUyMHNjaGVkdWxlciklMEElMEFmb3IlMjBpbnB1dCUyQyUyMHRhcmdldCUyMGluJTIwZGF0YWxvYWRlciUzQSUwQSUyMCUyMCUyMCUyMG9wdGltaXplci56ZXJvX2dyYWQoKSUwQSUyMCUyMCUyMCUyMG91dHB1dCUyMCUzRCUyMG1vZGVsKGlucHV0KSUwQSUyMCUyMCUyMCUyMGxvc3MlMjAlM0QlMjBsb3NzX2Z1bmMob3V0cHV0JTJDJTIwdGFyZ2V0KSUwQSUyMCUyMCUyMCUyMGFjY2VsZXJhdG9yLmJhY2t3YXJkKGxvc3MpJTBBJTIwJTIwJTIwJTIwaWYlMjBhY2NlbGVyYXRvci5zeW5jX2dyYWRpZW50cyUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGFjY2VsZXJhdG9yLmNsaXBfZ3JhZF9ub3JtXyhtb2RlbC5wYXJhbWV0ZXJzKCklMkMlMjBtYXhfZ3JhZF9ub3JtKSUwQSUyMCUyMCUyMCUyMG9wdGltaXplci5zdGVwKCk=",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(gradient_accumulation_steps=<span class="hljs-number">2</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>dataloader, model, optimizer, scheduler = accelerator.prepare(dataloader, model, optimizer, scheduler)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> <span class="hljs-built_in">input</span>, target <span class="hljs-keyword">in</span> dataloader:
<span class="hljs-meta">... </span>    optimizer.zero_grad()
<span class="hljs-meta">... </span>    output = model(<span class="hljs-built_in">input</span>)
<span class="hljs-meta">... </span>    loss = loss_func(output, target)
<span class="hljs-meta">... </span>    accelerator.backward(loss)
<span class="hljs-meta">... </span>    <span class="hljs-keyword">if</span> accelerator.sync_gradients:
<span class="hljs-meta">... </span>        accelerator.clip_grad_norm_(model.parameters(), max_grad_norm)
<span class="hljs-meta">... </span>    optimizer.step()`,wrap:!1}}),{c(){t=i("p"),t.textContent=m,r=n(),g(a.$$.fragment)},l(e){t=d(e,"P",{"data-svelte-h":!0}),j(t)!=="svelte-11lpom8"&&(t.textContent=m),r=c(e),u(a.$$.fragment,e)},m(e,p){w(e,t,p),w(e,r,p),f(a,e,p),o=!0},p:T,i(e){o||(b(a.$$.fragment,e),o=!0)},o(e){$(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),y(a,e)}}}function ai(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoZ3JhZGllbnRfYWNjdW11bGF0aW9uX3N0ZXBzJTNEMiklMEFkYXRhbG9hZGVyJTJDJTIwbW9kZWwlMkMlMjBvcHRpbWl6ZXIlMkMlMjBzY2hlZHVsZXIlMjAlM0QlMjBhY2NlbGVyYXRvci5wcmVwYXJlKGRhdGFsb2FkZXIlMkMlMjBtb2RlbCUyQyUyMG9wdGltaXplciUyQyUyMHNjaGVkdWxlciklMEElMEFmb3IlMjBpbnB1dCUyQyUyMHRhcmdldCUyMGluJTIwZGF0YWxvYWRlciUzQSUwQSUyMCUyMCUyMCUyMG9wdGltaXplci56ZXJvX2dyYWQoKSUwQSUyMCUyMCUyMCUyMG91dHB1dCUyMCUzRCUyMG1vZGVsKGlucHV0KSUwQSUyMCUyMCUyMCUyMGxvc3MlMjAlM0QlMjBsb3NzX2Z1bmMob3V0cHV0JTJDJTIwdGFyZ2V0KSUwQSUyMCUyMCUyMCUyMGFjY2VsZXJhdG9yLmJhY2t3YXJkKGxvc3MpJTBBJTIwJTIwJTIwJTIwaWYlMjBhY2NlbGVyYXRvci5zeW5jX2dyYWRpZW50cyUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGFjY2VsZXJhdG9yLmNsaXBfZ3JhZF92YWx1ZV8obW9kZWwucGFyYW1ldGVycygpJTJDJTIwY2xpcF92YWx1ZSklMEElMjAlMjAlMjAlMjBvcHRpbWl6ZXIuc3RlcCgp",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(gradient_accumulation_steps=<span class="hljs-number">2</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>dataloader, model, optimizer, scheduler = accelerator.prepare(dataloader, model, optimizer, scheduler)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> <span class="hljs-built_in">input</span>, target <span class="hljs-keyword">in</span> dataloader:
<span class="hljs-meta">... </span>    optimizer.zero_grad()
<span class="hljs-meta">... </span>    output = model(<span class="hljs-built_in">input</span>)
<span class="hljs-meta">... </span>    loss = loss_func(output, target)
<span class="hljs-meta">... </span>    accelerator.backward(loss)
<span class="hljs-meta">... </span>    <span class="hljs-keyword">if</span> accelerator.sync_gradients:
<span class="hljs-meta">... </span>        accelerator.clip_grad_value_(model.parameters(), clip_value)
<span class="hljs-meta">... </span>    optimizer.step()`,wrap:!1}}),{c(){t=i("p"),t.textContent=m,r=n(),g(a.$$.fragment)},l(e){t=d(e,"P",{"data-svelte-h":!0}),j(t)!=="svelte-11lpom8"&&(t.textContent=m),r=c(e),u(a.$$.fragment,e)},m(e,p){w(e,t,p),w(e,r,p),f(a,e,p),o=!0},p:T,i(e){o||(b(a.$$.fragment,e),o=!0)},o(e){$(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),y(a,e)}}}function si(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IobG9nX3dpdGglM0QlMjJ0ZW5zb3Jib2FyZCUyMiklMEFhY2NlbGVyYXRvci5pbml0X3RyYWNrZXJzKCUyMm15X3Byb2plY3QlMjIpJTBBJTIzJTIwRG8lMjB0cmFpbmluZyUwQWFjY2VsZXJhdG9yLmVuZF90cmFpbmluZygp",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(log_with=<span class="hljs-string">&quot;tensorboard&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>accelerator.init_trackers(<span class="hljs-string">&quot;my_project&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Do training</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>accelerator.end_training()`,wrap:!1}}),{c(){t=i("p"),t.textContent=m,r=n(),g(a.$$.fragment)},l(e){t=d(e,"P",{"data-svelte-h":!0}),j(t)!=="svelte-11lpom8"&&(t.textContent=m),r=c(e),u(a.$$.fragment,e)},m(e,p){w(e,t,p),w(e,r,p),f(a,e,p),o=!0},p:T,i(e){o||(b(a.$$.fragment,e),o=!0)},o(e){$(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),y(a,e)}}}function li(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKSUwQW1vZGVsJTJDJTIwb3B0aW1pemVyJTJDJTIwc2NoZWR1bGVyJTIwJTNEJTIwLi4uJTBBbW9kZWwlMkMlMjBvcHRpbWl6ZXIlMkMlMjBzY2hlZHVsZXIlMjAlM0QlMjBhY2NlbGVyYXRvci5wcmVwYXJlKG1vZGVsJTJDJTIwb3B0aW1pemVyJTJDJTIwc2NoZWR1bGVyKSUwQW1vZGVsJTJDJTIwb3B0aW1pemVyJTJDJTIwc2NoZWR1bGVyJTIwJTNEJTIwYWNjZWxlcmF0b3IuZnJlZV9tZW1vcnkobW9kZWwlMkMlMjBvcHRpbWl6ZXIlMkMlMjBzY2hlZHVsZXIp",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()
<span class="hljs-meta">&gt;&gt;&gt; </span>model, optimizer, scheduler = ...
<span class="hljs-meta">&gt;&gt;&gt; </span>model, optimizer, scheduler = accelerator.prepare(model, optimizer, scheduler)
<span class="hljs-meta">&gt;&gt;&gt; </span>model, optimizer, scheduler = accelerator.free_memory(model, optimizer, scheduler)`,wrap:!1}}),{c(){t=i("p"),t.textContent=m,r=n(),g(a.$$.fragment)},l(e){t=d(e,"P",{"data-svelte-h":!0}),j(t)!=="svelte-11lpom8"&&(t.textContent=m),r=c(e),u(a.$$.fragment,e)},m(e,p){w(e,t,p),w(e,r,p),f(a,e,p),o=!0},p:T,i(e){o||(b(a.$$.fragment,e),o=!0)},o(e){$(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),y(a,e)}}}function ri(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"JTIzJTIwQXNzdW1pbmclMjBmb3VyJTIwcHJvY2Vzc2VzJTBBaW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwYWNjZWxlcmF0ZSUyMGltcG9ydCUyMEFjY2VsZXJhdG9yJTBBJTBBYWNjZWxlcmF0b3IlMjAlM0QlMjBBY2NlbGVyYXRvcigpJTBBcHJvY2Vzc190ZW5zb3IlMjAlM0QlMjB0b3JjaC50ZW5zb3IoJTVCYWNjZWxlcmF0b3IucHJvY2Vzc19pbmRleCU1RCklMEFnYXRoZXJlZF90ZW5zb3IlMjAlM0QlMjBhY2NlbGVyYXRvci5nYXRoZXIocHJvY2Vzc190ZW5zb3IpJTBBZ2F0aGVyZWRfdGVuc29y",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Assuming four processes</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<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()
<span class="hljs-meta">&gt;&gt;&gt; </span>process_tensor = torch.tensor([accelerator.process_index])
<span class="hljs-meta">&gt;&gt;&gt; </span>gathered_tensor = accelerator.gather(process_tensor)
<span class="hljs-meta">&gt;&gt;&gt; </span>gathered_tensor
tensor([<span class="hljs-number">0</span>, <span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>])`,wrap:!1}}),{c(){t=i("p"),t.textContent=m,r=n(),g(a.$$.fragment)},l(e){t=d(e,"P",{"data-svelte-h":!0}),j(t)!=="svelte-11lpom8"&&(t.textContent=m),r=c(e),u(a.$$.fragment,e)},m(e,p){w(e,t,p),w(e,r,p),f(a,e,p),o=!0},p:T,i(e){o||(b(a.$$.fragment,e),o=!0)},o(e){$(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),y(a,e)}}}function ni(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"JTIzJTIwQXNzdW1pbmclMjB0d28lMjBwcm9jZXNzZXMlMkMlMjB3aXRoJTIwYSUyMGJhdGNoJTIwc2l6ZSUyMG9mJTIwNSUyMG9uJTIwYSUyMGRhdGFzZXQlMjB3aXRoJTIwOSUyMHNhbXBsZXMlMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjBhY2NlbGVyYXRlJTIwaW1wb3J0JTIwQWNjZWxlcmF0b3IlMEElMEFhY2NlbGVyYXRvciUyMCUzRCUyMEFjY2VsZXJhdG9yKCklMEFkYXRhbG9hZGVyJTIwJTNEJTIwdG9yY2gudXRpbHMuZGF0YS5EYXRhTG9hZGVyKHJhbmdlKDkpJTJDJTIwYmF0Y2hfc2l6ZSUzRDUpJTBBZGF0YWxvYWRlciUyMCUzRCUyMGFjY2VsZXJhdG9yLnByZXBhcmUoZGF0YWxvYWRlciklMEFiYXRjaCUyMCUzRCUyMG5leHQoaXRlcihkYXRhbG9hZGVyKSklMEFnYXRoZXJlZF9pdGVtcyUyMCUzRCUyMGFjY2VsZXJhdG9yLmdhdGhlcl9mb3JfbWV0cmljcyhiYXRjaCklMEFsZW4oZ2F0aGVyZWRfaXRlbXMp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Assuming two processes, with a batch size of 5 on a dataset with 9 samples</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<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()
<span class="hljs-meta">&gt;&gt;&gt; </span>dataloader = torch.utils.data.DataLoader(<span class="hljs-built_in">range</span>(<span class="hljs-number">9</span>), batch_size=<span class="hljs-number">5</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>dataloader = accelerator.prepare(dataloader)
<span class="hljs-meta">&gt;&gt;&gt; </span>batch = <span class="hljs-built_in">next</span>(<span class="hljs-built_in">iter</span>(dataloader))
<span class="hljs-meta">&gt;&gt;&gt; </span>gathered_items = accelerator.gather_for_metrics(batch)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">len</span>(gathered_items)
<span class="hljs-number">9</span>`,wrap:!1}}),{c(){t=i("p"),t.textContent=m,r=n(),g(a.$$.fragment)},l(e){t=d(e,"P",{"data-svelte-h":!0}),j(t)!=="svelte-11lpom8"&&(t.textContent=m),r=c(e),u(a.$$.fragment,e)},m(e,p){w(e,t,p),w(e,r,p),f(a,e,p),o=!0},p:T,i(e){o||(b(a.$$.fragment,e),o=!0)},o(e){$(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),y(a,e)}}}function ci(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwYWNjZWxlcmF0ZSUyMGltcG9ydCUyMEFjY2VsZXJhdG9yJTBBJTBBYWNjZWxlcmF0b3IlMjAlM0QlMjBBY2NlbGVyYXRvcigpJTBBbmV0JTIwJTNEJTIwdG9yY2gubm4uTGluZWFyKDIlMkMlMjAyKSUwQW5ldCUyMCUzRCUyMGFjY2VsZXJhdG9yLnByZXBhcmUobmV0KSUwQXN0YXRlX2RpY3QlMjAlM0QlMjBhY2NlbGVyYXRvci5nZXRfc3RhdGVfZGljdChuZXQp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<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()
<span class="hljs-meta">&gt;&gt;&gt; </span>net = torch.nn.Linear(<span class="hljs-number">2</span>, <span class="hljs-number">2</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>net = accelerator.prepare(net)
<span class="hljs-meta">&gt;&gt;&gt; </span>state_dict = accelerator.get_state_dict(net)`,wrap:!1}}),{c(){t=i("p"),t.textContent=m,r=n(),g(a.$$.fragment)},l(e){t=d(e,"P",{"data-svelte-h":!0}),j(t)!=="svelte-11lpom8"&&(t.textContent=m),r=c(e),u(a.$$.fragment,e)},m(e,p){w(e,t,p),w(e,r,p),f(a,e,p),o=!0},p:T,i(e){o||(b(a.$$.fragment,e),o=!0)},o(e){$(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),y(a,e)}}}function oi(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IobG9nX3dpdGglM0QlMjJ0ZW5zb3Jib2FyZCUyMiklMEFhY2NlbGVyYXRvci5pbml0X3RyYWNrZXJzKCUyMm15X3Byb2plY3QlMjIpJTBBdGVuc29yYm9hcmRfdHJhY2tlciUyMCUzRCUyMGFjY2VsZXJhdG9yLmdldF90cmFja2VyKCUyMnRlbnNvcmJvYXJkJTIyKQ==",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(log_with=<span class="hljs-string">&quot;tensorboard&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>accelerator.init_trackers(<span class="hljs-string">&quot;my_project&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tensorboard_tracker = accelerator.get_tracker(<span class="hljs-string">&quot;tensorboard&quot;</span>)`,wrap:!1}}),{c(){t=i("p"),t.textContent=m,r=n(),g(a.$$.fragment)},l(e){t=d(e,"P",{"data-svelte-h":!0}),j(t)!=="svelte-11lpom8"&&(t.textContent=m),r=c(e),u(a.$$.fragment,e)},m(e,p){w(e,t,p),w(e,r,p),f(a,e,p),o=!0},p:T,i(e){o||(b(a.$$.fragment,e),o=!0)},o(e){$(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),y(a,e)}}}function pi(_){let t,m=`<code>join_uneven_inputs</code> is only supported for Distributed Data Parallel training on multiple GPUs. For any other
configuration, this method will have no effect.`;return{c(){t=i("p"),t.innerHTML=m},l(r){t=d(r,"P",{"data-svelte-h":!0}),j(t)!=="svelte-rvhzx4"&&(t.innerHTML=m)},m(r,a){w(r,t,a)},p:T,d(r){r&&h(t)}}}function ii(_){let t,m="Overidding <code>even_batches</code> will not affect iterable-style data loaders.";return{c(){t=i("p"),t.innerHTML=m},l(r){t=d(r,"P",{"data-svelte-h":!0}),j(t)!=="svelte-1kjj3tv"&&(t.innerHTML=m)},m(r,a){w(r,t,a)},p:T,d(r){r&&h(t)}}}function di(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoZXZlbl9iYXRjaGVzJTNEVHJ1ZSklMEFkZHBfbW9kZWwlMkMlMjBvcHRpbWl6ZXIlMkMlMjBkYXRhbG9hZGVyJTIwJTNEJTIwYWNjZWxlcmF0b3IucHJlcGFyZShtb2RlbCUyQyUyMG9wdGltaXplciUyQyUyMGRhdGFsb2FkZXIpJTBBJTBBd2l0aCUyMGFjY2VsZXJhdG9yLmpvaW5fdW5ldmVuX2lucHV0cyglNUJkZHBfbW9kZWwlNUQlMkMlMjBldmVuX2JhdGNoZXMlM0RGYWxzZSklM0ElMEElMjAlMjAlMjAlMjBmb3IlMjBpbnB1dCUyQyUyMG91dHB1dCUyMGluJTIwZGF0YWxvYWRlciUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMG91dHB1dHMlMjAlM0QlMjBtb2RlbChpbnB1dCklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBsb3NzJTIwJTNEJTIwbG9zc19mdW5jKG91dHB1dHMpJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwbG9zcy5iYWNrd2FyZCgpJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwb3B0aW1pemVyLnN0ZXAoKSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMG9wdGltaXplci56ZXJvX2dyYWQoKQ==",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(even_batches=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>ddp_model, optimizer, dataloader = accelerator.prepare(model, optimizer, dataloader)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> accelerator.join_uneven_inputs([ddp_model], even_batches=<span class="hljs-literal">False</span>):
<span class="hljs-meta">... </span>    <span class="hljs-keyword">for</span> <span class="hljs-built_in">input</span>, output <span class="hljs-keyword">in</span> dataloader:
<span class="hljs-meta">... </span>        outputs = model(<span class="hljs-built_in">input</span>)
<span class="hljs-meta">... </span>        loss = loss_func(outputs)
<span class="hljs-meta">... </span>        loss.backward()
<span class="hljs-meta">... </span>        optimizer.step()
<span class="hljs-meta">... </span>        optimizer.zero_grad()`,wrap:!1}}),{c(){t=i("p"),t.textContent=m,r=n(),g(a.$$.fragment)},l(e){t=d(e,"P",{"data-svelte-h":!0}),j(t)!=="svelte-11lpom8"&&(t.textContent=m),r=c(e),u(a.$$.fragment,e)},m(e,p){w(e,t,p),w(e,r,p),f(a,e,p),o=!0},p:T,i(e){o||(b(a.$$.fragment,e),o=!0)},o(e){$(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),y(a,e)}}}function mi(_){let t,m=`Should only be used in conjunction with <a href="/docs/accelerate/main/en/package_reference/accelerator#accelerate.Accelerator.save_state">Accelerator.save_state()</a>. If a file is not registered for
checkpointing, it will not be loaded if stored in the directory.`;return{c(){t=i("p"),t.innerHTML=m},l(r){t=d(r,"P",{"data-svelte-h":!0}),j(t)!=="svelte-1w06apw"&&(t.innerHTML=m)},m(r,a){w(r,t,a)},p:T,d(r){r&&h(t)}}}function hi(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKSUwQW1vZGVsJTJDJTIwb3B0aW1pemVyJTJDJTIwbHJfc2NoZWR1bGVyJTIwJTNEJTIwLi4uJTBBbW9kZWwlMkMlMjBvcHRpbWl6ZXIlMkMlMjBscl9zY2hlZHVsZXIlMjAlM0QlMjBhY2NlbGVyYXRvci5wcmVwYXJlKG1vZGVsJTJDJTIwb3B0aW1pemVyJTJDJTIwbHJfc2NoZWR1bGVyKSUwQWFjY2VsZXJhdG9yLmxvYWRfc3RhdGUoJTIybXlfY2hlY2twb2ludCUyMik=",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()
<span class="hljs-meta">&gt;&gt;&gt; </span>model, optimizer, lr_scheduler = ...
<span class="hljs-meta">&gt;&gt;&gt; </span>model, optimizer, lr_scheduler = accelerator.prepare(model, optimizer, lr_scheduler)
<span class="hljs-meta">&gt;&gt;&gt; </span>accelerator.load_state(<span class="hljs-string">&quot;my_checkpoint&quot;</span>)`,wrap:!1}}),{c(){t=i("p"),t.textContent=m,r=n(),g(a.$$.fragment)},l(e){t=d(e,"P",{"data-svelte-h":!0}),j(t)!=="svelte-11lpom8"&&(t.textContent=m),r=c(e),u(a.$$.fragment,e)},m(e,p){w(e,t,p),w(e,r,p),f(a,e,p),o=!0},p:T,i(e){o||(b(a.$$.fragment,e),o=!0)},o(e){$(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),y(a,e)}}}function gi(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKSUwQXdpdGglMjBhY2NlbGVyYXRvci5sb2NhbF9tYWluX3Byb2Nlc3NfZmlyc3QoKSUzQSUwQSUyMCUyMCUyMCUyMCUyMyUyMFRoaXMlMjB3aWxsJTIwYmUlMjBwcmludGVkJTIwZmlyc3QlMjBieSUyMGxvY2FsJTIwcHJvY2VzcyUyMDAlMjB0aGVuJTIwaW4lMjBhJTIwc2VlbWluZ2x5JTBBJTIwJTIwJTIwJTIwJTIzJTIwcmFuZG9tJTIwb3JkZXIlMjBieSUyMHRoZSUyMG90aGVyJTIwcHJvY2Vzc2VzLiUwQSUyMCUyMCUyMCUyMHByaW50KGYlMjJUaGlzJTIwd2lsbCUyMGJlJTIwcHJpbnRlZCUyMGJ5JTIwcHJvY2VzcyUyMCU3QmFjY2VsZXJhdG9yLmxvY2FsX3Byb2Nlc3NfaW5kZXglN0QlMjIp",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()
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> accelerator.local_main_process_first():
<span class="hljs-meta">... </span>    <span class="hljs-comment"># This will be printed first by local process 0 then in a seemingly</span>
<span class="hljs-meta">... </span>    <span class="hljs-comment"># random order by the other processes.</span>
<span class="hljs-meta">... </span>    <span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;This will be printed by process <span class="hljs-subst">{accelerator.local_process_index}</span>&quot;</span>)`,wrap:!1}}),{c(){t=i("p"),t.textContent=m,r=n(),g(a.$$.fragment)},l(e){t=d(e,"P",{"data-svelte-h":!0}),j(t)!=="svelte-11lpom8"&&(t.textContent=m),r=c(e),u(a.$$.fragment,e)},m(e,p){w(e,t,p),w(e,r,p),f(a,e,p),o=!0},p:T,i(e){o||(b(a.$$.fragment,e),o=!0)},o(e){$(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),y(a,e)}}}function ui(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKSUwQXdpdGglMjBhY2NlbGVyYXRvci5tYWluX3Byb2Nlc3NfZmlyc3QoKSUzQSUwQSUyMCUyMCUyMCUyMCUyMyUyMFRoaXMlMjB3aWxsJTIwYmUlMjBwcmludGVkJTIwZmlyc3QlMjBieSUyMHByb2Nlc3MlMjAwJTIwdGhlbiUyMGluJTIwYSUyMHNlZW1pbmdseSUwQSUyMCUyMCUyMCUyMCUyMyUyMHJhbmRvbSUyMG9yZGVyJTIwYnklMjB0aGUlMjBvdGhlciUyMHByb2Nlc3Nlcy4lMEElMjAlMjAlMjAlMjBwcmludChmJTIyVGhpcyUyMHdpbGwlMjBiZSUyMHByaW50ZWQlMjBieSUyMHByb2Nlc3MlMjAlN0JhY2NlbGVyYXRvci5wcm9jZXNzX2luZGV4JTdEJTIyKQ==",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()
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> accelerator.main_process_first():
<span class="hljs-meta">... </span>    <span class="hljs-comment"># This will be printed first by process 0 then in a seemingly</span>
<span class="hljs-meta">... </span>    <span class="hljs-comment"># random order by the other processes.</span>
<span class="hljs-meta">... </span>    <span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;This will be printed by process <span class="hljs-subst">{accelerator.process_index}</span>&quot;</span>)`,wrap:!1}}),{c(){t=i("p"),t.textContent=m,r=n(),g(a.$$.fragment)},l(e){t=d(e,"P",{"data-svelte-h":!0}),j(t)!=="svelte-11lpom8"&&(t.textContent=m),r=c(e),u(a.$$.fragment,e)},m(e,p){w(e,t,p),w(e,r,p),f(a,e,p),o=!0},p:T,i(e){o||(b(a.$$.fragment,e),o=!0)},o(e){$(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),y(a,e)}}}function fi(_){let t,m="<code>context_parallel</code> is currently only supported together with FSDP2, and requires <code>parallelism_config.cp_size</code> &gt;",r,a,o=`<li>If either of these conditions are not met, this context manager will have no effect, though to enable fewer
code changes it will not raise an Exception.</li>`;return{c(){t=i("p"),t.innerHTML=m,r=n(),a=i("ol"),a.innerHTML=o},l(e){t=d(e,"P",{"data-svelte-h":!0}),j(t)!=="svelte-13dftix"&&(t.innerHTML=m),r=c(e),a=d(e,"OL",{"data-svelte-h":!0}),j(a)!=="svelte-ylijyy"&&(a.innerHTML=o)},m(e,p){w(e,t,p),w(e,r,p),w(e,a,p)},p:T,d(e){e&&(h(t),h(r),h(a))}}}function bi(_){let t,m="This context manager has to be recreated with each training step, as shown in the example below.";return{c(){t=i("p"),t.textContent=m},l(r){t=d(r,"P",{"data-svelte-h":!0}),j(t)!=="svelte-50s686"&&(t.textContent=m)},m(r,a){w(r,t,a)},p:T,d(r){r&&h(t)}}}function $i(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"Zm9yJTIwYmF0Y2glMjBpbiUyMGRhdGFsb2FkZXIlM0ElMEElMjAlMjAlMjAlMjB3aXRoJTIwYWNjZWxlcmF0b3IubWF5YmVfY29udGV4dF9wYXJhbGxlbCglMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBidWZmZXJzJTNEJTVCYmF0Y2glNUIlMjJpbnB1dF9pZHMlMjIlNUQlMkMlMjBiYXRjaCU1QiUyMmF0dGVudGlvbl9tYXNrJTIyJTVEJTVEJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwYnVmZmVyX3NlcV9kaW1zJTNEJTVCMSUyQyUyMDElNUQlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBub19yZXN0b3JlX2J1ZmZlcnMlM0QlN0JiYXRjaCU1QiUyMmlucHV0X2lkcyUyMiU1RCU3RCUyQyUwQSUyMCUyMCUyMCUyMCklM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBvdXRwdXRzJTIwJTNEJTIwbW9kZWwoYmF0Y2gpJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwLi4u",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> batch <span class="hljs-keyword">in</span> dataloader:
<span class="hljs-meta">... </span>    <span class="hljs-keyword">with</span> accelerator.maybe_context_parallel(
<span class="hljs-meta">... </span>        buffers=[batch[<span class="hljs-string">&quot;input_ids&quot;</span>], batch[<span class="hljs-string">&quot;attention_mask&quot;</span>]],
<span class="hljs-meta">... </span>        buffer_seq_dims=[<span class="hljs-number">1</span>, <span class="hljs-number">1</span>],
<span class="hljs-meta">... </span>        no_restore_buffers={batch[<span class="hljs-string">&quot;input_ids&quot;</span>]},
<span class="hljs-meta">... </span>    ):
<span class="hljs-meta">... </span>        outputs = model(batch)
<span class="hljs-meta">... </span>        ...`,wrap:!1}}),{c(){t=i("p"),t.textContent=m,r=n(),g(a.$$.fragment)},l(e){t=d(e,"P",{"data-svelte-h":!0}),j(t)!=="svelte-11lpom8"&&(t.textContent=m),r=c(e),u(a.$$.fragment,e)},m(e,p){w(e,t,p),w(e,r,p),f(a,e,p),o=!0},p:T,i(e){o||(b(a.$$.fragment,e),o=!0)},o(e){$(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),y(a,e)}}}function yi(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKSUwQWRhdGFsb2FkZXIlMkMlMjBtb2RlbCUyQyUyMG9wdGltaXplciUyMCUzRCUyMGFjY2VsZXJhdG9yLnByZXBhcmUoZGF0YWxvYWRlciUyQyUyMG1vZGVsJTJDJTIwb3B0aW1pemVyKSUwQWlucHV0X2ElMjAlM0QlMjBuZXh0KGl0ZXIoZGF0YWxvYWRlcikpJTBBaW5wdXRfYiUyMCUzRCUyMG5leHQoaXRlcihkYXRhbG9hZGVyKSklMEElMEF3aXRoJTIwYWNjZWxlcmF0b3Iubm9fc3luYygpJTNBJTBBJTIwJTIwJTIwJTIwb3V0cHV0cyUyMCUzRCUyMG1vZGVsKGlucHV0X2EpJTBBJTIwJTIwJTIwJTIwbG9zcyUyMCUzRCUyMGxvc3NfZnVuYyhvdXRwdXRzKSUwQSUyMCUyMCUyMCUyMGFjY2VsZXJhdG9yLmJhY2t3YXJkKGxvc3MpJTBBJTIwJTIwJTIwJTIwJTIzJTIwTm8lMjBzeW5jaHJvbml6YXRpb24lMjBhY3Jvc3MlMjBwcm9jZXNzZXMlMkMlMjBvbmx5JTIwYWNjdW11bGF0ZSUyMGdyYWRpZW50cyUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbChpbnB1dF9iKSUwQWFjY2VsZXJhdG9yLmJhY2t3YXJkKGxvc3MpJTBBJTIzJTIwU3luY2hyb25pemF0aW9uJTIwYWNyb3NzJTIwYWxsJTIwcHJvY2Vzc2VzJTBBb3B0aW1pemVyLnN0ZXAoKSUwQW9wdGltaXplci56ZXJvX2dyYWQoKQ==",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()
<span class="hljs-meta">&gt;&gt;&gt; </span>dataloader, model, optimizer = accelerator.prepare(dataloader, model, optimizer)
<span class="hljs-meta">&gt;&gt;&gt; </span>input_a = <span class="hljs-built_in">next</span>(<span class="hljs-built_in">iter</span>(dataloader))
<span class="hljs-meta">&gt;&gt;&gt; </span>input_b = <span class="hljs-built_in">next</span>(<span class="hljs-built_in">iter</span>(dataloader))

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> accelerator.no_sync():
<span class="hljs-meta">... </span>    outputs = model(input_a)
<span class="hljs-meta">... </span>    loss = loss_func(outputs)
<span class="hljs-meta">... </span>    accelerator.backward(loss)
<span class="hljs-meta">... </span>    <span class="hljs-comment"># No synchronization across processes, only accumulate gradients</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(input_b)
<span class="hljs-meta">&gt;&gt;&gt; </span>accelerator.backward(loss)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Synchronization across all processes</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>optimizer.step()
<span class="hljs-meta">&gt;&gt;&gt; </span>optimizer.zero_grad()`,wrap:!1}}),{c(){t=i("p"),t.textContent=m,r=n(),g(a.$$.fragment)},l(e){t=d(e,"P",{"data-svelte-h":!0}),j(t)!=="svelte-11lpom8"&&(t.textContent=m),r=c(e),u(a.$$.fragment,e)},m(e,p){w(e,t,p),w(e,r,p),f(a,e,p),o=!0},p:T,i(e){o||(b(a.$$.fragment,e),o=!0)},o(e){$(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),y(a,e)}}}function Mi(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"JTIzJTIwQXNzdW1lJTIwd2UlMjBoYXZlJTIwNCUyMHByb2Nlc3Nlcy4lMEFmcm9tJTIwYWNjZWxlcmF0ZSUyMGltcG9ydCUyMEFjY2VsZXJhdG9yJTBBJTBBYWNjZWxlcmF0b3IlMjAlM0QlMjBBY2NlbGVyYXRvcigpJTBBJTBBJTBBJTQwYWNjZWxlcmF0b3Iub25fbGFzdF9wcm9jZXNzJTBBZGVmJTIwcHJpbnRfc29tZXRoaW5nKCklM0ElMEElMjAlMjAlMjAlMjBwcmludChmJTIyUHJpbnRlZCUyMG9uJTIwcHJvY2VzcyUyMCU3QmFjY2VsZXJhdG9yLnByb2Nlc3NfaW5kZXglN0QlMjIpJTBBJTBBJTBBcHJpbnRfc29tZXRoaW5nKCklMEElMjJQcmludGVkJTIwb24lMjBwcm9jZXNzJTIwMyUyMg==",highlighted:`<span class="hljs-comment"># Assume we have 4 processes.</span>
<span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator

accelerator = Accelerator()


<span class="hljs-meta">@accelerator.on_last_process</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">print_something</span>():
    <span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;Printed on process <span class="hljs-subst">{accelerator.process_index}</span>&quot;</span>)


print_something()
<span class="hljs-string">&quot;Printed on process 3&quot;</span>`,wrap:!1}}),{c(){t=i("p"),t.textContent=m,r=n(),g(a.$$.fragment)},l(e){t=d(e,"P",{"data-svelte-h":!0}),j(t)!=="svelte-11lpom8"&&(t.textContent=m),r=c(e),u(a.$$.fragment,e)},m(e,p){w(e,t,p),w(e,r,p),f(a,e,p),o=!0},p:T,i(e){o||(b(a.$$.fragment,e),o=!0)},o(e){$(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),y(a,e)}}}function ji(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"JTIzJTIwQXNzdW1lJTIwd2UlMjBoYXZlJTIwMiUyMHNlcnZlcnMlMjB3aXRoJTIwNCUyMHByb2Nlc3NlcyUyMGVhY2guJTBBZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKSUwQSUwQSUwQSU0MGFjY2VsZXJhdG9yLm9uX2xvY2FsX21haW5fcHJvY2VzcyUwQWRlZiUyMHByaW50X3NvbWV0aGluZygpJTNBJTBBJTIwJTIwJTIwJTIwcHJpbnQoJTIyVGhpcyUyMHdpbGwlMjBiZSUyMHByaW50ZWQlMjBieSUyMHByb2Nlc3MlMjAwJTIwb25seSUyMG9uJTIwZWFjaCUyMHNlcnZlci4lMjIpJTBBJTBBJTBBcHJpbnRfc29tZXRoaW5nKCklMEElMjMlMjBPbiUyMHNlcnZlciUyMDElM0ElMEElMjJUaGlzJTIwd2lsbCUyMGJlJTIwcHJpbnRlZCUyMGJ5JTIwcHJvY2VzcyUyMDAlMjBvbmx5JTIyJTBBJTIzJTIwT24lMjBzZXJ2ZXIlMjAyJTNBJTBBJTIyVGhpcyUyMHdpbGwlMjBiZSUyMHByaW50ZWQlMjBieSUyMHByb2Nlc3MlMjAwJTIwb25seSUyMg==",highlighted:`<span class="hljs-comment"># Assume we have 2 servers with 4 processes each.</span>
<span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator

accelerator = Accelerator()


<span class="hljs-meta">@accelerator.on_local_main_process</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">print_something</span>():
    <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;This will be printed by process 0 only on each server.&quot;</span>)


print_something()
<span class="hljs-comment"># On server 1:</span>
<span class="hljs-string">&quot;This will be printed by process 0 only&quot;</span>
<span class="hljs-comment"># On server 2:</span>
<span class="hljs-string">&quot;This will be printed by process 0 only&quot;</span>`,wrap:!1}}),{c(){t=i("p"),t.textContent=m,r=n(),g(a.$$.fragment)},l(e){t=d(e,"P",{"data-svelte-h":!0}),j(t)!=="svelte-11lpom8"&&(t.textContent=m),r=c(e),u(a.$$.fragment,e)},m(e,p){w(e,t,p),w(e,r,p),f(a,e,p),o=!0},p:T,i(e){o||(b(a.$$.fragment,e),o=!0)},o(e){$(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),y(a,e)}}}function wi(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"JTIzJTIwQXNzdW1lJTIwd2UlMjBoYXZlJTIwMiUyMHNlcnZlcnMlMjB3aXRoJTIwNCUyMHByb2Nlc3NlcyUyMGVhY2guJTBBZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKSUwQSUwQSUwQSU0MGFjY2VsZXJhdG9yLm9uX2xvY2FsX3Byb2Nlc3MobG9jYWxfcHJvY2Vzc19pbmRleCUzRDIpJTBBZGVmJTIwcHJpbnRfc29tZXRoaW5nKCklM0ElMEElMjAlMjAlMjAlMjBwcmludChmJTIyUHJpbnRlZCUyMG9uJTIwcHJvY2VzcyUyMCU3QmFjY2VsZXJhdG9yLmxvY2FsX3Byb2Nlc3NfaW5kZXglN0QlMjIpJTBBJTBBJTBBcHJpbnRfc29tZXRoaW5nKCklMEElMjMlMjBPbiUyMHNlcnZlciUyMDElM0ElMEElMjJQcmludGVkJTIwb24lMjBwcm9jZXNzJTIwMiUyMiUwQSUyMyUyME9uJTIwc2VydmVyJTIwMiUzQSUwQSUyMlByaW50ZWQlMjBvbiUyMHByb2Nlc3MlMjAyJTIy",highlighted:`<span class="hljs-comment"># Assume we have 2 servers with 4 processes each.</span>
<span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator

accelerator = Accelerator()


<span class="hljs-meta">@accelerator.on_local_process(<span class="hljs-params">local_process_index=<span class="hljs-number">2</span></span>)</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">print_something</span>():
    <span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;Printed on process <span class="hljs-subst">{accelerator.local_process_index}</span>&quot;</span>)


print_something()
<span class="hljs-comment"># On server 1:</span>
<span class="hljs-string">&quot;Printed on process 2&quot;</span>
<span class="hljs-comment"># On server 2:</span>
<span class="hljs-string">&quot;Printed on process 2&quot;</span>`,wrap:!1}}),{c(){t=i("p"),t.textContent=m,r=n(),g(a.$$.fragment)},l(e){t=d(e,"P",{"data-svelte-h":!0}),j(t)!=="svelte-11lpom8"&&(t.textContent=m),r=c(e),u(a.$$.fragment,e)},m(e,p){w(e,t,p),w(e,r,p),f(a,e,p),o=!0},p:T,i(e){o||(b(a.$$.fragment,e),o=!0)},o(e){$(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),y(a,e)}}}function _i(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKSUwQSUwQSUwQSU0MGFjY2VsZXJhdG9yLm9uX21haW5fcHJvY2VzcyUwQWRlZiUyMHByaW50X3NvbWV0aGluZygpJTNBJTBBJTIwJTIwJTIwJTIwcHJpbnQoJTIyVGhpcyUyMHdpbGwlMjBiZSUyMHByaW50ZWQlMjBieSUyMHByb2Nlc3MlMjAwJTIwb25seS4lMjIpJTBBJTBBJTBBcHJpbnRfc29tZXRoaW5nKCk=",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()


<span class="hljs-meta">&gt;&gt;&gt; </span>@accelerator.on_main_process
<span class="hljs-meta">... </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">print_something</span>():
<span class="hljs-meta">... </span>    <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;This will be printed by process 0 only.&quot;</span>)


<span class="hljs-meta">&gt;&gt;&gt; </span>print_something()
<span class="hljs-string">&quot;This will be printed by process 0 only&quot;</span>`,wrap:!1}}),{c(){t=i("p"),t.textContent=m,r=n(),g(a.$$.fragment)},l(e){t=d(e,"P",{"data-svelte-h":!0}),j(t)!=="svelte-11lpom8"&&(t.textContent=m),r=c(e),u(a.$$.fragment,e)},m(e,p){w(e,t,p),w(e,r,p),f(a,e,p),o=!0},p:T,i(e){o||(b(a.$$.fragment,e),o=!0)},o(e){$(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),y(a,e)}}}function vi(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"JTIzJTIwQXNzdW1lJTIwd2UlMjBoYXZlJTIwNCUyMHByb2Nlc3Nlcy4lMEFmcm9tJTIwYWNjZWxlcmF0ZSUyMGltcG9ydCUyMEFjY2VsZXJhdG9yJTBBJTBBYWNjZWxlcmF0b3IlMjAlM0QlMjBBY2NlbGVyYXRvcigpJTBBJTBBJTBBJTQwYWNjZWxlcmF0b3Iub25fcHJvY2Vzcyhwcm9jZXNzX2luZGV4JTNEMiklMEFkZWYlMjBwcmludF9zb21ldGhpbmcoKSUzQSUwQSUyMCUyMCUyMCUyMHByaW50KGYlMjJQcmludGVkJTIwb24lMjBwcm9jZXNzJTIwJTdCYWNjZWxlcmF0b3IucHJvY2Vzc19pbmRleCU3RCUyMiklMEElMEElMEFwcmludF9zb21ldGhpbmcoKSUwQSUyMlByaW50ZWQlMjBvbiUyMHByb2Nlc3MlMjAyJTIy",highlighted:`<span class="hljs-comment"># Assume we have 4 processes.</span>
<span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator

accelerator = Accelerator()


<span class="hljs-meta">@accelerator.on_process(<span class="hljs-params">process_index=<span class="hljs-number">2</span></span>)</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">print_something</span>():
    <span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;Printed on process <span class="hljs-subst">{accelerator.process_index}</span>&quot;</span>)


print_something()
<span class="hljs-string">&quot;Printed on process 2&quot;</span>`,wrap:!1}}),{c(){t=i("p"),t.textContent=m,r=n(),g(a.$$.fragment)},l(e){t=d(e,"P",{"data-svelte-h":!0}),j(t)!=="svelte-11lpom8"&&(t.textContent=m),r=c(e),u(a.$$.fragment,e)},m(e,p){w(e,t,p),w(e,r,p),f(a,e,p),o=!0},p:T,i(e){o||(b(a.$$.fragment,e),o=!0)},o(e){$(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),y(a,e)}}}function Ji(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"JTIzJTIwQXNzdW1pbmclMjB0d28lMjBwcm9jZXNzZXMlMkMlMjB3aXRoJTIwdGhlJTIwZmlyc3QlMjBwcm9jZXNzZXMlMjBoYXZpbmclMjBhJTIwdGVuc29yJTIwb2YlMjBzaXplJTIwMSUyMGFuZCUyMHRoZSUyMHNlY29uZCUyMG9mJTIwc2l6ZSUyMDIlMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjBhY2NlbGVyYXRlJTIwaW1wb3J0JTIwQWNjZWxlcmF0b3IlMEElMEFhY2NlbGVyYXRvciUyMCUzRCUyMEFjY2VsZXJhdG9yKCklMEFwcm9jZXNzX3RlbnNvciUyMCUzRCUyMHRvcmNoLmFyYW5nZShhY2NlbGVyYXRvci5wcm9jZXNzX2luZGV4JTIwJTJCJTIwMSkudG8oYWNjZWxlcmF0b3IuZGV2aWNlKSUwQXBhZGRlZF90ZW5zb3IlMjAlM0QlMjBhY2NlbGVyYXRvci5wYWRfYWNyb3NzX3Byb2Nlc3Nlcyhwcm9jZXNzX3RlbnNvciklMEFwYWRkZWRfdGVuc29yLnNoYXBl",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Assuming two processes, with the first processes having a tensor of size 1 and the second of size 2</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<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()
<span class="hljs-meta">&gt;&gt;&gt; </span>process_tensor = torch.arange(accelerator.process_index + <span class="hljs-number">1</span>).to(accelerator.device)
<span class="hljs-meta">&gt;&gt;&gt; </span>padded_tensor = accelerator.pad_across_processes(process_tensor)
<span class="hljs-meta">&gt;&gt;&gt; </span>padded_tensor.shape
torch.Size([<span class="hljs-number">2</span>])`,wrap:!1}}),{c(){t=i("p"),t.textContent=m,r=n(),g(a.$$.fragment)},l(e){t=d(e,"P",{"data-svelte-h":!0}),j(t)!=="svelte-11lpom8"&&(t.textContent=m),r=c(e),u(a.$$.fragment,e)},m(e,p){w(e,t,p),w(e,r,p),f(a,e,p),o=!0},p:T,i(e){o||(b(a.$$.fragment,e),o=!0)},o(e){$(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),y(a,e)}}}function Ti(_){let t,m="You don’t need to prepare a model if you only use it for inference without any kind of mixed precision";return{c(){t=i("p"),t.textContent=m},l(r){t=d(r,"P",{"data-svelte-h":!0}),j(t)!=="svelte-1k839yf"&&(t.textContent=m)},m(r,a){w(r,t,a)},p:T,d(r){r&&h(t)}}}function Ui(_){let t,m="Examples:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKSUwQSUyMyUyMEFzc3VtZSUyMGElMjBtb2RlbCUyQyUyMG9wdGltaXplciUyQyUyMGRhdGFfbG9hZGVyJTIwYW5kJTIwc2NoZWR1bGVyJTIwYXJlJTIwZGVmaW5lZCUwQW1vZGVsJTJDJTIwb3B0aW1pemVyJTJDJTIwZGF0YV9sb2FkZXIlMkMlMjBzY2hlZHVsZXIlMjAlM0QlMjBhY2NlbGVyYXRvci5wcmVwYXJlKG1vZGVsJTJDJTIwb3B0aW1pemVyJTJDJTIwZGF0YV9sb2FkZXIlMkMlMjBzY2hlZHVsZXIp",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()
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Assume a model, optimizer, data_loader and scheduler are defined</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model, optimizer, data_loader, scheduler = accelerator.prepare(model, optimizer, data_loader, scheduler)`,wrap:!1}}),{c(){t=i("p"),t.textContent=m,r=n(),g(a.$$.fragment)},l(e){t=d(e,"P",{"data-svelte-h":!0}),j(t)!=="svelte-kvfsh7"&&(t.textContent=m),r=c(e),u(a.$$.fragment,e)},m(e,p){w(e,t,p),w(e,r,p),f(a,e,p),o=!0},p:T,i(e){o||(b(a.$$.fragment,e),o=!0)},o(e){$(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),y(a,e)}}}function xi(_){let t,m;return t=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKSUwQSUyMyUyMEFzc3VtZSUyMGElMjBtb2RlbCUyQyUyMG9wdGltaXplciUyQyUyMGRhdGFfbG9hZGVyJTIwYW5kJTIwc2NoZWR1bGVyJTIwYXJlJTIwZGVmaW5lZCUwQWRldmljZV9wbGFjZW1lbnQlMjAlM0QlMjAlNUJUcnVlJTJDJTIwVHJ1ZSUyQyUyMEZhbHNlJTJDJTIwRmFsc2UlNUQlMEElMjMlMjBXaWxsJTIwcGxhY2UlMjB0aGUlMjBmaXJzdCUyMHR3byUyMGl0ZW1zJTIwcGFzc2VkJTIwaW4lMjBhdXRvbWF0aWNhbGx5JTIwdG8lMjB0aGUlMjByaWdodCUyMGRldmljZSUyMGJ1dCUyMG5vdCUyMHRoZSUyMGxhc3QlMjB0d28uJTBBbW9kZWwlMkMlMjBvcHRpbWl6ZXIlMkMlMjBkYXRhX2xvYWRlciUyQyUyMHNjaGVkdWxlciUyMCUzRCUyMGFjY2VsZXJhdG9yLnByZXBhcmUoJTBBJTIwJTIwJTIwJTIwbW9kZWwlMkMlMjBvcHRpbWl6ZXIlMkMlMjBkYXRhX2xvYWRlciUyQyUyMHNjaGVkdWxlciUyQyUyMGRldmljZV9wbGFjZW1lbnQlM0RkZXZpY2VfcGxhY2VtZW50JTBBKQ==",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()
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Assume a model, optimizer, data_loader and scheduler are defined</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>device_placement = [<span class="hljs-literal">True</span>, <span class="hljs-literal">True</span>, <span class="hljs-literal">False</span>, <span class="hljs-literal">False</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Will place the first two items passed in automatically to the right device but not the last two.</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model, optimizer, data_loader, scheduler = accelerator.prepare(
<span class="hljs-meta">... </span>    model, optimizer, data_loader, scheduler, device_placement=device_placement
<span class="hljs-meta">... </span>)`,wrap:!1}}),{c(){g(t.$$.fragment)},l(r){u(t.$$.fragment,r)},m(r,a){f(t,r,a),m=!0},p:T,i(r){m||(b(t.$$.fragment,r),m=!0)},o(r){$(t.$$.fragment,r),m=!1},d(r){y(t,r)}}}function ki(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwYWNjZWxlcmF0ZSUyMGltcG9ydCUyMEFjY2VsZXJhdG9yJTBBJTBBYWNjZWxlcmF0b3IlMjAlM0QlMjBBY2NlbGVyYXRvcigpJTBBZGF0YV9sb2FkZXIlMjAlM0QlMjB0b3JjaC51dGlscy5kYXRhLkRhdGFMb2FkZXIoLi4uKSUwQWRhdGFfbG9hZGVyJTIwJTNEJTIwYWNjZWxlcmF0b3IucHJlcGFyZV9kYXRhX2xvYWRlcihkYXRhX2xvYWRlciUyQyUyMGRldmljZV9wbGFjZW1lbnQlM0RUcnVlKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<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()
<span class="hljs-meta">&gt;&gt;&gt; </span>data_loader = torch.utils.data.DataLoader(...)
<span class="hljs-meta">&gt;&gt;&gt; </span>data_loader = accelerator.prepare_data_loader(data_loader, device_placement=<span class="hljs-literal">True</span>)`,wrap:!1}}),{c(){t=i("p"),t.textContent=m,r=n(),g(a.$$.fragment)},l(e){t=d(e,"P",{"data-svelte-h":!0}),j(t)!=="svelte-11lpom8"&&(t.textContent=m),r=c(e),u(a.$$.fragment,e)},m(e,p){w(e,t,p),w(e,r,p),f(a,e,p),o=!0},p:T,i(e){o||(b(a.$$.fragment,e),o=!0)},o(e){$(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),y(a,e)}}}function Gi(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKSUwQSUyMyUyMEFzc3VtZSUyMGElMjBtb2RlbCUyMGlzJTIwZGVmaW5lZCUwQW1vZGVsJTIwJTNEJTIwYWNjZWxlcmF0b3IucHJlcGFyZV9tb2RlbChtb2RlbCk=",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()
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Assume a model is defined</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = accelerator.prepare_model(model)`,wrap:!1}}),{c(){t=i("p"),t.textContent=m,r=n(),g(a.$$.fragment)},l(e){t=d(e,"P",{"data-svelte-h":!0}),j(t)!=="svelte-11lpom8"&&(t.textContent=m),r=c(e),u(a.$$.fragment,e)},m(e,p){w(e,t,p),w(e,r,p),f(a,e,p),o=!0},p:T,i(e){o||(b(a.$$.fragment,e),o=!0)},o(e){$(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),y(a,e)}}}function Bi(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwYWNjZWxlcmF0ZSUyMGltcG9ydCUyMEFjY2VsZXJhdG9yJTBBJTBBYWNjZWxlcmF0b3IlMjAlM0QlMjBBY2NlbGVyYXRvcigpJTBBb3B0aW1pemVyJTIwJTNEJTIwdG9yY2gub3B0aW0uQWRhbSguLi4pJTBBb3B0aW1pemVyJTIwJTNEJTIwYWNjZWxlcmF0b3IucHJlcGFyZV9vcHRpbWl6ZXIob3B0aW1pemVyJTJDJTIwZGV2aWNlX3BsYWNlbWVudCUzRFRydWUp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<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()
<span class="hljs-meta">&gt;&gt;&gt; </span>optimizer = torch.optim.Adam(...)
<span class="hljs-meta">&gt;&gt;&gt; </span>optimizer = accelerator.prepare_optimizer(optimizer, device_placement=<span class="hljs-literal">True</span>)`,wrap:!1}}),{c(){t=i("p"),t.textContent=m,r=n(),g(a.$$.fragment)},l(e){t=d(e,"P",{"data-svelte-h":!0}),j(t)!=="svelte-11lpom8"&&(t.textContent=m),r=c(e),u(a.$$.fragment,e)},m(e,p){w(e,t,p),w(e,r,p),f(a,e,p),o=!0},p:T,i(e){o||(b(a.$$.fragment,e),o=!0)},o(e){$(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),y(a,e)}}}function Ii(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwYWNjZWxlcmF0ZSUyMGltcG9ydCUyMEFjY2VsZXJhdG9yJTBBJTBBYWNjZWxlcmF0b3IlMjAlM0QlMjBBY2NlbGVyYXRvcigpJTBBb3B0aW1pemVyJTIwJTNEJTIwdG9yY2gub3B0aW0uQWRhbSguLi4pJTBBc2NoZWR1bGVyJTIwJTNEJTIwdG9yY2gub3B0aW0ubHJfc2NoZWR1bGVyLkxhbWJkYUxSKG9wdGltaXplciUyQyUyMC4uLiklMEFzY2hlZHVsZXIlMjAlM0QlMjBhY2NlbGVyYXRvci5wcmVwYXJlX3NjaGVkdWxlcihzY2hlZHVsZXIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<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()
<span class="hljs-meta">&gt;&gt;&gt; </span>optimizer = torch.optim.Adam(...)
<span class="hljs-meta">&gt;&gt;&gt; </span>scheduler = torch.optim.lr_scheduler.LambdaLR(optimizer, ...)
<span class="hljs-meta">&gt;&gt;&gt; </span>scheduler = accelerator.prepare_scheduler(scheduler)`,wrap:!1}}),{c(){t=i("p"),t.textContent=m,r=n(),g(a.$$.fragment)},l(e){t=d(e,"P",{"data-svelte-h":!0}),j(t)!=="svelte-11lpom8"&&(t.textContent=m),r=c(e),u(a.$$.fragment,e)},m(e,p){w(e,t,p),w(e,r,p),f(a,e,p),o=!0},p:T,i(e){o||(b(a.$$.fragment,e),o=!0)},o(e){$(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),y(a,e)}}}function Ci(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKSUwQWFjY2VsZXJhdG9yLnByaW50KCUyMkhlbGxvJTIwd29ybGQhJTIyKQ==",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()
<span class="hljs-meta">&gt;&gt;&gt; </span>accelerator.<span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;Hello world!&quot;</span>)`,wrap:!1}}),{c(){t=i("p"),t.textContent=m,r=n(),g(a.$$.fragment)},l(e){t=d(e,"P",{"data-svelte-h":!0}),j(t)!=="svelte-11lpom8"&&(t.textContent=m),r=c(e),u(a.$$.fragment,e)},m(e,p){w(e,t,p),w(e,r,p),f(a,e,p),o=!0},p:T,i(e){o||(b(a.$$.fragment,e),o=!0)},o(e){$(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),y(a,e)}}}function Zi(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"JTIzJTIwUHJvZmlsZSUyMHdpdGglMjBkZWZhdWx0JTIwc2V0dGluZ3MlMEFmcm9tJTIwYWNjZWxlcmF0ZSUyMGltcG9ydCUyMEFjY2VsZXJhdG9yJTBBZnJvbSUyMGFjY2VsZXJhdGUudXRpbHMlMjBpbXBvcnQlMjBQcm9maWxlS3dhcmdzJTBBJTBBYWNjZWxlcmF0b3IlMjAlM0QlMjBBY2NlbGVyYXRvcigpJTBBd2l0aCUyMGFjY2VsZXJhdG9yLnByb2ZpbGUoKSUyMGFzJTIwcHJvZiUzQSUwQSUyMCUyMCUyMCUyMHRyYWluKCklMEFhY2NlbGVyYXRvci5wcmludChwcm9mLmtleV9hdmVyYWdlcygpLnRhYmxlKCkpJTBBJTBBJTBBJTIzJTIwUHJvZmlsZSUyMHdpdGglMjB0aGUlMjBjdXN0b20lMjBoYW5kbGVyJTBBZGVmJTIwY3VzdG9tX2hhbmRsZXIocHJvZiklM0ElMEElMjAlMjAlMjAlMjBwcmludChwcm9mLmtleV9hdmVyYWdlcygpLnRhYmxlKHNvcnRfYnklM0QlMjJzZWxmX2NwdV90aW1lX3RvdGFsJTIyJTJDJTIwcm93X2xpbWl0JTNEMTApKSUwQSUwQSUwQWt3YXJncyUyMCUzRCUyMFByb2ZpbGVLd2FyZ3Moc2NoZWR1bGVfb3B0aW9uJTNEZGljdCh3YWl0JTNEMSUyQyUyMHdhcm11cCUzRDElMkMlMjBhY3RpdmUlM0QxKSUyQyUyMG9uX3RyYWNlX3JlYWR5JTNEY3VzdG9tX2hhbmRsZXIpJTBBYWNjZWxlcmF0b3IlMjAlM0QlMjBBY2NlbGVyYXRvcihrd2FyZ19oYW5kbGVyJTNEJTVCa3dhcmdzJTVEKSUwQXdpdGglMjBhY2NlbGVyYXRvci5wcm9maWxlKCklMjBhcyUyMHByb2YlM0ElMEElMjAlMjAlMjAlMjBmb3IlMjBfJTIwaW4lMjByYW5nZSgxMCklM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjB0cmFpbl9pdGVyYXRpb24oKSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHByb2Yuc3RlcCgpJTBBJTBBJTBBJTIzJTIwUHJvZmlsZSUyMGFuZCUyMGV4cG9ydCUyMHRvJTIwQ2hyb21lJTIwVHJhY2UlMEFrd2FyZ3MlMjAlM0QlMjBQcm9maWxlS3dhcmdzKG91dHB1dF90cmFjZV9kaXIlM0QlMjJvdXRwdXRfdHJhY2UlMjIpJTBBYWNjZWxlcmF0b3IlMjAlM0QlMjBBY2NlbGVyYXRvcihrd2FyZ19oYW5kbGVyJTNEJTVCa3dhcmdzJTVEKSUwQXdpdGglMjBhY2NlbGVyYXRvci5wcm9maWxlKCklM0ElMEElMjAlMjAlMjAlMjB0cmFpbigp",highlighted:`<span class="hljs-comment"># Profile with default settings</span>
<span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator
<span class="hljs-keyword">from</span> accelerate.utils <span class="hljs-keyword">import</span> ProfileKwargs

accelerator = Accelerator()
<span class="hljs-keyword">with</span> accelerator.profile() <span class="hljs-keyword">as</span> prof:
    train()
accelerator.<span class="hljs-built_in">print</span>(prof.key_averages().table())


<span class="hljs-comment"># Profile with the custom handler</span>
<span class="hljs-keyword">def</span> <span class="hljs-title function_">custom_handler</span>(<span class="hljs-params">prof</span>):
    <span class="hljs-built_in">print</span>(prof.key_averages().table(sort_by=<span class="hljs-string">&quot;self_cpu_time_total&quot;</span>, row_limit=<span class="hljs-number">10</span>))


kwargs = ProfileKwargs(schedule_option=<span class="hljs-built_in">dict</span>(wait=<span class="hljs-number">1</span>, warmup=<span class="hljs-number">1</span>, active=<span class="hljs-number">1</span>), on_trace_ready=custom_handler)
accelerator = Accelerator(kwarg_handler=[kwargs])
<span class="hljs-keyword">with</span> accelerator.profile() <span class="hljs-keyword">as</span> prof:
    <span class="hljs-keyword">for</span> _ <span class="hljs-keyword">in</span> <span class="hljs-built_in">range</span>(<span class="hljs-number">10</span>):
        train_iteration()
        prof.step()


<span class="hljs-comment"># Profile and export to Chrome Trace</span>
kwargs = ProfileKwargs(output_trace_dir=<span class="hljs-string">&quot;output_trace&quot;</span>)
accelerator = Accelerator(kwarg_handler=[kwargs])
<span class="hljs-keyword">with</span> accelerator.profile():
    train()`,wrap:!1}}),{c(){t=i("p"),t.textContent=m,r=n(),g(a.$$.fragment)},l(e){t=d(e,"P",{"data-svelte-h":!0}),j(t)!=="svelte-11lpom8"&&(t.textContent=m),r=c(e),u(a.$$.fragment,e)},m(e,p){w(e,t,p),w(e,r,p),f(a,e,p),o=!0},p:T,i(e){o||(b(a.$$.fragment,e),o=!0)},o(e){$(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),y(a,e)}}}function Wi(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"JTIzJTIwQXNzdW1pbmclMjB0d28lMjBwcm9jZXNzZXMlMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjBhY2NlbGVyYXRlJTIwaW1wb3J0JTIwQWNjZWxlcmF0b3IlMEElMEFhY2NlbGVyYXRvciUyMCUzRCUyMEFjY2VsZXJhdG9yKCklMEFwcm9jZXNzX3RlbnNvciUyMCUzRCUyMHRvcmNoLmFyYW5nZShhY2NlbGVyYXRvci5udW1fcHJvY2Vzc2VzKSUyMCUyQiUyMDElMjAlMkIlMjAoMiUyMColMjBhY2NlbGVyYXRvci5wcm9jZXNzX2luZGV4KSUwQXByb2Nlc3NfdGVuc29yJTIwJTNEJTIwcHJvY2Vzc190ZW5zb3IudG8oYWNjZWxlcmF0b3IuZGV2aWNlKSUwQXJlZHVjZWRfdGVuc29yJTIwJTNEJTIwYWNjZWxlcmF0b3IucmVkdWNlKHByb2Nlc3NfdGVuc29yJTJDJTIwcmVkdWN0aW9uJTNEJTIyc3VtJTIyKSUwQXJlZHVjZWRfdGVuc29y",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Assuming two processes</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<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()
<span class="hljs-meta">&gt;&gt;&gt; </span>process_tensor = torch.arange(accelerator.num_processes) + <span class="hljs-number">1</span> + (<span class="hljs-number">2</span> * accelerator.process_index)
<span class="hljs-meta">&gt;&gt;&gt; </span>process_tensor = process_tensor.to(accelerator.device)
<span class="hljs-meta">&gt;&gt;&gt; </span>reduced_tensor = accelerator.reduce(process_tensor, reduction=<span class="hljs-string">&quot;sum&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>reduced_tensor
tensor([<span class="hljs-number">4</span>, <span class="hljs-number">6</span>])`,wrap:!1}}),{c(){t=i("p"),t.textContent=m,r=n(),g(a.$$.fragment)},l(e){t=d(e,"P",{"data-svelte-h":!0}),j(t)!=="svelte-11lpom8"&&(t.textContent=m),r=c(e),u(a.$$.fragment,e)},m(e,p){w(e,t,p),w(e,r,p),f(a,e,p),o=!0},p:T,i(e){o||(b(a.$$.fragment,e),o=!0)},o(e){$(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),y(a,e)}}}function Yi(_){let t,m="Every <code>object</code> must have a <code>load_state_dict</code> and <code>state_dict</code> function to be stored.";return{c(){t=i("p"),t.innerHTML=m},l(r){t=d(r,"P",{"data-svelte-h":!0}),j(t)!=="svelte-1kglckk"&&(t.innerHTML=m)},m(r,a){w(r,t,a)},p:T,d(r){r&&h(t)}}}function Xi(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKSUwQSUyMyUyMEFzc3VtZSUyMCU2MEN1c3RvbU9iamVjdCU2MCUyMGhhcyUyMGElMjAlNjBzdGF0ZV9kaWN0JTYwJTIwYW5kJTIwJTYwbG9hZF9zdGF0ZV9kaWN0JTYwJTIwZnVuY3Rpb24uJTBBb2JqJTIwJTNEJTIwQ3VzdG9tT2JqZWN0KCklMEFhY2NlbGVyYXRvci5yZWdpc3Rlcl9mb3JfY2hlY2twb2ludGluZyhvYmopJTBBYWNjZWxlcmF0b3Iuc2F2ZV9zdGF0ZSglMjJjaGVja3BvaW50LnB0JTIyKQ==",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator\n\n<span class="hljs-meta">&gt;&gt;&gt; </span>accelerator = Accelerator()\n<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Assume `CustomObject` has a `state_dict` and `load_state_dict` function.</span>\n<span class="hljs-meta">&gt;&gt;&gt; </span>obj = CustomObject()\n<span class="hljs-meta">&gt;&gt;&gt; </span>accelerator.register_for_checkpointing(obj)\n<span class="hljs-meta">&gt;&gt;&gt; </span>accelerator.save_state(<span class="hljs-string">&quot;checkpoint.pt&quot;</span>)',wrap:!1}}),{c(){t=i("p"),t.textContent=m,r=n(),g(a.$$.fragment)},l(e){t=d(e,"P",{"data-svelte-h":!0}),j(t)!=="svelte-11lpom8"&&(t.textContent=m),r=c(e),u(a.$$.fragment,e)},m(e,p){w(e,t,p),w(e,r,p),f(a,e,p),o=!0},p:T,i(e){o||(b(a.$$.fragment,e),o=!0)},o(e){$(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),y(a,e)}}}function Ai(_){let t,m=`Should only be used in conjunction with <a href="/docs/accelerate/main/en/package_reference/accelerator#accelerate.Accelerator.register_save_state_pre_hook">Accelerator.register_save_state_pre_hook()</a>. Can be useful to load
configurations in addition to model weights. Can also be used to overwrite model loading with a customized
method. In this case, make sure to remove already loaded models from the models list.`;return{c(){t=i("p"),t.innerHTML=m},l(r){t=d(r,"P",{"data-svelte-h":!0}),j(t)!=="svelte-1qnymkw"&&(t.innerHTML=m)},m(r,a){w(r,t,a)},p:T,d(r){r&&h(t)}}}function Vi(_){let t,m=`Should only be used in conjunction with <a href="/docs/accelerate/main/en/package_reference/accelerator#accelerate.Accelerator.register_load_state_pre_hook">Accelerator.register_load_state_pre_hook()</a>. Can be useful to save
configurations in addition to model weights. Can also be used to overwrite model saving with a customized
method. In this case, make sure to remove already loaded weights from the weights list.`;return{c(){t=i("p"),t.innerHTML=m},l(r){t=d(r,"P",{"data-svelte-h":!0}),j(t)!=="svelte-cks0xt"&&(t.innerHTML=m)},m(r,a){w(r,t,a)},p:T,d(r){r&&h(t)}}}function Ni(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKSUwQWFyciUyMCUzRCUyMCU1QjAlMkMlMjAxJTJDJTIwMiUyQyUyMDMlNUQlMEFhY2NlbGVyYXRvci5zYXZlKGFyciUyQyUyMCUyMmFycmF5LnBrbCUyMik=",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()
<span class="hljs-meta">&gt;&gt;&gt; </span>arr = [<span class="hljs-number">0</span>, <span class="hljs-number">1</span>, <span class="hljs-number">2</span>, <span class="hljs-number">3</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>accelerator.save(arr, <span class="hljs-string">&quot;array.pkl&quot;</span>)`,wrap:!1}}),{c(){t=i("p"),t.textContent=m,r=n(),g(a.$$.fragment)},l(e){t=d(e,"P",{"data-svelte-h":!0}),j(t)!=="svelte-11lpom8"&&(t.textContent=m),r=c(e),u(a.$$.fragment,e)},m(e,p){w(e,t,p),w(e,r,p),f(a,e,p),o=!0},p:T,i(e){o||(b(a.$$.fragment,e),o=!0)},o(e){$(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),y(a,e)}}}function Qi(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKSUwQW1vZGVsJTIwJTNEJTIwLi4uJTBBYWNjZWxlcmF0b3Iuc2F2ZV9tb2RlbChtb2RlbCUyQyUyMHNhdmVfZGlyZWN0b3J5KQ==",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()
<span class="hljs-meta">&gt;&gt;&gt; </span>model = ...
<span class="hljs-meta">&gt;&gt;&gt; </span>accelerator.save_model(model, save_directory)`,wrap:!1}}),{c(){t=i("p"),t.textContent=m,r=n(),g(a.$$.fragment)},l(e){t=d(e,"P",{"data-svelte-h":!0}),j(t)!=="svelte-11lpom8"&&(t.textContent=m),r=c(e),u(a.$$.fragment,e)},m(e,p){w(e,t,p),w(e,r,p),f(a,e,p),o=!0},p:T,i(e){o||(b(a.$$.fragment,e),o=!0)},o(e){$(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),y(a,e)}}}function Fi(_){let t,m=`Should only be used when wanting to save a checkpoint during training and restoring the state in the same
environment.`;return{c(){t=i("p"),t.textContent=m},l(r){t=d(r,"P",{"data-svelte-h":!0}),j(t)!=="svelte-1ljq3ee"&&(t.textContent=m)},m(r,a){w(r,t,a)},p:T,d(r){r&&h(t)}}}function zi(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKSUwQW1vZGVsJTJDJTIwb3B0aW1pemVyJTJDJTIwbHJfc2NoZWR1bGVyJTIwJTNEJTIwLi4uJTBBbW9kZWwlMkMlMjBvcHRpbWl6ZXIlMkMlMjBscl9zY2hlZHVsZXIlMjAlM0QlMjBhY2NlbGVyYXRvci5wcmVwYXJlKG1vZGVsJTJDJTIwb3B0aW1pemVyJTJDJTIwbHJfc2NoZWR1bGVyKSUwQWFjY2VsZXJhdG9yLnNhdmVfc3RhdGUob3V0cHV0X2RpciUzRCUyMm15X2NoZWNrcG9pbnQlMjIp",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()
<span class="hljs-meta">&gt;&gt;&gt; </span>model, optimizer, lr_scheduler = ...
<span class="hljs-meta">&gt;&gt;&gt; </span>model, optimizer, lr_scheduler = accelerator.prepare(model, optimizer, lr_scheduler)
<span class="hljs-meta">&gt;&gt;&gt; </span>accelerator.save_state(output_dir=<span class="hljs-string">&quot;my_checkpoint&quot;</span>)`,wrap:!1}}),{c(){t=i("p"),t.textContent=m,r=n(),g(a.$$.fragment)},l(e){t=d(e,"P",{"data-svelte-h":!0}),j(t)!=="svelte-11lpom8"&&(t.textContent=m),r=c(e),u(a.$$.fragment,e)},m(e,p){w(e,t,p),w(e,r,p),f(a,e,p),o=!0},p:T,i(e){o||(b(a.$$.fragment,e),o=!0)},o(e){$(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),y(a,e)}}}function Ri(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKSUwQSUyMyUyMEFzc3VtZSUyMGxhdGVyJTIwaW4lMjB0aGUlMjB0cmFpbmluZyUyMHNjcmlwdCUwQSUyMyUyMCU2MHNob3VsZF9kb19icmVha3BvaW50JTYwJTIwaXMlMjBhJTIwY3VzdG9tJTIwZnVuY3Rpb24lMjB0byUyMG1vbml0b3IlMjB3aGVuJTIwdG8lMjBicmVhayUyQyUwQSUyMyUyMGUuZy4lMjB3aGVuJTIwdGhlJTIwbG9zcyUyMGlzJTIwTmFOJTBBaWYlMjBzaG91bGRfZG9fYnJlYWtwb2ludChsb3NzKSUzQSUwQSUyMCUyMCUyMCUyMGFjY2VsZXJhdG9yLnNldF90cmlnZ2VyKCklMEElMjMlMjBBc3N1bWUlMjBsYXRlciUyMGluJTIwdGhlJTIwdHJhaW5pbmclMjBzY3JpcHQlMEFpZiUyMGFjY2VsZXJhdG9yLmNoZWNrX2JyZWFrcG9pbnQoKSUzQSUwQSUyMCUyMCUyMCUyMGJyZWFr",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()
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Assume later in the training script</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># \`should_do_breakpoint\` is a custom function to monitor when to break,</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># e.g. when the loss is NaN</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">if</span> should_do_breakpoint(loss):
<span class="hljs-meta">... </span>    accelerator.set_trigger()
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Assume later in the training script</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">if</span> accelerator.check_breakpoint():
<span class="hljs-meta">... </span>    <span class="hljs-keyword">break</span>`,wrap:!1}}),{c(){t=i("p"),t.textContent=m,r=n(),g(a.$$.fragment)},l(e){t=d(e,"P",{"data-svelte-h":!0}),j(t)!=="svelte-11lpom8"&&(t.textContent=m),r=c(e),u(a.$$.fragment,e)},m(e,p){w(e,t,p),w(e,r,p),f(a,e,p),o=!0},p:T,i(e){o||(b(a.$$.fragment,e),o=!0)},o(e){$(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),y(a,e)}}}function Ei(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKSUwQWRhdGFsb2FkZXIlMkMlMjBtb2RlbCUyQyUyMG9wdGltaXplciUyQyUyMHNjaGVkdWxlciUyMCUzRCUyMGFjY2VsZXJhdG9yLnByZXBhcmUoZGF0YWxvYWRlciUyQyUyMG1vZGVsJTJDJTIwb3B0aW1pemVyJTJDJTIwc2NoZWR1bGVyKSUwQXNraXBwZWRfZGF0YWxvYWRlciUyMCUzRCUyMGFjY2VsZXJhdG9yLnNraXBfZmlyc3RfYmF0Y2hlcyhkYXRhbG9hZGVyJTJDJTIwbnVtX2JhdGNoZXMlM0QyKSUwQSUyMyUyMGZvciUyMHRoZSUyMGZpcnN0JTIwZXBvY2glMjBvbmx5JTBBZm9yJTIwaW5wdXQlMkMlMjB0YXJnZXQlMjBpbiUyMHNraXBwZWRfZGF0YWxvYWRlciUzQSUwQSUyMCUyMCUyMCUyMG9wdGltaXplci56ZXJvX2dyYWQoKSUwQSUyMCUyMCUyMCUyMG91dHB1dCUyMCUzRCUyMG1vZGVsKGlucHV0KSUwQSUyMCUyMCUyMCUyMGxvc3MlMjAlM0QlMjBsb3NzX2Z1bmMob3V0cHV0JTJDJTIwdGFyZ2V0KSUwQSUyMCUyMCUyMCUyMGFjY2VsZXJhdG9yLmJhY2t3YXJkKGxvc3MpJTBBJTIwJTIwJTIwJTIwb3B0aW1pemVyLnN0ZXAoKSUwQSUwQSUyMyUyMHN1YnNlcXVlbnQlMjBlcG9jaHMlMEFmb3IlMjBpbnB1dCUyQyUyMHRhcmdldCUyMGluJTIwZGF0YWxvYWRlciUzQSUwQSUyMCUyMCUyMCUyMG9wdGltaXplci56ZXJvX2dyYWQoKSUwQSUyMCUyMCUyMCUyMC4uLg==",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()
<span class="hljs-meta">&gt;&gt;&gt; </span>dataloader, model, optimizer, scheduler = accelerator.prepare(dataloader, model, optimizer, scheduler)
<span class="hljs-meta">&gt;&gt;&gt; </span>skipped_dataloader = accelerator.skip_first_batches(dataloader, num_batches=<span class="hljs-number">2</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># for the first epoch only</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> <span class="hljs-built_in">input</span>, target <span class="hljs-keyword">in</span> skipped_dataloader:
<span class="hljs-meta">... </span>    optimizer.zero_grad()
<span class="hljs-meta">... </span>    output = model(<span class="hljs-built_in">input</span>)
<span class="hljs-meta">... </span>    loss = loss_func(output, target)
<span class="hljs-meta">... </span>    accelerator.backward(loss)
<span class="hljs-meta">... </span>    optimizer.step()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># subsequent epochs</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> <span class="hljs-built_in">input</span>, target <span class="hljs-keyword">in</span> dataloader:
<span class="hljs-meta">... </span>    optimizer.zero_grad()
<span class="hljs-meta">... </span>    ...`,wrap:!1}}),{c(){t=i("p"),t.textContent=m,r=n(),g(a.$$.fragment)},l(e){t=d(e,"P",{"data-svelte-h":!0}),j(t)!=="svelte-11lpom8"&&(t.textContent=m),r=c(e),u(a.$$.fragment,e)},m(e,p){w(e,t,p),w(e,r,p),f(a,e,p),o=!0},p:T,i(e){o||(b(a.$$.fragment,e),o=!0)},o(e){$(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),y(a,e)}}}function Si(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"JTIzJTIwQXNzdW1lJTIwdGhlcmUlMjBhcmUlMjB0d28lMjBwcm9jZXNzZXMlMEFmcm9tJTIwYWNjZWxlcmF0ZSUyMGltcG9ydCUyMEFjY2VsZXJhdG9yJTBBJTBBYWNjZWxlcmF0b3IlMjAlM0QlMjBBY2NlbGVyYXRvcigpJTBBd2l0aCUyMGFjY2VsZXJhdG9yLnNwbGl0X2JldHdlZW5fcHJvY2Vzc2VzKCU1QiUyMkElMjIlMkMlMjAlMjJCJTIyJTJDJTIwJTIyQyUyMiU1RCklMjBhcyUyMGlucHV0cyUzQSUwQSUyMCUyMCUyMCUyMHByaW50KGlucHV0cyklMEElMjMlMjBQcm9jZXNzJTIwMCUwQSU1QiUyMkElMjIlMkMlMjAlMjJCJTIyJTVEJTBBJTIzJTIwUHJvY2VzcyUyMDElMEElNUIlMjJDJTIyJTVEJTBBJTBBd2l0aCUyMGFjY2VsZXJhdG9yLnNwbGl0X2JldHdlZW5fcHJvY2Vzc2VzKCU1QiUyMkElMjIlMkMlMjAlMjJCJTIyJTJDJTIwJTIyQyUyMiU1RCUyQyUyMGFwcGx5X3BhZGRpbmclM0RUcnVlKSUyMGFzJTIwaW5wdXRzJTNBJTBBJTIwJTIwJTIwJTIwcHJpbnQoaW5wdXRzKSUwQSUyMyUyMFByb2Nlc3MlMjAwJTBBJTVCJTIyQSUyMiUyQyUyMCUyMkIlMjIlNUQlMEElMjMlMjBQcm9jZXNzJTIwMSUwQSU1QiUyMkMlMjIlMkMlMjAlMjJDJTIyJTVE",highlighted:`<span class="hljs-comment"># Assume there are two processes</span>
<span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator

accelerator = Accelerator()
<span class="hljs-keyword">with</span> accelerator.split_between_processes([<span class="hljs-string">&quot;A&quot;</span>, <span class="hljs-string">&quot;B&quot;</span>, <span class="hljs-string">&quot;C&quot;</span>]) <span class="hljs-keyword">as</span> inputs:
    <span class="hljs-built_in">print</span>(inputs)
<span class="hljs-comment"># Process 0</span>
[<span class="hljs-string">&quot;A&quot;</span>, <span class="hljs-string">&quot;B&quot;</span>]
<span class="hljs-comment"># Process 1</span>
[<span class="hljs-string">&quot;C&quot;</span>]

<span class="hljs-keyword">with</span> accelerator.split_between_processes([<span class="hljs-string">&quot;A&quot;</span>, <span class="hljs-string">&quot;B&quot;</span>, <span class="hljs-string">&quot;C&quot;</span>], apply_padding=<span class="hljs-literal">True</span>) <span class="hljs-keyword">as</span> inputs:
    <span class="hljs-built_in">print</span>(inputs)
<span class="hljs-comment"># Process 0</span>
[<span class="hljs-string">&quot;A&quot;</span>, <span class="hljs-string">&quot;B&quot;</span>]
<span class="hljs-comment"># Process 1</span>
[<span class="hljs-string">&quot;C&quot;</span>, <span class="hljs-string">&quot;C&quot;</span>]`,wrap:!1}}),{c(){t=i("p"),t.textContent=m,r=n(),g(a.$$.fragment)},l(e){t=d(e,"P",{"data-svelte-h":!0}),j(t)!=="svelte-11lpom8"&&(t.textContent=m),r=c(e),u(a.$$.fragment,e)},m(e,p){w(e,t,p),w(e,r,p),f(a,e,p),o=!0},p:T,i(e){o||(b(a.$$.fragment,e),o=!0)},o(e){$(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),y(a,e)}}}function Hi(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKSUwQWRhdGFsb2FkZXIlMkMlMjBtb2RlbCUyQyUyMG9wdGltaXplciUyMCUzRCUyMGFjY2VsZXJhdG9yLnByZXBhcmUoZGF0YWxvYWRlciUyQyUyMG1vZGVsJTJDJTIwb3B0aW1pemVyKSUwQSUwQXdpdGglMjBhY2NlbGVyYXRvci5ub19zeW5jKCklM0ElMEElMjAlMjAlMjAlMjBsb3NzX2ElMjAlM0QlMjBsb3NzX2Z1bmMobW9kZWwoaW5wdXRfYSkpJTIwJTIwJTIzJTIwZmlyc3QlMjBmb3J3YXJkJTIwcGFzcyUwQSUyMCUyMCUyMCUyMGxvc3NfYiUyMCUzRCUyMGxvc3NfZnVuYyhtb2RlbChpbnB1dF9iKSklMjAlMjAlMjMlMjBzZWNvbmQlMjBmb3J3YXJkJTIwcGFzcyUwQWFjY2VsZXJhdG9yLmJhY2t3YXJkKGxvc3NfYSklMjAlMjAlMjMlMjBObyUyMHN5bmNocm9uaXphdGlvbiUyMGFjcm9zcyUyMHByb2Nlc3NlcyUyQyUyMG9ubHklMjBhY2N1bXVsYXRlJTIwZ3JhZGllbnRzJTBBd2l0aCUyMGFjY2VsZXJhdG9yLnRyaWdnZXJfc3luY19pbl9iYWNrd2FyZChtb2RlbCklM0ElMEElMjAlMjAlMjAlMjBhY2NlbGVyYXRvci5iYWNrd2FyZChsb3NzX2IpJTIwJTIwJTIzJTIwU3luY2hyb25pemF0aW9uJTIwYWNyb3NzJTIwYWxsJTIwcHJvY2Vzc2VzJTBBb3B0aW1pemVyLnN0ZXAoKSUwQW9wdGltaXplci56ZXJvX2dyYWQoKQ==",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()
<span class="hljs-meta">&gt;&gt;&gt; </span>dataloader, model, optimizer = accelerator.prepare(dataloader, model, optimizer)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> accelerator.no_sync():
<span class="hljs-meta">... </span>    loss_a = loss_func(model(input_a))  <span class="hljs-comment"># first forward pass</span>
<span class="hljs-meta">... </span>    loss_b = loss_func(model(input_b))  <span class="hljs-comment"># second forward pass</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>accelerator.backward(loss_a)  <span class="hljs-comment"># No synchronization across processes, only accumulate gradients</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> accelerator.trigger_sync_in_backward(model):
<span class="hljs-meta">... </span>    accelerator.backward(loss_b)  <span class="hljs-comment"># Synchronization across all processes</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>optimizer.step()
<span class="hljs-meta">&gt;&gt;&gt; </span>optimizer.zero_grad()`,wrap:!1}}),{c(){t=i("p"),t.textContent=m,r=n(),g(a.$$.fragment)},l(e){t=d(e,"P",{"data-svelte-h":!0}),j(t)!=="svelte-11lpom8"&&(t.textContent=m),r=c(e),u(a.$$.fragment,e)},m(e,p){w(e,t,p),w(e,r,p),f(a,e,p),o=!0},p:T,i(e){o||(b(a.$$.fragment,e),o=!0)},o(e){$(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),y(a,e)}}}function Li(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKSUwQW1vZGVsJTJDJTIwb3B0aW1pemVyJTIwJTNEJTIwYWNjZWxlcmF0b3IucHJlcGFyZShtb2RlbCUyQyUyMG9wdGltaXplciklMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoaW5wdXRzKSUwQWxvc3MlMjAlM0QlMjBsb3NzX2ZuKG91dHB1dHMlMkMlMjBsYWJlbHMpJTBBYWNjZWxlcmF0b3IuYmFja3dhcmQobG9zcyklMEFhY2NlbGVyYXRvci51bnNjYWxlX2dyYWRpZW50cyhvcHRpbWl6ZXIlM0RvcHRpbWl6ZXIp",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()
<span class="hljs-meta">&gt;&gt;&gt; </span>model, optimizer = accelerator.prepare(model, optimizer)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(inputs)
<span class="hljs-meta">&gt;&gt;&gt; </span>loss = loss_fn(outputs, labels)
<span class="hljs-meta">&gt;&gt;&gt; </span>accelerator.backward(loss)
<span class="hljs-meta">&gt;&gt;&gt; </span>accelerator.unscale_gradients(optimizer=optimizer)`,wrap:!1}}),{c(){t=i("p"),t.textContent=m,r=n(),g(a.$$.fragment)},l(e){t=d(e,"P",{"data-svelte-h":!0}),j(t)!=="svelte-11lpom8"&&(t.textContent=m),r=c(e),u(a.$$.fragment,e)},m(e,p){w(e,t,p),w(e,r,p),f(a,e,p),o=!0},p:T,i(e){o||(b(a.$$.fragment,e),o=!0)},o(e){$(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),y(a,e)}}}function Pi(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"JTIzJTIwQXNzdW1pbmclMjB0d28lMjBHUFUlMjBwcm9jZXNzZXMlMEFmcm9tJTIwdG9yY2gubm4ucGFyYWxsZWwlMjBpbXBvcnQlMjBEaXN0cmlidXRlZERhdGFQYXJhbGxlbCUwQWZyb20lMjBhY2NlbGVyYXRlJTIwaW1wb3J0JTIwQWNjZWxlcmF0b3IlMEElMEFhY2NlbGVyYXRvciUyMCUzRCUyMEFjY2VsZXJhdG9yKCklMEFtb2RlbCUyMCUzRCUyMGFjY2VsZXJhdG9yLnByZXBhcmUoTXlNb2RlbCgpKSUwQXByaW50KG1vZGVsLl9fY2xhc3NfXy5fX25hbWVfXyklMEElMEFtb2RlbCUyMCUzRCUyMGFjY2VsZXJhdG9yLnVud3JhcF9tb2RlbChtb2RlbCklMEFwcmludChtb2RlbC5fX2NsYXNzX18uX19uYW1lX18p",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Assuming two GPU processes</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> torch.nn.parallel <span class="hljs-keyword">import</span> DistributedDataParallel
<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()
<span class="hljs-meta">&gt;&gt;&gt; </span>model = accelerator.prepare(MyModel())
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(model.__class__.__name__)
DistributedDataParallel

<span class="hljs-meta">&gt;&gt;&gt; </span>model = accelerator.unwrap_model(model)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(model.__class__.__name__)
MyModel`,wrap:!1}}),{c(){t=i("p"),t.textContent=m,r=n(),g(a.$$.fragment)},l(e){t=d(e,"P",{"data-svelte-h":!0}),j(t)!=="svelte-11lpom8"&&(t.textContent=m),r=c(e),u(a.$$.fragment,e)},m(e,p){w(e,t,p),w(e,r,p),f(a,e,p),o=!0},p:T,i(e){o||(b(a.$$.fragment,e),o=!0)},o(e){$(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),y(a,e)}}}function Di(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"JTIzJTIwQXNzdW1pbmclMjB0d28lMjBHUFUlMjBwcm9jZXNzZXMlMEFpbXBvcnQlMjB0aW1lJTBBZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKSUwQWlmJTIwYWNjZWxlcmF0b3IuaXNfbWFpbl9wcm9jZXNzJTNBJTBBJTIwJTIwJTIwJTIwdGltZS5zbGVlcCgyKSUwQWVsc2UlM0ElMEElMjAlMjAlMjAlMjBwcmludCglMjJJJ20lMjB3YWl0aW5nJTIwZm9yJTIwdGhlJTIwbWFpbiUyMHByb2Nlc3MlMjB0byUyMGZpbmlzaCUyMGl0cyUyMHNsZWVwLi4uJTIyKSUwQWFjY2VsZXJhdG9yLndhaXRfZm9yX2V2ZXJ5b25lKCklMEElMjMlMjBTaG91bGQlMjBwcmludCUyMG9uJTIwZXZlcnklMjBwcm9jZXNzJTIwYXQlMjB0aGUlMjBzYW1lJTIwdGltZSUwQXByaW50KCUyMkV2ZXJ5b25lJTIwaXMlMjBoZXJlJTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Assuming two GPU processes</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> time
<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()
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">if</span> accelerator.is_main_process:
<span class="hljs-meta">... </span>    time.sleep(<span class="hljs-number">2</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">else</span>:
<span class="hljs-meta">... </span>    <span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;I&#x27;m waiting for the main process to finish its sleep...&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>accelerator.wait_for_everyone()
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Should print on every process at the same time</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(<span class="hljs-string">&quot;Everyone is here&quot;</span>)`,wrap:!1}}),{c(){t=i("p"),t.textContent=m,r=n(),g(a.$$.fragment)},l(e){t=d(e,"P",{"data-svelte-h":!0}),j(t)!=="svelte-11lpom8"&&(t.textContent=m),r=c(e),u(a.$$.fragment,e)},m(e,p){w(e,t,p),w(e,r,p),f(a,e,p),o=!0},p:T,i(e){o||(b(a.$$.fragment,e),o=!0)},o(e){$(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),y(a,e)}}}function Ki(_){let t,m,r,a,o,e,p,bo='The <a href="/docs/accelerate/main/en/package_reference/accelerator#accelerate.Accelerator">Accelerator</a> is the main class for enabling distributed training on any type of training setup. Read the <a href="../basic_tutorials/migration">Add Accelerator to your code</a> tutorial to learn more about how to add the <a href="/docs/accelerate/main/en/package_reference/accelerator#accelerate.Accelerator">Accelerator</a> to your script.',El,ja,Sl,v,wa,ql,_s,$o="Creates an instance of an accelerator for distributed training or mixed precision training.",Ol,vs,yo="<strong>Available attributes:</strong>",er,Js,Mo=`<li><strong>device</strong> (<code>torch.device</code>) — The device to use.</li> <li><strong>distributed_type</strong> (<a href="/docs/accelerate/main/en/package_reference/utilities#accelerate.DistributedType">DistributedType</a>) — The distributed training configuration.</li> <li><strong>local_process_index</strong> (<code>int</code>) — The process index on the current machine.</li> <li><strong>mixed_precision</strong> (<code>str</code>) — The configured mixed precision mode.</li> <li><strong>num_processes</strong> (<code>int</code>) — The total number of processes used for training.</li> <li><strong>optimizer_step_was_skipped</strong> (<code>bool</code>) — Whether or not the optimizer update was skipped (because of
gradient overflow in mixed precision), in which
case the learning rate should not be changed.</li> <li><strong>process_index</strong> (<code>int</code>) — The overall index of the current process among all processes.</li> <li><strong>state</strong> (<a href="/docs/accelerate/main/en/package_reference/state#accelerate.state.AcceleratorState">AcceleratorState</a>) — The distributed setup state.</li> <li><strong>sync_gradients</strong> (<code>bool</code>) — Whether the gradients are currently being synced across all processes.</li> <li><strong>use_distributed</strong> (<code>bool</code>) — Whether the current configuration is for distributed training.</li>`,tr,we,_a,ar,Ts,jo="A context manager that will lightly wrap around and perform gradient accumulation automatically",sr,$t,lr,S,va,rr,Us,wo=`Will apply automatic mixed-precision inside the block inside this context manager, if it is enabled. Nothing
different will happen otherwise.`,nr,xs,_o=`A different <code>autocast_handler</code> can be passed in to override the one set in the <code>Accelerator</code> object. This is
useful in blocks under <code>autocast</code> where you want to revert to fp32.`,cr,yt,or,H,Ja,pr,ks,vo=`Scales the gradients in accordance to the <code>GradientAccumulationPlugin</code> and calls the correct <code>backward()</code> based
on the configuration.`,ir,Gs,Jo="Should be used in lieu of <code>loss.backward()</code>.",dr,Mt,mr,L,Ta,hr,Bs,To=`Checks if the internal trigger tensor has been set to 1 in any of the processes. If so, will return <code>True</code> and
reset the trigger tensor to 0.`,gr,Is,Uo=`Note:
Does not require <code>wait_for_everyone()</code>`,ur,jt,fr,_e,Ua,br,Cs,xo=`Alias for <code>Accelerate.free_memory</code>, releases all references to the internal objects stored and call the
garbage collector. You should call this method between two trainings with different models/optimizers.`,$r,wt,yr,ve,xa,Mr,Zs,ko="Should be used in place of <code>torch.nn.utils.clip_grad_norm_</code>.",jr,_t,wr,Je,ka,_r,Ws,Go="Should be used in place of <code>torch.nn.utils.clip_grad_value_</code>.",vr,vt,Jr,Te,Ga,Tr,Ys,Bo=`Runs any special end training behaviors, such as stopping trackers on the main process only or destoying
process group. Should always be called at the end of your script if using experiment tracking.`,Ur,Jt,xr,Ue,Ba,kr,Xs,Io=`Will release all references to the internal objects stored and call the garbage collector. You should call this
method between two trainings with different models/optimizers. Also will reset <code>Accelerator.step</code> to 0.`,Gr,Tt,Br,P,Ia,Ir,As,Co=`Gather the values in <em>tensor</em> across all processes and concatenate them on the first dimension. Useful to
regroup the predictions from all processes when doing evaluation.`,Cr,Vs,Zo=`Note:
This gather happens in all processes.`,Zr,Ut,Wr,xe,Ca,Yr,Ns,Wo=`Gathers <code>input_data</code> and potentially drops duplicates in the last batch if on a distributed system. Should be
used for gathering the inputs and targets for metric calculation.`,Xr,xt,Ar,ke,Za,Vr,Qs,Yo=`Returns the state dictionary of a model sent through <a href="/docs/accelerate/main/en/package_reference/accelerator#accelerate.Accelerator.prepare">Accelerator.prepare()</a> potentially without full
precision.`,Nr,kt,Qr,Ge,Wa,Fr,Fs,Xo="Returns a <code>tracker</code> from <code>self.trackers</code> based on <code>name</code> on the main process only.",zr,Gt,Rr,A,Ya,Er,zs,Ao=`A context manager that facilitates distributed training or evaluation on uneven inputs, which acts as a wrapper
around <code>torch.distributed.algorithms.join</code>. This is useful when the total batch size does not evenly divide the
length of the dataset.`,Sr,Bt,Hr,It,Lr,Ct,Pr,D,Xa,Dr,Rs,Vo="Loads the current states of the model, optimizer, scaler, RNG generators, and registered objects.",Kr,Zt,qr,Wt,Or,K,Aa,en,Es,No="Lets the local main process go inside a with block.",tn,Ss,Qo="The other processes will enter the with block after the main process exits.",an,Yt,sn,Xt,Va,ln,Hs,Fo="Runs backward pass on LOMO optimizers.",rn,q,Na,nn,Ls,zo="Lets the main process go first inside a with block.",cn,Ps,Ro="The other processes will enter the with block after the main process exits.",on,At,pn,V,Qa,dn,Ds,Eo="A context manager that enables context parallel training.",mn,Vt,hn,Nt,gn,Qt,un,O,Fa,fn,Ks,So=`A context manager to disable gradient synchronizations across DDP processes by calling
<code>torch.nn.parallel.DistributedDataParallel.no_sync</code>.`,bn,qs,Ho="If <code>model</code> is not in DDP, this context manager does nothing",$n,Ft,yn,Be,za,Mn,Os,Lo=`A decorator that will run the decorated function on the last process only. Can also be called using the
<code>PartialState</code> class.`,jn,zt,wn,Ie,Ra,_n,el,Po=`A decorator that will run the decorated function on the local main process only. Can also be called using the
<code>PartialState</code> class.`,vn,Rt,Jn,Ce,Ea,Tn,tl,Do=`A decorator that will run the decorated function on a given local process index only. Can also be called using
the <code>PartialState</code> class.`,Un,Et,xn,Ze,Sa,kn,al,Ko=`A decorator that will run the decorated function on the main process only. Can also be called using the
<code>PartialState</code> class.`,Gn,St,Bn,We,Ha,In,sl,qo=`A decorator that will run the decorated function on a given process index only. Can also be called using the
<code>PartialState</code> class.`,Cn,Ht,Zn,Ye,La,Wn,ll,Oo=`Recursively pad the tensors in a nested list/tuple/dictionary of tensors from all devices to the same size so
they can safely be gathered.`,Yn,Lt,Xn,N,Pa,An,rl,ep=`Prepare all objects passed in <code>args</code> for distributed training and mixed precision, then return them in the same
order.`,Vn,Pt,Nn,Dt,Qn,Kt,Fn,Xe,Da,zn,nl,tp=`Prepares a PyTorch DataLoader for training in any distributed setup. It is recommended to use
<a href="/docs/accelerate/main/en/package_reference/accelerator#accelerate.Accelerator.prepare">Accelerator.prepare()</a> instead.`,Rn,qt,En,Ae,Ka,Sn,cl,ap=`Prepares a PyTorch model for training in any distributed setup. It is recommended to use
<a href="/docs/accelerate/main/en/package_reference/accelerator#accelerate.Accelerator.prepare">Accelerator.prepare()</a> instead.`,Hn,Ot,Ln,Ve,qa,Pn,ol,sp=`Prepares a PyTorch Optimizer for training in any distributed setup. It is recommended to use
<a href="/docs/accelerate/main/en/package_reference/accelerator#accelerate.Accelerator.prepare">Accelerator.prepare()</a> instead.`,Dn,ea,Kn,Ne,Oa,qn,pl,lp=`Prepares a PyTorch Scheduler for training in any distributed setup. It is recommended to use
<a href="/docs/accelerate/main/en/package_reference/accelerator#accelerate.Accelerator.prepare">Accelerator.prepare()</a> instead.`,On,ta,ec,Qe,es,tc,il,rp="Drop in replacement of <code>print()</code> to only print once per server.",ac,aa,sc,ee,ts,lc,dl,np=`Will profile the code inside the context manager. The profile will be saved to a Chrome Trace file if
<code>profile_handler.output_trace_dir</code> is set.`,rc,ml,cp="A different <code>profile_handler</code> can be passed in to override the one set in the <code>Accelerator</code> object.",nc,sa,cc,te,as,oc,hl,op="Reduce the values in <em>tensor</em> across all processes based on <em>reduction</em>.",pc,gl,pp=`Note:
All processes get the reduced value.`,ic,la,dc,Q,ss,mc,ul,ip="Makes note of <code>objects</code> and will save or load them in during <code>save_state</code> or <code>load_state</code>.",hc,fl,dp=`These should be utilized when the state is being loaded or saved in the same script. It is not designed to be
used in different scripts.`,gc,ra,uc,na,fc,I,ls,bc,bl,mp='Registers a pre hook to be run before <code>load_checkpoint</code> is called in <a href="/docs/accelerate/main/en/package_reference/accelerator#accelerate.Accelerator.load_state">Accelerator.load_state()</a>.',$c,$l,hp="The hook should have the following signature:",yc,yl,gp="<code>hook(models: list[torch.nn.Module], input_dir: str) -&gt; None</code>",Mc,Ml,up=`The <code>models</code> argument are the models as saved in the accelerator state under <code>accelerator._models</code>, and the
<code>input_dir</code> argument is the <code>input_dir</code> argument passed to <a href="/docs/accelerate/main/en/package_reference/accelerator#accelerate.Accelerator.load_state">Accelerator.load_state()</a>.`,jc,ca,wc,C,rs,_c,jl,fp='Registers a pre hook to be run before <code>save_checkpoint</code> is called in <a href="/docs/accelerate/main/en/package_reference/accelerator#accelerate.Accelerator.save_state">Accelerator.save_state()</a>.',vc,wl,bp="The hook should have the following signature:",Jc,_l,$p="<code>hook(models: list[torch.nn.Module], weights: list[dict[str, torch.Tensor]], input_dir: str) -&gt; None</code>",Tc,vl,yp=`The <code>models</code> argument are the models as saved in the accelerator state under <code>accelerator._models</code>, <code>weigths</code>
argument are the state dicts of the <code>models</code>, and the <code>input_dir</code> argument is the <code>input_dir</code> argument passed
to <a href="/docs/accelerate/main/en/package_reference/accelerator#accelerate.Accelerator.load_state">Accelerator.load_state()</a>.`,Uc,oa,xc,ae,ns,kc,Jl,Mp="Save the object passed to disk once per machine. Use in place of <code>torch.save</code>.",Gc,Tl,jp=`Note:
If <code>save_on_each_node</code> was passed in as a <code>ProjectConfiguration</code>, will save the object once per node,
rather than only once on the main node.`,Bc,pa,Ic,Fe,cs,Cc,Ul,wp="Save a model so that it can be re-loaded using load_checkpoint_in_model",Zc,ia,Wc,Z,os,Yc,xl,_p="Saves the current states of the model, optimizer, scaler, RNG generators, and registered objects to a folder.",Xc,kl,vp=`If a <code>ProjectConfiguration</code> was passed to the <code>Accelerator</code> object with <code>automatic_checkpoint_naming</code> enabled
then checkpoints will be saved to <code>self.project_dir/checkpoints</code>. If the number of current saves is greater
than <code>total_limit</code> then the oldest save is deleted. Each checkpoint is saved in separate folders named
<code>checkpoint_&lt;iteration&gt;</code>.`,Ac,Gl,Jp="Otherwise they are just saved to <code>output_dir</code>.",Vc,da,Nc,ma,Qc,se,ps,Fc,Bl,Tp=`Sets the internal trigger tensor to 1 on the current process. A latter check should follow using this which
will check across all processes.`,zc,Il,Up=`Note:
Does not require <code>wait_for_everyone()</code>`,Rc,ha,Ec,ze,is,Sc,Cl,xp="Creates a new <code>torch.utils.data.DataLoader</code> that will efficiently skip the first <code>num_batches</code>.",Hc,ga,Lc,le,ds,Pc,Zl,kp=`Splits <code>input</code> between <code>self.num_processes</code> quickly and can be then used on that process. Useful when doing
distributed inference, such as with different prompts.`,Dc,Wl,Gp="Note that when using a <code>dict</code>, all keys need to have the same number of elements.",Kc,ua,qc,re,ms,Oc,Yl,Bp=`Trigger the sync of the gradients in the next backward pass of the model after multiple forward passes under
<code>Accelerator.no_sync</code> (only applicable in multi-GPU scenarios).`,eo,Xl,Ip="If the script is not launched in distributed mode, this context manager does nothing.",to,fa,ao,ne,hs,so,Al,Cp="Unscale the gradients in mixed precision training with AMP. This is a noop in all other settings.",lo,Vl,Zp='Likely should be called through <a href="/docs/accelerate/main/en/package_reference/accelerator#accelerate.Accelerator.clip_grad_norm_">Accelerator.clip<em>grad_norm</em>()</a> or <a href="/docs/accelerate/main/en/package_reference/accelerator#accelerate.Accelerator.clip_grad_value_">Accelerator.clip<em>grad_value</em>()</a>',ro,ba,no,Re,gs,co,Nl,Wp=`Unwraps the <code>model</code> from the additional layer possible added by <a href="/docs/accelerate/main/en/package_reference/accelerator#accelerate.Accelerator.prepare">prepare()</a>. Useful before saving
the model.`,oo,$a,po,ya,us,io,Ql,Yp="Verifies that <code>model</code> has not been prepared with big model inference with a device-map resembling <code>auto</code>.",mo,Ee,fs,ho,Fl,Xp=`Will stop the execution of the current process until every other process has reached that point (so this does
nothing when the script is only run in one process). Useful to do before saving a model.`,go,Ma,Hl,bs,Ll,He,$s,uo,zl,Ap="Recursively gather object in a nested list/tuple/dictionary of objects from all devices.",Pl,ys,Dl,Rl,Kl;return o=new fo({props:{title:"Accelerator",local:"accelerator",headingTag:"h1"}}),ja=new fo({props:{title:"Accelerator",local:"api ][ accelerate.Accelerator",headingTag:"h2"}}),wa=new k({props:{name:"class accelerate.Accelerator",anchor:"accelerate.Accelerator",parameters:[{name:"device_placement",val:": bool = True"},{name:"split_batches",val:": bool = <object object at 0x7fed33305dc0>"},{name:"mixed_precision",val:": PrecisionType | str | None = None"},{name:"gradient_accumulation_steps",val:": int = 1"},{name:"cpu",val:": bool = False"},{name:"dataloader_config",val:": DataLoaderConfiguration | None = None"},{name:"deepspeed_plugin",val:": DeepSpeedPlugin | dict[str, DeepSpeedPlugin] | None = None"},{name:"fsdp_plugin",val:": FullyShardedDataParallelPlugin | None = None"},{name:"torch_tp_plugin",val:": TorchTensorParallelPlugin | None = None"},{name:"megatron_lm_plugin",val:": MegatronLMPlugin | None = None"},{name:"rng_types",val:": list[str | RNGType] | None = None"},{name:"log_with",val:": str | LoggerType | GeneralTracker | list[str | LoggerType | GeneralTracker] | None = None"},{name:"project_dir",val:": str | os.PathLike | None = None"},{name:"project_config",val:": ProjectConfiguration | None = None"},{name:"gradient_accumulation_plugin",val:": GradientAccumulationPlugin | None = None"},{name:"step_scheduler_with_optimizer",val:": bool = True"},{name:"kwargs_handlers",val:": list[KwargsHandler] | None = None"},{name:"dynamo_backend",val:": DynamoBackend | str | None = None"},{name:"dynamo_plugin",val:": TorchDynamoPlugin | None = None"},{name:"deepspeed_plugins",val:": DeepSpeedPlugin | dict[str, DeepSpeedPlugin] | None = None"},{name:"parallelism_config",val:": ParallelismConfig | None = None"}],parametersDescription:[{anchor:"accelerate.Accelerator.device_placement",description:`<strong>device_placement</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not the accelerator should put objects on device (tensors yielded by the dataloader, model,
etc&#x2026;).`,name:"device_placement"},{anchor:"accelerate.Accelerator.mixed_precision",description:`<strong>mixed_precision</strong> (<code>str</code>, <em>optional</em>) &#x2014;
Whether or not to use mixed precision training. Choose from &#x2018;no&#x2019;,&#x2018;fp16&#x2019;,&#x2018;bf16&#x2019; or &#x2018;fp8&#x2019;. Will default to
the value in the environment variable <code>ACCELERATE_MIXED_PRECISION</code>, which will use the default value in the
accelerate config of the current system or the flag passed with the <code>accelerate.launch</code> command. &#x2018;fp8&#x2019;
requires the installation of transformers-engine.`,name:"mixed_precision"},{anchor:"accelerate.Accelerator.gradient_accumulation_steps",description:`<strong>gradient_accumulation_steps</strong> (<code>int</code>, <em>optional</em>, default to 1) &#x2014;
The number of steps that should pass before gradients are accumulated. A number &gt; 1 should be combined with
<code>Accelerator.accumulate</code>. If not passed, will default to the value in the environment variable
<code>ACCELERATE_GRADIENT_ACCUMULATION_STEPS</code>. Can also be configured through a <code>GradientAccumulationPlugin</code>.`,name:"gradient_accumulation_steps"},{anchor:"accelerate.Accelerator.cpu",description:`<strong>cpu</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to force the script to execute on CPU. Will ignore GPU available if set to <code>True</code> and force
the execution on one process only.`,name:"cpu"},{anchor:"accelerate.Accelerator.dataloader_config",description:`<strong>dataloader_config</strong> (<code>DataLoaderConfiguration</code>, <em>optional</em>) &#x2014;
A configuration for how the dataloaders should be handled in distributed scenarios.`,name:"dataloader_config"},{anchor:"accelerate.Accelerator.deepspeed_plugin",description:`<strong>deepspeed_plugin</strong> (<a href="/docs/accelerate/main/en/package_reference/utilities#accelerate.DeepSpeedPlugin">DeepSpeedPlugin</a> or dict of <code>str</code> &#x2014; <a href="/docs/accelerate/main/en/package_reference/utilities#accelerate.DeepSpeedPlugin">DeepSpeedPlugin</a>, <em>optional</em>):
Tweak your DeepSpeed related args using this argument. This argument is optional and can be configured
directly using <em>accelerate config</em>. If using multiple plugins, use the configured <code>key</code> property of each
plugin to access them from <code>accelerator.state.get_deepspeed_plugin(key)</code>. Alias for <code>deepspeed_plugins</code>.`,name:"deepspeed_plugin"},{anchor:"accelerate.Accelerator.fsdp_plugin",description:`<strong>fsdp_plugin</strong> (<a href="/docs/accelerate/main/en/package_reference/utilities#accelerate.FullyShardedDataParallelPlugin">FullyShardedDataParallelPlugin</a>, <em>optional</em>) &#x2014;
Tweak your FSDP related args using this argument. This argument is optional and can be configured directly
using <em>accelerate config</em>`,name:"fsdp_plugin"},{anchor:"accelerate.Accelerator.torch_tp_plugin",description:`<strong>torch_tp_plugin</strong> (<code>TorchTensorParallelPlugin</code>, <em>optional</em>) &#x2014;
Deprecated: use <code>parallelism_config</code> with <code>tp_size</code> instead.`,name:"torch_tp_plugin"},{anchor:"accelerate.Accelerator.megatron_lm_plugin",description:`<strong>megatron_lm_plugin</strong> (<a href="/docs/accelerate/main/en/package_reference/megatron_lm#accelerate.utils.MegatronLMPlugin">MegatronLMPlugin</a>, <em>optional</em>) &#x2014;
Tweak your MegatronLM related args using this argument. This argument is optional and can be configured
directly using <em>accelerate config</em>`,name:"megatron_lm_plugin"},{anchor:"accelerate.Accelerator.rng_types",description:`<strong>rng_types</strong> (list of <code>str</code> or <a href="/docs/accelerate/main/en/package_reference/utilities#accelerate.utils.RNGType">RNGType</a>) &#x2014;
The list of random number generators to synchronize at the beginning of each iteration in your prepared
dataloaders. Should be one or several of:</p>
<ul>
<li><code>&quot;torch&quot;</code>: the base torch random number generator</li>
<li><code>&quot;cuda&quot;</code>: the CUDA random number generator (GPU only)</li>
<li><code>&quot;xla&quot;</code>: the XLA random number generator (TPU only)</li>
<li><code>&quot;generator&quot;</code>: the <code>torch.Generator</code> of the sampler (or batch sampler if there is no sampler in your
dataloader) or of the iterable dataset (if it exists) if the underlying dataset is of that type.</li>
</ul>
<p>Will default to <code>[&quot;torch&quot;]</code> for PyTorch versions &lt;=1.5.1 and <code>[&quot;generator&quot;]</code> for PyTorch versions &gt;= 1.6.`,name:"rng_types"},{anchor:"accelerate.Accelerator.log_with",description:`<strong>log_with</strong> (list of <code>str</code>, <a href="/docs/accelerate/main/en/package_reference/utilities#accelerate.utils.LoggerType">LoggerType</a> or <a href="/docs/accelerate/main/en/package_reference/tracking#accelerate.tracking.GeneralTracker">GeneralTracker</a>, <em>optional</em>) &#x2014;
A list of loggers to be setup for experiment tracking. Should be one or several of:</p>
<ul>
<li><code>&quot;all&quot;</code></li>
<li><code>&quot;tensorboard&quot;</code></li>
<li><code>&quot;wandb&quot;</code></li>
<li><code>&quot;trackio&quot;</code></li>
<li><code>&quot;aim&quot;</code></li>
<li><code>&quot;comet_ml&quot;</code></li>
<li><code>&quot;mlflow&quot;</code></li>
<li><code>&quot;dvclive&quot;</code></li>
<li><code>&quot;swanlab&quot;</code>
If <code>&quot;all&quot;</code> is selected, will pick up all available trackers in the environment and initialize them. Can
also accept implementations of <code>GeneralTracker</code> for custom trackers, and can be combined with <code>&quot;all&quot;</code>.</li>
</ul>`,name:"log_with"},{anchor:"accelerate.Accelerator.project_config",description:`<strong>project_config</strong> (<a href="/docs/accelerate/main/en/package_reference/utilities#accelerate.utils.ProjectConfiguration">ProjectConfiguration</a>, <em>optional</em>) &#x2014;
A configuration for how saving the state can be handled.`,name:"project_config"},{anchor:"accelerate.Accelerator.project_dir",description:`<strong>project_dir</strong> (<code>str</code>, <code>os.PathLike</code>, <em>optional</em>) &#x2014;
A path to a directory for storing data such as logs of locally-compatible loggers and potentially saved
checkpoints.`,name:"project_dir"},{anchor:"accelerate.Accelerator.step_scheduler_with_optimizer",description:`<strong>step_scheduler_with_optimizer</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Set <code>True</code> if the learning rate scheduler is stepped at the same time as the optimizer, <code>False</code> if only
done under certain circumstances (at the end of each epoch, for instance).`,name:"step_scheduler_with_optimizer"},{anchor:"accelerate.Accelerator.kwargs_handlers",description:`<strong>kwargs_handlers</strong> (list of <a href="/docs/accelerate/main/en/package_reference/kwargs#accelerate.utils.KwargsHandler">KwargsHandler</a>, <em>optional</em>) &#x2014;
A list of <a href="/docs/accelerate/main/en/package_reference/kwargs#accelerate.utils.KwargsHandler">KwargsHandler</a> to customize how the objects related to distributed training, profiling
or mixed precision are created. See <a href="kwargs">kwargs</a> for more information.`,name:"kwargs_handlers"},{anchor:"accelerate.Accelerator.dynamo_backend",description:`<strong>dynamo_backend</strong> (<code>str</code> or <a href="/docs/accelerate/main/en/package_reference/utilities#accelerate.utils.DynamoBackend">DynamoBackend</a>, <em>optional</em>, defaults to <code>&quot;no&quot;</code>) &#x2014;
Set to one of the possible dynamo backends to optimize your training with torch dynamo.`,name:"dynamo_backend"},{anchor:"accelerate.Accelerator.dynamo_plugin",description:`<strong>dynamo_plugin</strong> (<a href="/docs/accelerate/main/en/package_reference/utilities#accelerate.utils.TorchDynamoPlugin">TorchDynamoPlugin</a>, <em>optional</em>) &#x2014;
A configuration for how torch dynamo should be handled, if more tweaking than just the <code>backend</code> or <code>mode</code>
is needed.`,name:"dynamo_plugin"},{anchor:"accelerate.Accelerator.gradient_accumulation_plugin",description:`<strong>gradient_accumulation_plugin</strong> (<a href="/docs/accelerate/main/en/package_reference/utilities#accelerate.utils.GradientAccumulationPlugin">GradientAccumulationPlugin</a>, <em>optional</em>) &#x2014;
A configuration for how gradient accumulation should be handled, if more tweaking than just the
<code>gradient_accumulation_steps</code> is needed.`,name:"gradient_accumulation_plugin"}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L184"}}),_a=new k({props:{name:"accumulate",anchor:"accelerate.Accelerator.accumulate",parameters:[{name:"*models",val:""}],parametersDescription:[{anchor:"accelerate.Accelerator.accumulate.*models",description:`<strong>*models</strong> (list of <code>torch.nn.Module</code>) &#x2014;
PyTorch Modules that were prepared with <code>Accelerator.prepare</code>. Models passed to <code>accumulate()</code> will
skip gradient syncing during backward pass in distributed training`,name:"*models"}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L1249"}}),$t=new G({props:{anchor:"accelerate.Accelerator.accumulate.example",$$slots:{default:[Dp]},$$scope:{ctx:_}}}),va=new k({props:{name:"autocast",anchor:"accelerate.Accelerator.autocast",parameters:[{name:"autocast_handler",val:": AutocastKwargs = None"}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L4045"}}),yt=new G({props:{anchor:"accelerate.Accelerator.autocast.example",$$slots:{default:[Kp]},$$scope:{ctx:_}}}),Ja=new k({props:{name:"backward",anchor:"accelerate.Accelerator.backward",parameters:[{name:"loss",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L2702"}}),Mt=new G({props:{anchor:"accelerate.Accelerator.backward.example",$$slots:{default:[qp]},$$scope:{ctx:_}}}),Ta=new k({props:{name:"check_trigger",anchor:"accelerate.Accelerator.check_trigger",parameters:[],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L2762"}}),jt=new G({props:{anchor:"accelerate.Accelerator.check_trigger.example",$$slots:{default:[Op]},$$scope:{ctx:_}}}),Ua=new k({props:{name:"clear",anchor:"accelerate.Accelerator.clear",parameters:[{name:"*objects",val:""}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L3808"}}),wt=new G({props:{anchor:"accelerate.Accelerator.clear.example",$$slots:{default:[ei]},$$scope:{ctx:_}}}),xa=new k({props:{name:"clip_grad_norm_",anchor:"accelerate.Accelerator.clip_grad_norm_",parameters:[{name:"parameters",val:""},{name:"max_norm",val:""},{name:"norm_type",val:" = 2"}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L2830",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>Total norm of the parameter gradients (viewed as a single vector).</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>torch.Tensor</code></p>
`}}),_t=new G({props:{anchor:"accelerate.Accelerator.clip_grad_norm_.example",$$slots:{default:[ti]},$$scope:{ctx:_}}}),ka=new k({props:{name:"clip_grad_value_",anchor:"accelerate.Accelerator.clip_grad_value_",parameters:[{name:"parameters",val:""},{name:"clip_value",val:""}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L2893"}}),vt=new G({props:{anchor:"accelerate.Accelerator.clip_grad_value_.example",$$slots:{default:[ai]},$$scope:{ctx:_}}}),Ga=new k({props:{name:"end_training",anchor:"accelerate.Accelerator.end_training",parameters:[],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L3267"}}),Jt=new G({props:{anchor:"accelerate.Accelerator.end_training.example",$$slots:{default:[si]},$$scope:{ctx:_}}}),Ba=new k({props:{name:"free_memory",anchor:"accelerate.Accelerator.free_memory",parameters:[{name:"*objects",val:""}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L3779"}}),Tt=new G({props:{anchor:"accelerate.Accelerator.free_memory.example",$$slots:{default:[li]},$$scope:{ctx:_}}}),Ia=new k({props:{name:"gather",anchor:"accelerate.Accelerator.gather",parameters:[{name:"tensor",val:""}],parametersDescription:[{anchor:"accelerate.Accelerator.gather.tensor",description:`<strong>tensor</strong> (<code>torch.Tensor</code>, or a nested tuple/list/dictionary of <code>torch.Tensor</code>) &#x2014;
The tensors to gather across all processes.`,name:"tensor"}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L2920",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The gathered tensor(s). Note that the
first dimension of the result is <em>num_processes</em> multiplied by the first dimension of the input tensors.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>torch.Tensor</code>, or a nested tuple/list/dictionary of <code>torch.Tensor</code></p>
`}}),Ut=new G({props:{anchor:"accelerate.Accelerator.gather.example",$$slots:{default:[ri]},$$scope:{ctx:_}}}),Ca=new k({props:{name:"gather_for_metrics",anchor:"accelerate.Accelerator.gather_for_metrics",parameters:[{name:"input_data",val:""},{name:"use_gather_object",val:" = False"}],parametersDescription:[{anchor:"accelerate.Accelerator.gather_for_metrics.input",description:`<strong>input</strong> (<code>torch.Tensor</code>, <code>object</code>, a nested tuple/list/dictionary of <code>torch.Tensor</code>, or a nested tuple/list/dictionary of <code>object</code>) &#x2014;
The tensors or objects for calculating metrics across all processes`,name:"input"},{anchor:"accelerate.Accelerator.gather_for_metrics.use_gather_object(bool)",description:`<strong>use_gather_object(<code>bool</code>)</strong> &#x2014;
Whether to forcibly use gather_object instead of gather (which is already done if all objects passed do
not contain tensors). This flag can be useful for gathering tensors with different sizes that we don&#x2019;t
want to pad and concatenate along the first dimension. Using it with GPU tensors is not well supported
and inefficient as it incurs GPU -&gt; CPU transfer since tensors would be pickled.`,name:"use_gather_object(bool)"}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L2952"}}),xt=new G({props:{anchor:"accelerate.Accelerator.gather_for_metrics.example",$$slots:{default:[ni]},$$scope:{ctx:_}}}),Za=new k({props:{name:"get_state_dict",anchor:"accelerate.Accelerator.get_state_dict",parameters:[{name:"model",val:""},{name:"unwrap",val:" = True"}],parametersDescription:[{anchor:"accelerate.Accelerator.get_state_dict.model",description:`<strong>model</strong> (<code>torch.nn.Module</code>) &#x2014;
A PyTorch model sent through <a href="/docs/accelerate/main/en/package_reference/accelerator#accelerate.Accelerator.prepare">Accelerator.prepare()</a>`,name:"model"},{anchor:"accelerate.Accelerator.get_state_dict.unwrap",description:`<strong>unwrap</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to return the original underlying state_dict of <code>model</code> or to return the wrapped state_dict`,name:"unwrap"}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L3875",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The state dictionary of the model potentially without full precision.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>dict</code></p>
`}}),kt=new G({props:{anchor:"accelerate.Accelerator.get_state_dict.example",$$slots:{default:[ci]},$$scope:{ctx:_}}}),Wa=new k({props:{name:"get_tracker",anchor:"accelerate.Accelerator.get_tracker",parameters:[{name:"name",val:": str"},{name:"unwrap",val:": bool = False"}],parametersDescription:[{anchor:"accelerate.Accelerator.get_tracker.name",description:`<strong>name</strong> (<code>str</code>) &#x2014;
The name of a tracker, corresponding to the <code>.name</code> property.`,name:"name"},{anchor:"accelerate.Accelerator.get_tracker.unwrap",description:`<strong>unwrap</strong> (<code>bool</code>) &#x2014;
Whether to return the internal tracking mechanism or to return the wrapped tracker instead
(recommended).`,name:"unwrap"}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L3205",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The tracker corresponding to <code>name</code> if it exists.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>GeneralTracker</code></p>
`}}),Gt=new G({props:{anchor:"accelerate.Accelerator.get_tracker.example",$$slots:{default:[oi]},$$scope:{ctx:_}}}),Ya=new k({props:{name:"join_uneven_inputs",anchor:"accelerate.Accelerator.join_uneven_inputs",parameters:[{name:"joinables",val:""},{name:"even_batches",val:" = None"}],parametersDescription:[{anchor:"accelerate.Accelerator.join_uneven_inputs.joinables",description:`<strong>joinables</strong> (<code>list[torch.distributed.algorithms.Joinable]</code>) &#x2014;
A list of models or optimizers that subclass <code>torch.distributed.algorithms.Joinable</code>. Most commonly, a
PyTorch Module that was prepared with <code>Accelerator.prepare</code> for DistributedDataParallel training.`,name:"joinables"},{anchor:"accelerate.Accelerator.join_uneven_inputs.even_batches",description:`<strong>even_batches</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set, this will override the value of <code>even_batches</code> set in the <code>Accelerator</code>. If it is not provided,
the default <code>Accelerator</code> value wil be used.`,name:"even_batches"}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L1294"}}),Bt=new Se({props:{warning:!0,$$slots:{default:[pi]},$$scope:{ctx:_}}}),It=new Se({props:{warning:!0,$$slots:{default:[ii]},$$scope:{ctx:_}}}),Ct=new G({props:{anchor:"accelerate.Accelerator.join_uneven_inputs.example",$$slots:{default:[di]},$$scope:{ctx:_}}}),Xa=new k({props:{name:"load_state",anchor:"accelerate.Accelerator.load_state",parameters:[{name:"input_dir",val:": str = None"},{name:"load_kwargs",val:": dict | None = None"},{name:"**load_model_func_kwargs",val:""}],parametersDescription:[{anchor:"accelerate.Accelerator.load_state.input_dir",description:`<strong>input_dir</strong> (<code>str</code> or <code>os.PathLike</code>) &#x2014;
The name of the folder all relevant weights and states were saved in. Can be <code>None</code> if
<code>automatic_checkpoint_naming</code> is used, and will pick up from the latest checkpoint.`,name:"input_dir"},{anchor:"accelerate.Accelerator.load_state.load_kwargs",description:`<strong>load_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Additional keyword arguments for the underlying <code>load</code> function, such as optional arguments for
state_dict and optimizer on.`,name:"load_kwargs"},{anchor:"accelerate.Accelerator.load_state.load_model_func_kwargs",description:`<strong>load_model_func_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Additional keyword arguments for loading model which can be passed to the underlying load function,
such as optional arguments for DeepSpeed&#x2019;s <code>load_checkpoint</code> function or a <code>map_location</code> to load the
model and optimizer on.`,name:"load_model_func_kwargs"}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L3627"}}),Zt=new Se({props:{$$slots:{default:[mi]},$$scope:{ctx:_}}}),Wt=new G({props:{anchor:"accelerate.Accelerator.load_state.example",$$slots:{default:[hi]},$$scope:{ctx:_}}}),Aa=new k({props:{name:"local_main_process_first",anchor:"accelerate.Accelerator.local_main_process_first",parameters:[],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L1111"}}),Yt=new G({props:{anchor:"accelerate.Accelerator.local_main_process_first.example",$$slots:{default:[gi]},$$scope:{ctx:_}}}),Va=new k({props:{name:"lomo_backward",anchor:"accelerate.Accelerator.lomo_backward",parameters:[{name:"loss",val:": torch.Tensor"},{name:"learning_rate",val:": float"}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L4190"}}),Na=new k({props:{name:"main_process_first",anchor:"accelerate.Accelerator.main_process_first",parameters:[],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L1089"}}),At=new G({props:{anchor:"accelerate.Accelerator.main_process_first.example",$$slots:{default:[ui]},$$scope:{ctx:_}}}),Qa=new k({props:{name:"maybe_context_parallel",anchor:"accelerate.Accelerator.maybe_context_parallel",parameters:[{name:"buffers",val:": list[torch.Tensor] | None = None"},{name:"buffer_seq_dims",val:": list[int] | None = None"},{name:"no_restore_buffers",val:": set[torch.Tensor] | None = None"}],parametersDescription:[{anchor:"accelerate.Accelerator.maybe_context_parallel.buffers",description:`<strong>buffers</strong> (<code>list[torch.Tensor]</code>, <code>optional</code>) &#x2014;
Buffers, which are going to be sharded along the sequence dimension. Common examples are inputs, labels
or positional embedding buffers. This context manager will modify these buffers in-place, and after
exiting the context, the buffers will be restored to their original state. To avoid unnecessary
restores, you can use <code>no_restore_buffers</code> to specify which buffers don&#x2019;t need to be restored.`,name:"buffers"},{anchor:"accelerate.Accelerator.maybe_context_parallel.buffer_seq_dims",description:`<strong>buffer_seq_dims</strong> (<code>list[int]</code>, <code>optional</code>) &#x2014;
Sequence dimensions of <code>buffers</code>.`,name:"buffer_seq_dims"},{anchor:"accelerate.Accelerator.maybe_context_parallel.no_restore_buffers",description:`<strong>no_restore_buffers</strong> (<code>set[torch.Tensor]</code>, <code>optional</code>) &#x2014;
This set must be a subset of <code>buffers</code>. Specifies which buffers from <code>buffers</code> argument won&#x2019;t be
restored after the context exits. These buffers will be then kept in sharded state.`,name:"no_restore_buffers"}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L3982"}}),Vt=new Se({props:{warning:!0,$$slots:{default:[fi]},$$scope:{ctx:_}}}),Nt=new Se({props:{warning:!0,$$slots:{default:[bi]},$$scope:{ctx:_}}}),Qt=new G({props:{anchor:"accelerate.Accelerator.maybe_context_parallel.example",$$slots:{default:[$i]},$$scope:{ctx:_}}}),Fa=new k({props:{name:"no_sync",anchor:"accelerate.Accelerator.no_sync",parameters:[{name:"model",val:""}],parametersDescription:[{anchor:"accelerate.Accelerator.no_sync.model",description:`<strong>model</strong> (<code>torch.nn.Module</code>) &#x2014;
PyTorch Module that was prepared with <code>Accelerator.prepare</code>`,name:"model"}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L1133"}}),Ft=new G({props:{anchor:"accelerate.Accelerator.no_sync.example",$$slots:{default:[yi]},$$scope:{ctx:_}}}),za=new k({props:{name:"on_last_process",anchor:"accelerate.Accelerator.on_last_process",parameters:[{name:"function",val:": Callable[..., Any]"}],parametersDescription:[{anchor:"accelerate.Accelerator.on_last_process.function",description:"<strong>function</strong> (<code>Callable</code>) &#x2014; The function to decorate.",name:"function"}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L957"}}),zt=new G({props:{anchor:"accelerate.Accelerator.on_last_process.example",$$slots:{default:[Mi]},$$scope:{ctx:_}}}),Ra=new k({props:{name:"on_local_main_process",anchor:"accelerate.Accelerator.on_local_main_process",parameters:[{name:"function",val:": Callable[..., Any] = None"}],parametersDescription:[{anchor:"accelerate.Accelerator.on_local_main_process.function",description:"<strong>function</strong> (<code>Callable</code>) &#x2014; The function to decorate.",name:"function"}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L915"}}),Rt=new G({props:{anchor:"accelerate.Accelerator.on_local_main_process.example",$$slots:{default:[ji]},$$scope:{ctx:_}}}),Ea=new k({props:{name:"on_local_process",anchor:"accelerate.Accelerator.on_local_process",parameters:[{name:"function",val:": Callable[..., Any] = None"},{name:"local_process_index",val:": int = None"}],parametersDescription:[{anchor:"accelerate.Accelerator.on_local_process.function",description:`<strong>function</strong> (<code>Callable</code>, <em>optional</em>) &#x2014;
The function to decorate.`,name:"function"},{anchor:"accelerate.Accelerator.on_local_process.local_process_index",description:`<strong>local_process_index</strong> (<code>int</code>, <em>optional</em>) &#x2014;
The index of the local process on which to run the function.`,name:"local_process_index"}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L1041"}}),Et=new G({props:{anchor:"accelerate.Accelerator.on_local_process.example",$$slots:{default:[wi]},$$scope:{ctx:_}}}),Sa=new k({props:{name:"on_main_process",anchor:"accelerate.Accelerator.on_main_process",parameters:[{name:"function",val:": Callable[..., Any] = None"}],parametersDescription:[{anchor:"accelerate.Accelerator.on_main_process.function",description:"<strong>function</strong> (<code>Callable</code>) &#x2014; The function to decorate.",name:"function"}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L876"}}),St=new G({props:{anchor:"accelerate.Accelerator.on_main_process.example",$$slots:{default:[_i]},$$scope:{ctx:_}}}),Ha=new k({props:{name:"on_process",anchor:"accelerate.Accelerator.on_process",parameters:[{name:"function",val:": Callable[..., Any] = None"},{name:"process_index",val:": int = None"}],parametersDescription:[{anchor:"accelerate.Accelerator.on_process.function",description:`<strong>function</strong> (<code>Callable</code>, <code>optional</code>) &#x2014;
The function to decorate.`,name:"function"},{anchor:"accelerate.Accelerator.on_process.process_index",description:`<strong>process_index</strong> (<code>int</code>, <code>optional</code>) &#x2014;
The index of the process on which to run the function.`,name:"process_index"}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L996"}}),Ht=new G({props:{anchor:"accelerate.Accelerator.on_process.example",$$slots:{default:[vi]},$$scope:{ctx:_}}}),La=new k({props:{name:"pad_across_processes",anchor:"accelerate.Accelerator.pad_across_processes",parameters:[{name:"tensor",val:""},{name:"dim",val:" = 0"},{name:"pad_index",val:" = 0"},{name:"pad_first",val:" = False"}],parametersDescription:[{anchor:"accelerate.Accelerator.pad_across_processes.tensor",description:`<strong>tensor</strong> (nested list/tuple/dictionary of <code>torch.Tensor</code>) &#x2014;
The data to gather.`,name:"tensor"},{anchor:"accelerate.Accelerator.pad_across_processes.dim",description:`<strong>dim</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
The dimension on which to pad.`,name:"dim"},{anchor:"accelerate.Accelerator.pad_across_processes.pad_index",description:`<strong>pad_index</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
The value with which to pad.`,name:"pad_index"},{anchor:"accelerate.Accelerator.pad_across_processes.pad_first",description:`<strong>pad_first</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to pad at the beginning or the end.`,name:"pad_first"}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L3061",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The padded tensor(s).</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>torch.Tensor</code>, or a nested tuple/list/dictionary of <code>torch.Tensor</code></p>
`}}),Lt=new G({props:{anchor:"accelerate.Accelerator.pad_across_processes.example",$$slots:{default:[Ji]},$$scope:{ctx:_}}}),Pa=new k({props:{name:"prepare",anchor:"accelerate.Accelerator.prepare",parameters:[{name:"*args",val:""},{name:"device_placement",val:" = None"}],parametersDescription:[{anchor:"accelerate.Accelerator.prepare.*args",description:`<strong>*args</strong> (list of objects) &#x2014;
Any of the following type of objects:</p>
<ul>
<li><code>torch.utils.data.DataLoader</code>: PyTorch Dataloader</li>
<li><code>torch.nn.Module</code>: PyTorch Module</li>
<li><code>torch.optim.Optimizer</code>: PyTorch Optimizer</li>
<li><code>torch.optim.lr_scheduler.LRScheduler</code>: PyTorch LR Scheduler</li>
</ul>`,name:"*args"},{anchor:"accelerate.Accelerator.prepare.device_placement",description:`<strong>device_placement</strong> (<code>list[bool]</code>, <em>optional</em>) &#x2014;
Used to customize whether automatic device placement should be performed for each object passed. Needs
to be a list of the same length as <code>args</code>. Not compatible with DeepSpeed or FSDP.`,name:"device_placement"}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L1409"}}),Pt=new Se({props:{$$slots:{default:[Ti]},$$scope:{ctx:_}}}),Dt=new G({props:{anchor:"accelerate.Accelerator.prepare.example",$$slots:{default:[Ui]},$$scope:{ctx:_}}}),Kt=new G({props:{anchor:"accelerate.Accelerator.prepare.example-2",$$slots:{default:[xi]},$$scope:{ctx:_}}}),Da=new k({props:{name:"prepare_data_loader",anchor:"accelerate.Accelerator.prepare_data_loader",parameters:[{name:"data_loader",val:": torch.utils.data.DataLoader"},{name:"device_placement",val:" = None"},{name:"slice_fn_for_dispatch",val:" = None"}],parametersDescription:[{anchor:"accelerate.Accelerator.prepare_data_loader.data_loader",description:`<strong>data_loader</strong> (<code>torch.utils.data.DataLoader</code>) &#x2014;
A vanilla PyTorch DataLoader to prepare`,name:"data_loader"},{anchor:"accelerate.Accelerator.prepare_data_loader.device_placement",description:`<strong>device_placement</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to place the batches on the proper device in the prepared dataloader. Will default to
<code>self.device_placement</code>.`,name:"device_placement"},{anchor:"accelerate.Accelerator.prepare_data_loader.slice_fn_for_dispatch",description:"<strong>slice_fn_for_dispatch</strong> (<code>Callable</code>, <em>optional</em><code>) -- If passed, this function will be used to slice tensors across </code>num_processes<code>. Will default to [slice_tensors()](/docs/accelerate/main/en/package_reference/utilities#accelerate.utils.slice_tensors). This argument is used only when </code>dispatch_batches<code>is set to</code>True` and will\nbe ignored otherwise.",name:"slice_fn_for_dispatch"}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L2558"}}),qt=new G({props:{anchor:"accelerate.Accelerator.prepare_data_loader.example",$$slots:{default:[ki]},$$scope:{ctx:_}}}),Ka=new k({props:{name:"prepare_model",anchor:"accelerate.Accelerator.prepare_model",parameters:[{name:"model",val:": torch.nn.Module"},{name:"device_placement",val:": bool = None"},{name:"evaluation_mode",val:": bool = False"}],parametersDescription:[{anchor:"accelerate.Accelerator.prepare_model.model",description:`<strong>model</strong> (<code>torch.nn.Module</code>) &#x2014;
A PyTorch model to prepare. You don&#x2019;t need to prepare a model if it is used only for inference without
any kind of mixed precision`,name:"model"},{anchor:"accelerate.Accelerator.prepare_model.device_placement",description:`<strong>device_placement</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to place the model on the proper device. Will default to <code>self.device_placement</code>.`,name:"device_placement"},{anchor:"accelerate.Accelerator.prepare_model.evaluation_mode",description:`<strong>evaluation_mode</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to set the model for evaluation only, by just applying mixed precision and
<code>torch.compile</code> (if configured in the <code>Accelerator</code> object).`,name:"evaluation_mode"}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L1703"}}),Ot=new G({props:{anchor:"accelerate.Accelerator.prepare_model.example",$$slots:{default:[Gi]},$$scope:{ctx:_}}}),qa=new k({props:{name:"prepare_optimizer",anchor:"accelerate.Accelerator.prepare_optimizer",parameters:[{name:"optimizer",val:": torch.optim.Optimizer"},{name:"device_placement",val:" = None"}],parametersDescription:[{anchor:"accelerate.Accelerator.prepare_optimizer.optimizer",description:`<strong>optimizer</strong> (<code>torch.optim.Optimizer</code>) &#x2014;
A vanilla PyTorch optimizer to prepare`,name:"optimizer"},{anchor:"accelerate.Accelerator.prepare_optimizer.device_placement",description:`<strong>device_placement</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to place the optimizer on the proper device. Will default to <code>self.device_placement</code>.`,name:"device_placement"}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L2617"}}),ea=new G({props:{anchor:"accelerate.Accelerator.prepare_optimizer.example",$$slots:{default:[Bi]},$$scope:{ctx:_}}}),Oa=new k({props:{name:"prepare_scheduler",anchor:"accelerate.Accelerator.prepare_scheduler",parameters:[{name:"scheduler",val:": LRScheduler"}],parametersDescription:[{anchor:"accelerate.Accelerator.prepare_scheduler.scheduler",description:`<strong>scheduler</strong> (<code>torch.optim.lr_scheduler.LRScheduler</code>) &#x2014;
A vanilla PyTorch scheduler to prepare`,name:"scheduler"}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L2661"}}),ta=new G({props:{anchor:"accelerate.Accelerator.prepare_scheduler.example",$$slots:{default:[Ii]},$$scope:{ctx:_}}}),es=new k({props:{name:"print",anchor:"accelerate.Accelerator.print",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L1377"}}),aa=new G({props:{anchor:"accelerate.Accelerator.print.example",$$slots:{default:[Ci]},$$scope:{ctx:_}}}),ts=new k({props:{name:"profile",anchor:"accelerate.Accelerator.profile",parameters:[{name:"profile_handler",val:": ProfileKwargs | None = None"}],parametersDescription:[{anchor:"accelerate.Accelerator.profile.profile_handler",description:`<strong>profile_handler</strong> (<code>ProfileKwargs</code>, <em>optional</em>) &#x2014;
The profile handler to use for this context manager. If not passed, will use the one set in the
<code>Accelerator</code> object.`,name:"profile_handler"}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L4072"}}),sa=new G({props:{anchor:"accelerate.Accelerator.profile.example",$$slots:{default:[Zi]},$$scope:{ctx:_}}}),as=new k({props:{name:"reduce",anchor:"accelerate.Accelerator.reduce",parameters:[{name:"tensor",val:""},{name:"reduction",val:" = 'sum'"},{name:"scale",val:" = 1.0"}],parametersDescription:[{anchor:"accelerate.Accelerator.reduce.tensor",description:`<strong>tensor</strong> (<code>torch.Tensor</code>, or a nested tuple/list/dictionary of <code>torch.Tensor</code>) &#x2014;
The tensors to reduce across all processes.`,name:"tensor"},{anchor:"accelerate.Accelerator.reduce.reduction",description:`<strong>reduction</strong> (<code>str</code>, <em>optional</em>, defaults to &#x201C;sum&#x201D;) &#x2014;
A reduction type, can be one of &#x2018;sum&#x2019;, &#x2018;mean&#x2019;, or &#x2018;none&#x2019;. If &#x2018;none&#x2019;, will not perform any operation.`,name:"reduction"},{anchor:"accelerate.Accelerator.reduce.scale",description:`<strong>scale</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
A default scaling value to be applied after the reduce, only valied on XLA.`,name:"scale"}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L3025",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The reduced tensor(s).</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>torch.Tensor</code>, or a nested tuple/list/dictionary of <code>torch.Tensor</code></p>
`}}),la=new G({props:{anchor:"accelerate.Accelerator.reduce.example",$$slots:{default:[Wi]},$$scope:{ctx:_}}}),ss=new k({props:{name:"register_for_checkpointing",anchor:"accelerate.Accelerator.register_for_checkpointing",parameters:[{name:"*objects",val:""}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L3946"}}),ra=new Se({props:{$$slots:{default:[Yi]},$$scope:{ctx:_}}}),na=new G({props:{anchor:"accelerate.Accelerator.register_for_checkpointing.example",$$slots:{default:[Xi]},$$scope:{ctx:_}}}),ls=new k({props:{name:"register_load_state_pre_hook",anchor:"accelerate.Accelerator.register_load_state_pre_hook",parameters:[{name:"hook",val:": Callable[..., None]"}],parametersDescription:[{anchor:"accelerate.Accelerator.register_load_state_pre_hook.hook",description:`<strong>hook</strong> (<code>Callable</code>) &#x2014;
A function to be called in <a href="/docs/accelerate/main/en/package_reference/accelerator#accelerate.Accelerator.load_state">Accelerator.load_state()</a> before <code>load_checkpoint</code>.`,name:"hook"}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L3596",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>a handle that can be used to remove the added hook by calling
<code>handle.remove()</code></p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>torch.utils.hooks.RemovableHandle</code></p>
`}}),ca=new Se({props:{$$slots:{default:[Ai]},$$scope:{ctx:_}}}),rs=new k({props:{name:"register_save_state_pre_hook",anchor:"accelerate.Accelerator.register_save_state_pre_hook",parameters:[{name:"hook",val:": Callable[..., None]"}],parametersDescription:[{anchor:"accelerate.Accelerator.register_save_state_pre_hook.hook",description:`<strong>hook</strong> (<code>Callable</code>) &#x2014;
A function to be called in <a href="/docs/accelerate/main/en/package_reference/accelerator#accelerate.Accelerator.save_state">Accelerator.save_state()</a> before <code>save_checkpoint</code>.`,name:"hook"}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L3429",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>a handle that can be used to remove the added hook by calling
<code>handle.remove()</code></p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>torch.utils.hooks.RemovableHandle</code></p>
`}}),oa=new Se({props:{$$slots:{default:[Vi]},$$scope:{ctx:_}}}),ns=new k({props:{name:"save",anchor:"accelerate.Accelerator.save",parameters:[{name:"obj",val:""},{name:"f",val:""},{name:"safe_serialization",val:" = False"}],parametersDescription:[{anchor:"accelerate.Accelerator.save.obj",description:"<strong>obj</strong> (<code>object</code>) &#x2014; The object to save.",name:"obj"},{anchor:"accelerate.Accelerator.save.f",description:"<strong>f</strong> (<code>str</code> or <code>os.PathLike</code>) &#x2014; Where to save the content of <code>obj</code>.",name:"f"},{anchor:"accelerate.Accelerator.save.safe_serialization",description:"<strong>safe_serialization</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014; Whether to save <code>obj</code> using <code>safetensors</code>",name:"safe_serialization"}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L3288"}}),pa=new G({props:{anchor:"accelerate.Accelerator.save.example",$$slots:{default:[Ni]},$$scope:{ctx:_}}}),cs=new k({props:{name:"save_model",anchor:"accelerate.Accelerator.save_model",parameters:[{name:"model",val:": torch.nn.Module"},{name:"save_directory",val:": Union[str, os.PathLike]"},{name:"max_shard_size",val:": Union[int, str] = '10GB'"},{name:"safe_serialization",val:": bool = True"}],parametersDescription:[{anchor:"accelerate.Accelerator.save_model.model",description:`<strong>model</strong> &#x2014; (<code>torch.nn.Module</code>):
Model to be saved. The model can be wrapped or unwraped.`,name:"model"},{anchor:"accelerate.Accelerator.save_model.save_directory",description:`<strong>save_directory</strong> (<code>str</code> or <code>os.PathLike</code>) &#x2014;
Directory to which to save. Will be created if it doesn&#x2019;t exist.`,name:"save_directory"},{anchor:"accelerate.Accelerator.save_model.max_shard_size",description:`<strong>max_shard_size</strong> (<code>int</code> or <code>str</code>, <em>optional</em>, defaults to <code>&quot;10GB&quot;</code>) &#x2014;
The maximum size for a checkpoint before being sharded. Checkpoints shard will then be each of size
lower than this size. If expressed as a string, needs to be digits followed by a unit (like <code>&quot;5MB&quot;</code>).</p>
<div class="course-tip course-tip-orange bg-gradient-to-br dark:bg-gradient-to-r before:border-orange-500 dark:before:border-orange-800 from-orange-50 dark:from-gray-900 to-white dark:to-gray-950 border border-orange-50 text-orange-700 dark:text-gray-400">
						
<p>If a single weight of the model is bigger than <code>max_shard_size</code>, it will be in its own checkpoint shard
which will be bigger than <code>max_shard_size</code>.</p>

					</div>`,name:"max_shard_size"},{anchor:"accelerate.Accelerator.save_model.safe_serialization",description:`<strong>safe_serialization</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to save the model using <code>safetensors</code> or the traditional PyTorch way (that uses <code>pickle</code>).`,name:"safe_serialization"}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L3318"}}),ia=new G({props:{anchor:"accelerate.Accelerator.save_model.example",$$slots:{default:[Qi]},$$scope:{ctx:_}}}),os=new k({props:{name:"save_state",anchor:"accelerate.Accelerator.save_state",parameters:[{name:"output_dir",val:": str = None"},{name:"safe_serialization",val:": bool = True"},{name:"**save_model_func_kwargs",val:""}],parametersDescription:[{anchor:"accelerate.Accelerator.save_state.output_dir",description:`<strong>output_dir</strong> (<code>str</code> or <code>os.PathLike</code>) &#x2014;
The name of the folder to save all relevant weights and states.`,name:"output_dir"},{anchor:"accelerate.Accelerator.save_state.safe_serialization",description:`<strong>safe_serialization</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to save the model using <code>safetensors</code> or the traditional PyTorch way (that uses <code>pickle</code>).`,name:"safe_serialization"},{anchor:"accelerate.Accelerator.save_state.save_model_func_kwargs",description:`<strong>save_model_func_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Additional keyword arguments for saving model which can be passed to the underlying save function, such
as optional arguments for DeepSpeed&#x2019;s <code>save_checkpoint</code> function.`,name:"save_model_func_kwargs"}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L3461"}}),da=new Se({props:{$$slots:{default:[Fi]},$$scope:{ctx:_}}}),ma=new G({props:{anchor:"accelerate.Accelerator.save_state.example",$$slots:{default:[zi]},$$scope:{ctx:_}}}),ps=new k({props:{name:"set_trigger",anchor:"accelerate.Accelerator.set_trigger",parameters:[],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L2736"}}),ha=new G({props:{anchor:"accelerate.Accelerator.set_trigger.example",$$slots:{default:[Ri]},$$scope:{ctx:_}}}),is=new k({props:{name:"skip_first_batches",anchor:"accelerate.Accelerator.skip_first_batches",parameters:[{name:"dataloader",val:""},{name:"num_batches",val:": int = 0"}],parametersDescription:[{anchor:"accelerate.Accelerator.skip_first_batches.dataloader",description:"<strong>dataloader</strong> (<code>torch.utils.data.DataLoader</code>) &#x2014; The data loader in which to skip batches.",name:"dataloader"},{anchor:"accelerate.Accelerator.skip_first_batches.num_batches",description:"<strong>num_batches</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014; The number of batches to skip",name:"num_batches"}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L4143"}}),ga=new G({props:{anchor:"accelerate.Accelerator.skip_first_batches.example",$$slots:{default:[Ei]},$$scope:{ctx:_}}}),ds=new k({props:{name:"split_between_processes",anchor:"accelerate.Accelerator.split_between_processes",parameters:[{name:"inputs",val:": list | tuple | dict | torch.Tensor"},{name:"apply_padding",val:": bool = False"}],parametersDescription:[{anchor:"accelerate.Accelerator.split_between_processes.inputs",description:`<strong>inputs</strong> (<code>list</code>, <code>tuple</code>, <code>torch.Tensor</code>, or <code>dict</code> of <code>list</code>/<code>tuple</code>/<code>torch.Tensor</code>) &#x2014;
The input to split between processes.`,name:"inputs"},{anchor:"accelerate.Accelerator.split_between_processes.apply_padding",description:`<strong>apply_padding</strong> (<code>bool</code>, <code>optional</code>, defaults to <code>False</code>) &#x2014;
Whether to apply padding by repeating the last element of the input so that all processes have the same
number of elements. Useful when trying to perform actions such as <code>Accelerator.gather()</code> on the outputs
or passing in less inputs than there are processes. If so, just remember to drop the padded elements
afterwards.`,name:"apply_padding"}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L834"}}),ua=new G({props:{anchor:"accelerate.Accelerator.split_between_processes.example",$$slots:{default:[Si]},$$scope:{ctx:_}}}),ms=new k({props:{name:"trigger_sync_in_backward",anchor:"accelerate.Accelerator.trigger_sync_in_backward",parameters:[{name:"model",val:""}],parametersDescription:[{anchor:"accelerate.Accelerator.trigger_sync_in_backward.model",description:`<strong>model</strong> (<code>torch.nn.Module</code>) &#x2014;
The model for which to trigger the gradient synchronization.`,name:"model"}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L1175"}}),fa=new G({props:{anchor:"accelerate.Accelerator.trigger_sync_in_backward.example",$$slots:{default:[Hi]},$$scope:{ctx:_}}}),hs=new k({props:{name:"unscale_gradients",anchor:"accelerate.Accelerator.unscale_gradients",parameters:[{name:"optimizer",val:" = None"}],parametersDescription:[{anchor:"accelerate.Accelerator.unscale_gradients.optimizer",description:`<strong>optimizer</strong> (<code>torch.optim.Optimizer</code> or <code>list[torch.optim.Optimizer]</code>, <em>optional</em>) &#x2014;
The optimizer(s) for which to unscale gradients. If not set, will unscale gradients on all optimizers
that were passed to <a href="/docs/accelerate/main/en/package_reference/accelerator#accelerate.Accelerator.prepare">prepare()</a>.`,name:"optimizer"}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L2795"}}),ba=new G({props:{anchor:"accelerate.Accelerator.unscale_gradients.example",$$slots:{default:[Li]},$$scope:{ctx:_}}}),gs=new k({props:{name:"unwrap_model",anchor:"accelerate.Accelerator.unwrap_model",parameters:[{name:"model",val:""},{name:"keep_fp32_wrapper",val:": bool = True"},{name:"keep_torch_compile",val:": bool = True"}],parametersDescription:[{anchor:"accelerate.Accelerator.unwrap_model.model",description:`<strong>model</strong> (<code>torch.nn.Module</code>) &#x2014;
The model to unwrap.`,name:"model"},{anchor:"accelerate.Accelerator.unwrap_model.keep_fp32_wrapper",description:`<strong>keep_fp32_wrapper</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to not remove the mixed precision hook if it was added.`,name:"keep_fp32_wrapper"},{anchor:"accelerate.Accelerator.unwrap_model.keep_torch_compile",description:`<strong>keep_torch_compile</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether to not unwrap compiled model if compiled.`,name:"keep_torch_compile"}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L3096",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The unwrapped model.</p>
`,returnType:`<script context="module">export const metadata = 'undefined';<\/script>


<p><code>torch.nn.Module</code></p>
`}}),$a=new G({props:{anchor:"accelerate.Accelerator.unwrap_model.example",$$slots:{default:[Pi]},$$scope:{ctx:_}}}),us=new k({props:{name:"verify_device_map",anchor:"accelerate.Accelerator.verify_device_map",parameters:[{name:"model",val:": torch.nn.Module"}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L4179"}}),fs=new k({props:{name:"wait_for_everyone",anchor:"accelerate.Accelerator.wait_for_everyone",parameters:[],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L3130"}}),Ma=new G({props:{anchor:"accelerate.Accelerator.wait_for_everyone.example",$$slots:{default:[Di]},$$scope:{ctx:_}}}),bs=new fo({props:{title:"Utilities",local:"accelerate.utils.gather_object",headingTag:"h2"}}),$s=new k({props:{name:"accelerate.utils.gather_object",anchor:"accelerate.utils.gather_object",parameters:[{name:"object",val:": typing.Any"}],parametersDescription:[{anchor:"accelerate.utils.gather_object.object",description:`<strong>object</strong> (nested list/tuple/dictionary of picklable object) &#x2014;
The data to gather.`,name:"object"}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/utils/operations.py#L444",returnDescription:`<script context="module">export const metadata = 'undefined';<\/script>


<p>The same data structure as <code>object</code> with all the objects sent to every device.</p>
`}}),ys=new Pp({props:{source:"https://github.com/huggingface/accelerate/blob/main/docs/source/package_reference/accelerator.md"}}),{c(){t=i("meta"),m=n(),r=i("p"),a=n(),g(o.$$.fragment),e=n(),p=i("p"),p.innerHTML=bo,El=n(),g(ja.$$.fragment),Sl=n(),v=i("div"),g(wa.$$.fragment),ql=n(),_s=i("p"),_s.textContent=$o,Ol=n(),vs=i("p"),vs.innerHTML=yo,er=n(),Js=i("ul"),Js.innerHTML=Mo,tr=n(),we=i("div"),g(_a.$$.fragment),ar=n(),Ts=i("p"),Ts.textContent=jo,sr=n(),g($t.$$.fragment),lr=n(),S=i("div"),g(va.$$.fragment),rr=n(),Us=i("p"),Us.textContent=wo,nr=n(),xs=i("p"),xs.innerHTML=_o,cr=n(),g(yt.$$.fragment),or=n(),H=i("div"),g(Ja.$$.fragment),pr=n(),ks=i("p"),ks.innerHTML=vo,ir=n(),Gs=i("p"),Gs.innerHTML=Jo,dr=n(),g(Mt.$$.fragment),mr=n(),L=i("div"),g(Ta.$$.fragment),hr=n(),Bs=i("p"),Bs.innerHTML=To,gr=n(),Is=i("p"),Is.innerHTML=Uo,ur=n(),g(jt.$$.fragment),fr=n(),_e=i("div"),g(Ua.$$.fragment),br=n(),Cs=i("p"),Cs.innerHTML=xo,$r=n(),g(wt.$$.fragment),yr=n(),ve=i("div"),g(xa.$$.fragment),Mr=n(),Zs=i("p"),Zs.innerHTML=ko,jr=n(),g(_t.$$.fragment),wr=n(),Je=i("div"),g(ka.$$.fragment),_r=n(),Ws=i("p"),Ws.innerHTML=Go,vr=n(),g(vt.$$.fragment),Jr=n(),Te=i("div"),g(Ga.$$.fragment),Tr=n(),Ys=i("p"),Ys.textContent=Bo,Ur=n(),g(Jt.$$.fragment),xr=n(),Ue=i("div"),g(Ba.$$.fragment),kr=n(),Xs=i("p"),Xs.innerHTML=Io,Gr=n(),g(Tt.$$.fragment),Br=n(),P=i("div"),g(Ia.$$.fragment),Ir=n(),As=i("p"),As.innerHTML=Co,Cr=n(),Vs=i("p"),Vs.textContent=Zo,Zr=n(),g(Ut.$$.fragment),Wr=n(),xe=i("div"),g(Ca.$$.fragment),Yr=n(),Ns=i("p"),Ns.innerHTML=Wo,Xr=n(),g(xt.$$.fragment),Ar=n(),ke=i("div"),g(Za.$$.fragment),Vr=n(),Qs=i("p"),Qs.innerHTML=Yo,Nr=n(),g(kt.$$.fragment),Qr=n(),Ge=i("div"),g(Wa.$$.fragment),Fr=n(),Fs=i("p"),Fs.innerHTML=Xo,zr=n(),g(Gt.$$.fragment),Rr=n(),A=i("div"),g(Ya.$$.fragment),Er=n(),zs=i("p"),zs.innerHTML=Ao,Sr=n(),g(Bt.$$.fragment),Hr=n(),g(It.$$.fragment),Lr=n(),g(Ct.$$.fragment),Pr=n(),D=i("div"),g(Xa.$$.fragment),Dr=n(),Rs=i("p"),Rs.textContent=Vo,Kr=n(),g(Zt.$$.fragment),qr=n(),g(Wt.$$.fragment),Or=n(),K=i("div"),g(Aa.$$.fragment),en=n(),Es=i("p"),Es.textContent=No,tn=n(),Ss=i("p"),Ss.textContent=Qo,an=n(),g(Yt.$$.fragment),sn=n(),Xt=i("div"),g(Va.$$.fragment),ln=n(),Hs=i("p"),Hs.textContent=Fo,rn=n(),q=i("div"),g(Na.$$.fragment),nn=n(),Ls=i("p"),Ls.textContent=zo,cn=n(),Ps=i("p"),Ps.textContent=Ro,on=n(),g(At.$$.fragment),pn=n(),V=i("div"),g(Qa.$$.fragment),dn=n(),Ds=i("p"),Ds.textContent=Eo,mn=n(),g(Vt.$$.fragment),hn=n(),g(Nt.$$.fragment),gn=n(),g(Qt.$$.fragment),un=n(),O=i("div"),g(Fa.$$.fragment),fn=n(),Ks=i("p"),Ks.innerHTML=So,bn=n(),qs=i("p"),qs.innerHTML=Ho,$n=n(),g(Ft.$$.fragment),yn=n(),Be=i("div"),g(za.$$.fragment),Mn=n(),Os=i("p"),Os.innerHTML=Lo,jn=n(),g(zt.$$.fragment),wn=n(),Ie=i("div"),g(Ra.$$.fragment),_n=n(),el=i("p"),el.innerHTML=Po,vn=n(),g(Rt.$$.fragment),Jn=n(),Ce=i("div"),g(Ea.$$.fragment),Tn=n(),tl=i("p"),tl.innerHTML=Do,Un=n(),g(Et.$$.fragment),xn=n(),Ze=i("div"),g(Sa.$$.fragment),kn=n(),al=i("p"),al.innerHTML=Ko,Gn=n(),g(St.$$.fragment),Bn=n(),We=i("div"),g(Ha.$$.fragment),In=n(),sl=i("p"),sl.innerHTML=qo,Cn=n(),g(Ht.$$.fragment),Zn=n(),Ye=i("div"),g(La.$$.fragment),Wn=n(),ll=i("p"),ll.textContent=Oo,Yn=n(),g(Lt.$$.fragment),Xn=n(),N=i("div"),g(Pa.$$.fragment),An=n(),rl=i("p"),rl.innerHTML=ep,Vn=n(),g(Pt.$$.fragment),Nn=n(),g(Dt.$$.fragment),Qn=n(),g(Kt.$$.fragment),Fn=n(),Xe=i("div"),g(Da.$$.fragment),zn=n(),nl=i("p"),nl.innerHTML=tp,Rn=n(),g(qt.$$.fragment),En=n(),Ae=i("div"),g(Ka.$$.fragment),Sn=n(),cl=i("p"),cl.innerHTML=ap,Hn=n(),g(Ot.$$.fragment),Ln=n(),Ve=i("div"),g(qa.$$.fragment),Pn=n(),ol=i("p"),ol.innerHTML=sp,Dn=n(),g(ea.$$.fragment),Kn=n(),Ne=i("div"),g(Oa.$$.fragment),qn=n(),pl=i("p"),pl.innerHTML=lp,On=n(),g(ta.$$.fragment),ec=n(),Qe=i("div"),g(es.$$.fragment),tc=n(),il=i("p"),il.innerHTML=rp,ac=n(),g(aa.$$.fragment),sc=n(),ee=i("div"),g(ts.$$.fragment),lc=n(),dl=i("p"),dl.innerHTML=np,rc=n(),ml=i("p"),ml.innerHTML=cp,nc=n(),g(sa.$$.fragment),cc=n(),te=i("div"),g(as.$$.fragment),oc=n(),hl=i("p"),hl.innerHTML=op,pc=n(),gl=i("p"),gl.textContent=pp,ic=n(),g(la.$$.fragment),dc=n(),Q=i("div"),g(ss.$$.fragment),mc=n(),ul=i("p"),ul.innerHTML=ip,hc=n(),fl=i("p"),fl.textContent=dp,gc=n(),g(ra.$$.fragment),uc=n(),g(na.$$.fragment),fc=n(),I=i("div"),g(ls.$$.fragment),bc=n(),bl=i("p"),bl.innerHTML=mp,$c=n(),$l=i("p"),$l.textContent=hp,yc=n(),yl=i("p"),yl.innerHTML=gp,Mc=n(),Ml=i("p"),Ml.innerHTML=up,jc=n(),g(ca.$$.fragment),wc=n(),C=i("div"),g(rs.$$.fragment),_c=n(),jl=i("p"),jl.innerHTML=fp,vc=n(),wl=i("p"),wl.textContent=bp,Jc=n(),_l=i("p"),_l.innerHTML=$p,Tc=n(),vl=i("p"),vl.innerHTML=yp,Uc=n(),g(oa.$$.fragment),xc=n(),ae=i("div"),g(ns.$$.fragment),kc=n(),Jl=i("p"),Jl.innerHTML=Mp,Gc=n(),Tl=i("p"),Tl.innerHTML=jp,Bc=n(),g(pa.$$.fragment),Ic=n(),Fe=i("div"),g(cs.$$.fragment),Cc=n(),Ul=i("p"),Ul.textContent=wp,Zc=n(),g(ia.$$.fragment),Wc=n(),Z=i("div"),g(os.$$.fragment),Yc=n(),xl=i("p"),xl.textContent=_p,Xc=n(),kl=i("p"),kl.innerHTML=vp,Ac=n(),Gl=i("p"),Gl.innerHTML=Jp,Vc=n(),g(da.$$.fragment),Nc=n(),g(ma.$$.fragment),Qc=n(),se=i("div"),g(ps.$$.fragment),Fc=n(),Bl=i("p"),Bl.textContent=Tp,zc=n(),Il=i("p"),Il.innerHTML=Up,Rc=n(),g(ha.$$.fragment),Ec=n(),ze=i("div"),g(is.$$.fragment),Sc=n(),Cl=i("p"),Cl.innerHTML=xp,Hc=n(),g(ga.$$.fragment),Lc=n(),le=i("div"),g(ds.$$.fragment),Pc=n(),Zl=i("p"),Zl.innerHTML=kp,Dc=n(),Wl=i("p"),Wl.innerHTML=Gp,Kc=n(),g(ua.$$.fragment),qc=n(),re=i("div"),g(ms.$$.fragment),Oc=n(),Yl=i("p"),Yl.innerHTML=Bp,eo=n(),Xl=i("p"),Xl.textContent=Ip,to=n(),g(fa.$$.fragment),ao=n(),ne=i("div"),g(hs.$$.fragment),so=n(),Al=i("p"),Al.textContent=Cp,lo=n(),Vl=i("p"),Vl.innerHTML=Zp,ro=n(),g(ba.$$.fragment),no=n(),Re=i("div"),g(gs.$$.fragment),co=n(),Nl=i("p"),Nl.innerHTML=Wp,oo=n(),g($a.$$.fragment),po=n(),ya=i("div"),g(us.$$.fragment),io=n(),Ql=i("p"),Ql.innerHTML=Yp,mo=n(),Ee=i("div"),g(fs.$$.fragment),ho=n(),Fl=i("p"),Fl.textContent=Xp,go=n(),g(Ma.$$.fragment),Hl=n(),g(bs.$$.fragment),Ll=n(),He=i("div"),g($s.$$.fragment),uo=n(),zl=i("p"),zl.textContent=Ap,Pl=n(),g(ys.$$.fragment),Dl=n(),Rl=i("p"),this.h()},l(s){const M=Lp("svelte-u9bgzb",document.head);t=d(M,"META",{name:!0,content:!0}),M.forEach(h),m=c(s),r=d(s,"P",{}),U(r).forEach(h),a=c(s),u(o.$$.fragment,s),e=c(s),p=d(s,"P",{"data-svelte-h":!0}),j(p)!=="svelte-1m2utx6"&&(p.innerHTML=bo),El=c(s),u(ja.$$.fragment,s),Sl=c(s),v=d(s,"DIV",{class:!0});var J=U(v);u(wa.$$.fragment,J),ql=c(J),_s=d(J,"P",{"data-svelte-h":!0}),j(_s)!=="svelte-18gnhk2"&&(_s.textContent=$o),Ol=c(J),vs=d(J,"P",{"data-svelte-h":!0}),j(vs)!=="svelte-17v1xbv"&&(vs.innerHTML=yo),er=c(J),Js=d(J,"UL",{"data-svelte-h":!0}),j(Js)!=="svelte-1830bw3"&&(Js.innerHTML=Mo),tr=c(J),we=d(J,"DIV",{class:!0});var Le=U(we);u(_a.$$.fragment,Le),ar=c(Le),Ts=d(Le,"P",{"data-svelte-h":!0}),j(Ts)!=="svelte-hhq3cw"&&(Ts.textContent=jo),sr=c(Le),u($t.$$.fragment,Le),Le.forEach(h),lr=c(J),S=d(J,"DIV",{class:!0});var ce=U(S);u(va.$$.fragment,ce),rr=c(ce),Us=d(ce,"P",{"data-svelte-h":!0}),j(Us)!=="svelte-1to22fk"&&(Us.textContent=wo),nr=c(ce),xs=d(ce,"P",{"data-svelte-h":!0}),j(xs)!=="svelte-2z45q2"&&(xs.innerHTML=_o),cr=c(ce),u(yt.$$.fragment,ce),ce.forEach(h),or=c(J),H=d(J,"DIV",{class:!0});var oe=U(H);u(Ja.$$.fragment,oe),pr=c(oe),ks=d(oe,"P",{"data-svelte-h":!0}),j(ks)!=="svelte-1k83amz"&&(ks.innerHTML=vo),ir=c(oe),Gs=d(oe,"P",{"data-svelte-h":!0}),j(Gs)!=="svelte-3qeaqc"&&(Gs.innerHTML=Jo),dr=c(oe),u(Mt.$$.fragment,oe),oe.forEach(h),mr=c(J),L=d(J,"DIV",{class:!0});var pe=U(L);u(Ta.$$.fragment,pe),hr=c(pe),Bs=d(pe,"P",{"data-svelte-h":!0}),j(Bs)!=="svelte-m17ioq"&&(Bs.innerHTML=To),gr=c(pe),Is=d(pe,"P",{"data-svelte-h":!0}),j(Is)!=="svelte-h6tcr2"&&(Is.innerHTML=Uo),ur=c(pe),u(jt.$$.fragment,pe),pe.forEach(h),fr=c(J),_e=d(J,"DIV",{class:!0});var Pe=U(_e);u(Ua.$$.fragment,Pe),br=c(Pe),Cs=d(Pe,"P",{"data-svelte-h":!0}),j(Cs)!=="svelte-bl1ihw"&&(Cs.innerHTML=xo),$r=c(Pe),u(wt.$$.fragment,Pe),Pe.forEach(h),yr=c(J),ve=d(J,"DIV",{class:!0});var De=U(ve);u(xa.$$.fragment,De),Mr=c(De),Zs=d(De,"P",{"data-svelte-h":!0}),j(Zs)!=="svelte-1w1177v"&&(Zs.innerHTML=ko),jr=c(De),u(_t.$$.fragment,De),De.forEach(h),wr=c(J),Je=d(J,"DIV",{class:!0});var Ke=U(Je);u(ka.$$.fragment,Ke),_r=c(Ke),Ws=d(Ke,"P",{"data-svelte-h":!0}),j(Ws)!=="svelte-1rffb4m"&&(Ws.innerHTML=Go),vr=c(Ke),u(vt.$$.fragment,Ke),Ke.forEach(h),Jr=c(J),Te=d(J,"DIV",{class:!0});var qe=U(Te);u(Ga.$$.fragment,qe),Tr=c(qe),Ys=d(qe,"P",{"data-svelte-h":!0}),j(Ys)!=="svelte-a2pg1h"&&(Ys.textContent=Bo),Ur=c(qe),u(Jt.$$.fragment,qe),qe.forEach(h),xr=c(J),Ue=d(J,"DIV",{class:!0});var Oe=U(Ue);u(Ba.$$.fragment,Oe),kr=c(Oe),Xs=d(Oe,"P",{"data-svelte-h":!0}),j(Xs)!=="svelte-iw017b"&&(Xs.innerHTML=Io),Gr=c(Oe),u(Tt.$$.fragment,Oe),Oe.forEach(h),Br=c(J),P=d(J,"DIV",{class:!0});var ie=U(P);u(Ia.$$.fragment,ie),Ir=c(ie),As=d(ie,"P",{"data-svelte-h":!0}),j(As)!=="svelte-c0v2dv"&&(As.innerHTML=Co),Cr=c(ie),Vs=d(ie,"P",{"data-svelte-h":!0}),j(Vs)!=="svelte-1ap3exf"&&(Vs.textContent=Zo),Zr=c(ie),u(Ut.$$.fragment,ie),ie.forEach(h),Wr=c(J),xe=d(J,"DIV",{class:!0});var et=U(xe);u(Ca.$$.fragment,et),Yr=c(et),Ns=d(et,"P",{"data-svelte-h":!0}),j(Ns)!=="svelte-19l0og1"&&(Ns.innerHTML=Wo),Xr=c(et),u(xt.$$.fragment,et),et.forEach(h),Ar=c(J),ke=d(J,"DIV",{class:!0});var tt=U(ke);u(Za.$$.fragment,tt),Vr=c(tt),Qs=d(tt,"P",{"data-svelte-h":!0}),j(Qs)!=="svelte-4sbmnk"&&(Qs.innerHTML=Yo),Nr=c(tt),u(kt.$$.fragment,tt),tt.forEach(h),Qr=c(J),Ge=d(J,"DIV",{class:!0});var at=U(Ge);u(Wa.$$.fragment,at),Fr=c(at),Fs=d(at,"P",{"data-svelte-h":!0}),j(Fs)!=="svelte-vacsyv"&&(Fs.innerHTML=Xo),zr=c(at),u(Gt.$$.fragment,at),at.forEach(h),Rr=c(J),A=d(J,"DIV",{class:!0});var F=U(A);u(Ya.$$.fragment,F),Er=c(F),zs=d(F,"P",{"data-svelte-h":!0}),j(zs)!=="svelte-hlem7e"&&(zs.innerHTML=Ao),Sr=c(F),u(Bt.$$.fragment,F),Hr=c(F),u(It.$$.fragment,F),Lr=c(F),u(Ct.$$.fragment,F),F.forEach(h),Pr=c(J),D=d(J,"DIV",{class:!0});var de=U(D);u(Xa.$$.fragment,de),Dr=c(de),Rs=d(de,"P",{"data-svelte-h":!0}),j(Rs)!=="svelte-1kjfoov"&&(Rs.textContent=Vo),Kr=c(de),u(Zt.$$.fragment,de),qr=c(de),u(Wt.$$.fragment,de),de.forEach(h),Or=c(J),K=d(J,"DIV",{class:!0});var me=U(K);u(Aa.$$.fragment,me),en=c(me),Es=d(me,"P",{"data-svelte-h":!0}),j(Es)!=="svelte-1xrqyx2"&&(Es.textContent=No),tn=c(me),Ss=d(me,"P",{"data-svelte-h":!0}),j(Ss)!=="svelte-144ycie"&&(Ss.textContent=Qo),an=c(me),u(Yt.$$.fragment,me),me.forEach(h),sn=c(J),Xt=d(J,"DIV",{class:!0});var Ms=U(Xt);u(Va.$$.fragment,Ms),ln=c(Ms),Hs=d(Ms,"P",{"data-svelte-h":!0}),j(Hs)!=="svelte-vdzhg"&&(Hs.textContent=Fo),Ms.forEach(h),rn=c(J),q=d(J,"DIV",{class:!0});var he=U(q);u(Na.$$.fragment,he),nn=c(he),Ls=d(he,"P",{"data-svelte-h":!0}),j(Ls)!=="svelte-f40x3x"&&(Ls.textContent=zo),cn=c(he),Ps=d(he,"P",{"data-svelte-h":!0}),j(Ps)!=="svelte-144ycie"&&(Ps.textContent=Ro),on=c(he),u(At.$$.fragment,he),he.forEach(h),pn=c(J),V=d(J,"DIV",{class:!0});var z=U(V);u(Qa.$$.fragment,z),dn=c(z),Ds=d(z,"P",{"data-svelte-h":!0}),j(Ds)!=="svelte-p8l2iu"&&(Ds.textContent=Eo),mn=c(z),u(Vt.$$.fragment,z),hn=c(z),u(Nt.$$.fragment,z),gn=c(z),u(Qt.$$.fragment,z),z.forEach(h),un=c(J),O=d(J,"DIV",{class:!0});var ge=U(O);u(Fa.$$.fragment,ge),fn=c(ge),Ks=d(ge,"P",{"data-svelte-h":!0}),j(Ks)!=="svelte-1g6bbp3"&&(Ks.innerHTML=So),bn=c(ge),qs=d(ge,"P",{"data-svelte-h":!0}),j(qs)!=="svelte-g65bbp"&&(qs.innerHTML=Ho),$n=c(ge),u(Ft.$$.fragment,ge),ge.forEach(h),yn=c(J),Be=d(J,"DIV",{class:!0});var st=U(Be);u(za.$$.fragment,st),Mn=c(st),Os=d(st,"P",{"data-svelte-h":!0}),j(Os)!=="svelte-dzayl0"&&(Os.innerHTML=Lo),jn=c(st),u(zt.$$.fragment,st),st.forEach(h),wn=c(J),Ie=d(J,"DIV",{class:!0});var lt=U(Ie);u(Ra.$$.fragment,lt),_n=c(lt),el=d(lt,"P",{"data-svelte-h":!0}),j(el)!=="svelte-56q7i0"&&(el.innerHTML=Po),vn=c(lt),u(Rt.$$.fragment,lt),lt.forEach(h),Jn=c(J),Ce=d(J,"DIV",{class:!0});var rt=U(Ce);u(Ea.$$.fragment,rt),Tn=c(rt),tl=d(rt,"P",{"data-svelte-h":!0}),j(tl)!=="svelte-1c2pa3e"&&(tl.innerHTML=Do),Un=c(rt),u(Et.$$.fragment,rt),rt.forEach(h),xn=c(J),Ze=d(J,"DIV",{class:!0});var nt=U(Ze);u(Sa.$$.fragment,nt),kn=c(nt),al=d(nt,"P",{"data-svelte-h":!0}),j(al)!=="svelte-1bxst4n"&&(al.innerHTML=Ko),Gn=c(nt),u(St.$$.fragment,nt),nt.forEach(h),Bn=c(J),We=d(J,"DIV",{class:!0});var ct=U(We);u(Ha.$$.fragment,ct),In=c(ct),sl=d(ct,"P",{"data-svelte-h":!0}),j(sl)!=="svelte-gt9ih5"&&(sl.innerHTML=qo),Cn=c(ct),u(Ht.$$.fragment,ct),ct.forEach(h),Zn=c(J),Ye=d(J,"DIV",{class:!0});var ot=U(Ye);u(La.$$.fragment,ot),Wn=c(ot),ll=d(ot,"P",{"data-svelte-h":!0}),j(ll)!=="svelte-1mfhnhh"&&(ll.textContent=Oo),Yn=c(ot),u(Lt.$$.fragment,ot),ot.forEach(h),Xn=c(J),N=d(J,"DIV",{class:!0});var R=U(N);u(Pa.$$.fragment,R),An=c(R),rl=d(R,"P",{"data-svelte-h":!0}),j(rl)!=="svelte-90g1bo"&&(rl.innerHTML=ep),Vn=c(R),u(Pt.$$.fragment,R),Nn=c(R),u(Dt.$$.fragment,R),Qn=c(R),u(Kt.$$.fragment,R),R.forEach(h),Fn=c(J),Xe=d(J,"DIV",{class:!0});var pt=U(Xe);u(Da.$$.fragment,pt),zn=c(pt),nl=d(pt,"P",{"data-svelte-h":!0}),j(nl)!=="svelte-jtaqq6"&&(nl.innerHTML=tp),Rn=c(pt),u(qt.$$.fragment,pt),pt.forEach(h),En=c(J),Ae=d(J,"DIV",{class:!0});var it=U(Ae);u(Ka.$$.fragment,it),Sn=c(it),cl=d(it,"P",{"data-svelte-h":!0}),j(cl)!=="svelte-1ipttjs"&&(cl.innerHTML=ap),Hn=c(it),u(Ot.$$.fragment,it),it.forEach(h),Ln=c(J),Ve=d(J,"DIV",{class:!0});var dt=U(Ve);u(qa.$$.fragment,dt),Pn=c(dt),ol=d(dt,"P",{"data-svelte-h":!0}),j(ol)!=="svelte-1ilbfbi"&&(ol.innerHTML=sp),Dn=c(dt),u(ea.$$.fragment,dt),dt.forEach(h),Kn=c(J),Ne=d(J,"DIV",{class:!0});var mt=U(Ne);u(Oa.$$.fragment,mt),qn=c(mt),pl=d(mt,"P",{"data-svelte-h":!0}),j(pl)!=="svelte-lcda6w"&&(pl.innerHTML=lp),On=c(mt),u(ta.$$.fragment,mt),mt.forEach(h),ec=c(J),Qe=d(J,"DIV",{class:!0});var ht=U(Qe);u(es.$$.fragment,ht),tc=c(ht),il=d(ht,"P",{"data-svelte-h":!0}),j(il)!=="svelte-1fwzii1"&&(il.innerHTML=rp),ac=c(ht),u(aa.$$.fragment,ht),ht.forEach(h),sc=c(J),ee=d(J,"DIV",{class:!0});var ue=U(ee);u(ts.$$.fragment,ue),lc=c(ue),dl=d(ue,"P",{"data-svelte-h":!0}),j(dl)!=="svelte-18jmrh0"&&(dl.innerHTML=np),rc=c(ue),ml=d(ue,"P",{"data-svelte-h":!0}),j(ml)!=="svelte-bk0lx4"&&(ml.innerHTML=cp),nc=c(ue),u(sa.$$.fragment,ue),ue.forEach(h),cc=c(J),te=d(J,"DIV",{class:!0});var fe=U(te);u(as.$$.fragment,fe),oc=c(fe),hl=d(fe,"P",{"data-svelte-h":!0}),j(hl)!=="svelte-1lyv8gx"&&(hl.innerHTML=op),pc=c(fe),gl=d(fe,"P",{"data-svelte-h":!0}),j(gl)!=="svelte-12bh3zw"&&(gl.textContent=pp),ic=c(fe),u(la.$$.fragment,fe),fe.forEach(h),dc=c(J),Q=d(J,"DIV",{class:!0});var E=U(Q);u(ss.$$.fragment,E),mc=c(E),ul=d(E,"P",{"data-svelte-h":!0}),j(ul)!=="svelte-1yy42cg"&&(ul.innerHTML=ip),hc=c(E),fl=d(E,"P",{"data-svelte-h":!0}),j(fl)!=="svelte-x6uu8"&&(fl.textContent=dp),gc=c(E),u(ra.$$.fragment,E),uc=c(E),u(na.$$.fragment,E),E.forEach(h),fc=c(J),I=d(J,"DIV",{class:!0});var W=U(I);u(ls.$$.fragment,W),bc=c(W),bl=d(W,"P",{"data-svelte-h":!0}),j(bl)!=="svelte-r9fsru"&&(bl.innerHTML=mp),$c=c(W),$l=d(W,"P",{"data-svelte-h":!0}),j($l)!=="svelte-14qme5z"&&($l.textContent=hp),yc=c(W),yl=d(W,"P",{"data-svelte-h":!0}),j(yl)!=="svelte-ljm1ur"&&(yl.innerHTML=gp),Mc=c(W),Ml=d(W,"P",{"data-svelte-h":!0}),j(Ml)!=="svelte-80yz6h"&&(Ml.innerHTML=up),jc=c(W),u(ca.$$.fragment,W),W.forEach(h),wc=c(J),C=d(J,"DIV",{class:!0});var Y=U(C);u(rs.$$.fragment,Y),_c=c(Y),jl=d(Y,"P",{"data-svelte-h":!0}),j(jl)!=="svelte-1pt2ddf"&&(jl.innerHTML=fp),vc=c(Y),wl=d(Y,"P",{"data-svelte-h":!0}),j(wl)!=="svelte-14qme5z"&&(wl.textContent=bp),Jc=c(Y),_l=d(Y,"P",{"data-svelte-h":!0}),j(_l)!=="svelte-ze4wea"&&(_l.innerHTML=$p),Tc=c(Y),vl=d(Y,"P",{"data-svelte-h":!0}),j(vl)!=="svelte-hsjn5i"&&(vl.innerHTML=yp),Uc=c(Y),u(oa.$$.fragment,Y),Y.forEach(h),xc=c(J),ae=d(J,"DIV",{class:!0});var be=U(ae);u(ns.$$.fragment,be),kc=c(be),Jl=d(be,"P",{"data-svelte-h":!0}),j(Jl)!=="svelte-16eiqks"&&(Jl.innerHTML=Mp),Gc=c(be),Tl=d(be,"P",{"data-svelte-h":!0}),j(Tl)!=="svelte-4i4kmd"&&(Tl.innerHTML=jp),Bc=c(be),u(pa.$$.fragment,be),be.forEach(h),Ic=c(J),Fe=d(J,"DIV",{class:!0});var gt=U(Fe);u(cs.$$.fragment,gt),Cc=c(gt),Ul=d(gt,"P",{"data-svelte-h":!0}),j(Ul)!=="svelte-onu98y"&&(Ul.textContent=wp),Zc=c(gt),u(ia.$$.fragment,gt),gt.forEach(h),Wc=c(J),Z=d(J,"DIV",{class:!0});var X=U(Z);u(os.$$.fragment,X),Yc=c(X),xl=d(X,"P",{"data-svelte-h":!0}),j(xl)!=="svelte-1v72nnm"&&(xl.textContent=_p),Xc=c(X),kl=d(X,"P",{"data-svelte-h":!0}),j(kl)!=="svelte-5mv7f4"&&(kl.innerHTML=vp),Ac=c(X),Gl=d(X,"P",{"data-svelte-h":!0}),j(Gl)!=="svelte-13o3ok4"&&(Gl.innerHTML=Jp),Vc=c(X),u(da.$$.fragment,X),Nc=c(X),u(ma.$$.fragment,X),X.forEach(h),Qc=c(J),se=d(J,"DIV",{class:!0});var $e=U(se);u(ps.$$.fragment,$e),Fc=c($e),Bl=d($e,"P",{"data-svelte-h":!0}),j(Bl)!=="svelte-1bgx6cf"&&(Bl.textContent=Tp),zc=c($e),Il=d($e,"P",{"data-svelte-h":!0}),j(Il)!=="svelte-h6tcr2"&&(Il.innerHTML=Up),Rc=c($e),u(ha.$$.fragment,$e),$e.forEach(h),Ec=c(J),ze=d(J,"DIV",{class:!0});var ut=U(ze);u(is.$$.fragment,ut),Sc=c(ut),Cl=d(ut,"P",{"data-svelte-h":!0}),j(Cl)!=="svelte-9m10k"&&(Cl.innerHTML=xp),Hc=c(ut),u(ga.$$.fragment,ut),ut.forEach(h),Lc=c(J),le=d(J,"DIV",{class:!0});var ye=U(le);u(ds.$$.fragment,ye),Pc=c(ye),Zl=d(ye,"P",{"data-svelte-h":!0}),j(Zl)!=="svelte-xr05jy"&&(Zl.innerHTML=kp),Dc=c(ye),Wl=d(ye,"P",{"data-svelte-h":!0}),j(Wl)!=="svelte-hvuw2l"&&(Wl.innerHTML=Gp),Kc=c(ye),u(ua.$$.fragment,ye),ye.forEach(h),qc=c(J),re=d(J,"DIV",{class:!0});var Me=U(re);u(ms.$$.fragment,Me),Oc=c(Me),Yl=d(Me,"P",{"data-svelte-h":!0}),j(Yl)!=="svelte-111j6q2"&&(Yl.innerHTML=Bp),eo=c(Me),Xl=d(Me,"P",{"data-svelte-h":!0}),j(Xl)!=="svelte-obux0l"&&(Xl.textContent=Ip),to=c(Me),u(fa.$$.fragment,Me),Me.forEach(h),ao=c(J),ne=d(J,"DIV",{class:!0});var je=U(ne);u(hs.$$.fragment,je),so=c(je),Al=d(je,"P",{"data-svelte-h":!0}),j(Al)!=="svelte-1w117kr"&&(Al.textContent=Cp),lo=c(je),Vl=d(je,"P",{"data-svelte-h":!0}),j(Vl)!=="svelte-1l7ede9"&&(Vl.innerHTML=Zp),ro=c(je),u(ba.$$.fragment,je),je.forEach(h),no=c(J),Re=d(J,"DIV",{class:!0});var ft=U(Re);u(gs.$$.fragment,ft),co=c(ft),Nl=d(ft,"P",{"data-svelte-h":!0}),j(Nl)!=="svelte-180l03j"&&(Nl.innerHTML=Wp),oo=c(ft),u($a.$$.fragment,ft),ft.forEach(h),po=c(J),ya=d(J,"DIV",{class:!0});var js=U(ya);u(us.$$.fragment,js),io=c(js),Ql=d(js,"P",{"data-svelte-h":!0}),j(Ql)!=="svelte-1ml1a9c"&&(Ql.innerHTML=Yp),js.forEach(h),mo=c(J),Ee=d(J,"DIV",{class:!0});var bt=U(Ee);u(fs.$$.fragment,bt),ho=c(bt),Fl=d(bt,"P",{"data-svelte-h":!0}),j(Fl)!=="svelte-tmafbn"&&(Fl.textContent=Xp),go=c(bt),u(Ma.$$.fragment,bt),bt.forEach(h),J.forEach(h),Hl=c(s),u(bs.$$.fragment,s),Ll=c(s),He=d(s,"DIV",{class:!0});var ws=U(He);u($s.$$.fragment,ws),uo=c(ws),zl=d(ws,"P",{"data-svelte-h":!0}),j(zl)!=="svelte-11ueuet"&&(zl.textContent=Ap),ws.forEach(h),Pl=c(s),u(ys.$$.fragment,s),Dl=c(s),Rl=d(s,"P",{}),U(Rl).forEach(h),this.h()},h(){x(t,"name","hf:doc:metadata"),x(t,"content",qi),x(we,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(H,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(_e,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(ve,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(Je,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(Te,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(Ue,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(xe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(ke,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(Ge,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(A,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(D,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(K,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(Xt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(V,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(O,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(Be,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(Ie,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(Ce,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(Ze,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(We,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(Ye,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(Xe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(Ae,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(Ve,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(Ne,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(Qe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(te,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(Q,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(I,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(ae,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(Fe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(se,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(ze,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(le,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(re,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(ne,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(Re,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(ya,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(Ee,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(v,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),x(He,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(s,M){l(document.head,t),w(s,m,M),w(s,r,M),w(s,a,M),f(o,s,M),w(s,e,M),w(s,p,M),w(s,El,M),f(ja,s,M),w(s,Sl,M),w(s,v,M),f(wa,v,null),l(v,ql),l(v,_s),l(v,Ol),l(v,vs),l(v,er),l(v,Js),l(v,tr),l(v,we),f(_a,we,null),l(we,ar),l(we,Ts),l(we,sr),f($t,we,null),l(v,lr),l(v,S),f(va,S,null),l(S,rr),l(S,Us),l(S,nr),l(S,xs),l(S,cr),f(yt,S,null),l(v,or),l(v,H),f(Ja,H,null),l(H,pr),l(H,ks),l(H,ir),l(H,Gs),l(H,dr),f(Mt,H,null),l(v,mr),l(v,L),f(Ta,L,null),l(L,hr),l(L,Bs),l(L,gr),l(L,Is),l(L,ur),f(jt,L,null),l(v,fr),l(v,_e),f(Ua,_e,null),l(_e,br),l(_e,Cs),l(_e,$r),f(wt,_e,null),l(v,yr),l(v,ve),f(xa,ve,null),l(ve,Mr),l(ve,Zs),l(ve,jr),f(_t,ve,null),l(v,wr),l(v,Je),f(ka,Je,null),l(Je,_r),l(Je,Ws),l(Je,vr),f(vt,Je,null),l(v,Jr),l(v,Te),f(Ga,Te,null),l(Te,Tr),l(Te,Ys),l(Te,Ur),f(Jt,Te,null),l(v,xr),l(v,Ue),f(Ba,Ue,null),l(Ue,kr),l(Ue,Xs),l(Ue,Gr),f(Tt,Ue,null),l(v,Br),l(v,P),f(Ia,P,null),l(P,Ir),l(P,As),l(P,Cr),l(P,Vs),l(P,Zr),f(Ut,P,null),l(v,Wr),l(v,xe),f(Ca,xe,null),l(xe,Yr),l(xe,Ns),l(xe,Xr),f(xt,xe,null),l(v,Ar),l(v,ke),f(Za,ke,null),l(ke,Vr),l(ke,Qs),l(ke,Nr),f(kt,ke,null),l(v,Qr),l(v,Ge),f(Wa,Ge,null),l(Ge,Fr),l(Ge,Fs),l(Ge,zr),f(Gt,Ge,null),l(v,Rr),l(v,A),f(Ya,A,null),l(A,Er),l(A,zs),l(A,Sr),f(Bt,A,null),l(A,Hr),f(It,A,null),l(A,Lr),f(Ct,A,null),l(v,Pr),l(v,D),f(Xa,D,null),l(D,Dr),l(D,Rs),l(D,Kr),f(Zt,D,null),l(D,qr),f(Wt,D,null),l(v,Or),l(v,K),f(Aa,K,null),l(K,en),l(K,Es),l(K,tn),l(K,Ss),l(K,an),f(Yt,K,null),l(v,sn),l(v,Xt),f(Va,Xt,null),l(Xt,ln),l(Xt,Hs),l(v,rn),l(v,q),f(Na,q,null),l(q,nn),l(q,Ls),l(q,cn),l(q,Ps),l(q,on),f(At,q,null),l(v,pn),l(v,V),f(Qa,V,null),l(V,dn),l(V,Ds),l(V,mn),f(Vt,V,null),l(V,hn),f(Nt,V,null),l(V,gn),f(Qt,V,null),l(v,un),l(v,O),f(Fa,O,null),l(O,fn),l(O,Ks),l(O,bn),l(O,qs),l(O,$n),f(Ft,O,null),l(v,yn),l(v,Be),f(za,Be,null),l(Be,Mn),l(Be,Os),l(Be,jn),f(zt,Be,null),l(v,wn),l(v,Ie),f(Ra,Ie,null),l(Ie,_n),l(Ie,el),l(Ie,vn),f(Rt,Ie,null),l(v,Jn),l(v,Ce),f(Ea,Ce,null),l(Ce,Tn),l(Ce,tl),l(Ce,Un),f(Et,Ce,null),l(v,xn),l(v,Ze),f(Sa,Ze,null),l(Ze,kn),l(Ze,al),l(Ze,Gn),f(St,Ze,null),l(v,Bn),l(v,We),f(Ha,We,null),l(We,In),l(We,sl),l(We,Cn),f(Ht,We,null),l(v,Zn),l(v,Ye),f(La,Ye,null),l(Ye,Wn),l(Ye,ll),l(Ye,Yn),f(Lt,Ye,null),l(v,Xn),l(v,N),f(Pa,N,null),l(N,An),l(N,rl),l(N,Vn),f(Pt,N,null),l(N,Nn),f(Dt,N,null),l(N,Qn),f(Kt,N,null),l(v,Fn),l(v,Xe),f(Da,Xe,null),l(Xe,zn),l(Xe,nl),l(Xe,Rn),f(qt,Xe,null),l(v,En),l(v,Ae),f(Ka,Ae,null),l(Ae,Sn),l(Ae,cl),l(Ae,Hn),f(Ot,Ae,null),l(v,Ln),l(v,Ve),f(qa,Ve,null),l(Ve,Pn),l(Ve,ol),l(Ve,Dn),f(ea,Ve,null),l(v,Kn),l(v,Ne),f(Oa,Ne,null),l(Ne,qn),l(Ne,pl),l(Ne,On),f(ta,Ne,null),l(v,ec),l(v,Qe),f(es,Qe,null),l(Qe,tc),l(Qe,il),l(Qe,ac),f(aa,Qe,null),l(v,sc),l(v,ee),f(ts,ee,null),l(ee,lc),l(ee,dl),l(ee,rc),l(ee,ml),l(ee,nc),f(sa,ee,null),l(v,cc),l(v,te),f(as,te,null),l(te,oc),l(te,hl),l(te,pc),l(te,gl),l(te,ic),f(la,te,null),l(v,dc),l(v,Q),f(ss,Q,null),l(Q,mc),l(Q,ul),l(Q,hc),l(Q,fl),l(Q,gc),f(ra,Q,null),l(Q,uc),f(na,Q,null),l(v,fc),l(v,I),f(ls,I,null),l(I,bc),l(I,bl),l(I,$c),l(I,$l),l(I,yc),l(I,yl),l(I,Mc),l(I,Ml),l(I,jc),f(ca,I,null),l(v,wc),l(v,C),f(rs,C,null),l(C,_c),l(C,jl),l(C,vc),l(C,wl),l(C,Jc),l(C,_l),l(C,Tc),l(C,vl),l(C,Uc),f(oa,C,null),l(v,xc),l(v,ae),f(ns,ae,null),l(ae,kc),l(ae,Jl),l(ae,Gc),l(ae,Tl),l(ae,Bc),f(pa,ae,null),l(v,Ic),l(v,Fe),f(cs,Fe,null),l(Fe,Cc),l(Fe,Ul),l(Fe,Zc),f(ia,Fe,null),l(v,Wc),l(v,Z),f(os,Z,null),l(Z,Yc),l(Z,xl),l(Z,Xc),l(Z,kl),l(Z,Ac),l(Z,Gl),l(Z,Vc),f(da,Z,null),l(Z,Nc),f(ma,Z,null),l(v,Qc),l(v,se),f(ps,se,null),l(se,Fc),l(se,Bl),l(se,zc),l(se,Il),l(se,Rc),f(ha,se,null),l(v,Ec),l(v,ze),f(is,ze,null),l(ze,Sc),l(ze,Cl),l(ze,Hc),f(ga,ze,null),l(v,Lc),l(v,le),f(ds,le,null),l(le,Pc),l(le,Zl),l(le,Dc),l(le,Wl),l(le,Kc),f(ua,le,null),l(v,qc),l(v,re),f(ms,re,null),l(re,Oc),l(re,Yl),l(re,eo),l(re,Xl),l(re,to),f(fa,re,null),l(v,ao),l(v,ne),f(hs,ne,null),l(ne,so),l(ne,Al),l(ne,lo),l(ne,Vl),l(ne,ro),f(ba,ne,null),l(v,no),l(v,Re),f(gs,Re,null),l(Re,co),l(Re,Nl),l(Re,oo),f($a,Re,null),l(v,po),l(v,ya),f(us,ya,null),l(ya,io),l(ya,Ql),l(v,mo),l(v,Ee),f(fs,Ee,null),l(Ee,ho),l(Ee,Fl),l(Ee,go),f(Ma,Ee,null),w(s,Hl,M),f(bs,s,M),w(s,Ll,M),w(s,He,M),f($s,He,null),l(He,uo),l(He,zl),w(s,Pl,M),f(ys,s,M),w(s,Dl,M),w(s,Rl,M),Kl=!0},p(s,[M]){const J={};M&2&&(J.$$scope={dirty:M,ctx:s}),$t.$set(J);const Le={};M&2&&(Le.$$scope={dirty:M,ctx:s}),yt.$set(Le);const ce={};M&2&&(ce.$$scope={dirty:M,ctx:s}),Mt.$set(ce);const oe={};M&2&&(oe.$$scope={dirty:M,ctx:s}),jt.$set(oe);const pe={};M&2&&(pe.$$scope={dirty:M,ctx:s}),wt.$set(pe);const Pe={};M&2&&(Pe.$$scope={dirty:M,ctx:s}),_t.$set(Pe);const De={};M&2&&(De.$$scope={dirty:M,ctx:s}),vt.$set(De);const Ke={};M&2&&(Ke.$$scope={dirty:M,ctx:s}),Jt.$set(Ke);const qe={};M&2&&(qe.$$scope={dirty:M,ctx:s}),Tt.$set(qe);const Oe={};M&2&&(Oe.$$scope={dirty:M,ctx:s}),Ut.$set(Oe);const ie={};M&2&&(ie.$$scope={dirty:M,ctx:s}),xt.$set(ie);const et={};M&2&&(et.$$scope={dirty:M,ctx:s}),kt.$set(et);const tt={};M&2&&(tt.$$scope={dirty:M,ctx:s}),Gt.$set(tt);const at={};M&2&&(at.$$scope={dirty:M,ctx:s}),Bt.$set(at);const F={};M&2&&(F.$$scope={dirty:M,ctx:s}),It.$set(F);const de={};M&2&&(de.$$scope={dirty:M,ctx:s}),Ct.$set(de);const me={};M&2&&(me.$$scope={dirty:M,ctx:s}),Zt.$set(me);const Ms={};M&2&&(Ms.$$scope={dirty:M,ctx:s}),Wt.$set(Ms);const he={};M&2&&(he.$$scope={dirty:M,ctx:s}),Yt.$set(he);const z={};M&2&&(z.$$scope={dirty:M,ctx:s}),At.$set(z);const ge={};M&2&&(ge.$$scope={dirty:M,ctx:s}),Vt.$set(ge);const st={};M&2&&(st.$$scope={dirty:M,ctx:s}),Nt.$set(st);const lt={};M&2&&(lt.$$scope={dirty:M,ctx:s}),Qt.$set(lt);const rt={};M&2&&(rt.$$scope={dirty:M,ctx:s}),Ft.$set(rt);const nt={};M&2&&(nt.$$scope={dirty:M,ctx:s}),zt.$set(nt);const ct={};M&2&&(ct.$$scope={dirty:M,ctx:s}),Rt.$set(ct);const ot={};M&2&&(ot.$$scope={dirty:M,ctx:s}),Et.$set(ot);const R={};M&2&&(R.$$scope={dirty:M,ctx:s}),St.$set(R);const pt={};M&2&&(pt.$$scope={dirty:M,ctx:s}),Ht.$set(pt);const it={};M&2&&(it.$$scope={dirty:M,ctx:s}),Lt.$set(it);const dt={};M&2&&(dt.$$scope={dirty:M,ctx:s}),Pt.$set(dt);const mt={};M&2&&(mt.$$scope={dirty:M,ctx:s}),Dt.$set(mt);const ht={};M&2&&(ht.$$scope={dirty:M,ctx:s}),Kt.$set(ht);const ue={};M&2&&(ue.$$scope={dirty:M,ctx:s}),qt.$set(ue);const fe={};M&2&&(fe.$$scope={dirty:M,ctx:s}),Ot.$set(fe);const E={};M&2&&(E.$$scope={dirty:M,ctx:s}),ea.$set(E);const W={};M&2&&(W.$$scope={dirty:M,ctx:s}),ta.$set(W);const Y={};M&2&&(Y.$$scope={dirty:M,ctx:s}),aa.$set(Y);const be={};M&2&&(be.$$scope={dirty:M,ctx:s}),sa.$set(be);const gt={};M&2&&(gt.$$scope={dirty:M,ctx:s}),la.$set(gt);const X={};M&2&&(X.$$scope={dirty:M,ctx:s}),ra.$set(X);const $e={};M&2&&($e.$$scope={dirty:M,ctx:s}),na.$set($e);const ut={};M&2&&(ut.$$scope={dirty:M,ctx:s}),ca.$set(ut);const ye={};M&2&&(ye.$$scope={dirty:M,ctx:s}),oa.$set(ye);const Me={};M&2&&(Me.$$scope={dirty:M,ctx:s}),pa.$set(Me);const je={};M&2&&(je.$$scope={dirty:M,ctx:s}),ia.$set(je);const ft={};M&2&&(ft.$$scope={dirty:M,ctx:s}),da.$set(ft);const js={};M&2&&(js.$$scope={dirty:M,ctx:s}),ma.$set(js);const bt={};M&2&&(bt.$$scope={dirty:M,ctx:s}),ha.$set(bt);const ws={};M&2&&(ws.$$scope={dirty:M,ctx:s}),ga.$set(ws);const Vp={};M&2&&(Vp.$$scope={dirty:M,ctx:s}),ua.$set(Vp);const Np={};M&2&&(Np.$$scope={dirty:M,ctx:s}),fa.$set(Np);const Qp={};M&2&&(Qp.$$scope={dirty:M,ctx:s}),ba.$set(Qp);const Fp={};M&2&&(Fp.$$scope={dirty:M,ctx:s}),$a.$set(Fp);const zp={};M&2&&(zp.$$scope={dirty:M,ctx:s}),Ma.$set(zp)},i(s){Kl||(b(o.$$.fragment,s),b(ja.$$.fragment,s),b(wa.$$.fragment,s),b(_a.$$.fragment,s),b($t.$$.fragment,s),b(va.$$.fragment,s),b(yt.$$.fragment,s),b(Ja.$$.fragment,s),b(Mt.$$.fragment,s),b(Ta.$$.fragment,s),b(jt.$$.fragment,s),b(Ua.$$.fragment,s),b(wt.$$.fragment,s),b(xa.$$.fragment,s),b(_t.$$.fragment,s),b(ka.$$.fragment,s),b(vt.$$.fragment,s),b(Ga.$$.fragment,s),b(Jt.$$.fragment,s),b(Ba.$$.fragment,s),b(Tt.$$.fragment,s),b(Ia.$$.fragment,s),b(Ut.$$.fragment,s),b(Ca.$$.fragment,s),b(xt.$$.fragment,s),b(Za.$$.fragment,s),b(kt.$$.fragment,s),b(Wa.$$.fragment,s),b(Gt.$$.fragment,s),b(Ya.$$.fragment,s),b(Bt.$$.fragment,s),b(It.$$.fragment,s),b(Ct.$$.fragment,s),b(Xa.$$.fragment,s),b(Zt.$$.fragment,s),b(Wt.$$.fragment,s),b(Aa.$$.fragment,s),b(Yt.$$.fragment,s),b(Va.$$.fragment,s),b(Na.$$.fragment,s),b(At.$$.fragment,s),b(Qa.$$.fragment,s),b(Vt.$$.fragment,s),b(Nt.$$.fragment,s),b(Qt.$$.fragment,s),b(Fa.$$.fragment,s),b(Ft.$$.fragment,s),b(za.$$.fragment,s),b(zt.$$.fragment,s),b(Ra.$$.fragment,s),b(Rt.$$.fragment,s),b(Ea.$$.fragment,s),b(Et.$$.fragment,s),b(Sa.$$.fragment,s),b(St.$$.fragment,s),b(Ha.$$.fragment,s),b(Ht.$$.fragment,s),b(La.$$.fragment,s),b(Lt.$$.fragment,s),b(Pa.$$.fragment,s),b(Pt.$$.fragment,s),b(Dt.$$.fragment,s),b(Kt.$$.fragment,s),b(Da.$$.fragment,s),b(qt.$$.fragment,s),b(Ka.$$.fragment,s),b(Ot.$$.fragment,s),b(qa.$$.fragment,s),b(ea.$$.fragment,s),b(Oa.$$.fragment,s),b(ta.$$.fragment,s),b(es.$$.fragment,s),b(aa.$$.fragment,s),b(ts.$$.fragment,s),b(sa.$$.fragment,s),b(as.$$.fragment,s),b(la.$$.fragment,s),b(ss.$$.fragment,s),b(ra.$$.fragment,s),b(na.$$.fragment,s),b(ls.$$.fragment,s),b(ca.$$.fragment,s),b(rs.$$.fragment,s),b(oa.$$.fragment,s),b(ns.$$.fragment,s),b(pa.$$.fragment,s),b(cs.$$.fragment,s),b(ia.$$.fragment,s),b(os.$$.fragment,s),b(da.$$.fragment,s),b(ma.$$.fragment,s),b(ps.$$.fragment,s),b(ha.$$.fragment,s),b(is.$$.fragment,s),b(ga.$$.fragment,s),b(ds.$$.fragment,s),b(ua.$$.fragment,s),b(ms.$$.fragment,s),b(fa.$$.fragment,s),b(hs.$$.fragment,s),b(ba.$$.fragment,s),b(gs.$$.fragment,s),b($a.$$.fragment,s),b(us.$$.fragment,s),b(fs.$$.fragment,s),b(Ma.$$.fragment,s),b(bs.$$.fragment,s),b($s.$$.fragment,s),b(ys.$$.fragment,s),Kl=!0)},o(s){$(o.$$.fragment,s),$(ja.$$.fragment,s),$(wa.$$.fragment,s),$(_a.$$.fragment,s),$($t.$$.fragment,s),$(va.$$.fragment,s),$(yt.$$.fragment,s),$(Ja.$$.fragment,s),$(Mt.$$.fragment,s),$(Ta.$$.fragment,s),$(jt.$$.fragment,s),$(Ua.$$.fragment,s),$(wt.$$.fragment,s),$(xa.$$.fragment,s),$(_t.$$.fragment,s),$(ka.$$.fragment,s),$(vt.$$.fragment,s),$(Ga.$$.fragment,s),$(Jt.$$.fragment,s),$(Ba.$$.fragment,s),$(Tt.$$.fragment,s),$(Ia.$$.fragment,s),$(Ut.$$.fragment,s),$(Ca.$$.fragment,s),$(xt.$$.fragment,s),$(Za.$$.fragment,s),$(kt.$$.fragment,s),$(Wa.$$.fragment,s),$(Gt.$$.fragment,s),$(Ya.$$.fragment,s),$(Bt.$$.fragment,s),$(It.$$.fragment,s),$(Ct.$$.fragment,s),$(Xa.$$.fragment,s),$(Zt.$$.fragment,s),$(Wt.$$.fragment,s),$(Aa.$$.fragment,s),$(Yt.$$.fragment,s),$(Va.$$.fragment,s),$(Na.$$.fragment,s),$(At.$$.fragment,s),$(Qa.$$.fragment,s),$(Vt.$$.fragment,s),$(Nt.$$.fragment,s),$(Qt.$$.fragment,s),$(Fa.$$.fragment,s),$(Ft.$$.fragment,s),$(za.$$.fragment,s),$(zt.$$.fragment,s),$(Ra.$$.fragment,s),$(Rt.$$.fragment,s),$(Ea.$$.fragment,s),$(Et.$$.fragment,s),$(Sa.$$.fragment,s),$(St.$$.fragment,s),$(Ha.$$.fragment,s),$(Ht.$$.fragment,s),$(La.$$.fragment,s),$(Lt.$$.fragment,s),$(Pa.$$.fragment,s),$(Pt.$$.fragment,s),$(Dt.$$.fragment,s),$(Kt.$$.fragment,s),$(Da.$$.fragment,s),$(qt.$$.fragment,s),$(Ka.$$.fragment,s),$(Ot.$$.fragment,s),$(qa.$$.fragment,s),$(ea.$$.fragment,s),$(Oa.$$.fragment,s),$(ta.$$.fragment,s),$(es.$$.fragment,s),$(aa.$$.fragment,s),$(ts.$$.fragment,s),$(sa.$$.fragment,s),$(as.$$.fragment,s),$(la.$$.fragment,s),$(ss.$$.fragment,s),$(ra.$$.fragment,s),$(na.$$.fragment,s),$(ls.$$.fragment,s),$(ca.$$.fragment,s),$(rs.$$.fragment,s),$(oa.$$.fragment,s),$(ns.$$.fragment,s),$(pa.$$.fragment,s),$(cs.$$.fragment,s),$(ia.$$.fragment,s),$(os.$$.fragment,s),$(da.$$.fragment,s),$(ma.$$.fragment,s),$(ps.$$.fragment,s),$(ha.$$.fragment,s),$(is.$$.fragment,s),$(ga.$$.fragment,s),$(ds.$$.fragment,s),$(ua.$$.fragment,s),$(ms.$$.fragment,s),$(fa.$$.fragment,s),$(hs.$$.fragment,s),$(ba.$$.fragment,s),$(gs.$$.fragment,s),$($a.$$.fragment,s),$(us.$$.fragment,s),$(fs.$$.fragment,s),$(Ma.$$.fragment,s),$(bs.$$.fragment,s),$($s.$$.fragment,s),$(ys.$$.fragment,s),Kl=!1},d(s){s&&(h(m),h(r),h(a),h(e),h(p),h(El),h(Sl),h(v),h(Hl),h(Ll),h(He),h(Pl),h(Dl),h(Rl)),h(t),y(o,s),y(ja,s),y(wa),y(_a),y($t),y(va),y(yt),y(Ja),y(Mt),y(Ta),y(jt),y(Ua),y(wt),y(xa),y(_t),y(ka),y(vt),y(Ga),y(Jt),y(Ba),y(Tt),y(Ia),y(Ut),y(Ca),y(xt),y(Za),y(kt),y(Wa),y(Gt),y(Ya),y(Bt),y(It),y(Ct),y(Xa),y(Zt),y(Wt),y(Aa),y(Yt),y(Va),y(Na),y(At),y(Qa),y(Vt),y(Nt),y(Qt),y(Fa),y(Ft),y(za),y(zt),y(Ra),y(Rt),y(Ea),y(Et),y(Sa),y(St),y(Ha),y(Ht),y(La),y(Lt),y(Pa),y(Pt),y(Dt),y(Kt),y(Da),y(qt),y(Ka),y(Ot),y(qa),y(ea),y(Oa),y(ta),y(es),y(aa),y(ts),y(sa),y(as),y(la),y(ss),y(ra),y(na),y(ls),y(ca),y(rs),y(oa),y(ns),y(pa),y(cs),y(ia),y(os),y(da),y(ma),y(ps),y(ha),y(is),y(ga),y(ds),y(ua),y(ms),y(fa),y(hs),y(ba),y(gs),y($a),y(us),y(fs),y(Ma),y(bs,s),y($s),y(ys,s)}}}const qi='{"title":"Accelerator","local":"accelerator","sections":[{"title":"Accelerator","local":"api ][ accelerate.Accelerator","sections":[],"depth":2},{"title":"Utilities","local":"accelerate.utils.gather_object","sections":[],"depth":2}],"depth":1}';function Oi(_){return Ep(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class cd extends Sp{constructor(t){super(),Hp(this,t,Oi,Ki,Rp,{})}}export{cd as component};
