import{s as rl,o as il,n as os}from"../chunks/scheduler.25b97de1.js";import{S as ol,i as cl,g,s as i,r as M,A as ml,h as b,f as t,c as o,j as el,u as j,x as J,k as nl,y as hl,a as e,v as u,d,t as y,w as f,m as Ml,n as jl}from"../chunks/index.d9030fc9.js";import{T as Wa}from"../chunks/Tip.baa67368.js";import{Y as pl}from"../chunks/Youtube.eaf1a617.js";import{C as k}from"../chunks/CodeBlock.e6cd0d95.js";import{D as ul}from"../chunks/DocNotebookDropdown.5ea6cb78.js";import{F as Ba,M as Ls}from"../chunks/Markdown.7217f838.js";import{H as Ss,E as dl}from"../chunks/EditOnGithub.91d95064.js";function yl(C){let l,c='To see all architectures and checkpoints compatible with this task, we recommend checking the <a href="https://huggingface.co/tasks/token-classification" rel="nofollow">task-page</a>.';return{c(){l=g("p"),l.innerHTML=c},l(a){l=b(a,"P",{"data-svelte-h":!0}),J(l)!=="svelte-17xuz9c"&&(l.innerHTML=c)},m(a,m){e(a,l,m)},p:os,d(a){a&&t(l)}}}function fl(C){let l,c;return l=new k({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(){M(l.$$.fragment)},l(a){j(l.$$.fragment,a)},m(a,m){u(l,a,m),c=!0},p:os,i(a){c||(d(l.$$.fragment,a),c=!0)},o(a){y(l.$$.fragment,a),c=!1},d(a){f(l,a)}}}function gl(C){let l,c;return l=new Ls({props:{$$slots:{default:[fl]},$$scope:{ctx:C}}}),{c(){M(l.$$.fragment)},l(a){j(l.$$.fragment,a)},m(a,m){u(l,a,m),c=!0},p(a,m){const w={};m&2&&(w.$$scope={dirty:m,ctx:a}),l.$set(w)},i(a){c||(d(l.$$.fragment,a),c=!0)},o(a){y(l.$$.fragment,a),c=!1},d(a){f(l,a)}}}function bl(C){let l,c;return l=new k({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(){M(l.$$.fragment)},l(a){j(l.$$.fragment,a)},m(a,m){u(l,a,m),c=!0},p:os,i(a){c||(d(l.$$.fragment,a),c=!0)},o(a){y(l.$$.fragment,a),c=!1},d(a){f(l,a)}}}function wl(C){let l,c;return l=new Ls({props:{$$slots:{default:[bl]},$$scope:{ctx:C}}}),{c(){M(l.$$.fragment)},l(a){j(l.$$.fragment,a)},m(a,m){u(l,a,m),c=!0},p(a,m){const w={};m&2&&(w.$$scope={dirty:m,ctx:a}),l.$set(w)},i(a){c||(d(l.$$.fragment,a),c=!0)},o(a){y(l.$$.fragment,a),c=!1},d(a){f(l,a)}}}function Jl(C){let l,c='If you aren’t familiar with finetuning a model with the <a href="/docs/transformers/main/en/main_classes/trainer#transformers.Trainer">Trainer</a>, take a look at the basic tutorial <a href="../training#train-with-pytorch-trainer">here</a>!';return{c(){l=g("p"),l.innerHTML=c},l(a){l=b(a,"P",{"data-svelte-h":!0}),J(l)!=="svelte-15s4um0"&&(l.innerHTML=c)},m(a,m){e(a,l,m)},p:os,d(a){a&&t(l)}}}function Tl(C){let l,c,a,m='You’re ready to start training your model now! Load DistilBERT with <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoModelForTokenClassification">AutoModelForTokenClassification</a> along with the number of expected labels, and the label mappings:',w,_,A,v,I="At this point, only three steps remain:",G,x,V='<li>Define your training hyperparameters in <a href="/docs/transformers/main/en/main_classes/trainer#transformers.TrainingArguments">TrainingArguments</a>. The only required parameter is <code>output_dir</code> which specifies where to save your model. You’ll push this model to the Hub by setting <code>push_to_hub=True</code> (you need to be signed in to Hugging Face to upload your model). At the end of each epoch, the <a href="/docs/transformers/main/en/main_classes/trainer#transformers.Trainer">Trainer</a> will evaluate the seqeval scores and save the training checkpoint.</li> <li>Pass the training arguments to <a href="/docs/transformers/main/en/main_classes/trainer#transformers.Trainer">Trainer</a> along with the model, dataset, tokenizer, data collator, and <code>compute_metrics</code> function.</li> <li>Call <a href="/docs/transformers/main/en/main_classes/trainer#transformers.Trainer.train">train()</a> to finetune your model.</li>',W,$,B,r,U='Once training is completed, share your model to the Hub with the <a href="/docs/transformers/main/en/main_classes/trainer#transformers.Trainer.push_to_hub">push_to_hub()</a> method so everyone can use your model:',E,X,R;return l=new Wa({props:{$$slots:{default:[Jl]},$$scope:{ctx:C}}}),_=new k({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}}),$=new k({props:{code:"dHJhaW5pbmdfYXJncyUyMCUzRCUyMFRyYWluaW5nQXJndW1lbnRzKCUwQSUyMCUyMCUyMCUyMG91dHB1dF9kaXIlM0QlMjJteV9hd2Vzb21lX3dudXRfbW9kZWwlMjIlMkMlMEElMjAlMjAlMjAlMjBsZWFybmluZ19yYXRlJTNEMmUtNSUyQyUwQSUyMCUyMCUyMCUyMHBlcl9kZXZpY2VfdHJhaW5fYmF0Y2hfc2l6ZSUzRDE2JTJDJTBBJTIwJTIwJTIwJTIwcGVyX2RldmljZV9ldmFsX2JhdGNoX3NpemUlM0QxNiUyQyUwQSUyMCUyMCUyMCUyMG51bV90cmFpbl9lcG9jaHMlM0QyJTJDJTBBJTIwJTIwJTIwJTIwd2VpZ2h0X2RlY2F5JTNEMC4wMSUyQyUwQSUyMCUyMCUyMCUyMGV2YWxfc3RyYXRlZ3klM0QlMjJlcG9jaCUyMiUyQyUwQSUyMCUyMCUyMCUyMHNhdmVfc3RyYXRlZ3klM0QlMjJlcG9jaCUyMiUyQyUwQSUyMCUyMCUyMCUyMGxvYWRfYmVzdF9tb2RlbF9hdF9lbmQlM0RUcnVlJTJDJTBBJTIwJTIwJTIwJTIwcHVzaF90b19odWIlM0RUcnVlJTJDJTBBKSUwQSUwQXRyYWluZXIlMjAlM0QlMjBUcmFpbmVyKCUwQSUyMCUyMCUyMCUyMG1vZGVsJTNEbW9kZWwlMkMlMEElMjAlMjAlMjAlMjBhcmdzJTNEdHJhaW5pbmdfYXJncyUyQyUwQSUyMCUyMCUyMCUyMHRyYWluX2RhdGFzZXQlM0R0b2tlbml6ZWRfd251dCU1QiUyMnRyYWluJTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwZXZhbF9kYXRhc2V0JTNEdG9rZW5pemVkX3dudXQlNUIlMjJ0ZXN0JTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwcHJvY2Vzc2luZ19jbGFzcyUzRHRva2VuaXplciUyQyUwQSUyMCUyMCUyMCUyMGRhdGFfY29sbGF0b3IlM0RkYXRhX2NvbGxhdG9yJTJDJTBBJTIwJTIwJTIwJTIwY29tcHV0ZV9tZXRyaWNzJTNEY29tcHV0ZV9tZXRyaWNzJTJDJTBBKSUwQSUwQXRyYWluZXIudHJhaW4oKQ==",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>    processing_class=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 k({props:{code:"dHJhaW5lci5wdXNoX3RvX2h1Yigp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.push_to_hub()',wrap:!1}}),{c(){M(l.$$.fragment),c=i(),a=g("p"),a.innerHTML=m,w=i(),M(_.$$.fragment),A=i(),v=g("p"),v.textContent=I,G=i(),x=g("ol"),x.innerHTML=V,W=i(),M($.$$.fragment),B=i(),r=g("p"),r.innerHTML=U,E=i(),M(X.$$.fragment)},l(h){j(l.$$.fragment,h),c=o(h),a=b(h,"P",{"data-svelte-h":!0}),J(a)!=="svelte-1u5l9g0"&&(a.innerHTML=m),w=o(h),j(_.$$.fragment,h),A=o(h),v=b(h,"P",{"data-svelte-h":!0}),J(v)!=="svelte-l42k0i"&&(v.textContent=I),G=o(h),x=b(h,"OL",{"data-svelte-h":!0}),J(x)!=="svelte-e23su2"&&(x.innerHTML=V),W=o(h),j($.$$.fragment,h),B=o(h),r=b(h,"P",{"data-svelte-h":!0}),J(r)!=="svelte-1v13hlo"&&(r.innerHTML=U),E=o(h),j(X.$$.fragment,h)},m(h,Z){u(l,h,Z),e(h,c,Z),e(h,a,Z),e(h,w,Z),u(_,h,Z),e(h,A,Z),e(h,v,Z),e(h,G,Z),e(h,x,Z),e(h,W,Z),u($,h,Z),e(h,B,Z),e(h,r,Z),e(h,E,Z),u(X,h,Z),R=!0},p(h,Z){const H={};Z&2&&(H.$$scope={dirty:Z,ctx:h}),l.$set(H)},i(h){R||(d(l.$$.fragment,h),d(_.$$.fragment,h),d($.$$.fragment,h),d(X.$$.fragment,h),R=!0)},o(h){y(l.$$.fragment,h),y(_.$$.fragment,h),y($.$$.fragment,h),y(X.$$.fragment,h),R=!1},d(h){h&&(t(c),t(a),t(w),t(A),t(v),t(G),t(x),t(W),t(B),t(r),t(E)),f(l,h),f(_,h),f($,h),f(X,h)}}}function Ul(C){let l,c;return l=new Ls({props:{$$slots:{default:[Tl]},$$scope:{ctx:C}}}),{c(){M(l.$$.fragment)},l(a){j(l.$$.fragment,a)},m(a,m){u(l,a,m),c=!0},p(a,m){const w={};m&2&&(w.$$scope={dirty:m,ctx:a}),l.$set(w)},i(a){c||(d(l.$$.fragment,a),c=!0)},o(a){y(l.$$.fragment,a),c=!1},d(a){f(l,a)}}}function $l(C){let l,c='If you aren’t familiar with finetuning a model with Keras, take a look at the basic tutorial <a href="../training#train-a-tensorflow-model-with-keras">here</a>!';return{c(){l=g("p"),l.innerHTML=c},l(a){l=b(a,"P",{"data-svelte-h":!0}),J(l)!=="svelte-1rd4nl8"&&(l.innerHTML=c)},m(a,m){e(a,l,m)},p:os,d(a){a&&t(l)}}}function xl(C){let l,c,a,m,w,_='Then you can load DistilBERT with <a href="/docs/transformers/main/en/model_doc/auto#transformers.TFAutoModelForTokenClassification">TFAutoModelForTokenClassification</a> along with the number of expected labels, and the label mappings:',A,v,I,G,x='Convert your datasets to the <code>tf.data.Dataset</code> format with <a href="/docs/transformers/main/en/main_classes/model#transformers.TFPreTrainedModel.prepare_tf_dataset">prepare_tf_dataset()</a>:',V,W,$,B,r='Configure the model for training with <a href="https://keras.io/api/models/model_training_apis/#compile-method" rel="nofollow"><code>compile</code></a>. Note that Transformers models all have a default task-relevant loss function, so you don’t need to specify one unless you want to:',U,E,X,R,h='The last two things to setup before you start training is to compute the seqeval scores from the predictions, and provide a way to push your model to the Hub. Both are done by using <a href="../main_classes/keras_callbacks">Keras callbacks</a>.',Z,H,cs='Pass your <code>compute_metrics</code> function to <a href="/docs/transformers/main/en/main_classes/keras_callbacks#transformers.KerasMetricCallback">KerasMetricCallback</a>:',F,z,Q,as,ms='Specify where to push your model and tokenizer in the <a href="/docs/transformers/main/en/main_classes/keras_callbacks#transformers.PushToHubCallback">PushToHubCallback</a>:',N,Y,q,S,ls="Then bundle your callbacks together:",hs,L,D,P,ts='Finally, you’re ready to start training your model! Call <a href="https://keras.io/api/models/model_training_apis/#fit-method" rel="nofollow"><code>fit</code></a> with your training and validation datasets, the number of epochs, and your callbacks to finetune the model:',Ms,K,O,ss,es="Once training is completed, your model is automatically uploaded to the Hub so everyone can use it!",js;return l=new Wa({props:{$$slots:{default:[$l]},$$scope:{ctx:C}}}),a=new k({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 k({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}}),W=new k({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 k({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 k({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 k({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 k({props:{code:"Y2FsbGJhY2tzJTIwJTNEJTIwJTVCbWV0cmljX2NhbGxiYWNrJTJDJTIwcHVzaF90b19odWJfY2FsbGJhY2slNUQ=",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>callbacks = [metric_callback, push_to_hub_callback]',wrap:!1}}),K=new k({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(){M(l.$$.fragment),c=Ml(`
To finetune a model in TensorFlow, start by setting up an optimizer function, learning rate schedule, and some training hyperparameters:

	`),M(a.$$.fragment),m=i(),w=g("p"),w.innerHTML=_,A=i(),M(v.$$.fragment),I=i(),G=g("p"),G.innerHTML=x,V=i(),M(W.$$.fragment),$=i(),B=g("p"),B.innerHTML=r,U=i(),M(E.$$.fragment),X=i(),R=g("p"),R.innerHTML=h,Z=i(),H=g("p"),H.innerHTML=cs,F=i(),M(z.$$.fragment),Q=i(),as=g("p"),as.innerHTML=ms,N=i(),M(Y.$$.fragment),q=i(),S=g("p"),S.textContent=ls,hs=i(),M(L.$$.fragment),D=i(),P=g("p"),P.innerHTML=ts,Ms=i(),M(K.$$.fragment),O=i(),ss=g("p"),ss.textContent=es},l(p){j(l.$$.fragment,p),c=jl(p,`
To finetune a model in TensorFlow, start by setting up an optimizer function, learning rate schedule, and some training hyperparameters:

	`),j(a.$$.fragment,p),m=o(p),w=b(p,"P",{"data-svelte-h":!0}),J(w)!=="svelte-1p9qjdy"&&(w.innerHTML=_),A=o(p),j(v.$$.fragment,p),I=o(p),G=b(p,"P",{"data-svelte-h":!0}),J(G)!=="svelte-9ymftz"&&(G.innerHTML=x),V=o(p),j(W.$$.fragment,p),$=o(p),B=b(p,"P",{"data-svelte-h":!0}),J(B)!=="svelte-17cxx5e"&&(B.innerHTML=r),U=o(p),j(E.$$.fragment,p),X=o(p),R=b(p,"P",{"data-svelte-h":!0}),J(R)!=="svelte-nf8aa0"&&(R.innerHTML=h),Z=o(p),H=b(p,"P",{"data-svelte-h":!0}),J(H)!=="svelte-bi2rpv"&&(H.innerHTML=cs),F=o(p),j(z.$$.fragment,p),Q=o(p),as=b(p,"P",{"data-svelte-h":!0}),J(as)!=="svelte-1b3skyn"&&(as.innerHTML=ms),N=o(p),j(Y.$$.fragment,p),q=o(p),S=b(p,"P",{"data-svelte-h":!0}),J(S)!=="svelte-1lw9xm8"&&(S.textContent=ls),hs=o(p),j(L.$$.fragment,p),D=o(p),P=b(p,"P",{"data-svelte-h":!0}),J(P)!=="svelte-1hrpv1v"&&(P.innerHTML=ts),Ms=o(p),j(K.$$.fragment,p),O=o(p),ss=b(p,"P",{"data-svelte-h":!0}),J(ss)!=="svelte-2s71om"&&(ss.textContent=es)},m(p,T){u(l,p,T),e(p,c,T),u(a,p,T),e(p,m,T),e(p,w,T),e(p,A,T),u(v,p,T),e(p,I,T),e(p,G,T),e(p,V,T),u(W,p,T),e(p,$,T),e(p,B,T),e(p,U,T),u(E,p,T),e(p,X,T),e(p,R,T),e(p,Z,T),e(p,H,T),e(p,F,T),u(z,p,T),e(p,Q,T),e(p,as,T),e(p,N,T),u(Y,p,T),e(p,q,T),e(p,S,T),e(p,hs,T),u(L,p,T),e(p,D,T),e(p,P,T),e(p,Ms,T),u(K,p,T),e(p,O,T),e(p,ss,T),js=!0},p(p,T){const us={};T&2&&(us.$$scope={dirty:T,ctx:p}),l.$set(us)},i(p){js||(d(l.$$.fragment,p),d(a.$$.fragment,p),d(v.$$.fragment,p),d(W.$$.fragment,p),d(E.$$.fragment,p),d(z.$$.fragment,p),d(Y.$$.fragment,p),d(L.$$.fragment,p),d(K.$$.fragment,p),js=!0)},o(p){y(l.$$.fragment,p),y(a.$$.fragment,p),y(v.$$.fragment,p),y(W.$$.fragment,p),y(E.$$.fragment,p),y(z.$$.fragment,p),y(Y.$$.fragment,p),y(L.$$.fragment,p),y(K.$$.fragment,p),js=!1},d(p){p&&(t(c),t(m),t(w),t(A),t(I),t(G),t(V),t($),t(B),t(U),t(X),t(R),t(Z),t(H),t(F),t(Q),t(as),t(N),t(q),t(S),t(hs),t(D),t(P),t(Ms),t(O),t(ss)),f(l,p),f(a,p),f(v,p),f(W,p),f(E,p),f(z,p),f(Y,p),f(L,p),f(K,p)}}}function kl(C){let l,c;return l=new Ls({props:{$$slots:{default:[xl]},$$scope:{ctx:C}}}),{c(){M(l.$$.fragment)},l(a){j(l.$$.fragment,a)},m(a,m){u(l,a,m),c=!0},p(a,m){const w={};m&2&&(w.$$scope={dirty:m,ctx:a}),l.$set(w)},i(a){c||(d(l.$$.fragment,a),c=!0)},o(a){y(l.$$.fragment,a),c=!1},d(a){f(l,a)}}}function Cl(C){let l,c=`For a more in-depth example of how to finetune a model for token classification, take a look at the corresponding
<a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/token_classification.ipynb" rel="nofollow">PyTorch notebook</a>
or <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/token_classification-tf.ipynb" rel="nofollow">TensorFlow notebook</a>.`;return{c(){l=g("p"),l.innerHTML=c},l(a){l=b(a,"P",{"data-svelte-h":!0}),J(l)!=="svelte-j7j3qo"&&(l.innerHTML=c)},m(a,m){e(a,l,m)},p:os,d(a){a&&t(l)}}}function _l(C){let l,c="Tokenize the text and return PyTorch tensors:",a,m,w,_,A="Pass your inputs to the model and return the <code>logits</code>:",v,I,G,x,V="Get the class with the highest probability, and use the model’s <code>id2label</code> mapping to convert it to a text label:",W,$,B;return m=new k({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 k({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}}),$=new k({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(){l=g("p"),l.textContent=c,a=i(),M(m.$$.fragment),w=i(),_=g("p"),_.innerHTML=A,v=i(),M(I.$$.fragment),G=i(),x=g("p"),x.innerHTML=V,W=i(),M($.$$.fragment)},l(r){l=b(r,"P",{"data-svelte-h":!0}),J(l)!=="svelte-1qcz1wr"&&(l.textContent=c),a=o(r),j(m.$$.fragment,r),w=o(r),_=b(r,"P",{"data-svelte-h":!0}),J(_)!=="svelte-f3g043"&&(_.innerHTML=A),v=o(r),j(I.$$.fragment,r),G=o(r),x=b(r,"P",{"data-svelte-h":!0}),J(x)!=="svelte-6mgrol"&&(x.innerHTML=V),W=o(r),j($.$$.fragment,r)},m(r,U){e(r,l,U),e(r,a,U),u(m,r,U),e(r,w,U),e(r,_,U),e(r,v,U),u(I,r,U),e(r,G,U),e(r,x,U),e(r,W,U),u($,r,U),B=!0},p:os,i(r){B||(d(m.$$.fragment,r),d(I.$$.fragment,r),d($.$$.fragment,r),B=!0)},o(r){y(m.$$.fragment,r),y(I.$$.fragment,r),y($.$$.fragment,r),B=!1},d(r){r&&(t(l),t(a),t(w),t(_),t(v),t(G),t(x),t(W)),f(m,r),f(I,r),f($,r)}}}function Il(C){let l,c;return l=new Ls({props:{$$slots:{default:[_l]},$$scope:{ctx:C}}}),{c(){M(l.$$.fragment)},l(a){j(l.$$.fragment,a)},m(a,m){u(l,a,m),c=!0},p(a,m){const w={};m&2&&(w.$$scope={dirty:m,ctx:a}),l.$set(w)},i(a){c||(d(l.$$.fragment,a),c=!0)},o(a){y(l.$$.fragment,a),c=!1},d(a){f(l,a)}}}function Zl(C){let l,c="Tokenize the text and return TensorFlow tensors:",a,m,w,_,A="Pass your inputs to the model and return the <code>logits</code>:",v,I,G,x,V="Get the class with the highest probability, and use the model’s <code>id2label</code> mapping to convert it to a text label:",W,$,B;return m=new k({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 k({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}}),$=new k({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(){l=g("p"),l.textContent=c,a=i(),M(m.$$.fragment),w=i(),_=g("p"),_.innerHTML=A,v=i(),M(I.$$.fragment),G=i(),x=g("p"),x.innerHTML=V,W=i(),M($.$$.fragment)},l(r){l=b(r,"P",{"data-svelte-h":!0}),J(l)!=="svelte-s1qr7b"&&(l.textContent=c),a=o(r),j(m.$$.fragment,r),w=o(r),_=b(r,"P",{"data-svelte-h":!0}),J(_)!=="svelte-f3g043"&&(_.innerHTML=A),v=o(r),j(I.$$.fragment,r),G=o(r),x=b(r,"P",{"data-svelte-h":!0}),J(x)!=="svelte-6mgrol"&&(x.innerHTML=V),W=o(r),j($.$$.fragment,r)},m(r,U){e(r,l,U),e(r,a,U),u(m,r,U),e(r,w,U),e(r,_,U),e(r,v,U),u(I,r,U),e(r,G,U),e(r,x,U),e(r,W,U),u($,r,U),B=!0},p:os,i(r){B||(d(m.$$.fragment,r),d(I.$$.fragment,r),d($.$$.fragment,r),B=!0)},o(r){y(m.$$.fragment,r),y(I.$$.fragment,r),y($.$$.fragment,r),B=!1},d(r){r&&(t(l),t(a),t(w),t(_),t(v),t(G),t(x),t(W)),f(m,r),f(I,r),f($,r)}}}function vl(C){let l,c;return l=new Ls({props:{$$slots:{default:[Zl]},$$scope:{ctx:C}}}),{c(){M(l.$$.fragment)},l(a){j(l.$$.fragment,a)},m(a,m){u(l,a,m),c=!0},p(a,m){const w={};m&2&&(w.$$scope={dirty:m,ctx:a}),l.$set(w)},i(a){c||(d(l.$$.fragment,a),c=!0)},o(a){y(l.$$.fragment,a),c=!1},d(a){f(l,a)}}}function Gl(C){let l,c,a,m,w,_,A,v,I,G,x,V="Token classification assigns a label to individual tokens in a sentence. One of the most common token classification tasks is Named Entity Recognition (NER). NER attempts to find a label for each entity in a sentence, such as a person, location, or organization.",W,$,B="This guide will show you how to:",r,U,E='<li>Finetune <a href="https://huggingface.co/distilbert/distilbert-base-uncased" rel="nofollow">DistilBERT</a> on the <a href="https://huggingface.co/datasets/wnut_17" rel="nofollow">WNUT 17</a> dataset to detect new entities.</li> <li>Use your finetuned model for inference.</li>',X,R,h,Z,H="Before you begin, make sure you have all the necessary libraries installed:",cs,F,z,Q,as="We encourage you to login to your Hugging Face account so you can upload and share your model with the community. When prompted, enter your token to login:",ms,N,Y,q,S,ls,hs="Start by loading the WNUT 17 dataset from the 🤗 Datasets library:",L,D,P,ts,Ms="Then take a look at an example:",K,O,ss,es,js="Each number in <code>ner_tags</code> represents an entity. Convert the numbers to their label names to find out what the entities are:",p,T,us,ds,Aa="The letter that prefixes each <code>ner_tag</code> indicates the token position of the entity:",Ps,ys,Ra=`<li><code>B-</code> indicates the beginning of an entity.</li> <li><code>I-</code> indicates a token is contained inside the same entity (for example, the <code>State</code> token is a part of an entity like
<code>Empire State Building</code>).</li> <li><code>0</code> indicates the token doesn’t correspond to any entity.</li>`,Ks,fs,Os,gs,sa,bs,Xa="The next step is to load a DistilBERT tokenizer to preprocess the <code>tokens</code> field:",aa,ws,la,Js,Va="As you saw in the example <code>tokens</code> field above, it looks like the input has already been tokenized. But the input actually hasn’t been tokenized yet and you’ll need to set <code>is_split_into_words=True</code> to tokenize the words into subwords. For example:",ta,Ts,ea,Us,Ea="However, this adds some special tokens <code>[CLS]</code> and <code>[SEP]</code> and the subword tokenization creates a mismatch between the input and labels. A single word corresponding to a single label may now be split into two subwords. You’ll need to realign the tokens and labels by:",na,$s,Ha='<li>Mapping all tokens to their corresponding word with the <a href="https://huggingface.co/docs/transformers/main_classes/tokenizer#transformers.BatchEncoding.word_ids" rel="nofollow"><code>word_ids</code></a> method.</li> <li>Assigning the label <code>-100</code> to the special tokens <code>[CLS]</code> and <code>[SEP]</code> so they’re ignored by the PyTorch loss function (see <a href="https://pytorch.org/docs/stable/generated/torch.nn.CrossEntropyLoss.html" rel="nofollow">CrossEntropyLoss</a>).</li> <li>Only labeling the first token of a given word. Assign <code>-100</code> to other subtokens from the same word.</li>',pa,xs,Fa="Here is how you can create a function to realign the tokens and labels, and truncate sequences to be no longer than DistilBERT’s maximum input length:",ra,ks,ia,Cs,za='To apply the preprocessing function over the entire dataset, use 🤗 Datasets <a href="https://huggingface.co/docs/datasets/main/en/package_reference/main_classes#datasets.Dataset.map" rel="nofollow">map</a> function. You can speed up the <code>map</code> function by setting <code>batched=True</code> to process multiple elements of the dataset at once:',oa,_s,ca,Is,Qa='Now create a batch of examples using <a href="/docs/transformers/main/en/main_classes/data_collator#transformers.DataCollatorWithPadding">DataCollatorWithPadding</a>. It’s more efficient to <em>dynamically pad</em> the sentences to the longest length in a batch during collation, instead of padding the whole dataset to the maximum length.',ma,ns,ha,Zs,Ma,vs,Na='Including a metric during training is often helpful for evaluating your model’s performance. You can quickly load a evaluation method with the 🤗 <a href="https://huggingface.co/docs/evaluate/index" rel="nofollow">Evaluate</a> library. For this task, load the <a href="https://huggingface.co/spaces/evaluate-metric/seqeval" rel="nofollow">seqeval</a> framework (see the 🤗 Evaluate <a href="https://huggingface.co/docs/evaluate/a_quick_tour" rel="nofollow">quick tour</a> to learn more about how to load and compute a metric). Seqeval actually produces several scores: precision, recall, F1, and accuracy.',ja,Gs,ua,Ws,Ya='Get the NER labels first, and then create a function that passes your true predictions and true labels to <a href="https://huggingface.co/docs/evaluate/main/en/package_reference/main_classes#evaluate.EvaluationModule.compute" rel="nofollow">compute</a> to calculate the scores:',da,Bs,ya,As,qa="Your <code>compute_metrics</code> function is ready to go now, and you’ll return to it when you setup your training.",fa,Rs,ga,Xs,Sa="Before you start training your model, create a map of the expected ids to their labels with <code>id2label</code> and <code>label2id</code>:",ba,Vs,wa,ps,Ja,rs,Ta,Es,Ua,Hs,La="Great, now that you’ve finetuned a model, you can use it for inference!",$a,Fs,Da="Grab some text you’d like to run inference on:",xa,zs,ka,Qs,Pa='The simplest way to try out your finetuned model for inference is to use it in a <a href="/docs/transformers/main/en/main_classes/pipelines#transformers.pipeline">pipeline()</a>. Instantiate a <code>pipeline</code> for NER with your model, and pass your text to it:',Ca,Ns,_a,Ys,Ka="You can also manually replicate the results of the <code>pipeline</code> if you’d like:",Ia,is,Za,qs,va,Ds,Ga;return w=new Ss({props:{title:"Token classification",local:"token-classification",headingTag:"h1"}}),A=new ul({props:{classNames:"absolute z-10 right-0 top-0",options:[{label:"Mixed",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/en/token_classification.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/en/pytorch/token_classification.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/en/tensorflow/token_classification.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/en/token_classification.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/en/pytorch/token_classification.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/en/tensorflow/token_classification.ipynb"}]}}),I=new pl({props:{id:"wVHdVlPScxA"}}),R=new Wa({props:{$$slots:{default:[yl]},$$scope:{ctx:C}}}),F=new k({props:{code:"cGlwJTIwaW5zdGFsbCUyMHRyYW5zZm9ybWVycyUyMGRhdGFzZXRzJTIwZXZhbHVhdGUlMjBzZXFldmFs",highlighted:"pip install transformers datasets evaluate seqeval",wrap:!1}}),N=new k({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 k({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 k({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 k({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}}),fs=new Ss({props:{title:"Preprocess",local:"preprocess",headingTag:"h2"}}),gs=new pl({props:{id:"iY2AZYdZAr0"}}),ws=new k({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 k({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}}),ks=new k({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}}),_s=new k({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}}),ns=new Ba({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[wl],pytorch:[gl]},$$scope:{ctx:C}}}),Zs=new Ss({props:{title:"Evaluate",local:"evaluate",headingTag:"h2"}}),Gs=new k({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}}),Bs=new k({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 k({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 Ba({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[kl],pytorch:[Ul]},$$scope:{ctx:C}}}),rs=new Wa({props:{$$slots:{default:[Cl]},$$scope:{ctx:C}}}),Es=new Ss({props:{title:"Inference",local:"inference",headingTag:"h2"}}),zs=new k({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 k({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 Ba({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[vl],pytorch:[Il]},$$scope:{ctx:C}}}),qs=new dl({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/en/tasks/token_classification.md"}}),{c(){l=g("meta"),c=i(),a=g("p"),m=i(),M(w.$$.fragment),_=i(),M(A.$$.fragment),v=i(),M(I.$$.fragment),G=i(),x=g("p"),x.textContent=V,W=i(),$=g("p"),$.textContent=B,r=i(),U=g("ol"),U.innerHTML=E,X=i(),M(R.$$.fragment),h=i(),Z=g("p"),Z.textContent=H,cs=i(),M(F.$$.fragment),z=i(),Q=g("p"),Q.textContent=as,ms=i(),M(N.$$.fragment),Y=i(),M(q.$$.fragment),S=i(),ls=g("p"),ls.textContent=hs,L=i(),M(D.$$.fragment),P=i(),ts=g("p"),ts.textContent=Ms,K=i(),M(O.$$.fragment),ss=i(),es=g("p"),es.innerHTML=js,p=i(),M(T.$$.fragment),us=i(),ds=g("p"),ds.innerHTML=Aa,Ps=i(),ys=g("ul"),ys.innerHTML=Ra,Ks=i(),M(fs.$$.fragment),Os=i(),M(gs.$$.fragment),sa=i(),bs=g("p"),bs.innerHTML=Xa,aa=i(),M(ws.$$.fragment),la=i(),Js=g("p"),Js.innerHTML=Va,ta=i(),M(Ts.$$.fragment),ea=i(),Us=g("p"),Us.innerHTML=Ea,na=i(),$s=g("ol"),$s.innerHTML=Ha,pa=i(),xs=g("p"),xs.textContent=Fa,ra=i(),M(ks.$$.fragment),ia=i(),Cs=g("p"),Cs.innerHTML=za,oa=i(),M(_s.$$.fragment),ca=i(),Is=g("p"),Is.innerHTML=Qa,ma=i(),M(ns.$$.fragment),ha=i(),M(Zs.$$.fragment),Ma=i(),vs=g("p"),vs.innerHTML=Na,ja=i(),M(Gs.$$.fragment),ua=i(),Ws=g("p"),Ws.innerHTML=Ya,da=i(),M(Bs.$$.fragment),ya=i(),As=g("p"),As.innerHTML=qa,fa=i(),M(Rs.$$.fragment),ga=i(),Xs=g("p"),Xs.innerHTML=Sa,ba=i(),M(Vs.$$.fragment),wa=i(),M(ps.$$.fragment),Ja=i(),M(rs.$$.fragment),Ta=i(),M(Es.$$.fragment),Ua=i(),Hs=g("p"),Hs.textContent=La,$a=i(),Fs=g("p"),Fs.textContent=Da,xa=i(),M(zs.$$.fragment),ka=i(),Qs=g("p"),Qs.innerHTML=Pa,Ca=i(),M(Ns.$$.fragment),_a=i(),Ys=g("p"),Ys.innerHTML=Ka,Ia=i(),M(is.$$.fragment),Za=i(),M(qs.$$.fragment),va=i(),Ds=g("p"),this.h()},l(s){const n=ml("svelte-u9bgzb",document.head);l=b(n,"META",{name:!0,content:!0}),n.forEach(t),c=o(s),a=b(s,"P",{}),el(a).forEach(t),m=o(s),j(w.$$.fragment,s),_=o(s),j(A.$$.fragment,s),v=o(s),j(I.$$.fragment,s),G=o(s),x=b(s,"P",{"data-svelte-h":!0}),J(x)!=="svelte-o0annf"&&(x.textContent=V),W=o(s),$=b(s,"P",{"data-svelte-h":!0}),J($)!=="svelte-1aff4p7"&&($.textContent=B),r=o(s),U=b(s,"OL",{"data-svelte-h":!0}),J(U)!=="svelte-oqtrz6"&&(U.innerHTML=E),X=o(s),j(R.$$.fragment,s),h=o(s),Z=b(s,"P",{"data-svelte-h":!0}),J(Z)!=="svelte-1c9nexd"&&(Z.textContent=H),cs=o(s),j(F.$$.fragment,s),z=o(s),Q=b(s,"P",{"data-svelte-h":!0}),J(Q)!=="svelte-k76o1m"&&(Q.textContent=as),ms=o(s),j(N.$$.fragment,s),Y=o(s),j(q.$$.fragment,s),S=o(s),ls=b(s,"P",{"data-svelte-h":!0}),J(ls)!=="svelte-tluco0"&&(ls.textContent=hs),L=o(s),j(D.$$.fragment,s),P=o(s),ts=b(s,"P",{"data-svelte-h":!0}),J(ts)!=="svelte-1m91ua0"&&(ts.textContent=Ms),K=o(s),j(O.$$.fragment,s),ss=o(s),es=b(s,"P",{"data-svelte-h":!0}),J(es)!=="svelte-1684qxr"&&(es.innerHTML=js),p=o(s),j(T.$$.fragment,s),us=o(s),ds=b(s,"P",{"data-svelte-h":!0}),J(ds)!=="svelte-b2md1a"&&(ds.innerHTML=Aa),Ps=o(s),ys=b(s,"UL",{"data-svelte-h":!0}),J(ys)!=="svelte-13punrg"&&(ys.innerHTML=Ra),Ks=o(s),j(fs.$$.fragment,s),Os=o(s),j(gs.$$.fragment,s),sa=o(s),bs=b(s,"P",{"data-svelte-h":!0}),J(bs)!=="svelte-1pk56gi"&&(bs.innerHTML=Xa),aa=o(s),j(ws.$$.fragment,s),la=o(s),Js=b(s,"P",{"data-svelte-h":!0}),J(Js)!=="svelte-el75ld"&&(Js.innerHTML=Va),ta=o(s),j(Ts.$$.fragment,s),ea=o(s),Us=b(s,"P",{"data-svelte-h":!0}),J(Us)!=="svelte-1lf9iv0"&&(Us.innerHTML=Ea),na=o(s),$s=b(s,"OL",{"data-svelte-h":!0}),J($s)!=="svelte-1heekds"&&($s.innerHTML=Ha),pa=o(s),xs=b(s,"P",{"data-svelte-h":!0}),J(xs)!=="svelte-yddais"&&(xs.textContent=Fa),ra=o(s),j(ks.$$.fragment,s),ia=o(s),Cs=b(s,"P",{"data-svelte-h":!0}),J(Cs)!=="svelte-1fasmjz"&&(Cs.innerHTML=za),oa=o(s),j(_s.$$.fragment,s),ca=o(s),Is=b(s,"P",{"data-svelte-h":!0}),J(Is)!=="svelte-pjl5y5"&&(Is.innerHTML=Qa),ma=o(s),j(ns.$$.fragment,s),ha=o(s),j(Zs.$$.fragment,s),Ma=o(s),vs=b(s,"P",{"data-svelte-h":!0}),J(vs)!=="svelte-434hvn"&&(vs.innerHTML=Na),ja=o(s),j(Gs.$$.fragment,s),ua=o(s),Ws=b(s,"P",{"data-svelte-h":!0}),J(Ws)!=="svelte-np7vj3"&&(Ws.innerHTML=Ya),da=o(s),j(Bs.$$.fragment,s),ya=o(s),As=b(s,"P",{"data-svelte-h":!0}),J(As)!=="svelte-183aynn"&&(As.innerHTML=qa),fa=o(s),j(Rs.$$.fragment,s),ga=o(s),Xs=b(s,"P",{"data-svelte-h":!0}),J(Xs)!=="svelte-18c6io4"&&(Xs.innerHTML=Sa),ba=o(s),j(Vs.$$.fragment,s),wa=o(s),j(ps.$$.fragment,s),Ja=o(s),j(rs.$$.fragment,s),Ta=o(s),j(Es.$$.fragment,s),Ua=o(s),Hs=b(s,"P",{"data-svelte-h":!0}),J(Hs)!=="svelte-633ppb"&&(Hs.textContent=La),$a=o(s),Fs=b(s,"P",{"data-svelte-h":!0}),J(Fs)!=="svelte-o1jbfg"&&(Fs.textContent=Da),xa=o(s),j(zs.$$.fragment,s),ka=o(s),Qs=b(s,"P",{"data-svelte-h":!0}),J(Qs)!=="svelte-ap335r"&&(Qs.innerHTML=Pa),Ca=o(s),j(Ns.$$.fragment,s),_a=o(s),Ys=b(s,"P",{"data-svelte-h":!0}),J(Ys)!=="svelte-1njl8vm"&&(Ys.innerHTML=Ka),Ia=o(s),j(is.$$.fragment,s),Za=o(s),j(qs.$$.fragment,s),va=o(s),Ds=b(s,"P",{}),el(Ds).forEach(t),this.h()},h(){nl(l,"name","hf:doc:metadata"),nl(l,"content",Wl)},m(s,n){hl(document.head,l),e(s,c,n),e(s,a,n),e(s,m,n),u(w,s,n),e(s,_,n),u(A,s,n),e(s,v,n),u(I,s,n),e(s,G,n),e(s,x,n),e(s,W,n),e(s,$,n),e(s,r,n),e(s,U,n),e(s,X,n),u(R,s,n),e(s,h,n),e(s,Z,n),e(s,cs,n),u(F,s,n),e(s,z,n),e(s,Q,n),e(s,ms,n),u(N,s,n),e(s,Y,n),u(q,s,n),e(s,S,n),e(s,ls,n),e(s,L,n),u(D,s,n),e(s,P,n),e(s,ts,n),e(s,K,n),u(O,s,n),e(s,ss,n),e(s,es,n),e(s,p,n),u(T,s,n),e(s,us,n),e(s,ds,n),e(s,Ps,n),e(s,ys,n),e(s,Ks,n),u(fs,s,n),e(s,Os,n),u(gs,s,n),e(s,sa,n),e(s,bs,n),e(s,aa,n),u(ws,s,n),e(s,la,n),e(s,Js,n),e(s,ta,n),u(Ts,s,n),e(s,ea,n),e(s,Us,n),e(s,na,n),e(s,$s,n),e(s,pa,n),e(s,xs,n),e(s,ra,n),u(ks,s,n),e(s,ia,n),e(s,Cs,n),e(s,oa,n),u(_s,s,n),e(s,ca,n),e(s,Is,n),e(s,ma,n),u(ns,s,n),e(s,ha,n),u(Zs,s,n),e(s,Ma,n),e(s,vs,n),e(s,ja,n),u(Gs,s,n),e(s,ua,n),e(s,Ws,n),e(s,da,n),u(Bs,s,n),e(s,ya,n),e(s,As,n),e(s,fa,n),u(Rs,s,n),e(s,ga,n),e(s,Xs,n),e(s,ba,n),u(Vs,s,n),e(s,wa,n),u(ps,s,n),e(s,Ja,n),u(rs,s,n),e(s,Ta,n),u(Es,s,n),e(s,Ua,n),e(s,Hs,n),e(s,$a,n),e(s,Fs,n),e(s,xa,n),u(zs,s,n),e(s,ka,n),e(s,Qs,n),e(s,Ca,n),u(Ns,s,n),e(s,_a,n),e(s,Ys,n),e(s,Ia,n),u(is,s,n),e(s,Za,n),u(qs,s,n),e(s,va,n),e(s,Ds,n),Ga=!0},p(s,[n]){const Oa={};n&2&&(Oa.$$scope={dirty:n,ctx:s}),R.$set(Oa);const sl={};n&2&&(sl.$$scope={dirty:n,ctx:s}),ns.$set(sl);const al={};n&2&&(al.$$scope={dirty:n,ctx:s}),ps.$set(al);const ll={};n&2&&(ll.$$scope={dirty:n,ctx:s}),rs.$set(ll);const tl={};n&2&&(tl.$$scope={dirty:n,ctx:s}),is.$set(tl)},i(s){Ga||(d(w.$$.fragment,s),d(A.$$.fragment,s),d(I.$$.fragment,s),d(R.$$.fragment,s),d(F.$$.fragment,s),d(N.$$.fragment,s),d(q.$$.fragment,s),d(D.$$.fragment,s),d(O.$$.fragment,s),d(T.$$.fragment,s),d(fs.$$.fragment,s),d(gs.$$.fragment,s),d(ws.$$.fragment,s),d(Ts.$$.fragment,s),d(ks.$$.fragment,s),d(_s.$$.fragment,s),d(ns.$$.fragment,s),d(Zs.$$.fragment,s),d(Gs.$$.fragment,s),d(Bs.$$.fragment,s),d(Rs.$$.fragment,s),d(Vs.$$.fragment,s),d(ps.$$.fragment,s),d(rs.$$.fragment,s),d(Es.$$.fragment,s),d(zs.$$.fragment,s),d(Ns.$$.fragment,s),d(is.$$.fragment,s),d(qs.$$.fragment,s),Ga=!0)},o(s){y(w.$$.fragment,s),y(A.$$.fragment,s),y(I.$$.fragment,s),y(R.$$.fragment,s),y(F.$$.fragment,s),y(N.$$.fragment,s),y(q.$$.fragment,s),y(D.$$.fragment,s),y(O.$$.fragment,s),y(T.$$.fragment,s),y(fs.$$.fragment,s),y(gs.$$.fragment,s),y(ws.$$.fragment,s),y(Ts.$$.fragment,s),y(ks.$$.fragment,s),y(_s.$$.fragment,s),y(ns.$$.fragment,s),y(Zs.$$.fragment,s),y(Gs.$$.fragment,s),y(Bs.$$.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),Ga=!1},d(s){s&&(t(c),t(a),t(m),t(_),t(v),t(G),t(x),t(W),t($),t(r),t(U),t(X),t(h),t(Z),t(cs),t(z),t(Q),t(ms),t(Y),t(S),t(ls),t(L),t(P),t(ts),t(K),t(ss),t(es),t(p),t(us),t(ds),t(Ps),t(ys),t(Ks),t(Os),t(sa),t(bs),t(aa),t(la),t(Js),t(ta),t(ea),t(Us),t(na),t($s),t(pa),t(xs),t(ra),t(ia),t(Cs),t(oa),t(ca),t(Is),t(ma),t(ha),t(Ma),t(vs),t(ja),t(ua),t(Ws),t(da),t(ya),t(As),t(fa),t(ga),t(Xs),t(ba),t(wa),t(Ja),t(Ta),t(Ua),t(Hs),t($a),t(Fs),t(xa),t(ka),t(Qs),t(Ca),t(_a),t(Ys),t(Ia),t(Za),t(va),t(Ds)),t(l),f(w,s),f(A,s),f(I,s),f(R,s),f(F,s),f(N,s),f(q,s),f(D,s),f(O,s),f(T,s),f(fs,s),f(gs,s),f(ws,s),f(Ts,s),f(ks,s),f(_s,s),f(ns,s),f(Zs,s),f(Gs,s),f(Bs,s),f(Rs,s),f(Vs,s),f(ps,s),f(rs,s),f(Es,s),f(zs,s),f(Ns,s),f(is,s),f(qs,s)}}}const Wl='{"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 Bl(C){return il(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ql extends ol{constructor(l){super(),cl(this,l,Bl,Gl,rl,{})}}export{Ql as component};
