import{s as ra,o as ia,n as cs}from"../chunks/scheduler.9bc65507.js";import{S as ca,i as oa,g as d,s as i,r as j,A as ma,h as b,f as t,c,j as na,u as h,x as J,k as ea,y as Ma,a as n,v as u,d as y,t as f,w as g,m as ja,n as ha}from"../chunks/index.707bf1b6.js";import{T as Bl}from"../chunks/Tip.c2ecdbf4.js";import{Y as pa}from"../chunks/Youtube.e1129c6f.js";import{C as _}from"../chunks/CodeBlock.54a9f38d.js";import{D as ua}from"../chunks/DocNotebookDropdown.41f65cb5.js";import{F as Wl,M as Ls}from"../chunks/Markdown.8ab98a13.js";import{H as Ss,E as ya}from"../chunks/EditOnGithub.922df6ba.js";function fa(k){let a,o='このタスクと互換性のあるすべてのアーキテクチャとチェックポイントを確認するには、<a href="https://huggingface.co/tasks/token-classification" rel="nofollow">タスクページ</a> を確認することをお勧めします。';return{c(){a=d("p"),a.innerHTML=o},l(l){a=b(l,"P",{"data-svelte-h":!0}),J(a)!=="svelte-62918c"&&(a.innerHTML=o)},m(l,m){n(l,a,m)},p:cs,d(l){l&&t(a)}}}function ga(k){let a,o;return a=new _({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERhdGFDb2xsYXRvckZvclRva2VuQ2xhc3NpZmljYXRpb24lMEElMEFkYXRhX2NvbGxhdG9yJTIwJTNEJTIwRGF0YUNvbGxhdG9yRm9yVG9rZW5DbGFzc2lmaWNhdGlvbih0b2tlbml6ZXIlM0R0b2tlbml6ZXIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DataCollatorForTokenClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>data_collator = DataCollatorForTokenClassification(tokenizer=tokenizer)`,wrap:!1}}),{c(){j(a.$$.fragment)},l(l){h(a.$$.fragment,l)},m(l,m){u(a,l,m),o=!0},p:cs,i(l){o||(y(a.$$.fragment,l),o=!0)},o(l){f(a.$$.fragment,l),o=!1},d(l){g(a,l)}}}function da(k){let a,o;return a=new Ls({props:{$$slots:{default:[ga]},$$scope:{ctx:k}}}),{c(){j(a.$$.fragment)},l(l){h(a.$$.fragment,l)},m(l,m){u(a,l,m),o=!0},p(l,m){const w={};m&2&&(w.$$scope={dirty:m,ctx:l}),a.$set(w)},i(l){o||(y(a.$$.fragment,l),o=!0)},o(l){f(a.$$.fragment,l),o=!1},d(l){g(a,l)}}}function ba(k){let a,o;return a=new _({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERhdGFDb2xsYXRvckZvclRva2VuQ2xhc3NpZmljYXRpb24lMEElMEFkYXRhX2NvbGxhdG9yJTIwJTNEJTIwRGF0YUNvbGxhdG9yRm9yVG9rZW5DbGFzc2lmaWNhdGlvbih0b2tlbml6ZXIlM0R0b2tlbml6ZXIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnRmJTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DataCollatorForTokenClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>data_collator = DataCollatorForTokenClassification(tokenizer=tokenizer, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)`,wrap:!1}}),{c(){j(a.$$.fragment)},l(l){h(a.$$.fragment,l)},m(l,m){u(a,l,m),o=!0},p:cs,i(l){o||(y(a.$$.fragment,l),o=!0)},o(l){f(a.$$.fragment,l),o=!1},d(l){g(a,l)}}}function wa(k){let a,o;return a=new Ls({props:{$$slots:{default:[ba]},$$scope:{ctx:k}}}),{c(){j(a.$$.fragment)},l(l){h(a.$$.fragment,l)},m(l,m){u(a,l,m),o=!0},p(l,m){const w={};m&2&&(w.$$scope={dirty:m,ctx:l}),a.$set(w)},i(l){o||(y(a.$$.fragment,l),o=!0)},o(l){f(a.$$.fragment,l),o=!1},d(l){g(a,l)}}}function Ja(k){let a,o='<a href="/docs/transformers/pr_28071/ja/main_classes/trainer#transformers.Trainer">Trainer</a> を使用したモデルの微調整に慣れていない場合は、<a href="../training#train-with-pytorch-trainer">ここ</a> の基本的なチュートリアルをご覧ください。';return{c(){a=d("p"),a.innerHTML=o},l(l){a=b(l,"P",{"data-svelte-h":!0}),J(a)!=="svelte-1nzx798"&&(a.innerHTML=o)},m(l,m){n(l,a,m)},p:cs,d(l){l&&t(a)}}}function Ta(k){let a,o,l,m='これでモデルのトレーニングを開始する準備が整いました。 <a href="/docs/transformers/pr_28071/ja/model_doc/auto#transformers.AutoModelForTokenClassification">AutoModelForTokenClassification</a> を使用して、予期されるラベルの数とラベル マッピングを指定して DistilBERT を読み込みます。',w,C,A,v,I="この時点で残っているステップは 3 つだけです。",G,x,V='<li><a href="/docs/transformers/pr_28071/ja/main_classes/trainer#transformers.TrainingArguments">TrainingArguments</a> でトレーニング ハイパーパラメータを定義します。唯一の必須パラメータは、モデルの保存場所を指定する <code>output_dir</code> です。 <code>push_to_hub=True</code>を設定して、このモデルをハブにプッシュします (モデルをアップロードするには、Hugging Face にサインインする必要があります)。各エポックの終了時に、<a href="/docs/transformers/pr_28071/ja/main_classes/trainer#transformers.Trainer">Trainer</a> は連続スコアを評価し、トレーニング チェックポイントを保存します。</li> <li>トレーニング引数を、モデル、データセット、トークナイザー、データ照合器、および <code>compute_metrics</code> 関数とともに <a href="/docs/transformers/pr_28071/ja/main_classes/trainer#transformers.Trainer">Trainer</a> に渡します。</li> <li><a href="/docs/transformers/pr_28071/ja/main_classes/trainer#transformers.Trainer.train">train()</a> を呼び出してモデルを微調整します。</li>',B,U,W,r,$='トレーニングが完了したら、 <a href="/docs/transformers/pr_28071/ja/main_classes/trainer#transformers.Trainer.push_to_hub">push_to_hub()</a> メソッドを使用してモデルをハブに共有し、誰もがモデルを使用できるようにします。',E,X,R;return a=new Bl({props:{$$slots:{default:[Ja]},$$scope:{ctx:k}}}),C=new _({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvclRva2VuQ2xhc3NpZmljYXRpb24lMkMlMjBUcmFpbmluZ0FyZ3VtZW50cyUyQyUyMFRyYWluZXIlMEElMEFtb2RlbCUyMCUzRCUyMEF1dG9Nb2RlbEZvclRva2VuQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUwQSUyMCUyMCUyMCUyMCUyMmRpc3RpbGJlcnQlMkZkaXN0aWxiZXJ0LWJhc2UtdW5jYXNlZCUyMiUyQyUyMG51bV9sYWJlbHMlM0QxMyUyQyUyMGlkMmxhYmVsJTNEaWQybGFiZWwlMkMlMjBsYWJlbDJpZCUzRGxhYmVsMmlkJTBBKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForTokenClassification, TrainingArguments, Trainer

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForTokenClassification.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;distilbert/distilbert-base-uncased&quot;</span>, num_labels=<span class="hljs-number">13</span>, id2label=id2label, label2id=label2id
<span class="hljs-meta">... </span>)`,wrap:!1}}),U=new _({props:{code:"dHJhaW5pbmdfYXJncyUyMCUzRCUyMFRyYWluaW5nQXJndW1lbnRzKCUwQSUyMCUyMCUyMCUyMG91dHB1dF9kaXIlM0QlMjJteV9hd2Vzb21lX3dudXRfbW9kZWwlMjIlMkMlMEElMjAlMjAlMjAlMjBsZWFybmluZ19yYXRlJTNEMmUtNSUyQyUwQSUyMCUyMCUyMCUyMHBlcl9kZXZpY2VfdHJhaW5fYmF0Y2hfc2l6ZSUzRDE2JTJDJTBBJTIwJTIwJTIwJTIwcGVyX2RldmljZV9ldmFsX2JhdGNoX3NpemUlM0QxNiUyQyUwQSUyMCUyMCUyMCUyMG51bV90cmFpbl9lcG9jaHMlM0QyJTJDJTBBJTIwJTIwJTIwJTIwd2VpZ2h0X2RlY2F5JTNEMC4wMSUyQyUwQSUyMCUyMCUyMCUyMGV2YWxfc3RyYXRlZ3klM0QlMjJlcG9jaCUyMiUyQyUwQSUyMCUyMCUyMCUyMHNhdmVfc3RyYXRlZ3klM0QlMjJlcG9jaCUyMiUyQyUwQSUyMCUyMCUyMCUyMGxvYWRfYmVzdF9tb2RlbF9hdF9lbmQlM0RUcnVlJTJDJTBBJTIwJTIwJTIwJTIwcHVzaF90b19odWIlM0RUcnVlJTJDJTBBKSUwQSUwQXRyYWluZXIlMjAlM0QlMjBUcmFpbmVyKCUwQSUyMCUyMCUyMCUyMG1vZGVsJTNEbW9kZWwlMkMlMEElMjAlMjAlMjAlMjBhcmdzJTNEdHJhaW5pbmdfYXJncyUyQyUwQSUyMCUyMCUyMCUyMHRyYWluX2RhdGFzZXQlM0R0b2tlbml6ZWRfd251dCU1QiUyMnRyYWluJTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwZXZhbF9kYXRhc2V0JTNEdG9rZW5pemVkX3dudXQlNUIlMjJ0ZXN0JTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwdG9rZW5pemVyJTNEdG9rZW5pemVyJTJDJTBBJTIwJTIwJTIwJTIwZGF0YV9jb2xsYXRvciUzRGRhdGFfY29sbGF0b3IlMkMlMEElMjAlMjAlMjAlMjBjb21wdXRlX21ldHJpY3MlM0Rjb21wdXRlX21ldHJpY3MlMkMlMEEpJTBBJTBBdHJhaW5lci50cmFpbigp",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_wnut_model&quot;</span>,
<span class="hljs-meta">... </span>    learning_rate=<span class="hljs-number">2e-5</span>,
<span class="hljs-meta">... </span>    per_device_train_batch_size=<span class="hljs-number">16</span>,
<span class="hljs-meta">... </span>    per_device_eval_batch_size=<span class="hljs-number">16</span>,
<span class="hljs-meta">... </span>    num_train_epochs=<span class="hljs-number">2</span>,
<span class="hljs-meta">... </span>    weight_decay=<span class="hljs-number">0.01</span>,
<span class="hljs-meta">... </span>    eval_strategy=<span class="hljs-string">&quot;epoch&quot;</span>,
<span class="hljs-meta">... </span>    save_strategy=<span class="hljs-string">&quot;epoch&quot;</span>,
<span class="hljs-meta">... </span>    load_best_model_at_end=<span class="hljs-literal">True</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=tokenized_wnut[<span class="hljs-string">&quot;train&quot;</span>],
<span class="hljs-meta">... </span>    eval_dataset=tokenized_wnut[<span class="hljs-string">&quot;test&quot;</span>],
<span class="hljs-meta">... </span>    tokenizer=tokenizer,
<span class="hljs-meta">... </span>    data_collator=data_collator,
<span class="hljs-meta">... </span>    compute_metrics=compute_metrics,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.train()`,wrap:!1}}),X=new _({props:{code:"dHJhaW5lci5wdXNoX3RvX2h1Yigp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.push_to_hub()',wrap:!1}}),{c(){j(a.$$.fragment),o=i(),l=d("p"),l.innerHTML=m,w=i(),j(C.$$.fragment),A=i(),v=d("p"),v.textContent=I,G=i(),x=d("ol"),x.innerHTML=V,B=i(),j(U.$$.fragment),W=i(),r=d("p"),r.innerHTML=$,E=i(),j(X.$$.fragment)},l(M){h(a.$$.fragment,M),o=c(M),l=b(M,"P",{"data-svelte-h":!0}),J(l)!=="svelte-czai4n"&&(l.innerHTML=m),w=c(M),h(C.$$.fragment,M),A=c(M),v=b(M,"P",{"data-svelte-h":!0}),J(v)!=="svelte-5p19xw"&&(v.textContent=I),G=c(M),x=b(M,"OL",{"data-svelte-h":!0}),J(x)!=="svelte-1e3k2z3"&&(x.innerHTML=V),B=c(M),h(U.$$.fragment,M),W=c(M),r=b(M,"P",{"data-svelte-h":!0}),J(r)!=="svelte-yktcfh"&&(r.innerHTML=$),E=c(M),h(X.$$.fragment,M)},m(M,Z){u(a,M,Z),n(M,o,Z),n(M,l,Z),n(M,w,Z),u(C,M,Z),n(M,A,Z),n(M,v,Z),n(M,G,Z),n(M,x,Z),n(M,B,Z),u(U,M,Z),n(M,W,Z),n(M,r,Z),n(M,E,Z),u(X,M,Z),R=!0},p(M,Z){const F={};Z&2&&(F.$$scope={dirty:Z,ctx:M}),a.$set(F)},i(M){R||(y(a.$$.fragment,M),y(C.$$.fragment,M),y(U.$$.fragment,M),y(X.$$.fragment,M),R=!0)},o(M){f(a.$$.fragment,M),f(C.$$.fragment,M),f(U.$$.fragment,M),f(X.$$.fragment,M),R=!1},d(M){M&&(t(o),t(l),t(w),t(A),t(v),t(G),t(x),t(B),t(W),t(r),t(E)),g(a,M),g(C,M),g(U,M),g(X,M)}}}function $a(k){let a,o;return a=new Ls({props:{$$slots:{default:[Ta]},$$scope:{ctx:k}}}),{c(){j(a.$$.fragment)},l(l){h(a.$$.fragment,l)},m(l,m){u(a,l,m),o=!0},p(l,m){const w={};m&2&&(w.$$scope={dirty:m,ctx:l}),a.$set(w)},i(l){o||(y(a.$$.fragment,l),o=!0)},o(l){f(a.$$.fragment,l),o=!1},d(l){g(a,l)}}}function Ua(k){let a,o='Keras を使用したモデルの微調整に慣れていない場合は、<a href="../training#train-a-tensorflow-model-with-keras">こちら</a> の基本的なチュートリアルをご覧ください。';return{c(){a=d("p"),a.innerHTML=o},l(l){a=b(l,"P",{"data-svelte-h":!0}),J(a)!=="svelte-1jwo7q8"&&(a.innerHTML=o)},m(l,m){n(l,a,m)},p:cs,d(l){l&&t(a)}}}function xa(k){let a,o,l,m,w,C='次に、<a href="/docs/transformers/pr_28071/ja/model_doc/auto#transformers.TFAutoModelForTokenClassification">TFAutoModelForTokenClassification</a> を使用して、予期されるラベルの数とラベル マッピングを指定して DistilBERT をロードできます。',A,v,I,G,x='<a href="/docs/transformers/pr_28071/ja/main_classes/model#transformers.TFPreTrainedModel.prepare_tf_dataset">prepare_tf_dataset()</a> を使用して、データセットを <code>tf.data.Dataset</code> 形式に変換します。',V,B,U,W,r='<a href="https://keras.io/api/models/model_training_apis/#compile-method" rel="nofollow"><code>compile</code></a> を使用してトレーニング用のモデルを設定します。 Transformers モデルにはすべてデフォルトのタスク関連の損失関数があるため、次の場合を除き、損失関数を指定する必要はないことに注意してください。',$,E,X,R,M='トレーニングを開始する前にセットアップする最後の 2 つのことは、予測から連続スコアを計算することと、モデルをハブにプッシュする方法を提供することです。どちらも <a href="../main_classes/keras_callbacks">Keras コールバック</a> を使用して行われます。',Z,F,os='<code>compute_metrics</code> 関数を <a href="/docs/transformers/pr_28071/ja/main_classes/keras_callbacks#transformers.KerasMetricCallback">KerasMetricCallback</a> に渡します。',H,z,Q,ls,ms='<a href="/docs/transformers/pr_28071/ja/main_classes/keras_callbacks#transformers.PushToHubCallback">PushToHubCallback</a> でモデルとトークナイザーをプッシュする場所を指定します。',N,Y,q,S,as="次に、コールバックをまとめてバンドルします。",Ms,L,D,P,ts='ついに、モデルのトレーニングを開始する準備が整いました。トレーニングおよび検証データセット、エポック数、コールバックを指定して <a href="https://keras.io/api/models/model_training_apis/#fit-method" rel="nofollow"><code>fit</code></a> を呼び出し、モデルを微調整します。',js,K,O,ss,ns="トレーニングが完了すると、モデルは自動的にハブにアップロードされ、誰でも使用できるようになります。",hs;return a=new Bl({props:{$$slots:{default:[Ua]},$$scope:{ctx:k}}}),l=new _({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMGNyZWF0ZV9vcHRpbWl6ZXIlMEElMEFiYXRjaF9zaXplJTIwJTNEJTIwMTYlMEFudW1fdHJhaW5fZXBvY2hzJTIwJTNEJTIwMyUwQW51bV90cmFpbl9zdGVwcyUyMCUzRCUyMChsZW4odG9rZW5pemVkX3dudXQlNUIlMjJ0cmFpbiUyMiU1RCklMjAlMkYlMkYlMjBiYXRjaF9zaXplKSUyMColMjBudW1fdHJhaW5fZXBvY2hzJTBBb3B0aW1pemVyJTJDJTIwbHJfc2NoZWR1bGUlMjAlM0QlMjBjcmVhdGVfb3B0aW1pemVyKCUwQSUyMCUyMCUyMCUyMGluaXRfbHIlM0QyZS01JTJDJTBBJTIwJTIwJTIwJTIwbnVtX3RyYWluX3N0ZXBzJTNEbnVtX3RyYWluX3N0ZXBzJTJDJTBBJTIwJTIwJTIwJTIwd2VpZ2h0X2RlY2F5X3JhdGUlM0QwLjAxJTJDJTBBJTIwJTIwJTIwJTIwbnVtX3dhcm11cF9zdGVwcyUzRDAlMkMlMEEp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> create_optimizer

<span class="hljs-meta">&gt;&gt;&gt; </span>batch_size = <span class="hljs-number">16</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>num_train_epochs = <span class="hljs-number">3</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>num_train_steps = (<span class="hljs-built_in">len</span>(tokenized_wnut[<span class="hljs-string">&quot;train&quot;</span>]) // batch_size) * num_train_epochs
<span class="hljs-meta">&gt;&gt;&gt; </span>optimizer, lr_schedule = create_optimizer(
<span class="hljs-meta">... </span>    init_lr=<span class="hljs-number">2e-5</span>,
<span class="hljs-meta">... </span>    num_train_steps=num_train_steps,
<span class="hljs-meta">... </span>    weight_decay_rate=<span class="hljs-number">0.01</span>,
<span class="hljs-meta">... </span>    num_warmup_steps=<span class="hljs-number">0</span>,
<span class="hljs-meta">... </span>)`,wrap:!1}}),v=new _({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGQXV0b01vZGVsRm9yVG9rZW5DbGFzc2lmaWNhdGlvbiUwQSUwQW1vZGVsJTIwJTNEJTIwVEZBdXRvTW9kZWxGb3JUb2tlbkNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMEElMjAlMjAlMjAlMjAlMjJkaXN0aWxiZXJ0JTJGZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQlMjIlMkMlMjBudW1fbGFiZWxzJTNEMTMlMkMlMjBpZDJsYWJlbCUzRGlkMmxhYmVsJTJDJTIwbGFiZWwyaWQlM0RsYWJlbDJpZCUwQSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFAutoModelForTokenClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFAutoModelForTokenClassification.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;distilbert/distilbert-base-uncased&quot;</span>, num_labels=<span class="hljs-number">13</span>, id2label=id2label, label2id=label2id
<span class="hljs-meta">... </span>)`,wrap:!1}}),B=new _({props:{code:"dGZfdHJhaW5fc2V0JTIwJTNEJTIwbW9kZWwucHJlcGFyZV90Zl9kYXRhc2V0KCUwQSUyMCUyMCUyMCUyMHRva2VuaXplZF93bnV0JTVCJTIydHJhaW4lMjIlNUQlMkMlMEElMjAlMjAlMjAlMjBzaHVmZmxlJTNEVHJ1ZSUyQyUwQSUyMCUyMCUyMCUyMGJhdGNoX3NpemUlM0QxNiUyQyUwQSUyMCUyMCUyMCUyMGNvbGxhdGVfZm4lM0RkYXRhX2NvbGxhdG9yJTJDJTBBKSUwQSUwQXRmX3ZhbGlkYXRpb25fc2V0JTIwJTNEJTIwbW9kZWwucHJlcGFyZV90Zl9kYXRhc2V0KCUwQSUyMCUyMCUyMCUyMHRva2VuaXplZF93bnV0JTVCJTIydmFsaWRhdGlvbiUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMHNodWZmbGUlM0RGYWxzZSUyQyUwQSUyMCUyMCUyMCUyMGJhdGNoX3NpemUlM0QxNiUyQyUwQSUyMCUyMCUyMCUyMGNvbGxhdGVfZm4lM0RkYXRhX2NvbGxhdG9yJTJDJTBBKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>tf_train_set = model.prepare_tf_dataset(
<span class="hljs-meta">... </span>    tokenized_wnut[<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_validation_set = model.prepare_tf_dataset(
<span class="hljs-meta">... </span>    tokenized_wnut[<span class="hljs-string">&quot;validation&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}}),E=new _({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}}),z=new _({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycy5rZXJhc19jYWxsYmFja3MlMjBpbXBvcnQlMjBLZXJhc01ldHJpY0NhbGxiYWNrJTBBJTBBbWV0cmljX2NhbGxiYWNrJTIwJTNEJTIwS2VyYXNNZXRyaWNDYWxsYmFjayhtZXRyaWNfZm4lM0Rjb21wdXRlX21ldHJpY3MlMkMlMjBldmFsX2RhdGFzZXQlM0R0Zl92YWxpZGF0aW9uX3NldCk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers.keras_callbacks <span class="hljs-keyword">import</span> KerasMetricCallback

<span class="hljs-meta">&gt;&gt;&gt; </span>metric_callback = KerasMetricCallback(metric_fn=compute_metrics, eval_dataset=tf_validation_set)`,wrap:!1}}),Y=new _({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycy5rZXJhc19jYWxsYmFja3MlMjBpbXBvcnQlMjBQdXNoVG9IdWJDYWxsYmFjayUwQSUwQXB1c2hfdG9faHViX2NhbGxiYWNrJTIwJTNEJTIwUHVzaFRvSHViQ2FsbGJhY2soJTBBJTIwJTIwJTIwJTIwb3V0cHV0X2RpciUzRCUyMm15X2F3ZXNvbWVfd251dF9tb2RlbCUyMiUyQyUwQSUyMCUyMCUyMCUyMHRva2VuaXplciUzRHRva2VuaXplciUyQyUwQSk=",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>push_to_hub_callback = PushToHubCallback(
<span class="hljs-meta">... </span>    output_dir=<span class="hljs-string">&quot;my_awesome_wnut_model&quot;</span>,
<span class="hljs-meta">... </span>    tokenizer=tokenizer,
<span class="hljs-meta">... </span>)`,wrap:!1}}),L=new _({props:{code:"Y2FsbGJhY2tzJTIwJTNEJTIwJTVCbWV0cmljX2NhbGxiYWNrJTJDJTIwcHVzaF90b19odWJfY2FsbGJhY2slNUQ=",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>callbacks = [metric_callback, push_to_hub_callback]',wrap:!1}}),K=new _({props:{code:"bW9kZWwuZml0KHglM0R0Zl90cmFpbl9zZXQlMkMlMjB2YWxpZGF0aW9uX2RhdGElM0R0Zl92YWxpZGF0aW9uX3NldCUyQyUyMGVwb2NocyUzRDMlMkMlMjBjYWxsYmFja3MlM0RjYWxsYmFja3Mp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>model.fit(x=tf_train_set, validation_data=tf_validation_set, epochs=<span class="hljs-number">3</span>, callbacks=callbacks)',wrap:!1}}),{c(){j(a.$$.fragment),o=ja(`
TensorFlow でモデルを微調整するには、オプティマイザー関数、学習率スケジュール、およびいくつかのトレーニング ハイパーパラメーターをセットアップすることから始めます。

	`),j(l.$$.fragment),m=i(),w=d("p"),w.innerHTML=C,A=i(),j(v.$$.fragment),I=i(),G=d("p"),G.innerHTML=x,V=i(),j(B.$$.fragment),U=i(),W=d("p"),W.innerHTML=r,$=i(),j(E.$$.fragment),X=i(),R=d("p"),R.innerHTML=M,Z=i(),F=d("p"),F.innerHTML=os,H=i(),j(z.$$.fragment),Q=i(),ls=d("p"),ls.innerHTML=ms,N=i(),j(Y.$$.fragment),q=i(),S=d("p"),S.textContent=as,Ms=i(),j(L.$$.fragment),D=i(),P=d("p"),P.innerHTML=ts,js=i(),j(K.$$.fragment),O=i(),ss=d("p"),ss.textContent=ns},l(p){h(a.$$.fragment,p),o=ha(p,`
TensorFlow でモデルを微調整するには、オプティマイザー関数、学習率スケジュール、およびいくつかのトレーニング ハイパーパラメーターをセットアップすることから始めます。

	`),h(l.$$.fragment,p),m=c(p),w=b(p,"P",{"data-svelte-h":!0}),J(w)!=="svelte-1ot2fvq"&&(w.innerHTML=C),A=c(p),h(v.$$.fragment,p),I=c(p),G=b(p,"P",{"data-svelte-h":!0}),J(G)!=="svelte-dgevgw"&&(G.innerHTML=x),V=c(p),h(B.$$.fragment,p),U=c(p),W=b(p,"P",{"data-svelte-h":!0}),J(W)!=="svelte-1pd5few"&&(W.innerHTML=r),$=c(p),h(E.$$.fragment,p),X=c(p),R=b(p,"P",{"data-svelte-h":!0}),J(R)!=="svelte-ggt0vi"&&(R.innerHTML=M),Z=c(p),F=b(p,"P",{"data-svelte-h":!0}),J(F)!=="svelte-8sje50"&&(F.innerHTML=os),H=c(p),h(z.$$.fragment,p),Q=c(p),ls=b(p,"P",{"data-svelte-h":!0}),J(ls)!=="svelte-sr7h3x"&&(ls.innerHTML=ms),N=c(p),h(Y.$$.fragment,p),q=c(p),S=b(p,"P",{"data-svelte-h":!0}),J(S)!=="svelte-r16oc5"&&(S.textContent=as),Ms=c(p),h(L.$$.fragment,p),D=c(p),P=b(p,"P",{"data-svelte-h":!0}),J(P)!=="svelte-ffgub5"&&(P.innerHTML=ts),js=c(p),h(K.$$.fragment,p),O=c(p),ss=b(p,"P",{"data-svelte-h":!0}),J(ss)!=="svelte-vh7z0v"&&(ss.textContent=ns)},m(p,T){u(a,p,T),n(p,o,T),u(l,p,T),n(p,m,T),n(p,w,T),n(p,A,T),u(v,p,T),n(p,I,T),n(p,G,T),n(p,V,T),u(B,p,T),n(p,U,T),n(p,W,T),n(p,$,T),u(E,p,T),n(p,X,T),n(p,R,T),n(p,Z,T),n(p,F,T),n(p,H,T),u(z,p,T),n(p,Q,T),n(p,ls,T),n(p,N,T),u(Y,p,T),n(p,q,T),n(p,S,T),n(p,Ms,T),u(L,p,T),n(p,D,T),n(p,P,T),n(p,js,T),u(K,p,T),n(p,O,T),n(p,ss,T),hs=!0},p(p,T){const us={};T&2&&(us.$$scope={dirty:T,ctx:p}),a.$set(us)},i(p){hs||(y(a.$$.fragment,p),y(l.$$.fragment,p),y(v.$$.fragment,p),y(B.$$.fragment,p),y(E.$$.fragment,p),y(z.$$.fragment,p),y(Y.$$.fragment,p),y(L.$$.fragment,p),y(K.$$.fragment,p),hs=!0)},o(p){f(a.$$.fragment,p),f(l.$$.fragment,p),f(v.$$.fragment,p),f(B.$$.fragment,p),f(E.$$.fragment,p),f(z.$$.fragment,p),f(Y.$$.fragment,p),f(L.$$.fragment,p),f(K.$$.fragment,p),hs=!1},d(p){p&&(t(o),t(m),t(w),t(A),t(I),t(G),t(V),t(U),t(W),t($),t(X),t(R),t(Z),t(F),t(H),t(Q),t(ls),t(N),t(q),t(S),t(Ms),t(D),t(P),t(js),t(O),t(ss)),g(a,p),g(l,p),g(v,p),g(B,p),g(E,p),g(z,p),g(Y,p),g(L,p),g(K,p)}}}function _a(k){let a,o;return a=new Ls({props:{$$slots:{default:[xa]},$$scope:{ctx:k}}}),{c(){j(a.$$.fragment)},l(l){h(a.$$.fragment,l)},m(l,m){u(a,l,m),o=!0},p(l,m){const w={};m&2&&(w.$$scope={dirty:m,ctx:l}),a.$set(w)},i(l){o||(y(a.$$.fragment,l),o=!0)},o(l){f(a.$$.fragment,l),o=!1},d(l){g(a,l)}}}function ka(k){let a,o=`トークン分類のモデルを微調整する方法のより詳細な例については、対応するセクションを参照してください。
<a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/token_classification.ipynb" rel="nofollow">PyTorch ノートブック</a>
または <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/token_classification-tf.ipynb" rel="nofollow">TensorFlow ノートブック</a>。`;return{c(){a=d("p"),a.innerHTML=o},l(l){a=b(l,"P",{"data-svelte-h":!0}),J(a)!=="svelte-bbxcky"&&(a.innerHTML=o)},m(l,m){n(l,a,m)},p:cs,d(l){l&&t(a)}}}function Ca(k){let a,o="テキストをトークン化して PyTorch テンソルを返します。",l,m,w,C,A="入力をモデルに渡し、<code>logits</code>を返します。",v,I,G,x,V="最も高い確率でクラスを取得し、モデルの <code>id2label</code> マッピングを使用してそれをテキスト ラベルに変換します。",B,U,W;return m=new _({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJzdGV2aGxpdSUyRm15X2F3ZXNvbWVfd251dF9tb2RlbCUyMiklMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIodGV4dCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIp",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_wnut_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(text, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)`,wrap:!1}}),I=new _({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvclRva2VuQ2xhc3NpZmljYXRpb24lMEElMEFtb2RlbCUyMCUzRCUyMEF1dG9Nb2RlbEZvclRva2VuQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMnN0ZXZobGl1JTJGbXlfYXdlc29tZV93bnV0X21vZGVsJTIyKSUwQXdpdGglMjB0b3JjaC5ub19ncmFkKCklM0ElMEElMjAlMjAlMjAlMjBsb2dpdHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cykubG9naXRz",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForTokenClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForTokenClassification.from_pretrained(<span class="hljs-string">&quot;stevhliu/my_awesome_wnut_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    logits = model(**inputs).logits`,wrap:!1}}),U=new _({props:{code:"cHJlZGljdGlvbnMlMjAlM0QlMjB0b3JjaC5hcmdtYXgobG9naXRzJTJDJTIwZGltJTNEMiklMEFwcmVkaWN0ZWRfdG9rZW5fY2xhc3MlMjAlM0QlMjAlNUJtb2RlbC5jb25maWcuaWQybGFiZWwlNUJ0Lml0ZW0oKSU1RCUyMGZvciUyMHQlMjBpbiUyMHByZWRpY3Rpb25zJTVCMCU1RCU1RCUwQXByZWRpY3RlZF90b2tlbl9jbGFzcw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>predictions = torch.argmax(logits, dim=<span class="hljs-number">2</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_token_class = [model.config.id2label[t.item()] <span class="hljs-keyword">for</span> t <span class="hljs-keyword">in</span> predictions[<span class="hljs-number">0</span>]]
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_token_class
[<span class="hljs-string">&#x27;O&#x27;</span>,
 <span class="hljs-string">&#x27;O&#x27;</span>,
 <span class="hljs-string">&#x27;B-location&#x27;</span>,
 <span class="hljs-string">&#x27;I-location&#x27;</span>,
 <span class="hljs-string">&#x27;B-group&#x27;</span>,
 <span class="hljs-string">&#x27;O&#x27;</span>,
 <span class="hljs-string">&#x27;O&#x27;</span>,
 <span class="hljs-string">&#x27;O&#x27;</span>,
 <span class="hljs-string">&#x27;O&#x27;</span>,
 <span class="hljs-string">&#x27;O&#x27;</span>,
 <span class="hljs-string">&#x27;O&#x27;</span>,
 <span class="hljs-string">&#x27;O&#x27;</span>,
 <span class="hljs-string">&#x27;O&#x27;</span>,
 <span class="hljs-string">&#x27;B-location&#x27;</span>,
 <span class="hljs-string">&#x27;B-location&#x27;</span>,
 <span class="hljs-string">&#x27;O&#x27;</span>,
 <span class="hljs-string">&#x27;O&#x27;</span>]`,wrap:!1}}),{c(){a=d("p"),a.textContent=o,l=i(),j(m.$$.fragment),w=i(),C=d("p"),C.innerHTML=A,v=i(),j(I.$$.fragment),G=i(),x=d("p"),x.innerHTML=V,B=i(),j(U.$$.fragment)},l(r){a=b(r,"P",{"data-svelte-h":!0}),J(a)!=="svelte-1n0k6or"&&(a.textContent=o),l=c(r),h(m.$$.fragment,r),w=c(r),C=b(r,"P",{"data-svelte-h":!0}),J(C)!=="svelte-1rvunpz"&&(C.innerHTML=A),v=c(r),h(I.$$.fragment,r),G=c(r),x=b(r,"P",{"data-svelte-h":!0}),J(x)!=="svelte-37ihfr"&&(x.innerHTML=V),B=c(r),h(U.$$.fragment,r)},m(r,$){n(r,a,$),n(r,l,$),u(m,r,$),n(r,w,$),n(r,C,$),n(r,v,$),u(I,r,$),n(r,G,$),n(r,x,$),n(r,B,$),u(U,r,$),W=!0},p:cs,i(r){W||(y(m.$$.fragment,r),y(I.$$.fragment,r),y(U.$$.fragment,r),W=!0)},o(r){f(m.$$.fragment,r),f(I.$$.fragment,r),f(U.$$.fragment,r),W=!1},d(r){r&&(t(a),t(l),t(w),t(C),t(v),t(G),t(x),t(B)),g(m,r),g(I,r),g(U,r)}}}function Ia(k){let a,o;return a=new Ls({props:{$$slots:{default:[Ca]},$$scope:{ctx:k}}}),{c(){j(a.$$.fragment)},l(l){h(a.$$.fragment,l)},m(l,m){u(a,l,m),o=!0},p(l,m){const w={};m&2&&(w.$$scope={dirty:m,ctx:l}),a.$set(w)},i(l){o||(y(a.$$.fragment,l),o=!0)},o(l){f(a.$$.fragment,l),o=!1},d(l){g(a,l)}}}function Za(k){let a,o="テキストをトークン化し、TensorFlow テンソルを返します。",l,m,w,C,A="入力をモデルに渡し、<code>logits</code>を返します。",v,I,G,x,V="最も高い確率でクラスを取得し、モデルの <code>id2label</code> マッピングを使用してそれをテキスト ラベルに変換します。",B,U,W;return m=new _({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJzdGV2aGxpdSUyRm15X2F3ZXNvbWVfd251dF9tb2RlbCUyMiklMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIodGV4dCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIydGYlMjIp",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_wnut_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(text, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)`,wrap:!1}}),I=new _({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGQXV0b01vZGVsRm9yVG9rZW5DbGFzc2lmaWNhdGlvbiUwQSUwQW1vZGVsJTIwJTNEJTIwVEZBdXRvTW9kZWxGb3JUb2tlbkNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZCglMjJzdGV2aGxpdSUyRm15X2F3ZXNvbWVfd251dF9tb2RlbCUyMiklMEFsb2dpdHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cykubG9naXRz",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFAutoModelForTokenClassification

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFAutoModelForTokenClassification.from_pretrained(<span class="hljs-string">&quot;stevhliu/my_awesome_wnut_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = model(**inputs).logits`,wrap:!1}}),U=new _({props:{code:"cHJlZGljdGVkX3Rva2VuX2NsYXNzX2lkcyUyMCUzRCUyMHRmLm1hdGguYXJnbWF4KGxvZ2l0cyUyQyUyMGF4aXMlM0QtMSklMEFwcmVkaWN0ZWRfdG9rZW5fY2xhc3MlMjAlM0QlMjAlNUJtb2RlbC5jb25maWcuaWQybGFiZWwlNUJ0JTVEJTIwZm9yJTIwdCUyMGluJTIwcHJlZGljdGVkX3Rva2VuX2NsYXNzX2lkcyU1QjAlNUQubnVtcHkoKS50b2xpc3QoKSU1RCUwQXByZWRpY3RlZF90b2tlbl9jbGFzcw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_token_class_ids = tf.math.argmax(logits, axis=-<span class="hljs-number">1</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_token_class = [model.config.id2label[t] <span class="hljs-keyword">for</span> t <span class="hljs-keyword">in</span> predicted_token_class_ids[<span class="hljs-number">0</span>].numpy().tolist()]
<span class="hljs-meta">&gt;&gt;&gt; </span>predicted_token_class
[<span class="hljs-string">&#x27;O&#x27;</span>,
 <span class="hljs-string">&#x27;O&#x27;</span>,
 <span class="hljs-string">&#x27;B-location&#x27;</span>,
 <span class="hljs-string">&#x27;I-location&#x27;</span>,
 <span class="hljs-string">&#x27;B-group&#x27;</span>,
 <span class="hljs-string">&#x27;O&#x27;</span>,
 <span class="hljs-string">&#x27;O&#x27;</span>,
 <span class="hljs-string">&#x27;O&#x27;</span>,
 <span class="hljs-string">&#x27;O&#x27;</span>,
 <span class="hljs-string">&#x27;O&#x27;</span>,
 <span class="hljs-string">&#x27;O&#x27;</span>,
 <span class="hljs-string">&#x27;O&#x27;</span>,
 <span class="hljs-string">&#x27;O&#x27;</span>,
 <span class="hljs-string">&#x27;B-location&#x27;</span>,
 <span class="hljs-string">&#x27;B-location&#x27;</span>,
 <span class="hljs-string">&#x27;O&#x27;</span>,
 <span class="hljs-string">&#x27;O&#x27;</span>]`,wrap:!1}}),{c(){a=d("p"),a.textContent=o,l=i(),j(m.$$.fragment),w=i(),C=d("p"),C.innerHTML=A,v=i(),j(I.$$.fragment),G=i(),x=d("p"),x.innerHTML=V,B=i(),j(U.$$.fragment)},l(r){a=b(r,"P",{"data-svelte-h":!0}),J(a)!=="svelte-1bnmfqq"&&(a.textContent=o),l=c(r),h(m.$$.fragment,r),w=c(r),C=b(r,"P",{"data-svelte-h":!0}),J(C)!=="svelte-1rvunpz"&&(C.innerHTML=A),v=c(r),h(I.$$.fragment,r),G=c(r),x=b(r,"P",{"data-svelte-h":!0}),J(x)!=="svelte-37ihfr"&&(x.innerHTML=V),B=c(r),h(U.$$.fragment,r)},m(r,$){n(r,a,$),n(r,l,$),u(m,r,$),n(r,w,$),n(r,C,$),n(r,v,$),u(I,r,$),n(r,G,$),n(r,x,$),n(r,B,$),u(U,r,$),W=!0},p:cs,i(r){W||(y(m.$$.fragment,r),y(I.$$.fragment,r),y(U.$$.fragment,r),W=!0)},o(r){f(m.$$.fragment,r),f(I.$$.fragment,r),f(U.$$.fragment,r),W=!1},d(r){r&&(t(a),t(l),t(w),t(C),t(v),t(G),t(x),t(B)),g(m,r),g(I,r),g(U,r)}}}function va(k){let a,o;return a=new Ls({props:{$$slots:{default:[Za]},$$scope:{ctx:k}}}),{c(){j(a.$$.fragment)},l(l){h(a.$$.fragment,l)},m(l,m){u(a,l,m),o=!0},p(l,m){const w={};m&2&&(w.$$scope={dirty:m,ctx:l}),a.$set(w)},i(l){o||(y(a.$$.fragment,l),o=!0)},o(l){f(a.$$.fragment,l),o=!1},d(l){g(a,l)}}}function Ga(k){let a,o,l,m,w,C,A,v,I,G,x,V="トークン分類では、文内の個々のトークンにラベルを割り当てます。最も一般的なトークン分類タスクの 1 つは、固有表現認識 (NER) です。 NER は、人、場所、組織など、文内の各エンティティのラベルを見つけようとします。",B,U,W="このガイドでは、次の方法を説明します。",r,$,E='<li><a href="https://huggingface.co/datasets/wnut_17" rel="nofollow">WNUT 17</a> データセットで <a href="https://huggingface.co/distilbert/distilbert-base-uncased" rel="nofollow">DistilBERT</a> を微調整して、新しいエンティティを検出します。</li> <li>微調整されたモデルを推論に使用します。</li>',X,R,M,Z,F="始める前に、必要なライブラリがすべてインストールされていることを確認してください。",os,H,z,Q,ls="モデルをアップロードしてコミュニティと共有できるように、Hugging Face アカウントにログインすることをお勧めします。プロンプトが表示されたら、トークンを入力してログインします。",ms,N,Y,q,S,as,Ms="まず、🤗 データセット ライブラリから WNUT 17 データセットをロードします。",L,D,P,ts,js="次に、例を見てみましょう。",K,O,ss,ns,hs="<code>ner_tags</code>内の各数字はエンティティを表します。数値をラベル名に変換して、エンティティが何であるかを調べます。",p,T,us,ys,Al="各 <code>ner_tag</code> の前に付く文字は、エンティティのトークンの位置を示します。",Ps,fs,Rl=`<li><code>B-</code> はエンティティの始まりを示します。</li> <li><code>I-</code> は、トークンが同じエンティティ内に含まれていることを示します (たとえば、<code>State</code> トークンは次のようなエンティティの一部です)
<code>Empire State Building</code>）。</li> <li><code>0</code> は、トークンがどのエンティティにも対応しないことを示します。</li>`,Ks,gs,Os,ds,sl,bs,Xl="次のステップでは、DistilBERT トークナイザーをロードして<code>tokens</code>フィールドを前処理します。",ll,ws,al,Js,Vl="上の <code>tokens</code>フィールドの例で見たように、入力はすでにトークン化されているようです。しかし、実際には入力はまだトークン化されていないため、単語をサブワードにトークン化するには<code>is_split_into_words=True</code> を設定する必要があります。例えば：",tl,Ts,nl,$s,El="ただし、これによりいくつかの特別なトークン <code>[CLS]</code> と <code>[SEP]</code> が追加され、サブワードのトークン化により入力とラベルの間に不一致が生じます。 1 つのラベルに対応する 1 つの単語を 2 つのサブワードに分割できるようになりました。次の方法でトークンとラベルを再調整する必要があります。",el,Us,Fl='<li><a href="https://huggingface.co/docs/transformers/main_classes/tokenizer#transformers.BatchEncoding.word_ids" rel="nofollow"><code>word_ids</code></a> メソッドを使用して、すべてのトークンを対応する単語にマッピングします。</li> <li>特別なトークン <code>[CLS]</code> と <code>[SEP]</code> にラベル <code>-100</code> を割り当て、それらが PyTorch 損失関数によって無視されるようにします (<a href="https://pytorch.org/docs/stable/generated/torch.nn.CrossEntropyLoss.html" rel="nofollow">CrossEntropyLoss</a>)。</li> <li>特定の単語の最初のトークンのみにラベルを付けます。同じ単語の他のサブトークンに <code>-100</code>を割り当てます。</li>',pl,xs,Hl="トークンとラベルを再調整し、シーケンスを DistilBERT の最大入力長以下に切り詰める関数を作成する方法を次に示します。",rl,_s,il,ks,zl="データセット全体に前処理関数を適用するには、🤗 Datasets <code>map</code> 関数を使用します。 <code>batched=True</code> を設定してデータセットの複数の要素を一度に処理することで、<code>map</code> 関数を高速化できます。",cl,Cs,ol,Is,Ql="次に、<code>DataCollat​​orWithPadding</code> を使用してサンプルのバッチを作成します。データセット全体を最大長までパディングするのではなく、照合中にバッチ内の最長の長さまで文を <em>動的にパディング</em> する方が効率的です。",ml,es,Ml,Zs,jl,vs,Nl='トレーニング中にメトリクスを含めると、多くの場合、モデルのパフォーマンスを評価するのに役立ちます。 🤗 <a href="https://huggingface.co/docs/evaluate/index" rel="nofollow">Evaluate</a> ライブラリを使用して、評価メソッドをすばやくロードできます。このタスクでは、<a href="https://huggingface.co/spaces/evaluate-metric/seqeval" rel="nofollow">seqeval</a> フレームワークを読み込みます (🤗 Evaluate <a href="https://huggingface.co/docs/evaluate/a_quick_tour" rel="nofollow">クイック ツアー</a> を参照してください) ) メトリクスの読み込みと計算の方法について詳しくは、こちらをご覧ください)。 Seqeval は実際に、精度、再現率、F1、精度などのいくつかのスコアを生成します。',hl,Gs,ul,Bs,Yl="まず NER ラベルを取得してから、真の予測と真のラベルを <code>compute</code> に渡してスコアを計算する関数を作成します。",yl,Ws,fl,As,ql="これで<code>compute_metrics</code>関数の準備が整いました。トレーニングをセットアップするときにこの関数に戻ります。",gl,Rs,dl,Xs,Sl="モデルのトレーニングを開始する前に、<code>id2label</code>と<code>label2id</code>を使用して、予想される ID とそのラベルのマップを作成します。",bl,Vs,wl,ps,Jl,rs,Tl,Es,$l,Fs,Ll="モデルを微調整したので、それを推論に使用できるようになりました。",Ul,Hs,Dl="推論を実行したいテキストをいくつか取得します。",xl,zs,_l,Qs,Pl='推論用に微調整されたモデルを試す最も簡単な方法は、それを <a href="/docs/transformers/pr_28071/ja/main_classes/pipelines#transformers.pipeline">pipeline()</a> で使用することです。モデルを使用して NER の<code>pipeline</code>をインスタンス化し、テキストをそれに渡します。',kl,Ns,Cl,Ys,Kl="必要に応じて、<code>pipeline</code>の結果を手動で複製することもできます。",Il,is,Zl,qs,vl,Ds,Gl;return w=new Ss({props:{title:"Token classification",local:"token-classification",headingTag:"h1"}}),A=new ua({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/token_classification.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/ja/pytorch/token_classification.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/ja/tensorflow/token_classification.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ja/token_classification.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ja/pytorch/token_classification.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ja/tensorflow/token_classification.ipynb"}]}}),I=new pa({props:{id:"wVHdVlPScxA"}}),R=new Bl({props:{$$slots:{default:[fa]},$$scope:{ctx:k}}}),H=new _({props:{code:"cGlwJTIwaW5zdGFsbCUyMHRyYW5zZm9ybWVycyUyMGRhdGFzZXRzJTIwZXZhbHVhdGUlMjBzZXFldmFs",highlighted:"pip install transformers datasets evaluate seqeval",wrap:!1}}),N=new _({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 Ss({props:{title:"Load WNUT 17 dataset",local:"load-wnut-17-dataset",headingTag:"h2"}}),D=new _({props:{code:"ZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBJTBBd251dCUyMCUzRCUyMGxvYWRfZGF0YXNldCglMjJ3bnV0XzE3JTIyKQ==",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>wnut = load_dataset(<span class="hljs-string">&quot;wnut_17&quot;</span>)`,wrap:!1}}),O=new _({props:{code:"d251dCU1QiUyMnRyYWluJTIyJTVEJTVCMCU1RA==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>wnut[<span class="hljs-string">&quot;train&quot;</span>][<span class="hljs-number">0</span>]
{<span class="hljs-string">&#x27;id&#x27;</span>: <span class="hljs-string">&#x27;0&#x27;</span>,
 <span class="hljs-string">&#x27;ner_tags&#x27;</span>: [<span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">7</span>, <span class="hljs-number">8</span>, <span class="hljs-number">8</span>, <span class="hljs-number">0</span>, <span class="hljs-number">7</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>],
 <span class="hljs-string">&#x27;tokens&#x27;</span>: [<span class="hljs-string">&#x27;@paulwalk&#x27;</span>, <span class="hljs-string">&#x27;It&#x27;</span>, <span class="hljs-string">&quot;&#x27;s&quot;</span>, <span class="hljs-string">&#x27;the&#x27;</span>, <span class="hljs-string">&#x27;view&#x27;</span>, <span class="hljs-string">&#x27;from&#x27;</span>, <span class="hljs-string">&#x27;where&#x27;</span>, <span class="hljs-string">&#x27;I&#x27;</span>, <span class="hljs-string">&quot;&#x27;m&quot;</span>, <span class="hljs-string">&#x27;living&#x27;</span>, <span class="hljs-string">&#x27;for&#x27;</span>, <span class="hljs-string">&#x27;two&#x27;</span>, <span class="hljs-string">&#x27;weeks&#x27;</span>, <span class="hljs-string">&#x27;.&#x27;</span>, <span class="hljs-string">&#x27;Empire&#x27;</span>, <span class="hljs-string">&#x27;State&#x27;</span>, <span class="hljs-string">&#x27;Building&#x27;</span>, <span class="hljs-string">&#x27;=&#x27;</span>, <span class="hljs-string">&#x27;ESB&#x27;</span>, <span class="hljs-string">&#x27;.&#x27;</span>, <span class="hljs-string">&#x27;Pretty&#x27;</span>, <span class="hljs-string">&#x27;bad&#x27;</span>, <span class="hljs-string">&#x27;storm&#x27;</span>, <span class="hljs-string">&#x27;here&#x27;</span>, <span class="hljs-string">&#x27;last&#x27;</span>, <span class="hljs-string">&#x27;evening&#x27;</span>, <span class="hljs-string">&#x27;.&#x27;</span>]
}`,wrap:!1}}),T=new _({props:{code:"bGFiZWxfbGlzdCUyMCUzRCUyMHdudXQlNUIlMjJ0cmFpbiUyMiU1RC5mZWF0dXJlcyU1QmYlMjJuZXJfdGFncyUyMiU1RC5mZWF0dXJlLm5hbWVzJTBBbGFiZWxfbGlzdA==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>label_list = wnut[<span class="hljs-string">&quot;train&quot;</span>].features[<span class="hljs-string">f&quot;ner_tags&quot;</span>].feature.names
<span class="hljs-meta">&gt;&gt;&gt; </span>label_list
[
    <span class="hljs-string">&quot;O&quot;</span>,
    <span class="hljs-string">&quot;B-corporation&quot;</span>,
    <span class="hljs-string">&quot;I-corporation&quot;</span>,
    <span class="hljs-string">&quot;B-creative-work&quot;</span>,
    <span class="hljs-string">&quot;I-creative-work&quot;</span>,
    <span class="hljs-string">&quot;B-group&quot;</span>,
    <span class="hljs-string">&quot;I-group&quot;</span>,
    <span class="hljs-string">&quot;B-location&quot;</span>,
    <span class="hljs-string">&quot;I-location&quot;</span>,
    <span class="hljs-string">&quot;B-person&quot;</span>,
    <span class="hljs-string">&quot;I-person&quot;</span>,
    <span class="hljs-string">&quot;B-product&quot;</span>,
    <span class="hljs-string">&quot;I-product&quot;</span>,
]`,wrap:!1}}),gs=new Ss({props:{title:"Preprocess",local:"preprocess",headingTag:"h2"}}),ds=new pa({props:{id:"iY2AZYdZAr0"}}),ws=new _({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJkaXN0aWxiZXJ0JTJGZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQlMjIp",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/distilbert-base-uncased&quot;</span>)`,wrap:!1}}),Ts=new _({props:{code:"ZXhhbXBsZSUyMCUzRCUyMHdudXQlNUIlMjJ0cmFpbiUyMiU1RCU1QjAlNUQlMEF0b2tlbml6ZWRfaW5wdXQlMjAlM0QlMjB0b2tlbml6ZXIoZXhhbXBsZSU1QiUyMnRva2VucyUyMiU1RCUyQyUyMGlzX3NwbGl0X2ludG9fd29yZHMlM0RUcnVlKSUwQXRva2VucyUyMCUzRCUyMHRva2VuaXplci5jb252ZXJ0X2lkc190b190b2tlbnModG9rZW5pemVkX2lucHV0JTVCJTIyaW5wdXRfaWRzJTIyJTVEKSUwQXRva2Vucw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>example = wnut[<span class="hljs-string">&quot;train&quot;</span>][<span class="hljs-number">0</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenized_input = tokenizer(example[<span class="hljs-string">&quot;tokens&quot;</span>], is_split_into_words=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokens = tokenizer.convert_ids_to_tokens(tokenized_input[<span class="hljs-string">&quot;input_ids&quot;</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>tokens
[<span class="hljs-string">&#x27;[CLS]&#x27;</span>, <span class="hljs-string">&#x27;@&#x27;</span>, <span class="hljs-string">&#x27;paul&#x27;</span>, <span class="hljs-string">&#x27;##walk&#x27;</span>, <span class="hljs-string">&#x27;it&#x27;</span>, <span class="hljs-string">&quot;&#x27;&quot;</span>, <span class="hljs-string">&#x27;s&#x27;</span>, <span class="hljs-string">&#x27;the&#x27;</span>, <span class="hljs-string">&#x27;view&#x27;</span>, <span class="hljs-string">&#x27;from&#x27;</span>, <span class="hljs-string">&#x27;where&#x27;</span>, <span class="hljs-string">&#x27;i&#x27;</span>, <span class="hljs-string">&quot;&#x27;&quot;</span>, <span class="hljs-string">&#x27;m&#x27;</span>, <span class="hljs-string">&#x27;living&#x27;</span>, <span class="hljs-string">&#x27;for&#x27;</span>, <span class="hljs-string">&#x27;two&#x27;</span>, <span class="hljs-string">&#x27;weeks&#x27;</span>, <span class="hljs-string">&#x27;.&#x27;</span>, <span class="hljs-string">&#x27;empire&#x27;</span>, <span class="hljs-string">&#x27;state&#x27;</span>, <span class="hljs-string">&#x27;building&#x27;</span>, <span class="hljs-string">&#x27;=&#x27;</span>, <span class="hljs-string">&#x27;es&#x27;</span>, <span class="hljs-string">&#x27;##b&#x27;</span>, <span class="hljs-string">&#x27;.&#x27;</span>, <span class="hljs-string">&#x27;pretty&#x27;</span>, <span class="hljs-string">&#x27;bad&#x27;</span>, <span class="hljs-string">&#x27;storm&#x27;</span>, <span class="hljs-string">&#x27;here&#x27;</span>, <span class="hljs-string">&#x27;last&#x27;</span>, <span class="hljs-string">&#x27;evening&#x27;</span>, <span class="hljs-string">&#x27;.&#x27;</span>, <span class="hljs-string">&#x27;[SEP]&#x27;</span>]`,wrap:!1}}),_s=new _({props:{code:"ZGVmJTIwdG9rZW5pemVfYW5kX2FsaWduX2xhYmVscyhleGFtcGxlcyklM0ElMEElMjAlMjAlMjAlMjB0b2tlbml6ZWRfaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKGV4YW1wbGVzJTVCJTIydG9rZW5zJTIyJTVEJTJDJTIwdHJ1bmNhdGlvbiUzRFRydWUlMkMlMjBpc19zcGxpdF9pbnRvX3dvcmRzJTNEVHJ1ZSklMEElMEElMjAlMjAlMjAlMjBsYWJlbHMlMjAlM0QlMjAlNUIlNUQlMEElMjAlMjAlMjAlMjBmb3IlMjBpJTJDJTIwbGFiZWwlMjBpbiUyMGVudW1lcmF0ZShleGFtcGxlcyU1QmYlMjJuZXJfdGFncyUyMiU1RCklM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjB3b3JkX2lkcyUyMCUzRCUyMHRva2VuaXplZF9pbnB1dHMud29yZF9pZHMoYmF0Y2hfaW5kZXglM0RpKSUyMCUyMCUyMyUyME1hcCUyMHRva2VucyUyMHRvJTIwdGhlaXIlMjByZXNwZWN0aXZlJTIwd29yZC4lMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBwcmV2aW91c193b3JkX2lkeCUyMCUzRCUyME5vbmUlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBsYWJlbF9pZHMlMjAlM0QlMjAlNUIlNUQlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBmb3IlMjB3b3JkX2lkeCUyMGluJTIwd29yZF9pZHMlM0ElMjAlMjAlMjMlMjBTZXQlMjB0aGUlMjBzcGVjaWFsJTIwdG9rZW5zJTIwdG8lMjAtMTAwLiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGlmJTIwd29yZF9pZHglMjBpcyUyME5vbmUlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBsYWJlbF9pZHMuYXBwZW5kKC0xMDApJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwZWxpZiUyMHdvcmRfaWR4JTIwISUzRCUyMHByZXZpb3VzX3dvcmRfaWR4JTNBJTIwJTIwJTIzJTIwT25seSUyMGxhYmVsJTIwdGhlJTIwZmlyc3QlMjB0b2tlbiUyMG9mJTIwYSUyMGdpdmVuJTIwd29yZC4lMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBsYWJlbF9pZHMuYXBwZW5kKGxhYmVsJTVCd29yZF9pZHglNUQpJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwZWxzZSUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGxhYmVsX2lkcy5hcHBlbmQoLTEwMCklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBwcmV2aW91c193b3JkX2lkeCUyMCUzRCUyMHdvcmRfaWR4JTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwbGFiZWxzLmFwcGVuZChsYWJlbF9pZHMpJTBBJTBBJTIwJTIwJTIwJTIwdG9rZW5pemVkX2lucHV0cyU1QiUyMmxhYmVscyUyMiU1RCUyMCUzRCUyMGxhYmVscyUwQSUyMCUyMCUyMCUyMHJldHVybiUyMHRva2VuaXplZF9pbnB1dHM=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">tokenize_and_align_labels</span>(<span class="hljs-params">examples</span>):
<span class="hljs-meta">... </span>    tokenized_inputs = tokenizer(examples[<span class="hljs-string">&quot;tokens&quot;</span>], truncation=<span class="hljs-literal">True</span>, is_split_into_words=<span class="hljs-literal">True</span>)

<span class="hljs-meta">... </span>    labels = []
<span class="hljs-meta">... </span>    <span class="hljs-keyword">for</span> i, label <span class="hljs-keyword">in</span> <span class="hljs-built_in">enumerate</span>(examples[<span class="hljs-string">f&quot;ner_tags&quot;</span>]):
<span class="hljs-meta">... </span>        word_ids = tokenized_inputs.word_ids(batch_index=i)  <span class="hljs-comment"># Map tokens to their respective word.</span>
<span class="hljs-meta">... </span>        previous_word_idx = <span class="hljs-literal">None</span>
<span class="hljs-meta">... </span>        label_ids = []
<span class="hljs-meta">... </span>        <span class="hljs-keyword">for</span> word_idx <span class="hljs-keyword">in</span> word_ids:  <span class="hljs-comment"># Set the special tokens to -100.</span>
<span class="hljs-meta">... </span>            <span class="hljs-keyword">if</span> word_idx <span class="hljs-keyword">is</span> <span class="hljs-literal">None</span>:
<span class="hljs-meta">... </span>                label_ids.append(-<span class="hljs-number">100</span>)
<span class="hljs-meta">... </span>            <span class="hljs-keyword">elif</span> word_idx != previous_word_idx:  <span class="hljs-comment"># Only label the first token of a given word.</span>
<span class="hljs-meta">... </span>                label_ids.append(label[word_idx])
<span class="hljs-meta">... </span>            <span class="hljs-keyword">else</span>:
<span class="hljs-meta">... </span>                label_ids.append(-<span class="hljs-number">100</span>)
<span class="hljs-meta">... </span>            previous_word_idx = word_idx
<span class="hljs-meta">... </span>        labels.append(label_ids)

<span class="hljs-meta">... </span>    tokenized_inputs[<span class="hljs-string">&quot;labels&quot;</span>] = labels
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> tokenized_inputs`,wrap:!1}}),Cs=new _({props:{code:"dG9rZW5pemVkX3dudXQlMjAlM0QlMjB3bnV0Lm1hcCh0b2tlbml6ZV9hbmRfYWxpZ25fbGFiZWxzJTJDJTIwYmF0Y2hlZCUzRFRydWUp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>tokenized_wnut = wnut.<span class="hljs-built_in">map</span>(tokenize_and_align_labels, batched=<span class="hljs-literal">True</span>)',wrap:!1}}),es=new Wl({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[wa],pytorch:[da]},$$scope:{ctx:k}}}),Zs=new Ss({props:{title:"Evaluate",local:"evaluate",headingTag:"h2"}}),Gs=new _({props:{code:"aW1wb3J0JTIwZXZhbHVhdGUlMEElMEFzZXFldmFsJTIwJTNEJTIwZXZhbHVhdGUubG9hZCglMjJzZXFldmFsJTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> evaluate

<span class="hljs-meta">&gt;&gt;&gt; </span>seqeval = evaluate.load(<span class="hljs-string">&quot;seqeval&quot;</span>)`,wrap:!1}}),Ws=new _({props:{code:"aW1wb3J0JTIwbnVtcHklMjBhcyUyMG5wJTBBJTBBbGFiZWxzJTIwJTNEJTIwJTVCbGFiZWxfbGlzdCU1QmklNUQlMjBmb3IlMjBpJTIwaW4lMjBleGFtcGxlJTVCZiUyMm5lcl90YWdzJTIyJTVEJTVEJTBBJTBBJTBBZGVmJTIwY29tcHV0ZV9tZXRyaWNzKHApJTNBJTBBJTIwJTIwJTIwJTIwcHJlZGljdGlvbnMlMkMlMjBsYWJlbHMlMjAlM0QlMjBwJTBBJTIwJTIwJTIwJTIwcHJlZGljdGlvbnMlMjAlM0QlMjBucC5hcmdtYXgocHJlZGljdGlvbnMlMkMlMjBheGlzJTNEMiklMEElMEElMjAlMjAlMjAlMjB0cnVlX3ByZWRpY3Rpb25zJTIwJTNEJTIwJTVCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTVCbGFiZWxfbGlzdCU1QnAlNUQlMjBmb3IlMjAocCUyQyUyMGwpJTIwaW4lMjB6aXAocHJlZGljdGlvbiUyQyUyMGxhYmVsKSUyMGlmJTIwbCUyMCElM0QlMjAtMTAwJTVEJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwZm9yJTIwcHJlZGljdGlvbiUyQyUyMGxhYmVsJTIwaW4lMjB6aXAocHJlZGljdGlvbnMlMkMlMjBsYWJlbHMpJTBBJTIwJTIwJTIwJTIwJTVEJTBBJTIwJTIwJTIwJTIwdHJ1ZV9sYWJlbHMlMjAlM0QlMjAlNUIlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlNUJsYWJlbF9saXN0JTVCbCU1RCUyMGZvciUyMChwJTJDJTIwbCklMjBpbiUyMHppcChwcmVkaWN0aW9uJTJDJTIwbGFiZWwpJTIwaWYlMjBsJTIwISUzRCUyMC0xMDAlNUQlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBmb3IlMjBwcmVkaWN0aW9uJTJDJTIwbGFiZWwlMjBpbiUyMHppcChwcmVkaWN0aW9ucyUyQyUyMGxhYmVscyklMEElMjAlMjAlMjAlMjAlNUQlMEElMEElMjAlMjAlMjAlMjByZXN1bHRzJTIwJTNEJTIwc2VxZXZhbC5jb21wdXRlKHByZWRpY3Rpb25zJTNEdHJ1ZV9wcmVkaWN0aW9ucyUyQyUyMHJlZmVyZW5jZXMlM0R0cnVlX2xhYmVscyklMEElMjAlMjAlMjAlMjByZXR1cm4lMjAlN0IlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJwcmVjaXNpb24lMjIlM0ElMjByZXN1bHRzJTVCJTIyb3ZlcmFsbF9wcmVjaXNpb24lMjIlNUQlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJyZWNhbGwlMjIlM0ElMjByZXN1bHRzJTVCJTIyb3ZlcmFsbF9yZWNhbGwlMjIlNUQlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJmMSUyMiUzQSUyMHJlc3VsdHMlNUIlMjJvdmVyYWxsX2YxJTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIyYWNjdXJhY3klMjIlM0ElMjByZXN1bHRzJTVCJTIyb3ZlcmFsbF9hY2N1cmFjeSUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMCU3RA==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np

<span class="hljs-meta">&gt;&gt;&gt; </span>labels = [label_list[i] <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> example[<span class="hljs-string">f&quot;ner_tags&quot;</span>]]


<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">compute_metrics</span>(<span class="hljs-params">p</span>):
<span class="hljs-meta">... </span>    predictions, labels = p
<span class="hljs-meta">... </span>    predictions = np.argmax(predictions, axis=<span class="hljs-number">2</span>)

<span class="hljs-meta">... </span>    true_predictions = [
<span class="hljs-meta">... </span>        [label_list[p] <span class="hljs-keyword">for</span> (p, l) <span class="hljs-keyword">in</span> <span class="hljs-built_in">zip</span>(prediction, label) <span class="hljs-keyword">if</span> l != -<span class="hljs-number">100</span>]
<span class="hljs-meta">... </span>        <span class="hljs-keyword">for</span> prediction, label <span class="hljs-keyword">in</span> <span class="hljs-built_in">zip</span>(predictions, labels)
<span class="hljs-meta">... </span>    ]
<span class="hljs-meta">... </span>    true_labels = [
<span class="hljs-meta">... </span>        [label_list[l] <span class="hljs-keyword">for</span> (p, l) <span class="hljs-keyword">in</span> <span class="hljs-built_in">zip</span>(prediction, label) <span class="hljs-keyword">if</span> l != -<span class="hljs-number">100</span>]
<span class="hljs-meta">... </span>        <span class="hljs-keyword">for</span> prediction, label <span class="hljs-keyword">in</span> <span class="hljs-built_in">zip</span>(predictions, labels)
<span class="hljs-meta">... </span>    ]

<span class="hljs-meta">... </span>    results = seqeval.compute(predictions=true_predictions, references=true_labels)
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> {
<span class="hljs-meta">... </span>        <span class="hljs-string">&quot;precision&quot;</span>: results[<span class="hljs-string">&quot;overall_precision&quot;</span>],
<span class="hljs-meta">... </span>        <span class="hljs-string">&quot;recall&quot;</span>: results[<span class="hljs-string">&quot;overall_recall&quot;</span>],
<span class="hljs-meta">... </span>        <span class="hljs-string">&quot;f1&quot;</span>: results[<span class="hljs-string">&quot;overall_f1&quot;</span>],
<span class="hljs-meta">... </span>        <span class="hljs-string">&quot;accuracy&quot;</span>: results[<span class="hljs-string">&quot;overall_accuracy&quot;</span>],
<span class="hljs-meta">... </span>    }`,wrap:!1}}),Rs=new Ss({props:{title:"Train",local:"train",headingTag:"h2"}}),Vs=new _({props:{code:"aWQybGFiZWwlMjAlM0QlMjAlN0IlMEElMjAlMjAlMjAlMjAwJTNBJTIwJTIyTyUyMiUyQyUwQSUyMCUyMCUyMCUyMDElM0ElMjAlMjJCLWNvcnBvcmF0aW9uJTIyJTJDJTBBJTIwJTIwJTIwJTIwMiUzQSUyMCUyMkktY29ycG9yYXRpb24lMjIlMkMlMEElMjAlMjAlMjAlMjAzJTNBJTIwJTIyQi1jcmVhdGl2ZS13b3JrJTIyJTJDJTBBJTIwJTIwJTIwJTIwNCUzQSUyMCUyMkktY3JlYXRpdmUtd29yayUyMiUyQyUwQSUyMCUyMCUyMCUyMDUlM0ElMjAlMjJCLWdyb3VwJTIyJTJDJTBBJTIwJTIwJTIwJTIwNiUzQSUyMCUyMkktZ3JvdXAlMjIlMkMlMEElMjAlMjAlMjAlMjA3JTNBJTIwJTIyQi1sb2NhdGlvbiUyMiUyQyUwQSUyMCUyMCUyMCUyMDglM0ElMjAlMjJJLWxvY2F0aW9uJTIyJTJDJTBBJTIwJTIwJTIwJTIwOSUzQSUyMCUyMkItcGVyc29uJTIyJTJDJTBBJTIwJTIwJTIwJTIwMTAlM0ElMjAlMjJJLXBlcnNvbiUyMiUyQyUwQSUyMCUyMCUyMCUyMDExJTNBJTIwJTIyQi1wcm9kdWN0JTIyJTJDJTBBJTIwJTIwJTIwJTIwMTIlM0ElMjAlMjJJLXByb2R1Y3QlMjIlMkMlMEElN0QlMEFsYWJlbDJpZCUyMCUzRCUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyMk8lMjIlM0ElMjAwJTJDJTBBJTIwJTIwJTIwJTIwJTIyQi1jb3Jwb3JhdGlvbiUyMiUzQSUyMDElMkMlMEElMjAlMjAlMjAlMjAlMjJJLWNvcnBvcmF0aW9uJTIyJTNBJTIwMiUyQyUwQSUyMCUyMCUyMCUyMCUyMkItY3JlYXRpdmUtd29yayUyMiUzQSUyMDMlMkMlMEElMjAlMjAlMjAlMjAlMjJJLWNyZWF0aXZlLXdvcmslMjIlM0ElMjA0JTJDJTBBJTIwJTIwJTIwJTIwJTIyQi1ncm91cCUyMiUzQSUyMDUlMkMlMEElMjAlMjAlMjAlMjAlMjJJLWdyb3VwJTIyJTNBJTIwNiUyQyUwQSUyMCUyMCUyMCUyMCUyMkItbG9jYXRpb24lMjIlM0ElMjA3JTJDJTBBJTIwJTIwJTIwJTIwJTIySS1sb2NhdGlvbiUyMiUzQSUyMDglMkMlMEElMjAlMjAlMjAlMjAlMjJCLXBlcnNvbiUyMiUzQSUyMDklMkMlMEElMjAlMjAlMjAlMjAlMjJJLXBlcnNvbiUyMiUzQSUyMDEwJTJDJTBBJTIwJTIwJTIwJTIwJTIyQi1wcm9kdWN0JTIyJTNBJTIwMTElMkMlMEElMjAlMjAlMjAlMjAlMjJJLXByb2R1Y3QlMjIlM0ElMjAxMiUyQyUwQSU3RA==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>id2label = {
<span class="hljs-meta">... </span>    <span class="hljs-number">0</span>: <span class="hljs-string">&quot;O&quot;</span>,
<span class="hljs-meta">... </span>    <span class="hljs-number">1</span>: <span class="hljs-string">&quot;B-corporation&quot;</span>,
<span class="hljs-meta">... </span>    <span class="hljs-number">2</span>: <span class="hljs-string">&quot;I-corporation&quot;</span>,
<span class="hljs-meta">... </span>    <span class="hljs-number">3</span>: <span class="hljs-string">&quot;B-creative-work&quot;</span>,
<span class="hljs-meta">... </span>    <span class="hljs-number">4</span>: <span class="hljs-string">&quot;I-creative-work&quot;</span>,
<span class="hljs-meta">... </span>    <span class="hljs-number">5</span>: <span class="hljs-string">&quot;B-group&quot;</span>,
<span class="hljs-meta">... </span>    <span class="hljs-number">6</span>: <span class="hljs-string">&quot;I-group&quot;</span>,
<span class="hljs-meta">... </span>    <span class="hljs-number">7</span>: <span class="hljs-string">&quot;B-location&quot;</span>,
<span class="hljs-meta">... </span>    <span class="hljs-number">8</span>: <span class="hljs-string">&quot;I-location&quot;</span>,
<span class="hljs-meta">... </span>    <span class="hljs-number">9</span>: <span class="hljs-string">&quot;B-person&quot;</span>,
<span class="hljs-meta">... </span>    <span class="hljs-number">10</span>: <span class="hljs-string">&quot;I-person&quot;</span>,
<span class="hljs-meta">... </span>    <span class="hljs-number">11</span>: <span class="hljs-string">&quot;B-product&quot;</span>,
<span class="hljs-meta">... </span>    <span class="hljs-number">12</span>: <span class="hljs-string">&quot;I-product&quot;</span>,
<span class="hljs-meta">... </span>}
<span class="hljs-meta">&gt;&gt;&gt; </span>label2id = {
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;O&quot;</span>: <span class="hljs-number">0</span>,
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;B-corporation&quot;</span>: <span class="hljs-number">1</span>,
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;I-corporation&quot;</span>: <span class="hljs-number">2</span>,
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;B-creative-work&quot;</span>: <span class="hljs-number">3</span>,
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;I-creative-work&quot;</span>: <span class="hljs-number">4</span>,
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;B-group&quot;</span>: <span class="hljs-number">5</span>,
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;I-group&quot;</span>: <span class="hljs-number">6</span>,
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;B-location&quot;</span>: <span class="hljs-number">7</span>,
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;I-location&quot;</span>: <span class="hljs-number">8</span>,
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;B-person&quot;</span>: <span class="hljs-number">9</span>,
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;I-person&quot;</span>: <span class="hljs-number">10</span>,
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;B-product&quot;</span>: <span class="hljs-number">11</span>,
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;I-product&quot;</span>: <span class="hljs-number">12</span>,
<span class="hljs-meta">... </span>}`,wrap:!1}}),ps=new Wl({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[_a],pytorch:[$a]},$$scope:{ctx:k}}}),rs=new Bl({props:{$$slots:{default:[ka]},$$scope:{ctx:k}}}),Es=new Ss({props:{title:"Inference",local:"inference",headingTag:"h2"}}),zs=new _({props:{code:"dGV4dCUyMCUzRCUyMCUyMlRoZSUyMEdvbGRlbiUyMFN0YXRlJTIwV2FycmlvcnMlMjBhcmUlMjBhbiUyMEFtZXJpY2FuJTIwcHJvZmVzc2lvbmFsJTIwYmFza2V0YmFsbCUyMHRlYW0lMjBiYXNlZCUyMGluJTIwU2FuJTIwRnJhbmNpc2NvLiUyMg==",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>text = <span class="hljs-string">&quot;The Golden State Warriors are an American professional basketball team based in San Francisco.&quot;</span>',wrap:!1}}),Ns=new _({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBY2xhc3NpZmllciUyMCUzRCUyMHBpcGVsaW5lKCUyMm5lciUyMiUyQyUyMG1vZGVsJTNEJTIyc3RldmhsaXUlMkZteV9hd2Vzb21lX3dudXRfbW9kZWwlMjIpJTBBY2xhc3NpZmllcih0ZXh0KQ==",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>classifier = pipeline(<span class="hljs-string">&quot;ner&quot;</span>, model=<span class="hljs-string">&quot;stevhliu/my_awesome_wnut_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>classifier(text)
[{<span class="hljs-string">&#x27;entity&#x27;</span>: <span class="hljs-string">&#x27;B-location&#x27;</span>,
  <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.42658573</span>,
  <span class="hljs-string">&#x27;index&#x27;</span>: <span class="hljs-number">2</span>,
  <span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;golden&#x27;</span>,
  <span class="hljs-string">&#x27;start&#x27;</span>: <span class="hljs-number">4</span>,
  <span class="hljs-string">&#x27;end&#x27;</span>: <span class="hljs-number">10</span>},
 {<span class="hljs-string">&#x27;entity&#x27;</span>: <span class="hljs-string">&#x27;I-location&#x27;</span>,
  <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.35856336</span>,
  <span class="hljs-string">&#x27;index&#x27;</span>: <span class="hljs-number">3</span>,
  <span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;state&#x27;</span>,
  <span class="hljs-string">&#x27;start&#x27;</span>: <span class="hljs-number">11</span>,
  <span class="hljs-string">&#x27;end&#x27;</span>: <span class="hljs-number">16</span>},
 {<span class="hljs-string">&#x27;entity&#x27;</span>: <span class="hljs-string">&#x27;B-group&#x27;</span>,
  <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.3064001</span>,
  <span class="hljs-string">&#x27;index&#x27;</span>: <span class="hljs-number">4</span>,
  <span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;warriors&#x27;</span>,
  <span class="hljs-string">&#x27;start&#x27;</span>: <span class="hljs-number">17</span>,
  <span class="hljs-string">&#x27;end&#x27;</span>: <span class="hljs-number">25</span>},
 {<span class="hljs-string">&#x27;entity&#x27;</span>: <span class="hljs-string">&#x27;B-location&#x27;</span>,
  <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.65523505</span>,
  <span class="hljs-string">&#x27;index&#x27;</span>: <span class="hljs-number">13</span>,
  <span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;san&#x27;</span>,
  <span class="hljs-string">&#x27;start&#x27;</span>: <span class="hljs-number">80</span>,
  <span class="hljs-string">&#x27;end&#x27;</span>: <span class="hljs-number">83</span>},
 {<span class="hljs-string">&#x27;entity&#x27;</span>: <span class="hljs-string">&#x27;B-location&#x27;</span>,
  <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.4668663</span>,
  <span class="hljs-string">&#x27;index&#x27;</span>: <span class="hljs-number">14</span>,
  <span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;francisco&#x27;</span>,
  <span class="hljs-string">&#x27;start&#x27;</span>: <span class="hljs-number">84</span>,
  <span class="hljs-string">&#x27;end&#x27;</span>: <span class="hljs-number">93</span>}]`,wrap:!1}}),is=new Wl({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[va],pytorch:[Ia]},$$scope:{ctx:k}}}),qs=new ya({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/ja/tasks/token_classification.md"}}),{c(){a=d("meta"),o=i(),l=d("p"),m=i(),j(w.$$.fragment),C=i(),j(A.$$.fragment),v=i(),j(I.$$.fragment),G=i(),x=d("p"),x.textContent=V,B=i(),U=d("p"),U.textContent=W,r=i(),$=d("ol"),$.innerHTML=E,X=i(),j(R.$$.fragment),M=i(),Z=d("p"),Z.textContent=F,os=i(),j(H.$$.fragment),z=i(),Q=d("p"),Q.textContent=ls,ms=i(),j(N.$$.fragment),Y=i(),j(q.$$.fragment),S=i(),as=d("p"),as.textContent=Ms,L=i(),j(D.$$.fragment),P=i(),ts=d("p"),ts.textContent=js,K=i(),j(O.$$.fragment),ss=i(),ns=d("p"),ns.innerHTML=hs,p=i(),j(T.$$.fragment),us=i(),ys=d("p"),ys.innerHTML=Al,Ps=i(),fs=d("ul"),fs.innerHTML=Rl,Ks=i(),j(gs.$$.fragment),Os=i(),j(ds.$$.fragment),sl=i(),bs=d("p"),bs.innerHTML=Xl,ll=i(),j(ws.$$.fragment),al=i(),Js=d("p"),Js.innerHTML=Vl,tl=i(),j(Ts.$$.fragment),nl=i(),$s=d("p"),$s.innerHTML=El,el=i(),Us=d("ol"),Us.innerHTML=Fl,pl=i(),xs=d("p"),xs.textContent=Hl,rl=i(),j(_s.$$.fragment),il=i(),ks=d("p"),ks.innerHTML=zl,cl=i(),j(Cs.$$.fragment),ol=i(),Is=d("p"),Is.innerHTML=Ql,ml=i(),j(es.$$.fragment),Ml=i(),j(Zs.$$.fragment),jl=i(),vs=d("p"),vs.innerHTML=Nl,hl=i(),j(Gs.$$.fragment),ul=i(),Bs=d("p"),Bs.innerHTML=Yl,yl=i(),j(Ws.$$.fragment),fl=i(),As=d("p"),As.innerHTML=ql,gl=i(),j(Rs.$$.fragment),dl=i(),Xs=d("p"),Xs.innerHTML=Sl,bl=i(),j(Vs.$$.fragment),wl=i(),j(ps.$$.fragment),Jl=i(),j(rs.$$.fragment),Tl=i(),j(Es.$$.fragment),$l=i(),Fs=d("p"),Fs.textContent=Ll,Ul=i(),Hs=d("p"),Hs.textContent=Dl,xl=i(),j(zs.$$.fragment),_l=i(),Qs=d("p"),Qs.innerHTML=Pl,kl=i(),j(Ns.$$.fragment),Cl=i(),Ys=d("p"),Ys.innerHTML=Kl,Il=i(),j(is.$$.fragment),Zl=i(),j(qs.$$.fragment),vl=i(),Ds=d("p"),this.h()},l(s){const e=ma("svelte-u9bgzb",document.head);a=b(e,"META",{name:!0,content:!0}),e.forEach(t),o=c(s),l=b(s,"P",{}),na(l).forEach(t),m=c(s),h(w.$$.fragment,s),C=c(s),h(A.$$.fragment,s),v=c(s),h(I.$$.fragment,s),G=c(s),x=b(s,"P",{"data-svelte-h":!0}),J(x)!=="svelte-1pzr9oy"&&(x.textContent=V),B=c(s),U=b(s,"P",{"data-svelte-h":!0}),J(U)!=="svelte-w5jzhi"&&(U.textContent=W),r=c(s),$=b(s,"OL",{"data-svelte-h":!0}),J($)!=="svelte-s4jtml"&&($.innerHTML=E),X=c(s),h(R.$$.fragment,s),M=c(s),Z=b(s,"P",{"data-svelte-h":!0}),J(Z)!=="svelte-1lya3k8"&&(Z.textContent=F),os=c(s),h(H.$$.fragment,s),z=c(s),Q=b(s,"P",{"data-svelte-h":!0}),J(Q)!=="svelte-193zy02"&&(Q.textContent=ls),ms=c(s),h(N.$$.fragment,s),Y=c(s),h(q.$$.fragment,s),S=c(s),as=b(s,"P",{"data-svelte-h":!0}),J(as)!=="svelte-l7eyn2"&&(as.textContent=Ms),L=c(s),h(D.$$.fragment,s),P=c(s),ts=b(s,"P",{"data-svelte-h":!0}),J(ts)!=="svelte-1r6oj5w"&&(ts.textContent=js),K=c(s),h(O.$$.fragment,s),ss=c(s),ns=b(s,"P",{"data-svelte-h":!0}),J(ns)!=="svelte-oegc1b"&&(ns.innerHTML=hs),p=c(s),h(T.$$.fragment,s),us=c(s),ys=b(s,"P",{"data-svelte-h":!0}),J(ys)!=="svelte-ojxi8i"&&(ys.innerHTML=Al),Ps=c(s),fs=b(s,"UL",{"data-svelte-h":!0}),J(fs)!=="svelte-84dn3u"&&(fs.innerHTML=Rl),Ks=c(s),h(gs.$$.fragment,s),Os=c(s),h(ds.$$.fragment,s),sl=c(s),bs=b(s,"P",{"data-svelte-h":!0}),J(bs)!=="svelte-cnh8zx"&&(bs.innerHTML=Xl),ll=c(s),h(ws.$$.fragment,s),al=c(s),Js=b(s,"P",{"data-svelte-h":!0}),J(Js)!=="svelte-1iw1brp"&&(Js.innerHTML=Vl),tl=c(s),h(Ts.$$.fragment,s),nl=c(s),$s=b(s,"P",{"data-svelte-h":!0}),J($s)!=="svelte-5b435g"&&($s.innerHTML=El),el=c(s),Us=b(s,"OL",{"data-svelte-h":!0}),J(Us)!=="svelte-11v861c"&&(Us.innerHTML=Fl),pl=c(s),xs=b(s,"P",{"data-svelte-h":!0}),J(xs)!=="svelte-173aflj"&&(xs.textContent=Hl),rl=c(s),h(_s.$$.fragment,s),il=c(s),ks=b(s,"P",{"data-svelte-h":!0}),J(ks)!=="svelte-1rpvj99"&&(ks.innerHTML=zl),cl=c(s),h(Cs.$$.fragment,s),ol=c(s),Is=b(s,"P",{"data-svelte-h":!0}),J(Is)!=="svelte-qd498c"&&(Is.innerHTML=Ql),ml=c(s),h(es.$$.fragment,s),Ml=c(s),h(Zs.$$.fragment,s),jl=c(s),vs=b(s,"P",{"data-svelte-h":!0}),J(vs)!=="svelte-1ym9fv4"&&(vs.innerHTML=Nl),hl=c(s),h(Gs.$$.fragment,s),ul=c(s),Bs=b(s,"P",{"data-svelte-h":!0}),J(Bs)!=="svelte-1wshevw"&&(Bs.innerHTML=Yl),yl=c(s),h(Ws.$$.fragment,s),fl=c(s),As=b(s,"P",{"data-svelte-h":!0}),J(As)!=="svelte-18cw5xr"&&(As.innerHTML=ql),gl=c(s),h(Rs.$$.fragment,s),dl=c(s),Xs=b(s,"P",{"data-svelte-h":!0}),J(Xs)!=="svelte-i6dg18"&&(Xs.innerHTML=Sl),bl=c(s),h(Vs.$$.fragment,s),wl=c(s),h(ps.$$.fragment,s),Jl=c(s),h(rs.$$.fragment,s),Tl=c(s),h(Es.$$.fragment,s),$l=c(s),Fs=b(s,"P",{"data-svelte-h":!0}),J(Fs)!=="svelte-cyrfc8"&&(Fs.textContent=Ll),Ul=c(s),Hs=b(s,"P",{"data-svelte-h":!0}),J(Hs)!=="svelte-tzt2ke"&&(Hs.textContent=Dl),xl=c(s),h(zs.$$.fragment,s),_l=c(s),Qs=b(s,"P",{"data-svelte-h":!0}),J(Qs)!=="svelte-dw0oi1"&&(Qs.innerHTML=Pl),kl=c(s),h(Ns.$$.fragment,s),Cl=c(s),Ys=b(s,"P",{"data-svelte-h":!0}),J(Ys)!=="svelte-p649vi"&&(Ys.innerHTML=Kl),Il=c(s),h(is.$$.fragment,s),Zl=c(s),h(qs.$$.fragment,s),vl=c(s),Ds=b(s,"P",{}),na(Ds).forEach(t),this.h()},h(){ea(a,"name","hf:doc:metadata"),ea(a,"content",Ba)},m(s,e){Ma(document.head,a),n(s,o,e),n(s,l,e),n(s,m,e),u(w,s,e),n(s,C,e),u(A,s,e),n(s,v,e),u(I,s,e),n(s,G,e),n(s,x,e),n(s,B,e),n(s,U,e),n(s,r,e),n(s,$,e),n(s,X,e),u(R,s,e),n(s,M,e),n(s,Z,e),n(s,os,e),u(H,s,e),n(s,z,e),n(s,Q,e),n(s,ms,e),u(N,s,e),n(s,Y,e),u(q,s,e),n(s,S,e),n(s,as,e),n(s,L,e),u(D,s,e),n(s,P,e),n(s,ts,e),n(s,K,e),u(O,s,e),n(s,ss,e),n(s,ns,e),n(s,p,e),u(T,s,e),n(s,us,e),n(s,ys,e),n(s,Ps,e),n(s,fs,e),n(s,Ks,e),u(gs,s,e),n(s,Os,e),u(ds,s,e),n(s,sl,e),n(s,bs,e),n(s,ll,e),u(ws,s,e),n(s,al,e),n(s,Js,e),n(s,tl,e),u(Ts,s,e),n(s,nl,e),n(s,$s,e),n(s,el,e),n(s,Us,e),n(s,pl,e),n(s,xs,e),n(s,rl,e),u(_s,s,e),n(s,il,e),n(s,ks,e),n(s,cl,e),u(Cs,s,e),n(s,ol,e),n(s,Is,e),n(s,ml,e),u(es,s,e),n(s,Ml,e),u(Zs,s,e),n(s,jl,e),n(s,vs,e),n(s,hl,e),u(Gs,s,e),n(s,ul,e),n(s,Bs,e),n(s,yl,e),u(Ws,s,e),n(s,fl,e),n(s,As,e),n(s,gl,e),u(Rs,s,e),n(s,dl,e),n(s,Xs,e),n(s,bl,e),u(Vs,s,e),n(s,wl,e),u(ps,s,e),n(s,Jl,e),u(rs,s,e),n(s,Tl,e),u(Es,s,e),n(s,$l,e),n(s,Fs,e),n(s,Ul,e),n(s,Hs,e),n(s,xl,e),u(zs,s,e),n(s,_l,e),n(s,Qs,e),n(s,kl,e),u(Ns,s,e),n(s,Cl,e),n(s,Ys,e),n(s,Il,e),u(is,s,e),n(s,Zl,e),u(qs,s,e),n(s,vl,e),n(s,Ds,e),Gl=!0},p(s,[e]){const Ol={};e&2&&(Ol.$$scope={dirty:e,ctx:s}),R.$set(Ol);const sa={};e&2&&(sa.$$scope={dirty:e,ctx:s}),es.$set(sa);const la={};e&2&&(la.$$scope={dirty:e,ctx:s}),ps.$set(la);const aa={};e&2&&(aa.$$scope={dirty:e,ctx:s}),rs.$set(aa);const ta={};e&2&&(ta.$$scope={dirty:e,ctx:s}),is.$set(ta)},i(s){Gl||(y(w.$$.fragment,s),y(A.$$.fragment,s),y(I.$$.fragment,s),y(R.$$.fragment,s),y(H.$$.fragment,s),y(N.$$.fragment,s),y(q.$$.fragment,s),y(D.$$.fragment,s),y(O.$$.fragment,s),y(T.$$.fragment,s),y(gs.$$.fragment,s),y(ds.$$.fragment,s),y(ws.$$.fragment,s),y(Ts.$$.fragment,s),y(_s.$$.fragment,s),y(Cs.$$.fragment,s),y(es.$$.fragment,s),y(Zs.$$.fragment,s),y(Gs.$$.fragment,s),y(Ws.$$.fragment,s),y(Rs.$$.fragment,s),y(Vs.$$.fragment,s),y(ps.$$.fragment,s),y(rs.$$.fragment,s),y(Es.$$.fragment,s),y(zs.$$.fragment,s),y(Ns.$$.fragment,s),y(is.$$.fragment,s),y(qs.$$.fragment,s),Gl=!0)},o(s){f(w.$$.fragment,s),f(A.$$.fragment,s),f(I.$$.fragment,s),f(R.$$.fragment,s),f(H.$$.fragment,s),f(N.$$.fragment,s),f(q.$$.fragment,s),f(D.$$.fragment,s),f(O.$$.fragment,s),f(T.$$.fragment,s),f(gs.$$.fragment,s),f(ds.$$.fragment,s),f(ws.$$.fragment,s),f(Ts.$$.fragment,s),f(_s.$$.fragment,s),f(Cs.$$.fragment,s),f(es.$$.fragment,s),f(Zs.$$.fragment,s),f(Gs.$$.fragment,s),f(Ws.$$.fragment,s),f(Rs.$$.fragment,s),f(Vs.$$.fragment,s),f(ps.$$.fragment,s),f(rs.$$.fragment,s),f(Es.$$.fragment,s),f(zs.$$.fragment,s),f(Ns.$$.fragment,s),f(is.$$.fragment,s),f(qs.$$.fragment,s),Gl=!1},d(s){s&&(t(o),t(l),t(m),t(C),t(v),t(G),t(x),t(B),t(U),t(r),t($),t(X),t(M),t(Z),t(os),t(z),t(Q),t(ms),t(Y),t(S),t(as),t(L),t(P),t(ts),t(K),t(ss),t(ns),t(p),t(us),t(ys),t(Ps),t(fs),t(Ks),t(Os),t(sl),t(bs),t(ll),t(al),t(Js),t(tl),t(nl),t($s),t(el),t(Us),t(pl),t(xs),t(rl),t(il),t(ks),t(cl),t(ol),t(Is),t(ml),t(Ml),t(jl),t(vs),t(hl),t(ul),t(Bs),t(yl),t(fl),t(As),t(gl),t(dl),t(Xs),t(bl),t(wl),t(Jl),t(Tl),t($l),t(Fs),t(Ul),t(Hs),t(xl),t(_l),t(Qs),t(kl),t(Cl),t(Ys),t(Il),t(Zl),t(vl),t(Ds)),t(a),g(w,s),g(A,s),g(I,s),g(R,s),g(H,s),g(N,s),g(q,s),g(D,s),g(O,s),g(T,s),g(gs,s),g(ds,s),g(ws,s),g(Ts,s),g(_s,s),g(Cs,s),g(es,s),g(Zs,s),g(Gs,s),g(Ws,s),g(Rs,s),g(Vs,s),g(ps,s),g(rs,s),g(Es,s),g(zs,s),g(Ns,s),g(is,s),g(qs,s)}}}const Ba='{"title":"Token classification","local":"token-classification","sections":[{"title":"Load WNUT 17 dataset","local":"load-wnut-17-dataset","sections":[],"depth":2},{"title":"Preprocess","local":"preprocess","sections":[],"depth":2},{"title":"Evaluate","local":"evaluate","sections":[],"depth":2},{"title":"Train","local":"train","sections":[],"depth":2},{"title":"Inference","local":"inference","sections":[],"depth":2}],"depth":1}';function Wa(k){return ia(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Qa extends ca{constructor(a){super(),oa(this,a,Wa,Ga,ra,{})}}export{Qa as component};
