import{s as Dt,o as Kt,n as te}from"../chunks/scheduler.18a86fab.js";import{S as Ot,i as es,g as $,s as p,r as d,A as ts,h as j,f as a,c as i,j as qt,u as g,x as T,k as St,y as ss,a as l,v as y,d as M,t as w,w as b,m as as,n as ls}from"../chunks/index.98837b22.js";import{T as xt}from"../chunks/Tip.77304350.js";import{Y as Pt}from"../chunks/Youtube.14fb207c.js";import{C}from"../chunks/CodeBlock.8d0c2e8a.js";import{D as ns}from"../chunks/DocNotebookDropdown.a04a6b2a.js";import{F as Jt,M as Re}from"../chunks/Markdown.ae01904b.js";import{H as Fe}from"../chunks/Heading.7e7e0c5b.js";import{E as rs}from"../chunks/index.499f366c.js";function os(U){let t,c='To see all architectures and checkpoints compatible with this task, we recommend checking the <a href="https://huggingface.co/tasks/text-generation" rel="nofollow">task-page</a>';return{c(){t=$("p"),t.innerHTML=c},l(s){t=j(s,"P",{"data-svelte-h":!0}),T(t)!=="svelte-5dreck"&&(t.innerHTML=c)},m(s,m){l(s,t,m)},p:te,d(s){s&&a(t)}}}function ps(U){let t,c="Use the end-of-sequence token as the padding token and set <code>mlm=False</code>. This will use the inputs as labels shifted to the right by one element:",s,m,f;return m=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERhdGFDb2xsYXRvckZvckxhbmd1YWdlTW9kZWxpbmclMEElMEF0b2tlbml6ZXIucGFkX3Rva2VuJTIwJTNEJTIwdG9rZW5pemVyLmVvc190b2tlbiUwQWRhdGFfY29sbGF0b3IlMjAlM0QlMjBEYXRhQ29sbGF0b3JGb3JMYW5ndWFnZU1vZGVsaW5nKHRva2VuaXplciUzRHRva2VuaXplciUyQyUyMG1sbSUzREZhbHNlKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DataCollatorForLanguageModeling

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.pad_token = tokenizer.eos_token
<span class="hljs-meta">&gt;&gt;&gt; </span>data_collator = DataCollatorForLanguageModeling(tokenizer=tokenizer, mlm=<span class="hljs-literal">False</span>)`,wrap:!1}}),{c(){t=$("p"),t.innerHTML=c,s=p(),d(m.$$.fragment)},l(u){t=j(u,"P",{"data-svelte-h":!0}),T(t)!=="svelte-su9ugx"&&(t.innerHTML=c),s=i(u),g(m.$$.fragment,u)},m(u,v){l(u,t,v),l(u,s,v),y(m,u,v),f=!0},p:te,i(u){f||(M(m.$$.fragment,u),f=!0)},o(u){w(m.$$.fragment,u),f=!1},d(u){u&&(a(t),a(s)),b(m,u)}}}function is(U){let t,c;return t=new Re({props:{$$slots:{default:[ps]},$$scope:{ctx:U}}}),{c(){d(t.$$.fragment)},l(s){g(t.$$.fragment,s)},m(s,m){y(t,s,m),c=!0},p(s,m){const f={};m&2&&(f.$$scope={dirty:m,ctx:s}),t.$set(f)},i(s){c||(M(t.$$.fragment,s),c=!0)},o(s){w(t.$$.fragment,s),c=!1},d(s){b(t,s)}}}function ms(U){let t,c="Use the end-of-sequence token as the padding token and set <code>mlm=False</code>. This will use the inputs as labels shifted to the right by one element:",s,m,f;return m=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERhdGFDb2xsYXRvckZvckxhbmd1YWdlTW9kZWxpbmclMEElMEFkYXRhX2NvbGxhdG9yJTIwJTNEJTIwRGF0YUNvbGxhdG9yRm9yTGFuZ3VhZ2VNb2RlbGluZyh0b2tlbml6ZXIlM0R0b2tlbml6ZXIlMkMlMjBtbG0lM0RGYWxzZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIydGYlMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DataCollatorForLanguageModeling

<span class="hljs-meta">&gt;&gt;&gt; </span>data_collator = DataCollatorForLanguageModeling(tokenizer=tokenizer, mlm=<span class="hljs-literal">False</span>, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)`,wrap:!1}}),{c(){t=$("p"),t.innerHTML=c,s=p(),d(m.$$.fragment)},l(u){t=j(u,"P",{"data-svelte-h":!0}),T(t)!=="svelte-su9ugx"&&(t.innerHTML=c),s=i(u),g(m.$$.fragment,u)},m(u,v){l(u,t,v),l(u,s,v),y(m,u,v),f=!0},p:te,i(u){f||(M(m.$$.fragment,u),f=!0)},o(u){w(m.$$.fragment,u),f=!1},d(u){u&&(a(t),a(s)),b(m,u)}}}function cs(U){let t,c;return t=new Re({props:{$$slots:{default:[ms]},$$scope:{ctx:U}}}),{c(){d(t.$$.fragment)},l(s){g(t.$$.fragment,s)},m(s,m){y(t,s,m),c=!0},p(s,m){const f={};m&2&&(f.$$scope={dirty:m,ctx:s}),t.$set(f)},i(s){c||(M(t.$$.fragment,s),c=!0)},o(s){w(t.$$.fragment,s),c=!1},d(s){b(t,s)}}}function hs(U){let t,c='If you aren’t familiar with finetuning a model with the <a href="/docs/transformers/main/en/main_classes/trainer#transformers.Trainer">Trainer</a>, take a look at the <a href="../training#train-with-pytorch-trainer">basic tutorial</a>!';return{c(){t=$("p"),t.innerHTML=c},l(s){t=j(s,"P",{"data-svelte-h":!0}),T(t)!=="svelte-me8q54"&&(t.innerHTML=c)},m(s,m){l(s,t,m)},p:te,d(s){s&&a(t)}}}function us(U){let t,c,s,m='You’re ready to start training your model now! Load DistilGPT2 with <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoModelForCausalLM">AutoModelForCausalLM</a>:',f,u,v,I,G="At this point, only three steps remain:",R,Z,X='<li>Define your training hyperparameters in <a href="/docs/transformers/main/en/main_classes/trainer#transformers.TrainingArguments">TrainingArguments</a>. The only required parameter is <code>output_dir</code> which specifies where to save your model. You’ll push this model to the Hub by setting <code>push_to_hub=True</code> (you need to be signed in to Hugging Face to upload your model).</li> <li>Pass the training arguments to <a href="/docs/transformers/main/en/main_classes/trainer#transformers.Trainer">Trainer</a> along with the model, datasets, and data collator.</li> <li>Call <a href="/docs/transformers/main/en/main_classes/trainer#transformers.Trainer.train">train()</a> to finetune your model.</li>',W,J,V,r,x='Once training is completed, use the <a href="/docs/transformers/main/en/main_classes/trainer#transformers.Trainer.evaluate">evaluate()</a> method to evaluate your model and get its perplexity:',Q,Y,z,A,L='Then share your model to the Hub with the <a href="/docs/transformers/main/en/main_classes/trainer#transformers.Trainer.push_to_hub">push_to_hub()</a> method so everyone can use your model:',F,E,B;return t=new xt({props:{$$slots:{default:[hs]},$$scope:{ctx:U}}}),u=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTJDJTIwVHJhaW5pbmdBcmd1bWVudHMlMkMlMjBUcmFpbmVyJTBBJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JDYXVzYWxMTS5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsYmVydCUyRmRpc3RpbGdwdDIlMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, TrainingArguments, Trainer

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;distilbert/distilgpt2&quot;</span>)`,wrap:!1}}),J=new C({props:{code:"dHJhaW5pbmdfYXJncyUyMCUzRCUyMFRyYWluaW5nQXJndW1lbnRzKCUwQSUyMCUyMCUyMCUyMG91dHB1dF9kaXIlM0QlMjJteV9hd2Vzb21lX2VsaTVfY2xtLW1vZGVsJTIyJTJDJTBBJTIwJTIwJTIwJTIwZXZhbF9zdHJhdGVneSUzRCUyMmVwb2NoJTIyJTJDJTBBJTIwJTIwJTIwJTIwbGVhcm5pbmdfcmF0ZSUzRDJlLTUlMkMlMEElMjAlMjAlMjAlMjB3ZWlnaHRfZGVjYXklM0QwLjAxJTJDJTBBJTIwJTIwJTIwJTIwcHVzaF90b19odWIlM0RUcnVlJTJDJTBBKSUwQSUwQXRyYWluZXIlMjAlM0QlMjBUcmFpbmVyKCUwQSUyMCUyMCUyMCUyMG1vZGVsJTNEbW9kZWwlMkMlMEElMjAlMjAlMjAlMjBhcmdzJTNEdHJhaW5pbmdfYXJncyUyQyUwQSUyMCUyMCUyMCUyMHRyYWluX2RhdGFzZXQlM0RsbV9kYXRhc2V0JTVCJTIydHJhaW4lMjIlNUQlMkMlMEElMjAlMjAlMjAlMjBldmFsX2RhdGFzZXQlM0RsbV9kYXRhc2V0JTVCJTIydGVzdCUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMGRhdGFfY29sbGF0b3IlM0RkYXRhX2NvbGxhdG9yJTJDJTBBJTIwJTIwJTIwJTIwdG9rZW5pemVyJTNEdG9rZW5pemVyJTJDJTBBKSUwQSUwQXRyYWluZXIudHJhaW4oKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>training_args = TrainingArguments(
<span class="hljs-meta">... </span>    output_dir=<span class="hljs-string">&quot;my_awesome_eli5_clm-model&quot;</span>,
<span class="hljs-meta">... </span>    eval_strategy=<span class="hljs-string">&quot;epoch&quot;</span>,
<span class="hljs-meta">... </span>    learning_rate=<span class="hljs-number">2e-5</span>,
<span class="hljs-meta">... </span>    weight_decay=<span class="hljs-number">0.01</span>,
<span class="hljs-meta">... </span>    push_to_hub=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>)

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

<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.train()`,wrap:!1}}),Y=new C({props:{code:"aW1wb3J0JTIwbWF0aCUwQSUwQWV2YWxfcmVzdWx0cyUyMCUzRCUyMHRyYWluZXIuZXZhbHVhdGUoKSUwQXByaW50KGYlMjJQZXJwbGV4aXR5JTNBJTIwJTdCbWF0aC5leHAoZXZhbF9yZXN1bHRzJTVCJ2V2YWxfbG9zcyclNUQpJTNBLjJmJTdEJTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> math

<span class="hljs-meta">&gt;&gt;&gt; </span>eval_results = trainer.evaluate()
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;Perplexity: <span class="hljs-subst">{math.exp(eval_results[<span class="hljs-string">&#x27;eval_loss&#x27;</span>]):<span class="hljs-number">.2</span>f}</span>&quot;</span>)
Perplexity: <span class="hljs-number">49.61</span>`,wrap:!1}}),E=new C({props:{code:"dHJhaW5lci5wdXNoX3RvX2h1Yigp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.push_to_hub()',wrap:!1}}),{c(){d(t.$$.fragment),c=p(),s=$("p"),s.innerHTML=m,f=p(),d(u.$$.fragment),v=p(),I=$("p"),I.textContent=G,R=p(),Z=$("ol"),Z.innerHTML=X,W=p(),d(J.$$.fragment),V=p(),r=$("p"),r.innerHTML=x,Q=p(),d(Y.$$.fragment),z=p(),A=$("p"),A.innerHTML=L,F=p(),d(E.$$.fragment)},l(h){g(t.$$.fragment,h),c=i(h),s=j(h,"P",{"data-svelte-h":!0}),T(s)!=="svelte-1q2so56"&&(s.innerHTML=m),f=i(h),g(u.$$.fragment,h),v=i(h),I=j(h,"P",{"data-svelte-h":!0}),T(I)!=="svelte-l42k0i"&&(I.textContent=G),R=i(h),Z=j(h,"OL",{"data-svelte-h":!0}),T(Z)!=="svelte-9nzdq0"&&(Z.innerHTML=X),W=i(h),g(J.$$.fragment,h),V=i(h),r=j(h,"P",{"data-svelte-h":!0}),T(r)!=="svelte-18h3zoe"&&(r.innerHTML=x),Q=i(h),g(Y.$$.fragment,h),z=i(h),A=j(h,"P",{"data-svelte-h":!0}),T(A)!=="svelte-1ofhil3"&&(A.innerHTML=L),F=i(h),g(E.$$.fragment,h)},m(h,_){y(t,h,_),l(h,c,_),l(h,s,_),l(h,f,_),y(u,h,_),l(h,v,_),l(h,I,_),l(h,R,_),l(h,Z,_),l(h,W,_),y(J,h,_),l(h,V,_),l(h,r,_),l(h,Q,_),y(Y,h,_),l(h,z,_),l(h,A,_),l(h,F,_),y(E,h,_),B=!0},p(h,_){const H={};_&2&&(H.$$scope={dirty:_,ctx:h}),t.$set(H)},i(h){B||(M(t.$$.fragment,h),M(u.$$.fragment,h),M(J.$$.fragment,h),M(Y.$$.fragment,h),M(E.$$.fragment,h),B=!0)},o(h){w(t.$$.fragment,h),w(u.$$.fragment,h),w(J.$$.fragment,h),w(Y.$$.fragment,h),w(E.$$.fragment,h),B=!1},d(h){h&&(a(c),a(s),a(f),a(v),a(I),a(R),a(Z),a(W),a(V),a(r),a(Q),a(z),a(A),a(F)),b(t,h),b(u,h),b(J,h),b(Y,h),b(E,h)}}}function fs(U){let t,c;return t=new Re({props:{$$slots:{default:[us]},$$scope:{ctx:U}}}),{c(){d(t.$$.fragment)},l(s){g(t.$$.fragment,s)},m(s,m){y(t,s,m),c=!0},p(s,m){const f={};m&2&&(f.$$scope={dirty:m,ctx:s}),t.$set(f)},i(s){c||(M(t.$$.fragment,s),c=!0)},o(s){w(t.$$.fragment,s),c=!1},d(s){b(t,s)}}}function ds(U){let t,c='If you aren’t familiar with finetuning a model with Keras, take a look at the <a href="../training#train-a-tensorflow-model-with-keras">basic tutorial</a>!';return{c(){t=$("p"),t.innerHTML=c},l(s){t=j(s,"P",{"data-svelte-h":!0}),T(t)!=="svelte-1mqyx4y"&&(t.innerHTML=c)},m(s,m){l(s,t,m)},p:te,d(s){s&&a(t)}}}function gs(U){let t,c,s,m,f,u='Then you can load DistilGPT2 with <a href="/docs/transformers/main/en/model_doc/auto#transformers.TFAutoModelForCausalLM">TFAutoModelForCausalLM</a>:',v,I,G,R,Z='Convert your datasets to the <code>tf.data.Dataset</code> format with <a href="/docs/transformers/main/en/main_classes/model#transformers.TFPreTrainedModel.prepare_tf_dataset">prepare_tf_dataset()</a>:',X,W,J,V,r='Configure the model for training with <a href="https://keras.io/api/models/model_training_apis/#compile-method" rel="nofollow"><code>compile</code></a>. Note that Transformers models all have a default task-relevant loss function, so you don’t need to specify one unless you want to:',x,Q,Y,z,A='This can be done by specifying where to push your model and tokenizer in the <a href="/docs/transformers/main/en/main_classes/keras_callbacks#transformers.PushToHubCallback">PushToHubCallback</a>:',L,F,E,B,h='Finally, you’re ready to start training your model! Call <a href="https://keras.io/api/models/model_training_apis/#fit-method" rel="nofollow"><code>fit</code></a> with your training and validation datasets, the number of epochs, and your callback to finetune the model:',_,H,S,N,Ve="Once training is completed, your model is automatically uploaded to the Hub so everyone can use it!",P;return t=new xt({props:{$$slots:{default:[ds]},$$scope:{ctx:U}}}),s=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMGNyZWF0ZV9vcHRpbWl6ZXIlMkMlMjBBZGFtV2VpZ2h0RGVjYXklMEElMEFvcHRpbWl6ZXIlMjAlM0QlMjBBZGFtV2VpZ2h0RGVjYXkobGVhcm5pbmdfcmF0ZSUzRDJlLTUlMkMlMjB3ZWlnaHRfZGVjYXlfcmF0ZSUzRDAuMDEp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> create_optimizer, AdamWeightDecay

<span class="hljs-meta">&gt;&gt;&gt; </span>optimizer = AdamWeightDecay(learning_rate=<span class="hljs-number">2e-5</span>, weight_decay_rate=<span class="hljs-number">0.01</span>)`,wrap:!1}}),I=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGQXV0b01vZGVsRm9yQ2F1c2FsTE0lMEElMEFtb2RlbCUyMCUzRCUyMFRGQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMmRpc3RpbGJlcnQlMkZkaXN0aWxncHQyJTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFAutoModelForCausalLM

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFAutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;distilbert/distilgpt2&quot;</span>)`,wrap:!1}}),W=new C({props:{code:"dGZfdHJhaW5fc2V0JTIwJTNEJTIwbW9kZWwucHJlcGFyZV90Zl9kYXRhc2V0KCUwQSUyMCUyMCUyMCUyMGxtX2RhdGFzZXQlNUIlMjJ0cmFpbiUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMHNodWZmbGUlM0RUcnVlJTJDJTBBJTIwJTIwJTIwJTIwYmF0Y2hfc2l6ZSUzRDE2JTJDJTBBJTIwJTIwJTIwJTIwY29sbGF0ZV9mbiUzRGRhdGFfY29sbGF0b3IlMkMlMEEpJTBBJTBBdGZfdGVzdF9zZXQlMjAlM0QlMjBtb2RlbC5wcmVwYXJlX3RmX2RhdGFzZXQoJTBBJTIwJTIwJTIwJTIwbG1fZGF0YXNldCU1QiUyMnRlc3QlMjIlNUQlMkMlMEElMjAlMjAlMjAlMjBzaHVmZmxlJTNERmFsc2UlMkMlMEElMjAlMjAlMjAlMjBiYXRjaF9zaXplJTNEMTYlMkMlMEElMjAlMjAlMjAlMjBjb2xsYXRlX2ZuJTNEZGF0YV9jb2xsYXRvciUyQyUwQSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>tf_train_set = model.prepare_tf_dataset(
<span class="hljs-meta">... </span>    lm_dataset[<span class="hljs-string">&quot;train&quot;</span>],
<span class="hljs-meta">... </span>    shuffle=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>    batch_size=<span class="hljs-number">16</span>,
<span class="hljs-meta">... </span>    collate_fn=data_collator,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>tf_test_set = model.prepare_tf_dataset(
<span class="hljs-meta">... </span>    lm_dataset[<span class="hljs-string">&quot;test&quot;</span>],
<span class="hljs-meta">... </span>    shuffle=<span class="hljs-literal">False</span>,
<span class="hljs-meta">... </span>    batch_size=<span class="hljs-number">16</span>,
<span class="hljs-meta">... </span>    collate_fn=data_collator,
<span class="hljs-meta">... </span>)`,wrap:!1}}),Q=new C({props:{code:"aW1wb3J0JTIwdGVuc29yZmxvdyUyMGFzJTIwdGYlMEElMEFtb2RlbC5jb21waWxlKG9wdGltaXplciUzRG9wdGltaXplciklMjAlMjAlMjMlMjBObyUyMGxvc3MlMjBhcmd1bWVudCE=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf

<span class="hljs-meta">&gt;&gt;&gt; </span>model.<span class="hljs-built_in">compile</span>(optimizer=optimizer)  <span class="hljs-comment"># No loss argument!</span>`,wrap:!1}}),F=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycy5rZXJhc19jYWxsYmFja3MlMjBpbXBvcnQlMjBQdXNoVG9IdWJDYWxsYmFjayUwQSUwQWNhbGxiYWNrJTIwJTNEJTIwUHVzaFRvSHViQ2FsbGJhY2soJTBBJTIwJTIwJTIwJTIwb3V0cHV0X2RpciUzRCUyMm15X2F3ZXNvbWVfZWxpNV9jbG0tbW9kZWwlMjIlMkMlMEElMjAlMjAlMjAlMjB0b2tlbml6ZXIlM0R0b2tlbml6ZXIlMkMlMEEp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers.keras_callbacks <span class="hljs-keyword">import</span> PushToHubCallback

<span class="hljs-meta">&gt;&gt;&gt; </span>callback = PushToHubCallback(
<span class="hljs-meta">... </span>    output_dir=<span class="hljs-string">&quot;my_awesome_eli5_clm-model&quot;</span>,
<span class="hljs-meta">... </span>    tokenizer=tokenizer,
<span class="hljs-meta">... </span>)`,wrap:!1}}),H=new C({props:{code:"bW9kZWwuZml0KHglM0R0Zl90cmFpbl9zZXQlMkMlMjB2YWxpZGF0aW9uX2RhdGElM0R0Zl90ZXN0X3NldCUyQyUyMGVwb2NocyUzRDMlMkMlMjBjYWxsYmFja3MlM0QlNUJjYWxsYmFjayU1RCk=",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>model.fit(x=tf_train_set, validation_data=tf_test_set, epochs=<span class="hljs-number">3</span>, callbacks=[callback])',wrap:!1}}),{c(){d(t.$$.fragment),c=as(`
To finetune a model in TensorFlow, start by setting up an optimizer function, learning rate schedule, and some training hyperparameters:

	`),d(s.$$.fragment),m=p(),f=$("p"),f.innerHTML=u,v=p(),d(I.$$.fragment),G=p(),R=$("p"),R.innerHTML=Z,X=p(),d(W.$$.fragment),J=p(),V=$("p"),V.innerHTML=r,x=p(),d(Q.$$.fragment),Y=p(),z=$("p"),z.innerHTML=A,L=p(),d(F.$$.fragment),E=p(),B=$("p"),B.innerHTML=h,_=p(),d(H.$$.fragment),S=p(),N=$("p"),N.textContent=Ve},l(o){g(t.$$.fragment,o),c=ls(o,`
To finetune a model in TensorFlow, start by setting up an optimizer function, learning rate schedule, and some training hyperparameters:

	`),g(s.$$.fragment,o),m=i(o),f=j(o,"P",{"data-svelte-h":!0}),T(f)!=="svelte-dt80o4"&&(f.innerHTML=u),v=i(o),g(I.$$.fragment,o),G=i(o),R=j(o,"P",{"data-svelte-h":!0}),T(R)!=="svelte-9ymftz"&&(R.innerHTML=Z),X=i(o),g(W.$$.fragment,o),J=i(o),V=j(o,"P",{"data-svelte-h":!0}),T(V)!=="svelte-17cxx5e"&&(V.innerHTML=r),x=i(o),g(Q.$$.fragment,o),Y=i(o),z=j(o,"P",{"data-svelte-h":!0}),T(z)!=="svelte-1aajtcp"&&(z.innerHTML=A),L=i(o),g(F.$$.fragment,o),E=i(o),B=j(o,"P",{"data-svelte-h":!0}),T(B)!=="svelte-1pfsro2"&&(B.innerHTML=h),_=i(o),g(H.$$.fragment,o),S=i(o),N=j(o,"P",{"data-svelte-h":!0}),T(N)!=="svelte-2s71om"&&(N.textContent=Ve)},m(o,k){y(t,o,k),l(o,c,k),y(s,o,k),l(o,m,k),l(o,f,k),l(o,v,k),y(I,o,k),l(o,G,k),l(o,R,k),l(o,X,k),y(W,o,k),l(o,J,k),l(o,V,k),l(o,x,k),y(Q,o,k),l(o,Y,k),l(o,z,k),l(o,L,k),y(F,o,k),l(o,E,k),l(o,B,k),l(o,_,k),y(H,o,k),l(o,S,k),l(o,N,k),P=!0},p(o,k){const q={};k&2&&(q.$$scope={dirty:k,ctx:o}),t.$set(q)},i(o){P||(M(t.$$.fragment,o),M(s.$$.fragment,o),M(I.$$.fragment,o),M(W.$$.fragment,o),M(Q.$$.fragment,o),M(F.$$.fragment,o),M(H.$$.fragment,o),P=!0)},o(o){w(t.$$.fragment,o),w(s.$$.fragment,o),w(I.$$.fragment,o),w(W.$$.fragment,o),w(Q.$$.fragment,o),w(F.$$.fragment,o),w(H.$$.fragment,o),P=!1},d(o){o&&(a(c),a(m),a(f),a(v),a(G),a(R),a(X),a(J),a(V),a(x),a(Y),a(z),a(L),a(E),a(B),a(_),a(S),a(N)),b(t,o),b(s,o),b(I,o),b(W,o),b(Q,o),b(F,o),b(H,o)}}}function ys(U){let t,c;return t=new Re({props:{$$slots:{default:[gs]},$$scope:{ctx:U}}}),{c(){d(t.$$.fragment)},l(s){g(t.$$.fragment,s)},m(s,m){y(t,s,m),c=!0},p(s,m){const f={};m&2&&(f.$$scope={dirty:m,ctx:s}),t.$set(f)},i(s){c||(M(t.$$.fragment,s),c=!0)},o(s){w(t.$$.fragment,s),c=!1},d(s){b(t,s)}}}function Ms(U){let t,c=`For a more in-depth example of how to finetune a model for causal language modeling, take a look at the corresponding
<a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling.ipynb" rel="nofollow">PyTorch notebook</a>
or <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling-tf.ipynb" rel="nofollow">TensorFlow notebook</a>.`;return{c(){t=$("p"),t.innerHTML=c},l(s){t=j(s,"P",{"data-svelte-h":!0}),T(t)!=="svelte-bbjpvr"&&(t.innerHTML=c)},m(s,m){l(s,t,m)},p:te,d(s){s&&a(t)}}}function ws(U){let t,c="Tokenize the text and return the <code>input_ids</code> as PyTorch tensors:",s,m,f,u,v=`Use the <a href="/docs/transformers/main/en/main_classes/text_generation#transformers.GenerationMixin.generate">generate()</a> method to generate text.
For more details about the different text generation strategies and parameters for controlling generation, check out the <a href="../generation_strategies">Text generation strategies</a> page.`,I,G,R,Z,X="Decode the generated token ids back into text:",W,J,V;return m=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJ1c2VybmFtZSUyRm15X2F3ZXNvbWVfZWxpNV9jbG0tbW9kZWwlMjIpJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKHByb21wdCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpLmlucHV0X2lkcw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;username/my_awesome_eli5_clm-model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(prompt, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).input_ids`,wrap:!1}}),G=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTBBJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JDYXVzYWxMTS5mcm9tX3ByZXRyYWluZWQoJTIydXNlcm5hbWUlMkZteV9hd2Vzb21lX2VsaTVfY2xtLW1vZGVsJTIyKSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbC5nZW5lcmF0ZShpbnB1dHMlMkMlMjBtYXhfbmV3X3Rva2VucyUzRDEwMCUyQyUyMGRvX3NhbXBsZSUzRFRydWUlMkMlMjB0b3BfayUzRDUwJTJDJTIwdG9wX3AlM0QwLjk1KQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;username/my_awesome_eli5_clm-model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model.generate(inputs, max_new_tokens=<span class="hljs-number">100</span>, do_sample=<span class="hljs-literal">True</span>, top_k=<span class="hljs-number">50</span>, top_p=<span class="hljs-number">0.95</span>)`,wrap:!1}}),J=new C({props:{code:"dG9rZW5pemVyLmJhdGNoX2RlY29kZShvdXRwdXRzJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.batch_decode(outputs, skip_special_tokens=<span class="hljs-literal">True</span>)
[<span class="hljs-string">&quot;Somatic hypermutation allows the immune system to react to drugs with the ability to adapt to a different environmental situation. In other words, a system of &#x27;hypermutation&#x27; can help the immune system to adapt to a different environmental situation or in some cases even a single life. In contrast, researchers at the University of Massachusetts-Boston have found that &#x27;hypermutation&#x27; is much stronger in mice than in humans but can be found in humans, and that it&#x27;s not completely unknown to the immune system. A study on how the immune system&quot;</span>]`,wrap:!1}}),{c(){t=$("p"),t.innerHTML=c,s=p(),d(m.$$.fragment),f=p(),u=$("p"),u.innerHTML=v,I=p(),d(G.$$.fragment),R=p(),Z=$("p"),Z.textContent=X,W=p(),d(J.$$.fragment)},l(r){t=j(r,"P",{"data-svelte-h":!0}),T(t)!=="svelte-1c2y1ia"&&(t.innerHTML=c),s=i(r),g(m.$$.fragment,r),f=i(r),u=j(r,"P",{"data-svelte-h":!0}),T(u)!=="svelte-1qra5al"&&(u.innerHTML=v),I=i(r),g(G.$$.fragment,r),R=i(r),Z=j(r,"P",{"data-svelte-h":!0}),T(Z)!=="svelte-1918fu9"&&(Z.textContent=X),W=i(r),g(J.$$.fragment,r)},m(r,x){l(r,t,x),l(r,s,x),y(m,r,x),l(r,f,x),l(r,u,x),l(r,I,x),y(G,r,x),l(r,R,x),l(r,Z,x),l(r,W,x),y(J,r,x),V=!0},p:te,i(r){V||(M(m.$$.fragment,r),M(G.$$.fragment,r),M(J.$$.fragment,r),V=!0)},o(r){w(m.$$.fragment,r),w(G.$$.fragment,r),w(J.$$.fragment,r),V=!1},d(r){r&&(a(t),a(s),a(f),a(u),a(I),a(R),a(Z),a(W)),b(m,r),b(G,r),b(J,r)}}}function bs(U){let t,c;return t=new Re({props:{$$slots:{default:[ws]},$$scope:{ctx:U}}}),{c(){d(t.$$.fragment)},l(s){g(t.$$.fragment,s)},m(s,m){y(t,s,m),c=!0},p(s,m){const f={};m&2&&(f.$$scope={dirty:m,ctx:s}),t.$set(f)},i(s){c||(M(t.$$.fragment,s),c=!0)},o(s){w(t.$$.fragment,s),c=!1},d(s){b(t,s)}}}function $s(U){let t,c="Tokenize the text and return the <code>input_ids</code> as TensorFlow tensors:",s,m,f,u,v='Use the <code>~transformers.generation_tf_utils.TFGenerationMixin.generate</code> method to create the summarization. For more details about the different text generation strategies and parameters for controlling generation, check out the <a href="../generation_strategies">Text generation strategies</a> page.',I,G,R,Z,X="Decode the generated token ids back into text:",W,J,V;return m=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJ1c2VybmFtZSUyRm15X2F3ZXNvbWVfZWxpNV9jbG0tbW9kZWwlMjIpJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKHByb21wdCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIydGYlMjIpLmlucHV0X2lkcw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;username/my_awesome_eli5_clm-model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(prompt, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>).input_ids`,wrap:!1}}),G=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGQXV0b01vZGVsRm9yQ2F1c2FsTE0lMEElMEFtb2RlbCUyMCUzRCUyMFRGQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMnVzZXJuYW1lJTJGbXlfYXdlc29tZV9lbGk1X2NsbS1tb2RlbCUyMiklMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoaW5wdXRfaWRzJTNEaW5wdXRzJTJDJTIwbWF4X25ld190b2tlbnMlM0QxMDAlMkMlMjBkb19zYW1wbGUlM0RUcnVlJTJDJTIwdG9wX2slM0Q1MCUyQyUyMHRvcF9wJTNEMC45NSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFAutoModelForCausalLM

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFAutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;username/my_awesome_eli5_clm-model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model.generate(input_ids=inputs, max_new_tokens=<span class="hljs-number">100</span>, do_sample=<span class="hljs-literal">True</span>, top_k=<span class="hljs-number">50</span>, top_p=<span class="hljs-number">0.95</span>)`,wrap:!1}}),J=new C({props:{code:"dG9rZW5pemVyLmJhdGNoX2RlY29kZShvdXRwdXRzJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.batch_decode(outputs, skip_special_tokens=<span class="hljs-literal">True</span>)
[<span class="hljs-string">&#x27;Somatic hypermutation allows the immune system to detect the presence of other viruses as they become more prevalent. Therefore, researchers have identified a high proportion of human viruses. The proportion of virus-associated viruses in our study increases with age. Therefore, we propose a simple algorithm to detect the presence of these new viruses in our samples as a sign of improved immunity. A first study based on this algorithm, which will be published in Science on Friday, aims to show that this finding could translate into the development of a better vaccine that is more effective for&#x27;</span>]`,wrap:!1}}),{c(){t=$("p"),t.innerHTML=c,s=p(),d(m.$$.fragment),f=p(),u=$("p"),u.innerHTML=v,I=p(),d(G.$$.fragment),R=p(),Z=$("p"),Z.textContent=X,W=p(),d(J.$$.fragment)},l(r){t=j(r,"P",{"data-svelte-h":!0}),T(t)!=="svelte-hw2mu6"&&(t.innerHTML=c),s=i(r),g(m.$$.fragment,r),f=i(r),u=j(r,"P",{"data-svelte-h":!0}),T(u)!=="svelte-dn2hme"&&(u.innerHTML=v),I=i(r),g(G.$$.fragment,r),R=i(r),Z=j(r,"P",{"data-svelte-h":!0}),T(Z)!=="svelte-1918fu9"&&(Z.textContent=X),W=i(r),g(J.$$.fragment,r)},m(r,x){l(r,t,x),l(r,s,x),y(m,r,x),l(r,f,x),l(r,u,x),l(r,I,x),y(G,r,x),l(r,R,x),l(r,Z,x),l(r,W,x),y(J,r,x),V=!0},p:te,i(r){V||(M(m.$$.fragment,r),M(G.$$.fragment,r),M(J.$$.fragment,r),V=!0)},o(r){w(m.$$.fragment,r),w(G.$$.fragment,r),w(J.$$.fragment,r),V=!1},d(r){r&&(a(t),a(s),a(f),a(u),a(I),a(R),a(Z),a(W)),b(m,r),b(G,r),b(J,r)}}}function js(U){let t,c;return t=new Re({props:{$$slots:{default:[$s]},$$scope:{ctx:U}}}),{c(){d(t.$$.fragment)},l(s){g(t.$$.fragment,s)},m(s,m){y(t,s,m),c=!0},p(s,m){const f={};m&2&&(f.$$scope={dirty:m,ctx:s}),t.$set(f)},i(s){c||(M(t.$$.fragment,s),c=!0)},o(s){w(t.$$.fragment,s),c=!1},d(s){b(t,s)}}}function Ts(U){let t,c,s,m,f,u,v,I,G,R=`There are two types of language modeling, causal and masked. This guide illustrates causal language modeling.
Causal language models are frequently used for text generation. You can use these models for creative applications like
choosing your own text adventure or an intelligent coding assistant like Copilot or CodeParrot.`,Z,X,W,J,V=`Causal language modeling predicts the next token in a sequence of tokens, and the model can only attend to tokens on
the left. This means the model cannot see future tokens. GPT-2 is an example of a causal language model.`,r,x,Q="This guide will show you how to:",Y,z,A='<li>Finetune <a href="https://huggingface.co/distilbert/distilgpt2" rel="nofollow">DistilGPT2</a> on the <a href="https://www.reddit.com/r/askscience/" rel="nofollow">r/askscience</a> subset of the <a href="https://huggingface.co/datasets/eli5" rel="nofollow">ELI5</a> dataset.</li> <li>Use your finetuned model for inference.</li>',L,F,E,B,h="Before you begin, make sure you have all the necessary libraries installed:",_,H,S,N,Ve="We encourage you to log in to your Hugging Face account so you can upload and share your model with the community. When prompted, enter your token to log in:",P,o,k,q,ze,se,kt='Start by loading the first 5000 examples from the <a href="https://huggingface.co/datasets/eli5_category" rel="nofollow">ELI5-Category</a> dataset with the 🤗 Datasets library. This’ll give you a chance to experiment and make sure everything works before spending more time training on the full dataset.',Be,ae,He,le,_t='Split the dataset’s <code>train</code> split into a train and test set with the <a href="https://huggingface.co/docs/datasets/main/en/package_reference/main_classes#datasets.Dataset.train_test_split" rel="nofollow">train_test_split</a> method:',Ye,ne,Ee,re,Ut="Then take a look at an example:",Qe,oe,Ne,pe,vt=`While this may look like a lot, you’re only really interested in the <code>text</code> field. What’s cool about language modeling
tasks is you don’t need labels (also known as an unsupervised task) because the next word <em>is</em> the label.`,Ae,ie,Le,me,qe,ce,Gt="The next step is to load a DistilGPT2 tokenizer to process the <code>text</code> subfield:",Se,he,Pe,ue,Zt=`You’ll notice from the example above, the <code>text</code> field is actually nested inside <code>answers</code>. This means you’ll need to
extract the <code>text</code> subfield from its nested structure with the <a href="https://huggingface.co/docs/datasets/process#flatten" rel="nofollow"><code>flatten</code></a> method:`,De,fe,Ke,de,Ct=`Each subfield is now a separate column as indicated by the <code>answers</code> prefix, and the <code>text</code> field is a list now. Instead
of tokenizing each sentence separately, convert the list to a string so you can jointly tokenize them.`,Oe,ge,It="Here is a first preprocessing function to join the list of strings for each example and tokenize the result:",et,ye,tt,Me,Wt='To apply this preprocessing function over the entire dataset, use the 🤗 Datasets <a href="https://huggingface.co/docs/datasets/main/en/package_reference/main_classes#datasets.Dataset.map" rel="nofollow">map</a> method. You can speed up the <code>map</code> function by setting <code>batched=True</code> to process multiple elements of the dataset at once, and increasing the number of processes with <code>num_proc</code>. Remove any columns you don’t need:',st,we,at,be,Rt="This dataset contains the token sequences, but some of these are longer than the maximum input length for the model.",lt,$e,Vt="You can now use a second preprocessing function to",nt,je,Xt="<li>concatenate all the sequences</li> <li>split the concatenated sequences into shorter chunks defined by <code>block_size</code>, which should be both shorter than the maximum input length and short enough for your GPU RAM.</li>",rt,Te,ot,xe,Ft="Apply the <code>group_texts</code> function over the entire dataset:",pt,Je,it,ke,zt=`Now create a batch of examples using <a href="/docs/transformers/main/en/main_classes/data_collator#transformers.DataCollatorForLanguageModeling">DataCollatorForLanguageModeling</a>. It’s more efficient to <em>dynamically pad</em> the
sentences to the longest length in a batch during collation, instead of padding the whole dataset to the maximum length.`,mt,D,ct,_e,ht,K,ut,O,ft,Ue,dt,ve,Bt="Great, now that you’ve finetuned a model, you can use it for inference!",gt,Ge,Ht="Come up with a prompt you’d like to generate text from:",yt,Ze,Mt,Ce,Yt='The simplest way to try out your finetuned model for inference is to use it in a <a href="/docs/transformers/main/en/main_classes/pipelines#transformers.pipeline">pipeline()</a>. Instantiate a <code>pipeline</code> for text generation with your model, and pass your text to it:',wt,Ie,bt,ee,$t,We,jt,Xe,Tt;return f=new Fe({props:{title:"Causal language modeling",local:"causal-language-modeling",headingTag:"h1"}}),v=new ns({props:{classNames:"absolute z-10 right-0 top-0",options:[{label:"Mixed",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/en/language_modeling.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/en/pytorch/language_modeling.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/en/tensorflow/language_modeling.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/en/language_modeling.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/en/pytorch/language_modeling.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/en/tensorflow/language_modeling.ipynb"}]}}),X=new Pt({props:{id:"Vpjb1lu0MDk"}}),F=new xt({props:{$$slots:{default:[os]},$$scope:{ctx:U}}}),H=new C({props:{code:"cGlwJTIwaW5zdGFsbCUyMHRyYW5zZm9ybWVycyUyMGRhdGFzZXRzJTIwZXZhbHVhdGU=",highlighted:"pip install transformers datasets evaluate",wrap:!1}}),o=new C({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMG5vdGVib29rX2xvZ2luJTBBJTBBbm90ZWJvb2tfbG9naW4oKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> notebook_login

<span class="hljs-meta">&gt;&gt;&gt; </span>notebook_login()`,wrap:!1}}),q=new Fe({props:{title:"Load ELI5 dataset",local:"load-eli5-dataset",headingTag:"h2"}}),ae=new C({props:{code:"ZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBJTBBZWxpNSUyMCUzRCUyMGxvYWRfZGF0YXNldCglMjJlbGk1X2NhdGVnb3J5JTIyJTJDJTIwc3BsaXQlM0QlMjJ0cmFpbiU1QiUzQTUwMDAlNUQlMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset

<span class="hljs-meta">&gt;&gt;&gt; </span>eli5 = load_dataset(<span class="hljs-string">&quot;eli5_category&quot;</span>, split=<span class="hljs-string">&quot;train[:5000]&quot;</span>)`,wrap:!1}}),ne=new C({props:{code:"ZWxpNSUyMCUzRCUyMGVsaTUudHJhaW5fdGVzdF9zcGxpdCh0ZXN0X3NpemUlM0QwLjIp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>eli5 = eli5.train_test_split(test_size=<span class="hljs-number">0.2</span>)',wrap:!1}}),oe=new C({props:{code:"ZWxpNSU1QiUyMnRyYWluJTIyJTVEJTVCMCU1RA==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>eli5[<span class="hljs-string">&quot;train&quot;</span>][<span class="hljs-number">0</span>]
{<span class="hljs-string">&#x27;q_id&#x27;</span>: <span class="hljs-string">&#x27;7h191n&#x27;</span>,
 <span class="hljs-string">&#x27;title&#x27;</span>: <span class="hljs-string">&#x27;What does the tax bill that was passed today mean? How will it affect Americans in each tax bracket?&#x27;</span>,
 <span class="hljs-string">&#x27;selftext&#x27;</span>: <span class="hljs-string">&#x27;&#x27;</span>,
 <span class="hljs-string">&#x27;category&#x27;</span>: <span class="hljs-string">&#x27;Economics&#x27;</span>,
 <span class="hljs-string">&#x27;subreddit&#x27;</span>: <span class="hljs-string">&#x27;explainlikeimfive&#x27;</span>,
 <span class="hljs-string">&#x27;answers&#x27;</span>: {<span class="hljs-string">&#x27;a_id&#x27;</span>: [<span class="hljs-string">&#x27;dqnds8l&#x27;</span>, <span class="hljs-string">&#x27;dqnd1jl&#x27;</span>, <span class="hljs-string">&#x27;dqng3i1&#x27;</span>, <span class="hljs-string">&#x27;dqnku5x&#x27;</span>],
  <span class="hljs-string">&#x27;text&#x27;</span>: [<span class="hljs-string">&quot;The tax bill is 500 pages long and there were a lot of changes still going on right to the end. It&#x27;s not just an adjustment to the income tax brackets, it&#x27;s a whole bunch of changes. As such there is no good answer to your question. The big take aways are: - Big reduction in corporate income tax rate will make large companies very happy. - Pass through rate change will make certain styles of business (law firms, hedge funds) extremely happy - Income tax changes are moderate, and are set to expire (though it&#x27;s the kind of thing that might just always get re-applied without being made permanent) - People in high tax states (California, New York) lose out, and many of them will end up with their taxes raised.&quot;</span>,
   <span class="hljs-string">&#x27;None yet. It has to be reconciled with a vastly different house bill and then passed again.&#x27;</span>,
   <span class="hljs-string">&#x27;Also: does this apply to 2017 taxes? Or does it start with 2018 taxes?&#x27;</span>,
   <span class="hljs-string">&#x27;This article explains both the House and senate bills, including the proposed changes to your income taxes based on your income level. URL_0&#x27;</span>],
  <span class="hljs-string">&#x27;score&#x27;</span>: [<span class="hljs-number">21</span>, <span class="hljs-number">19</span>, <span class="hljs-number">5</span>, <span class="hljs-number">3</span>],
  <span class="hljs-string">&#x27;text_urls&#x27;</span>: [[],
   [],
   [],
   [<span class="hljs-string">&#x27;https://www.investopedia.com/news/trumps-tax-reform-what-can-be-done/&#x27;</span>]]},
 <span class="hljs-string">&#x27;title_urls&#x27;</span>: [<span class="hljs-string">&#x27;url&#x27;</span>],
 <span class="hljs-string">&#x27;selftext_urls&#x27;</span>: [<span class="hljs-string">&#x27;url&#x27;</span>]}`,wrap:!1}}),ie=new Fe({props:{title:"Preprocess",local:"preprocess",headingTag:"h2"}}),me=new Pt({props:{id:"ma1TrR7gE7I"}}),he=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJkaXN0aWxiZXJ0JTJGZGlzdGlsZ3B0MiUyMik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;distilbert/distilgpt2&quot;</span>)`,wrap:!1}}),fe=new C({props:{code:"ZWxpNSUyMCUzRCUyMGVsaTUuZmxhdHRlbigpJTBBZWxpNSU1QiUyMnRyYWluJTIyJTVEJTVCMCU1RA==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>eli5 = eli5.flatten()
<span class="hljs-meta">&gt;&gt;&gt; </span>eli5[<span class="hljs-string">&quot;train&quot;</span>][<span class="hljs-number">0</span>]
{<span class="hljs-string">&#x27;q_id&#x27;</span>: <span class="hljs-string">&#x27;7h191n&#x27;</span>,
 <span class="hljs-string">&#x27;title&#x27;</span>: <span class="hljs-string">&#x27;What does the tax bill that was passed today mean? How will it affect Americans in each tax bracket?&#x27;</span>,
 <span class="hljs-string">&#x27;selftext&#x27;</span>: <span class="hljs-string">&#x27;&#x27;</span>,
 <span class="hljs-string">&#x27;category&#x27;</span>: <span class="hljs-string">&#x27;Economics&#x27;</span>,
 <span class="hljs-string">&#x27;subreddit&#x27;</span>: <span class="hljs-string">&#x27;explainlikeimfive&#x27;</span>,
 <span class="hljs-string">&#x27;answers.a_id&#x27;</span>: [<span class="hljs-string">&#x27;dqnds8l&#x27;</span>, <span class="hljs-string">&#x27;dqnd1jl&#x27;</span>, <span class="hljs-string">&#x27;dqng3i1&#x27;</span>, <span class="hljs-string">&#x27;dqnku5x&#x27;</span>],
 <span class="hljs-string">&#x27;answers.text&#x27;</span>: [<span class="hljs-string">&quot;The tax bill is 500 pages long and there were a lot of changes still going on right to the end. It&#x27;s not just an adjustment to the income tax brackets, it&#x27;s a whole bunch of changes. As such there is no good answer to your question. The big take aways are: - Big reduction in corporate income tax rate will make large companies very happy. - Pass through rate change will make certain styles of business (law firms, hedge funds) extremely happy - Income tax changes are moderate, and are set to expire (though it&#x27;s the kind of thing that might just always get re-applied without being made permanent) - People in high tax states (California, New York) lose out, and many of them will end up with their taxes raised.&quot;</span>,
  <span class="hljs-string">&#x27;None yet. It has to be reconciled with a vastly different house bill and then passed again.&#x27;</span>,
  <span class="hljs-string">&#x27;Also: does this apply to 2017 taxes? Or does it start with 2018 taxes?&#x27;</span>,
  <span class="hljs-string">&#x27;This article explains both the House and senate bills, including the proposed changes to your income taxes based on your income level. URL_0&#x27;</span>],
 <span class="hljs-string">&#x27;answers.score&#x27;</span>: [<span class="hljs-number">21</span>, <span class="hljs-number">19</span>, <span class="hljs-number">5</span>, <span class="hljs-number">3</span>],
 <span class="hljs-string">&#x27;answers.text_urls&#x27;</span>: [[],
  [],
  [],
  [<span class="hljs-string">&#x27;https://www.investopedia.com/news/trumps-tax-reform-what-can-be-done/&#x27;</span>]],
 <span class="hljs-string">&#x27;title_urls&#x27;</span>: [<span class="hljs-string">&#x27;url&#x27;</span>],
 <span class="hljs-string">&#x27;selftext_urls&#x27;</span>: [<span class="hljs-string">&#x27;url&#x27;</span>]}`,wrap:!1}}),ye=new C({props:{code:"ZGVmJTIwcHJlcHJvY2Vzc19mdW5jdGlvbihleGFtcGxlcyklM0ElMEElMjAlMjAlMjAlMjByZXR1cm4lMjB0b2tlbml6ZXIoJTVCJTIyJTIwJTIyLmpvaW4oeCklMjBmb3IlMjB4JTIwaW4lMjBleGFtcGxlcyU1QiUyMmFuc3dlcnMudGV4dCUyMiU1RCU1RCk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">preprocess_function</span>(<span class="hljs-params">examples</span>):
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> tokenizer([<span class="hljs-string">&quot; &quot;</span>.join(x) <span class="hljs-keyword">for</span> x <span class="hljs-keyword">in</span> examples[<span class="hljs-string">&quot;answers.text&quot;</span>]])`,wrap:!1}}),we=new C({props:{code:"dG9rZW5pemVkX2VsaTUlMjAlM0QlMjBlbGk1Lm1hcCglMEElMjAlMjAlMjAlMjBwcmVwcm9jZXNzX2Z1bmN0aW9uJTJDJTBBJTIwJTIwJTIwJTIwYmF0Y2hlZCUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjBudW1fcHJvYyUzRDQlMkMlMEElMjAlMjAlMjAlMjByZW1vdmVfY29sdW1ucyUzRGVsaTUlNUIlMjJ0cmFpbiUyMiU1RC5jb2x1bW5fbmFtZXMlMkMlMEEp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>tokenized_eli5 = eli5.<span class="hljs-built_in">map</span>(
<span class="hljs-meta">... </span>    preprocess_function,
<span class="hljs-meta">... </span>    batched=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>    num_proc=<span class="hljs-number">4</span>,
<span class="hljs-meta">... </span>    remove_columns=eli5[<span class="hljs-string">&quot;train&quot;</span>].column_names,
<span class="hljs-meta">... </span>)`,wrap:!1}}),Te=new C({props:{code:"YmxvY2tfc2l6ZSUyMCUzRCUyMDEyOCUwQSUwQSUwQWRlZiUyMGdyb3VwX3RleHRzKGV4YW1wbGVzKSUzQSUwQSUyMCUyMCUyMCUyMCUyMyUyMENvbmNhdGVuYXRlJTIwYWxsJTIwdGV4dHMuJTBBJTIwJTIwJTIwJTIwY29uY2F0ZW5hdGVkX2V4YW1wbGVzJTIwJTNEJTIwJTdCayUzQSUyMHN1bShleGFtcGxlcyU1QmslNUQlMkMlMjAlNUIlNUQpJTIwZm9yJTIwayUyMGluJTIwZXhhbXBsZXMua2V5cygpJTdEJTBBJTIwJTIwJTIwJTIwdG90YWxfbGVuZ3RoJTIwJTNEJTIwbGVuKGNvbmNhdGVuYXRlZF9leGFtcGxlcyU1Qmxpc3QoZXhhbXBsZXMua2V5cygpKSU1QjAlNUQlNUQpJTBBJTIwJTIwJTIwJTIwJTIzJTIwV2UlMjBkcm9wJTIwdGhlJTIwc21hbGwlMjByZW1haW5kZXIlMkMlMjB3ZSUyMGNvdWxkJTIwYWRkJTIwcGFkZGluZyUyMGlmJTIwdGhlJTIwbW9kZWwlMjBzdXBwb3J0ZWQlMjBpdCUyMGluc3RlYWQlMjBvZiUyMHRoaXMlMjBkcm9wJTJDJTIweW91JTIwY2FuJTBBJTIwJTIwJTIwJTIwJTIzJTIwY3VzdG9taXplJTIwdGhpcyUyMHBhcnQlMjB0byUyMHlvdXIlMjBuZWVkcy4lMEElMjAlMjAlMjAlMjBpZiUyMHRvdGFsX2xlbmd0aCUyMCUzRSUzRCUyMGJsb2NrX3NpemUlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjB0b3RhbF9sZW5ndGglMjAlM0QlMjAodG90YWxfbGVuZ3RoJTIwJTJGJTJGJTIwYmxvY2tfc2l6ZSklMjAqJTIwYmxvY2tfc2l6ZSUwQSUyMCUyMCUyMCUyMCUyMyUyMFNwbGl0JTIwYnklMjBjaHVua3MlMjBvZiUyMGJsb2NrX3NpemUuJTBBJTIwJTIwJTIwJTIwcmVzdWx0JTIwJTNEJTIwJTdCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwayUzQSUyMCU1QnQlNUJpJTIwJTNBJTIwaSUyMCUyQiUyMGJsb2NrX3NpemUlNUQlMjBmb3IlMjBpJTIwaW4lMjByYW5nZSgwJTJDJTIwdG90YWxfbGVuZ3RoJTJDJTIwYmxvY2tfc2l6ZSklNUQlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBmb3IlMjBrJTJDJTIwdCUyMGluJTIwY29uY2F0ZW5hdGVkX2V4YW1wbGVzLml0ZW1zKCklMEElMjAlMjAlMjAlMjAlN0QlMEElMjAlMjAlMjAlMjByZXN1bHQlNUIlMjJsYWJlbHMlMjIlNUQlMjAlM0QlMjByZXN1bHQlNUIlMjJpbnB1dF9pZHMlMjIlNUQuY29weSgpJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwcmVzdWx0",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>block_size = <span class="hljs-number">128</span>


<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">group_texts</span>(<span class="hljs-params">examples</span>):
<span class="hljs-meta">... </span>    <span class="hljs-comment"># Concatenate all texts.</span>
<span class="hljs-meta">... </span>    concatenated_examples = {k: <span class="hljs-built_in">sum</span>(examples[k], []) <span class="hljs-keyword">for</span> k <span class="hljs-keyword">in</span> examples.keys()}
<span class="hljs-meta">... </span>    total_length = <span class="hljs-built_in">len</span>(concatenated_examples[<span class="hljs-built_in">list</span>(examples.keys())[<span class="hljs-number">0</span>]])
<span class="hljs-meta">... </span>    <span class="hljs-comment"># We drop the small remainder, we could add padding if the model supported it instead of this drop, you can</span>
<span class="hljs-meta">... </span>    <span class="hljs-comment"># customize this part to your needs.</span>
<span class="hljs-meta">... </span>    <span class="hljs-keyword">if</span> total_length &gt;= block_size:
<span class="hljs-meta">... </span>        total_length = (total_length // block_size) * block_size
<span class="hljs-meta">... </span>    <span class="hljs-comment"># Split by chunks of block_size.</span>
<span class="hljs-meta">... </span>    result = {
<span class="hljs-meta">... </span>        k: [t[i : i + block_size] <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> <span class="hljs-built_in">range</span>(<span class="hljs-number">0</span>, total_length, block_size)]
<span class="hljs-meta">... </span>        <span class="hljs-keyword">for</span> k, t <span class="hljs-keyword">in</span> concatenated_examples.items()
<span class="hljs-meta">... </span>    }
<span class="hljs-meta">... </span>    result[<span class="hljs-string">&quot;labels&quot;</span>] = result[<span class="hljs-string">&quot;input_ids&quot;</span>].copy()
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> result`,wrap:!1}}),Je=new C({props:{code:"bG1fZGF0YXNldCUyMCUzRCUyMHRva2VuaXplZF9lbGk1Lm1hcChncm91cF90ZXh0cyUyQyUyMGJhdGNoZWQlM0RUcnVlJTJDJTIwbnVtX3Byb2MlM0Q0KQ==",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>lm_dataset = tokenized_eli5.<span class="hljs-built_in">map</span>(group_texts, batched=<span class="hljs-literal">True</span>, num_proc=<span class="hljs-number">4</span>)',wrap:!1}}),D=new Jt({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[cs],pytorch:[is]},$$scope:{ctx:U}}}),_e=new Fe({props:{title:"Train",local:"train",headingTag:"h2"}}),K=new Jt({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[ys],pytorch:[fs]},$$scope:{ctx:U}}}),O=new xt({props:{$$slots:{default:[Ms]},$$scope:{ctx:U}}}),Ue=new Fe({props:{title:"Inference",local:"inference",headingTag:"h2"}}),Ze=new C({props:{code:"cHJvbXB0JTIwJTNEJTIwJTIyU29tYXRpYyUyMGh5cGVybXV0YXRpb24lMjBhbGxvd3MlMjB0aGUlMjBpbW11bmUlMjBzeXN0ZW0lMjB0byUyMg==",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;Somatic hypermutation allows the immune system to&quot;</span>',wrap:!1}}),Ie=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBZ2VuZXJhdG9yJTIwJTNEJTIwcGlwZWxpbmUoJTIydGV4dC1nZW5lcmF0aW9uJTIyJTJDJTIwbW9kZWwlM0QlMjJ1c2VybmFtZSUyRm15X2F3ZXNvbWVfZWxpNV9jbG0tbW9kZWwlMjIpJTBBZ2VuZXJhdG9yKHByb21wdCk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

<span class="hljs-meta">&gt;&gt;&gt; </span>generator = pipeline(<span class="hljs-string">&quot;text-generation&quot;</span>, model=<span class="hljs-string">&quot;username/my_awesome_eli5_clm-model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>generator(prompt)
[{<span class="hljs-string">&#x27;generated_text&#x27;</span>: <span class="hljs-string">&quot;Somatic hypermutation allows the immune system to be able to effectively reverse the damage caused by an infection.\\n\\n\\nThe damage caused by an infection is caused by the immune system&#x27;s ability to perform its own self-correcting tasks.&quot;</span>}]`,wrap:!1}}),ee=new Jt({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[js],pytorch:[bs]},$$scope:{ctx:U}}}),We=new rs({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/tasks/language_modeling.md"}}),{c(){t=$("meta"),c=p(),s=$("p"),m=p(),d(f.$$.fragment),u=p(),d(v.$$.fragment),I=p(),G=$("p"),G.textContent=R,Z=p(),d(X.$$.fragment),W=p(),J=$("p"),J.textContent=V,r=p(),x=$("p"),x.textContent=Q,Y=p(),z=$("ol"),z.innerHTML=A,L=p(),d(F.$$.fragment),E=p(),B=$("p"),B.textContent=h,_=p(),d(H.$$.fragment),S=p(),N=$("p"),N.textContent=Ve,P=p(),d(o.$$.fragment),k=p(),d(q.$$.fragment),ze=p(),se=$("p"),se.innerHTML=kt,Be=p(),d(ae.$$.fragment),He=p(),le=$("p"),le.innerHTML=_t,Ye=p(),d(ne.$$.fragment),Ee=p(),re=$("p"),re.textContent=Ut,Qe=p(),d(oe.$$.fragment),Ne=p(),pe=$("p"),pe.innerHTML=vt,Ae=p(),d(ie.$$.fragment),Le=p(),d(me.$$.fragment),qe=p(),ce=$("p"),ce.innerHTML=Gt,Se=p(),d(he.$$.fragment),Pe=p(),ue=$("p"),ue.innerHTML=Zt,De=p(),d(fe.$$.fragment),Ke=p(),de=$("p"),de.innerHTML=Ct,Oe=p(),ge=$("p"),ge.textContent=It,et=p(),d(ye.$$.fragment),tt=p(),Me=$("p"),Me.innerHTML=Wt,st=p(),d(we.$$.fragment),at=p(),be=$("p"),be.textContent=Rt,lt=p(),$e=$("p"),$e.textContent=Vt,nt=p(),je=$("ul"),je.innerHTML=Xt,rt=p(),d(Te.$$.fragment),ot=p(),xe=$("p"),xe.innerHTML=Ft,pt=p(),d(Je.$$.fragment),it=p(),ke=$("p"),ke.innerHTML=zt,mt=p(),d(D.$$.fragment),ct=p(),d(_e.$$.fragment),ht=p(),d(K.$$.fragment),ut=p(),d(O.$$.fragment),ft=p(),d(Ue.$$.fragment),dt=p(),ve=$("p"),ve.textContent=Bt,gt=p(),Ge=$("p"),Ge.textContent=Ht,yt=p(),d(Ze.$$.fragment),Mt=p(),Ce=$("p"),Ce.innerHTML=Yt,wt=p(),d(Ie.$$.fragment),bt=p(),d(ee.$$.fragment),$t=p(),d(We.$$.fragment),jt=p(),Xe=$("p"),this.h()},l(e){const n=ts("svelte-u9bgzb",document.head);t=j(n,"META",{name:!0,content:!0}),n.forEach(a),c=i(e),s=j(e,"P",{}),qt(s).forEach(a),m=i(e),g(f.$$.fragment,e),u=i(e),g(v.$$.fragment,e),I=i(e),G=j(e,"P",{"data-svelte-h":!0}),T(G)!=="svelte-1j29ona"&&(G.textContent=R),Z=i(e),g(X.$$.fragment,e),W=i(e),J=j(e,"P",{"data-svelte-h":!0}),T(J)!=="svelte-nw6q3g"&&(J.textContent=V),r=i(e),x=j(e,"P",{"data-svelte-h":!0}),T(x)!=="svelte-1aff4p7"&&(x.textContent=Q),Y=i(e),z=j(e,"OL",{"data-svelte-h":!0}),T(z)!=="svelte-27cdvu"&&(z.innerHTML=A),L=i(e),g(F.$$.fragment,e),E=i(e),B=j(e,"P",{"data-svelte-h":!0}),T(B)!=="svelte-1c9nexd"&&(B.textContent=h),_=i(e),g(H.$$.fragment,e),S=i(e),N=j(e,"P",{"data-svelte-h":!0}),T(N)!=="svelte-27hn0u"&&(N.textContent=Ve),P=i(e),g(o.$$.fragment,e),k=i(e),g(q.$$.fragment,e),ze=i(e),se=j(e,"P",{"data-svelte-h":!0}),T(se)!=="svelte-1172m8d"&&(se.innerHTML=kt),Be=i(e),g(ae.$$.fragment,e),He=i(e),le=j(e,"P",{"data-svelte-h":!0}),T(le)!=="svelte-rugbz4"&&(le.innerHTML=_t),Ye=i(e),g(ne.$$.fragment,e),Ee=i(e),re=j(e,"P",{"data-svelte-h":!0}),T(re)!=="svelte-1m91ua0"&&(re.textContent=Ut),Qe=i(e),g(oe.$$.fragment,e),Ne=i(e),pe=j(e,"P",{"data-svelte-h":!0}),T(pe)!=="svelte-1wm9gdc"&&(pe.innerHTML=vt),Ae=i(e),g(ie.$$.fragment,e),Le=i(e),g(me.$$.fragment,e),qe=i(e),ce=j(e,"P",{"data-svelte-h":!0}),T(ce)!=="svelte-1lrcpa6"&&(ce.innerHTML=Gt),Se=i(e),g(he.$$.fragment,e),Pe=i(e),ue=j(e,"P",{"data-svelte-h":!0}),T(ue)!=="svelte-1tms5jm"&&(ue.innerHTML=Zt),De=i(e),g(fe.$$.fragment,e),Ke=i(e),de=j(e,"P",{"data-svelte-h":!0}),T(de)!=="svelte-1mdv3gu"&&(de.innerHTML=Ct),Oe=i(e),ge=j(e,"P",{"data-svelte-h":!0}),T(ge)!=="svelte-njkc6i"&&(ge.textContent=It),et=i(e),g(ye.$$.fragment,e),tt=i(e),Me=j(e,"P",{"data-svelte-h":!0}),T(Me)!=="svelte-1xbgtq4"&&(Me.innerHTML=Wt),st=i(e),g(we.$$.fragment,e),at=i(e),be=j(e,"P",{"data-svelte-h":!0}),T(be)!=="svelte-pz0l04"&&(be.textContent=Rt),lt=i(e),$e=j(e,"P",{"data-svelte-h":!0}),T($e)!=="svelte-5guq64"&&($e.textContent=Vt),nt=i(e),je=j(e,"UL",{"data-svelte-h":!0}),T(je)!=="svelte-19gyadw"&&(je.innerHTML=Xt),rt=i(e),g(Te.$$.fragment,e),ot=i(e),xe=j(e,"P",{"data-svelte-h":!0}),T(xe)!=="svelte-1o69amy"&&(xe.innerHTML=Ft),pt=i(e),g(Je.$$.fragment,e),it=i(e),ke=j(e,"P",{"data-svelte-h":!0}),T(ke)!=="svelte-ghlfnb"&&(ke.innerHTML=zt),mt=i(e),g(D.$$.fragment,e),ct=i(e),g(_e.$$.fragment,e),ht=i(e),g(K.$$.fragment,e),ut=i(e),g(O.$$.fragment,e),ft=i(e),g(Ue.$$.fragment,e),dt=i(e),ve=j(e,"P",{"data-svelte-h":!0}),T(ve)!=="svelte-633ppb"&&(ve.textContent=Bt),gt=i(e),Ge=j(e,"P",{"data-svelte-h":!0}),T(Ge)!=="svelte-12i1768"&&(Ge.textContent=Ht),yt=i(e),g(Ze.$$.fragment,e),Mt=i(e),Ce=j(e,"P",{"data-svelte-h":!0}),T(Ce)!=="svelte-1t6v145"&&(Ce.innerHTML=Yt),wt=i(e),g(Ie.$$.fragment,e),bt=i(e),g(ee.$$.fragment,e),$t=i(e),g(We.$$.fragment,e),jt=i(e),Xe=j(e,"P",{}),qt(Xe).forEach(a),this.h()},h(){St(t,"name","hf:doc:metadata"),St(t,"content",xs)},m(e,n){ss(document.head,t),l(e,c,n),l(e,s,n),l(e,m,n),y(f,e,n),l(e,u,n),y(v,e,n),l(e,I,n),l(e,G,n),l(e,Z,n),y(X,e,n),l(e,W,n),l(e,J,n),l(e,r,n),l(e,x,n),l(e,Y,n),l(e,z,n),l(e,L,n),y(F,e,n),l(e,E,n),l(e,B,n),l(e,_,n),y(H,e,n),l(e,S,n),l(e,N,n),l(e,P,n),y(o,e,n),l(e,k,n),y(q,e,n),l(e,ze,n),l(e,se,n),l(e,Be,n),y(ae,e,n),l(e,He,n),l(e,le,n),l(e,Ye,n),y(ne,e,n),l(e,Ee,n),l(e,re,n),l(e,Qe,n),y(oe,e,n),l(e,Ne,n),l(e,pe,n),l(e,Ae,n),y(ie,e,n),l(e,Le,n),y(me,e,n),l(e,qe,n),l(e,ce,n),l(e,Se,n),y(he,e,n),l(e,Pe,n),l(e,ue,n),l(e,De,n),y(fe,e,n),l(e,Ke,n),l(e,de,n),l(e,Oe,n),l(e,ge,n),l(e,et,n),y(ye,e,n),l(e,tt,n),l(e,Me,n),l(e,st,n),y(we,e,n),l(e,at,n),l(e,be,n),l(e,lt,n),l(e,$e,n),l(e,nt,n),l(e,je,n),l(e,rt,n),y(Te,e,n),l(e,ot,n),l(e,xe,n),l(e,pt,n),y(Je,e,n),l(e,it,n),l(e,ke,n),l(e,mt,n),y(D,e,n),l(e,ct,n),y(_e,e,n),l(e,ht,n),y(K,e,n),l(e,ut,n),y(O,e,n),l(e,ft,n),y(Ue,e,n),l(e,dt,n),l(e,ve,n),l(e,gt,n),l(e,Ge,n),l(e,yt,n),y(Ze,e,n),l(e,Mt,n),l(e,Ce,n),l(e,wt,n),y(Ie,e,n),l(e,bt,n),y(ee,e,n),l(e,$t,n),y(We,e,n),l(e,jt,n),l(e,Xe,n),Tt=!0},p(e,[n]){const Et={};n&2&&(Et.$$scope={dirty:n,ctx:e}),F.$set(Et);const Qt={};n&2&&(Qt.$$scope={dirty:n,ctx:e}),D.$set(Qt);const Nt={};n&2&&(Nt.$$scope={dirty:n,ctx:e}),K.$set(Nt);const At={};n&2&&(At.$$scope={dirty:n,ctx:e}),O.$set(At);const Lt={};n&2&&(Lt.$$scope={dirty:n,ctx:e}),ee.$set(Lt)},i(e){Tt||(M(f.$$.fragment,e),M(v.$$.fragment,e),M(X.$$.fragment,e),M(F.$$.fragment,e),M(H.$$.fragment,e),M(o.$$.fragment,e),M(q.$$.fragment,e),M(ae.$$.fragment,e),M(ne.$$.fragment,e),M(oe.$$.fragment,e),M(ie.$$.fragment,e),M(me.$$.fragment,e),M(he.$$.fragment,e),M(fe.$$.fragment,e),M(ye.$$.fragment,e),M(we.$$.fragment,e),M(Te.$$.fragment,e),M(Je.$$.fragment,e),M(D.$$.fragment,e),M(_e.$$.fragment,e),M(K.$$.fragment,e),M(O.$$.fragment,e),M(Ue.$$.fragment,e),M(Ze.$$.fragment,e),M(Ie.$$.fragment,e),M(ee.$$.fragment,e),M(We.$$.fragment,e),Tt=!0)},o(e){w(f.$$.fragment,e),w(v.$$.fragment,e),w(X.$$.fragment,e),w(F.$$.fragment,e),w(H.$$.fragment,e),w(o.$$.fragment,e),w(q.$$.fragment,e),w(ae.$$.fragment,e),w(ne.$$.fragment,e),w(oe.$$.fragment,e),w(ie.$$.fragment,e),w(me.$$.fragment,e),w(he.$$.fragment,e),w(fe.$$.fragment,e),w(ye.$$.fragment,e),w(we.$$.fragment,e),w(Te.$$.fragment,e),w(Je.$$.fragment,e),w(D.$$.fragment,e),w(_e.$$.fragment,e),w(K.$$.fragment,e),w(O.$$.fragment,e),w(Ue.$$.fragment,e),w(Ze.$$.fragment,e),w(Ie.$$.fragment,e),w(ee.$$.fragment,e),w(We.$$.fragment,e),Tt=!1},d(e){e&&(a(c),a(s),a(m),a(u),a(I),a(G),a(Z),a(W),a(J),a(r),a(x),a(Y),a(z),a(L),a(E),a(B),a(_),a(S),a(N),a(P),a(k),a(ze),a(se),a(Be),a(He),a(le),a(Ye),a(Ee),a(re),a(Qe),a(Ne),a(pe),a(Ae),a(Le),a(qe),a(ce),a(Se),a(Pe),a(ue),a(De),a(Ke),a(de),a(Oe),a(ge),a(et),a(tt),a(Me),a(st),a(at),a(be),a(lt),a($e),a(nt),a(je),a(rt),a(ot),a(xe),a(pt),a(it),a(ke),a(mt),a(ct),a(ht),a(ut),a(ft),a(dt),a(ve),a(gt),a(Ge),a(yt),a(Mt),a(Ce),a(wt),a(bt),a($t),a(jt),a(Xe)),a(t),b(f,e),b(v,e),b(X,e),b(F,e),b(H,e),b(o,e),b(q,e),b(ae,e),b(ne,e),b(oe,e),b(ie,e),b(me,e),b(he,e),b(fe,e),b(ye,e),b(we,e),b(Te,e),b(Je,e),b(D,e),b(_e,e),b(K,e),b(O,e),b(Ue,e),b(Ze,e),b(Ie,e),b(ee,e),b(We,e)}}}const xs='{"title":"Causal language modeling","local":"causal-language-modeling","sections":[{"title":"Load ELI5 dataset","local":"load-eli5-dataset","sections":[],"depth":2},{"title":"Preprocess","local":"preprocess","sections":[],"depth":2},{"title":"Train","local":"train","sections":[],"depth":2},{"title":"Inference","local":"inference","sections":[],"depth":2}],"depth":1}';function Js(U){return Kt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Rs extends Ot{constructor(t){super(),es(this,t,Js,Ts,Dt,{})}}export{Rs as component};
