import{s as ra,o as ia,n as cs}from"../chunks/scheduler.56730f09.js";import{S as ca,i as oa,g as b,s as i,r as j,A as ma,h as d,f as t,c,j as na,u as h,x as w,k as ea,y as Ma,a as n,v as u,d as y,t as g,w as J,m as ja,n as ha}from"../chunks/index.61415d3e.js";import{T as Vl}from"../chunks/Tip.81680c40.js";import{Y as pa}from"../chunks/Youtube.4af31517.js";import{C}from"../chunks/CodeBlock.501e762d.js";import{D as ua}from"../chunks/DocNotebookDropdown.de94d9b4.js";import{F as Bl,M as Ls}from"../chunks/Markdown.44d6dca7.js";import{H as Ss,E as ya}from"../chunks/index.bd32f405.js";function ga(k){let a,o='للاطلاع جميع البنى والنقاط المتوافقة مع هذه المهمة، نوصي بالرجوع من <a href="https://huggingface.co/tasks/token-classification" rel="nofollow">صفحة المهمة</a>.';return{c(){a=b("p"),a.innerHTML=o},l(l){a=d(l,"P",{"data-svelte-h":!0}),w(a)!=="svelte-1pa6gj1"&&(a.innerHTML=o)},m(l,m){n(l,a,m)},p:cs,d(l){l&&t(a)}}}function Ja(k){let a,o;return a=new C({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){g(a.$$.fragment,l),o=!1},d(l){J(a,l)}}}function ba(k){let a,o;return a=new Ls({props:{$$slots:{default:[Ja]},$$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 f={};m&2&&(f.$$scope={dirty:m,ctx:l}),a.$set(f)},i(l){o||(y(a.$$.fragment,l),o=!0)},o(l){g(a.$$.fragment,l),o=!1},d(l){J(a,l)}}}function da(k){let a,o;return a=new C({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){g(a.$$.fragment,l),o=!1},d(l){J(a,l)}}}function fa(k){let a,o;return a=new Ls({props:{$$slots:{default:[da]},$$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 f={};m&2&&(f.$$scope={dirty:m,ctx:l}),a.$set(f)},i(l){o||(y(a.$$.fragment,l),o=!0)},o(l){g(a.$$.fragment,l),o=!1},d(l){J(a,l)}}}function wa(k){let a,o='إذا لم تكن على دراية بتعديل نموذج باستخدام <code>Trainer</code>, ألق نظرة على الدليل التعليمي الأساسي <a href="../training#train-with-pytorch-trainer">هنا</a>!';return{c(){a=b("p"),a.innerHTML=o},l(l){a=d(l,"P",{"data-svelte-h":!0}),w(a)!=="svelte-182x1vq"&&(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="أنت مستعد الآن لبدء تدريب نموذجك! قم بتحميل DistilBERT مع <code>AutoModelForTokenClassification</code> إلى جانب عدد التصنيفات المتوقعة، وخريطة التسميات:",f,I,R,v,_="في هذه المرحلة، هناك ثلاث خطوات فقط متبقية:",G,x,A=`<li>حدد معلمات التدريب الخاصة بك في <code>TrainingArguments</code>. المعامل الوحيد المطلوب هو <code>output_dir</code> الذي يحدد مكان حفظ نموذجك. ستقوم بدفع هذا النموذج إلى Hub عن طريق تعيين <code>push_to_hub=True</code> (يجب أن تكون مسجلاً الدخول إلى Hugging Face لتحميل نموذجك). في نهاية كل حقبة، سيقوم <code>Trainer</code> بتقييم درجات seqeval وحفظ تسخة التدريب.</li> <li>قم بتمرير معاملات التدريب إلى <code>Trainer</code> إلى جانب النموذج، ومجموعة البيانات، والمُجزِّئ اللغوي، و<code>data collator</code>، ودالة <code>compute_metrics</code>.
3.استدعِ <code>train()</code> لتدريب نموذجك.</li>`,V,$,B,r,U="بمجرد اكتمال التدريب، شارك نموذجك على Hub باستخدام طريقة <code>push_to_hub()</code> حتى يتمكن الجميع من استخدام نموذجك:",X,E,W;return a=new Vl({props:{$$slots:{default:[wa]},$$scope:{ctx:k}}}),I=new C({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 C({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}}),E=new C({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=b("p"),l.innerHTML=m,f=i(),j(I.$$.fragment),R=i(),v=b("p"),v.textContent=_,G=i(),x=b("ol"),x.innerHTML=A,V=i(),j($.$$.fragment),B=i(),r=b("p"),r.innerHTML=U,X=i(),j(E.$$.fragment)},l(M){h(a.$$.fragment,M),o=c(M),l=d(M,"P",{"data-svelte-h":!0}),w(l)!=="svelte-1q5em0k"&&(l.innerHTML=m),f=c(M),h(I.$$.fragment,M),R=c(M),v=d(M,"P",{"data-svelte-h":!0}),w(v)!=="svelte-js7en6"&&(v.textContent=_),G=c(M),x=d(M,"OL",{"data-svelte-h":!0}),w(x)!=="svelte-xrljiu"&&(x.innerHTML=A),V=c(M),h($.$$.fragment,M),B=c(M),r=d(M,"P",{"data-svelte-h":!0}),w(r)!=="svelte-ff6r7l"&&(r.innerHTML=U),X=c(M),h(E.$$.fragment,M)},m(M,Z){u(a,M,Z),n(M,o,Z),n(M,l,Z),n(M,f,Z),u(I,M,Z),n(M,R,Z),n(M,v,Z),n(M,G,Z),n(M,x,Z),n(M,V,Z),u($,M,Z),n(M,B,Z),n(M,r,Z),n(M,X,Z),u(E,M,Z),W=!0},p(M,Z){const Q={};Z&2&&(Q.$$scope={dirty:Z,ctx:M}),a.$set(Q)},i(M){W||(y(a.$$.fragment,M),y(I.$$.fragment,M),y($.$$.fragment,M),y(E.$$.fragment,M),W=!0)},o(M){g(a.$$.fragment,M),g(I.$$.fragment,M),g($.$$.fragment,M),g(E.$$.fragment,M),W=!1},d(M){M&&(t(o),t(l),t(f),t(R),t(v),t(G),t(x),t(V),t(B),t(r),t(X)),J(a,M),J(I,M),J($,M),J(E,M)}}}function Ua(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 f={};m&2&&(f.$$scope={dirty:m,ctx:l}),a.$set(f)},i(l){o||(y(a.$$.fragment,l),o=!0)},o(l){g(a.$$.fragment,l),o=!1},d(l){J(a,l)}}}function $a(k){let a,o='إذا لم تكن على دراية بتعديل نموذج باستخدام Keras، ألق نظرة على الدليل التعليمي الأساسي <a href="../training#train-a-tensorflow-model-with-keras">هنا</a>!';return{c(){a=b("p"),a.innerHTML=o},l(l){a=d(l,"P",{"data-svelte-h":!0}),w(a)!=="svelte-1m8nazx"&&(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,f,I="ثم يمكنك تحميل DistilBERT مع <code>TFAutoModelForTokenClassification</code> إلى جانب عدد التسميات المتوقعة، وتخطيطات التسميات:",R,v,_,G,x="قم بتحويل مجموعات بياناتك إلى تنسيق <code>tf.data.Dataset</code> مع <code>prepare_tf_dataset()</code>:",A,V,$,B,r='هيّئ النموذج للتدريب باستخدام <a href="https://keras.io/api/models/model_training_apis/#compile-method" rel="nofollow"><code>compile</code></a>. لاحظ أن نماذج Transformers تتضمن دالة خسارة افتراضية مرتبطة بالمهمة، لذلك لا تحتاج إلى تحديد واحدة إلا إذا كنت ترغب في ذلك:',U,X,E,W,M='آخر أمرين يجب إعدادهما قبل بدء التدريب هو حساب درجات seqeval من التنبؤات، وتوفير طريقة لدفع نموذجك إلى Hub. يتم ذلك باستخدام <a href="../main_classes/keras_callbacks">Keras callbacks</a>.',Z,Q,os="مرر دالة <code>compute_metrics</code> الخاصة بك إلى <code>KerasMetricCallback</code>:",N,H,F,ls,ms="حدد مكان دفع نموذجك والمحلل اللغوي في <code>PushToHubCallback</code>:",z,q,Y,S,as="ثم جمّع callbacks الخاصة بك معًا:",Ms,L,D,O,ts='أخيرًا، أنت جاهز الآن لبدء تدريب نموذجك! قم باستدعاء <a href="https://keras.io/api/models/model_training_apis/#fit-method" rel="nofollow"><code>fit</code></a> مع بيانات التدريب والتحقق، وعدد الحقبات، وcallbacks لتعديل النموذج:',js,P,K,ss,ns="بمجرد اكتمال التدريب، يتم تحميل نموذجك تلقائيًا إلى Hub حتى يتمكن الجميع من استخدامه!",hs;return a=new Vl({props:{$$slots:{default:[$a]},$$scope:{ctx:k}}}),l=new C({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 C({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}}),V=new C({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}}),X=new C({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}}),H=new C({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}}),q=new C({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 C({props:{code:"Y2FsbGJhY2tzJTIwJTNEJTIwJTVCbWV0cmljX2NhbGxiYWNrJTJDJTIwcHVzaF90b19odWJfY2FsbGJhY2slNUQ=",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>callbacks = [metric_callback, push_to_hub_callback]',wrap:!1}}),P=new C({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(),f=b("p"),f.innerHTML=I,R=i(),j(v.$$.fragment),_=i(),G=b("p"),G.innerHTML=x,A=i(),j(V.$$.fragment),$=i(),B=b("p"),B.innerHTML=r,U=i(),j(X.$$.fragment),E=i(),W=b("p"),W.innerHTML=M,Z=i(),Q=b("p"),Q.innerHTML=os,N=i(),j(H.$$.fragment),F=i(),ls=b("p"),ls.innerHTML=ms,z=i(),j(q.$$.fragment),Y=i(),S=b("p"),S.textContent=as,Ms=i(),j(L.$$.fragment),D=i(),O=b("p"),O.innerHTML=ts,js=i(),j(P.$$.fragment),K=i(),ss=b("p"),ss.textContent=ns},l(p){h(a.$$.fragment,p),o=ha(p,`
للتعديل على نموذج في TensorFlow، ابدأ بإعداد دالة محسن، وجدول معدل التعلم، وبعض معلمات التدريب:

	`),h(l.$$.fragment,p),m=c(p),f=d(p,"P",{"data-svelte-h":!0}),w(f)!=="svelte-ui46vh"&&(f.innerHTML=I),R=c(p),h(v.$$.fragment,p),_=c(p),G=d(p,"P",{"data-svelte-h":!0}),w(G)!=="svelte-1cze99a"&&(G.innerHTML=x),A=c(p),h(V.$$.fragment,p),$=c(p),B=d(p,"P",{"data-svelte-h":!0}),w(B)!=="svelte-ckw1qd"&&(B.innerHTML=r),U=c(p),h(X.$$.fragment,p),E=c(p),W=d(p,"P",{"data-svelte-h":!0}),w(W)!=="svelte-1d8j8ga"&&(W.innerHTML=M),Z=c(p),Q=d(p,"P",{"data-svelte-h":!0}),w(Q)!=="svelte-1opb8y1"&&(Q.innerHTML=os),N=c(p),h(H.$$.fragment,p),F=c(p),ls=d(p,"P",{"data-svelte-h":!0}),w(ls)!=="svelte-ql8x90"&&(ls.innerHTML=ms),z=c(p),h(q.$$.fragment,p),Y=c(p),S=d(p,"P",{"data-svelte-h":!0}),w(S)!=="svelte-1ch3264"&&(S.textContent=as),Ms=c(p),h(L.$$.fragment,p),D=c(p),O=d(p,"P",{"data-svelte-h":!0}),w(O)!=="svelte-1fcivk1"&&(O.innerHTML=ts),js=c(p),h(P.$$.fragment,p),K=c(p),ss=d(p,"P",{"data-svelte-h":!0}),w(ss)!=="svelte-2i53kw"&&(ss.textContent=ns)},m(p,T){u(a,p,T),n(p,o,T),u(l,p,T),n(p,m,T),n(p,f,T),n(p,R,T),u(v,p,T),n(p,_,T),n(p,G,T),n(p,A,T),u(V,p,T),n(p,$,T),n(p,B,T),n(p,U,T),u(X,p,T),n(p,E,T),n(p,W,T),n(p,Z,T),n(p,Q,T),n(p,N,T),u(H,p,T),n(p,F,T),n(p,ls,T),n(p,z,T),u(q,p,T),n(p,Y,T),n(p,S,T),n(p,Ms,T),u(L,p,T),n(p,D,T),n(p,O,T),n(p,js,T),u(P,p,T),n(p,K,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(V.$$.fragment,p),y(X.$$.fragment,p),y(H.$$.fragment,p),y(q.$$.fragment,p),y(L.$$.fragment,p),y(P.$$.fragment,p),hs=!0)},o(p){g(a.$$.fragment,p),g(l.$$.fragment,p),g(v.$$.fragment,p),g(V.$$.fragment,p),g(X.$$.fragment,p),g(H.$$.fragment,p),g(q.$$.fragment,p),g(L.$$.fragment,p),g(P.$$.fragment,p),hs=!1},d(p){p&&(t(o),t(m),t(f),t(R),t(_),t(G),t(A),t($),t(B),t(U),t(E),t(W),t(Z),t(Q),t(N),t(F),t(ls),t(z),t(Y),t(S),t(Ms),t(D),t(O),t(js),t(K),t(ss)),J(a,p),J(l,p),J(v,p),J(V,p),J(X,p),J(H,p),J(q,p),J(L,p),J(P,p)}}}function Ca(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 f={};m&2&&(f.$$scope={dirty:m,ctx:l}),a.$set(f)},i(l){o||(y(a.$$.fragment,l),o=!0)},o(l){g(a.$$.fragment,l),o=!1},d(l){J(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=b("p"),a.innerHTML=o},l(l){a=d(l,"P",{"data-svelte-h":!0}),w(a)!=="svelte-1xy2vh1"&&(a.innerHTML=o)},m(l,m){n(l,a,m)},p:cs,d(l){l&&t(a)}}}function Ia(k){let a,o="قسّم النص إلى رموز وأرجع المُوتّرات بلغة PyTorch:",l,m,f,I,R="مرر مدخلاتك إلى النموذج واحصل على <code>logits</code>:",v,_,G,x,A="استخرج الفئة ذات الاحتمالية الأعلى، واستخدم جدول <code>id2label</code> الخاصة بالنموذج لتحويلها إلى تسمية نصية:",V,$,B;return m=new C({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}}),_=new C({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 C({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=b("p"),a.textContent=o,l=i(),j(m.$$.fragment),f=i(),I=b("p"),I.innerHTML=R,v=i(),j(_.$$.fragment),G=i(),x=b("p"),x.innerHTML=A,V=i(),j($.$$.fragment)},l(r){a=d(r,"P",{"data-svelte-h":!0}),w(a)!=="svelte-9bzhm2"&&(a.textContent=o),l=c(r),h(m.$$.fragment,r),f=c(r),I=d(r,"P",{"data-svelte-h":!0}),w(I)!=="svelte-bshp75"&&(I.innerHTML=R),v=c(r),h(_.$$.fragment,r),G=c(r),x=d(r,"P",{"data-svelte-h":!0}),w(x)!=="svelte-q2tg1i"&&(x.innerHTML=A),V=c(r),h($.$$.fragment,r)},m(r,U){n(r,a,U),n(r,l,U),u(m,r,U),n(r,f,U),n(r,I,U),n(r,v,U),u(_,r,U),n(r,G,U),n(r,x,U),n(r,V,U),u($,r,U),B=!0},p:cs,i(r){B||(y(m.$$.fragment,r),y(_.$$.fragment,r),y($.$$.fragment,r),B=!0)},o(r){g(m.$$.fragment,r),g(_.$$.fragment,r),g($.$$.fragment,r),B=!1},d(r){r&&(t(a),t(l),t(f),t(I),t(v),t(G),t(x),t(V)),J(m,r),J(_,r),J($,r)}}}function _a(k){let a,o;return a=new Ls({props:{$$slots:{default:[Ia]},$$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 f={};m&2&&(f.$$scope={dirty:m,ctx:l}),a.$set(f)},i(l){o||(y(a.$$.fragment,l),o=!0)},o(l){g(a.$$.fragment,l),o=!1},d(l){J(a,l)}}}function Za(k){let a,o="قسّم النص إلى رموز وأرجع المُوتّرات ب TensorFlow:",l,m,f,I,R="مرر مدخلاتك إلى النموذج واحصل على <code>logits</code>:",v,_,G,x,A="استخرج الفئة ذات الاحتمالية الأعلى، واستخدم جدول <code>id2label</code> الخاصة بالنموذج لتحويلها إلى تسمية نصية:",V,$,B;return m=new C({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}}),_=new C({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 C({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=b("p"),a.textContent=o,l=i(),j(m.$$.fragment),f=i(),I=b("p"),I.innerHTML=R,v=i(),j(_.$$.fragment),G=i(),x=b("p"),x.innerHTML=A,V=i(),j($.$$.fragment)},l(r){a=d(r,"P",{"data-svelte-h":!0}),w(a)!=="svelte-246ssj"&&(a.textContent=o),l=c(r),h(m.$$.fragment,r),f=c(r),I=d(r,"P",{"data-svelte-h":!0}),w(I)!=="svelte-bshp75"&&(I.innerHTML=R),v=c(r),h(_.$$.fragment,r),G=c(r),x=d(r,"P",{"data-svelte-h":!0}),w(x)!=="svelte-q2tg1i"&&(x.innerHTML=A),V=c(r),h($.$$.fragment,r)},m(r,U){n(r,a,U),n(r,l,U),u(m,r,U),n(r,f,U),n(r,I,U),n(r,v,U),u(_,r,U),n(r,G,U),n(r,x,U),n(r,V,U),u($,r,U),B=!0},p:cs,i(r){B||(y(m.$$.fragment,r),y(_.$$.fragment,r),y($.$$.fragment,r),B=!0)},o(r){g(m.$$.fragment,r),g(_.$$.fragment,r),g($.$$.fragment,r),B=!1},d(r){r&&(t(a),t(l),t(f),t(I),t(v),t(G),t(x),t(V)),J(m,r),J(_,r),J($,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 f={};m&2&&(f.$$scope={dirty:m,ctx:l}),a.$set(f)},i(l){o||(y(a.$$.fragment,l),o=!0)},o(l){g(a.$$.fragment,l),o=!1},d(l){J(a,l)}}}function Ga(k){let a,o,l,m,f,I,R,v,_,G,x,A="يهدف تصنيف الرموز إلى إعطاء تسمية لكل رمز على حدة في الجملة. من أكثر مهام تصنيف الرموز شيوعًا هو التعرف على الكيانات المسماة (NER). يحاول NER تحديد تسمية لكل كيان في الجملة، مثل شخص، أو مكان، أو منظمة.",V,$,B="سيوضح لك هذا الدليل كيفية:",r,U,X='<li>ضبط <a href="https://huggingface.co/distilbert/distilbert-base-uncased" rel="nofollow">DistilBERT</a> على مجموعة بيانات <a href="https://huggingface.co/datasets/wnut_17" rel="nofollow">WNUT 17</a> للكشف عن كيانات جديدة.</li> <li>استخدام نموذجك المضبوط بدقة للاستدلال.</li>',E,W,M,Z,Q="قبل أن تبدأ، تأكد من تثبيت جميع المكتبات الضرورية:",os,N,H,F,ls="نحن نشجعك على تسجيل الدخول إلى حساب HuggingFace الخاص بك حتى تتمكن من تحميل ومشاركة نموذجك مع المجتمع. عندما يُطلب منك، أدخل رمزك لتسجيل الدخول:",ms,z,q,Y,S,as,Ms="ابدأ بتحميل مجموعة بيانات WNUT 17 من مكتبة 🤗 Datasets:",L,D,O,ts,js="ثم ألق نظرة على مثال:",P,K,ss,ns,hs="يمثل كل رقم في <code>ner_tags</code> كياناً. حوّل الأرقام إلى أسماء التصنيفات لمعرفة ماهية الكيانات:",p,T,us,ys,Rl="يشير الحرف الذي يسبق كل <code>ner_tag</code> إلى موضع الرمز للكيان:",Os,gs,Wl="<li><code>B-</code> يشير إلى بداية الكيان.</li> <li><code>I-</code> يشير إلى أن الرمز يقع ضمن نفس الكيان (على سبيل المثال، الرمز <code>State</code> هو جزء من كيان مثل <code>Empire State Building</code>).</li> <li><code>0</code> يشير إلى أن الرمز لا يمثل أي كيان.</li>",Ps,Js,Ks,bs,sl,ds,El="الخطوة التالية هي تحميل مُجزِّئ النصوص DistilBERT للمعالجة المسبقة لحقل <code>tokens</code>:",ll,fs,al,ws,Al="كما رأيت في حقل <code>tokens</code> المثال أعلاه، يبدو أن المدخل قد تم تحليله بالفعل. لكن المدخل  لم يُجزأ بعد ويتعيّن عليك ضبط <code>is_split_into_words=True</code> لتقسيم الكلمات إلى كلمات فرعية. على سبيل المثال:",tl,Ts,nl,Us,Xl="ومع ذلك، يضيف هذا بعض الرموز الخاصة <code>[CLS]</code> و<code>[SEP]</code> وتقسيم الكلمات إلى أجزاء يُنشئ عدم تطابق بين المُدخلات والتسميات. قد يتم تقسيم كلمة واحدة تقابل تسمية واحدة الآن إلى كلمتين فرعيتين. ستحتاج إلى إعادة محاذاة الرموز والتسميات عن طريق:",el,$s,Ql='<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>-100</code> للرموز الخاصة <code>[CLS]</code> و<code>[SEP]</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,Nl="هنا كيف يمكنك إنشاء وظيفة لإعادة محاذاة الرموز والتسميات، وقص الجمل لتتجاوز الحد الأقصى لطول مُدخلات DistilBERT:",rl,Cs,il,ks,Hl="لتطبيق هذه العملية على كامل مجموعة البيانات، استخدم الدالة <code>map</code> لمجموعة بيانات 🤗. يمكنك تسريع الدالة <code>map</code> عن طريق تعيين <code>batched=True</code> لمعالجة عناصر متعددة من مجموعة البيانات في وقت واحد:",cl,Is,ol,_s,Fl="الآن قم بإنشاء دفعة من الأمثلة باستخدام <code>DataCollatorWithPadding</code>.من الأفضل استخدام <em>الحشو الديناميكي</em> للجمل إلى أطول طول في دفعة أثناء التجميع، بدلاً من حشو مجموعة البيانات بالكامل إلى الطول الأقصى.",ml,es,Ml,Zs,jl,vs,zl='يُعدّ تضمين مقياس أثناء التدريب مفيدًا في تقييم أداء نموذجك. يمكنك تحميل طريقة تقييم بسرعة مع مكتبة 🤗 <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">quick tour</a> لمعرفة المزيد حول كيفية تحميل وحساب مقياس). يُخرج seqeval عدة نتائج: الدقة، والاستذكار، ومقياس F1، والدقة.',hl,Gs,ul,Vs,ql="احصل على تسميات الكيانات المسماة (NER) أولاً،ثم أنشئ دالة تُمرر تنبؤاتك وتسمياتك الصحيحة إلى <code>compute</code> لحساب النتائج:",yl,Bs,gl,Rs,Yl="دالة <code>compute_metrics</code> جاهزة للاستخدام، وستحتاج إليها عند إعداد التدريب.",Jl,Ws,bl,Es,Sl="قبل تدريب النموذج، جهّز خريطة تربط بين المعرّفات المتوقعة وتسمياتها باستخدام <code>id2label</code> و <code>label2id</code>:",dl,As,fl,ps,wl,rs,Tl,Xs,Ul,Qs,Ll="رائع، الآن بعد أن قمت بتعديل نموذج، يمكنك استخدامه للاستدلال!",$l,Ns,Dl="احصل على بعض النصوص التي تريد تشغيل الاستدلال عليها:",xl,Hs,Cl,Fs,Ol="أبسط طريقة لتجربة نموذجك المُدرب مسبقًا للاستدلال هي استخدامه في <code>pipeline()</code>. قم بتنفيذ <code>pipeline</code> لتصنيف الكيانات المسماة مع نموذجك، ومرر نصك إليه:",kl,zs,Il,qs,Pl="يمكنك أيضًا تكرار نتائج <code>pipeline</code> يدويًا إذا أردت:",_l,is,Zl,Ys,vl,Ds,Gl;return f=new Ss({props:{title:"تصنيف الرموز(Token classification)",local:"تصنيف-الرموزtoken-classification",headingTag:"h1"}}),R=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/ar/token_classification.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/ar/pytorch/token_classification.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/ar/tensorflow/token_classification.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ar/token_classification.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ar/pytorch/token_classification.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ar/tensorflow/token_classification.ipynb"}]}}),_=new pa({props:{id:"wVHdVlPScxA"}}),W=new Vl({props:{$$slots:{default:[ga]},$$scope:{ctx:k}}}),N=new C({props:{code:"cGlwJTIwaW5zdGFsbCUyMHRyYW5zZm9ybWVycyUyMGRhdGFzZXRzJTIwZXZhbHVhdGUlMjBzZXFldmFs",highlighted:"pip install transformers datasets evaluate seqeval",wrap:!1}}),z=new C({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}}),Y=new Ss({props:{title:"تحميل مجموعة بيانات WNUT 17",local:"تحميل-مجموعة-بيانات-wnut-17",headingTag:"h2"}}),D=new C({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}}),K=new C({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 C({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}}),Js=new Ss({props:{title:"المعالجة المسبقة(Preprocess)",local:"المعالجة-المسبقةpreprocess",headingTag:"h2"}}),bs=new pa({props:{id:"iY2AZYdZAr0"}}),fs=new C({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 C({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}}),Cs=new C({props:{code:"ZGVmJTIwdG9rZW5pemVfYW5kX2FsaWduX2xhYmVscyhleGFtcGxlcyklM0ElMEElMjAlMjAlMjAlMjB0b2tlbml6ZWRfaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKGV4YW1wbGVzJTVCJTIydG9rZW5zJTIyJTVEJTJDJTIwdHJ1bmNhdGlvbiUzRFRydWUlMkMlMjBpc19zcGxpdF9pbnRvX3dvcmRzJTNEVHJ1ZSklMEElMEElMjAlMjAlMjAlMjBsYWJlbHMlMjAlM0QlMjAlNUIlNUQlMEElMjAlMjAlMjAlMjBmb3IlMjBpJTJDJTIwbGFiZWwlMjBpbiUyMGVudW1lcmF0ZShleGFtcGxlcyU1QmYlMjJuZXJfdGFncyUyMiU1RCklM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjB3b3JkX2lkcyUyMCUzRCUyMHRva2VuaXplZF9pbnB1dHMud29yZF9pZHMoYmF0Y2hfaW5kZXglM0RpKSUyMCUyMCUyMyUyMCVEOCVBQSVEOCVCOSVEOSU4QSVEOSU4QSVEOSU4NiUyMCVEOCVBNyVEOSU4NCVEOCVCMSVEOSU4NSVEOSU4OCVEOCVCMiUyMCVEOCVBNSVEOSU4NCVEOSU4OSUyMCVEOSU4MyVEOSU4NCVEOSU4NSVEOCVBNyVEOCVBQSVEOSU4NyVEOSU4NSUyMCVEOCVBNyVEOSU4NCVEOSU4NSVEOSU4MiVEOCVBNyVEOCVBOCVEOSU4NCVEOCVBOS4lMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBwcmV2aW91c193b3JkX2lkeCUyMCUzRCUyME5vbmUlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBsYWJlbF9pZHMlMjAlM0QlMjAlNUIlNUQlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBmb3IlMjB3b3JkX2lkeCUyMGluJTIwd29yZF9pZHMlM0ElMjAlMjAlMjMlMjAlRDglQUElRDglQjklRDklOEElRDklOEElRDklODYlMjAlRDglQTclRDklODQlRDglQjElRDklODUlRDklODglRDglQjIlMjAlRDglQTclRDklODQlRDglQUUlRDglQTclRDglQjUlRDglQTklMjAlRDglQTUlRDklODQlRDklODklMjAtMTAwLiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGlmJTIwd29yZF9pZHglMjBpcyUyME5vbmUlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBsYWJlbF9pZHMuYXBwZW5kKC0xMDApJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwZWxpZiUyMHdvcmRfaWR4JTIwISUzRCUyMHByZXZpb3VzX3dvcmRfaWR4JTNBJTIwJTIwJTIzJTIwJUQ4JUFBJUQ4JUIzJUQ5JTg1JUQ5JThBJUQ4JUE5JTIwJUQ4JUE3JUQ5JTg0JUQ4JUIxJUQ5JTg1JUQ4JUIyJTIwJUQ4JUE3JUQ5JTg0JUQ4JUEzJUQ5JTg4JUQ5JTg0JTIwJUQ5JTgxJUQ5JTgyJUQ4JUI3JTIwJUQ5JTg0JUQ5JTgzJUQ5JTg0JUQ5JTg1JUQ4JUE5JTIwJUQ5JTg1JUQ4JUI5JUQ5JThBJUQ5JTg2JUQ4JUE5LiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGxhYmVsX2lkcy5hcHBlbmQobGFiZWwlNUJ3b3JkX2lkeCU1RCklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBlbHNlJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwbGFiZWxfaWRzLmFwcGVuZCgtMTAwKSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHByZXZpb3VzX3dvcmRfaWR4JTIwJTNEJTIwd29yZF9pZHglMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBsYWJlbHMuYXBwZW5kKGxhYmVsX2lkcyklMEElMEElMjAlMjAlMjAlMjB0b2tlbml6ZWRfaW5wdXRzJTVCJTIybGFiZWxzJTIyJTVEJTIwJTNEJTIwbGFiZWxzJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwdG9rZW5pemVkX2lucHV0cw==",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"># تعيين الرموز إلى كلماتهم المقابلة.</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"># تعيين الرموز الخاصة إلى -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"># تسمية الرمز الأول فقط لكلمة معينة.</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}}),Is=new C({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 Bl({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[fa],pytorch:[ba]},$$scope:{ctx:k}}}),Zs=new Ss({props:{title:"التقييم(Evaluate)",local:"التقييمevaluate",headingTag:"h2"}}),Gs=new C({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 C({props:{code:"aW1wb3J0JTIwbnVtcHklMjBhcyUyMG5wJTBBJTBBbGFiZWxzJTIwJTNEJTIwJTVCbGFiZWxfbGlzdCU1QmklNUQlMjBmb3IlMjBpJTIwaW4lMjBleGFtcGxlJTVCZiUyMm5lcl90YWdzJTIyJTVEJTVEJTBBJTBBZGVmJTIwY29tcHV0ZV9tZXRyaWNzKHApJTNBJTBBJTIwJTIwJTIwJTIwcHJlZGljdGlvbnMlMkMlMjBsYWJlbHMlMjAlM0QlMjBwJTBBJTIwJTIwJTIwJTIwcHJlZGljdGlvbnMlMjAlM0QlMjBucC5hcmdtYXgocHJlZGljdGlvbnMlMkMlMjBheGlzJTNEMiklMEElMEElMjAlMjAlMjAlMjB0cnVlX3ByZWRpY3Rpb25zJTIwJTNEJTIwJTVCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTVCbGFiZWxfbGlzdCU1QnAlNUQlMjBmb3IlMjAocCUyQyUyMGwpJTIwaW4lMjB6aXAocHJlZGljdGlvbiUyQyUyMGxhYmVsKSUyMGlmJTIwbCUyMCElM0QlMjAtMTAwJTVEJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwZm9yJTIwcHJlZGljdGlvbiUyQyUyMGxhYmVsJTIwaW4lMjB6aXAocHJlZGljdGlvbnMlMkMlMjBsYWJlbHMpJTBBJTIwJTIwJTIwJTIwJTVEJTBBJTIwJTIwJTIwJTIwdHJ1ZV9sYWJlbHMlMjAlM0QlMjAlNUIlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlNUJsYWJlbF9saXN0JTVCbCU1RCUyMGZvciUyMChwJTJDJTIwbCklMjBpbiUyMHppcChwcmVkaWN0aW9uJTJDJTIwbGFiZWwpJTIwaWYlMjBsJTIwISUzRCUyMC0xMDAlNUQlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBmb3IlMjBwcmVkaWN0aW9uJTJDJTIwbGFiZWwlMjBpbiUyMHppcChwcmVkaWN0aW9ucyUyQyUyMGxhYmVscyklMEElMjAlMjAlMjAlMjAlNUQlMEElMEElMjAlMjAlMjAlMjByZXN1bHRzJTIwJTNEJTIwc2VxZXZhbC5jb21wdXRlKHByZWRpY3Rpb25zJTNEdHJ1ZV9wcmVkaWN0aW9ucyUyQyUyMHJlZmVyZW5jZXMlM0R0cnVlX2xhYmVscyklMEElMjAlMjAlMjAlMjByZXR1cm4lMjAlN0IlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJwcmVjaXNpb24lMjIlM0ElMjByZXN1bHRzJTVCJTIyb3ZlcmFsbF9wcmVjaXNpb24lMjIlNUQlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJyZWNhbGwlMjIlM0ElMjByZXN1bHRzJTVCJTIyb3ZlcmFsbF9yZWNhbGwlMjIlNUQlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJmMSUyMiUzQSUyMHJlc3VsdHMlNUIlMjJvdmVyYWxsX2YxJTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIyYWNjdXJhY3klMjIlM0ElMjByZXN1bHRzJTVCJTIyb3ZlcmFsbF9hY2N1cmFjeSUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMCU3RA==",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}}),Ws=new Ss({props:{title:"التدريب(Train)",local:"التدريبtrain",headingTag:"h2"}}),As=new C({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 Bl({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[Ca],pytorch:[Ua]},$$scope:{ctx:k}}}),rs=new Vl({props:{$$slots:{default:[ka]},$$scope:{ctx:k}}}),Xs=new Ss({props:{title:"الاستدلال(Inference)",local:"الاستدلالinference",headingTag:"h2"}}),Hs=new C({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}}),zs=new C({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 Bl({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[va],pytorch:[_a]},$$scope:{ctx:k}}}),Ys=new ya({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/ar/tasks/token_classification.md"}}),{c(){a=b("meta"),o=i(),l=b("p"),m=i(),j(f.$$.fragment),I=i(),j(R.$$.fragment),v=i(),j(_.$$.fragment),G=i(),x=b("p"),x.textContent=A,V=i(),$=b("p"),$.textContent=B,r=i(),U=b("ol"),U.innerHTML=X,E=i(),j(W.$$.fragment),M=i(),Z=b("p"),Z.textContent=Q,os=i(),j(N.$$.fragment),H=i(),F=b("p"),F.textContent=ls,ms=i(),j(z.$$.fragment),q=i(),j(Y.$$.fragment),S=i(),as=b("p"),as.textContent=Ms,L=i(),j(D.$$.fragment),O=i(),ts=b("p"),ts.textContent=js,P=i(),j(K.$$.fragment),ss=i(),ns=b("p"),ns.innerHTML=hs,p=i(),j(T.$$.fragment),us=i(),ys=b("p"),ys.innerHTML=Rl,Os=i(),gs=b("ul"),gs.innerHTML=Wl,Ps=i(),j(Js.$$.fragment),Ks=i(),j(bs.$$.fragment),sl=i(),ds=b("p"),ds.innerHTML=El,ll=i(),j(fs.$$.fragment),al=i(),ws=b("p"),ws.innerHTML=Al,tl=i(),j(Ts.$$.fragment),nl=i(),Us=b("p"),Us.innerHTML=Xl,el=i(),$s=b("ol"),$s.innerHTML=Ql,pl=i(),xs=b("p"),xs.textContent=Nl,rl=i(),j(Cs.$$.fragment),il=i(),ks=b("p"),ks.innerHTML=Hl,cl=i(),j(Is.$$.fragment),ol=i(),_s=b("p"),_s.innerHTML=Fl,ml=i(),j(es.$$.fragment),Ml=i(),j(Zs.$$.fragment),jl=i(),vs=b("p"),vs.innerHTML=zl,hl=i(),j(Gs.$$.fragment),ul=i(),Vs=b("p"),Vs.innerHTML=ql,yl=i(),j(Bs.$$.fragment),gl=i(),Rs=b("p"),Rs.innerHTML=Yl,Jl=i(),j(Ws.$$.fragment),bl=i(),Es=b("p"),Es.innerHTML=Sl,dl=i(),j(As.$$.fragment),fl=i(),j(ps.$$.fragment),wl=i(),j(rs.$$.fragment),Tl=i(),j(Xs.$$.fragment),Ul=i(),Qs=b("p"),Qs.textContent=Ll,$l=i(),Ns=b("p"),Ns.textContent=Dl,xl=i(),j(Hs.$$.fragment),Cl=i(),Fs=b("p"),Fs.innerHTML=Ol,kl=i(),j(zs.$$.fragment),Il=i(),qs=b("p"),qs.innerHTML=Pl,_l=i(),j(is.$$.fragment),Zl=i(),j(Ys.$$.fragment),vl=i(),Ds=b("p"),this.h()},l(s){const e=ma("svelte-u9bgzb",document.head);a=d(e,"META",{name:!0,content:!0}),e.forEach(t),o=c(s),l=d(s,"P",{}),na(l).forEach(t),m=c(s),h(f.$$.fragment,s),I=c(s),h(R.$$.fragment,s),v=c(s),h(_.$$.fragment,s),G=c(s),x=d(s,"P",{"data-svelte-h":!0}),w(x)!=="svelte-mlex5h"&&(x.textContent=A),V=c(s),$=d(s,"P",{"data-svelte-h":!0}),w($)!=="svelte-lp8700"&&($.textContent=B),r=c(s),U=d(s,"OL",{"data-svelte-h":!0}),w(U)!=="svelte-f6bdfy"&&(U.innerHTML=X),E=c(s),h(W.$$.fragment,s),M=c(s),Z=d(s,"P",{"data-svelte-h":!0}),w(Z)!=="svelte-93upt2"&&(Z.textContent=Q),os=c(s),h(N.$$.fragment,s),H=c(s),F=d(s,"P",{"data-svelte-h":!0}),w(F)!=="svelte-1akjhwh"&&(F.textContent=ls),ms=c(s),h(z.$$.fragment,s),q=c(s),h(Y.$$.fragment,s),S=c(s),as=d(s,"P",{"data-svelte-h":!0}),w(as)!=="svelte-1tafdxt"&&(as.textContent=Ms),L=c(s),h(D.$$.fragment,s),O=c(s),ts=d(s,"P",{"data-svelte-h":!0}),w(ts)!=="svelte-1e1soci"&&(ts.textContent=js),P=c(s),h(K.$$.fragment,s),ss=c(s),ns=d(s,"P",{"data-svelte-h":!0}),w(ns)!=="svelte-krnhtx"&&(ns.innerHTML=hs),p=c(s),h(T.$$.fragment,s),us=c(s),ys=d(s,"P",{"data-svelte-h":!0}),w(ys)!=="svelte-adxshk"&&(ys.innerHTML=Rl),Os=c(s),gs=d(s,"UL",{"data-svelte-h":!0}),w(gs)!=="svelte-himjeb"&&(gs.innerHTML=Wl),Ps=c(s),h(Js.$$.fragment,s),Ks=c(s),h(bs.$$.fragment,s),sl=c(s),ds=d(s,"P",{"data-svelte-h":!0}),w(ds)!=="svelte-24obir"&&(ds.innerHTML=El),ll=c(s),h(fs.$$.fragment,s),al=c(s),ws=d(s,"P",{"data-svelte-h":!0}),w(ws)!=="svelte-1ice9v2"&&(ws.innerHTML=Al),tl=c(s),h(Ts.$$.fragment,s),nl=c(s),Us=d(s,"P",{"data-svelte-h":!0}),w(Us)!=="svelte-n6w5d2"&&(Us.innerHTML=Xl),el=c(s),$s=d(s,"OL",{"data-svelte-h":!0}),w($s)!=="svelte-e69f3s"&&($s.innerHTML=Ql),pl=c(s),xs=d(s,"P",{"data-svelte-h":!0}),w(xs)!=="svelte-58h08z"&&(xs.textContent=Nl),rl=c(s),h(Cs.$$.fragment,s),il=c(s),ks=d(s,"P",{"data-svelte-h":!0}),w(ks)!=="svelte-k7o1mk"&&(ks.innerHTML=Hl),cl=c(s),h(Is.$$.fragment,s),ol=c(s),_s=d(s,"P",{"data-svelte-h":!0}),w(_s)!=="svelte-1l905x3"&&(_s.innerHTML=Fl),ml=c(s),h(es.$$.fragment,s),Ml=c(s),h(Zs.$$.fragment,s),jl=c(s),vs=d(s,"P",{"data-svelte-h":!0}),w(vs)!=="svelte-12xv8go"&&(vs.innerHTML=zl),hl=c(s),h(Gs.$$.fragment,s),ul=c(s),Vs=d(s,"P",{"data-svelte-h":!0}),w(Vs)!=="svelte-10jvy45"&&(Vs.innerHTML=ql),yl=c(s),h(Bs.$$.fragment,s),gl=c(s),Rs=d(s,"P",{"data-svelte-h":!0}),w(Rs)!=="svelte-t0jeyd"&&(Rs.innerHTML=Yl),Jl=c(s),h(Ws.$$.fragment,s),bl=c(s),Es=d(s,"P",{"data-svelte-h":!0}),w(Es)!=="svelte-1fc001q"&&(Es.innerHTML=Sl),dl=c(s),h(As.$$.fragment,s),fl=c(s),h(ps.$$.fragment,s),wl=c(s),h(rs.$$.fragment,s),Tl=c(s),h(Xs.$$.fragment,s),Ul=c(s),Qs=d(s,"P",{"data-svelte-h":!0}),w(Qs)!=="svelte-ltiwph"&&(Qs.textContent=Ll),$l=c(s),Ns=d(s,"P",{"data-svelte-h":!0}),w(Ns)!=="svelte-1gaxkwa"&&(Ns.textContent=Dl),xl=c(s),h(Hs.$$.fragment,s),Cl=c(s),Fs=d(s,"P",{"data-svelte-h":!0}),w(Fs)!=="svelte-6lvpup"&&(Fs.innerHTML=Ol),kl=c(s),h(zs.$$.fragment,s),Il=c(s),qs=d(s,"P",{"data-svelte-h":!0}),w(qs)!=="svelte-asb9jo"&&(qs.innerHTML=Pl),_l=c(s),h(is.$$.fragment,s),Zl=c(s),h(Ys.$$.fragment,s),vl=c(s),Ds=d(s,"P",{}),na(Ds).forEach(t),this.h()},h(){ea(a,"name","hf:doc:metadata"),ea(a,"content",Va)},m(s,e){Ma(document.head,a),n(s,o,e),n(s,l,e),n(s,m,e),u(f,s,e),n(s,I,e),u(R,s,e),n(s,v,e),u(_,s,e),n(s,G,e),n(s,x,e),n(s,V,e),n(s,$,e),n(s,r,e),n(s,U,e),n(s,E,e),u(W,s,e),n(s,M,e),n(s,Z,e),n(s,os,e),u(N,s,e),n(s,H,e),n(s,F,e),n(s,ms,e),u(z,s,e),n(s,q,e),u(Y,s,e),n(s,S,e),n(s,as,e),n(s,L,e),u(D,s,e),n(s,O,e),n(s,ts,e),n(s,P,e),u(K,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,Os,e),n(s,gs,e),n(s,Ps,e),u(Js,s,e),n(s,Ks,e),u(bs,s,e),n(s,sl,e),n(s,ds,e),n(s,ll,e),u(fs,s,e),n(s,al,e),n(s,ws,e),n(s,tl,e),u(Ts,s,e),n(s,nl,e),n(s,Us,e),n(s,el,e),n(s,$s,e),n(s,pl,e),n(s,xs,e),n(s,rl,e),u(Cs,s,e),n(s,il,e),n(s,ks,e),n(s,cl,e),u(Is,s,e),n(s,ol,e),n(s,_s,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,Vs,e),n(s,yl,e),u(Bs,s,e),n(s,gl,e),n(s,Rs,e),n(s,Jl,e),u(Ws,s,e),n(s,bl,e),n(s,Es,e),n(s,dl,e),u(As,s,e),n(s,fl,e),u(ps,s,e),n(s,wl,e),u(rs,s,e),n(s,Tl,e),u(Xs,s,e),n(s,Ul,e),n(s,Qs,e),n(s,$l,e),n(s,Ns,e),n(s,xl,e),u(Hs,s,e),n(s,Cl,e),n(s,Fs,e),n(s,kl,e),u(zs,s,e),n(s,Il,e),n(s,qs,e),n(s,_l,e),u(is,s,e),n(s,Zl,e),u(Ys,s,e),n(s,vl,e),n(s,Ds,e),Gl=!0},p(s,[e]){const Kl={};e&2&&(Kl.$$scope={dirty:e,ctx:s}),W.$set(Kl);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(f.$$.fragment,s),y(R.$$.fragment,s),y(_.$$.fragment,s),y(W.$$.fragment,s),y(N.$$.fragment,s),y(z.$$.fragment,s),y(Y.$$.fragment,s),y(D.$$.fragment,s),y(K.$$.fragment,s),y(T.$$.fragment,s),y(Js.$$.fragment,s),y(bs.$$.fragment,s),y(fs.$$.fragment,s),y(Ts.$$.fragment,s),y(Cs.$$.fragment,s),y(Is.$$.fragment,s),y(es.$$.fragment,s),y(Zs.$$.fragment,s),y(Gs.$$.fragment,s),y(Bs.$$.fragment,s),y(Ws.$$.fragment,s),y(As.$$.fragment,s),y(ps.$$.fragment,s),y(rs.$$.fragment,s),y(Xs.$$.fragment,s),y(Hs.$$.fragment,s),y(zs.$$.fragment,s),y(is.$$.fragment,s),y(Ys.$$.fragment,s),Gl=!0)},o(s){g(f.$$.fragment,s),g(R.$$.fragment,s),g(_.$$.fragment,s),g(W.$$.fragment,s),g(N.$$.fragment,s),g(z.$$.fragment,s),g(Y.$$.fragment,s),g(D.$$.fragment,s),g(K.$$.fragment,s),g(T.$$.fragment,s),g(Js.$$.fragment,s),g(bs.$$.fragment,s),g(fs.$$.fragment,s),g(Ts.$$.fragment,s),g(Cs.$$.fragment,s),g(Is.$$.fragment,s),g(es.$$.fragment,s),g(Zs.$$.fragment,s),g(Gs.$$.fragment,s),g(Bs.$$.fragment,s),g(Ws.$$.fragment,s),g(As.$$.fragment,s),g(ps.$$.fragment,s),g(rs.$$.fragment,s),g(Xs.$$.fragment,s),g(Hs.$$.fragment,s),g(zs.$$.fragment,s),g(is.$$.fragment,s),g(Ys.$$.fragment,s),Gl=!1},d(s){s&&(t(o),t(l),t(m),t(I),t(v),t(G),t(x),t(V),t($),t(r),t(U),t(E),t(M),t(Z),t(os),t(H),t(F),t(ms),t(q),t(S),t(as),t(L),t(O),t(ts),t(P),t(ss),t(ns),t(p),t(us),t(ys),t(Os),t(gs),t(Ps),t(Ks),t(sl),t(ds),t(ll),t(al),t(ws),t(tl),t(nl),t(Us),t(el),t($s),t(pl),t(xs),t(rl),t(il),t(ks),t(cl),t(ol),t(_s),t(ml),t(Ml),t(jl),t(vs),t(hl),t(ul),t(Vs),t(yl),t(gl),t(Rs),t(Jl),t(bl),t(Es),t(dl),t(fl),t(wl),t(Tl),t(Ul),t(Qs),t($l),t(Ns),t(xl),t(Cl),t(Fs),t(kl),t(Il),t(qs),t(_l),t(Zl),t(vl),t(Ds)),t(a),J(f,s),J(R,s),J(_,s),J(W,s),J(N,s),J(z,s),J(Y,s),J(D,s),J(K,s),J(T,s),J(Js,s),J(bs,s),J(fs,s),J(Ts,s),J(Cs,s),J(Is,s),J(es,s),J(Zs,s),J(Gs,s),J(Bs,s),J(Ws,s),J(As,s),J(ps,s),J(rs,s),J(Xs,s),J(Hs,s),J(zs,s),J(is,s),J(Ys,s)}}}const Va='{"title":"تصنيف الرموز(Token classification)","local":"تصنيف-الرموزtoken-classification","sections":[{"title":"تحميل مجموعة بيانات WNUT 17","local":"تحميل-مجموعة-بيانات-wnut-17","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 Ba(k){return ia(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Fa extends ca{constructor(a){super(),oa(this,a,Ba,Ga,ra,{})}}export{Fa as component};
