import{s as Pt,o as St,n as te}from"../chunks/scheduler.9bc65507.js";import{S as Dt,i as Kt,g as b,s as m,r as u,A as Ot,h as w,f as s,c as i,j as Lt,u as g,x as T,k as Nt,y as es,a as l,v as M,d as y,t as j,w as $,m as ts,n as ss}from"../chunks/index.707bf1b6.js";import{T as wt}from"../chunks/Tip.c2ecdbf4.js";import{Y as qt}from"../chunks/Youtube.e1129c6f.js";import{C as Z}from"../chunks/CodeBlock.54a9f38d.js";import{D as as}from"../chunks/DocNotebookDropdown.3e6b3817.js";import{F as Tt,M as Re}from"../chunks/Markdown.8ab98a13.js";import{H as Xe}from"../chunks/Heading.342b1fa6.js";function ls(G){let t,f=`このガイドと同じ手順に従って、因果言語モデリング用に他のアーキテクチャを微調整できます。
次のアーキテクチャのいずれかを選択します。`,a,p,d='<a href="../model_doc/bart">BART</a>, <a href="../model_doc/bert">BERT</a>, <a href="../model_doc/bert-generation">Bert Generation</a>, <a href="../model_doc/big_bird">BigBird</a>, <a href="../model_doc/bigbird_pegasus">BigBird-Pegasus</a>, <a href="../model_doc/biogpt">BioGpt</a>, <a href="../model_doc/blenderbot">Blenderbot</a>, <a href="../model_doc/blenderbot-small">BlenderbotSmall</a>, <a href="../model_doc/bloom">BLOOM</a>, <a href="../model_doc/camembert">CamemBERT</a>, <a href="../model_doc/code_llama">CodeLlama</a>, <a href="../model_doc/codegen">CodeGen</a>, <a href="../model_doc/cpmant">CPM-Ant</a>, <a href="../model_doc/ctrl">CTRL</a>, <a href="../model_doc/data2vec-text">Data2VecText</a>, <a href="../model_doc/electra">ELECTRA</a>, <a href="../model_doc/ernie">ERNIE</a>, <a href="../model_doc/falcon">Falcon</a>, <a href="../model_doc/fuyu">Fuyu</a>, <a href="../model_doc/git">GIT</a>, <a href="../model_doc/gpt-sw3">GPT-Sw3</a>, <a href="../model_doc/gpt2">OpenAI GPT-2</a>, <a href="../model_doc/gpt_bigcode">GPTBigCode</a>, <a href="../model_doc/gpt_neo">GPT Neo</a>, <a href="../model_doc/gpt_neox">GPT NeoX</a>, <a href="../model_doc/gpt_neox_japanese">GPT NeoX Japanese</a>, <a href="../model_doc/gptj">GPT-J</a>, <a href="../model_doc/llama">LLaMA</a>, <a href="../model_doc/marian">Marian</a>, <a href="../model_doc/mbart">mBART</a>, <a href="../model_doc/mega">MEGA</a>, <a href="../model_doc/megatron-bert">Megatron-BERT</a>, <a href="../model_doc/mistral">Mistral</a>, <a href="../model_doc/mpt">MPT</a>, <a href="../model_doc/musicgen">MusicGen</a>, <a href="../model_doc/mvp">MVP</a>, <a href="../model_doc/open-llama">OpenLlama</a>, <a href="../model_doc/openai-gpt">OpenAI GPT</a>, <a href="../model_doc/opt">OPT</a>, <a href="../model_doc/pegasus">Pegasus</a>, <a href="../model_doc/persimmon">Persimmon</a>, <a href="../model_doc/plbart">PLBart</a>, <a href="../model_doc/prophetnet">ProphetNet</a>, <a href="../model_doc/qdqbert">QDQBert</a>, <a href="../model_doc/reformer">Reformer</a>, <a href="../model_doc/rembert">RemBERT</a>, <a href="../model_doc/roberta">RoBERTa</a>, <a href="../model_doc/roberta-prelayernorm">RoBERTa-PreLayerNorm</a>, <a href="../model_doc/roc_bert">RoCBert</a>, <a href="../model_doc/roformer">RoFormer</a>, <a href="../model_doc/rwkv">RWKV</a>, <a href="../model_doc/speech_to_text_2">Speech2Text2</a>, <a href="../model_doc/transfo-xl">Transformer-XL</a>, <a href="../model_doc/trocr">TrOCR</a>, <a href="../model_doc/xglm">XGLM</a>, <a href="../model_doc/xlm">XLM</a>, <a href="../model_doc/xlm-prophetnet">XLM-ProphetNet</a>, <a href="../model_doc/xlm-roberta">XLM-RoBERTa</a>, <a href="../model_doc/xlm-roberta-xl">XLM-RoBERTa-XL</a>, <a href="../model_doc/xlnet">XLNet</a>, <a href="../model_doc/xmod">X-MOD</a>';return{c(){t=b("p"),t.textContent=f,a=m(),p=b("p"),p.innerHTML=d},l(c){t=w(c,"P",{"data-svelte-h":!0}),T(t)!=="svelte-b7bqri"&&(t.textContent=f),a=i(c),p=w(c,"P",{"data-svelte-h":!0}),T(p)!=="svelte-h3q6a6"&&(p.innerHTML=d)},m(c,x){l(c,t,x),l(c,a,x),l(c,p,x)},p:te,d(c){c&&(s(t),s(a),s(p))}}}function ns(G){let t,f="シーケンス終了トークンをパディング トークンとして使用し、<code>mlm=False</code> を設定します。これは、入力を 1 要素分右にシフトしたラベルとして使用します。",a,p,d;return p=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=f,a=m(),u(p.$$.fragment)},l(c){t=w(c,"P",{"data-svelte-h":!0}),T(t)!=="svelte-1fnpddk"&&(t.innerHTML=f),a=i(c),g(p.$$.fragment,c)},m(c,x){l(c,t,x),l(c,a,x),M(p,c,x),d=!0},p:te,i(c){d||(y(p.$$.fragment,c),d=!0)},o(c){j(p.$$.fragment,c),d=!1},d(c){c&&(s(t),s(a)),$(p,c)}}}function rs(G){let t,f;return t=new Re({props:{$$slots:{default:[ns]},$$scope:{ctx:G}}}),{c(){u(t.$$.fragment)},l(a){g(t.$$.fragment,a)},m(a,p){M(t,a,p),f=!0},p(a,p){const d={};p&2&&(d.$$scope={dirty:p,ctx:a}),t.$set(d)},i(a){f||(y(t.$$.fragment,a),f=!0)},o(a){j(t.$$.fragment,a),f=!1},d(a){$(t,a)}}}function ps(G){let t,f="シーケンス終了トークンをパディング トークンとして使用し、<code>mlm=False</code> を設定します。これは、入力を 1 要素分右にシフトしたラベルとして使用します。",a,p,d;return p=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=f,a=m(),u(p.$$.fragment)},l(c){t=w(c,"P",{"data-svelte-h":!0}),T(t)!=="svelte-1fnpddk"&&(t.innerHTML=f),a=i(c),g(p.$$.fragment,c)},m(c,x){l(c,t,x),l(c,a,x),M(p,c,x),d=!0},p:te,i(c){d||(y(p.$$.fragment,c),d=!0)},o(c){j(p.$$.fragment,c),d=!1},d(c){c&&(s(t),s(a)),$(p,c)}}}function os(G){let t,f;return t=new Re({props:{$$slots:{default:[ps]},$$scope:{ctx:G}}}),{c(){u(t.$$.fragment)},l(a){g(t.$$.fragment,a)},m(a,p){M(t,a,p),f=!0},p(a,p){const d={};p&2&&(d.$$scope={dirty:p,ctx:a}),t.$set(d)},i(a){f||(y(t.$$.fragment,a),f=!0)},o(a){j(t.$$.fragment,a),f=!1},d(a){$(t,a)}}}function ms(G){let t,f='<a href="/docs/transformers/main/ja/main_classes/trainer#transformers.Trainer">Trainer</a> を使用したモデルの微調整に慣れていない場合は、<a href="../training#train-with-pytorch-trainer">基本チュートリアル</a> を参照してください。';return{c(){t=b("p"),t.innerHTML=f},l(a){t=w(a,"P",{"data-svelte-h":!0}),T(t)!=="svelte-j85yn3"&&(t.innerHTML=f)},m(a,p){l(a,t,p)},p:te,d(a){a&&s(t)}}}function is(G){let t,f,a,p='これでモデルのトレーニングを開始する準備が整いました。 <a href="/docs/transformers/main/ja/model_doc/auto#transformers.AutoModelForCausalLM">AutoModelForCausalLM</a> を使用して DistilGPT2 をロードします。',d,c,x,I,v="この時点で残っている手順は次の 3 つだけです。",V,C,X='<li><a href="/docs/transformers/main/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/main/ja/main_classes/trainer#transformers.Trainer">Trainer</a> に渡します。</li> <li><a href="/docs/transformers/main/ja/main_classes/trainer#transformers.Trainer.train">train()</a> を呼び出してモデルを微調整します。</li>',R,J,W,r,_='トレーニングが完了したら、 <a href="/docs/transformers/main/ja/main_classes/trainer#transformers.Trainer.evaluate">evaluate()</a> メソッドを使用してモデルを評価し、その複雑さを取得します。',A,E,F,L,N='次に、 <a href="/docs/transformers/main/ja/main_classes/trainer#transformers.Trainer.push_to_hub">push_to_hub()</a> メソッドを使用してモデルをハブに共有し、誰もがモデルを使用できるようにします。',B,Y,z;return t=new wt({props:{$$slots:{default:[ms]},$$scope:{ctx:G}}}),c=new Z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTJDJTIwVHJhaW5pbmdBcmd1bWVudHMlMkMlMjBUcmFpbmVyJTBBJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JDYXVzYWxMTS5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsZ3B0MiUyMik=",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;distilgpt2&quot;</span>)`,wrap:!1}}),J=new Z({props:{code:"dHJhaW5pbmdfYXJncyUyMCUzRCUyMFRyYWluaW5nQXJndW1lbnRzKCUwQSUyMCUyMCUyMCUyMG91dHB1dF9kaXIlM0QlMjJteV9hd2Vzb21lX2VsaTVfY2xtLW1vZGVsJTIyJTJDJTBBJTIwJTIwJTIwJTIwZXZhbHVhdGlvbl9zdHJhdGVneSUzRCUyMmVwb2NoJTIyJTJDJTBBJTIwJTIwJTIwJTIwbGVhcm5pbmdfcmF0ZSUzRDJlLTUlMkMlMEElMjAlMjAlMjAlMjB3ZWlnaHRfZGVjYXklM0QwLjAxJTJDJTBBJTIwJTIwJTIwJTIwcHVzaF90b19odWIlM0RUcnVlJTJDJTBBKSUwQSUwQXRyYWluZXIlMjAlM0QlMjBUcmFpbmVyKCUwQSUyMCUyMCUyMCUyMG1vZGVsJTNEbW9kZWwlMkMlMEElMjAlMjAlMjAlMjBhcmdzJTNEdHJhaW5pbmdfYXJncyUyQyUwQSUyMCUyMCUyMCUyMHRyYWluX2RhdGFzZXQlM0RsbV9kYXRhc2V0JTVCJTIydHJhaW4lMjIlNUQlMkMlMEElMjAlMjAlMjAlMjBldmFsX2RhdGFzZXQlM0RsbV9kYXRhc2V0JTVCJTIydGVzdCUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMGRhdGFfY29sbGF0b3IlM0RkYXRhX2NvbGxhdG9yJTJDJTBBKSUwQSUwQXRyYWluZXIudHJhaW4oKQ==",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>    evaluation_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}}),E=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}}),Y=new Z({props:{code:"dHJhaW5lci5wdXNoX3RvX2h1Yigp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.push_to_hub()',wrap:!1}}),{c(){u(t.$$.fragment),f=m(),a=b("p"),a.innerHTML=p,d=m(),u(c.$$.fragment),x=m(),I=b("p"),I.textContent=v,V=m(),C=b("ol"),C.innerHTML=X,R=m(),u(J.$$.fragment),W=m(),r=b("p"),r.innerHTML=_,A=m(),u(E.$$.fragment),F=m(),L=b("p"),L.innerHTML=N,B=m(),u(Y.$$.fragment)},l(h){g(t.$$.fragment,h),f=i(h),a=w(h,"P",{"data-svelte-h":!0}),T(a)!=="svelte-pmutmj"&&(a.innerHTML=p),d=i(h),g(c.$$.fragment,h),x=i(h),I=w(h,"P",{"data-svelte-h":!0}),T(I)!=="svelte-1j8bgyv"&&(I.textContent=v),V=i(h),C=w(h,"OL",{"data-svelte-h":!0}),T(C)!=="svelte-1yjbkwa"&&(C.innerHTML=X),R=i(h),g(J.$$.fragment,h),W=i(h),r=w(h,"P",{"data-svelte-h":!0}),T(r)!=="svelte-w8pdej"&&(r.innerHTML=_),A=i(h),g(E.$$.fragment,h),F=i(h),L=w(h,"P",{"data-svelte-h":!0}),T(L)!=="svelte-hy4bys"&&(L.innerHTML=N),B=i(h),g(Y.$$.fragment,h)},m(h,k){M(t,h,k),l(h,f,k),l(h,a,k),l(h,d,k),M(c,h,k),l(h,x,k),l(h,I,k),l(h,V,k),l(h,C,k),l(h,R,k),M(J,h,k),l(h,W,k),l(h,r,k),l(h,A,k),M(E,h,k),l(h,F,k),l(h,L,k),l(h,B,k),M(Y,h,k),z=!0},p(h,k){const H={};k&2&&(H.$$scope={dirty:k,ctx:h}),t.$set(H)},i(h){z||(y(t.$$.fragment,h),y(c.$$.fragment,h),y(J.$$.fragment,h),y(E.$$.fragment,h),y(Y.$$.fragment,h),z=!0)},o(h){j(t.$$.fragment,h),j(c.$$.fragment,h),j(J.$$.fragment,h),j(E.$$.fragment,h),j(Y.$$.fragment,h),z=!1},d(h){h&&(s(f),s(a),s(d),s(x),s(I),s(V),s(C),s(R),s(W),s(r),s(A),s(F),s(L),s(B)),$(t,h),$(c,h),$(J,h),$(E,h),$(Y,h)}}}function cs(G){let t,f;return t=new Re({props:{$$slots:{default:[is]},$$scope:{ctx:G}}}),{c(){u(t.$$.fragment)},l(a){g(t.$$.fragment,a)},m(a,p){M(t,a,p),f=!0},p(a,p){const d={};p&2&&(d.$$scope={dirty:p,ctx:a}),t.$set(d)},i(a){f||(y(t.$$.fragment,a),f=!0)},o(a){j(t.$$.fragment,a),f=!1},d(a){$(t,a)}}}function fs(G){let t,f='Keras を使用したモデルの微調整に慣れていない場合は、<a href="../training#train-a-tensorflow-model-with-keras">基本チュートリアル</a> をご覧ください。';return{c(){t=b("p"),t.innerHTML=f},l(a){t=w(a,"P",{"data-svelte-h":!0}),T(t)!=="svelte-12i88xp"&&(t.innerHTML=f)},m(a,p){l(a,t,p)},p:te,d(a){a&&s(t)}}}function hs(G){let t,f,a,p,d,c='次に、<a href="/docs/transformers/main/ja/model_doc/auto#transformers.TFAutoModelForCausalLM">TFAutoModelForCausalLM</a> を使用して DistilGPT2 をロードできます。',x,I,v,V,C='<a href="/docs/transformers/main/ja/main_classes/model#transformers.TFPreTrainedModel.prepare_tf_dataset">prepare_tf_dataset()</a> を使用して、データセットを <code>tf.data.Dataset</code> 形式に変換します。',X,R,J,W,r='<a href="https://keras.io/api/models/model_training_apis/#compile-method" rel="nofollow"><code>compile</code></a> を使用してトレーニング用のモデルを設定します。 Transformers モデルにはすべてデフォルトのタスク関連の損失関数があるため、次の場合を除き、損失関数を指定する必要はないことに注意してください。',_,A,E,F,L='これは、モデルとトークナイザーを <a href="/docs/transformers/main/ja/main_classes/keras_callbacks#transformers.PushToHubCallback">PushToHubCallback</a> でプッシュする場所を指定することで実行できます。',N,B,Y,z,h='ついに、モデルのトレーニングを開始する準備が整いました。トレーニングおよび検証データセット、エポック数、コールバックを指定して <a href="https://keras.io/api/models/model_training_apis/#fit-method" rel="nofollow"><code>fit</code></a> を呼び出し、モデルを微調整します。',k,H,P,Q,Ve="トレーニングが完了すると、モデルは自動的にハブにアップロードされ、誰でも使用できるようになります。",S;return t=new wt({props:{$$slots:{default:[fs]},$$scope:{ctx:G}}}),a=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:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGQXV0b01vZGVsRm9yQ2F1c2FsTE0lMEElMEFtb2RlbCUyMCUzRCUyMFRGQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMmRpc3RpbGdwdDIlMjIp",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;distilgpt2&quot;</span>)`,wrap:!1}}),R=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}}),A=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}}),B=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(){u(t.$$.fragment),f=ts(`
TensorFlow でモデルを微調整するには、オプティマイザー関数、学習率スケジュール、およびいくつかのトレーニング ハイパーパラメーターをセットアップすることから始めます。

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

	`),g(a.$$.fragment,o),p=i(o),d=w(o,"P",{"data-svelte-h":!0}),T(d)!=="svelte-18by1ey"&&(d.innerHTML=c),x=i(o),g(I.$$.fragment,o),v=i(o),V=w(o,"P",{"data-svelte-h":!0}),T(V)!=="svelte-1mdvspu"&&(V.innerHTML=C),X=i(o),g(R.$$.fragment,o),J=i(o),W=w(o,"P",{"data-svelte-h":!0}),T(W)!=="svelte-1pd5few"&&(W.innerHTML=r),_=i(o),g(A.$$.fragment,o),E=i(o),F=w(o,"P",{"data-svelte-h":!0}),T(F)!=="svelte-1ymjqpq"&&(F.innerHTML=L),N=i(o),g(B.$$.fragment,o),Y=i(o),z=w(o,"P",{"data-svelte-h":!0}),T(z)!=="svelte-ffgub5"&&(z.innerHTML=h),k=i(o),g(H.$$.fragment,o),P=i(o),Q=w(o,"P",{"data-svelte-h":!0}),T(Q)!=="svelte-vh7z0v"&&(Q.textContent=Ve)},m(o,U){M(t,o,U),l(o,f,U),M(a,o,U),l(o,p,U),l(o,d,U),l(o,x,U),M(I,o,U),l(o,v,U),l(o,V,U),l(o,X,U),M(R,o,U),l(o,J,U),l(o,W,U),l(o,_,U),M(A,o,U),l(o,E,U),l(o,F,U),l(o,N,U),M(B,o,U),l(o,Y,U),l(o,z,U),l(o,k,U),M(H,o,U),l(o,P,U),l(o,Q,U),S=!0},p(o,U){const q={};U&2&&(q.$$scope={dirty:U,ctx:o}),t.$set(q)},i(o){S||(y(t.$$.fragment,o),y(a.$$.fragment,o),y(I.$$.fragment,o),y(R.$$.fragment,o),y(A.$$.fragment,o),y(B.$$.fragment,o),y(H.$$.fragment,o),S=!0)},o(o){j(t.$$.fragment,o),j(a.$$.fragment,o),j(I.$$.fragment,o),j(R.$$.fragment,o),j(A.$$.fragment,o),j(B.$$.fragment,o),j(H.$$.fragment,o),S=!1},d(o){o&&(s(f),s(p),s(d),s(x),s(v),s(V),s(X),s(J),s(W),s(_),s(E),s(F),s(N),s(Y),s(z),s(k),s(P),s(Q)),$(t,o),$(a,o),$(I,o),$(R,o),$(A,o),$(B,o),$(H,o)}}}function ds(G){let t,f;return t=new Re({props:{$$slots:{default:[hs]},$$scope:{ctx:G}}}),{c(){u(t.$$.fragment)},l(a){g(t.$$.fragment,a)},m(a,p){M(t,a,p),f=!0},p(a,p){const d={};p&2&&(d.$$scope={dirty:p,ctx:a}),t.$set(d)},i(a){f||(y(t.$$.fragment,a),f=!0)},o(a){j(t.$$.fragment,a),f=!1},d(a){$(t,a)}}}function us(G){let t,f=`因果言語モデリング用にモデルを微調整する方法のより詳細な例については、対応するドキュメントを参照してください。
<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=f},l(a){t=w(a,"P",{"data-svelte-h":!0}),T(t)!=="svelte-2qmraz"&&(t.innerHTML=f)},m(a,p){l(a,t,p)},p:te,d(a){a&&s(t)}}}function gs(G){let t,f="テキストをトークン化し、「input_ids」を PyTorch テンソルとして返します。",a,p,d,c,x=`<a href="/docs/transformers/main/ja/main_classes/text_generation#transformers.GenerationMixin.generate">generate()</a> メソッドを使用してテキストを生成します。
さまざまなテキスト生成戦略と生成を制御するためのパラメーターの詳細については、<a href="../generation_strategies">テキスト生成戦略</a> ページを参照してください。`,I,v,V,C,X="生成されたトークン ID をデコードしてテキストに戻します。",R,J,W;return p=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}}),v=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}}),J=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=f,a=m(),u(p.$$.fragment),d=m(),c=b("p"),c.innerHTML=x,I=m(),u(v.$$.fragment),V=m(),C=b("p"),C.textContent=X,R=m(),u(J.$$.fragment)},l(r){t=w(r,"P",{"data-svelte-h":!0}),T(t)!=="svelte-oq6k77"&&(t.textContent=f),a=i(r),g(p.$$.fragment,r),d=i(r),c=w(r,"P",{"data-svelte-h":!0}),T(c)!=="svelte-loeze1"&&(c.innerHTML=x),I=i(r),g(v.$$.fragment,r),V=i(r),C=w(r,"P",{"data-svelte-h":!0}),T(C)!=="svelte-izrqac"&&(C.textContent=X),R=i(r),g(J.$$.fragment,r)},m(r,_){l(r,t,_),l(r,a,_),M(p,r,_),l(r,d,_),l(r,c,_),l(r,I,_),M(v,r,_),l(r,V,_),l(r,C,_),l(r,R,_),M(J,r,_),W=!0},p:te,i(r){W||(y(p.$$.fragment,r),y(v.$$.fragment,r),y(J.$$.fragment,r),W=!0)},o(r){j(p.$$.fragment,r),j(v.$$.fragment,r),j(J.$$.fragment,r),W=!1},d(r){r&&(s(t),s(a),s(d),s(c),s(I),s(V),s(C),s(R)),$(p,r),$(v,r),$(J,r)}}}function Ms(G){let t,f;return t=new Re({props:{$$slots:{default:[gs]},$$scope:{ctx:G}}}),{c(){u(t.$$.fragment)},l(a){g(t.$$.fragment,a)},m(a,p){M(t,a,p),f=!0},p(a,p){const d={};p&2&&(d.$$scope={dirty:p,ctx:a}),t.$set(d)},i(a){f||(y(t.$$.fragment,a),f=!0)},o(a){j(t.$$.fragment,a),f=!1},d(a){$(t,a)}}}function ys(G){let t,f="テキストをトークン化し、<code>input_ids</code>を TensorFlow テンソルとして返します。",a,p,d,c,x='<a href="/docs/transformers/main/ja/main_classes/text_generation#transformers.TFGenerationMixin.generate">generate()</a> メソッドを使用して要約を作成します。さまざまなテキスト生成戦略と生成を制御するためのパラメーターの詳細については、<a href="../generation_strategies">テキスト生成戦略</a> ページを参照してください。',I,v,V,C,X="生成されたトークン ID をデコードしてテキストに戻します。",R,J,W;return p=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}}),v=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}}),J=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=f,a=m(),u(p.$$.fragment),d=m(),c=b("p"),c.innerHTML=x,I=m(),u(v.$$.fragment),V=m(),C=b("p"),C.textContent=X,R=m(),u(J.$$.fragment)},l(r){t=w(r,"P",{"data-svelte-h":!0}),T(t)!=="svelte-pv8irx"&&(t.innerHTML=f),a=i(r),g(p.$$.fragment,r),d=i(r),c=w(r,"P",{"data-svelte-h":!0}),T(c)!=="svelte-rfaq6z"&&(c.innerHTML=x),I=i(r),g(v.$$.fragment,r),V=i(r),C=w(r,"P",{"data-svelte-h":!0}),T(C)!=="svelte-izrqac"&&(C.textContent=X),R=i(r),g(J.$$.fragment,r)},m(r,_){l(r,t,_),l(r,a,_),M(p,r,_),l(r,d,_),l(r,c,_),l(r,I,_),M(v,r,_),l(r,V,_),l(r,C,_),l(r,R,_),M(J,r,_),W=!0},p:te,i(r){W||(y(p.$$.fragment,r),y(v.$$.fragment,r),y(J.$$.fragment,r),W=!0)},o(r){j(p.$$.fragment,r),j(v.$$.fragment,r),j(J.$$.fragment,r),W=!1},d(r){r&&(s(t),s(a),s(d),s(c),s(I),s(V),s(C),s(R)),$(p,r),$(v,r),$(J,r)}}}function js(G){let t,f;return t=new Re({props:{$$slots:{default:[ys]},$$scope:{ctx:G}}}),{c(){u(t.$$.fragment)},l(a){g(t.$$.fragment,a)},m(a,p){M(t,a,p),f=!0},p(a,p){const d={};p&2&&(d.$$scope={dirty:p,ctx:a}),t.$set(d)},i(a){f||(y(t.$$.fragment,a),f=!0)},o(a){j(t.$$.fragment,a),f=!1},d(a){$(t,a)}}}function $s(G){let t,f,a,p,d,c,x,I,v,V=`言語モデリングには、因果的モデリングとマスクされた言語モデリングの 2 つのタイプがあります。このガイドでは、因果関係のある言語モデリングについて説明します。
因果言語モデルはテキスト生成によく使用されます。これらのモデルは、次のようなクリエイティブなアプリケーションに使用できます。
独自のテキスト アドベンチャーを選択するか、Copilot や CodeParrot などのインテリジェントなコーディング アシスタントを選択します。`,C,X,R,J,W=`因果言語モデリングは、一連のトークン内の次のトークンを予測します。モデルは、次のトークンにのみ対応できます。
左。これは、モデルが将来のトークンを認識できないことを意味します。 GPT-2 は因果的言語モデルの一例です。`,r,_,A="このガイドでは、次の方法を説明します。",E,F,L='<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/distilgpt2" rel="nofollow">DistilGPT2</a> を微調整します。 /huggingface.co/datasets/eli5) データセット。</li> <li>微調整したモデルを推論に使用します。</li>',N,B,Y,z,h="始める前に、必要なライブラリがすべてインストールされていることを確認してください。",k,H,P,Q,Ve="モデルをアップロードしてコミュニティと共有できるように、Hugging Face アカウントにログインすることをお勧めします。プロンプトが表示されたら、トークンを入力してログインします。",S,o,U,q,Be,se,_t=`まず、ELI5 データセットの r/askscience サブセットの小さいサブセットを 🤗 データセット ライブラリからロードします。
これにより、完全なデータセットのトレーニングにさらに時間を費やす前に、実験してすべてが機能することを確認する機会が得られます。`,Fe,ae,ze,le,Jt="<code>train_test_split</code> メソッドを使用して、データセットの <code>train_asks</code> をトレイン セットとテスト セットに分割します。",He,ne,Ee,re,xt="次に、例を見てみましょう。",Ye,pe,Ae,oe,Ut=`これは多くのことのように見えるかもしれませんが、実際に関心があるのは<code>text</code>フィールドだけです。言語モデリングの優れている点
タスクでは、次の単語がラベル * であるため、ラベル (教師なしタスクとも呼ばれます) は必要ありません。`,Qe,me,Le,ie,Ne,ce,kt="次のステップは、<code>text</code>サブフィールドを処理するために DistilGPT2 トークナイザーをロードすることです。",qe,fe,Pe,he,Gt=`上の例からわかるように、<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> サブフィールドを抽出します。`,Se,de,De,ue,vt=`<code>answers</code>接頭辞で示されるように、各サブフィールドは個別の列になり、<code>text</code>フィールドはリストになりました。その代わり
各文を個別にトークン化する場合は、リストを文字列に変換して、それらをまとめてトークン化できるようにします。`,Ke,ge,Ct="以下は、各例の文字列のリストを結合し、結果をトークン化する最初の前処理関数です。",Oe,Me,et,ye,Zt="この前処理関数をデータセット全体に適用するには、🤗 Datasets <code>map</code> メソッドを使用します。 <code>map</code> 関数を高速化するには、<code>batched=True</code> を設定してデータセットの複数の要素を一度に処理し、<code>num_proc</code> でプロセスの数を増やします。不要な列を削除します。",tt,je,st,$e,It="このデータセットにはトークン シーケンスが含まれていますが、その一部はモデルの最大入力長よりも長くなります。",at,be,Rt="2 番目の前処理関数を使用して、",lt,we,Vt="<li>すべてのシーケンスを連結します</li> <li>連結されたシーケンスを<code>block_size</code>で定義された短いチャンクに分割します。これは、最大入力長より短く、GPU RAM に十分な長さである必要があります。</li>",nt,Te,rt,_e,Wt="Apply the <code>group_texts</code> function over the entire dataset:",pt,Je,ot,xe,Xt=`次に、<code>DataCollat​​orForLanguageModeling</code> を使用してサンプルのバッチを作成します。 <em>動的にパディング</em>する方が効率的です。
データセット全体を最大長までパディングするのではなく、照合中にバッチ内の文を最長の長さにします。`,mt,D,it,Ue,ct,K,ft,O,ht,ke,dt,Ge,Bt="モデルを微調整したので、それを推論に使用できるようになりました。",ut,ve,Ft="テキストを生成するプロンプトを考え出します。",gt,Ce,Mt,Ze,zt='推論用に微調整されたモデルを試す最も簡単な方法は、それを <a href="/docs/transformers/main/ja/main_classes/pipelines#transformers.pipeline">pipeline()</a> で使用することです。モデルを使用してテキスト生成用の<code>pipeline</code>をインスタンス化し、それにテキストを渡します。',yt,Ie,jt,ee,$t,We,bt;return d=new Xe({props:{title:"Causal language modeling",local:"causal-language-modeling",headingTag:"h1"}}),x=new as({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 qt({props:{id:"Vpjb1lu0MDk"}}),B=new wt({props:{$$slots:{default:[ls]},$$scope:{ctx:G}}}),H=new Z({props:{code:"cGlwJTIwaW5zdGFsbCUyMHRyYW5zZm9ybWVycyUyMGRhdGFzZXRzJTIwZXZhbHVhdGU=",highlighted:"pip install transformers datasets evaluate",wrap:!1}}),o=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 Xe({props:{title:"Load ELI5 dataset",local:"load-eli5-dataset",headingTag:"h2"}}),ae=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}}),ne=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}}),pe=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}}),me=new Xe({props:{title:"Preprocess",local:"preprocess",headingTag:"h2"}}),ie=new qt({props:{id:"ma1TrR7gE7I"}}),fe=new Z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJkaXN0aWxncHQyJTIyKQ==",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;distilgpt2&quot;</span>)`,wrap:!1}}),de=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}}),Me=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}}),je=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}}),Te=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}}),Je=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 Tt({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[os],pytorch:[rs]},$$scope:{ctx:G}}}),Ue=new Xe({props:{title:"Train",local:"train",headingTag:"h2"}}),K=new Tt({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[ds],pytorch:[cs]},$$scope:{ctx:G}}}),O=new wt({props:{$$slots:{default:[us]},$$scope:{ctx:G}}}),ke=new Xe({props:{title:"Inference",local:"inference",headingTag:"h2"}}),Ce=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}}),Ie=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}}),ee=new Tt({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[js],pytorch:[Ms]},$$scope:{ctx:G}}}),{c(){t=b("meta"),f=m(),a=b("p"),p=m(),u(d.$$.fragment),c=m(),u(x.$$.fragment),I=m(),v=b("p"),v.textContent=V,C=m(),u(X.$$.fragment),R=m(),J=b("p"),J.textContent=W,r=m(),_=b("p"),_.textContent=A,E=m(),F=b("ol"),F.innerHTML=L,N=m(),u(B.$$.fragment),Y=m(),z=b("p"),z.textContent=h,k=m(),u(H.$$.fragment),P=m(),Q=b("p"),Q.textContent=Ve,S=m(),u(o.$$.fragment),U=m(),u(q.$$.fragment),Be=m(),se=b("p"),se.textContent=_t,Fe=m(),u(ae.$$.fragment),ze=m(),le=b("p"),le.innerHTML=Jt,He=m(),u(ne.$$.fragment),Ee=m(),re=b("p"),re.textContent=xt,Ye=m(),u(pe.$$.fragment),Ae=m(),oe=b("p"),oe.innerHTML=Ut,Qe=m(),u(me.$$.fragment),Le=m(),u(ie.$$.fragment),Ne=m(),ce=b("p"),ce.innerHTML=kt,qe=m(),u(fe.$$.fragment),Pe=m(),he=b("p"),he.innerHTML=Gt,Se=m(),u(de.$$.fragment),De=m(),ue=b("p"),ue.innerHTML=vt,Ke=m(),ge=b("p"),ge.textContent=Ct,Oe=m(),u(Me.$$.fragment),et=m(),ye=b("p"),ye.innerHTML=Zt,tt=m(),u(je.$$.fragment),st=m(),$e=b("p"),$e.textContent=It,at=m(),be=b("p"),be.textContent=Rt,lt=m(),we=b("ul"),we.innerHTML=Vt,nt=m(),u(Te.$$.fragment),rt=m(),_e=b("p"),_e.innerHTML=Wt,pt=m(),u(Je.$$.fragment),ot=m(),xe=b("p"),xe.innerHTML=Xt,mt=m(),u(D.$$.fragment),it=m(),u(Ue.$$.fragment),ct=m(),u(K.$$.fragment),ft=m(),u(O.$$.fragment),ht=m(),u(ke.$$.fragment),dt=m(),Ge=b("p"),Ge.textContent=Bt,ut=m(),ve=b("p"),ve.textContent=Ft,gt=m(),u(Ce.$$.fragment),Mt=m(),Ze=b("p"),Ze.innerHTML=zt,yt=m(),u(Ie.$$.fragment),jt=m(),u(ee.$$.fragment),$t=m(),We=b("p"),this.h()},l(e){const n=Ot("svelte-u9bgzb",document.head);t=w(n,"META",{name:!0,content:!0}),n.forEach(s),f=i(e),a=w(e,"P",{}),Lt(a).forEach(s),p=i(e),g(d.$$.fragment,e),c=i(e),g(x.$$.fragment,e),I=i(e),v=w(e,"P",{"data-svelte-h":!0}),T(v)!=="svelte-1yyz4on"&&(v.textContent=V),C=i(e),g(X.$$.fragment,e),R=i(e),J=w(e,"P",{"data-svelte-h":!0}),T(J)!=="svelte-1q0t2hv"&&(J.textContent=W),r=i(e),_=w(e,"P",{"data-svelte-h":!0}),T(_)!=="svelte-w5jzhi"&&(_.textContent=A),E=i(e),F=w(e,"OL",{"data-svelte-h":!0}),T(F)!=="svelte-xzm2f"&&(F.innerHTML=L),N=i(e),g(B.$$.fragment,e),Y=i(e),z=w(e,"P",{"data-svelte-h":!0}),T(z)!=="svelte-1lya3k8"&&(z.textContent=h),k=i(e),g(H.$$.fragment,e),P=i(e),Q=w(e,"P",{"data-svelte-h":!0}),T(Q)!=="svelte-193zy02"&&(Q.textContent=Ve),S=i(e),g(o.$$.fragment,e),U=i(e),g(q.$$.fragment,e),Be=i(e),se=w(e,"P",{"data-svelte-h":!0}),T(se)!=="svelte-vg7xut"&&(se.textContent=_t),Fe=i(e),g(ae.$$.fragment,e),ze=i(e),le=w(e,"P",{"data-svelte-h":!0}),T(le)!=="svelte-1ohvh79"&&(le.innerHTML=Jt),He=i(e),g(ne.$$.fragment,e),Ee=i(e),re=w(e,"P",{"data-svelte-h":!0}),T(re)!=="svelte-1r6oj5w"&&(re.textContent=xt),Ye=i(e),g(pe.$$.fragment,e),Ae=i(e),oe=w(e,"P",{"data-svelte-h":!0}),T(oe)!=="svelte-cl288g"&&(oe.innerHTML=Ut),Qe=i(e),g(me.$$.fragment,e),Le=i(e),g(ie.$$.fragment,e),Ne=i(e),ce=w(e,"P",{"data-svelte-h":!0}),T(ce)!=="svelte-tp55im"&&(ce.innerHTML=kt),qe=i(e),g(fe.$$.fragment,e),Pe=i(e),he=w(e,"P",{"data-svelte-h":!0}),T(he)!=="svelte-xo485t"&&(he.innerHTML=Gt),Se=i(e),g(de.$$.fragment,e),De=i(e),ue=w(e,"P",{"data-svelte-h":!0}),T(ue)!=="svelte-jgh86y"&&(ue.innerHTML=vt),Ke=i(e),ge=w(e,"P",{"data-svelte-h":!0}),T(ge)!=="svelte-177qfmt"&&(ge.textContent=Ct),Oe=i(e),g(Me.$$.fragment,e),et=i(e),ye=w(e,"P",{"data-svelte-h":!0}),T(ye)!=="svelte-1l40k3u"&&(ye.innerHTML=Zt),tt=i(e),g(je.$$.fragment,e),st=i(e),$e=w(e,"P",{"data-svelte-h":!0}),T($e)!=="svelte-1bsb6if"&&($e.textContent=It),at=i(e),be=w(e,"P",{"data-svelte-h":!0}),T(be)!=="svelte-1jnll4i"&&(be.textContent=Rt),lt=i(e),we=w(e,"UL",{"data-svelte-h":!0}),T(we)!=="svelte-1r1l6ld"&&(we.innerHTML=Vt),nt=i(e),g(Te.$$.fragment,e),rt=i(e),_e=w(e,"P",{"data-svelte-h":!0}),T(_e)!=="svelte-1o69amy"&&(_e.innerHTML=Wt),pt=i(e),g(Je.$$.fragment,e),ot=i(e),xe=w(e,"P",{"data-svelte-h":!0}),T(xe)!=="svelte-1v01q1n"&&(xe.innerHTML=Xt),mt=i(e),g(D.$$.fragment,e),it=i(e),g(Ue.$$.fragment,e),ct=i(e),g(K.$$.fragment,e),ft=i(e),g(O.$$.fragment,e),ht=i(e),g(ke.$$.fragment,e),dt=i(e),Ge=w(e,"P",{"data-svelte-h":!0}),T(Ge)!=="svelte-cyrfc8"&&(Ge.textContent=Bt),ut=i(e),ve=w(e,"P",{"data-svelte-h":!0}),T(ve)!=="svelte-lyo9y"&&(ve.textContent=Ft),gt=i(e),g(Ce.$$.fragment,e),Mt=i(e),Ze=w(e,"P",{"data-svelte-h":!0}),T(Ze)!=="svelte-1cvcpc5"&&(Ze.innerHTML=zt),yt=i(e),g(Ie.$$.fragment,e),jt=i(e),g(ee.$$.fragment,e),$t=i(e),We=w(e,"P",{}),Lt(We).forEach(s),this.h()},h(){Nt(t,"name","hf:doc:metadata"),Nt(t,"content",bs)},m(e,n){es(document.head,t),l(e,f,n),l(e,a,n),l(e,p,n),M(d,e,n),l(e,c,n),M(x,e,n),l(e,I,n),l(e,v,n),l(e,C,n),M(X,e,n),l(e,R,n),l(e,J,n),l(e,r,n),l(e,_,n),l(e,E,n),l(e,F,n),l(e,N,n),M(B,e,n),l(e,Y,n),l(e,z,n),l(e,k,n),M(H,e,n),l(e,P,n),l(e,Q,n),l(e,S,n),M(o,e,n),l(e,U,n),M(q,e,n),l(e,Be,n),l(e,se,n),l(e,Fe,n),M(ae,e,n),l(e,ze,n),l(e,le,n),l(e,He,n),M(ne,e,n),l(e,Ee,n),l(e,re,n),l(e,Ye,n),M(pe,e,n),l(e,Ae,n),l(e,oe,n),l(e,Qe,n),M(me,e,n),l(e,Le,n),M(ie,e,n),l(e,Ne,n),l(e,ce,n),l(e,qe,n),M(fe,e,n),l(e,Pe,n),l(e,he,n),l(e,Se,n),M(de,e,n),l(e,De,n),l(e,ue,n),l(e,Ke,n),l(e,ge,n),l(e,Oe,n),M(Me,e,n),l(e,et,n),l(e,ye,n),l(e,tt,n),M(je,e,n),l(e,st,n),l(e,$e,n),l(e,at,n),l(e,be,n),l(e,lt,n),l(e,we,n),l(e,nt,n),M(Te,e,n),l(e,rt,n),l(e,_e,n),l(e,pt,n),M(Je,e,n),l(e,ot,n),l(e,xe,n),l(e,mt,n),M(D,e,n),l(e,it,n),M(Ue,e,n),l(e,ct,n),M(K,e,n),l(e,ft,n),M(O,e,n),l(e,ht,n),M(ke,e,n),l(e,dt,n),l(e,Ge,n),l(e,ut,n),l(e,ve,n),l(e,gt,n),M(Ce,e,n),l(e,Mt,n),l(e,Ze,n),l(e,yt,n),M(Ie,e,n),l(e,jt,n),M(ee,e,n),l(e,$t,n),l(e,We,n),bt=!0},p(e,[n]){const Ht={};n&2&&(Ht.$$scope={dirty:n,ctx:e}),B.$set(Ht);const Et={};n&2&&(Et.$$scope={dirty:n,ctx:e}),D.$set(Et);const Yt={};n&2&&(Yt.$$scope={dirty:n,ctx:e}),K.$set(Yt);const At={};n&2&&(At.$$scope={dirty:n,ctx:e}),O.$set(At);const Qt={};n&2&&(Qt.$$scope={dirty:n,ctx:e}),ee.$set(Qt)},i(e){bt||(y(d.$$.fragment,e),y(x.$$.fragment,e),y(X.$$.fragment,e),y(B.$$.fragment,e),y(H.$$.fragment,e),y(o.$$.fragment,e),y(q.$$.fragment,e),y(ae.$$.fragment,e),y(ne.$$.fragment,e),y(pe.$$.fragment,e),y(me.$$.fragment,e),y(ie.$$.fragment,e),y(fe.$$.fragment,e),y(de.$$.fragment,e),y(Me.$$.fragment,e),y(je.$$.fragment,e),y(Te.$$.fragment,e),y(Je.$$.fragment,e),y(D.$$.fragment,e),y(Ue.$$.fragment,e),y(K.$$.fragment,e),y(O.$$.fragment,e),y(ke.$$.fragment,e),y(Ce.$$.fragment,e),y(Ie.$$.fragment,e),y(ee.$$.fragment,e),bt=!0)},o(e){j(d.$$.fragment,e),j(x.$$.fragment,e),j(X.$$.fragment,e),j(B.$$.fragment,e),j(H.$$.fragment,e),j(o.$$.fragment,e),j(q.$$.fragment,e),j(ae.$$.fragment,e),j(ne.$$.fragment,e),j(pe.$$.fragment,e),j(me.$$.fragment,e),j(ie.$$.fragment,e),j(fe.$$.fragment,e),j(de.$$.fragment,e),j(Me.$$.fragment,e),j(je.$$.fragment,e),j(Te.$$.fragment,e),j(Je.$$.fragment,e),j(D.$$.fragment,e),j(Ue.$$.fragment,e),j(K.$$.fragment,e),j(O.$$.fragment,e),j(ke.$$.fragment,e),j(Ce.$$.fragment,e),j(Ie.$$.fragment,e),j(ee.$$.fragment,e),bt=!1},d(e){e&&(s(f),s(a),s(p),s(c),s(I),s(v),s(C),s(R),s(J),s(r),s(_),s(E),s(F),s(N),s(Y),s(z),s(k),s(P),s(Q),s(S),s(U),s(Be),s(se),s(Fe),s(ze),s(le),s(He),s(Ee),s(re),s(Ye),s(Ae),s(oe),s(Qe),s(Le),s(Ne),s(ce),s(qe),s(Pe),s(he),s(Se),s(De),s(ue),s(Ke),s(ge),s(Oe),s(et),s(ye),s(tt),s(st),s($e),s(at),s(be),s(lt),s(we),s(nt),s(rt),s(_e),s(pt),s(ot),s(xe),s(mt),s(it),s(ct),s(ft),s(ht),s(dt),s(Ge),s(ut),s(ve),s(gt),s(Mt),s(Ze),s(yt),s(jt),s($t),s(We)),s(t),$(d,e),$(x,e),$(X,e),$(B,e),$(H,e),$(o,e),$(q,e),$(ae,e),$(ne,e),$(pe,e),$(me,e),$(ie,e),$(fe,e),$(de,e),$(Me,e),$(je,e),$(Te,e),$(Je,e),$(D,e),$(Ue,e),$(K,e),$(O,e),$(ke,e),$(Ce,e),$(Ie,e),$(ee,e)}}}const bs='{"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 ws(G){return St(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Cs extends Dt{constructor(t){super(),Kt(this,t,ws,$s,Pt,{})}}export{Cs as component};
