import{s as qt,o as St,n as es}from"../chunks/scheduler.9bc65507.js";import{S as Pt,i as Dt,g as $,s as o,r as M,A as Kt,h as w,f as l,c as i,j as Nt,u as g,x as T,k as At,y as Ot,a,v as d,d as j,t as y,w as b}from"../chunks/index.707bf1b6.js";import{T as wt}from"../chunks/Tip.c2ecdbf4.js";import{Y as Lt}from"../chunks/Youtube.e1129c6f.js";import{C as v}from"../chunks/CodeBlock.54a9f38d.js";import{D as se}from"../chunks/DocNotebookDropdown.41f65cb5.js";import{F as Tt,M as Vs}from"../chunks/Markdown.8ab98a13.js";import{H as zs,E as te}from"../chunks/EditOnGithub.922df6ba.js";function ee(Z){let t,f='このタスクと互換性のあるすべてのアーキテクチャとチェックポイントを確認するには、<a href="https://huggingface.co/tasks/fill-mask" rel="nofollow">タスクページ</a> を確認することをお勧めします。';return{c(){t=$("p"),t.innerHTML=f},l(e){t=w(e,"P",{"data-svelte-h":!0}),T(t)!=="svelte-om1ujy"&&(t.innerHTML=f)},m(e,m){a(e,t,m)},p:es,d(e){e&&l(t)}}}function le(Z){let t,f="シーケンス終了トークンをパディング トークンとして使用し、データを反復するたびにランダムにトークンをマスクするために <code>mlm_probability</code> を指定します。",e,m,u;return m=new v({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERhdGFDb2xsYXRvckZvckxhbmd1YWdlTW9kZWxpbmclMEElMEF0b2tlbml6ZXIucGFkX3Rva2VuJTIwJTNEJTIwdG9rZW5pemVyLmVvc190b2tlbiUwQWRhdGFfY29sbGF0b3IlMjAlM0QlMjBEYXRhQ29sbGF0b3JGb3JMYW5ndWFnZU1vZGVsaW5nKHRva2VuaXplciUzRHRva2VuaXplciUyQyUyMG1sbV9wcm9iYWJpbGl0eSUzRDAuMTUp",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_probability=<span class="hljs-number">0.15</span>)`,wrap:!1}}),{c(){t=$("p"),t.innerHTML=f,e=o(),M(m.$$.fragment)},l(h){t=w(h,"P",{"data-svelte-h":!0}),T(t)!=="svelte-dtctdf"&&(t.innerHTML=f),e=i(h),g(m.$$.fragment,h)},m(h,G){a(h,t,G),a(h,e,G),d(m,h,G),u=!0},p:es,i(h){u||(j(m.$$.fragment,h),u=!0)},o(h){y(m.$$.fragment,h),u=!1},d(h){h&&(l(t),l(e)),b(m,h)}}}function ae(Z){let t,f;return t=new Vs({props:{$$slots:{default:[le]},$$scope:{ctx:Z}}}),{c(){M(t.$$.fragment)},l(e){g(t.$$.fragment,e)},m(e,m){d(t,e,m),f=!0},p(e,m){const u={};m&2&&(u.$$scope={dirty:m,ctx:e}),t.$set(u)},i(e){f||(j(t.$$.fragment,e),f=!0)},o(e){y(t.$$.fragment,e),f=!1},d(e){b(t,e)}}}function ne(Z){let t,f="シーケンス終了トークンをパディング トークンとして使用し、データを反復するたびにランダムにトークンをマスクするために <code>mlm_probability</code> を指定します。",e,m,u;return m=new v({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERhdGFDb2xsYXRvckZvckxhbmd1YWdlTW9kZWxpbmclMEElMEFkYXRhX2NvbGxhdG9yJTIwJTNEJTIwRGF0YUNvbGxhdG9yRm9yTGFuZ3VhZ2VNb2RlbGluZyh0b2tlbml6ZXIlM0R0b2tlbml6ZXIlMkMlMjBtbG1fcHJvYmFiaWxpdHklM0QwLjE1JTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJ0ZiUyMik=",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_probability=<span class="hljs-number">0.15</span>, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)`,wrap:!1}}),{c(){t=$("p"),t.innerHTML=f,e=o(),M(m.$$.fragment)},l(h){t=w(h,"P",{"data-svelte-h":!0}),T(t)!=="svelte-dtctdf"&&(t.innerHTML=f),e=i(h),g(m.$$.fragment,h)},m(h,G){a(h,t,G),a(h,e,G),d(m,h,G),u=!0},p:es,i(h){u||(j(m.$$.fragment,h),u=!0)},o(h){y(m.$$.fragment,h),u=!1},d(h){h&&(l(t),l(e)),b(m,h)}}}function pe(Z){let t,f;return t=new Vs({props:{$$slots:{default:[ne]},$$scope:{ctx:Z}}}),{c(){M(t.$$.fragment)},l(e){g(t.$$.fragment,e)},m(e,m){d(t,e,m),f=!0},p(e,m){const u={};m&2&&(u.$$scope={dirty:m,ctx:e}),t.$set(u)},i(e){f||(j(t.$$.fragment,e),f=!0)},o(e){y(t.$$.fragment,e),f=!1},d(e){b(t,e)}}}function re(Z){let t,f='<a href="/docs/transformers/pr_30929/ja/main_classes/trainer#transformers.Trainer">Trainer</a> を使用したモデルの微調整に慣れていない場合は、<a href="../training#train-with-pytorch-trainer">ここ</a> の基本的なチュートリアルをご覧ください。';return{c(){t=$("p"),t.innerHTML=f},l(e){t=w(e,"P",{"data-svelte-h":!0}),T(t)!=="svelte-sp3oib"&&(t.innerHTML=f)},m(e,m){a(e,t,m)},p:es,d(e){e&&l(t)}}}function oe(Z){let t,f,e,m='これでモデルのトレーニングを開始する準備が整いました。 <a href="/docs/transformers/pr_30929/ja/model_doc/auto#transformers.AutoModelForMaskedLM">AutoModelForMaskedLM</a> を使用して DistilRoBERTa をロードします。',u,h,G,C,W="この時点で残っている手順は次の 3 つだけです。",R,k,F='<li><a href="/docs/transformers/pr_30929/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_30929/ja/main_classes/trainer#transformers.Trainer">Trainer</a> に渡します。</li> <li><a href="/docs/transformers/pr_30929/ja/main_classes/trainer#transformers.Trainer.train">train()</a> を呼び出してモデルを微調整します。</li>',I,U,X,p,_='トレーニングが完了したら、 <a href="/docs/transformers/pr_30929/ja/main_classes/trainer#transformers.Trainer.evaluate">evaluate()</a> メソッドを使用してモデルを評価し、その複雑さを取得します。',H,E,B,V,Q='次に、 <a href="/docs/transformers/pr_30929/ja/main_classes/trainer#transformers.Trainer.push_to_hub">push_to_hub()</a> メソッドを使用してモデルをハブに共有し、誰もがモデルを使用できるようにします。',Y,N,z;return t=new wt({props:{$$slots:{default:[re]},$$scope:{ctx:Z}}}),h=new v({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvck1hc2tlZExNJTBBJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JNYXNrZWRMTS5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsYmVydCUyRmRpc3RpbHJvYmVydGEtYmFzZSUyMik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForMaskedLM

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForMaskedLM.from_pretrained(<span class="hljs-string">&quot;distilbert/distilroberta-base&quot;</span>)`,wrap:!1}}),U=new v({props:{code:"dHJhaW5pbmdfYXJncyUyMCUzRCUyMFRyYWluaW5nQXJndW1lbnRzKCUwQSUyMCUyMCUyMCUyMG91dHB1dF9kaXIlM0QlMjJteV9hd2Vzb21lX2VsaTVfbWxtX21vZGVsJTIyJTJDJTBBJTIwJTIwJTIwJTIwZXZhbF9zdHJhdGVneSUzRCUyMmVwb2NoJTIyJTJDJTBBJTIwJTIwJTIwJTIwbGVhcm5pbmdfcmF0ZSUzRDJlLTUlMkMlMEElMjAlMjAlMjAlMjBudW1fdHJhaW5fZXBvY2hzJTNEMyUyQyUwQSUyMCUyMCUyMCUyMHdlaWdodF9kZWNheSUzRDAuMDElMkMlMEElMjAlMjAlMjAlMjBwdXNoX3RvX2h1YiUzRFRydWUlMkMlMEEpJTBBJTBBdHJhaW5lciUyMCUzRCUyMFRyYWluZXIoJTBBJTIwJTIwJTIwJTIwbW9kZWwlM0Rtb2RlbCUyQyUwQSUyMCUyMCUyMCUyMGFyZ3MlM0R0cmFpbmluZ19hcmdzJTJDJTBBJTIwJTIwJTIwJTIwdHJhaW5fZGF0YXNldCUzRGxtX2RhdGFzZXQlNUIlMjJ0cmFpbiUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMGV2YWxfZGF0YXNldCUzRGxtX2RhdGFzZXQlNUIlMjJ0ZXN0JTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwZGF0YV9jb2xsYXRvciUzRGRhdGFfY29sbGF0b3IlMkMlMEEpJTBBJTBBdHJhaW5lci50cmFpbigp",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_mlm_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>    num_train_epochs=<span class="hljs-number">3</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 v({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">8.76</span>`,wrap:!1}}),N=new v({props:{code:"dHJhaW5lci5wdXNoX3RvX2h1Yigp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.push_to_hub()',wrap:!1}}),{c(){M(t.$$.fragment),f=o(),e=$("p"),e.innerHTML=m,u=o(),M(h.$$.fragment),G=o(),C=$("p"),C.textContent=W,R=o(),k=$("ol"),k.innerHTML=F,I=o(),M(U.$$.fragment),X=o(),p=$("p"),p.innerHTML=_,H=o(),M(E.$$.fragment),B=o(),V=$("p"),V.innerHTML=Q,Y=o(),M(N.$$.fragment)},l(c){g(t.$$.fragment,c),f=i(c),e=w(c,"P",{"data-svelte-h":!0}),T(e)!=="svelte-1r3bkfa"&&(e.innerHTML=m),u=i(c),g(h.$$.fragment,c),G=i(c),C=w(c,"P",{"data-svelte-h":!0}),T(C)!=="svelte-1j8bgyv"&&(C.textContent=W),R=i(c),k=w(c,"OL",{"data-svelte-h":!0}),T(k)!=="svelte-11a1yfj"&&(k.innerHTML=F),I=i(c),g(U.$$.fragment,c),X=i(c),p=w(c,"P",{"data-svelte-h":!0}),T(p)!=="svelte-mzv902"&&(p.innerHTML=_),H=i(c),g(E.$$.fragment,c),B=i(c),V=w(c,"P",{"data-svelte-h":!0}),T(V)!=="svelte-g6l52d"&&(V.innerHTML=Q),Y=i(c),g(N.$$.fragment,c)},m(c,x){d(t,c,x),a(c,f,x),a(c,e,x),a(c,u,x),d(h,c,x),a(c,G,x),a(c,C,x),a(c,R,x),a(c,k,x),a(c,I,x),d(U,c,x),a(c,X,x),a(c,p,x),a(c,H,x),d(E,c,x),a(c,B,x),a(c,V,x),a(c,Y,x),d(N,c,x),z=!0},p(c,x){const A={};x&2&&(A.$$scope={dirty:x,ctx:c}),t.$set(A)},i(c){z||(j(t.$$.fragment,c),j(h.$$.fragment,c),j(U.$$.fragment,c),j(E.$$.fragment,c),j(N.$$.fragment,c),z=!0)},o(c){y(t.$$.fragment,c),y(h.$$.fragment,c),y(U.$$.fragment,c),y(E.$$.fragment,c),y(N.$$.fragment,c),z=!1},d(c){c&&(l(f),l(e),l(u),l(G),l(C),l(R),l(k),l(I),l(X),l(p),l(H),l(B),l(V),l(Y)),b(t,c),b(h,c),b(U,c),b(E,c),b(N,c)}}}function ie(Z){let t,f;return t=new Vs({props:{$$slots:{default:[oe]},$$scope:{ctx:Z}}}),{c(){M(t.$$.fragment)},l(e){g(t.$$.fragment,e)},m(e,m){d(t,e,m),f=!0},p(e,m){const u={};m&2&&(u.$$scope={dirty:m,ctx:e}),t.$set(u)},i(e){f||(j(t.$$.fragment,e),f=!0)},o(e){y(t.$$.fragment,e),f=!1},d(e){b(t,e)}}}function me(Z){let t,f='Keras を使用したモデルの微調整に慣れていない場合は、<a href="../training#train-a-tensorflow-model-with-keras">こちら</a> の基本的なチュートリアルをご覧ください。';return{c(){t=$("p"),t.innerHTML=f},l(e){t=w(e,"P",{"data-svelte-h":!0}),T(t)!=="svelte-1jwo7q8"&&(t.innerHTML=f)},m(e,m){a(e,t,m)},p:es,d(e){e&&l(t)}}}function ce(Z){let t,f,e,m="TensorFlow でモデルを微調整するには、オプティマイザー関数、学習率スケジュール、およびいくつかのトレーニング ハイパーパラメーターをセットアップすることから始めます。",u,h,G,C,W='次に、<a href="/docs/transformers/pr_30929/ja/model_doc/auto#transformers.TFAutoModelForMaskedLM">TFAutoModelForMaskedLM</a> を使用して DistilRoBERTa をロードできます。',R,k,F,I,U='<a href="/docs/transformers/pr_30929/ja/main_classes/model#transformers.TFPreTrainedModel.prepare_tf_dataset">prepare_tf_dataset()</a> を使用して、データセットを <code>tf.data.Dataset</code> 形式に変換します。',X,p,_,H,E='<a href="https://keras.io/api/models/model_training_apis/#compile-method" rel="nofollow"><code>compile</code></a> を使用してトレーニング用のモデルを設定します。 Transformers モデルにはすべてデフォルトのタスク関連の損失関数があるため、次の場合を除き、損失関数を指定する必要はないことに注意してください。',B,V,Q,Y,N='This can be done by specifying where to push your model and tokenizer in the <a href="/docs/transformers/pr_30929/ja/main_classes/keras_callbacks#transformers.PushToHubCallback">PushToHubCallback</a>:',z,c,x,A,ls='ついに、モデルのトレーニングを開始する準備が整いました。トレーニングおよび検証データセット、エポック数、コールバックを指定して <a href="https://keras.io/api/models/model_training_apis/#fit-method" rel="nofollow"><code>fit</code></a> を呼び出し、モデルを微調整します。',L,q,S,P,D="トレーニングが完了すると、モデルは自動的にハブにアップロードされ、誰でも使用できるようになります。",as;return t=new wt({props:{$$slots:{default:[me]},$$scope:{ctx:Z}}}),h=new v({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}}),k=new v({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGQXV0b01vZGVsRm9yTWFza2VkTE0lMEElMEFtb2RlbCUyMCUzRCUyMFRGQXV0b01vZGVsRm9yTWFza2VkTE0uZnJvbV9wcmV0cmFpbmVkKCUyMmRpc3RpbGJlcnQlMkZkaXN0aWxyb2JlcnRhLWJhc2UlMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFAutoModelForMaskedLM

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFAutoModelForMaskedLM.from_pretrained(<span class="hljs-string">&quot;distilbert/distilroberta-base&quot;</span>)`,wrap:!1}}),p=new v({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}}),V=new v({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}}),c=new v({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycy5rZXJhc19jYWxsYmFja3MlMjBpbXBvcnQlMjBQdXNoVG9IdWJDYWxsYmFjayUwQSUwQWNhbGxiYWNrJTIwJTNEJTIwUHVzaFRvSHViQ2FsbGJhY2soJTBBJTIwJTIwJTIwJTIwb3V0cHV0X2RpciUzRCUyMm15X2F3ZXNvbWVfZWxpNV9tbG1fbW9kZWwlMjIlMkMlMEElMjAlMjAlMjAlMjB0b2tlbml6ZXIlM0R0b2tlbml6ZXIlMkMlMEEp",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_mlm_model&quot;</span>,
<span class="hljs-meta">... </span>    tokenizer=tokenizer,
<span class="hljs-meta">... </span>)`,wrap:!1}}),q=new v({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(){M(t.$$.fragment),f=o(),e=$("p"),e.textContent=m,u=o(),M(h.$$.fragment),G=o(),C=$("p"),C.innerHTML=W,R=o(),M(k.$$.fragment),F=o(),I=$("p"),I.innerHTML=U,X=o(),M(p.$$.fragment),_=o(),H=$("p"),H.innerHTML=E,B=o(),M(V.$$.fragment),Q=o(),Y=$("p"),Y.innerHTML=N,z=o(),M(c.$$.fragment),x=o(),A=$("p"),A.innerHTML=ls,L=o(),M(q.$$.fragment),S=o(),P=$("p"),P.textContent=D},l(r){g(t.$$.fragment,r),f=i(r),e=w(r,"P",{"data-svelte-h":!0}),T(e)!=="svelte-7f4w1i"&&(e.textContent=m),u=i(r),g(h.$$.fragment,r),G=i(r),C=w(r,"P",{"data-svelte-h":!0}),T(C)!=="svelte-1jm40yj"&&(C.innerHTML=W),R=i(r),g(k.$$.fragment,r),F=i(r),I=w(r,"P",{"data-svelte-h":!0}),T(I)!=="svelte-vie6qn"&&(I.innerHTML=U),X=i(r),g(p.$$.fragment,r),_=i(r),H=w(r,"P",{"data-svelte-h":!0}),T(H)!=="svelte-1pd5few"&&(H.innerHTML=E),B=i(r),g(V.$$.fragment,r),Q=i(r),Y=w(r,"P",{"data-svelte-h":!0}),T(Y)!=="svelte-fprqkk"&&(Y.innerHTML=N),z=i(r),g(c.$$.fragment,r),x=i(r),A=w(r,"P",{"data-svelte-h":!0}),T(A)!=="svelte-ffgub5"&&(A.innerHTML=ls),L=i(r),g(q.$$.fragment,r),S=i(r),P=w(r,"P",{"data-svelte-h":!0}),T(P)!=="svelte-vh7z0v"&&(P.textContent=D)},m(r,J){d(t,r,J),a(r,f,J),a(r,e,J),a(r,u,J),d(h,r,J),a(r,G,J),a(r,C,J),a(r,R,J),d(k,r,J),a(r,F,J),a(r,I,J),a(r,X,J),d(p,r,J),a(r,_,J),a(r,H,J),a(r,B,J),d(V,r,J),a(r,Q,J),a(r,Y,J),a(r,z,J),d(c,r,J),a(r,x,J),a(r,A,J),a(r,L,J),d(q,r,J),a(r,S,J),a(r,P,J),as=!0},p(r,J){const ns={};J&2&&(ns.$$scope={dirty:J,ctx:r}),t.$set(ns)},i(r){as||(j(t.$$.fragment,r),j(h.$$.fragment,r),j(k.$$.fragment,r),j(p.$$.fragment,r),j(V.$$.fragment,r),j(c.$$.fragment,r),j(q.$$.fragment,r),as=!0)},o(r){y(t.$$.fragment,r),y(h.$$.fragment,r),y(k.$$.fragment,r),y(p.$$.fragment,r),y(V.$$.fragment,r),y(c.$$.fragment,r),y(q.$$.fragment,r),as=!1},d(r){r&&(l(f),l(e),l(u),l(G),l(C),l(R),l(F),l(I),l(X),l(_),l(H),l(B),l(Q),l(Y),l(z),l(x),l(A),l(L),l(S),l(P)),b(t,r),b(h,r),b(k,r),b(p,r),b(V,r),b(c,r),b(q,r)}}}function fe(Z){let t,f;return t=new Vs({props:{$$slots:{default:[ce]},$$scope:{ctx:Z}}}),{c(){M(t.$$.fragment)},l(e){g(t.$$.fragment,e)},m(e,m){d(t,e,m),f=!0},p(e,m){const u={};m&2&&(u.$$scope={dirty:m,ctx:e}),t.$set(u)},i(e){f||(j(t.$$.fragment,e),f=!0)},o(e){y(t.$$.fragment,e),f=!1},d(e){b(t,e)}}}function he(Z){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=$("p"),t.innerHTML=f},l(e){t=w(e,"P",{"data-svelte-h":!0}),T(t)!=="svelte-ypf7aj"&&(t.innerHTML=f)},m(e,m){a(e,t,m)},p:es,d(e){e&&l(t)}}}function ue(Z){let t,f="テキストをトークン化し、<code>input_ids</code>を PyTorch テンソルとして返します。 <code>&lt;mask&gt;</code> トークンの位置も指定する必要があります。",e,m,u,h,G="入力をモデルに渡し、マスクされたトークンの<code>logits</code>を返します。",C,W,R,k,F="次に、マスクされた 3 つのトークンを最も高い確率で返し、出力します。",I,U,X;return m=new v({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJzdGV2aGxpdSUyRm15X2F3ZXNvbWVfZWxpNV9tbG1fbW9kZWwlMjIpJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKHRleHQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQW1hc2tfdG9rZW5faW5kZXglMjAlM0QlMjB0b3JjaC53aGVyZShpbnB1dHMlNUIlMjJpbnB1dF9pZHMlMjIlNUQlMjAlM0QlM0QlMjB0b2tlbml6ZXIubWFza190b2tlbl9pZCklNUIxJTVE",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;stevhliu/my_awesome_eli5_mlm_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(text, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>mask_token_index = torch.where(inputs[<span class="hljs-string">&quot;input_ids&quot;</span>] == tokenizer.mask_token_id)[<span class="hljs-number">1</span>]`,wrap:!1}}),W=new v({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvck1hc2tlZExNJTBBJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JNYXNrZWRMTS5mcm9tX3ByZXRyYWluZWQoJTIyc3RldmhsaXUlMkZteV9hd2Vzb21lX2VsaTVfbWxtX21vZGVsJTIyKSUwQWxvZ2l0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKS5sb2dpdHMlMEFtYXNrX3Rva2VuX2xvZ2l0cyUyMCUzRCUyMGxvZ2l0cyU1QjAlMkMlMjBtYXNrX3Rva2VuX2luZGV4JTJDJTIwJTNBJTVE",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForMaskedLM

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForMaskedLM.from_pretrained(<span class="hljs-string">&quot;stevhliu/my_awesome_eli5_mlm_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = model(**inputs).logits
<span class="hljs-meta">&gt;&gt;&gt; </span>mask_token_logits = logits[<span class="hljs-number">0</span>, mask_token_index, :]`,wrap:!1}}),U=new v({props:{code:"dG9wXzNfdG9rZW5zJTIwJTNEJTIwdG9yY2gudG9wayhtYXNrX3Rva2VuX2xvZ2l0cyUyQyUyMDMlMkMlMjBkaW0lM0QxKS5pbmRpY2VzJTVCMCU1RC50b2xpc3QoKSUwQSUwQWZvciUyMHRva2VuJTIwaW4lMjB0b3BfM190b2tlbnMlM0ElMEElMjAlMjAlMjAlMjBwcmludCh0ZXh0LnJlcGxhY2UodG9rZW5pemVyLm1hc2tfdG9rZW4lMkMlMjB0b2tlbml6ZXIuZGVjb2RlKCU1QnRva2VuJTVEKSkp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>top_3_tokens = torch.topk(mask_token_logits, <span class="hljs-number">3</span>, dim=<span class="hljs-number">1</span>).indices[<span class="hljs-number">0</span>].tolist()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> token <span class="hljs-keyword">in</span> top_3_tokens:
<span class="hljs-meta">... </span>    <span class="hljs-built_in">print</span>(text.replace(tokenizer.mask_token, tokenizer.decode([token])))
The Milky Way <span class="hljs-keyword">is</span> a spiral galaxy.
The Milky Way <span class="hljs-keyword">is</span> a massive galaxy.
The Milky Way <span class="hljs-keyword">is</span> a small galaxy.`,wrap:!1}}),{c(){t=$("p"),t.innerHTML=f,e=o(),M(m.$$.fragment),u=o(),h=$("p"),h.innerHTML=G,C=o(),M(W.$$.fragment),R=o(),k=$("p"),k.textContent=F,I=o(),M(U.$$.fragment)},l(p){t=w(p,"P",{"data-svelte-h":!0}),T(t)!=="svelte-1p5tmxy"&&(t.innerHTML=f),e=i(p),g(m.$$.fragment,p),u=i(p),h=w(p,"P",{"data-svelte-h":!0}),T(h)!=="svelte-8pqnod"&&(h.innerHTML=G),C=i(p),g(W.$$.fragment,p),R=i(p),k=w(p,"P",{"data-svelte-h":!0}),T(k)!=="svelte-1jeaz8n"&&(k.textContent=F),I=i(p),g(U.$$.fragment,p)},m(p,_){a(p,t,_),a(p,e,_),d(m,p,_),a(p,u,_),a(p,h,_),a(p,C,_),d(W,p,_),a(p,R,_),a(p,k,_),a(p,I,_),d(U,p,_),X=!0},p:es,i(p){X||(j(m.$$.fragment,p),j(W.$$.fragment,p),j(U.$$.fragment,p),X=!0)},o(p){y(m.$$.fragment,p),y(W.$$.fragment,p),y(U.$$.fragment,p),X=!1},d(p){p&&(l(t),l(e),l(u),l(h),l(C),l(R),l(k),l(I)),b(m,p),b(W,p),b(U,p)}}}function Me(Z){let t,f;return t=new Vs({props:{$$slots:{default:[ue]},$$scope:{ctx:Z}}}),{c(){M(t.$$.fragment)},l(e){g(t.$$.fragment,e)},m(e,m){d(t,e,m),f=!0},p(e,m){const u={};m&2&&(u.$$scope={dirty:m,ctx:e}),t.$set(u)},i(e){f||(j(t.$$.fragment,e),f=!0)},o(e){y(t.$$.fragment,e),f=!1},d(e){b(t,e)}}}function ge(Z){let t,f="テキストをトークン化し、<code>input_ids</code>を TensorFlow テンソルとして返します。 <code>&lt;mask&gt;</code> トークンの位置も指定する必要があります。",e,m,u,h,G="入力をモデルに渡し、マスクされたトークンの<code>logits</code>を返します。",C,W,R,k,F="次に、マスクされた 3 つのトークンを最も高い確率で返し、出力します。",I,U,X;return m=new v({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJzdGV2aGxpdSUyRm15X2F3ZXNvbWVfZWxpNV9tbG1fbW9kZWwlMjIpJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKHRleHQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnRmJTIyKSUwQW1hc2tfdG9rZW5faW5kZXglMjAlM0QlMjB0Zi53aGVyZShpbnB1dHMlNUIlMjJpbnB1dF9pZHMlMjIlNUQlMjAlM0QlM0QlMjB0b2tlbml6ZXIubWFza190b2tlbl9pZCklNUIwJTJDJTIwMSU1RA==",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;stevhliu/my_awesome_eli5_mlm_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(text, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>mask_token_index = tf.where(inputs[<span class="hljs-string">&quot;input_ids&quot;</span>] == tokenizer.mask_token_id)[<span class="hljs-number">0</span>, <span class="hljs-number">1</span>]`,wrap:!1}}),W=new v({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGQXV0b01vZGVsRm9yTWFza2VkTE0lMEElMEFtb2RlbCUyMCUzRCUyMFRGQXV0b01vZGVsRm9yTWFza2VkTE0uZnJvbV9wcmV0cmFpbmVkKCUyMnN0ZXZobGl1JTJGbXlfYXdlc29tZV9lbGk1X21sbV9tb2RlbCUyMiklMEFsb2dpdHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cykubG9naXRzJTBBbWFza190b2tlbl9sb2dpdHMlMjAlM0QlMjBsb2dpdHMlNUIwJTJDJTIwbWFza190b2tlbl9pbmRleCUyQyUyMCUzQSU1RA==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFAutoModelForMaskedLM

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFAutoModelForMaskedLM.from_pretrained(<span class="hljs-string">&quot;stevhliu/my_awesome_eli5_mlm_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = model(**inputs).logits
<span class="hljs-meta">&gt;&gt;&gt; </span>mask_token_logits = logits[<span class="hljs-number">0</span>, mask_token_index, :]`,wrap:!1}}),U=new v({props:{code:"dG9wXzNfdG9rZW5zJTIwJTNEJTIwdGYubWF0aC50b3BfayhtYXNrX3Rva2VuX2xvZ2l0cyUyQyUyMDMpLmluZGljZXMubnVtcHkoKSUwQSUwQWZvciUyMHRva2VuJTIwaW4lMjB0b3BfM190b2tlbnMlM0ElMEElMjAlMjAlMjAlMjBwcmludCh0ZXh0LnJlcGxhY2UodG9rZW5pemVyLm1hc2tfdG9rZW4lMkMlMjB0b2tlbml6ZXIuZGVjb2RlKCU1QnRva2VuJTVEKSkp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>top_3_tokens = tf.math.top_k(mask_token_logits, <span class="hljs-number">3</span>).indices.numpy()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> token <span class="hljs-keyword">in</span> top_3_tokens:
<span class="hljs-meta">... </span>    <span class="hljs-built_in">print</span>(text.replace(tokenizer.mask_token, tokenizer.decode([token])))
The Milky Way <span class="hljs-keyword">is</span> a spiral galaxy.
The Milky Way <span class="hljs-keyword">is</span> a massive galaxy.
The Milky Way <span class="hljs-keyword">is</span> a small galaxy.`,wrap:!1}}),{c(){t=$("p"),t.innerHTML=f,e=o(),M(m.$$.fragment),u=o(),h=$("p"),h.innerHTML=G,C=o(),M(W.$$.fragment),R=o(),k=$("p"),k.textContent=F,I=o(),M(U.$$.fragment)},l(p){t=w(p,"P",{"data-svelte-h":!0}),T(t)!=="svelte-td21lc"&&(t.innerHTML=f),e=i(p),g(m.$$.fragment,p),u=i(p),h=w(p,"P",{"data-svelte-h":!0}),T(h)!=="svelte-8pqnod"&&(h.innerHTML=G),C=i(p),g(W.$$.fragment,p),R=i(p),k=w(p,"P",{"data-svelte-h":!0}),T(k)!=="svelte-1jeaz8n"&&(k.textContent=F),I=i(p),g(U.$$.fragment,p)},m(p,_){a(p,t,_),a(p,e,_),d(m,p,_),a(p,u,_),a(p,h,_),a(p,C,_),d(W,p,_),a(p,R,_),a(p,k,_),a(p,I,_),d(U,p,_),X=!0},p:es,i(p){X||(j(m.$$.fragment,p),j(W.$$.fragment,p),j(U.$$.fragment,p),X=!0)},o(p){y(m.$$.fragment,p),y(W.$$.fragment,p),y(U.$$.fragment,p),X=!1},d(p){p&&(l(t),l(e),l(u),l(h),l(C),l(R),l(k),l(I)),b(m,p),b(W,p),b(U,p)}}}function de(Z){let t,f;return t=new Vs({props:{$$slots:{default:[ge]},$$scope:{ctx:Z}}}),{c(){M(t.$$.fragment)},l(e){g(t.$$.fragment,e)},m(e,m){d(t,e,m),f=!0},p(e,m){const u={};m&2&&(u.$$scope={dirty:m,ctx:e}),t.$set(u)},i(e){f||(j(t.$$.fragment,e),f=!0)},o(e){y(t.$$.fragment,e),f=!1},d(e){b(t,e)}}}function je(Z){let t,f,e,m,u,h,G,C,W,R,k,F=`マスクされた言語モデリングはシーケンス内のマスクされたトークンを予測し、モデルはトークンを双方向に処理できます。これ
これは、モデルが左右のトークンに完全にアクセスできることを意味します。マスクされた言語モデリングは、次のようなタスクに最適です。
シーケンス全体の文脈をよく理解する必要があります。 BERT はマスクされた言語モデルの一例です。`,I,U,X="このガイドでは、次の方法を説明します。",p,_,H='<li><a href="https://huggingface.co/distilbert/distilroberta-base" rel="nofollow">ELI5</a> の <a href="https://www.reddit.com/r/askscience/" rel="nofollow">r/askscience</a> サブセットで <a href="https://huggingface.co/distilbert/distilroberta-base" rel="nofollow">DistilRoBERTa</a> を微調整します。 ://huggingface.co/datasets/eli5) データセット。</li> <li>微調整したモデルを推論に使用します。</li>',E,B,V,Q,Y="始める前に、必要なライブラリがすべてインストールされていることを確認してください。",N,z,c,x,A="モデルをアップロードしてコミュニティと共有できるように、Hugging Face アカウントにログインすることをお勧めします。プロンプトが表示されたら、トークンを入力してログインします。",ls,L,q,S,P,D,as=`まず、ELI5 データセットの r/askscience サブセットの小さいサブセットを 🤗 データセット ライブラリからロードします。これで
データセット全体のトレーニングにさらに時間を費やす前に、実験してすべてが機能することを確認する機会が与えられます。`,r,J,ns,ps,kt="<code>train_test_split</code> メソッドを使用して、データセットの <code>train_asks</code> をトレイン セットとテスト セットに分割します。",Fs,rs,Hs,os,_t="次に、例を見てみましょう。",Es,is,Qs,ms,Jt="これは多くのことのように見えるかもしれませんが、実際に関心があるのは<code>text</code>フィールドだけです。言語モデリング タスクの優れた点は、次の単語がラベル * であるため、ラベル (教師なしタスクとも呼ばれます) が必要ないことです。",Ys,cs,Ns,fs,As,hs,xt="マスクされた言語モデリングの場合、次のステップは、<code>text</code>サブフィールドを処理するために DistilRoBERTa トークナイザーをロードすることです。",Ls,us,qs,Ms,Ut=`上の例からわかるように、<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> サブフィールドを抽出します。`,Ss,gs,Ps,ds,Zt=`<code>answers</code>接頭辞で示されるように、各サブフィールドは個別の列になり、<code>text</code>フィールドはリストになりました。その代わり
各文を個別にトークン化する場合は、リストを文字列に変換して、それらをまとめてトークン化できるようにします。`,Ds,js,Gt="以下は、各例の文字列のリストを結合し、結果をトークン化する最初の前処理関数です。",Ks,ys,Os,bs,vt="この前処理関数をデータセット全体に適用するには、🤗 Datasets <code>map</code> メソッドを使用します。 <code>map</code> 関数を高速化するには、<code>batched=True</code> を設定してデータセットの複数の要素を一度に処理し、<code>num_proc</code> でプロセスの数を増やします。不要な列を削除します。",st,$s,tt,ws,Ct="このデータセットにはトークン シーケンスが含まれていますが、その一部はモデルの最大入力長よりも長くなります。",et,Ts,Wt="2 番目の前処理関数を使用して、",lt,ks,It="<li>すべてのシーケンスを連結します</li> <li>連結されたシーケンスを<code>block_size</code>で定義された短いチャンクに分割します。これは、最大入力長より短く、GPU RAM に十分な長さである必要があります。</li>",at,_s,nt,Js,Rt="データセット全体に<code>group_texts</code>関数を適用します。",pt,xs,rt,Us,Xt="次に、<code>DataCollat​​orForLanguageModeling</code> を使用してサンプルのバッチを作成します。データセット全体を最大長までパディングするのではなく、照合中にバッチ内の最長の長さまで文を <em>動的にパディング</em> する方が効率的です。",ot,K,it,Zs,mt,O,ct,ss,ft,Gs,ht,vs,Vt="モデルを微調整したので、それを推論に使用できるようになりました。",ut,Cs,Bt="モデルに空白を埋めるテキストを考え出し、特別な <code>&lt;mask&gt;</code> トークンを使用して空白を示します。",Mt,Ws,gt,Is,zt='推論用に微調整されたモデルを試す最も簡単な方法は、それを <a href="/docs/transformers/pr_30929/ja/main_classes/pipelines#transformers.pipeline">pipeline()</a> で使用することです。モデルを使用してフィルマスクの<code>pipeline</code>をインスタンス化し、テキストをそれに渡します。必要に応じて、<code>top_k</code>パラメータを使用して、返す予測の数を指定できます。',dt,Rs,jt,ts,yt,Xs,bt,Bs,$t;return u=new zs({props:{title:"Masked language modeling",local:"masked-language-modeling",headingTag:"h1"}}),G=new se({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/masked_language_modeling.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/ja/pytorch/masked_language_modeling.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/ja/tensorflow/masked_language_modeling.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ja/masked_language_modeling.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ja/pytorch/masked_language_modeling.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ja/tensorflow/masked_language_modeling.ipynb"}]}}),W=new Lt({props:{id:"mqElG5QJWUg"}}),B=new wt({props:{$$slots:{default:[ee]},$$scope:{ctx:Z}}}),z=new v({props:{code:"cGlwJTIwaW5zdGFsbCUyMHRyYW5zZm9ybWVycyUyMGRhdGFzZXRzJTIwZXZhbHVhdGU=",highlighted:"pip install transformers datasets evaluate",wrap:!1}}),L=new v({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}}),S=new zs({props:{title:"Load ELI5 dataset",local:"load-eli5-dataset",headingTag:"h2"}}),J=new v({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}}),rs=new v({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}}),is=new v({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}}),cs=new zs({props:{title:"Preprocess",local:"preprocess",headingTag:"h2"}}),fs=new Lt({props:{id:"8PmhEIXhBvI"}}),us=new v({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJkaXN0aWxiZXJ0JTJGZGlzdGlscm9iZXJ0YS1iYXNlJTIyKQ==",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/distilroberta-base&quot;</span>)`,wrap:!1}}),gs=new v({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}}),ys=new v({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 v({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}}),_s=new v({props:{code:"YmxvY2tfc2l6ZSUyMCUzRCUyMDEyOCUwQSUwQSUwQWRlZiUyMGdyb3VwX3RleHRzKGV4YW1wbGVzKSUzQSUwQSUyMCUyMCUyMCUyMCUyMyUyMENvbmNhdGVuYXRlJTIwYWxsJTIwdGV4dHMuJTBBJTIwJTIwJTIwJTIwY29uY2F0ZW5hdGVkX2V4YW1wbGVzJTIwJTNEJTIwJTdCayUzQSUyMHN1bShleGFtcGxlcyU1QmslNUQlMkMlMjAlNUIlNUQpJTIwZm9yJTIwayUyMGluJTIwZXhhbXBsZXMua2V5cygpJTdEJTBBJTIwJTIwJTIwJTIwdG90YWxfbGVuZ3RoJTIwJTNEJTIwbGVuKGNvbmNhdGVuYXRlZF9leGFtcGxlcyU1Qmxpc3QoZXhhbXBsZXMua2V5cygpKSU1QjAlNUQlNUQpJTBBJTIwJTIwJTIwJTIwJTIzJTIwV2UlMjBkcm9wJTIwdGhlJTIwc21hbGwlMjByZW1haW5kZXIlMkMlMjB3ZSUyMGNvdWxkJTIwYWRkJTIwcGFkZGluZyUyMGlmJTIwdGhlJTIwbW9kZWwlMjBzdXBwb3J0ZWQlMjBpdCUyMGluc3RlYWQlMjBvZiUyMHRoaXMlMjBkcm9wJTJDJTIweW91JTIwY2FuJTBBJTIwJTIwJTIwJTIwJTIzJTIwY3VzdG9taXplJTIwdGhpcyUyMHBhcnQlMjB0byUyMHlvdXIlMjBuZWVkcy4lMEElMjAlMjAlMjAlMjBpZiUyMHRvdGFsX2xlbmd0aCUyMCUzRSUzRCUyMGJsb2NrX3NpemUlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjB0b3RhbF9sZW5ndGglMjAlM0QlMjAodG90YWxfbGVuZ3RoJTIwJTJGJTJGJTIwYmxvY2tfc2l6ZSklMjAqJTIwYmxvY2tfc2l6ZSUwQSUyMCUyMCUyMCUyMCUyMyUyMFNwbGl0JTIwYnklMjBjaHVua3MlMjBvZiUyMGJsb2NrX3NpemUuJTBBJTIwJTIwJTIwJTIwcmVzdWx0JTIwJTNEJTIwJTdCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwayUzQSUyMCU1QnQlNUJpJTIwJTNBJTIwaSUyMCUyQiUyMGJsb2NrX3NpemUlNUQlMjBmb3IlMjBpJTIwaW4lMjByYW5nZSgwJTJDJTIwdG90YWxfbGVuZ3RoJTJDJTIwYmxvY2tfc2l6ZSklNUQlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBmb3IlMjBrJTJDJTIwdCUyMGluJTIwY29uY2F0ZW5hdGVkX2V4YW1wbGVzLml0ZW1zKCklMEElMjAlMjAlMjAlMjAlN0QlMEElMjAlMjAlMjAlMjByZXR1cm4lMjByZXN1bHQ=",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>    <span class="hljs-keyword">return</span> result`,wrap:!1}}),xs=new v({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}}),K=new Tt({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[pe],pytorch:[ae]},$$scope:{ctx:Z}}}),Zs=new zs({props:{title:"Train",local:"train",headingTag:"h2"}}),O=new Tt({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[fe],pytorch:[ie]},$$scope:{ctx:Z}}}),ss=new wt({props:{$$slots:{default:[he]},$$scope:{ctx:Z}}}),Gs=new zs({props:{title:"Inference",local:"inference",headingTag:"h2"}}),Ws=new v({props:{code:"dGV4dCUyMCUzRCUyMCUyMlRoZSUyME1pbGt5JTIwV2F5JTIwaXMlMjBhJTIwJTNDbWFzayUzRSUyMGdhbGF4eS4lMjI=",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>text = <span class="hljs-string">&quot;The Milky Way is a &lt;mask&gt; galaxy.&quot;</span>',wrap:!1}}),Rs=new v({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBbWFza19maWxsZXIlMjAlM0QlMjBwaXBlbGluZSglMjJmaWxsLW1hc2slMjIlMkMlMjAlMjJzdGV2aGxpdSUyRm15X2F3ZXNvbWVfZWxpNV9tbG1fbW9kZWwlMjIpJTBBbWFza19maWxsZXIodGV4dCUyQyUyMHRvcF9rJTNEMyk=",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>mask_filler = pipeline(<span class="hljs-string">&quot;fill-mask&quot;</span>, <span class="hljs-string">&quot;stevhliu/my_awesome_eli5_mlm_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>mask_filler(text, top_k=<span class="hljs-number">3</span>)
[{<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.5150994658470154</span>,
  <span class="hljs-string">&#x27;token&#x27;</span>: <span class="hljs-number">21300</span>,
  <span class="hljs-string">&#x27;token_str&#x27;</span>: <span class="hljs-string">&#x27; spiral&#x27;</span>,
  <span class="hljs-string">&#x27;sequence&#x27;</span>: <span class="hljs-string">&#x27;The Milky Way is a spiral galaxy.&#x27;</span>},
 {<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.07087188959121704</span>,
  <span class="hljs-string">&#x27;token&#x27;</span>: <span class="hljs-number">2232</span>,
  <span class="hljs-string">&#x27;token_str&#x27;</span>: <span class="hljs-string">&#x27; massive&#x27;</span>,
  <span class="hljs-string">&#x27;sequence&#x27;</span>: <span class="hljs-string">&#x27;The Milky Way is a massive galaxy.&#x27;</span>},
 {<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.06434620916843414</span>,
  <span class="hljs-string">&#x27;token&#x27;</span>: <span class="hljs-number">650</span>,
  <span class="hljs-string">&#x27;token_str&#x27;</span>: <span class="hljs-string">&#x27; small&#x27;</span>,
  <span class="hljs-string">&#x27;sequence&#x27;</span>: <span class="hljs-string">&#x27;The Milky Way is a small galaxy.&#x27;</span>}]`,wrap:!1}}),ts=new Tt({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[de],pytorch:[Me]},$$scope:{ctx:Z}}}),Xs=new te({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/ja/tasks/masked_language_modeling.md"}}),{c(){t=$("meta"),f=o(),e=$("p"),m=o(),M(u.$$.fragment),h=o(),M(G.$$.fragment),C=o(),M(W.$$.fragment),R=o(),k=$("p"),k.textContent=F,I=o(),U=$("p"),U.textContent=X,p=o(),_=$("ol"),_.innerHTML=H,E=o(),M(B.$$.fragment),V=o(),Q=$("p"),Q.textContent=Y,N=o(),M(z.$$.fragment),c=o(),x=$("p"),x.textContent=A,ls=o(),M(L.$$.fragment),q=o(),M(S.$$.fragment),P=o(),D=$("p"),D.textContent=as,r=o(),M(J.$$.fragment),ns=o(),ps=$("p"),ps.innerHTML=kt,Fs=o(),M(rs.$$.fragment),Hs=o(),os=$("p"),os.textContent=_t,Es=o(),M(is.$$.fragment),Qs=o(),ms=$("p"),ms.innerHTML=Jt,Ys=o(),M(cs.$$.fragment),Ns=o(),M(fs.$$.fragment),As=o(),hs=$("p"),hs.innerHTML=xt,Ls=o(),M(us.$$.fragment),qs=o(),Ms=$("p"),Ms.innerHTML=Ut,Ss=o(),M(gs.$$.fragment),Ps=o(),ds=$("p"),ds.innerHTML=Zt,Ds=o(),js=$("p"),js.textContent=Gt,Ks=o(),M(ys.$$.fragment),Os=o(),bs=$("p"),bs.innerHTML=vt,st=o(),M($s.$$.fragment),tt=o(),ws=$("p"),ws.textContent=Ct,et=o(),Ts=$("p"),Ts.textContent=Wt,lt=o(),ks=$("ul"),ks.innerHTML=It,at=o(),M(_s.$$.fragment),nt=o(),Js=$("p"),Js.innerHTML=Rt,pt=o(),M(xs.$$.fragment),rt=o(),Us=$("p"),Us.innerHTML=Xt,ot=o(),M(K.$$.fragment),it=o(),M(Zs.$$.fragment),mt=o(),M(O.$$.fragment),ct=o(),M(ss.$$.fragment),ft=o(),M(Gs.$$.fragment),ht=o(),vs=$("p"),vs.textContent=Vt,ut=o(),Cs=$("p"),Cs.innerHTML=Bt,Mt=o(),M(Ws.$$.fragment),gt=o(),Is=$("p"),Is.innerHTML=zt,dt=o(),M(Rs.$$.fragment),jt=o(),M(ts.$$.fragment),yt=o(),M(Xs.$$.fragment),bt=o(),Bs=$("p"),this.h()},l(s){const n=Kt("svelte-u9bgzb",document.head);t=w(n,"META",{name:!0,content:!0}),n.forEach(l),f=i(s),e=w(s,"P",{}),Nt(e).forEach(l),m=i(s),g(u.$$.fragment,s),h=i(s),g(G.$$.fragment,s),C=i(s),g(W.$$.fragment,s),R=i(s),k=w(s,"P",{"data-svelte-h":!0}),T(k)!=="svelte-6gq7id"&&(k.textContent=F),I=i(s),U=w(s,"P",{"data-svelte-h":!0}),T(U)!=="svelte-w5jzhi"&&(U.textContent=X),p=i(s),_=w(s,"OL",{"data-svelte-h":!0}),T(_)!=="svelte-nfl7pm"&&(_.innerHTML=H),E=i(s),g(B.$$.fragment,s),V=i(s),Q=w(s,"P",{"data-svelte-h":!0}),T(Q)!=="svelte-1lya3k8"&&(Q.textContent=Y),N=i(s),g(z.$$.fragment,s),c=i(s),x=w(s,"P",{"data-svelte-h":!0}),T(x)!=="svelte-193zy02"&&(x.textContent=A),ls=i(s),g(L.$$.fragment,s),q=i(s),g(S.$$.fragment,s),P=i(s),D=w(s,"P",{"data-svelte-h":!0}),T(D)!=="svelte-1m8npvc"&&(D.textContent=as),r=i(s),g(J.$$.fragment,s),ns=i(s),ps=w(s,"P",{"data-svelte-h":!0}),T(ps)!=="svelte-1ohvh79"&&(ps.innerHTML=kt),Fs=i(s),g(rs.$$.fragment,s),Hs=i(s),os=w(s,"P",{"data-svelte-h":!0}),T(os)!=="svelte-1r6oj5w"&&(os.textContent=_t),Es=i(s),g(is.$$.fragment,s),Qs=i(s),ms=w(s,"P",{"data-svelte-h":!0}),T(ms)!=="svelte-kb5u2z"&&(ms.innerHTML=Jt),Ys=i(s),g(cs.$$.fragment,s),Ns=i(s),g(fs.$$.fragment,s),As=i(s),hs=w(s,"P",{"data-svelte-h":!0}),T(hs)!=="svelte-32hazt"&&(hs.innerHTML=xt),Ls=i(s),g(us.$$.fragment,s),qs=i(s),Ms=w(s,"P",{"data-svelte-h":!0}),T(Ms)!=="svelte-fjd9et"&&(Ms.innerHTML=Ut),Ss=i(s),g(gs.$$.fragment,s),Ps=i(s),ds=w(s,"P",{"data-svelte-h":!0}),T(ds)!=="svelte-jgh86y"&&(ds.innerHTML=Zt),Ds=i(s),js=w(s,"P",{"data-svelte-h":!0}),T(js)!=="svelte-177qfmt"&&(js.textContent=Gt),Ks=i(s),g(ys.$$.fragment,s),Os=i(s),bs=w(s,"P",{"data-svelte-h":!0}),T(bs)!=="svelte-1l40k3u"&&(bs.innerHTML=vt),st=i(s),g($s.$$.fragment,s),tt=i(s),ws=w(s,"P",{"data-svelte-h":!0}),T(ws)!=="svelte-1bsb6if"&&(ws.textContent=Ct),et=i(s),Ts=w(s,"P",{"data-svelte-h":!0}),T(Ts)!=="svelte-1jnll4i"&&(Ts.textContent=Wt),lt=i(s),ks=w(s,"UL",{"data-svelte-h":!0}),T(ks)!=="svelte-1r1l6ld"&&(ks.innerHTML=It),at=i(s),g(_s.$$.fragment,s),nt=i(s),Js=w(s,"P",{"data-svelte-h":!0}),T(Js)!=="svelte-1vmzqwi"&&(Js.innerHTML=Rt),pt=i(s),g(xs.$$.fragment,s),rt=i(s),Us=w(s,"P",{"data-svelte-h":!0}),T(Us)!=="svelte-1yn7k6t"&&(Us.innerHTML=Xt),ot=i(s),g(K.$$.fragment,s),it=i(s),g(Zs.$$.fragment,s),mt=i(s),g(O.$$.fragment,s),ct=i(s),g(ss.$$.fragment,s),ft=i(s),g(Gs.$$.fragment,s),ht=i(s),vs=w(s,"P",{"data-svelte-h":!0}),T(vs)!=="svelte-cyrfc8"&&(vs.textContent=Vt),ut=i(s),Cs=w(s,"P",{"data-svelte-h":!0}),T(Cs)!=="svelte-5jelel"&&(Cs.innerHTML=Bt),Mt=i(s),g(Ws.$$.fragment,s),gt=i(s),Is=w(s,"P",{"data-svelte-h":!0}),T(Is)!=="svelte-1ix8u5i"&&(Is.innerHTML=zt),dt=i(s),g(Rs.$$.fragment,s),jt=i(s),g(ts.$$.fragment,s),yt=i(s),g(Xs.$$.fragment,s),bt=i(s),Bs=w(s,"P",{}),Nt(Bs).forEach(l),this.h()},h(){At(t,"name","hf:doc:metadata"),At(t,"content",ye)},m(s,n){Ot(document.head,t),a(s,f,n),a(s,e,n),a(s,m,n),d(u,s,n),a(s,h,n),d(G,s,n),a(s,C,n),d(W,s,n),a(s,R,n),a(s,k,n),a(s,I,n),a(s,U,n),a(s,p,n),a(s,_,n),a(s,E,n),d(B,s,n),a(s,V,n),a(s,Q,n),a(s,N,n),d(z,s,n),a(s,c,n),a(s,x,n),a(s,ls,n),d(L,s,n),a(s,q,n),d(S,s,n),a(s,P,n),a(s,D,n),a(s,r,n),d(J,s,n),a(s,ns,n),a(s,ps,n),a(s,Fs,n),d(rs,s,n),a(s,Hs,n),a(s,os,n),a(s,Es,n),d(is,s,n),a(s,Qs,n),a(s,ms,n),a(s,Ys,n),d(cs,s,n),a(s,Ns,n),d(fs,s,n),a(s,As,n),a(s,hs,n),a(s,Ls,n),d(us,s,n),a(s,qs,n),a(s,Ms,n),a(s,Ss,n),d(gs,s,n),a(s,Ps,n),a(s,ds,n),a(s,Ds,n),a(s,js,n),a(s,Ks,n),d(ys,s,n),a(s,Os,n),a(s,bs,n),a(s,st,n),d($s,s,n),a(s,tt,n),a(s,ws,n),a(s,et,n),a(s,Ts,n),a(s,lt,n),a(s,ks,n),a(s,at,n),d(_s,s,n),a(s,nt,n),a(s,Js,n),a(s,pt,n),d(xs,s,n),a(s,rt,n),a(s,Us,n),a(s,ot,n),d(K,s,n),a(s,it,n),d(Zs,s,n),a(s,mt,n),d(O,s,n),a(s,ct,n),d(ss,s,n),a(s,ft,n),d(Gs,s,n),a(s,ht,n),a(s,vs,n),a(s,ut,n),a(s,Cs,n),a(s,Mt,n),d(Ws,s,n),a(s,gt,n),a(s,Is,n),a(s,dt,n),d(Rs,s,n),a(s,jt,n),d(ts,s,n),a(s,yt,n),d(Xs,s,n),a(s,bt,n),a(s,Bs,n),$t=!0},p(s,[n]){const Ft={};n&2&&(Ft.$$scope={dirty:n,ctx:s}),B.$set(Ft);const Ht={};n&2&&(Ht.$$scope={dirty:n,ctx:s}),K.$set(Ht);const Et={};n&2&&(Et.$$scope={dirty:n,ctx:s}),O.$set(Et);const Qt={};n&2&&(Qt.$$scope={dirty:n,ctx:s}),ss.$set(Qt);const Yt={};n&2&&(Yt.$$scope={dirty:n,ctx:s}),ts.$set(Yt)},i(s){$t||(j(u.$$.fragment,s),j(G.$$.fragment,s),j(W.$$.fragment,s),j(B.$$.fragment,s),j(z.$$.fragment,s),j(L.$$.fragment,s),j(S.$$.fragment,s),j(J.$$.fragment,s),j(rs.$$.fragment,s),j(is.$$.fragment,s),j(cs.$$.fragment,s),j(fs.$$.fragment,s),j(us.$$.fragment,s),j(gs.$$.fragment,s),j(ys.$$.fragment,s),j($s.$$.fragment,s),j(_s.$$.fragment,s),j(xs.$$.fragment,s),j(K.$$.fragment,s),j(Zs.$$.fragment,s),j(O.$$.fragment,s),j(ss.$$.fragment,s),j(Gs.$$.fragment,s),j(Ws.$$.fragment,s),j(Rs.$$.fragment,s),j(ts.$$.fragment,s),j(Xs.$$.fragment,s),$t=!0)},o(s){y(u.$$.fragment,s),y(G.$$.fragment,s),y(W.$$.fragment,s),y(B.$$.fragment,s),y(z.$$.fragment,s),y(L.$$.fragment,s),y(S.$$.fragment,s),y(J.$$.fragment,s),y(rs.$$.fragment,s),y(is.$$.fragment,s),y(cs.$$.fragment,s),y(fs.$$.fragment,s),y(us.$$.fragment,s),y(gs.$$.fragment,s),y(ys.$$.fragment,s),y($s.$$.fragment,s),y(_s.$$.fragment,s),y(xs.$$.fragment,s),y(K.$$.fragment,s),y(Zs.$$.fragment,s),y(O.$$.fragment,s),y(ss.$$.fragment,s),y(Gs.$$.fragment,s),y(Ws.$$.fragment,s),y(Rs.$$.fragment,s),y(ts.$$.fragment,s),y(Xs.$$.fragment,s),$t=!1},d(s){s&&(l(f),l(e),l(m),l(h),l(C),l(R),l(k),l(I),l(U),l(p),l(_),l(E),l(V),l(Q),l(N),l(c),l(x),l(ls),l(q),l(P),l(D),l(r),l(ns),l(ps),l(Fs),l(Hs),l(os),l(Es),l(Qs),l(ms),l(Ys),l(Ns),l(As),l(hs),l(Ls),l(qs),l(Ms),l(Ss),l(Ps),l(ds),l(Ds),l(js),l(Ks),l(Os),l(bs),l(st),l(tt),l(ws),l(et),l(Ts),l(lt),l(ks),l(at),l(nt),l(Js),l(pt),l(rt),l(Us),l(ot),l(it),l(mt),l(ct),l(ft),l(ht),l(vs),l(ut),l(Cs),l(Mt),l(gt),l(Is),l(dt),l(jt),l(yt),l(bt),l(Bs)),l(t),b(u,s),b(G,s),b(W,s),b(B,s),b(z,s),b(L,s),b(S,s),b(J,s),b(rs,s),b(is,s),b(cs,s),b(fs,s),b(us,s),b(gs,s),b(ys,s),b($s,s),b(_s,s),b(xs,s),b(K,s),b(Zs,s),b(O,s),b(ss,s),b(Gs,s),b(Ws,s),b(Rs,s),b(ts,s),b(Xs,s)}}}const ye='{"title":"Masked language modeling","local":"masked-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 be(Z){return St(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ze extends Pt{constructor(t){super(),Dt(this,t,be,je,qt,{})}}export{Ze as component};
