import{s as Xt,o as Bt,n as Z}from"../chunks/scheduler.25b97de1.js";import{S as Wt,i as kt,g as p,s as r,r as m,A as Gt,h as c,f as l,c as i,j as At,u as d,x as M,k as $t,y as vt,a as t,v as T,d as h,t as y,w as f}from"../chunks/index.d9030fc9.js";import{T as ls}from"../chunks/Tip.baa67368.js";import{C as I}from"../chunks/CodeBlock.e6cd0d95.js";import{H as A,E as Vt}from"../chunks/EditOnGithub.91d95064.js";import{H as Ct,a as ts}from"../chunks/HfOption.1e589c90.js";function Et(U){let a,o='In addition to the <a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.Trainer">Trainer</a> class, Transformers also provides a <a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.Seq2SeqTrainer">Seq2SeqTrainer</a> class for sequence-to-sequence tasks like translation or summarization. There is also the <a href="https://huggingface.co/docs/trl/main/en/sft_trainer#trl.SFTTrainer" rel="nofollow">SFTTrainer</a> class from the <a href="https://hf.co/docs/trl" rel="nofollow">TRL</a> library which wraps the <a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.Trainer">Trainer</a> class and is optimized for training language models like Llama-2 and Mistral with autoregressive techniques. <a href="https://huggingface.co/docs/trl/main/en/sft_trainer#trl.SFTTrainer" rel="nofollow">SFTTrainer</a> also supports features like sequence packing, LoRA, quantization, and DeepSpeed for efficiently scaling to any model size.',n,u,w,j,g='Feel free to check out the <a href="./main_classes/trainer">API reference</a> for these other <a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.Trainer">Trainer</a>-type classes to learn more about when to use which one. In general, <a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.Trainer">Trainer</a> is the most versatile option and is appropriate for a broad spectrum of tasks. <a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.Seq2SeqTrainer">Seq2SeqTrainer</a> is designed for sequence-to-sequence tasks and <a href="https://huggingface.co/docs/trl/main/en/sft_trainer#trl.SFTTrainer" rel="nofollow">SFTTrainer</a> is designed for training language models.';return{c(){a=p("p"),a.innerHTML=o,n=r(),u=p("br"),w=r(),j=p("p"),j.innerHTML=g},l(_){a=c(_,"P",{"data-svelte-h":!0}),M(a)!=="svelte-1s16671"&&(a.innerHTML=o),n=i(_),u=c(_,"BR",{}),w=i(_),j=c(_,"P",{"data-svelte-h":!0}),M(j)!=="svelte-1rvlzgm"&&(j.innerHTML=g)},m(_,J){t(_,a,J),t(_,n,J),t(_,u,J),t(_,w,J),t(_,j,J)},p:Z,d(_){_&&(l(a),l(n),l(u),l(w),l(j))}}}function Ft(U){let a,o='Check out the <a href="./main_classes/logging">logging</a> API reference for more information about the different logging levels.';return{c(){a=p("p"),a.innerHTML=o},l(n){a=c(n,"P",{"data-svelte-h":!0}),M(a)!=="svelte-6jeeaq"&&(a.innerHTML=o)},m(n,u){t(n,a,u)},p:Z,d(n){n&&l(a)}}}function Rt(U){let a,o='<a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.Trainer">Trainer</a> sets the log level separately for each node in the <code>Trainer.__init__()</code> method, so you may want to consider setting this sooner if you’re using other Transformers functionalities before creating the <a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.Trainer">Trainer</a> object.';return{c(){a=p("p"),a.innerHTML=o},l(n){a=c(n,"P",{"data-svelte-h":!0}),M(a)!=="svelte-1yhr9w9"&&(a.innerHTML=o)},m(n,u){t(n,a,u)},p:Z,d(n){n&&l(a)}}}function Qt(U){let a,o;return a=new I({props:{code:"bXlfYXBwLnB5JTIwLi4uJTIwLS1sb2dfbGV2ZWwlMjB3YXJuaW5nJTIwLS1sb2dfbGV2ZWxfcmVwbGljYSUyMGVycm9y",highlighted:"my_app.py ... --log_level warning --log_level_replica error",wrap:!1}}),{c(){m(a.$$.fragment)},l(n){d(a.$$.fragment,n)},m(n,u){T(a,n,u),o=!0},p:Z,i(n){o||(h(a.$$.fragment,n),o=!0)},o(n){y(a.$$.fragment,n),o=!1},d(n){f(a,n)}}}function Nt(U){let a,o="Add the <code>log_on_each_node 0</code> parameter for multi-node environments.",n,u,w;return u=new I({props:{code:"bXlfYXBwLnB5JTIwLi4uJTIwLS1sb2dfbGV2ZWwlMjB3YXJuaW5nJTIwLS1sb2dfbGV2ZWxfcmVwbGljYSUyMGVycm9yJTIwLS1sb2dfb25fZWFjaF9ub2RlJTIwMCUwQSUwQSUyMyUyMHNldCUyMHRvJTIwb25seSUyMHJlcG9ydCUyMGVycm9ycyUwQW15X2FwcC5weSUyMC4uLiUyMC0tbG9nX2xldmVsJTIwZXJyb3IlMjAtLWxvZ19sZXZlbF9yZXBsaWNhJTIwZXJyb3IlMjAtLWxvZ19vbl9lYWNoX25vZGUlMjAw",highlighted:`my_app.py ... --log_level warning --log_level_replica error --log_on_each_node 0

<span class="hljs-comment"># set to only report errors</span>
my_app.py ... --log_level error --log_level_replica error --log_on_each_node 0`,wrap:!1}}),{c(){a=p("p"),a.innerHTML=o,n=r(),m(u.$$.fragment)},l(j){a=c(j,"P",{"data-svelte-h":!0}),M(a)!=="svelte-86ubk0"&&(a.innerHTML=o),n=i(j),d(u.$$.fragment,j)},m(j,g){t(j,a,g),t(j,n,g),T(u,j,g),w=!0},p:Z,i(j){w||(h(u.$$.fragment,j),w=!0)},o(j){y(u.$$.fragment,j),w=!1},d(j){j&&(l(a),l(n)),f(u,j)}}}function zt(U){let a,o,n,u;return a=new ts({props:{id:"logging",option:"single node",$$slots:{default:[Qt]},$$scope:{ctx:U}}}),n=new ts({props:{id:"logging",option:"multi-node",$$slots:{default:[Nt]},$$scope:{ctx:U}}}),{c(){m(a.$$.fragment),o=r(),m(n.$$.fragment)},l(w){d(a.$$.fragment,w),o=i(w),d(n.$$.fragment,w)},m(w,j){T(a,w,j),t(w,o,j),T(n,w,j),u=!0},p(w,j){const g={};j&2&&(g.$$scope={dirty:j,ctx:w}),a.$set(g);const _={};j&2&&(_.$$scope={dirty:j,ctx:w}),n.$set(_)},i(w){u||(h(a.$$.fragment,w),h(n.$$.fragment,w),u=!0)},o(w){y(a.$$.fragment,w),y(n.$$.fragment,w),u=!1},d(w){w&&l(o),f(a,w),f(n,w)}}}function St(U){let a,o="According to the authors, it is recommended to use <code>AdaLomo</code> without <code>grad_norm</code> to get better performance and higher throughput.";return{c(){a=p("p"),a.innerHTML=o},l(n){a=c(n,"P",{"data-svelte-h":!0}),M(a)!=="svelte-q6vma3"&&(a.innerHTML=o)},m(n,u){t(n,a,u)},p:Z,d(n){n&&l(a)}}}function Yt(U){let a,o="GrokAdamW is particularly useful for models that require advanced optimization techniques to achieve better performance and stability.";return{c(){a=p("p"),a.textContent=o},l(n){a=c(n,"P",{"data-svelte-h":!0}),M(a)!=="svelte-kys0va"&&(a.textContent=o)},m(n,u){t(n,a,u)},p:Z,d(n){n&&l(a)}}}function Ht(U){let a,o='Learn more about FSDP sharding strategies, CPU offloading, and more with the <a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.Trainer">Trainer</a> in the <a href="fsdp">Fully Sharded Data Parallel</a> guide.';return{c(){a=p("p"),a.innerHTML=o},l(n){a=c(n,"P",{"data-svelte-h":!0}),M(a)!=="svelte-1dnzy9p"&&(a.innerHTML=o)},m(n,u){t(n,a,u)},p:Z,d(n){n&&l(a)}}}function xt(U){let a,o;return a=new I({props:{code:"Y29tcHV0ZV9lbnZpcm9ubWVudCUzQSUyMExPQ0FMX01BQ0hJTkUlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMEFkaXN0cmlidXRlZF90eXBlJTNBJTIwTVVMVElfR1BVJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTBBZG93bmNhc3RfYmYxNiUzQSUyMCdubyclMEFncHVfaWRzJTNBJTIwYWxsJTBBbWFjaGluZV9yYW5rJTNBJTIwMCUyMCUyM2NoYW5nZSUyMHJhbmslMjBhcyUyMHBlciUyMHRoZSUyMG5vZGUlMEFtYWluX3Byb2Nlc3NfaXAlM0ElMjAxOTIuMTY4LjIwLjElMEFtYWluX3Byb2Nlc3NfcG9ydCUzQSUyMDk4OTglMEFtYWluX3RyYWluaW5nX2Z1bmN0aW9uJTNBJTIwbWFpbiUwQW1peGVkX3ByZWNpc2lvbiUzQSUyMGZwMTYlMEFudW1fbWFjaGluZXMlM0ElMjAyJTBBbnVtX3Byb2Nlc3NlcyUzQSUyMDglMEFyZHp2X2JhY2tlbmQlM0ElMjBzdGF0aWMlMEFzYW1lX25ldHdvcmslM0ElMjB0cnVlJTBBdHB1X2VudiUzQSUyMCU1QiU1RCUwQXRwdV91c2VfY2x1c3RlciUzQSUyMGZhbHNlJTBBdHB1X3VzZV9zdWRvJTNBJTIwZmFsc2UlMEF1c2VfY3B1JTNBJTIwZmFsc2U=",highlighted:`<span class="hljs-attr">compute_environment:</span> <span class="hljs-string">LOCAL_MACHINE</span>                                                                                             
<span class="hljs-attr">distributed_type:</span> <span class="hljs-string">MULTI_GPU</span>                                                                                                    
<span class="hljs-attr">downcast_bf16:</span> <span class="hljs-string">&#x27;no&#x27;</span>
<span class="hljs-attr">gpu_ids:</span> <span class="hljs-string">all</span>
<span class="hljs-attr">machine_rank:</span> <span class="hljs-number">0</span> <span class="hljs-comment">#change rank as per the node</span>
<span class="hljs-attr">main_process_ip:</span> <span class="hljs-number">192.168</span><span class="hljs-number">.20</span><span class="hljs-number">.1</span>
<span class="hljs-attr">main_process_port:</span> <span class="hljs-number">9898</span>
<span class="hljs-attr">main_training_function:</span> <span class="hljs-string">main</span>
<span class="hljs-attr">mixed_precision:</span> <span class="hljs-string">fp16</span>
<span class="hljs-attr">num_machines:</span> <span class="hljs-number">2</span>
<span class="hljs-attr">num_processes:</span> <span class="hljs-number">8</span>
<span class="hljs-attr">rdzv_backend:</span> <span class="hljs-string">static</span>
<span class="hljs-attr">same_network:</span> <span class="hljs-literal">true</span>
<span class="hljs-attr">tpu_env:</span> []
<span class="hljs-attr">tpu_use_cluster:</span> <span class="hljs-literal">false</span>
<span class="hljs-attr">tpu_use_sudo:</span> <span class="hljs-literal">false</span>
<span class="hljs-attr">use_cpu:</span> <span class="hljs-literal">false</span>`,wrap:!1}}),{c(){m(a.$$.fragment)},l(n){d(a.$$.fragment,n)},m(n,u){T(a,n,u),o=!0},p:Z,i(n){o||(h(a.$$.fragment,n),o=!0)},o(n){y(a.$$.fragment,n),o=!1},d(n){f(a,n)}}}function Lt(U){let a,o;return a=new I({props:{code:"Y29tcHV0ZV9lbnZpcm9ubWVudCUzQSUyMExPQ0FMX01BQ0hJTkUlMEFkaXN0cmlidXRlZF90eXBlJTNBJTIwRlNEUCUwQWRvd25jYXN0X2JmMTYlM0ElMjAnbm8nJTBBZnNkcF9jb25maWclM0ElMEElMjAlMjBmc2RwX2F1dG9fd3JhcF9wb2xpY3klM0ElMjBUUkFOU0ZPUk1FUl9CQVNFRF9XUkFQJTBBJTIwJTIwZnNkcF9iYWNrd2FyZF9wcmVmZXRjaF9wb2xpY3klM0ElMjBCQUNLV0FSRF9QUkUlMEElMjAlMjBmc2RwX2ZvcndhcmRfcHJlZmV0Y2glM0ElMjB0cnVlJTBBJTIwJTIwZnNkcF9vZmZsb2FkX3BhcmFtcyUzQSUyMGZhbHNlJTBBJTIwJTIwZnNkcF9zaGFyZGluZ19zdHJhdGVneSUzQSUyMDElMEElMjAlMjBmc2RwX3N0YXRlX2RpY3RfdHlwZSUzQSUyMEZVTExfU1RBVEVfRElDVCUwQSUyMCUyMGZzZHBfc3luY19tb2R1bGVfc3RhdGVzJTNBJTIwdHJ1ZSUwQSUyMCUyMGZzZHBfdHJhbnNmb3JtZXJfbGF5ZXJfY2xzX3RvX3dyYXAlM0ElMjBCZXJ0TGF5ZXIlMEElMjAlMjBmc2RwX3VzZV9vcmlnX3BhcmFtcyUzQSUyMHRydWUlMEFtYWNoaW5lX3JhbmslM0ElMjAwJTBBbWFpbl90cmFpbmluZ19mdW5jdGlvbiUzQSUyMG1haW4lMEFtaXhlZF9wcmVjaXNpb24lM0ElMjBiZjE2JTBBbnVtX21hY2hpbmVzJTNBJTIwMSUwQW51bV9wcm9jZXNzZXMlM0ElMjAyJTBBcmR6dl9iYWNrZW5kJTNBJTIwc3RhdGljJTBBc2FtZV9uZXR3b3JrJTNBJTIwdHJ1ZSUwQXRwdV9lbnYlM0ElMjAlNUIlNUQlMEF0cHVfdXNlX2NsdXN0ZXIlM0ElMjBmYWxzZSUwQXRwdV91c2Vfc3VkbyUzQSUyMGZhbHNlJTBBdXNlX2NwdSUzQSUyMGZhbHNl",highlighted:`<span class="hljs-attr">compute_environment:</span> <span class="hljs-string">LOCAL_MACHINE</span>
<span class="hljs-attr">distributed_type:</span> <span class="hljs-string">FSDP</span>
<span class="hljs-attr">downcast_bf16:</span> <span class="hljs-string">&#x27;no&#x27;</span>
<span class="hljs-attr">fsdp_config:</span>
  <span class="hljs-attr">fsdp_auto_wrap_policy:</span> <span class="hljs-string">TRANSFORMER_BASED_WRAP</span>
  <span class="hljs-attr">fsdp_backward_prefetch_policy:</span> <span class="hljs-string">BACKWARD_PRE</span>
  <span class="hljs-attr">fsdp_forward_prefetch:</span> <span class="hljs-literal">true</span>
  <span class="hljs-attr">fsdp_offload_params:</span> <span class="hljs-literal">false</span>
  <span class="hljs-attr">fsdp_sharding_strategy:</span> <span class="hljs-number">1</span>
  <span class="hljs-attr">fsdp_state_dict_type:</span> <span class="hljs-string">FULL_STATE_DICT</span>
  <span class="hljs-attr">fsdp_sync_module_states:</span> <span class="hljs-literal">true</span>
  <span class="hljs-attr">fsdp_transformer_layer_cls_to_wrap:</span> <span class="hljs-string">BertLayer</span>
  <span class="hljs-attr">fsdp_use_orig_params:</span> <span class="hljs-literal">true</span>
<span class="hljs-attr">machine_rank:</span> <span class="hljs-number">0</span>
<span class="hljs-attr">main_training_function:</span> <span class="hljs-string">main</span>
<span class="hljs-attr">mixed_precision:</span> <span class="hljs-string">bf16</span>
<span class="hljs-attr">num_machines:</span> <span class="hljs-number">1</span>
<span class="hljs-attr">num_processes:</span> <span class="hljs-number">2</span>
<span class="hljs-attr">rdzv_backend:</span> <span class="hljs-string">static</span>
<span class="hljs-attr">same_network:</span> <span class="hljs-literal">true</span>
<span class="hljs-attr">tpu_env:</span> []
<span class="hljs-attr">tpu_use_cluster:</span> <span class="hljs-literal">false</span>
<span class="hljs-attr">tpu_use_sudo:</span> <span class="hljs-literal">false</span>
<span class="hljs-attr">use_cpu:</span> <span class="hljs-literal">false</span>`,wrap:!1}}),{c(){m(a.$$.fragment)},l(n){d(a.$$.fragment,n)},m(n,u){T(a,n,u),o=!0},p:Z,i(n){o||(h(a.$$.fragment,n),o=!0)},o(n){y(a.$$.fragment,n),o=!1},d(n){f(a,n)}}}function qt(U){let a,o;return a=new I({props:{code:"Y29tcHV0ZV9lbnZpcm9ubWVudCUzQSUyMExPQ0FMX01BQ0hJTkUlMEFkZWVwc3BlZWRfY29uZmlnJTNBJTBBJTIwJTIwZGVlcHNwZWVkX2NvbmZpZ19maWxlJTNBJTIwJTJGaG9tZSUyRnVzZXIlMkZjb25maWdzJTJGZHNfemVybzNfY29uZmlnLmpzb24lMEElMjAlMjB6ZXJvM19pbml0X2ZsYWclM0ElMjB0cnVlJTBBZGlzdHJpYnV0ZWRfdHlwZSUzQSUyMERFRVBTUEVFRCUwQWRvd25jYXN0X2JmMTYlM0ElMjAnbm8nJTBBbWFjaGluZV9yYW5rJTNBJTIwMCUwQW1haW5fdHJhaW5pbmdfZnVuY3Rpb24lM0ElMjBtYWluJTBBbnVtX21hY2hpbmVzJTNBJTIwMSUwQW51bV9wcm9jZXNzZXMlM0ElMjA0JTBBcmR6dl9iYWNrZW5kJTNBJTIwc3RhdGljJTBBc2FtZV9uZXR3b3JrJTNBJTIwdHJ1ZSUwQXRwdV9lbnYlM0ElMjAlNUIlNUQlMEF0cHVfdXNlX2NsdXN0ZXIlM0ElMjBmYWxzZSUwQXRwdV91c2Vfc3VkbyUzQSUyMGZhbHNlJTBBdXNlX2NwdSUzQSUyMGZhbHNl",highlighted:`<span class="hljs-attr">compute_environment:</span> <span class="hljs-string">LOCAL_MACHINE</span>
<span class="hljs-attr">deepspeed_config:</span>
  <span class="hljs-attr">deepspeed_config_file:</span> <span class="hljs-string">/home/user/configs/ds_zero3_config.json</span>
  <span class="hljs-attr">zero3_init_flag:</span> <span class="hljs-literal">true</span>
<span class="hljs-attr">distributed_type:</span> <span class="hljs-string">DEEPSPEED</span>
<span class="hljs-attr">downcast_bf16:</span> <span class="hljs-string">&#x27;no&#x27;</span>
<span class="hljs-attr">machine_rank:</span> <span class="hljs-number">0</span>
<span class="hljs-attr">main_training_function:</span> <span class="hljs-string">main</span>
<span class="hljs-attr">num_machines:</span> <span class="hljs-number">1</span>
<span class="hljs-attr">num_processes:</span> <span class="hljs-number">4</span>
<span class="hljs-attr">rdzv_backend:</span> <span class="hljs-string">static</span>
<span class="hljs-attr">same_network:</span> <span class="hljs-literal">true</span>
<span class="hljs-attr">tpu_env:</span> []
<span class="hljs-attr">tpu_use_cluster:</span> <span class="hljs-literal">false</span>
<span class="hljs-attr">tpu_use_sudo:</span> <span class="hljs-literal">false</span>
<span class="hljs-attr">use_cpu:</span> <span class="hljs-literal">false</span>`,wrap:!1}}),{c(){m(a.$$.fragment)},l(n){d(a.$$.fragment,n)},m(n,u){T(a,n,u),o=!0},p:Z,i(n){o||(h(a.$$.fragment,n),o=!0)},o(n){y(a.$$.fragment,n),o=!1},d(n){f(a,n)}}}function Dt(U){let a,o;return a=new I({props:{code:"Y29tcHV0ZV9lbnZpcm9ubWVudCUzQSUyMExPQ0FMX01BQ0hJTkUlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMEFkZWVwc3BlZWRfY29uZmlnJTNBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTBBJTIwJTIwZ3JhZGllbnRfYWNjdW11bGF0aW9uX3N0ZXBzJTNBJTIwMSUwQSUyMCUyMGdyYWRpZW50X2NsaXBwaW5nJTNBJTIwMC43JTBBJTIwJTIwb2ZmbG9hZF9vcHRpbWl6ZXJfZGV2aWNlJTNBJTIwY3B1JTBBJTIwJTIwb2ZmbG9hZF9wYXJhbV9kZXZpY2UlM0ElMjBjcHUlMEElMjAlMjB6ZXJvM19pbml0X2ZsYWclM0ElMjB0cnVlJTBBJTIwJTIwemVyb19zdGFnZSUzQSUyMDIlMEFkaXN0cmlidXRlZF90eXBlJTNBJTIwREVFUFNQRUVEJTBBZG93bmNhc3RfYmYxNiUzQSUyMCdubyclMEFtYWNoaW5lX3JhbmslM0ElMjAwJTBBbWFpbl90cmFpbmluZ19mdW5jdGlvbiUzQSUyMG1haW4lMEFtaXhlZF9wcmVjaXNpb24lM0ElMjBiZjE2JTBBbnVtX21hY2hpbmVzJTNBJTIwMSUwQW51bV9wcm9jZXNzZXMlM0ElMjA0JTBBcmR6dl9iYWNrZW5kJTNBJTIwc3RhdGljJTBBc2FtZV9uZXR3b3JrJTNBJTIwdHJ1ZSUwQXRwdV9lbnYlM0ElMjAlNUIlNUQlMEF0cHVfdXNlX2NsdXN0ZXIlM0ElMjBmYWxzZSUwQXRwdV91c2Vfc3VkbyUzQSUyMGZhbHNlJTBBdXNlX2NwdSUzQSUyMGZhbHNl",highlighted:`<span class="hljs-attr">compute_environment:</span> <span class="hljs-string">LOCAL_MACHINE</span>                                                                                             
<span class="hljs-attr">deepspeed_config:</span>                                                                                                              
  <span class="hljs-attr">gradient_accumulation_steps:</span> <span class="hljs-number">1</span>
  <span class="hljs-attr">gradient_clipping:</span> <span class="hljs-number">0.7</span>
  <span class="hljs-attr">offload_optimizer_device:</span> <span class="hljs-string">cpu</span>
  <span class="hljs-attr">offload_param_device:</span> <span class="hljs-string">cpu</span>
  <span class="hljs-attr">zero3_init_flag:</span> <span class="hljs-literal">true</span>
  <span class="hljs-attr">zero_stage:</span> <span class="hljs-number">2</span>
<span class="hljs-attr">distributed_type:</span> <span class="hljs-string">DEEPSPEED</span>
<span class="hljs-attr">downcast_bf16:</span> <span class="hljs-string">&#x27;no&#x27;</span>
<span class="hljs-attr">machine_rank:</span> <span class="hljs-number">0</span>
<span class="hljs-attr">main_training_function:</span> <span class="hljs-string">main</span>
<span class="hljs-attr">mixed_precision:</span> <span class="hljs-string">bf16</span>
<span class="hljs-attr">num_machines:</span> <span class="hljs-number">1</span>
<span class="hljs-attr">num_processes:</span> <span class="hljs-number">4</span>
<span class="hljs-attr">rdzv_backend:</span> <span class="hljs-string">static</span>
<span class="hljs-attr">same_network:</span> <span class="hljs-literal">true</span>
<span class="hljs-attr">tpu_env:</span> []
<span class="hljs-attr">tpu_use_cluster:</span> <span class="hljs-literal">false</span>
<span class="hljs-attr">tpu_use_sudo:</span> <span class="hljs-literal">false</span>
<span class="hljs-attr">use_cpu:</span> <span class="hljs-literal">false</span>`,wrap:!1}}),{c(){m(a.$$.fragment)},l(n){d(a.$$.fragment,n)},m(n,u){T(a,n,u),o=!0},p:Z,i(n){o||(h(a.$$.fragment,n),o=!0)},o(n){y(a.$$.fragment,n),o=!1},d(n){f(a,n)}}}function Pt(U){let a,o,n,u,w,j,g,_;return a=new ts({props:{id:"config",option:"DistributedDataParallel",$$slots:{default:[xt]},$$scope:{ctx:U}}}),n=new ts({props:{id:"config",option:"FSDP",$$slots:{default:[Lt]},$$scope:{ctx:U}}}),w=new ts({props:{id:"config",option:"DeepSpeed",$$slots:{default:[qt]},$$scope:{ctx:U}}}),g=new ts({props:{id:"config",option:"DeepSpeed with Accelerate plugin",$$slots:{default:[Dt]},$$scope:{ctx:U}}}),{c(){m(a.$$.fragment),o=r(),m(n.$$.fragment),u=r(),m(w.$$.fragment),j=r(),m(g.$$.fragment)},l(J){d(a.$$.fragment,J),o=i(J),d(n.$$.fragment,J),u=i(J),d(w.$$.fragment,J),j=i(J),d(g.$$.fragment,J)},m(J,b){T(a,J,b),t(J,o,b),T(n,J,b),t(J,u,b),T(w,J,b),t(J,j,b),T(g,J,b),_=!0},p(J,b){const V={};b&2&&(V.$$scope={dirty:b,ctx:J}),a.$set(V);const $={};b&2&&($.$$scope={dirty:b,ctx:J}),n.$set($);const as={};b&2&&(as.$$scope={dirty:b,ctx:J}),w.$set(as);const E={};b&2&&(E.$$scope={dirty:b,ctx:J}),g.$set(E)},i(J){_||(h(a.$$.fragment,J),h(n.$$.fragment,J),h(w.$$.fragment,J),h(g.$$.fragment,J),_=!0)},o(J){y(a.$$.fragment,J),y(n.$$.fragment,J),y(w.$$.fragment,J),y(g.$$.fragment,J),_=!1},d(J){J&&(l(o),l(u),l(j)),f(a,J),f(n,J),f(w,J),f(g,J)}}}function Kt(U){let a,o,n,u,w,j,g,_='The <a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.Trainer">Trainer</a> is a complete training and evaluation loop for PyTorch models implemented in the Transformers library. You only need to pass it the necessary pieces for training (model, tokenizer, dataset, evaluation function, training hyperparameters, etc.), and the <a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.Trainer">Trainer</a> class takes care of the rest. This makes it easier to start training faster without manually writing your own training loop. But at the same time, <a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.Trainer">Trainer</a> is very customizable and offers a ton of training options so you can tailor it to your exact training needs.',J,b,V,$,as='Before you start, make sure <a href="https://hf.co/docs/accelerate" rel="nofollow">Accelerate</a> - a library for enabling and running PyTorch training across distributed environments - is installed.',E,F,rs,R,Xl='This guide provides an overview of the <a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.Trainer">Trainer</a> class.',is,Q,os,N,Bl='<a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.Trainer">Trainer</a> includes all the code you’ll find in a basic training loop:',ps,z,Wl='<li>perform a training step to calculate the loss</li> <li>calculate the gradients with the <a href="https://huggingface.co/docs/accelerate/main/en/package_reference/accelerator#accelerate.Accelerator.backward" rel="nofollow">backward</a> method</li> <li>update the weights based on the gradients</li> <li>repeat this process until you’ve reached a predetermined number of epochs</li>',cs,S,kl='The <a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.Trainer">Trainer</a> class abstracts all of this code away so you don’t have to worry about manually writing a training loop every time or if you’re just getting started with PyTorch and training. You only need to provide the essential components required for training, such as a model and a dataset, and the <a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.Trainer">Trainer</a> class handles everything else.',Ms,Y,Gl='If you want to specify any training options or hyperparameters, you can find them in the <a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.TrainingArguments">TrainingArguments</a> class. For example, let’s define where to save the model in <code>output_dir</code> and push the model to the Hub after training with <code>push_to_hub=True</code>.',ms,H,ds,x,vl='Pass <code>training_args</code> to the <a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.Trainer">Trainer</a> along with a model, dataset, something to preprocess the dataset with (depending on your data type it could be a tokenizer, feature extractor or image processor), a data collator, and a function to compute the metrics you want to track during training.',Ts,L,Vl='Finally, call <a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.Trainer.train">train()</a> to start training!',hs,q,ys,D,fs,P,El='The <a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.Trainer">Trainer</a> class saves your model checkpoints to the directory specified in the <code>output_dir</code> parameter of <a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.TrainingArguments">TrainingArguments</a>. You’ll find the checkpoints saved in a <code>checkpoint-000</code> subfolder where the numbers at the end correspond to the training step. Saving checkpoints are useful for resuming training later.',us,K,ws,O,Fl='You can save your checkpoints (the optimizer state is not saved by default) to the Hub by setting <code>push_to_hub=True</code> in <a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.TrainingArguments">TrainingArguments</a> to commit and push them. Other options for deciding how your checkpoints are saved are set up in the <a href="https://huggingface.co/docs/transformers/main_classes/trainer#transformers.TrainingArguments.hub_strategy" rel="nofollow"><code>hub_strategy</code></a> parameter:',Js,ee,Rl="<li><code>hub_strategy=&quot;checkpoint&quot;</code> pushes the latest checkpoint to a subfolder named “last-checkpoint” from which you can resume training</li> <li><code>hub_strategy=&quot;all_checkpoints&quot;</code> pushes all checkpoints to the directory defined in <code>output_dir</code> (you’ll see one checkpoint per folder in your model repository)</li>",js,se,Ql='When you resume training from a checkpoint, the <a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.Trainer">Trainer</a> tries to keep the Python, NumPy, and PyTorch RNG states the same as they were when the checkpoint was saved. But because PyTorch has various non-deterministic default settings, the RNG states aren’t guaranteed to be the same. If you want to enable full determinism, take a look at the <a href="https://pytorch.org/docs/stable/notes/randomness#controlling-sources-of-randomness" rel="nofollow">Controlling sources of randomness</a> guide to learn what you can enable to make your training fully deterministic. Keep in mind though that by making certain settings deterministic, training may be slower.',Us,le,gs,te,Nl='While the <a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.Trainer">Trainer</a> class is designed to be accessible and easy-to-use, it also offers a lot of customizability for more adventurous users. Many of the <a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.Trainer">Trainer</a>’s method can be subclassed and overridden to support the functionality you want, without having to rewrite the entire training loop from scratch to accommodate it. These methods include:',bs,ae,zl='<li><a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.Trainer.get_train_dataloader">get_train_dataloader()</a> creates a training DataLoader</li> <li><a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.Trainer.get_eval_dataloader">get_eval_dataloader()</a> creates an evaluation DataLoader</li> <li><a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.Trainer.get_test_dataloader">get_test_dataloader()</a> creates a test DataLoader</li> <li><a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.Trainer.log">log()</a> logs information on the various objects that watch training</li> <li><a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.Trainer.create_optimizer_and_scheduler">create_optimizer_and_scheduler()</a> creates an optimizer and learning rate scheduler if they weren’t passed in the <code>__init__</code>; these can also be separately customized with <a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.Trainer.create_optimizer">create_optimizer()</a> and <a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.Trainer.create_scheduler">create_scheduler()</a> respectively</li> <li><a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.Trainer.compute_loss">compute_loss()</a> computes the loss on a batch of training inputs</li> <li><a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.Trainer.training_step">training_step()</a> performs the training step</li> <li><a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.Trainer.prediction_step">prediction_step()</a> performs the prediction and test step</li> <li><a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.Trainer.evaluate">evaluate()</a> evaluates the model and returns the evaluation metrics</li> <li><a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.Trainer.predict">predict()</a> makes predictions (with metrics if labels are available) on the test set</li>',_s,ne,Sl='For example, if you want to customize the <a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.Trainer.compute_loss">compute_loss()</a> method to use a weighted loss instead.',Is,re,Zs,ie,As,oe,Yl='Another option for customizing the <a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.Trainer">Trainer</a> is to use <a href="callbacks">callbacks</a>. Callbacks <em>don’t change</em> anything in the training loop. They inspect the training loop state and then execute some action (early stopping, logging results, etc.) depending on the state. In other words, a callback can’t be used to implement something like a custom loss function and you’ll need to subclass and override the <a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.Trainer.compute_loss">compute_loss()</a> method for that.',$s,pe,Hl="For example, if you want to add an early stopping callback to the training loop after 10 steps.",Cs,ce,Xs,Me,xl='Then pass it to the <a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.Trainer">Trainer</a>’s <code>callback</code> parameter.',Bs,me,Ws,de,ks,C,Gs,Te,Ll='The <a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.Trainer">Trainer</a> is set to <code>logging.INFO</code> by default which reports errors, warnings, and other basic information. A <a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.Trainer">Trainer</a> replica - in distributed environments - is set to <code>logging.WARNING</code> which only reports errors and warnings. You can change the logging level with the <a href="https://huggingface.co/docs/transformers/main_classes/trainer#transformers.TrainingArguments.log_level" rel="nofollow"><code>log_level</code></a> and <a href="https://huggingface.co/docs/transformers/main_classes/trainer#transformers.TrainingArguments.log_level_replica" rel="nofollow"><code>log_level_replica</code></a> parameters in <a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.TrainingArguments">TrainingArguments</a>.',vs,he,ql='To configure the log level setting for each node, use the <a href="https://huggingface.co/docs/transformers/main/en/main_classes/trainer#transformers.TrainingArguments.log_on_each_node" rel="nofollow"><code>log_on_each_node</code></a> parameter to determine whether to use the log level on each node or only on the main node.',Vs,X,Es,ye,Dl="For example, to set your main code and modules to use the same log level according to each node:",Fs,fe,Rs,ue,Pl="Use different combinations of <code>log_level</code> and <code>log_level_replica</code> to configure what gets logged on each of the nodes.",Qs,B,Ns,we,zs,Je,Kl='<a href="https://hf.co/papers/2310.05914" rel="nofollow">NEFTune</a> is a technique that can improve performance by adding noise to the embedding vectors during training. To enable it in <a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.Trainer">Trainer</a>, set the <code>neftune_noise_alpha</code> parameter in <a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.TrainingArguments">TrainingArguments</a> to control how much noise is added.',Ss,je,Ys,Ue,Ol="NEFTune is disabled after training to restore the original embedding layer to avoid any unexpected behavior.",Hs,ge,xs,be,et="Gradient Low-Rank Projection (GaLore) is a memory-efficient low-rank training strategy that allows full-parameter learning but is more memory-efficient than common low-rank adaptation methods, such as LoRA.",Ls,_e,st="First make sure to install GaLore official repository:",qs,Ie,Ds,Ze,lt="Then simply add one of <code>[&quot;galore_adamw&quot;, &quot;galore_adafactor&quot;, &quot;galore_adamw_8bit&quot;]</code> in <code>optim</code> together with <code>optim_target_modules</code>, which can be a list of strings, regex or full path corresponding to the target module names you want to adapt. Below is an end-to-end example script (make sure to <code>pip install trl datasets</code>):",Ps,Ae,Ks,$e,tt="To pass extra arguments supports by GaLore, you should pass correctly <code>optim_args</code>, for example:",Os,Ce,el,Xe,at='You can read more about the method in the <a href="https://github.com/jiaweizzhao/GaLore" rel="nofollow">original repository</a> or the <a href="https://arxiv.org/abs/2403.03507" rel="nofollow">paper</a>.',sl,Be,nt="Currently you can only train Linear layers that are considered as GaLore layers and will use low-rank decomposition to be trained while remaining layers will be optimized in the conventional manner.",ll,We,rt="Note it will take a bit of time before starting the training (~3 minutes for a 2B model on a NVIDIA A100), but training should go smoothly afterwards.",tl,ke,it="You can also perform layer-wise optimization by post-pending the optimizer name with <code>layerwise</code> like below:",al,Ge,nl,ve,ot='Note layerwise optimization is a bit experimental and does not support DDP (Distributed Data Parallel), thus you can run the training script only on a single GPU. Please see <a href="https://github.com/jiaweizzhao/GaLore?tab=readme-ov-file#train-7b-model-with-a-single-gpu-with-24gb-memory" rel="nofollow">this appropriate section</a> for more details. Other features such as gradient clipping, DeepSpeed, etc might not be supported out of the box. Please <a href="https://github.com/huggingface/transformers/issues" rel="nofollow">raise an issue on GitHub</a> if you encounter such issue.',rl,Ve,il,Ee,pt=`The LOMO optimizers have been introduced in <a href="https://hf.co/papers/2306.09782" rel="nofollow">Full Parameter Fine-Tuning for Large Language Models with Limited Resources</a> and <a href="https://hf.co/papers/2310.10195" rel="nofollow">AdaLomo: Low-memory Optimization with Adaptive Learning Rate</a>.
They both consist of an efficient full-parameter fine-tuning method. These optimizers fuse the gradient computation and the parameter update in one step to reduce memory usage. Supported optimizers for LOMO are <code>&quot;lomo&quot;</code> and <code>&quot;adalomo&quot;</code>. First either install LOMO from pypi <code>pip install lomo-optim</code> or install it from source with <code>pip install git+https://github.com/OpenLMLab/LOMO.git</code>.`,ol,W,pl,Fe,ct='Below is a simple script to demonstrate how to fine-tune <a href="https://huggingface.co/google/gemma-2b" rel="nofollow">google/gemma-2b</a> on IMDB dataset in full precision:',cl,Re,Ml,Qe,ml,Ne,Mt="The GrokAdamW optimizer is designed to enhance training performance and stability, particularly for models that benefit from grokking signal functions. To use GrokAdamW, first install the optimizer package with <code>pip install grokadamw</code>.",dl,k,Tl,ze,mt='Below is a simple script to demonstrate how to fine-tune <a href="https://huggingface.co/google/gemma-2b" rel="nofollow">google/gemma-2b</a> on the IMDB dataset using the GrokAdamW optimizer:',hl,Se,yl,Ye,dt="This script demonstrates how to fine-tune the <code>google/gemma-2b</code> model on the IMDB dataset using the GrokAdamW optimizer. The <code>TrainingArguments</code> are configured to use GrokAdamW, and the dataset is passed to the <code>Trainer</code> for training.",fl,He,ul,xe,Tt='The <a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.Trainer">Trainer</a> class is powered by <a href="https://hf.co/docs/accelerate" rel="nofollow">Accelerate</a>, a library for easily training PyTorch models in distributed environments with support for integrations such as <a href="https://pytorch.org/blog/introducing-pytorch-fully-sharded-data-parallel-api/" rel="nofollow">FullyShardedDataParallel (FSDP)</a> and <a href="https://www.deepspeed.ai/" rel="nofollow">DeepSpeed</a>.',wl,G,Jl,Le,ht='To use Accelerate with <a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.Trainer">Trainer</a>, run the <a href="https://huggingface.co/docs/accelerate/package_reference/cli#accelerate-config" rel="nofollow"><code>accelerate.config</code></a> command to set up training for your training environment. This command creates a <code>config_file.yaml</code> that’ll be used when you launch your training script. For example, some example configurations you can setup are:',jl,v,Ul,qe,yt='The <a href="https://huggingface.co/docs/accelerate/package_reference/cli#accelerate-launch" rel="nofollow"><code>accelerate_launch</code></a> command is the recommended way to launch your training script on a distributed system with Accelerate and <a href="/docs/transformers/pr_31098/en/main_classes/trainer#transformers.Trainer">Trainer</a> with the parameters specified in <code>config_file.yaml</code>. This file is saved to the Accelerate cache folder and automatically loaded when you run <code>accelerate_launch</code>.',gl,De,ft='For example, to run the <a href="https://github.com/huggingface/transformers/blob/f4db565b695582891e43a5e042e5d318e28f20b8/examples/pytorch/text-classification/run_glue.py#L4" rel="nofollow">run_glue.py</a> training script with the FSDP configuration:',bl,Pe,_l,Ke,ut="You could also specify the parameters from the <code>config_file.yaml</code> file directly in the command line:",Il,Oe,Zl,es,wt='Check out the <a href="https://huggingface.co/docs/accelerate/basic_tutorials/launch" rel="nofollow">Launching your Accelerate scripts</a> tutorial to learn more about <code>accelerate_launch</code> and custom configurations.',Al,ss,$l,ns,Cl;return w=new A({props:{title:"Trainer",local:"trainer",headingTag:"h1"}}),b=new ls({props:{$$slots:{default:[Et]},$$scope:{ctx:U}}}),F=new I({props:{code:"cGlwJTIwaW5zdGFsbCUyMGFjY2VsZXJhdGUlMEElMEElMjMlMjB1cGdyYWRlJTBBcGlwJTIwaW5zdGFsbCUyMGFjY2VsZXJhdGUlMjAtLXVwZ3JhZGU=",highlighted:`pip install accelerate

<span class="hljs-comment"># upgrade</span>
pip install accelerate --upgrade`,wrap:!1}}),Q=new A({props:{title:"Basic usage",local:"basic-usage",headingTag:"h2"}}),H=new I({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRyYWluaW5nQXJndW1lbnRzJTBBJTBBdHJhaW5pbmdfYXJncyUyMCUzRCUyMFRyYWluaW5nQXJndW1lbnRzKCUwQSUyMCUyMCUyMCUyMG91dHB1dF9kaXIlM0QlMjJ5b3VyLW1vZGVsJTIyJTJDJTBBJTIwJTIwJTIwJTIwbGVhcm5pbmdfcmF0ZSUzRDJlLTUlMkMlMEElMjAlMjAlMjAlMjBwZXJfZGV2aWNlX3RyYWluX2JhdGNoX3NpemUlM0QxNiUyQyUwQSUyMCUyMCUyMCUyMHBlcl9kZXZpY2VfZXZhbF9iYXRjaF9zaXplJTNEMTYlMkMlMEElMjAlMjAlMjAlMjBudW1fdHJhaW5fZXBvY2hzJTNEMiUyQyUwQSUyMCUyMCUyMCUyMHdlaWdodF9kZWNheSUzRDAuMDElMkMlMEElMjAlMjAlMjAlMjBldmFsX3N0cmF0ZWd5JTNEJTIyZXBvY2glMjIlMkMlMEElMjAlMjAlMjAlMjBzYXZlX3N0cmF0ZWd5JTNEJTIyZXBvY2glMjIlMkMlMEElMjAlMjAlMjAlMjBsb2FkX2Jlc3RfbW9kZWxfYXRfZW5kJTNEVHJ1ZSUyQyUwQSUyMCUyMCUyMCUyMHB1c2hfdG9faHViJTNEVHJ1ZSUyQyUwQSk=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TrainingArguments

training_args = TrainingArguments(
    output_dir=<span class="hljs-string">&quot;your-model&quot;</span>,
    learning_rate=<span class="hljs-number">2e-5</span>,
    per_device_train_batch_size=<span class="hljs-number">16</span>,
    per_device_eval_batch_size=<span class="hljs-number">16</span>,
    num_train_epochs=<span class="hljs-number">2</span>,
    weight_decay=<span class="hljs-number">0.01</span>,
    eval_strategy=<span class="hljs-string">&quot;epoch&quot;</span>,
    save_strategy=<span class="hljs-string">&quot;epoch&quot;</span>,
    load_best_model_at_end=<span class="hljs-literal">True</span>,
    push_to_hub=<span class="hljs-literal">True</span>,
)`,wrap:!1}}),q=new I({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRyYWluZXIlMEElMEF0cmFpbmVyJTIwJTNEJTIwVHJhaW5lciglMEElMjAlMjAlMjAlMjBtb2RlbCUzRG1vZGVsJTJDJTBBJTIwJTIwJTIwJTIwYXJncyUzRHRyYWluaW5nX2FyZ3MlMkMlMEElMjAlMjAlMjAlMjB0cmFpbl9kYXRhc2V0JTNEZGF0YXNldCU1QiUyMnRyYWluJTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwZXZhbF9kYXRhc2V0JTNEZGF0YXNldCU1QiUyMnRlc3QlMjIlNUQlMkMlMEElMjAlMjAlMjAlMjB0b2tlbml6ZXIlM0R0b2tlbml6ZXIlMkMlMEElMjAlMjAlMjAlMjBkYXRhX2NvbGxhdG9yJTNEZGF0YV9jb2xsYXRvciUyQyUwQSUyMCUyMCUyMCUyMGNvbXB1dGVfbWV0cmljcyUzRGNvbXB1dGVfbWV0cmljcyUyQyUwQSklMEElMEF0cmFpbmVyLnRyYWluKCk=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Trainer

trainer = Trainer(
    model=model,
    args=training_args,
    train_dataset=dataset[<span class="hljs-string">&quot;train&quot;</span>],
    eval_dataset=dataset[<span class="hljs-string">&quot;test&quot;</span>],
    tokenizer=tokenizer,
    data_collator=data_collator,
    compute_metrics=compute_metrics,
)

trainer.train()`,wrap:!1}}),D=new A({props:{title:"Checkpoints",local:"checkpoints",headingTag:"h3"}}),K=new I({props:{code:"JTIzJTIwcmVzdW1lJTIwZnJvbSUyMGxhdGVzdCUyMGNoZWNrcG9pbnQlMEF0cmFpbmVyLnRyYWluKHJlc3VtZV9mcm9tX2NoZWNrcG9pbnQlM0RUcnVlKSUwQSUwQSUyMyUyMHJlc3VtZSUyMGZyb20lMjBzcGVjaWZpYyUyMGNoZWNrcG9pbnQlMjBzYXZlZCUyMGluJTIwb3V0cHV0JTIwZGlyZWN0b3J5JTBBdHJhaW5lci50cmFpbihyZXN1bWVfZnJvbV9jaGVja3BvaW50JTNEJTIyeW91ci1tb2RlbCUyRmNoZWNrcG9pbnQtMTAwMCUyMik=",highlighted:`<span class="hljs-comment"># resume from latest checkpoint</span>
trainer.train(resume_from_checkpoint=<span class="hljs-literal">True</span>)

<span class="hljs-comment"># resume from specific checkpoint saved in output directory</span>
trainer.train(resume_from_checkpoint=<span class="hljs-string">&quot;your-model/checkpoint-1000&quot;</span>)`,wrap:!1}}),le=new A({props:{title:"Customize the Trainer",local:"customize-the-trainer",headingTag:"h2"}}),re=new I({props:{code:"ZnJvbSUyMHRvcmNoJTIwaW1wb3J0JTIwbm4lMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwVHJhaW5lciUwQSUwQWNsYXNzJTIwQ3VzdG9tVHJhaW5lcihUcmFpbmVyKSUzQSUwQSUyMCUyMCUyMCUyMGRlZiUyMGNvbXB1dGVfbG9zcyhzZWxmJTJDJTIwbW9kZWwlMkMlMjBpbnB1dHMlMkMlMjByZXR1cm5fb3V0cHV0cyUzREZhbHNlKSUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGxhYmVscyUyMCUzRCUyMGlucHV0cy5wb3AoJTIybGFiZWxzJTIyKSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMyUyMGZvcndhcmQlMjBwYXNzJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGxvZ2l0cyUyMCUzRCUyMG91dHB1dHMuZ2V0KCUyMmxvZ2l0cyUyMiklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjMlMjBjb21wdXRlJTIwY3VzdG9tJTIwbG9zcyUyMGZvciUyMDMlMjBsYWJlbHMlMjB3aXRoJTIwZGlmZmVyZW50JTIwd2VpZ2h0cyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGxvc3NfZmN0JTIwJTNEJTIwbm4uQ3Jvc3NFbnRyb3B5TG9zcyh3ZWlnaHQlM0R0b3JjaC50ZW5zb3IoJTVCMS4wJTJDJTIwMi4wJTJDJTIwMy4wJTVEJTJDJTIwZGV2aWNlJTNEbW9kZWwuZGV2aWNlKSklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBsb3NzJTIwJTNEJTIwbG9zc19mY3QobG9naXRzLnZpZXcoLTElMkMlMjBzZWxmLm1vZGVsLmNvbmZpZy5udW1fbGFiZWxzKSUyQyUyMGxhYmVscy52aWV3KC0xKSklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjByZXR1cm4lMjAobG9zcyUyQyUyMG91dHB1dHMpJTIwaWYlMjByZXR1cm5fb3V0cHV0cyUyMGVsc2UlMjBsb3Nz",highlighted:`<span class="hljs-keyword">from</span> torch <span class="hljs-keyword">import</span> nn
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Trainer

<span class="hljs-keyword">class</span> <span class="hljs-title class_">CustomTrainer</span>(<span class="hljs-title class_ inherited__">Trainer</span>):
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">compute_loss</span>(<span class="hljs-params">self, model, inputs, return_outputs=<span class="hljs-literal">False</span></span>):
        labels = inputs.pop(<span class="hljs-string">&quot;labels&quot;</span>)
        <span class="hljs-comment"># forward pass</span>
        outputs = model(**inputs)
        logits = outputs.get(<span class="hljs-string">&quot;logits&quot;</span>)
        <span class="hljs-comment"># compute custom loss for 3 labels with different weights</span>
        loss_fct = nn.CrossEntropyLoss(weight=torch.tensor([<span class="hljs-number">1.0</span>, <span class="hljs-number">2.0</span>, <span class="hljs-number">3.0</span>], device=model.device))
        loss = loss_fct(logits.view(-<span class="hljs-number">1</span>, self.model.config.num_labels), labels.view(-<span class="hljs-number">1</span>))
        <span class="hljs-keyword">return</span> (loss, outputs) <span class="hljs-keyword">if</span> return_outputs <span class="hljs-keyword">else</span> loss`,wrap:!1}}),ie=new A({props:{title:"Callbacks",local:"callbacks",headingTag:"h3"}}),ce=new I({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRyYWluZXJDYWxsYmFjayUwQSUwQWNsYXNzJTIwRWFybHlTdG9wcGluZ0NhbGxiYWNrKFRyYWluZXJDYWxsYmFjayklM0ElMEElMjAlMjAlMjAlMjBkZWYlMjBfX2luaXRfXyhzZWxmJTJDJTIwbnVtX3N0ZXBzJTNEMTApJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwc2VsZi5udW1fc3RlcHMlMjAlM0QlMjBudW1fc3RlcHMlMEElMjAlMjAlMjAlMjAlMEElMjAlMjAlMjAlMjBkZWYlMjBvbl9zdGVwX2VuZChzZWxmJTJDJTIwYXJncyUyQyUyMHN0YXRlJTJDJTIwY29udHJvbCUyQyUyMCoqa3dhcmdzKSUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGlmJTIwc3RhdGUuZ2xvYmFsX3N0ZXAlMjAlM0UlM0QlMjBzZWxmLm51bV9zdGVwcyUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHJldHVybiUyMCU3QiUyMnNob3VsZF90cmFpbmluZ19zdG9wJTIyJTNBJTIwVHJ1ZSU3RCUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGVsc2UlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjByZXR1cm4lMjAlN0IlN0Q=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TrainerCallback

<span class="hljs-keyword">class</span> <span class="hljs-title class_">EarlyStoppingCallback</span>(<span class="hljs-title class_ inherited__">TrainerCallback</span>):
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">__init__</span>(<span class="hljs-params">self, num_steps=<span class="hljs-number">10</span></span>):
        self.num_steps = num_steps
    
    <span class="hljs-keyword">def</span> <span class="hljs-title function_">on_step_end</span>(<span class="hljs-params">self, args, state, control, **kwargs</span>):
        <span class="hljs-keyword">if</span> state.global_step &gt;= self.num_steps:
            <span class="hljs-keyword">return</span> {<span class="hljs-string">&quot;should_training_stop&quot;</span>: <span class="hljs-literal">True</span>}
        <span class="hljs-keyword">else</span>:
            <span class="hljs-keyword">return</span> {}`,wrap:!1}}),me=new I({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRyYWluZXIlMEElMEF0cmFpbmVyJTIwJTNEJTIwVHJhaW5lciglMEElMjAlMjAlMjAlMjBtb2RlbCUzRG1vZGVsJTJDJTBBJTIwJTIwJTIwJTIwYXJncyUzRHRyYWluaW5nX2FyZ3MlMkMlMEElMjAlMjAlMjAlMjB0cmFpbl9kYXRhc2V0JTNEZGF0YXNldCU1QiUyMnRyYWluJTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwZXZhbF9kYXRhc2V0JTNEZGF0YXNldCU1QiUyMnRlc3QlMjIlNUQlMkMlMEElMjAlMjAlMjAlMjB0b2tlbml6ZXIlM0R0b2tlbml6ZXIlMkMlMEElMjAlMjAlMjAlMjBkYXRhX2NvbGxhdG9yJTNEZGF0YV9jb2xsYXRvciUyQyUwQSUyMCUyMCUyMCUyMGNvbXB1dGVfbWV0cmljcyUzRGNvbXB1dGVfbWV0cmljcyUyQyUwQSUyMCUyMCUyMCUyMGNhbGxiYWNrJTNEJTVCRWFybHlTdG9wcGluZ0NhbGxiYWNrKCklNUQlMkMlMEEp",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Trainer

trainer = Trainer(
    model=model,
    args=training_args,
    train_dataset=dataset[<span class="hljs-string">&quot;train&quot;</span>],
    eval_dataset=dataset[<span class="hljs-string">&quot;test&quot;</span>],
    tokenizer=tokenizer,
    data_collator=data_collator,
    compute_metrics=compute_metrics,
    callback=[EarlyStoppingCallback()],
)`,wrap:!1}}),de=new A({props:{title:"Logging",local:"logging",headingTag:"h2"}}),C=new ls({props:{$$slots:{default:[Ft]},$$scope:{ctx:U}}}),X=new ls({props:{$$slots:{default:[Rt]},$$scope:{ctx:U}}}),fe=new I({props:{code:"bG9nZ2VyJTIwJTNEJTIwbG9nZ2luZy5nZXRMb2dnZXIoX19uYW1lX18pJTBBJTBBbG9nZ2luZy5iYXNpY0NvbmZpZyglMEElMjAlMjAlMjAlMjBmb3JtYXQlM0QlMjIlMjUoYXNjdGltZSlzJTIwLSUyMCUyNShsZXZlbG5hbWUpcyUyMC0lMjAlMjUobmFtZSlzJTIwLSUyMCUyNShtZXNzYWdlKXMlMjIlMkMlMEElMjAlMjAlMjAlMjBkYXRlZm10JTNEJTIyJTI1bSUyRiUyNWQlMkYlMjVZJTIwJTI1SCUzQSUyNU0lM0ElMjVTJTIyJTJDJTBBJTIwJTIwJTIwJTIwaGFuZGxlcnMlM0QlNUJsb2dnaW5nLlN0cmVhbUhhbmRsZXIoc3lzLnN0ZG91dCklNUQlMkMlMEEpJTBBJTBBbG9nX2xldmVsJTIwJTNEJTIwdHJhaW5pbmdfYXJncy5nZXRfcHJvY2Vzc19sb2dfbGV2ZWwoKSUwQWxvZ2dlci5zZXRMZXZlbChsb2dfbGV2ZWwpJTBBZGF0YXNldHMudXRpbHMubG9nZ2luZy5zZXRfdmVyYm9zaXR5KGxvZ19sZXZlbCklMEF0cmFuc2Zvcm1lcnMudXRpbHMubG9nZ2luZy5zZXRfdmVyYm9zaXR5KGxvZ19sZXZlbCklMEElMEF0cmFpbmVyJTIwJTNEJTIwVHJhaW5lciguLi4p",highlighted:`logger = logging.getLogger(__name__)

logging.basicConfig(
    <span class="hljs-built_in">format</span>=<span class="hljs-string">&quot;%(asctime)s - %(levelname)s - %(name)s - %(message)s&quot;</span>,
    datefmt=<span class="hljs-string">&quot;%m/%d/%Y %H:%M:%S&quot;</span>,
    handlers=[logging.StreamHandler(sys.stdout)],
)

log_level = training_args.get_process_log_level()
logger.setLevel(log_level)
datasets.utils.logging.set_verbosity(log_level)
transformers.utils.logging.set_verbosity(log_level)

trainer = Trainer(...)`,wrap:!1}}),B=new Ct({props:{id:"logging",options:["single node","multi-node"],$$slots:{default:[zt]},$$scope:{ctx:U}}}),we=new A({props:{title:"NEFTune",local:"neftune",headingTag:"h2"}}),je=new I({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRyYWluaW5nQXJndW1lbnRzJTJDJTIwVHJhaW5lciUwQSUwQXRyYWluaW5nX2FyZ3MlMjAlM0QlMjBUcmFpbmluZ0FyZ3VtZW50cyguLi4lMkMlMjBuZWZ0dW5lX25vaXNlX2FscGhhJTNEMC4xKSUwQXRyYWluZXIlMjAlM0QlMjBUcmFpbmVyKC4uLiUyQyUyMGFyZ3MlM0R0cmFpbmluZ19hcmdzKQ==",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TrainingArguments, Trainer

training_args = TrainingArguments(..., neftune_noise_alpha=<span class="hljs-number">0.1</span>)
trainer = Trainer(..., args=training_args)`,wrap:!1}}),ge=new A({props:{title:"GaLore",local:"galore",headingTag:"h2"}}),Ie=new I({props:{code:"cGlwJTIwaW5zdGFsbCUyMGdhbG9yZS10b3JjaA==",highlighted:"pip install galore-torch",wrap:!1}}),Ae=new I({props:{code:"aW1wb3J0JTIwdG9yY2glMEFpbXBvcnQlMjBkYXRhc2V0cyUwQWltcG9ydCUyMHRybCUwQSUwQWZyb20lMjB0cmFuc2Zvcm1lcnMlMjBpbXBvcnQlMjBUcmFpbmluZ0FyZ3VtZW50cyUyQyUyMEF1dG9Db25maWclMkMlMjBBdXRvVG9rZW5pemVyJTJDJTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0lMEElMEF0cmFpbl9kYXRhc2V0JTIwJTNEJTIwZGF0YXNldHMubG9hZF9kYXRhc2V0KCdpbWRiJyUyQyUyMHNwbGl0JTNEJ3RyYWluJyklMEElMEFhcmdzJTIwJTNEJTIwVHJhaW5pbmdBcmd1bWVudHMoJTBBJTIwJTIwJTIwJTIwb3V0cHV0X2RpciUzRCUyMi4lMkZ0ZXN0LWdhbG9yZSUyMiUyQyUwQSUyMCUyMCUyMCUyMG1heF9zdGVwcyUzRDEwMCUyQyUwQSUyMCUyMCUyMCUyMHBlcl9kZXZpY2VfdHJhaW5fYmF0Y2hfc2l6ZSUzRDIlMkMlMEElMjAlMjAlMjAlMjBvcHRpbSUzRCUyMmdhbG9yZV9hZGFtdyUyMiUyQyUwQSUyMCUyMCUyMCUyMG9wdGltX3RhcmdldF9tb2R1bGVzJTNEJTVCciUyMi4qLmF0dG4uKiUyMiUyQyUyMHIlMjIuKi5tbHAuKiUyMiU1RCUwQSklMEElMEFtb2RlbF9pZCUyMCUzRCUyMCUyMmdvb2dsZSUyRmdlbW1hLTJiJTIyJTBBJTBBY29uZmlnJTIwJTNEJTIwQXV0b0NvbmZpZy5mcm9tX3ByZXRyYWluZWQobW9kZWxfaWQpJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQobW9kZWxfaWQpJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JDYXVzYWxMTS5mcm9tX2NvbmZpZyhjb25maWcpLnRvKDApJTBBJTBBdHJhaW5lciUyMCUzRCUyMHRybC5TRlRUcmFpbmVyKCUwQSUyMCUyMCUyMCUyMG1vZGVsJTNEbW9kZWwlMkMlMjAlMEElMjAlMjAlMjAlMjBhcmdzJTNEYXJncyUyQyUwQSUyMCUyMCUyMCUyMHRyYWluX2RhdGFzZXQlM0R0cmFpbl9kYXRhc2V0JTJDJTBBJTIwJTIwJTIwJTIwZGF0YXNldF90ZXh0X2ZpZWxkJTNEJ3RleHQnJTJDJTBBJTIwJTIwJTIwJTIwbWF4X3NlcV9sZW5ndGglM0Q1MTIlMkMlMEEpJTBBJTBBdHJhaW5lci50cmFpbigp",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">import</span> datasets
<span class="hljs-keyword">import</span> trl

<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TrainingArguments, AutoConfig, AutoTokenizer, AutoModelForCausalLM

train_dataset = datasets.load_dataset(<span class="hljs-string">&#x27;imdb&#x27;</span>, split=<span class="hljs-string">&#x27;train&#x27;</span>)

args = TrainingArguments(
    output_dir=<span class="hljs-string">&quot;./test-galore&quot;</span>,
    max_steps=<span class="hljs-number">100</span>,
    per_device_train_batch_size=<span class="hljs-number">2</span>,
    optim=<span class="hljs-string">&quot;galore_adamw&quot;</span>,
    optim_target_modules=[<span class="hljs-string">r&quot;.*.attn.*&quot;</span>, <span class="hljs-string">r&quot;.*.mlp.*&quot;</span>]
)

model_id = <span class="hljs-string">&quot;google/gemma-2b&quot;</span>

config = AutoConfig.from_pretrained(model_id)

tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_config(config).to(<span class="hljs-number">0</span>)

trainer = trl.SFTTrainer(
    model=model, 
    args=args,
    train_dataset=train_dataset,
    dataset_text_field=<span class="hljs-string">&#x27;text&#x27;</span>,
    max_seq_length=<span class="hljs-number">512</span>,
)

trainer.train()`,wrap:!1}}),Ce=new I({props:{code:"aW1wb3J0JTIwdG9yY2glMEFpbXBvcnQlMjBkYXRhc2V0cyUwQWltcG9ydCUyMHRybCUwQSUwQWZyb20lMjB0cmFuc2Zvcm1lcnMlMjBpbXBvcnQlMjBUcmFpbmluZ0FyZ3VtZW50cyUyQyUyMEF1dG9Db25maWclMkMlMjBBdXRvVG9rZW5pemVyJTJDJTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0lMEElMEF0cmFpbl9kYXRhc2V0JTIwJTNEJTIwZGF0YXNldHMubG9hZF9kYXRhc2V0KCdpbWRiJyUyQyUyMHNwbGl0JTNEJ3RyYWluJyklMEElMEFhcmdzJTIwJTNEJTIwVHJhaW5pbmdBcmd1bWVudHMoJTBBJTIwJTIwJTIwJTIwb3V0cHV0X2RpciUzRCUyMi4lMkZ0ZXN0LWdhbG9yZSUyMiUyQyUwQSUyMCUyMCUyMCUyMG1heF9zdGVwcyUzRDEwMCUyQyUwQSUyMCUyMCUyMCUyMHBlcl9kZXZpY2VfdHJhaW5fYmF0Y2hfc2l6ZSUzRDIlMkMlMEElMjAlMjAlMjAlMjBvcHRpbSUzRCUyMmdhbG9yZV9hZGFtdyUyMiUyQyUwQSUyMCUyMCUyMCUyMG9wdGltX3RhcmdldF9tb2R1bGVzJTNEJTVCciUyMi4qLmF0dG4uKiUyMiUyQyUyMHIlMjIuKi5tbHAuKiUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMG9wdGltX2FyZ3MlM0QlMjJyYW5rJTNENjQlMkMlMjB1cGRhdGVfcHJval9nYXAlM0QxMDAlMkMlMjBzY2FsZSUzRDAuMTAlMjIlMkMlMEEpJTBBJTBBbW9kZWxfaWQlMjAlM0QlMjAlMjJnb29nbGUlMkZnZW1tYS0yYiUyMiUwQSUwQWNvbmZpZyUyMCUzRCUyMEF1dG9Db25maWcuZnJvbV9wcmV0cmFpbmVkKG1vZGVsX2lkKSUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKG1vZGVsX2lkKSUwQW1vZGVsJTIwJTNEJTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9jb25maWcoY29uZmlnKS50bygwKSUwQSUwQXRyYWluZXIlMjAlM0QlMjB0cmwuU0ZUVHJhaW5lciglMEElMjAlMjAlMjAlMjBtb2RlbCUzRG1vZGVsJTJDJTIwJTBBJTIwJTIwJTIwJTIwYXJncyUzRGFyZ3MlMkMlMEElMjAlMjAlMjAlMjB0cmFpbl9kYXRhc2V0JTNEdHJhaW5fZGF0YXNldCUyQyUwQSUyMCUyMCUyMCUyMGRhdGFzZXRfdGV4dF9maWVsZCUzRCd0ZXh0JyUyQyUwQSUyMCUyMCUyMCUyMG1heF9zZXFfbGVuZ3RoJTNENTEyJTJDJTBBKSUwQSUwQXRyYWluZXIudHJhaW4oKQ==",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">import</span> datasets
<span class="hljs-keyword">import</span> trl

<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TrainingArguments, AutoConfig, AutoTokenizer, AutoModelForCausalLM

train_dataset = datasets.load_dataset(<span class="hljs-string">&#x27;imdb&#x27;</span>, split=<span class="hljs-string">&#x27;train&#x27;</span>)

args = TrainingArguments(
    output_dir=<span class="hljs-string">&quot;./test-galore&quot;</span>,
    max_steps=<span class="hljs-number">100</span>,
    per_device_train_batch_size=<span class="hljs-number">2</span>,
    optim=<span class="hljs-string">&quot;galore_adamw&quot;</span>,
    optim_target_modules=[<span class="hljs-string">r&quot;.*.attn.*&quot;</span>, <span class="hljs-string">r&quot;.*.mlp.*&quot;</span>],
    optim_args=<span class="hljs-string">&quot;rank=64, update_proj_gap=100, scale=0.10&quot;</span>,
)

model_id = <span class="hljs-string">&quot;google/gemma-2b&quot;</span>

config = AutoConfig.from_pretrained(model_id)

tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_config(config).to(<span class="hljs-number">0</span>)

trainer = trl.SFTTrainer(
    model=model, 
    args=args,
    train_dataset=train_dataset,
    dataset_text_field=<span class="hljs-string">&#x27;text&#x27;</span>,
    max_seq_length=<span class="hljs-number">512</span>,
)

trainer.train()`,wrap:!1}}),Ge=new I({props:{code:"aW1wb3J0JTIwdG9yY2glMEFpbXBvcnQlMjBkYXRhc2V0cyUwQWltcG9ydCUyMHRybCUwQSUwQWZyb20lMjB0cmFuc2Zvcm1lcnMlMjBpbXBvcnQlMjBUcmFpbmluZ0FyZ3VtZW50cyUyQyUyMEF1dG9Db25maWclMkMlMjBBdXRvVG9rZW5pemVyJTJDJTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0lMEElMEF0cmFpbl9kYXRhc2V0JTIwJTNEJTIwZGF0YXNldHMubG9hZF9kYXRhc2V0KCdpbWRiJyUyQyUyMHNwbGl0JTNEJ3RyYWluJyklMEElMEFhcmdzJTIwJTNEJTIwVHJhaW5pbmdBcmd1bWVudHMoJTBBJTIwJTIwJTIwJTIwb3V0cHV0X2RpciUzRCUyMi4lMkZ0ZXN0LWdhbG9yZSUyMiUyQyUwQSUyMCUyMCUyMCUyMG1heF9zdGVwcyUzRDEwMCUyQyUwQSUyMCUyMCUyMCUyMHBlcl9kZXZpY2VfdHJhaW5fYmF0Y2hfc2l6ZSUzRDIlMkMlMEElMjAlMjAlMjAlMjBvcHRpbSUzRCUyMmdhbG9yZV9hZGFtd19sYXllcndpc2UlMjIlMkMlMEElMjAlMjAlMjAlMjBvcHRpbV90YXJnZXRfbW9kdWxlcyUzRCU1QnIlMjIuKi5hdHRuLiolMjIlMkMlMjByJTIyLioubWxwLiolMjIlNUQlMEEpJTBBJTBBbW9kZWxfaWQlMjAlM0QlMjAlMjJnb29nbGUlMkZnZW1tYS0yYiUyMiUwQSUwQWNvbmZpZyUyMCUzRCUyMEF1dG9Db25maWcuZnJvbV9wcmV0cmFpbmVkKG1vZGVsX2lkKSUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKG1vZGVsX2lkKSUwQW1vZGVsJTIwJTNEJTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9jb25maWcoY29uZmlnKS50bygwKSUwQSUwQXRyYWluZXIlMjAlM0QlMjB0cmwuU0ZUVHJhaW5lciglMEElMjAlMjAlMjAlMjBtb2RlbCUzRG1vZGVsJTJDJTIwJTBBJTIwJTIwJTIwJTIwYXJncyUzRGFyZ3MlMkMlMEElMjAlMjAlMjAlMjB0cmFpbl9kYXRhc2V0JTNEdHJhaW5fZGF0YXNldCUyQyUwQSUyMCUyMCUyMCUyMGRhdGFzZXRfdGV4dF9maWVsZCUzRCd0ZXh0JyUyQyUwQSUyMCUyMCUyMCUyMG1heF9zZXFfbGVuZ3RoJTNENTEyJTJDJTBBKSUwQSUwQXRyYWluZXIudHJhaW4oKQ==",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">import</span> datasets
<span class="hljs-keyword">import</span> trl

<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TrainingArguments, AutoConfig, AutoTokenizer, AutoModelForCausalLM

train_dataset = datasets.load_dataset(<span class="hljs-string">&#x27;imdb&#x27;</span>, split=<span class="hljs-string">&#x27;train&#x27;</span>)

args = TrainingArguments(
    output_dir=<span class="hljs-string">&quot;./test-galore&quot;</span>,
    max_steps=<span class="hljs-number">100</span>,
    per_device_train_batch_size=<span class="hljs-number">2</span>,
    optim=<span class="hljs-string">&quot;galore_adamw_layerwise&quot;</span>,
    optim_target_modules=[<span class="hljs-string">r&quot;.*.attn.*&quot;</span>, <span class="hljs-string">r&quot;.*.mlp.*&quot;</span>]
)

model_id = <span class="hljs-string">&quot;google/gemma-2b&quot;</span>

config = AutoConfig.from_pretrained(model_id)

tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_config(config).to(<span class="hljs-number">0</span>)

trainer = trl.SFTTrainer(
    model=model, 
    args=args,
    train_dataset=train_dataset,
    dataset_text_field=<span class="hljs-string">&#x27;text&#x27;</span>,
    max_seq_length=<span class="hljs-number">512</span>,
)

trainer.train()`,wrap:!1}}),Ve=new A({props:{title:"LOMO optimizer",local:"lomo-optimizer",headingTag:"h2"}}),W=new ls({props:{$$slots:{default:[St]},$$scope:{ctx:U}}}),Re=new I({props:{code:"aW1wb3J0JTIwdG9yY2glMEFpbXBvcnQlMjBkYXRhc2V0cyUwQWZyb20lMjB0cmFuc2Zvcm1lcnMlMjBpbXBvcnQlMjBUcmFpbmluZ0FyZ3VtZW50cyUyQyUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBBdXRvTW9kZWxGb3JDYXVzYWxMTSUwQWltcG9ydCUyMHRybCUwQSUwQXRyYWluX2RhdGFzZXQlMjAlM0QlMjBkYXRhc2V0cy5sb2FkX2RhdGFzZXQoJ2ltZGInJTJDJTIwc3BsaXQlM0QndHJhaW4nKSUwQSUwQWFyZ3MlMjAlM0QlMjBUcmFpbmluZ0FyZ3VtZW50cyglMEElMjAlMjAlMjAlMjBvdXRwdXRfZGlyJTNEJTIyLiUyRnRlc3QtbG9tbyUyMiUyQyUwQSUyMCUyMCUyMCUyMG1heF9zdGVwcyUzRDEwMDAlMkMlMEElMjAlMjAlMjAlMjBwZXJfZGV2aWNlX3RyYWluX2JhdGNoX3NpemUlM0Q0JTJDJTBBJTIwJTIwJTIwJTIwb3B0aW0lM0QlMjJhZGFsb21vJTIyJTJDJTBBJTIwJTIwJTIwJTIwZ3JhZGllbnRfY2hlY2twb2ludGluZyUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjBsb2dnaW5nX3N0cmF0ZWd5JTNEJTIyc3RlcHMlMjIlMkMlMEElMjAlMjAlMjAlMjBsb2dnaW5nX3N0ZXBzJTNEMSUyQyUwQSUyMCUyMCUyMCUyMGxlYXJuaW5nX3JhdGUlM0QyZS02JTJDJTBBJTIwJTIwJTIwJTIwc2F2ZV9zdHJhdGVneSUzRCUyMm5vJTIyJTJDJTBBJTIwJTIwJTIwJTIwcnVuX25hbWUlM0QlMjJsb21vLWltZGIlMjIlMkMlMEEpJTBBJTBBbW9kZWxfaWQlMjAlM0QlMjAlMjJnb29nbGUlMkZnZW1tYS0yYiUyMiUwQSUwQXRva2VuaXplciUyMCUzRCUyMEF1dG9Ub2tlbml6ZXIuZnJvbV9wcmV0cmFpbmVkKG1vZGVsX2lkKSUwQW1vZGVsJTIwJTNEJTIwQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKG1vZGVsX2lkJTJDJTIwbG93X2NwdV9tZW1fdXNhZ2UlM0RUcnVlKS50bygwKSUwQSUwQXRyYWluZXIlMjAlM0QlMjB0cmwuU0ZUVHJhaW5lciglMEElMjAlMjAlMjAlMjBtb2RlbCUzRG1vZGVsJTJDJTIwJTBBJTIwJTIwJTIwJTIwYXJncyUzRGFyZ3MlMkMlMEElMjAlMjAlMjAlMjB0cmFpbl9kYXRhc2V0JTNEdHJhaW5fZGF0YXNldCUyQyUwQSUyMCUyMCUyMCUyMGRhdGFzZXRfdGV4dF9maWVsZCUzRCd0ZXh0JyUyQyUwQSUyMCUyMCUyMCUyMG1heF9zZXFfbGVuZ3RoJTNEMTAyNCUyQyUwQSklMEElMEF0cmFpbmVyLnRyYWluKCk=",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">import</span> datasets
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TrainingArguments, AutoTokenizer, AutoModelForCausalLM
<span class="hljs-keyword">import</span> trl

train_dataset = datasets.load_dataset(<span class="hljs-string">&#x27;imdb&#x27;</span>, split=<span class="hljs-string">&#x27;train&#x27;</span>)

args = TrainingArguments(
    output_dir=<span class="hljs-string">&quot;./test-lomo&quot;</span>,
    max_steps=<span class="hljs-number">1000</span>,
    per_device_train_batch_size=<span class="hljs-number">4</span>,
    optim=<span class="hljs-string">&quot;adalomo&quot;</span>,
    gradient_checkpointing=<span class="hljs-literal">True</span>,
    logging_strategy=<span class="hljs-string">&quot;steps&quot;</span>,
    logging_steps=<span class="hljs-number">1</span>,
    learning_rate=<span class="hljs-number">2e-6</span>,
    save_strategy=<span class="hljs-string">&quot;no&quot;</span>,
    run_name=<span class="hljs-string">&quot;lomo-imdb&quot;</span>,
)

model_id = <span class="hljs-string">&quot;google/gemma-2b&quot;</span>

tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, low_cpu_mem_usage=<span class="hljs-literal">True</span>).to(<span class="hljs-number">0</span>)

trainer = trl.SFTTrainer(
    model=model, 
    args=args,
    train_dataset=train_dataset,
    dataset_text_field=<span class="hljs-string">&#x27;text&#x27;</span>,
    max_seq_length=<span class="hljs-number">1024</span>,
)

trainer.train()`,wrap:!1}}),Qe=new A({props:{title:"GrokAdamW optimizer",local:"grokadamw-optimizer",headingTag:"h2"}}),k=new ls({props:{$$slots:{default:[Yt]},$$scope:{ctx:U}}}),Se=new I({props:{code:"aW1wb3J0JTIwdG9yY2glMEFpbXBvcnQlMjBkYXRhc2V0cyUwQWZyb20lMjB0cmFuc2Zvcm1lcnMlMjBpbXBvcnQlMjBUcmFpbmluZ0FyZ3VtZW50cyUyQyUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBBdXRvTW9kZWxGb3JDYXVzYWxMTSUyQyUyMFRyYWluZXIlMEElMEElMjMlMjBMb2FkJTIwdGhlJTIwSU1EQiUyMGRhdGFzZXQlMEF0cmFpbl9kYXRhc2V0JTIwJTNEJTIwZGF0YXNldHMubG9hZF9kYXRhc2V0KCdpbWRiJyUyQyUyMHNwbGl0JTNEJ3RyYWluJyklMEElMEElMjMlMjBEZWZpbmUlMjB0aGUlMjB0cmFpbmluZyUyMGFyZ3VtZW50cyUwQWFyZ3MlMjAlM0QlMjBUcmFpbmluZ0FyZ3VtZW50cyglMEElMjAlMjAlMjAlMjBvdXRwdXRfZGlyJTNEJTIyLiUyRnRlc3QtZ3Jva2FkYW13JTIyJTJDJTBBJTIwJTIwJTIwJTIwbWF4X3N0ZXBzJTNEMTAwMCUyQyUwQSUyMCUyMCUyMCUyMHBlcl9kZXZpY2VfdHJhaW5fYmF0Y2hfc2l6ZSUzRDQlMkMlMEElMjAlMjAlMjAlMjBvcHRpbSUzRCUyMmdyb2thZGFtdyUyMiUyQyUwQSUyMCUyMCUyMCUyMGxvZ2dpbmdfc3RyYXRlZ3klM0QlMjJzdGVwcyUyMiUyQyUwQSUyMCUyMCUyMCUyMGxvZ2dpbmdfc3RlcHMlM0QxJTJDJTBBJTIwJTIwJTIwJTIwbGVhcm5pbmdfcmF0ZSUzRDJlLTUlMkMlMEElMjAlMjAlMjAlMjBzYXZlX3N0cmF0ZWd5JTNEJTIybm8lMjIlMkMlMEElMjAlMjAlMjAlMjBydW5fbmFtZSUzRCUyMmdyb2thZGFtdy1pbWRiJTIyJTJDJTBBKSUwQSUwQSUyMyUyMExvYWQlMjB0aGUlMjBtb2RlbCUyMGFuZCUyMHRva2VuaXplciUwQW1vZGVsX2lkJTIwJTNEJTIwJTIyZ29vZ2xlJTJGZ2VtbWEtMmIlMjIlMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZChtb2RlbF9pZCklMEFtb2RlbCUyMCUzRCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNLmZyb21fcHJldHJhaW5lZChtb2RlbF9pZCUyQyUyMGxvd19jcHVfbWVtX3VzYWdlJTNEVHJ1ZSkudG8oMCklMEElMEElMjMlMjBJbml0aWFsaXplJTIwdGhlJTIwVHJhaW5lciUwQXRyYWluZXIlMjAlM0QlMjBUcmFpbmVyKCUwQSUyMCUyMCUyMCUyMG1vZGVsJTNEbW9kZWwlMkMlMEElMjAlMjAlMjAlMjBhcmdzJTNEYXJncyUyQyUwQSUyMCUyMCUyMCUyMHRyYWluX2RhdGFzZXQlM0R0cmFpbl9kYXRhc2V0JTJDJTBBKSUwQSUwQSUyMyUyMFRyYWluJTIwdGhlJTIwbW9kZWwlMEF0cmFpbmVyLnRyYWluKCk=",highlighted:`<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">import</span> datasets
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TrainingArguments, AutoTokenizer, AutoModelForCausalLM, Trainer

<span class="hljs-comment"># Load the IMDB dataset</span>
train_dataset = datasets.load_dataset(<span class="hljs-string">&#x27;imdb&#x27;</span>, split=<span class="hljs-string">&#x27;train&#x27;</span>)

<span class="hljs-comment"># Define the training arguments</span>
args = TrainingArguments(
    output_dir=<span class="hljs-string">&quot;./test-grokadamw&quot;</span>,
    max_steps=<span class="hljs-number">1000</span>,
    per_device_train_batch_size=<span class="hljs-number">4</span>,
    optim=<span class="hljs-string">&quot;grokadamw&quot;</span>,
    logging_strategy=<span class="hljs-string">&quot;steps&quot;</span>,
    logging_steps=<span class="hljs-number">1</span>,
    learning_rate=<span class="hljs-number">2e-5</span>,
    save_strategy=<span class="hljs-string">&quot;no&quot;</span>,
    run_name=<span class="hljs-string">&quot;grokadamw-imdb&quot;</span>,
)

<span class="hljs-comment"># Load the model and tokenizer</span>
model_id = <span class="hljs-string">&quot;google/gemma-2b&quot;</span>
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, low_cpu_mem_usage=<span class="hljs-literal">True</span>).to(<span class="hljs-number">0</span>)

<span class="hljs-comment"># Initialize the Trainer</span>
trainer = Trainer(
    model=model,
    args=args,
    train_dataset=train_dataset,
)

<span class="hljs-comment"># Train the model</span>
trainer.train()`,wrap:!1}}),He=new A({props:{title:"Accelerate and Trainer",local:"accelerate-and-trainer",headingTag:"h2"}}),G=new ls({props:{$$slots:{default:[Ht]},$$scope:{ctx:U}}}),v=new Ct({props:{id:"config",options:["DistributedDataParallel","FSDP","DeepSpeed","DeepSpeed with Accelerate plugin"],$$slots:{default:[Pt]},$$scope:{ctx:U}}}),Pe=new I({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMCU1QyUwQSUyMCUyMCUyMCUyMC4lMkZleGFtcGxlcyUyRnB5dG9yY2glMkZ0ZXh0LWNsYXNzaWZpY2F0aW9uJTJGcnVuX2dsdWUucHklMjAlNUMlMEElMjAlMjAlMjAlMjAtLW1vZGVsX25hbWVfb3JfcGF0aCUyMGdvb2dsZS1iZXJ0JTJGYmVydC1iYXNlLWNhc2VkJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS10YXNrX25hbWUlMjAlMjRUQVNLX05BTUUlMjAlNUMlMEElMjAlMjAlMjAlMjAtLWRvX3RyYWluJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1kb19ldmFsJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1tYXhfc2VxX2xlbmd0aCUyMDEyOCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tcGVyX2RldmljZV90cmFpbl9iYXRjaF9zaXplJTIwMTYlMjAlNUMlMEElMjAlMjAlMjAlMjAtLWxlYXJuaW5nX3JhdGUlMjA1ZS01JTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1udW1fdHJhaW5fZXBvY2hzJTIwMyUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tb3V0cHV0X2RpciUyMCUyRnRtcCUyRiUyNFRBU0tfTkFNRSUyRiUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tb3ZlcndyaXRlX291dHB1dF9kaXI=",highlighted:`accelerate launch \\
    ./examples/pytorch/text-classification/run_glue.py \\
    --model_name_or_path google-bert/bert-base-cased \\
    --task_name <span class="hljs-variable">$TASK_NAME</span> \\
    --do_train \\
    --do_eval \\
    --max_seq_length 128 \\
    --per_device_train_batch_size 16 \\
    --learning_rate 5e-5 \\
    --num_train_epochs 3 \\
    --output_dir /tmp/<span class="hljs-variable">$TASK_NAME</span>/ \\
    --overwrite_output_dir`,wrap:!1}}),Oe=new I({props:{code:"YWNjZWxlcmF0ZSUyMGxhdW5jaCUyMC0tbnVtX3Byb2Nlc3NlcyUzRDIlMjAlNUMlMEElMjAlMjAlMjAlMjAtLXVzZV9mc2RwJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1taXhlZF9wcmVjaXNpb24lM0RiZjE2JTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1mc2RwX2F1dG9fd3JhcF9wb2xpY3klM0RUUkFOU0ZPUk1FUl9CQVNFRF9XUkFQJTIwJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1mc2RwX3RyYW5zZm9ybWVyX2xheWVyX2Nsc190b193cmFwJTNEJTIyQmVydExheWVyJTIyJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1mc2RwX3NoYXJkaW5nX3N0cmF0ZWd5JTNEMSUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tZnNkcF9zdGF0ZV9kaWN0X3R5cGUlM0RGVUxMX1NUQVRFX0RJQ1QlMjAlNUMlMEElMjAlMjAlMjAlMjAuJTJGZXhhbXBsZXMlMkZweXRvcmNoJTJGdGV4dC1jbGFzc2lmaWNhdGlvbiUyRnJ1bl9nbHVlLnB5JTBBJTIwJTIwJTIwJTIwLS1tb2RlbF9uYW1lX29yX3BhdGglMjBnb29nbGUtYmVydCUyRmJlcnQtYmFzZS1jYXNlZCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tdGFza19uYW1lJTIwJTI0VEFTS19OQU1FJTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1kb190cmFpbiUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tZG9fZXZhbCUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tbWF4X3NlcV9sZW5ndGglMjAxMjglMjAlNUMlMEElMjAlMjAlMjAlMjAtLXBlcl9kZXZpY2VfdHJhaW5fYmF0Y2hfc2l6ZSUyMDE2JTIwJTVDJTBBJTIwJTIwJTIwJTIwLS1sZWFybmluZ19yYXRlJTIwNWUtNSUyMCU1QyUwQSUyMCUyMCUyMCUyMC0tbnVtX3RyYWluX2Vwb2NocyUyMDMlMjAlNUMlMEElMjAlMjAlMjAlMjAtLW91dHB1dF9kaXIlMjAlMkZ0bXAlMkYlMjRUQVNLX05BTUUlMkYlMjAlNUMlMEElMjAlMjAlMjAlMjAtLW92ZXJ3cml0ZV9vdXRwdXRfZGly",highlighted:`accelerate launch --num_processes=2 \\
    --use_fsdp \\
    --mixed_precision=bf16 \\
    --fsdp_auto_wrap_policy=TRANSFORMER_BASED_WRAP  \\
    --fsdp_transformer_layer_cls_to_wrap=<span class="hljs-string">&quot;BertLayer&quot;</span> \\
    --fsdp_sharding_strategy=1 \\
    --fsdp_state_dict_type=FULL_STATE_DICT \\
    ./examples/pytorch/text-classification/run_glue.py
    --model_name_or_path google-bert/bert-base-cased \\
    --task_name <span class="hljs-variable">$TASK_NAME</span> \\
    --do_train \\
    --do_eval \\
    --max_seq_length 128 \\
    --per_device_train_batch_size 16 \\
    --learning_rate 5e-5 \\
    --num_train_epochs 3 \\
    --output_dir /tmp/<span class="hljs-variable">$TASK_NAME</span>/ \\
    --overwrite_output_dir`,wrap:!1}}),ss=new Vt({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/trainer.md"}}),{c(){a=p("meta"),o=r(),n=p("p"),u=r(),m(w.$$.fragment),j=r(),g=p("p"),g.innerHTML=_,J=r(),m(b.$$.fragment),V=r(),$=p("p"),$.innerHTML=as,E=r(),m(F.$$.fragment),rs=r(),R=p("p"),R.innerHTML=Xl,is=r(),m(Q.$$.fragment),os=r(),N=p("p"),N.innerHTML=Bl,ps=r(),z=p("ol"),z.innerHTML=Wl,cs=r(),S=p("p"),S.innerHTML=kl,Ms=r(),Y=p("p"),Y.innerHTML=Gl,ms=r(),m(H.$$.fragment),ds=r(),x=p("p"),x.innerHTML=vl,Ts=r(),L=p("p"),L.innerHTML=Vl,hs=r(),m(q.$$.fragment),ys=r(),m(D.$$.fragment),fs=r(),P=p("p"),P.innerHTML=El,us=r(),m(K.$$.fragment),ws=r(),O=p("p"),O.innerHTML=Fl,Js=r(),ee=p("ul"),ee.innerHTML=Rl,js=r(),se=p("p"),se.innerHTML=Ql,Us=r(),m(le.$$.fragment),gs=r(),te=p("p"),te.innerHTML=Nl,bs=r(),ae=p("ul"),ae.innerHTML=zl,_s=r(),ne=p("p"),ne.innerHTML=Sl,Is=r(),m(re.$$.fragment),Zs=r(),m(ie.$$.fragment),As=r(),oe=p("p"),oe.innerHTML=Yl,$s=r(),pe=p("p"),pe.textContent=Hl,Cs=r(),m(ce.$$.fragment),Xs=r(),Me=p("p"),Me.innerHTML=xl,Bs=r(),m(me.$$.fragment),Ws=r(),m(de.$$.fragment),ks=r(),m(C.$$.fragment),Gs=r(),Te=p("p"),Te.innerHTML=Ll,vs=r(),he=p("p"),he.innerHTML=ql,Vs=r(),m(X.$$.fragment),Es=r(),ye=p("p"),ye.textContent=Dl,Fs=r(),m(fe.$$.fragment),Rs=r(),ue=p("p"),ue.innerHTML=Pl,Qs=r(),m(B.$$.fragment),Ns=r(),m(we.$$.fragment),zs=r(),Je=p("p"),Je.innerHTML=Kl,Ss=r(),m(je.$$.fragment),Ys=r(),Ue=p("p"),Ue.textContent=Ol,Hs=r(),m(ge.$$.fragment),xs=r(),be=p("p"),be.textContent=et,Ls=r(),_e=p("p"),_e.textContent=st,qs=r(),m(Ie.$$.fragment),Ds=r(),Ze=p("p"),Ze.innerHTML=lt,Ps=r(),m(Ae.$$.fragment),Ks=r(),$e=p("p"),$e.innerHTML=tt,Os=r(),m(Ce.$$.fragment),el=r(),Xe=p("p"),Xe.innerHTML=at,sl=r(),Be=p("p"),Be.textContent=nt,ll=r(),We=p("p"),We.textContent=rt,tl=r(),ke=p("p"),ke.innerHTML=it,al=r(),m(Ge.$$.fragment),nl=r(),ve=p("p"),ve.innerHTML=ot,rl=r(),m(Ve.$$.fragment),il=r(),Ee=p("p"),Ee.innerHTML=pt,ol=r(),m(W.$$.fragment),pl=r(),Fe=p("p"),Fe.innerHTML=ct,cl=r(),m(Re.$$.fragment),Ml=r(),m(Qe.$$.fragment),ml=r(),Ne=p("p"),Ne.innerHTML=Mt,dl=r(),m(k.$$.fragment),Tl=r(),ze=p("p"),ze.innerHTML=mt,hl=r(),m(Se.$$.fragment),yl=r(),Ye=p("p"),Ye.innerHTML=dt,fl=r(),m(He.$$.fragment),ul=r(),xe=p("p"),xe.innerHTML=Tt,wl=r(),m(G.$$.fragment),Jl=r(),Le=p("p"),Le.innerHTML=ht,jl=r(),m(v.$$.fragment),Ul=r(),qe=p("p"),qe.innerHTML=yt,gl=r(),De=p("p"),De.innerHTML=ft,bl=r(),m(Pe.$$.fragment),_l=r(),Ke=p("p"),Ke.innerHTML=ut,Il=r(),m(Oe.$$.fragment),Zl=r(),es=p("p"),es.innerHTML=wt,Al=r(),m(ss.$$.fragment),$l=r(),ns=p("p"),this.h()},l(e){const s=Gt("svelte-u9bgzb",document.head);a=c(s,"META",{name:!0,content:!0}),s.forEach(l),o=i(e),n=c(e,"P",{}),At(n).forEach(l),u=i(e),d(w.$$.fragment,e),j=i(e),g=c(e,"P",{"data-svelte-h":!0}),M(g)!=="svelte-3rmavh"&&(g.innerHTML=_),J=i(e),d(b.$$.fragment,e),V=i(e),$=c(e,"P",{"data-svelte-h":!0}),M($)!=="svelte-17cwfvo"&&($.innerHTML=as),E=i(e),d(F.$$.fragment,e),rs=i(e),R=c(e,"P",{"data-svelte-h":!0}),M(R)!=="svelte-139w2rp"&&(R.innerHTML=Xl),is=i(e),d(Q.$$.fragment,e),os=i(e),N=c(e,"P",{"data-svelte-h":!0}),M(N)!=="svelte-184g0sk"&&(N.innerHTML=Bl),ps=i(e),z=c(e,"OL",{"data-svelte-h":!0}),M(z)!=="svelte-300ub0"&&(z.innerHTML=Wl),cs=i(e),S=c(e,"P",{"data-svelte-h":!0}),M(S)!=="svelte-b8ra03"&&(S.innerHTML=kl),Ms=i(e),Y=c(e,"P",{"data-svelte-h":!0}),M(Y)!=="svelte-r21t0f"&&(Y.innerHTML=Gl),ms=i(e),d(H.$$.fragment,e),ds=i(e),x=c(e,"P",{"data-svelte-h":!0}),M(x)!=="svelte-1mv0gt9"&&(x.innerHTML=vl),Ts=i(e),L=c(e,"P",{"data-svelte-h":!0}),M(L)!=="svelte-1gve3jk"&&(L.innerHTML=Vl),hs=i(e),d(q.$$.fragment,e),ys=i(e),d(D.$$.fragment,e),fs=i(e),P=c(e,"P",{"data-svelte-h":!0}),M(P)!=="svelte-tm6xkx"&&(P.innerHTML=El),us=i(e),d(K.$$.fragment,e),ws=i(e),O=c(e,"P",{"data-svelte-h":!0}),M(O)!=="svelte-11w4nqy"&&(O.innerHTML=Fl),Js=i(e),ee=c(e,"UL",{"data-svelte-h":!0}),M(ee)!=="svelte-1f7sie2"&&(ee.innerHTML=Rl),js=i(e),se=c(e,"P",{"data-svelte-h":!0}),M(se)!=="svelte-18j1v70"&&(se.innerHTML=Ql),Us=i(e),d(le.$$.fragment,e),gs=i(e),te=c(e,"P",{"data-svelte-h":!0}),M(te)!=="svelte-ckc5k"&&(te.innerHTML=Nl),bs=i(e),ae=c(e,"UL",{"data-svelte-h":!0}),M(ae)!=="svelte-804uel"&&(ae.innerHTML=zl),_s=i(e),ne=c(e,"P",{"data-svelte-h":!0}),M(ne)!=="svelte-siwm61"&&(ne.innerHTML=Sl),Is=i(e),d(re.$$.fragment,e),Zs=i(e),d(ie.$$.fragment,e),As=i(e),oe=c(e,"P",{"data-svelte-h":!0}),M(oe)!=="svelte-77u1w7"&&(oe.innerHTML=Yl),$s=i(e),pe=c(e,"P",{"data-svelte-h":!0}),M(pe)!=="svelte-ckk1ok"&&(pe.textContent=Hl),Cs=i(e),d(ce.$$.fragment,e),Xs=i(e),Me=c(e,"P",{"data-svelte-h":!0}),M(Me)!=="svelte-qi8pjb"&&(Me.innerHTML=xl),Bs=i(e),d(me.$$.fragment,e),Ws=i(e),d(de.$$.fragment,e),ks=i(e),d(C.$$.fragment,e),Gs=i(e),Te=c(e,"P",{"data-svelte-h":!0}),M(Te)!=="svelte-bfmqmp"&&(Te.innerHTML=Ll),vs=i(e),he=c(e,"P",{"data-svelte-h":!0}),M(he)!=="svelte-3l1nfv"&&(he.innerHTML=ql),Vs=i(e),d(X.$$.fragment,e),Es=i(e),ye=c(e,"P",{"data-svelte-h":!0}),M(ye)!=="svelte-14qffqk"&&(ye.textContent=Dl),Fs=i(e),d(fe.$$.fragment,e),Rs=i(e),ue=c(e,"P",{"data-svelte-h":!0}),M(ue)!=="svelte-fy4z00"&&(ue.innerHTML=Pl),Qs=i(e),d(B.$$.fragment,e),Ns=i(e),d(we.$$.fragment,e),zs=i(e),Je=c(e,"P",{"data-svelte-h":!0}),M(Je)!=="svelte-8ujk0h"&&(Je.innerHTML=Kl),Ss=i(e),d(je.$$.fragment,e),Ys=i(e),Ue=c(e,"P",{"data-svelte-h":!0}),M(Ue)!=="svelte-1tyg2gl"&&(Ue.textContent=Ol),Hs=i(e),d(ge.$$.fragment,e),xs=i(e),be=c(e,"P",{"data-svelte-h":!0}),M(be)!=="svelte-qi406x"&&(be.textContent=et),Ls=i(e),_e=c(e,"P",{"data-svelte-h":!0}),M(_e)!=="svelte-6gjlmq"&&(_e.textContent=st),qs=i(e),d(Ie.$$.fragment,e),Ds=i(e),Ze=c(e,"P",{"data-svelte-h":!0}),M(Ze)!=="svelte-1g9eiy6"&&(Ze.innerHTML=lt),Ps=i(e),d(Ae.$$.fragment,e),Ks=i(e),$e=c(e,"P",{"data-svelte-h":!0}),M($e)!=="svelte-1rp4qeg"&&($e.innerHTML=tt),Os=i(e),d(Ce.$$.fragment,e),el=i(e),Xe=c(e,"P",{"data-svelte-h":!0}),M(Xe)!=="svelte-1ag0i93"&&(Xe.innerHTML=at),sl=i(e),Be=c(e,"P",{"data-svelte-h":!0}),M(Be)!=="svelte-14lab64"&&(Be.textContent=nt),ll=i(e),We=c(e,"P",{"data-svelte-h":!0}),M(We)!=="svelte-k79irj"&&(We.textContent=rt),tl=i(e),ke=c(e,"P",{"data-svelte-h":!0}),M(ke)!=="svelte-uvc2be"&&(ke.innerHTML=it),al=i(e),d(Ge.$$.fragment,e),nl=i(e),ve=c(e,"P",{"data-svelte-h":!0}),M(ve)!=="svelte-c2nuo5"&&(ve.innerHTML=ot),rl=i(e),d(Ve.$$.fragment,e),il=i(e),Ee=c(e,"P",{"data-svelte-h":!0}),M(Ee)!=="svelte-o771uk"&&(Ee.innerHTML=pt),ol=i(e),d(W.$$.fragment,e),pl=i(e),Fe=c(e,"P",{"data-svelte-h":!0}),M(Fe)!=="svelte-1ed4he8"&&(Fe.innerHTML=ct),cl=i(e),d(Re.$$.fragment,e),Ml=i(e),d(Qe.$$.fragment,e),ml=i(e),Ne=c(e,"P",{"data-svelte-h":!0}),M(Ne)!=="svelte-19cxj8v"&&(Ne.innerHTML=Mt),dl=i(e),d(k.$$.fragment,e),Tl=i(e),ze=c(e,"P",{"data-svelte-h":!0}),M(ze)!=="svelte-sjszbo"&&(ze.innerHTML=mt),hl=i(e),d(Se.$$.fragment,e),yl=i(e),Ye=c(e,"P",{"data-svelte-h":!0}),M(Ye)!=="svelte-pxxonu"&&(Ye.innerHTML=dt),fl=i(e),d(He.$$.fragment,e),ul=i(e),xe=c(e,"P",{"data-svelte-h":!0}),M(xe)!=="svelte-1var13v"&&(xe.innerHTML=Tt),wl=i(e),d(G.$$.fragment,e),Jl=i(e),Le=c(e,"P",{"data-svelte-h":!0}),M(Le)!=="svelte-1jtfzgh"&&(Le.innerHTML=ht),jl=i(e),d(v.$$.fragment,e),Ul=i(e),qe=c(e,"P",{"data-svelte-h":!0}),M(qe)!=="svelte-4ck014"&&(qe.innerHTML=yt),gl=i(e),De=c(e,"P",{"data-svelte-h":!0}),M(De)!=="svelte-cneufk"&&(De.innerHTML=ft),bl=i(e),d(Pe.$$.fragment,e),_l=i(e),Ke=c(e,"P",{"data-svelte-h":!0}),M(Ke)!=="svelte-13yow9q"&&(Ke.innerHTML=ut),Il=i(e),d(Oe.$$.fragment,e),Zl=i(e),es=c(e,"P",{"data-svelte-h":!0}),M(es)!=="svelte-zjyylh"&&(es.innerHTML=wt),Al=i(e),d(ss.$$.fragment,e),$l=i(e),ns=c(e,"P",{}),At(ns).forEach(l),this.h()},h(){$t(a,"name","hf:doc:metadata"),$t(a,"content",Ot)},m(e,s){vt(document.head,a),t(e,o,s),t(e,n,s),t(e,u,s),T(w,e,s),t(e,j,s),t(e,g,s),t(e,J,s),T(b,e,s),t(e,V,s),t(e,$,s),t(e,E,s),T(F,e,s),t(e,rs,s),t(e,R,s),t(e,is,s),T(Q,e,s),t(e,os,s),t(e,N,s),t(e,ps,s),t(e,z,s),t(e,cs,s),t(e,S,s),t(e,Ms,s),t(e,Y,s),t(e,ms,s),T(H,e,s),t(e,ds,s),t(e,x,s),t(e,Ts,s),t(e,L,s),t(e,hs,s),T(q,e,s),t(e,ys,s),T(D,e,s),t(e,fs,s),t(e,P,s),t(e,us,s),T(K,e,s),t(e,ws,s),t(e,O,s),t(e,Js,s),t(e,ee,s),t(e,js,s),t(e,se,s),t(e,Us,s),T(le,e,s),t(e,gs,s),t(e,te,s),t(e,bs,s),t(e,ae,s),t(e,_s,s),t(e,ne,s),t(e,Is,s),T(re,e,s),t(e,Zs,s),T(ie,e,s),t(e,As,s),t(e,oe,s),t(e,$s,s),t(e,pe,s),t(e,Cs,s),T(ce,e,s),t(e,Xs,s),t(e,Me,s),t(e,Bs,s),T(me,e,s),t(e,Ws,s),T(de,e,s),t(e,ks,s),T(C,e,s),t(e,Gs,s),t(e,Te,s),t(e,vs,s),t(e,he,s),t(e,Vs,s),T(X,e,s),t(e,Es,s),t(e,ye,s),t(e,Fs,s),T(fe,e,s),t(e,Rs,s),t(e,ue,s),t(e,Qs,s),T(B,e,s),t(e,Ns,s),T(we,e,s),t(e,zs,s),t(e,Je,s),t(e,Ss,s),T(je,e,s),t(e,Ys,s),t(e,Ue,s),t(e,Hs,s),T(ge,e,s),t(e,xs,s),t(e,be,s),t(e,Ls,s),t(e,_e,s),t(e,qs,s),T(Ie,e,s),t(e,Ds,s),t(e,Ze,s),t(e,Ps,s),T(Ae,e,s),t(e,Ks,s),t(e,$e,s),t(e,Os,s),T(Ce,e,s),t(e,el,s),t(e,Xe,s),t(e,sl,s),t(e,Be,s),t(e,ll,s),t(e,We,s),t(e,tl,s),t(e,ke,s),t(e,al,s),T(Ge,e,s),t(e,nl,s),t(e,ve,s),t(e,rl,s),T(Ve,e,s),t(e,il,s),t(e,Ee,s),t(e,ol,s),T(W,e,s),t(e,pl,s),t(e,Fe,s),t(e,cl,s),T(Re,e,s),t(e,Ml,s),T(Qe,e,s),t(e,ml,s),t(e,Ne,s),t(e,dl,s),T(k,e,s),t(e,Tl,s),t(e,ze,s),t(e,hl,s),T(Se,e,s),t(e,yl,s),t(e,Ye,s),t(e,fl,s),T(He,e,s),t(e,ul,s),t(e,xe,s),t(e,wl,s),T(G,e,s),t(e,Jl,s),t(e,Le,s),t(e,jl,s),T(v,e,s),t(e,Ul,s),t(e,qe,s),t(e,gl,s),t(e,De,s),t(e,bl,s),T(Pe,e,s),t(e,_l,s),t(e,Ke,s),t(e,Il,s),T(Oe,e,s),t(e,Zl,s),t(e,es,s),t(e,Al,s),T(ss,e,s),t(e,$l,s),t(e,ns,s),Cl=!0},p(e,[s]){const Jt={};s&2&&(Jt.$$scope={dirty:s,ctx:e}),b.$set(Jt);const jt={};s&2&&(jt.$$scope={dirty:s,ctx:e}),C.$set(jt);const Ut={};s&2&&(Ut.$$scope={dirty:s,ctx:e}),X.$set(Ut);const gt={};s&2&&(gt.$$scope={dirty:s,ctx:e}),B.$set(gt);const bt={};s&2&&(bt.$$scope={dirty:s,ctx:e}),W.$set(bt);const _t={};s&2&&(_t.$$scope={dirty:s,ctx:e}),k.$set(_t);const It={};s&2&&(It.$$scope={dirty:s,ctx:e}),G.$set(It);const Zt={};s&2&&(Zt.$$scope={dirty:s,ctx:e}),v.$set(Zt)},i(e){Cl||(h(w.$$.fragment,e),h(b.$$.fragment,e),h(F.$$.fragment,e),h(Q.$$.fragment,e),h(H.$$.fragment,e),h(q.$$.fragment,e),h(D.$$.fragment,e),h(K.$$.fragment,e),h(le.$$.fragment,e),h(re.$$.fragment,e),h(ie.$$.fragment,e),h(ce.$$.fragment,e),h(me.$$.fragment,e),h(de.$$.fragment,e),h(C.$$.fragment,e),h(X.$$.fragment,e),h(fe.$$.fragment,e),h(B.$$.fragment,e),h(we.$$.fragment,e),h(je.$$.fragment,e),h(ge.$$.fragment,e),h(Ie.$$.fragment,e),h(Ae.$$.fragment,e),h(Ce.$$.fragment,e),h(Ge.$$.fragment,e),h(Ve.$$.fragment,e),h(W.$$.fragment,e),h(Re.$$.fragment,e),h(Qe.$$.fragment,e),h(k.$$.fragment,e),h(Se.$$.fragment,e),h(He.$$.fragment,e),h(G.$$.fragment,e),h(v.$$.fragment,e),h(Pe.$$.fragment,e),h(Oe.$$.fragment,e),h(ss.$$.fragment,e),Cl=!0)},o(e){y(w.$$.fragment,e),y(b.$$.fragment,e),y(F.$$.fragment,e),y(Q.$$.fragment,e),y(H.$$.fragment,e),y(q.$$.fragment,e),y(D.$$.fragment,e),y(K.$$.fragment,e),y(le.$$.fragment,e),y(re.$$.fragment,e),y(ie.$$.fragment,e),y(ce.$$.fragment,e),y(me.$$.fragment,e),y(de.$$.fragment,e),y(C.$$.fragment,e),y(X.$$.fragment,e),y(fe.$$.fragment,e),y(B.$$.fragment,e),y(we.$$.fragment,e),y(je.$$.fragment,e),y(ge.$$.fragment,e),y(Ie.$$.fragment,e),y(Ae.$$.fragment,e),y(Ce.$$.fragment,e),y(Ge.$$.fragment,e),y(Ve.$$.fragment,e),y(W.$$.fragment,e),y(Re.$$.fragment,e),y(Qe.$$.fragment,e),y(k.$$.fragment,e),y(Se.$$.fragment,e),y(He.$$.fragment,e),y(G.$$.fragment,e),y(v.$$.fragment,e),y(Pe.$$.fragment,e),y(Oe.$$.fragment,e),y(ss.$$.fragment,e),Cl=!1},d(e){e&&(l(o),l(n),l(u),l(j),l(g),l(J),l(V),l($),l(E),l(rs),l(R),l(is),l(os),l(N),l(ps),l(z),l(cs),l(S),l(Ms),l(Y),l(ms),l(ds),l(x),l(Ts),l(L),l(hs),l(ys),l(fs),l(P),l(us),l(ws),l(O),l(Js),l(ee),l(js),l(se),l(Us),l(gs),l(te),l(bs),l(ae),l(_s),l(ne),l(Is),l(Zs),l(As),l(oe),l($s),l(pe),l(Cs),l(Xs),l(Me),l(Bs),l(Ws),l(ks),l(Gs),l(Te),l(vs),l(he),l(Vs),l(Es),l(ye),l(Fs),l(Rs),l(ue),l(Qs),l(Ns),l(zs),l(Je),l(Ss),l(Ys),l(Ue),l(Hs),l(xs),l(be),l(Ls),l(_e),l(qs),l(Ds),l(Ze),l(Ps),l(Ks),l($e),l(Os),l(el),l(Xe),l(sl),l(Be),l(ll),l(We),l(tl),l(ke),l(al),l(nl),l(ve),l(rl),l(il),l(Ee),l(ol),l(pl),l(Fe),l(cl),l(Ml),l(ml),l(Ne),l(dl),l(Tl),l(ze),l(hl),l(yl),l(Ye),l(fl),l(ul),l(xe),l(wl),l(Jl),l(Le),l(jl),l(Ul),l(qe),l(gl),l(De),l(bl),l(_l),l(Ke),l(Il),l(Zl),l(es),l(Al),l($l),l(ns)),l(a),f(w,e),f(b,e),f(F,e),f(Q,e),f(H,e),f(q,e),f(D,e),f(K,e),f(le,e),f(re,e),f(ie,e),f(ce,e),f(me,e),f(de,e),f(C,e),f(X,e),f(fe,e),f(B,e),f(we,e),f(je,e),f(ge,e),f(Ie,e),f(Ae,e),f(Ce,e),f(Ge,e),f(Ve,e),f(W,e),f(Re,e),f(Qe,e),f(k,e),f(Se,e),f(He,e),f(G,e),f(v,e),f(Pe,e),f(Oe,e),f(ss,e)}}}const Ot='{"title":"Trainer","local":"trainer","sections":[{"title":"Basic usage","local":"basic-usage","sections":[{"title":"Checkpoints","local":"checkpoints","sections":[],"depth":3}],"depth":2},{"title":"Customize the Trainer","local":"customize-the-trainer","sections":[{"title":"Callbacks","local":"callbacks","sections":[],"depth":3}],"depth":2},{"title":"Logging","local":"logging","sections":[],"depth":2},{"title":"NEFTune","local":"neftune","sections":[],"depth":2},{"title":"GaLore","local":"galore","sections":[],"depth":2},{"title":"LOMO optimizer","local":"lomo-optimizer","sections":[],"depth":2},{"title":"GrokAdamW optimizer","local":"grokadamw-optimizer","sections":[],"depth":2},{"title":"Accelerate and Trainer","local":"accelerate-and-trainer","sections":[],"depth":2}],"depth":1}';function ea(U){return Bt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ia extends Wt{constructor(a){super(),kt(this,a,ea,Kt,Xt,{})}}export{ia as component};
