import{S as ls,i as ps,s as cs,e as l,k as g,w as q,t as n,M as fs,c as p,d as a,m as _,a as c,x as j,h as r,b,G as t,g as f,y as S,q as E,o as z,B as T,v as ms,L as is}from"../../chunks/vendor-hf-doc-builder.js";import{T as Wt}from"../../chunks/Tip-hf-doc-builder.js";import{Y as hs}from"../../chunks/Youtube-hf-doc-builder.js";import{I as Ut}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{C as te}from"../../chunks/CodeBlock-hf-doc-builder.js";import{F as rs,M as Ht}from"../../chunks/Markdown-hf-doc-builder.js";function us(D){let s,h,o,d,w;return{c(){s=l("p"),h=n("See the summarization "),o=l("a"),d=n("task page"),w=n(" for more information about its associated models, datasets, and metrics."),this.h()},l($){s=p($,"P",{});var y=c(s);h=r(y,"See the summarization "),o=p(y,"A",{href:!0,rel:!0});var A=c(o);d=r(A,"task page"),A.forEach(a),w=r(y," for more information about its associated models, datasets, and metrics."),y.forEach(a),this.h()},h(){b(o,"href","https://huggingface.co/tasks/summarization"),b(o,"rel","nofollow")},m($,y){f($,s,y),t(s,h),t(s,o),t(o,d),t(s,w)},d($){$&&a(s)}}}function ds(D){let s,h;return s=new te({props:{code:`from transformers import DataCollatorForSeq2Seq

data_collator = DataCollatorForSeq2Seq(tokenizer=tokenizer, model=model)`,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=model)`}}),{c(){q(s.$$.fragment)},l(o){j(s.$$.fragment,o)},m(o,d){S(s,o,d),h=!0},p:is,i(o){h||(E(s.$$.fragment,o),h=!0)},o(o){z(s.$$.fragment,o),h=!1},d(o){T(s,o)}}}function gs(D){let s,h;return s=new Ht({props:{$$slots:{default:[ds]},$$scope:{ctx:D}}}),{c(){q(s.$$.fragment)},l(o){j(s.$$.fragment,o)},m(o,d){S(s,o,d),h=!0},p(o,d){const w={};d&2&&(w.$$scope={dirty:d,ctx:o}),s.$set(w)},i(o){h||(E(s.$$.fragment,o),h=!0)},o(o){z(s.$$.fragment,o),h=!1},d(o){T(s,o)}}}function _s(D){let s,h;return s=new te({props:{code:`from transformers import DataCollatorForSeq2Seq

data_collator = DataCollatorForSeq2Seq(tokenizer=tokenizer, model=model, 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=model, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)`}}),{c(){q(s.$$.fragment)},l(o){j(s.$$.fragment,o)},m(o,d){S(s,o,d),h=!0},p:is,i(o){h||(E(s.$$.fragment,o),h=!0)},o(o){z(s.$$.fragment,o),h=!1},d(o){T(s,o)}}}function $s(D){let s,h;return s=new Ht({props:{$$slots:{default:[_s]},$$scope:{ctx:D}}}),{c(){q(s.$$.fragment)},l(o){j(s.$$.fragment,o)},m(o,d){S(s,o,d),h=!0},p(o,d){const w={};d&2&&(w.$$scope={dirty:d,ctx:o}),s.$set(w)},i(o){h||(E(s.$$.fragment,o),h=!0)},o(o){z(s.$$.fragment,o),h=!1},d(o){T(s,o)}}}function bs(D){let s,h,o,d,w,$,y,A;return{c(){s=l("p"),h=n("If you aren\u2019t familiar with fine-tuning a model with the "),o=l("a"),d=n("Trainer"),w=n(", take a look at the basic tutorial "),$=l("a"),y=n("here"),A=n("!"),this.h()},l(C){s=p(C,"P",{});var k=c(s);h=r(k,"If you aren\u2019t familiar with fine-tuning a model with the "),o=p(k,"A",{href:!0});var F=c(o);d=r(F,"Trainer"),F.forEach(a),w=r(k,", take a look at the basic tutorial "),$=p(k,"A",{href:!0});var U=c($);y=r(U,"here"),U.forEach(a),A=r(k,"!"),k.forEach(a),this.h()},h(){b(o,"href","/docs/transformers/pr_17548/en/main_classes/trainer#transformers.Trainer"),b($,"href","../training#finetune-with-trainer")},m(C,k){f(C,s,k),t(s,h),t(s,o),t(o,d),t(s,w),t(s,$),t($,y),t(s,A)},d(C){C&&a(s)}}}function ws(D){let s,h,o,d,w,$,y,A,C,k,F,U,V,L,Y,M,K,ae,ue,se,N,le,P,de,W,ge,ee,Z,H,fe,X,J,I,O;return y=new te({props:{code:`from transformers import AutoModelForSeq2SeqLM, Seq2SeqTrainingArguments, Seq2SeqTrainer

model = AutoModelForSeq2SeqLM.from_pretrained("t5-small")`,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(<span class="hljs-string">&quot;t5-small&quot;</span>)`}}),C=new Wt({props:{$$slots:{default:[bs]},$$scope:{ctx:D}}}),I=new te({props:{code:`training_args = Seq2SeqTrainingArguments(
    output_dir="./results",
    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=1,
    fp16=True,
)

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

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;./results&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">1</span>,
<span class="hljs-meta">... </span>    fp16=<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>)

<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.train()`}}),{c(){s=l("p"),h=n("Load T5 with "),o=l("a"),d=n("AutoModelForSeq2SeqLM"),w=n(":"),$=g(),q(y.$$.fragment),A=g(),q(C.$$.fragment),k=g(),F=l("p"),U=n("At this point, only three steps remain:"),V=g(),L=l("ol"),Y=l("li"),M=n("Define your training hyperparameters in "),K=l("a"),ae=n("Seq2SeqTrainingArguments"),ue=n("."),se=g(),N=l("li"),le=n("Pass the training arguments to "),P=l("a"),de=n("Seq2SeqTrainer"),W=n(" along with the model, dataset, tokenizer, and data collator."),ge=g(),ee=l("li"),Z=n("Call "),H=l("a"),fe=n("train()"),X=n(" to fine-tune your model."),J=g(),q(I.$$.fragment),this.h()},l(u){s=p(u,"P",{});var x=c(s);h=r(x,"Load T5 with "),o=p(x,"A",{href:!0});var G=c(o);d=r(G,"AutoModelForSeq2SeqLM"),G.forEach(a),w=r(x,":"),x.forEach(a),$=_(u),j(y.$$.fragment,u),A=_(u),j(C.$$.fragment,u),k=_(u),F=p(u,"P",{});var oe=c(F);U=r(oe,"At this point, only three steps remain:"),oe.forEach(a),V=_(u),L=p(u,"OL",{});var R=c(L);Y=p(R,"LI",{});var Q=c(Y);M=r(Q,"Define your training hyperparameters in "),K=p(Q,"A",{href:!0});var _e=c(K);ae=r(_e,"Seq2SeqTrainingArguments"),_e.forEach(a),ue=r(Q,"."),Q.forEach(a),se=_(R),N=p(R,"LI",{});var B=c(N);le=r(B,"Pass the training arguments to "),P=p(B,"A",{href:!0});var me=c(P);de=r(me,"Seq2SeqTrainer"),me.forEach(a),W=r(B," along with the model, dataset, tokenizer, and data collator."),B.forEach(a),ge=_(R),ee=p(R,"LI",{});var pe=c(ee);Z=r(pe,"Call "),H=p(pe,"A",{href:!0});var ne=c(H);fe=r(ne,"train()"),ne.forEach(a),X=r(pe," to fine-tune your model."),pe.forEach(a),R.forEach(a),J=_(u),j(I.$$.fragment,u),this.h()},h(){b(o,"href","/docs/transformers/pr_17548/en/model_doc/auto#transformers.AutoModelForSeq2SeqLM"),b(K,"href","/docs/transformers/pr_17548/en/main_classes/trainer#transformers.Seq2SeqTrainingArguments"),b(P,"href","/docs/transformers/pr_17548/en/main_classes/trainer#transformers.Seq2SeqTrainer"),b(H,"href","/docs/transformers/pr_17548/en/main_classes/trainer#transformers.Trainer.train")},m(u,x){f(u,s,x),t(s,h),t(s,o),t(o,d),t(s,w),f(u,$,x),S(y,u,x),f(u,A,x),S(C,u,x),f(u,k,x),f(u,F,x),t(F,U),f(u,V,x),f(u,L,x),t(L,Y),t(Y,M),t(Y,K),t(K,ae),t(Y,ue),t(L,se),t(L,N),t(N,le),t(N,P),t(P,de),t(N,W),t(L,ge),t(L,ee),t(ee,Z),t(ee,H),t(H,fe),t(ee,X),f(u,J,x),S(I,u,x),O=!0},p(u,x){const G={};x&2&&(G.$$scope={dirty:x,ctx:u}),C.$set(G)},i(u){O||(E(y.$$.fragment,u),E(C.$$.fragment,u),E(I.$$.fragment,u),O=!0)},o(u){z(y.$$.fragment,u),z(C.$$.fragment,u),z(I.$$.fragment,u),O=!1},d(u){u&&a(s),u&&a($),T(y,u),u&&a(A),T(C,u),u&&a(k),u&&a(F),u&&a(V),u&&a(L),u&&a(J),T(I,u)}}}function vs(D){let s,h;return s=new Ht({props:{$$slots:{default:[ws]},$$scope:{ctx:D}}}),{c(){q(s.$$.fragment)},l(o){j(s.$$.fragment,o)},m(o,d){S(s,o,d),h=!0},p(o,d){const w={};d&2&&(w.$$scope={dirty:d,ctx:o}),s.$set(w)},i(o){h||(E(s.$$.fragment,o),h=!0)},o(o){z(s.$$.fragment,o),h=!1},d(o){T(s,o)}}}function ys(D){let s,h,o,d,w;return{c(){s=l("p"),h=n("If you aren\u2019t familiar with fine-tuning a model with Keras, take a look at the basic tutorial "),o=l("a"),d=n("here"),w=n("!"),this.h()},l($){s=p($,"P",{});var y=c(s);h=r(y,"If you aren\u2019t familiar with fine-tuning a model with Keras, take a look at the basic tutorial "),o=p(y,"A",{href:!0});var A=c(o);d=r(A,"here"),A.forEach(a),w=r(y,"!"),y.forEach(a),this.h()},h(){b(o,"href","training#finetune-with-keras")},m($,y){f($,s,y),t(s,h),t(s,o),t(o,d),t(s,w)},d($){$&&a(s)}}}function ks(D){let s,h,o,d,w,$,y,A,C,k,F,U,V,L,Y,M,K,ae,ue,se,N,le,P,de,W,ge,ee,Z,H,fe,X,J,I,O,u,x,G,oe,R,Q,_e,B,me,pe,ne,ke,re,ze;return L=new te({props:{code:`tf_train_set = tokenized_billsum["train"].to_tf_dataset(
    columns=["attention_mask", "input_ids", "labels"],
    shuffle=True,
    batch_size=16,
    collate_fn=data_collator,
)

tf_test_set = tokenized_billsum["test"].to_tf_dataset(
    columns=["attention_mask", "input_ids", "labels"],
    shuffle=False,
    batch_size=16,
    collate_fn=data_collator,
)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>tf_train_set = tokenized_billsum[<span class="hljs-string">&quot;train&quot;</span>].to_tf_dataset(
<span class="hljs-meta">... </span>    columns=[<span class="hljs-string">&quot;attention_mask&quot;</span>, <span class="hljs-string">&quot;input_ids&quot;</span>, <span class="hljs-string">&quot;labels&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 = tokenized_billsum[<span class="hljs-string">&quot;test&quot;</span>].to_tf_dataset(
<span class="hljs-meta">... </span>    columns=[<span class="hljs-string">&quot;attention_mask&quot;</span>, <span class="hljs-string">&quot;input_ids&quot;</span>, <span class="hljs-string">&quot;labels&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>)`}}),M=new Wt({props:{$$slots:{default:[ys]},$$scope:{ctx:D}}}),N=new te({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>)`}}),H=new te({props:{code:`from transformers import TFAutoModelForSeq2SeqLM

model = TFAutoModelForSeq2SeqLM.from_pretrained("t5-small")`,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;t5-small&quot;</span>)`}}),oe=new te({props:{code:"model.compile(optimizer=optimizer)",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>model.<span class="hljs-built_in">compile</span>(optimizer=optimizer)'}}),re=new te({props:{code:"model.fit(x=tf_train_set, validation_data=tf_test_set, epochs=3)",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>)'}}),{c(){s=l("p"),h=n("To fine-tune a model in TensorFlow, start by converting your datasets to the "),o=l("code"),d=n("tf.data.Dataset"),w=n(" format with "),$=l("a"),y=l("code"),A=n("to_tf_dataset"),C=n(". Specify inputs and labels in "),k=l("code"),F=n("columns"),U=n(", whether to shuffle the dataset order, batch size, and the data collator:"),V=g(),q(L.$$.fragment),Y=g(),q(M.$$.fragment),K=g(),ae=l("p"),ue=n("Set up an optimizer function, learning rate schedule, and some training hyperparameters:"),se=g(),q(N.$$.fragment),le=g(),P=l("p"),de=n("Load T5 with "),W=l("a"),ge=n("TFAutoModelForSeq2SeqLM"),ee=n(":"),Z=g(),q(H.$$.fragment),fe=g(),X=l("p"),J=n("Configure the model for training with "),I=l("a"),O=l("code"),u=n("compile"),x=n(":"),G=g(),q(oe.$$.fragment),R=g(),Q=l("p"),_e=n("Call "),B=l("a"),me=l("code"),pe=n("fit"),ne=n(" to fine-tune the model:"),ke=g(),q(re.$$.fragment),this.h()},l(i){s=p(i,"P",{});var v=c(s);h=r(v,"To fine-tune a model in TensorFlow, start by converting your datasets to the "),o=p(v,"CODE",{});var $e=c(o);d=r($e,"tf.data.Dataset"),$e.forEach(a),w=r(v," format with "),$=p(v,"A",{href:!0,rel:!0});var qe=c($);y=p(qe,"CODE",{});var Je=c(y);A=r(Je,"to_tf_dataset"),Je.forEach(a),qe.forEach(a),C=r(v,". Specify inputs and labels in "),k=p(v,"CODE",{});var Oe=c(k);F=r(Oe,"columns"),Oe.forEach(a),U=r(v,", whether to shuffle the dataset order, batch size, and the data collator:"),v.forEach(a),V=_(i),j(L.$$.fragment,i),Y=_(i),j(M.$$.fragment,i),K=_(i),ae=p(i,"P",{});var be=c(ae);ue=r(be,"Set up an optimizer function, learning rate schedule, and some training hyperparameters:"),be.forEach(a),se=_(i),j(N.$$.fragment,i),le=_(i),P=p(i,"P",{});var je=c(P);de=r(je,"Load T5 with "),W=p(je,"A",{href:!0});var ce=c(W);ge=r(ce,"TFAutoModelForSeq2SeqLM"),ce.forEach(a),ee=r(je,":"),je.forEach(a),Z=_(i),j(H.$$.fragment,i),fe=_(i),X=p(i,"P",{});var Te=c(X);J=r(Te,"Configure the model for training with "),I=p(Te,"A",{href:!0,rel:!0});var xe=c(I);O=p(xe,"CODE",{});var Re=c(O);u=r(Re,"compile"),Re.forEach(a),xe.forEach(a),x=r(Te,":"),Te.forEach(a),G=_(i),j(oe.$$.fragment,i),R=_(i),Q=p(i,"P",{});var Ae=c(Q);_e=r(Ae,"Call "),B=p(Ae,"A",{href:!0,rel:!0});var Ce=c(B);me=p(Ce,"CODE",{});var Qe=c(me);pe=r(Qe,"fit"),Qe.forEach(a),Ce.forEach(a),ne=r(Ae," to fine-tune the model:"),Ae.forEach(a),ke=_(i),j(re.$$.fragment,i),this.h()},h(){b($,"href","https://huggingface.co/docs/datasets/package_reference/main_classes.html#datasets.Dataset.to_tf_dataset"),b($,"rel","nofollow"),b(W,"href","/docs/transformers/pr_17548/en/model_doc/auto#transformers.TFAutoModelForSeq2SeqLM"),b(I,"href","https://keras.io/api/models/model_training_apis/#compile-method"),b(I,"rel","nofollow"),b(B,"href","https://keras.io/api/models/model_training_apis/#fit-method"),b(B,"rel","nofollow")},m(i,v){f(i,s,v),t(s,h),t(s,o),t(o,d),t(s,w),t(s,$),t($,y),t(y,A),t(s,C),t(s,k),t(k,F),t(s,U),f(i,V,v),S(L,i,v),f(i,Y,v),S(M,i,v),f(i,K,v),f(i,ae,v),t(ae,ue),f(i,se,v),S(N,i,v),f(i,le,v),f(i,P,v),t(P,de),t(P,W),t(W,ge),t(P,ee),f(i,Z,v),S(H,i,v),f(i,fe,v),f(i,X,v),t(X,J),t(X,I),t(I,O),t(O,u),t(X,x),f(i,G,v),S(oe,i,v),f(i,R,v),f(i,Q,v),t(Q,_e),t(Q,B),t(B,me),t(me,pe),t(Q,ne),f(i,ke,v),S(re,i,v),ze=!0},p(i,v){const $e={};v&2&&($e.$$scope={dirty:v,ctx:i}),M.$set($e)},i(i){ze||(E(L.$$.fragment,i),E(M.$$.fragment,i),E(N.$$.fragment,i),E(H.$$.fragment,i),E(oe.$$.fragment,i),E(re.$$.fragment,i),ze=!0)},o(i){z(L.$$.fragment,i),z(M.$$.fragment,i),z(N.$$.fragment,i),z(H.$$.fragment,i),z(oe.$$.fragment,i),z(re.$$.fragment,i),ze=!1},d(i){i&&a(s),i&&a(V),T(L,i),i&&a(Y),T(M,i),i&&a(K),i&&a(ae),i&&a(se),T(N,i),i&&a(le),i&&a(P),i&&a(Z),T(H,i),i&&a(fe),i&&a(X),i&&a(G),T(oe,i),i&&a(R),i&&a(Q),i&&a(ke),T(re,i)}}}function qs(D){let s,h;return s=new Ht({props:{$$slots:{default:[ks]},$$scope:{ctx:D}}}),{c(){q(s.$$.fragment)},l(o){j(s.$$.fragment,o)},m(o,d){S(s,o,d),h=!0},p(o,d){const w={};d&2&&(w.$$scope={dirty:d,ctx:o}),s.$set(w)},i(o){h||(E(s.$$.fragment,o),h=!0)},o(o){z(s.$$.fragment,o),h=!1},d(o){T(s,o)}}}function js(D){let s,h,o,d,w,$,y,A;return{c(){s=l("p"),h=n(`For a more in-depth example of how to fine-tune a model for summarization, take a look at the corresponding
`),o=l("a"),d=n("PyTorch notebook"),w=n(`
or `),$=l("a"),y=n("TensorFlow notebook"),A=n("."),this.h()},l(C){s=p(C,"P",{});var k=c(s);h=r(k,`For a more in-depth example of how to fine-tune a model for summarization, take a look at the corresponding
`),o=p(k,"A",{href:!0,rel:!0});var F=c(o);d=r(F,"PyTorch notebook"),F.forEach(a),w=r(k,`
or `),$=p(k,"A",{href:!0,rel:!0});var U=c($);y=r(U,"TensorFlow notebook"),U.forEach(a),A=r(k,"."),k.forEach(a),this.h()},h(){b(o,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/summarization.ipynb"),b(o,"rel","nofollow"),b($,"href","https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/summarization-tf.ipynb"),b($,"rel","nofollow")},m(C,k){f(C,s,k),t(s,h),t(s,o),t(o,d),t(s,w),t(s,$),t($,y),t(s,A)},d(C){C&&a(s)}}}function Ss(D){let s,h,o,d,w,$,y,A,C,k,F,U,V,L,Y,M,K,ae,ue,se,N,le,P,de,W,ge,ee,Z,H,fe,X,J,I,O,u,x,G,oe,R,Q,_e,B,me,pe,ne,ke,re,ze,i,v,$e,qe,Je,Oe,be,je,ce,Te,xe,Re,Ae,Ce,Qe,Gt,yt,Se,Pe,ot,Ne,Yt,nt,Kt,kt,we,Xt,rt,Jt,Rt,it,Qt,Vt,qt,Be,jt,Ve,Zt,St,ve,lt,ea,ta,Ue,aa,pt,sa,oa,na,We,ra,ct,ia,la,Et,He,zt,he,pa,Ge,ft,ca,fa,mt,ma,ha,ht,ua,da,Tt,Ye,xt,ie,ga,Ze,_a,$a,ut,ba,wa,dt,va,ya,gt,ka,qa,At,De,Ct,Ee,Fe,_t,Ke,ja,$t,Sa,Pt,Le,Dt,Me,Ft;return $=new Ut({}),F=new hs({props:{id:"yHnr5Dk2zCI"}}),J=new Wt({props:{$$slots:{default:[us]},$$scope:{ctx:D}}}),G=new Ut({}),ne=new te({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>)`}}),v=new te({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>)'}}),be=new te({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>}`}}),Ne=new Ut({}),Be=new te({props:{code:`from transformers import AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained("t5-small")`,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;t5-small&quot;</span>)`}}),He=new te({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)

    with tokenizer.as_target_tokenizer():
        labels = tokenizer(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>    <span class="hljs-keyword">with</span> tokenizer.as_target_tokenizer():
<span class="hljs-meta">... </span>        labels = tokenizer(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`}}),Ye=new te({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>)'}}),De=new rs({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[$s],pytorch:[gs]},$$scope:{ctx:D}}}),Ke=new Ut({}),Le=new rs({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[qs],pytorch:[vs]},$$scope:{ctx:D}}}),Me=new Wt({props:{$$slots:{default:[js]},$$scope:{ctx:D}}}),{c(){s=l("meta"),h=g(),o=l("h1"),d=l("a"),w=l("span"),q($.$$.fragment),y=g(),A=l("span"),C=n("Summarization"),k=g(),q(F.$$.fragment),U=g(),V=l("p"),L=n("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:"),Y=g(),M=l("ul"),K=l("li"),ae=n("Extractive: extract the most relevant information from a document."),ue=g(),se=l("li"),N=n("Abstractive: generate new text that captures the most relevant information."),le=g(),P=l("p"),de=n("This guide will show you how to fine-tune "),W=l("a"),ge=n("T5"),ee=n(" on the California state bill subset of the "),Z=l("a"),H=n("BillSum"),fe=n(" dataset for abstractive summarization."),X=g(),q(J.$$.fragment),I=g(),O=l("h2"),u=l("a"),x=l("span"),q(G.$$.fragment),oe=g(),R=l("span"),Q=n("Load BillSum dataset"),_e=g(),B=l("p"),me=n("Load the BillSum dataset from the \u{1F917} Datasets library:"),pe=g(),q(ne.$$.fragment),ke=g(),re=l("p"),ze=n("Split this dataset into a train and test set:"),i=g(),q(v.$$.fragment),$e=g(),qe=l("p"),Je=n("Then take a look at an example:"),Oe=g(),q(be.$$.fragment),je=g(),ce=l("p"),Te=n("The "),xe=l("code"),Re=n("text"),Ae=n(" field is the input and the "),Ce=l("code"),Qe=n("summary"),Gt=n(" field is the target."),yt=g(),Se=l("h2"),Pe=l("a"),ot=l("span"),q(Ne.$$.fragment),Yt=g(),nt=l("span"),Kt=n("Preprocess"),kt=g(),we=l("p"),Xt=n("Load the T5 tokenizer to process "),rt=l("code"),Jt=n("text"),Rt=n(" and "),it=l("code"),Qt=n("summary"),Vt=n(":"),qt=g(),q(Be.$$.fragment),jt=g(),Ve=l("p"),Zt=n("The preprocessing function needs to:"),St=g(),ve=l("ol"),lt=l("li"),ea=n("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."),ta=g(),Ue=l("li"),aa=n("Use a context manager with the "),pt=l("code"),sa=n("as_target_tokenizer()"),oa=n(" function to parallelize tokenization of inputs and labels."),na=g(),We=l("li"),ra=n("Truncate sequences to be no longer than the maximum length set by the "),ct=l("code"),ia=n("max_length"),la=n(" parameter."),Et=g(),q(He.$$.fragment),zt=g(),he=l("p"),pa=n("Use \u{1F917} Datasets "),Ge=l("a"),ft=l("code"),ca=n("map"),fa=n(" function to apply the preprocessing function over the entire dataset. You can speed up the "),mt=l("code"),ma=n("map"),ha=n(" function by setting "),ht=l("code"),ua=n("batched=True"),da=n(" to process multiple elements of the dataset at once:"),Tt=g(),q(Ye.$$.fragment),xt=g(),ie=l("p"),ga=n("Use "),Ze=l("a"),_a=n("DataCollatorForSeq2Seq"),$a=n(" to create a batch of examples. It will also "),ut=l("em"),ba=n("dynamically pad"),wa=n(" your text and labels to the length of the longest element in its batch, so they are a uniform length. While it is possible to pad your text in the "),dt=l("code"),va=n("tokenizer"),ya=n(" function by setting "),gt=l("code"),ka=n("padding=True"),qa=n(", dynamic padding is more efficient."),At=g(),q(De.$$.fragment),Ct=g(),Ee=l("h2"),Fe=l("a"),_t=l("span"),q(Ke.$$.fragment),ja=g(),$t=l("span"),Sa=n("Train"),Pt=g(),q(Le.$$.fragment),Dt=g(),q(Me.$$.fragment),this.h()},l(e){const m=fs('[data-svelte="svelte-1phssyn"]',document.head);s=p(m,"META",{name:!0,content:!0}),m.forEach(a),h=_(e),o=p(e,"H1",{class:!0});var Xe=c(o);d=p(Xe,"A",{id:!0,class:!0,href:!0});var bt=c(d);w=p(bt,"SPAN",{});var wt=c(w);j($.$$.fragment,wt),wt.forEach(a),bt.forEach(a),y=_(Xe),A=p(Xe,"SPAN",{});var vt=c(A);C=r(vt,"Summarization"),vt.forEach(a),Xe.forEach(a),k=_(e),j(F.$$.fragment,e),U=_(e),V=p(e,"P",{});var Ea=c(V);L=r(Ea,"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:"),Ea.forEach(a),Y=_(e),M=p(e,"UL",{});var Lt=c(M);K=p(Lt,"LI",{});var za=c(K);ae=r(za,"Extractive: extract the most relevant information from a document."),za.forEach(a),ue=_(Lt),se=p(Lt,"LI",{});var Ta=c(se);N=r(Ta,"Abstractive: generate new text that captures the most relevant information."),Ta.forEach(a),Lt.forEach(a),le=_(e),P=p(e,"P",{});var et=c(P);de=r(et,"This guide will show you how to fine-tune "),W=p(et,"A",{href:!0,rel:!0});var xa=c(W);ge=r(xa,"T5"),xa.forEach(a),ee=r(et," on the California state bill subset of the "),Z=p(et,"A",{href:!0,rel:!0});var Aa=c(Z);H=r(Aa,"BillSum"),Aa.forEach(a),fe=r(et," dataset for abstractive summarization."),et.forEach(a),X=_(e),j(J.$$.fragment,e),I=_(e),O=p(e,"H2",{class:!0});var Mt=c(O);u=p(Mt,"A",{id:!0,class:!0,href:!0});var Ca=c(u);x=p(Ca,"SPAN",{});var Pa=c(x);j(G.$$.fragment,Pa),Pa.forEach(a),Ca.forEach(a),oe=_(Mt),R=p(Mt,"SPAN",{});var Da=c(R);Q=r(Da,"Load BillSum dataset"),Da.forEach(a),Mt.forEach(a),_e=_(e),B=p(e,"P",{});var Fa=c(B);me=r(Fa,"Load the BillSum dataset from the \u{1F917} Datasets library:"),Fa.forEach(a),pe=_(e),j(ne.$$.fragment,e),ke=_(e),re=p(e,"P",{});var La=c(re);ze=r(La,"Split this dataset into a train and test set:"),La.forEach(a),i=_(e),j(v.$$.fragment,e),$e=_(e),qe=p(e,"P",{});var Ma=c(qe);Je=r(Ma,"Then take a look at an example:"),Ma.forEach(a),Oe=_(e),j(be.$$.fragment,e),je=_(e),ce=p(e,"P",{});var tt=c(ce);Te=r(tt,"The "),xe=p(tt,"CODE",{});var Ia=c(xe);Re=r(Ia,"text"),Ia.forEach(a),Ae=r(tt," field is the input and the "),Ce=p(tt,"CODE",{});var Oa=c(Ce);Qe=r(Oa,"summary"),Oa.forEach(a),Gt=r(tt," field is the target."),tt.forEach(a),yt=_(e),Se=p(e,"H2",{class:!0});var It=c(Se);Pe=p(It,"A",{id:!0,class:!0,href:!0});var Na=c(Pe);ot=p(Na,"SPAN",{});var Ba=c(ot);j(Ne.$$.fragment,Ba),Ba.forEach(a),Na.forEach(a),Yt=_(It),nt=p(It,"SPAN",{});var Ua=c(nt);Kt=r(Ua,"Preprocess"),Ua.forEach(a),It.forEach(a),kt=_(e),we=p(e,"P",{});var at=c(we);Xt=r(at,"Load the T5 tokenizer to process "),rt=p(at,"CODE",{});var Wa=c(rt);Jt=r(Wa,"text"),Wa.forEach(a),Rt=r(at," and "),it=p(at,"CODE",{});var Ha=c(it);Qt=r(Ha,"summary"),Ha.forEach(a),Vt=r(at,":"),at.forEach(a),qt=_(e),j(Be.$$.fragment,e),jt=_(e),Ve=p(e,"P",{});var Ga=c(Ve);Zt=r(Ga,"The preprocessing function needs to:"),Ga.forEach(a),St=_(e),ve=p(e,"OL",{});var st=c(ve);lt=p(st,"LI",{});var Ya=c(lt);ea=r(Ya,"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."),Ya.forEach(a),ta=_(st),Ue=p(st,"LI",{});var Ot=c(Ue);aa=r(Ot,"Use a context manager with the "),pt=p(Ot,"CODE",{});var Ka=c(pt);sa=r(Ka,"as_target_tokenizer()"),Ka.forEach(a),oa=r(Ot," function to parallelize tokenization of inputs and labels."),Ot.forEach(a),na=_(st),We=p(st,"LI",{});var Nt=c(We);ra=r(Nt,"Truncate sequences to be no longer than the maximum length set by the "),ct=p(Nt,"CODE",{});var Xa=c(ct);ia=r(Xa,"max_length"),Xa.forEach(a),la=r(Nt," parameter."),Nt.forEach(a),st.forEach(a),Et=_(e),j(He.$$.fragment,e),zt=_(e),he=p(e,"P",{});var Ie=c(he);pa=r(Ie,"Use \u{1F917} Datasets "),Ge=p(Ie,"A",{href:!0,rel:!0});var Ja=c(Ge);ft=p(Ja,"CODE",{});var Ra=c(ft);ca=r(Ra,"map"),Ra.forEach(a),Ja.forEach(a),fa=r(Ie," function to apply the preprocessing function over the entire dataset. You can speed up the "),mt=p(Ie,"CODE",{});var Qa=c(mt);ma=r(Qa,"map"),Qa.forEach(a),ha=r(Ie," function by setting "),ht=p(Ie,"CODE",{});var Va=c(ht);ua=r(Va,"batched=True"),Va.forEach(a),da=r(Ie," to process multiple elements of the dataset at once:"),Ie.forEach(a),Tt=_(e),j(Ye.$$.fragment,e),xt=_(e),ie=p(e,"P",{});var ye=c(ie);ga=r(ye,"Use "),Ze=p(ye,"A",{href:!0});var Za=c(Ze);_a=r(Za,"DataCollatorForSeq2Seq"),Za.forEach(a),$a=r(ye," to create a batch of examples. It will also "),ut=p(ye,"EM",{});var es=c(ut);ba=r(es,"dynamically pad"),es.forEach(a),wa=r(ye," your text and labels to the length of the longest element in its batch, so they are a uniform length. While it is possible to pad your text in the "),dt=p(ye,"CODE",{});var ts=c(dt);va=r(ts,"tokenizer"),ts.forEach(a),ya=r(ye," function by setting "),gt=p(ye,"CODE",{});var as=c(gt);ka=r(as,"padding=True"),as.forEach(a),qa=r(ye,", dynamic padding is more efficient."),ye.forEach(a),At=_(e),j(De.$$.fragment,e),Ct=_(e),Ee=p(e,"H2",{class:!0});var Bt=c(Ee);Fe=p(Bt,"A",{id:!0,class:!0,href:!0});var ss=c(Fe);_t=p(ss,"SPAN",{});var os=c(_t);j(Ke.$$.fragment,os),os.forEach(a),ss.forEach(a),ja=_(Bt),$t=p(Bt,"SPAN",{});var ns=c($t);Sa=r(ns,"Train"),ns.forEach(a),Bt.forEach(a),Pt=_(e),j(Le.$$.fragment,e),Dt=_(e),j(Me.$$.fragment,e),this.h()},h(){b(s,"name","hf:doc:metadata"),b(s,"content",JSON.stringify(Es)),b(d,"id","summarization"),b(d,"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"),b(d,"href","#summarization"),b(o,"class","relative group"),b(W,"href","https://huggingface.co/t5-small"),b(W,"rel","nofollow"),b(Z,"href","https://huggingface.co/datasets/billsum"),b(Z,"rel","nofollow"),b(u,"id","load-billsum-dataset"),b(u,"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"),b(u,"href","#load-billsum-dataset"),b(O,"class","relative group"),b(Pe,"id","preprocess"),b(Pe,"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"),b(Pe,"href","#preprocess"),b(Se,"class","relative group"),b(Ge,"href","https://huggingface.co/docs/datasets/package_reference/main_classes.html#datasets.Dataset.map"),b(Ge,"rel","nofollow"),b(Ze,"href","/docs/transformers/pr_17548/en/main_classes/data_collator#transformers.DataCollatorForSeq2Seq"),b(Fe,"id","train"),b(Fe,"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"),b(Fe,"href","#train"),b(Ee,"class","relative group")},m(e,m){t(document.head,s),f(e,h,m),f(e,o,m),t(o,d),t(d,w),S($,w,null),t(o,y),t(o,A),t(A,C),f(e,k,m),S(F,e,m),f(e,U,m),f(e,V,m),t(V,L),f(e,Y,m),f(e,M,m),t(M,K),t(K,ae),t(M,ue),t(M,se),t(se,N),f(e,le,m),f(e,P,m),t(P,de),t(P,W),t(W,ge),t(P,ee),t(P,Z),t(Z,H),t(P,fe),f(e,X,m),S(J,e,m),f(e,I,m),f(e,O,m),t(O,u),t(u,x),S(G,x,null),t(O,oe),t(O,R),t(R,Q),f(e,_e,m),f(e,B,m),t(B,me),f(e,pe,m),S(ne,e,m),f(e,ke,m),f(e,re,m),t(re,ze),f(e,i,m),S(v,e,m),f(e,$e,m),f(e,qe,m),t(qe,Je),f(e,Oe,m),S(be,e,m),f(e,je,m),f(e,ce,m),t(ce,Te),t(ce,xe),t(xe,Re),t(ce,Ae),t(ce,Ce),t(Ce,Qe),t(ce,Gt),f(e,yt,m),f(e,Se,m),t(Se,Pe),t(Pe,ot),S(Ne,ot,null),t(Se,Yt),t(Se,nt),t(nt,Kt),f(e,kt,m),f(e,we,m),t(we,Xt),t(we,rt),t(rt,Jt),t(we,Rt),t(we,it),t(it,Qt),t(we,Vt),f(e,qt,m),S(Be,e,m),f(e,jt,m),f(e,Ve,m),t(Ve,Zt),f(e,St,m),f(e,ve,m),t(ve,lt),t(lt,ea),t(ve,ta),t(ve,Ue),t(Ue,aa),t(Ue,pt),t(pt,sa),t(Ue,oa),t(ve,na),t(ve,We),t(We,ra),t(We,ct),t(ct,ia),t(We,la),f(e,Et,m),S(He,e,m),f(e,zt,m),f(e,he,m),t(he,pa),t(he,Ge),t(Ge,ft),t(ft,ca),t(he,fa),t(he,mt),t(mt,ma),t(he,ha),t(he,ht),t(ht,ua),t(he,da),f(e,Tt,m),S(Ye,e,m),f(e,xt,m),f(e,ie,m),t(ie,ga),t(ie,Ze),t(Ze,_a),t(ie,$a),t(ie,ut),t(ut,ba),t(ie,wa),t(ie,dt),t(dt,va),t(ie,ya),t(ie,gt),t(gt,ka),t(ie,qa),f(e,At,m),S(De,e,m),f(e,Ct,m),f(e,Ee,m),t(Ee,Fe),t(Fe,_t),S(Ke,_t,null),t(Ee,ja),t(Ee,$t),t($t,Sa),f(e,Pt,m),S(Le,e,m),f(e,Dt,m),S(Me,e,m),Ft=!0},p(e,[m]){const Xe={};m&2&&(Xe.$$scope={dirty:m,ctx:e}),J.$set(Xe);const bt={};m&2&&(bt.$$scope={dirty:m,ctx:e}),De.$set(bt);const wt={};m&2&&(wt.$$scope={dirty:m,ctx:e}),Le.$set(wt);const vt={};m&2&&(vt.$$scope={dirty:m,ctx:e}),Me.$set(vt)},i(e){Ft||(E($.$$.fragment,e),E(F.$$.fragment,e),E(J.$$.fragment,e),E(G.$$.fragment,e),E(ne.$$.fragment,e),E(v.$$.fragment,e),E(be.$$.fragment,e),E(Ne.$$.fragment,e),E(Be.$$.fragment,e),E(He.$$.fragment,e),E(Ye.$$.fragment,e),E(De.$$.fragment,e),E(Ke.$$.fragment,e),E(Le.$$.fragment,e),E(Me.$$.fragment,e),Ft=!0)},o(e){z($.$$.fragment,e),z(F.$$.fragment,e),z(J.$$.fragment,e),z(G.$$.fragment,e),z(ne.$$.fragment,e),z(v.$$.fragment,e),z(be.$$.fragment,e),z(Ne.$$.fragment,e),z(Be.$$.fragment,e),z(He.$$.fragment,e),z(Ye.$$.fragment,e),z(De.$$.fragment,e),z(Ke.$$.fragment,e),z(Le.$$.fragment,e),z(Me.$$.fragment,e),Ft=!1},d(e){a(s),e&&a(h),e&&a(o),T($),e&&a(k),T(F,e),e&&a(U),e&&a(V),e&&a(Y),e&&a(M),e&&a(le),e&&a(P),e&&a(X),T(J,e),e&&a(I),e&&a(O),T(G),e&&a(_e),e&&a(B),e&&a(pe),T(ne,e),e&&a(ke),e&&a(re),e&&a(i),T(v,e),e&&a($e),e&&a(qe),e&&a(Oe),T(be,e),e&&a(je),e&&a(ce),e&&a(yt),e&&a(Se),T(Ne),e&&a(kt),e&&a(we),e&&a(qt),T(Be,e),e&&a(jt),e&&a(Ve),e&&a(St),e&&a(ve),e&&a(Et),T(He,e),e&&a(zt),e&&a(he),e&&a(Tt),T(Ye,e),e&&a(xt),e&&a(ie),e&&a(At),T(De,e),e&&a(Ct),e&&a(Ee),T(Ke),e&&a(Pt),T(Le,e),e&&a(Dt),T(Me,e)}}}const Es={local:"summarization",sections:[{local:"load-billsum-dataset",title:"Load BillSum dataset"},{local:"preprocess",title:"Preprocess"},{local:"train",title:"Train"}],title:"Summarization"};function zs(D){return ms(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Fs extends ls{constructor(s){super();ps(this,s,zs,Ss,cs,{})}}export{Fs as default,Es as metadata};
