import{s as _a,o as Ia,n as A}from"../chunks/scheduler.25b97de1.js";import{S as Za,i as Aa,g as p,s as r,r as m,A as $a,h as c,f as l,c as i,j as Ua,u as d,x as M,k as ga,y as Ca,a,v as T,d as h,t as f,w as u}from"../chunks/index.d9030fc9.js";import{T as as}from"../chunks/Tip.baa67368.js";import{C as I}from"../chunks/CodeBlock.e6cd0d95.js";import{H as Z,E as Xa}from"../chunks/EditOnGithub.91d95064.js";import{H as ba,a as es}from"../chunks/HfOption.1e589c90.js";function Ba(U){let t,o='In addition to the <a href="/docs/transformers/pr_30079/en/main_classes/trainer#transformers.Trainer">Trainer</a> class, Transformers also provides a <a href="/docs/transformers/pr_30079/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/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_30079/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/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,J,y,j,g='Feel free to check out the <a href="./main_classes/trainer">API reference</a> for these other <a href="/docs/transformers/pr_30079/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_30079/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_30079/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/trainer#trl.SFTTrainer" rel="nofollow">SFTTrainer</a> is designed for training language models.';return{c(){t=p("p"),t.innerHTML=o,n=r(),J=p("br"),y=r(),j=p("p"),j.innerHTML=g},l(_){t=c(_,"P",{"data-svelte-h":!0}),M(t)!=="svelte-aocm05"&&(t.innerHTML=o),n=i(_),J=c(_,"BR",{}),y=i(_),j=c(_,"P",{"data-svelte-h":!0}),M(j)!=="svelte-83gede"&&(j.innerHTML=g)},m(_,w){a(_,t,w),a(_,n,w),a(_,J,w),a(_,y,w),a(_,j,w)},p:A,d(_){_&&(l(t),l(n),l(J),l(y),l(j))}}}function Wa(U){let t,o='Check out the <a href="./main_classes/logging">logging</a> API reference for more information about the different logging levels.';return{c(){t=p("p"),t.innerHTML=o},l(n){t=c(n,"P",{"data-svelte-h":!0}),M(t)!=="svelte-6jeeaq"&&(t.innerHTML=o)},m(n,J){a(n,t,J)},p:A,d(n){n&&l(t)}}}function Va(U){let t,o='<a href="/docs/transformers/pr_30079/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_30079/en/main_classes/trainer#transformers.Trainer">Trainer</a> object.';return{c(){t=p("p"),t.innerHTML=o},l(n){t=c(n,"P",{"data-svelte-h":!0}),M(t)!=="svelte-100a32h"&&(t.innerHTML=o)},m(n,J){a(n,t,J)},p:A,d(n){n&&l(t)}}}function ka(U){let t,o;return t=new I({props:{code:"bXlfYXBwLnB5JTIwLi4uJTIwLS1sb2dfbGV2ZWwlMjB3YXJuaW5nJTIwLS1sb2dfbGV2ZWxfcmVwbGljYSUyMGVycm9y",highlighted:"my_app.py ... --log_level warning --log_level_replica error",wrap:!1}}),{c(){m(t.$$.fragment)},l(n){d(t.$$.fragment,n)},m(n,J){T(t,n,J),o=!0},p:A,i(n){o||(h(t.$$.fragment,n),o=!0)},o(n){f(t.$$.fragment,n),o=!1},d(n){u(t,n)}}}function Ea(U){let t,o="Add the <code>log_on_each_node 0</code> parameter for multi-node environments.",n,J,y;return J=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(){t=p("p"),t.innerHTML=o,n=r(),m(J.$$.fragment)},l(j){t=c(j,"P",{"data-svelte-h":!0}),M(t)!=="svelte-86ubk0"&&(t.innerHTML=o),n=i(j),d(J.$$.fragment,j)},m(j,g){a(j,t,g),a(j,n,g),T(J,j,g),y=!0},p:A,i(j){y||(h(J.$$.fragment,j),y=!0)},o(j){f(J.$$.fragment,j),y=!1},d(j){j&&(l(t),l(n)),u(J,j)}}}function Ga(U){let t,o,n,J;return t=new es({props:{id:"logging",option:"single node",$$slots:{default:[ka]},$$scope:{ctx:U}}}),n=new es({props:{id:"logging",option:"multi-node",$$slots:{default:[Ea]},$$scope:{ctx:U}}}),{c(){m(t.$$.fragment),o=r(),m(n.$$.fragment)},l(y){d(t.$$.fragment,y),o=i(y),d(n.$$.fragment,y)},m(y,j){T(t,y,j),a(y,o,j),T(n,y,j),J=!0},p(y,j){const g={};j&2&&(g.$$scope={dirty:j,ctx:y}),t.$set(g);const _={};j&2&&(_.$$scope={dirty:j,ctx:y}),n.$set(_)},i(y){J||(h(t.$$.fragment,y),h(n.$$.fragment,y),J=!0)},o(y){f(t.$$.fragment,y),f(n.$$.fragment,y),J=!1},d(y){y&&l(o),u(t,y),u(n,y)}}}function va(U){let t,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(){t=p("p"),t.innerHTML=o},l(n){t=c(n,"P",{"data-svelte-h":!0}),M(t)!=="svelte-q6vma3"&&(t.innerHTML=o)},m(n,J){a(n,t,J)},p:A,d(n){n&&l(t)}}}function Fa(U){let t,o='Learn more about FSDP sharding strategies, CPU offloading, and more with the <a href="/docs/transformers/pr_30079/en/main_classes/trainer#transformers.Trainer">Trainer</a> in the <a href="fsdp">Fully Sharded Data Parallel</a> guide.';return{c(){t=p("p"),t.innerHTML=o},l(n){t=c(n,"P",{"data-svelte-h":!0}),M(t)!=="svelte-11glf75"&&(t.innerHTML=o)},m(n,J){a(n,t,J)},p:A,d(n){n&&l(t)}}}function Ra(U){let t,o;return t=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(t.$$.fragment)},l(n){d(t.$$.fragment,n)},m(n,J){T(t,n,J),o=!0},p:A,i(n){o||(h(t.$$.fragment,n),o=!0)},o(n){f(t.$$.fragment,n),o=!1},d(n){u(t,n)}}}function Qa(U){let t,o;return t=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(t.$$.fragment)},l(n){d(t.$$.fragment,n)},m(n,J){T(t,n,J),o=!0},p:A,i(n){o||(h(t.$$.fragment,n),o=!0)},o(n){f(t.$$.fragment,n),o=!1},d(n){u(t,n)}}}function Na(U){let t,o;return t=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(t.$$.fragment)},l(n){d(t.$$.fragment,n)},m(n,J){T(t,n,J),o=!0},p:A,i(n){o||(h(t.$$.fragment,n),o=!0)},o(n){f(t.$$.fragment,n),o=!1},d(n){u(t,n)}}}function Sa(U){let t,o;return t=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(t.$$.fragment)},l(n){d(t.$$.fragment,n)},m(n,J){T(t,n,J),o=!0},p:A,i(n){o||(h(t.$$.fragment,n),o=!0)},o(n){f(t.$$.fragment,n),o=!1},d(n){u(t,n)}}}function za(U){let t,o,n,J,y,j,g,_;return t=new es({props:{id:"config",option:"DistributedDataParallel",$$slots:{default:[Ra]},$$scope:{ctx:U}}}),n=new es({props:{id:"config",option:"FSDP",$$slots:{default:[Qa]},$$scope:{ctx:U}}}),y=new es({props:{id:"config",option:"DeepSpeed",$$slots:{default:[Na]},$$scope:{ctx:U}}}),g=new es({props:{id:"config",option:"DeepSpeed with Accelerate plugin",$$slots:{default:[Sa]},$$scope:{ctx:U}}}),{c(){m(t.$$.fragment),o=r(),m(n.$$.fragment),J=r(),m(y.$$.fragment),j=r(),m(g.$$.fragment)},l(w){d(t.$$.fragment,w),o=i(w),d(n.$$.fragment,w),J=i(w),d(y.$$.fragment,w),j=i(w),d(g.$$.fragment,w)},m(w,b){T(t,w,b),a(w,o,b),T(n,w,b),a(w,J,b),T(y,w,b),a(w,j,b),T(g,w,b),_=!0},p(w,b){const E={};b&2&&(E.$$scope={dirty:b,ctx:w}),t.$set(E);const $={};b&2&&($.$$scope={dirty:b,ctx:w}),n.$set($);const ss={};b&2&&(ss.$$scope={dirty:b,ctx:w}),y.$set(ss);const G={};b&2&&(G.$$scope={dirty:b,ctx:w}),g.$set(G)},i(w){_||(h(t.$$.fragment,w),h(n.$$.fragment,w),h(y.$$.fragment,w),h(g.$$.fragment,w),_=!0)},o(w){f(t.$$.fragment,w),f(n.$$.fragment,w),f(y.$$.fragment,w),f(g.$$.fragment,w),_=!1},d(w){w&&(l(o),l(J),l(j)),u(t,w),u(n,w),u(y,w),u(g,w)}}}function Ya(U){let t,o,n,J,y,j,g,_='The <a href="/docs/transformers/pr_30079/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_30079/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_30079/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.',w,b,E,$,ss='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.',G,v,ts,F,Zl='This guide provides an overview of the <a href="/docs/transformers/pr_30079/en/main_classes/trainer#transformers.Trainer">Trainer</a> class.',ns,R,rs,Q,Al='<a href="/docs/transformers/pr_30079/en/main_classes/trainer#transformers.Trainer">Trainer</a> includes all the code you’ll find in a basic training loop:',is,N,$l='<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>',os,S,Cl='The <a href="/docs/transformers/pr_30079/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_30079/en/main_classes/trainer#transformers.Trainer">Trainer</a> class handles everything else.',ps,z,Xl='If you want to specify any training options or hyperparameters, you can find them in the <a href="/docs/transformers/pr_30079/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>.',cs,Y,Ms,H,Bl='Pass <code>training_args</code> to the <a href="/docs/transformers/pr_30079/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.',ms,x,Wl='Finally, call <a href="/docs/transformers/pr_30079/en/main_classes/trainer#transformers.Trainer.train">train()</a> to start training!',ds,L,Ts,q,hs,D,Vl='The <a href="/docs/transformers/pr_30079/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_30079/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.',fs,P,us,K,kl='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_30079/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:',ys,O,El="<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>",ws,ee,Gl='When you resume training from a checkpoint, the <a href="/docs/transformers/pr_30079/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.',Js,se,js,le,vl='While the <a href="/docs/transformers/pr_30079/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_30079/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:',Us,ae,Fl='<li><a href="/docs/transformers/pr_30079/en/main_classes/trainer#transformers.Trainer.get_train_dataloader">get_train_dataloader()</a> creates a training DataLoader</li> <li><a href="/docs/transformers/pr_30079/en/main_classes/trainer#transformers.Trainer.get_eval_dataloader">get_eval_dataloader()</a> creates an evaluation DataLoader</li> <li><a href="/docs/transformers/pr_30079/en/main_classes/trainer#transformers.Trainer.get_test_dataloader">get_test_dataloader()</a> creates a test DataLoader</li> <li><a href="/docs/transformers/pr_30079/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_30079/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_30079/en/main_classes/trainer#transformers.Trainer.create_optimizer">create_optimizer()</a> and <a href="/docs/transformers/pr_30079/en/main_classes/trainer#transformers.Trainer.create_scheduler">create_scheduler()</a> respectively</li> <li><a href="/docs/transformers/pr_30079/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_30079/en/main_classes/trainer#transformers.Trainer.training_step">training_step()</a> performs the training step</li> <li><a href="/docs/transformers/pr_30079/en/main_classes/trainer#transformers.Trainer.prediction_step">prediction_step()</a> performs the prediction and test step</li> <li><a href="/docs/transformers/pr_30079/en/main_classes/trainer#transformers.Trainer.evaluate">evaluate()</a> evaluates the model and returns the evaluation metrics</li> <li><a href="/docs/transformers/pr_30079/en/main_classes/trainer#transformers.Trainer.predict">predict()</a> makes predictions (with metrics if labels are available) on the test set</li>',gs,te,Rl='For example, if you want to customize the <a href="/docs/transformers/pr_30079/en/main_classes/trainer#transformers.Trainer.compute_loss">compute_loss()</a> method to use a weighted loss instead.',bs,ne,_s,re,Is,ie,Ql='Another option for customizing the <a href="/docs/transformers/pr_30079/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_30079/en/main_classes/trainer#transformers.Trainer.compute_loss">compute_loss()</a> method for that.',Zs,oe,Nl="For example, if you want to add an early stopping callback to the training loop after 10 steps.",As,pe,$s,ce,Sl='Then pass it to the <a href="/docs/transformers/pr_30079/en/main_classes/trainer#transformers.Trainer">Trainer</a>’s <code>callback</code> parameter.',Cs,Me,Xs,me,Bs,C,Ws,de,zl='The <a href="/docs/transformers/pr_30079/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_30079/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_30079/en/main_classes/trainer#transformers.TrainingArguments">TrainingArguments</a>.',Vs,Te,Yl='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.',ks,X,Es,he,Hl="For example, to set your main code and modules to use the same log level according to each node:",Gs,fe,vs,ue,xl="Use different combinations of <code>log_level</code> and <code>log_level_replica</code> to configure what gets logged on each of the nodes.",Fs,B,Rs,ye,Qs,we,Ll='<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_30079/en/main_classes/trainer#transformers.Trainer">Trainer</a>, set the <code>neftune_noise_alpha</code> parameter in <a href="/docs/transformers/pr_30079/en/main_classes/trainer#transformers.TrainingArguments">TrainingArguments</a> to control how much noise is added.',Ns,Je,Ss,je,ql="NEFTune is disabled after training to restore the original embedding layer to avoid any unexpected behavior.",zs,Ue,Ys,ge,Dl="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.",Hs,be,Pl="First make sure to install GaLore official repository:",xs,_e,Ls,Ie,Kl="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>):",qs,Ze,Ds,Ae,Ol="To pass extra arguments supports by GaLore, you should pass correctly <code>optim_args</code>, for example:",Ps,$e,Ks,Ce,ea='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>.',Os,Xe,sa="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.",el,Be,la="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.",sl,We,aa="You can also perform layer-wise optimization by post-pending the optimizer name with <code>layerwise</code> like below:",ll,Ve,al,ke,ta='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.',tl,Ee,nl,Ge,na=`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>.`,rl,W,il,ve,ra='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:',ol,Fe,pl,Re,cl,Qe,ia=`The Schedule Free optimizers have been introduced in <a href="https://hf.co/papers/2405.15682" rel="nofollow">The Road Less Scheduled</a>.
Schedule-Free learning replaces the momentum of the base optimizer with a combination of averaging and interpolation, to completely remove the need to anneal the learning rate with a traditional schedule.
Supported optimizers for SFO are <code>&quot;schedule_free_adamw&quot;</code> and <code>&quot;schedule_free_sgd&quot;</code>. First install schedulefree from pypi <code>pip install schedulefree</code>.`,Ml,Ne,oa='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:',ml,Se,dl,ze,Tl,Ye,pa='The <a href="/docs/transformers/pr_30079/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>.',hl,V,fl,He,ca='To use Accelerate with <a href="/docs/transformers/pr_30079/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:',ul,k,yl,xe,Ma='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_30079/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>.',wl,Le,ma='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:',Jl,qe,jl,De,da="You could also specify the parameters from the <code>config_file.yaml</code> file directly in the command line:",Ul,Pe,gl,Ke,Ta='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.',bl,Oe,_l,ls,Il;return y=new Z({props:{title:"Trainer",local:"trainer",headingTag:"h1"}}),b=new as({props:{$$slots:{default:[Ba]},$$scope:{ctx:U}}}),v=new I({props:{code:"cGlwJTIwaW5zdGFsbCUyMGFjY2VsZXJhdGUlMEElMEElMjMlMjB1cGdyYWRlJTBBcGlwJTIwaW5zdGFsbCUyMGFjY2VsZXJhdGUlMjAtLXVwZ3JhZGU=",highlighted:`pip install accelerate

<span class="hljs-comment"># upgrade</span>
pip install accelerate --upgrade`,wrap:!1}}),R=new Z({props:{title:"Basic usage",local:"basic-usage",headingTag:"h2"}}),Y=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}}),L=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}}),q=new Z({props:{title:"Checkpoints",local:"checkpoints",headingTag:"h3"}}),P=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}}),se=new Z({props:{title:"Customize the Trainer",local:"customize-the-trainer",headingTag:"h2"}}),ne=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}}),re=new Z({props:{title:"Callbacks",local:"callbacks",headingTag:"h3"}}),pe=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}}),me=new Z({props:{title:"Logging",local:"logging",headingTag:"h2"}}),C=new as({props:{$$slots:{default:[Wa]},$$scope:{ctx:U}}}),X=new as({props:{$$slots:{default:[Va]},$$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 ba({props:{id:"logging",options:["single node","multi-node"],$$slots:{default:[Ga]},$$scope:{ctx:U}}}),ye=new Z({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}}),Ue=new Z({props:{title:"GaLore",local:"galore",headingTag:"h2"}}),_e=new I({props:{code:"cGlwJTIwaW5zdGFsbCUyMGdhbG9yZS10b3JjaA==",highlighted:"pip install galore-torch",wrap:!1}}),Ze=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}}),$e=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}}),Ve=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}}),Ee=new Z({props:{title:"LOMO optimizer",local:"lomo-optimizer",headingTag:"h2"}}),W=new as({props:{$$slots:{default:[va]},$$scope:{ctx:U}}}),Fe=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}}),Re=new Z({props:{title:"Schedule Free Optimizer",local:"schedule-free-optimizer",headingTag:"h2"}}),Se=new I({props:{code:"aW1wb3J0JTIwdG9yY2glMEFpbXBvcnQlMjBkYXRhc2V0cyUwQWZyb20lMjB0cmFuc2Zvcm1lcnMlMjBpbXBvcnQlMjBUcmFpbmluZ0FyZ3VtZW50cyUyQyUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBBdXRvTW9kZWxGb3JDYXVzYWxMTSUwQWltcG9ydCUyMHRybCUwQSUwQXRyYWluX2RhdGFzZXQlMjAlM0QlMjBkYXRhc2V0cy5sb2FkX2RhdGFzZXQoJ2ltZGInJTJDJTIwc3BsaXQlM0QndHJhaW4nKSUwQSUwQWFyZ3MlMjAlM0QlMjBUcmFpbmluZ0FyZ3VtZW50cyglMEElMjAlMjAlMjAlMjBvdXRwdXRfZGlyJTNEJTIyLiUyRnRlc3Qtc2NoZWR1bGVmcmVlJTIyJTJDJTBBJTIwJTIwJTIwJTIwbWF4X3N0ZXBzJTNEMTAwMCUyQyUwQSUyMCUyMCUyMCUyMHBlcl9kZXZpY2VfdHJhaW5fYmF0Y2hfc2l6ZSUzRDQlMkMlMEElMjAlMjAlMjAlMjBvcHRpbSUzRCUyMnNjaGVkdWxlX2ZyZWVfYWRhbXclMjIlMkMlMEElMjAlMjAlMjAlMjBncmFkaWVudF9jaGVja3BvaW50aW5nJTNEVHJ1ZSUyQyUwQSUyMCUyMCUyMCUyMGxvZ2dpbmdfc3RyYXRlZ3klM0QlMjJzdGVwcyUyMiUyQyUwQSUyMCUyMCUyMCUyMGxvZ2dpbmdfc3RlcHMlM0QxJTJDJTBBJTIwJTIwJTIwJTIwbGVhcm5pbmdfcmF0ZSUzRDJlLTYlMkMlMEElMjAlMjAlMjAlMjBzYXZlX3N0cmF0ZWd5JTNEJTIybm8lMjIlMkMlMEElMjAlMjAlMjAlMjBydW5fbmFtZSUzRCUyMnNmby1pbWRiJTIyJTJDJTBBKSUwQSUwQW1vZGVsX2lkJTIwJTNEJTIwJTIyZ29vZ2xlJTJGZ2VtbWEtMmIlMjIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZChtb2RlbF9pZCklMEFtb2RlbCUyMCUzRCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNLmZyb21fcHJldHJhaW5lZChtb2RlbF9pZCUyQyUyMGxvd19jcHVfbWVtX3VzYWdlJTNEVHJ1ZSkudG8oMCklMEElMEF0cmFpbmVyJTIwJTNEJTIwdHJsLlNGVFRyYWluZXIoJTBBJTIwJTIwJTIwJTIwbW9kZWwlM0Rtb2RlbCUyQyUyMCUwQSUyMCUyMCUyMCUyMGFyZ3MlM0RhcmdzJTJDJTBBJTIwJTIwJTIwJTIwdHJhaW5fZGF0YXNldCUzRHRyYWluX2RhdGFzZXQlMkMlMEElMjAlMjAlMjAlMjBkYXRhc2V0X3RleHRfZmllbGQlM0QndGV4dCclMkMlMEElMjAlMjAlMjAlMjBtYXhfc2VxX2xlbmd0aCUzRDEwMjQlMkMlMEEpJTBBJTBBdHJhaW5lci50cmFpbigp",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-schedulefree&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;schedule_free_adamw&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;sfo-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}}),ze=new Z({props:{title:"Accelerate and Trainer",local:"accelerate-and-trainer",headingTag:"h2"}}),V=new as({props:{$$slots:{default:[Fa]},$$scope:{ctx:U}}}),k=new ba({props:{id:"config",options:["DistributedDataParallel","FSDP","DeepSpeed","DeepSpeed with Accelerate plugin"],$$slots:{default:[za]},$$scope:{ctx:U}}}),qe=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}}),Pe=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}}),Oe=new Xa({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/trainer.md"}}),{c(){t=p("meta"),o=r(),n=p("p"),J=r(),m(y.$$.fragment),j=r(),g=p("p"),g.innerHTML=_,w=r(),m(b.$$.fragment),E=r(),$=p("p"),$.innerHTML=ss,G=r(),m(v.$$.fragment),ts=r(),F=p("p"),F.innerHTML=Zl,ns=r(),m(R.$$.fragment),rs=r(),Q=p("p"),Q.innerHTML=Al,is=r(),N=p("ol"),N.innerHTML=$l,os=r(),S=p("p"),S.innerHTML=Cl,ps=r(),z=p("p"),z.innerHTML=Xl,cs=r(),m(Y.$$.fragment),Ms=r(),H=p("p"),H.innerHTML=Bl,ms=r(),x=p("p"),x.innerHTML=Wl,ds=r(),m(L.$$.fragment),Ts=r(),m(q.$$.fragment),hs=r(),D=p("p"),D.innerHTML=Vl,fs=r(),m(P.$$.fragment),us=r(),K=p("p"),K.innerHTML=kl,ys=r(),O=p("ul"),O.innerHTML=El,ws=r(),ee=p("p"),ee.innerHTML=Gl,Js=r(),m(se.$$.fragment),js=r(),le=p("p"),le.innerHTML=vl,Us=r(),ae=p("ul"),ae.innerHTML=Fl,gs=r(),te=p("p"),te.innerHTML=Rl,bs=r(),m(ne.$$.fragment),_s=r(),m(re.$$.fragment),Is=r(),ie=p("p"),ie.innerHTML=Ql,Zs=r(),oe=p("p"),oe.textContent=Nl,As=r(),m(pe.$$.fragment),$s=r(),ce=p("p"),ce.innerHTML=Sl,Cs=r(),m(Me.$$.fragment),Xs=r(),m(me.$$.fragment),Bs=r(),m(C.$$.fragment),Ws=r(),de=p("p"),de.innerHTML=zl,Vs=r(),Te=p("p"),Te.innerHTML=Yl,ks=r(),m(X.$$.fragment),Es=r(),he=p("p"),he.textContent=Hl,Gs=r(),m(fe.$$.fragment),vs=r(),ue=p("p"),ue.innerHTML=xl,Fs=r(),m(B.$$.fragment),Rs=r(),m(ye.$$.fragment),Qs=r(),we=p("p"),we.innerHTML=Ll,Ns=r(),m(Je.$$.fragment),Ss=r(),je=p("p"),je.textContent=ql,zs=r(),m(Ue.$$.fragment),Ys=r(),ge=p("p"),ge.textContent=Dl,Hs=r(),be=p("p"),be.textContent=Pl,xs=r(),m(_e.$$.fragment),Ls=r(),Ie=p("p"),Ie.innerHTML=Kl,qs=r(),m(Ze.$$.fragment),Ds=r(),Ae=p("p"),Ae.innerHTML=Ol,Ps=r(),m($e.$$.fragment),Ks=r(),Ce=p("p"),Ce.innerHTML=ea,Os=r(),Xe=p("p"),Xe.textContent=sa,el=r(),Be=p("p"),Be.textContent=la,sl=r(),We=p("p"),We.innerHTML=aa,ll=r(),m(Ve.$$.fragment),al=r(),ke=p("p"),ke.innerHTML=ta,tl=r(),m(Ee.$$.fragment),nl=r(),Ge=p("p"),Ge.innerHTML=na,rl=r(),m(W.$$.fragment),il=r(),ve=p("p"),ve.innerHTML=ra,ol=r(),m(Fe.$$.fragment),pl=r(),m(Re.$$.fragment),cl=r(),Qe=p("p"),Qe.innerHTML=ia,Ml=r(),Ne=p("p"),Ne.innerHTML=oa,ml=r(),m(Se.$$.fragment),dl=r(),m(ze.$$.fragment),Tl=r(),Ye=p("p"),Ye.innerHTML=pa,hl=r(),m(V.$$.fragment),fl=r(),He=p("p"),He.innerHTML=ca,ul=r(),m(k.$$.fragment),yl=r(),xe=p("p"),xe.innerHTML=Ma,wl=r(),Le=p("p"),Le.innerHTML=ma,Jl=r(),m(qe.$$.fragment),jl=r(),De=p("p"),De.innerHTML=da,Ul=r(),m(Pe.$$.fragment),gl=r(),Ke=p("p"),Ke.innerHTML=Ta,bl=r(),m(Oe.$$.fragment),_l=r(),ls=p("p"),this.h()},l(e){const s=$a("svelte-u9bgzb",document.head);t=c(s,"META",{name:!0,content:!0}),s.forEach(l),o=i(e),n=c(e,"P",{}),Ua(n).forEach(l),J=i(e),d(y.$$.fragment,e),j=i(e),g=c(e,"P",{"data-svelte-h":!0}),M(g)!=="svelte-2ndfip"&&(g.innerHTML=_),w=i(e),d(b.$$.fragment,e),E=i(e),$=c(e,"P",{"data-svelte-h":!0}),M($)!=="svelte-17cwfvo"&&($.innerHTML=ss),G=i(e),d(v.$$.fragment,e),ts=i(e),F=c(e,"P",{"data-svelte-h":!0}),M(F)!=="svelte-1fzgj89"&&(F.innerHTML=Zl),ns=i(e),d(R.$$.fragment,e),rs=i(e),Q=c(e,"P",{"data-svelte-h":!0}),M(Q)!=="svelte-rxja8"&&(Q.innerHTML=Al),is=i(e),N=c(e,"OL",{"data-svelte-h":!0}),M(N)!=="svelte-300ub0"&&(N.innerHTML=$l),os=i(e),S=c(e,"P",{"data-svelte-h":!0}),M(S)!=="svelte-7h4f9f"&&(S.innerHTML=Cl),ps=i(e),z=c(e,"P",{"data-svelte-h":!0}),M(z)!=="svelte-g7n76f"&&(z.innerHTML=Xl),cs=i(e),d(Y.$$.fragment,e),Ms=i(e),H=c(e,"P",{"data-svelte-h":!0}),M(H)!=="svelte-h5hs4l"&&(H.innerHTML=Bl),ms=i(e),x=c(e,"P",{"data-svelte-h":!0}),M(x)!=="svelte-e388vs"&&(x.innerHTML=Wl),ds=i(e),d(L.$$.fragment,e),Ts=i(e),d(q.$$.fragment,e),hs=i(e),D=c(e,"P",{"data-svelte-h":!0}),M(D)!=="svelte-1kngw6l"&&(D.innerHTML=Vl),fs=i(e),d(P.$$.fragment,e),us=i(e),K=c(e,"P",{"data-svelte-h":!0}),M(K)!=="svelte-5j90fu"&&(K.innerHTML=kl),ys=i(e),O=c(e,"UL",{"data-svelte-h":!0}),M(O)!=="svelte-1f7sie2"&&(O.innerHTML=El),ws=i(e),ee=c(e,"P",{"data-svelte-h":!0}),M(ee)!=="svelte-1b9b3gk"&&(ee.innerHTML=Gl),Js=i(e),d(se.$$.fragment,e),js=i(e),le=c(e,"P",{"data-svelte-h":!0}),M(le)!=="svelte-j77js0"&&(le.innerHTML=vl),Us=i(e),ae=c(e,"UL",{"data-svelte-h":!0}),M(ae)!=="svelte-1jl1i79"&&(ae.innerHTML=Fl),gs=i(e),te=c(e,"P",{"data-svelte-h":!0}),M(te)!=="svelte-sg6mex"&&(te.innerHTML=Rl),bs=i(e),d(ne.$$.fragment,e),_s=i(e),d(re.$$.fragment,e),Is=i(e),ie=c(e,"P",{"data-svelte-h":!0}),M(ie)!=="svelte-11o4s0v"&&(ie.innerHTML=Ql),Zs=i(e),oe=c(e,"P",{"data-svelte-h":!0}),M(oe)!=="svelte-ckk1ok"&&(oe.textContent=Nl),As=i(e),d(pe.$$.fragment,e),$s=i(e),ce=c(e,"P",{"data-svelte-h":!0}),M(ce)!=="svelte-1eujr8n"&&(ce.innerHTML=Sl),Cs=i(e),d(Me.$$.fragment,e),Xs=i(e),d(me.$$.fragment,e),Bs=i(e),d(C.$$.fragment,e),Ws=i(e),de=c(e,"P",{"data-svelte-h":!0}),M(de)!=="svelte-1l2fk11"&&(de.innerHTML=zl),Vs=i(e),Te=c(e,"P",{"data-svelte-h":!0}),M(Te)!=="svelte-3l1nfv"&&(Te.innerHTML=Yl),ks=i(e),d(X.$$.fragment,e),Es=i(e),he=c(e,"P",{"data-svelte-h":!0}),M(he)!=="svelte-14qffqk"&&(he.textContent=Hl),Gs=i(e),d(fe.$$.fragment,e),vs=i(e),ue=c(e,"P",{"data-svelte-h":!0}),M(ue)!=="svelte-fy4z00"&&(ue.innerHTML=xl),Fs=i(e),d(B.$$.fragment,e),Rs=i(e),d(ye.$$.fragment,e),Qs=i(e),we=c(e,"P",{"data-svelte-h":!0}),M(we)!=="svelte-ie6k1"&&(we.innerHTML=Ll),Ns=i(e),d(Je.$$.fragment,e),Ss=i(e),je=c(e,"P",{"data-svelte-h":!0}),M(je)!=="svelte-1tyg2gl"&&(je.textContent=ql),zs=i(e),d(Ue.$$.fragment,e),Ys=i(e),ge=c(e,"P",{"data-svelte-h":!0}),M(ge)!=="svelte-qi406x"&&(ge.textContent=Dl),Hs=i(e),be=c(e,"P",{"data-svelte-h":!0}),M(be)!=="svelte-6gjlmq"&&(be.textContent=Pl),xs=i(e),d(_e.$$.fragment,e),Ls=i(e),Ie=c(e,"P",{"data-svelte-h":!0}),M(Ie)!=="svelte-1g9eiy6"&&(Ie.innerHTML=Kl),qs=i(e),d(Ze.$$.fragment,e),Ds=i(e),Ae=c(e,"P",{"data-svelte-h":!0}),M(Ae)!=="svelte-1rp4qeg"&&(Ae.innerHTML=Ol),Ps=i(e),d($e.$$.fragment,e),Ks=i(e),Ce=c(e,"P",{"data-svelte-h":!0}),M(Ce)!=="svelte-1ag0i93"&&(Ce.innerHTML=ea),Os=i(e),Xe=c(e,"P",{"data-svelte-h":!0}),M(Xe)!=="svelte-14lab64"&&(Xe.textContent=sa),el=i(e),Be=c(e,"P",{"data-svelte-h":!0}),M(Be)!=="svelte-k79irj"&&(Be.textContent=la),sl=i(e),We=c(e,"P",{"data-svelte-h":!0}),M(We)!=="svelte-uvc2be"&&(We.innerHTML=aa),ll=i(e),d(Ve.$$.fragment,e),al=i(e),ke=c(e,"P",{"data-svelte-h":!0}),M(ke)!=="svelte-c2nuo5"&&(ke.innerHTML=ta),tl=i(e),d(Ee.$$.fragment,e),nl=i(e),Ge=c(e,"P",{"data-svelte-h":!0}),M(Ge)!=="svelte-o771uk"&&(Ge.innerHTML=na),rl=i(e),d(W.$$.fragment,e),il=i(e),ve=c(e,"P",{"data-svelte-h":!0}),M(ve)!=="svelte-1ed4he8"&&(ve.innerHTML=ra),ol=i(e),d(Fe.$$.fragment,e),pl=i(e),d(Re.$$.fragment,e),cl=i(e),Qe=c(e,"P",{"data-svelte-h":!0}),M(Qe)!=="svelte-w5uo13"&&(Qe.innerHTML=ia),Ml=i(e),Ne=c(e,"P",{"data-svelte-h":!0}),M(Ne)!=="svelte-1ed4he8"&&(Ne.innerHTML=oa),ml=i(e),d(Se.$$.fragment,e),dl=i(e),d(ze.$$.fragment,e),Tl=i(e),Ye=c(e,"P",{"data-svelte-h":!0}),M(Ye)!=="svelte-1twd9tr"&&(Ye.innerHTML=pa),hl=i(e),d(V.$$.fragment,e),fl=i(e),He=c(e,"P",{"data-svelte-h":!0}),M(He)!=="svelte-12gdxqp"&&(He.innerHTML=ca),ul=i(e),d(k.$$.fragment,e),yl=i(e),xe=c(e,"P",{"data-svelte-h":!0}),M(xe)!=="svelte-1xfag24"&&(xe.innerHTML=Ma),wl=i(e),Le=c(e,"P",{"data-svelte-h":!0}),M(Le)!=="svelte-cneufk"&&(Le.innerHTML=ma),Jl=i(e),d(qe.$$.fragment,e),jl=i(e),De=c(e,"P",{"data-svelte-h":!0}),M(De)!=="svelte-13yow9q"&&(De.innerHTML=da),Ul=i(e),d(Pe.$$.fragment,e),gl=i(e),Ke=c(e,"P",{"data-svelte-h":!0}),M(Ke)!=="svelte-zjyylh"&&(Ke.innerHTML=Ta),bl=i(e),d(Oe.$$.fragment,e),_l=i(e),ls=c(e,"P",{}),Ua(ls).forEach(l),this.h()},h(){ga(t,"name","hf:doc:metadata"),ga(t,"content",Ha)},m(e,s){Ca(document.head,t),a(e,o,s),a(e,n,s),a(e,J,s),T(y,e,s),a(e,j,s),a(e,g,s),a(e,w,s),T(b,e,s),a(e,E,s),a(e,$,s),a(e,G,s),T(v,e,s),a(e,ts,s),a(e,F,s),a(e,ns,s),T(R,e,s),a(e,rs,s),a(e,Q,s),a(e,is,s),a(e,N,s),a(e,os,s),a(e,S,s),a(e,ps,s),a(e,z,s),a(e,cs,s),T(Y,e,s),a(e,Ms,s),a(e,H,s),a(e,ms,s),a(e,x,s),a(e,ds,s),T(L,e,s),a(e,Ts,s),T(q,e,s),a(e,hs,s),a(e,D,s),a(e,fs,s),T(P,e,s),a(e,us,s),a(e,K,s),a(e,ys,s),a(e,O,s),a(e,ws,s),a(e,ee,s),a(e,Js,s),T(se,e,s),a(e,js,s),a(e,le,s),a(e,Us,s),a(e,ae,s),a(e,gs,s),a(e,te,s),a(e,bs,s),T(ne,e,s),a(e,_s,s),T(re,e,s),a(e,Is,s),a(e,ie,s),a(e,Zs,s),a(e,oe,s),a(e,As,s),T(pe,e,s),a(e,$s,s),a(e,ce,s),a(e,Cs,s),T(Me,e,s),a(e,Xs,s),T(me,e,s),a(e,Bs,s),T(C,e,s),a(e,Ws,s),a(e,de,s),a(e,Vs,s),a(e,Te,s),a(e,ks,s),T(X,e,s),a(e,Es,s),a(e,he,s),a(e,Gs,s),T(fe,e,s),a(e,vs,s),a(e,ue,s),a(e,Fs,s),T(B,e,s),a(e,Rs,s),T(ye,e,s),a(e,Qs,s),a(e,we,s),a(e,Ns,s),T(Je,e,s),a(e,Ss,s),a(e,je,s),a(e,zs,s),T(Ue,e,s),a(e,Ys,s),a(e,ge,s),a(e,Hs,s),a(e,be,s),a(e,xs,s),T(_e,e,s),a(e,Ls,s),a(e,Ie,s),a(e,qs,s),T(Ze,e,s),a(e,Ds,s),a(e,Ae,s),a(e,Ps,s),T($e,e,s),a(e,Ks,s),a(e,Ce,s),a(e,Os,s),a(e,Xe,s),a(e,el,s),a(e,Be,s),a(e,sl,s),a(e,We,s),a(e,ll,s),T(Ve,e,s),a(e,al,s),a(e,ke,s),a(e,tl,s),T(Ee,e,s),a(e,nl,s),a(e,Ge,s),a(e,rl,s),T(W,e,s),a(e,il,s),a(e,ve,s),a(e,ol,s),T(Fe,e,s),a(e,pl,s),T(Re,e,s),a(e,cl,s),a(e,Qe,s),a(e,Ml,s),a(e,Ne,s),a(e,ml,s),T(Se,e,s),a(e,dl,s),T(ze,e,s),a(e,Tl,s),a(e,Ye,s),a(e,hl,s),T(V,e,s),a(e,fl,s),a(e,He,s),a(e,ul,s),T(k,e,s),a(e,yl,s),a(e,xe,s),a(e,wl,s),a(e,Le,s),a(e,Jl,s),T(qe,e,s),a(e,jl,s),a(e,De,s),a(e,Ul,s),T(Pe,e,s),a(e,gl,s),a(e,Ke,s),a(e,bl,s),T(Oe,e,s),a(e,_l,s),a(e,ls,s),Il=!0},p(e,[s]){const ha={};s&2&&(ha.$$scope={dirty:s,ctx:e}),b.$set(ha);const fa={};s&2&&(fa.$$scope={dirty:s,ctx:e}),C.$set(fa);const ua={};s&2&&(ua.$$scope={dirty:s,ctx:e}),X.$set(ua);const ya={};s&2&&(ya.$$scope={dirty:s,ctx:e}),B.$set(ya);const wa={};s&2&&(wa.$$scope={dirty:s,ctx:e}),W.$set(wa);const Ja={};s&2&&(Ja.$$scope={dirty:s,ctx:e}),V.$set(Ja);const ja={};s&2&&(ja.$$scope={dirty:s,ctx:e}),k.$set(ja)},i(e){Il||(h(y.$$.fragment,e),h(b.$$.fragment,e),h(v.$$.fragment,e),h(R.$$.fragment,e),h(Y.$$.fragment,e),h(L.$$.fragment,e),h(q.$$.fragment,e),h(P.$$.fragment,e),h(se.$$.fragment,e),h(ne.$$.fragment,e),h(re.$$.fragment,e),h(pe.$$.fragment,e),h(Me.$$.fragment,e),h(me.$$.fragment,e),h(C.$$.fragment,e),h(X.$$.fragment,e),h(fe.$$.fragment,e),h(B.$$.fragment,e),h(ye.$$.fragment,e),h(Je.$$.fragment,e),h(Ue.$$.fragment,e),h(_e.$$.fragment,e),h(Ze.$$.fragment,e),h($e.$$.fragment,e),h(Ve.$$.fragment,e),h(Ee.$$.fragment,e),h(W.$$.fragment,e),h(Fe.$$.fragment,e),h(Re.$$.fragment,e),h(Se.$$.fragment,e),h(ze.$$.fragment,e),h(V.$$.fragment,e),h(k.$$.fragment,e),h(qe.$$.fragment,e),h(Pe.$$.fragment,e),h(Oe.$$.fragment,e),Il=!0)},o(e){f(y.$$.fragment,e),f(b.$$.fragment,e),f(v.$$.fragment,e),f(R.$$.fragment,e),f(Y.$$.fragment,e),f(L.$$.fragment,e),f(q.$$.fragment,e),f(P.$$.fragment,e),f(se.$$.fragment,e),f(ne.$$.fragment,e),f(re.$$.fragment,e),f(pe.$$.fragment,e),f(Me.$$.fragment,e),f(me.$$.fragment,e),f(C.$$.fragment,e),f(X.$$.fragment,e),f(fe.$$.fragment,e),f(B.$$.fragment,e),f(ye.$$.fragment,e),f(Je.$$.fragment,e),f(Ue.$$.fragment,e),f(_e.$$.fragment,e),f(Ze.$$.fragment,e),f($e.$$.fragment,e),f(Ve.$$.fragment,e),f(Ee.$$.fragment,e),f(W.$$.fragment,e),f(Fe.$$.fragment,e),f(Re.$$.fragment,e),f(Se.$$.fragment,e),f(ze.$$.fragment,e),f(V.$$.fragment,e),f(k.$$.fragment,e),f(qe.$$.fragment,e),f(Pe.$$.fragment,e),f(Oe.$$.fragment,e),Il=!1},d(e){e&&(l(o),l(n),l(J),l(j),l(g),l(w),l(E),l($),l(G),l(ts),l(F),l(ns),l(rs),l(Q),l(is),l(N),l(os),l(S),l(ps),l(z),l(cs),l(Ms),l(H),l(ms),l(x),l(ds),l(Ts),l(hs),l(D),l(fs),l(us),l(K),l(ys),l(O),l(ws),l(ee),l(Js),l(js),l(le),l(Us),l(ae),l(gs),l(te),l(bs),l(_s),l(Is),l(ie),l(Zs),l(oe),l(As),l($s),l(ce),l(Cs),l(Xs),l(Bs),l(Ws),l(de),l(Vs),l(Te),l(ks),l(Es),l(he),l(Gs),l(vs),l(ue),l(Fs),l(Rs),l(Qs),l(we),l(Ns),l(Ss),l(je),l(zs),l(Ys),l(ge),l(Hs),l(be),l(xs),l(Ls),l(Ie),l(qs),l(Ds),l(Ae),l(Ps),l(Ks),l(Ce),l(Os),l(Xe),l(el),l(Be),l(sl),l(We),l(ll),l(al),l(ke),l(tl),l(nl),l(Ge),l(rl),l(il),l(ve),l(ol),l(pl),l(cl),l(Qe),l(Ml),l(Ne),l(ml),l(dl),l(Tl),l(Ye),l(hl),l(fl),l(He),l(ul),l(yl),l(xe),l(wl),l(Le),l(Jl),l(jl),l(De),l(Ul),l(gl),l(Ke),l(bl),l(_l),l(ls)),l(t),u(y,e),u(b,e),u(v,e),u(R,e),u(Y,e),u(L,e),u(q,e),u(P,e),u(se,e),u(ne,e),u(re,e),u(pe,e),u(Me,e),u(me,e),u(C,e),u(X,e),u(fe,e),u(B,e),u(ye,e),u(Je,e),u(Ue,e),u(_e,e),u(Ze,e),u($e,e),u(Ve,e),u(Ee,e),u(W,e),u(Fe,e),u(Re,e),u(Se,e),u(ze,e),u(V,e),u(k,e),u(qe,e),u(Pe,e),u(Oe,e)}}}const Ha='{"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":"Schedule Free Optimizer","local":"schedule-free-optimizer","sections":[],"depth":2},{"title":"Accelerate and Trainer","local":"accelerate-and-trainer","sections":[],"depth":2}],"depth":1}';function xa(U){return Ia(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class et extends Za{constructor(t){super(),Aa(this,t,xa,Ya,_a,{})}}export{et as component};
