import{s as At,o as Lt,n as pe}from"../chunks/scheduler.5eb9d175.js";import{S as Pt,i as Dt,g,s as i,r as f,A as Kt,h as $,f as l,c as p,j as qt,u,x as T,k as Qt,y as Ot,a,v as y,d,t as M,w as b,m as es,n as ts}from"../chunks/index.fcdcb606.js";import{T as Jt}from"../chunks/Tip.9272e506.js";import{Y as ss}from"../chunks/Youtube.398fab2b.js";import{C}from"../chunks/CodeBlock.a7036e06.js";import{D as ls}from"../chunks/DocNotebookDropdown.2547080e.js";import{F as kt,M as Se}from"../chunks/Markdown.927e6a50.js";import{H as Ne,E as as}from"../chunks/EditOnGithub.98bf070f.js";function ns(_){let s,c='لمشاهدة جميع البنى ونقاط التفتيش المتوافقة مع هذه المهمة، نوصي بالتحقق من <a href="https://huggingface.co/tasks/summarization" rel="nofollow">صفحة المهمة</a>';return{c(){s=g("p"),s.innerHTML=c},l(t){s=$(t,"P",{"data-svelte-h":!0}),T(s)!=="svelte-r8nxhd"&&(s.innerHTML=c)},m(t,m){a(t,s,m)},p:pe,d(t){t&&l(s)}}}function rs(_){let s,c;return s=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERhdGFDb2xsYXRvckZvclNlcTJTZXElMEElMEFkYXRhX2NvbGxhdG9yJTIwJTNEJTIwRGF0YUNvbGxhdG9yRm9yU2VxMlNlcSh0b2tlbml6ZXIlM0R0b2tlbml6ZXIlMkMlMjBtb2RlbCUzRGNoZWNrcG9pbnQp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DataCollatorForSeq2Seq

<span class="hljs-meta">&gt;&gt;&gt; </span>data_collator = DataCollatorForSeq2Seq(tokenizer=tokenizer, model=checkpoint)`,wrap:!1}}),{c(){f(s.$$.fragment)},l(t){u(s.$$.fragment,t)},m(t,m){y(s,t,m),c=!0},p:pe,i(t){c||(d(s.$$.fragment,t),c=!0)},o(t){M(s.$$.fragment,t),c=!1},d(t){b(s,t)}}}function os(_){let s,c;return s=new Se({props:{$$slots:{default:[rs]},$$scope:{ctx:_}}}),{c(){f(s.$$.fragment)},l(t){u(s.$$.fragment,t)},m(t,m){y(s,t,m),c=!0},p(t,m){const j={};m&2&&(j.$$scope={dirty:m,ctx:t}),s.$set(j)},i(t){c||(d(s.$$.fragment,t),c=!0)},o(t){M(s.$$.fragment,t),c=!1},d(t){b(s,t)}}}function is(_){let s,c;return s=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERhdGFDb2xsYXRvckZvclNlcTJTZXElMEElMEFkYXRhX2NvbGxhdG9yJTIwJTNEJTIwRGF0YUNvbGxhdG9yRm9yU2VxMlNlcSh0b2tlbml6ZXIlM0R0b2tlbml6ZXIlMkMlMjBtb2RlbCUzRGNoZWNrcG9pbnQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnRmJTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DataCollatorForSeq2Seq

<span class="hljs-meta">&gt;&gt;&gt; </span>data_collator = DataCollatorForSeq2Seq(tokenizer=tokenizer, model=checkpoint, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)`,wrap:!1}}),{c(){f(s.$$.fragment)},l(t){u(s.$$.fragment,t)},m(t,m){y(s,t,m),c=!0},p:pe,i(t){c||(d(s.$$.fragment,t),c=!0)},o(t){M(s.$$.fragment,t),c=!1},d(t){b(s,t)}}}function ps(_){let s,c;return s=new Se({props:{$$slots:{default:[is]},$$scope:{ctx:_}}}),{c(){f(s.$$.fragment)},l(t){u(s.$$.fragment,t)},m(t,m){y(s,t,m),c=!0},p(t,m){const j={};m&2&&(j.$$scope={dirty:m,ctx:t}),s.$set(j)},i(t){c||(d(s.$$.fragment,t),c=!0)},o(t){M(s.$$.fragment,t),c=!1},d(t){b(s,t)}}}function cs(_){let s,c='إذا لم تكن معتادًا على ضبط نموذج باستخدام <code>Trainer</code>، فألق نظرة على البرنامج التعليمي الأساسي <a href="../training#train-with-pytorch-trainer">هنا</a>!';return{c(){s=g("p"),s.innerHTML=c},l(t){s=$(t,"P",{"data-svelte-h":!0}),T(s)!=="svelte-1dylxqo"&&(s.innerHTML=c)},m(t,m){a(t,s,m)},p:pe,d(t){t&&l(s)}}}function ms(_){let s,c,t,m="أنت جاهز لبدء تدريب نموذجك الآن! قم بتحميل T5 باستخدام <code>AutoModelForSeq2SeqLM</code>:",j,Z,X,G,v="في هذه المرحلة، لم يتبق سوى ثلاث خطوات:",V,k,I="<li>حدد مُعامِلات التدريب الخاصة بك في <code>Seq2SeqTrainingArguments</code>. المعامل الوحيد المطلوب هو <code>output_dir</code> الذي يُحدد مكان حفظ نموذجك. ستدفع هذا النموذج إلى Hub عن طريق تعيين <code>push_to_hub=True</code> (تحتاج إلى تسجيل الدخول إلى Hugging Face لتحميل نموذجك). في نهاية كل حقبة، سيقوم <code>Trainer</code> بتقييم مقياس ROUGE وحفظ نقطة تفتيش التدريب.</li> <li>مرر مُعامِلات التدريب إلى <code>Seq2SeqTrainer</code> جنبًا إلى جنب مع النموذج ومجموعة البيانات والمُحلِّل اللغوي وجامع البيانات ودالة <code>compute_metrics</code>.</li> <li>استدعِ <code>train()</code> لضبط نموذجك.</li>",W,J,R,o,U="بمجرد اكتمال التدريب، شارك نموذجك مع Hub باستخدام طريقة <code>push_to_hub()</code> حتى يتمكن الجميع من استخدام نموذجك:",F,z,H;return s=new Jt({props:{$$slots:{default:[cs]},$$scope:{ctx:_}}}),Z=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvclNlcTJTZXFMTSUyQyUyMFNlcTJTZXFUcmFpbmluZ0FyZ3VtZW50cyUyQyUyMFNlcTJTZXFUcmFpbmVyJTBBJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JTZXEyU2VxTE0uZnJvbV9wcmV0cmFpbmVkKGNoZWNrcG9pbnQp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForSeq2SeqLM, Seq2SeqTrainingArguments, Seq2SeqTrainer

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForSeq2SeqLM.from_pretrained(checkpoint)`,wrap:!1}}),J=new C({props:{code:"dHJhaW5pbmdfYXJncyUyMCUzRCUyMFNlcTJTZXFUcmFpbmluZ0FyZ3VtZW50cyglMEElMjAlMjAlMjAlMjBvdXRwdXRfZGlyJTNEJTIybXlfYXdlc29tZV9iaWxsc3VtX21vZGVsJTIyJTJDJTBBJTIwJTIwJTIwJTIwZXZhbF9zdHJhdGVneSUzRCUyMmVwb2NoJTIyJTJDJTBBJTIwJTIwJTIwJTIwbGVhcm5pbmdfcmF0ZSUzRDJlLTUlMkMlMEElMjAlMjAlMjAlMjBwZXJfZGV2aWNlX3RyYWluX2JhdGNoX3NpemUlM0QxNiUyQyUwQSUyMCUyMCUyMCUyMHBlcl9kZXZpY2VfZXZhbF9iYXRjaF9zaXplJTNEMTYlMkMlMEElMjAlMjAlMjAlMjB3ZWlnaHRfZGVjYXklM0QwLjAxJTJDJTBBJTIwJTIwJTIwJTIwc2F2ZV90b3RhbF9saW1pdCUzRDMlMkMlMEElMjAlMjAlMjAlMjBudW1fdHJhaW5fZXBvY2hzJTNENCUyQyUwQSUyMCUyMCUyMCUyMHByZWRpY3Rfd2l0aF9nZW5lcmF0ZSUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjBmcDE2JTNEVHJ1ZSUyQyUyMCUyM2NoYW5nZSUyMHRvJTIwYmYxNiUzRFRydWUlMjBmb3IlMjBYUFUlMEElMjAlMjAlMjAlMjBwdXNoX3RvX2h1YiUzRFRydWUlMkMlMEEpJTBBJTBBdHJhaW5lciUyMCUzRCUyMFNlcTJTZXFUcmFpbmVyKCUwQSUyMCUyMCUyMCUyMG1vZGVsJTNEbW9kZWwlMkMlMEElMjAlMjAlMjAlMjBhcmdzJTNEdHJhaW5pbmdfYXJncyUyQyUwQSUyMCUyMCUyMCUyMHRyYWluX2RhdGFzZXQlM0R0b2tlbml6ZWRfYmlsbHN1bSU1QiUyMnRyYWluJTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwZXZhbF9kYXRhc2V0JTNEdG9rZW5pemVkX2JpbGxzdW0lNUIlMjJ0ZXN0JTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwcHJvY2Vzc2luZ19jbGFzcyUzRHRva2VuaXplciUyQyUwQSUyMCUyMCUyMCUyMGRhdGFfY29sbGF0b3IlM0RkYXRhX2NvbGxhdG9yJTJDJTBBJTIwJTIwJTIwJTIwY29tcHV0ZV9tZXRyaWNzJTNEY29tcHV0ZV9tZXRyaWNzJTJDJTBBKSUwQSUwQXRyYWluZXIudHJhaW4oKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>training_args = Seq2SeqTrainingArguments(
<span class="hljs-meta">... </span>    output_dir=<span class="hljs-string">&quot;my_awesome_billsum_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>    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>    weight_decay=<span class="hljs-number">0.01</span>,
<span class="hljs-meta">... </span>    save_total_limit=<span class="hljs-number">3</span>,
<span class="hljs-meta">... </span>    num_train_epochs=<span class="hljs-number">4</span>,
<span class="hljs-meta">... </span>    predict_with_generate=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>    fp16=<span class="hljs-literal">True</span>, <span class="hljs-comment">#change to bf16=True for XPU</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 = Seq2SeqTrainer(
<span class="hljs-meta">... </span>    model=model,
<span class="hljs-meta">... </span>    args=training_args,
<span class="hljs-meta">... </span>    train_dataset=tokenized_billsum[<span class="hljs-string">&quot;train&quot;</span>],
<span class="hljs-meta">... </span>    eval_dataset=tokenized_billsum[<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}}),z=new C({props:{code:"dHJhaW5lci5wdXNoX3RvX2h1Yigp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.push_to_hub()',wrap:!1}}),{c(){f(s.$$.fragment),c=i(),t=g("p"),t.innerHTML=m,j=i(),f(Z.$$.fragment),X=i(),G=g("p"),G.textContent=v,V=i(),k=g("ol"),k.innerHTML=I,W=i(),f(J.$$.fragment),R=i(),o=g("p"),o.innerHTML=U,F=i(),f(z.$$.fragment)},l(h){u(s.$$.fragment,h),c=p(h),t=$(h,"P",{"data-svelte-h":!0}),T(t)!=="svelte-1a48e2z"&&(t.innerHTML=m),j=p(h),u(Z.$$.fragment,h),X=p(h),G=$(h,"P",{"data-svelte-h":!0}),T(G)!=="svelte-32ct6g"&&(G.textContent=v),V=p(h),k=$(h,"OL",{"data-svelte-h":!0}),T(k)!=="svelte-18eq8hv"&&(k.innerHTML=I),W=p(h),u(J.$$.fragment,h),R=p(h),o=$(h,"P",{"data-svelte-h":!0}),T(o)!=="svelte-1tbeblz"&&(o.innerHTML=U),F=p(h),u(z.$$.fragment,h)},m(h,x){y(s,h,x),a(h,c,x),a(h,t,x),a(h,j,x),y(Z,h,x),a(h,X,x),a(h,G,x),a(h,V,x),a(h,k,x),a(h,W,x),y(J,h,x),a(h,R,x),a(h,o,x),a(h,F,x),y(z,h,x),H=!0},p(h,x){const B={};x&2&&(B.$$scope={dirty:x,ctx:h}),s.$set(B)},i(h){H||(d(s.$$.fragment,h),d(Z.$$.fragment,h),d(J.$$.fragment,h),d(z.$$.fragment,h),H=!0)},o(h){M(s.$$.fragment,h),M(Z.$$.fragment,h),M(J.$$.fragment,h),M(z.$$.fragment,h),H=!1},d(h){h&&(l(c),l(t),l(j),l(X),l(G),l(V),l(k),l(W),l(R),l(o),l(F)),b(s,h),b(Z,h),b(J,h),b(z,h)}}}function hs(_){let s,c;return s=new Se({props:{$$slots:{default:[ms]},$$scope:{ctx:_}}}),{c(){f(s.$$.fragment)},l(t){u(s.$$.fragment,t)},m(t,m){y(s,t,m),c=!0},p(t,m){const j={};m&2&&(j.$$scope={dirty:m,ctx:t}),s.$set(j)},i(t){c||(d(s.$$.fragment,t),c=!0)},o(t){M(s.$$.fragment,t),c=!1},d(t){b(s,t)}}}function fs(_){let s,c='إذا لم تكن معتادًا على ضبط نموذج باستخدام Keras، فألق نظرة على البرنامج التعليمي الأساسي <a href="../training#train-a-tensorflow-model-with-keras">هنا</a>!';return{c(){s=g("p"),s.innerHTML=c},l(t){s=$(t,"P",{"data-svelte-h":!0}),T(s)!=="svelte-1awyf5t"&&(s.innerHTML=c)},m(t,m){a(t,s,m)},p:pe,d(t){t&&l(s)}}}function us(_){let s,c,t,m,j,Z="ثم يمكنك تحميل T5 باستخدام <code>TFAutoModelForSeq2SeqLM</code>:",X,G,v,V,k="حوّل مجموعات البيانات الخاصة بك إلى تنسيق <code>tf.data.Dataset</code> باستخدام <code>prepare_tf_dataset()</code>:",I,W,J,R,o='قم بتكوين النموذج للتدريب باستخدام <a href="https://keras.io/api/models/model_training_apis/#compile-method" rel="nofollow"><code>compile</code></a>. لاحظ أن جميع نماذج Transformers لديها دالة خسارة ذات صلة بالمهمة افتراضيًا، لذلك لست بحاجة إلى تحديد واحدة ما لم تكن ترغب في ذلك:',U,F,z,H,h='آخر شيئين يجب إعدادهما قبل بدء التدريب هما حساب درجة ROUGE من التنبؤات، وتوفير طريقة لدفع نموذجك إلى Hub. يتم كلاهما باستخدام <a href="../main_classes/keras_callbacks">استدعاءات Keras</a>.',x,B,ce="مرر دالة <code>compute_metrics</code> الخاصة بك إلى <code>KerasMetricCallback</code>:",Y,O,le,N,me="حدد مكان دفع نموذجك ومُحلِّلك اللغوي في <code>PushToHubCallback</code>:",E,ee,ae,S,he="ثم اجمع استدعاءاتك معًا:",q,Q,A,te,fe='أخيرًا، أنت جاهز لبدء تدريب نموذجك! اتصل بـ <a href="https://keras.io/api/models/model_training_apis/#fit-method" rel="nofollow"><code>fit</code></a> مع مجموعات بيانات التدريب والتحقق من الصحة وعدد الحقب واستدعاءاتك لضبط النموذج:',L,P,D,se,ue="بمجرد اكتمال التدريب، يتم تحميل نموذجك تلقائيًا إلى Hub حتى يتمكن الجميع من استخدامه!",K;return s=new Jt({props:{$$slots:{default:[fs]},$$scope:{ctx:_}}}),t=new C({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 C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGQXV0b01vZGVsRm9yU2VxMlNlcUxNJTBBJTBBbW9kZWwlMjAlM0QlMjBURkF1dG9Nb2RlbEZvclNlcTJTZXFMTS5mcm9tX3ByZXRyYWluZWQoY2hlY2twb2ludCk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFAutoModelForSeq2SeqLM

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFAutoModelForSeq2SeqLM.from_pretrained(checkpoint)`,wrap:!1}}),W=new C({props:{code:"dGZfdHJhaW5fc2V0JTIwJTNEJTIwbW9kZWwucHJlcGFyZV90Zl9kYXRhc2V0KCUwQSUyMCUyMCUyMCUyMHRva2VuaXplZF9iaWxsc3VtJTVCJTIydHJhaW4lMjIlNUQlMkMlMEElMjAlMjAlMjAlMjBzaHVmZmxlJTNEVHJ1ZSUyQyUwQSUyMCUyMCUyMCUyMGJhdGNoX3NpemUlM0QxNiUyQyUwQSUyMCUyMCUyMCUyMGNvbGxhdGVfZm4lM0RkYXRhX2NvbGxhdG9yJTJDJTBBKSUwQSUwQXRmX3Rlc3Rfc2V0JTIwJTNEJTIwbW9kZWwucHJlcGFyZV90Zl9kYXRhc2V0KCUwQSUyMCUyMCUyMCUyMHRva2VuaXplZF9iaWxsc3VtJTVCJTIydGVzdCUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMHNodWZmbGUlM0RGYWxzZSUyQyUwQSUyMCUyMCUyMCUyMGJhdGNoX3NpemUlM0QxNiUyQyUwQSUyMCUyMCUyMCUyMGNvbGxhdGVfZm4lM0RkYXRhX2NvbGxhdG9yJTJDJTBBKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>tf_train_set = model.prepare_tf_dataset(
<span class="hljs-meta">... </span>    tokenized_billsum[<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>    tokenized_billsum[<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}}),F=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}}),O=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycy5rZXJhc19jYWxsYmFja3MlMjBpbXBvcnQlMjBLZXJhc01ldHJpY0NhbGxiYWNrJTBBJTBBbWV0cmljX2NhbGxiYWNrJTIwJTNEJTIwS2VyYXNNZXRyaWNDYWxsYmFjayhtZXRyaWNfZm4lM0Rjb21wdXRlX21ldHJpY3MlMkMlMjBldmFsX2RhdGFzZXQlM0R0Zl90ZXN0X3NldCk=",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_test_set)`,wrap:!1}}),ee=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycy5rZXJhc19jYWxsYmFja3MlMjBpbXBvcnQlMjBQdXNoVG9IdWJDYWxsYmFjayUwQSUwQXB1c2hfdG9faHViX2NhbGxiYWNrJTIwJTNEJTIwUHVzaFRvSHViQ2FsbGJhY2soJTBBJTIwJTIwJTIwJTIwb3V0cHV0X2RpciUzRCUyMm15X2F3ZXNvbWVfYmlsbHN1bV9tb2RlbCUyMiUyQyUwQSUyMCUyMCUyMCUyMHRva2VuaXplciUzRHRva2VuaXplciUyQyUwQSk=",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_billsum_model&quot;</span>,
<span class="hljs-meta">... </span>    tokenizer=tokenizer,
<span class="hljs-meta">... </span>)`,wrap:!1}}),Q=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:"bW9kZWwuZml0KHglM0R0Zl90cmFpbl9zZXQlMkMlMjB2YWxpZGF0aW9uX2RhdGElM0R0Zl90ZXN0X3NldCUyQyUyMGVwb2NocyUzRDMlMkMlMjBjYWxsYmFja3MlM0RjYWxsYmFja3Mp",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=callbacks)',wrap:!1}}),{c(){f(s.$$.fragment),c=es(`
لضبط نموذج في TensorFlow، ابدأ بإعداد دالة مُحسِّن وجدول معدل التعلم وبعض معلمات التدريب:

	`),f(t.$$.fragment),m=i(),j=g("p"),j.innerHTML=Z,X=i(),f(G.$$.fragment),v=i(),V=g("p"),V.innerHTML=k,I=i(),f(W.$$.fragment),J=i(),R=g("p"),R.innerHTML=o,U=i(),f(F.$$.fragment),z=i(),H=g("p"),H.innerHTML=h,x=i(),B=g("p"),B.innerHTML=ce,Y=i(),f(O.$$.fragment),le=i(),N=g("p"),N.innerHTML=me,E=i(),f(ee.$$.fragment),ae=i(),S=g("p"),S.textContent=he,q=i(),f(Q.$$.fragment),A=i(),te=g("p"),te.innerHTML=fe,L=i(),f(P.$$.fragment),D=i(),se=g("p"),se.textContent=ue},l(r){u(s.$$.fragment,r),c=ts(r,`
لضبط نموذج في TensorFlow، ابدأ بإعداد دالة مُحسِّن وجدول معدل التعلم وبعض معلمات التدريب:

	`),u(t.$$.fragment,r),m=p(r),j=$(r,"P",{"data-svelte-h":!0}),T(j)!=="svelte-jomjos"&&(j.innerHTML=Z),X=p(r),u(G.$$.fragment,r),v=p(r),V=$(r,"P",{"data-svelte-h":!0}),T(V)!=="svelte-tlcvmw"&&(V.innerHTML=k),I=p(r),u(W.$$.fragment,r),J=p(r),R=$(r,"P",{"data-svelte-h":!0}),T(R)!=="svelte-1pbuk0z"&&(R.innerHTML=o),U=p(r),u(F.$$.fragment,r),z=p(r),H=$(r,"P",{"data-svelte-h":!0}),T(H)!=="svelte-aggyuj"&&(H.innerHTML=h),x=p(r),B=$(r,"P",{"data-svelte-h":!0}),T(B)!=="svelte-1opb8y1"&&(B.innerHTML=ce),Y=p(r),u(O.$$.fragment,r),le=p(r),N=$(r,"P",{"data-svelte-h":!0}),T(N)!=="svelte-hk34li"&&(N.innerHTML=me),E=p(r),u(ee.$$.fragment,r),ae=p(r),S=$(r,"P",{"data-svelte-h":!0}),T(S)!=="svelte-1g9bpud"&&(S.textContent=he),q=p(r),u(Q.$$.fragment,r),A=p(r),te=$(r,"P",{"data-svelte-h":!0}),T(te)!=="svelte-1wu45w4"&&(te.innerHTML=fe),L=p(r),u(P.$$.fragment,r),D=p(r),se=$(r,"P",{"data-svelte-h":!0}),T(se)!=="svelte-2i53kw"&&(se.textContent=ue)},m(r,w){y(s,r,w),a(r,c,w),y(t,r,w),a(r,m,w),a(r,j,w),a(r,X,w),y(G,r,w),a(r,v,w),a(r,V,w),a(r,I,w),y(W,r,w),a(r,J,w),a(r,R,w),a(r,U,w),y(F,r,w),a(r,z,w),a(r,H,w),a(r,x,w),a(r,B,w),a(r,Y,w),y(O,r,w),a(r,le,w),a(r,N,w),a(r,E,w),y(ee,r,w),a(r,ae,w),a(r,S,w),a(r,q,w),y(Q,r,w),a(r,A,w),a(r,te,w),a(r,L,w),y(P,r,w),a(r,D,w),a(r,se,w),K=!0},p(r,w){const Ye={};w&2&&(Ye.$$scope={dirty:w,ctx:r}),s.$set(Ye)},i(r){K||(d(s.$$.fragment,r),d(t.$$.fragment,r),d(G.$$.fragment,r),d(W.$$.fragment,r),d(F.$$.fragment,r),d(O.$$.fragment,r),d(ee.$$.fragment,r),d(Q.$$.fragment,r),d(P.$$.fragment,r),K=!0)},o(r){M(s.$$.fragment,r),M(t.$$.fragment,r),M(G.$$.fragment,r),M(W.$$.fragment,r),M(F.$$.fragment,r),M(O.$$.fragment,r),M(ee.$$.fragment,r),M(Q.$$.fragment,r),M(P.$$.fragment,r),K=!1},d(r){r&&(l(c),l(m),l(j),l(X),l(v),l(V),l(I),l(J),l(R),l(U),l(z),l(H),l(x),l(B),l(Y),l(le),l(N),l(E),l(ae),l(S),l(q),l(A),l(te),l(L),l(D),l(se)),b(s,r),b(t,r),b(G,r),b(W,r),b(F,r),b(O,r),b(ee,r),b(Q,r),b(P,r)}}}function ys(_){let s,c;return s=new Se({props:{$$slots:{default:[us]},$$scope:{ctx:_}}}),{c(){f(s.$$.fragment)},l(t){u(s.$$.fragment,t)},m(t,m){y(s,t,m),c=!0},p(t,m){const j={};m&2&&(j.$$scope={dirty:m,ctx:t}),s.$set(j)},i(t){c||(d(s.$$.fragment,t),c=!0)},o(t){M(s.$$.fragment,t),c=!1},d(t){b(s,t)}}}function ds(_){let s,c=`للحصول على مثال أكثر تعمقًا حول كيفية ضبط نموذج للتجميع، ألقِ نظرة على <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/summarization.ipynb" rel="nofollow">دفتر ملاحظات PyTorch</a>
أو <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/summarization-tf.ipynb" rel="nofollow">دفتر ملاحظات TensorFlow</a> المقابل.`;return{c(){s=g("p"),s.innerHTML=c},l(t){s=$(t,"P",{"data-svelte-h":!0}),T(s)!=="svelte-1e5kw5b"&&(s.innerHTML=c)},m(t,m){a(t,s,m)},p:pe,d(t){t&&l(s)}}}function Ms(_){let s,c="قسم النص وإرجع <code>input_ids</code> كتنسورات PyTorch:",t,m,j,Z,X='استخدم طريقة <code>generate()</code> لإنشاء التلخيص. لمزيد من التفاصيل حول استراتيجيات توليد النص المختلفة والمعلمات للتحكم في التوليد، راجع واجهة برمجة تطبيقات <a href="../main_classes/text_generation">توليد النص</a>.',G,v,V,k,I="فك تشفير معرفات الرموز المولدة مرة أخرى إلى نص:",W,J,R;return m=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJ1c2VybmFtZSUyRm15X2F3ZXNvbWVfYmlsbHN1bV9tb2RlbCUyMiklMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIodGV4dCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpLmlucHV0X2lkcw==",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_billsum_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(text, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).input_ids`,wrap:!1}}),v=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvclNlcTJTZXFMTSUwQSUwQW1vZGVsJTIwJTNEJTIwQXV0b01vZGVsRm9yU2VxMlNlcUxNLmZyb21fcHJldHJhaW5lZCglMjJ1c2VybmFtZSUyRm15X2F3ZXNvbWVfYmlsbHN1bV9tb2RlbCUyMiklMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoaW5wdXRzJTJDJTIwbWF4X25ld190b2tlbnMlM0QxMDAlMkMlMjBkb19zYW1wbGUlM0RGYWxzZSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForSeq2SeqLM

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForSeq2SeqLM.from_pretrained(<span class="hljs-string">&quot;username/my_awesome_billsum_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model.generate(inputs, max_new_tokens=<span class="hljs-number">100</span>, do_sample=<span class="hljs-literal">False</span>)`,wrap:!1}}),J=new C({props:{code:"dG9rZW5pemVyLmRlY29kZShvdXRwdXRzJTVCMCU1RCUyQyUyMHNraXBfc3BlY2lhbF90b2tlbnMlM0RUcnVlKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.decode(outputs[<span class="hljs-number">0</span>], skip_special_tokens=<span class="hljs-literal">True</span>)
<span class="hljs-string">&#x27;the inflation reduction act lowers prescription drug costs, health care costs, and energy costs. it&#x27;</span>s the most aggressive action on tackling the climate crisis <span class="hljs-keyword">in</span> american history. it will ask the ultra-wealthy <span class="hljs-keyword">and</span> corporations to pay their fair share.<span class="hljs-string">&#x27;</span>`,wrap:!1}}),{c(){s=g("p"),s.innerHTML=c,t=i(),f(m.$$.fragment),j=i(),Z=g("p"),Z.innerHTML=X,G=i(),f(v.$$.fragment),V=i(),k=g("p"),k.textContent=I,W=i(),f(J.$$.fragment)},l(o){s=$(o,"P",{"data-svelte-h":!0}),T(s)!=="svelte-1q993bw"&&(s.innerHTML=c),t=p(o),u(m.$$.fragment,o),j=p(o),Z=$(o,"P",{"data-svelte-h":!0}),T(Z)!=="svelte-n2i6j"&&(Z.innerHTML=X),G=p(o),u(v.$$.fragment,o),V=p(o),k=$(o,"P",{"data-svelte-h":!0}),T(k)!=="svelte-qf3bdb"&&(k.textContent=I),W=p(o),u(J.$$.fragment,o)},m(o,U){a(o,s,U),a(o,t,U),y(m,o,U),a(o,j,U),a(o,Z,U),a(o,G,U),y(v,o,U),a(o,V,U),a(o,k,U),a(o,W,U),y(J,o,U),R=!0},p:pe,i(o){R||(d(m.$$.fragment,o),d(v.$$.fragment,o),d(J.$$.fragment,o),R=!0)},o(o){M(m.$$.fragment,o),M(v.$$.fragment,o),M(J.$$.fragment,o),R=!1},d(o){o&&(l(s),l(t),l(j),l(Z),l(G),l(V),l(k),l(W)),b(m,o),b(v,o),b(J,o)}}}function bs(_){let s,c;return s=new Se({props:{$$slots:{default:[Ms]},$$scope:{ctx:_}}}),{c(){f(s.$$.fragment)},l(t){u(s.$$.fragment,t)},m(t,m){y(s,t,m),c=!0},p(t,m){const j={};m&2&&(j.$$scope={dirty:m,ctx:t}),s.$set(j)},i(t){c||(d(s.$$.fragment,t),c=!0)},o(t){M(s.$$.fragment,t),c=!1},d(t){b(s,t)}}}function gs(_){let s,c="قسم النص وإرجع <code>input_ids</code> كتنسورات TensorFlow:",t,m,j,Z,X='استخدم طريقة <code>~transformers.generation_tf_utils.TFGenerationMixin.generate</code> لإنشاء التلخيص. لمزيد من التفاصيل حول استراتيجيات توليد النص المختلفة والمعلمات للتحكم في التوليد، راجع واجهة برمجة تطبيقات <a href="../main_classes/text_generation">توليد النص</a>.',G,v,V,k,I="فك تشفير معرفات الرموز المولدة مرة أخرى إلى نص:",W,J,R;return m=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJ1c2VybmFtZSUyRm15X2F3ZXNvbWVfYmlsbHN1bV9tb2RlbCUyMiklMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIodGV4dCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIydGYlMjIpLmlucHV0X2lkcw==",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_billsum_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(text, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>).input_ids`,wrap:!1}}),v=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGQXV0b01vZGVsRm9yU2VxMlNlcUxNJTBBJTBBbW9kZWwlMjAlM0QlMjBURkF1dG9Nb2RlbEZvclNlcTJTZXFMTS5mcm9tX3ByZXRyYWluZWQoJTIydXNlcm5hbWUlMkZteV9hd2Vzb21lX2JpbGxzdW1fbW9kZWwlMjIpJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKGlucHV0cyUyQyUyMG1heF9uZXdfdG9rZW5zJTNEMTAwJTJDJTIwZG9fc2FtcGxlJTNERmFsc2Up",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFAutoModelForSeq2SeqLM

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFAutoModelForSeq2SeqLM.from_pretrained(<span class="hljs-string">&quot;username/my_awesome_billsum_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model.generate(inputs, max_new_tokens=<span class="hljs-number">100</span>, do_sample=<span class="hljs-literal">False</span>)`,wrap:!1}}),J=new C({props:{code:"dG9rZW5pemVyLmRlY29kZShvdXRwdXRzJTVCMCU1RCUyQyUyMHNraXBfc3BlY2lhbF90b2tlbnMlM0RUcnVlKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.decode(outputs[<span class="hljs-number">0</span>], skip_special_tokens=<span class="hljs-literal">True</span>)
<span class="hljs-string">&#x27;the inflation reduction act lowers prescription drug costs, health care costs, and energy costs. it&#x27;</span>s the most aggressive action on tackling the climate crisis <span class="hljs-keyword">in</span> american history. it will ask the ultra-wealthy <span class="hljs-keyword">and</span> corporations to pay their fair share.<span class="hljs-string">&#x27;</span>`,wrap:!1}}),{c(){s=g("p"),s.innerHTML=c,t=i(),f(m.$$.fragment),j=i(),Z=g("p"),Z.innerHTML=X,G=i(),f(v.$$.fragment),V=i(),k=g("p"),k.textContent=I,W=i(),f(J.$$.fragment)},l(o){s=$(o,"P",{"data-svelte-h":!0}),T(s)!=="svelte-2tlm8k"&&(s.innerHTML=c),t=p(o),u(m.$$.fragment,o),j=p(o),Z=$(o,"P",{"data-svelte-h":!0}),T(Z)!=="svelte-130qdqa"&&(Z.innerHTML=X),G=p(o),u(v.$$.fragment,o),V=p(o),k=$(o,"P",{"data-svelte-h":!0}),T(k)!=="svelte-qf3bdb"&&(k.textContent=I),W=p(o),u(J.$$.fragment,o)},m(o,U){a(o,s,U),a(o,t,U),y(m,o,U),a(o,j,U),a(o,Z,U),a(o,G,U),y(v,o,U),a(o,V,U),a(o,k,U),a(o,W,U),y(J,o,U),R=!0},p:pe,i(o){R||(d(m.$$.fragment,o),d(v.$$.fragment,o),d(J.$$.fragment,o),R=!0)},o(o){M(m.$$.fragment,o),M(v.$$.fragment,o),M(J.$$.fragment,o),R=!1},d(o){o&&(l(s),l(t),l(j),l(Z),l(G),l(V),l(k),l(W)),b(m,o),b(v,o),b(J,o)}}}function $s(_){let s,c;return s=new Se({props:{$$slots:{default:[gs]},$$scope:{ctx:_}}}),{c(){f(s.$$.fragment)},l(t){u(s.$$.fragment,t)},m(t,m){y(s,t,m),c=!0},p(t,m){const j={};m&2&&(j.$$scope={dirty:m,ctx:t}),s.$set(j)},i(t){c||(d(s.$$.fragment,t),c=!0)},o(t){M(s.$$.fragment,t),c=!1},d(t){b(s,t)}}}function js(_){let s,c,t,m,j,Z,X,G,v,V,k,I="يقوم التلخيص بإنشاء نسخة مختصرة من مستند أو مقال، حيث يلتقط جميع المعلومات المهمة. بالإضافة إلى الترجمة، يعتبر التلخيص مثالاً آخر على مهمة يمكن صياغتها كتسلسل إلى تسلسل. يمكن أن يكون التلخيص:",W,J,R="<li>استخراجي: استخراج أهم المعلومات من مستند.</li> <li>تجريدي: إنشاء نص جديد يلخص أهم المعلومات.</li>",o,U,F="سيوضح لك هذا الدليل كيفية:",z,H,h='<li>ضبط دقيق <a href="https://huggingface.co/google-t5/t5-small" rel="nofollow">T5</a> على مجموعة فرعية من مشاريع قوانين ولاية كاليفورنيا من مجموعة بيانات <a href="https://huggingface.co/datasets/billsum" rel="nofollow">BillSum</a> للتلخيص التجريدي.</li> <li>استخدام النموذج المضبوط بدقة للتنبؤ.</li>',x,B,ce,Y,O="قبل البدء، تأكد من تثبيت جميع المكتبات الضرورية:",le,N,me,E,ee="نشجعك على تسجيل الدخول إلى حساب Hugging Face الخاص بك حتى تتمكن من تحميل نموذجك ومشاركته مع المجتمع. عند المطالبة، أدخل الرمز المميز لتسجيل الدخول:",ae,S,he,q,Q,A,te="ابدأ بتحميل جزء صغير من بيانات مشاريع القوانين الخاصة بولاية كاليفورنيا من مجموعة بيانات BillSum في مكتبة 🤗 Datasets:",fe,L,P,D,se="قسّم مجموعة البيانات إلى مجموعتي تدريب واختبار باستخدام الدالة <code>train_test_split</code>:",ue,K,r,w,Ye="ثم ألقِ نظرة على مثال:",qe,ye,Qe,de,_t="هناك مُدخلان سترغب في استخدامهما:",Ae,Me,Zt="<li><code>text</code>: نص القانون الذي سيكون مُدخلًا للنموذج.</li> <li><code>summary</code>: نسخة مُختصرة من <code>text</code> والتي ستكون هدف النموذج.</li>",Le,be,Pe,ge,vt="الخطوة التالية هي تحميل مجزء النصوص T5 لمعالجة <code>text</code> و <code>summary</code>:",De,$e,Ke,je,Ct="وظيفة المعالجة المسبقة التي تريد إنشاءها تحتاج إلى:",Oe,we,Gt="<li>إضافة بادئة للمُدخل باستخدام توجيه حتى يعرف T5 أن هذه مهمة تلخيص. تتطلب بعض النماذج القادرة على مهام البرمجة اللغوية العصبية المتعددة توجيهات لمهام مُحددة.</li> <li>استخدام مُعامل الكلمة الرئيسية <code>text_target</code> عند ترميز التصنيفات.</li> <li>قصّ التسلسلات بحيث لا يزيد طولها عن الحد الأقصى الذي تم تعيينه بواسطة مُعامل <code>max_length</code>.</li>",et,Te,tt,Ue,xt="لتطبيق دالة المعالجة المسبقة على مجموعة البيانات بأكملها، استخدم طريقة <code>map</code> الخاصة بـ 🤗 Datasets. يمكنك تسريع دالة <code>map</code> عن طريق تعيين <code>batched=True</code> لمعالجة عناصر متعددة من مجموعة البيانات في وقت واحد:",st,Je,lt,ke,Vt="الآن قم بإنشاء دفعة من الأمثلة باستخدام <code>DataCollatorForSeq2Seq</code>.  الأكثر كفاءة <em>الحشو الديناميكي</em> للجمل إلى أطول طول في دفعة أثناء عملية التجميع، بدلاً من حشو مجموعة البيانات بأكملها إلى الحد الأقصى للطول.",at,ne,nt,_e,rt,Ze,Wt='يُعد تضمين مقياس أثناء التدريب مفيدًا غالبًا لتقييم أداء نموذجك. يمكنك تحميل طريقة تقييم بسرعة باستخدام مكتبة 🤗 <a href="https://huggingface.co/docs/evaluate/index" rel="nofollow">Evaluate</a>. لهذه المهمة، قم بتحميل مقياس <a href="https://huggingface.co/spaces/evaluate-metric/rouge" rel="nofollow">ROUGE</a> (راجع <a href="https://huggingface.co/docs/evaluate/a_quick_tour" rel="nofollow">الجولة السريعة</a> الخاصة بـ 🤗 Evaluate لمعرفة المزيد حول كيفية تحميل وحساب مقياس):',ot,ve,it,Ce,Rt="ثم قم بإنشاء دالة تُمرر تنبؤاتك وتصنيفاتك إلى <code>compute</code> لحساب مقياس ROUGE:",pt,Ge,ct,xe,Xt="دالة <code>compute_metrics</code> الخاصة بك جاهزة الآن، وستعود إليها عند إعداد التدريب الخاص بك.",mt,Ve,ht,re,ft,oe,ut,We,yt,Re,Ht="رائع، الآن بعد أن قمت بضبط نموذج، يمكنك استخدامه للاستدلال!",dt,Xe,Bt="خدد بعض النصوص الذي ترغب في تلخيصها. بالنسبة لـ T5، تحتاج إلى إضافة بادئة إلى مُدخلاتك اعتمادًا على المهمة التي تعمل عليها. بالنسبة التلخيص، يجب عليك إضافة بادئة إلى مُدخلاتك كما هو موضح أدناه:",Mt,He,bt,Be,zt="أبسط طريقة لتجربة نموذجك المضبوط للاستدلال هي استخدامه في <code>pipeline()</code>. استخدم <code>pipeline</code> للتلخيص باستخدام نموذجك، ومرر نصك إليه:",gt,ze,$t,Ie,It="يمكنك أيضًا تكرار نتائج <code>pipeline</code> يدويًا إذا أردت:",jt,ie,wt,Fe,Tt,Ee,Ut;return j=new Ne({props:{title:"التلخيص (Summarization)",local:"التلخيص-summarization",headingTag:"h1"}}),X=new ls({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/summarization.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/ar/pytorch/summarization.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/ar/tensorflow/summarization.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ar/summarization.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ar/pytorch/summarization.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ar/tensorflow/summarization.ipynb"}]}}),v=new ss({props:{id:"yHnr5Dk2zCI"}}),B=new Jt({props:{$$slots:{default:[ns]},$$scope:{ctx:_}}}),N=new C({props:{code:"cGlwJTIwaW5zdGFsbCUyMHRyYW5zZm9ybWVycyUyMGRhdGFzZXRzJTIwZXZhbHVhdGUlMjByb3VnZV9zY29yZQ==",highlighted:"pip install transformers datasets evaluate rouge_score",wrap:!1}}),S=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}}),q=new Ne({props:{title:"تحميل مجموعة بيانات BillSum",local:"تحميل-مجموعة-بيانات-billsum",headingTag:"h2"}}),L=new C({props:{code:"ZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBJTBBYmlsbHN1bSUyMCUzRCUyMGxvYWRfZGF0YXNldCglMjJiaWxsc3VtJTIyJTJDJTIwc3BsaXQlM0QlMjJjYV90ZXN0JTIyKQ==",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>billsum = load_dataset(<span class="hljs-string">&quot;billsum&quot;</span>, split=<span class="hljs-string">&quot;ca_test&quot;</span>)`,wrap:!1}}),K=new C({props:{code:"YmlsbHN1bSUyMCUzRCUyMGJpbGxzdW0udHJhaW5fdGVzdF9zcGxpdCh0ZXN0X3NpemUlM0QwLjIp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>billsum = billsum.train_test_split(test_size=<span class="hljs-number">0.2</span>)',wrap:!1}}),ye=new C({props:{code:"YmlsbHN1bSU1QiUyMnRyYWluJTIyJTVEJTVCMCU1RA==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>billsum[<span class="hljs-string">&quot;train&quot;</span>][<span class="hljs-number">0</span>]
{<span class="hljs-string">&#x27;summary&#x27;</span>: <span class="hljs-string">&#x27;Existing law authorizes state agencies to enter into contracts for the acquisition of goods or services upon approval by the Department of General Services. Existing law sets forth various requirements and prohibitions for those contracts, including, but not limited to, a prohibition on entering into contracts for the acquisition of goods or services of $100,000 or more with a contractor that discriminates between spouses and domestic partners or same-sex and different-sex couples in the provision of benefits. Existing law provides that a contract entered into in violation of those requirements and prohibitions is void and authorizes the state or any person acting on behalf of the state to bring a civil action seeking a determination that a contract is in violation and therefore void. Under existing law, a willful violation of those requirements and prohibitions is a misdemeanor.\\nThis bill would also prohibit a state agency from entering into contracts for the acquisition of goods or services of $100,000 or more with a contractor that discriminates between employees on the basis of gender identity in the provision of benefits, as specified. By expanding the scope of a crime, this bill would impose a state-mandated local program.\\nThe California Constitution requires the state to reimburse local agencies and school districts for certain costs mandated by the state. Statutory provisions establish procedures for making that reimbursement.\\nThis bill would provide that no reimbursement is required by this act for a specified reason.&#x27;</span>,
 <span class="hljs-string">&#x27;text&#x27;</span>: <span class="hljs-string">&#x27;The people of the State of California do enact as follows:\\n\\n\\nSECTION 1.\\nSection 10295.35 is added to the Public Contract Code, to read:\\n10295.35.\\n(a) (1) Notwithstanding any other law, a state agency shall not enter into any contract for the acquisition of goods or services in the amount of one hundred thousand dollars ($100,000) or more with a contractor that, in the provision of benefits, discriminates between employees on the basis of an employee’s or dependent’s actual or perceived gender identity, including, but not limited to, the employee’s or dependent’s identification as transgender.\\n(2) For purposes of this section, “contract” includes contracts with a cumulative amount of one hundred thousand dollars ($100,000) or more per contractor in each fiscal year.\\n(3) For purposes of this section, an employee health plan is discriminatory if the plan is not consistent with Section 1365.5 of the Health and Safety Code and Section 10140 of the Insurance Code.\\n(4) The requirements of this section shall apply only to those portions of a contractor’s operations that occur under any of the following conditions:\\n(A) Within the state.\\n(B) On real property outside the state if the property is owned by the state or if the state has a right to occupy the property, and if the contractor’s presence at that location is connected to a contract with the state.\\n(C) Elsewhere in the United States where work related to a state contract is being performed.\\n(b) Contractors shall treat as confidential, to the maximum extent allowed by law or by the requirement of the contractor’s insurance provider, any request by an employee or applicant for employment benefits or any documentation of eligibility for benefits submitted by an employee or applicant for employment.\\n(c) After taking all reasonable measures to find a contractor that complies with this section, as determined by the state agency, the requirements of this section may be waived under any of the following circumstances:\\n(1) There is only one prospective contractor willing to enter into a specific contract with the state agency.\\n(2) The contract is necessary to respond to an emergency, as determined by the state agency, that endangers the public health, welfare, or safety, or the contract is necessary for the provision of essential services, and no entity that complies with the requirements of this section capable of responding to the emergency is immediately available.\\n(3) The requirements of this section violate, or are inconsistent with, the terms or conditions of a grant, subvention, or agreement, if the agency has made a good faith attempt to change the terms or conditions of any grant, subvention, or agreement to authorize application of this section.\\n(4) The contractor is providing wholesale or bulk water, power, or natural gas, the conveyance or transmission of the same, or ancillary services, as required for ensuring reliable services in accordance with good utility practice, if the purchase of the same cannot practically be accomplished through the standard competitive bidding procedures and the contractor is not providing direct retail services to end users.\\n(d) (1) A contractor shall not be deemed to discriminate in the provision of benefits if the contractor, in providing the benefits, pays the actual costs incurred in obtaining the benefit.\\n(2) If a contractor is unable to provide a certain benefit, despite taking reasonable measures to do so, the contractor shall not be deemed to discriminate in the provision of benefits.\\n(e) (1) Every contract subject to this chapter shall contain a statement by which the contractor certifies that the contractor is in compliance with this section.\\n(2) The department or other contracting agency shall enforce this section pursuant to its existing enforcement powers.\\n(3) (A) If a contractor falsely certifies that it is in compliance with this section, the contract with that contractor shall be subject to Article 9 (commencing with Section 10420), unless, within a time period specified by the department or other contracting agency, the contractor provides to the department or agency proof that it has complied, or is in the process of complying, with this section.\\n(B) The application of the remedies or penalties contained in Article 9 (commencing with Section 10420) to a contract subject to this chapter shall not preclude the application of any existing remedies otherwise available to the department or other contracting agency under its existing enforcement powers.\\n(f) Nothing in this section is intended to regulate the contracting practices of any local jurisdiction.\\n(g) This section shall be construed so as not to conflict with applicable federal laws, rules, or regulations. In the event that a court or agency of competent jurisdiction holds that federal law, rule, or regulation invalidates any clause, sentence, paragraph, or section of this code or the application thereof to any person or circumstances, it is the intent of the state that the court or agency sever that clause, sentence, paragraph, or section so that the remainder of this section shall remain in effect.\\nSEC. 2.\\nSection 10295.35 of the Public Contract Code shall not be construed to create any new enforcement authority or responsibility in the Department of General Services or any other contracting agency.\\nSEC. 3.\\nNo reimbursement is required by this act pursuant to Section 6 of Article XIII\\u2009B of the California Constitution because the only costs that may be incurred by a local agency or school district will be incurred because this act creates a new crime or infraction, eliminates a crime or infraction, or changes the penalty for a crime or infraction, within the meaning of Section 17556 of the Government Code, or changes the definition of a crime within the meaning of Section 6 of Article XIII\\u2009B of the California Constitution.&#x27;</span>,
 <span class="hljs-string">&#x27;title&#x27;</span>: <span class="hljs-string">&#x27;An act to add Section 10295.35 to the Public Contract Code, relating to public contracts.&#x27;</span>}`,wrap:!1}}),be=new Ne({props:{title:"المعالجة المسبقة (Preprocess)",local:"المعالجة-المسبقة-preprocess",headingTag:"h2"}}),$e=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEFjaGVja3BvaW50JTIwJTNEJTIwJTIyZ29vZ2xlLXQ1JTJGdDUtc21hbGwlMjIlMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZChjaGVja3BvaW50KQ==",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>checkpoint = <span class="hljs-string">&quot;google-t5/t5-small&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(checkpoint)`,wrap:!1}}),Te=new C({props:{code:"cHJlZml4JTIwJTNEJTIwJTIyc3VtbWFyaXplJTNBJTIwJTIyJTBBJTBBZGVmJTIwcHJlcHJvY2Vzc19mdW5jdGlvbihleGFtcGxlcyklM0ElMEElMjAlMjAlMjAlMjBpbnB1dHMlMjAlM0QlMjAlNUJwcmVmaXglMjAlMkIlMjBkb2MlMjBmb3IlMjBkb2MlMjBpbiUyMGV4YW1wbGVzJTVCJTIydGV4dCUyMiU1RCU1RCUwQSUyMCUyMCUyMCUyMG1vZGVsX2lucHV0cyUyMCUzRCUyMHRva2VuaXplcihpbnB1dHMlMkMlMjBtYXhfbGVuZ3RoJTNEMTAyNCUyQyUyMHRydW5jYXRpb24lM0RUcnVlKSUwQSUwQSUyMCUyMCUyMCUyMGxhYmVscyUyMCUzRCUyMHRva2VuaXplcih0ZXh0X3RhcmdldCUzRGV4YW1wbGVzJTVCJTIyc3VtbWFyeSUyMiU1RCUyQyUyMG1heF9sZW5ndGglM0QxMjglMkMlMjB0cnVuY2F0aW9uJTNEVHJ1ZSklMEElMEElMjAlMjAlMjAlMjBtb2RlbF9pbnB1dHMlNUIlMjJsYWJlbHMlMjIlNUQlMjAlM0QlMjBsYWJlbHMlNUIlMjJpbnB1dF9pZHMlMjIlNUQlMEElMjAlMjAlMjAlMjByZXR1cm4lMjBtb2RlbF9pbnB1dHM=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>prefix = <span class="hljs-string">&quot;summarize: &quot;</span>

<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>    inputs = [prefix + doc <span class="hljs-keyword">for</span> doc <span class="hljs-keyword">in</span> examples[<span class="hljs-string">&quot;text&quot;</span>]]
<span class="hljs-meta">... </span>    model_inputs = tokenizer(inputs, max_length=<span class="hljs-number">1024</span>, truncation=<span class="hljs-literal">True</span>)

<span class="hljs-meta">... </span>    labels = tokenizer(text_target=examples[<span class="hljs-string">&quot;summary&quot;</span>], max_length=<span class="hljs-number">128</span>, truncation=<span class="hljs-literal">True</span>)

<span class="hljs-meta">... </span>    model_inputs[<span class="hljs-string">&quot;labels&quot;</span>] = labels[<span class="hljs-string">&quot;input_ids&quot;</span>]
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> model_inputs`,wrap:!1}}),Je=new C({props:{code:"dG9rZW5pemVkX2JpbGxzdW0lMjAlM0QlMjBiaWxsc3VtLm1hcChwcmVwcm9jZXNzX2Z1bmN0aW9uJTJDJTIwYmF0Y2hlZCUzRFRydWUp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>tokenized_billsum = billsum.<span class="hljs-built_in">map</span>(preprocess_function, batched=<span class="hljs-literal">True</span>)',wrap:!1}}),ne=new kt({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[ps],pytorch:[os]},$$scope:{ctx:_}}}),_e=new Ne({props:{title:"التقييم (Evaluate)",local:"التقييم-evaluate",headingTag:"h2"}}),ve=new C({props:{code:"aW1wb3J0JTIwZXZhbHVhdGUlMEElMEFyb3VnZSUyMCUzRCUyMGV2YWx1YXRlLmxvYWQoJTIycm91Z2UlMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> evaluate

<span class="hljs-meta">&gt;&gt;&gt; </span>rouge = evaluate.load(<span class="hljs-string">&quot;rouge&quot;</span>)`,wrap:!1}}),Ge=new C({props:{code:"aW1wb3J0JTIwbnVtcHklMjBhcyUyMG5wJTBBJTBBZGVmJTIwY29tcHV0ZV9tZXRyaWNzKGV2YWxfcHJlZCklM0ElMEElMjAlMjAlMjAlMjBwcmVkaWN0aW9ucyUyQyUyMGxhYmVscyUyMCUzRCUyMGV2YWxfcHJlZCUwQSUyMCUyMCUyMCUyMGRlY29kZWRfcHJlZHMlMjAlM0QlMjB0b2tlbml6ZXIuYmF0Y2hfZGVjb2RlKHByZWRpY3Rpb25zJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUpJTBBJTIwJTIwJTIwJTIwbGFiZWxzJTIwJTNEJTIwbnAud2hlcmUobGFiZWxzJTIwISUzRCUyMC0xMDAlMkMlMjBsYWJlbHMlMkMlMjB0b2tlbml6ZXIucGFkX3Rva2VuX2lkKSUwQSUyMCUyMCUyMCUyMGRlY29kZWRfbGFiZWxzJTIwJTNEJTIwdG9rZW5pemVyLmJhdGNoX2RlY29kZShsYWJlbHMlMkMlMjBza2lwX3NwZWNpYWxfdG9rZW5zJTNEVHJ1ZSklMEElMEElMjAlMjAlMjAlMjByZXN1bHQlMjAlM0QlMjByb3VnZS5jb21wdXRlKHByZWRpY3Rpb25zJTNEZGVjb2RlZF9wcmVkcyUyQyUyMHJlZmVyZW5jZXMlM0RkZWNvZGVkX2xhYmVscyUyQyUyMHVzZV9zdGVtbWVyJTNEVHJ1ZSklMEElMEElMjAlMjAlMjAlMjBwcmVkaWN0aW9uX2xlbnMlMjAlM0QlMjAlNUJucC5jb3VudF9ub256ZXJvKHByZWQlMjAhJTNEJTIwdG9rZW5pemVyLnBhZF90b2tlbl9pZCklMjBmb3IlMjBwcmVkJTIwaW4lMjBwcmVkaWN0aW9ucyU1RCUwQSUyMCUyMCUyMCUyMHJlc3VsdCU1QiUyMmdlbl9sZW4lMjIlNUQlMjAlM0QlMjBucC5tZWFuKHByZWRpY3Rpb25fbGVucyklMEElMEElMjAlMjAlMjAlMjByZXR1cm4lMjAlN0JrJTNBJTIwcm91bmQodiUyQyUyMDQpJTIwZm9yJTIwayUyQyUyMHYlMjBpbiUyMHJlc3VsdC5pdGVtcygpJTdE",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><span class="hljs-keyword">def</span> <span class="hljs-title function_">compute_metrics</span>(<span class="hljs-params">eval_pred</span>):
<span class="hljs-meta">... </span>    predictions, labels = eval_pred
<span class="hljs-meta">... </span>    decoded_preds = tokenizer.batch_decode(predictions, skip_special_tokens=<span class="hljs-literal">True</span>)
<span class="hljs-meta">... </span>    labels = np.where(labels != -<span class="hljs-number">100</span>, labels, tokenizer.pad_token_id)
<span class="hljs-meta">... </span>    decoded_labels = tokenizer.batch_decode(labels, skip_special_tokens=<span class="hljs-literal">True</span>)

<span class="hljs-meta">... </span>    result = rouge.compute(predictions=decoded_preds, references=decoded_labels, use_stemmer=<span class="hljs-literal">True</span>)

<span class="hljs-meta">... </span>    prediction_lens = [np.count_nonzero(pred != tokenizer.pad_token_id) <span class="hljs-keyword">for</span> pred <span class="hljs-keyword">in</span> predictions]
<span class="hljs-meta">... </span>    result[<span class="hljs-string">&quot;gen_len&quot;</span>] = np.mean(prediction_lens)

<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> {k: <span class="hljs-built_in">round</span>(v, <span class="hljs-number">4</span>) <span class="hljs-keyword">for</span> k, v <span class="hljs-keyword">in</span> result.items()}`,wrap:!1}}),Ve=new Ne({props:{title:"التدريب (Train)",local:"التدريب-train",headingTag:"h2"}}),re=new kt({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[ys],pytorch:[hs]},$$scope:{ctx:_}}}),oe=new Jt({props:{$$slots:{default:[ds]},$$scope:{ctx:_}}}),We=new Ne({props:{title:"الاستدلال (Inference)",local:"الاستدلال-inference",headingTag:"h2"}}),He=new C({props:{code:"dGV4dCUyMCUzRCUyMCUyMnN1bW1hcml6ZSUzQSUyMFRoZSUyMEluZmxhdGlvbiUyMFJlZHVjdGlvbiUyMEFjdCUyMGxvd2VycyUyMHByZXNjcmlwdGlvbiUyMGRydWclMjBjb3N0cyUyQyUyMGhlYWx0aCUyMGNhcmUlMjBjb3N0cyUyQyUyMGFuZCUyMGVuZXJneSUyMGNvc3RzLiUyMEl0J3MlMjB0aGUlMjBtb3N0JTIwYWdncmVzc2l2ZSUyMGFjdGlvbiUyMG9uJTIwdGFja2xpbmclMjB0aGUlMjBjbGltYXRlJTIwY3Jpc2lzJTIwaW4lMjBBbWVyaWNhbiUyMGhpc3RvcnklMkMlMjB3aGljaCUyMHdpbGwlMjBsaWZ0JTIwdXAlMjBBbWVyaWNhbiUyMHdvcmtlcnMlMjBhbmQlMjBjcmVhdGUlMjBnb29kLXBheWluZyUyQyUyMHVuaW9uJTIwam9icyUyMGFjcm9zcyUyMHRoZSUyMGNvdW50cnkuJTIwSXQnbGwlMjBsb3dlciUyMHRoZSUyMGRlZmljaXQlMjBhbmQlMjBhc2slMjB0aGUlMjB1bHRyYS13ZWFsdGh5JTIwYW5kJTIwY29ycG9yYXRpb25zJTIwdG8lMjBwYXklMjB0aGVpciUyMGZhaXIlMjBzaGFyZS4lMjBBbmQlMjBubyUyMG9uZSUyMG1ha2luZyUyMHVuZGVyJTIwJTI0NDAwJTJDMDAwJTIwcGVyJTIweWVhciUyMHdpbGwlMjBwYXklMjBhJTIwcGVubnklMjBtb3JlJTIwaW4lMjB0YXhlcy4lMjI=",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>text = <span class="hljs-string">&quot;summarize: The Inflation Reduction Act lowers prescription drug costs, health care costs, and energy costs. It&#x27;s the most aggressive action on tackling the climate crisis in American history, which will lift up American workers and create good-paying, union jobs across the country. It&#x27;ll lower the deficit and ask the ultra-wealthy and corporations to pay their fair share. And no one making under $400,000 per year will pay a penny more in taxes.&quot;</span>',wrap:!1}}),ze=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBc3VtbWFyaXplciUyMCUzRCUyMHBpcGVsaW5lKCUyMnN1bW1hcml6YXRpb24lMjIlMkMlMjBtb2RlbCUzRCUyMnVzZXJuYW1lJTJGbXlfYXdlc29tZV9iaWxsc3VtX21vZGVsJTIyKSUwQXN1bW1hcml6ZXIodGV4dCk=",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>summarizer = pipeline(<span class="hljs-string">&quot;summarization&quot;</span>, model=<span class="hljs-string">&quot;username/my_awesome_billsum_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>summarizer(text)
[{<span class="hljs-string">&quot;summary_text&quot;</span>: <span class="hljs-string">&quot;The Inflation Reduction Act lowers prescription drug costs, health care costs, and energy costs. It&#x27;s the most aggressive action on tackling the climate crisis in American history, which will lift up American workers and create good-paying, union jobs across the country.&quot;</span>}]`,wrap:!1}}),ie=new kt({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[$s],pytorch:[bs]},$$scope:{ctx:_}}}),Fe=new as({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/ar/tasks/summarization.md"}}),{c(){s=g("meta"),c=i(),t=g("p"),m=i(),f(j.$$.fragment),Z=i(),f(X.$$.fragment),G=i(),f(v.$$.fragment),V=i(),k=g("p"),k.textContent=I,W=i(),J=g("ul"),J.innerHTML=R,o=i(),U=g("p"),U.textContent=F,z=i(),H=g("ol"),H.innerHTML=h,x=i(),f(B.$$.fragment),ce=i(),Y=g("p"),Y.textContent=O,le=i(),f(N.$$.fragment),me=i(),E=g("p"),E.textContent=ee,ae=i(),f(S.$$.fragment),he=i(),f(q.$$.fragment),Q=i(),A=g("p"),A.textContent=te,fe=i(),f(L.$$.fragment),P=i(),D=g("p"),D.innerHTML=se,ue=i(),f(K.$$.fragment),r=i(),w=g("p"),w.textContent=Ye,qe=i(),f(ye.$$.fragment),Qe=i(),de=g("p"),de.textContent=_t,Ae=i(),Me=g("ul"),Me.innerHTML=Zt,Le=i(),f(be.$$.fragment),Pe=i(),ge=g("p"),ge.innerHTML=vt,De=i(),f($e.$$.fragment),Ke=i(),je=g("p"),je.textContent=Ct,Oe=i(),we=g("ol"),we.innerHTML=Gt,et=i(),f(Te.$$.fragment),tt=i(),Ue=g("p"),Ue.innerHTML=xt,st=i(),f(Je.$$.fragment),lt=i(),ke=g("p"),ke.innerHTML=Vt,at=i(),f(ne.$$.fragment),nt=i(),f(_e.$$.fragment),rt=i(),Ze=g("p"),Ze.innerHTML=Wt,ot=i(),f(ve.$$.fragment),it=i(),Ce=g("p"),Ce.innerHTML=Rt,pt=i(),f(Ge.$$.fragment),ct=i(),xe=g("p"),xe.innerHTML=Xt,mt=i(),f(Ve.$$.fragment),ht=i(),f(re.$$.fragment),ft=i(),f(oe.$$.fragment),ut=i(),f(We.$$.fragment),yt=i(),Re=g("p"),Re.textContent=Ht,dt=i(),Xe=g("p"),Xe.textContent=Bt,Mt=i(),f(He.$$.fragment),bt=i(),Be=g("p"),Be.innerHTML=zt,gt=i(),f(ze.$$.fragment),$t=i(),Ie=g("p"),Ie.innerHTML=It,jt=i(),f(ie.$$.fragment),wt=i(),f(Fe.$$.fragment),Tt=i(),Ee=g("p"),this.h()},l(e){const n=Kt("svelte-u9bgzb",document.head);s=$(n,"META",{name:!0,content:!0}),n.forEach(l),c=p(e),t=$(e,"P",{}),qt(t).forEach(l),m=p(e),u(j.$$.fragment,e),Z=p(e),u(X.$$.fragment,e),G=p(e),u(v.$$.fragment,e),V=p(e),k=$(e,"P",{"data-svelte-h":!0}),T(k)!=="svelte-1e6s4pm"&&(k.textContent=I),W=p(e),J=$(e,"UL",{"data-svelte-h":!0}),T(J)!=="svelte-1178z0x"&&(J.innerHTML=R),o=p(e),U=$(e,"P",{"data-svelte-h":!0}),T(U)!=="svelte-lp8700"&&(U.textContent=F),z=p(e),H=$(e,"OL",{"data-svelte-h":!0}),T(H)!=="svelte-ek07cs"&&(H.innerHTML=h),x=p(e),u(B.$$.fragment,e),ce=p(e),Y=$(e,"P",{"data-svelte-h":!0}),T(Y)!=="svelte-1vj7g14"&&(Y.textContent=O),le=p(e),u(N.$$.fragment,e),me=p(e),E=$(e,"P",{"data-svelte-h":!0}),T(E)!=="svelte-1cg1fxc"&&(E.textContent=ee),ae=p(e),u(S.$$.fragment,e),he=p(e),u(q.$$.fragment,e),Q=p(e),A=$(e,"P",{"data-svelte-h":!0}),T(A)!=="svelte-uep165"&&(A.textContent=te),fe=p(e),u(L.$$.fragment,e),P=p(e),D=$(e,"P",{"data-svelte-h":!0}),T(D)!=="svelte-1rxkph6"&&(D.innerHTML=se),ue=p(e),u(K.$$.fragment,e),r=p(e),w=$(e,"P",{"data-svelte-h":!0}),T(w)!=="svelte-9v40eo"&&(w.textContent=Ye),qe=p(e),u(ye.$$.fragment,e),Qe=p(e),de=$(e,"P",{"data-svelte-h":!0}),T(de)!=="svelte-be51qs"&&(de.textContent=_t),Ae=p(e),Me=$(e,"UL",{"data-svelte-h":!0}),T(Me)!=="svelte-1s7f00h"&&(Me.innerHTML=Zt),Le=p(e),u(be.$$.fragment,e),Pe=p(e),ge=$(e,"P",{"data-svelte-h":!0}),T(ge)!=="svelte-1h1t80m"&&(ge.innerHTML=vt),De=p(e),u($e.$$.fragment,e),Ke=p(e),je=$(e,"P",{"data-svelte-h":!0}),T(je)!=="svelte-upifnz"&&(je.textContent=Ct),Oe=p(e),we=$(e,"OL",{"data-svelte-h":!0}),T(we)!=="svelte-1lniirp"&&(we.innerHTML=Gt),et=p(e),u(Te.$$.fragment,e),tt=p(e),Ue=$(e,"P",{"data-svelte-h":!0}),T(Ue)!=="svelte-mrr32b"&&(Ue.innerHTML=xt),st=p(e),u(Je.$$.fragment,e),lt=p(e),ke=$(e,"P",{"data-svelte-h":!0}),T(ke)!=="svelte-u8gjrq"&&(ke.innerHTML=Vt),at=p(e),u(ne.$$.fragment,e),nt=p(e),u(_e.$$.fragment,e),rt=p(e),Ze=$(e,"P",{"data-svelte-h":!0}),T(Ze)!=="svelte-14g4t36"&&(Ze.innerHTML=Wt),ot=p(e),u(ve.$$.fragment,e),it=p(e),Ce=$(e,"P",{"data-svelte-h":!0}),T(Ce)!=="svelte-brpmtd"&&(Ce.innerHTML=Rt),pt=p(e),u(Ge.$$.fragment,e),ct=p(e),xe=$(e,"P",{"data-svelte-h":!0}),T(xe)!=="svelte-j4d2g4"&&(xe.innerHTML=Xt),mt=p(e),u(Ve.$$.fragment,e),ht=p(e),u(re.$$.fragment,e),ft=p(e),u(oe.$$.fragment,e),ut=p(e),u(We.$$.fragment,e),yt=p(e),Re=$(e,"P",{"data-svelte-h":!0}),T(Re)!=="svelte-25dfys"&&(Re.textContent=Ht),dt=p(e),Xe=$(e,"P",{"data-svelte-h":!0}),T(Xe)!=="svelte-1mk8315"&&(Xe.textContent=Bt),Mt=p(e),u(He.$$.fragment,e),bt=p(e),Be=$(e,"P",{"data-svelte-h":!0}),T(Be)!=="svelte-hcrihz"&&(Be.innerHTML=zt),gt=p(e),u(ze.$$.fragment,e),$t=p(e),Ie=$(e,"P",{"data-svelte-h":!0}),T(Ie)!=="svelte-asb9jo"&&(Ie.innerHTML=It),jt=p(e),u(ie.$$.fragment,e),wt=p(e),u(Fe.$$.fragment,e),Tt=p(e),Ee=$(e,"P",{}),qt(Ee).forEach(l),this.h()},h(){Qt(s,"name","hf:doc:metadata"),Qt(s,"content",ws)},m(e,n){Ot(document.head,s),a(e,c,n),a(e,t,n),a(e,m,n),y(j,e,n),a(e,Z,n),y(X,e,n),a(e,G,n),y(v,e,n),a(e,V,n),a(e,k,n),a(e,W,n),a(e,J,n),a(e,o,n),a(e,U,n),a(e,z,n),a(e,H,n),a(e,x,n),y(B,e,n),a(e,ce,n),a(e,Y,n),a(e,le,n),y(N,e,n),a(e,me,n),a(e,E,n),a(e,ae,n),y(S,e,n),a(e,he,n),y(q,e,n),a(e,Q,n),a(e,A,n),a(e,fe,n),y(L,e,n),a(e,P,n),a(e,D,n),a(e,ue,n),y(K,e,n),a(e,r,n),a(e,w,n),a(e,qe,n),y(ye,e,n),a(e,Qe,n),a(e,de,n),a(e,Ae,n),a(e,Me,n),a(e,Le,n),y(be,e,n),a(e,Pe,n),a(e,ge,n),a(e,De,n),y($e,e,n),a(e,Ke,n),a(e,je,n),a(e,Oe,n),a(e,we,n),a(e,et,n),y(Te,e,n),a(e,tt,n),a(e,Ue,n),a(e,st,n),y(Je,e,n),a(e,lt,n),a(e,ke,n),a(e,at,n),y(ne,e,n),a(e,nt,n),y(_e,e,n),a(e,rt,n),a(e,Ze,n),a(e,ot,n),y(ve,e,n),a(e,it,n),a(e,Ce,n),a(e,pt,n),y(Ge,e,n),a(e,ct,n),a(e,xe,n),a(e,mt,n),y(Ve,e,n),a(e,ht,n),y(re,e,n),a(e,ft,n),y(oe,e,n),a(e,ut,n),y(We,e,n),a(e,yt,n),a(e,Re,n),a(e,dt,n),a(e,Xe,n),a(e,Mt,n),y(He,e,n),a(e,bt,n),a(e,Be,n),a(e,gt,n),y(ze,e,n),a(e,$t,n),a(e,Ie,n),a(e,jt,n),y(ie,e,n),a(e,wt,n),y(Fe,e,n),a(e,Tt,n),a(e,Ee,n),Ut=!0},p(e,[n]){const Ft={};n&2&&(Ft.$$scope={dirty:n,ctx:e}),B.$set(Ft);const Nt={};n&2&&(Nt.$$scope={dirty:n,ctx:e}),ne.$set(Nt);const St={};n&2&&(St.$$scope={dirty:n,ctx:e}),re.$set(St);const Yt={};n&2&&(Yt.$$scope={dirty:n,ctx:e}),oe.$set(Yt);const Et={};n&2&&(Et.$$scope={dirty:n,ctx:e}),ie.$set(Et)},i(e){Ut||(d(j.$$.fragment,e),d(X.$$.fragment,e),d(v.$$.fragment,e),d(B.$$.fragment,e),d(N.$$.fragment,e),d(S.$$.fragment,e),d(q.$$.fragment,e),d(L.$$.fragment,e),d(K.$$.fragment,e),d(ye.$$.fragment,e),d(be.$$.fragment,e),d($e.$$.fragment,e),d(Te.$$.fragment,e),d(Je.$$.fragment,e),d(ne.$$.fragment,e),d(_e.$$.fragment,e),d(ve.$$.fragment,e),d(Ge.$$.fragment,e),d(Ve.$$.fragment,e),d(re.$$.fragment,e),d(oe.$$.fragment,e),d(We.$$.fragment,e),d(He.$$.fragment,e),d(ze.$$.fragment,e),d(ie.$$.fragment,e),d(Fe.$$.fragment,e),Ut=!0)},o(e){M(j.$$.fragment,e),M(X.$$.fragment,e),M(v.$$.fragment,e),M(B.$$.fragment,e),M(N.$$.fragment,e),M(S.$$.fragment,e),M(q.$$.fragment,e),M(L.$$.fragment,e),M(K.$$.fragment,e),M(ye.$$.fragment,e),M(be.$$.fragment,e),M($e.$$.fragment,e),M(Te.$$.fragment,e),M(Je.$$.fragment,e),M(ne.$$.fragment,e),M(_e.$$.fragment,e),M(ve.$$.fragment,e),M(Ge.$$.fragment,e),M(Ve.$$.fragment,e),M(re.$$.fragment,e),M(oe.$$.fragment,e),M(We.$$.fragment,e),M(He.$$.fragment,e),M(ze.$$.fragment,e),M(ie.$$.fragment,e),M(Fe.$$.fragment,e),Ut=!1},d(e){e&&(l(c),l(t),l(m),l(Z),l(G),l(V),l(k),l(W),l(J),l(o),l(U),l(z),l(H),l(x),l(ce),l(Y),l(le),l(me),l(E),l(ae),l(he),l(Q),l(A),l(fe),l(P),l(D),l(ue),l(r),l(w),l(qe),l(Qe),l(de),l(Ae),l(Me),l(Le),l(Pe),l(ge),l(De),l(Ke),l(je),l(Oe),l(we),l(et),l(tt),l(Ue),l(st),l(lt),l(ke),l(at),l(nt),l(rt),l(Ze),l(ot),l(it),l(Ce),l(pt),l(ct),l(xe),l(mt),l(ht),l(ft),l(ut),l(yt),l(Re),l(dt),l(Xe),l(Mt),l(bt),l(Be),l(gt),l($t),l(Ie),l(jt),l(wt),l(Tt),l(Ee)),l(s),b(j,e),b(X,e),b(v,e),b(B,e),b(N,e),b(S,e),b(q,e),b(L,e),b(K,e),b(ye,e),b(be,e),b($e,e),b(Te,e),b(Je,e),b(ne,e),b(_e,e),b(ve,e),b(Ge,e),b(Ve,e),b(re,e),b(oe,e),b(We,e),b(He,e),b(ze,e),b(ie,e),b(Fe,e)}}}const ws='{"title":"التلخيص (Summarization)","local":"التلخيص-summarization","sections":[{"title":"تحميل مجموعة بيانات BillSum","local":"تحميل-مجموعة-بيانات-billsum","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 Ts(_){return Lt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class xs extends Pt{constructor(s){super(),Dt(this,s,Ts,js,At,{})}}export{xs as component};
