import{s as Qt,o as Lt,n as pe}from"../chunks/scheduler.9bc65507.js";import{S as Pt,i as Dt,g as w,s as i,r as f,A as Kt,h as $,f as a,c as p,j as Et,u,x as T,k as Yt,y as Ot,a as l,v as d,d as y,t as M,w as b,m as qt,n as At}from"../chunks/index.707bf1b6.js";import{T as Tt}from"../chunks/Tip.c2ecdbf4.js";import{Y as es}from"../chunks/Youtube.e1129c6f.js";import{C as Z}from"../chunks/CodeBlock.54a9f38d.js";import{D as ts}from"../chunks/DocNotebookDropdown.3e6b3817.js";import{F as Ut,M as Se}from"../chunks/Markdown.8ab98a13.js";import{H as Ie}from"../chunks/Heading.342b1fa6.js";function ss(J){let s,c,t='<a href="../model_doc/bart">BART</a>, <a href="../model_doc/bigbird_pegasus">BigBird-Pegasus</a>, <a href="../model_doc/blenderbot">Blenderbot</a>, <a href="../model_doc/blenderbot-small">BlenderbotSmall</a>, <a href="../model_doc/encoder-decoder">Encoder decoder</a>, <a href="../model_doc/fsmt">FairSeq Machine-Translation</a>, <a href="../model_doc/gptsan-japanese">GPTSAN-japanese</a>, <a href="../model_doc/led">LED</a>, <a href="../model_doc/longt5">LongT5</a>, <a href="../model_doc/m2m_100">M2M100</a>, <a href="../model_doc/marian">Marian</a>, <a href="../model_doc/mbart">mBART</a>, <a href="../model_doc/mt5">MT5</a>, <a href="../model_doc/mvp">MVP</a>, <a href="../model_doc/nllb">NLLB</a>, <a href="../model_doc/nllb-moe">NLLB-MOE</a>, <a href="../model_doc/pegasus">Pegasus</a>, <a href="../model_doc/pegasus_x">PEGASUS-X</a>, <a href="../model_doc/plbart">PLBart</a>, <a href="../model_doc/prophetnet">ProphetNet</a>, <a href="../model_doc/seamless_m4t">SeamlessM4T</a>, <a href="../model_doc/switch_transformers">SwitchTransformers</a>, <a href="../model_doc/t5">T5</a>, <a href="../model_doc/umt5">UMT5</a>, <a href="../model_doc/xlm-prophetnet">XLM-ProphetNet</a>';return{c(){s=qt(`The task illustrated in this tutorial is supported by the following model architectures:

`),c=w("p"),c.innerHTML=t},l(m){s=At(m,`The task illustrated in this tutorial is supported by the following model architectures:

`),c=$(m,"P",{"data-svelte-h":!0}),T(c)!=="svelte-1ad5e7s"&&(c.innerHTML=t)},m(m,g){l(m,s,g),l(m,c,g)},p:pe,d(m){m&&(a(s),a(c))}}}function as(J){let s,c;return s=new Z({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){d(s,t,m),c=!0},p:pe,i(t){c||(y(s.$$.fragment,t),c=!0)},o(t){M(s.$$.fragment,t),c=!1},d(t){b(s,t)}}}function ls(J){let s,c;return s=new Se({props:{$$slots:{default:[as]},$$scope:{ctx:J}}}),{c(){f(s.$$.fragment)},l(t){u(s.$$.fragment,t)},m(t,m){d(s,t,m),c=!0},p(t,m){const g={};m&2&&(g.$$scope={dirty:m,ctx:t}),s.$set(g)},i(t){c||(y(s.$$.fragment,t),c=!0)},o(t){M(s.$$.fragment,t),c=!1},d(t){b(s,t)}}}function ns(J){let s,c;return s=new Z({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){d(s,t,m),c=!0},p:pe,i(t){c||(y(s.$$.fragment,t),c=!0)},o(t){M(s.$$.fragment,t),c=!1},d(t){b(s,t)}}}function os(J){let s,c;return s=new Se({props:{$$slots:{default:[ns]},$$scope:{ctx:J}}}),{c(){f(s.$$.fragment)},l(t){u(s.$$.fragment,t)},m(t,m){d(s,t,m),c=!0},p(t,m){const g={};m&2&&(g.$$scope={dirty:m,ctx:t}),s.$set(g)},i(t){c||(y(s.$$.fragment,t),c=!0)},o(t){M(s.$$.fragment,t),c=!1},d(t){b(s,t)}}}function rs(J){let s,c='If you aren’t familiar with finetuning a model with the <a href="/docs/transformers/main/en/main_classes/trainer#transformers.Trainer">Trainer</a>, take a look at the basic tutorial <a href="../training#train-with-pytorch-trainer">here</a>!';return{c(){s=w("p"),s.innerHTML=c},l(t){s=$(t,"P",{"data-svelte-h":!0}),T(s)!=="svelte-15s4um0"&&(s.innerHTML=c)},m(t,m){l(t,s,m)},p:pe,d(t){t&&a(s)}}}function is(J){let s,c,t,m='You’re ready to start training your model now! Load T5 with <a href="/docs/transformers/main/en/model_doc/auto#transformers.AutoModelForSeq2SeqLM">AutoModelForSeq2SeqLM</a>:',g,v,B,G,C="At this point, only three steps remain:",V,k,F='<li>Define your training hyperparameters in <a href="/docs/transformers/main/en/main_classes/trainer#transformers.Seq2SeqTrainingArguments">Seq2SeqTrainingArguments</a>. The only required parameter is <code>output_dir</code> which specifies where to save your model. You’ll push this model to the Hub by setting <code>push_to_hub=True</code> (you need to be signed in to Hugging Face to upload your model). At the end of each epoch, the <a href="/docs/transformers/main/en/main_classes/trainer#transformers.Trainer">Trainer</a> will evaluate the ROUGE metric and save the training checkpoint.</li> <li>Pass the training arguments to <a href="/docs/transformers/main/en/main_classes/trainer#transformers.Seq2SeqTrainer">Seq2SeqTrainer</a> along with the model, dataset, tokenizer, data collator, and <code>compute_metrics</code> function.</li> <li>Call <a href="/docs/transformers/main/en/main_classes/trainer#transformers.Trainer.train">train()</a> to finetune your model.</li>',W,_,R,r,U='Once training is completed, share your model to the Hub with the <a href="/docs/transformers/main/en/main_classes/trainer#transformers.Trainer.push_to_hub">push_to_hub()</a> method so everyone can use your model:',I,z,H;return s=new Tt({props:{$$slots:{default:[rs]},$$scope:{ctx:J}}}),v=new Z({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}}),_=new Z({props:{code:"dHJhaW5pbmdfYXJncyUyMCUzRCUyMFNlcTJTZXFUcmFpbmluZ0FyZ3VtZW50cyglMEElMjAlMjAlMjAlMjBvdXRwdXRfZGlyJTNEJTIybXlfYXdlc29tZV9iaWxsc3VtX21vZGVsJTIyJTJDJTBBJTIwJTIwJTIwJTIwZXZhbHVhdGlvbl9zdHJhdGVneSUzRCUyMmVwb2NoJTIyJTJDJTBBJTIwJTIwJTIwJTIwbGVhcm5pbmdfcmF0ZSUzRDJlLTUlMkMlMEElMjAlMjAlMjAlMjBwZXJfZGV2aWNlX3RyYWluX2JhdGNoX3NpemUlM0QxNiUyQyUwQSUyMCUyMCUyMCUyMHBlcl9kZXZpY2VfZXZhbF9iYXRjaF9zaXplJTNEMTYlMkMlMEElMjAlMjAlMjAlMjB3ZWlnaHRfZGVjYXklM0QwLjAxJTJDJTBBJTIwJTIwJTIwJTIwc2F2ZV90b3RhbF9saW1pdCUzRDMlMkMlMEElMjAlMjAlMjAlMjBudW1fdHJhaW5fZXBvY2hzJTNENCUyQyUwQSUyMCUyMCUyMCUyMHByZWRpY3Rfd2l0aF9nZW5lcmF0ZSUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjBmcDE2JTNEVHJ1ZSUyQyUwQSUyMCUyMCUyMCUyMHB1c2hfdG9faHViJTNEVHJ1ZSUyQyUwQSklMEElMEF0cmFpbmVyJTIwJTNEJTIwU2VxMlNlcVRyYWluZXIoJTBBJTIwJTIwJTIwJTIwbW9kZWwlM0Rtb2RlbCUyQyUwQSUyMCUyMCUyMCUyMGFyZ3MlM0R0cmFpbmluZ19hcmdzJTJDJTBBJTIwJTIwJTIwJTIwdHJhaW5fZGF0YXNldCUzRHRva2VuaXplZF9iaWxsc3VtJTVCJTIydHJhaW4lMjIlNUQlMkMlMEElMjAlMjAlMjAlMjBldmFsX2RhdGFzZXQlM0R0b2tlbml6ZWRfYmlsbHN1bSU1QiUyMnRlc3QlMjIlNUQlMkMlMEElMjAlMjAlMjAlMjB0b2tlbml6ZXIlM0R0b2tlbml6ZXIlMkMlMEElMjAlMjAlMjAlMjBkYXRhX2NvbGxhdG9yJTNEZGF0YV9jb2xsYXRvciUyQyUwQSUyMCUyMCUyMCUyMGNvbXB1dGVfbWV0cmljcyUzRGNvbXB1dGVfbWV0cmljcyUyQyUwQSklMEElMEF0cmFpbmVyLnRyYWluKCk=",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>    evaluation_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-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>    tokenizer=tokenizer,
<span class="hljs-meta">... </span>    data_collator=data_collator,
<span class="hljs-meta">... </span>    compute_metrics=compute_metrics,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.train()`,wrap:!1}}),z=new Z({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=w("p"),t.innerHTML=m,g=i(),f(v.$$.fragment),B=i(),G=w("p"),G.textContent=C,V=i(),k=w("ol"),k.innerHTML=F,W=i(),f(_.$$.fragment),R=i(),r=w("p"),r.innerHTML=U,I=i(),f(z.$$.fragment)},l(h){u(s.$$.fragment,h),c=p(h),t=$(h,"P",{"data-svelte-h":!0}),T(t)!=="svelte-peka6h"&&(t.innerHTML=m),g=p(h),u(v.$$.fragment,h),B=p(h),G=$(h,"P",{"data-svelte-h":!0}),T(G)!=="svelte-l42k0i"&&(G.textContent=C),V=p(h),k=$(h,"OL",{"data-svelte-h":!0}),T(k)!=="svelte-tig37i"&&(k.innerHTML=F),W=p(h),u(_.$$.fragment,h),R=p(h),r=$(h,"P",{"data-svelte-h":!0}),T(r)!=="svelte-1v13hlo"&&(r.innerHTML=U),I=p(h),u(z.$$.fragment,h)},m(h,x){d(s,h,x),l(h,c,x),l(h,t,x),l(h,g,x),d(v,h,x),l(h,B,x),l(h,G,x),l(h,V,x),l(h,k,x),l(h,W,x),d(_,h,x),l(h,R,x),l(h,r,x),l(h,I,x),d(z,h,x),H=!0},p(h,x){const X={};x&2&&(X.$$scope={dirty:x,ctx:h}),s.$set(X)},i(h){H||(y(s.$$.fragment,h),y(v.$$.fragment,h),y(_.$$.fragment,h),y(z.$$.fragment,h),H=!0)},o(h){M(s.$$.fragment,h),M(v.$$.fragment,h),M(_.$$.fragment,h),M(z.$$.fragment,h),H=!1},d(h){h&&(a(c),a(t),a(g),a(B),a(G),a(V),a(k),a(W),a(R),a(r),a(I)),b(s,h),b(v,h),b(_,h),b(z,h)}}}function ps(J){let s,c;return s=new Se({props:{$$slots:{default:[is]},$$scope:{ctx:J}}}),{c(){f(s.$$.fragment)},l(t){u(s.$$.fragment,t)},m(t,m){d(s,t,m),c=!0},p(t,m){const g={};m&2&&(g.$$scope={dirty:m,ctx:t}),s.$set(g)},i(t){c||(y(s.$$.fragment,t),c=!0)},o(t){M(s.$$.fragment,t),c=!1},d(t){b(s,t)}}}function cs(J){let s,c='If you aren’t familiar with finetuning a model with Keras, take a look at the basic tutorial <a href="../training#train-a-tensorflow-model-with-keras">here</a>!';return{c(){s=w("p"),s.innerHTML=c},l(t){s=$(t,"P",{"data-svelte-h":!0}),T(s)!=="svelte-1rd4nl8"&&(s.innerHTML=c)},m(t,m){l(t,s,m)},p:pe,d(t){t&&a(s)}}}function ms(J){let s,c,t,m,g,v='Then you can load T5 with <a href="/docs/transformers/main/en/model_doc/auto#transformers.TFAutoModelForSeq2SeqLM">TFAutoModelForSeq2SeqLM</a>:',B,G,C,V,k='Convert your datasets to the <code>tf.data.Dataset</code> format with <a href="/docs/transformers/main/en/main_classes/model#transformers.TFPreTrainedModel.prepare_tf_dataset">prepare_tf_dataset()</a>:',F,W,_,R,r='Configure the model for training with <a href="https://keras.io/api/models/model_training_apis/#compile-method" rel="nofollow"><code>compile</code></a>. Note that Transformers models all have a default task-relevant loss function, so you don’t need to specify one unless you want to:',U,I,z,H,h='The last two things to setup before you start training is to compute the ROUGE score from the predictions, and provide a way to push your model to the Hub. Both are done by using <a href="../main_classes/keras_callbacks">Keras callbacks</a>.',x,X,ce='Pass your <code>compute_metrics</code> function to <a href="/docs/transformers/main/en/main_classes/keras_callbacks#transformers.KerasMetricCallback">KerasMetricCallback</a>:',E,O,ae,S,me='Specify where to push your model and tokenizer in the <a href="/docs/transformers/main/en/main_classes/keras_callbacks#transformers.PushToHubCallback">PushToHubCallback</a>:',Y,ee,le,N,he="Then bundle your callbacks together:",q,A,Q,te,fe='Finally, you’re ready to start training your model! Call <a href="https://keras.io/api/models/model_training_apis/#fit-method" rel="nofollow"><code>fit</code></a> with your training and validation datasets, the number of epochs, and your callbacks to finetune the model:',L,P,D,se,ue="Once training is completed, your model is automatically uploaded to the Hub so everyone can use it!",K;return s=new Tt({props:{$$slots:{default:[cs]},$$scope:{ctx:J}}}),t=new Z({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 Z({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 Z({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}}),I=new Z({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 Z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycy5rZXJhc19jYWxsYmFja3MlMjBpbXBvcnQlMjBLZXJhc01ldHJpY0NhbGxiYWNrJTBBJTBBbWV0cmljX2NhbGxiYWNrJTIwJTNEJTIwS2VyYXNNZXRyaWNDYWxsYmFjayhtZXRyaWNfZm4lM0Rjb21wdXRlX21ldHJpY3MlMkMlMjBldmFsX2RhdGFzZXQlM0R0Zl92YWxpZGF0aW9uX3NldCk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers.keras_callbacks <span class="hljs-keyword">import</span> KerasMetricCallback

<span class="hljs-meta">&gt;&gt;&gt; </span>metric_callback = KerasMetricCallback(metric_fn=compute_metrics, eval_dataset=tf_validation_set)`,wrap:!1}}),ee=new Z({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}}),A=new Z({props:{code:"Y2FsbGJhY2tzJTIwJTNEJTIwJTVCbWV0cmljX2NhbGxiYWNrJTJDJTIwcHVzaF90b19odWJfY2FsbGJhY2slNUQ=",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>callbacks = [metric_callback, push_to_hub_callback]',wrap:!1}}),P=new Z({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=qt(`
To finetune a model in TensorFlow, start by setting up an optimizer function, learning rate schedule, and some training hyperparameters:

	`),f(t.$$.fragment),m=i(),g=w("p"),g.innerHTML=v,B=i(),f(G.$$.fragment),C=i(),V=w("p"),V.innerHTML=k,F=i(),f(W.$$.fragment),_=i(),R=w("p"),R.innerHTML=r,U=i(),f(I.$$.fragment),z=i(),H=w("p"),H.innerHTML=h,x=i(),X=w("p"),X.innerHTML=ce,E=i(),f(O.$$.fragment),ae=i(),S=w("p"),S.innerHTML=me,Y=i(),f(ee.$$.fragment),le=i(),N=w("p"),N.textContent=he,q=i(),f(A.$$.fragment),Q=i(),te=w("p"),te.innerHTML=fe,L=i(),f(P.$$.fragment),D=i(),se=w("p"),se.textContent=ue},l(o){u(s.$$.fragment,o),c=At(o,`
To finetune a model in TensorFlow, start by setting up an optimizer function, learning rate schedule, and some training hyperparameters:

	`),u(t.$$.fragment,o),m=p(o),g=$(o,"P",{"data-svelte-h":!0}),T(g)!=="svelte-17zh4n3"&&(g.innerHTML=v),B=p(o),u(G.$$.fragment,o),C=p(o),V=$(o,"P",{"data-svelte-h":!0}),T(V)!=="svelte-9ymftz"&&(V.innerHTML=k),F=p(o),u(W.$$.fragment,o),_=p(o),R=$(o,"P",{"data-svelte-h":!0}),T(R)!=="svelte-17cxx5e"&&(R.innerHTML=r),U=p(o),u(I.$$.fragment,o),z=p(o),H=$(o,"P",{"data-svelte-h":!0}),T(H)!=="svelte-ugq3ja"&&(H.innerHTML=h),x=p(o),X=$(o,"P",{"data-svelte-h":!0}),T(X)!=="svelte-bi2rpv"&&(X.innerHTML=ce),E=p(o),u(O.$$.fragment,o),ae=p(o),S=$(o,"P",{"data-svelte-h":!0}),T(S)!=="svelte-1b3skyn"&&(S.innerHTML=me),Y=p(o),u(ee.$$.fragment,o),le=p(o),N=$(o,"P",{"data-svelte-h":!0}),T(N)!=="svelte-1lw9xm8"&&(N.textContent=he),q=p(o),u(A.$$.fragment,o),Q=p(o),te=$(o,"P",{"data-svelte-h":!0}),T(te)!=="svelte-1hrpv1v"&&(te.innerHTML=fe),L=p(o),u(P.$$.fragment,o),D=p(o),se=$(o,"P",{"data-svelte-h":!0}),T(se)!=="svelte-2s71om"&&(se.textContent=ue)},m(o,j){d(s,o,j),l(o,c,j),d(t,o,j),l(o,m,j),l(o,g,j),l(o,B,j),d(G,o,j),l(o,C,j),l(o,V,j),l(o,F,j),d(W,o,j),l(o,_,j),l(o,R,j),l(o,U,j),d(I,o,j),l(o,z,j),l(o,H,j),l(o,x,j),l(o,X,j),l(o,E,j),d(O,o,j),l(o,ae,j),l(o,S,j),l(o,Y,j),d(ee,o,j),l(o,le,j),l(o,N,j),l(o,q,j),d(A,o,j),l(o,Q,j),l(o,te,j),l(o,L,j),d(P,o,j),l(o,D,j),l(o,se,j),K=!0},p(o,j){const Ne={};j&2&&(Ne.$$scope={dirty:j,ctx:o}),s.$set(Ne)},i(o){K||(y(s.$$.fragment,o),y(t.$$.fragment,o),y(G.$$.fragment,o),y(W.$$.fragment,o),y(I.$$.fragment,o),y(O.$$.fragment,o),y(ee.$$.fragment,o),y(A.$$.fragment,o),y(P.$$.fragment,o),K=!0)},o(o){M(s.$$.fragment,o),M(t.$$.fragment,o),M(G.$$.fragment,o),M(W.$$.fragment,o),M(I.$$.fragment,o),M(O.$$.fragment,o),M(ee.$$.fragment,o),M(A.$$.fragment,o),M(P.$$.fragment,o),K=!1},d(o){o&&(a(c),a(m),a(g),a(B),a(C),a(V),a(F),a(_),a(R),a(U),a(z),a(H),a(x),a(X),a(E),a(ae),a(S),a(Y),a(le),a(N),a(q),a(Q),a(te),a(L),a(D),a(se)),b(s,o),b(t,o),b(G,o),b(W,o),b(I,o),b(O,o),b(ee,o),b(A,o),b(P,o)}}}function hs(J){let s,c;return s=new Se({props:{$$slots:{default:[ms]},$$scope:{ctx:J}}}),{c(){f(s.$$.fragment)},l(t){u(s.$$.fragment,t)},m(t,m){d(s,t,m),c=!0},p(t,m){const g={};m&2&&(g.$$scope={dirty:m,ctx:t}),s.$set(g)},i(t){c||(y(s.$$.fragment,t),c=!0)},o(t){M(s.$$.fragment,t),c=!1},d(t){b(s,t)}}}function fs(J){let s,c=`For a more in-depth example of how to finetune a model for summarization, take a look at the corresponding
<a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/summarization.ipynb" rel="nofollow">PyTorch notebook</a>
or <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/summarization-tf.ipynb" rel="nofollow">TensorFlow notebook</a>.`;return{c(){s=w("p"),s.innerHTML=c},l(t){s=$(t,"P",{"data-svelte-h":!0}),T(s)!=="svelte-qyprqu"&&(s.innerHTML=c)},m(t,m){l(t,s,m)},p:pe,d(t){t&&a(s)}}}function us(J){let s,c="Tokenize the text and return the <code>input_ids</code> as PyTorch tensors:",t,m,g,v,B='Use the <a href="/docs/transformers/main/en/model_doc/phi#transformers.PhiForCausalLM.generate">generate()</a> method to create the summarization. For more details about the different text generation strategies and parameters for controlling generation, check out the <a href="../main_classes/text_generation">Text Generation</a> API.',G,C,V,k,F="Decode the generated token ids back into text:",W,_,R;return m=new Z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJzdGV2aGxpdSUyRm15X2F3ZXNvbWVfYmlsbHN1bV9tb2RlbCUyMiklMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIodGV4dCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpLmlucHV0X2lkcw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;stevhliu/my_awesome_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}}),C=new Z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvclNlcTJTZXFMTSUwQSUwQW1vZGVsJTIwJTNEJTIwQXV0b01vZGVsRm9yU2VxMlNlcUxNLmZyb21fcHJldHJhaW5lZCglMjJzdGV2aGxpdSUyRm15X2F3ZXNvbWVfYmlsbHN1bV9tb2RlbCUyMiklMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoaW5wdXRzJTJDJTIwbWF4X25ld190b2tlbnMlM0QxMDAlMkMlMjBkb19zYW1wbGUlM0RGYWxzZSk=",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;stevhliu/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}}),_=new Z({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=w("p"),s.innerHTML=c,t=i(),f(m.$$.fragment),g=i(),v=w("p"),v.innerHTML=B,G=i(),f(C.$$.fragment),V=i(),k=w("p"),k.textContent=F,W=i(),f(_.$$.fragment)},l(r){s=$(r,"P",{"data-svelte-h":!0}),T(s)!=="svelte-1c2y1ia"&&(s.innerHTML=c),t=p(r),u(m.$$.fragment,r),g=p(r),v=$(r,"P",{"data-svelte-h":!0}),T(v)!=="svelte-1vsfwq2"&&(v.innerHTML=B),G=p(r),u(C.$$.fragment,r),V=p(r),k=$(r,"P",{"data-svelte-h":!0}),T(k)!=="svelte-1918fu9"&&(k.textContent=F),W=p(r),u(_.$$.fragment,r)},m(r,U){l(r,s,U),l(r,t,U),d(m,r,U),l(r,g,U),l(r,v,U),l(r,G,U),d(C,r,U),l(r,V,U),l(r,k,U),l(r,W,U),d(_,r,U),R=!0},p:pe,i(r){R||(y(m.$$.fragment,r),y(C.$$.fragment,r),y(_.$$.fragment,r),R=!0)},o(r){M(m.$$.fragment,r),M(C.$$.fragment,r),M(_.$$.fragment,r),R=!1},d(r){r&&(a(s),a(t),a(g),a(v),a(G),a(V),a(k),a(W)),b(m,r),b(C,r),b(_,r)}}}function ds(J){let s,c;return s=new Se({props:{$$slots:{default:[us]},$$scope:{ctx:J}}}),{c(){f(s.$$.fragment)},l(t){u(s.$$.fragment,t)},m(t,m){d(s,t,m),c=!0},p(t,m){const g={};m&2&&(g.$$scope={dirty:m,ctx:t}),s.$set(g)},i(t){c||(y(s.$$.fragment,t),c=!0)},o(t){M(s.$$.fragment,t),c=!1},d(t){b(s,t)}}}function ys(J){let s,c="Tokenize the text and return the <code>input_ids</code> as TensorFlow tensors:",t,m,g,v,B='Use the <a href="/docs/transformers/main/en/main_classes/text_generation#transformers.TFGenerationMixin.generate">generate()</a> method to create the summarization. For more details about the different text generation strategies and parameters for controlling generation, check out the <a href="../main_classes/text_generation">Text Generation</a> API.',G,C,V,k,F="Decode the generated token ids back into text:",W,_,R;return m=new Z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJzdGV2aGxpdSUyRm15X2F3ZXNvbWVfYmlsbHN1bV9tb2RlbCUyMiklMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIodGV4dCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIydGYlMjIpLmlucHV0X2lkcw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;stevhliu/my_awesome_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}}),C=new Z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGQXV0b01vZGVsRm9yU2VxMlNlcUxNJTBBJTBBbW9kZWwlMjAlM0QlMjBURkF1dG9Nb2RlbEZvclNlcTJTZXFMTS5mcm9tX3ByZXRyYWluZWQoJTIyc3RldmhsaXUlMkZteV9hd2Vzb21lX2JpbGxzdW1fbW9kZWwlMjIpJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKGlucHV0cyUyQyUyMG1heF9uZXdfdG9rZW5zJTNEMTAwJTJDJTIwZG9fc2FtcGxlJTNERmFsc2Up",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;stevhliu/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}}),_=new Z({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=w("p"),s.innerHTML=c,t=i(),f(m.$$.fragment),g=i(),v=w("p"),v.innerHTML=B,G=i(),f(C.$$.fragment),V=i(),k=w("p"),k.textContent=F,W=i(),f(_.$$.fragment)},l(r){s=$(r,"P",{"data-svelte-h":!0}),T(s)!=="svelte-hw2mu6"&&(s.innerHTML=c),t=p(r),u(m.$$.fragment,r),g=p(r),v=$(r,"P",{"data-svelte-h":!0}),T(v)!=="svelte-1sjsfzc"&&(v.innerHTML=B),G=p(r),u(C.$$.fragment,r),V=p(r),k=$(r,"P",{"data-svelte-h":!0}),T(k)!=="svelte-1918fu9"&&(k.textContent=F),W=p(r),u(_.$$.fragment,r)},m(r,U){l(r,s,U),l(r,t,U),d(m,r,U),l(r,g,U),l(r,v,U),l(r,G,U),d(C,r,U),l(r,V,U),l(r,k,U),l(r,W,U),d(_,r,U),R=!0},p:pe,i(r){R||(y(m.$$.fragment,r),y(C.$$.fragment,r),y(_.$$.fragment,r),R=!0)},o(r){M(m.$$.fragment,r),M(C.$$.fragment,r),M(_.$$.fragment,r),R=!1},d(r){r&&(a(s),a(t),a(g),a(v),a(G),a(V),a(k),a(W)),b(m,r),b(C,r),b(_,r)}}}function Ms(J){let s,c;return s=new Se({props:{$$slots:{default:[ys]},$$scope:{ctx:J}}}),{c(){f(s.$$.fragment)},l(t){u(s.$$.fragment,t)},m(t,m){d(s,t,m),c=!0},p(t,m){const g={};m&2&&(g.$$scope={dirty:m,ctx:t}),s.$set(g)},i(t){c||(y(s.$$.fragment,t),c=!0)},o(t){M(s.$$.fragment,t),c=!1},d(t){b(s,t)}}}function bs(J){let s,c,t,m,g,v,B,G,C,V,k,F="Summarization creates a shorter version of a document or an article that captures all the important information. Along with translation, it is another example of a task that can be formulated as a sequence-to-sequence task. Summarization can be:",W,_,R="<li>Extractive: extract the most relevant information from a document.</li> <li>Abstractive: generate new text that captures the most relevant information.</li>",r,U,I="This guide will show you how to:",z,H,h='<li>Finetune <a href="https://huggingface.co/t5-small" rel="nofollow">T5</a> on the California state bill subset of the <a href="https://huggingface.co/datasets/billsum" rel="nofollow">BillSum</a> dataset for abstractive summarization.</li> <li>Use your finetuned model for inference.</li>',x,X,ce,E,O="Before you begin, make sure you have all the necessary libraries installed:",ae,S,me,Y,ee="We encourage you to login to your Hugging Face account so you can upload and share your model with the community. When prompted, enter your token to login:",le,N,he,q,A,Q,te="Start by loading the smaller California state bill subset of the BillSum dataset from the 🤗 Datasets library:",fe,L,P,D,se='Split the dataset into a train and test set with the <a href="https://huggingface.co/docs/datasets/main/en/package_reference/main_classes#datasets.Dataset.train_test_split" rel="nofollow">train_test_split</a> method:',ue,K,o,j,Ne="Then take a look at an example:",Ye,de,qe,ye,_t="There are two fields that you’ll want to use:",Ae,Me,kt="<li><code>text</code>: the text of the bill which’ll be the input to the model.</li> <li><code>summary</code>: a condensed version of <code>text</code> which’ll be the model target.</li>",Qe,be,Le,ge,Jt="The next step is to load a T5 tokenizer to process <code>text</code> and <code>summary</code>:",Pe,we,De,$e,vt="The preprocessing function you want to create needs to:",Ke,je,Ct="<li>Prefix the input with a prompt so T5 knows this is a summarization task. Some models capable of multiple NLP tasks require prompting for specific tasks.</li> <li>Use the keyword <code>text_target</code> argument when tokenizing labels.</li> <li>Truncate sequences to be no longer than the maximum length set by the <code>max_length</code> parameter.</li>",Oe,Te,et,Ue,Zt='To apply the preprocessing function over the entire dataset, use 🤗 Datasets <a href="https://huggingface.co/docs/datasets/main/en/package_reference/main_classes#datasets.Dataset.map" rel="nofollow">map</a> method. You can speed up the <code>map</code> function by setting <code>batched=True</code> to process multiple elements of the dataset at once:',tt,_e,st,ke,Gt='Now create a batch of examples using <a href="/docs/transformers/main/en/main_classes/data_collator#transformers.DataCollatorForSeq2Seq">DataCollatorForSeq2Seq</a>. It’s more efficient to <em>dynamically pad</em> the sentences to the longest length in a batch during collation, instead of padding the whole dataset to the maximum length.',at,ne,lt,Je,nt,ve,xt='Including a metric during training is often helpful for evaluating your model’s performance. You can quickly load a evaluation method with the 🤗 <a href="https://huggingface.co/docs/evaluate/index" rel="nofollow">Evaluate</a> library. For this task, load the <a href="https://huggingface.co/spaces/evaluate-metric/rouge" rel="nofollow">ROUGE</a> metric (see the 🤗 Evaluate <a href="https://huggingface.co/docs/evaluate/a_quick_tour" rel="nofollow">quick tour</a> to learn more about how to load and compute a metric):',ot,Ce,rt,Ze,Vt='Then create a function that passes your predictions and labels to <a href="https://huggingface.co/docs/evaluate/main/en/package_reference/main_classes#evaluate.EvaluationModule.compute" rel="nofollow">compute</a> to calculate the ROUGE metric:',it,Ge,pt,xe,Wt="Your <code>compute_metrics</code> function is ready to go now, and you’ll return to it when you setup your training.",ct,Ve,mt,oe,ht,re,ft,We,ut,Re,Rt="Great, now that you’ve finetuned a model, you can use it for inference!",dt,Be,Bt="Come up with some text you’d like to summarize. For T5, you need to prefix your input depending on the task you’re working on. For summarization you should prefix your input as shown below:",yt,He,Mt,Xe,Ht='The simplest way to try out your finetuned model for inference is to use it in a <a href="/docs/transformers/main/en/main_classes/pipelines#transformers.pipeline">pipeline()</a>. Instantiate a <code>pipeline</code> for summarization with your model, and pass your text to it:',bt,ze,gt,Fe,Xt="You can also manually replicate the results of the <code>pipeline</code> if you’d like:",wt,ie,$t,Ee,jt;return g=new Ie({props:{title:"Summarization",local:"summarization",headingTag:"h1"}}),B=new ts({props:{classNames:"absolute z-10 right-0 top-0",options:[{label:"Mixed",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/en/summarization.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/en/pytorch/summarization.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/en/tensorflow/summarization.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/en/summarization.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/en/pytorch/summarization.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/en/tensorflow/summarization.ipynb"}]}}),C=new es({props:{id:"yHnr5Dk2zCI"}}),X=new Tt({props:{$$slots:{default:[ss]},$$scope:{ctx:J}}}),S=new Z({props:{code:"cGlwJTIwaW5zdGFsbCUyMHRyYW5zZm9ybWVycyUyMGRhdGFzZXRzJTIwZXZhbHVhdGUlMjByb3VnZV9zY29yZQ==",highlighted:"pip install transformers datasets evaluate rouge_score",wrap:!1}}),N=new Z({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 Ie({props:{title:"Load BillSum dataset",local:"load-billsum-dataset",headingTag:"h2"}}),L=new Z({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 Z({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}}),de=new Z({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 Ie({props:{title:"Preprocess",local:"preprocess",headingTag:"h2"}}),we=new Z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEFjaGVja3BvaW50JTIwJTNEJTIwJTIydDUtc21hbGwlMjIlMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZChjaGVja3BvaW50KQ==",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;t5-small&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(checkpoint)`,wrap:!1}}),Te=new Z({props:{code:"cHJlZml4JTIwJTNEJTIwJTIyc3VtbWFyaXplJTNBJTIwJTIyJTBBJTBBJTBBZGVmJTIwcHJlcHJvY2Vzc19mdW5jdGlvbihleGFtcGxlcyklM0ElMEElMjAlMjAlMjAlMjBpbnB1dHMlMjAlM0QlMjAlNUJwcmVmaXglMjAlMkIlMjBkb2MlMjBmb3IlMjBkb2MlMjBpbiUyMGV4YW1wbGVzJTVCJTIydGV4dCUyMiU1RCU1RCUwQSUyMCUyMCUyMCUyMG1vZGVsX2lucHV0cyUyMCUzRCUyMHRva2VuaXplcihpbnB1dHMlMkMlMjBtYXhfbGVuZ3RoJTNEMTAyNCUyQyUyMHRydW5jYXRpb24lM0RUcnVlKSUwQSUwQSUyMCUyMCUyMCUyMGxhYmVscyUyMCUzRCUyMHRva2VuaXplcih0ZXh0X3RhcmdldCUzRGV4YW1wbGVzJTVCJTIyc3VtbWFyeSUyMiU1RCUyQyUyMG1heF9sZW5ndGglM0QxMjglMkMlMjB0cnVuY2F0aW9uJTNEVHJ1ZSklMEElMEElMjAlMjAlMjAlMjBtb2RlbF9pbnB1dHMlNUIlMjJsYWJlbHMlMjIlNUQlMjAlM0QlMjBsYWJlbHMlNUIlMjJpbnB1dF9pZHMlMjIlNUQlMEElMjAlMjAlMjAlMjByZXR1cm4lMjBtb2RlbF9pbnB1dHM=",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}}),_e=new Z({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 Ut({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[os],pytorch:[ls]},$$scope:{ctx:J}}}),Je=new Ie({props:{title:"Evaluate",local:"evaluate",headingTag:"h2"}}),Ce=new Z({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 Z({props:{code:"aW1wb3J0JTIwbnVtcHklMjBhcyUyMG5wJTBBJTBBJTBBZGVmJTIwY29tcHV0ZV9tZXRyaWNzKGV2YWxfcHJlZCklM0ElMEElMjAlMjAlMjAlMjBwcmVkaWN0aW9ucyUyQyUyMGxhYmVscyUyMCUzRCUyMGV2YWxfcHJlZCUwQSUyMCUyMCUyMCUyMGRlY29kZWRfcHJlZHMlMjAlM0QlMjB0b2tlbml6ZXIuYmF0Y2hfZGVjb2RlKHByZWRpY3Rpb25zJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUpJTBBJTIwJTIwJTIwJTIwbGFiZWxzJTIwJTNEJTIwbnAud2hlcmUobGFiZWxzJTIwISUzRCUyMC0xMDAlMkMlMjBsYWJlbHMlMkMlMjB0b2tlbml6ZXIucGFkX3Rva2VuX2lkKSUwQSUyMCUyMCUyMCUyMGRlY29kZWRfbGFiZWxzJTIwJTNEJTIwdG9rZW5pemVyLmJhdGNoX2RlY29kZShsYWJlbHMlMkMlMjBza2lwX3NwZWNpYWxfdG9rZW5zJTNEVHJ1ZSklMEElMEElMjAlMjAlMjAlMjByZXN1bHQlMjAlM0QlMjByb3VnZS5jb21wdXRlKHByZWRpY3Rpb25zJTNEZGVjb2RlZF9wcmVkcyUyQyUyMHJlZmVyZW5jZXMlM0RkZWNvZGVkX2xhYmVscyUyQyUyMHVzZV9zdGVtbWVyJTNEVHJ1ZSklMEElMEElMjAlMjAlMjAlMjBwcmVkaWN0aW9uX2xlbnMlMjAlM0QlMjAlNUJucC5jb3VudF9ub256ZXJvKHByZWQlMjAhJTNEJTIwdG9rZW5pemVyLnBhZF90b2tlbl9pZCklMjBmb3IlMjBwcmVkJTIwaW4lMjBwcmVkaWN0aW9ucyU1RCUwQSUyMCUyMCUyMCUyMHJlc3VsdCU1QiUyMmdlbl9sZW4lMjIlNUQlMjAlM0QlMjBucC5tZWFuKHByZWRpY3Rpb25fbGVucyklMEElMEElMjAlMjAlMjAlMjByZXR1cm4lMjAlN0JrJTNBJTIwcm91bmQodiUyQyUyMDQpJTIwZm9yJTIwayUyQyUyMHYlMjBpbiUyMHJlc3VsdC5pdGVtcygpJTdE",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 Ie({props:{title:"Train",local:"train",headingTag:"h2"}}),oe=new Ut({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[hs],pytorch:[ps]},$$scope:{ctx:J}}}),re=new Tt({props:{$$slots:{default:[fs]},$$scope:{ctx:J}}}),We=new Ie({props:{title:"Inference",local:"inference",headingTag:"h2"}}),He=new Z({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 Z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBc3VtbWFyaXplciUyMCUzRCUyMHBpcGVsaW5lKCUyMnN1bW1hcml6YXRpb24lMjIlMkMlMjBtb2RlbCUzRCUyMnN0ZXZobGl1JTJGbXlfYXdlc29tZV9iaWxsc3VtX21vZGVsJTIyKSUwQXN1bW1hcml6ZXIodGV4dCk=",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;stevhliu/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 Ut({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[Ms],pytorch:[ds]},$$scope:{ctx:J}}}),{c(){s=w("meta"),c=i(),t=w("p"),m=i(),f(g.$$.fragment),v=i(),f(B.$$.fragment),G=i(),f(C.$$.fragment),V=i(),k=w("p"),k.textContent=F,W=i(),_=w("ul"),_.innerHTML=R,r=i(),U=w("p"),U.textContent=I,z=i(),H=w("ol"),H.innerHTML=h,x=i(),f(X.$$.fragment),ce=i(),E=w("p"),E.textContent=O,ae=i(),f(S.$$.fragment),me=i(),Y=w("p"),Y.textContent=ee,le=i(),f(N.$$.fragment),he=i(),f(q.$$.fragment),A=i(),Q=w("p"),Q.textContent=te,fe=i(),f(L.$$.fragment),P=i(),D=w("p"),D.innerHTML=se,ue=i(),f(K.$$.fragment),o=i(),j=w("p"),j.textContent=Ne,Ye=i(),f(de.$$.fragment),qe=i(),ye=w("p"),ye.textContent=_t,Ae=i(),Me=w("ul"),Me.innerHTML=kt,Qe=i(),f(be.$$.fragment),Le=i(),ge=w("p"),ge.innerHTML=Jt,Pe=i(),f(we.$$.fragment),De=i(),$e=w("p"),$e.textContent=vt,Ke=i(),je=w("ol"),je.innerHTML=Ct,Oe=i(),f(Te.$$.fragment),et=i(),Ue=w("p"),Ue.innerHTML=Zt,tt=i(),f(_e.$$.fragment),st=i(),ke=w("p"),ke.innerHTML=Gt,at=i(),f(ne.$$.fragment),lt=i(),f(Je.$$.fragment),nt=i(),ve=w("p"),ve.innerHTML=xt,ot=i(),f(Ce.$$.fragment),rt=i(),Ze=w("p"),Ze.innerHTML=Vt,it=i(),f(Ge.$$.fragment),pt=i(),xe=w("p"),xe.innerHTML=Wt,ct=i(),f(Ve.$$.fragment),mt=i(),f(oe.$$.fragment),ht=i(),f(re.$$.fragment),ft=i(),f(We.$$.fragment),ut=i(),Re=w("p"),Re.textContent=Rt,dt=i(),Be=w("p"),Be.textContent=Bt,yt=i(),f(He.$$.fragment),Mt=i(),Xe=w("p"),Xe.innerHTML=Ht,bt=i(),f(ze.$$.fragment),gt=i(),Fe=w("p"),Fe.innerHTML=Xt,wt=i(),f(ie.$$.fragment),$t=i(),Ee=w("p"),this.h()},l(e){const n=Kt("svelte-u9bgzb",document.head);s=$(n,"META",{name:!0,content:!0}),n.forEach(a),c=p(e),t=$(e,"P",{}),Et(t).forEach(a),m=p(e),u(g.$$.fragment,e),v=p(e),u(B.$$.fragment,e),G=p(e),u(C.$$.fragment,e),V=p(e),k=$(e,"P",{"data-svelte-h":!0}),T(k)!=="svelte-1m8hm66"&&(k.textContent=F),W=p(e),_=$(e,"UL",{"data-svelte-h":!0}),T(_)!=="svelte-1rofy1u"&&(_.innerHTML=R),r=p(e),U=$(e,"P",{"data-svelte-h":!0}),T(U)!=="svelte-1aff4p7"&&(U.textContent=I),z=p(e),H=$(e,"OL",{"data-svelte-h":!0}),T(H)!=="svelte-8msm5v"&&(H.innerHTML=h),x=p(e),u(X.$$.fragment,e),ce=p(e),E=$(e,"P",{"data-svelte-h":!0}),T(E)!=="svelte-1c9nexd"&&(E.textContent=O),ae=p(e),u(S.$$.fragment,e),me=p(e),Y=$(e,"P",{"data-svelte-h":!0}),T(Y)!=="svelte-k76o1m"&&(Y.textContent=ee),le=p(e),u(N.$$.fragment,e),he=p(e),u(q.$$.fragment,e),A=p(e),Q=$(e,"P",{"data-svelte-h":!0}),T(Q)!=="svelte-l4wmf4"&&(Q.textContent=te),fe=p(e),u(L.$$.fragment,e),P=p(e),D=$(e,"P",{"data-svelte-h":!0}),T(D)!=="svelte-11qrtib"&&(D.innerHTML=se),ue=p(e),u(K.$$.fragment,e),o=p(e),j=$(e,"P",{"data-svelte-h":!0}),T(j)!=="svelte-1m91ua0"&&(j.textContent=Ne),Ye=p(e),u(de.$$.fragment,e),qe=p(e),ye=$(e,"P",{"data-svelte-h":!0}),T(ye)!=="svelte-1a8v1m8"&&(ye.textContent=_t),Ae=p(e),Me=$(e,"UL",{"data-svelte-h":!0}),T(Me)!=="svelte-1f0gqje"&&(Me.innerHTML=kt),Qe=p(e),u(be.$$.fragment,e),Le=p(e),ge=$(e,"P",{"data-svelte-h":!0}),T(ge)!=="svelte-lfk9rm"&&(ge.innerHTML=Jt),Pe=p(e),u(we.$$.fragment,e),De=p(e),$e=$(e,"P",{"data-svelte-h":!0}),T($e)!=="svelte-pduvot"&&($e.textContent=vt),Ke=p(e),je=$(e,"OL",{"data-svelte-h":!0}),T(je)!=="svelte-11ryhh6"&&(je.innerHTML=Ct),Oe=p(e),u(Te.$$.fragment,e),et=p(e),Ue=$(e,"P",{"data-svelte-h":!0}),T(Ue)!=="svelte-74644w"&&(Ue.innerHTML=Zt),tt=p(e),u(_e.$$.fragment,e),st=p(e),ke=$(e,"P",{"data-svelte-h":!0}),T(ke)!=="svelte-1yb3v27"&&(ke.innerHTML=Gt),at=p(e),u(ne.$$.fragment,e),lt=p(e),u(Je.$$.fragment,e),nt=p(e),ve=$(e,"P",{"data-svelte-h":!0}),T(ve)!=="svelte-767wh5"&&(ve.innerHTML=xt),ot=p(e),u(Ce.$$.fragment,e),rt=p(e),Ze=$(e,"P",{"data-svelte-h":!0}),T(Ze)!=="svelte-e6vwbk"&&(Ze.innerHTML=Vt),it=p(e),u(Ge.$$.fragment,e),pt=p(e),xe=$(e,"P",{"data-svelte-h":!0}),T(xe)!=="svelte-183aynn"&&(xe.innerHTML=Wt),ct=p(e),u(Ve.$$.fragment,e),mt=p(e),u(oe.$$.fragment,e),ht=p(e),u(re.$$.fragment,e),ft=p(e),u(We.$$.fragment,e),ut=p(e),Re=$(e,"P",{"data-svelte-h":!0}),T(Re)!=="svelte-633ppb"&&(Re.textContent=Rt),dt=p(e),Be=$(e,"P",{"data-svelte-h":!0}),T(Be)!=="svelte-18tsusp"&&(Be.textContent=Bt),yt=p(e),u(He.$$.fragment,e),Mt=p(e),Xe=$(e,"P",{"data-svelte-h":!0}),T(Xe)!=="svelte-105og9"&&(Xe.innerHTML=Ht),bt=p(e),u(ze.$$.fragment,e),gt=p(e),Fe=$(e,"P",{"data-svelte-h":!0}),T(Fe)!=="svelte-1njl8vm"&&(Fe.innerHTML=Xt),wt=p(e),u(ie.$$.fragment,e),$t=p(e),Ee=$(e,"P",{}),Et(Ee).forEach(a),this.h()},h(){Yt(s,"name","hf:doc:metadata"),Yt(s,"content",gs)},m(e,n){Ot(document.head,s),l(e,c,n),l(e,t,n),l(e,m,n),d(g,e,n),l(e,v,n),d(B,e,n),l(e,G,n),d(C,e,n),l(e,V,n),l(e,k,n),l(e,W,n),l(e,_,n),l(e,r,n),l(e,U,n),l(e,z,n),l(e,H,n),l(e,x,n),d(X,e,n),l(e,ce,n),l(e,E,n),l(e,ae,n),d(S,e,n),l(e,me,n),l(e,Y,n),l(e,le,n),d(N,e,n),l(e,he,n),d(q,e,n),l(e,A,n),l(e,Q,n),l(e,fe,n),d(L,e,n),l(e,P,n),l(e,D,n),l(e,ue,n),d(K,e,n),l(e,o,n),l(e,j,n),l(e,Ye,n),d(de,e,n),l(e,qe,n),l(e,ye,n),l(e,Ae,n),l(e,Me,n),l(e,Qe,n),d(be,e,n),l(e,Le,n),l(e,ge,n),l(e,Pe,n),d(we,e,n),l(e,De,n),l(e,$e,n),l(e,Ke,n),l(e,je,n),l(e,Oe,n),d(Te,e,n),l(e,et,n),l(e,Ue,n),l(e,tt,n),d(_e,e,n),l(e,st,n),l(e,ke,n),l(e,at,n),d(ne,e,n),l(e,lt,n),d(Je,e,n),l(e,nt,n),l(e,ve,n),l(e,ot,n),d(Ce,e,n),l(e,rt,n),l(e,Ze,n),l(e,it,n),d(Ge,e,n),l(e,pt,n),l(e,xe,n),l(e,ct,n),d(Ve,e,n),l(e,mt,n),d(oe,e,n),l(e,ht,n),d(re,e,n),l(e,ft,n),d(We,e,n),l(e,ut,n),l(e,Re,n),l(e,dt,n),l(e,Be,n),l(e,yt,n),d(He,e,n),l(e,Mt,n),l(e,Xe,n),l(e,bt,n),d(ze,e,n),l(e,gt,n),l(e,Fe,n),l(e,wt,n),d(ie,e,n),l(e,$t,n),l(e,Ee,n),jt=!0},p(e,[n]){const zt={};n&2&&(zt.$$scope={dirty:n,ctx:e}),X.$set(zt);const Ft={};n&2&&(Ft.$$scope={dirty:n,ctx:e}),ne.$set(Ft);const It={};n&2&&(It.$$scope={dirty:n,ctx:e}),oe.$set(It);const St={};n&2&&(St.$$scope={dirty:n,ctx:e}),re.$set(St);const Nt={};n&2&&(Nt.$$scope={dirty:n,ctx:e}),ie.$set(Nt)},i(e){jt||(y(g.$$.fragment,e),y(B.$$.fragment,e),y(C.$$.fragment,e),y(X.$$.fragment,e),y(S.$$.fragment,e),y(N.$$.fragment,e),y(q.$$.fragment,e),y(L.$$.fragment,e),y(K.$$.fragment,e),y(de.$$.fragment,e),y(be.$$.fragment,e),y(we.$$.fragment,e),y(Te.$$.fragment,e),y(_e.$$.fragment,e),y(ne.$$.fragment,e),y(Je.$$.fragment,e),y(Ce.$$.fragment,e),y(Ge.$$.fragment,e),y(Ve.$$.fragment,e),y(oe.$$.fragment,e),y(re.$$.fragment,e),y(We.$$.fragment,e),y(He.$$.fragment,e),y(ze.$$.fragment,e),y(ie.$$.fragment,e),jt=!0)},o(e){M(g.$$.fragment,e),M(B.$$.fragment,e),M(C.$$.fragment,e),M(X.$$.fragment,e),M(S.$$.fragment,e),M(N.$$.fragment,e),M(q.$$.fragment,e),M(L.$$.fragment,e),M(K.$$.fragment,e),M(de.$$.fragment,e),M(be.$$.fragment,e),M(we.$$.fragment,e),M(Te.$$.fragment,e),M(_e.$$.fragment,e),M(ne.$$.fragment,e),M(Je.$$.fragment,e),M(Ce.$$.fragment,e),M(Ge.$$.fragment,e),M(Ve.$$.fragment,e),M(oe.$$.fragment,e),M(re.$$.fragment,e),M(We.$$.fragment,e),M(He.$$.fragment,e),M(ze.$$.fragment,e),M(ie.$$.fragment,e),jt=!1},d(e){e&&(a(c),a(t),a(m),a(v),a(G),a(V),a(k),a(W),a(_),a(r),a(U),a(z),a(H),a(x),a(ce),a(E),a(ae),a(me),a(Y),a(le),a(he),a(A),a(Q),a(fe),a(P),a(D),a(ue),a(o),a(j),a(Ye),a(qe),a(ye),a(Ae),a(Me),a(Qe),a(Le),a(ge),a(Pe),a(De),a($e),a(Ke),a(je),a(Oe),a(et),a(Ue),a(tt),a(st),a(ke),a(at),a(lt),a(nt),a(ve),a(ot),a(rt),a(Ze),a(it),a(pt),a(xe),a(ct),a(mt),a(ht),a(ft),a(ut),a(Re),a(dt),a(Be),a(yt),a(Mt),a(Xe),a(bt),a(gt),a(Fe),a(wt),a($t),a(Ee)),a(s),b(g,e),b(B,e),b(C,e),b(X,e),b(S,e),b(N,e),b(q,e),b(L,e),b(K,e),b(de,e),b(be,e),b(we,e),b(Te,e),b(_e,e),b(ne,e),b(Je,e),b(Ce,e),b(Ge,e),b(Ve,e),b(oe,e),b(re,e),b(We,e),b(He,e),b(ze,e),b(ie,e)}}}const gs='{"title":"Summarization","local":"summarization","sections":[{"title":"Load BillSum dataset","local":"load-billsum-dataset","sections":[],"depth":2},{"title":"Preprocess","local":"preprocess","sections":[],"depth":2},{"title":"Evaluate","local":"evaluate","sections":[],"depth":2},{"title":"Train","local":"train","sections":[],"depth":2},{"title":"Inference","local":"inference","sections":[],"depth":2}],"depth":1}';function ws(J){return Lt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Cs extends Pt{constructor(s){super(),Dt(this,s,ws,bs,Qt,{})}}export{Cs as component};
