import{s as Sp,o as Hp,n as T}from"../chunks/scheduler.b9285784.js";import{S as Lp,i as Pp,e as i,s as n,c as g,h as Dp,a as d,d as h,b as c,f as U,g as u,j,k as x,l,m as w,n as f,t as b,o as $,p as y}from"../chunks/index.26bc89a1.js";import{T as Se}from"../chunks/Tip.e4eba3d6.js";import{C as Kp,H as $o,E as qp}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.7242ff19.js";import{D as k}from"../chunks/Docstring.9ffdb58c.js";import{C as B}from"../chunks/CodeBlock.c8ee1711.js";import{E as G}from"../chunks/ExampleCodeBlock.89d3b91e.js";function Op(_){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 ei(_){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 ti(_){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 ai(_){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 si(_){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 li(_){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 ri(_){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 ni(_){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 ci(_){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 oi(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"JTIzJTIwQXNzdW1pbmclMjBmb3VyJTIwcHJvY2Vzc2VzJTBBaW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwYWNjZWxlcmF0ZSUyMGltcG9ydCUyMEFjY2VsZXJhdG9yJTBBJTBBYWNjZWxlcmF0b3IlMjAlM0QlMjBBY2NlbGVyYXRvcigpJTBBcHJvY2Vzc190ZW5zb3IlMjAlM0QlMjB0b3JjaC50ZW5zb3IoJTVCYWNjZWxlcmF0b3IucHJvY2Vzc19pbmRleCU1RCUyQyUyMGRldmljZSUzRGFjY2VsZXJhdG9yLmRldmljZSklMEFnYXRoZXJlZF90ZW5zb3IlMjAlM0QlMjBhY2NlbGVyYXRvci5nYXRoZXIocHJvY2Vzc190ZW5zb3IpJTBBZ2F0aGVyZWRfdGVuc29y",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], device=accelerator.device)
<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 pi(_){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 ii(_){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 di(_){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 mi(_){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 hi(_){let t,m="Overriding <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-1ueogj7"&&(t.innerHTML=m)},m(r,a){w(r,t,a)},p:T,d(r){r&&h(t)}}}function gi(_){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 ui(_){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 fi(_){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 bi(_){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 $i(_){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 yi(_){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 Mi(_){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 ji(_){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 wi(_){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 _i(_){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 vi(_){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 Ji(_){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 Ti(_){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 Ui(_){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 xi(_){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 ki(_){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 Gi(_){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 Bi(_){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 Ci(_){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 Ii(_){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 Zi(_){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 Wi(_){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 Yi(_){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 Xi(_){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 Ai(_){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 Ni(_){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 Vi(_){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 Qi(_){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 Fi(_){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 zi(_){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 Ri(_){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 Ei(_){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 Si(_){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 Hi(_){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 Li(_){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 Pi(_){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 Di(_){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 Ki(_){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 qi(_){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 Oi(_){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 ed(_){let t,m,r,a,o,e,p,Sl,ja,yo='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.',Hl,wa,Ll,v,_a,er,vs,Mo="Creates an instance of an accelerator for distributed training or mixed precision training.",tr,Js,jo="<strong>Available attributes:</strong>",ar,Ts,wo=`<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>`,sr,we,va,lr,Us,_o="A context manager that will lightly wrap around and perform gradient accumulation automatically",rr,$t,nr,S,Ja,cr,xs,vo=`Will apply automatic mixed-precision inside the block inside this context manager, if it is enabled. Nothing
different will happen otherwise.`,or,ks,Jo=`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.`,pr,yt,ir,H,Ta,dr,Gs,To=`Scales the gradients in accordance to the <code>GradientAccumulationPlugin</code> and calls the correct <code>backward()</code> based
on the configuration.`,mr,Bs,Uo="Should be used in lieu of <code>loss.backward()</code>.",hr,Mt,gr,L,Ua,ur,Cs,xo=`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.`,fr,Is,ko=`Note:
Does not require <code>wait_for_everyone()</code>`,br,jt,$r,_e,xa,yr,Zs,Go=`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.`,Mr,wt,jr,ve,ka,wr,Ws,Bo="Should be used in place of <code>torch.nn.utils.clip_grad_norm_</code>.",_r,_t,vr,Je,Ga,Jr,Ys,Co="Should be used in place of <code>torch.nn.utils.clip_grad_value_</code>.",Tr,vt,Ur,Te,Ba,xr,Xs,Io=`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.`,kr,Jt,Gr,Ue,Ca,Br,As,Zo=`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.`,Cr,Tt,Ir,P,Ia,Zr,Ns,Wo=`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.`,Wr,Vs,Yo=`Note:
This gather happens in all processes.`,Yr,Ut,Xr,xe,Za,Ar,Qs,Xo=`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.`,Nr,xt,Vr,ke,Wa,Qr,Fs,Ao=`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.`,Fr,kt,zr,Ge,Ya,Rr,zs,No="Returns a <code>tracker</code> from <code>self.trackers</code> based on <code>name</code> on the main process only.",Er,Gt,Sr,A,Xa,Hr,Rs,Vo=`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.`,Lr,Bt,Pr,Ct,Dr,It,Kr,D,Aa,qr,Es,Qo="Loads the current states of the model, optimizer, scaler, RNG generators, and registered objects.",Or,Zt,en,Wt,tn,K,Na,an,Ss,Fo="Lets the local main process go inside a with block.",sn,Hs,zo="The other processes will enter the with block after the main process exits.",ln,Yt,rn,Xt,Va,nn,Ls,Ro="Runs backward pass on LOMO optimizers.",cn,q,Qa,on,Ps,Eo="Lets the main process go first inside a with block.",pn,Ds,So="The other processes will enter the with block after the main process exits.",dn,At,mn,N,Fa,hn,Ks,Ho="A context manager that enables context parallel training.",gn,Nt,un,Vt,fn,Qt,bn,O,za,$n,qs,Lo=`A context manager to disable gradient synchronizations across DDP processes by calling
<code>torch.nn.parallel.DistributedDataParallel.no_sync</code>.`,yn,Os,Po="If <code>model</code> is not in DDP, this context manager does nothing",Mn,Ft,jn,Be,Ra,wn,el,Do=`A decorator that will run the decorated function on the last process only. Can also be called using the
<code>PartialState</code> class.`,_n,zt,vn,Ce,Ea,Jn,tl,Ko=`A decorator that will run the decorated function on the local main process only. Can also be called using the
<code>PartialState</code> class.`,Tn,Rt,Un,Ie,Sa,xn,al,qo=`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.`,kn,Et,Gn,Ze,Ha,Bn,sl,Oo=`A decorator that will run the decorated function on the main process only. Can also be called using the
<code>PartialState</code> class.`,Cn,St,In,We,La,Zn,ll,ep=`A decorator that will run the decorated function on a given process index only. Can also be called using the
<code>PartialState</code> class.`,Wn,Ht,Yn,Ye,Pa,Xn,rl,tp=`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.`,An,Lt,Nn,V,Da,Vn,nl,ap=`Prepare all objects passed in <code>args</code> for distributed training and mixed precision, then return them in the same
order.`,Qn,Pt,Fn,Dt,zn,Kt,Rn,Xe,Ka,En,cl,sp=`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.`,Sn,qt,Hn,Ae,qa,Ln,ol,lp=`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.`,Pn,Ot,Dn,Ne,Oa,Kn,pl,rp=`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.`,qn,ea,On,Ve,es,ec,il,np=`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.`,tc,ta,ac,Qe,ts,sc,dl,cp="Drop in replacement of <code>print()</code> to only print once per server.",lc,aa,rc,ee,as,nc,ml,op=`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.`,cc,hl,pp="A different <code>profile_handler</code> can be passed in to override the one set in the <code>Accelerator</code> object.",oc,sa,pc,te,ss,ic,gl,ip="Reduce the values in <em>tensor</em> across all processes based on <em>reduction</em>.",dc,ul,dp=`Note:
All processes get the reduced value.`,mc,la,hc,Q,ls,gc,fl,mp="Makes note of <code>objects</code> and will save or load them in during <code>save_state</code> or <code>load_state</code>.",uc,bl,hp=`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.`,fc,ra,bc,na,$c,C,rs,yc,$l,gp='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>.',Mc,yl,up="The hook should have the following signature:",jc,Ml,fp="<code>hook(models: list[torch.nn.Module], input_dir: str) -&gt; None</code>",wc,jl,bp=`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>.`,_c,ca,vc,I,ns,Jc,wl,$p='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>.',Tc,_l,yp="The hook should have the following signature:",Uc,vl,Mp="<code>hook(models: list[torch.nn.Module], weights: list[dict[str, torch.Tensor]], input_dir: str) -&gt; None</code>",xc,Jl,jp=`The <code>models</code> argument are the models as saved in the accelerator state under <code>accelerator._models</code>, <code>weights</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>.`,kc,oa,Gc,ae,cs,Bc,Tl,wp="Save the object passed to disk once per machine. Use in place of <code>torch.save</code>.",Cc,Ul,_p=`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.`,Ic,pa,Zc,Fe,os,Wc,xl,vp="Save a model so that it can be re-loaded using load_checkpoint_in_model",Yc,ia,Xc,Z,ps,Ac,kl,Jp="Saves the current states of the model, optimizer, scaler, RNG generators, and registered objects to a folder.",Nc,Gl,Tp=`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>.`,Vc,Bl,Up="Otherwise they are just saved to <code>output_dir</code>.",Qc,da,Fc,ma,zc,se,is,Rc,Cl,xp=`Sets the internal trigger tensor to 1 on the current process. A latter check should follow using this which
will check across all processes.`,Ec,Il,kp=`Note:
Does not require <code>wait_for_everyone()</code>`,Sc,ha,Hc,ze,ds,Lc,Zl,Gp="Creates a new <code>torch.utils.data.DataLoader</code> that will efficiently skip the first <code>num_batches</code>.",Pc,ga,Dc,le,ms,Kc,Wl,Bp=`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.`,qc,Yl,Cp="Note that when using a <code>dict</code>, all keys need to have the same number of elements.",Oc,ua,eo,re,hs,to,Xl,Ip=`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).`,ao,Al,Zp="If the script is not launched in distributed mode, this context manager does nothing.",so,fa,lo,ne,gs,ro,Nl,Wp="Unscale the gradients in mixed precision training with AMP. This is a noop in all other settings.",no,Vl,Yp='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>',co,ba,oo,Re,us,po,Ql,Xp=`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.`,io,$a,mo,ya,fs,ho,Fl,Ap="Verifies that <code>model</code> has not been prepared with big model inference with a device-map resembling <code>auto</code>.",go,Ee,bs,uo,zl,Np=`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.`,fo,Ma,Pl,$s,Dl,He,ys,bo,Rl,Vp="Recursively gather object in a nested list/tuple/dictionary of objects from all devices.",Kl,Ms,ql,El,Ol;return o=new Kp({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),p=new $o({props:{title:"Accelerator",local:"accelerator",headingTag:"h1"}}),wa=new $o({props:{title:"Accelerator",local:"api ][ accelerate.Accelerator",headingTag:"h2"}}),_a=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 0x7f4f02c726b0>"},{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/deepspeed#accelerate.DeepSpeedPlugin">DeepSpeedPlugin</a> or dict of <code>str</code> &#x2014; <a href="/docs/accelerate/main/en/package_reference/deepspeed#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#L183"}}),va=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#L1253"}}),$t=new G({props:{anchor:"accelerate.Accelerator.accumulate.example",$$slots:{default:[Op]},$$scope:{ctx:_}}}),Ja=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#L4051"}}),yt=new G({props:{anchor:"accelerate.Accelerator.autocast.example",$$slots:{default:[ei]},$$scope:{ctx:_}}}),Ta=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#L2708"}}),Mt=new G({props:{anchor:"accelerate.Accelerator.backward.example",$$slots:{default:[ti]},$$scope:{ctx:_}}}),Ua=new k({props:{name:"check_trigger",anchor:"accelerate.Accelerator.check_trigger",parameters:[],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L2768"}}),jt=new G({props:{anchor:"accelerate.Accelerator.check_trigger.example",$$slots:{default:[ai]},$$scope:{ctx:_}}}),xa=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#L3814"}}),wt=new G({props:{anchor:"accelerate.Accelerator.clear.example",$$slots:{default:[si]},$$scope:{ctx:_}}}),ka=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#L2836",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:[li]},$$scope:{ctx:_}}}),Ga=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#L2899"}}),vt=new G({props:{anchor:"accelerate.Accelerator.clip_grad_value_.example",$$slots:{default:[ri]},$$scope:{ctx:_}}}),Ba=new k({props:{name:"end_training",anchor:"accelerate.Accelerator.end_training",parameters:[],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L3273"}}),Jt=new G({props:{anchor:"accelerate.Accelerator.end_training.example",$$slots:{default:[ni]},$$scope:{ctx:_}}}),Ca=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#L3785"}}),Tt=new G({props:{anchor:"accelerate.Accelerator.free_memory.example",$$slots:{default:[ci]},$$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#L2926",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:[oi]},$$scope:{ctx:_}}}),Za=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#L2958"}}),xt=new G({props:{anchor:"accelerate.Accelerator.gather_for_metrics.example",$$slots:{default:[pi]},$$scope:{ctx:_}}}),Wa=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#L3881",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:[ii]},$$scope:{ctx:_}}}),Ya=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#L3211",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:[di]},$$scope:{ctx:_}}}),Xa=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#L1298"}}),Bt=new Se({props:{warning:!0,$$slots:{default:[mi]},$$scope:{ctx:_}}}),Ct=new Se({props:{warning:!0,$$slots:{default:[hi]},$$scope:{ctx:_}}}),It=new G({props:{anchor:"accelerate.Accelerator.join_uneven_inputs.example",$$slots:{default:[gi]},$$scope:{ctx:_}}}),Aa=new k({props:{name:"load_state",anchor:"accelerate.Accelerator.load_state",parameters:[{name:"input_dir",val:": str | None = 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#L3633"}}),Zt=new Se({props:{$$slots:{default:[ui]},$$scope:{ctx:_}}}),Wt=new G({props:{anchor:"accelerate.Accelerator.load_state.example",$$slots:{default:[fi]},$$scope:{ctx:_}}}),Na=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#L1108"}}),Yt=new G({props:{anchor:"accelerate.Accelerator.local_main_process_first.example",$$slots:{default:[bi]},$$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#L4194"}}),Qa=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#L1086"}}),At=new G({props:{anchor:"accelerate.Accelerator.main_process_first.example",$$slots:{default:[$i]},$$scope:{ctx:_}}}),Fa=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#L3988"}}),Nt=new Se({props:{warning:!0,$$slots:{default:[yi]},$$scope:{ctx:_}}}),Vt=new Se({props:{warning:!0,$$slots:{default:[Mi]},$$scope:{ctx:_}}}),Qt=new G({props:{anchor:"accelerate.Accelerator.maybe_context_parallel.example",$$slots:{default:[ji]},$$scope:{ctx:_}}}),za=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#L1130"}}),Ft=new G({props:{anchor:"accelerate.Accelerator.no_sync.example",$$slots:{default:[wi]},$$scope:{ctx:_}}}),Ra=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#L954"}}),zt=new G({props:{anchor:"accelerate.Accelerator.on_last_process.example",$$slots:{default:[_i]},$$scope:{ctx:_}}}),Ea=new k({props:{name:"on_local_main_process",anchor:"accelerate.Accelerator.on_local_main_process",parameters:[{name:"function",val:": Callable[..., Any] | None = 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#L912"}}),Rt=new G({props:{anchor:"accelerate.Accelerator.on_local_main_process.example",$$slots:{default:[vi]},$$scope:{ctx:_}}}),Sa=new k({props:{name:"on_local_process",anchor:"accelerate.Accelerator.on_local_process",parameters:[{name:"function",val:": Callable[..., Any] | None = None"},{name:"local_process_index",val:": int | None = 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#L1038"}}),Et=new G({props:{anchor:"accelerate.Accelerator.on_local_process.example",$$slots:{default:[Ji]},$$scope:{ctx:_}}}),Ha=new k({props:{name:"on_main_process",anchor:"accelerate.Accelerator.on_main_process",parameters:[{name:"function",val:": Callable[..., Any] | None = 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#L873"}}),St=new G({props:{anchor:"accelerate.Accelerator.on_main_process.example",$$slots:{default:[Ti]},$$scope:{ctx:_}}}),La=new k({props:{name:"on_process",anchor:"accelerate.Accelerator.on_process",parameters:[{name:"function",val:": Callable[..., Any] | None = None"},{name:"process_index",val:": int | None = 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#L993"}}),Ht=new G({props:{anchor:"accelerate.Accelerator.on_process.example",$$slots:{default:[Ui]},$$scope:{ctx:_}}}),Pa=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#L3067",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:[xi]},$$scope:{ctx:_}}}),Da=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#L1413"}}),Pt=new Se({props:{$$slots:{default:[ki]},$$scope:{ctx:_}}}),Dt=new G({props:{anchor:"accelerate.Accelerator.prepare.example",$$slots:{default:[Gi]},$$scope:{ctx:_}}}),Kt=new G({props:{anchor:"accelerate.Accelerator.prepare.example-2",$$slots:{default:[Bi]},$$scope:{ctx:_}}}),Ka=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#L2564"}}),qt=new G({props:{anchor:"accelerate.Accelerator.prepare_data_loader.example",$$slots:{default:[Ci]},$$scope:{ctx:_}}}),qa=new k({props:{name:"prepare_model",anchor:"accelerate.Accelerator.prepare_model",parameters:[{name:"model",val:": torch.nn.Module"},{name:"device_placement",val:": bool | None = 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#L1707"}}),Ot=new G({props:{anchor:"accelerate.Accelerator.prepare_model.example",$$slots:{default:[Ii]},$$scope:{ctx:_}}}),Oa=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#L2623"}}),ea=new G({props:{anchor:"accelerate.Accelerator.prepare_optimizer.example",$$slots:{default:[Zi]},$$scope:{ctx:_}}}),es=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#L2667"}}),ta=new G({props:{anchor:"accelerate.Accelerator.prepare_scheduler.example",$$slots:{default:[Wi]},$$scope:{ctx:_}}}),ts=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#L1381"}}),aa=new G({props:{anchor:"accelerate.Accelerator.print.example",$$slots:{default:[Yi]},$$scope:{ctx:_}}}),as=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#L4076"}}),sa=new G({props:{anchor:"accelerate.Accelerator.profile.example",$$slots:{default:[Xi]},$$scope:{ctx:_}}}),ss=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 valid on XLA.`,name:"scale"}],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L3031",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:[Ai]},$$scope:{ctx:_}}}),ls=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#L3952"}}),ra=new Se({props:{$$slots:{default:[Ni]},$$scope:{ctx:_}}}),na=new G({props:{anchor:"accelerate.Accelerator.register_for_checkpointing.example",$$slots:{default:[Vi]},$$scope:{ctx:_}}}),rs=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#L3602",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:[Qi]},$$scope:{ctx:_}}}),ns=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#L3435",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:[Fi]},$$scope:{ctx:_}}}),cs=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#L3294"}}),pa=new G({props:{anchor:"accelerate.Accelerator.save.example",$$slots:{default:[zi]},$$scope:{ctx:_}}}),os=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 unwrapped.`,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#L3324"}}),ia=new G({props:{anchor:"accelerate.Accelerator.save_model.example",$$slots:{default:[Ri]},$$scope:{ctx:_}}}),ps=new k({props:{name:"save_state",anchor:"accelerate.Accelerator.save_state",parameters:[{name:"output_dir",val:": str | None = 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#L3467"}}),da=new Se({props:{$$slots:{default:[Ei]},$$scope:{ctx:_}}}),ma=new G({props:{anchor:"accelerate.Accelerator.save_state.example",$$slots:{default:[Si]},$$scope:{ctx:_}}}),is=new k({props:{name:"set_trigger",anchor:"accelerate.Accelerator.set_trigger",parameters:[],source:"https://github.com/huggingface/accelerate/blob/main/src/accelerate/accelerator.py#L2742"}}),ha=new G({props:{anchor:"accelerate.Accelerator.set_trigger.example",$$slots:{default:[Hi]},$$scope:{ctx:_}}}),ds=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#L4147"}}),ga=new G({props:{anchor:"accelerate.Accelerator.skip_first_batches.example",$$slots:{default:[Li]},$$scope:{ctx:_}}}),ms=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#L831"}}),ua=new G({props:{anchor:"accelerate.Accelerator.split_between_processes.example",$$slots:{default:[Pi]},$$scope:{ctx:_}}}),hs=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#L1179"}}),fa=new G({props:{anchor:"accelerate.Accelerator.trigger_sync_in_backward.example",$$slots:{default:[Di]},$$scope:{ctx:_}}}),gs=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#L2801"}}),ba=new G({props:{anchor:"accelerate.Accelerator.unscale_gradients.example",$$slots:{default:[Ki]},$$scope:{ctx:_}}}),us=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#L3102",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:[qi]},$$scope:{ctx:_}}}),fs=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#L4183"}}),bs=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#L3136"}}),Ma=new G({props:{anchor:"accelerate.Accelerator.wait_for_everyone.example",$$slots:{default:[Oi]},$$scope:{ctx:_}}}),$s=new $o({props:{title:"Utilities",local:"accelerate.utils.gather_object",headingTag:"h2"}}),ys=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#L445",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>
`}}),Ms=new qp({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(),g(p.$$.fragment),Sl=n(),ja=i("p"),ja.innerHTML=yo,Hl=n(),g(wa.$$.fragment),Ll=n(),v=i("div"),g(_a.$$.fragment),er=n(),vs=i("p"),vs.textContent=Mo,tr=n(),Js=i("p"),Js.innerHTML=jo,ar=n(),Ts=i("ul"),Ts.innerHTML=wo,sr=n(),we=i("div"),g(va.$$.fragment),lr=n(),Us=i("p"),Us.textContent=_o,rr=n(),g($t.$$.fragment),nr=n(),S=i("div"),g(Ja.$$.fragment),cr=n(),xs=i("p"),xs.textContent=vo,or=n(),ks=i("p"),ks.innerHTML=Jo,pr=n(),g(yt.$$.fragment),ir=n(),H=i("div"),g(Ta.$$.fragment),dr=n(),Gs=i("p"),Gs.innerHTML=To,mr=n(),Bs=i("p"),Bs.innerHTML=Uo,hr=n(),g(Mt.$$.fragment),gr=n(),L=i("div"),g(Ua.$$.fragment),ur=n(),Cs=i("p"),Cs.innerHTML=xo,fr=n(),Is=i("p"),Is.innerHTML=ko,br=n(),g(jt.$$.fragment),$r=n(),_e=i("div"),g(xa.$$.fragment),yr=n(),Zs=i("p"),Zs.innerHTML=Go,Mr=n(),g(wt.$$.fragment),jr=n(),ve=i("div"),g(ka.$$.fragment),wr=n(),Ws=i("p"),Ws.innerHTML=Bo,_r=n(),g(_t.$$.fragment),vr=n(),Je=i("div"),g(Ga.$$.fragment),Jr=n(),Ys=i("p"),Ys.innerHTML=Co,Tr=n(),g(vt.$$.fragment),Ur=n(),Te=i("div"),g(Ba.$$.fragment),xr=n(),Xs=i("p"),Xs.textContent=Io,kr=n(),g(Jt.$$.fragment),Gr=n(),Ue=i("div"),g(Ca.$$.fragment),Br=n(),As=i("p"),As.innerHTML=Zo,Cr=n(),g(Tt.$$.fragment),Ir=n(),P=i("div"),g(Ia.$$.fragment),Zr=n(),Ns=i("p"),Ns.innerHTML=Wo,Wr=n(),Vs=i("p"),Vs.textContent=Yo,Yr=n(),g(Ut.$$.fragment),Xr=n(),xe=i("div"),g(Za.$$.fragment),Ar=n(),Qs=i("p"),Qs.innerHTML=Xo,Nr=n(),g(xt.$$.fragment),Vr=n(),ke=i("div"),g(Wa.$$.fragment),Qr=n(),Fs=i("p"),Fs.innerHTML=Ao,Fr=n(),g(kt.$$.fragment),zr=n(),Ge=i("div"),g(Ya.$$.fragment),Rr=n(),zs=i("p"),zs.innerHTML=No,Er=n(),g(Gt.$$.fragment),Sr=n(),A=i("div"),g(Xa.$$.fragment),Hr=n(),Rs=i("p"),Rs.innerHTML=Vo,Lr=n(),g(Bt.$$.fragment),Pr=n(),g(Ct.$$.fragment),Dr=n(),g(It.$$.fragment),Kr=n(),D=i("div"),g(Aa.$$.fragment),qr=n(),Es=i("p"),Es.textContent=Qo,Or=n(),g(Zt.$$.fragment),en=n(),g(Wt.$$.fragment),tn=n(),K=i("div"),g(Na.$$.fragment),an=n(),Ss=i("p"),Ss.textContent=Fo,sn=n(),Hs=i("p"),Hs.textContent=zo,ln=n(),g(Yt.$$.fragment),rn=n(),Xt=i("div"),g(Va.$$.fragment),nn=n(),Ls=i("p"),Ls.textContent=Ro,cn=n(),q=i("div"),g(Qa.$$.fragment),on=n(),Ps=i("p"),Ps.textContent=Eo,pn=n(),Ds=i("p"),Ds.textContent=So,dn=n(),g(At.$$.fragment),mn=n(),N=i("div"),g(Fa.$$.fragment),hn=n(),Ks=i("p"),Ks.textContent=Ho,gn=n(),g(Nt.$$.fragment),un=n(),g(Vt.$$.fragment),fn=n(),g(Qt.$$.fragment),bn=n(),O=i("div"),g(za.$$.fragment),$n=n(),qs=i("p"),qs.innerHTML=Lo,yn=n(),Os=i("p"),Os.innerHTML=Po,Mn=n(),g(Ft.$$.fragment),jn=n(),Be=i("div"),g(Ra.$$.fragment),wn=n(),el=i("p"),el.innerHTML=Do,_n=n(),g(zt.$$.fragment),vn=n(),Ce=i("div"),g(Ea.$$.fragment),Jn=n(),tl=i("p"),tl.innerHTML=Ko,Tn=n(),g(Rt.$$.fragment),Un=n(),Ie=i("div"),g(Sa.$$.fragment),xn=n(),al=i("p"),al.innerHTML=qo,kn=n(),g(Et.$$.fragment),Gn=n(),Ze=i("div"),g(Ha.$$.fragment),Bn=n(),sl=i("p"),sl.innerHTML=Oo,Cn=n(),g(St.$$.fragment),In=n(),We=i("div"),g(La.$$.fragment),Zn=n(),ll=i("p"),ll.innerHTML=ep,Wn=n(),g(Ht.$$.fragment),Yn=n(),Ye=i("div"),g(Pa.$$.fragment),Xn=n(),rl=i("p"),rl.textContent=tp,An=n(),g(Lt.$$.fragment),Nn=n(),V=i("div"),g(Da.$$.fragment),Vn=n(),nl=i("p"),nl.innerHTML=ap,Qn=n(),g(Pt.$$.fragment),Fn=n(),g(Dt.$$.fragment),zn=n(),g(Kt.$$.fragment),Rn=n(),Xe=i("div"),g(Ka.$$.fragment),En=n(),cl=i("p"),cl.innerHTML=sp,Sn=n(),g(qt.$$.fragment),Hn=n(),Ae=i("div"),g(qa.$$.fragment),Ln=n(),ol=i("p"),ol.innerHTML=lp,Pn=n(),g(Ot.$$.fragment),Dn=n(),Ne=i("div"),g(Oa.$$.fragment),Kn=n(),pl=i("p"),pl.innerHTML=rp,qn=n(),g(ea.$$.fragment),On=n(),Ve=i("div"),g(es.$$.fragment),ec=n(),il=i("p"),il.innerHTML=np,tc=n(),g(ta.$$.fragment),ac=n(),Qe=i("div"),g(ts.$$.fragment),sc=n(),dl=i("p"),dl.innerHTML=cp,lc=n(),g(aa.$$.fragment),rc=n(),ee=i("div"),g(as.$$.fragment),nc=n(),ml=i("p"),ml.innerHTML=op,cc=n(),hl=i("p"),hl.innerHTML=pp,oc=n(),g(sa.$$.fragment),pc=n(),te=i("div"),g(ss.$$.fragment),ic=n(),gl=i("p"),gl.innerHTML=ip,dc=n(),ul=i("p"),ul.textContent=dp,mc=n(),g(la.$$.fragment),hc=n(),Q=i("div"),g(ls.$$.fragment),gc=n(),fl=i("p"),fl.innerHTML=mp,uc=n(),bl=i("p"),bl.textContent=hp,fc=n(),g(ra.$$.fragment),bc=n(),g(na.$$.fragment),$c=n(),C=i("div"),g(rs.$$.fragment),yc=n(),$l=i("p"),$l.innerHTML=gp,Mc=n(),yl=i("p"),yl.textContent=up,jc=n(),Ml=i("p"),Ml.innerHTML=fp,wc=n(),jl=i("p"),jl.innerHTML=bp,_c=n(),g(ca.$$.fragment),vc=n(),I=i("div"),g(ns.$$.fragment),Jc=n(),wl=i("p"),wl.innerHTML=$p,Tc=n(),_l=i("p"),_l.textContent=yp,Uc=n(),vl=i("p"),vl.innerHTML=Mp,xc=n(),Jl=i("p"),Jl.innerHTML=jp,kc=n(),g(oa.$$.fragment),Gc=n(),ae=i("div"),g(cs.$$.fragment),Bc=n(),Tl=i("p"),Tl.innerHTML=wp,Cc=n(),Ul=i("p"),Ul.innerHTML=_p,Ic=n(),g(pa.$$.fragment),Zc=n(),Fe=i("div"),g(os.$$.fragment),Wc=n(),xl=i("p"),xl.textContent=vp,Yc=n(),g(ia.$$.fragment),Xc=n(),Z=i("div"),g(ps.$$.fragment),Ac=n(),kl=i("p"),kl.textContent=Jp,Nc=n(),Gl=i("p"),Gl.innerHTML=Tp,Vc=n(),Bl=i("p"),Bl.innerHTML=Up,Qc=n(),g(da.$$.fragment),Fc=n(),g(ma.$$.fragment),zc=n(),se=i("div"),g(is.$$.fragment),Rc=n(),Cl=i("p"),Cl.textContent=xp,Ec=n(),Il=i("p"),Il.innerHTML=kp,Sc=n(),g(ha.$$.fragment),Hc=n(),ze=i("div"),g(ds.$$.fragment),Lc=n(),Zl=i("p"),Zl.innerHTML=Gp,Pc=n(),g(ga.$$.fragment),Dc=n(),le=i("div"),g(ms.$$.fragment),Kc=n(),Wl=i("p"),Wl.innerHTML=Bp,qc=n(),Yl=i("p"),Yl.innerHTML=Cp,Oc=n(),g(ua.$$.fragment),eo=n(),re=i("div"),g(hs.$$.fragment),to=n(),Xl=i("p"),Xl.innerHTML=Ip,ao=n(),Al=i("p"),Al.textContent=Zp,so=n(),g(fa.$$.fragment),lo=n(),ne=i("div"),g(gs.$$.fragment),ro=n(),Nl=i("p"),Nl.textContent=Wp,no=n(),Vl=i("p"),Vl.innerHTML=Yp,co=n(),g(ba.$$.fragment),oo=n(),Re=i("div"),g(us.$$.fragment),po=n(),Ql=i("p"),Ql.innerHTML=Xp,io=n(),g($a.$$.fragment),mo=n(),ya=i("div"),g(fs.$$.fragment),ho=n(),Fl=i("p"),Fl.innerHTML=Ap,go=n(),Ee=i("div"),g(bs.$$.fragment),uo=n(),zl=i("p"),zl.textContent=Np,fo=n(),g(Ma.$$.fragment),Pl=n(),g($s.$$.fragment),Dl=n(),He=i("div"),g(ys.$$.fragment),bo=n(),Rl=i("p"),Rl.textContent=Vp,Kl=n(),g(Ms.$$.fragment),ql=n(),El=i("p"),this.h()},l(s){const M=Dp("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),u(p.$$.fragment,s),Sl=c(s),ja=d(s,"P",{"data-svelte-h":!0}),j(ja)!=="svelte-1m2utx6"&&(ja.innerHTML=yo),Hl=c(s),u(wa.$$.fragment,s),Ll=c(s),v=d(s,"DIV",{class:!0});var J=U(v);u(_a.$$.fragment,J),er=c(J),vs=d(J,"P",{"data-svelte-h":!0}),j(vs)!=="svelte-18gnhk2"&&(vs.textContent=Mo),tr=c(J),Js=d(J,"P",{"data-svelte-h":!0}),j(Js)!=="svelte-17v1xbv"&&(Js.innerHTML=jo),ar=c(J),Ts=d(J,"UL",{"data-svelte-h":!0}),j(Ts)!=="svelte-1830bw3"&&(Ts.innerHTML=wo),sr=c(J),we=d(J,"DIV",{class:!0});var Le=U(we);u(va.$$.fragment,Le),lr=c(Le),Us=d(Le,"P",{"data-svelte-h":!0}),j(Us)!=="svelte-hhq3cw"&&(Us.textContent=_o),rr=c(Le),u($t.$$.fragment,Le),Le.forEach(h),nr=c(J),S=d(J,"DIV",{class:!0});var ce=U(S);u(Ja.$$.fragment,ce),cr=c(ce),xs=d(ce,"P",{"data-svelte-h":!0}),j(xs)!=="svelte-1to22fk"&&(xs.textContent=vo),or=c(ce),ks=d(ce,"P",{"data-svelte-h":!0}),j(ks)!=="svelte-2z45q2"&&(ks.innerHTML=Jo),pr=c(ce),u(yt.$$.fragment,ce),ce.forEach(h),ir=c(J),H=d(J,"DIV",{class:!0});var oe=U(H);u(Ta.$$.fragment,oe),dr=c(oe),Gs=d(oe,"P",{"data-svelte-h":!0}),j(Gs)!=="svelte-1k83amz"&&(Gs.innerHTML=To),mr=c(oe),Bs=d(oe,"P",{"data-svelte-h":!0}),j(Bs)!=="svelte-3qeaqc"&&(Bs.innerHTML=Uo),hr=c(oe),u(Mt.$$.fragment,oe),oe.forEach(h),gr=c(J),L=d(J,"DIV",{class:!0});var pe=U(L);u(Ua.$$.fragment,pe),ur=c(pe),Cs=d(pe,"P",{"data-svelte-h":!0}),j(Cs)!=="svelte-m17ioq"&&(Cs.innerHTML=xo),fr=c(pe),Is=d(pe,"P",{"data-svelte-h":!0}),j(Is)!=="svelte-h6tcr2"&&(Is.innerHTML=ko),br=c(pe),u(jt.$$.fragment,pe),pe.forEach(h),$r=c(J),_e=d(J,"DIV",{class:!0});var Pe=U(_e);u(xa.$$.fragment,Pe),yr=c(Pe),Zs=d(Pe,"P",{"data-svelte-h":!0}),j(Zs)!=="svelte-bl1ihw"&&(Zs.innerHTML=Go),Mr=c(Pe),u(wt.$$.fragment,Pe),Pe.forEach(h),jr=c(J),ve=d(J,"DIV",{class:!0});var De=U(ve);u(ka.$$.fragment,De),wr=c(De),Ws=d(De,"P",{"data-svelte-h":!0}),j(Ws)!=="svelte-1w1177v"&&(Ws.innerHTML=Bo),_r=c(De),u(_t.$$.fragment,De),De.forEach(h),vr=c(J),Je=d(J,"DIV",{class:!0});var Ke=U(Je);u(Ga.$$.fragment,Ke),Jr=c(Ke),Ys=d(Ke,"P",{"data-svelte-h":!0}),j(Ys)!=="svelte-1rffb4m"&&(Ys.innerHTML=Co),Tr=c(Ke),u(vt.$$.fragment,Ke),Ke.forEach(h),Ur=c(J),Te=d(J,"DIV",{class:!0});var qe=U(Te);u(Ba.$$.fragment,qe),xr=c(qe),Xs=d(qe,"P",{"data-svelte-h":!0}),j(Xs)!=="svelte-a2pg1h"&&(Xs.textContent=Io),kr=c(qe),u(Jt.$$.fragment,qe),qe.forEach(h),Gr=c(J),Ue=d(J,"DIV",{class:!0});var Oe=U(Ue);u(Ca.$$.fragment,Oe),Br=c(Oe),As=d(Oe,"P",{"data-svelte-h":!0}),j(As)!=="svelte-iw017b"&&(As.innerHTML=Zo),Cr=c(Oe),u(Tt.$$.fragment,Oe),Oe.forEach(h),Ir=c(J),P=d(J,"DIV",{class:!0});var ie=U(P);u(Ia.$$.fragment,ie),Zr=c(ie),Ns=d(ie,"P",{"data-svelte-h":!0}),j(Ns)!=="svelte-c0v2dv"&&(Ns.innerHTML=Wo),Wr=c(ie),Vs=d(ie,"P",{"data-svelte-h":!0}),j(Vs)!=="svelte-1ap3exf"&&(Vs.textContent=Yo),Yr=c(ie),u(Ut.$$.fragment,ie),ie.forEach(h),Xr=c(J),xe=d(J,"DIV",{class:!0});var et=U(xe);u(Za.$$.fragment,et),Ar=c(et),Qs=d(et,"P",{"data-svelte-h":!0}),j(Qs)!=="svelte-19l0og1"&&(Qs.innerHTML=Xo),Nr=c(et),u(xt.$$.fragment,et),et.forEach(h),Vr=c(J),ke=d(J,"DIV",{class:!0});var tt=U(ke);u(Wa.$$.fragment,tt),Qr=c(tt),Fs=d(tt,"P",{"data-svelte-h":!0}),j(Fs)!=="svelte-4sbmnk"&&(Fs.innerHTML=Ao),Fr=c(tt),u(kt.$$.fragment,tt),tt.forEach(h),zr=c(J),Ge=d(J,"DIV",{class:!0});var at=U(Ge);u(Ya.$$.fragment,at),Rr=c(at),zs=d(at,"P",{"data-svelte-h":!0}),j(zs)!=="svelte-vacsyv"&&(zs.innerHTML=No),Er=c(at),u(Gt.$$.fragment,at),at.forEach(h),Sr=c(J),A=d(J,"DIV",{class:!0});var F=U(A);u(Xa.$$.fragment,F),Hr=c(F),Rs=d(F,"P",{"data-svelte-h":!0}),j(Rs)!=="svelte-hlem7e"&&(Rs.innerHTML=Vo),Lr=c(F),u(Bt.$$.fragment,F),Pr=c(F),u(Ct.$$.fragment,F),Dr=c(F),u(It.$$.fragment,F),F.forEach(h),Kr=c(J),D=d(J,"DIV",{class:!0});var de=U(D);u(Aa.$$.fragment,de),qr=c(de),Es=d(de,"P",{"data-svelte-h":!0}),j(Es)!=="svelte-1kjfoov"&&(Es.textContent=Qo),Or=c(de),u(Zt.$$.fragment,de),en=c(de),u(Wt.$$.fragment,de),de.forEach(h),tn=c(J),K=d(J,"DIV",{class:!0});var me=U(K);u(Na.$$.fragment,me),an=c(me),Ss=d(me,"P",{"data-svelte-h":!0}),j(Ss)!=="svelte-1xrqyx2"&&(Ss.textContent=Fo),sn=c(me),Hs=d(me,"P",{"data-svelte-h":!0}),j(Hs)!=="svelte-144ycie"&&(Hs.textContent=zo),ln=c(me),u(Yt.$$.fragment,me),me.forEach(h),rn=c(J),Xt=d(J,"DIV",{class:!0});var js=U(Xt);u(Va.$$.fragment,js),nn=c(js),Ls=d(js,"P",{"data-svelte-h":!0}),j(Ls)!=="svelte-vdzhg"&&(Ls.textContent=Ro),js.forEach(h),cn=c(J),q=d(J,"DIV",{class:!0});var he=U(q);u(Qa.$$.fragment,he),on=c(he),Ps=d(he,"P",{"data-svelte-h":!0}),j(Ps)!=="svelte-f40x3x"&&(Ps.textContent=Eo),pn=c(he),Ds=d(he,"P",{"data-svelte-h":!0}),j(Ds)!=="svelte-144ycie"&&(Ds.textContent=So),dn=c(he),u(At.$$.fragment,he),he.forEach(h),mn=c(J),N=d(J,"DIV",{class:!0});var z=U(N);u(Fa.$$.fragment,z),hn=c(z),Ks=d(z,"P",{"data-svelte-h":!0}),j(Ks)!=="svelte-p8l2iu"&&(Ks.textContent=Ho),gn=c(z),u(Nt.$$.fragment,z),un=c(z),u(Vt.$$.fragment,z),fn=c(z),u(Qt.$$.fragment,z),z.forEach(h),bn=c(J),O=d(J,"DIV",{class:!0});var ge=U(O);u(za.$$.fragment,ge),$n=c(ge),qs=d(ge,"P",{"data-svelte-h":!0}),j(qs)!=="svelte-1g6bbp3"&&(qs.innerHTML=Lo),yn=c(ge),Os=d(ge,"P",{"data-svelte-h":!0}),j(Os)!=="svelte-g65bbp"&&(Os.innerHTML=Po),Mn=c(ge),u(Ft.$$.fragment,ge),ge.forEach(h),jn=c(J),Be=d(J,"DIV",{class:!0});var st=U(Be);u(Ra.$$.fragment,st),wn=c(st),el=d(st,"P",{"data-svelte-h":!0}),j(el)!=="svelte-dzayl0"&&(el.innerHTML=Do),_n=c(st),u(zt.$$.fragment,st),st.forEach(h),vn=c(J),Ce=d(J,"DIV",{class:!0});var lt=U(Ce);u(Ea.$$.fragment,lt),Jn=c(lt),tl=d(lt,"P",{"data-svelte-h":!0}),j(tl)!=="svelte-56q7i0"&&(tl.innerHTML=Ko),Tn=c(lt),u(Rt.$$.fragment,lt),lt.forEach(h),Un=c(J),Ie=d(J,"DIV",{class:!0});var rt=U(Ie);u(Sa.$$.fragment,rt),xn=c(rt),al=d(rt,"P",{"data-svelte-h":!0}),j(al)!=="svelte-1c2pa3e"&&(al.innerHTML=qo),kn=c(rt),u(Et.$$.fragment,rt),rt.forEach(h),Gn=c(J),Ze=d(J,"DIV",{class:!0});var nt=U(Ze);u(Ha.$$.fragment,nt),Bn=c(nt),sl=d(nt,"P",{"data-svelte-h":!0}),j(sl)!=="svelte-1bxst4n"&&(sl.innerHTML=Oo),Cn=c(nt),u(St.$$.fragment,nt),nt.forEach(h),In=c(J),We=d(J,"DIV",{class:!0});var ct=U(We);u(La.$$.fragment,ct),Zn=c(ct),ll=d(ct,"P",{"data-svelte-h":!0}),j(ll)!=="svelte-gt9ih5"&&(ll.innerHTML=ep),Wn=c(ct),u(Ht.$$.fragment,ct),ct.forEach(h),Yn=c(J),Ye=d(J,"DIV",{class:!0});var ot=U(Ye);u(Pa.$$.fragment,ot),Xn=c(ot),rl=d(ot,"P",{"data-svelte-h":!0}),j(rl)!=="svelte-1mfhnhh"&&(rl.textContent=tp),An=c(ot),u(Lt.$$.fragment,ot),ot.forEach(h),Nn=c(J),V=d(J,"DIV",{class:!0});var R=U(V);u(Da.$$.fragment,R),Vn=c(R),nl=d(R,"P",{"data-svelte-h":!0}),j(nl)!=="svelte-90g1bo"&&(nl.innerHTML=ap),Qn=c(R),u(Pt.$$.fragment,R),Fn=c(R),u(Dt.$$.fragment,R),zn=c(R),u(Kt.$$.fragment,R),R.forEach(h),Rn=c(J),Xe=d(J,"DIV",{class:!0});var pt=U(Xe);u(Ka.$$.fragment,pt),En=c(pt),cl=d(pt,"P",{"data-svelte-h":!0}),j(cl)!=="svelte-jtaqq6"&&(cl.innerHTML=sp),Sn=c(pt),u(qt.$$.fragment,pt),pt.forEach(h),Hn=c(J),Ae=d(J,"DIV",{class:!0});var it=U(Ae);u(qa.$$.fragment,it),Ln=c(it),ol=d(it,"P",{"data-svelte-h":!0}),j(ol)!=="svelte-1ipttjs"&&(ol.innerHTML=lp),Pn=c(it),u(Ot.$$.fragment,it),it.forEach(h),Dn=c(J),Ne=d(J,"DIV",{class:!0});var dt=U(Ne);u(Oa.$$.fragment,dt),Kn=c(dt),pl=d(dt,"P",{"data-svelte-h":!0}),j(pl)!=="svelte-1ilbfbi"&&(pl.innerHTML=rp),qn=c(dt),u(ea.$$.fragment,dt),dt.forEach(h),On=c(J),Ve=d(J,"DIV",{class:!0});var mt=U(Ve);u(es.$$.fragment,mt),ec=c(mt),il=d(mt,"P",{"data-svelte-h":!0}),j(il)!=="svelte-lcda6w"&&(il.innerHTML=np),tc=c(mt),u(ta.$$.fragment,mt),mt.forEach(h),ac=c(J),Qe=d(J,"DIV",{class:!0});var ht=U(Qe);u(ts.$$.fragment,ht),sc=c(ht),dl=d(ht,"P",{"data-svelte-h":!0}),j(dl)!=="svelte-1fwzii1"&&(dl.innerHTML=cp),lc=c(ht),u(aa.$$.fragment,ht),ht.forEach(h),rc=c(J),ee=d(J,"DIV",{class:!0});var ue=U(ee);u(as.$$.fragment,ue),nc=c(ue),ml=d(ue,"P",{"data-svelte-h":!0}),j(ml)!=="svelte-18jmrh0"&&(ml.innerHTML=op),cc=c(ue),hl=d(ue,"P",{"data-svelte-h":!0}),j(hl)!=="svelte-bk0lx4"&&(hl.innerHTML=pp),oc=c(ue),u(sa.$$.fragment,ue),ue.forEach(h),pc=c(J),te=d(J,"DIV",{class:!0});var fe=U(te);u(ss.$$.fragment,fe),ic=c(fe),gl=d(fe,"P",{"data-svelte-h":!0}),j(gl)!=="svelte-1lyv8gx"&&(gl.innerHTML=ip),dc=c(fe),ul=d(fe,"P",{"data-svelte-h":!0}),j(ul)!=="svelte-12bh3zw"&&(ul.textContent=dp),mc=c(fe),u(la.$$.fragment,fe),fe.forEach(h),hc=c(J),Q=d(J,"DIV",{class:!0});var E=U(Q);u(ls.$$.fragment,E),gc=c(E),fl=d(E,"P",{"data-svelte-h":!0}),j(fl)!=="svelte-1yy42cg"&&(fl.innerHTML=mp),uc=c(E),bl=d(E,"P",{"data-svelte-h":!0}),j(bl)!=="svelte-x6uu8"&&(bl.textContent=hp),fc=c(E),u(ra.$$.fragment,E),bc=c(E),u(na.$$.fragment,E),E.forEach(h),$c=c(J),C=d(J,"DIV",{class:!0});var W=U(C);u(rs.$$.fragment,W),yc=c(W),$l=d(W,"P",{"data-svelte-h":!0}),j($l)!=="svelte-r9fsru"&&($l.innerHTML=gp),Mc=c(W),yl=d(W,"P",{"data-svelte-h":!0}),j(yl)!=="svelte-14qme5z"&&(yl.textContent=up),jc=c(W),Ml=d(W,"P",{"data-svelte-h":!0}),j(Ml)!=="svelte-ljm1ur"&&(Ml.innerHTML=fp),wc=c(W),jl=d(W,"P",{"data-svelte-h":!0}),j(jl)!=="svelte-80yz6h"&&(jl.innerHTML=bp),_c=c(W),u(ca.$$.fragment,W),W.forEach(h),vc=c(J),I=d(J,"DIV",{class:!0});var Y=U(I);u(ns.$$.fragment,Y),Jc=c(Y),wl=d(Y,"P",{"data-svelte-h":!0}),j(wl)!=="svelte-1pt2ddf"&&(wl.innerHTML=$p),Tc=c(Y),_l=d(Y,"P",{"data-svelte-h":!0}),j(_l)!=="svelte-14qme5z"&&(_l.textContent=yp),Uc=c(Y),vl=d(Y,"P",{"data-svelte-h":!0}),j(vl)!=="svelte-ze4wea"&&(vl.innerHTML=Mp),xc=c(Y),Jl=d(Y,"P",{"data-svelte-h":!0}),j(Jl)!=="svelte-1az1cae"&&(Jl.innerHTML=jp),kc=c(Y),u(oa.$$.fragment,Y),Y.forEach(h),Gc=c(J),ae=d(J,"DIV",{class:!0});var be=U(ae);u(cs.$$.fragment,be),Bc=c(be),Tl=d(be,"P",{"data-svelte-h":!0}),j(Tl)!=="svelte-16eiqks"&&(Tl.innerHTML=wp),Cc=c(be),Ul=d(be,"P",{"data-svelte-h":!0}),j(Ul)!=="svelte-4i4kmd"&&(Ul.innerHTML=_p),Ic=c(be),u(pa.$$.fragment,be),be.forEach(h),Zc=c(J),Fe=d(J,"DIV",{class:!0});var gt=U(Fe);u(os.$$.fragment,gt),Wc=c(gt),xl=d(gt,"P",{"data-svelte-h":!0}),j(xl)!=="svelte-onu98y"&&(xl.textContent=vp),Yc=c(gt),u(ia.$$.fragment,gt),gt.forEach(h),Xc=c(J),Z=d(J,"DIV",{class:!0});var X=U(Z);u(ps.$$.fragment,X),Ac=c(X),kl=d(X,"P",{"data-svelte-h":!0}),j(kl)!=="svelte-1v72nnm"&&(kl.textContent=Jp),Nc=c(X),Gl=d(X,"P",{"data-svelte-h":!0}),j(Gl)!=="svelte-5mv7f4"&&(Gl.innerHTML=Tp),Vc=c(X),Bl=d(X,"P",{"data-svelte-h":!0}),j(Bl)!=="svelte-13o3ok4"&&(Bl.innerHTML=Up),Qc=c(X),u(da.$$.fragment,X),Fc=c(X),u(ma.$$.fragment,X),X.forEach(h),zc=c(J),se=d(J,"DIV",{class:!0});var $e=U(se);u(is.$$.fragment,$e),Rc=c($e),Cl=d($e,"P",{"data-svelte-h":!0}),j(Cl)!=="svelte-1bgx6cf"&&(Cl.textContent=xp),Ec=c($e),Il=d($e,"P",{"data-svelte-h":!0}),j(Il)!=="svelte-h6tcr2"&&(Il.innerHTML=kp),Sc=c($e),u(ha.$$.fragment,$e),$e.forEach(h),Hc=c(J),ze=d(J,"DIV",{class:!0});var ut=U(ze);u(ds.$$.fragment,ut),Lc=c(ut),Zl=d(ut,"P",{"data-svelte-h":!0}),j(Zl)!=="svelte-9m10k"&&(Zl.innerHTML=Gp),Pc=c(ut),u(ga.$$.fragment,ut),ut.forEach(h),Dc=c(J),le=d(J,"DIV",{class:!0});var ye=U(le);u(ms.$$.fragment,ye),Kc=c(ye),Wl=d(ye,"P",{"data-svelte-h":!0}),j(Wl)!=="svelte-xr05jy"&&(Wl.innerHTML=Bp),qc=c(ye),Yl=d(ye,"P",{"data-svelte-h":!0}),j(Yl)!=="svelte-hvuw2l"&&(Yl.innerHTML=Cp),Oc=c(ye),u(ua.$$.fragment,ye),ye.forEach(h),eo=c(J),re=d(J,"DIV",{class:!0});var Me=U(re);u(hs.$$.fragment,Me),to=c(Me),Xl=d(Me,"P",{"data-svelte-h":!0}),j(Xl)!=="svelte-111j6q2"&&(Xl.innerHTML=Ip),ao=c(Me),Al=d(Me,"P",{"data-svelte-h":!0}),j(Al)!=="svelte-obux0l"&&(Al.textContent=Zp),so=c(Me),u(fa.$$.fragment,Me),Me.forEach(h),lo=c(J),ne=d(J,"DIV",{class:!0});var je=U(ne);u(gs.$$.fragment,je),ro=c(je),Nl=d(je,"P",{"data-svelte-h":!0}),j(Nl)!=="svelte-1w117kr"&&(Nl.textContent=Wp),no=c(je),Vl=d(je,"P",{"data-svelte-h":!0}),j(Vl)!=="svelte-1l7ede9"&&(Vl.innerHTML=Yp),co=c(je),u(ba.$$.fragment,je),je.forEach(h),oo=c(J),Re=d(J,"DIV",{class:!0});var ft=U(Re);u(us.$$.fragment,ft),po=c(ft),Ql=d(ft,"P",{"data-svelte-h":!0}),j(Ql)!=="svelte-180l03j"&&(Ql.innerHTML=Xp),io=c(ft),u($a.$$.fragment,ft),ft.forEach(h),mo=c(J),ya=d(J,"DIV",{class:!0});var ws=U(ya);u(fs.$$.fragment,ws),ho=c(ws),Fl=d(ws,"P",{"data-svelte-h":!0}),j(Fl)!=="svelte-1ml1a9c"&&(Fl.innerHTML=Ap),ws.forEach(h),go=c(J),Ee=d(J,"DIV",{class:!0});var bt=U(Ee);u(bs.$$.fragment,bt),uo=c(bt),zl=d(bt,"P",{"data-svelte-h":!0}),j(zl)!=="svelte-tmafbn"&&(zl.textContent=Np),fo=c(bt),u(Ma.$$.fragment,bt),bt.forEach(h),J.forEach(h),Pl=c(s),u($s.$$.fragment,s),Dl=c(s),He=d(s,"DIV",{class:!0});var _s=U(He);u(ys.$$.fragment,_s),bo=c(_s),Rl=d(_s,"P",{"data-svelte-h":!0}),j(Rl)!=="svelte-11ueuet"&&(Rl.textContent=Vp),_s.forEach(h),Kl=c(s),u(Ms.$$.fragment,s),ql=c(s),El=d(s,"P",{}),U(El).forEach(h),this.h()},h(){x(t,"name","hf:doc:metadata"),x(t,"content",td),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(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(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(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(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(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(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(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(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(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(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(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(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(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),f(p,s,M),w(s,Sl,M),w(s,ja,M),w(s,Hl,M),f(wa,s,M),w(s,Ll,M),w(s,v,M),f(_a,v,null),l(v,er),l(v,vs),l(v,tr),l(v,Js),l(v,ar),l(v,Ts),l(v,sr),l(v,we),f(va,we,null),l(we,lr),l(we,Us),l(we,rr),f($t,we,null),l(v,nr),l(v,S),f(Ja,S,null),l(S,cr),l(S,xs),l(S,or),l(S,ks),l(S,pr),f(yt,S,null),l(v,ir),l(v,H),f(Ta,H,null),l(H,dr),l(H,Gs),l(H,mr),l(H,Bs),l(H,hr),f(Mt,H,null),l(v,gr),l(v,L),f(Ua,L,null),l(L,ur),l(L,Cs),l(L,fr),l(L,Is),l(L,br),f(jt,L,null),l(v,$r),l(v,_e),f(xa,_e,null),l(_e,yr),l(_e,Zs),l(_e,Mr),f(wt,_e,null),l(v,jr),l(v,ve),f(ka,ve,null),l(ve,wr),l(ve,Ws),l(ve,_r),f(_t,ve,null),l(v,vr),l(v,Je),f(Ga,Je,null),l(Je,Jr),l(Je,Ys),l(Je,Tr),f(vt,Je,null),l(v,Ur),l(v,Te),f(Ba,Te,null),l(Te,xr),l(Te,Xs),l(Te,kr),f(Jt,Te,null),l(v,Gr),l(v,Ue),f(Ca,Ue,null),l(Ue,Br),l(Ue,As),l(Ue,Cr),f(Tt,Ue,null),l(v,Ir),l(v,P),f(Ia,P,null),l(P,Zr),l(P,Ns),l(P,Wr),l(P,Vs),l(P,Yr),f(Ut,P,null),l(v,Xr),l(v,xe),f(Za,xe,null),l(xe,Ar),l(xe,Qs),l(xe,Nr),f(xt,xe,null),l(v,Vr),l(v,ke),f(Wa,ke,null),l(ke,Qr),l(ke,Fs),l(ke,Fr),f(kt,ke,null),l(v,zr),l(v,Ge),f(Ya,Ge,null),l(Ge,Rr),l(Ge,zs),l(Ge,Er),f(Gt,Ge,null),l(v,Sr),l(v,A),f(Xa,A,null),l(A,Hr),l(A,Rs),l(A,Lr),f(Bt,A,null),l(A,Pr),f(Ct,A,null),l(A,Dr),f(It,A,null),l(v,Kr),l(v,D),f(Aa,D,null),l(D,qr),l(D,Es),l(D,Or),f(Zt,D,null),l(D,en),f(Wt,D,null),l(v,tn),l(v,K),f(Na,K,null),l(K,an),l(K,Ss),l(K,sn),l(K,Hs),l(K,ln),f(Yt,K,null),l(v,rn),l(v,Xt),f(Va,Xt,null),l(Xt,nn),l(Xt,Ls),l(v,cn),l(v,q),f(Qa,q,null),l(q,on),l(q,Ps),l(q,pn),l(q,Ds),l(q,dn),f(At,q,null),l(v,mn),l(v,N),f(Fa,N,null),l(N,hn),l(N,Ks),l(N,gn),f(Nt,N,null),l(N,un),f(Vt,N,null),l(N,fn),f(Qt,N,null),l(v,bn),l(v,O),f(za,O,null),l(O,$n),l(O,qs),l(O,yn),l(O,Os),l(O,Mn),f(Ft,O,null),l(v,jn),l(v,Be),f(Ra,Be,null),l(Be,wn),l(Be,el),l(Be,_n),f(zt,Be,null),l(v,vn),l(v,Ce),f(Ea,Ce,null),l(Ce,Jn),l(Ce,tl),l(Ce,Tn),f(Rt,Ce,null),l(v,Un),l(v,Ie),f(Sa,Ie,null),l(Ie,xn),l(Ie,al),l(Ie,kn),f(Et,Ie,null),l(v,Gn),l(v,Ze),f(Ha,Ze,null),l(Ze,Bn),l(Ze,sl),l(Ze,Cn),f(St,Ze,null),l(v,In),l(v,We),f(La,We,null),l(We,Zn),l(We,ll),l(We,Wn),f(Ht,We,null),l(v,Yn),l(v,Ye),f(Pa,Ye,null),l(Ye,Xn),l(Ye,rl),l(Ye,An),f(Lt,Ye,null),l(v,Nn),l(v,V),f(Da,V,null),l(V,Vn),l(V,nl),l(V,Qn),f(Pt,V,null),l(V,Fn),f(Dt,V,null),l(V,zn),f(Kt,V,null),l(v,Rn),l(v,Xe),f(Ka,Xe,null),l(Xe,En),l(Xe,cl),l(Xe,Sn),f(qt,Xe,null),l(v,Hn),l(v,Ae),f(qa,Ae,null),l(Ae,Ln),l(Ae,ol),l(Ae,Pn),f(Ot,Ae,null),l(v,Dn),l(v,Ne),f(Oa,Ne,null),l(Ne,Kn),l(Ne,pl),l(Ne,qn),f(ea,Ne,null),l(v,On),l(v,Ve),f(es,Ve,null),l(Ve,ec),l(Ve,il),l(Ve,tc),f(ta,Ve,null),l(v,ac),l(v,Qe),f(ts,Qe,null),l(Qe,sc),l(Qe,dl),l(Qe,lc),f(aa,Qe,null),l(v,rc),l(v,ee),f(as,ee,null),l(ee,nc),l(ee,ml),l(ee,cc),l(ee,hl),l(ee,oc),f(sa,ee,null),l(v,pc),l(v,te),f(ss,te,null),l(te,ic),l(te,gl),l(te,dc),l(te,ul),l(te,mc),f(la,te,null),l(v,hc),l(v,Q),f(ls,Q,null),l(Q,gc),l(Q,fl),l(Q,uc),l(Q,bl),l(Q,fc),f(ra,Q,null),l(Q,bc),f(na,Q,null),l(v,$c),l(v,C),f(rs,C,null),l(C,yc),l(C,$l),l(C,Mc),l(C,yl),l(C,jc),l(C,Ml),l(C,wc),l(C,jl),l(C,_c),f(ca,C,null),l(v,vc),l(v,I),f(ns,I,null),l(I,Jc),l(I,wl),l(I,Tc),l(I,_l),l(I,Uc),l(I,vl),l(I,xc),l(I,Jl),l(I,kc),f(oa,I,null),l(v,Gc),l(v,ae),f(cs,ae,null),l(ae,Bc),l(ae,Tl),l(ae,Cc),l(ae,Ul),l(ae,Ic),f(pa,ae,null),l(v,Zc),l(v,Fe),f(os,Fe,null),l(Fe,Wc),l(Fe,xl),l(Fe,Yc),f(ia,Fe,null),l(v,Xc),l(v,Z),f(ps,Z,null),l(Z,Ac),l(Z,kl),l(Z,Nc),l(Z,Gl),l(Z,Vc),l(Z,Bl),l(Z,Qc),f(da,Z,null),l(Z,Fc),f(ma,Z,null),l(v,zc),l(v,se),f(is,se,null),l(se,Rc),l(se,Cl),l(se,Ec),l(se,Il),l(se,Sc),f(ha,se,null),l(v,Hc),l(v,ze),f(ds,ze,null),l(ze,Lc),l(ze,Zl),l(ze,Pc),f(ga,ze,null),l(v,Dc),l(v,le),f(ms,le,null),l(le,Kc),l(le,Wl),l(le,qc),l(le,Yl),l(le,Oc),f(ua,le,null),l(v,eo),l(v,re),f(hs,re,null),l(re,to),l(re,Xl),l(re,ao),l(re,Al),l(re,so),f(fa,re,null),l(v,lo),l(v,ne),f(gs,ne,null),l(ne,ro),l(ne,Nl),l(ne,no),l(ne,Vl),l(ne,co),f(ba,ne,null),l(v,oo),l(v,Re),f(us,Re,null),l(Re,po),l(Re,Ql),l(Re,io),f($a,Re,null),l(v,mo),l(v,ya),f(fs,ya,null),l(ya,ho),l(ya,Fl),l(v,go),l(v,Ee),f(bs,Ee,null),l(Ee,uo),l(Ee,zl),l(Ee,fo),f(Ma,Ee,null),w(s,Pl,M),f($s,s,M),w(s,Dl,M),w(s,He,M),f(ys,He,null),l(He,bo),l(He,Rl),w(s,Kl,M),f(Ms,s,M),w(s,ql,M),w(s,El,M),Ol=!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}),Ct.$set(F);const de={};M&2&&(de.$$scope={dirty:M,ctx:s}),It.$set(de);const me={};M&2&&(me.$$scope={dirty:M,ctx:s}),Zt.$set(me);const js={};M&2&&(js.$$scope={dirty:M,ctx:s}),Wt.$set(js);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}),Nt.$set(ge);const st={};M&2&&(st.$$scope={dirty:M,ctx:s}),Vt.$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 ws={};M&2&&(ws.$$scope={dirty:M,ctx:s}),ma.$set(ws);const bt={};M&2&&(bt.$$scope={dirty:M,ctx:s}),ha.$set(bt);const _s={};M&2&&(_s.$$scope={dirty:M,ctx:s}),ga.$set(_s);const Qp={};M&2&&(Qp.$$scope={dirty:M,ctx:s}),ua.$set(Qp);const Fp={};M&2&&(Fp.$$scope={dirty:M,ctx:s}),fa.$set(Fp);const zp={};M&2&&(zp.$$scope={dirty:M,ctx:s}),ba.$set(zp);const Rp={};M&2&&(Rp.$$scope={dirty:M,ctx:s}),$a.$set(Rp);const Ep={};M&2&&(Ep.$$scope={dirty:M,ctx:s}),Ma.$set(Ep)},i(s){Ol||(b(o.$$.fragment,s),b(p.$$.fragment,s),b(wa.$$.fragment,s),b(_a.$$.fragment,s),b(va.$$.fragment,s),b($t.$$.fragment,s),b(Ja.$$.fragment,s),b(yt.$$.fragment,s),b(Ta.$$.fragment,s),b(Mt.$$.fragment,s),b(Ua.$$.fragment,s),b(jt.$$.fragment,s),b(xa.$$.fragment,s),b(wt.$$.fragment,s),b(ka.$$.fragment,s),b(_t.$$.fragment,s),b(Ga.$$.fragment,s),b(vt.$$.fragment,s),b(Ba.$$.fragment,s),b(Jt.$$.fragment,s),b(Ca.$$.fragment,s),b(Tt.$$.fragment,s),b(Ia.$$.fragment,s),b(Ut.$$.fragment,s),b(Za.$$.fragment,s),b(xt.$$.fragment,s),b(Wa.$$.fragment,s),b(kt.$$.fragment,s),b(Ya.$$.fragment,s),b(Gt.$$.fragment,s),b(Xa.$$.fragment,s),b(Bt.$$.fragment,s),b(Ct.$$.fragment,s),b(It.$$.fragment,s),b(Aa.$$.fragment,s),b(Zt.$$.fragment,s),b(Wt.$$.fragment,s),b(Na.$$.fragment,s),b(Yt.$$.fragment,s),b(Va.$$.fragment,s),b(Qa.$$.fragment,s),b(At.$$.fragment,s),b(Fa.$$.fragment,s),b(Nt.$$.fragment,s),b(Vt.$$.fragment,s),b(Qt.$$.fragment,s),b(za.$$.fragment,s),b(Ft.$$.fragment,s),b(Ra.$$.fragment,s),b(zt.$$.fragment,s),b(Ea.$$.fragment,s),b(Rt.$$.fragment,s),b(Sa.$$.fragment,s),b(Et.$$.fragment,s),b(Ha.$$.fragment,s),b(St.$$.fragment,s),b(La.$$.fragment,s),b(Ht.$$.fragment,s),b(Pa.$$.fragment,s),b(Lt.$$.fragment,s),b(Da.$$.fragment,s),b(Pt.$$.fragment,s),b(Dt.$$.fragment,s),b(Kt.$$.fragment,s),b(Ka.$$.fragment,s),b(qt.$$.fragment,s),b(qa.$$.fragment,s),b(Ot.$$.fragment,s),b(Oa.$$.fragment,s),b(ea.$$.fragment,s),b(es.$$.fragment,s),b(ta.$$.fragment,s),b(ts.$$.fragment,s),b(aa.$$.fragment,s),b(as.$$.fragment,s),b(sa.$$.fragment,s),b(ss.$$.fragment,s),b(la.$$.fragment,s),b(ls.$$.fragment,s),b(ra.$$.fragment,s),b(na.$$.fragment,s),b(rs.$$.fragment,s),b(ca.$$.fragment,s),b(ns.$$.fragment,s),b(oa.$$.fragment,s),b(cs.$$.fragment,s),b(pa.$$.fragment,s),b(os.$$.fragment,s),b(ia.$$.fragment,s),b(ps.$$.fragment,s),b(da.$$.fragment,s),b(ma.$$.fragment,s),b(is.$$.fragment,s),b(ha.$$.fragment,s),b(ds.$$.fragment,s),b(ga.$$.fragment,s),b(ms.$$.fragment,s),b(ua.$$.fragment,s),b(hs.$$.fragment,s),b(fa.$$.fragment,s),b(gs.$$.fragment,s),b(ba.$$.fragment,s),b(us.$$.fragment,s),b($a.$$.fragment,s),b(fs.$$.fragment,s),b(bs.$$.fragment,s),b(Ma.$$.fragment,s),b($s.$$.fragment,s),b(ys.$$.fragment,s),b(Ms.$$.fragment,s),Ol=!0)},o(s){$(o.$$.fragment,s),$(p.$$.fragment,s),$(wa.$$.fragment,s),$(_a.$$.fragment,s),$(va.$$.fragment,s),$($t.$$.fragment,s),$(Ja.$$.fragment,s),$(yt.$$.fragment,s),$(Ta.$$.fragment,s),$(Mt.$$.fragment,s),$(Ua.$$.fragment,s),$(jt.$$.fragment,s),$(xa.$$.fragment,s),$(wt.$$.fragment,s),$(ka.$$.fragment,s),$(_t.$$.fragment,s),$(Ga.$$.fragment,s),$(vt.$$.fragment,s),$(Ba.$$.fragment,s),$(Jt.$$.fragment,s),$(Ca.$$.fragment,s),$(Tt.$$.fragment,s),$(Ia.$$.fragment,s),$(Ut.$$.fragment,s),$(Za.$$.fragment,s),$(xt.$$.fragment,s),$(Wa.$$.fragment,s),$(kt.$$.fragment,s),$(Ya.$$.fragment,s),$(Gt.$$.fragment,s),$(Xa.$$.fragment,s),$(Bt.$$.fragment,s),$(Ct.$$.fragment,s),$(It.$$.fragment,s),$(Aa.$$.fragment,s),$(Zt.$$.fragment,s),$(Wt.$$.fragment,s),$(Na.$$.fragment,s),$(Yt.$$.fragment,s),$(Va.$$.fragment,s),$(Qa.$$.fragment,s),$(At.$$.fragment,s),$(Fa.$$.fragment,s),$(Nt.$$.fragment,s),$(Vt.$$.fragment,s),$(Qt.$$.fragment,s),$(za.$$.fragment,s),$(Ft.$$.fragment,s),$(Ra.$$.fragment,s),$(zt.$$.fragment,s),$(Ea.$$.fragment,s),$(Rt.$$.fragment,s),$(Sa.$$.fragment,s),$(Et.$$.fragment,s),$(Ha.$$.fragment,s),$(St.$$.fragment,s),$(La.$$.fragment,s),$(Ht.$$.fragment,s),$(Pa.$$.fragment,s),$(Lt.$$.fragment,s),$(Da.$$.fragment,s),$(Pt.$$.fragment,s),$(Dt.$$.fragment,s),$(Kt.$$.fragment,s),$(Ka.$$.fragment,s),$(qt.$$.fragment,s),$(qa.$$.fragment,s),$(Ot.$$.fragment,s),$(Oa.$$.fragment,s),$(ea.$$.fragment,s),$(es.$$.fragment,s),$(ta.$$.fragment,s),$(ts.$$.fragment,s),$(aa.$$.fragment,s),$(as.$$.fragment,s),$(sa.$$.fragment,s),$(ss.$$.fragment,s),$(la.$$.fragment,s),$(ls.$$.fragment,s),$(ra.$$.fragment,s),$(na.$$.fragment,s),$(rs.$$.fragment,s),$(ca.$$.fragment,s),$(ns.$$.fragment,s),$(oa.$$.fragment,s),$(cs.$$.fragment,s),$(pa.$$.fragment,s),$(os.$$.fragment,s),$(ia.$$.fragment,s),$(ps.$$.fragment,s),$(da.$$.fragment,s),$(ma.$$.fragment,s),$(is.$$.fragment,s),$(ha.$$.fragment,s),$(ds.$$.fragment,s),$(ga.$$.fragment,s),$(ms.$$.fragment,s),$(ua.$$.fragment,s),$(hs.$$.fragment,s),$(fa.$$.fragment,s),$(gs.$$.fragment,s),$(ba.$$.fragment,s),$(us.$$.fragment,s),$($a.$$.fragment,s),$(fs.$$.fragment,s),$(bs.$$.fragment,s),$(Ma.$$.fragment,s),$($s.$$.fragment,s),$(ys.$$.fragment,s),$(Ms.$$.fragment,s),Ol=!1},d(s){s&&(h(m),h(r),h(a),h(e),h(Sl),h(ja),h(Hl),h(Ll),h(v),h(Pl),h(Dl),h(He),h(Kl),h(ql),h(El)),h(t),y(o,s),y(p,s),y(wa,s),y(_a),y(va),y($t),y(Ja),y(yt),y(Ta),y(Mt),y(Ua),y(jt),y(xa),y(wt),y(ka),y(_t),y(Ga),y(vt),y(Ba),y(Jt),y(Ca),y(Tt),y(Ia),y(Ut),y(Za),y(xt),y(Wa),y(kt),y(Ya),y(Gt),y(Xa),y(Bt),y(Ct),y(It),y(Aa),y(Zt),y(Wt),y(Na),y(Yt),y(Va),y(Qa),y(At),y(Fa),y(Nt),y(Vt),y(Qt),y(za),y(Ft),y(Ra),y(zt),y(Ea),y(Rt),y(Sa),y(Et),y(Ha),y(St),y(La),y(Ht),y(Pa),y(Lt),y(Da),y(Pt),y(Dt),y(Kt),y(Ka),y(qt),y(qa),y(Ot),y(Oa),y(ea),y(es),y(ta),y(ts),y(aa),y(as),y(sa),y(ss),y(la),y(ls),y(ra),y(na),y(rs),y(ca),y(ns),y(oa),y(cs),y(pa),y(os),y(ia),y(ps),y(da),y(ma),y(is),y(ha),y(ds),y(ga),y(ms),y(ua),y(hs),y(fa),y(gs),y(ba),y(us),y($a),y(fs),y(bs),y(Ma),y($s,s),y(ys),y(Ms,s)}}}const td='{"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 ad(_){return Hp(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class id extends Lp{constructor(t){super(),Pp(this,t,ad,ed,Sp,{})}}export{id as component};
