import{S as vo,i as jo,s as Eo,e as n,k as d,w as q,t as s,M as qo,c as l,d as a,m as _,a as i,x as T,h as r,b as g,G as t,g as m,y as S,q as A,o as x,B as z,v as To,L as $s}from"../../chunks/vendor-hf-doc-builder.js";import{T as gs}from"../../chunks/Tip-hf-doc-builder.js";import{Y as So}from"../../chunks/Youtube-hf-doc-builder.js";import{I as ra}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{C as K}from"../../chunks/CodeBlock-hf-doc-builder.js";import{F as jr,M as oa}from"../../chunks/Markdown-hf-doc-builder.js";function Ao(R){let p,h,o,$,w,j,P,F,y,M,C,B,U,Y,J,ee,Q,D,re,H,te,W,O,L,u,k,G,Z,ae,oe,ne,de,se,Me,he,_e,Le,Ee,N,xe,le,qe,ye,ce,ke,ve,ge,ie,b,I,X,V,Pe,fe,De,$e,me,Te,ze,be,je,ue,pe,Ce;return{c(){p=s(`The task illustrated in this tutorial is supported by the following model architectures:

`),h=n("p"),o=n("a"),$=s("BART"),w=s(", "),j=n("a"),P=s("BigBird-Pegasus"),F=s(", "),y=n("a"),M=s("Blenderbot"),C=s(", "),B=n("a"),U=s("BlenderbotSmall"),Y=s(", "),J=n("a"),ee=s("Encoder decoder"),Q=s(", "),D=n("a"),re=s("FairSeq Machine-Translation"),H=s(", "),te=n("a"),W=s("LED"),O=s(", "),L=n("a"),u=s("LongT5"),k=s(", "),G=n("a"),Z=s("M2M100"),ae=s(", "),oe=n("a"),ne=s("Marian"),de=s(", "),se=n("a"),Me=s("mBART"),he=s(", "),_e=n("a"),Le=s("MT5"),Ee=s(", "),N=n("a"),xe=s("MVP"),le=s(", "),qe=n("a"),ye=s("NLLB"),ce=s(", "),ke=n("a"),ve=s("Pegasus"),ge=s(", "),ie=n("a"),b=s("PEGASUS-X"),I=s(", "),X=n("a"),V=s("PLBart"),Pe=s(", "),fe=n("a"),De=s("ProphetNet"),$e=s(", "),me=n("a"),Te=s("SwitchTransformers"),ze=s(", "),be=n("a"),je=s("T5"),ue=s(", "),pe=n("a"),Ce=s("XLM-ProphetNet"),this.h()},l(we){p=r(we,`The task illustrated in this tutorial is supported by the following model architectures:

`),h=l(we,"P",{});var v=i(h);o=l(v,"A",{href:!0});var Qe=i(o);$=r(Qe,"BART"),Qe.forEach(a),w=r(v,", "),j=l(v,"A",{href:!0});var Ze=i(j);P=r(Ze,"BigBird-Pegasus"),Ze.forEach(a),F=r(v,", "),y=l(v,"A",{href:!0});var Ne=i(y);M=r(Ne,"Blenderbot"),Ne.forEach(a),C=r(v,", "),B=l(v,"A",{href:!0});var Se=i(B);U=r(Se,"BlenderbotSmall"),Se.forEach(a),Y=r(v,", "),J=l(v,"A",{href:!0});var Ue=i(J);ee=r(Ue,"Encoder decoder"),Ue.forEach(a),Q=r(v,", "),D=l(v,"A",{href:!0});var Fe=i(D);re=r(Fe,"FairSeq Machine-Translation"),Fe.forEach(a),H=r(v,", "),te=l(v,"A",{href:!0});var et=i(te);W=r(et,"LED"),et.forEach(a),O=r(v,", "),L=l(v,"A",{href:!0});var Ge=i(L);u=r(Ge,"LongT5"),Ge.forEach(a),k=r(v,", "),G=l(v,"A",{href:!0});var c=i(G);Z=r(c,"M2M100"),c.forEach(a),ae=r(v,", "),oe=l(v,"A",{href:!0});var E=i(oe);ne=r(E,"Marian"),E.forEach(a),de=r(v,", "),se=l(v,"A",{href:!0});var Ie=i(se);Me=r(Ie,"mBART"),Ie.forEach(a),he=r(v,", "),_e=l(v,"A",{href:!0});var He=i(_e);Le=r(He,"MT5"),He.forEach(a),Ee=r(v,", "),N=l(v,"A",{href:!0});var tt=i(N);xe=r(tt,"MVP"),tt.forEach(a),le=r(v,", "),qe=l(v,"A",{href:!0});var Oe=i(qe);ye=r(Oe,"NLLB"),Oe.forEach(a),ce=r(v,", "),ke=l(v,"A",{href:!0});var Be=i(ke);ve=r(Be,"Pegasus"),Be.forEach(a),ge=r(v,", "),ie=l(v,"A",{href:!0});var We=i(ie);b=r(We,"PEGASUS-X"),We.forEach(a),I=r(v,", "),X=l(v,"A",{href:!0});var nt=i(X);V=r(nt,"PLBart"),nt.forEach(a),Pe=r(v,", "),fe=l(v,"A",{href:!0});var Xe=i(fe);De=r(Xe,"ProphetNet"),Xe.forEach(a),$e=r(v,", "),me=l(v,"A",{href:!0});var lt=i(me);Te=r(lt,"SwitchTransformers"),lt.forEach(a),ze=r(v,", "),be=l(v,"A",{href:!0});var Ae=i(be);je=r(Ae,"T5"),Ae.forEach(a),ue=r(v,", "),pe=l(v,"A",{href:!0});var Ve=i(pe);Ce=r(Ve,"XLM-ProphetNet"),Ve.forEach(a),v.forEach(a),this.h()},h(){g(o,"href","../model_doc/bart"),g(j,"href","../model_doc/bigbird_pegasus"),g(y,"href","../model_doc/blenderbot"),g(B,"href","../model_doc/blenderbot-small"),g(J,"href","../model_doc/encoder-decoder"),g(D,"href","../model_doc/fsmt"),g(te,"href","../model_doc/led"),g(L,"href","../model_doc/longt5"),g(G,"href","../model_doc/m2m_100"),g(oe,"href","../model_doc/marian"),g(se,"href","../model_doc/mbart"),g(_e,"href","../model_doc/mt5"),g(N,"href","../model_doc/mvp"),g(qe,"href","../model_doc/nllb"),g(ke,"href","../model_doc/pegasus"),g(ie,"href","../model_doc/pegasus_x"),g(X,"href","../model_doc/plbart"),g(fe,"href","../model_doc/prophetnet"),g(me,"href","../model_doc/switch_transformers"),g(be,"href","../model_doc/t5"),g(pe,"href","../model_doc/xlm-prophetnet")},m(we,v){m(we,p,v),m(we,h,v),t(h,o),t(o,$),t(h,w),t(h,j),t(j,P),t(h,F),t(h,y),t(y,M),t(h,C),t(h,B),t(B,U),t(h,Y),t(h,J),t(J,ee),t(h,Q),t(h,D),t(D,re),t(h,H),t(h,te),t(te,W),t(h,O),t(h,L),t(L,u),t(h,k),t(h,G),t(G,Z),t(h,ae),t(h,oe),t(oe,ne),t(h,de),t(h,se),t(se,Me),t(h,he),t(h,_e),t(_e,Le),t(h,Ee),t(h,N),t(N,xe),t(h,le),t(h,qe),t(qe,ye),t(h,ce),t(h,ke),t(ke,ve),t(h,ge),t(h,ie),t(ie,b),t(h,I),t(h,X),t(X,V),t(h,Pe),t(h,fe),t(fe,De),t(h,$e),t(h,me),t(me,Te),t(h,ze),t(h,be),t(be,je),t(h,ue),t(h,pe),t(pe,Ce)},d(we){we&&a(p),we&&a(h)}}}function xo(R){let p,h;return p=new K({props:{code:`from transformers import DataCollatorForSeq2Seq

data_collator = DataCollatorForSeq2Seq(tokenizer=tokenizer, model=checkpoint)`,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)`}}),{c(){q(p.$$.fragment)},l(o){T(p.$$.fragment,o)},m(o,$){S(p,o,$),h=!0},p:$s,i(o){h||(A(p.$$.fragment,o),h=!0)},o(o){x(p.$$.fragment,o),h=!1},d(o){z(p,o)}}}function zo(R){let p,h;return p=new oa({props:{$$slots:{default:[xo]},$$scope:{ctx:R}}}),{c(){q(p.$$.fragment)},l(o){T(p.$$.fragment,o)},m(o,$){S(p,o,$),h=!0},p(o,$){const w={};$&2&&(w.$$scope={dirty:$,ctx:o}),p.$set(w)},i(o){h||(A(p.$$.fragment,o),h=!0)},o(o){x(p.$$.fragment,o),h=!1},d(o){z(p,o)}}}function Po(R){let p,h;return p=new K({props:{code:`from transformers import DataCollatorForSeq2Seq

data_collator = DataCollatorForSeq2Seq(tokenizer=tokenizer, model=checkpoint, return_tensors="tf")`,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>)`}}),{c(){q(p.$$.fragment)},l(o){T(p.$$.fragment,o)},m(o,$){S(p,o,$),h=!0},p:$s,i(o){h||(A(p.$$.fragment,o),h=!0)},o(o){x(p.$$.fragment,o),h=!1},d(o){z(p,o)}}}function Co(R){let p,h;return p=new oa({props:{$$slots:{default:[Po]},$$scope:{ctx:R}}}),{c(){q(p.$$.fragment)},l(o){T(p.$$.fragment,o)},m(o,$){S(p,o,$),h=!0},p(o,$){const w={};$&2&&(w.$$scope={dirty:$,ctx:o}),p.$set(w)},i(o){h||(A(p.$$.fragment,o),h=!0)},o(o){x(p.$$.fragment,o),h=!1},d(o){z(p,o)}}}function Fo(R){let p,h,o,$,w,j,P,F;return{c(){p=n("p"),h=s("If you aren\u2019t familiar with finetuning a model with the "),o=n("a"),$=s("Trainer"),w=s(", take a look at the basic tutorial "),j=n("a"),P=s("here"),F=s("!"),this.h()},l(y){p=l(y,"P",{});var M=i(p);h=r(M,"If you aren\u2019t familiar with finetuning a model with the "),o=l(M,"A",{href:!0});var C=i(o);$=r(C,"Trainer"),C.forEach(a),w=r(M,", take a look at the basic tutorial "),j=l(M,"A",{href:!0});var B=i(j);P=r(B,"here"),B.forEach(a),F=r(M,"!"),M.forEach(a),this.h()},h(){g(o,"href","/docs/transformers/main/en/main_classes/trainer#transformers.Trainer"),g(j,"href","../training#train-with-pytorch-trainer")},m(y,M){m(y,p,M),t(p,h),t(p,o),t(o,$),t(p,w),t(p,j),t(j,P),t(p,F)},d(y){y&&a(p)}}}function Mo(R){let p,h,o,$,w,j,P,F,y,M,C,B,U,Y,J,ee,Q,D,re,H,te,W,O,L,u,k,G,Z,ae,oe,ne,de,se,Me,he,_e,Le,Ee,N,xe,le,qe,ye,ce,ke,ve,ge,ie;return p=new gs({props:{$$slots:{default:[Fo]},$$scope:{ctx:R}}}),o=new K({props:{code:`from transformers import AutoModelForSeq2SeqLM, Seq2SeqTrainingArguments, Seq2SeqTrainer

model = AutoModelForSeq2SeqLM.from_pretrained(checkpoint)`,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)`}}),N=new K({props:{code:`training_args = Seq2SeqTrainingArguments(
    output_dir="my_awesome_billsum_model",
    evaluation_strategy="epoch",
    learning_rate=2e-5,
    per_device_train_batch_size=16,
    per_device_eval_batch_size=16,
    weight_decay=0.01,
    save_total_limit=3,
    num_train_epochs=4,
    predict_with_generate=True,
    fp16=True,
    push_to_hub=True,
)

trainer = Seq2SeqTrainer(
    model=model,
    args=training_args,
    train_dataset=tokenized_billsum["train"],
    eval_dataset=tokenized_billsum["test"],
    tokenizer=tokenizer,
    data_collator=data_collator,
    compute_metrics=compute_metrics,
)

trainer.train()`,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()`}}),ge=new K({props:{code:"trainer.push_to_hub()",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.push_to_hub()'}}),{c(){q(p.$$.fragment),h=s(`
You're ready to start training your model now! Load T5 with [AutoModelForSeq2SeqLM](/docs/transformers/main/en/model_doc/auto#transformers.AutoModelForSeq2SeqLM):

	`),q(o.$$.fragment),$=d(),w=n("p"),j=s("At this point, only three steps remain:"),P=d(),F=n("ol"),y=n("li"),M=s("Define your training hyperparameters in "),C=n("a"),B=s("Seq2SeqTrainingArguments"),U=s(". The only required parameter is "),Y=n("code"),J=s("output_dir"),ee=s(" which specifies where to save your model. You\u2019ll push this model to the Hub by setting "),Q=n("code"),D=s("push_to_hub=True"),re=s(" (you need to be signed in to Hugging Face to upload your model). At the end of each epoch, the "),H=n("a"),te=s("Trainer"),W=s(" will evaluate the ROUGE metric and save the training checkpoint."),O=d(),L=n("li"),u=s("Pass the training arguments to "),k=n("a"),G=s("Seq2SeqTrainer"),Z=s(" along with the model, dataset, tokenizer, data collator, and "),ae=n("code"),oe=s("compute_metrics"),ne=s(" function."),de=d(),se=n("li"),Me=s("Call "),he=n("a"),_e=s("train()"),Le=s(" to finetune your model."),Ee=d(),q(N.$$.fragment),xe=d(),le=n("p"),qe=s("Once training is completed, share your model to the Hub with the "),ye=n("a"),ce=s("push_to_hub()"),ke=s(" method so everyone can use your model:"),ve=d(),q(ge.$$.fragment),this.h()},l(b){T(p.$$.fragment,b),h=r(b,`
You're ready to start training your model now! Load T5 with [AutoModelForSeq2SeqLM](/docs/transformers/main/en/model_doc/auto#transformers.AutoModelForSeq2SeqLM):

	`),T(o.$$.fragment,b),$=_(b),w=l(b,"P",{});var I=i(w);j=r(I,"At this point, only three steps remain:"),I.forEach(a),P=_(b),F=l(b,"OL",{});var X=i(F);y=l(X,"LI",{});var V=i(y);M=r(V,"Define your training hyperparameters in "),C=l(V,"A",{href:!0});var Pe=i(C);B=r(Pe,"Seq2SeqTrainingArguments"),Pe.forEach(a),U=r(V,". The only required parameter is "),Y=l(V,"CODE",{});var fe=i(Y);J=r(fe,"output_dir"),fe.forEach(a),ee=r(V," which specifies where to save your model. You\u2019ll push this model to the Hub by setting "),Q=l(V,"CODE",{});var De=i(Q);D=r(De,"push_to_hub=True"),De.forEach(a),re=r(V," (you need to be signed in to Hugging Face to upload your model). At the end of each epoch, the "),H=l(V,"A",{href:!0});var $e=i(H);te=r($e,"Trainer"),$e.forEach(a),W=r(V," will evaluate the ROUGE metric and save the training checkpoint."),V.forEach(a),O=_(X),L=l(X,"LI",{});var me=i(L);u=r(me,"Pass the training arguments to "),k=l(me,"A",{href:!0});var Te=i(k);G=r(Te,"Seq2SeqTrainer"),Te.forEach(a),Z=r(me," along with the model, dataset, tokenizer, data collator, and "),ae=l(me,"CODE",{});var ze=i(ae);oe=r(ze,"compute_metrics"),ze.forEach(a),ne=r(me," function."),me.forEach(a),de=_(X),se=l(X,"LI",{});var be=i(se);Me=r(be,"Call "),he=l(be,"A",{href:!0});var je=i(he);_e=r(je,"train()"),je.forEach(a),Le=r(be," to finetune your model."),be.forEach(a),X.forEach(a),Ee=_(b),T(N.$$.fragment,b),xe=_(b),le=l(b,"P",{});var ue=i(le);qe=r(ue,"Once training is completed, share your model to the Hub with the "),ye=l(ue,"A",{href:!0});var pe=i(ye);ce=r(pe,"push_to_hub()"),pe.forEach(a),ke=r(ue," method so everyone can use your model:"),ue.forEach(a),ve=_(b),T(ge.$$.fragment,b),this.h()},h(){g(C,"href","/docs/transformers/main/en/main_classes/trainer#transformers.Seq2SeqTrainingArguments"),g(H,"href","/docs/transformers/main/en/main_classes/trainer#transformers.Trainer"),g(k,"href","/docs/transformers/main/en/main_classes/trainer#transformers.Seq2SeqTrainer"),g(he,"href","/docs/transformers/main/en/main_classes/trainer#transformers.Trainer.train"),g(ye,"href","/docs/transformers/main/en/main_classes/trainer#transformers.Trainer.push_to_hub")},m(b,I){S(p,b,I),m(b,h,I),S(o,b,I),m(b,$,I),m(b,w,I),t(w,j),m(b,P,I),m(b,F,I),t(F,y),t(y,M),t(y,C),t(C,B),t(y,U),t(y,Y),t(Y,J),t(y,ee),t(y,Q),t(Q,D),t(y,re),t(y,H),t(H,te),t(y,W),t(F,O),t(F,L),t(L,u),t(L,k),t(k,G),t(L,Z),t(L,ae),t(ae,oe),t(L,ne),t(F,de),t(F,se),t(se,Me),t(se,he),t(he,_e),t(se,Le),m(b,Ee,I),S(N,b,I),m(b,xe,I),m(b,le,I),t(le,qe),t(le,ye),t(ye,ce),t(le,ke),m(b,ve,I),S(ge,b,I),ie=!0},p(b,I){const X={};I&2&&(X.$$scope={dirty:I,ctx:b}),p.$set(X)},i(b){ie||(A(p.$$.fragment,b),A(o.$$.fragment,b),A(N.$$.fragment,b),A(ge.$$.fragment,b),ie=!0)},o(b){x(p.$$.fragment,b),x(o.$$.fragment,b),x(N.$$.fragment,b),x(ge.$$.fragment,b),ie=!1},d(b){z(p,b),b&&a(h),z(o,b),b&&a($),b&&a(w),b&&a(P),b&&a(F),b&&a(Ee),z(N,b),b&&a(xe),b&&a(le),b&&a(ve),z(ge,b)}}}function Lo(R){let p,h;return p=new oa({props:{$$slots:{default:[Mo]},$$scope:{ctx:R}}}),{c(){q(p.$$.fragment)},l(o){T(p.$$.fragment,o)},m(o,$){S(p,o,$),h=!0},p(o,$){const w={};$&2&&(w.$$scope={dirty:$,ctx:o}),p.$set(w)},i(o){h||(A(p.$$.fragment,o),h=!0)},o(o){x(p.$$.fragment,o),h=!1},d(o){z(p,o)}}}function Do(R){let p,h,o,$,w;return{c(){p=n("p"),h=s("If you aren\u2019t familiar with finetuning a model with Keras, take a look at the basic tutorial "),o=n("a"),$=s("here"),w=s("!"),this.h()},l(j){p=l(j,"P",{});var P=i(p);h=r(P,"If you aren\u2019t familiar with finetuning a model with Keras, take a look at the basic tutorial "),o=l(P,"A",{href:!0});var F=i(o);$=r(F,"here"),F.forEach(a),w=r(P,"!"),P.forEach(a),this.h()},h(){g(o,"href","../training#train-a-tensorflow-model-with-keras")},m(j,P){m(j,p,P),t(p,h),t(p,o),t(o,$),t(p,w)},d(j){j&&a(p)}}}function Io(R){let p,h,o,$,w,j,P,F,y,M,C,B,U,Y,J,ee,Q,D,re,H,te,W,O,L,u,k,G,Z,ae,oe,ne,de,se,Me,he,_e,Le,Ee,N,xe,le,qe,ye,ce,ke,ve,ge,ie,b,I,X,V,Pe,fe,De,$e,me,Te,ze,be,je,ue,pe,Ce,we,v,Qe,Ze,Ne,Se,Ue,Fe,et,Ge;return p=new gs({props:{$$slots:{default:[Do]},$$scope:{ctx:R}}}),o=new K({props:{code:`from transformers import create_optimizer, AdamWeightDecay

optimizer = AdamWeightDecay(learning_rate=2e-5, weight_decay_rate=0.01)`,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>)`}}),C=new K({props:{code:`from transformers import TFAutoModelForSeq2SeqLM

model = TFAutoModelForSeq2SeqLM.from_pretrained(checkpoint)`,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)`}}),W=new K({props:{code:`tf_train_set = model.prepare_tf_dataset(
    tokenized_billsum["train"],
    shuffle=True,
    batch_size=16,
    collate_fn=data_collator,
)

tf_test_set = model.prepare_tf_dataset(
    tokenized_billsum["test"],
    shuffle=False,
    batch_size=16,
    collate_fn=data_collator,
)`,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>)`}}),ne=new K({props:{code:`import tensorflow as tf

model.compile(optimizer=optimizer)`,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)`}}),ie=new K({props:{code:`from transformers.keras_callbacks import KerasMetricCallback

metric_callback = KerasMetricCallback(metric_fn=compute_metrics, eval_dataset=tf_validation_set)`,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)`}}),$e=new K({props:{code:`from transformers.keras_callbacks import PushToHubCallback

push_to_hub_callback = PushToHubCallback(
    output_dir="my_awesome_billsum_model",
    tokenizer=tokenizer,
)`,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>)`}}),je=new K({props:{code:"callbacks = [metric_callback, push_to_hub_callback]",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>callbacks = [metric_callback, push_to_hub_callback]'}}),Se=new K({props:{code:"model.fit(x=tf_train_set, validation_data=tf_test_set, epochs=3, callbacks=callbacks)",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)'}}),{c(){q(p.$$.fragment),h=s(`
To finetune a model in TensorFlow, start by setting up an optimizer function, learning rate schedule, and some training hyperparameters:

	`),q(o.$$.fragment),$=d(),w=n("p"),j=s("Then you can load T5 with "),P=n("a"),F=s("TFAutoModelForSeq2SeqLM"),y=s(":"),M=d(),q(C.$$.fragment),B=d(),U=n("p"),Y=s("Convert your datasets to the "),J=n("code"),ee=s("tf.data.Dataset"),Q=s(" format with "),D=n("a"),re=s("prepare_tf_dataset()"),H=s(":"),te=d(),q(W.$$.fragment),O=d(),L=n("p"),u=s("Configure the model for training with "),k=n("a"),G=n("code"),Z=s("compile"),ae=s(":"),oe=d(),q(ne.$$.fragment),de=d(),se=n("p"),Me=s("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 "),he=n("a"),_e=s("Keras callbacks"),Le=s("."),Ee=d(),N=n("p"),xe=s("Pass your "),le=n("code"),qe=s("compute_metrics"),ye=s(" function to "),ce=n("a"),ke=s("KerasMetricCallback"),ve=s(":"),ge=d(),q(ie.$$.fragment),b=d(),I=n("p"),X=s("Specify where to push your model and tokenizer in the "),V=n("a"),Pe=s("PushToHubCallback"),fe=s(":"),De=d(),q($e.$$.fragment),me=d(),Te=n("p"),ze=s("Then bundle your callbacks together:"),be=d(),q(je.$$.fragment),ue=d(),pe=n("p"),Ce=s("Finally, you\u2019re ready to start training your model! Call "),we=n("a"),v=n("code"),Qe=s("fit"),Ze=s(" with your training and validation datasets, the number of epochs, and your callbacks to finetune the model:"),Ne=d(),q(Se.$$.fragment),Ue=d(),Fe=n("p"),et=s("Once training is completed, your model is automatically uploaded to the Hub so everyone can use it!"),this.h()},l(c){T(p.$$.fragment,c),h=r(c,`
To finetune a model in TensorFlow, start by setting up an optimizer function, learning rate schedule, and some training hyperparameters:

	`),T(o.$$.fragment,c),$=_(c),w=l(c,"P",{});var E=i(w);j=r(E,"Then you can load T5 with "),P=l(E,"A",{href:!0});var Ie=i(P);F=r(Ie,"TFAutoModelForSeq2SeqLM"),Ie.forEach(a),y=r(E,":"),E.forEach(a),M=_(c),T(C.$$.fragment,c),B=_(c),U=l(c,"P",{});var He=i(U);Y=r(He,"Convert your datasets to the "),J=l(He,"CODE",{});var tt=i(J);ee=r(tt,"tf.data.Dataset"),tt.forEach(a),Q=r(He," format with "),D=l(He,"A",{href:!0});var Oe=i(D);re=r(Oe,"prepare_tf_dataset()"),Oe.forEach(a),H=r(He,":"),He.forEach(a),te=_(c),T(W.$$.fragment,c),O=_(c),L=l(c,"P",{});var Be=i(L);u=r(Be,"Configure the model for training with "),k=l(Be,"A",{href:!0,rel:!0});var We=i(k);G=l(We,"CODE",{});var nt=i(G);Z=r(nt,"compile"),nt.forEach(a),We.forEach(a),ae=r(Be,":"),Be.forEach(a),oe=_(c),T(ne.$$.fragment,c),de=_(c),se=l(c,"P",{});var Xe=i(se);Me=r(Xe,"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 "),he=l(Xe,"A",{href:!0});var lt=i(he);_e=r(lt,"Keras callbacks"),lt.forEach(a),Le=r(Xe,"."),Xe.forEach(a),Ee=_(c),N=l(c,"P",{});var Ae=i(N);xe=r(Ae,"Pass your "),le=l(Ae,"CODE",{});var Ve=i(le);qe=r(Ve,"compute_metrics"),Ve.forEach(a),ye=r(Ae," function to "),ce=l(Ae,"A",{href:!0});var Yt=i(ce);ke=r(Yt,"KerasMetricCallback"),Yt.forEach(a),ve=r(Ae,":"),Ae.forEach(a),ge=_(c),T(ie.$$.fragment,c),b=_(c),I=l(c,"P",{});var mt=i(I);X=r(mt,"Specify where to push your model and tokenizer in the "),V=l(mt,"A",{href:!0});var ht=i(V);Pe=r(ht,"PushToHubCallback"),ht.forEach(a),fe=r(mt,":"),mt.forEach(a),De=_(c),T($e.$$.fragment,c),me=_(c),Te=l(c,"P",{});var Kt=i(Te);ze=r(Kt,"Then bundle your callbacks together:"),Kt.forEach(a),be=_(c),T(je.$$.fragment,c),ue=_(c),pe=l(c,"P",{});var ft=i(pe);Ce=r(ft,"Finally, you\u2019re ready to start training your model! Call "),we=l(ft,"A",{href:!0,rel:!0});var qt=i(we);v=l(qt,"CODE",{});var Re=i(v);Qe=r(Re,"fit"),Re.forEach(a),qt.forEach(a),Ze=r(ft," with your training and validation datasets, the number of epochs, and your callbacks to finetune the model:"),ft.forEach(a),Ne=_(c),T(Se.$$.fragment,c),Ue=_(c),Fe=l(c,"P",{});var Je=i(Fe);et=r(Je,"Once training is completed, your model is automatically uploaded to the Hub so everyone can use it!"),Je.forEach(a),this.h()},h(){g(P,"href","/docs/transformers/main/en/model_doc/auto#transformers.TFAutoModelForSeq2SeqLM"),g(D,"href","/docs/transformers/main/en/main_classes/model#transformers.TFPreTrainedModel.prepare_tf_dataset"),g(k,"href","https://keras.io/api/models/model_training_apis/#compile-method"),g(k,"rel","nofollow"),g(he,"href","./main_classes/keras_callbacks"),g(ce,"href","/docs/transformers/main/en/main_classes/keras_callbacks#transformers.KerasMetricCallback"),g(V,"href","/docs/transformers/main/en/main_classes/keras_callbacks#transformers.PushToHubCallback"),g(we,"href","https://keras.io/api/models/model_training_apis/#fit-method"),g(we,"rel","nofollow")},m(c,E){S(p,c,E),m(c,h,E),S(o,c,E),m(c,$,E),m(c,w,E),t(w,j),t(w,P),t(P,F),t(w,y),m(c,M,E),S(C,c,E),m(c,B,E),m(c,U,E),t(U,Y),t(U,J),t(J,ee),t(U,Q),t(U,D),t(D,re),t(U,H),m(c,te,E),S(W,c,E),m(c,O,E),m(c,L,E),t(L,u),t(L,k),t(k,G),t(G,Z),t(L,ae),m(c,oe,E),S(ne,c,E),m(c,de,E),m(c,se,E),t(se,Me),t(se,he),t(he,_e),t(se,Le),m(c,Ee,E),m(c,N,E),t(N,xe),t(N,le),t(le,qe),t(N,ye),t(N,ce),t(ce,ke),t(N,ve),m(c,ge,E),S(ie,c,E),m(c,b,E),m(c,I,E),t(I,X),t(I,V),t(V,Pe),t(I,fe),m(c,De,E),S($e,c,E),m(c,me,E),m(c,Te,E),t(Te,ze),m(c,be,E),S(je,c,E),m(c,ue,E),m(c,pe,E),t(pe,Ce),t(pe,we),t(we,v),t(v,Qe),t(pe,Ze),m(c,Ne,E),S(Se,c,E),m(c,Ue,E),m(c,Fe,E),t(Fe,et),Ge=!0},p(c,E){const Ie={};E&2&&(Ie.$$scope={dirty:E,ctx:c}),p.$set(Ie)},i(c){Ge||(A(p.$$.fragment,c),A(o.$$.fragment,c),A(C.$$.fragment,c),A(W.$$.fragment,c),A(ne.$$.fragment,c),A(ie.$$.fragment,c),A($e.$$.fragment,c),A(je.$$.fragment,c),A(Se.$$.fragment,c),Ge=!0)},o(c){x(p.$$.fragment,c),x(o.$$.fragment,c),x(C.$$.fragment,c),x(W.$$.fragment,c),x(ne.$$.fragment,c),x(ie.$$.fragment,c),x($e.$$.fragment,c),x(je.$$.fragment,c),x(Se.$$.fragment,c),Ge=!1},d(c){z(p,c),c&&a(h),z(o,c),c&&a($),c&&a(w),c&&a(M),z(C,c),c&&a(B),c&&a(U),c&&a(te),z(W,c),c&&a(O),c&&a(L),c&&a(oe),z(ne,c),c&&a(de),c&&a(se),c&&a(Ee),c&&a(N),c&&a(ge),z(ie,c),c&&a(b),c&&a(I),c&&a(De),z($e,c),c&&a(me),c&&a(Te),c&&a(be),z(je,c),c&&a(ue),c&&a(pe),c&&a(Ne),z(Se,c),c&&a(Ue),c&&a(Fe)}}}function Oo(R){let p,h;return p=new oa({props:{$$slots:{default:[Io]},$$scope:{ctx:R}}}),{c(){q(p.$$.fragment)},l(o){T(p.$$.fragment,o)},m(o,$){S(p,o,$),h=!0},p(o,$){const w={};$&2&&(w.$$scope={dirty:$,ctx:o}),p.$set(w)},i(o){h||(A(p.$$.fragment,o),h=!0)},o(o){x(p.$$.fragment,o),h=!1},d(o){z(p,o)}}}function Bo(R){let p,h,o,$,w,j,P,F;return{c(){p=n("p"),h=s(`For a more in-depth example of how to finetune a model for summarization, take a look at the corresponding
`),o=n("a"),$=s("PyTorch notebook"),w=s(`
or `),j=n("a"),P=s("TensorFlow notebook"),F=s("."),this.h()},l(y){p=l(y,"P",{});var M=i(p);h=r(M,`For a more in-depth example of how to finetune a model for summarization, take a look at the corresponding
`),o=l(M,"A",{href:!0,rel:!0});var C=i(o);$=r(C,"PyTorch notebook"),C.forEach(a),w=r(M,`
or `),j=l(M,"A",{href:!0,rel:!0});var B=i(j);P=r(B,"TensorFlow notebook"),B.forEach(a),F=r(M,"."),M.forEach(a),this.h()},h(){g(o,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/summarization.ipynb"),g(o,"rel","nofollow"),g(j,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/summarization-tf.ipynb"),g(j,"rel","nofollow")},m(y,M){m(y,p,M),t(p,h),t(p,o),t(o,$),t(p,w),t(p,j),t(j,P),t(p,F)},d(y){y&&a(p)}}}function Ho(R){let p,h,o,$,w,j,P,F,y,M,C,B,U,Y,J,ee,Q,D,re,H,te,W,O,L;return P=new K({props:{code:`from transformers import AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained("stevhliu/my_awesome_billsum_model")
inputs = tokenizer(text, return_tensors="pt").input_ids`,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`}}),D=new K({props:{code:`from transformers import AutoModelForSeq2SeqLM

model = AutoModelForSeq2SeqLM.from_pretrained("stevhliu/my_awesome_billsum_model")
outputs = model.generate(inputs, max_new_tokens=100, do_sample=False)`,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>)`}}),O=new K({props:{code:"tokenizer.decode(outputs[0], skip_special_tokens=True)",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>`}}),{c(){p=n("p"),h=s("Tokenize the text and return the "),o=n("code"),$=s("input_ids"),w=s(" as PyTorch tensors:"),j=d(),q(P.$$.fragment),F=d(),y=n("p"),M=s("Use the "),C=n("a"),B=s("generate()"),U=s(" method to create the summarization. For more details about the different text generation strategies and parameters for controlling generation, check out the "),Y=n("a"),J=s("Text Generation"),ee=s(" API."),Q=d(),q(D.$$.fragment),re=d(),H=n("p"),te=s("Decode the generated token ids back into text:"),W=d(),q(O.$$.fragment),this.h()},l(u){p=l(u,"P",{});var k=i(p);h=r(k,"Tokenize the text and return the "),o=l(k,"CODE",{});var G=i(o);$=r(G,"input_ids"),G.forEach(a),w=r(k," as PyTorch tensors:"),k.forEach(a),j=_(u),T(P.$$.fragment,u),F=_(u),y=l(u,"P",{});var Z=i(y);M=r(Z,"Use the "),C=l(Z,"A",{href:!0});var ae=i(C);B=r(ae,"generate()"),ae.forEach(a),U=r(Z," method to create the summarization. For more details about the different text generation strategies and parameters for controlling generation, check out the "),Y=l(Z,"A",{href:!0});var oe=i(Y);J=r(oe,"Text Generation"),oe.forEach(a),ee=r(Z," API."),Z.forEach(a),Q=_(u),T(D.$$.fragment,u),re=_(u),H=l(u,"P",{});var ne=i(H);te=r(ne,"Decode the generated token ids back into text:"),ne.forEach(a),W=_(u),T(O.$$.fragment,u),this.h()},h(){g(C,"href","/docs/transformers/main/en/main_classes/text_generation#transformers.GenerationMixin.generate"),g(Y,"href","./main_classes/text_generation")},m(u,k){m(u,p,k),t(p,h),t(p,o),t(o,$),t(p,w),m(u,j,k),S(P,u,k),m(u,F,k),m(u,y,k),t(y,M),t(y,C),t(C,B),t(y,U),t(y,Y),t(Y,J),t(y,ee),m(u,Q,k),S(D,u,k),m(u,re,k),m(u,H,k),t(H,te),m(u,W,k),S(O,u,k),L=!0},p:$s,i(u){L||(A(P.$$.fragment,u),A(D.$$.fragment,u),A(O.$$.fragment,u),L=!0)},o(u){x(P.$$.fragment,u),x(D.$$.fragment,u),x(O.$$.fragment,u),L=!1},d(u){u&&a(p),u&&a(j),z(P,u),u&&a(F),u&&a(y),u&&a(Q),z(D,u),u&&a(re),u&&a(H),u&&a(W),z(O,u)}}}function No(R){let p,h;return p=new oa({props:{$$slots:{default:[Ho]},$$scope:{ctx:R}}}),{c(){q(p.$$.fragment)},l(o){T(p.$$.fragment,o)},m(o,$){S(p,o,$),h=!0},p(o,$){const w={};$&2&&(w.$$scope={dirty:$,ctx:o}),p.$set(w)},i(o){h||(A(p.$$.fragment,o),h=!0)},o(o){x(p.$$.fragment,o),h=!1},d(o){z(p,o)}}}function Uo(R){let p,h,o,$,w,j,P,F,y,M,C,B,U,Y,J,ee,Q,D,re,H,te,W,O,L;return P=new K({props:{code:`from transformers import AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained("stevhliu/my_awesome_billsum_model")
inputs = tokenizer(text, return_tensors="tf").input_ids`,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`}}),D=new K({props:{code:`from transformers import TFAutoModelForSeq2SeqLM

model = TFAutoModelForSeq2SeqLM.from_pretrained("stevhliu/my_awesome_billsum_model")
outputs = model.generate(inputs, max_new_tokens=100, do_sample=False)`,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>)`}}),O=new K({props:{code:"tokenizer.decode(outputs[0], skip_special_tokens=True)",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>`}}),{c(){p=n("p"),h=s("Tokenize the text and return the "),o=n("code"),$=s("input_ids"),w=s(" as TensorFlow tensors:"),j=d(),q(P.$$.fragment),F=d(),y=n("p"),M=s("Use the "),C=n("a"),B=s("generate()"),U=s(" method to create the summarization. For more details about the different text generation strategies and parameters for controlling generation, check out the "),Y=n("a"),J=s("Text Generation"),ee=s(" API."),Q=d(),q(D.$$.fragment),re=d(),H=n("p"),te=s("Decode the generated token ids back into text:"),W=d(),q(O.$$.fragment),this.h()},l(u){p=l(u,"P",{});var k=i(p);h=r(k,"Tokenize the text and return the "),o=l(k,"CODE",{});var G=i(o);$=r(G,"input_ids"),G.forEach(a),w=r(k," as TensorFlow tensors:"),k.forEach(a),j=_(u),T(P.$$.fragment,u),F=_(u),y=l(u,"P",{});var Z=i(y);M=r(Z,"Use the "),C=l(Z,"A",{href:!0});var ae=i(C);B=r(ae,"generate()"),ae.forEach(a),U=r(Z," method to create the summarization. For more details about the different text generation strategies and parameters for controlling generation, check out the "),Y=l(Z,"A",{href:!0});var oe=i(Y);J=r(oe,"Text Generation"),oe.forEach(a),ee=r(Z," API."),Z.forEach(a),Q=_(u),T(D.$$.fragment,u),re=_(u),H=l(u,"P",{});var ne=i(H);te=r(ne,"Decode the generated token ids back into text:"),ne.forEach(a),W=_(u),T(O.$$.fragment,u),this.h()},h(){g(C,"href","/docs/transformers/main/en/main_classes/text_generation#transformers.TFGenerationMixin.generate"),g(Y,"href","./main_classes/text_generation")},m(u,k){m(u,p,k),t(p,h),t(p,o),t(o,$),t(p,w),m(u,j,k),S(P,u,k),m(u,F,k),m(u,y,k),t(y,M),t(y,C),t(C,B),t(y,U),t(y,Y),t(Y,J),t(y,ee),m(u,Q,k),S(D,u,k),m(u,re,k),m(u,H,k),t(H,te),m(u,W,k),S(O,u,k),L=!0},p:$s,i(u){L||(A(P.$$.fragment,u),A(D.$$.fragment,u),A(O.$$.fragment,u),L=!0)},o(u){x(P.$$.fragment,u),x(D.$$.fragment,u),x(O.$$.fragment,u),L=!1},d(u){u&&a(p),u&&a(j),z(P,u),u&&a(F),u&&a(y),u&&a(Q),z(D,u),u&&a(re),u&&a(H),u&&a(W),z(O,u)}}}function Go(R){let p,h;return p=new oa({props:{$$slots:{default:[Uo]},$$scope:{ctx:R}}}),{c(){q(p.$$.fragment)},l(o){T(p.$$.fragment,o)},m(o,$){S(p,o,$),h=!0},p(o,$){const w={};$&2&&(w.$$scope={dirty:$,ctx:o}),p.$set(w)},i(o){h||(A(p.$$.fragment,o),h=!0)},o(o){x(p.$$.fragment,o),h=!1},d(o){z(p,o)}}}function Ro(R){let p,h,o,$,w,j,P,F,y,M,C,B,U,Y,J,ee,Q,D,re,H,te,W,O,L,u,k,G,Z,ae,oe,ne,de,se,Me,he,_e,Le,Ee,N,xe,le,qe,ye,ce,ke,ve,ge,ie,b,I,X,V,Pe,fe,De,$e,me,Te,ze,be,je,ue,pe,Ce,we,v,Qe,Ze,Ne,Se,Ue,Fe,et,Ge,c,E,Ie,He,tt,Oe,Be,We,nt,Xe,lt,Ae,Ve,Yt,mt,ht,Kt,ft,qt,Re,Je,na,Tt,bs,la,ws,xa,at,ys,ia,ks,vs,pa,js,Es,za,St,Pa,Wt,qs,Ca,st,ca,Ts,Ss,At,As,ma,xs,zs,Ps,xt,Cs,ha,Fs,Ms,Fa,zt,Ma,Ye,Ls,Pt,Ds,Is,fa,Os,Bs,ua,Hs,Ns,La,Ct,Da,rt,Us,Xt,Gs,Rs,da,Ys,Ks,Ia,ut,Oa,it,dt,_a,Ft,Ws,ga,Xs,Ba,Ke,Vs,Mt,Js,Qs,Lt,Zs,er,Dt,tr,ar,Ha,It,Na,_t,sr,Ot,rr,or,Ua,Bt,Ga,gt,nr,$a,lr,ir,Ra,pt,$t,ba,Ht,pr,wa,cr,Ya,bt,Ka,wt,Wa,ct,yt,ya,Nt,mr,ka,hr,Xa,Vt,fr,Va,Jt,ur,Ja,Ut,Qa,ot,dr,Qt,_r,gr,va,$r,br,Za,Gt,es,kt,wr,ja,yr,kr,ts,vt,as;return j=new ra({}),C=new So({props:{id:"yHnr5Dk2zCI"}}),N=new gs({props:{$$slots:{default:[Ao]},$$scope:{ctx:R}}}),ce=new K({props:{code:"pip install transformers datasets evaluate rouge_score",highlighted:"pip install transformers datasets evaluate rouge_score"}}),b=new K({props:{code:`from huggingface_hub import notebook_login

notebook_login()`,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()`}}),fe=new ra({}),ue=new K({props:{code:`from datasets import load_dataset

billsum = load_dataset("billsum", split="ca_test")`,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>)`}}),Se=new K({props:{code:"billsum = billsum.train_test_split(test_size=0.2)",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>billsum = billsum.train_test_split(test_size=<span class="hljs-number">0.2</span>)'}}),c=new K({props:{code:'billsum["train"][0]',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\u2019s or dependent\u2019s actual or perceived gender identity, including, but not limited to, the employee\u2019s or dependent\u2019s identification as transgender.\\n(2) For purposes of this section, \u201Ccontract\u201D 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\u2019s 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\u2019s 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\u2019s 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>}`}}),Tt=new ra({}),St=new K({props:{code:`from transformers import AutoTokenizer

checkpoint = "t5-small"
tokenizer = AutoTokenizer.from_pretrained(checkpoint)`,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)`}}),zt=new K({props:{code:`prefix = "summarize: "


def preprocess_function(examples):
    inputs = [prefix + doc for doc in examples["text"]]
    model_inputs = tokenizer(inputs, max_length=1024, truncation=True)

    labels = tokenizer(text_target=examples["summary"], max_length=128, truncation=True)

    model_inputs["labels"] = labels["input_ids"]
    return model_inputs`,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`}}),Ct=new K({props:{code:"tokenized_billsum = billsum.map(preprocess_function, batched=True)",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>)'}}),ut=new jr({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[Co],pytorch:[zo]},$$scope:{ctx:R}}}),Ft=new ra({}),It=new K({props:{code:`import evaluate

rouge = evaluate.load("rouge")`,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>)`}}),Bt=new K({props:{code:`import numpy as np


def compute_metrics(eval_pred):
    predictions, labels = eval_pred
    decoded_preds = tokenizer.batch_decode(predictions, skip_special_tokens=True)
    labels = np.where(labels != -100, labels, tokenizer.pad_token_id)
    decoded_labels = tokenizer.batch_decode(labels, skip_special_tokens=True)

    result = rouge.compute(predictions=decoded_preds, references=decoded_labels, use_stemmer=True)

    prediction_lens = [np.count_nonzero(pred != tokenizer.pad_token_id) for pred in predictions]
    result["gen_len"] = np.mean(prediction_lens)

    return {k: round(v, 4) for k, v in result.items()}`,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()}`}}),Ht=new ra({}),bt=new jr({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[Oo],pytorch:[Lo]},$$scope:{ctx:R}}}),wt=new gs({props:{$$slots:{default:[Bo]},$$scope:{ctx:R}}}),Nt=new ra({}),Ut=new K({props:{code:`text = "summarize: The Inflation Reduction Act lowers prescription drug costs, health care costs, and energy costs. It'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'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."`,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>'}}),Gt=new K({props:{code:`from transformers import pipeline

summarizer = pipeline("summarization", model="stevhliu/my_awesome_billsum_model")
summarizer(text)`,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>}]`}}),vt=new jr({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[Go],pytorch:[No]},$$scope:{ctx:R}}}),{c(){p=n("meta"),h=d(),o=n("h1"),$=n("a"),w=n("span"),q(j.$$.fragment),P=d(),F=n("span"),y=s("Summarization"),M=d(),q(C.$$.fragment),B=d(),U=n("p"),Y=s("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:"),J=d(),ee=n("ul"),Q=n("li"),D=s("Extractive: extract the most relevant information from a document."),re=d(),H=n("li"),te=s("Abstractive: generate new text that captures the most relevant information."),W=d(),O=n("p"),L=s("This guide will show you how to:"),u=d(),k=n("ol"),G=n("li"),Z=s("Finetune "),ae=n("a"),oe=s("T5"),ne=s(" on the California state bill subset of the "),de=n("a"),se=s("BillSum"),Me=s(" dataset for abstractive summarization."),he=d(),_e=n("li"),Le=s("Use your finetuned model for inference."),Ee=d(),q(N.$$.fragment),xe=d(),le=n("p"),qe=s("Before you begin, make sure you have all the necessary libraries installed:"),ye=d(),q(ce.$$.fragment),ke=d(),ve=n("p"),ge=s("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:"),ie=d(),q(b.$$.fragment),I=d(),X=n("h2"),V=n("a"),Pe=n("span"),q(fe.$$.fragment),De=d(),$e=n("span"),me=s("Load BillSum dataset"),Te=d(),ze=n("p"),be=s("Start by loading the smaller California state bill subset of the BillSum dataset from the \u{1F917} Datasets library:"),je=d(),q(ue.$$.fragment),pe=d(),Ce=n("p"),we=s("Split the dataset into a train and test set with the "),v=n("a"),Qe=s("train_test_split"),Ze=s(" method:"),Ne=d(),q(Se.$$.fragment),Ue=d(),Fe=n("p"),et=s("Then take a look at an example:"),Ge=d(),q(c.$$.fragment),E=d(),Ie=n("p"),He=s("There are two fields that you\u2019ll want to use:"),tt=d(),Oe=n("ul"),Be=n("li"),We=n("code"),nt=s("text"),Xe=s(": the text of the bill which\u2019ll be the input to the model."),lt=d(),Ae=n("li"),Ve=n("code"),Yt=s("summary"),mt=s(": a condensed version of "),ht=n("code"),Kt=s("text"),ft=s(" which\u2019ll be the model target."),qt=d(),Re=n("h2"),Je=n("a"),na=n("span"),q(Tt.$$.fragment),bs=d(),la=n("span"),ws=s("Preprocess"),xa=d(),at=n("p"),ys=s("The next step is to load a T5 tokenizer to process "),ia=n("code"),ks=s("text"),vs=s(" and "),pa=n("code"),js=s("summary"),Es=s(":"),za=d(),q(St.$$.fragment),Pa=d(),Wt=n("p"),qs=s("The preprocessing function you want to create needs to:"),Ca=d(),st=n("ol"),ca=n("li"),Ts=s("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."),Ss=d(),At=n("li"),As=s("Use the keyword "),ma=n("code"),xs=s("text_target"),zs=s(" argument when tokenizing labels."),Ps=d(),xt=n("li"),Cs=s("Truncate sequences to be no longer than the maximum length set by the "),ha=n("code"),Fs=s("max_length"),Ms=s(" parameter."),Fa=d(),q(zt.$$.fragment),Ma=d(),Ye=n("p"),Ls=s("To apply the preprocessing function over the entire dataset, use \u{1F917} Datasets "),Pt=n("a"),Ds=s("map"),Is=s(" method. You can speed up the "),fa=n("code"),Os=s("map"),Bs=s(" function by setting "),ua=n("code"),Hs=s("batched=True"),Ns=s(" to process multiple elements of the dataset at once:"),La=d(),q(Ct.$$.fragment),Da=d(),rt=n("p"),Us=s("Now create a batch of examples using "),Xt=n("a"),Gs=s("DataCollatorForSeq2Seq"),Rs=s(". It\u2019s more efficient to "),da=n("em"),Ys=s("dynamically pad"),Ks=s(" the sentences to the longest length in a batch during collation, instead of padding the whole dataset to the maximium length."),Ia=d(),q(ut.$$.fragment),Oa=d(),it=n("h2"),dt=n("a"),_a=n("span"),q(Ft.$$.fragment),Ws=d(),ga=n("span"),Xs=s("Evaluate"),Ba=d(),Ke=n("p"),Vs=s("Including a metric during training is often helpful for evaluating your model\u2019s performance. You can quickly load a evaluation method with the \u{1F917} "),Mt=n("a"),Js=s("Evaluate"),Qs=s(" library. For this task, load the "),Lt=n("a"),Zs=s("ROUGE"),er=s(" metric (see the \u{1F917} Evaluate "),Dt=n("a"),tr=s("quick tour"),ar=s(" to learn more about how to load and compute a metric):"),Ha=d(),q(It.$$.fragment),Na=d(),_t=n("p"),sr=s("Then create a function that passes your predictions and labels to "),Ot=n("a"),rr=s("compute"),or=s(" to calculate the ROUGE metric:"),Ua=d(),q(Bt.$$.fragment),Ga=d(),gt=n("p"),nr=s("Your "),$a=n("code"),lr=s("compute_metrics"),ir=s(" function is ready to go now, and you\u2019ll return to it when you setup your training."),Ra=d(),pt=n("h2"),$t=n("a"),ba=n("span"),q(Ht.$$.fragment),pr=d(),wa=n("span"),cr=s("Train"),Ya=d(),q(bt.$$.fragment),Ka=d(),q(wt.$$.fragment),Wa=d(),ct=n("h2"),yt=n("a"),ya=n("span"),q(Nt.$$.fragment),mr=d(),ka=n("span"),hr=s("Inference"),Xa=d(),Vt=n("p"),fr=s("Great, now that you\u2019ve finetuned a model, you can use it for inference!"),Va=d(),Jt=n("p"),ur=s("Come up with some text you\u2019d like to summarize. For T5, you need to prefix your input depending on the task you\u2019re working on. For summarization you should prefix your input as shown below:"),Ja=d(),q(Ut.$$.fragment),Qa=d(),ot=n("p"),dr=s("The simplest way to try out your finetuned model for inference is to use it in a "),Qt=n("a"),_r=s("pipeline()"),gr=s(". Instantiate a "),va=n("code"),$r=s("pipeline"),br=s(" for summarization with your model, and pass your text to it:"),Za=d(),q(Gt.$$.fragment),es=d(),kt=n("p"),wr=s("You can also manually replicate the results of the "),ja=n("code"),yr=s("pipeline"),kr=s(" if you\u2019d like:"),ts=d(),q(vt.$$.fragment),this.h()},l(e){const f=qo('[data-svelte="svelte-1phssyn"]',document.head);p=l(f,"META",{name:!0,content:!0}),f.forEach(a),h=_(e),o=l(e,"H1",{class:!0});var Rt=i(o);$=l(Rt,"A",{id:!0,class:!0,href:!0});var Ea=i($);w=l(Ea,"SPAN",{});var qa=i(w);T(j.$$.fragment,qa),qa.forEach(a),Ea.forEach(a),P=_(Rt),F=l(Rt,"SPAN",{});var Ta=i(F);y=r(Ta,"Summarization"),Ta.forEach(a),Rt.forEach(a),M=_(e),T(C.$$.fragment,e),B=_(e),U=l(e,"P",{});var Sa=i(U);Y=r(Sa,"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:"),Sa.forEach(a),J=_(e),ee=l(e,"UL",{});var ss=i(ee);Q=l(ss,"LI",{});var Er=i(Q);D=r(Er,"Extractive: extract the most relevant information from a document."),Er.forEach(a),re=_(ss),H=l(ss,"LI",{});var qr=i(H);te=r(qr,"Abstractive: generate new text that captures the most relevant information."),qr.forEach(a),ss.forEach(a),W=_(e),O=l(e,"P",{});var Tr=i(O);L=r(Tr,"This guide will show you how to:"),Tr.forEach(a),u=_(e),k=l(e,"OL",{});var rs=i(k);G=l(rs,"LI",{});var Zt=i(G);Z=r(Zt,"Finetune "),ae=l(Zt,"A",{href:!0,rel:!0});var Sr=i(ae);oe=r(Sr,"T5"),Sr.forEach(a),ne=r(Zt," on the California state bill subset of the "),de=l(Zt,"A",{href:!0,rel:!0});var Ar=i(de);se=r(Ar,"BillSum"),Ar.forEach(a),Me=r(Zt," dataset for abstractive summarization."),Zt.forEach(a),he=_(rs),_e=l(rs,"LI",{});var xr=i(_e);Le=r(xr,"Use your finetuned model for inference."),xr.forEach(a),rs.forEach(a),Ee=_(e),T(N.$$.fragment,e),xe=_(e),le=l(e,"P",{});var zr=i(le);qe=r(zr,"Before you begin, make sure you have all the necessary libraries installed:"),zr.forEach(a),ye=_(e),T(ce.$$.fragment,e),ke=_(e),ve=l(e,"P",{});var Pr=i(ve);ge=r(Pr,"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:"),Pr.forEach(a),ie=_(e),T(b.$$.fragment,e),I=_(e),X=l(e,"H2",{class:!0});var os=i(X);V=l(os,"A",{id:!0,class:!0,href:!0});var Cr=i(V);Pe=l(Cr,"SPAN",{});var Fr=i(Pe);T(fe.$$.fragment,Fr),Fr.forEach(a),Cr.forEach(a),De=_(os),$e=l(os,"SPAN",{});var Mr=i($e);me=r(Mr,"Load BillSum dataset"),Mr.forEach(a),os.forEach(a),Te=_(e),ze=l(e,"P",{});var Lr=i(ze);be=r(Lr,"Start by loading the smaller California state bill subset of the BillSum dataset from the \u{1F917} Datasets library:"),Lr.forEach(a),je=_(e),T(ue.$$.fragment,e),pe=_(e),Ce=l(e,"P",{});var ns=i(Ce);we=r(ns,"Split the dataset into a train and test set with the "),v=l(ns,"A",{href:!0,rel:!0});var Dr=i(v);Qe=r(Dr,"train_test_split"),Dr.forEach(a),Ze=r(ns," method:"),ns.forEach(a),Ne=_(e),T(Se.$$.fragment,e),Ue=_(e),Fe=l(e,"P",{});var Ir=i(Fe);et=r(Ir,"Then take a look at an example:"),Ir.forEach(a),Ge=_(e),T(c.$$.fragment,e),E=_(e),Ie=l(e,"P",{});var Or=i(Ie);He=r(Or,"There are two fields that you\u2019ll want to use:"),Or.forEach(a),tt=_(e),Oe=l(e,"UL",{});var ls=i(Oe);Be=l(ls,"LI",{});var vr=i(Be);We=l(vr,"CODE",{});var Br=i(We);nt=r(Br,"text"),Br.forEach(a),Xe=r(vr,": the text of the bill which\u2019ll be the input to the model."),vr.forEach(a),lt=_(ls),Ae=l(ls,"LI",{});var Aa=i(Ae);Ve=l(Aa,"CODE",{});var Hr=i(Ve);Yt=r(Hr,"summary"),Hr.forEach(a),mt=r(Aa,": a condensed version of "),ht=l(Aa,"CODE",{});var Nr=i(ht);Kt=r(Nr,"text"),Nr.forEach(a),ft=r(Aa," which\u2019ll be the model target."),Aa.forEach(a),ls.forEach(a),qt=_(e),Re=l(e,"H2",{class:!0});var is=i(Re);Je=l(is,"A",{id:!0,class:!0,href:!0});var Ur=i(Je);na=l(Ur,"SPAN",{});var Gr=i(na);T(Tt.$$.fragment,Gr),Gr.forEach(a),Ur.forEach(a),bs=_(is),la=l(is,"SPAN",{});var Rr=i(la);ws=r(Rr,"Preprocess"),Rr.forEach(a),is.forEach(a),xa=_(e),at=l(e,"P",{});var ea=i(at);ys=r(ea,"The next step is to load a T5 tokenizer to process "),ia=l(ea,"CODE",{});var Yr=i(ia);ks=r(Yr,"text"),Yr.forEach(a),vs=r(ea," and "),pa=l(ea,"CODE",{});var Kr=i(pa);js=r(Kr,"summary"),Kr.forEach(a),Es=r(ea,":"),ea.forEach(a),za=_(e),T(St.$$.fragment,e),Pa=_(e),Wt=l(e,"P",{});var Wr=i(Wt);qs=r(Wr,"The preprocessing function you want to create needs to:"),Wr.forEach(a),Ca=_(e),st=l(e,"OL",{});var ta=i(st);ca=l(ta,"LI",{});var Xr=i(ca);Ts=r(Xr,"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."),Xr.forEach(a),Ss=_(ta),At=l(ta,"LI",{});var ps=i(At);As=r(ps,"Use the keyword "),ma=l(ps,"CODE",{});var Vr=i(ma);xs=r(Vr,"text_target"),Vr.forEach(a),zs=r(ps," argument when tokenizing labels."),ps.forEach(a),Ps=_(ta),xt=l(ta,"LI",{});var cs=i(xt);Cs=r(cs,"Truncate sequences to be no longer than the maximum length set by the "),ha=l(cs,"CODE",{});var Jr=i(ha);Fs=r(Jr,"max_length"),Jr.forEach(a),Ms=r(cs," parameter."),cs.forEach(a),ta.forEach(a),Fa=_(e),T(zt.$$.fragment,e),Ma=_(e),Ye=l(e,"P",{});var jt=i(Ye);Ls=r(jt,"To apply the preprocessing function over the entire dataset, use \u{1F917} Datasets "),Pt=l(jt,"A",{href:!0,rel:!0});var Qr=i(Pt);Ds=r(Qr,"map"),Qr.forEach(a),Is=r(jt," method. You can speed up the "),fa=l(jt,"CODE",{});var Zr=i(fa);Os=r(Zr,"map"),Zr.forEach(a),Bs=r(jt," function by setting "),ua=l(jt,"CODE",{});var eo=i(ua);Hs=r(eo,"batched=True"),eo.forEach(a),Ns=r(jt," to process multiple elements of the dataset at once:"),jt.forEach(a),La=_(e),T(Ct.$$.fragment,e),Da=_(e),rt=l(e,"P",{});var aa=i(rt);Us=r(aa,"Now create a batch of examples using "),Xt=l(aa,"A",{href:!0});var to=i(Xt);Gs=r(to,"DataCollatorForSeq2Seq"),to.forEach(a),Rs=r(aa,". It\u2019s more efficient to "),da=l(aa,"EM",{});var ao=i(da);Ys=r(ao,"dynamically pad"),ao.forEach(a),Ks=r(aa," the sentences to the longest length in a batch during collation, instead of padding the whole dataset to the maximium length."),aa.forEach(a),Ia=_(e),T(ut.$$.fragment,e),Oa=_(e),it=l(e,"H2",{class:!0});var ms=i(it);dt=l(ms,"A",{id:!0,class:!0,href:!0});var so=i(dt);_a=l(so,"SPAN",{});var ro=i(_a);T(Ft.$$.fragment,ro),ro.forEach(a),so.forEach(a),Ws=_(ms),ga=l(ms,"SPAN",{});var oo=i(ga);Xs=r(oo,"Evaluate"),oo.forEach(a),ms.forEach(a),Ba=_(e),Ke=l(e,"P",{});var Et=i(Ke);Vs=r(Et,"Including a metric during training is often helpful for evaluating your model\u2019s performance. You can quickly load a evaluation method with the \u{1F917} "),Mt=l(Et,"A",{href:!0,rel:!0});var no=i(Mt);Js=r(no,"Evaluate"),no.forEach(a),Qs=r(Et," library. For this task, load the "),Lt=l(Et,"A",{href:!0,rel:!0});var lo=i(Lt);Zs=r(lo,"ROUGE"),lo.forEach(a),er=r(Et," metric (see the \u{1F917} Evaluate "),Dt=l(Et,"A",{href:!0,rel:!0});var io=i(Dt);tr=r(io,"quick tour"),io.forEach(a),ar=r(Et," to learn more about how to load and compute a metric):"),Et.forEach(a),Ha=_(e),T(It.$$.fragment,e),Na=_(e),_t=l(e,"P",{});var hs=i(_t);sr=r(hs,"Then create a function that passes your predictions and labels to "),Ot=l(hs,"A",{href:!0,rel:!0});var po=i(Ot);rr=r(po,"compute"),po.forEach(a),or=r(hs," to calculate the ROUGE metric:"),hs.forEach(a),Ua=_(e),T(Bt.$$.fragment,e),Ga=_(e),gt=l(e,"P",{});var fs=i(gt);nr=r(fs,"Your "),$a=l(fs,"CODE",{});var co=i($a);lr=r(co,"compute_metrics"),co.forEach(a),ir=r(fs," function is ready to go now, and you\u2019ll return to it when you setup your training."),fs.forEach(a),Ra=_(e),pt=l(e,"H2",{class:!0});var us=i(pt);$t=l(us,"A",{id:!0,class:!0,href:!0});var mo=i($t);ba=l(mo,"SPAN",{});var ho=i(ba);T(Ht.$$.fragment,ho),ho.forEach(a),mo.forEach(a),pr=_(us),wa=l(us,"SPAN",{});var fo=i(wa);cr=r(fo,"Train"),fo.forEach(a),us.forEach(a),Ya=_(e),T(bt.$$.fragment,e),Ka=_(e),T(wt.$$.fragment,e),Wa=_(e),ct=l(e,"H2",{class:!0});var ds=i(ct);yt=l(ds,"A",{id:!0,class:!0,href:!0});var uo=i(yt);ya=l(uo,"SPAN",{});var _o=i(ya);T(Nt.$$.fragment,_o),_o.forEach(a),uo.forEach(a),mr=_(ds),ka=l(ds,"SPAN",{});var go=i(ka);hr=r(go,"Inference"),go.forEach(a),ds.forEach(a),Xa=_(e),Vt=l(e,"P",{});var $o=i(Vt);fr=r($o,"Great, now that you\u2019ve finetuned a model, you can use it for inference!"),$o.forEach(a),Va=_(e),Jt=l(e,"P",{});var bo=i(Jt);ur=r(bo,"Come up with some text you\u2019d like to summarize. For T5, you need to prefix your input depending on the task you\u2019re working on. For summarization you should prefix your input as shown below:"),bo.forEach(a),Ja=_(e),T(Ut.$$.fragment,e),Qa=_(e),ot=l(e,"P",{});var sa=i(ot);dr=r(sa,"The simplest way to try out your finetuned model for inference is to use it in a "),Qt=l(sa,"A",{href:!0});var wo=i(Qt);_r=r(wo,"pipeline()"),wo.forEach(a),gr=r(sa,". Instantiate a "),va=l(sa,"CODE",{});var yo=i(va);$r=r(yo,"pipeline"),yo.forEach(a),br=r(sa," for summarization with your model, and pass your text to it:"),sa.forEach(a),Za=_(e),T(Gt.$$.fragment,e),es=_(e),kt=l(e,"P",{});var _s=i(kt);wr=r(_s,"You can also manually replicate the results of the "),ja=l(_s,"CODE",{});var ko=i(ja);yr=r(ko,"pipeline"),ko.forEach(a),kr=r(_s," if you\u2019d like:"),_s.forEach(a),ts=_(e),T(vt.$$.fragment,e),this.h()},h(){g(p,"name","hf:doc:metadata"),g(p,"content",JSON.stringify(Yo)),g($,"id","summarization"),g($,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),g($,"href","#summarization"),g(o,"class","relative group"),g(ae,"href","https://huggingface.co/t5-small"),g(ae,"rel","nofollow"),g(de,"href","https://huggingface.co/datasets/billsum"),g(de,"rel","nofollow"),g(V,"id","load-billsum-dataset"),g(V,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),g(V,"href","#load-billsum-dataset"),g(X,"class","relative group"),g(v,"href","https://huggingface.co/docs/datasets/main/en/package_reference/main_classes#datasets.Dataset.train_test_split"),g(v,"rel","nofollow"),g(Je,"id","preprocess"),g(Je,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),g(Je,"href","#preprocess"),g(Re,"class","relative group"),g(Pt,"href","https://huggingface.co/docs/datasets/main/en/package_reference/main_classes#datasets.Dataset.map"),g(Pt,"rel","nofollow"),g(Xt,"href","/docs/transformers/main/en/main_classes/data_collator#transformers.DataCollatorForSeq2Seq"),g(dt,"id","evaluate"),g(dt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),g(dt,"href","#evaluate"),g(it,"class","relative group"),g(Mt,"href","https://huggingface.co/docs/evaluate/index"),g(Mt,"rel","nofollow"),g(Lt,"href","https://huggingface.co/spaces/evaluate-metric/rouge"),g(Lt,"rel","nofollow"),g(Dt,"href","https://huggingface.co/docs/evaluate/a_quick_tour"),g(Dt,"rel","nofollow"),g(Ot,"href","https://huggingface.co/docs/evaluate/main/en/package_reference/main_classes#evaluate.EvaluationModule.compute"),g(Ot,"rel","nofollow"),g($t,"id","train"),g($t,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),g($t,"href","#train"),g(pt,"class","relative group"),g(yt,"id","inference"),g(yt,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),g(yt,"href","#inference"),g(ct,"class","relative group"),g(Qt,"href","/docs/transformers/main/en/main_classes/pipelines#transformers.pipeline")},m(e,f){t(document.head,p),m(e,h,f),m(e,o,f),t(o,$),t($,w),S(j,w,null),t(o,P),t(o,F),t(F,y),m(e,M,f),S(C,e,f),m(e,B,f),m(e,U,f),t(U,Y),m(e,J,f),m(e,ee,f),t(ee,Q),t(Q,D),t(ee,re),t(ee,H),t(H,te),m(e,W,f),m(e,O,f),t(O,L),m(e,u,f),m(e,k,f),t(k,G),t(G,Z),t(G,ae),t(ae,oe),t(G,ne),t(G,de),t(de,se),t(G,Me),t(k,he),t(k,_e),t(_e,Le),m(e,Ee,f),S(N,e,f),m(e,xe,f),m(e,le,f),t(le,qe),m(e,ye,f),S(ce,e,f),m(e,ke,f),m(e,ve,f),t(ve,ge),m(e,ie,f),S(b,e,f),m(e,I,f),m(e,X,f),t(X,V),t(V,Pe),S(fe,Pe,null),t(X,De),t(X,$e),t($e,me),m(e,Te,f),m(e,ze,f),t(ze,be),m(e,je,f),S(ue,e,f),m(e,pe,f),m(e,Ce,f),t(Ce,we),t(Ce,v),t(v,Qe),t(Ce,Ze),m(e,Ne,f),S(Se,e,f),m(e,Ue,f),m(e,Fe,f),t(Fe,et),m(e,Ge,f),S(c,e,f),m(e,E,f),m(e,Ie,f),t(Ie,He),m(e,tt,f),m(e,Oe,f),t(Oe,Be),t(Be,We),t(We,nt),t(Be,Xe),t(Oe,lt),t(Oe,Ae),t(Ae,Ve),t(Ve,Yt),t(Ae,mt),t(Ae,ht),t(ht,Kt),t(Ae,ft),m(e,qt,f),m(e,Re,f),t(Re,Je),t(Je,na),S(Tt,na,null),t(Re,bs),t(Re,la),t(la,ws),m(e,xa,f),m(e,at,f),t(at,ys),t(at,ia),t(ia,ks),t(at,vs),t(at,pa),t(pa,js),t(at,Es),m(e,za,f),S(St,e,f),m(e,Pa,f),m(e,Wt,f),t(Wt,qs),m(e,Ca,f),m(e,st,f),t(st,ca),t(ca,Ts),t(st,Ss),t(st,At),t(At,As),t(At,ma),t(ma,xs),t(At,zs),t(st,Ps),t(st,xt),t(xt,Cs),t(xt,ha),t(ha,Fs),t(xt,Ms),m(e,Fa,f),S(zt,e,f),m(e,Ma,f),m(e,Ye,f),t(Ye,Ls),t(Ye,Pt),t(Pt,Ds),t(Ye,Is),t(Ye,fa),t(fa,Os),t(Ye,Bs),t(Ye,ua),t(ua,Hs),t(Ye,Ns),m(e,La,f),S(Ct,e,f),m(e,Da,f),m(e,rt,f),t(rt,Us),t(rt,Xt),t(Xt,Gs),t(rt,Rs),t(rt,da),t(da,Ys),t(rt,Ks),m(e,Ia,f),S(ut,e,f),m(e,Oa,f),m(e,it,f),t(it,dt),t(dt,_a),S(Ft,_a,null),t(it,Ws),t(it,ga),t(ga,Xs),m(e,Ba,f),m(e,Ke,f),t(Ke,Vs),t(Ke,Mt),t(Mt,Js),t(Ke,Qs),t(Ke,Lt),t(Lt,Zs),t(Ke,er),t(Ke,Dt),t(Dt,tr),t(Ke,ar),m(e,Ha,f),S(It,e,f),m(e,Na,f),m(e,_t,f),t(_t,sr),t(_t,Ot),t(Ot,rr),t(_t,or),m(e,Ua,f),S(Bt,e,f),m(e,Ga,f),m(e,gt,f),t(gt,nr),t(gt,$a),t($a,lr),t(gt,ir),m(e,Ra,f),m(e,pt,f),t(pt,$t),t($t,ba),S(Ht,ba,null),t(pt,pr),t(pt,wa),t(wa,cr),m(e,Ya,f),S(bt,e,f),m(e,Ka,f),S(wt,e,f),m(e,Wa,f),m(e,ct,f),t(ct,yt),t(yt,ya),S(Nt,ya,null),t(ct,mr),t(ct,ka),t(ka,hr),m(e,Xa,f),m(e,Vt,f),t(Vt,fr),m(e,Va,f),m(e,Jt,f),t(Jt,ur),m(e,Ja,f),S(Ut,e,f),m(e,Qa,f),m(e,ot,f),t(ot,dr),t(ot,Qt),t(Qt,_r),t(ot,gr),t(ot,va),t(va,$r),t(ot,br),m(e,Za,f),S(Gt,e,f),m(e,es,f),m(e,kt,f),t(kt,wr),t(kt,ja),t(ja,yr),t(kt,kr),m(e,ts,f),S(vt,e,f),as=!0},p(e,[f]){const Rt={};f&2&&(Rt.$$scope={dirty:f,ctx:e}),N.$set(Rt);const Ea={};f&2&&(Ea.$$scope={dirty:f,ctx:e}),ut.$set(Ea);const qa={};f&2&&(qa.$$scope={dirty:f,ctx:e}),bt.$set(qa);const Ta={};f&2&&(Ta.$$scope={dirty:f,ctx:e}),wt.$set(Ta);const Sa={};f&2&&(Sa.$$scope={dirty:f,ctx:e}),vt.$set(Sa)},i(e){as||(A(j.$$.fragment,e),A(C.$$.fragment,e),A(N.$$.fragment,e),A(ce.$$.fragment,e),A(b.$$.fragment,e),A(fe.$$.fragment,e),A(ue.$$.fragment,e),A(Se.$$.fragment,e),A(c.$$.fragment,e),A(Tt.$$.fragment,e),A(St.$$.fragment,e),A(zt.$$.fragment,e),A(Ct.$$.fragment,e),A(ut.$$.fragment,e),A(Ft.$$.fragment,e),A(It.$$.fragment,e),A(Bt.$$.fragment,e),A(Ht.$$.fragment,e),A(bt.$$.fragment,e),A(wt.$$.fragment,e),A(Nt.$$.fragment,e),A(Ut.$$.fragment,e),A(Gt.$$.fragment,e),A(vt.$$.fragment,e),as=!0)},o(e){x(j.$$.fragment,e),x(C.$$.fragment,e),x(N.$$.fragment,e),x(ce.$$.fragment,e),x(b.$$.fragment,e),x(fe.$$.fragment,e),x(ue.$$.fragment,e),x(Se.$$.fragment,e),x(c.$$.fragment,e),x(Tt.$$.fragment,e),x(St.$$.fragment,e),x(zt.$$.fragment,e),x(Ct.$$.fragment,e),x(ut.$$.fragment,e),x(Ft.$$.fragment,e),x(It.$$.fragment,e),x(Bt.$$.fragment,e),x(Ht.$$.fragment,e),x(bt.$$.fragment,e),x(wt.$$.fragment,e),x(Nt.$$.fragment,e),x(Ut.$$.fragment,e),x(Gt.$$.fragment,e),x(vt.$$.fragment,e),as=!1},d(e){a(p),e&&a(h),e&&a(o),z(j),e&&a(M),z(C,e),e&&a(B),e&&a(U),e&&a(J),e&&a(ee),e&&a(W),e&&a(O),e&&a(u),e&&a(k),e&&a(Ee),z(N,e),e&&a(xe),e&&a(le),e&&a(ye),z(ce,e),e&&a(ke),e&&a(ve),e&&a(ie),z(b,e),e&&a(I),e&&a(X),z(fe),e&&a(Te),e&&a(ze),e&&a(je),z(ue,e),e&&a(pe),e&&a(Ce),e&&a(Ne),z(Se,e),e&&a(Ue),e&&a(Fe),e&&a(Ge),z(c,e),e&&a(E),e&&a(Ie),e&&a(tt),e&&a(Oe),e&&a(qt),e&&a(Re),z(Tt),e&&a(xa),e&&a(at),e&&a(za),z(St,e),e&&a(Pa),e&&a(Wt),e&&a(Ca),e&&a(st),e&&a(Fa),z(zt,e),e&&a(Ma),e&&a(Ye),e&&a(La),z(Ct,e),e&&a(Da),e&&a(rt),e&&a(Ia),z(ut,e),e&&a(Oa),e&&a(it),z(Ft),e&&a(Ba),e&&a(Ke),e&&a(Ha),z(It,e),e&&a(Na),e&&a(_t),e&&a(Ua),z(Bt,e),e&&a(Ga),e&&a(gt),e&&a(Ra),e&&a(pt),z(Ht),e&&a(Ya),z(bt,e),e&&a(Ka),z(wt,e),e&&a(Wa),e&&a(ct),z(Nt),e&&a(Xa),e&&a(Vt),e&&a(Va),e&&a(Jt),e&&a(Ja),z(Ut,e),e&&a(Qa),e&&a(ot),e&&a(Za),z(Gt,e),e&&a(es),e&&a(kt),e&&a(ts),z(vt,e)}}}const Yo={local:"summarization",sections:[{local:"load-billsum-dataset",title:"Load BillSum dataset"},{local:"preprocess",title:"Preprocess"},{local:"evaluate",title:"Evaluate"},{local:"train",title:"Train"},{local:"inference",title:"Inference"}],title:"Summarization"};function Ko(R){return To(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class en extends vo{constructor(p){super();jo(this,p,Ko,Ro,Eo,{})}}export{en as default,Yo as metadata};
