import{s as Ll,o as Sl,n as ss}from"../chunks/scheduler.5eb9d175.js";import{S as ql,i as Ol,g as $,s as i,r as f,A as Pl,h as w,f as e,c as m,j as Al,u as j,x as k,k as Yl,y as Kl,a,v as u,d,t as b,w as y,m as st,n as lt}from"../chunks/index.fcdcb606.js";import{T as wl}from"../chunks/Tip.9272e506.js";import{Y as Nl}from"../chunks/Youtube.398fab2b.js";import{C as D}from"../chunks/CodeBlock.a7036e06.js";import{D as tt}from"../chunks/DocNotebookDropdown.2547080e.js";import{F as kl,M as Qs}from"../chunks/Markdown.927e6a50.js";import{H as Vs,E as et}from"../chunks/EditOnGithub.98bf070f.js";function at(J){let l,c='لمعرفة جميع البنى والنسخ المتوافقة مع هذه المهمة، نوصي بالتحقق من <a href="https://huggingface.co/tasks/fill-mask" rel="nofollow">صفحة المهمة</a>';return{c(){l=$("p"),l.innerHTML=c},l(t){l=w(t,"P",{"data-svelte-h":!0}),k(l)!=="svelte-1p9khee"&&(l.innerHTML=c)},m(t,o){a(t,l,o)},p:ss,d(t){t&&e(l)}}}function nt(J){let l,c="استخدم رمز نهاية التسلسل كرمز الحشو وحدد <code>mlm_probability</code> لحجب الرموز عشوائياً كل مرة تكرر فيها البيانات:",t,o,h;return o=new D({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERhdGFDb2xsYXRvckZvckxhbmd1YWdlTW9kZWxpbmclMEElMEF0b2tlbml6ZXIucGFkX3Rva2VuJTIwJTNEJTIwdG9rZW5pemVyLmVvc190b2tlbiUwQWRhdGFfY29sbGF0b3IlMjAlM0QlMjBEYXRhQ29sbGF0b3JGb3JMYW5ndWFnZU1vZGVsaW5nKHRva2VuaXplciUzRHRva2VuaXplciUyQyUyMG1sbV9wcm9iYWJpbGl0eSUzRDAuMTUp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DataCollatorForLanguageModeling

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.pad_token = tokenizer.eos_token
<span class="hljs-meta">&gt;&gt;&gt; </span>data_collator = DataCollatorForLanguageModeling(tokenizer=tokenizer, mlm_probability=<span class="hljs-number">0.15</span>)`,wrap:!1}}),{c(){l=$("p"),l.innerHTML=c,t=i(),f(o.$$.fragment)},l(M){l=w(M,"P",{"data-svelte-h":!0}),k(l)!=="svelte-1p8uifc"&&(l.innerHTML=c),t=m(M),j(o.$$.fragment,M)},m(M,C){a(M,l,C),a(M,t,C),u(o,M,C),h=!0},p:ss,i(M){h||(d(o.$$.fragment,M),h=!0)},o(M){b(o.$$.fragment,M),h=!1},d(M){M&&(e(l),e(t)),y(o,M)}}}function pt(J){let l,c;return l=new Qs({props:{$$slots:{default:[nt]},$$scope:{ctx:J}}}),{c(){f(l.$$.fragment)},l(t){j(l.$$.fragment,t)},m(t,o){u(l,t,o),c=!0},p(t,o){const h={};o&2&&(h.$$scope={dirty:o,ctx:t}),l.$set(h)},i(t){c||(d(l.$$.fragment,t),c=!0)},o(t){b(l.$$.fragment,t),c=!1},d(t){y(l,t)}}}function rt(J){let l,c="استخدم رمز نهاية التسلسل كرمز الحشو وحدد <code>mlm_probability</code> لحجب الرموز عشوائياً كل مرة تكرر فيها البيانات:",t,o,h;return o=new D({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERhdGFDb2xsYXRvckZvckxhbmd1YWdlTW9kZWxpbmclMEElMEFkYXRhX2NvbGxhdG9yJTIwJTNEJTIwRGF0YUNvbGxhdG9yRm9yTGFuZ3VhZ2VNb2RlbGluZyh0b2tlbml6ZXIlM0R0b2tlbml6ZXIlMkMlMjBtbG1fcHJvYmFiaWxpdHklM0QwLjE1JTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJ0ZiUyMik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DataCollatorForLanguageModeling

<span class="hljs-meta">&gt;&gt;&gt; </span>data_collator = DataCollatorForLanguageModeling(tokenizer=tokenizer, mlm_probability=<span class="hljs-number">0.15</span>, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)`,wrap:!1}}),{c(){l=$("p"),l.innerHTML=c,t=i(),f(o.$$.fragment)},l(M){l=w(M,"P",{"data-svelte-h":!0}),k(l)!=="svelte-1p8uifc"&&(l.innerHTML=c),t=m(M),j(o.$$.fragment,M)},m(M,C){a(M,l,C),a(M,t,C),u(o,M,C),h=!0},p:ss,i(M){h||(d(o.$$.fragment,M),h=!0)},o(M){b(o.$$.fragment,M),h=!1},d(M){M&&(e(l),e(t)),y(o,M)}}}function it(J){let l,c;return l=new Qs({props:{$$slots:{default:[rt]},$$scope:{ctx:J}}}),{c(){f(l.$$.fragment)},l(t){j(l.$$.fragment,t)},m(t,o){u(l,t,o),c=!0},p(t,o){const h={};o&2&&(h.$$scope={dirty:o,ctx:t}),l.$set(h)},i(t){c||(d(l.$$.fragment,t),c=!0)},o(t){b(l.$$.fragment,t),c=!1},d(t){y(l,t)}}}function mt(J){let l,c='إذا لم تكن على دراية بتعديل نموذج باستخدام <code>Trainer</code>, ألق نظرة على الدليل الأساسي <a href="../training#train-with-pytorch-trainer">هنا</a>!';return{c(){l=$("p"),l.innerHTML=c},l(t){l=w(t,"P",{"data-svelte-h":!0}),k(l)!=="svelte-qu9q7x"&&(l.innerHTML=c)},m(t,o){a(t,l,o)},p:ss,d(t){t&&e(l)}}}function ot(J){let l,c,t,o="أنت مستعد الآن لبدء تدريب نموذجك! قم بتحميل DistilRoBERTa باستخدام <code>AutoModelForMaskedLM</code>:",h,M,C,G,Z="في هذه المرحلة، تبقى ثلاث خطوات فقط:",Q,_,B="<li>حدد معلمات التدريب الخاصة بك في <code>TrainingArguments</code>. المعلمة الوحيدة المطلوبة هي <code>output_dir</code> والتي تحدد مكان حفظ نموذجك. ستقوم بدفع هذا النموذج إلى Hub عن طريق تعيين <code>push_to_hub=True</code> (يجب أن تكون مسجلاً الدخول إلى Hugging Face لتحميل نموذجك).</li> <li>قم بتمرير معلمات التدريب إلى <code>Trainer</code> مع النموذج، ومجموعات البيانات، ومجمّع البيانات.</li> <li>قم باستدعاء <code>train()</code> لتعديل نموذجك.</li>",W,x,v,p,T=`بمجرد اكتمال التدريب، استخدم طريقة <code>evaluate()</code> لتقييم النموذج والحصول على مقياس
الحيرة:`,z,E,V,F,H="ثم شارك نموذجك على Hub باستخدام طريقة <code>push_to_hub()</code> حتى يتمكن الجميع من استخدام نموذجك:",A,X,I;return l=new wl({props:{$$slots:{default:[mt]},$$scope:{ctx:J}}}),M=new D({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvck1hc2tlZExNJTBBJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JNYXNrZWRMTS5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsYmVydCUyRmRpc3RpbHJvYmVydGEtYmFzZSUyMik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForMaskedLM

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForMaskedLM.from_pretrained(<span class="hljs-string">&quot;distilbert/distilroberta-base&quot;</span>)`,wrap:!1}}),x=new D({props:{code:"dHJhaW5pbmdfYXJncyUyMCUzRCUyMFRyYWluaW5nQXJndW1lbnRzKCUwQSUyMCUyMCUyMCUyMG91dHB1dF9kaXIlM0QlMjJteV9hd2Vzb21lX2VsaTVfbWxtX21vZGVsJTIyJTJDJTBBJTIwJTIwJTIwJTIwZXZhbF9zdHJhdGVneSUzRCUyMmVwb2NoJTIyJTJDJTBBJTIwJTIwJTIwJTIwbGVhcm5pbmdfcmF0ZSUzRDJlLTUlMkMlMEElMjAlMjAlMjAlMjBudW1fdHJhaW5fZXBvY2hzJTNEMyUyQyUwQSUyMCUyMCUyMCUyMHdlaWdodF9kZWNheSUzRDAuMDElMkMlMEElMjAlMjAlMjAlMjBwdXNoX3RvX2h1YiUzRFRydWUlMkMlMEEpJTBBJTBBdHJhaW5lciUyMCUzRCUyMFRyYWluZXIoJTBBJTIwJTIwJTIwJTIwbW9kZWwlM0Rtb2RlbCUyQyUwQSUyMCUyMCUyMCUyMGFyZ3MlM0R0cmFpbmluZ19hcmdzJTJDJTBBJTIwJTIwJTIwJTIwdHJhaW5fZGF0YXNldCUzRGxtX2RhdGFzZXQlNUIlMjJ0cmFpbiUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMGV2YWxfZGF0YXNldCUzRGxtX2RhdGFzZXQlNUIlMjJ0ZXN0JTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwZGF0YV9jb2xsYXRvciUzRGRhdGFfY29sbGF0b3IlMkMlMEElMjAlMjAlMjAlMjB0b2tlbml6ZXIlM0R0b2tlbml6ZXIlMkMlMEEpJTBBJTBBdHJhaW5lci50cmFpbigp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>training_args = TrainingArguments(
<span class="hljs-meta">... </span>    output_dir=<span class="hljs-string">&quot;my_awesome_eli5_mlm_model&quot;</span>,
<span class="hljs-meta">... </span>    eval_strategy=<span class="hljs-string">&quot;epoch&quot;</span>,
<span class="hljs-meta">... </span>    learning_rate=<span class="hljs-number">2e-5</span>,
<span class="hljs-meta">... </span>    num_train_epochs=<span class="hljs-number">3</span>,
<span class="hljs-meta">... </span>    weight_decay=<span class="hljs-number">0.01</span>,
<span class="hljs-meta">... </span>    push_to_hub=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>trainer = Trainer(
<span class="hljs-meta">... </span>    model=model,
<span class="hljs-meta">... </span>    args=training_args,
<span class="hljs-meta">... </span>    train_dataset=lm_dataset[<span class="hljs-string">&quot;train&quot;</span>],
<span class="hljs-meta">... </span>    eval_dataset=lm_dataset[<span class="hljs-string">&quot;test&quot;</span>],
<span class="hljs-meta">... </span>    data_collator=data_collator,
<span class="hljs-meta">... </span>    tokenizer=tokenizer,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.train()`,wrap:!1}}),E=new D({props:{code:"aW1wb3J0JTIwbWF0aCUwQSUwQWV2YWxfcmVzdWx0cyUyMCUzRCUyMHRyYWluZXIuZXZhbHVhdGUoKSUwQXByaW50KGYlMjJQZXJwbGV4aXR5JTNBJTIwJTdCbWF0aC5leHAoZXZhbF9yZXN1bHRzJTVCJ2V2YWxfbG9zcyclNUQpJTNBLjJmJTdEJTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> math

<span class="hljs-meta">&gt;&gt;&gt; </span>eval_results = trainer.evaluate()
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;Perplexity: <span class="hljs-subst">{math.exp(eval_results[<span class="hljs-string">&#x27;eval_loss&#x27;</span>]):<span class="hljs-number">.2</span>f}</span>&quot;</span>)
Perplexity: <span class="hljs-number">8.76</span>`,wrap:!1}}),X=new D({props:{code:"dHJhaW5lci5wdXNoX3RvX2h1Yigp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.push_to_hub()',wrap:!1}}),{c(){f(l.$$.fragment),c=i(),t=$("p"),t.innerHTML=o,h=i(),f(M.$$.fragment),C=i(),G=$("p"),G.textContent=Z,Q=i(),_=$("ol"),_.innerHTML=B,W=i(),f(x.$$.fragment),v=i(),p=$("p"),p.innerHTML=T,z=i(),f(E.$$.fragment),V=i(),F=$("p"),F.innerHTML=H,A=i(),f(X.$$.fragment)},l(g){j(l.$$.fragment,g),c=m(g),t=w(g,"P",{"data-svelte-h":!0}),k(t)!=="svelte-ft3hal"&&(t.innerHTML=o),h=m(g),j(M.$$.fragment,g),C=m(g),G=w(g,"P",{"data-svelte-h":!0}),k(G)!=="svelte-1taxt6y"&&(G.textContent=Z),Q=m(g),_=w(g,"OL",{"data-svelte-h":!0}),k(_)!=="svelte-urto3u"&&(_.innerHTML=B),W=m(g),j(x.$$.fragment,g),v=m(g),p=w(g,"P",{"data-svelte-h":!0}),k(p)!=="svelte-165oe5t"&&(p.innerHTML=T),z=m(g),j(E.$$.fragment,g),V=m(g),F=w(g,"P",{"data-svelte-h":!0}),k(F)!=="svelte-1g4l0nl"&&(F.innerHTML=H),A=m(g),j(X.$$.fragment,g)},m(g,R){u(l,g,R),a(g,c,R),a(g,t,R),a(g,h,R),u(M,g,R),a(g,C,R),a(g,G,R),a(g,Q,R),a(g,_,R),a(g,W,R),u(x,g,R),a(g,v,R),a(g,p,R),a(g,z,R),u(E,g,R),a(g,V,R),a(g,F,R),a(g,A,R),u(X,g,R),I=!0},p(g,R){const N={};R&2&&(N.$$scope={dirty:R,ctx:g}),l.$set(N)},i(g){I||(d(l.$$.fragment,g),d(M.$$.fragment,g),d(x.$$.fragment,g),d(E.$$.fragment,g),d(X.$$.fragment,g),I=!0)},o(g){b(l.$$.fragment,g),b(M.$$.fragment,g),b(x.$$.fragment,g),b(E.$$.fragment,g),b(X.$$.fragment,g),I=!1},d(g){g&&(e(c),e(t),e(h),e(C),e(G),e(Q),e(_),e(W),e(v),e(p),e(z),e(V),e(F),e(A)),y(l,g),y(M,g),y(x,g),y(E,g),y(X,g)}}}function ct(J){let l,c;return l=new Qs({props:{$$slots:{default:[ot]},$$scope:{ctx:J}}}),{c(){f(l.$$.fragment)},l(t){j(l.$$.fragment,t)},m(t,o){u(l,t,o),c=!0},p(t,o){const h={};o&2&&(h.$$scope={dirty:o,ctx:t}),l.$set(h)},i(t){c||(d(l.$$.fragment,t),c=!0)},o(t){b(l.$$.fragment,t),c=!1},d(t){y(l,t)}}}function gt(J){let l,c='إذا لم تكن على دراية بتعديل نموذج باستخدام Keras، ألق نظرة على الدليل الأساسي <a href="../training#train-a-tensorflow-model-with-keras">هنا</a>!';return{c(){l=$("p"),l.innerHTML=c},l(t){l=w(t,"P",{"data-svelte-h":!0}),k(l)!=="svelte-1h8bp0a"&&(l.innerHTML=c)},m(t,o){a(t,l,o)},p:ss,d(t){t&&e(l)}}}function Mt(J){let l,c,t,o,h,M="ثم يمكنك تحميل DistilRoBERTa باستخدام <code>TFAutoModelForMaskedLM</code>:",C,G,Z,Q,_="قم بتحويل مجموعات بياناتك إلى تنسيق <code>tf.data.Dataset</code> باستخدام <code>prepare_tf_dataset()</code>:",B,W,x,v,p='قم بتهيئة النموذج للتدريب باستخدام <a href="https://keras.io/api/models/model_training_apis/#compile-method" rel="nofollow"><code>compile</code></a>. لاحظ أن نماذج Transformers لديها جميعها دالة خسارة افتراضية ذات صلة بالمهمة، لذلك لا تحتاج إلى تحديد واحدة ما لم تكن تريد ذلك:',T,z,E,V,F="يمكن القيام بذلك عن طريق تحديد مكان دفع نموذجك ومعالج الرموز في <code>PushToHubCallback</code>:",H,A,X,I,g='أخيراً، أنت مستعد لبدء تدريب نموذجك! قم باستدعاء <a href="https://keras.io/api/models/model_training_apis/#fit-method" rel="nofollow"><code>fit</code></a> مع مجموعات بيانات التدريب والتحقق، وعدد العصور، والتعليقات الخاصة بك لتعديل النموذج:',R,N,S,Y,ls="بمجرد اكتمال التدريب، يتم تحميل نموذجك تلقائياً إلى Hub حتى يتمكن الجميع من استخدامه!",L;return l=new wl({props:{$$slots:{default:[gt]},$$scope:{ctx:J}}}),t=new D({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMGNyZWF0ZV9vcHRpbWl6ZXIlMkMlMjBBZGFtV2VpZ2h0RGVjYXklMEElMEFvcHRpbWl6ZXIlMjAlM0QlMjBBZGFtV2VpZ2h0RGVjYXkobGVhcm5pbmdfcmF0ZSUzRDJlLTUlMkMlMjB3ZWlnaHRfZGVjYXlfcmF0ZSUzRDAuMDEp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> create_optimizer, AdamWeightDecay

<span class="hljs-meta">&gt;&gt;&gt; </span>optimizer = AdamWeightDecay(learning_rate=<span class="hljs-number">2e-5</span>, weight_decay_rate=<span class="hljs-number">0.01</span>)`,wrap:!1}}),G=new D({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGQXV0b01vZGVsRm9yTWFza2VkTE0lMEElMEFtb2RlbCUyMCUzRCUyMFRGQXV0b01vZGVsRm9yTWFza2VkTE0uZnJvbV9wcmV0cmFpbmVkKCUyMmRpc3RpbGJlcnQlMkZkaXN0aWxyb2JlcnRhLWJhc2UlMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFAutoModelForMaskedLM

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFAutoModelForMaskedLM.from_pretrained(<span class="hljs-string">&quot;distilbert/distilroberta-base&quot;</span>)`,wrap:!1}}),W=new D({props:{code:"dGZfdHJhaW5fc2V0JTIwJTNEJTIwbW9kZWwucHJlcGFyZV90Zl9kYXRhc2V0KCUwQSUyMCUyMCUyMCUyMGxtX2RhdGFzZXQlNUIlMjJ0cmFpbiUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMHNodWZmbGUlM0RUcnVlJTJDJTBBJTIwJTIwJTIwJTIwYmF0Y2hfc2l6ZSUzRDE2JTJDJTBBJTIwJTIwJTIwJTIwY29sbGF0ZV9mbiUzRGRhdGFfY29sbGF0b3IlMkMlMEEpJTBBJTBBdGZfdGVzdF9zZXQlMjAlM0QlMjBtb2RlbC5wcmVwYXJlX3RmX2RhdGFzZXQoJTBBJTIwJTIwJTIwJTIwbG1fZGF0YXNldCU1QiUyMnRlc3QlMjIlNUQlMkMlMEElMjAlMjAlMjAlMjBzaHVmZmxlJTNERmFsc2UlMkMlMEElMjAlMjAlMjAlMjBiYXRjaF9zaXplJTNEMTYlMkMlMEElMjAlMjAlMjAlMjBjb2xsYXRlX2ZuJTNEZGF0YV9jb2xsYXRvciUyQyUwQSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>tf_train_set = model.prepare_tf_dataset(
<span class="hljs-meta">... </span>    lm_dataset[<span class="hljs-string">&quot;train&quot;</span>],
<span class="hljs-meta">... </span>    shuffle=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>    batch_size=<span class="hljs-number">16</span>,
<span class="hljs-meta">... </span>    collate_fn=data_collator,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>tf_test_set = model.prepare_tf_dataset(
<span class="hljs-meta">... </span>    lm_dataset[<span class="hljs-string">&quot;test&quot;</span>],
<span class="hljs-meta">... </span>    shuffle=<span class="hljs-literal">False</span>,
<span class="hljs-meta">... </span>    batch_size=<span class="hljs-number">16</span>,
<span class="hljs-meta">... </span>    collate_fn=data_collator,
<span class="hljs-meta">... </span>)`,wrap:!1}}),z=new D({props:{code:"aW1wb3J0JTIwdGVuc29yZmxvdyUyMGFzJTIwdGYlMEElMEFtb2RlbC5jb21waWxlKG9wdGltaXplciUzRG9wdGltaXplciklMjAlMjAlMjMlMjAlRDklODQlRDglQTclMjAlRDglQUElRDklODglRDglQUMlRDglQUYlMjAlRDglQUQlRDglQUMlRDglQTklMjAlRDklODQlRDklODQlRDglQUUlRDglQjMlRDglQTclRDglQjElRDglQTkh",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"># لا توجد حجة للخسارة!</span>`,wrap:!1}}),A=new D({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycy5rZXJhc19jYWxsYmFja3MlMjBpbXBvcnQlMjBQdXNoVG9IdWJDYWxsYmFjayUwQSUwQWNhbGxiYWNrJTIwJTNEJTIwUHVzaFRvSHViQ2FsbGJhY2soJTBBJTIwJTIwJTIwJTIwb3V0cHV0X2RpciUzRCUyMm15X2F3ZXNvbWVfZWxpNV9tbG1fbW9kZWwlMjIlMkMlMEElMjAlMjAlMjAlMjB0b2tlbml6ZXIlM0R0b2tlbml6ZXIlMkMlMEEp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers.keras_callbacks <span class="hljs-keyword">import</span> PushToHubCallback

<span class="hljs-meta">&gt;&gt;&gt; </span>callback = PushToHubCallback(
<span class="hljs-meta">... </span>    output_dir=<span class="hljs-string">&quot;my_awesome_eli5_mlm_model&quot;</span>,
<span class="hljs-meta">... </span>    tokenizer=tokenizer,
<span class="hljs-meta">... </span>)`,wrap:!1}}),N=new D({props:{code:"bW9kZWwuZml0KHglM0R0Zl90cmFpbl9zZXQlMkMlMjB2YWxpZGF0aW9uX2RhdGElM0R0Zl90ZXN0X3NldCUyQyUyMGVwb2NocyUzRDMlMkMlMjBjYWxsYmFja3MlM0QlNUJjYWxsYmFjayU1RCk=",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>model.fit(x=tf_train_set, validation_data=tf_test_set, epochs=<span class="hljs-number">3</span>, callbacks=[callback])',wrap:!1}}),{c(){f(l.$$.fragment),c=st(`
لتعديل نموذج في TensorFlow، ابدأ بإعداد دالة محسن، وجدول معدل التعلم، وبعض معلمات التدريب:

	`),f(t.$$.fragment),o=i(),h=$("p"),h.innerHTML=M,C=i(),f(G.$$.fragment),Z=i(),Q=$("p"),Q.innerHTML=_,B=i(),f(W.$$.fragment),x=i(),v=$("p"),v.innerHTML=p,T=i(),f(z.$$.fragment),E=i(),V=$("p"),V.innerHTML=F,H=i(),f(A.$$.fragment),X=i(),I=$("p"),I.innerHTML=g,R=i(),f(N.$$.fragment),S=i(),Y=$("p"),Y.textContent=ls},l(r){j(l.$$.fragment,r),c=lt(r,`
لتعديل نموذج في TensorFlow، ابدأ بإعداد دالة محسن، وجدول معدل التعلم، وبعض معلمات التدريب:

	`),j(t.$$.fragment,r),o=m(r),h=w(r,"P",{"data-svelte-h":!0}),k(h)!=="svelte-w0g3zw"&&(h.innerHTML=M),C=m(r),j(G.$$.fragment,r),Z=m(r),Q=w(r,"P",{"data-svelte-h":!0}),k(Q)!=="svelte-1rim6wr"&&(Q.innerHTML=_),B=m(r),j(W.$$.fragment,r),x=m(r),v=w(r,"P",{"data-svelte-h":!0}),k(v)!=="svelte-yl5ezy"&&(v.innerHTML=p),T=m(r),j(z.$$.fragment,r),E=m(r),V=w(r,"P",{"data-svelte-h":!0}),k(V)!=="svelte-3uzirf"&&(V.innerHTML=F),H=m(r),j(A.$$.fragment,r),X=m(r),I=w(r,"P",{"data-svelte-h":!0}),k(I)!=="svelte-11069el"&&(I.innerHTML=g),R=m(r),j(N.$$.fragment,r),S=m(r),Y=w(r,"P",{"data-svelte-h":!0}),k(Y)!=="svelte-19ojwdc"&&(Y.textContent=ls)},m(r,U){u(l,r,U),a(r,c,U),u(t,r,U),a(r,o,U),a(r,h,U),a(r,C,U),u(G,r,U),a(r,Z,U),a(r,Q,U),a(r,B,U),u(W,r,U),a(r,x,U),a(r,v,U),a(r,T,U),u(z,r,U),a(r,E,U),a(r,V,U),a(r,H,U),u(A,r,U),a(r,X,U),a(r,I,U),a(r,R,U),u(N,r,U),a(r,S,U),a(r,Y,U),L=!0},p(r,U){const Ws={};U&2&&(Ws.$$scope={dirty:U,ctx:r}),l.$set(Ws)},i(r){L||(d(l.$$.fragment,r),d(t.$$.fragment,r),d(G.$$.fragment,r),d(W.$$.fragment,r),d(z.$$.fragment,r),d(A.$$.fragment,r),d(N.$$.fragment,r),L=!0)},o(r){b(l.$$.fragment,r),b(t.$$.fragment,r),b(G.$$.fragment,r),b(W.$$.fragment,r),b(z.$$.fragment,r),b(A.$$.fragment,r),b(N.$$.fragment,r),L=!1},d(r){r&&(e(c),e(o),e(h),e(C),e(Z),e(Q),e(B),e(x),e(v),e(T),e(E),e(V),e(H),e(X),e(I),e(R),e(S),e(Y)),y(l,r),y(t,r),y(G,r),y(W,r),y(z,r),y(A,r),y(N,r)}}}function ht(J){let l,c;return l=new Qs({props:{$$slots:{default:[Mt]},$$scope:{ctx:J}}}),{c(){f(l.$$.fragment)},l(t){j(l.$$.fragment,t)},m(t,o){u(l,t,o),c=!0},p(t,o){const h={};o&2&&(h.$$scope={dirty:o,ctx:t}),l.$set(h)},i(t){c||(d(l.$$.fragment,t),c=!0)},o(t){b(l.$$.fragment,t),c=!1},d(t){y(l,t)}}}function ft(J){let l,c=`لمثال أكثر تفصيلاً حول كيفية تعديل نموذج للنمذجة اللغوية المقنعة، ألق نظرة على الدفتر المقابل
<a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling.ipynb" rel="nofollow">دفتر PyTorch</a>
أو <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling-tf.ipynb" rel="nofollow">دفتر TensorFlow</a>.`;return{c(){l=$("p"),l.innerHTML=c},l(t){l=w(t,"P",{"data-svelte-h":!0}),k(l)!=="svelte-hv9ctw"&&(l.innerHTML=c)},m(t,o){a(t,l,o)},p:ss,d(t){t&&e(l)}}}function jt(J){let l,c="قم بتجزئة النص وإرجاع <code>input_ids</code> كمتجهات PyTorch. ستحتاج أيضًا إلى تحديد موضع رمز <code>&lt;mask&gt;</code>:",t,o,h,M,C="قم بتمرير المدخلات إلى النموذج وإرجاع <code>logits</code> للرمز المقنع:",G,Z,Q,_,B="ثم قم بإرجاع الرموز الثلاثة المقنعة ذات الاحتمالية الأعلى وطباعتها:",W,x,v;return o=new D({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJ1c2VybmFtZSUyRm15X2F3ZXNvbWVfZWxpNV9tbG1fbW9kZWwlMjIpJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKHRleHQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQW1hc2tfdG9rZW5faW5kZXglMjAlM0QlMjB0b3JjaC53aGVyZShpbnB1dHMlNUIlMjJpbnB1dF9pZHMlMjIlNUQlMjAlM0QlM0QlMjB0b2tlbml6ZXIubWFza190b2tlbl9pZCklNUIxJTVE",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;username/my_awesome_eli5_mlm_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(text, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>mask_token_index = torch.where(inputs[<span class="hljs-string">&quot;input_ids&quot;</span>] == tokenizer.mask_token_id)[<span class="hljs-number">1</span>]`,wrap:!1}}),Z=new D({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvck1hc2tlZExNJTBBJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JNYXNrZWRMTS5mcm9tX3ByZXRyYWluZWQoJTIydXNlcm5hbWUlMkZteV9hd2Vzb21lX2VsaTVfbWxtX21vZGVsJTIyKSUwQWxvZ2l0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKS5sb2dpdHMlMEFtYXNrX3Rva2VuX2xvZ2l0cyUyMCUzRCUyMGxvZ2l0cyU1QjAlMkMlMjBtYXNrX3Rva2VuX2luZGV4JTJDJTIwJTNBJTVE",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForMaskedLM

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> token <span class="hljs-keyword">in</span> top_3_tokens:
<span class="hljs-meta">... </span>    <span class="hljs-built_in">print</span>(text.replace(tokenizer.mask_token, tokenizer.decode([token])))
The Milky Way <span class="hljs-keyword">is</span> a spiral galaxy.
The Milky Way <span class="hljs-keyword">is</span> a massive galaxy.
The Milky Way <span class="hljs-keyword">is</span> a small galaxy.`,wrap:!1}}),{c(){l=$("p"),l.innerHTML=c,t=i(),f(o.$$.fragment),h=i(),M=$("p"),M.innerHTML=C,G=i(),f(Z.$$.fragment),Q=i(),_=$("p"),_.textContent=B,W=i(),f(x.$$.fragment)},l(p){l=w(p,"P",{"data-svelte-h":!0}),k(l)!=="svelte-2b5lii"&&(l.innerHTML=c),t=m(p),j(o.$$.fragment,p),h=m(p),M=w(p,"P",{"data-svelte-h":!0}),k(M)!=="svelte-daaelq"&&(M.innerHTML=C),G=m(p),j(Z.$$.fragment,p),Q=m(p),_=w(p,"P",{"data-svelte-h":!0}),k(_)!=="svelte-1ubzmox"&&(_.textContent=B),W=m(p),j(x.$$.fragment,p)},m(p,T){a(p,l,T),a(p,t,T),u(o,p,T),a(p,h,T),a(p,M,T),a(p,G,T),u(Z,p,T),a(p,Q,T),a(p,_,T),a(p,W,T),u(x,p,T),v=!0},p:ss,i(p){v||(d(o.$$.fragment,p),d(Z.$$.fragment,p),d(x.$$.fragment,p),v=!0)},o(p){b(o.$$.fragment,p),b(Z.$$.fragment,p),b(x.$$.fragment,p),v=!1},d(p){p&&(e(l),e(t),e(h),e(M),e(G),e(Q),e(_),e(W)),y(o,p),y(Z,p),y(x,p)}}}function ut(J){let l,c;return l=new Qs({props:{$$slots:{default:[jt]},$$scope:{ctx:J}}}),{c(){f(l.$$.fragment)},l(t){j(l.$$.fragment,t)},m(t,o){u(l,t,o),c=!0},p(t,o){const h={};o&2&&(h.$$scope={dirty:o,ctx:t}),l.$set(h)},i(t){c||(d(l.$$.fragment,t),c=!0)},o(t){b(l.$$.fragment,t),c=!1},d(t){y(l,t)}}}function dt(J){let l,c="قم بتقسيم النص إلى رموز وإرجاع <code>input_ids</code> كـ TensorFlow tensors. ستحتاج أيضًا إلى تحديد موضع رمز <code>&lt;mask&gt;</code>:",t,o,h,M,C="قم بتمرير المدخلات إلى النموذج وإرجاع <code>logits</code> للرمز المقنع:",G,Z,Q,_,B="ثم قم بإرجاع الرموز الثلاثة المقنعة ذات الاحتمالية الأعلى وطباعتها:",W,x,v;return o=new D({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJ1c2VybmFtZSUyRm15X2F3ZXNvbWVfZWxpNV9tbG1fbW9kZWwlMjIpJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKHRleHQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnRmJTIyKSUwQW1hc2tfdG9rZW5faW5kZXglMjAlM0QlMjB0Zi53aGVyZShpbnB1dHMlNUIlMjJpbnB1dF9pZHMlMjIlNUQlMjAlM0QlM0QlMjB0b2tlbml6ZXIubWFza190b2tlbl9pZCklNUIwJTJDJTIwMSU1RA==",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;username/my_awesome_eli5_mlm_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(text, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>mask_token_index = tf.where(inputs[<span class="hljs-string">&quot;input_ids&quot;</span>] == tokenizer.mask_token_id)[<span class="hljs-number">0</span>, <span class="hljs-number">1</span>]`,wrap:!1}}),Z=new D({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGQXV0b01vZGVsRm9yTWFza2VkTE0lMEElMEFtb2RlbCUyMCUzRCUyMFRGQXV0b01vZGVsRm9yTWFza2VkTE0uZnJvbV9wcmV0cmFpbmVkKCUyMnVzZXJuYW1lJTJGbXlfYXdlc29tZV9lbGk1X21sbV9tb2RlbCUyMiklMEFsb2dpdHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cykubG9naXRzJTBBbWFza190b2tlbl9sb2dpdHMlMjAlM0QlMjBsb2dpdHMlNUIwJTJDJTIwbWFza190b2tlbl9pbmRleCUyQyUyMCUzQSU1RA==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFAutoModelForMaskedLM

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

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> token <span class="hljs-keyword">in</span> top_3_tokens:
<span class="hljs-meta">... </span>    <span class="hljs-built_in">print</span>(text.replace(tokenizer.mask_token, tokenizer.decode([token])))
The Milky Way <span class="hljs-keyword">is</span> a spiral galaxy.
The Milky Way <span class="hljs-keyword">is</span> a massive galaxy.
The Milky Way <span class="hljs-keyword">is</span> a small galaxy.`,wrap:!1}}),{c(){l=$("p"),l.innerHTML=c,t=i(),f(o.$$.fragment),h=i(),M=$("p"),M.innerHTML=C,G=i(),f(Z.$$.fragment),Q=i(),_=$("p"),_.textContent=B,W=i(),f(x.$$.fragment)},l(p){l=w(p,"P",{"data-svelte-h":!0}),k(l)!=="svelte-16lr9a0"&&(l.innerHTML=c),t=m(p),j(o.$$.fragment,p),h=m(p),M=w(p,"P",{"data-svelte-h":!0}),k(M)!=="svelte-daaelq"&&(M.innerHTML=C),G=m(p),j(Z.$$.fragment,p),Q=m(p),_=w(p,"P",{"data-svelte-h":!0}),k(_)!=="svelte-1ubzmox"&&(_.textContent=B),W=m(p),j(x.$$.fragment,p)},m(p,T){a(p,l,T),a(p,t,T),u(o,p,T),a(p,h,T),a(p,M,T),a(p,G,T),u(Z,p,T),a(p,Q,T),a(p,_,T),a(p,W,T),u(x,p,T),v=!0},p:ss,i(p){v||(d(o.$$.fragment,p),d(Z.$$.fragment,p),d(x.$$.fragment,p),v=!0)},o(p){b(o.$$.fragment,p),b(Z.$$.fragment,p),b(x.$$.fragment,p),v=!1},d(p){p&&(e(l),e(t),e(h),e(M),e(G),e(Q),e(_),e(W)),y(o,p),y(Z,p),y(x,p)}}}function bt(J){let l,c;return l=new Qs({props:{$$slots:{default:[dt]},$$scope:{ctx:J}}}),{c(){f(l.$$.fragment)},l(t){j(l.$$.fragment,t)},m(t,o){u(l,t,o),c=!0},p(t,o){const h={};o&2&&(h.$$scope={dirty:o,ctx:t}),l.$set(h)},i(t){c||(d(l.$$.fragment,t),c=!0)},o(t){b(l.$$.fragment,t),c=!1},d(t){y(l,t)}}}function yt(J){let l,c,t,o,h,M,C,G,Z,Q,_,B=`تتنبأ نمذجة اللغة المقنعة برمز مقنع في تسلسل، ويمكن للنموذج الانتباه إلى الرموز بشكل ثنائي الاتجاه. هذا
يعني أن النموذج لديه إمكانية الوصول الكاملة إلى الرموز الموجودة على اليسار واليمين. تعد نمذجة اللغة المقنعة ممتازة للمهام التي
تتطلب فهمًا سياقيًا جيدًا لتسلسل كامل. BERT هو مثال على نموذج لغة مقنع.`,W,x,v="سيوضح لك هذا الدليل كيفية:",p,T,z='<li>تكييف <a href="https://huggingface.co/distilbert/distilroberta-base" rel="nofollow">DistilRoBERTa</a> على مجموعة فرعية <a href="https://www.reddit.com/r/askscience/" rel="nofollow">r/askscience</a> من مجموعة بيانات <a href="https://huggingface.co/datasets/eli5" rel="nofollow">ELI5</a>.</li> <li>استخدام نموذج المدرب الخاص بك للاستدلال.</li>',E,V,F,H,A="قبل أن تبدأ، تأكد من تثبيت جميع المكتبات الضرورية:",X,I,g,R,N="نحن نشجعك على تسجيل الدخول إلى حساب Hugging Face الخاص بك حتى تتمكن من تحميل ومشاركة نموذجك مع المجتمع. عندما تتم مطالبتك، أدخل رمزك لتسجيل الدخول:",S,Y,ls,L,r,U,Ws='ابدأ بتحميل أول 5000 مثال من مجموعة بيانات <a href="https://huggingface.co/datasets/eli5_category" rel="nofollow">ELI5-Category</a> باستخدام مكتبة 🤗 Datasets. سيعطيك هذا فرصة للتجربة والتأكد من أن كل شيء يعمل قبل قضاء المزيد من الوقت في التدريب على مجموعة البيانات الكاملة.',Is,ts,Es,es,Tl="قم بتقسيم مجموعة البيانات <code>train</code> إلى مجموعتي تدريب واختبار باستخدام الدالة <code>train_test_split</code>:",Xs,as,Bs,ns,xl="ثم ألق نظرة على مثال:",zs,ps,Fs,rs,Ul="على الرغم من أن هذا قد يبدو كثيرًا، إلا أنك مهتم حقًا بحقل <code>text</code>. ما هو رائع حول مهام نمذجة اللغة هو أنك لا تحتاج إلى تسميات (تُعرف أيضًا باسم المهمة غير الخاضعة للإشراف) لأن الكلمة التالية <em>هي</em> التسمية.",Hs,is,As,ms,Ys,os,Rl="بالنسبة لنمذجة اللغة المقنعة، فإن الخطوة التالية هي تحميل معالج DistilRoBERTa لمعالجة حقل <code>text</code> الفرعي:",Ns,cs,Ls,gs,_l='ستلاحظ من المثال أعلاه، أن حقل <code>text</code> موجود بالفعل داخل <code>answers</code>. هذا يعني أنك ستحتاج إلى استخراج حقل <code>text</code> الفرعي من بنيته المضمنة باستخدام الدالة <a href="https://huggingface.co/docs/datasets/process#flatten" rel="nofollow"><code>flatten</code></a>:',Ss,Ms,qs,hs,Jl=`كل حقل فرعي هو الآن عمود منفصل كما هو موضح بواسطة بادئة <code>answers</code>، وحقل <code>text</code> هو قائمة الآن. بدلاً من
معالجة كل جملة بشكل منفصل، قم بتحويل القائمة إلى سلسلة حتى تتمكن من معالجتها بشكل مشترك.`,Os,fs,Cl="هنا أول دالة معالجة مسبقة لربط قائمة السلاسل لكل مثال ومعالجة النتيجة:",Ps,js,Ks,us,Zl="لتطبيق دالة المعالجة المسبقة على مجموعة البيانات بأكملها، استخدم الدالة 🤗 Datasets <code>map</code>. يمكنك تسريع دالة <code>map</code> عن طريق تعيين <code>batched=True</code> لمعالجة عدة عناصر في وقت واحد، وزيادة عدد العمليات باستخدام <code>num_proc</code>. احذف أي أعمدة غير ضرورية:",sl,ds,ll,bs,Dl="تحتوي مجموعة البيانات هذه على تسلسلات رمزية، ولكن بعضها أطول من الطول الأقصى للمدخلات للنموذج.",tl,ys,Gl="يمكنك الآن استخدام دالة معالجة مسبقة ثانية لـ:",el,$s,Ql="<li>تجميع جميع التسلسلات</li> <li>تقسيم التسلسلات المجمّعة إلى أجزاء أقصر محددة بـ <code>block_size</code>، والتي يجب أن تكون أقصر من الحد الأقصى لطول المدخلات ومناسبة لذاكرة GPU.</li>",al,ws,nl,ks,Wl="طبق دالة <code>group_texts</code> على مجموعة البيانات بأكملها:",pl,Ts,rl,xs,vl="الآن، قم بإنشاء دفعة من الأمثلة باستخدام <code>DataCollatorForLanguageModeling</code>. من الأكثر كفاءة أن تقوم بـ <em>الحشو الديناميكي</em> ليصل طولها إلى أطول جملة في الدفعة أثناء التجميع، بدلاً من حشو مجموعة البيانات بأكملها إلى الطول الأقصى.",il,q,ml,Us,ol,O,cl,P,gl,Rs,Ml,_s,Vl="رائع، الآن بعد أن قمت بتعديل نموذج، يمكنك استخدامه للاستدلال!",hl,Js,Il="جهّز بعض النصوص التي تريد أن يملأ النموذج الفراغات فيها، واستخدم الرمز الخاص <code>&lt;mask&gt;</code> للإشارة إلى الفراغ:",fl,Cs,jl,Zs,El="أبسط طريقة لتجربة نموذجك المعدل للاستدلال هي استخدامه في <code>pipeline()</code>. قم بإنشاء كائن  <code>pipeline</code> لملء الفراغ مع نموذجك، ومرر نصك إليه. إذا أردت، يمكنك استخدام معلمة <code>top_k</code> لتحديد عدد التنبؤات التي تريد إرجاعها:",ul,Ds,dl,K,bl,Gs,yl,vs,$l;return h=new Vs({props:{title:"نمذجة اللغة المقنعة (Masked language modeling)",local:"نمذجة-اللغة-المقنعة-masked-language-modeling",headingTag:"h1"}}),C=new tt({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/masked_language_modeling.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/ar/pytorch/masked_language_modeling.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/ar/tensorflow/masked_language_modeling.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ar/masked_language_modeling.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ar/pytorch/masked_language_modeling.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ar/tensorflow/masked_language_modeling.ipynb"}]}}),Z=new Nl({props:{id:"mqElG5QJWUg"}}),V=new wl({props:{$$slots:{default:[at]},$$scope:{ctx:J}}}),I=new D({props:{code:"cGlwJTIwaW5zdGFsbCUyMHRyYW5zZm9ybWVycyUyMGRhdGFzZXRzJTIwZXZhbHVhdGU=",highlighted:"pip install transformers datasets evaluate",wrap:!1}}),Y=new D({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}}),L=new Vs({props:{title:"تحميل مجموعة بيانات ELI5",local:"تحميل-مجموعة-بيانات-eli5",headingTag:"h2"}}),ts=new D({props:{code:"ZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBJTBBZWxpNSUyMCUzRCUyMGxvYWRfZGF0YXNldCglMjJlbGk1X2NhdGVnb3J5JTIyJTJDJTIwc3BsaXQlM0QlMjJ0cmFpbiU1QiUzQTUwMDAlNUQlMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset

<span class="hljs-meta">&gt;&gt;&gt; </span>eli5 = load_dataset(<span class="hljs-string">&quot;eli5_category&quot;</span>, split=<span class="hljs-string">&quot;train[:5000]&quot;</span>)`,wrap:!1}}),as=new D({props:{code:"ZWxpNSUyMCUzRCUyMGVsaTUudHJhaW5fdGVzdF9zcGxpdCh0ZXN0X3NpemUlM0QwLjIp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>eli5 = eli5.train_test_split(test_size=<span class="hljs-number">0.2</span>)',wrap:!1}}),ps=new D({props:{code:"ZWxpNSU1QiUyMnRyYWluJTIyJTVEJTVCMCU1RA==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>eli5[<span class="hljs-string">&quot;train&quot;</span>][<span class="hljs-number">0</span>]
{<span class="hljs-string">&#x27;q_id&#x27;</span>: <span class="hljs-string">&#x27;7h191n&#x27;</span>,
 <span class="hljs-string">&#x27;title&#x27;</span>: <span class="hljs-string">&#x27;What does the tax bill that was passed today mean? How will it affect Americans in each tax bracket?&#x27;</span>,
 <span class="hljs-string">&#x27;selftext&#x27;</span>: <span class="hljs-string">&#x27;&#x27;</span>,
 <span class="hljs-string">&#x27;category&#x27;</span>: <span class="hljs-string">&#x27;Economics&#x27;</span>,
 <span class="hljs-string">&#x27;subreddit&#x27;</span>: <span class="hljs-string">&#x27;explainlikeimfive&#x27;</span>,
 <span class="hljs-string">&#x27;answers&#x27;</span>: {<span class="hljs-string">&#x27;a_id&#x27;</span>: [<span class="hljs-string">&#x27;dqnds8l&#x27;</span>, <span class="hljs-string">&#x27;dqnd1jl&#x27;</span>, <span class="hljs-string">&#x27;dqng3i1&#x27;</span>, <span class="hljs-string">&#x27;dqnku5x&#x27;</span>],
  <span class="hljs-string">&#x27;text&#x27;</span>: [<span class="hljs-string">&quot;The tax bill is 500 pages long and there were a lot of changes still going on right to the end. It&#x27;s not just an adjustment to the income tax brackets, it&#x27;s a whole bunch of changes. As such there is no good answer to your question. The big take aways are: - Big reduction in corporate income tax rate will make large companies very happy. - Pass through rate change will make certain styles of business (law firms, hedge funds) extremely happy - Income tax changes are moderate, and are set to expire (though it&#x27;s the kind of thing that might just always get re-applied without being made permanent) - People in high tax states (California, New York) lose out, and many of them will end up with their taxes raised.&quot;</span>,
   <span class="hljs-string">&#x27;None yet. It has to be reconciled with a vastly different house bill and then passed again.&#x27;</span>,
   <span class="hljs-string">&#x27;Also: does this apply to 2017 taxes? Or does it start with 2018 taxes?&#x27;</span>,
   <span class="hljs-string">&#x27;This article explains both the House and senate bills, including the proposed changes to your income taxes based on your income level. URL_0&#x27;</span>],
  <span class="hljs-string">&#x27;score&#x27;</span>: [<span class="hljs-number">21</span>, <span class="hljs-number">19</span>, <span class="hljs-number">5</span>, <span class="hljs-number">3</span>],
  <span class="hljs-string">&#x27;text_urls&#x27;</span>: [[],
   [],
   [],
   [<span class="hljs-string">&#x27;https://www.investopedia.com/news/trumps-tax-reform-what-can-be-done/&#x27;</span>]]},
 <span class="hljs-string">&#x27;title_urls&#x27;</span>: [<span class="hljs-string">&#x27;url&#x27;</span>],
 <span class="hljs-string">&#x27;selftext_urls&#x27;</span>: [<span class="hljs-string">&#x27;url&#x27;</span>]}`,wrap:!1}}),is=new Vs({props:{title:"معالجة مسبقة (Preprocess)",local:"معالجة-مسبقة-preprocess",headingTag:"h2"}}),ms=new Nl({props:{id:"8PmhEIXhBvI"}}),cs=new D({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJkaXN0aWxiZXJ0JTJGZGlzdGlscm9iZXJ0YS1iYXNlJTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;distilbert/distilroberta-base&quot;</span>)`,wrap:!1}}),Ms=new D({props:{code:"ZWxpNSUyMCUzRCUyMGVsaTUuZmxhdHRlbigpJTBBZWxpNSU1QiUyMnRyYWluJTIyJTVEJTVCMCU1RA==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>eli5 = eli5.flatten()
<span class="hljs-meta">&gt;&gt;&gt; </span>eli5[<span class="hljs-string">&quot;train&quot;</span>][<span class="hljs-number">0</span>]
{<span class="hljs-string">&#x27;q_id&#x27;</span>: <span class="hljs-string">&#x27;7h191n&#x27;</span>,
 <span class="hljs-string">&#x27;title&#x27;</span>: <span class="hljs-string">&#x27;What does the tax bill that was passed today mean? How will it affect Americans in each tax bracket?&#x27;</span>,
 <span class="hljs-string">&#x27;selftext&#x27;</span>: <span class="hljs-string">&#x27;&#x27;</span>,
 <span class="hljs-string">&#x27;category&#x27;</span>: <span class="hljs-string">&#x27;Economics&#x27;</span>,
 <span class="hljs-string">&#x27;subreddit&#x27;</span>: <span class="hljs-string">&#x27;explainlikeimfive&#x27;</span>,
 <span class="hljs-string">&#x27;answers.a_id&#x27;</span>: [<span class="hljs-string">&#x27;dqnds8l&#x27;</span>, <span class="hljs-string">&#x27;dqnd1jl&#x27;</span>, <span class="hljs-string">&#x27;dqng3i1&#x27;</span>, <span class="hljs-string">&#x27;dqnku5x&#x27;</span>],
 <span class="hljs-string">&#x27;answers.text&#x27;</span>: [<span class="hljs-string">&quot;The tax bill is 500 pages long and there were a lot of changes still going on right to the end. It&#x27;s not just an adjustment to the income tax brackets, it&#x27;s a whole bunch of changes. As such there is no good answer to your question. The big take aways are: - Big reduction in corporate income tax rate will make large companies very happy. - Pass through rate change will make certain styles of business (law firms, hedge funds) extremely happy - Income tax changes are moderate, and are set to expire (though it&#x27;s the kind of thing that might just always get re-applied without being made permanent) - People in high tax states (California, New York) lose out, and many of them will end up with their taxes raised.&quot;</span>,
  <span class="hljs-string">&#x27;None yet. It has to be reconciled with a vastly different house bill and then passed again.&#x27;</span>,
  <span class="hljs-string">&#x27;Also: does this apply to 2017 taxes? Or does it start with 2018 taxes?&#x27;</span>,
  <span class="hljs-string">&#x27;This article explains both the House and senate bills, including the proposed changes to your income taxes based on your income level. URL_0&#x27;</span>],
 <span class="hljs-string">&#x27;answers.score&#x27;</span>: [<span class="hljs-number">21</span>, <span class="hljs-number">19</span>, <span class="hljs-number">5</span>, <span class="hljs-number">3</span>],
 <span class="hljs-string">&#x27;answers.text_urls&#x27;</span>: [[],
  [],
  [],
  [<span class="hljs-string">&#x27;https://www.investopedia.com/news/trumps-tax-reform-what-can-be-done/&#x27;</span>]],
 <span class="hljs-string">&#x27;title_urls&#x27;</span>: [<span class="hljs-string">&#x27;url&#x27;</span>],
 <span class="hljs-string">&#x27;selftext_urls&#x27;</span>: [<span class="hljs-string">&#x27;url&#x27;</span>]}`,wrap:!1}}),js=new D({props:{code:"ZGVmJTIwcHJlcHJvY2Vzc19mdW5jdGlvbihleGFtcGxlcyklM0ElMEElMjAlMjAlMjAlMjByZXR1cm4lMjB0b2tlbml6ZXIoJTVCJTIyJTIwJTIyLmpvaW4oeCklMjBmb3IlMjB4JTIwaW4lMjBleGFtcGxlcyU1QiUyMmFuc3dlcnMudGV4dCUyMiU1RCU1RCk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">preprocess_function</span>(<span class="hljs-params">examples</span>):
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> tokenizer([<span class="hljs-string">&quot; &quot;</span>.join(x) <span class="hljs-keyword">for</span> x <span class="hljs-keyword">in</span> examples[<span class="hljs-string">&quot;answers.text&quot;</span>]])`,wrap:!1}}),ds=new D({props:{code:"dG9rZW5pemVkX2VsaTUlMjAlM0QlMjBlbGk1Lm1hcCglMEElMjAlMjAlMjAlMjBwcmVwcm9jZXNzX2Z1bmN0aW9uJTJDJTBBJTIwJTIwJTIwJTIwYmF0Y2hlZCUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjBudW1fcHJvYyUzRDQlMkMlMEElMjAlMjAlMjAlMjByZW1vdmVfY29sdW1ucyUzRGVsaTUlNUIlMjJ0cmFpbiUyMiU1RC5jb2x1bW5fbmFtZXMlMkMlMEEp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>tokenized_eli5 = eli5.<span class="hljs-built_in">map</span>(
<span class="hljs-meta">... </span>    preprocess_function,
<span class="hljs-meta">... </span>    batched=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>    num_proc=<span class="hljs-number">4</span>,
<span class="hljs-meta">... </span>    remove_columns=eli5[<span class="hljs-string">&quot;train&quot;</span>].column_names,
<span class="hljs-meta">... </span>)`,wrap:!1}}),ws=new D({props:{code:"YmxvY2tfc2l6ZSUyMCUzRCUyMDEyOCUwQSUwQWRlZiUyMGdyb3VwX3RleHRzKGV4YW1wbGVzKSUzQSUwQSUyMCUyMCUyMCUyMCUyMyUyMCVEOCVBQSVEOCVBQyVEOSU4NSVEOSU4QSVEOCVCOSUyMCVEOCVBQyVEOSU4NSVEOSU4QSVEOCVCOSUyMCVEOCVBNyVEOSU4NCVEOSU4NiVEOCVCNSVEOSU4OCVEOCVCNS4lMEElMjAlMjAlMjAlMjBjb25jYXRlbmF0ZWRfZXhhbXBsZXMlMjAlM0QlMjAlN0JrJTNBJTIwc3VtKGV4YW1wbGVzJTVCayU1RCUyQyUyMCU1QiU1RCklMjBmb3IlMjBrJTIwaW4lMjBleGFtcGxlcy5rZXlzKCklN0QlMEElMjAlMjAlMjAlMjB0b3RhbF9sZW5ndGglMjAlM0QlMjBsZW4oY29uY2F0ZW5hdGVkX2V4YW1wbGVzJTVCbGlzdChleGFtcGxlcy5rZXlzKCkpJTVCMCU1RCU1RCklMEElMjAlMjAlMjAlMjAlMjMlMjAlRDklODYlRDglQUElRDglQUMlRDglQTclRDklODclRDklODQlMjAlRDglQTclRDklODQlRDglQUMlRDglQjIlRDglQTElMjAlRDglQTclRDklODQlRDklODUlRDglQUElRDglQTglRDklODIlRDklOEElMjAlRDglQTclRDklODQlRDglQjUlRDglQkElRDklOEElRDglQjElRDglOEMlMjAlRDklOEElRDklODUlRDklODMlRDklODYlRDklODYlRDglQTclMjAlRDglQTUlRDglQjYlRDglQTclRDklODElRDglQTklMjAlRDglQTclRDklODQlRDglQUQlRDglQjQlRDklODglMjAlRDglQTUlRDglQjAlRDglQTclMjAlRDklODMlRDglQTclRDklODYlMjAlRDglQTclRDklODQlRDklODYlRDklODUlRDklODglRDglQjAlRDglQUMlMjAlRDklOEElRDglQUYlRDglQjklRDklODUlRDklODclMjAlRDglQTglRDglQUYlRDklODQlRDglQTclRDklOEIlMjAlRDklODUlRDklODYlMjAlRDklODclRDglQjAlRDglQTclMjAlRDglQTclRDklODQlRDglQTUlRDglQjMlRDklODIlRDglQTclRDglQjclRDglOEMlMjAlRDklOEElRDklODUlRDklODMlRDklODYlRDklODMlMEElMjAlMjAlMjAlMjAlMjMlMjAlRDglQUElRDglQUUlRDglQjUlRDklOEElRDglQjUlMjAlRDklODclRDglQjAlRDglQTclMjAlRDglQTclRDklODQlRDglQUMlRDglQjIlRDglQTElMjAlRDglQUQlRDglQjMlRDglQTglMjAlRDglQTclRDglQUQlRDglQUElRDklOEElRDglQTclRDglQUMlRDglQTclRDglQUElRDklODMuJTBBJTIwJTIwJTIwJTIwaWYlMjB0b3RhbF9sZW5ndGglMjAlM0UlM0QlMjBibG9ja19zaXplJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwdG90YWxfbGVuZ3RoJTIwJTNEJTIwKHRvdGFsX2xlbmd0aCUyMCUyRiUyRiUyMGJsb2NrX3NpemUpJTIwKiUyMGJsb2NrX3NpemUlMEElMjAlMjAlMjAlMjAlMjMlMjAlRDglQUElRDklODIlRDglQjMlRDklOEElRDklODUlRDklODclRDglQTclMjAlRDglQTUlRDklODQlRDklODklMjAlRDglQTMlRDglQUMlRDglQjIlRDglQTclRDglQTElMjAlRDglQTglRDglQUQlRDglQUMlRDklODUlMjBibG9ja19zaXplLiUwQSUyMCUyMCUyMCUyMHJlc3VsdCUyMCUzRCUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGslM0ElMjAlNUJ0JTVCaSUyMCUzQSUyMGklMjAlMkIlMjBibG9ja19zaXplJTVEJTIwZm9yJTIwaSUyMGluJTIwcmFuZ2UoMCUyQyUyMHRvdGFsX2xlbmd0aCUyQyUyMGJsb2NrX3NpemUpJTVEJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwZm9yJTIwayUyQyUyMHQlMjBpbiUyMGNvbmNhdGVuYXRlZF9leGFtcGxlcy5pdGVtcygpJTBBJTIwJTIwJTIwJTIwJTdEJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwcmVzdWx0",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>block_size = <span class="hljs-number">128</span>

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">group_texts</span>(<span class="hljs-params">examples</span>):
<span class="hljs-meta">... </span>    <span class="hljs-comment"># تجميع جميع النصوص.</span>
<span class="hljs-meta">... </span>    concatenated_examples = {k: <span class="hljs-built_in">sum</span>(examples[k], []) <span class="hljs-keyword">for</span> k <span class="hljs-keyword">in</span> examples.keys()}
<span class="hljs-meta">... </span>    total_length = <span class="hljs-built_in">len</span>(concatenated_examples[<span class="hljs-built_in">list</span>(examples.keys())[<span class="hljs-number">0</span>]])
<span class="hljs-meta">... </span>    <span class="hljs-comment"># نتجاهل الجزء المتبقي الصغير، يمكننا إضافة الحشو إذا كان النموذج يدعمه بدلاً من هذا الإسقاط، يمكنك</span>
<span class="hljs-meta">... </span>    <span class="hljs-comment"># تخصيص هذا الجزء حسب احتياجاتك.</span>
<span class="hljs-meta">... </span>    <span class="hljs-keyword">if</span> total_length &gt;= block_size:
<span class="hljs-meta">... </span>        total_length = (total_length // block_size) * block_size
<span class="hljs-meta">... </span>    <span class="hljs-comment"># تقسيمها إلى أجزاء بحجم block_size.</span>
<span class="hljs-meta">... </span>    result = {
<span class="hljs-meta">... </span>        k: [t[i : i + block_size] <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> <span class="hljs-built_in">range</span>(<span class="hljs-number">0</span>, total_length, block_size)]
<span class="hljs-meta">... </span>        <span class="hljs-keyword">for</span> k, t <span class="hljs-keyword">in</span> concatenated_examples.items()
<span class="hljs-meta">... </span>    }
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> result`,wrap:!1}}),Ts=new D({props:{code:"bG1fZGF0YXNldCUyMCUzRCUyMHRva2VuaXplZF9lbGk1Lm1hcChncm91cF90ZXh0cyUyQyUyMGJhdGNoZWQlM0RUcnVlJTJDJTIwbnVtX3Byb2MlM0Q0KQ==",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>lm_dataset = tokenized_eli5.<span class="hljs-built_in">map</span>(group_texts, batched=<span class="hljs-literal">True</span>, num_proc=<span class="hljs-number">4</span>)',wrap:!1}}),q=new kl({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[it],pytorch:[pt]},$$scope:{ctx:J}}}),Us=new Vs({props:{title:"التدريب (Train)",local:"التدريب-train",headingTag:"h2"}}),O=new kl({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[ht],pytorch:[ct]},$$scope:{ctx:J}}}),P=new wl({props:{$$slots:{default:[ft]},$$scope:{ctx:J}}}),Rs=new Vs({props:{title:"الاستدلال",local:"الاستدلال",headingTag:"h2"}}),Cs=new D({props:{code:"dGV4dCUyMCUzRCUyMCUyMlRoZSUyME1pbGt5JTIwV2F5JTIwaXMlMjBhJTIwJTNDbWFzayUzRSUyMGdhbGF4eS4lMjI=",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>text = <span class="hljs-string">&quot;The Milky Way is a &lt;mask&gt; galaxy.&quot;</span>',wrap:!1}}),Ds=new D({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBbWFza19maWxsZXIlMjAlM0QlMjBwaXBlbGluZSglMjJmaWxsLW1hc2slMjIlMkMlMjAlMjJ1c2VybmFtZSUyRm15X2F3ZXNvbWVfZWxpNV9tbG1fbW9kZWwlMjIpJTBBbWFza19maWxsZXIodGV4dCUyQyUyMHRvcF9rJTNEMyk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

<span class="hljs-meta">&gt;&gt;&gt; </span>mask_filler = pipeline(<span class="hljs-string">&quot;fill-mask&quot;</span>, <span class="hljs-string">&quot;username/my_awesome_eli5_mlm_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>mask_filler(text, top_k=<span class="hljs-number">3</span>)
[{<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.5150994658470154</span>,
  <span class="hljs-string">&#x27;token&#x27;</span>: <span class="hljs-number">21300</span>,
  <span class="hljs-string">&#x27;token_str&#x27;</span>: <span class="hljs-string">&#x27; spiral&#x27;</span>,
  <span class="hljs-string">&#x27;sequence&#x27;</span>: <span class="hljs-string">&#x27;The Milky Way is a spiral galaxy.&#x27;</span>},
 {<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.07087188959121704</span>,
  <span class="hljs-string">&#x27;token&#x27;</span>: <span class="hljs-number">2232</span>,
  <span class="hljs-string">&#x27;token_str&#x27;</span>: <span class="hljs-string">&#x27; massive&#x27;</span>,
  <span class="hljs-string">&#x27;sequence&#x27;</span>: <span class="hljs-string">&#x27;The Milky Way is a massive galaxy.&#x27;</span>},
 {<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.06434620916843414</span>,
  <span class="hljs-string">&#x27;token&#x27;</span>: <span class="hljs-number">650</span>,
  <span class="hljs-string">&#x27;token_str&#x27;</span>: <span class="hljs-string">&#x27; small&#x27;</span>,
  <span class="hljs-string">&#x27;sequence&#x27;</span>: <span class="hljs-string">&#x27;The Milky Way is a small galaxy.&#x27;</span>}]`,wrap:!1}}),K=new kl({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[bt],pytorch:[ut]},$$scope:{ctx:J}}}),Gs=new et({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/ar/tasks/masked_language_modeling.md"}}),{c(){l=$("meta"),c=i(),t=$("p"),o=i(),f(h.$$.fragment),M=i(),f(C.$$.fragment),G=i(),f(Z.$$.fragment),Q=i(),_=$("p"),_.textContent=B,W=i(),x=$("p"),x.textContent=v,p=i(),T=$("ol"),T.innerHTML=z,E=i(),f(V.$$.fragment),F=i(),H=$("p"),H.textContent=A,X=i(),f(I.$$.fragment),g=i(),R=$("p"),R.textContent=N,S=i(),f(Y.$$.fragment),ls=i(),f(L.$$.fragment),r=i(),U=$("p"),U.innerHTML=Ws,Is=i(),f(ts.$$.fragment),Es=i(),es=$("p"),es.innerHTML=Tl,Xs=i(),f(as.$$.fragment),Bs=i(),ns=$("p"),ns.textContent=xl,zs=i(),f(ps.$$.fragment),Fs=i(),rs=$("p"),rs.innerHTML=Ul,Hs=i(),f(is.$$.fragment),As=i(),f(ms.$$.fragment),Ys=i(),os=$("p"),os.innerHTML=Rl,Ns=i(),f(cs.$$.fragment),Ls=i(),gs=$("p"),gs.innerHTML=_l,Ss=i(),f(Ms.$$.fragment),qs=i(),hs=$("p"),hs.innerHTML=Jl,Os=i(),fs=$("p"),fs.textContent=Cl,Ps=i(),f(js.$$.fragment),Ks=i(),us=$("p"),us.innerHTML=Zl,sl=i(),f(ds.$$.fragment),ll=i(),bs=$("p"),bs.textContent=Dl,tl=i(),ys=$("p"),ys.textContent=Gl,el=i(),$s=$("ul"),$s.innerHTML=Ql,al=i(),f(ws.$$.fragment),nl=i(),ks=$("p"),ks.innerHTML=Wl,pl=i(),f(Ts.$$.fragment),rl=i(),xs=$("p"),xs.innerHTML=vl,il=i(),f(q.$$.fragment),ml=i(),f(Us.$$.fragment),ol=i(),f(O.$$.fragment),cl=i(),f(P.$$.fragment),gl=i(),f(Rs.$$.fragment),Ml=i(),_s=$("p"),_s.textContent=Vl,hl=i(),Js=$("p"),Js.innerHTML=Il,fl=i(),f(Cs.$$.fragment),jl=i(),Zs=$("p"),Zs.innerHTML=El,ul=i(),f(Ds.$$.fragment),dl=i(),f(K.$$.fragment),bl=i(),f(Gs.$$.fragment),yl=i(),vs=$("p"),this.h()},l(s){const n=Pl("svelte-u9bgzb",document.head);l=w(n,"META",{name:!0,content:!0}),n.forEach(e),c=m(s),t=w(s,"P",{}),Al(t).forEach(e),o=m(s),j(h.$$.fragment,s),M=m(s),j(C.$$.fragment,s),G=m(s),j(Z.$$.fragment,s),Q=m(s),_=w(s,"P",{"data-svelte-h":!0}),k(_)!=="svelte-197dis2"&&(_.textContent=B),W=m(s),x=w(s,"P",{"data-svelte-h":!0}),k(x)!=="svelte-lp8700"&&(x.textContent=v),p=m(s),T=w(s,"OL",{"data-svelte-h":!0}),k(T)!=="svelte-bqqmbo"&&(T.innerHTML=z),E=m(s),j(V.$$.fragment,s),F=m(s),H=w(s,"P",{"data-svelte-h":!0}),k(H)!=="svelte-93upt2"&&(H.textContent=A),X=m(s),j(I.$$.fragment,s),g=m(s),R=w(s,"P",{"data-svelte-h":!0}),k(R)!=="svelte-cvukg2"&&(R.textContent=N),S=m(s),j(Y.$$.fragment,s),ls=m(s),j(L.$$.fragment,s),r=m(s),U=w(s,"P",{"data-svelte-h":!0}),k(U)!=="svelte-lm688b"&&(U.innerHTML=Ws),Is=m(s),j(ts.$$.fragment,s),Es=m(s),es=w(s,"P",{"data-svelte-h":!0}),k(es)!=="svelte-xofc0r"&&(es.innerHTML=Tl),Xs=m(s),j(as.$$.fragment,s),Bs=m(s),ns=w(s,"P",{"data-svelte-h":!0}),k(ns)!=="svelte-1e1soci"&&(ns.textContent=xl),zs=m(s),j(ps.$$.fragment,s),Fs=m(s),rs=w(s,"P",{"data-svelte-h":!0}),k(rs)!=="svelte-ilavd2"&&(rs.innerHTML=Ul),Hs=m(s),j(is.$$.fragment,s),As=m(s),j(ms.$$.fragment,s),Ys=m(s),os=w(s,"P",{"data-svelte-h":!0}),k(os)!=="svelte-1lnbm1y"&&(os.innerHTML=Rl),Ns=m(s),j(cs.$$.fragment,s),Ls=m(s),gs=w(s,"P",{"data-svelte-h":!0}),k(gs)!=="svelte-1mesglz"&&(gs.innerHTML=_l),Ss=m(s),j(Ms.$$.fragment,s),qs=m(s),hs=w(s,"P",{"data-svelte-h":!0}),k(hs)!=="svelte-zkvir4"&&(hs.innerHTML=Jl),Os=m(s),fs=w(s,"P",{"data-svelte-h":!0}),k(fs)!=="svelte-1xqw8re"&&(fs.textContent=Cl),Ps=m(s),j(js.$$.fragment,s),Ks=m(s),us=w(s,"P",{"data-svelte-h":!0}),k(us)!=="svelte-1q90avs"&&(us.innerHTML=Zl),sl=m(s),j(ds.$$.fragment,s),ll=m(s),bs=w(s,"P",{"data-svelte-h":!0}),k(bs)!=="svelte-1o9vmyd"&&(bs.textContent=Dl),tl=m(s),ys=w(s,"P",{"data-svelte-h":!0}),k(ys)!=="svelte-16ind4"&&(ys.textContent=Gl),el=m(s),$s=w(s,"UL",{"data-svelte-h":!0}),k($s)!=="svelte-1sugnmu"&&($s.innerHTML=Ql),al=m(s),j(ws.$$.fragment,s),nl=m(s),ks=w(s,"P",{"data-svelte-h":!0}),k(ks)!=="svelte-pr861r"&&(ks.innerHTML=Wl),pl=m(s),j(Ts.$$.fragment,s),rl=m(s),xs=w(s,"P",{"data-svelte-h":!0}),k(xs)!=="svelte-1kd6cis"&&(xs.innerHTML=vl),il=m(s),j(q.$$.fragment,s),ml=m(s),j(Us.$$.fragment,s),ol=m(s),j(O.$$.fragment,s),cl=m(s),j(P.$$.fragment,s),gl=m(s),j(Rs.$$.fragment,s),Ml=m(s),_s=w(s,"P",{"data-svelte-h":!0}),k(_s)!=="svelte-ltiwph"&&(_s.textContent=Vl),hl=m(s),Js=w(s,"P",{"data-svelte-h":!0}),k(Js)!=="svelte-1tcacui"&&(Js.innerHTML=Il),fl=m(s),j(Cs.$$.fragment,s),jl=m(s),Zs=w(s,"P",{"data-svelte-h":!0}),k(Zs)!=="svelte-1deksa0"&&(Zs.innerHTML=El),ul=m(s),j(Ds.$$.fragment,s),dl=m(s),j(K.$$.fragment,s),bl=m(s),j(Gs.$$.fragment,s),yl=m(s),vs=w(s,"P",{}),Al(vs).forEach(e),this.h()},h(){Yl(l,"name","hf:doc:metadata"),Yl(l,"content",$t)},m(s,n){Kl(document.head,l),a(s,c,n),a(s,t,n),a(s,o,n),u(h,s,n),a(s,M,n),u(C,s,n),a(s,G,n),u(Z,s,n),a(s,Q,n),a(s,_,n),a(s,W,n),a(s,x,n),a(s,p,n),a(s,T,n),a(s,E,n),u(V,s,n),a(s,F,n),a(s,H,n),a(s,X,n),u(I,s,n),a(s,g,n),a(s,R,n),a(s,S,n),u(Y,s,n),a(s,ls,n),u(L,s,n),a(s,r,n),a(s,U,n),a(s,Is,n),u(ts,s,n),a(s,Es,n),a(s,es,n),a(s,Xs,n),u(as,s,n),a(s,Bs,n),a(s,ns,n),a(s,zs,n),u(ps,s,n),a(s,Fs,n),a(s,rs,n),a(s,Hs,n),u(is,s,n),a(s,As,n),u(ms,s,n),a(s,Ys,n),a(s,os,n),a(s,Ns,n),u(cs,s,n),a(s,Ls,n),a(s,gs,n),a(s,Ss,n),u(Ms,s,n),a(s,qs,n),a(s,hs,n),a(s,Os,n),a(s,fs,n),a(s,Ps,n),u(js,s,n),a(s,Ks,n),a(s,us,n),a(s,sl,n),u(ds,s,n),a(s,ll,n),a(s,bs,n),a(s,tl,n),a(s,ys,n),a(s,el,n),a(s,$s,n),a(s,al,n),u(ws,s,n),a(s,nl,n),a(s,ks,n),a(s,pl,n),u(Ts,s,n),a(s,rl,n),a(s,xs,n),a(s,il,n),u(q,s,n),a(s,ml,n),u(Us,s,n),a(s,ol,n),u(O,s,n),a(s,cl,n),u(P,s,n),a(s,gl,n),u(Rs,s,n),a(s,Ml,n),a(s,_s,n),a(s,hl,n),a(s,Js,n),a(s,fl,n),u(Cs,s,n),a(s,jl,n),a(s,Zs,n),a(s,ul,n),u(Ds,s,n),a(s,dl,n),u(K,s,n),a(s,bl,n),u(Gs,s,n),a(s,yl,n),a(s,vs,n),$l=!0},p(s,[n]){const Xl={};n&2&&(Xl.$$scope={dirty:n,ctx:s}),V.$set(Xl);const Bl={};n&2&&(Bl.$$scope={dirty:n,ctx:s}),q.$set(Bl);const zl={};n&2&&(zl.$$scope={dirty:n,ctx:s}),O.$set(zl);const Fl={};n&2&&(Fl.$$scope={dirty:n,ctx:s}),P.$set(Fl);const Hl={};n&2&&(Hl.$$scope={dirty:n,ctx:s}),K.$set(Hl)},i(s){$l||(d(h.$$.fragment,s),d(C.$$.fragment,s),d(Z.$$.fragment,s),d(V.$$.fragment,s),d(I.$$.fragment,s),d(Y.$$.fragment,s),d(L.$$.fragment,s),d(ts.$$.fragment,s),d(as.$$.fragment,s),d(ps.$$.fragment,s),d(is.$$.fragment,s),d(ms.$$.fragment,s),d(cs.$$.fragment,s),d(Ms.$$.fragment,s),d(js.$$.fragment,s),d(ds.$$.fragment,s),d(ws.$$.fragment,s),d(Ts.$$.fragment,s),d(q.$$.fragment,s),d(Us.$$.fragment,s),d(O.$$.fragment,s),d(P.$$.fragment,s),d(Rs.$$.fragment,s),d(Cs.$$.fragment,s),d(Ds.$$.fragment,s),d(K.$$.fragment,s),d(Gs.$$.fragment,s),$l=!0)},o(s){b(h.$$.fragment,s),b(C.$$.fragment,s),b(Z.$$.fragment,s),b(V.$$.fragment,s),b(I.$$.fragment,s),b(Y.$$.fragment,s),b(L.$$.fragment,s),b(ts.$$.fragment,s),b(as.$$.fragment,s),b(ps.$$.fragment,s),b(is.$$.fragment,s),b(ms.$$.fragment,s),b(cs.$$.fragment,s),b(Ms.$$.fragment,s),b(js.$$.fragment,s),b(ds.$$.fragment,s),b(ws.$$.fragment,s),b(Ts.$$.fragment,s),b(q.$$.fragment,s),b(Us.$$.fragment,s),b(O.$$.fragment,s),b(P.$$.fragment,s),b(Rs.$$.fragment,s),b(Cs.$$.fragment,s),b(Ds.$$.fragment,s),b(K.$$.fragment,s),b(Gs.$$.fragment,s),$l=!1},d(s){s&&(e(c),e(t),e(o),e(M),e(G),e(Q),e(_),e(W),e(x),e(p),e(T),e(E),e(F),e(H),e(X),e(g),e(R),e(S),e(ls),e(r),e(U),e(Is),e(Es),e(es),e(Xs),e(Bs),e(ns),e(zs),e(Fs),e(rs),e(Hs),e(As),e(Ys),e(os),e(Ns),e(Ls),e(gs),e(Ss),e(qs),e(hs),e(Os),e(fs),e(Ps),e(Ks),e(us),e(sl),e(ll),e(bs),e(tl),e(ys),e(el),e($s),e(al),e(nl),e(ks),e(pl),e(rl),e(xs),e(il),e(ml),e(ol),e(cl),e(gl),e(Ml),e(_s),e(hl),e(Js),e(fl),e(jl),e(Zs),e(ul),e(dl),e(bl),e(yl),e(vs)),e(l),y(h,s),y(C,s),y(Z,s),y(V,s),y(I,s),y(Y,s),y(L,s),y(ts,s),y(as,s),y(ps,s),y(is,s),y(ms,s),y(cs,s),y(Ms,s),y(js,s),y(ds,s),y(ws,s),y(Ts,s),y(q,s),y(Us,s),y(O,s),y(P,s),y(Rs,s),y(Cs,s),y(Ds,s),y(K,s),y(Gs,s)}}}const $t='{"title":"نمذجة اللغة المقنعة (Masked language modeling)","local":"نمذجة-اللغة-المقنعة-masked-language-modeling","sections":[{"title":"تحميل مجموعة بيانات ELI5","local":"تحميل-مجموعة-بيانات-eli5","sections":[],"depth":2},{"title":"معالجة مسبقة (Preprocess)","local":"معالجة-مسبقة-preprocess","sections":[],"depth":2},{"title":"التدريب (Train)","local":"التدريب-train","sections":[],"depth":2},{"title":"الاستدلال","local":"الاستدلال","sections":[],"depth":2}],"depth":1}';function wt(J){return Sl(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Zt extends ql{constructor(l){super(),Ol(this,l,wt,yt,Ll,{})}}export{Zt as component};
