Buckets:
| import{s as qp,o as Op,n as T}from"../chunks/scheduler.b9285784.js";import{S as ei,i as ti,e as i,s as n,c as g,h as ai,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 y,p as $}from"../chunks/index.26bc89a1.js";import{T as Se}from"../chunks/Tip.e4eba3d6.js";import{C as si,H as vo,E as li}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.c0f56888.js";import{D as k}from"../chunks/Docstring.357c28c5.js";import{C as B}from"../chunks/CodeBlock.2b639c7d.js";import{E as G}from"../chunks/ExampleCodeBlock.09fa6cbd.js";function ri(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoZ3JhZGllbnRfYWNjdW11bGF0aW9uX3N0ZXBzJTNEMSklMEFkYXRhbG9hZGVyJTJDJTIwbW9kZWwlMkMlMjBvcHRpbWl6ZXIlMkMlMjBzY2hlZHVsZXIlMjAlM0QlMjBhY2NlbGVyYXRvci5wcmVwYXJlKGRhdGFsb2FkZXIlMkMlMjBtb2RlbCUyQyUyMG9wdGltaXplciUyQyUyMHNjaGVkdWxlciklMEElMEFmb3IlMjBpbnB1dCUyQyUyMG91dHB1dCUyMGluJTIwZGF0YWxvYWRlciUzQSUwQSUyMCUyMCUyMCUyMHdpdGglMjBhY2NlbGVyYXRvci5hY2N1bXVsYXRlKG1vZGVsKSUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMG91dHB1dHMlMjAlM0QlMjBtb2RlbChpbnB1dCklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBsb3NzJTIwJTNEJTIwbG9zc19mdW5jKG91dHB1dHMpJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwbG9zcy5iYWNrd2FyZCgpJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwb3B0aW1pemVyLnN0ZXAoKSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHNjaGVkdWxlci5zdGVwKCklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBvcHRpbWl6ZXIuemVyb19ncmFkKCk=",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator | |
| <span class="hljs-meta">>>> </span>accelerator = Accelerator(gradient_accumulation_steps=<span class="hljs-number">1</span>) | |
| <span class="hljs-meta">>>> </span>dataloader, model, optimizer, scheduler = accelerator.prepare(dataloader, model, optimizer, scheduler) | |
| <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> <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()`,lang:"python",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){y(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),$(a,e)}}}function ni(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IobWl4ZWRfcHJlY2lzaW9uJTNEJTIyZnAxNiUyMiklMEF3aXRoJTIwYWNjZWxlcmF0b3IuYXV0b2Nhc3QoKSUzQSUwQSUyMCUyMCUyMCUyMHRyYWluKCk=",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator | |
| <span class="hljs-meta">>>> </span>accelerator = Accelerator(mixed_precision=<span class="hljs-string">"fp16"</span>) | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">with</span> accelerator.autocast(): | |
| <span class="hljs-meta">... </span> train()`,lang:"python",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){y(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),$(a,e)}}}function ci(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoZ3JhZGllbnRfYWNjdW11bGF0aW9uX3N0ZXBzJTNEMiklMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoaW5wdXRzKSUwQWxvc3MlMjAlM0QlMjBsb3NzX2ZuKG91dHB1dHMlMkMlMjBsYWJlbHMpJTBBYWNjZWxlcmF0b3IuYmFja3dhcmQobG9zcyk=",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator | |
| <span class="hljs-meta">>>> </span>accelerator = Accelerator(gradient_accumulation_steps=<span class="hljs-number">2</span>) | |
| <span class="hljs-meta">>>> </span>outputs = model(inputs) | |
| <span class="hljs-meta">>>> </span>loss = loss_fn(outputs, labels) | |
| <span class="hljs-meta">>>> </span>accelerator.backward(loss)`,lang:"python",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){y(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),$(a,e)}}}function oi(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKSUwQSUyMyUyMEFzc3VtZSUyMGxhdGVyJTIwaW4lMjB0aGUlMjB0cmFpbmluZyUyMHNjcmlwdCUwQSUyMyUyMCU2MHNob3VsZF9kb19icmVha3BvaW50JTYwJTIwaXMlMjBhJTIwY3VzdG9tJTIwZnVuY3Rpb24lMjB0byUyMG1vbml0b3IlMjB3aGVuJTIwdG8lMjBicmVhayUyQyUwQSUyMyUyMGUuZy4lMjB3aGVuJTIwdGhlJTIwbG9zcyUyMGlzJTIwTmFOJTBBaWYlMjBzaG91bGRfZG9fYnJlYWtwb2ludChsb3NzKSUzQSUwQSUyMCUyMCUyMCUyMGFjY2VsZXJhdG9yLnNldF90cmlnZ2VyKCklMEElMjMlMjBBc3N1bWUlMjBsYXRlciUyMGluJTIwdGhlJTIwdHJhaW5pbmclMjBzY3JpcHQlMEFpZiUyMGFjY2VsZXJhdG9yLmNoZWNrX3RyaWdnZXIoKSUzQSUwQSUyMCUyMCUyMCUyMGJyZWFr",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator | |
| <span class="hljs-meta">>>> </span>accelerator = Accelerator() | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Assume later in the training script</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># \`should_do_breakpoint\` is a custom function to monitor when to break,</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># e.g. when the loss is NaN</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">if</span> should_do_breakpoint(loss): | |
| <span class="hljs-meta">... </span> accelerator.set_trigger() | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Assume later in the training script</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">if</span> accelerator.check_trigger(): | |
| <span class="hljs-meta">... </span> <span class="hljs-keyword">break</span>`,lang:"python",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){y(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),$(a,e)}}}function pi(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKSUwQW1vZGVsJTJDJTIwb3B0aW1pemVyJTJDJTIwc2NoZWR1bGVyJTIwJTNEJTIwLi4uJTBBbW9kZWwlMkMlMjBvcHRpbWl6ZXIlMkMlMjBzY2hlZHVsZXIlMjAlM0QlMjBhY2NlbGVyYXRvci5wcmVwYXJlKG1vZGVsJTJDJTIwb3B0aW1pemVyJTJDJTIwc2NoZWR1bGVyKSUwQW1vZGVsJTJDJTIwb3B0aW1pemVyJTJDJTIwc2NoZWR1bGVyJTIwJTNEJTIwYWNjZWxlcmF0b3IuY2xlYXIobW9kZWwlMkMlMjBvcHRpbWl6ZXIlMkMlMjBzY2hlZHVsZXIp",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator | |
| <span class="hljs-meta">>>> </span>accelerator = Accelerator() | |
| <span class="hljs-meta">>>> </span>model, optimizer, scheduler = ... | |
| <span class="hljs-meta">>>> </span>model, optimizer, scheduler = accelerator.prepare(model, optimizer, scheduler) | |
| <span class="hljs-meta">>>> </span>model, optimizer, scheduler = accelerator.clear(model, optimizer, scheduler)`,lang:"python",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){y(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),$(a,e)}}}function ii(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoZ3JhZGllbnRfYWNjdW11bGF0aW9uX3N0ZXBzJTNEMiklMEFkYXRhbG9hZGVyJTJDJTIwbW9kZWwlMkMlMjBvcHRpbWl6ZXIlMkMlMjBzY2hlZHVsZXIlMjAlM0QlMjBhY2NlbGVyYXRvci5wcmVwYXJlKGRhdGFsb2FkZXIlMkMlMjBtb2RlbCUyQyUyMG9wdGltaXplciUyQyUyMHNjaGVkdWxlciklMEElMEFmb3IlMjBpbnB1dCUyQyUyMHRhcmdldCUyMGluJTIwZGF0YWxvYWRlciUzQSUwQSUyMCUyMCUyMCUyMG9wdGltaXplci56ZXJvX2dyYWQoKSUwQSUyMCUyMCUyMCUyMG91dHB1dCUyMCUzRCUyMG1vZGVsKGlucHV0KSUwQSUyMCUyMCUyMCUyMGxvc3MlMjAlM0QlMjBsb3NzX2Z1bmMob3V0cHV0JTJDJTIwdGFyZ2V0KSUwQSUyMCUyMCUyMCUyMGFjY2VsZXJhdG9yLmJhY2t3YXJkKGxvc3MpJTBBJTIwJTIwJTIwJTIwaWYlMjBhY2NlbGVyYXRvci5zeW5jX2dyYWRpZW50cyUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGFjY2VsZXJhdG9yLmNsaXBfZ3JhZF9ub3JtXyhtb2RlbC5wYXJhbWV0ZXJzKCklMkMlMjBtYXhfZ3JhZF9ub3JtKSUwQSUyMCUyMCUyMCUyMG9wdGltaXplci5zdGVwKCk=",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator | |
| <span class="hljs-meta">>>> </span>accelerator = Accelerator(gradient_accumulation_steps=<span class="hljs-number">2</span>) | |
| <span class="hljs-meta">>>> </span>dataloader, model, optimizer, scheduler = accelerator.prepare(dataloader, model, optimizer, scheduler) | |
| <span class="hljs-meta">>>> </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()`,lang:"python",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){y(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),$(a,e)}}}function di(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoZ3JhZGllbnRfYWNjdW11bGF0aW9uX3N0ZXBzJTNEMiklMEFkYXRhbG9hZGVyJTJDJTIwbW9kZWwlMkMlMjBvcHRpbWl6ZXIlMkMlMjBzY2hlZHVsZXIlMjAlM0QlMjBhY2NlbGVyYXRvci5wcmVwYXJlKGRhdGFsb2FkZXIlMkMlMjBtb2RlbCUyQyUyMG9wdGltaXplciUyQyUyMHNjaGVkdWxlciklMEElMEFmb3IlMjBpbnB1dCUyQyUyMHRhcmdldCUyMGluJTIwZGF0YWxvYWRlciUzQSUwQSUyMCUyMCUyMCUyMG9wdGltaXplci56ZXJvX2dyYWQoKSUwQSUyMCUyMCUyMCUyMG91dHB1dCUyMCUzRCUyMG1vZGVsKGlucHV0KSUwQSUyMCUyMCUyMCUyMGxvc3MlMjAlM0QlMjBsb3NzX2Z1bmMob3V0cHV0JTJDJTIwdGFyZ2V0KSUwQSUyMCUyMCUyMCUyMGFjY2VsZXJhdG9yLmJhY2t3YXJkKGxvc3MpJTBBJTIwJTIwJTIwJTIwaWYlMjBhY2NlbGVyYXRvci5zeW5jX2dyYWRpZW50cyUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGFjY2VsZXJhdG9yLmNsaXBfZ3JhZF92YWx1ZV8obW9kZWwucGFyYW1ldGVycygpJTJDJTIwY2xpcF92YWx1ZSklMEElMjAlMjAlMjAlMjBvcHRpbWl6ZXIuc3RlcCgp",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator | |
| <span class="hljs-meta">>>> </span>accelerator = Accelerator(gradient_accumulation_steps=<span class="hljs-number">2</span>) | |
| <span class="hljs-meta">>>> </span>dataloader, model, optimizer, scheduler = accelerator.prepare(dataloader, model, optimizer, scheduler) | |
| <span class="hljs-meta">>>> </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()`,lang:"python",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){y(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),$(a,e)}}}function mi(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IobG9nX3dpdGglM0QlMjJ0ZW5zb3Jib2FyZCUyMiklMEFhY2NlbGVyYXRvci5pbml0X3RyYWNrZXJzKCUyMm15X3Byb2plY3QlMjIpJTBBJTIzJTIwRG8lMjB0cmFpbmluZyUwQWFjY2VsZXJhdG9yLmVuZF90cmFpbmluZygp",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator | |
| <span class="hljs-meta">>>> </span>accelerator = Accelerator(log_with=<span class="hljs-string">"tensorboard"</span>) | |
| <span class="hljs-meta">>>> </span>accelerator.init_trackers(<span class="hljs-string">"my_project"</span>) | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Do training</span> | |
| <span class="hljs-meta">>>> </span>accelerator.end_training()`,lang:"python",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){y(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),$(a,e)}}}function hi(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKSUwQW1vZGVsJTJDJTIwb3B0aW1pemVyJTJDJTIwc2NoZWR1bGVyJTIwJTNEJTIwLi4uJTBBbW9kZWwlMkMlMjBvcHRpbWl6ZXIlMkMlMjBzY2hlZHVsZXIlMjAlM0QlMjBhY2NlbGVyYXRvci5wcmVwYXJlKG1vZGVsJTJDJTIwb3B0aW1pemVyJTJDJTIwc2NoZWR1bGVyKSUwQW1vZGVsJTJDJTIwb3B0aW1pemVyJTJDJTIwc2NoZWR1bGVyJTIwJTNEJTIwYWNjZWxlcmF0b3IuZnJlZV9tZW1vcnkobW9kZWwlMkMlMjBvcHRpbWl6ZXIlMkMlMjBzY2hlZHVsZXIp",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator | |
| <span class="hljs-meta">>>> </span>accelerator = Accelerator() | |
| <span class="hljs-meta">>>> </span>model, optimizer, scheduler = ... | |
| <span class="hljs-meta">>>> </span>model, optimizer, scheduler = accelerator.prepare(model, optimizer, scheduler) | |
| <span class="hljs-meta">>>> </span>model, optimizer, scheduler = accelerator.free_memory(model, optimizer, scheduler)`,lang:"python",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){y(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),$(a,e)}}}function gi(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"JTIzJTIwQXNzdW1pbmclMjBmb3VyJTIwcHJvY2Vzc2VzJTBBaW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwYWNjZWxlcmF0ZSUyMGltcG9ydCUyMEFjY2VsZXJhdG9yJTBBJTBBYWNjZWxlcmF0b3IlMjAlM0QlMjBBY2NlbGVyYXRvcigpJTBBcHJvY2Vzc190ZW5zb3IlMjAlM0QlMjB0b3JjaC50ZW5zb3IoJTVCYWNjZWxlcmF0b3IucHJvY2Vzc19pbmRleCU1RCUyQyUyMGRldmljZSUzRGFjY2VsZXJhdG9yLmRldmljZSklMEFnYXRoZXJlZF90ZW5zb3IlMjAlM0QlMjBhY2NlbGVyYXRvci5nYXRoZXIocHJvY2Vzc190ZW5zb3IpJTBBZ2F0aGVyZWRfdGVuc29y",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-comment"># Assuming four processes</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator | |
| <span class="hljs-meta">>>> </span>accelerator = Accelerator() | |
| <span class="hljs-meta">>>> </span>process_tensor = torch.tensor([accelerator.process_index], device=accelerator.device) | |
| <span class="hljs-meta">>>> </span>gathered_tensor = accelerator.gather(process_tensor) | |
| <span class="hljs-meta">>>> </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>])`,lang:"python",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){y(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),$(a,e)}}}function ui(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"JTIzJTIwQXNzdW1pbmclMjB0d28lMjBwcm9jZXNzZXMlMkMlMjB3aXRoJTIwYSUyMGJhdGNoJTIwc2l6ZSUyMG9mJTIwNSUyMG9uJTIwYSUyMGRhdGFzZXQlMjB3aXRoJTIwOSUyMHNhbXBsZXMlMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjBhY2NlbGVyYXRlJTIwaW1wb3J0JTIwQWNjZWxlcmF0b3IlMEElMEFhY2NlbGVyYXRvciUyMCUzRCUyMEFjY2VsZXJhdG9yKCklMEFkYXRhbG9hZGVyJTIwJTNEJTIwdG9yY2gudXRpbHMuZGF0YS5EYXRhTG9hZGVyKHJhbmdlKDkpJTJDJTIwYmF0Y2hfc2l6ZSUzRDUpJTBBZGF0YWxvYWRlciUyMCUzRCUyMGFjY2VsZXJhdG9yLnByZXBhcmUoZGF0YWxvYWRlciklMEFiYXRjaCUyMCUzRCUyMG5leHQoaXRlcihkYXRhbG9hZGVyKSklMEFnYXRoZXJlZF9pdGVtcyUyMCUzRCUyMGFjY2VsZXJhdG9yLmdhdGhlcl9mb3JfbWV0cmljcyhiYXRjaCklMEFsZW4oZ2F0aGVyZWRfaXRlbXMp",highlighted:`<span class="hljs-meta">>>> </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">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator | |
| <span class="hljs-meta">>>> </span>accelerator = Accelerator() | |
| <span class="hljs-meta">>>> </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">>>> </span>dataloader = accelerator.prepare(dataloader) | |
| <span class="hljs-meta">>>> </span>batch = <span class="hljs-built_in">next</span>(<span class="hljs-built_in">iter</span>(dataloader)) | |
| <span class="hljs-meta">>>> </span>gathered_items = accelerator.gather_for_metrics(batch) | |
| <span class="hljs-meta">>>> </span><span class="hljs-built_in">len</span>(gathered_items) | |
| <span class="hljs-number">9</span>`,lang:"python",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){y(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),$(a,e)}}}function fi(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwYWNjZWxlcmF0ZSUyMGltcG9ydCUyMEFjY2VsZXJhdG9yJTBBJTBBYWNjZWxlcmF0b3IlMjAlM0QlMjBBY2NlbGVyYXRvcigpJTBBbmV0JTIwJTNEJTIwdG9yY2gubm4uTGluZWFyKDIlMkMlMjAyKSUwQW5ldCUyMCUzRCUyMGFjY2VsZXJhdG9yLnByZXBhcmUobmV0KSUwQXN0YXRlX2RpY3QlMjAlM0QlMjBhY2NlbGVyYXRvci5nZXRfc3RhdGVfZGljdChuZXQp",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator | |
| <span class="hljs-meta">>>> </span>accelerator = Accelerator() | |
| <span class="hljs-meta">>>> </span>net = torch.nn.Linear(<span class="hljs-number">2</span>, <span class="hljs-number">2</span>) | |
| <span class="hljs-meta">>>> </span>net = accelerator.prepare(net) | |
| <span class="hljs-meta">>>> </span>state_dict = accelerator.get_state_dict(net)`,lang:"python",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){y(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),$(a,e)}}}function bi(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IobG9nX3dpdGglM0QlMjJ0ZW5zb3Jib2FyZCUyMiklMEFhY2NlbGVyYXRvci5pbml0X3RyYWNrZXJzKCUyMm15X3Byb2plY3QlMjIpJTBBdGVuc29yYm9hcmRfdHJhY2tlciUyMCUzRCUyMGFjY2VsZXJhdG9yLmdldF90cmFja2VyKCUyMnRlbnNvcmJvYXJkJTIyKQ==",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator | |
| <span class="hljs-meta">>>> </span>accelerator = Accelerator(log_with=<span class="hljs-string">"tensorboard"</span>) | |
| <span class="hljs-meta">>>> </span>accelerator.init_trackers(<span class="hljs-string">"my_project"</span>) | |
| <span class="hljs-meta">>>> </span>tensorboard_tracker = accelerator.get_tracker(<span class="hljs-string">"tensorboard"</span>)`,lang:"python",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){y(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),$(a,e)}}}function yi(_){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 $i(_){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 Mi(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoZXZlbl9iYXRjaGVzJTNEVHJ1ZSklMEFkZHBfbW9kZWwlMkMlMjBvcHRpbWl6ZXIlMkMlMjBkYXRhbG9hZGVyJTIwJTNEJTIwYWNjZWxlcmF0b3IucHJlcGFyZShtb2RlbCUyQyUyMG9wdGltaXplciUyQyUyMGRhdGFsb2FkZXIpJTBBJTBBd2l0aCUyMGFjY2VsZXJhdG9yLmpvaW5fdW5ldmVuX2lucHV0cyglNUJkZHBfbW9kZWwlNUQlMkMlMjBldmVuX2JhdGNoZXMlM0RGYWxzZSklM0ElMEElMjAlMjAlMjAlMjBmb3IlMjBpbnB1dCUyQyUyMG91dHB1dCUyMGluJTIwZGF0YWxvYWRlciUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMG91dHB1dHMlMjAlM0QlMjBtb2RlbChpbnB1dCklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBsb3NzJTIwJTNEJTIwbG9zc19mdW5jKG91dHB1dHMpJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwbG9zcy5iYWNrd2FyZCgpJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwb3B0aW1pemVyLnN0ZXAoKSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMG9wdGltaXplci56ZXJvX2dyYWQoKQ==",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator | |
| <span class="hljs-meta">>>> </span>accelerator = Accelerator(even_batches=<span class="hljs-literal">True</span>) | |
| <span class="hljs-meta">>>> </span>ddp_model, optimizer, dataloader = accelerator.prepare(model, optimizer, dataloader) | |
| <span class="hljs-meta">>>> </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()`,lang:"python",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){y(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),$(a,e)}}}function ji(_){let t,m=`Should only be used in conjunction with <a href="/docs/accelerate/pr_4049/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-7n5011"&&(t.innerHTML=m)},m(r,a){w(r,t,a)},p:T,d(r){r&&h(t)}}}function wi(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKSUwQW1vZGVsJTJDJTIwb3B0aW1pemVyJTJDJTIwbHJfc2NoZWR1bGVyJTIwJTNEJTIwLi4uJTBBbW9kZWwlMkMlMjBvcHRpbWl6ZXIlMkMlMjBscl9zY2hlZHVsZXIlMjAlM0QlMjBhY2NlbGVyYXRvci5wcmVwYXJlKG1vZGVsJTJDJTIwb3B0aW1pemVyJTJDJTIwbHJfc2NoZWR1bGVyKSUwQWFjY2VsZXJhdG9yLmxvYWRfc3RhdGUoJTIybXlfY2hlY2twb2ludCUyMik=",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator | |
| <span class="hljs-meta">>>> </span>accelerator = Accelerator() | |
| <span class="hljs-meta">>>> </span>model, optimizer, lr_scheduler = ... | |
| <span class="hljs-meta">>>> </span>model, optimizer, lr_scheduler = accelerator.prepare(model, optimizer, lr_scheduler) | |
| <span class="hljs-meta">>>> </span>accelerator.load_state(<span class="hljs-string">"my_checkpoint"</span>)`,lang:"python",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){y(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),$(a,e)}}}function _i(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKSUwQXdpdGglMjBhY2NlbGVyYXRvci5sb2NhbF9tYWluX3Byb2Nlc3NfZmlyc3QoKSUzQSUwQSUyMCUyMCUyMCUyMCUyMyUyMFRoaXMlMjB3aWxsJTIwYmUlMjBwcmludGVkJTIwZmlyc3QlMjBieSUyMGxvY2FsJTIwcHJvY2VzcyUyMDAlMjB0aGVuJTIwaW4lMjBhJTIwc2VlbWluZ2x5JTBBJTIwJTIwJTIwJTIwJTIzJTIwcmFuZG9tJTIwb3JkZXIlMjBieSUyMHRoZSUyMG90aGVyJTIwcHJvY2Vzc2VzLiUwQSUyMCUyMCUyMCUyMHByaW50KGYlMjJUaGlzJTIwd2lsbCUyMGJlJTIwcHJpbnRlZCUyMGJ5JTIwcHJvY2VzcyUyMCU3QmFjY2VsZXJhdG9yLmxvY2FsX3Byb2Nlc3NfaW5kZXglN0QlMjIp",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator | |
| <span class="hljs-meta">>>> </span>accelerator = Accelerator() | |
| <span class="hljs-meta">>>> </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"This will be printed by process <span class="hljs-subst">{accelerator.local_process_index}</span>"</span>)`,lang:"python",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){y(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),$(a,e)}}}function vi(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKSUwQXdpdGglMjBhY2NlbGVyYXRvci5tYWluX3Byb2Nlc3NfZmlyc3QoKSUzQSUwQSUyMCUyMCUyMCUyMCUyMyUyMFRoaXMlMjB3aWxsJTIwYmUlMjBwcmludGVkJTIwZmlyc3QlMjBieSUyMHByb2Nlc3MlMjAwJTIwdGhlbiUyMGluJTIwYSUyMHNlZW1pbmdseSUwQSUyMCUyMCUyMCUyMCUyMyUyMHJhbmRvbSUyMG9yZGVyJTIwYnklMjB0aGUlMjBvdGhlciUyMHByb2Nlc3Nlcy4lMEElMjAlMjAlMjAlMjBwcmludChmJTIyVGhpcyUyMHdpbGwlMjBiZSUyMHByaW50ZWQlMjBieSUyMHByb2Nlc3MlMjAlN0JhY2NlbGVyYXRvci5wcm9jZXNzX2luZGV4JTdEJTIyKQ==",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator | |
| <span class="hljs-meta">>>> </span>accelerator = Accelerator() | |
| <span class="hljs-meta">>>> </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"This will be printed by process <span class="hljs-subst">{accelerator.process_index}</span>"</span>)`,lang:"python",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){y(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),$(a,e)}}}function Ji(_){let t,m="<code>context_parallel</code> is currently supported with FSDP2 and requires <code>parallelism_config.cp_size</code> >",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-1cwbxnt"&&(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 Ti(_){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 Ui(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"Zm9yJTIwYmF0Y2glMjBpbiUyMGRhdGFsb2FkZXIlM0ElMEElMjAlMjAlMjAlMjB3aXRoJTIwYWNjZWxlcmF0b3IubWF5YmVfY29udGV4dF9wYXJhbGxlbCglMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBidWZmZXJzJTNEJTVCYmF0Y2glNUIlMjJpbnB1dF9pZHMlMjIlNUQlMkMlMjBiYXRjaCU1QiUyMmF0dGVudGlvbl9tYXNrJTIyJTVEJTVEJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwYnVmZmVyX3NlcV9kaW1zJTNEJTVCMSUyQyUyMDElNUQlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBub19yZXN0b3JlX2J1ZmZlcnMlM0QlN0JiYXRjaCU1QiUyMmlucHV0X2lkcyUyMiU1RCU3RCUyQyUwQSUyMCUyMCUyMCUyMCklM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBvdXRwdXRzJTIwJTNEJTIwbW9kZWwoYmF0Y2gpJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwLi4u",highlighted:`<span class="hljs-meta">>>> </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">"input_ids"</span>], batch[<span class="hljs-string">"attention_mask"</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">"input_ids"</span>]}, | |
| <span class="hljs-meta">... </span> ): | |
| <span class="hljs-meta">... </span> outputs = model(batch) | |
| <span class="hljs-meta">... </span> ...`,lang:"python",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){y(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),$(a,e)}}}function xi(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKSUwQWRhdGFsb2FkZXIlMkMlMjBtb2RlbCUyQyUyMG9wdGltaXplciUyMCUzRCUyMGFjY2VsZXJhdG9yLnByZXBhcmUoZGF0YWxvYWRlciUyQyUyMG1vZGVsJTJDJTIwb3B0aW1pemVyKSUwQWlucHV0X2ElMjAlM0QlMjBuZXh0KGl0ZXIoZGF0YWxvYWRlcikpJTBBaW5wdXRfYiUyMCUzRCUyMG5leHQoaXRlcihkYXRhbG9hZGVyKSklMEElMEF3aXRoJTIwYWNjZWxlcmF0b3Iubm9fc3luYygpJTNBJTBBJTIwJTIwJTIwJTIwb3V0cHV0cyUyMCUzRCUyMG1vZGVsKGlucHV0X2EpJTBBJTIwJTIwJTIwJTIwbG9zcyUyMCUzRCUyMGxvc3NfZnVuYyhvdXRwdXRzKSUwQSUyMCUyMCUyMCUyMGFjY2VsZXJhdG9yLmJhY2t3YXJkKGxvc3MpJTBBJTIwJTIwJTIwJTIwJTIzJTIwTm8lMjBzeW5jaHJvbml6YXRpb24lMjBhY3Jvc3MlMjBwcm9jZXNzZXMlMkMlMjBvbmx5JTIwYWNjdW11bGF0ZSUyMGdyYWRpZW50cyUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbChpbnB1dF9iKSUwQWFjY2VsZXJhdG9yLmJhY2t3YXJkKGxvc3MpJTBBJTIzJTIwU3luY2hyb25pemF0aW9uJTIwYWNyb3NzJTIwYWxsJTIwcHJvY2Vzc2VzJTBBb3B0aW1pemVyLnN0ZXAoKSUwQW9wdGltaXplci56ZXJvX2dyYWQoKQ==",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator | |
| <span class="hljs-meta">>>> </span>accelerator = Accelerator() | |
| <span class="hljs-meta">>>> </span>dataloader, model, optimizer = accelerator.prepare(dataloader, model, optimizer) | |
| <span class="hljs-meta">>>> </span>input_a = <span class="hljs-built_in">next</span>(<span class="hljs-built_in">iter</span>(dataloader)) | |
| <span class="hljs-meta">>>> </span>input_b = <span class="hljs-built_in">next</span>(<span class="hljs-built_in">iter</span>(dataloader)) | |
| <span class="hljs-meta">>>> </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">>>> </span>outputs = model(input_b) | |
| <span class="hljs-meta">>>> </span>accelerator.backward(loss) | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Synchronization across all processes</span> | |
| <span class="hljs-meta">>>> </span>optimizer.step() | |
| <span class="hljs-meta">>>> </span>optimizer.zero_grad()`,lang:"python",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){y(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),$(a,e)}}}function ki(_){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"Printed on process <span class="hljs-subst">{accelerator.process_index}</span>"</span>) | |
| print_something() | |
| <span class="hljs-string">"Printed on process 3"</span>`,lang:"python",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){y(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),$(a,e)}}}function Gi(_){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">"This will be printed by process 0 only on each server."</span>) | |
| print_something() | |
| <span class="hljs-comment"># On server 1:</span> | |
| <span class="hljs-string">"This will be printed by process 0 only"</span> | |
| <span class="hljs-comment"># On server 2:</span> | |
| <span class="hljs-string">"This will be printed by process 0 only"</span>`,lang:"python",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){y(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),$(a,e)}}}function Bi(_){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"Printed on process <span class="hljs-subst">{accelerator.local_process_index}</span>"</span>) | |
| print_something() | |
| <span class="hljs-comment"># On server 1:</span> | |
| <span class="hljs-string">"Printed on process 2"</span> | |
| <span class="hljs-comment"># On server 2:</span> | |
| <span class="hljs-string">"Printed on process 2"</span>`,lang:"python",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){y(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),$(a,e)}}}function Ci(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKSUwQSUwQSUwQSU0MGFjY2VsZXJhdG9yLm9uX21haW5fcHJvY2VzcyUwQWRlZiUyMHByaW50X3NvbWV0aGluZygpJTNBJTBBJTIwJTIwJTIwJTIwcHJpbnQoJTIyVGhpcyUyMHdpbGwlMjBiZSUyMHByaW50ZWQlMjBieSUyMHByb2Nlc3MlMjAwJTIwb25seS4lMjIpJTBBJTBBJTBBcHJpbnRfc29tZXRoaW5nKCk=",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator | |
| <span class="hljs-meta">>>> </span>accelerator = Accelerator() | |
| <span class="hljs-meta">>>> </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">"This will be printed by process 0 only."</span>) | |
| <span class="hljs-meta">>>> </span>print_something() | |
| <span class="hljs-string">"This will be printed by process 0 only"</span>`,lang:"python",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){y(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),$(a,e)}}}function Ii(_){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"Printed on process <span class="hljs-subst">{accelerator.process_index}</span>"</span>) | |
| print_something() | |
| <span class="hljs-string">"Printed on process 2"</span>`,lang:"python",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){y(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),$(a,e)}}}function Zi(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"JTIzJTIwQXNzdW1pbmclMjB0d28lMjBwcm9jZXNzZXMlMkMlMjB3aXRoJTIwdGhlJTIwZmlyc3QlMjBwcm9jZXNzZXMlMjBoYXZpbmclMjBhJTIwdGVuc29yJTIwb2YlMjBzaXplJTIwMSUyMGFuZCUyMHRoZSUyMHNlY29uZCUyMG9mJTIwc2l6ZSUyMDIlMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjBhY2NlbGVyYXRlJTIwaW1wb3J0JTIwQWNjZWxlcmF0b3IlMEElMEFhY2NlbGVyYXRvciUyMCUzRCUyMEFjY2VsZXJhdG9yKCklMEFwcm9jZXNzX3RlbnNvciUyMCUzRCUyMHRvcmNoLmFyYW5nZShhY2NlbGVyYXRvci5wcm9jZXNzX2luZGV4JTIwJTJCJTIwMSkudG8oYWNjZWxlcmF0b3IuZGV2aWNlKSUwQXBhZGRlZF90ZW5zb3IlMjAlM0QlMjBhY2NlbGVyYXRvci5wYWRfYWNyb3NzX3Byb2Nlc3Nlcyhwcm9jZXNzX3RlbnNvciklMEFwYWRkZWRfdGVuc29yLnNoYXBl",highlighted:`<span class="hljs-meta">>>> </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">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator | |
| <span class="hljs-meta">>>> </span>accelerator = Accelerator() | |
| <span class="hljs-meta">>>> </span>process_tensor = torch.arange(accelerator.process_index + <span class="hljs-number">1</span>).to(accelerator.device) | |
| <span class="hljs-meta">>>> </span>padded_tensor = accelerator.pad_across_processes(process_tensor) | |
| <span class="hljs-meta">>>> </span>padded_tensor.shape | |
| torch.Size([<span class="hljs-number">2</span>])`,lang:"python",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){y(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),$(a,e)}}}function Wi(_){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 Yi(_){let t,m="Examples:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKSUwQSUyMyUyMEFzc3VtZSUyMGElMjBtb2RlbCUyQyUyMG9wdGltaXplciUyQyUyMGRhdGFfbG9hZGVyJTIwYW5kJTIwc2NoZWR1bGVyJTIwYXJlJTIwZGVmaW5lZCUwQW1vZGVsJTJDJTIwb3B0aW1pemVyJTJDJTIwZGF0YV9sb2FkZXIlMkMlMjBzY2hlZHVsZXIlMjAlM0QlMjBhY2NlbGVyYXRvci5wcmVwYXJlKG1vZGVsJTJDJTIwb3B0aW1pemVyJTJDJTIwZGF0YV9sb2FkZXIlMkMlMjBzY2hlZHVsZXIp",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator | |
| <span class="hljs-meta">>>> </span>accelerator = Accelerator() | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Assume a model, optimizer, data_loader and scheduler are defined</span> | |
| <span class="hljs-meta">>>> </span>model, optimizer, data_loader, scheduler = accelerator.prepare(model, optimizer, data_loader, scheduler)`,lang:"python",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){y(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),$(a,e)}}}function Xi(_){let t,m;return t=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKSUwQSUyMyUyMEFzc3VtZSUyMGElMjBtb2RlbCUyQyUyMG9wdGltaXplciUyQyUyMGRhdGFfbG9hZGVyJTIwYW5kJTIwc2NoZWR1bGVyJTIwYXJlJTIwZGVmaW5lZCUwQWRldmljZV9wbGFjZW1lbnQlMjAlM0QlMjAlNUJUcnVlJTJDJTIwVHJ1ZSUyQyUyMEZhbHNlJTJDJTIwRmFsc2UlNUQlMEElMjMlMjBXaWxsJTIwcGxhY2UlMjB0aGUlMjBmaXJzdCUyMHR3byUyMGl0ZW1zJTIwcGFzc2VkJTIwaW4lMjBhdXRvbWF0aWNhbGx5JTIwdG8lMjB0aGUlMjByaWdodCUyMGRldmljZSUyMGJ1dCUyMG5vdCUyMHRoZSUyMGxhc3QlMjB0d28uJTBBbW9kZWwlMkMlMjBvcHRpbWl6ZXIlMkMlMjBkYXRhX2xvYWRlciUyQyUyMHNjaGVkdWxlciUyMCUzRCUyMGFjY2VsZXJhdG9yLnByZXBhcmUoJTBBJTIwJTIwJTIwJTIwbW9kZWwlMkMlMjBvcHRpbWl6ZXIlMkMlMjBkYXRhX2xvYWRlciUyQyUyMHNjaGVkdWxlciUyQyUyMGRldmljZV9wbGFjZW1lbnQlM0RkZXZpY2VfcGxhY2VtZW50JTBBKQ==",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator | |
| <span class="hljs-meta">>>> </span>accelerator = Accelerator() | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Assume a model, optimizer, data_loader and scheduler are defined</span> | |
| <span class="hljs-meta">>>> </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">>>> </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">>>> </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>)`,lang:"python",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){y(t.$$.fragment,r),m=!1},d(r){$(t,r)}}}function Ai(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwYWNjZWxlcmF0ZSUyMGltcG9ydCUyMEFjY2VsZXJhdG9yJTBBJTBBYWNjZWxlcmF0b3IlMjAlM0QlMjBBY2NlbGVyYXRvcigpJTBBZGF0YV9sb2FkZXIlMjAlM0QlMjB0b3JjaC51dGlscy5kYXRhLkRhdGFMb2FkZXIoLi4uKSUwQWRhdGFfbG9hZGVyJTIwJTNEJTIwYWNjZWxlcmF0b3IucHJlcGFyZV9kYXRhX2xvYWRlcihkYXRhX2xvYWRlciUyQyUyMGRldmljZV9wbGFjZW1lbnQlM0RUcnVlKQ==",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator | |
| <span class="hljs-meta">>>> </span>accelerator = Accelerator() | |
| <span class="hljs-meta">>>> </span>data_loader = torch.utils.data.DataLoader(...) | |
| <span class="hljs-meta">>>> </span>data_loader = accelerator.prepare_data_loader(data_loader, device_placement=<span class="hljs-literal">True</span>)`,lang:"python",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){y(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),$(a,e)}}}function Ni(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKSUwQSUyMyUyMEFzc3VtZSUyMGElMjBtb2RlbCUyMGlzJTIwZGVmaW5lZCUwQW1vZGVsJTIwJTNEJTIwYWNjZWxlcmF0b3IucHJlcGFyZV9tb2RlbChtb2RlbCk=",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator | |
| <span class="hljs-meta">>>> </span>accelerator = Accelerator() | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Assume a model is defined</span> | |
| <span class="hljs-meta">>>> </span>model = accelerator.prepare_model(model)`,lang:"python",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){y(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),$(a,e)}}}function Vi(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwYWNjZWxlcmF0ZSUyMGltcG9ydCUyMEFjY2VsZXJhdG9yJTBBJTBBYWNjZWxlcmF0b3IlMjAlM0QlMjBBY2NlbGVyYXRvcigpJTBBb3B0aW1pemVyJTIwJTNEJTIwdG9yY2gub3B0aW0uQWRhbSguLi4pJTBBb3B0aW1pemVyJTIwJTNEJTIwYWNjZWxlcmF0b3IucHJlcGFyZV9vcHRpbWl6ZXIob3B0aW1pemVyJTJDJTIwZGV2aWNlX3BsYWNlbWVudCUzRFRydWUp",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator | |
| <span class="hljs-meta">>>> </span>accelerator = Accelerator() | |
| <span class="hljs-meta">>>> </span>optimizer = torch.optim.Adam(...) | |
| <span class="hljs-meta">>>> </span>optimizer = accelerator.prepare_optimizer(optimizer, device_placement=<span class="hljs-literal">True</span>)`,lang:"python",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){y(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),$(a,e)}}}function Qi(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwYWNjZWxlcmF0ZSUyMGltcG9ydCUyMEFjY2VsZXJhdG9yJTBBJTBBYWNjZWxlcmF0b3IlMjAlM0QlMjBBY2NlbGVyYXRvcigpJTBBb3B0aW1pemVyJTIwJTNEJTIwdG9yY2gub3B0aW0uQWRhbSguLi4pJTBBc2NoZWR1bGVyJTIwJTNEJTIwdG9yY2gub3B0aW0ubHJfc2NoZWR1bGVyLkxhbWJkYUxSKG9wdGltaXplciUyQyUyMC4uLiklMEFzY2hlZHVsZXIlMjAlM0QlMjBhY2NlbGVyYXRvci5wcmVwYXJlX3NjaGVkdWxlcihzY2hlZHVsZXIp",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator | |
| <span class="hljs-meta">>>> </span>accelerator = Accelerator() | |
| <span class="hljs-meta">>>> </span>optimizer = torch.optim.Adam(...) | |
| <span class="hljs-meta">>>> </span>scheduler = torch.optim.lr_scheduler.LambdaLR(optimizer, ...) | |
| <span class="hljs-meta">>>> </span>scheduler = accelerator.prepare_scheduler(scheduler)`,lang:"python",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){y(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),$(a,e)}}}function Fi(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKSUwQWFjY2VsZXJhdG9yLnByaW50KCUyMkhlbGxvJTIwd29ybGQhJTIyKQ==",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator | |
| <span class="hljs-meta">>>> </span>accelerator = Accelerator() | |
| <span class="hljs-meta">>>> </span>accelerator.<span class="hljs-built_in">print</span>(<span class="hljs-string">"Hello world!"</span>)`,lang:"python",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){y(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),$(a,e)}}}function zi(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"JTIzJTIwUHJvZmlsZSUyMHdpdGglMjBkZWZhdWx0JTIwc2V0dGluZ3MlMEFmcm9tJTIwYWNjZWxlcmF0ZSUyMGltcG9ydCUyMEFjY2VsZXJhdG9yJTBBZnJvbSUyMGFjY2VsZXJhdGUudXRpbHMlMjBpbXBvcnQlMjBQcm9maWxlS3dhcmdzJTBBJTBBYWNjZWxlcmF0b3IlMjAlM0QlMjBBY2NlbGVyYXRvcigpJTBBd2l0aCUyMGFjY2VsZXJhdG9yLnByb2ZpbGUoKSUyMGFzJTIwcHJvZiUzQSUwQSUyMCUyMCUyMCUyMHRyYWluKCklMEFhY2NlbGVyYXRvci5wcmludChwcm9mLmtleV9hdmVyYWdlcygpLnRhYmxlKCkpJTBBJTBBJTBBJTIzJTIwUHJvZmlsZSUyMHdpdGglMjB0aGUlMjBjdXN0b20lMjBoYW5kbGVyJTBBZGVmJTIwY3VzdG9tX2hhbmRsZXIocHJvZiklM0ElMEElMjAlMjAlMjAlMjBwcmludChwcm9mLmtleV9hdmVyYWdlcygpLnRhYmxlKHNvcnRfYnklM0QlMjJzZWxmX2NwdV90aW1lX3RvdGFsJTIyJTJDJTIwcm93X2xpbWl0JTNEMTApKSUwQSUwQSUwQWt3YXJncyUyMCUzRCUyMFByb2ZpbGVLd2FyZ3Moc2NoZWR1bGVfb3B0aW9uJTNEZGljdCh3YWl0JTNEMSUyQyUyMHdhcm11cCUzRDElMkMlMjBhY3RpdmUlM0QxKSUyQyUyMG9uX3RyYWNlX3JlYWR5JTNEY3VzdG9tX2hhbmRsZXIpJTBBYWNjZWxlcmF0b3IlMjAlM0QlMjBBY2NlbGVyYXRvcihrd2FyZ19oYW5kbGVyJTNEJTVCa3dhcmdzJTVEKSUwQXdpdGglMjBhY2NlbGVyYXRvci5wcm9maWxlKCklMjBhcyUyMHByb2YlM0ElMEElMjAlMjAlMjAlMjBmb3IlMjBfJTIwaW4lMjByYW5nZSgxMCklM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjB0cmFpbl9pdGVyYXRpb24oKSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHByb2Yuc3RlcCgpJTBBJTBBJTBBJTIzJTIwUHJvZmlsZSUyMGFuZCUyMGV4cG9ydCUyMHRvJTIwQ2hyb21lJTIwVHJhY2UlMEFrd2FyZ3MlMjAlM0QlMjBQcm9maWxlS3dhcmdzKG91dHB1dF90cmFjZV9kaXIlM0QlMjJvdXRwdXRfdHJhY2UlMjIpJTBBYWNjZWxlcmF0b3IlMjAlM0QlMjBBY2NlbGVyYXRvcihrd2FyZ19oYW5kbGVyJTNEJTVCa3dhcmdzJTVEKSUwQXdpdGglMjBhY2NlbGVyYXRvci5wcm9maWxlKCklM0ElMEElMjAlMjAlMjAlMjB0cmFpbigp",highlighted:`<span class="hljs-comment"># Profile with default settings</span> | |
| <span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator | |
| <span class="hljs-keyword">from</span> accelerate.utils <span class="hljs-keyword">import</span> ProfileKwargs | |
| accelerator = Accelerator() | |
| <span class="hljs-keyword">with</span> accelerator.profile() <span class="hljs-keyword">as</span> prof: | |
| train() | |
| accelerator.<span class="hljs-built_in">print</span>(prof.key_averages().table()) | |
| <span class="hljs-comment"># Profile with the custom handler</span> | |
| <span class="hljs-keyword">def</span> <span class="hljs-title function_">custom_handler</span>(<span class="hljs-params">prof</span>): | |
| <span class="hljs-built_in">print</span>(prof.key_averages().table(sort_by=<span class="hljs-string">"self_cpu_time_total"</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">"output_trace"</span>) | |
| accelerator = Accelerator(kwarg_handler=[kwargs]) | |
| <span class="hljs-keyword">with</span> accelerator.profile(): | |
| train()`,lang:"python",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){y(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),$(a,e)}}}function Ri(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"JTIzJTIwQXNzdW1pbmclMjB0d28lMjBwcm9jZXNzZXMlMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjBhY2NlbGVyYXRlJTIwaW1wb3J0JTIwQWNjZWxlcmF0b3IlMEElMEFhY2NlbGVyYXRvciUyMCUzRCUyMEFjY2VsZXJhdG9yKCklMEFwcm9jZXNzX3RlbnNvciUyMCUzRCUyMHRvcmNoLmFyYW5nZShhY2NlbGVyYXRvci5udW1fcHJvY2Vzc2VzKSUyMCUyQiUyMDElMjAlMkIlMjAoMiUyMColMjBhY2NlbGVyYXRvci5wcm9jZXNzX2luZGV4KSUwQXByb2Nlc3NfdGVuc29yJTIwJTNEJTIwcHJvY2Vzc190ZW5zb3IudG8oYWNjZWxlcmF0b3IuZGV2aWNlKSUwQXJlZHVjZWRfdGVuc29yJTIwJTNEJTIwYWNjZWxlcmF0b3IucmVkdWNlKHByb2Nlc3NfdGVuc29yJTJDJTIwcmVkdWN0aW9uJTNEJTIyc3VtJTIyKSUwQXJlZHVjZWRfdGVuc29y",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-comment"># Assuming two processes</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> torch | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator | |
| <span class="hljs-meta">>>> </span>accelerator = Accelerator() | |
| <span class="hljs-meta">>>> </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">>>> </span>process_tensor = process_tensor.to(accelerator.device) | |
| <span class="hljs-meta">>>> </span>reduced_tensor = accelerator.reduce(process_tensor, reduction=<span class="hljs-string">"sum"</span>) | |
| <span class="hljs-meta">>>> </span>reduced_tensor | |
| tensor([<span class="hljs-number">4</span>, <span class="hljs-number">6</span>])`,lang:"python",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){y(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),$(a,e)}}}function Ei(_){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 Si(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKSUwQSUyMyUyMEFzc3VtZSUyMCU2MEN1c3RvbU9iamVjdCU2MCUyMGhhcyUyMGElMjAlNjBzdGF0ZV9kaWN0JTYwJTIwYW5kJTIwJTYwbG9hZF9zdGF0ZV9kaWN0JTYwJTIwZnVuY3Rpb24uJTBBb2JqJTIwJTNEJTIwQ3VzdG9tT2JqZWN0KCklMEFhY2NlbGVyYXRvci5yZWdpc3Rlcl9mb3JfY2hlY2twb2ludGluZyhvYmopJTBBYWNjZWxlcmF0b3Iuc2F2ZV9zdGF0ZSglMjJjaGVja3BvaW50LnB0JTIyKQ==",highlighted:'<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator\n\n<span class="hljs-meta">>>> </span>accelerator = Accelerator()\n<span class="hljs-meta">>>> </span><span class="hljs-comment"># Assume `CustomObject` has a `state_dict` and `load_state_dict` function.</span>\n<span class="hljs-meta">>>> </span>obj = CustomObject()\n<span class="hljs-meta">>>> </span>accelerator.register_for_checkpointing(obj)\n<span class="hljs-meta">>>> </span>accelerator.save_state(<span class="hljs-string">"checkpoint.pt"</span>)',lang:"python",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){y(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),$(a,e)}}}function Hi(_){let t,m=`Should only be used in conjunction with <a href="/docs/accelerate/pr_4049/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-1ek9sb5"&&(t.innerHTML=m)},m(r,a){w(r,t,a)},p:T,d(r){r&&h(t)}}}function Li(_){let t,m=`Should only be used in conjunction with <a href="/docs/accelerate/pr_4049/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-1i9bqdy"&&(t.innerHTML=m)},m(r,a){w(r,t,a)},p:T,d(r){r&&h(t)}}}function Pi(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKSUwQWFyciUyMCUzRCUyMCU1QjAlMkMlMjAxJTJDJTIwMiUyQyUyMDMlNUQlMEFhY2NlbGVyYXRvci5zYXZlKGFyciUyQyUyMCUyMmFycmF5LnBrbCUyMik=",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator | |
| <span class="hljs-meta">>>> </span>accelerator = Accelerator() | |
| <span class="hljs-meta">>>> </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">>>> </span>accelerator.save(arr, <span class="hljs-string">"array.pkl"</span>)`,lang:"python",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){y(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),$(a,e)}}}function Di(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKSUwQW1vZGVsJTIwJTNEJTIwLi4uJTBBYWNjZWxlcmF0b3Iuc2F2ZV9tb2RlbChtb2RlbCUyQyUyMHNhdmVfZGlyZWN0b3J5KQ==",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator | |
| <span class="hljs-meta">>>> </span>accelerator = Accelerator() | |
| <span class="hljs-meta">>>> </span>model = ... | |
| <span class="hljs-meta">>>> </span>accelerator.save_model(model, save_directory)`,lang:"python",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){y(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),$(a,e)}}}function Ki(_){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 qi(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKSUwQW1vZGVsJTJDJTIwb3B0aW1pemVyJTJDJTIwbHJfc2NoZWR1bGVyJTIwJTNEJTIwLi4uJTBBbW9kZWwlMkMlMjBvcHRpbWl6ZXIlMkMlMjBscl9zY2hlZHVsZXIlMjAlM0QlMjBhY2NlbGVyYXRvci5wcmVwYXJlKG1vZGVsJTJDJTIwb3B0aW1pemVyJTJDJTIwbHJfc2NoZWR1bGVyKSUwQWFjY2VsZXJhdG9yLnNhdmVfc3RhdGUob3V0cHV0X2RpciUzRCUyMm15X2NoZWNrcG9pbnQlMjIp",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator | |
| <span class="hljs-meta">>>> </span>accelerator = Accelerator() | |
| <span class="hljs-meta">>>> </span>model, optimizer, lr_scheduler = ... | |
| <span class="hljs-meta">>>> </span>model, optimizer, lr_scheduler = accelerator.prepare(model, optimizer, lr_scheduler) | |
| <span class="hljs-meta">>>> </span>accelerator.save_state(output_dir=<span class="hljs-string">"my_checkpoint"</span>)`,lang:"python",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){y(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),$(a,e)}}}function Oi(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKSUwQSUyMyUyMEFzc3VtZSUyMGxhdGVyJTIwaW4lMjB0aGUlMjB0cmFpbmluZyUyMHNjcmlwdCUwQSUyMyUyMCU2MHNob3VsZF9kb19icmVha3BvaW50JTYwJTIwaXMlMjBhJTIwY3VzdG9tJTIwZnVuY3Rpb24lMjB0byUyMG1vbml0b3IlMjB3aGVuJTIwdG8lMjBicmVhayUyQyUwQSUyMyUyMGUuZy4lMjB3aGVuJTIwdGhlJTIwbG9zcyUyMGlzJTIwTmFOJTBBaWYlMjBzaG91bGRfZG9fYnJlYWtwb2ludChsb3NzKSUzQSUwQSUyMCUyMCUyMCUyMGFjY2VsZXJhdG9yLnNldF90cmlnZ2VyKCklMEElMjMlMjBBc3N1bWUlMjBsYXRlciUyMGluJTIwdGhlJTIwdHJhaW5pbmclMjBzY3JpcHQlMEFpZiUyMGFjY2VsZXJhdG9yLmNoZWNrX2JyZWFrcG9pbnQoKSUzQSUwQSUyMCUyMCUyMCUyMGJyZWFr",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator | |
| <span class="hljs-meta">>>> </span>accelerator = Accelerator() | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Assume later in the training script</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># \`should_do_breakpoint\` is a custom function to monitor when to break,</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># e.g. when the loss is NaN</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">if</span> should_do_breakpoint(loss): | |
| <span class="hljs-meta">... </span> accelerator.set_trigger() | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Assume later in the training script</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">if</span> accelerator.check_breakpoint(): | |
| <span class="hljs-meta">... </span> <span class="hljs-keyword">break</span>`,lang:"python",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){y(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),$(a,e)}}}function ed(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKSUwQWRhdGFsb2FkZXIlMkMlMjBtb2RlbCUyQyUyMG9wdGltaXplciUyQyUyMHNjaGVkdWxlciUyMCUzRCUyMGFjY2VsZXJhdG9yLnByZXBhcmUoZGF0YWxvYWRlciUyQyUyMG1vZGVsJTJDJTIwb3B0aW1pemVyJTJDJTIwc2NoZWR1bGVyKSUwQXNraXBwZWRfZGF0YWxvYWRlciUyMCUzRCUyMGFjY2VsZXJhdG9yLnNraXBfZmlyc3RfYmF0Y2hlcyhkYXRhbG9hZGVyJTJDJTIwbnVtX2JhdGNoZXMlM0QyKSUwQSUyMyUyMGZvciUyMHRoZSUyMGZpcnN0JTIwZXBvY2glMjBvbmx5JTBBZm9yJTIwaW5wdXQlMkMlMjB0YXJnZXQlMjBpbiUyMHNraXBwZWRfZGF0YWxvYWRlciUzQSUwQSUyMCUyMCUyMCUyMG9wdGltaXplci56ZXJvX2dyYWQoKSUwQSUyMCUyMCUyMCUyMG91dHB1dCUyMCUzRCUyMG1vZGVsKGlucHV0KSUwQSUyMCUyMCUyMCUyMGxvc3MlMjAlM0QlMjBsb3NzX2Z1bmMob3V0cHV0JTJDJTIwdGFyZ2V0KSUwQSUyMCUyMCUyMCUyMGFjY2VsZXJhdG9yLmJhY2t3YXJkKGxvc3MpJTBBJTIwJTIwJTIwJTIwb3B0aW1pemVyLnN0ZXAoKSUwQSUwQSUyMyUyMHN1YnNlcXVlbnQlMjBlcG9jaHMlMEFmb3IlMjBpbnB1dCUyQyUyMHRhcmdldCUyMGluJTIwZGF0YWxvYWRlciUzQSUwQSUyMCUyMCUyMCUyMG9wdGltaXplci56ZXJvX2dyYWQoKSUwQSUyMCUyMCUyMCUyMC4uLg==",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator | |
| <span class="hljs-meta">>>> </span>accelerator = Accelerator() | |
| <span class="hljs-meta">>>> </span>dataloader, model, optimizer, scheduler = accelerator.prepare(dataloader, model, optimizer, scheduler) | |
| <span class="hljs-meta">>>> </span>skipped_dataloader = accelerator.skip_first_batches(dataloader, num_batches=<span class="hljs-number">2</span>) | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># for the first epoch only</span> | |
| <span class="hljs-meta">>>> </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">>>> </span><span class="hljs-comment"># subsequent epochs</span> | |
| <span class="hljs-meta">>>> </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> ...`,lang:"python",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){y(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),$(a,e)}}}function td(_){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">"A"</span>, <span class="hljs-string">"B"</span>, <span class="hljs-string">"C"</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">"A"</span>, <span class="hljs-string">"B"</span>] | |
| <span class="hljs-comment"># Process 1</span> | |
| [<span class="hljs-string">"C"</span>] | |
| <span class="hljs-keyword">with</span> accelerator.split_between_processes([<span class="hljs-string">"A"</span>, <span class="hljs-string">"B"</span>, <span class="hljs-string">"C"</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">"A"</span>, <span class="hljs-string">"B"</span>] | |
| <span class="hljs-comment"># Process 1</span> | |
| [<span class="hljs-string">"C"</span>, <span class="hljs-string">"C"</span>]`,lang:"python",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){y(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),$(a,e)}}}function ad(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKSUwQWRhdGFsb2FkZXIlMkMlMjBtb2RlbCUyQyUyMG9wdGltaXplciUyMCUzRCUyMGFjY2VsZXJhdG9yLnByZXBhcmUoZGF0YWxvYWRlciUyQyUyMG1vZGVsJTJDJTIwb3B0aW1pemVyKSUwQSUwQXdpdGglMjBhY2NlbGVyYXRvci5ub19zeW5jKCklM0ElMEElMjAlMjAlMjAlMjBsb3NzX2ElMjAlM0QlMjBsb3NzX2Z1bmMobW9kZWwoaW5wdXRfYSkpJTIwJTIwJTIzJTIwZmlyc3QlMjBmb3J3YXJkJTIwcGFzcyUwQSUyMCUyMCUyMCUyMGxvc3NfYiUyMCUzRCUyMGxvc3NfZnVuYyhtb2RlbChpbnB1dF9iKSklMjAlMjAlMjMlMjBzZWNvbmQlMjBmb3J3YXJkJTIwcGFzcyUwQWFjY2VsZXJhdG9yLmJhY2t3YXJkKGxvc3NfYSklMjAlMjAlMjMlMjBObyUyMHN5bmNocm9uaXphdGlvbiUyMGFjcm9zcyUyMHByb2Nlc3NlcyUyQyUyMG9ubHklMjBhY2N1bXVsYXRlJTIwZ3JhZGllbnRzJTBBd2l0aCUyMGFjY2VsZXJhdG9yLnRyaWdnZXJfc3luY19pbl9iYWNrd2FyZChtb2RlbCklM0ElMEElMjAlMjAlMjAlMjBhY2NlbGVyYXRvci5iYWNrd2FyZChsb3NzX2IpJTIwJTIwJTIzJTIwU3luY2hyb25pemF0aW9uJTIwYWNyb3NzJTIwYWxsJTIwcHJvY2Vzc2VzJTBBb3B0aW1pemVyLnN0ZXAoKSUwQW9wdGltaXplci56ZXJvX2dyYWQoKQ==",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator | |
| <span class="hljs-meta">>>> </span>accelerator = Accelerator() | |
| <span class="hljs-meta">>>> </span>dataloader, model, optimizer = accelerator.prepare(dataloader, model, optimizer) | |
| <span class="hljs-meta">>>> </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">>>> </span>accelerator.backward(loss_a) <span class="hljs-comment"># No synchronization across processes, only accumulate gradients</span> | |
| <span class="hljs-meta">>>> </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">>>> </span>optimizer.step() | |
| <span class="hljs-meta">>>> </span>optimizer.zero_grad()`,lang:"python",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){y(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),$(a,e)}}}function sd(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"ZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKSUwQW1vZGVsJTJDJTIwb3B0aW1pemVyJTIwJTNEJTIwYWNjZWxlcmF0b3IucHJlcGFyZShtb2RlbCUyQyUyMG9wdGltaXplciklMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoaW5wdXRzKSUwQWxvc3MlMjAlM0QlMjBsb3NzX2ZuKG91dHB1dHMlMkMlMjBsYWJlbHMpJTBBYWNjZWxlcmF0b3IuYmFja3dhcmQobG9zcyklMEFhY2NlbGVyYXRvci51bnNjYWxlX2dyYWRpZW50cyhvcHRpbWl6ZXIlM0RvcHRpbWl6ZXIp",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator | |
| <span class="hljs-meta">>>> </span>accelerator = Accelerator() | |
| <span class="hljs-meta">>>> </span>model, optimizer = accelerator.prepare(model, optimizer) | |
| <span class="hljs-meta">>>> </span>outputs = model(inputs) | |
| <span class="hljs-meta">>>> </span>loss = loss_fn(outputs, labels) | |
| <span class="hljs-meta">>>> </span>accelerator.backward(loss) | |
| <span class="hljs-meta">>>> </span>accelerator.unscale_gradients(optimizer=optimizer)`,lang:"python",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){y(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),$(a,e)}}}function ld(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"JTIzJTIwQXNzdW1pbmclMjB0d28lMjBHUFUlMjBwcm9jZXNzZXMlMEFmcm9tJTIwdG9yY2gubm4ucGFyYWxsZWwlMjBpbXBvcnQlMjBEaXN0cmlidXRlZERhdGFQYXJhbGxlbCUwQWZyb20lMjBhY2NlbGVyYXRlJTIwaW1wb3J0JTIwQWNjZWxlcmF0b3IlMEElMEFhY2NlbGVyYXRvciUyMCUzRCUyMEFjY2VsZXJhdG9yKCklMEFtb2RlbCUyMCUzRCUyMGFjY2VsZXJhdG9yLnByZXBhcmUoTXlNb2RlbCgpKSUwQXByaW50KG1vZGVsLl9fY2xhc3NfXy5fX25hbWVfXyklMEElMEFtb2RlbCUyMCUzRCUyMGFjY2VsZXJhdG9yLnVud3JhcF9tb2RlbChtb2RlbCklMEFwcmludChtb2RlbC5fX2NsYXNzX18uX19uYW1lX18p",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-comment"># Assuming two GPU processes</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> torch.nn.parallel <span class="hljs-keyword">import</span> DistributedDataParallel | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator | |
| <span class="hljs-meta">>>> </span>accelerator = Accelerator() | |
| <span class="hljs-meta">>>> </span>model = accelerator.prepare(MyModel()) | |
| <span class="hljs-meta">>>> </span><span class="hljs-built_in">print</span>(model.__class__.__name__) | |
| DistributedDataParallel | |
| <span class="hljs-meta">>>> </span>model = accelerator.unwrap_model(model) | |
| <span class="hljs-meta">>>> </span><span class="hljs-built_in">print</span>(model.__class__.__name__) | |
| MyModel`,lang:"python",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){y(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),$(a,e)}}}function rd(_){let t,m="Example:",r,a,o;return a=new B({props:{code:"JTIzJTIwQXNzdW1pbmclMjB0d28lMjBHUFUlMjBwcm9jZXNzZXMlMEFpbXBvcnQlMjB0aW1lJTBBZnJvbSUyMGFjY2VsZXJhdGUlMjBpbXBvcnQlMjBBY2NlbGVyYXRvciUwQSUwQWFjY2VsZXJhdG9yJTIwJTNEJTIwQWNjZWxlcmF0b3IoKSUwQWlmJTIwYWNjZWxlcmF0b3IuaXNfbWFpbl9wcm9jZXNzJTNBJTBBJTIwJTIwJTIwJTIwdGltZS5zbGVlcCgyKSUwQWVsc2UlM0ElMEElMjAlMjAlMjAlMjBwcmludCglMjJJJ20lMjB3YWl0aW5nJTIwZm9yJTIwdGhlJTIwbWFpbiUyMHByb2Nlc3MlMjB0byUyMGZpbmlzaCUyMGl0cyUyMHNsZWVwLi4uJTIyKSUwQWFjY2VsZXJhdG9yLndhaXRfZm9yX2V2ZXJ5b25lKCklMEElMjMlMjBTaG91bGQlMjBwcmludCUyMG9uJTIwZXZlcnklMjBwcm9jZXNzJTIwYXQlMjB0aGUlMjBzYW1lJTIwdGltZSUwQXByaW50KCUyMkV2ZXJ5b25lJTIwaXMlMjBoZXJlJTIyKQ==",highlighted:`<span class="hljs-meta">>>> </span><span class="hljs-comment"># Assuming two GPU processes</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">import</span> time | |
| <span class="hljs-meta">>>> </span><span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator | |
| <span class="hljs-meta">>>> </span>accelerator = Accelerator() | |
| <span class="hljs-meta">>>> </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">>>> </span><span class="hljs-keyword">else</span>: | |
| <span class="hljs-meta">... </span> <span class="hljs-built_in">print</span>(<span class="hljs-string">"I'm waiting for the main process to finish its sleep..."</span>) | |
| <span class="hljs-meta">>>> </span>accelerator.wait_for_everyone() | |
| <span class="hljs-meta">>>> </span><span class="hljs-comment"># Should print on every process at the same time</span> | |
| <span class="hljs-meta">>>> </span><span class="hljs-built_in">print</span>(<span class="hljs-string">"Everyone is here"</span>)`,lang:"python",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){y(a.$$.fragment,e),o=!1},d(e){e&&(h(t),h(r)),$(a,e)}}}function nd(_){let t,m,r,a,o,e,p,Dl,wa,Jo='The <a href="/docs/accelerate/pr_4049/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/pr_4049/en/package_reference/accelerator#accelerate.Accelerator">Accelerator</a> to your script.',Kl,_a,ql,v,va,lr,Us,To="Creates an instance of an accelerator for distributed training or mixed precision training.",rr,xs,Uo="<strong>Available attributes:</strong>",nr,ks,xo=`<li><strong>device</strong> (<code>torch.device</code>) — The device to use.</li> <li><strong>distributed_type</strong> (<a href="/docs/accelerate/pr_4049/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/pr_4049/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>`,cr,we,Ja,or,Gs,ko="A context manager that will lightly wrap around and perform gradient accumulation automatically",pr,yt,ir,S,Ta,dr,Bs,Go=`Will apply automatic mixed-precision inside the block inside this context manager, if it is enabled. Nothing | |
| different will happen otherwise.`,mr,Cs,Bo=`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.`,hr,$t,gr,H,Ua,ur,Is,Co=`Scales the gradients in accordance to the <code>GradientAccumulationPlugin</code> and calls the correct <code>backward()</code> based | |
| on the configuration.`,fr,Zs,Io="Should be used in lieu of <code>loss.backward()</code>.",br,Mt,yr,L,xa,$r,Ws,Zo=`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.`,Mr,Ys,Wo=`Note: | |
| Does not require <code>wait_for_everyone()</code>`,jr,jt,wr,_e,ka,_r,Xs,Yo=`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.`,vr,wt,Jr,ve,Ga,Tr,As,Xo="Should be used in place of <code>torch.nn.utils.clip_grad_norm_</code>.",Ur,_t,xr,Je,Ba,kr,Ns,Ao="Should be used in place of <code>torch.nn.utils.clip_grad_value_</code>.",Gr,vt,Br,Jt,Ca,Cr,Vs,No="this is normally called as part of <code>prepare</code> but when dataloader was prepared apart from model (for the external accelerator.prepare call) this additional call needs to be made after prepare(model) (see HF Trainer as the use-case)",Ir,Te,Ia,Zr,Qs,Vo=`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.`,Wr,Tt,Yr,Ue,Za,Xr,Fs,Qo=`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.`,Ar,Ut,Nr,P,Wa,Vr,zs,Fo=`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.`,Qr,Rs,zo=`Note: | |
| This gather happens in all processes.`,Fr,xt,zr,xe,Ya,Rr,Es,Ro=`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.`,Er,kt,Sr,ke,Xa,Hr,Ss,Eo=`Returns the state dictionary of a model sent through <a href="/docs/accelerate/pr_4049/en/package_reference/accelerator#accelerate.Accelerator.prepare">Accelerator.prepare()</a> potentially without full | |
| precision.`,Lr,Gt,Pr,Ge,Aa,Dr,Hs,So="Returns a <code>tracker</code> from <code>self.trackers</code> based on <code>name</code> on the main process only.",Kr,Bt,qr,A,Na,Or,Ls,Ho=`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.`,en,Ct,tn,It,an,Zt,sn,D,Va,ln,Ps,Lo="Loads the current states of the model, optimizer, scaler, RNG generators, and registered objects.",rn,Wt,nn,Yt,cn,K,Qa,on,Ds,Po="Lets the local main process go inside a with block.",pn,Ks,Do="The other processes will enter the with block after the main process exits.",dn,Xt,mn,At,Fa,hn,qs,Ko="Runs backward pass on LOMO optimizers.",gn,q,za,un,Os,qo="Lets the main process go first inside a with block.",fn,el,Oo="The other processes will enter the with block after the main process exits.",bn,Nt,yn,N,Ra,$n,tl,ep="A context manager that enables context parallel training.",Mn,Vt,jn,Qt,wn,Ft,_n,O,Ea,vn,al,tp=`A context manager to disable gradient synchronizations across DDP processes by calling | |
| <code>torch.nn.parallel.DistributedDataParallel.no_sync</code>.`,Jn,sl,ap="If <code>model</code> is not in DDP, this context manager does nothing",Tn,zt,Un,Be,Sa,xn,ll,sp=`A decorator that will run the decorated function on the last process only. Can also be called using the | |
| <code>PartialState</code> class.`,kn,Rt,Gn,Ce,Ha,Bn,rl,lp=`A decorator that will run the decorated function on the local main process only. Can also be called using the | |
| <code>PartialState</code> class.`,Cn,Et,In,Ie,La,Zn,nl,rp=`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.`,Wn,St,Yn,Ze,Pa,Xn,cl,np=`A decorator that will run the decorated function on the main process only. Can also be called using the | |
| <code>PartialState</code> class.`,An,Ht,Nn,We,Da,Vn,ol,cp=`A decorator that will run the decorated function on a given process index only. Can also be called using the | |
| <code>PartialState</code> class.`,Qn,Lt,Fn,Ye,Ka,zn,pl,op=`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.`,Rn,Pt,En,V,qa,Sn,il,pp=`Prepare all objects passed in <code>args</code> for distributed training and mixed precision, then return them in the same | |
| order.`,Hn,Dt,Ln,Kt,Pn,qt,Dn,Xe,Oa,Kn,dl,ip=`Prepares a PyTorch DataLoader for training in any distributed setup. It is recommended to use | |
| <a href="/docs/accelerate/pr_4049/en/package_reference/accelerator#accelerate.Accelerator.prepare">Accelerator.prepare()</a> instead.`,qn,Ot,On,Ae,es,ec,ml,dp=`Prepares a PyTorch model for training in any distributed setup. It is recommended to use | |
| <a href="/docs/accelerate/pr_4049/en/package_reference/accelerator#accelerate.Accelerator.prepare">Accelerator.prepare()</a> instead.`,tc,ea,ac,Ne,ts,sc,hl,mp=`Prepares a PyTorch Optimizer for training in any distributed setup. It is recommended to use | |
| <a href="/docs/accelerate/pr_4049/en/package_reference/accelerator#accelerate.Accelerator.prepare">Accelerator.prepare()</a> instead.`,lc,ta,rc,Ve,as,nc,gl,hp=`Prepares a PyTorch Scheduler for training in any distributed setup. It is recommended to use | |
| <a href="/docs/accelerate/pr_4049/en/package_reference/accelerator#accelerate.Accelerator.prepare">Accelerator.prepare()</a> instead.`,cc,aa,oc,Qe,ss,pc,ul,gp="Drop in replacement of <code>print()</code> to only print once per server.",ic,sa,dc,ee,ls,mc,fl,up=`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.`,hc,bl,fp="A different <code>profile_handler</code> can be passed in to override the one set in the <code>Accelerator</code> object.",gc,la,uc,te,rs,fc,yl,bp="Reduce the values in <em>tensor</em> across all processes based on <em>reduction</em>.",bc,$l,yp=`Note: | |
| All processes get the reduced value.`,yc,ra,$c,Q,ns,Mc,Ml,$p="Makes note of <code>objects</code> and will save or load them in during <code>save_state</code> or <code>load_state</code>.",jc,jl,Mp=`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.`,wc,na,_c,ca,vc,C,cs,Jc,wl,jp='Registers a pre hook to be run before <code>load_checkpoint</code> is called in <a href="/docs/accelerate/pr_4049/en/package_reference/accelerator#accelerate.Accelerator.load_state">Accelerator.load_state()</a>.',Tc,_l,wp="The hook should have the following signature:",Uc,vl,_p="<code>hook(models: list[torch.nn.Module], input_dir: str) -> None</code>",xc,Jl,vp=`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/pr_4049/en/package_reference/accelerator#accelerate.Accelerator.load_state">Accelerator.load_state()</a>.`,kc,oa,Gc,I,os,Bc,Tl,Jp='Registers a pre hook to be run before <code>save_checkpoint</code> is called in <a href="/docs/accelerate/pr_4049/en/package_reference/accelerator#accelerate.Accelerator.save_state">Accelerator.save_state()</a>.',Cc,Ul,Tp="The hook should have the following signature:",Ic,xl,Up="<code>hook(models: list[torch.nn.Module], weights: list[dict[str, torch.Tensor]], input_dir: str) -> None</code>",Zc,kl,xp=`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/pr_4049/en/package_reference/accelerator#accelerate.Accelerator.load_state">Accelerator.load_state()</a>.`,Wc,pa,Yc,ae,ps,Xc,Gl,kp="Save the object passed to disk once per machine. Use in place of <code>torch.save</code>.",Ac,Bl,Gp=`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.`,Nc,ia,Vc,Fe,is,Qc,Cl,Bp="Save a model so that it can be re-loaded using load_checkpoint_in_model",Fc,da,zc,Z,ds,Rc,Il,Cp="Saves the current states of the model, optimizer, scaler, RNG generators, and registered objects to a folder.",Ec,Zl,Ip=`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_<iteration></code>.`,Sc,Wl,Zp="Otherwise they are just saved to <code>output_dir</code>.",Hc,ma,Lc,ha,Pc,se,ms,Dc,Yl,Wp=`Sets the internal trigger tensor to 1 on the current process. A latter check should follow using this which | |
| will check across all processes.`,Kc,Xl,Yp=`Note: | |
| Does not require <code>wait_for_everyone()</code>`,qc,ga,Oc,ze,hs,eo,Al,Xp="Creates a new <code>torch.utils.data.DataLoader</code> that will efficiently skip the first <code>num_batches</code>.",to,ua,ao,le,gs,so,Nl,Ap=`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.`,lo,Vl,Np="Note that when using a <code>dict</code>, all keys need to have the same number of elements.",ro,fa,no,re,us,co,Ql,Vp=`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).`,oo,Fl,Qp="If the script is not launched in distributed mode, this context manager does nothing.",po,ba,io,ne,fs,mo,zl,Fp="Unscale the gradients in mixed precision training with AMP. This is a noop in all other settings.",ho,Rl,zp='Likely should be called through <a href="/docs/accelerate/pr_4049/en/package_reference/accelerator#accelerate.Accelerator.clip_grad_norm_">Accelerator.clip<em>grad_norm</em>()</a> or <a href="/docs/accelerate/pr_4049/en/package_reference/accelerator#accelerate.Accelerator.clip_grad_value_">Accelerator.clip<em>grad_value</em>()</a>',go,ya,uo,Re,bs,fo,El,Rp=`Unwraps the <code>model</code> from the additional layer possible added by <a href="/docs/accelerate/pr_4049/en/package_reference/accelerator#accelerate.Accelerator.prepare">prepare()</a>. Useful before saving | |
| the model.`,bo,$a,yo,Ma,ys,$o,Sl,Ep="Verifies that <code>model</code> has not been prepared with big model inference with a device-map resembling <code>auto</code>.",Mo,Ee,$s,jo,Hl,Sp=`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.`,wo,ja,Ol,Ms,er,He,js,_o,Ll,Hp="Recursively gather object in a nested list/tuple/dictionary of objects from all devices.",tr,ws,ar,Pl,sr;return o=new si({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),p=new vo({props:{title:"Accelerator",local:"accelerator",headingTag:"h1"}}),_a=new vo({props:{title:"Accelerator",local:"api ][ accelerate.Accelerator",headingTag:"h2"}}),va=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 0x7f3448e76760>"},{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>) — | |
| Whether or not the accelerator should put objects on device (tensors yielded by the dataloader, model, | |
| etc…).`,name:"device_placement"},{anchor:"accelerate.Accelerator.mixed_precision",description:`<strong>mixed_precision</strong> (<code>str</code>, <em>optional</em>) — | |
| Whether or not to use mixed precision training. Choose from ‘no’,‘fp16’,‘bf16’ or ‘fp8’. 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. ‘fp8’ | |
| 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) — | |
| The number of steps that should pass before gradients are accumulated. A number > 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>) — | |
| 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>) — | |
| 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/pr_4049/en/package_reference/deepspeed#accelerate.DeepSpeedPlugin">DeepSpeedPlugin</a> or dict of <code>str</code> — <a href="/docs/accelerate/pr_4049/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/pr_4049/en/package_reference/fsdp#accelerate.FullyShardedDataParallelPlugin">FullyShardedDataParallelPlugin</a>, <em>optional</em>) — | |
| 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>) — | |
| 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/pr_4049/en/package_reference/utilities#accelerate.utils.MegatronLMPlugin">MegatronLMPlugin</a>, <em>optional</em>) — | |
| 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/pr_4049/en/package_reference/utilities#accelerate.utils.RNGType">RNGType</a>) — | |
| 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>"torch"</code>: the base torch random number generator</li> | |
| <li><code>"cuda"</code>: the CUDA random number generator (GPU only)</li> | |
| <li><code>"xla"</code>: the XLA random number generator (TPU only)</li> | |
| <li><code>"generator"</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>["torch"]</code> for PyTorch versions <=1.5.1 and <code>["generator"]</code> for PyTorch versions >= 1.6.`,name:"rng_types"},{anchor:"accelerate.Accelerator.log_with",description:`<strong>log_with</strong> (list of <code>str</code>, <a href="/docs/accelerate/pr_4049/en/package_reference/utilities#accelerate.utils.LoggerType">LoggerType</a> or <a href="/docs/accelerate/pr_4049/en/package_reference/tracking#accelerate.tracking.GeneralTracker">GeneralTracker</a>, <em>optional</em>) — | |
| A list of loggers to be setup for experiment tracking. Should be one or several of:</p> | |
| <ul> | |
| <li><code>"all"</code></li> | |
| <li><code>"tensorboard"</code></li> | |
| <li><code>"wandb"</code></li> | |
| <li><code>"trackio"</code></li> | |
| <li><code>"aim"</code></li> | |
| <li><code>"comet_ml"</code></li> | |
| <li><code>"mlflow"</code></li> | |
| <li><code>"dvclive"</code></li> | |
| <li><code>"swanlab"</code> | |
| If <code>"all"</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>"all"</code>.</li> | |
| </ul>`,name:"log_with"},{anchor:"accelerate.Accelerator.project_config",description:`<strong>project_config</strong> (<a href="/docs/accelerate/pr_4049/en/package_reference/utilities#accelerate.utils.ProjectConfiguration">ProjectConfiguration</a>, <em>optional</em>) — | |
| 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>) — | |
| 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>) — | |
| 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/pr_4049/en/package_reference/kwargs#accelerate.utils.KwargsHandler">KwargsHandler</a>, <em>optional</em>) — | |
| A list of <a href="/docs/accelerate/pr_4049/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/pr_4049/en/package_reference/utilities#accelerate.utils.DynamoBackend">DynamoBackend</a>, <em>optional</em>, defaults to <code>"no"</code>) — | |
| 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/pr_4049/en/package_reference/utilities#accelerate.utils.TorchDynamoPlugin">TorchDynamoPlugin</a>, <em>optional</em>) — | |
| 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/pr_4049/en/package_reference/utilities#accelerate.utils.GradientAccumulationPlugin">GradientAccumulationPlugin</a>, <em>optional</em>) — | |
| 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/vr_4049/src/accelerate/accelerator.py#L184"}}),Ja=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>) — | |
| 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/vr_4049/src/accelerate/accelerator.py#L1254"}}),yt=new G({props:{anchor:"accelerate.Accelerator.accumulate.example",$$slots:{default:[ri]},$$scope:{ctx:_}}}),Ta=new k({props:{name:"autocast",anchor:"accelerate.Accelerator.autocast",parameters:[{name:"autocast_handler",val:": AutocastKwargs = None"}],source:"https://github.com/huggingface/accelerate/blob/vr_4049/src/accelerate/accelerator.py#L4173"}}),$t=new G({props:{anchor:"accelerate.Accelerator.autocast.example",$$slots:{default:[ni]},$$scope:{ctx:_}}}),Ua=new k({props:{name:"backward",anchor:"accelerate.Accelerator.backward",parameters:[{name:"loss",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/accelerate/blob/vr_4049/src/accelerate/accelerator.py#L2818"}}),Mt=new G({props:{anchor:"accelerate.Accelerator.backward.example",$$slots:{default:[ci]},$$scope:{ctx:_}}}),xa=new k({props:{name:"check_trigger",anchor:"accelerate.Accelerator.check_trigger",parameters:[],source:"https://github.com/huggingface/accelerate/blob/vr_4049/src/accelerate/accelerator.py#L2878"}}),jt=new G({props:{anchor:"accelerate.Accelerator.check_trigger.example",$$slots:{default:[oi]},$$scope:{ctx:_}}}),ka=new k({props:{name:"clear",anchor:"accelerate.Accelerator.clear",parameters:[{name:"*objects",val:""}],source:"https://github.com/huggingface/accelerate/blob/vr_4049/src/accelerate/accelerator.py#L3927"}}),wt=new G({props:{anchor:"accelerate.Accelerator.clear.example",$$slots:{default:[pi]},$$scope:{ctx:_}}}),Ga=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/vr_4049/src/accelerate/accelerator.py#L2946",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:[ii]},$$scope:{ctx:_}}}),Ba=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/vr_4049/src/accelerate/accelerator.py#L3009"}}),vt=new G({props:{anchor:"accelerate.Accelerator.clip_grad_value_.example",$$slots:{default:[di]},$$scope:{ctx:_}}}),Ca=new k({props:{name:"deepspeed_ulysses_dl_adapter",anchor:"accelerate.Accelerator.deepspeed_ulysses_dl_adapter",parameters:[{name:"dl",val:""},{name:"model",val:""}],source:"https://github.com/huggingface/accelerate/blob/vr_4049/src/accelerate/accelerator.py#L2486"}}),Ia=new k({props:{name:"end_training",anchor:"accelerate.Accelerator.end_training",parameters:[],source:"https://github.com/huggingface/accelerate/blob/vr_4049/src/accelerate/accelerator.py#L3384"}}),Tt=new G({props:{anchor:"accelerate.Accelerator.end_training.example",$$slots:{default:[mi]},$$scope:{ctx:_}}}),Za=new k({props:{name:"free_memory",anchor:"accelerate.Accelerator.free_memory",parameters:[{name:"*objects",val:""}],source:"https://github.com/huggingface/accelerate/blob/vr_4049/src/accelerate/accelerator.py#L3898"}}),Ut=new G({props:{anchor:"accelerate.Accelerator.free_memory.example",$$slots:{default:[hi]},$$scope:{ctx:_}}}),Wa=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>) — | |
| The tensors to gather across all processes.`,name:"tensor"}],source:"https://github.com/huggingface/accelerate/blob/vr_4049/src/accelerate/accelerator.py#L3036",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> | |
| `}}),xt=new G({props:{anchor:"accelerate.Accelerator.gather.example",$$slots:{default:[gi]},$$scope:{ctx:_}}}),Ya=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>) — | |
| 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> — | |
| 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’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 -> CPU transfer since tensors would be pickled.`,name:"use_gather_object(bool)"}],source:"https://github.com/huggingface/accelerate/blob/vr_4049/src/accelerate/accelerator.py#L3068"}}),kt=new G({props:{anchor:"accelerate.Accelerator.gather_for_metrics.example",$$slots:{default:[ui]},$$scope:{ctx:_}}}),Xa=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>) — | |
| A PyTorch model sent through <a href="/docs/accelerate/pr_4049/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>) — | |
| 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/vr_4049/src/accelerate/accelerator.py#L3998",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> | |
| `}}),Gt=new G({props:{anchor:"accelerate.Accelerator.get_state_dict.example",$$slots:{default:[fi]},$$scope:{ctx:_}}}),Aa=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>) — | |
| 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>) — | |
| Whether to return the internal tracking mechanism or to return the wrapped tracker instead | |
| (recommended).`,name:"unwrap"}],source:"https://github.com/huggingface/accelerate/blob/vr_4049/src/accelerate/accelerator.py#L3322",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> | |
| `}}),Bt=new G({props:{anchor:"accelerate.Accelerator.get_tracker.example",$$slots:{default:[bi]},$$scope:{ctx:_}}}),Na=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>) — | |
| 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>) — | |
| 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/vr_4049/src/accelerate/accelerator.py#L1299"}}),Ct=new Se({props:{warning:!0,$$slots:{default:[yi]},$$scope:{ctx:_}}}),It=new Se({props:{warning:!0,$$slots:{default:[$i]},$$scope:{ctx:_}}}),Zt=new G({props:{anchor:"accelerate.Accelerator.join_uneven_inputs.example",$$slots:{default:[Mi]},$$scope:{ctx:_}}}),Va=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>) — | |
| 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>) — | |
| 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>) — | |
| Additional keyword arguments for loading model which can be passed to the underlying load function, | |
| such as optional arguments for DeepSpeed’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/vr_4049/src/accelerate/accelerator.py#L3746"}}),Wt=new Se({props:{$$slots:{default:[ji]},$$scope:{ctx:_}}}),Yt=new G({props:{anchor:"accelerate.Accelerator.load_state.example",$$slots:{default:[wi]},$$scope:{ctx:_}}}),Qa=new k({props:{name:"local_main_process_first",anchor:"accelerate.Accelerator.local_main_process_first",parameters:[],source:"https://github.com/huggingface/accelerate/blob/vr_4049/src/accelerate/accelerator.py#L1109"}}),Xt=new G({props:{anchor:"accelerate.Accelerator.local_main_process_first.example",$$slots:{default:[_i]},$$scope:{ctx:_}}}),Fa=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/vr_4049/src/accelerate/accelerator.py#L4316"}}),za=new k({props:{name:"main_process_first",anchor:"accelerate.Accelerator.main_process_first",parameters:[],source:"https://github.com/huggingface/accelerate/blob/vr_4049/src/accelerate/accelerator.py#L1087"}}),Nt=new G({props:{anchor:"accelerate.Accelerator.main_process_first.example",$$slots:{default:[vi]},$$scope:{ctx:_}}}),Ra=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>) — | |
| 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’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>) — | |
| 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>) — | |
| This set must be a subset of <code>buffers</code>. Specifies which buffers from <code>buffers</code> argument won’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/vr_4049/src/accelerate/accelerator.py#L4106"}}),Vt=new Se({props:{warning:!0,$$slots:{default:[Ji]},$$scope:{ctx:_}}}),Qt=new Se({props:{warning:!0,$$slots:{default:[Ti]},$$scope:{ctx:_}}}),Ft=new G({props:{anchor:"accelerate.Accelerator.maybe_context_parallel.example",$$slots:{default:[Ui]},$$scope:{ctx:_}}}),Ea=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>) — | |
| PyTorch Module that was prepared with <code>Accelerator.prepare</code>`,name:"model"}],source:"https://github.com/huggingface/accelerate/blob/vr_4049/src/accelerate/accelerator.py#L1131"}}),zt=new G({props:{anchor:"accelerate.Accelerator.no_sync.example",$$slots:{default:[xi]},$$scope:{ctx:_}}}),Sa=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>) — The function to decorate.",name:"function"}],source:"https://github.com/huggingface/accelerate/blob/vr_4049/src/accelerate/accelerator.py#L955"}}),Rt=new G({props:{anchor:"accelerate.Accelerator.on_last_process.example",$$slots:{default:[ki]},$$scope:{ctx:_}}}),Ha=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>) — The function to decorate.",name:"function"}],source:"https://github.com/huggingface/accelerate/blob/vr_4049/src/accelerate/accelerator.py#L913"}}),Et=new G({props:{anchor:"accelerate.Accelerator.on_local_main_process.example",$$slots:{default:[Gi]},$$scope:{ctx:_}}}),La=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>) — | |
| 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>) — | |
| The index of the local process on which to run the function.`,name:"local_process_index"}],source:"https://github.com/huggingface/accelerate/blob/vr_4049/src/accelerate/accelerator.py#L1039"}}),St=new G({props:{anchor:"accelerate.Accelerator.on_local_process.example",$$slots:{default:[Bi]},$$scope:{ctx:_}}}),Pa=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>) — The function to decorate.",name:"function"}],source:"https://github.com/huggingface/accelerate/blob/vr_4049/src/accelerate/accelerator.py#L874"}}),Ht=new G({props:{anchor:"accelerate.Accelerator.on_main_process.example",$$slots:{default:[Ci]},$$scope:{ctx:_}}}),Da=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>) — | |
| The function to decorate.`,name:"function"},{anchor:"accelerate.Accelerator.on_process.process_index",description:`<strong>process_index</strong> (<code>int</code>, <code>optional</code>) — | |
| The index of the process on which to run the function.`,name:"process_index"}],source:"https://github.com/huggingface/accelerate/blob/vr_4049/src/accelerate/accelerator.py#L994"}}),Lt=new G({props:{anchor:"accelerate.Accelerator.on_process.example",$$slots:{default:[Ii]},$$scope:{ctx:_}}}),Ka=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>) — | |
| 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) — | |
| 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) — | |
| 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>) — | |
| Whether to pad at the beginning or the end.`,name:"pad_first"}],source:"https://github.com/huggingface/accelerate/blob/vr_4049/src/accelerate/accelerator.py#L3178",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> | |
| `}}),Pt=new G({props:{anchor:"accelerate.Accelerator.pad_across_processes.example",$$slots:{default:[Zi]},$$scope:{ctx:_}}}),qa=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) — | |
| 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>) — | |
| 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/vr_4049/src/accelerate/accelerator.py#L1414"}}),Dt=new Se({props:{$$slots:{default:[Wi]},$$scope:{ctx:_}}}),Kt=new G({props:{anchor:"accelerate.Accelerator.prepare.example",$$slots:{default:[Yi]},$$scope:{ctx:_}}}),qt=new G({props:{anchor:"accelerate.Accelerator.prepare.example-2",$$slots:{default:[Xi]},$$scope:{ctx:_}}}),Oa=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>) — | |
| 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>) — | |
| 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/pr_4049/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/vr_4049/src/accelerate/accelerator.py#L2674"}}),Ot=new G({props:{anchor:"accelerate.Accelerator.prepare_data_loader.example",$$slots:{default:[Ai]},$$scope:{ctx:_}}}),es=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>) — | |
| A PyTorch model to prepare. You don’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>) — | |
| 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>) — | |
| 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/vr_4049/src/accelerate/accelerator.py#L1769"}}),ea=new G({props:{anchor:"accelerate.Accelerator.prepare_model.example",$$slots:{default:[Ni]},$$scope:{ctx:_}}}),ts=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>) — | |
| 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>) — | |
| 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/vr_4049/src/accelerate/accelerator.py#L2733"}}),ta=new G({props:{anchor:"accelerate.Accelerator.prepare_optimizer.example",$$slots:{default:[Vi]},$$scope:{ctx:_}}}),as=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>) — | |
| A vanilla PyTorch scheduler to prepare`,name:"scheduler"}],source:"https://github.com/huggingface/accelerate/blob/vr_4049/src/accelerate/accelerator.py#L2777"}}),aa=new G({props:{anchor:"accelerate.Accelerator.prepare_scheduler.example",$$slots:{default:[Qi]},$$scope:{ctx:_}}}),ss=new k({props:{name:"print",anchor:"accelerate.Accelerator.print",parameters:[{name:"*args",val:""},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/accelerate/blob/vr_4049/src/accelerate/accelerator.py#L1382"}}),sa=new G({props:{anchor:"accelerate.Accelerator.print.example",$$slots:{default:[Fi]},$$scope:{ctx:_}}}),ls=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>) — | |
| 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/vr_4049/src/accelerate/accelerator.py#L4198"}}),la=new G({props:{anchor:"accelerate.Accelerator.profile.example",$$slots:{default:[zi]},$$scope:{ctx:_}}}),rs=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>) — | |
| 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 “sum”) — | |
| A reduction type, can be one of ‘sum’, ‘mean’, ‘max’, or ‘none’. If ‘none’, 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) — | |
| A default scaling value to be applied after the reduce, only valid on XLA.`,name:"scale"}],source:"https://github.com/huggingface/accelerate/blob/vr_4049/src/accelerate/accelerator.py#L3141",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> | |
| `}}),ra=new G({props:{anchor:"accelerate.Accelerator.reduce.example",$$slots:{default:[Ri]},$$scope:{ctx:_}}}),ns=new k({props:{name:"register_for_checkpointing",anchor:"accelerate.Accelerator.register_for_checkpointing",parameters:[{name:"*objects",val:""}],source:"https://github.com/huggingface/accelerate/blob/vr_4049/src/accelerate/accelerator.py#L4070"}}),na=new Se({props:{$$slots:{default:[Ei]},$$scope:{ctx:_}}}),ca=new G({props:{anchor:"accelerate.Accelerator.register_for_checkpointing.example",$$slots:{default:[Si]},$$scope:{ctx:_}}}),cs=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>) — | |
| A function to be called in <a href="/docs/accelerate/pr_4049/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/vr_4049/src/accelerate/accelerator.py#L3715",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:[Hi]},$$scope:{ctx:_}}}),os=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>) — | |
| A function to be called in <a href="/docs/accelerate/pr_4049/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/vr_4049/src/accelerate/accelerator.py#L3548",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> | |
| `}}),pa=new Se({props:{$$slots:{default:[Li]},$$scope:{ctx:_}}}),ps=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>) — The object to save.",name:"obj"},{anchor:"accelerate.Accelerator.save.f",description:"<strong>f</strong> (<code>str</code> or <code>os.PathLike</code>) — 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>) — Whether to save <code>obj</code> using <code>safetensors</code>",name:"safe_serialization"}],source:"https://github.com/huggingface/accelerate/blob/vr_4049/src/accelerate/accelerator.py#L3405"}}),ia=new G({props:{anchor:"accelerate.Accelerator.save.example",$$slots:{default:[Pi]},$$scope:{ctx:_}}}),is=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> — (<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>) — | |
| Directory to which to save. Will be created if it doesn’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>"10GB"</code>) — | |
| 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>"5MB"</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>) — | |
| 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/vr_4049/src/accelerate/accelerator.py#L3435"}}),da=new G({props:{anchor:"accelerate.Accelerator.save_model.example",$$slots:{default:[Di]},$$scope:{ctx:_}}}),ds=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>) — | |
| 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>) — | |
| 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>) — | |
| Additional keyword arguments for saving model which can be passed to the underlying save function, such | |
| as optional arguments for DeepSpeed’s <code>save_checkpoint</code> function.`,name:"save_model_func_kwargs"}],source:"https://github.com/huggingface/accelerate/blob/vr_4049/src/accelerate/accelerator.py#L3580"}}),ma=new Se({props:{$$slots:{default:[Ki]},$$scope:{ctx:_}}}),ha=new G({props:{anchor:"accelerate.Accelerator.save_state.example",$$slots:{default:[qi]},$$scope:{ctx:_}}}),ms=new k({props:{name:"set_trigger",anchor:"accelerate.Accelerator.set_trigger",parameters:[],source:"https://github.com/huggingface/accelerate/blob/vr_4049/src/accelerate/accelerator.py#L2852"}}),ga=new G({props:{anchor:"accelerate.Accelerator.set_trigger.example",$$slots:{default:[Oi]},$$scope:{ctx:_}}}),hs=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>) — 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) — The number of batches to skip",name:"num_batches"}],source:"https://github.com/huggingface/accelerate/blob/vr_4049/src/accelerate/accelerator.py#L4269"}}),ua=new G({props:{anchor:"accelerate.Accelerator.skip_first_batches.example",$$slots:{default:[ed]},$$scope:{ctx:_}}}),gs=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>) — | |
| 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>) — | |
| 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/vr_4049/src/accelerate/accelerator.py#L832"}}),fa=new G({props:{anchor:"accelerate.Accelerator.split_between_processes.example",$$slots:{default:[td]},$$scope:{ctx:_}}}),us=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>) — | |
| The model for which to trigger the gradient synchronization.`,name:"model"}],source:"https://github.com/huggingface/accelerate/blob/vr_4049/src/accelerate/accelerator.py#L1180"}}),ba=new G({props:{anchor:"accelerate.Accelerator.trigger_sync_in_backward.example",$$slots:{default:[ad]},$$scope:{ctx:_}}}),fs=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>) — | |
| 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/pr_4049/en/package_reference/accelerator#accelerate.Accelerator.prepare">prepare()</a>.`,name:"optimizer"}],source:"https://github.com/huggingface/accelerate/blob/vr_4049/src/accelerate/accelerator.py#L2911"}}),ya=new G({props:{anchor:"accelerate.Accelerator.unscale_gradients.example",$$slots:{default:[sd]},$$scope:{ctx:_}}}),bs=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>) — | |
| 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>) — | |
| 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>) — | |
| Whether to not unwrap compiled model if compiled.`,name:"keep_torch_compile"}],source:"https://github.com/huggingface/accelerate/blob/vr_4049/src/accelerate/accelerator.py#L3213",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:[ld]},$$scope:{ctx:_}}}),ys=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/vr_4049/src/accelerate/accelerator.py#L4305"}}),$s=new k({props:{name:"wait_for_everyone",anchor:"accelerate.Accelerator.wait_for_everyone",parameters:[],source:"https://github.com/huggingface/accelerate/blob/vr_4049/src/accelerate/accelerator.py#L3247"}}),ja=new G({props:{anchor:"accelerate.Accelerator.wait_for_everyone.example",$$slots:{default:[rd]},$$scope:{ctx:_}}}),Ms=new vo({props:{title:"Utilities",local:"accelerate.utils.gather_object",headingTag:"h2"}}),js=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) — | |
| The data to gather.`,name:"object"}],source:"https://github.com/huggingface/accelerate/blob/vr_4049/src/accelerate/utils/operations.py#L499",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> | |
| `}}),ws=new li({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),Dl=n(),wa=i("p"),wa.innerHTML=Jo,Kl=n(),g(_a.$$.fragment),ql=n(),v=i("div"),g(va.$$.fragment),lr=n(),Us=i("p"),Us.textContent=To,rr=n(),xs=i("p"),xs.innerHTML=Uo,nr=n(),ks=i("ul"),ks.innerHTML=xo,cr=n(),we=i("div"),g(Ja.$$.fragment),or=n(),Gs=i("p"),Gs.textContent=ko,pr=n(),g(yt.$$.fragment),ir=n(),S=i("div"),g(Ta.$$.fragment),dr=n(),Bs=i("p"),Bs.textContent=Go,mr=n(),Cs=i("p"),Cs.innerHTML=Bo,hr=n(),g($t.$$.fragment),gr=n(),H=i("div"),g(Ua.$$.fragment),ur=n(),Is=i("p"),Is.innerHTML=Co,fr=n(),Zs=i("p"),Zs.innerHTML=Io,br=n(),g(Mt.$$.fragment),yr=n(),L=i("div"),g(xa.$$.fragment),$r=n(),Ws=i("p"),Ws.innerHTML=Zo,Mr=n(),Ys=i("p"),Ys.innerHTML=Wo,jr=n(),g(jt.$$.fragment),wr=n(),_e=i("div"),g(ka.$$.fragment),_r=n(),Xs=i("p"),Xs.innerHTML=Yo,vr=n(),g(wt.$$.fragment),Jr=n(),ve=i("div"),g(Ga.$$.fragment),Tr=n(),As=i("p"),As.innerHTML=Xo,Ur=n(),g(_t.$$.fragment),xr=n(),Je=i("div"),g(Ba.$$.fragment),kr=n(),Ns=i("p"),Ns.innerHTML=Ao,Gr=n(),g(vt.$$.fragment),Br=n(),Jt=i("div"),g(Ca.$$.fragment),Cr=n(),Vs=i("p"),Vs.innerHTML=No,Ir=n(),Te=i("div"),g(Ia.$$.fragment),Zr=n(),Qs=i("p"),Qs.textContent=Vo,Wr=n(),g(Tt.$$.fragment),Yr=n(),Ue=i("div"),g(Za.$$.fragment),Xr=n(),Fs=i("p"),Fs.innerHTML=Qo,Ar=n(),g(Ut.$$.fragment),Nr=n(),P=i("div"),g(Wa.$$.fragment),Vr=n(),zs=i("p"),zs.innerHTML=Fo,Qr=n(),Rs=i("p"),Rs.textContent=zo,Fr=n(),g(xt.$$.fragment),zr=n(),xe=i("div"),g(Ya.$$.fragment),Rr=n(),Es=i("p"),Es.innerHTML=Ro,Er=n(),g(kt.$$.fragment),Sr=n(),ke=i("div"),g(Xa.$$.fragment),Hr=n(),Ss=i("p"),Ss.innerHTML=Eo,Lr=n(),g(Gt.$$.fragment),Pr=n(),Ge=i("div"),g(Aa.$$.fragment),Dr=n(),Hs=i("p"),Hs.innerHTML=So,Kr=n(),g(Bt.$$.fragment),qr=n(),A=i("div"),g(Na.$$.fragment),Or=n(),Ls=i("p"),Ls.innerHTML=Ho,en=n(),g(Ct.$$.fragment),tn=n(),g(It.$$.fragment),an=n(),g(Zt.$$.fragment),sn=n(),D=i("div"),g(Va.$$.fragment),ln=n(),Ps=i("p"),Ps.textContent=Lo,rn=n(),g(Wt.$$.fragment),nn=n(),g(Yt.$$.fragment),cn=n(),K=i("div"),g(Qa.$$.fragment),on=n(),Ds=i("p"),Ds.textContent=Po,pn=n(),Ks=i("p"),Ks.textContent=Do,dn=n(),g(Xt.$$.fragment),mn=n(),At=i("div"),g(Fa.$$.fragment),hn=n(),qs=i("p"),qs.textContent=Ko,gn=n(),q=i("div"),g(za.$$.fragment),un=n(),Os=i("p"),Os.textContent=qo,fn=n(),el=i("p"),el.textContent=Oo,bn=n(),g(Nt.$$.fragment),yn=n(),N=i("div"),g(Ra.$$.fragment),$n=n(),tl=i("p"),tl.textContent=ep,Mn=n(),g(Vt.$$.fragment),jn=n(),g(Qt.$$.fragment),wn=n(),g(Ft.$$.fragment),_n=n(),O=i("div"),g(Ea.$$.fragment),vn=n(),al=i("p"),al.innerHTML=tp,Jn=n(),sl=i("p"),sl.innerHTML=ap,Tn=n(),g(zt.$$.fragment),Un=n(),Be=i("div"),g(Sa.$$.fragment),xn=n(),ll=i("p"),ll.innerHTML=sp,kn=n(),g(Rt.$$.fragment),Gn=n(),Ce=i("div"),g(Ha.$$.fragment),Bn=n(),rl=i("p"),rl.innerHTML=lp,Cn=n(),g(Et.$$.fragment),In=n(),Ie=i("div"),g(La.$$.fragment),Zn=n(),nl=i("p"),nl.innerHTML=rp,Wn=n(),g(St.$$.fragment),Yn=n(),Ze=i("div"),g(Pa.$$.fragment),Xn=n(),cl=i("p"),cl.innerHTML=np,An=n(),g(Ht.$$.fragment),Nn=n(),We=i("div"),g(Da.$$.fragment),Vn=n(),ol=i("p"),ol.innerHTML=cp,Qn=n(),g(Lt.$$.fragment),Fn=n(),Ye=i("div"),g(Ka.$$.fragment),zn=n(),pl=i("p"),pl.textContent=op,Rn=n(),g(Pt.$$.fragment),En=n(),V=i("div"),g(qa.$$.fragment),Sn=n(),il=i("p"),il.innerHTML=pp,Hn=n(),g(Dt.$$.fragment),Ln=n(),g(Kt.$$.fragment),Pn=n(),g(qt.$$.fragment),Dn=n(),Xe=i("div"),g(Oa.$$.fragment),Kn=n(),dl=i("p"),dl.innerHTML=ip,qn=n(),g(Ot.$$.fragment),On=n(),Ae=i("div"),g(es.$$.fragment),ec=n(),ml=i("p"),ml.innerHTML=dp,tc=n(),g(ea.$$.fragment),ac=n(),Ne=i("div"),g(ts.$$.fragment),sc=n(),hl=i("p"),hl.innerHTML=mp,lc=n(),g(ta.$$.fragment),rc=n(),Ve=i("div"),g(as.$$.fragment),nc=n(),gl=i("p"),gl.innerHTML=hp,cc=n(),g(aa.$$.fragment),oc=n(),Qe=i("div"),g(ss.$$.fragment),pc=n(),ul=i("p"),ul.innerHTML=gp,ic=n(),g(sa.$$.fragment),dc=n(),ee=i("div"),g(ls.$$.fragment),mc=n(),fl=i("p"),fl.innerHTML=up,hc=n(),bl=i("p"),bl.innerHTML=fp,gc=n(),g(la.$$.fragment),uc=n(),te=i("div"),g(rs.$$.fragment),fc=n(),yl=i("p"),yl.innerHTML=bp,bc=n(),$l=i("p"),$l.textContent=yp,yc=n(),g(ra.$$.fragment),$c=n(),Q=i("div"),g(ns.$$.fragment),Mc=n(),Ml=i("p"),Ml.innerHTML=$p,jc=n(),jl=i("p"),jl.textContent=Mp,wc=n(),g(na.$$.fragment),_c=n(),g(ca.$$.fragment),vc=n(),C=i("div"),g(cs.$$.fragment),Jc=n(),wl=i("p"),wl.innerHTML=jp,Tc=n(),_l=i("p"),_l.textContent=wp,Uc=n(),vl=i("p"),vl.innerHTML=_p,xc=n(),Jl=i("p"),Jl.innerHTML=vp,kc=n(),g(oa.$$.fragment),Gc=n(),I=i("div"),g(os.$$.fragment),Bc=n(),Tl=i("p"),Tl.innerHTML=Jp,Cc=n(),Ul=i("p"),Ul.textContent=Tp,Ic=n(),xl=i("p"),xl.innerHTML=Up,Zc=n(),kl=i("p"),kl.innerHTML=xp,Wc=n(),g(pa.$$.fragment),Yc=n(),ae=i("div"),g(ps.$$.fragment),Xc=n(),Gl=i("p"),Gl.innerHTML=kp,Ac=n(),Bl=i("p"),Bl.innerHTML=Gp,Nc=n(),g(ia.$$.fragment),Vc=n(),Fe=i("div"),g(is.$$.fragment),Qc=n(),Cl=i("p"),Cl.textContent=Bp,Fc=n(),g(da.$$.fragment),zc=n(),Z=i("div"),g(ds.$$.fragment),Rc=n(),Il=i("p"),Il.textContent=Cp,Ec=n(),Zl=i("p"),Zl.innerHTML=Ip,Sc=n(),Wl=i("p"),Wl.innerHTML=Zp,Hc=n(),g(ma.$$.fragment),Lc=n(),g(ha.$$.fragment),Pc=n(),se=i("div"),g(ms.$$.fragment),Dc=n(),Yl=i("p"),Yl.textContent=Wp,Kc=n(),Xl=i("p"),Xl.innerHTML=Yp,qc=n(),g(ga.$$.fragment),Oc=n(),ze=i("div"),g(hs.$$.fragment),eo=n(),Al=i("p"),Al.innerHTML=Xp,to=n(),g(ua.$$.fragment),ao=n(),le=i("div"),g(gs.$$.fragment),so=n(),Nl=i("p"),Nl.innerHTML=Ap,lo=n(),Vl=i("p"),Vl.innerHTML=Np,ro=n(),g(fa.$$.fragment),no=n(),re=i("div"),g(us.$$.fragment),co=n(),Ql=i("p"),Ql.innerHTML=Vp,oo=n(),Fl=i("p"),Fl.textContent=Qp,po=n(),g(ba.$$.fragment),io=n(),ne=i("div"),g(fs.$$.fragment),mo=n(),zl=i("p"),zl.textContent=Fp,ho=n(),Rl=i("p"),Rl.innerHTML=zp,go=n(),g(ya.$$.fragment),uo=n(),Re=i("div"),g(bs.$$.fragment),fo=n(),El=i("p"),El.innerHTML=Rp,bo=n(),g($a.$$.fragment),yo=n(),Ma=i("div"),g(ys.$$.fragment),$o=n(),Sl=i("p"),Sl.innerHTML=Ep,Mo=n(),Ee=i("div"),g($s.$$.fragment),jo=n(),Hl=i("p"),Hl.textContent=Sp,wo=n(),g(ja.$$.fragment),Ol=n(),g(Ms.$$.fragment),er=n(),He=i("div"),g(js.$$.fragment),_o=n(),Ll=i("p"),Ll.textContent=Hp,tr=n(),g(ws.$$.fragment),ar=n(),Pl=i("p"),this.h()},l(s){const M=ai("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),Dl=c(s),wa=d(s,"P",{"data-svelte-h":!0}),j(wa)!=="svelte-1q3xngw"&&(wa.innerHTML=Jo),Kl=c(s),u(_a.$$.fragment,s),ql=c(s),v=d(s,"DIV",{class:!0});var J=U(v);u(va.$$.fragment,J),lr=c(J),Us=d(J,"P",{"data-svelte-h":!0}),j(Us)!=="svelte-18gnhk2"&&(Us.textContent=To),rr=c(J),xs=d(J,"P",{"data-svelte-h":!0}),j(xs)!=="svelte-17v1xbv"&&(xs.innerHTML=Uo),nr=c(J),ks=d(J,"UL",{"data-svelte-h":!0}),j(ks)!=="svelte-8igzql"&&(ks.innerHTML=xo),cr=c(J),we=d(J,"DIV",{class:!0});var Le=U(we);u(Ja.$$.fragment,Le),or=c(Le),Gs=d(Le,"P",{"data-svelte-h":!0}),j(Gs)!=="svelte-hhq3cw"&&(Gs.textContent=ko),pr=c(Le),u(yt.$$.fragment,Le),Le.forEach(h),ir=c(J),S=d(J,"DIV",{class:!0});var ce=U(S);u(Ta.$$.fragment,ce),dr=c(ce),Bs=d(ce,"P",{"data-svelte-h":!0}),j(Bs)!=="svelte-1to22fk"&&(Bs.textContent=Go),mr=c(ce),Cs=d(ce,"P",{"data-svelte-h":!0}),j(Cs)!=="svelte-2z45q2"&&(Cs.innerHTML=Bo),hr=c(ce),u($t.$$.fragment,ce),ce.forEach(h),gr=c(J),H=d(J,"DIV",{class:!0});var oe=U(H);u(Ua.$$.fragment,oe),ur=c(oe),Is=d(oe,"P",{"data-svelte-h":!0}),j(Is)!=="svelte-1k83amz"&&(Is.innerHTML=Co),fr=c(oe),Zs=d(oe,"P",{"data-svelte-h":!0}),j(Zs)!=="svelte-3qeaqc"&&(Zs.innerHTML=Io),br=c(oe),u(Mt.$$.fragment,oe),oe.forEach(h),yr=c(J),L=d(J,"DIV",{class:!0});var pe=U(L);u(xa.$$.fragment,pe),$r=c(pe),Ws=d(pe,"P",{"data-svelte-h":!0}),j(Ws)!=="svelte-m17ioq"&&(Ws.innerHTML=Zo),Mr=c(pe),Ys=d(pe,"P",{"data-svelte-h":!0}),j(Ys)!=="svelte-h6tcr2"&&(Ys.innerHTML=Wo),jr=c(pe),u(jt.$$.fragment,pe),pe.forEach(h),wr=c(J),_e=d(J,"DIV",{class:!0});var Pe=U(_e);u(ka.$$.fragment,Pe),_r=c(Pe),Xs=d(Pe,"P",{"data-svelte-h":!0}),j(Xs)!=="svelte-bl1ihw"&&(Xs.innerHTML=Yo),vr=c(Pe),u(wt.$$.fragment,Pe),Pe.forEach(h),Jr=c(J),ve=d(J,"DIV",{class:!0});var De=U(ve);u(Ga.$$.fragment,De),Tr=c(De),As=d(De,"P",{"data-svelte-h":!0}),j(As)!=="svelte-1w1177v"&&(As.innerHTML=Xo),Ur=c(De),u(_t.$$.fragment,De),De.forEach(h),xr=c(J),Je=d(J,"DIV",{class:!0});var Ke=U(Je);u(Ba.$$.fragment,Ke),kr=c(Ke),Ns=d(Ke,"P",{"data-svelte-h":!0}),j(Ns)!=="svelte-1rffb4m"&&(Ns.innerHTML=Ao),Gr=c(Ke),u(vt.$$.fragment,Ke),Ke.forEach(h),Br=c(J),Jt=d(J,"DIV",{class:!0});var _s=U(Jt);u(Ca.$$.fragment,_s),Cr=c(_s),Vs=d(_s,"P",{"data-svelte-h":!0}),j(Vs)!=="svelte-z67x76"&&(Vs.innerHTML=No),_s.forEach(h),Ir=c(J),Te=d(J,"DIV",{class:!0});var qe=U(Te);u(Ia.$$.fragment,qe),Zr=c(qe),Qs=d(qe,"P",{"data-svelte-h":!0}),j(Qs)!=="svelte-a2pg1h"&&(Qs.textContent=Vo),Wr=c(qe),u(Tt.$$.fragment,qe),qe.forEach(h),Yr=c(J),Ue=d(J,"DIV",{class:!0});var Oe=U(Ue);u(Za.$$.fragment,Oe),Xr=c(Oe),Fs=d(Oe,"P",{"data-svelte-h":!0}),j(Fs)!=="svelte-iw017b"&&(Fs.innerHTML=Qo),Ar=c(Oe),u(Ut.$$.fragment,Oe),Oe.forEach(h),Nr=c(J),P=d(J,"DIV",{class:!0});var ie=U(P);u(Wa.$$.fragment,ie),Vr=c(ie),zs=d(ie,"P",{"data-svelte-h":!0}),j(zs)!=="svelte-c0v2dv"&&(zs.innerHTML=Fo),Qr=c(ie),Rs=d(ie,"P",{"data-svelte-h":!0}),j(Rs)!=="svelte-1ap3exf"&&(Rs.textContent=zo),Fr=c(ie),u(xt.$$.fragment,ie),ie.forEach(h),zr=c(J),xe=d(J,"DIV",{class:!0});var et=U(xe);u(Ya.$$.fragment,et),Rr=c(et),Es=d(et,"P",{"data-svelte-h":!0}),j(Es)!=="svelte-19l0og1"&&(Es.innerHTML=Ro),Er=c(et),u(kt.$$.fragment,et),et.forEach(h),Sr=c(J),ke=d(J,"DIV",{class:!0});var tt=U(ke);u(Xa.$$.fragment,tt),Hr=c(tt),Ss=d(tt,"P",{"data-svelte-h":!0}),j(Ss)!=="svelte-1gc14zx"&&(Ss.innerHTML=Eo),Lr=c(tt),u(Gt.$$.fragment,tt),tt.forEach(h),Pr=c(J),Ge=d(J,"DIV",{class:!0});var at=U(Ge);u(Aa.$$.fragment,at),Dr=c(at),Hs=d(at,"P",{"data-svelte-h":!0}),j(Hs)!=="svelte-vacsyv"&&(Hs.innerHTML=So),Kr=c(at),u(Bt.$$.fragment,at),at.forEach(h),qr=c(J),A=d(J,"DIV",{class:!0});var F=U(A);u(Na.$$.fragment,F),Or=c(F),Ls=d(F,"P",{"data-svelte-h":!0}),j(Ls)!=="svelte-hlem7e"&&(Ls.innerHTML=Ho),en=c(F),u(Ct.$$.fragment,F),tn=c(F),u(It.$$.fragment,F),an=c(F),u(Zt.$$.fragment,F),F.forEach(h),sn=c(J),D=d(J,"DIV",{class:!0});var de=U(D);u(Va.$$.fragment,de),ln=c(de),Ps=d(de,"P",{"data-svelte-h":!0}),j(Ps)!=="svelte-1kjfoov"&&(Ps.textContent=Lo),rn=c(de),u(Wt.$$.fragment,de),nn=c(de),u(Yt.$$.fragment,de),de.forEach(h),cn=c(J),K=d(J,"DIV",{class:!0});var me=U(K);u(Qa.$$.fragment,me),on=c(me),Ds=d(me,"P",{"data-svelte-h":!0}),j(Ds)!=="svelte-1xrqyx2"&&(Ds.textContent=Po),pn=c(me),Ks=d(me,"P",{"data-svelte-h":!0}),j(Ks)!=="svelte-144ycie"&&(Ks.textContent=Do),dn=c(me),u(Xt.$$.fragment,me),me.forEach(h),mn=c(J),At=d(J,"DIV",{class:!0});var vs=U(At);u(Fa.$$.fragment,vs),hn=c(vs),qs=d(vs,"P",{"data-svelte-h":!0}),j(qs)!=="svelte-vdzhg"&&(qs.textContent=Ko),vs.forEach(h),gn=c(J),q=d(J,"DIV",{class:!0});var he=U(q);u(za.$$.fragment,he),un=c(he),Os=d(he,"P",{"data-svelte-h":!0}),j(Os)!=="svelte-f40x3x"&&(Os.textContent=qo),fn=c(he),el=d(he,"P",{"data-svelte-h":!0}),j(el)!=="svelte-144ycie"&&(el.textContent=Oo),bn=c(he),u(Nt.$$.fragment,he),he.forEach(h),yn=c(J),N=d(J,"DIV",{class:!0});var z=U(N);u(Ra.$$.fragment,z),$n=c(z),tl=d(z,"P",{"data-svelte-h":!0}),j(tl)!=="svelte-p8l2iu"&&(tl.textContent=ep),Mn=c(z),u(Vt.$$.fragment,z),jn=c(z),u(Qt.$$.fragment,z),wn=c(z),u(Ft.$$.fragment,z),z.forEach(h),_n=c(J),O=d(J,"DIV",{class:!0});var ge=U(O);u(Ea.$$.fragment,ge),vn=c(ge),al=d(ge,"P",{"data-svelte-h":!0}),j(al)!=="svelte-1g6bbp3"&&(al.innerHTML=tp),Jn=c(ge),sl=d(ge,"P",{"data-svelte-h":!0}),j(sl)!=="svelte-g65bbp"&&(sl.innerHTML=ap),Tn=c(ge),u(zt.$$.fragment,ge),ge.forEach(h),Un=c(J),Be=d(J,"DIV",{class:!0});var st=U(Be);u(Sa.$$.fragment,st),xn=c(st),ll=d(st,"P",{"data-svelte-h":!0}),j(ll)!=="svelte-dzayl0"&&(ll.innerHTML=sp),kn=c(st),u(Rt.$$.fragment,st),st.forEach(h),Gn=c(J),Ce=d(J,"DIV",{class:!0});var lt=U(Ce);u(Ha.$$.fragment,lt),Bn=c(lt),rl=d(lt,"P",{"data-svelte-h":!0}),j(rl)!=="svelte-56q7i0"&&(rl.innerHTML=lp),Cn=c(lt),u(Et.$$.fragment,lt),lt.forEach(h),In=c(J),Ie=d(J,"DIV",{class:!0});var rt=U(Ie);u(La.$$.fragment,rt),Zn=c(rt),nl=d(rt,"P",{"data-svelte-h":!0}),j(nl)!=="svelte-1c2pa3e"&&(nl.innerHTML=rp),Wn=c(rt),u(St.$$.fragment,rt),rt.forEach(h),Yn=c(J),Ze=d(J,"DIV",{class:!0});var nt=U(Ze);u(Pa.$$.fragment,nt),Xn=c(nt),cl=d(nt,"P",{"data-svelte-h":!0}),j(cl)!=="svelte-1bxst4n"&&(cl.innerHTML=np),An=c(nt),u(Ht.$$.fragment,nt),nt.forEach(h),Nn=c(J),We=d(J,"DIV",{class:!0});var ct=U(We);u(Da.$$.fragment,ct),Vn=c(ct),ol=d(ct,"P",{"data-svelte-h":!0}),j(ol)!=="svelte-gt9ih5"&&(ol.innerHTML=cp),Qn=c(ct),u(Lt.$$.fragment,ct),ct.forEach(h),Fn=c(J),Ye=d(J,"DIV",{class:!0});var ot=U(Ye);u(Ka.$$.fragment,ot),zn=c(ot),pl=d(ot,"P",{"data-svelte-h":!0}),j(pl)!=="svelte-1mfhnhh"&&(pl.textContent=op),Rn=c(ot),u(Pt.$$.fragment,ot),ot.forEach(h),En=c(J),V=d(J,"DIV",{class:!0});var R=U(V);u(qa.$$.fragment,R),Sn=c(R),il=d(R,"P",{"data-svelte-h":!0}),j(il)!=="svelte-90g1bo"&&(il.innerHTML=pp),Hn=c(R),u(Dt.$$.fragment,R),Ln=c(R),u(Kt.$$.fragment,R),Pn=c(R),u(qt.$$.fragment,R),R.forEach(h),Dn=c(J),Xe=d(J,"DIV",{class:!0});var pt=U(Xe);u(Oa.$$.fragment,pt),Kn=c(pt),dl=d(pt,"P",{"data-svelte-h":!0}),j(dl)!=="svelte-1bnq0d5"&&(dl.innerHTML=ip),qn=c(pt),u(Ot.$$.fragment,pt),pt.forEach(h),On=c(J),Ae=d(J,"DIV",{class:!0});var it=U(Ae);u(es.$$.fragment,it),ec=c(it),ml=d(it,"P",{"data-svelte-h":!0}),j(ml)!=="svelte-npt0t"&&(ml.innerHTML=dp),tc=c(it),u(ea.$$.fragment,it),it.forEach(h),ac=c(J),Ne=d(J,"DIV",{class:!0});var dt=U(Ne);u(ts.$$.fragment,dt),sc=c(dt),hl=d(dt,"P",{"data-svelte-h":!0}),j(hl)!=="svelte-v11jtf"&&(hl.innerHTML=mp),lc=c(dt),u(ta.$$.fragment,dt),dt.forEach(h),rc=c(J),Ve=d(J,"DIV",{class:!0});var mt=U(Ve);u(as.$$.fragment,mt),nc=c(mt),gl=d(mt,"P",{"data-svelte-h":!0}),j(gl)!=="svelte-1ocd7u5"&&(gl.innerHTML=hp),cc=c(mt),u(aa.$$.fragment,mt),mt.forEach(h),oc=c(J),Qe=d(J,"DIV",{class:!0});var ht=U(Qe);u(ss.$$.fragment,ht),pc=c(ht),ul=d(ht,"P",{"data-svelte-h":!0}),j(ul)!=="svelte-1fwzii1"&&(ul.innerHTML=gp),ic=c(ht),u(sa.$$.fragment,ht),ht.forEach(h),dc=c(J),ee=d(J,"DIV",{class:!0});var ue=U(ee);u(ls.$$.fragment,ue),mc=c(ue),fl=d(ue,"P",{"data-svelte-h":!0}),j(fl)!=="svelte-18jmrh0"&&(fl.innerHTML=up),hc=c(ue),bl=d(ue,"P",{"data-svelte-h":!0}),j(bl)!=="svelte-bk0lx4"&&(bl.innerHTML=fp),gc=c(ue),u(la.$$.fragment,ue),ue.forEach(h),uc=c(J),te=d(J,"DIV",{class:!0});var fe=U(te);u(rs.$$.fragment,fe),fc=c(fe),yl=d(fe,"P",{"data-svelte-h":!0}),j(yl)!=="svelte-1lyv8gx"&&(yl.innerHTML=bp),bc=c(fe),$l=d(fe,"P",{"data-svelte-h":!0}),j($l)!=="svelte-12bh3zw"&&($l.textContent=yp),yc=c(fe),u(ra.$$.fragment,fe),fe.forEach(h),$c=c(J),Q=d(J,"DIV",{class:!0});var E=U(Q);u(ns.$$.fragment,E),Mc=c(E),Ml=d(E,"P",{"data-svelte-h":!0}),j(Ml)!=="svelte-1yy42cg"&&(Ml.innerHTML=$p),jc=c(E),jl=d(E,"P",{"data-svelte-h":!0}),j(jl)!=="svelte-x6uu8"&&(jl.textContent=Mp),wc=c(E),u(na.$$.fragment,E),_c=c(E),u(ca.$$.fragment,E),E.forEach(h),vc=c(J),C=d(J,"DIV",{class:!0});var W=U(C);u(cs.$$.fragment,W),Jc=c(W),wl=d(W,"P",{"data-svelte-h":!0}),j(wl)!=="svelte-87qjsl"&&(wl.innerHTML=jp),Tc=c(W),_l=d(W,"P",{"data-svelte-h":!0}),j(_l)!=="svelte-14qme5z"&&(_l.textContent=wp),Uc=c(W),vl=d(W,"P",{"data-svelte-h":!0}),j(vl)!=="svelte-ljm1ur"&&(vl.innerHTML=_p),xc=c(W),Jl=d(W,"P",{"data-svelte-h":!0}),j(Jl)!=="svelte-12fvh8c"&&(Jl.innerHTML=vp),kc=c(W),u(oa.$$.fragment,W),W.forEach(h),Gc=c(J),I=d(J,"DIV",{class:!0});var Y=U(I);u(os.$$.fragment,Y),Bc=c(Y),Tl=d(Y,"P",{"data-svelte-h":!0}),j(Tl)!=="svelte-12nzlds"&&(Tl.innerHTML=Jp),Cc=c(Y),Ul=d(Y,"P",{"data-svelte-h":!0}),j(Ul)!=="svelte-14qme5z"&&(Ul.textContent=Tp),Ic=c(Y),xl=d(Y,"P",{"data-svelte-h":!0}),j(xl)!=="svelte-ze4wea"&&(xl.innerHTML=Up),Zc=c(Y),kl=d(Y,"P",{"data-svelte-h":!0}),j(kl)!=="svelte-zvossf"&&(kl.innerHTML=xp),Wc=c(Y),u(pa.$$.fragment,Y),Y.forEach(h),Yc=c(J),ae=d(J,"DIV",{class:!0});var be=U(ae);u(ps.$$.fragment,be),Xc=c(be),Gl=d(be,"P",{"data-svelte-h":!0}),j(Gl)!=="svelte-16eiqks"&&(Gl.innerHTML=kp),Ac=c(be),Bl=d(be,"P",{"data-svelte-h":!0}),j(Bl)!=="svelte-4i4kmd"&&(Bl.innerHTML=Gp),Nc=c(be),u(ia.$$.fragment,be),be.forEach(h),Vc=c(J),Fe=d(J,"DIV",{class:!0});var gt=U(Fe);u(is.$$.fragment,gt),Qc=c(gt),Cl=d(gt,"P",{"data-svelte-h":!0}),j(Cl)!=="svelte-onu98y"&&(Cl.textContent=Bp),Fc=c(gt),u(da.$$.fragment,gt),gt.forEach(h),zc=c(J),Z=d(J,"DIV",{class:!0});var X=U(Z);u(ds.$$.fragment,X),Rc=c(X),Il=d(X,"P",{"data-svelte-h":!0}),j(Il)!=="svelte-1v72nnm"&&(Il.textContent=Cp),Ec=c(X),Zl=d(X,"P",{"data-svelte-h":!0}),j(Zl)!=="svelte-5mv7f4"&&(Zl.innerHTML=Ip),Sc=c(X),Wl=d(X,"P",{"data-svelte-h":!0}),j(Wl)!=="svelte-13o3ok4"&&(Wl.innerHTML=Zp),Hc=c(X),u(ma.$$.fragment,X),Lc=c(X),u(ha.$$.fragment,X),X.forEach(h),Pc=c(J),se=d(J,"DIV",{class:!0});var ye=U(se);u(ms.$$.fragment,ye),Dc=c(ye),Yl=d(ye,"P",{"data-svelte-h":!0}),j(Yl)!=="svelte-1bgx6cf"&&(Yl.textContent=Wp),Kc=c(ye),Xl=d(ye,"P",{"data-svelte-h":!0}),j(Xl)!=="svelte-h6tcr2"&&(Xl.innerHTML=Yp),qc=c(ye),u(ga.$$.fragment,ye),ye.forEach(h),Oc=c(J),ze=d(J,"DIV",{class:!0});var ut=U(ze);u(hs.$$.fragment,ut),eo=c(ut),Al=d(ut,"P",{"data-svelte-h":!0}),j(Al)!=="svelte-9m10k"&&(Al.innerHTML=Xp),to=c(ut),u(ua.$$.fragment,ut),ut.forEach(h),ao=c(J),le=d(J,"DIV",{class:!0});var $e=U(le);u(gs.$$.fragment,$e),so=c($e),Nl=d($e,"P",{"data-svelte-h":!0}),j(Nl)!=="svelte-xr05jy"&&(Nl.innerHTML=Ap),lo=c($e),Vl=d($e,"P",{"data-svelte-h":!0}),j(Vl)!=="svelte-hvuw2l"&&(Vl.innerHTML=Np),ro=c($e),u(fa.$$.fragment,$e),$e.forEach(h),no=c(J),re=d(J,"DIV",{class:!0});var Me=U(re);u(us.$$.fragment,Me),co=c(Me),Ql=d(Me,"P",{"data-svelte-h":!0}),j(Ql)!=="svelte-111j6q2"&&(Ql.innerHTML=Vp),oo=c(Me),Fl=d(Me,"P",{"data-svelte-h":!0}),j(Fl)!=="svelte-obux0l"&&(Fl.textContent=Qp),po=c(Me),u(ba.$$.fragment,Me),Me.forEach(h),io=c(J),ne=d(J,"DIV",{class:!0});var je=U(ne);u(fs.$$.fragment,je),mo=c(je),zl=d(je,"P",{"data-svelte-h":!0}),j(zl)!=="svelte-1w117kr"&&(zl.textContent=Fp),ho=c(je),Rl=d(je,"P",{"data-svelte-h":!0}),j(Rl)!=="svelte-wa9scr"&&(Rl.innerHTML=zp),go=c(je),u(ya.$$.fragment,je),je.forEach(h),uo=c(J),Re=d(J,"DIV",{class:!0});var ft=U(Re);u(bs.$$.fragment,ft),fo=c(ft),El=d(ft,"P",{"data-svelte-h":!0}),j(El)!=="svelte-1pg275a"&&(El.innerHTML=Rp),bo=c(ft),u($a.$$.fragment,ft),ft.forEach(h),yo=c(J),Ma=d(J,"DIV",{class:!0});var Js=U(Ma);u(ys.$$.fragment,Js),$o=c(Js),Sl=d(Js,"P",{"data-svelte-h":!0}),j(Sl)!=="svelte-1ml1a9c"&&(Sl.innerHTML=Ep),Js.forEach(h),Mo=c(J),Ee=d(J,"DIV",{class:!0});var bt=U(Ee);u($s.$$.fragment,bt),jo=c(bt),Hl=d(bt,"P",{"data-svelte-h":!0}),j(Hl)!=="svelte-tmafbn"&&(Hl.textContent=Sp),wo=c(bt),u(ja.$$.fragment,bt),bt.forEach(h),J.forEach(h),Ol=c(s),u(Ms.$$.fragment,s),er=c(s),He=d(s,"DIV",{class:!0});var Ts=U(He);u(js.$$.fragment,Ts),_o=c(Ts),Ll=d(Ts,"P",{"data-svelte-h":!0}),j(Ll)!=="svelte-11ueuet"&&(Ll.textContent=Hp),Ts.forEach(h),tr=c(s),u(ws.$$.fragment,s),ar=c(s),Pl=d(s,"P",{}),U(Pl).forEach(h),this.h()},h(){x(t,"name","hf:doc:metadata"),x(t,"content",cd),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(Jt,"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(At,"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(Ma,"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,Dl,M),w(s,wa,M),w(s,Kl,M),f(_a,s,M),w(s,ql,M),w(s,v,M),f(va,v,null),l(v,lr),l(v,Us),l(v,rr),l(v,xs),l(v,nr),l(v,ks),l(v,cr),l(v,we),f(Ja,we,null),l(we,or),l(we,Gs),l(we,pr),f(yt,we,null),l(v,ir),l(v,S),f(Ta,S,null),l(S,dr),l(S,Bs),l(S,mr),l(S,Cs),l(S,hr),f($t,S,null),l(v,gr),l(v,H),f(Ua,H,null),l(H,ur),l(H,Is),l(H,fr),l(H,Zs),l(H,br),f(Mt,H,null),l(v,yr),l(v,L),f(xa,L,null),l(L,$r),l(L,Ws),l(L,Mr),l(L,Ys),l(L,jr),f(jt,L,null),l(v,wr),l(v,_e),f(ka,_e,null),l(_e,_r),l(_e,Xs),l(_e,vr),f(wt,_e,null),l(v,Jr),l(v,ve),f(Ga,ve,null),l(ve,Tr),l(ve,As),l(ve,Ur),f(_t,ve,null),l(v,xr),l(v,Je),f(Ba,Je,null),l(Je,kr),l(Je,Ns),l(Je,Gr),f(vt,Je,null),l(v,Br),l(v,Jt),f(Ca,Jt,null),l(Jt,Cr),l(Jt,Vs),l(v,Ir),l(v,Te),f(Ia,Te,null),l(Te,Zr),l(Te,Qs),l(Te,Wr),f(Tt,Te,null),l(v,Yr),l(v,Ue),f(Za,Ue,null),l(Ue,Xr),l(Ue,Fs),l(Ue,Ar),f(Ut,Ue,null),l(v,Nr),l(v,P),f(Wa,P,null),l(P,Vr),l(P,zs),l(P,Qr),l(P,Rs),l(P,Fr),f(xt,P,null),l(v,zr),l(v,xe),f(Ya,xe,null),l(xe,Rr),l(xe,Es),l(xe,Er),f(kt,xe,null),l(v,Sr),l(v,ke),f(Xa,ke,null),l(ke,Hr),l(ke,Ss),l(ke,Lr),f(Gt,ke,null),l(v,Pr),l(v,Ge),f(Aa,Ge,null),l(Ge,Dr),l(Ge,Hs),l(Ge,Kr),f(Bt,Ge,null),l(v,qr),l(v,A),f(Na,A,null),l(A,Or),l(A,Ls),l(A,en),f(Ct,A,null),l(A,tn),f(It,A,null),l(A,an),f(Zt,A,null),l(v,sn),l(v,D),f(Va,D,null),l(D,ln),l(D,Ps),l(D,rn),f(Wt,D,null),l(D,nn),f(Yt,D,null),l(v,cn),l(v,K),f(Qa,K,null),l(K,on),l(K,Ds),l(K,pn),l(K,Ks),l(K,dn),f(Xt,K,null),l(v,mn),l(v,At),f(Fa,At,null),l(At,hn),l(At,qs),l(v,gn),l(v,q),f(za,q,null),l(q,un),l(q,Os),l(q,fn),l(q,el),l(q,bn),f(Nt,q,null),l(v,yn),l(v,N),f(Ra,N,null),l(N,$n),l(N,tl),l(N,Mn),f(Vt,N,null),l(N,jn),f(Qt,N,null),l(N,wn),f(Ft,N,null),l(v,_n),l(v,O),f(Ea,O,null),l(O,vn),l(O,al),l(O,Jn),l(O,sl),l(O,Tn),f(zt,O,null),l(v,Un),l(v,Be),f(Sa,Be,null),l(Be,xn),l(Be,ll),l(Be,kn),f(Rt,Be,null),l(v,Gn),l(v,Ce),f(Ha,Ce,null),l(Ce,Bn),l(Ce,rl),l(Ce,Cn),f(Et,Ce,null),l(v,In),l(v,Ie),f(La,Ie,null),l(Ie,Zn),l(Ie,nl),l(Ie,Wn),f(St,Ie,null),l(v,Yn),l(v,Ze),f(Pa,Ze,null),l(Ze,Xn),l(Ze,cl),l(Ze,An),f(Ht,Ze,null),l(v,Nn),l(v,We),f(Da,We,null),l(We,Vn),l(We,ol),l(We,Qn),f(Lt,We,null),l(v,Fn),l(v,Ye),f(Ka,Ye,null),l(Ye,zn),l(Ye,pl),l(Ye,Rn),f(Pt,Ye,null),l(v,En),l(v,V),f(qa,V,null),l(V,Sn),l(V,il),l(V,Hn),f(Dt,V,null),l(V,Ln),f(Kt,V,null),l(V,Pn),f(qt,V,null),l(v,Dn),l(v,Xe),f(Oa,Xe,null),l(Xe,Kn),l(Xe,dl),l(Xe,qn),f(Ot,Xe,null),l(v,On),l(v,Ae),f(es,Ae,null),l(Ae,ec),l(Ae,ml),l(Ae,tc),f(ea,Ae,null),l(v,ac),l(v,Ne),f(ts,Ne,null),l(Ne,sc),l(Ne,hl),l(Ne,lc),f(ta,Ne,null),l(v,rc),l(v,Ve),f(as,Ve,null),l(Ve,nc),l(Ve,gl),l(Ve,cc),f(aa,Ve,null),l(v,oc),l(v,Qe),f(ss,Qe,null),l(Qe,pc),l(Qe,ul),l(Qe,ic),f(sa,Qe,null),l(v,dc),l(v,ee),f(ls,ee,null),l(ee,mc),l(ee,fl),l(ee,hc),l(ee,bl),l(ee,gc),f(la,ee,null),l(v,uc),l(v,te),f(rs,te,null),l(te,fc),l(te,yl),l(te,bc),l(te,$l),l(te,yc),f(ra,te,null),l(v,$c),l(v,Q),f(ns,Q,null),l(Q,Mc),l(Q,Ml),l(Q,jc),l(Q,jl),l(Q,wc),f(na,Q,null),l(Q,_c),f(ca,Q,null),l(v,vc),l(v,C),f(cs,C,null),l(C,Jc),l(C,wl),l(C,Tc),l(C,_l),l(C,Uc),l(C,vl),l(C,xc),l(C,Jl),l(C,kc),f(oa,C,null),l(v,Gc),l(v,I),f(os,I,null),l(I,Bc),l(I,Tl),l(I,Cc),l(I,Ul),l(I,Ic),l(I,xl),l(I,Zc),l(I,kl),l(I,Wc),f(pa,I,null),l(v,Yc),l(v,ae),f(ps,ae,null),l(ae,Xc),l(ae,Gl),l(ae,Ac),l(ae,Bl),l(ae,Nc),f(ia,ae,null),l(v,Vc),l(v,Fe),f(is,Fe,null),l(Fe,Qc),l(Fe,Cl),l(Fe,Fc),f(da,Fe,null),l(v,zc),l(v,Z),f(ds,Z,null),l(Z,Rc),l(Z,Il),l(Z,Ec),l(Z,Zl),l(Z,Sc),l(Z,Wl),l(Z,Hc),f(ma,Z,null),l(Z,Lc),f(ha,Z,null),l(v,Pc),l(v,se),f(ms,se,null),l(se,Dc),l(se,Yl),l(se,Kc),l(se,Xl),l(se,qc),f(ga,se,null),l(v,Oc),l(v,ze),f(hs,ze,null),l(ze,eo),l(ze,Al),l(ze,to),f(ua,ze,null),l(v,ao),l(v,le),f(gs,le,null),l(le,so),l(le,Nl),l(le,lo),l(le,Vl),l(le,ro),f(fa,le,null),l(v,no),l(v,re),f(us,re,null),l(re,co),l(re,Ql),l(re,oo),l(re,Fl),l(re,po),f(ba,re,null),l(v,io),l(v,ne),f(fs,ne,null),l(ne,mo),l(ne,zl),l(ne,ho),l(ne,Rl),l(ne,go),f(ya,ne,null),l(v,uo),l(v,Re),f(bs,Re,null),l(Re,fo),l(Re,El),l(Re,bo),f($a,Re,null),l(v,yo),l(v,Ma),f(ys,Ma,null),l(Ma,$o),l(Ma,Sl),l(v,Mo),l(v,Ee),f($s,Ee,null),l(Ee,jo),l(Ee,Hl),l(Ee,wo),f(ja,Ee,null),w(s,Ol,M),f(Ms,s,M),w(s,er,M),w(s,He,M),f(js,He,null),l(He,_o),l(He,Ll),w(s,tr,M),f(ws,s,M),w(s,ar,M),w(s,Pl,M),sr=!0},p(s,[M]){const J={};M&2&&(J.$$scope={dirty:M,ctx:s}),yt.$set(J);const Le={};M&2&&(Le.$$scope={dirty:M,ctx:s}),$t.$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}),Tt.$set(Ke);const _s={};M&2&&(_s.$$scope={dirty:M,ctx:s}),Ut.$set(_s);const qe={};M&2&&(qe.$$scope={dirty:M,ctx:s}),xt.$set(qe);const Oe={};M&2&&(Oe.$$scope={dirty:M,ctx:s}),kt.$set(Oe);const ie={};M&2&&(ie.$$scope={dirty:M,ctx:s}),Gt.$set(ie);const et={};M&2&&(et.$$scope={dirty:M,ctx:s}),Bt.$set(et);const tt={};M&2&&(tt.$$scope={dirty:M,ctx:s}),Ct.$set(tt);const at={};M&2&&(at.$$scope={dirty:M,ctx:s}),It.$set(at);const F={};M&2&&(F.$$scope={dirty:M,ctx:s}),Zt.$set(F);const de={};M&2&&(de.$$scope={dirty:M,ctx:s}),Wt.$set(de);const me={};M&2&&(me.$$scope={dirty:M,ctx:s}),Yt.$set(me);const vs={};M&2&&(vs.$$scope={dirty:M,ctx:s}),Xt.$set(vs);const he={};M&2&&(he.$$scope={dirty:M,ctx:s}),Nt.$set(he);const z={};M&2&&(z.$$scope={dirty:M,ctx:s}),Vt.$set(z);const ge={};M&2&&(ge.$$scope={dirty:M,ctx:s}),Qt.$set(ge);const st={};M&2&&(st.$$scope={dirty:M,ctx:s}),Ft.$set(st);const lt={};M&2&&(lt.$$scope={dirty:M,ctx:s}),zt.$set(lt);const rt={};M&2&&(rt.$$scope={dirty:M,ctx:s}),Rt.$set(rt);const nt={};M&2&&(nt.$$scope={dirty:M,ctx:s}),Et.$set(nt);const ct={};M&2&&(ct.$$scope={dirty:M,ctx:s}),St.$set(ct);const ot={};M&2&&(ot.$$scope={dirty:M,ctx:s}),Ht.$set(ot);const R={};M&2&&(R.$$scope={dirty:M,ctx:s}),Lt.$set(R);const pt={};M&2&&(pt.$$scope={dirty:M,ctx:s}),Pt.$set(pt);const it={};M&2&&(it.$$scope={dirty:M,ctx:s}),Dt.$set(it);const dt={};M&2&&(dt.$$scope={dirty:M,ctx:s}),Kt.$set(dt);const mt={};M&2&&(mt.$$scope={dirty:M,ctx:s}),qt.$set(mt);const ht={};M&2&&(ht.$$scope={dirty:M,ctx:s}),Ot.$set(ht);const ue={};M&2&&(ue.$$scope={dirty:M,ctx:s}),ea.$set(ue);const fe={};M&2&&(fe.$$scope={dirty:M,ctx:s}),ta.$set(fe);const E={};M&2&&(E.$$scope={dirty:M,ctx:s}),aa.$set(E);const W={};M&2&&(W.$$scope={dirty:M,ctx:s}),sa.$set(W);const Y={};M&2&&(Y.$$scope={dirty:M,ctx:s}),la.$set(Y);const be={};M&2&&(be.$$scope={dirty:M,ctx:s}),ra.$set(be);const gt={};M&2&&(gt.$$scope={dirty:M,ctx:s}),na.$set(gt);const X={};M&2&&(X.$$scope={dirty:M,ctx:s}),ca.$set(X);const ye={};M&2&&(ye.$$scope={dirty:M,ctx:s}),oa.$set(ye);const ut={};M&2&&(ut.$$scope={dirty:M,ctx:s}),pa.$set(ut);const $e={};M&2&&($e.$$scope={dirty:M,ctx:s}),ia.$set($e);const Me={};M&2&&(Me.$$scope={dirty:M,ctx:s}),da.$set(Me);const je={};M&2&&(je.$$scope={dirty:M,ctx:s}),ma.$set(je);const ft={};M&2&&(ft.$$scope={dirty:M,ctx:s}),ha.$set(ft);const Js={};M&2&&(Js.$$scope={dirty:M,ctx:s}),ga.$set(Js);const bt={};M&2&&(bt.$$scope={dirty:M,ctx:s}),ua.$set(bt);const Ts={};M&2&&(Ts.$$scope={dirty:M,ctx:s}),fa.$set(Ts);const Lp={};M&2&&(Lp.$$scope={dirty:M,ctx:s}),ba.$set(Lp);const Pp={};M&2&&(Pp.$$scope={dirty:M,ctx:s}),ya.$set(Pp);const Dp={};M&2&&(Dp.$$scope={dirty:M,ctx:s}),$a.$set(Dp);const Kp={};M&2&&(Kp.$$scope={dirty:M,ctx:s}),ja.$set(Kp)},i(s){sr||(b(o.$$.fragment,s),b(p.$$.fragment,s),b(_a.$$.fragment,s),b(va.$$.fragment,s),b(Ja.$$.fragment,s),b(yt.$$.fragment,s),b(Ta.$$.fragment,s),b($t.$$.fragment,s),b(Ua.$$.fragment,s),b(Mt.$$.fragment,s),b(xa.$$.fragment,s),b(jt.$$.fragment,s),b(ka.$$.fragment,s),b(wt.$$.fragment,s),b(Ga.$$.fragment,s),b(_t.$$.fragment,s),b(Ba.$$.fragment,s),b(vt.$$.fragment,s),b(Ca.$$.fragment,s),b(Ia.$$.fragment,s),b(Tt.$$.fragment,s),b(Za.$$.fragment,s),b(Ut.$$.fragment,s),b(Wa.$$.fragment,s),b(xt.$$.fragment,s),b(Ya.$$.fragment,s),b(kt.$$.fragment,s),b(Xa.$$.fragment,s),b(Gt.$$.fragment,s),b(Aa.$$.fragment,s),b(Bt.$$.fragment,s),b(Na.$$.fragment,s),b(Ct.$$.fragment,s),b(It.$$.fragment,s),b(Zt.$$.fragment,s),b(Va.$$.fragment,s),b(Wt.$$.fragment,s),b(Yt.$$.fragment,s),b(Qa.$$.fragment,s),b(Xt.$$.fragment,s),b(Fa.$$.fragment,s),b(za.$$.fragment,s),b(Nt.$$.fragment,s),b(Ra.$$.fragment,s),b(Vt.$$.fragment,s),b(Qt.$$.fragment,s),b(Ft.$$.fragment,s),b(Ea.$$.fragment,s),b(zt.$$.fragment,s),b(Sa.$$.fragment,s),b(Rt.$$.fragment,s),b(Ha.$$.fragment,s),b(Et.$$.fragment,s),b(La.$$.fragment,s),b(St.$$.fragment,s),b(Pa.$$.fragment,s),b(Ht.$$.fragment,s),b(Da.$$.fragment,s),b(Lt.$$.fragment,s),b(Ka.$$.fragment,s),b(Pt.$$.fragment,s),b(qa.$$.fragment,s),b(Dt.$$.fragment,s),b(Kt.$$.fragment,s),b(qt.$$.fragment,s),b(Oa.$$.fragment,s),b(Ot.$$.fragment,s),b(es.$$.fragment,s),b(ea.$$.fragment,s),b(ts.$$.fragment,s),b(ta.$$.fragment,s),b(as.$$.fragment,s),b(aa.$$.fragment,s),b(ss.$$.fragment,s),b(sa.$$.fragment,s),b(ls.$$.fragment,s),b(la.$$.fragment,s),b(rs.$$.fragment,s),b(ra.$$.fragment,s),b(ns.$$.fragment,s),b(na.$$.fragment,s),b(ca.$$.fragment,s),b(cs.$$.fragment,s),b(oa.$$.fragment,s),b(os.$$.fragment,s),b(pa.$$.fragment,s),b(ps.$$.fragment,s),b(ia.$$.fragment,s),b(is.$$.fragment,s),b(da.$$.fragment,s),b(ds.$$.fragment,s),b(ma.$$.fragment,s),b(ha.$$.fragment,s),b(ms.$$.fragment,s),b(ga.$$.fragment,s),b(hs.$$.fragment,s),b(ua.$$.fragment,s),b(gs.$$.fragment,s),b(fa.$$.fragment,s),b(us.$$.fragment,s),b(ba.$$.fragment,s),b(fs.$$.fragment,s),b(ya.$$.fragment,s),b(bs.$$.fragment,s),b($a.$$.fragment,s),b(ys.$$.fragment,s),b($s.$$.fragment,s),b(ja.$$.fragment,s),b(Ms.$$.fragment,s),b(js.$$.fragment,s),b(ws.$$.fragment,s),sr=!0)},o(s){y(o.$$.fragment,s),y(p.$$.fragment,s),y(_a.$$.fragment,s),y(va.$$.fragment,s),y(Ja.$$.fragment,s),y(yt.$$.fragment,s),y(Ta.$$.fragment,s),y($t.$$.fragment,s),y(Ua.$$.fragment,s),y(Mt.$$.fragment,s),y(xa.$$.fragment,s),y(jt.$$.fragment,s),y(ka.$$.fragment,s),y(wt.$$.fragment,s),y(Ga.$$.fragment,s),y(_t.$$.fragment,s),y(Ba.$$.fragment,s),y(vt.$$.fragment,s),y(Ca.$$.fragment,s),y(Ia.$$.fragment,s),y(Tt.$$.fragment,s),y(Za.$$.fragment,s),y(Ut.$$.fragment,s),y(Wa.$$.fragment,s),y(xt.$$.fragment,s),y(Ya.$$.fragment,s),y(kt.$$.fragment,s),y(Xa.$$.fragment,s),y(Gt.$$.fragment,s),y(Aa.$$.fragment,s),y(Bt.$$.fragment,s),y(Na.$$.fragment,s),y(Ct.$$.fragment,s),y(It.$$.fragment,s),y(Zt.$$.fragment,s),y(Va.$$.fragment,s),y(Wt.$$.fragment,s),y(Yt.$$.fragment,s),y(Qa.$$.fragment,s),y(Xt.$$.fragment,s),y(Fa.$$.fragment,s),y(za.$$.fragment,s),y(Nt.$$.fragment,s),y(Ra.$$.fragment,s),y(Vt.$$.fragment,s),y(Qt.$$.fragment,s),y(Ft.$$.fragment,s),y(Ea.$$.fragment,s),y(zt.$$.fragment,s),y(Sa.$$.fragment,s),y(Rt.$$.fragment,s),y(Ha.$$.fragment,s),y(Et.$$.fragment,s),y(La.$$.fragment,s),y(St.$$.fragment,s),y(Pa.$$.fragment,s),y(Ht.$$.fragment,s),y(Da.$$.fragment,s),y(Lt.$$.fragment,s),y(Ka.$$.fragment,s),y(Pt.$$.fragment,s),y(qa.$$.fragment,s),y(Dt.$$.fragment,s),y(Kt.$$.fragment,s),y(qt.$$.fragment,s),y(Oa.$$.fragment,s),y(Ot.$$.fragment,s),y(es.$$.fragment,s),y(ea.$$.fragment,s),y(ts.$$.fragment,s),y(ta.$$.fragment,s),y(as.$$.fragment,s),y(aa.$$.fragment,s),y(ss.$$.fragment,s),y(sa.$$.fragment,s),y(ls.$$.fragment,s),y(la.$$.fragment,s),y(rs.$$.fragment,s),y(ra.$$.fragment,s),y(ns.$$.fragment,s),y(na.$$.fragment,s),y(ca.$$.fragment,s),y(cs.$$.fragment,s),y(oa.$$.fragment,s),y(os.$$.fragment,s),y(pa.$$.fragment,s),y(ps.$$.fragment,s),y(ia.$$.fragment,s),y(is.$$.fragment,s),y(da.$$.fragment,s),y(ds.$$.fragment,s),y(ma.$$.fragment,s),y(ha.$$.fragment,s),y(ms.$$.fragment,s),y(ga.$$.fragment,s),y(hs.$$.fragment,s),y(ua.$$.fragment,s),y(gs.$$.fragment,s),y(fa.$$.fragment,s),y(us.$$.fragment,s),y(ba.$$.fragment,s),y(fs.$$.fragment,s),y(ya.$$.fragment,s),y(bs.$$.fragment,s),y($a.$$.fragment,s),y(ys.$$.fragment,s),y($s.$$.fragment,s),y(ja.$$.fragment,s),y(Ms.$$.fragment,s),y(js.$$.fragment,s),y(ws.$$.fragment,s),sr=!1},d(s){s&&(h(m),h(r),h(a),h(e),h(Dl),h(wa),h(Kl),h(ql),h(v),h(Ol),h(er),h(He),h(tr),h(ar),h(Pl)),h(t),$(o,s),$(p,s),$(_a,s),$(va),$(Ja),$(yt),$(Ta),$($t),$(Ua),$(Mt),$(xa),$(jt),$(ka),$(wt),$(Ga),$(_t),$(Ba),$(vt),$(Ca),$(Ia),$(Tt),$(Za),$(Ut),$(Wa),$(xt),$(Ya),$(kt),$(Xa),$(Gt),$(Aa),$(Bt),$(Na),$(Ct),$(It),$(Zt),$(Va),$(Wt),$(Yt),$(Qa),$(Xt),$(Fa),$(za),$(Nt),$(Ra),$(Vt),$(Qt),$(Ft),$(Ea),$(zt),$(Sa),$(Rt),$(Ha),$(Et),$(La),$(St),$(Pa),$(Ht),$(Da),$(Lt),$(Ka),$(Pt),$(qa),$(Dt),$(Kt),$(qt),$(Oa),$(Ot),$(es),$(ea),$(ts),$(ta),$(as),$(aa),$(ss),$(sa),$(ls),$(la),$(rs),$(ra),$(ns),$(na),$(ca),$(cs),$(oa),$(os),$(pa),$(ps),$(ia),$(is),$(da),$(ds),$(ma),$(ha),$(ms),$(ga),$(hs),$(ua),$(gs),$(fa),$(us),$(ba),$(fs),$(ya),$(bs),$($a),$(ys),$($s),$(ja),$(Ms,s),$(js),$(ws,s)}}}const cd='{"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 od(_){return Op(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class fd extends ei{constructor(t){super(),ti(this,t,od,nd,qp,{})}}export{fd as component}; | |
Xet Storage Details
- Size:
- 190 kB
- Xet hash:
- f23b6c12edc20ddbb6d0f82deacc374b8851e8bcb7e71f4b62790dc4ac6e30bd
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.