import{s as Dt,o as Kt,n as ts}from"../chunks/scheduler.9bc65507.js";import{S as Ot,i as se,g as b,s as o,r as g,A as te,h as w,f as l,c as i,j as qt,u as d,x as T,k as St,y as ee,a,v as M,d as y,t as $,w as j,m as le,n as ae}from"../chunks/index.707bf1b6.js";import{T as Jt}from"../chunks/Tip.c2ecdbf4.js";import{Y as Pt}from"../chunks/Youtube.e1129c6f.js";import{C as Z}from"../chunks/CodeBlock.54a9f38d.js";import{D as ne}from"../chunks/DocNotebookDropdown.41f65cb5.js";import{F as _t,M as Rs}from"../chunks/Markdown.8ab98a13.js";import{H as Fs,E as pe}from"../chunks/EditOnGithub.922df6ba.js";function re(U){let t,c='このタスクと互換性のあるすべてのアーキテクチャとチェックポイントを確認するには、<a href="https://huggingface.co/tasks/text-generation" rel="nofollow">タスクページ</a> を確認することをお勧めします。u';return{c(){t=b("p"),t.innerHTML=c},l(e){t=w(e,"P",{"data-svelte-h":!0}),T(t)!=="svelte-z9ahjf"&&(t.innerHTML=c)},m(e,m){a(e,t,m)},p:ts,d(e){e&&l(t)}}}function oe(U){let t,c="シーケンス終了トークンをパディング トークンとして使用し、<code>mlm=False</code> を設定します。これは、入力を 1 要素分右にシフトしたラベルとして使用します。",e,m,h;return m=new Z({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=b("p"),t.innerHTML=c,e=o(),g(m.$$.fragment)},l(u){t=w(u,"P",{"data-svelte-h":!0}),T(t)!=="svelte-1fnpddk"&&(t.innerHTML=c),e=i(u),d(m.$$.fragment,u)},m(u,v){a(u,t,v),a(u,e,v),M(m,u,v),h=!0},p:ts,i(u){h||(y(m.$$.fragment,u),h=!0)},o(u){$(m.$$.fragment,u),h=!1},d(u){u&&(l(t),l(e)),j(m,u)}}}function ie(U){let t,c;return t=new Rs({props:{$$slots:{default:[oe]},$$scope:{ctx:U}}}),{c(){g(t.$$.fragment)},l(e){d(t.$$.fragment,e)},m(e,m){M(t,e,m),c=!0},p(e,m){const h={};m&2&&(h.$$scope={dirty:m,ctx:e}),t.$set(h)},i(e){c||(y(t.$$.fragment,e),c=!0)},o(e){$(t.$$.fragment,e),c=!1},d(e){j(t,e)}}}function me(U){let t,c="シーケンス終了トークンをパディング トークンとして使用し、<code>mlm=False</code> を設定します。これは、入力を 1 要素分右にシフトしたラベルとして使用します。",e,m,h;return m=new Z({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=b("p"),t.innerHTML=c,e=o(),g(m.$$.fragment)},l(u){t=w(u,"P",{"data-svelte-h":!0}),T(t)!=="svelte-1fnpddk"&&(t.innerHTML=c),e=i(u),d(m.$$.fragment,u)},m(u,v){a(u,t,v),a(u,e,v),M(m,u,v),h=!0},p:ts,i(u){h||(y(m.$$.fragment,u),h=!0)},o(u){$(m.$$.fragment,u),h=!1},d(u){u&&(l(t),l(e)),j(m,u)}}}function ce(U){let t,c;return t=new Rs({props:{$$slots:{default:[me]},$$scope:{ctx:U}}}),{c(){g(t.$$.fragment)},l(e){d(t.$$.fragment,e)},m(e,m){M(t,e,m),c=!0},p(e,m){const h={};m&2&&(h.$$scope={dirty:m,ctx:e}),t.$set(h)},i(e){c||(y(t.$$.fragment,e),c=!0)},o(e){$(t.$$.fragment,e),c=!1},d(e){j(t,e)}}}function fe(U){let t,c='<a href="/docs/transformers/pr_30674/ja/main_classes/trainer#transformers.Trainer">Trainer</a> を使用したモデルの微調整に慣れていない場合は、<a href="../training#train-with-pytorch-trainer">基本チュートリアル</a> を参照してください。';return{c(){t=b("p"),t.innerHTML=c},l(e){t=w(e,"P",{"data-svelte-h":!0}),T(t)!=="svelte-1448p37"&&(t.innerHTML=c)},m(e,m){a(e,t,m)},p:ts,d(e){e&&l(t)}}}function ue(U){let t,c,e,m='これでモデルのトレーニングを開始する準備が整いました。 <a href="/docs/transformers/pr_30674/ja/model_doc/auto#transformers.AutoModelForCausalLM">AutoModelForCausalLM</a> を使用して DistilGPT2 をロードします。',h,u,v,I,G="この時点で残っている手順は次の 3 つだけです。",R,C,X='<li><a href="/docs/transformers/pr_30674/ja/main_classes/trainer#transformers.TrainingArguments">TrainingArguments</a> でトレーニング ハイパーパラメータを定義します。唯一の必須パラメータは、モデルの保存場所を指定する <code>output_dir</code> です。 <code>push_to_hub=True</code>を設定して、このモデルをハブにプッシュします (モデルをアップロードするには、Hugging Face にサインインする必要があります)。</li> <li>トレーニング引数をモデル、データセット、データ照合器とともに <a href="/docs/transformers/pr_30674/ja/main_classes/trainer#transformers.Trainer">Trainer</a> に渡します。</li> <li><a href="/docs/transformers/pr_30674/ja/main_classes/trainer#transformers.Trainer.train">train()</a> を呼び出してモデルを微調整します。</li>',W,_,V,p,J='トレーニングが完了したら、 <a href="/docs/transformers/pr_30674/ja/main_classes/trainer#transformers.Trainer.evaluate">evaluate()</a> メソッドを使用してモデルを評価し、その複雑さを取得します。',Q,Y,z,N,L='次に、 <a href="/docs/transformers/pr_30674/ja/main_classes/trainer#transformers.Trainer.push_to_hub">push_to_hub()</a> メソッドを使用してモデルをハブに共有し、誰もがモデルを使用できるようにします。',F,E,B;return t=new Jt({props:{$$slots:{default:[fe]},$$scope:{ctx:U}}}),u=new Z({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}}),_=new Z({props:{code:"dHJhaW5pbmdfYXJncyUyMCUzRCUyMFRyYWluaW5nQXJndW1lbnRzKCUwQSUyMCUyMCUyMCUyMG91dHB1dF9kaXIlM0QlMjJteV9hd2Vzb21lX2VsaTVfY2xtLW1vZGVsJTIyJTJDJTBBJTIwJTIwJTIwJTIwZXZhbF9zdHJhdGVneSUzRCUyMmVwb2NoJTIyJTJDJTBBJTIwJTIwJTIwJTIwbGVhcm5pbmdfcmF0ZSUzRDJlLTUlMkMlMEElMjAlMjAlMjAlMjB3ZWlnaHRfZGVjYXklM0QwLjAxJTJDJTBBJTIwJTIwJTIwJTIwcHVzaF90b19odWIlM0RUcnVlJTJDJTBBKSUwQSUwQXRyYWluZXIlMjAlM0QlMjBUcmFpbmVyKCUwQSUyMCUyMCUyMCUyMG1vZGVsJTNEbW9kZWwlMkMlMEElMjAlMjAlMjAlMjBhcmdzJTNEdHJhaW5pbmdfYXJncyUyQyUwQSUyMCUyMCUyMCUyMHRyYWluX2RhdGFzZXQlM0RsbV9kYXRhc2V0JTVCJTIydHJhaW4lMjIlNUQlMkMlMEElMjAlMjAlMjAlMjBldmFsX2RhdGFzZXQlM0RsbV9kYXRhc2V0JTVCJTIydGVzdCUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMGRhdGFfY29sbGF0b3IlM0RkYXRhX2NvbGxhdG9yJTJDJTBBKSUwQSUwQXRyYWluZXIudHJhaW4oKQ==",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>)

<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.train()`,wrap:!1}}),Y=new Z({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 Z({props:{code:"dHJhaW5lci5wdXNoX3RvX2h1Yigp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.push_to_hub()',wrap:!1}}),{c(){g(t.$$.fragment),c=o(),e=b("p"),e.innerHTML=m,h=o(),g(u.$$.fragment),v=o(),I=b("p"),I.textContent=G,R=o(),C=b("ol"),C.innerHTML=X,W=o(),g(_.$$.fragment),V=o(),p=b("p"),p.innerHTML=J,Q=o(),g(Y.$$.fragment),z=o(),N=b("p"),N.innerHTML=L,F=o(),g(E.$$.fragment)},l(f){d(t.$$.fragment,f),c=i(f),e=w(f,"P",{"data-svelte-h":!0}),T(e)!=="svelte-1wb2w53"&&(e.innerHTML=m),h=i(f),d(u.$$.fragment,f),v=i(f),I=w(f,"P",{"data-svelte-h":!0}),T(I)!=="svelte-1j8bgyv"&&(I.textContent=G),R=i(f),C=w(f,"OL",{"data-svelte-h":!0}),T(C)!=="svelte-kvgd5i"&&(C.innerHTML=X),W=i(f),d(_.$$.fragment,f),V=i(f),p=w(f,"P",{"data-svelte-h":!0}),T(p)!=="svelte-hcje07"&&(p.innerHTML=J),Q=i(f),d(Y.$$.fragment,f),z=i(f),N=w(f,"P",{"data-svelte-h":!0}),T(N)!=="svelte-1um4wug"&&(N.innerHTML=L),F=i(f),d(E.$$.fragment,f)},m(f,k){M(t,f,k),a(f,c,k),a(f,e,k),a(f,h,k),M(u,f,k),a(f,v,k),a(f,I,k),a(f,R,k),a(f,C,k),a(f,W,k),M(_,f,k),a(f,V,k),a(f,p,k),a(f,Q,k),M(Y,f,k),a(f,z,k),a(f,N,k),a(f,F,k),M(E,f,k),B=!0},p(f,k){const H={};k&2&&(H.$$scope={dirty:k,ctx:f}),t.$set(H)},i(f){B||(y(t.$$.fragment,f),y(u.$$.fragment,f),y(_.$$.fragment,f),y(Y.$$.fragment,f),y(E.$$.fragment,f),B=!0)},o(f){$(t.$$.fragment,f),$(u.$$.fragment,f),$(_.$$.fragment,f),$(Y.$$.fragment,f),$(E.$$.fragment,f),B=!1},d(f){f&&(l(c),l(e),l(h),l(v),l(I),l(R),l(C),l(W),l(V),l(p),l(Q),l(z),l(N),l(F)),j(t,f),j(u,f),j(_,f),j(Y,f),j(E,f)}}}function he(U){let t,c;return t=new Rs({props:{$$slots:{default:[ue]},$$scope:{ctx:U}}}),{c(){g(t.$$.fragment)},l(e){d(t.$$.fragment,e)},m(e,m){M(t,e,m),c=!0},p(e,m){const h={};m&2&&(h.$$scope={dirty:m,ctx:e}),t.$set(h)},i(e){c||(y(t.$$.fragment,e),c=!0)},o(e){$(t.$$.fragment,e),c=!1},d(e){j(t,e)}}}function ge(U){let t,c='Keras を使用したモデルの微調整に慣れていない場合は、<a href="../training#train-a-tensorflow-model-with-keras">基本チュートリアル</a> をご覧ください。';return{c(){t=b("p"),t.innerHTML=c},l(e){t=w(e,"P",{"data-svelte-h":!0}),T(t)!=="svelte-12i88xp"&&(t.innerHTML=c)},m(e,m){a(e,t,m)},p:ts,d(e){e&&l(t)}}}function de(U){let t,c,e,m,h,u='次に、<a href="/docs/transformers/pr_30674/ja/model_doc/auto#transformers.TFAutoModelForCausalLM">TFAutoModelForCausalLM</a> を使用して DistilGPT2 をロードできます。',v,I,G,R,C='<a href="/docs/transformers/pr_30674/ja/main_classes/model#transformers.TFPreTrainedModel.prepare_tf_dataset">prepare_tf_dataset()</a> を使用して、データセットを <code>tf.data.Dataset</code> 形式に変換します。',X,W,_,V,p='<a href="https://keras.io/api/models/model_training_apis/#compile-method" rel="nofollow"><code>compile</code></a> を使用してトレーニング用のモデルを設定します。 Transformers モデルにはすべてデフォルトのタスク関連の損失関数があるため、次の場合を除き、損失関数を指定する必要はないことに注意してください。',J,Q,Y,z,N='これは、モデルとトークナイザーを <a href="/docs/transformers/pr_30674/ja/main_classes/keras_callbacks#transformers.PushToHubCallback">PushToHubCallback</a> でプッシュする場所を指定することで実行できます。',L,F,E,B,f='ついに、モデルのトレーニングを開始する準備が整いました。トレーニングおよび検証データセット、エポック数、コールバックを指定して <a href="https://keras.io/api/models/model_training_apis/#fit-method" rel="nofollow"><code>fit</code></a> を呼び出し、モデルを微調整します。',k,H,S,A,Vs="トレーニングが完了すると、モデルは自動的にハブにアップロードされ、誰でも使用できるようになります。",P;return t=new Jt({props:{$$slots:{default:[ge]},$$scope:{ctx:U}}}),e=new Z({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 Z({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 Z({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 Z({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 Z({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 Z({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(){g(t.$$.fragment),c=le(`
TensorFlow でモデルを微調整するには、オプティマイザー関数、学習率スケジュール、およびいくつかのトレーニング ハイパーパラメーターをセットアップすることから始めます。

	`),g(e.$$.fragment),m=o(),h=b("p"),h.innerHTML=u,v=o(),g(I.$$.fragment),G=o(),R=b("p"),R.innerHTML=C,X=o(),g(W.$$.fragment),_=o(),V=b("p"),V.innerHTML=p,J=o(),g(Q.$$.fragment),Y=o(),z=b("p"),z.innerHTML=N,L=o(),g(F.$$.fragment),E=o(),B=b("p"),B.innerHTML=f,k=o(),g(H.$$.fragment),S=o(),A=b("p"),A.textContent=Vs},l(r){d(t.$$.fragment,r),c=ae(r,`
TensorFlow でモデルを微調整するには、オプティマイザー関数、学習率スケジュール、およびいくつかのトレーニング ハイパーパラメーターをセットアップすることから始めます。

	`),d(e.$$.fragment,r),m=i(r),h=w(r,"P",{"data-svelte-h":!0}),T(h)!=="svelte-1ohzn46"&&(h.innerHTML=u),v=i(r),d(I.$$.fragment,r),G=i(r),R=w(r,"P",{"data-svelte-h":!0}),T(R)!=="svelte-ut1k7a"&&(R.innerHTML=C),X=i(r),d(W.$$.fragment,r),_=i(r),V=w(r,"P",{"data-svelte-h":!0}),T(V)!=="svelte-1pd5few"&&(V.innerHTML=p),J=i(r),d(Q.$$.fragment,r),Y=i(r),z=w(r,"P",{"data-svelte-h":!0}),T(z)!=="svelte-fyr35u"&&(z.innerHTML=N),L=i(r),d(F.$$.fragment,r),E=i(r),B=w(r,"P",{"data-svelte-h":!0}),T(B)!=="svelte-ffgub5"&&(B.innerHTML=f),k=i(r),d(H.$$.fragment,r),S=i(r),A=w(r,"P",{"data-svelte-h":!0}),T(A)!=="svelte-vh7z0v"&&(A.textContent=Vs)},m(r,x){M(t,r,x),a(r,c,x),M(e,r,x),a(r,m,x),a(r,h,x),a(r,v,x),M(I,r,x),a(r,G,x),a(r,R,x),a(r,X,x),M(W,r,x),a(r,_,x),a(r,V,x),a(r,J,x),M(Q,r,x),a(r,Y,x),a(r,z,x),a(r,L,x),M(F,r,x),a(r,E,x),a(r,B,x),a(r,k,x),M(H,r,x),a(r,S,x),a(r,A,x),P=!0},p(r,x){const q={};x&2&&(q.$$scope={dirty:x,ctx:r}),t.$set(q)},i(r){P||(y(t.$$.fragment,r),y(e.$$.fragment,r),y(I.$$.fragment,r),y(W.$$.fragment,r),y(Q.$$.fragment,r),y(F.$$.fragment,r),y(H.$$.fragment,r),P=!0)},o(r){$(t.$$.fragment,r),$(e.$$.fragment,r),$(I.$$.fragment,r),$(W.$$.fragment,r),$(Q.$$.fragment,r),$(F.$$.fragment,r),$(H.$$.fragment,r),P=!1},d(r){r&&(l(c),l(m),l(h),l(v),l(G),l(R),l(X),l(_),l(V),l(J),l(Y),l(z),l(L),l(E),l(B),l(k),l(S),l(A)),j(t,r),j(e,r),j(I,r),j(W,r),j(Q,r),j(F,r),j(H,r)}}}function Me(U){let t,c;return t=new Rs({props:{$$slots:{default:[de]},$$scope:{ctx:U}}}),{c(){g(t.$$.fragment)},l(e){d(t.$$.fragment,e)},m(e,m){M(t,e,m),c=!0},p(e,m){const h={};m&2&&(h.$$scope={dirty:m,ctx:e}),t.$set(h)},i(e){c||(y(t.$$.fragment,e),c=!0)},o(e){$(t.$$.fragment,e),c=!1},d(e){j(t,e)}}}function ye(U){let t,c=`因果言語モデリング用にモデルを微調整する方法のより詳細な例については、対応するドキュメントを参照してください。
<a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling.ipynb" rel="nofollow">PyTorch ノートブック</a>
または <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling-tf.ipynb" rel="nofollow">TensorFlow ノートブック</a>。`;return{c(){t=b("p"),t.innerHTML=c},l(e){t=w(e,"P",{"data-svelte-h":!0}),T(t)!=="svelte-2qmraz"&&(t.innerHTML=c)},m(e,m){a(e,t,m)},p:ts,d(e){e&&l(t)}}}function $e(U){let t,c="テキストをトークン化し、「input_ids」を PyTorch テンソルとして返します。",e,m,h,u,v=`<a href="/docs/transformers/pr_30674/ja/main_classes/text_generation#transformers.GenerationMixin.generate">generate()</a> メソッドを使用してテキストを生成します。
さまざまなテキスト生成戦略と生成を制御するためのパラメーターの詳細については、<a href="../generation_strategies">テキスト生成戦略</a> ページを参照してください。`,I,G,R,C,X="生成されたトークン ID をデコードしてテキストに戻します。",W,_,V;return m=new Z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJteV9hd2Vzb21lX2VsaTVfY2xtLW1vZGVsJTIyKSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplcihwcm9tcHQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKS5pbnB1dF9pZHM=",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;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 Z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTBBJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JDYXVzYWxMTS5mcm9tX3ByZXRyYWluZWQoJTIybXlfYXdlc29tZV9lbGk1X2NsbS1tb2RlbCUyMiklMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoaW5wdXRzJTJDJTIwbWF4X25ld190b2tlbnMlM0QxMDAlMkMlMjBkb19zYW1wbGUlM0RUcnVlJTJDJTIwdG9wX2slM0Q1MCUyQyUyMHRvcF9wJTNEMC45NSk=",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;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}}),_=new Z({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=b("p"),t.textContent=c,e=o(),g(m.$$.fragment),h=o(),u=b("p"),u.innerHTML=v,I=o(),g(G.$$.fragment),R=o(),C=b("p"),C.textContent=X,W=o(),g(_.$$.fragment)},l(p){t=w(p,"P",{"data-svelte-h":!0}),T(t)!=="svelte-oq6k77"&&(t.textContent=c),e=i(p),d(m.$$.fragment,p),h=i(p),u=w(p,"P",{"data-svelte-h":!0}),T(u)!=="svelte-fvncil"&&(u.innerHTML=v),I=i(p),d(G.$$.fragment,p),R=i(p),C=w(p,"P",{"data-svelte-h":!0}),T(C)!=="svelte-izrqac"&&(C.textContent=X),W=i(p),d(_.$$.fragment,p)},m(p,J){a(p,t,J),a(p,e,J),M(m,p,J),a(p,h,J),a(p,u,J),a(p,I,J),M(G,p,J),a(p,R,J),a(p,C,J),a(p,W,J),M(_,p,J),V=!0},p:ts,i(p){V||(y(m.$$.fragment,p),y(G.$$.fragment,p),y(_.$$.fragment,p),V=!0)},o(p){$(m.$$.fragment,p),$(G.$$.fragment,p),$(_.$$.fragment,p),V=!1},d(p){p&&(l(t),l(e),l(h),l(u),l(I),l(R),l(C),l(W)),j(m,p),j(G,p),j(_,p)}}}function je(U){let t,c;return t=new Rs({props:{$$slots:{default:[$e]},$$scope:{ctx:U}}}),{c(){g(t.$$.fragment)},l(e){d(t.$$.fragment,e)},m(e,m){M(t,e,m),c=!0},p(e,m){const h={};m&2&&(h.$$scope={dirty:m,ctx:e}),t.$set(h)},i(e){c||(y(t.$$.fragment,e),c=!0)},o(e){$(t.$$.fragment,e),c=!1},d(e){j(t,e)}}}function be(U){let t,c="テキストをトークン化し、<code>input_ids</code>を TensorFlow テンソルとして返します。",e,m,h,u,v='<code>~transformers.generation_tf_utils.TFGenerationMixin.generate</code> メソッドを使用して要約を作成します。さまざまなテキスト生成戦略と生成を制御するためのパラメーターの詳細については、<a href="../generation_strategies">テキスト生成戦略</a> ページを参照してください。',I,G,R,C,X="生成されたトークン ID をデコードしてテキストに戻します。",W,_,V;return m=new Z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJteV9hd2Vzb21lX2VsaTVfY2xtLW1vZGVsJTIyKSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplcihwcm9tcHQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnRmJTIyKS5pbnB1dF9pZHM=",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;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 Z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGQXV0b01vZGVsRm9yQ2F1c2FsTE0lMEElMEFtb2RlbCUyMCUzRCUyMFRGQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMm15X2F3ZXNvbWVfZWxpNV9jbG0tbW9kZWwlMjIpJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKGlucHV0X2lkcyUzRGlucHV0cyUyQyUyMG1heF9uZXdfdG9rZW5zJTNEMTAwJTJDJTIwZG9fc2FtcGxlJTNEVHJ1ZSUyQyUyMHRvcF9rJTNENTAlMkMlMjB0b3BfcCUzRDAuOTUp",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;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}}),_=new Z({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=b("p"),t.innerHTML=c,e=o(),g(m.$$.fragment),h=o(),u=b("p"),u.innerHTML=v,I=o(),g(G.$$.fragment),R=o(),C=b("p"),C.textContent=X,W=o(),g(_.$$.fragment)},l(p){t=w(p,"P",{"data-svelte-h":!0}),T(t)!=="svelte-pv8irx"&&(t.innerHTML=c),e=i(p),d(m.$$.fragment,p),h=i(p),u=w(p,"P",{"data-svelte-h":!0}),T(u)!=="svelte-1dquw2w"&&(u.innerHTML=v),I=i(p),d(G.$$.fragment,p),R=i(p),C=w(p,"P",{"data-svelte-h":!0}),T(C)!=="svelte-izrqac"&&(C.textContent=X),W=i(p),d(_.$$.fragment,p)},m(p,J){a(p,t,J),a(p,e,J),M(m,p,J),a(p,h,J),a(p,u,J),a(p,I,J),M(G,p,J),a(p,R,J),a(p,C,J),a(p,W,J),M(_,p,J),V=!0},p:ts,i(p){V||(y(m.$$.fragment,p),y(G.$$.fragment,p),y(_.$$.fragment,p),V=!0)},o(p){$(m.$$.fragment,p),$(G.$$.fragment,p),$(_.$$.fragment,p),V=!1},d(p){p&&(l(t),l(e),l(h),l(u),l(I),l(R),l(C),l(W)),j(m,p),j(G,p),j(_,p)}}}function we(U){let t,c;return t=new Rs({props:{$$slots:{default:[be]},$$scope:{ctx:U}}}),{c(){g(t.$$.fragment)},l(e){d(t.$$.fragment,e)},m(e,m){M(t,e,m),c=!0},p(e,m){const h={};m&2&&(h.$$scope={dirty:m,ctx:e}),t.$set(h)},i(e){c||(y(t.$$.fragment,e),c=!0)},o(e){$(t.$$.fragment,e),c=!1},d(e){j(t,e)}}}function Te(U){let t,c,e,m,h,u,v,I,G,R=`言語モデリングには、因果的モデリングとマスクされた言語モデリングの 2 つのタイプがあります。このガイドでは、因果関係のある言語モデリングについて説明します。
因果言語モデルはテキスト生成によく使用されます。これらのモデルは、次のようなクリエイティブなアプリケーションに使用できます。
独自のテキスト アドベンチャーを選択するか、Copilot や CodeParrot などのインテリジェントなコーディング アシスタントを選択します。`,C,X,W,_,V=`因果言語モデリングは、一連のトークン内の次のトークンを予測します。モデルは、次のトークンにのみ対応できます。
左。これは、モデルが将来のトークンを認識できないことを意味します。 GPT-2 は因果的言語モデルの一例です。`,p,J,Q="このガイドでは、次の方法を説明します。",Y,z,N='<li><a href="https:/" rel="nofollow">ELI5</a> の <a href="https://www.reddit.com/r/askscience/" rel="nofollow">r/askscience</a> サブセットで <a href="https://huggingface.co/distilbert/distilgpt2" rel="nofollow">DistilGPT2</a> を微調整します。 /huggingface.co/datasets/eli5) データセット。</li> <li>微調整したモデルを推論に使用します。</li>',L,F,E,B,f="始める前に、必要なライブラリがすべてインストールされていることを確認してください。",k,H,S,A,Vs="モデルをアップロードしてコミュニティと共有できるように、Hugging Face アカウントにログインすることをお勧めします。プロンプトが表示されたら、トークンを入力してログインします。",P,r,x,q,zs,es,xt=`まず、ELI5 データセットの r/askscience サブセットの小さいサブセットを 🤗 データセット ライブラリからロードします。
これにより、完全なデータセットのトレーニングにさらに時間を費やす前に、実験してすべてが機能することを確認する機会が得られます。`,Bs,ls,Hs,as,kt="<code>train_test_split</code> メソッドを使用して、データセットの <code>train_asks</code> をトレイン セットとテスト セットに分割します。",Ys,ns,Es,ps,Ut="次に、例を見てみましょう。",Qs,rs,As,os,vt=`これは多くのことのように見えるかもしれませんが、実際に関心があるのは<code>text</code>フィールドだけです。言語モデリングの優れている点
タスクでは、次の単語がラベル * であるため、ラベル (教師なしタスクとも呼ばれます) は必要ありません。`,Ns,is,Ls,ms,qs,cs,Gt="次のステップは、<code>text</code>サブフィールドを処理するために DistilGPT2 トークナイザーをロードすることです。",Ss,fs,Ps,us,Ct=`上の例からわかるように、<code>text</code>フィールドは実際には<code>answers</code>内にネストされています。つまり、次のことが必要になります。
<a href="https://huggingface.co/docs/datasets/process.html#flatten" rel="nofollow"><code>flatten</code></a> メソッドを使用して、ネストされた構造から <code>text</code> サブフィールドを抽出します。`,Ds,hs,Ks,gs,Zt=`<code>answers</code>接頭辞で示されるように、各サブフィールドは個別の列になり、<code>text</code>フィールドはリストになりました。その代わり
各文を個別にトークン化する場合は、リストを文字列に変換して、それらをまとめてトークン化できるようにします。`,Os,ds,It="以下は、各例の文字列のリストを結合し、結果をトークン化する最初の前処理関数です。",st,Ms,tt,ys,Wt="この前処理関数をデータセット全体に適用するには、🤗 Datasets <code>map</code> メソッドを使用します。 <code>map</code> 関数を高速化するには、<code>batched=True</code> を設定してデータセットの複数の要素を一度に処理し、<code>num_proc</code> でプロセスの数を増やします。不要な列を削除します。",et,$s,lt,js,Rt="このデータセットにはトークン シーケンスが含まれていますが、その一部はモデルの最大入力長よりも長くなります。",at,bs,Vt="2 番目の前処理関数を使用して、",nt,ws,Xt="<li>すべてのシーケンスを連結します</li> <li>連結されたシーケンスを<code>block_size</code>で定義された短いチャンクに分割します。これは、最大入力長より短く、GPU RAM に十分な長さである必要があります。</li>",pt,Ts,rt,Js,Ft="Apply the <code>group_texts</code> function over the entire dataset:",ot,_s,it,xs,zt=`次に、<code>DataCollat​​orForLanguageModeling</code> を使用してサンプルのバッチを作成します。 <em>動的にパディング</em>する方が効率的です。
データセット全体を最大長までパディングするのではなく、照合中にバッチ内の文を最長の長さにします。`,mt,D,ct,ks,ft,K,ut,O,ht,Us,gt,vs,Bt="モデルを微調整したので、それを推論に使用できるようになりました。",dt,Gs,Ht="テキストを生成するプロンプトを考え出します。",Mt,Cs,yt,Zs,Yt='推論用に微調整されたモデルを試す最も簡単な方法は、それを <a href="/docs/transformers/pr_30674/ja/main_classes/pipelines#transformers.pipeline">pipeline()</a> で使用することです。モデルを使用してテキスト生成用の<code>pipeline</code>をインスタンス化し、それにテキストを渡します。',$t,Is,jt,ss,bt,Ws,wt,Xs,Tt;return h=new Fs({props:{title:"Causal language modeling",local:"causal-language-modeling",headingTag:"h1"}}),v=new ne({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/ja/language_modeling.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/ja/pytorch/language_modeling.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/ja/tensorflow/language_modeling.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ja/language_modeling.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ja/pytorch/language_modeling.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ja/tensorflow/language_modeling.ipynb"}]}}),X=new Pt({props:{id:"Vpjb1lu0MDk"}}),F=new Jt({props:{$$slots:{default:[re]},$$scope:{ctx:U}}}),H=new Z({props:{code:"cGlwJTIwaW5zdGFsbCUyMHRyYW5zZm9ybWVycyUyMGRhdGFzZXRzJTIwZXZhbHVhdGU=",highlighted:"pip install transformers datasets evaluate",wrap:!1}}),r=new Z({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 Fs({props:{title:"Load ELI5 dataset",local:"load-eli5-dataset",headingTag:"h2"}}),ls=new Z({props:{code:"ZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBJTBBZWxpNSUyMCUzRCUyMGxvYWRfZGF0YXNldCglMjJlbGk1JTIyJTJDJTIwc3BsaXQlM0QlMjJ0cmFpbl9hc2tzJTVCJTNBNTAwMCU1RCUyMik=",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&quot;</span>, split=<span class="hljs-string">&quot;train_asks[:5000]&quot;</span>)`,wrap:!1}}),ns=new Z({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}}),rs=new Z({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;answers&#x27;</span>: {<span class="hljs-string">&#x27;a_id&#x27;</span>: [<span class="hljs-string">&#x27;c3d1aib&#x27;</span>, <span class="hljs-string">&#x27;c3d4lya&#x27;</span>],
  <span class="hljs-string">&#x27;score&#x27;</span>: [<span class="hljs-number">6</span>, <span class="hljs-number">3</span>],
  <span class="hljs-string">&#x27;text&#x27;</span>: [<span class="hljs-string">&quot;The velocity needed to remain in orbit is equal to the square root of Newton&#x27;s constant times the mass of earth divided by the distance from the center of the earth. I don&#x27;t know the altitude of that specific mission, but they&#x27;re usually around 300 km. That means he&#x27;s going 7-8 km/s.\\n\\nIn space there are no other forces acting on either the shuttle or the guy, so they stay in the same position relative to each other. If he were to become unable to return to the ship, he would presumably run out of oxygen, or slowly fall into the atmosphere and burn up.&quot;</span>,
   <span class="hljs-string">&quot;Hope you don&#x27;t mind me asking another question, but why aren&#x27;t there any stars visible in this photo?&quot;</span>]},
 <span class="hljs-string">&#x27;answers_urls&#x27;</span>: {<span class="hljs-string">&#x27;url&#x27;</span>: []},
 <span class="hljs-string">&#x27;document&#x27;</span>: <span class="hljs-string">&#x27;&#x27;</span>,
 <span class="hljs-string">&#x27;q_id&#x27;</span>: <span class="hljs-string">&#x27;nyxfp&#x27;</span>,
 <span class="hljs-string">&#x27;selftext&#x27;</span>: <span class="hljs-string">&#x27;_URL_0_\\n\\nThis was on the front page earlier and I have a few questions about it. Is it possible to calculate how fast the astronaut would be orbiting the earth? Also how does he stay close to the shuttle so that he can return safely, i.e is he orbiting at the same speed and can therefore stay next to it? And finally if his propulsion system failed, would he eventually re-enter the atmosphere and presumably die?&#x27;</span>,
 <span class="hljs-string">&#x27;selftext_urls&#x27;</span>: {<span class="hljs-string">&#x27;url&#x27;</span>: [<span class="hljs-string">&#x27;http://apod.nasa.gov/apod/image/1201/freeflyer_nasa_3000.jpg&#x27;</span>]},
 <span class="hljs-string">&#x27;subreddit&#x27;</span>: <span class="hljs-string">&#x27;askscience&#x27;</span>,
 <span class="hljs-string">&#x27;title&#x27;</span>: <span class="hljs-string">&#x27;Few questions about this space walk photograph.&#x27;</span>,
 <span class="hljs-string">&#x27;title_urls&#x27;</span>: {<span class="hljs-string">&#x27;url&#x27;</span>: []}}`,wrap:!1}}),is=new Fs({props:{title:"Preprocess",local:"preprocess",headingTag:"h2"}}),ms=new Pt({props:{id:"ma1TrR7gE7I"}}),fs=new Z({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}}),hs=new Z({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;answers.a_id&#x27;</span>: [<span class="hljs-string">&#x27;c3d1aib&#x27;</span>, <span class="hljs-string">&#x27;c3d4lya&#x27;</span>],
 <span class="hljs-string">&#x27;answers.score&#x27;</span>: [<span class="hljs-number">6</span>, <span class="hljs-number">3</span>],
 <span class="hljs-string">&#x27;answers.text&#x27;</span>: [<span class="hljs-string">&quot;The velocity needed to remain in orbit is equal to the square root of Newton&#x27;s constant times the mass of earth divided by the distance from the center of the earth. I don&#x27;t know the altitude of that specific mission, but they&#x27;re usually around 300 km. That means he&#x27;s going 7-8 km/s.\\n\\nIn space there are no other forces acting on either the shuttle or the guy, so they stay in the same position relative to each other. If he were to become unable to return to the ship, he would presumably run out of oxygen, or slowly fall into the atmosphere and burn up.&quot;</span>,
  <span class="hljs-string">&quot;Hope you don&#x27;t mind me asking another question, but why aren&#x27;t there any stars visible in this photo?&quot;</span>],
 <span class="hljs-string">&#x27;answers_urls.url&#x27;</span>: [],
 <span class="hljs-string">&#x27;document&#x27;</span>: <span class="hljs-string">&#x27;&#x27;</span>,
 <span class="hljs-string">&#x27;q_id&#x27;</span>: <span class="hljs-string">&#x27;nyxfp&#x27;</span>,
 <span class="hljs-string">&#x27;selftext&#x27;</span>: <span class="hljs-string">&#x27;_URL_0_\\n\\nThis was on the front page earlier and I have a few questions about it. Is it possible to calculate how fast the astronaut would be orbiting the earth? Also how does he stay close to the shuttle so that he can return safely, i.e is he orbiting at the same speed and can therefore stay next to it? And finally if his propulsion system failed, would he eventually re-enter the atmosphere and presumably die?&#x27;</span>,
 <span class="hljs-string">&#x27;selftext_urls.url&#x27;</span>: [<span class="hljs-string">&#x27;http://apod.nasa.gov/apod/image/1201/freeflyer_nasa_3000.jpg&#x27;</span>],
 <span class="hljs-string">&#x27;subreddit&#x27;</span>: <span class="hljs-string">&#x27;askscience&#x27;</span>,
 <span class="hljs-string">&#x27;title&#x27;</span>: <span class="hljs-string">&#x27;Few questions about this space walk photograph.&#x27;</span>,
 <span class="hljs-string">&#x27;title_urls.url&#x27;</span>: []}`,wrap:!1}}),Ms=new Z({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}}),$s=new Z({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}}),Ts=new Z({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}}),_s=new Z({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 _t({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[ce],pytorch:[ie]},$$scope:{ctx:U}}}),ks=new Fs({props:{title:"Train",local:"train",headingTag:"h2"}}),K=new _t({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[Me],pytorch:[he]},$$scope:{ctx:U}}}),O=new Jt({props:{$$slots:{default:[ye]},$$scope:{ctx:U}}}),Us=new Fs({props:{title:"Inference",local:"inference",headingTag:"h2"}}),Cs=new Z({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}}),Is=new Z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBZ2VuZXJhdG9yJTIwJTNEJTIwcGlwZWxpbmUoJTIydGV4dC1nZW5lcmF0aW9uJTIyJTJDJTIwbW9kZWwlM0QlMjJteV9hd2Vzb21lX2VsaTVfY2xtLW1vZGVsJTIyKSUwQWdlbmVyYXRvcihwcm9tcHQp",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;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}}),ss=new _t({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[we],pytorch:[je]},$$scope:{ctx:U}}}),Ws=new pe({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/ja/tasks/language_modeling.md"}}),{c(){t=b("meta"),c=o(),e=b("p"),m=o(),g(h.$$.fragment),u=o(),g(v.$$.fragment),I=o(),G=b("p"),G.textContent=R,C=o(),g(X.$$.fragment),W=o(),_=b("p"),_.textContent=V,p=o(),J=b("p"),J.textContent=Q,Y=o(),z=b("ol"),z.innerHTML=N,L=o(),g(F.$$.fragment),E=o(),B=b("p"),B.textContent=f,k=o(),g(H.$$.fragment),S=o(),A=b("p"),A.textContent=Vs,P=o(),g(r.$$.fragment),x=o(),g(q.$$.fragment),zs=o(),es=b("p"),es.textContent=xt,Bs=o(),g(ls.$$.fragment),Hs=o(),as=b("p"),as.innerHTML=kt,Ys=o(),g(ns.$$.fragment),Es=o(),ps=b("p"),ps.textContent=Ut,Qs=o(),g(rs.$$.fragment),As=o(),os=b("p"),os.innerHTML=vt,Ns=o(),g(is.$$.fragment),Ls=o(),g(ms.$$.fragment),qs=o(),cs=b("p"),cs.innerHTML=Gt,Ss=o(),g(fs.$$.fragment),Ps=o(),us=b("p"),us.innerHTML=Ct,Ds=o(),g(hs.$$.fragment),Ks=o(),gs=b("p"),gs.innerHTML=Zt,Os=o(),ds=b("p"),ds.textContent=It,st=o(),g(Ms.$$.fragment),tt=o(),ys=b("p"),ys.innerHTML=Wt,et=o(),g($s.$$.fragment),lt=o(),js=b("p"),js.textContent=Rt,at=o(),bs=b("p"),bs.textContent=Vt,nt=o(),ws=b("ul"),ws.innerHTML=Xt,pt=o(),g(Ts.$$.fragment),rt=o(),Js=b("p"),Js.innerHTML=Ft,ot=o(),g(_s.$$.fragment),it=o(),xs=b("p"),xs.innerHTML=zt,mt=o(),g(D.$$.fragment),ct=o(),g(ks.$$.fragment),ft=o(),g(K.$$.fragment),ut=o(),g(O.$$.fragment),ht=o(),g(Us.$$.fragment),gt=o(),vs=b("p"),vs.textContent=Bt,dt=o(),Gs=b("p"),Gs.textContent=Ht,Mt=o(),g(Cs.$$.fragment),yt=o(),Zs=b("p"),Zs.innerHTML=Yt,$t=o(),g(Is.$$.fragment),jt=o(),g(ss.$$.fragment),bt=o(),g(Ws.$$.fragment),wt=o(),Xs=b("p"),this.h()},l(s){const n=te("svelte-u9bgzb",document.head);t=w(n,"META",{name:!0,content:!0}),n.forEach(l),c=i(s),e=w(s,"P",{}),qt(e).forEach(l),m=i(s),d(h.$$.fragment,s),u=i(s),d(v.$$.fragment,s),I=i(s),G=w(s,"P",{"data-svelte-h":!0}),T(G)!=="svelte-1yyz4on"&&(G.textContent=R),C=i(s),d(X.$$.fragment,s),W=i(s),_=w(s,"P",{"data-svelte-h":!0}),T(_)!=="svelte-1q0t2hv"&&(_.textContent=V),p=i(s),J=w(s,"P",{"data-svelte-h":!0}),T(J)!=="svelte-w5jzhi"&&(J.textContent=Q),Y=i(s),z=w(s,"OL",{"data-svelte-h":!0}),T(z)!=="svelte-1f3rck6"&&(z.innerHTML=N),L=i(s),d(F.$$.fragment,s),E=i(s),B=w(s,"P",{"data-svelte-h":!0}),T(B)!=="svelte-1lya3k8"&&(B.textContent=f),k=i(s),d(H.$$.fragment,s),S=i(s),A=w(s,"P",{"data-svelte-h":!0}),T(A)!=="svelte-193zy02"&&(A.textContent=Vs),P=i(s),d(r.$$.fragment,s),x=i(s),d(q.$$.fragment,s),zs=i(s),es=w(s,"P",{"data-svelte-h":!0}),T(es)!=="svelte-vg7xut"&&(es.textContent=xt),Bs=i(s),d(ls.$$.fragment,s),Hs=i(s),as=w(s,"P",{"data-svelte-h":!0}),T(as)!=="svelte-1ohvh79"&&(as.innerHTML=kt),Ys=i(s),d(ns.$$.fragment,s),Es=i(s),ps=w(s,"P",{"data-svelte-h":!0}),T(ps)!=="svelte-1r6oj5w"&&(ps.textContent=Ut),Qs=i(s),d(rs.$$.fragment,s),As=i(s),os=w(s,"P",{"data-svelte-h":!0}),T(os)!=="svelte-cl288g"&&(os.innerHTML=vt),Ns=i(s),d(is.$$.fragment,s),Ls=i(s),d(ms.$$.fragment,s),qs=i(s),cs=w(s,"P",{"data-svelte-h":!0}),T(cs)!=="svelte-tp55im"&&(cs.innerHTML=Gt),Ss=i(s),d(fs.$$.fragment,s),Ps=i(s),us=w(s,"P",{"data-svelte-h":!0}),T(us)!=="svelte-xo485t"&&(us.innerHTML=Ct),Ds=i(s),d(hs.$$.fragment,s),Ks=i(s),gs=w(s,"P",{"data-svelte-h":!0}),T(gs)!=="svelte-jgh86y"&&(gs.innerHTML=Zt),Os=i(s),ds=w(s,"P",{"data-svelte-h":!0}),T(ds)!=="svelte-177qfmt"&&(ds.textContent=It),st=i(s),d(Ms.$$.fragment,s),tt=i(s),ys=w(s,"P",{"data-svelte-h":!0}),T(ys)!=="svelte-1l40k3u"&&(ys.innerHTML=Wt),et=i(s),d($s.$$.fragment,s),lt=i(s),js=w(s,"P",{"data-svelte-h":!0}),T(js)!=="svelte-1bsb6if"&&(js.textContent=Rt),at=i(s),bs=w(s,"P",{"data-svelte-h":!0}),T(bs)!=="svelte-1jnll4i"&&(bs.textContent=Vt),nt=i(s),ws=w(s,"UL",{"data-svelte-h":!0}),T(ws)!=="svelte-1r1l6ld"&&(ws.innerHTML=Xt),pt=i(s),d(Ts.$$.fragment,s),rt=i(s),Js=w(s,"P",{"data-svelte-h":!0}),T(Js)!=="svelte-1o69amy"&&(Js.innerHTML=Ft),ot=i(s),d(_s.$$.fragment,s),it=i(s),xs=w(s,"P",{"data-svelte-h":!0}),T(xs)!=="svelte-1v01q1n"&&(xs.innerHTML=zt),mt=i(s),d(D.$$.fragment,s),ct=i(s),d(ks.$$.fragment,s),ft=i(s),d(K.$$.fragment,s),ut=i(s),d(O.$$.fragment,s),ht=i(s),d(Us.$$.fragment,s),gt=i(s),vs=w(s,"P",{"data-svelte-h":!0}),T(vs)!=="svelte-cyrfc8"&&(vs.textContent=Bt),dt=i(s),Gs=w(s,"P",{"data-svelte-h":!0}),T(Gs)!=="svelte-lyo9y"&&(Gs.textContent=Ht),Mt=i(s),d(Cs.$$.fragment,s),yt=i(s),Zs=w(s,"P",{"data-svelte-h":!0}),T(Zs)!=="svelte-1wspp0x"&&(Zs.innerHTML=Yt),$t=i(s),d(Is.$$.fragment,s),jt=i(s),d(ss.$$.fragment,s),bt=i(s),d(Ws.$$.fragment,s),wt=i(s),Xs=w(s,"P",{}),qt(Xs).forEach(l),this.h()},h(){St(t,"name","hf:doc:metadata"),St(t,"content",Je)},m(s,n){ee(document.head,t),a(s,c,n),a(s,e,n),a(s,m,n),M(h,s,n),a(s,u,n),M(v,s,n),a(s,I,n),a(s,G,n),a(s,C,n),M(X,s,n),a(s,W,n),a(s,_,n),a(s,p,n),a(s,J,n),a(s,Y,n),a(s,z,n),a(s,L,n),M(F,s,n),a(s,E,n),a(s,B,n),a(s,k,n),M(H,s,n),a(s,S,n),a(s,A,n),a(s,P,n),M(r,s,n),a(s,x,n),M(q,s,n),a(s,zs,n),a(s,es,n),a(s,Bs,n),M(ls,s,n),a(s,Hs,n),a(s,as,n),a(s,Ys,n),M(ns,s,n),a(s,Es,n),a(s,ps,n),a(s,Qs,n),M(rs,s,n),a(s,As,n),a(s,os,n),a(s,Ns,n),M(is,s,n),a(s,Ls,n),M(ms,s,n),a(s,qs,n),a(s,cs,n),a(s,Ss,n),M(fs,s,n),a(s,Ps,n),a(s,us,n),a(s,Ds,n),M(hs,s,n),a(s,Ks,n),a(s,gs,n),a(s,Os,n),a(s,ds,n),a(s,st,n),M(Ms,s,n),a(s,tt,n),a(s,ys,n),a(s,et,n),M($s,s,n),a(s,lt,n),a(s,js,n),a(s,at,n),a(s,bs,n),a(s,nt,n),a(s,ws,n),a(s,pt,n),M(Ts,s,n),a(s,rt,n),a(s,Js,n),a(s,ot,n),M(_s,s,n),a(s,it,n),a(s,xs,n),a(s,mt,n),M(D,s,n),a(s,ct,n),M(ks,s,n),a(s,ft,n),M(K,s,n),a(s,ut,n),M(O,s,n),a(s,ht,n),M(Us,s,n),a(s,gt,n),a(s,vs,n),a(s,dt,n),a(s,Gs,n),a(s,Mt,n),M(Cs,s,n),a(s,yt,n),a(s,Zs,n),a(s,$t,n),M(Is,s,n),a(s,jt,n),M(ss,s,n),a(s,bt,n),M(Ws,s,n),a(s,wt,n),a(s,Xs,n),Tt=!0},p(s,[n]){const Et={};n&2&&(Et.$$scope={dirty:n,ctx:s}),F.$set(Et);const Qt={};n&2&&(Qt.$$scope={dirty:n,ctx:s}),D.$set(Qt);const At={};n&2&&(At.$$scope={dirty:n,ctx:s}),K.$set(At);const Nt={};n&2&&(Nt.$$scope={dirty:n,ctx:s}),O.$set(Nt);const Lt={};n&2&&(Lt.$$scope={dirty:n,ctx:s}),ss.$set(Lt)},i(s){Tt||(y(h.$$.fragment,s),y(v.$$.fragment,s),y(X.$$.fragment,s),y(F.$$.fragment,s),y(H.$$.fragment,s),y(r.$$.fragment,s),y(q.$$.fragment,s),y(ls.$$.fragment,s),y(ns.$$.fragment,s),y(rs.$$.fragment,s),y(is.$$.fragment,s),y(ms.$$.fragment,s),y(fs.$$.fragment,s),y(hs.$$.fragment,s),y(Ms.$$.fragment,s),y($s.$$.fragment,s),y(Ts.$$.fragment,s),y(_s.$$.fragment,s),y(D.$$.fragment,s),y(ks.$$.fragment,s),y(K.$$.fragment,s),y(O.$$.fragment,s),y(Us.$$.fragment,s),y(Cs.$$.fragment,s),y(Is.$$.fragment,s),y(ss.$$.fragment,s),y(Ws.$$.fragment,s),Tt=!0)},o(s){$(h.$$.fragment,s),$(v.$$.fragment,s),$(X.$$.fragment,s),$(F.$$.fragment,s),$(H.$$.fragment,s),$(r.$$.fragment,s),$(q.$$.fragment,s),$(ls.$$.fragment,s),$(ns.$$.fragment,s),$(rs.$$.fragment,s),$(is.$$.fragment,s),$(ms.$$.fragment,s),$(fs.$$.fragment,s),$(hs.$$.fragment,s),$(Ms.$$.fragment,s),$($s.$$.fragment,s),$(Ts.$$.fragment,s),$(_s.$$.fragment,s),$(D.$$.fragment,s),$(ks.$$.fragment,s),$(K.$$.fragment,s),$(O.$$.fragment,s),$(Us.$$.fragment,s),$(Cs.$$.fragment,s),$(Is.$$.fragment,s),$(ss.$$.fragment,s),$(Ws.$$.fragment,s),Tt=!1},d(s){s&&(l(c),l(e),l(m),l(u),l(I),l(G),l(C),l(W),l(_),l(p),l(J),l(Y),l(z),l(L),l(E),l(B),l(k),l(S),l(A),l(P),l(x),l(zs),l(es),l(Bs),l(Hs),l(as),l(Ys),l(Es),l(ps),l(Qs),l(As),l(os),l(Ns),l(Ls),l(qs),l(cs),l(Ss),l(Ps),l(us),l(Ds),l(Ks),l(gs),l(Os),l(ds),l(st),l(tt),l(ys),l(et),l(lt),l(js),l(at),l(bs),l(nt),l(ws),l(pt),l(rt),l(Js),l(ot),l(it),l(xs),l(mt),l(ct),l(ft),l(ut),l(ht),l(gt),l(vs),l(dt),l(Gs),l(Mt),l(yt),l(Zs),l($t),l(jt),l(bt),l(wt),l(Xs)),l(t),j(h,s),j(v,s),j(X,s),j(F,s),j(H,s),j(r,s),j(q,s),j(ls,s),j(ns,s),j(rs,s),j(is,s),j(ms,s),j(fs,s),j(hs,s),j(Ms,s),j($s,s),j(Ts,s),j(_s,s),j(D,s),j(ks,s),j(K,s),j(O,s),j(Us,s),j(Cs,s),j(Is,s),j(ss,s),j(Ws,s)}}}const Je='{"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 _e(U){return Kt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class We extends Ot{constructor(t){super(),se(this,t,_e,Te,Dt,{})}}export{We as component};
