import{s as Fs,o as Ys,n as je}from"../chunks/scheduler.889ebb13.js";import{S as As,i as Qs,g as h,s as i,u as M,A as qs,h as d,f as t,c as p,j as z,v as b,y,k as B,o as H,a,w as g,d as $,t as j,x as w,m as Ss,n as Es}from"../chunks/index.8980e686.js";import{T as os}from"../chunks/Tip.7191df11.js";import{Y as Ls}from"../chunks/Youtube.532e53e0.js";import{I as pt}from"../chunks/IconCopyLink.357761cd.js";import{C}from"../chunks/CodeBlock.25fc3430.js";import{D as Ps}from"../chunks/DocNotebookDropdown.f8a50280.js";import{F as ms,M as ct}from"../chunks/Markdown.31057263.js";function Ds(J){let l,c,s='<a href="../model_doc/bart">BART</a>, <a href="../model_doc/bigbird_pegasus">BigBird-Pegasus</a>, <a href="../model_doc/blenderbot">Blenderbot</a>, <a href="../model_doc/blenderbot-small">BlenderbotSmall</a>, <a href="../model_doc/encoder-decoder">Encoder decoder</a>, <a href="../model_doc/fsmt">FairSeq Machine-Translation</a>, <a href="../model_doc/gptsan-japanese">GPTSAN-japanese</a>, <a href="../model_doc/led">LED</a>, <a href="../model_doc/longt5">LongT5</a>, <a href="../model_doc/m2m_100">M2M100</a>, <a href="../model_doc/marian">Marian</a>, <a href="../model_doc/mbart">mBART</a>, <a href="../model_doc/mt5">MT5</a>, <a href="../model_doc/mvp">MVP</a>, <a href="../model_doc/nllb">NLLB</a>, <a href="../model_doc/nllb-moe">NLLB-MOE</a>, <a href="../model_doc/pegasus">Pegasus</a>, <a href="../model_doc/pegasus_x">PEGASUS-X</a>, <a href="../model_doc/plbart">PLBart</a>, <a href="../model_doc/prophetnet">ProphetNet</a>, <a href="../model_doc/switch_transformers">SwitchTransformers</a>, <a href="../model_doc/t5">T5</a>, <a href="../model_doc/xlm-prophetnet">XLM-ProphetNet</a>';return{c(){l=Ss(`이 튜토리얼에서 설명하는 작업은 다음 모델 아키텍처에서 지원됩니다:

`),c=h("p"),c.innerHTML=s},l(m){l=Es(m,`이 튜토리얼에서 설명하는 작업은 다음 모델 아키텍처에서 지원됩니다:

`),c=d(m,"P",{"data-svelte-h":!0}),y(c)!=="svelte-uls67l"&&(c.innerHTML=s)},m(m,u){a(m,l,u),a(m,c,u)},p:je,d(m){m&&(t(l),t(c))}}}function Ks(J){let l,c;return l=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERhdGFDb2xsYXRvckZvclNlcTJTZXElMEElMEFkYXRhX2NvbGxhdG9yJTIwJTNEJTIwRGF0YUNvbGxhdG9yRm9yU2VxMlNlcSh0b2tlbml6ZXIlM0R0b2tlbml6ZXIlMkMlMjBtb2RlbCUzRGNoZWNrcG9pbnQp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DataCollatorForSeq2Seq

<span class="hljs-meta">&gt;&gt;&gt; </span>data_collator = DataCollatorForSeq2Seq(tokenizer=tokenizer, model=checkpoint)`}}),{c(){M(l.$$.fragment)},l(s){b(l.$$.fragment,s)},m(s,m){g(l,s,m),c=!0},p:je,i(s){c||($(l.$$.fragment,s),c=!0)},o(s){j(l.$$.fragment,s),c=!1},d(s){w(l,s)}}}function Os(J){let l,c;return l=new ct({props:{$$slots:{default:[Ks]},$$scope:{ctx:J}}}),{c(){M(l.$$.fragment)},l(s){b(l.$$.fragment,s)},m(s,m){g(l,s,m),c=!0},p(s,m){const u={};m&2&&(u.$$scope={dirty:m,ctx:s}),l.$set(u)},i(s){c||($(l.$$.fragment,s),c=!0)},o(s){j(l.$$.fragment,s),c=!1},d(s){w(l,s)}}}function el(J){let l,c;return l=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERhdGFDb2xsYXRvckZvclNlcTJTZXElMEElMEFkYXRhX2NvbGxhdG9yJTIwJTNEJTIwRGF0YUNvbGxhdG9yRm9yU2VxMlNlcSh0b2tlbml6ZXIlM0R0b2tlbml6ZXIlMkMlMjBtb2RlbCUzRGNoZWNrcG9pbnQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnRmJTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DataCollatorForSeq2Seq

<span class="hljs-meta">&gt;&gt;&gt; </span>data_collator = DataCollatorForSeq2Seq(tokenizer=tokenizer, model=checkpoint, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)`}}),{c(){M(l.$$.fragment)},l(s){b(l.$$.fragment,s)},m(s,m){g(l,s,m),c=!0},p:je,i(s){c||($(l.$$.fragment,s),c=!0)},o(s){j(l.$$.fragment,s),c=!1},d(s){w(l,s)}}}function tl(J){let l,c;return l=new ct({props:{$$slots:{default:[el]},$$scope:{ctx:J}}}),{c(){M(l.$$.fragment)},l(s){b(l.$$.fragment,s)},m(s,m){g(l,s,m),c=!0},p(s,m){const u={};m&2&&(u.$$scope={dirty:m,ctx:s}),l.$set(u)},i(s){c||($(l.$$.fragment,s),c=!0)},o(s){j(l.$$.fragment,s),c=!1},d(s){w(l,s)}}}function sl(J){let l,c='모델을 <code>Trainer</code>로 파인튜닝 하는 것이 익숙하지 않다면, <a href="../training#train-with-pytorch-trainer">여기</a>에서 기본 튜토리얼을 확인해보세요!';return{c(){l=h("p"),l.innerHTML=c},l(s){l=d(s,"P",{"data-svelte-h":!0}),y(l)!=="svelte-1v8fl5q"&&(l.innerHTML=c)},m(s,m){a(s,l,m)},p:je,d(s){s&&t(l)}}}function ll(J){let l,c,s,m="이제 모델 학습을 시작할 준비가 되었습니다! <code>AutoModelForSeq2SeqLM</code>로 T5를 가져오세요:",u,U,X,_,W="이제 세 단계만 남았습니다:",G,V,I=`<li><code>Seq2SeqTrainingArguments</code>에서 학습 하이퍼파라미터를 정의하세요.
유일한 필수 매개변수는 모델을 저장할 위치를 지정하는 <code>output_dir</code>입니다.
<code>push_to_hub=True</code>를 설정하여 이 모델을 Hub에 푸시할 수 있습니다(모델을 업로드하려면 Hugging Face에 로그인해야 합니다.)
<code>Trainer</code>는 각 에폭이 끝날 때마다 ROUGE 지표를 평가하고 학습 체크포인트를 저장합니다.</li> <li>모델, 데이터셋, 토크나이저, 데이터 콜레이터 및 <code>compute_metrics</code> 함수와 함께 학습 인수를 <code>Seq2SeqTrainer</code>에 전달하세요.</li> <li><code>train()</code>을 호출하여 모델을 파인튜닝하세요.</li>`,Z,k,x,r,T="학습이 완료되면, 누구나 모델을 사용할 수 있도록 <code>push_to_hub()</code> 메소드로 Hub에 공유합니다:",Y,E,N;return l=new os({props:{$$slots:{default:[sl]},$$scope:{ctx:J}}}),U=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvclNlcTJTZXFMTSUyQyUyMFNlcTJTZXFUcmFpbmluZ0FyZ3VtZW50cyUyQyUyMFNlcTJTZXFUcmFpbmVyJTBBJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JTZXEyU2VxTE0uZnJvbV9wcmV0cmFpbmVkKGNoZWNrcG9pbnQp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForSeq2SeqLM, Seq2SeqTrainingArguments, Seq2SeqTrainer

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForSeq2SeqLM.from_pretrained(checkpoint)`}}),k=new C({props:{code:"dHJhaW5pbmdfYXJncyUyMCUzRCUyMFNlcTJTZXFUcmFpbmluZ0FyZ3VtZW50cyglMEElMjAlMjAlMjAlMjBvdXRwdXRfZGlyJTNEJTIybXlfYXdlc29tZV9iaWxsc3VtX21vZGVsJTIyJTJDJTBBJTIwJTIwJTIwJTIwZXZhbHVhdGlvbl9zdHJhdGVneSUzRCUyMmVwb2NoJTIyJTJDJTBBJTIwJTIwJTIwJTIwbGVhcm5pbmdfcmF0ZSUzRDJlLTUlMkMlMEElMjAlMjAlMjAlMjBwZXJfZGV2aWNlX3RyYWluX2JhdGNoX3NpemUlM0QxNiUyQyUwQSUyMCUyMCUyMCUyMHBlcl9kZXZpY2VfZXZhbF9iYXRjaF9zaXplJTNEMTYlMkMlMEElMjAlMjAlMjAlMjB3ZWlnaHRfZGVjYXklM0QwLjAxJTJDJTBBJTIwJTIwJTIwJTIwc2F2ZV90b3RhbF9saW1pdCUzRDMlMkMlMEElMjAlMjAlMjAlMjBudW1fdHJhaW5fZXBvY2hzJTNENCUyQyUwQSUyMCUyMCUyMCUyMHByZWRpY3Rfd2l0aF9nZW5lcmF0ZSUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjBmcDE2JTNEVHJ1ZSUyQyUwQSUyMCUyMCUyMCUyMHB1c2hfdG9faHViJTNEVHJ1ZSUyQyUwQSklMEElMEF0cmFpbmVyJTIwJTNEJTIwU2VxMlNlcVRyYWluZXIoJTBBJTIwJTIwJTIwJTIwbW9kZWwlM0Rtb2RlbCUyQyUwQSUyMCUyMCUyMCUyMGFyZ3MlM0R0cmFpbmluZ19hcmdzJTJDJTBBJTIwJTIwJTIwJTIwdHJhaW5fZGF0YXNldCUzRHRva2VuaXplZF9iaWxsc3VtJTVCJTIydHJhaW4lMjIlNUQlMkMlMEElMjAlMjAlMjAlMjBldmFsX2RhdGFzZXQlM0R0b2tlbml6ZWRfYmlsbHN1bSU1QiUyMnRlc3QlMjIlNUQlMkMlMEElMjAlMjAlMjAlMjB0b2tlbml6ZXIlM0R0b2tlbml6ZXIlMkMlMEElMjAlMjAlMjAlMjBkYXRhX2NvbGxhdG9yJTNEZGF0YV9jb2xsYXRvciUyQyUwQSUyMCUyMCUyMCUyMGNvbXB1dGVfbWV0cmljcyUzRGNvbXB1dGVfbWV0cmljcyUyQyUwQSklMEElMEF0cmFpbmVyLnRyYWluKCk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>training_args = Seq2SeqTrainingArguments(
<span class="hljs-meta">... </span>    output_dir=<span class="hljs-string">&quot;my_awesome_billsum_model&quot;</span>,
<span class="hljs-meta">... </span>    evaluation_strategy=<span class="hljs-string">&quot;epoch&quot;</span>,
<span class="hljs-meta">... </span>    learning_rate=<span class="hljs-number">2e-5</span>,
<span class="hljs-meta">... </span>    per_device_train_batch_size=<span class="hljs-number">16</span>,
<span class="hljs-meta">... </span>    per_device_eval_batch_size=<span class="hljs-number">16</span>,
<span class="hljs-meta">... </span>    weight_decay=<span class="hljs-number">0.01</span>,
<span class="hljs-meta">... </span>    save_total_limit=<span class="hljs-number">3</span>,
<span class="hljs-meta">... </span>    num_train_epochs=<span class="hljs-number">4</span>,
<span class="hljs-meta">... </span>    predict_with_generate=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>    fp16=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>    push_to_hub=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>)

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

<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.train()`}}),E=new C({props:{code:"dHJhaW5lci5wdXNoX3RvX2h1Yigp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.push_to_hub()'}}),{c(){M(l.$$.fragment),c=i(),s=h("p"),s.innerHTML=m,u=i(),M(U.$$.fragment),X=i(),_=h("p"),_.textContent=W,G=i(),V=h("ol"),V.innerHTML=I,Z=i(),M(k.$$.fragment),x=i(),r=h("p"),r.innerHTML=T,Y=i(),M(E.$$.fragment)},l(f){b(l.$$.fragment,f),c=p(f),s=d(f,"P",{"data-svelte-h":!0}),y(s)!=="svelte-112xz4j"&&(s.innerHTML=m),u=p(f),b(U.$$.fragment,f),X=p(f),_=d(f,"P",{"data-svelte-h":!0}),y(_)!=="svelte-1vwg7jz"&&(_.textContent=W),G=p(f),V=d(f,"OL",{"data-svelte-h":!0}),y(V)!=="svelte-1dcl8x1"&&(V.innerHTML=I),Z=p(f),b(k.$$.fragment,f),x=p(f),r=d(f,"P",{"data-svelte-h":!0}),y(r)!=="svelte-zvtm9j"&&(r.innerHTML=T),Y=p(f),b(E.$$.fragment,f)},m(f,R){g(l,f,R),a(f,c,R),a(f,s,R),a(f,u,R),g(U,f,R),a(f,X,R),a(f,_,R),a(f,G,R),a(f,V,R),a(f,Z,R),g(k,f,R),a(f,x,R),a(f,r,R),a(f,Y,R),g(E,f,R),N=!0},p(f,R){const S={};R&2&&(S.$$scope={dirty:R,ctx:f}),l.$set(S)},i(f){N||($(l.$$.fragment,f),$(U.$$.fragment,f),$(k.$$.fragment,f),$(E.$$.fragment,f),N=!0)},o(f){j(l.$$.fragment,f),j(U.$$.fragment,f),j(k.$$.fragment,f),j(E.$$.fragment,f),N=!1},d(f){f&&(t(c),t(s),t(u),t(X),t(_),t(G),t(V),t(Z),t(x),t(r),t(Y)),w(l,f),w(U,f),w(k,f),w(E,f)}}}function al(J){let l,c;return l=new ct({props:{$$slots:{default:[ll]},$$scope:{ctx:J}}}),{c(){M(l.$$.fragment)},l(s){b(l.$$.fragment,s)},m(s,m){g(l,s,m),c=!0},p(s,m){const u={};m&2&&(u.$$scope={dirty:m,ctx:s}),l.$set(u)},i(s){c||($(l.$$.fragment,s),c=!0)},o(s){j(l.$$.fragment,s),c=!1},d(s){w(l,s)}}}function nl(J){let l,c='Keras로 모델 파인튜닝을 하는 것이 익숙하지 않다면, <a href="../training#train-a-tensorflow-model-with-keras">여기</a>에서 기본적인 튜토리얼을 확인하세요!';return{c(){l=h("p"),l.innerHTML=c},l(s){l=d(s,"P",{"data-svelte-h":!0}),y(l)!=="svelte-wcc60e"&&(l.innerHTML=c)},m(s,m){a(s,l,m)},p:je,d(s){s&&t(l)}}}function ol(J){let l,c,s,m,u,U="그런 다음 <code>TFAutoModelForSeq2SeqLM</code>을 사용하여 T5를 가져오세요:",X,_,W,G,V="<code>prepare_tf_dataset()</code>을 사용하여 데이터셋을 <code>tf.data.Dataset</code> 형식으로 변환하세요:",I,Z,k,x,r='<a href="https://keras.io/api/models/model_training_apis/#compile-method" rel="nofollow"><code>compile</code></a>을 사용하여 모델을 학습할 수 있도록 구성하세요:',T,Y,E,N,f=`학습을 시작하기 전에 설정해야 할 마지막 두 가지는 예측에서 ROUGE 점수를 계산하고 모델을 Hub에 푸시하는 방법을 제공하는 것입니다.
두 작업 모두 <a href="../main_classes/keras_callbacks">Keras callbacks</a>으로 수행할 수 있습니다.`,R,S,mt="<code>KerasMetricCallback</code>에 <code>compute_metrics</code> 함수를 전달하세요:",ae,A,we,D,ee="<code>PushToHubCallback</code>에서 모델과 토크나이저를 푸시할 위치를 지정하세요:",ne,Q,ve,K,te="그런 다음 콜백을 번들로 묶어줍니다:",oe,q,Te,O,se=`드디어 모델 학습을 시작할 준비가 되었습니다!
학습 및 검증 데이터셋, 에폭 수 및 콜백과 함께 <a href="https://keras.io/api/models/model_training_apis/#fit-method" rel="nofollow"><code>fit</code></a>을 호출하여 모델을 파인튜닝하세요.`,re,F,L,P,le="학습이 완료되면 모델이 자동으로 Hub에 업로드되어 누구나 사용할 수 있게 됩니다!",he;return l=new os({props:{$$slots:{default:[nl]},$$scope:{ctx:J}}}),s=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMGNyZWF0ZV9vcHRpbWl6ZXIlMkMlMjBBZGFtV2VpZ2h0RGVjYXklMEElMEFvcHRpbWl6ZXIlMjAlM0QlMjBBZGFtV2VpZ2h0RGVjYXkobGVhcm5pbmdfcmF0ZSUzRDJlLTUlMkMlMjB3ZWlnaHRfZGVjYXlfcmF0ZSUzRDAuMDEp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> create_optimizer, AdamWeightDecay

<span class="hljs-meta">&gt;&gt;&gt; </span>optimizer = AdamWeightDecay(learning_rate=<span class="hljs-number">2e-5</span>, weight_decay_rate=<span class="hljs-number">0.01</span>)`}}),_=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGQXV0b01vZGVsRm9yU2VxMlNlcUxNJTBBJTBBbW9kZWwlMjAlM0QlMjBURkF1dG9Nb2RlbEZvclNlcTJTZXFMTS5mcm9tX3ByZXRyYWluZWQoY2hlY2twb2ludCk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFAutoModelForSeq2SeqLM

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFAutoModelForSeq2SeqLM.from_pretrained(checkpoint)`}}),Z=new C({props:{code:"dGZfdHJhaW5fc2V0JTIwJTNEJTIwbW9kZWwucHJlcGFyZV90Zl9kYXRhc2V0KCUwQSUyMCUyMCUyMCUyMHRva2VuaXplZF9iaWxsc3VtJTVCJTIydHJhaW4lMjIlNUQlMkMlMEElMjAlMjAlMjAlMjBzaHVmZmxlJTNEVHJ1ZSUyQyUwQSUyMCUyMCUyMCUyMGJhdGNoX3NpemUlM0QxNiUyQyUwQSUyMCUyMCUyMCUyMGNvbGxhdGVfZm4lM0RkYXRhX2NvbGxhdG9yJTJDJTBBKSUwQSUwQXRmX3Rlc3Rfc2V0JTIwJTNEJTIwbW9kZWwucHJlcGFyZV90Zl9kYXRhc2V0KCUwQSUyMCUyMCUyMCUyMHRva2VuaXplZF9iaWxsc3VtJTVCJTIydGVzdCUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMHNodWZmbGUlM0RGYWxzZSUyQyUwQSUyMCUyMCUyMCUyMGJhdGNoX3NpemUlM0QxNiUyQyUwQSUyMCUyMCUyMCUyMGNvbGxhdGVfZm4lM0RkYXRhX2NvbGxhdG9yJTJDJTBBKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>tf_train_set = model.prepare_tf_dataset(
<span class="hljs-meta">... </span>    tokenized_billsum[<span class="hljs-string">&quot;train&quot;</span>],
<span class="hljs-meta">... </span>    shuffle=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>    batch_size=<span class="hljs-number">16</span>,
<span class="hljs-meta">... </span>    collate_fn=data_collator,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>tf_test_set = model.prepare_tf_dataset(
<span class="hljs-meta">... </span>    tokenized_billsum[<span class="hljs-string">&quot;test&quot;</span>],
<span class="hljs-meta">... </span>    shuffle=<span class="hljs-literal">False</span>,
<span class="hljs-meta">... </span>    batch_size=<span class="hljs-number">16</span>,
<span class="hljs-meta">... </span>    collate_fn=data_collator,
<span class="hljs-meta">... </span>)`}}),Y=new C({props:{code:"aW1wb3J0JTIwdGVuc29yZmxvdyUyMGFzJTIwdGYlMEElMEFtb2RlbC5jb21waWxlKG9wdGltaXplciUzRG9wdGltaXplcik=",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)`}}),A=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycy5rZXJhc19jYWxsYmFja3MlMjBpbXBvcnQlMjBLZXJhc01ldHJpY0NhbGxiYWNrJTBBJTBBbWV0cmljX2NhbGxiYWNrJTIwJTNEJTIwS2VyYXNNZXRyaWNDYWxsYmFjayhtZXRyaWNfZm4lM0Rjb21wdXRlX21ldHJpY3MlMkMlMjBldmFsX2RhdGFzZXQlM0R0Zl92YWxpZGF0aW9uX3NldCk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers.keras_callbacks <span class="hljs-keyword">import</span> KerasMetricCallback

<span class="hljs-meta">&gt;&gt;&gt; </span>metric_callback = KerasMetricCallback(metric_fn=compute_metrics, eval_dataset=tf_validation_set)`}}),Q=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycy5rZXJhc19jYWxsYmFja3MlMjBpbXBvcnQlMjBQdXNoVG9IdWJDYWxsYmFjayUwQSUwQXB1c2hfdG9faHViX2NhbGxiYWNrJTIwJTNEJTIwUHVzaFRvSHViQ2FsbGJhY2soJTBBJTIwJTIwJTIwJTIwb3V0cHV0X2RpciUzRCUyMm15X2F3ZXNvbWVfYmlsbHN1bV9tb2RlbCUyMiUyQyUwQSUyMCUyMCUyMCUyMHRva2VuaXplciUzRHRva2VuaXplciUyQyUwQSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers.keras_callbacks <span class="hljs-keyword">import</span> PushToHubCallback

<span class="hljs-meta">&gt;&gt;&gt; </span>push_to_hub_callback = PushToHubCallback(
<span class="hljs-meta">... </span>    output_dir=<span class="hljs-string">&quot;my_awesome_billsum_model&quot;</span>,
<span class="hljs-meta">... </span>    tokenizer=tokenizer,
<span class="hljs-meta">... </span>)`}}),q=new C({props:{code:"Y2FsbGJhY2tzJTIwJTNEJTIwJTVCbWV0cmljX2NhbGxiYWNrJTJDJTIwcHVzaF90b19odWJfY2FsbGJhY2slNUQ=",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>callbacks = [metric_callback, push_to_hub_callback]'}}),F=new C({props:{code:"bW9kZWwuZml0KHglM0R0Zl90cmFpbl9zZXQlMkMlMjB2YWxpZGF0aW9uX2RhdGElM0R0Zl90ZXN0X3NldCUyQyUyMGVwb2NocyUzRDMlMkMlMjBjYWxsYmFja3MlM0RjYWxsYmFja3Mp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>model.fit(x=tf_train_set, validation_data=tf_test_set, epochs=<span class="hljs-number">3</span>, callbacks=callbacks)'}}),{c(){M(l.$$.fragment),c=Ss(`
TensorFlow에서 모델을 파인튜닝하려면, 먼저 옵티마이저, 학습률 스케줄 그리고 몇 가지 학습 하이퍼파라미터를 설정하세요:

	`),M(s.$$.fragment),m=i(),u=h("p"),u.innerHTML=U,X=i(),M(_.$$.fragment),W=i(),G=h("p"),G.innerHTML=V,I=i(),M(Z.$$.fragment),k=i(),x=h("p"),x.innerHTML=r,T=i(),M(Y.$$.fragment),E=i(),N=h("p"),N.innerHTML=f,R=i(),S=h("p"),S.innerHTML=mt,ae=i(),M(A.$$.fragment),we=i(),D=h("p"),D.innerHTML=ee,ne=i(),M(Q.$$.fragment),ve=i(),K=h("p"),K.textContent=te,oe=i(),M(q.$$.fragment),Te=i(),O=h("p"),O.innerHTML=se,re=i(),M(F.$$.fragment),L=i(),P=h("p"),P.textContent=le},l(o){b(l.$$.fragment,o),c=Es(o,`
TensorFlow에서 모델을 파인튜닝하려면, 먼저 옵티마이저, 학습률 스케줄 그리고 몇 가지 학습 하이퍼파라미터를 설정하세요:

	`),b(s.$$.fragment,o),m=p(o),u=d(o,"P",{"data-svelte-h":!0}),y(u)!=="svelte-11rvnin"&&(u.innerHTML=U),X=p(o),b(_.$$.fragment,o),W=p(o),G=d(o,"P",{"data-svelte-h":!0}),y(G)!=="svelte-84z53k"&&(G.innerHTML=V),I=p(o),b(Z.$$.fragment,o),k=p(o),x=d(o,"P",{"data-svelte-h":!0}),y(x)!=="svelte-1jrvted"&&(x.innerHTML=r),T=p(o),b(Y.$$.fragment,o),E=p(o),N=d(o,"P",{"data-svelte-h":!0}),y(N)!=="svelte-1uxjztu"&&(N.innerHTML=f),R=p(o),S=d(o,"P",{"data-svelte-h":!0}),y(S)!=="svelte-1fwgit4"&&(S.innerHTML=mt),ae=p(o),b(A.$$.fragment,o),we=p(o),D=d(o,"P",{"data-svelte-h":!0}),y(D)!=="svelte-1gxg6g9"&&(D.innerHTML=ee),ne=p(o),b(Q.$$.fragment,o),ve=p(o),K=d(o,"P",{"data-svelte-h":!0}),y(K)!=="svelte-1roz35e"&&(K.textContent=te),oe=p(o),b(q.$$.fragment,o),Te=p(o),O=d(o,"P",{"data-svelte-h":!0}),y(O)!=="svelte-zgk7hm"&&(O.innerHTML=se),re=p(o),b(F.$$.fragment,o),L=p(o),P=d(o,"P",{"data-svelte-h":!0}),y(P)!=="svelte-trwelq"&&(P.textContent=le)},m(o,v){g(l,o,v),a(o,c,v),g(s,o,v),a(o,m,v),a(o,u,v),a(o,X,v),g(_,o,v),a(o,W,v),a(o,G,v),a(o,I,v),g(Z,o,v),a(o,k,v),a(o,x,v),a(o,T,v),g(Y,o,v),a(o,E,v),a(o,N,v),a(o,R,v),a(o,S,v),a(o,ae,v),g(A,o,v),a(o,we,v),a(o,D,v),a(o,ne,v),g(Q,o,v),a(o,ve,v),a(o,K,v),a(o,oe,v),g(q,o,v),a(o,Te,v),a(o,O,v),a(o,re,v),g(F,o,v),a(o,L,v),a(o,P,v),he=!0},p(o,v){const Ue={};v&2&&(Ue.$$scope={dirty:v,ctx:o}),l.$set(Ue)},i(o){he||($(l.$$.fragment,o),$(s.$$.fragment,o),$(_.$$.fragment,o),$(Z.$$.fragment,o),$(Y.$$.fragment,o),$(A.$$.fragment,o),$(Q.$$.fragment,o),$(q.$$.fragment,o),$(F.$$.fragment,o),he=!0)},o(o){j(l.$$.fragment,o),j(s.$$.fragment,o),j(_.$$.fragment,o),j(Z.$$.fragment,o),j(Y.$$.fragment,o),j(A.$$.fragment,o),j(Q.$$.fragment,o),j(q.$$.fragment,o),j(F.$$.fragment,o),he=!1},d(o){o&&(t(c),t(m),t(u),t(X),t(W),t(G),t(I),t(k),t(x),t(T),t(E),t(N),t(R),t(S),t(ae),t(we),t(D),t(ne),t(ve),t(K),t(oe),t(Te),t(O),t(re),t(L),t(P)),w(l,o),w(s,o),w(_,o),w(Z,o),w(Y,o),w(A,o),w(Q,o),w(q,o),w(F,o)}}}function rl(J){let l,c;return l=new ct({props:{$$slots:{default:[ol]},$$scope:{ctx:J}}}),{c(){M(l.$$.fragment)},l(s){b(l.$$.fragment,s)},m(s,m){g(l,s,m),c=!0},p(s,m){const u={};m&2&&(u.$$scope={dirty:m,ctx:s}),l.$set(u)},i(s){c||($(l.$$.fragment,s),c=!0)},o(s){j(l.$$.fragment,s),c=!1},d(s){w(l,s)}}}function il(J){let l,c=`요약을 위해 모델을 파인튜닝하는 방법에 대한 더 자세한 예제를 보려면 <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/summarization.ipynb" rel="nofollow">PyTorch notebook</a>
또는 <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/summarization-tf.ipynb" rel="nofollow">TensorFlow notebook</a>을 참고하세요.`;return{c(){l=h("p"),l.innerHTML=c},l(s){l=d(s,"P",{"data-svelte-h":!0}),y(l)!=="svelte-19xvtxh"&&(l.innerHTML=c)},m(s,m){a(s,l,m)},p:je,d(s){s&&t(l)}}}function pl(J){let l,c="텍스트를 토크나이즈하고 <code>input_ids</code>를 PyTorch 텐서로 반환합니다:",s,m,u,U,X=`요약문을 생성하려면 <code>generate()</code> 메소드를 사용하세요.
텍스트 생성에 대한 다양한 전략과 생성을 제어하기 위한 매개변수에 대한 자세한 내용은 <a href="../main_classes/text_generation">텍스트 생성</a> API를 참조하세요.`,_,W,G,V,I="생성된 토큰 ID를 텍스트로 디코딩합니다:",Z,k,x;return m=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJzdGV2aGxpdSUyRm15X2F3ZXNvbWVfYmlsbHN1bV9tb2RlbCUyMiklMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIodGV4dCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIpLmlucHV0X2lkcw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;stevhliu/my_awesome_billsum_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(text, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).input_ids`}}),W=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvclNlcTJTZXFMTSUwQSUwQW1vZGVsJTIwJTNEJTIwQXV0b01vZGVsRm9yU2VxMlNlcUxNLmZyb21fcHJldHJhaW5lZCglMjJzdGV2aGxpdSUyRm15X2F3ZXNvbWVfYmlsbHN1bV9tb2RlbCUyMiklMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoaW5wdXRzJTJDJTIwbWF4X25ld190b2tlbnMlM0QxMDAlMkMlMjBkb19zYW1wbGUlM0RGYWxzZSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForSeq2SeqLM

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForSeq2SeqLM.from_pretrained(<span class="hljs-string">&quot;stevhliu/my_awesome_billsum_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model.generate(inputs, max_new_tokens=<span class="hljs-number">100</span>, do_sample=<span class="hljs-literal">False</span>)`}}),k=new C({props:{code:"dG9rZW5pemVyLmRlY29kZShvdXRwdXRzJTVCMCU1RCUyQyUyMHNraXBfc3BlY2lhbF90b2tlbnMlM0RUcnVlKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.decode(outputs[<span class="hljs-number">0</span>], skip_special_tokens=<span class="hljs-literal">True</span>)
<span class="hljs-string">&#x27;the inflation reduction act lowers prescription drug costs, health care costs, and energy costs. it&#x27;</span>s the most aggressive action on tackling the climate crisis <span class="hljs-keyword">in</span> american history. it will ask the ultra-wealthy <span class="hljs-keyword">and</span> corporations to pay their fair share.<span class="hljs-string">&#x27;</span>`}}),{c(){l=h("p"),l.innerHTML=c,s=i(),M(m.$$.fragment),u=i(),U=h("p"),U.innerHTML=X,_=i(),M(W.$$.fragment),G=i(),V=h("p"),V.textContent=I,Z=i(),M(k.$$.fragment)},l(r){l=d(r,"P",{"data-svelte-h":!0}),y(l)!=="svelte-xxy7yh"&&(l.innerHTML=c),s=p(r),b(m.$$.fragment,r),u=p(r),U=d(r,"P",{"data-svelte-h":!0}),y(U)!=="svelte-rlt40p"&&(U.innerHTML=X),_=p(r),b(W.$$.fragment,r),G=p(r),V=d(r,"P",{"data-svelte-h":!0}),y(V)!=="svelte-enqynu"&&(V.textContent=I),Z=p(r),b(k.$$.fragment,r)},m(r,T){a(r,l,T),a(r,s,T),g(m,r,T),a(r,u,T),a(r,U,T),a(r,_,T),g(W,r,T),a(r,G,T),a(r,V,T),a(r,Z,T),g(k,r,T),x=!0},p:je,i(r){x||($(m.$$.fragment,r),$(W.$$.fragment,r),$(k.$$.fragment,r),x=!0)},o(r){j(m.$$.fragment,r),j(W.$$.fragment,r),j(k.$$.fragment,r),x=!1},d(r){r&&(t(l),t(s),t(u),t(U),t(_),t(G),t(V),t(Z)),w(m,r),w(W,r),w(k,r)}}}function cl(J){let l,c;return l=new ct({props:{$$slots:{default:[pl]},$$scope:{ctx:J}}}),{c(){M(l.$$.fragment)},l(s){b(l.$$.fragment,s)},m(s,m){g(l,s,m),c=!0},p(s,m){const u={};m&2&&(u.$$scope={dirty:m,ctx:s}),l.$set(u)},i(s){c||($(l.$$.fragment,s),c=!0)},o(s){j(l.$$.fragment,s),c=!1},d(s){w(l,s)}}}function ml(J){let l,c="텍스트를 토크나이즈하고 <code>input_ids</code>를 TensorFlow 텐서로 반환합니다:",s,m,u,U,X=`요약문을 생성하려면 <code>generate()</code> 메소드를 사용하세요.
텍스트 생성에 대한 다양한 전략과 생성을 제어하기 위한 매개변수에 대한 자세한 내용은 <a href="../main_classes/text_generation">텍스트 생성</a> API를 참조하세요.`,_,W,G,V,I="생성된 토큰 ID를 텍스트로 디코딩합니다:",Z,k,x;return m=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJzdGV2aGxpdSUyRm15X2F3ZXNvbWVfYmlsbHN1bV9tb2RlbCUyMiklMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIodGV4dCUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIydGYlMjIpLmlucHV0X2lkcw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;stevhliu/my_awesome_billsum_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(text, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>).input_ids`}}),W=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGQXV0b01vZGVsRm9yU2VxMlNlcUxNJTBBJTBBbW9kZWwlMjAlM0QlMjBURkF1dG9Nb2RlbEZvclNlcTJTZXFMTS5mcm9tX3ByZXRyYWluZWQoJTIyc3RldmhsaXUlMkZteV9hd2Vzb21lX2JpbGxzdW1fbW9kZWwlMjIpJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKGlucHV0cyUyQyUyMG1heF9uZXdfdG9rZW5zJTNEMTAwJTJDJTIwZG9fc2FtcGxlJTNERmFsc2Up",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFAutoModelForSeq2SeqLM

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFAutoModelForSeq2SeqLM.from_pretrained(<span class="hljs-string">&quot;stevhliu/my_awesome_billsum_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model.generate(inputs, max_new_tokens=<span class="hljs-number">100</span>, do_sample=<span class="hljs-literal">False</span>)`}}),k=new C({props:{code:"dG9rZW5pemVyLmRlY29kZShvdXRwdXRzJTVCMCU1RCUyQyUyMHNraXBfc3BlY2lhbF90b2tlbnMlM0RUcnVlKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.decode(outputs[<span class="hljs-number">0</span>], skip_special_tokens=<span class="hljs-literal">True</span>)
<span class="hljs-string">&#x27;the inflation reduction act lowers prescription drug costs, health care costs, and energy costs. it&#x27;</span>s the most aggressive action on tackling the climate crisis <span class="hljs-keyword">in</span> american history. it will ask the ultra-wealthy <span class="hljs-keyword">and</span> corporations to pay their fair share.<span class="hljs-string">&#x27;</span>`}}),{c(){l=h("p"),l.innerHTML=c,s=i(),M(m.$$.fragment),u=i(),U=h("p"),U.innerHTML=X,_=i(),M(W.$$.fragment),G=i(),V=h("p"),V.textContent=I,Z=i(),M(k.$$.fragment)},l(r){l=d(r,"P",{"data-svelte-h":!0}),y(l)!=="svelte-1tm5hzv"&&(l.innerHTML=c),s=p(r),b(m.$$.fragment,r),u=p(r),U=d(r,"P",{"data-svelte-h":!0}),y(U)!=="svelte-rlt40p"&&(U.innerHTML=X),_=p(r),b(W.$$.fragment,r),G=p(r),V=d(r,"P",{"data-svelte-h":!0}),y(V)!=="svelte-enqynu"&&(V.textContent=I),Z=p(r),b(k.$$.fragment,r)},m(r,T){a(r,l,T),a(r,s,T),g(m,r,T),a(r,u,T),a(r,U,T),a(r,_,T),g(W,r,T),a(r,G,T),a(r,V,T),a(r,Z,T),g(k,r,T),x=!0},p:je,i(r){x||($(m.$$.fragment,r),$(W.$$.fragment,r),$(k.$$.fragment,r),x=!0)},o(r){j(m.$$.fragment,r),j(W.$$.fragment,r),j(k.$$.fragment,r),x=!1},d(r){r&&(t(l),t(s),t(u),t(U),t(_),t(G),t(V),t(Z)),w(m,r),w(W,r),w(k,r)}}}function hl(J){let l,c;return l=new ct({props:{$$slots:{default:[ml]},$$scope:{ctx:J}}}),{c(){M(l.$$.fragment)},l(s){b(l.$$.fragment,s)},m(s,m){g(l,s,m),c=!0},p(s,m){const u={};m&2&&(u.$$scope={dirty:m,ctx:s}),l.$set(u)},i(s){c||($(l.$$.fragment,s),c=!0)},o(s){j(l.$$.fragment,s),c=!1},d(s){w(l,s)}}}function dl(J){let l,c,s,m,u,U,X,_,W,G,V="요약",I,Z,k,x,r,T,Y=`요약은 문서나 기사에서 중요한 정보를 모두 포함하되 짧게 만드는 일입니다.
번역과 마찬가지로, 시퀀스-투-시퀀스 문제로 구성할 수 있는 대표적인 작업 중 하나입니다.
요약에는 아래와 같이 유형이 있습니다:`,E,N,f="<li>추출(Extractive) 요약: 문서에서 가장 관련성 높은 정보를 추출합니다.</li> <li>생성(Abstractive) 요약: 가장 관련성 높은 정보를 포착해내는 새로운 텍스트를 생성합니다.</li>",R,S,mt="이 가이드에서 소개할 내용은 아래와 같습니다:",ae,A,we='<li>생성 요약을 위한 <a href="https://huggingface.co/datasets/billsum" rel="nofollow">BillSum</a> 데이터셋 중 캘리포니아 주 법안 하위 집합으로 <a href="https://huggingface.co/t5-small" rel="nofollow">T5</a>를 파인튜닝합니다.</li> <li>파인튜닝된 모델을 사용하여 추론합니다.</li>',D,ee,ne,Q,ve="시작하기 전에 필요한 라이브러리가 모두 설치되어 있는지 확인하세요:",K,te,oe,q,Te=`Hugging Face 계정에 로그인하면 모델을 업로드하고 커뮤니티에 공유할 수 있습니다.
토큰을 입력하여 로그인하세요.`,O,se,re,F,L,P,le,he,o,v="BillSum 데이터셋 가져오기",Ue,_e,hs="🤗 Datasets 라이브러리에서 BillSum 데이터셋의 작은 버전인 캘리포니아 주 법안 하위 집합을 가져오세요:",$t,ke,jt,Je,ds="<code>train_test_split</code> 메소드로 데이터셋을 학습용와 테스트용으로 나누세요:",wt,Ce,vt,Ze,fs="그런 다음 예시를 하나 살펴보세요:",Tt,xe,Ut,Ge,us="여기서 다음 두 개의 필드를 사용하게 됩니다:",_t,Ve,ys="<li><code>text</code>: 모델의 입력이 될 법안 텍스트입니다.</li> <li><code>summary</code>: <code>text</code>의 간략한 버전으로 모델의 타겟이 됩니다.</li>",kt,ie,de,ht,Re,rs,nt,Ms="전처리",Jt,We,bs="다음으로 <code>text</code>와 <code>summary</code>를 처리하기 위한 T5 토크나이저를 가져옵니다:",Ct,Be,Zt,He,gs="생성하려는 전처리 함수는 아래 조건을 만족해야 합니다:",xt,Xe,$s="<li>입력 앞에 프롬프트를 붙여 T5가 요약 작업임을 인식할 수 있도록 합니다. 여러 NLP 작업을 수행할 수 있는 일부 모델은 특정 작업에 대한 프롬프트가 필요합니다.</li> <li>레이블을 토큰화할 때 <code>text_target</code> 인수를 사용합니다.</li> <li><code>max_length</code> 매개변수로 설정된 최대 길이를 넘지 않도록 긴 시퀀스를 잘라냅니다.</li>",Gt,Ne,Vt,ze,js=`전체 데이터셋에 전처리 함수를 적용하려면 🤗 Datasets의 <code>map</code> 메소드를 사용하세요.
<code>batched=True</code>로 설정하여 데이터셋의 여러 요소를 한 번에 처리하면 <code>map</code> 함수의 속도를 높일 수 있습니다.`,Rt,Ie,Wt,Se,ws=`이제 <code>DataCollatorForSeq2Seq</code>를 사용하여 예제 배치를 만드세요.
전체 데이터셋을 최대 길이로 패딩하는 것보다 배치마다 가장 긴 문장 길이에 맞춰 <em>동적 패딩</em>하는 것이 더 효율적입니다.`,Bt,fe,Ht,pe,ue,dt,Ee,is,ot,vs="평가",Xt,Fe,Ts=`학습 중에 평가 지표를 포함하면 모델의 성능을 평가하는 데 도움이 되는 경우가 많습니다.
🤗 <a href="https://huggingface.co/docs/evaluate/index" rel="nofollow">Evaluate</a> 라이브러리를 사용하면 평가 방법을 빠르게 불러올 수 있습니다.
이 작업에서는 <a href="https://huggingface.co/spaces/evaluate-metric/rouge" rel="nofollow">ROUGE</a> 평가 지표를 가져옵니다.
(평가 지표를 불러오고 계산하는 방법은 🤗 Evaluate <a href="https://huggingface.co/docs/evaluate/a_quick_tour" rel="nofollow">둘러보기</a>를 참조하세요.)`,Nt,Ye,zt,Ae,Us="그런 다음 예측값과 레이블을 <code>compute</code>에 전달하여 ROUGE 지표를 계산하는 함수를 만듭니다:",It,Qe,St,qe,_s="이제 <code>compute_metrics</code> 함수를 사용할 준비가 되었으며, 학습을 설정할 때 이 함수로 되돌아올 것입니다.",Et,ce,ye,ft,Le,ps,rt,ks="학습",Ft,Me,Yt,be,At,me,ge,ut,Pe,cs,it,Js="추론",Qt,De,Cs="좋아요, 이제 모델을 파인튜닝했으니 추론에 사용할 수 있습니다!",qt,Ke,Zs="요약할 텍스트를 작성해보세요. T5의 경우 작업에 따라 입력 앞에 접두사를 붙여야 합니다. 요약의 경우, 아래와 같은 접두사를 입력 앞에 붙여야 합니다:",Lt,Oe,Pt,et,xs=`추론을 위해 파인튜닝한 모델을 시험해 보는 가장 간단한 방법은 <code>pipeline()</code>에서 사용하는 것입니다.
모델을 사용하여 요약을 수행할 <code>pipeline()</code>을 인스턴스화하고 텍스트를 전달하세요:`,Dt,tt,Kt,st,Gs="원한다면 수동으로 다음과 같은 작업을 수행하여 <code>pipeline()</code>의 결과와 동일한 결과를 얻을 수 있습니다:",Ot,$e,es,yt,ts;return _=new pt({}),Z=new Ps({props:{classNames:"absolute z-10 right-0 top-0",options:[{label:"Mixed",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/ko/summarization.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/ko/pytorch/summarization.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/ko/tensorflow/summarization.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ko/summarization.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ko/pytorch/summarization.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ko/tensorflow/summarization.ipynb"}]}}),x=new Ls({props:{id:"yHnr5Dk2zCI"}}),ee=new os({props:{$$slots:{default:[Ds]},$$scope:{ctx:J}}}),te=new C({props:{code:"cGlwJTIwaW5zdGFsbCUyMHRyYW5zZm9ybWVycyUyMGRhdGFzZXRzJTIwZXZhbHVhdGUlMjByb3VnZV9zY29yZQ==",highlighted:"pip install transformers datasets evaluate rouge_score"}}),se=new C({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMG5vdGVib29rX2xvZ2luJTBBJTBBbm90ZWJvb2tfbG9naW4oKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> notebook_login

<span class="hljs-meta">&gt;&gt;&gt; </span>notebook_login()`}}),le=new pt({}),ke=new C({props:{code:"ZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBJTBBYmlsbHN1bSUyMCUzRCUyMGxvYWRfZGF0YXNldCglMjJiaWxsc3VtJTIyJTJDJTIwc3BsaXQlM0QlMjJjYV90ZXN0JTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset

<span class="hljs-meta">&gt;&gt;&gt; </span>billsum = load_dataset(<span class="hljs-string">&quot;billsum&quot;</span>, split=<span class="hljs-string">&quot;ca_test&quot;</span>)`}}),Ce=new C({props:{code:"YmlsbHN1bSUyMCUzRCUyMGJpbGxzdW0udHJhaW5fdGVzdF9zcGxpdCh0ZXN0X3NpemUlM0QwLjIp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>billsum = billsum.train_test_split(test_size=<span class="hljs-number">0.2</span>)'}}),xe=new C({props:{code:"YmlsbHN1bSU1QiUyMnRyYWluJTIyJTVEJTVCMCU1RA==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>billsum[<span class="hljs-string">&quot;train&quot;</span>][<span class="hljs-number">0</span>]
{<span class="hljs-string">&#x27;summary&#x27;</span>: <span class="hljs-string">&#x27;Existing law authorizes state agencies to enter into contracts for the acquisition of goods or services upon approval by the Department of General Services. Existing law sets forth various requirements and prohibitions for those contracts, including, but not limited to, a prohibition on entering into contracts for the acquisition of goods or services of $100,000 or more with a contractor that discriminates between spouses and domestic partners or same-sex and different-sex couples in the provision of benefits. Existing law provides that a contract entered into in violation of those requirements and prohibitions is void and authorizes the state or any person acting on behalf of the state to bring a civil action seeking a determination that a contract is in violation and therefore void. Under existing law, a willful violation of those requirements and prohibitions is a misdemeanor.\\nThis bill would also prohibit a state agency from entering into contracts for the acquisition of goods or services of $100,000 or more with a contractor that discriminates between employees on the basis of gender identity in the provision of benefits, as specified. By expanding the scope of a crime, this bill would impose a state-mandated local program.\\nThe California Constitution requires the state to reimburse local agencies and school districts for certain costs mandated by the state. Statutory provisions establish procedures for making that reimbursement.\\nThis bill would provide that no reimbursement is required by this act for a specified reason.&#x27;</span>,
 <span class="hljs-string">&#x27;text&#x27;</span>: <span class="hljs-string">&#x27;The people of the State of California do enact as follows:\\n\\n\\nSECTION 1.\\nSection 10295.35 is added to the Public Contract Code, to read:\\n10295.35.\\n(a) (1) Notwithstanding any other law, a state agency shall not enter into any contract for the acquisition of goods or services in the amount of one hundred thousand dollars ($100,000) or more with a contractor that, in the provision of benefits, discriminates between employees on the basis of an employee’s or dependent’s actual or perceived gender identity, including, but not limited to, the employee’s or dependent’s identification as transgender.\\n(2) For purposes of this section, “contract” includes contracts with a cumulative amount of one hundred thousand dollars ($100,000) or more per contractor in each fiscal year.\\n(3) For purposes of this section, an employee health plan is discriminatory if the plan is not consistent with Section 1365.5 of the Health and Safety Code and Section 10140 of the Insurance Code.\\n(4) The requirements of this section shall apply only to those portions of a contractor’s operations that occur under any of the following conditions:\\n(A) Within the state.\\n(B) On real property outside the state if the property is owned by the state or if the state has a right to occupy the property, and if the contractor’s presence at that location is connected to a contract with the state.\\n(C) Elsewhere in the United States where work related to a state contract is being performed.\\n(b) Contractors shall treat as confidential, to the maximum extent allowed by law or by the requirement of the contractor’s insurance provider, any request by an employee or applicant for employment benefits or any documentation of eligibility for benefits submitted by an employee or applicant for employment.\\n(c) After taking all reasonable measures to find a contractor that complies with this section, as determined by the state agency, the requirements of this section may be waived under any of the following circumstances:\\n(1) There is only one prospective contractor willing to enter into a specific contract with the state agency.\\n(2) The contract is necessary to respond to an emergency, as determined by the state agency, that endangers the public health, welfare, or safety, or the contract is necessary for the provision of essential services, and no entity that complies with the requirements of this section capable of responding to the emergency is immediately available.\\n(3) The requirements of this section violate, or are inconsistent with, the terms or conditions of a grant, subvention, or agreement, if the agency has made a good faith attempt to change the terms or conditions of any grant, subvention, or agreement to authorize application of this section.\\n(4) The contractor is providing wholesale or bulk water, power, or natural gas, the conveyance or transmission of the same, or ancillary services, as required for ensuring reliable services in accordance with good utility practice, if the purchase of the same cannot practically be accomplished through the standard competitive bidding procedures and the contractor is not providing direct retail services to end users.\\n(d) (1) A contractor shall not be deemed to discriminate in the provision of benefits if the contractor, in providing the benefits, pays the actual costs incurred in obtaining the benefit.\\n(2) If a contractor is unable to provide a certain benefit, despite taking reasonable measures to do so, the contractor shall not be deemed to discriminate in the provision of benefits.\\n(e) (1) Every contract subject to this chapter shall contain a statement by which the contractor certifies that the contractor is in compliance with this section.\\n(2) The department or other contracting agency shall enforce this section pursuant to its existing enforcement powers.\\n(3) (A) If a contractor falsely certifies that it is in compliance with this section, the contract with that contractor shall be subject to Article 9 (commencing with Section 10420), unless, within a time period specified by the department or other contracting agency, the contractor provides to the department or agency proof that it has complied, or is in the process of complying, with this section.\\n(B) The application of the remedies or penalties contained in Article 9 (commencing with Section 10420) to a contract subject to this chapter shall not preclude the application of any existing remedies otherwise available to the department or other contracting agency under its existing enforcement powers.\\n(f) Nothing in this section is intended to regulate the contracting practices of any local jurisdiction.\\n(g) This section shall be construed so as not to conflict with applicable federal laws, rules, or regulations. In the event that a court or agency of competent jurisdiction holds that federal law, rule, or regulation invalidates any clause, sentence, paragraph, or section of this code or the application thereof to any person or circumstances, it is the intent of the state that the court or agency sever that clause, sentence, paragraph, or section so that the remainder of this section shall remain in effect.\\nSEC. 2.\\nSection 10295.35 of the Public Contract Code shall not be construed to create any new enforcement authority or responsibility in the Department of General Services or any other contracting agency.\\nSEC. 3.\\nNo reimbursement is required by this act pursuant to Section 6 of Article XIII\\u2009B of the California Constitution because the only costs that may be incurred by a local agency or school district will be incurred because this act creates a new crime or infraction, eliminates a crime or infraction, or changes the penalty for a crime or infraction, within the meaning of Section 17556 of the Government Code, or changes the definition of a crime within the meaning of Section 6 of Article XIII\\u2009B of the California Constitution.&#x27;</span>,
 <span class="hljs-string">&#x27;title&#x27;</span>: <span class="hljs-string">&#x27;An act to add Section 10295.35 to the Public Contract Code, relating to public contracts.&#x27;</span>}`}}),Re=new pt({}),Be=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEFjaGVja3BvaW50JTIwJTNEJTIwJTIydDUtc21hbGwlMjIlMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZChjaGVja3BvaW50KQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>checkpoint = <span class="hljs-string">&quot;t5-small&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(checkpoint)`}}),Ne=new C({props:{code:"cHJlZml4JTIwJTNEJTIwJTIyc3VtbWFyaXplJTNBJTIwJTIyJTBBJTBBJTBBZGVmJTIwcHJlcHJvY2Vzc19mdW5jdGlvbihleGFtcGxlcyklM0ElMEElMjAlMjAlMjAlMjBpbnB1dHMlMjAlM0QlMjAlNUJwcmVmaXglMjAlMkIlMjBkb2MlMjBmb3IlMjBkb2MlMjBpbiUyMGV4YW1wbGVzJTVCJTIydGV4dCUyMiU1RCU1RCUwQSUyMCUyMCUyMCUyMG1vZGVsX2lucHV0cyUyMCUzRCUyMHRva2VuaXplcihpbnB1dHMlMkMlMjBtYXhfbGVuZ3RoJTNEMTAyNCUyQyUyMHRydW5jYXRpb24lM0RUcnVlKSUwQSUwQSUyMCUyMCUyMCUyMGxhYmVscyUyMCUzRCUyMHRva2VuaXplcih0ZXh0X3RhcmdldCUzRGV4YW1wbGVzJTVCJTIyc3VtbWFyeSUyMiU1RCUyQyUyMG1heF9sZW5ndGglM0QxMjglMkMlMjB0cnVuY2F0aW9uJTNEVHJ1ZSklMEElMEElMjAlMjAlMjAlMjBtb2RlbF9pbnB1dHMlNUIlMjJsYWJlbHMlMjIlNUQlMjAlM0QlMjBsYWJlbHMlNUIlMjJpbnB1dF9pZHMlMjIlNUQlMEElMjAlMjAlMjAlMjByZXR1cm4lMjBtb2RlbF9pbnB1dHM=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>prefix = <span class="hljs-string">&quot;summarize: &quot;</span>


<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">preprocess_function</span>(<span class="hljs-params">examples</span>):
<span class="hljs-meta">... </span>    inputs = [prefix + doc <span class="hljs-keyword">for</span> doc <span class="hljs-keyword">in</span> examples[<span class="hljs-string">&quot;text&quot;</span>]]
<span class="hljs-meta">... </span>    model_inputs = tokenizer(inputs, max_length=<span class="hljs-number">1024</span>, truncation=<span class="hljs-literal">True</span>)

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

<span class="hljs-meta">... </span>    model_inputs[<span class="hljs-string">&quot;labels&quot;</span>] = labels[<span class="hljs-string">&quot;input_ids&quot;</span>]
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> model_inputs`}}),Ie=new C({props:{code:"dG9rZW5pemVkX2JpbGxzdW0lMjAlM0QlMjBiaWxsc3VtLm1hcChwcmVwcm9jZXNzX2Z1bmN0aW9uJTJDJTIwYmF0Y2hlZCUzRFRydWUp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>tokenized_billsum = billsum.<span class="hljs-built_in">map</span>(preprocess_function, batched=<span class="hljs-literal">True</span>)'}}),fe=new ms({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[tl],pytorch:[Os]},$$scope:{ctx:J}}}),Ee=new pt({}),Ye=new C({props:{code:"aW1wb3J0JTIwZXZhbHVhdGUlMEElMEFyb3VnZSUyMCUzRCUyMGV2YWx1YXRlLmxvYWQoJTIycm91Z2UlMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> evaluate

<span class="hljs-meta">&gt;&gt;&gt; </span>rouge = evaluate.load(<span class="hljs-string">&quot;rouge&quot;</span>)`}}),Qe=new C({props:{code:"aW1wb3J0JTIwbnVtcHklMjBhcyUyMG5wJTBBJTBBJTBBZGVmJTIwY29tcHV0ZV9tZXRyaWNzKGV2YWxfcHJlZCklM0ElMEElMjAlMjAlMjAlMjBwcmVkaWN0aW9ucyUyQyUyMGxhYmVscyUyMCUzRCUyMGV2YWxfcHJlZCUwQSUyMCUyMCUyMCUyMGRlY29kZWRfcHJlZHMlMjAlM0QlMjB0b2tlbml6ZXIuYmF0Y2hfZGVjb2RlKHByZWRpY3Rpb25zJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUpJTBBJTIwJTIwJTIwJTIwbGFiZWxzJTIwJTNEJTIwbnAud2hlcmUobGFiZWxzJTIwISUzRCUyMC0xMDAlMkMlMjBsYWJlbHMlMkMlMjB0b2tlbml6ZXIucGFkX3Rva2VuX2lkKSUwQSUyMCUyMCUyMCUyMGRlY29kZWRfbGFiZWxzJTIwJTNEJTIwdG9rZW5pemVyLmJhdGNoX2RlY29kZShsYWJlbHMlMkMlMjBza2lwX3NwZWNpYWxfdG9rZW5zJTNEVHJ1ZSklMEElMEElMjAlMjAlMjAlMjByZXN1bHQlMjAlM0QlMjByb3VnZS5jb21wdXRlKHByZWRpY3Rpb25zJTNEZGVjb2RlZF9wcmVkcyUyQyUyMHJlZmVyZW5jZXMlM0RkZWNvZGVkX2xhYmVscyUyQyUyMHVzZV9zdGVtbWVyJTNEVHJ1ZSklMEElMEElMjAlMjAlMjAlMjBwcmVkaWN0aW9uX2xlbnMlMjAlM0QlMjAlNUJucC5jb3VudF9ub256ZXJvKHByZWQlMjAhJTNEJTIwdG9rZW5pemVyLnBhZF90b2tlbl9pZCklMjBmb3IlMjBwcmVkJTIwaW4lMjBwcmVkaWN0aW9ucyU1RCUwQSUyMCUyMCUyMCUyMHJlc3VsdCU1QiUyMmdlbl9sZW4lMjIlNUQlMjAlM0QlMjBucC5tZWFuKHByZWRpY3Rpb25fbGVucyklMEElMEElMjAlMjAlMjAlMjByZXR1cm4lMjAlN0JrJTNBJTIwcm91bmQodiUyQyUyMDQpJTIwZm9yJTIwayUyQyUyMHYlMjBpbiUyMHJlc3VsdC5pdGVtcygpJTdE",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np


<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">compute_metrics</span>(<span class="hljs-params">eval_pred</span>):
<span class="hljs-meta">... </span>    predictions, labels = eval_pred
<span class="hljs-meta">... </span>    decoded_preds = tokenizer.batch_decode(predictions, skip_special_tokens=<span class="hljs-literal">True</span>)
<span class="hljs-meta">... </span>    labels = np.where(labels != -<span class="hljs-number">100</span>, labels, tokenizer.pad_token_id)
<span class="hljs-meta">... </span>    decoded_labels = tokenizer.batch_decode(labels, skip_special_tokens=<span class="hljs-literal">True</span>)

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

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

<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> {k: <span class="hljs-built_in">round</span>(v, <span class="hljs-number">4</span>) <span class="hljs-keyword">for</span> k, v <span class="hljs-keyword">in</span> result.items()}`}}),Le=new pt({}),Me=new ms({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[rl],pytorch:[al]},$$scope:{ctx:J}}}),be=new os({props:{$$slots:{default:[il]},$$scope:{ctx:J}}}),Pe=new pt({}),Oe=new C({props:{code:"dGV4dCUyMCUzRCUyMCUyMnN1bW1hcml6ZSUzQSUyMFRoZSUyMEluZmxhdGlvbiUyMFJlZHVjdGlvbiUyMEFjdCUyMGxvd2VycyUyMHByZXNjcmlwdGlvbiUyMGRydWclMjBjb3N0cyUyQyUyMGhlYWx0aCUyMGNhcmUlMjBjb3N0cyUyQyUyMGFuZCUyMGVuZXJneSUyMGNvc3RzLiUyMEl0J3MlMjB0aGUlMjBtb3N0JTIwYWdncmVzc2l2ZSUyMGFjdGlvbiUyMG9uJTIwdGFja2xpbmclMjB0aGUlMjBjbGltYXRlJTIwY3Jpc2lzJTIwaW4lMjBBbWVyaWNhbiUyMGhpc3RvcnklMkMlMjB3aGljaCUyMHdpbGwlMjBsaWZ0JTIwdXAlMjBBbWVyaWNhbiUyMHdvcmtlcnMlMjBhbmQlMjBjcmVhdGUlMjBnb29kLXBheWluZyUyQyUyMHVuaW9uJTIwam9icyUyMGFjcm9zcyUyMHRoZSUyMGNvdW50cnkuJTIwSXQnbGwlMjBsb3dlciUyMHRoZSUyMGRlZmljaXQlMjBhbmQlMjBhc2slMjB0aGUlMjB1bHRyYS13ZWFsdGh5JTIwYW5kJTIwY29ycG9yYXRpb25zJTIwdG8lMjBwYXklMjB0aGVpciUyMGZhaXIlMjBzaGFyZS4lMjBBbmQlMjBubyUyMG9uZSUyMG1ha2luZyUyMHVuZGVyJTIwJTI0NDAwJTJDMDAwJTIwcGVyJTIweWVhciUyMHdpbGwlMjBwYXklMjBhJTIwcGVubnklMjBtb3JlJTIwaW4lMjB0YXhlcy4lMjI=",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>text = <span class="hljs-string">&quot;summarize: The Inflation Reduction Act lowers prescription drug costs, health care costs, and energy costs. It&#x27;s the most aggressive action on tackling the climate crisis in American history, which will lift up American workers and create good-paying, union jobs across the country. It&#x27;ll lower the deficit and ask the ultra-wealthy and corporations to pay their fair share. And no one making under $400,000 per year will pay a penny more in taxes.&quot;</span>'}}),tt=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBc3VtbWFyaXplciUyMCUzRCUyMHBpcGVsaW5lKCUyMnN1bW1hcml6YXRpb24lMjIlMkMlMjBtb2RlbCUzRCUyMnN0ZXZobGl1JTJGbXlfYXdlc29tZV9iaWxsc3VtX21vZGVsJTIyKSUwQXN1bW1hcml6ZXIodGV4dCk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

<span class="hljs-meta">&gt;&gt;&gt; </span>summarizer = pipeline(<span class="hljs-string">&quot;summarization&quot;</span>, model=<span class="hljs-string">&quot;stevhliu/my_awesome_billsum_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>summarizer(text)
[{<span class="hljs-string">&quot;summary_text&quot;</span>: <span class="hljs-string">&quot;The Inflation Reduction Act lowers prescription drug costs, health care costs, and energy costs. It&#x27;s the most aggressive action on tackling the climate crisis in American history, which will lift up American workers and create good-paying, union jobs across the country.&quot;</span>}]`}}),$e=new ms({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[hl],pytorch:[cl]},$$scope:{ctx:J}}}),{c(){l=h("meta"),c=i(),s=h("p"),m=i(),u=h("h1"),U=h("a"),X=h("span"),M(_.$$.fragment),W=i(),G=h("span"),G.textContent=V,I=i(),M(Z.$$.fragment),k=i(),M(x.$$.fragment),r=i(),T=h("p"),T.textContent=Y,E=i(),N=h("ul"),N.innerHTML=f,R=i(),S=h("p"),S.textContent=mt,ae=i(),A=h("ol"),A.innerHTML=we,D=i(),M(ee.$$.fragment),ne=i(),Q=h("p"),Q.textContent=ve,K=i(),M(te.$$.fragment),oe=i(),q=h("p"),q.textContent=Te,O=i(),M(se.$$.fragment),re=i(),F=h("h2"),L=h("a"),P=h("span"),M(le.$$.fragment),he=i(),o=h("span"),o.textContent=v,Ue=i(),_e=h("p"),_e.textContent=hs,$t=i(),M(ke.$$.fragment),jt=i(),Je=h("p"),Je.innerHTML=ds,wt=i(),M(Ce.$$.fragment),vt=i(),Ze=h("p"),Ze.textContent=fs,Tt=i(),M(xe.$$.fragment),Ut=i(),Ge=h("p"),Ge.textContent=us,_t=i(),Ve=h("ul"),Ve.innerHTML=ys,kt=i(),ie=h("h2"),de=h("a"),ht=h("span"),M(Re.$$.fragment),rs=i(),nt=h("span"),nt.textContent=Ms,Jt=i(),We=h("p"),We.innerHTML=bs,Ct=i(),M(Be.$$.fragment),Zt=i(),He=h("p"),He.textContent=gs,xt=i(),Xe=h("ol"),Xe.innerHTML=$s,Gt=i(),M(Ne.$$.fragment),Vt=i(),ze=h("p"),ze.innerHTML=js,Rt=i(),M(Ie.$$.fragment),Wt=i(),Se=h("p"),Se.innerHTML=ws,Bt=i(),M(fe.$$.fragment),Ht=i(),pe=h("h2"),ue=h("a"),dt=h("span"),M(Ee.$$.fragment),is=i(),ot=h("span"),ot.textContent=vs,Xt=i(),Fe=h("p"),Fe.innerHTML=Ts,Nt=i(),M(Ye.$$.fragment),zt=i(),Ae=h("p"),Ae.innerHTML=Us,It=i(),M(Qe.$$.fragment),St=i(),qe=h("p"),qe.innerHTML=_s,Et=i(),ce=h("h2"),ye=h("a"),ft=h("span"),M(Le.$$.fragment),ps=i(),rt=h("span"),rt.textContent=ks,Ft=i(),M(Me.$$.fragment),Yt=i(),M(be.$$.fragment),At=i(),me=h("h2"),ge=h("a"),ut=h("span"),M(Pe.$$.fragment),cs=i(),it=h("span"),it.textContent=Js,Qt=i(),De=h("p"),De.textContent=Cs,qt=i(),Ke=h("p"),Ke.textContent=Zs,Lt=i(),M(Oe.$$.fragment),Pt=i(),et=h("p"),et.innerHTML=xs,Dt=i(),M(tt.$$.fragment),Kt=i(),st=h("p"),st.innerHTML=Gs,Ot=i(),M($e.$$.fragment),es=i(),yt=h("p"),this.h()},l(e){const n=qs("svelte-1phssyn",document.head);l=d(n,"META",{name:!0,content:!0}),n.forEach(t),c=p(e),s=d(e,"P",{}),z(s).forEach(t),m=p(e),u=d(e,"H1",{class:!0});var lt=z(u);U=d(lt,"A",{id:!0,class:!0,href:!0});var Mt=z(U);X=d(Mt,"SPAN",{});var bt=z(X);b(_.$$.fragment,bt),bt.forEach(t),Mt.forEach(t),W=p(lt),G=d(lt,"SPAN",{"data-svelte-h":!0}),y(G)!=="svelte-9k3gek"&&(G.textContent=V),lt.forEach(t),I=p(e),b(Z.$$.fragment,e),k=p(e),b(x.$$.fragment,e),r=p(e),T=d(e,"P",{"data-svelte-h":!0}),y(T)!=="svelte-w23nc6"&&(T.textContent=Y),E=p(e),N=d(e,"UL",{"data-svelte-h":!0}),y(N)!=="svelte-ea3elv"&&(N.innerHTML=f),R=p(e),S=d(e,"P",{"data-svelte-h":!0}),y(S)!=="svelte-7oxnvp"&&(S.textContent=mt),ae=p(e),A=d(e,"OL",{"data-svelte-h":!0}),y(A)!=="svelte-106fbm1"&&(A.innerHTML=we),D=p(e),b(ee.$$.fragment,e),ne=p(e),Q=d(e,"P",{"data-svelte-h":!0}),y(Q)!=="svelte-1k0z9pm"&&(Q.textContent=ve),K=p(e),b(te.$$.fragment,e),oe=p(e),q=d(e,"P",{"data-svelte-h":!0}),y(q)!=="svelte-9xxxb4"&&(q.textContent=Te),O=p(e),b(se.$$.fragment,e),re=p(e),F=d(e,"H2",{class:!0});var at=z(F);L=d(at,"A",{id:!0,class:!0,href:!0});var gt=z(L);P=d(gt,"SPAN",{});var Vs=z(P);b(le.$$.fragment,Vs),Vs.forEach(t),gt.forEach(t),he=p(at),o=d(at,"SPAN",{"data-svelte-h":!0}),y(o)!=="svelte-vjanvs"&&(o.textContent=v),at.forEach(t),Ue=p(e),_e=d(e,"P",{"data-svelte-h":!0}),y(_e)!=="svelte-104pm3p"&&(_e.textContent=hs),$t=p(e),b(ke.$$.fragment,e),jt=p(e),Je=d(e,"P",{"data-svelte-h":!0}),y(Je)!=="svelte-kdn1eo"&&(Je.innerHTML=ds),wt=p(e),b(Ce.$$.fragment,e),vt=p(e),Ze=d(e,"P",{"data-svelte-h":!0}),y(Ze)!=="svelte-j8eln2"&&(Ze.textContent=fs),Tt=p(e),b(xe.$$.fragment,e),Ut=p(e),Ge=d(e,"P",{"data-svelte-h":!0}),y(Ge)!=="svelte-1l5f7ay"&&(Ge.textContent=us),_t=p(e),Ve=d(e,"UL",{"data-svelte-h":!0}),y(Ve)!=="svelte-11w9mbn"&&(Ve.innerHTML=ys),kt=p(e),ie=d(e,"H2",{class:!0});var ss=z(ie);de=d(ss,"A",{id:!0,class:!0,href:!0});var Rs=z(de);ht=d(Rs,"SPAN",{});var Ws=z(ht);b(Re.$$.fragment,Ws),Ws.forEach(t),Rs.forEach(t),rs=p(ss),nt=d(ss,"SPAN",{"data-svelte-h":!0}),y(nt)!=="svelte-1cte2wb"&&(nt.textContent=Ms),ss.forEach(t),Jt=p(e),We=d(e,"P",{"data-svelte-h":!0}),y(We)!=="svelte-fndar1"&&(We.innerHTML=bs),Ct=p(e),b(Be.$$.fragment,e),Zt=p(e),He=d(e,"P",{"data-svelte-h":!0}),y(He)!=="svelte-yu95e0"&&(He.textContent=gs),xt=p(e),Xe=d(e,"OL",{"data-svelte-h":!0}),y(Xe)!=="svelte-114jtp8"&&(Xe.innerHTML=$s),Gt=p(e),b(Ne.$$.fragment,e),Vt=p(e),ze=d(e,"P",{"data-svelte-h":!0}),y(ze)!=="svelte-19vpz1x"&&(ze.innerHTML=js),Rt=p(e),b(Ie.$$.fragment,e),Wt=p(e),Se=d(e,"P",{"data-svelte-h":!0}),y(Se)!=="svelte-1x4vtgp"&&(Se.innerHTML=ws),Bt=p(e),b(fe.$$.fragment,e),Ht=p(e),pe=d(e,"H2",{class:!0});var ls=z(pe);ue=d(ls,"A",{id:!0,class:!0,href:!0});var Bs=z(ue);dt=d(Bs,"SPAN",{});var Hs=z(dt);b(Ee.$$.fragment,Hs),Hs.forEach(t),Bs.forEach(t),is=p(ls),ot=d(ls,"SPAN",{"data-svelte-h":!0}),y(ot)!=="svelte-fd7xxy"&&(ot.textContent=vs),ls.forEach(t),Xt=p(e),Fe=d(e,"P",{"data-svelte-h":!0}),y(Fe)!=="svelte-1vagpvs"&&(Fe.innerHTML=Ts),Nt=p(e),b(Ye.$$.fragment,e),zt=p(e),Ae=d(e,"P",{"data-svelte-h":!0}),y(Ae)!=="svelte-u8z3ni"&&(Ae.innerHTML=Us),It=p(e),b(Qe.$$.fragment,e),St=p(e),qe=d(e,"P",{"data-svelte-h":!0}),y(qe)!=="svelte-bcxzuu"&&(qe.innerHTML=_s),Et=p(e),ce=d(e,"H2",{class:!0});var as=z(ce);ye=d(as,"A",{id:!0,class:!0,href:!0});var Xs=z(ye);ft=d(Xs,"SPAN",{});var Ns=z(ft);b(Le.$$.fragment,Ns),Ns.forEach(t),Xs.forEach(t),ps=p(as),rt=d(as,"SPAN",{"data-svelte-h":!0}),y(rt)!=="svelte-glxe6j"&&(rt.textContent=ks),as.forEach(t),Ft=p(e),b(Me.$$.fragment,e),Yt=p(e),b(be.$$.fragment,e),At=p(e),me=d(e,"H2",{class:!0});var ns=z(me);ge=d(ns,"A",{id:!0,class:!0,href:!0});var zs=z(ge);ut=d(zs,"SPAN",{});var Is=z(ut);b(Pe.$$.fragment,Is),Is.forEach(t),zs.forEach(t),cs=p(ns),it=d(ns,"SPAN",{"data-svelte-h":!0}),y(it)!=="svelte-8litrx"&&(it.textContent=Js),ns.forEach(t),Qt=p(e),De=d(e,"P",{"data-svelte-h":!0}),y(De)!=="svelte-1nv1rsn"&&(De.textContent=Cs),qt=p(e),Ke=d(e,"P",{"data-svelte-h":!0}),y(Ke)!=="svelte-7dupyj"&&(Ke.textContent=Zs),Lt=p(e),b(Oe.$$.fragment,e),Pt=p(e),et=d(e,"P",{"data-svelte-h":!0}),y(et)!=="svelte-42021r"&&(et.innerHTML=xs),Dt=p(e),b(tt.$$.fragment,e),Kt=p(e),st=d(e,"P",{"data-svelte-h":!0}),y(st)!=="svelte-15e1xc2"&&(st.innerHTML=Gs),Ot=p(e),b($e.$$.fragment,e),es=p(e),yt=d(e,"P",{}),z(yt).forEach(t),this.h()},h(){B(l,"name","hf:doc:metadata"),B(l,"content",JSON.stringify(fl)),B(U,"id","summarization"),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","#summarization"),B(u,"class","relative group"),B(L,"id","load-billsum-dataset"),B(L,"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(L,"href","#load-billsum-dataset"),B(F,"class","relative group"),B(de,"id","preprocess"),B(de,"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(de,"href","#preprocess"),B(ie,"class","relative group"),B(ue,"id","evaluate"),B(ue,"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(ue,"href","#evaluate"),B(pe,"class","relative group"),B(ye,"id","train"),B(ye,"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(ye,"href","#train"),B(ce,"class","relative group"),B(ge,"id","inference"),B(ge,"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(ge,"href","#inference"),B(me,"class","relative group")},m(e,n){H(document.head,l),a(e,c,n),a(e,s,n),a(e,m,n),a(e,u,n),H(u,U),H(U,X),g(_,X,null),H(u,W),H(u,G),a(e,I,n),g(Z,e,n),a(e,k,n),g(x,e,n),a(e,r,n),a(e,T,n),a(e,E,n),a(e,N,n),a(e,R,n),a(e,S,n),a(e,ae,n),a(e,A,n),a(e,D,n),g(ee,e,n),a(e,ne,n),a(e,Q,n),a(e,K,n),g(te,e,n),a(e,oe,n),a(e,q,n),a(e,O,n),g(se,e,n),a(e,re,n),a(e,F,n),H(F,L),H(L,P),g(le,P,null),H(F,he),H(F,o),a(e,Ue,n),a(e,_e,n),a(e,$t,n),g(ke,e,n),a(e,jt,n),a(e,Je,n),a(e,wt,n),g(Ce,e,n),a(e,vt,n),a(e,Ze,n),a(e,Tt,n),g(xe,e,n),a(e,Ut,n),a(e,Ge,n),a(e,_t,n),a(e,Ve,n),a(e,kt,n),a(e,ie,n),H(ie,de),H(de,ht),g(Re,ht,null),H(ie,rs),H(ie,nt),a(e,Jt,n),a(e,We,n),a(e,Ct,n),g(Be,e,n),a(e,Zt,n),a(e,He,n),a(e,xt,n),a(e,Xe,n),a(e,Gt,n),g(Ne,e,n),a(e,Vt,n),a(e,ze,n),a(e,Rt,n),g(Ie,e,n),a(e,Wt,n),a(e,Se,n),a(e,Bt,n),g(fe,e,n),a(e,Ht,n),a(e,pe,n),H(pe,ue),H(ue,dt),g(Ee,dt,null),H(pe,is),H(pe,ot),a(e,Xt,n),a(e,Fe,n),a(e,Nt,n),g(Ye,e,n),a(e,zt,n),a(e,Ae,n),a(e,It,n),g(Qe,e,n),a(e,St,n),a(e,qe,n),a(e,Et,n),a(e,ce,n),H(ce,ye),H(ye,ft),g(Le,ft,null),H(ce,ps),H(ce,rt),a(e,Ft,n),g(Me,e,n),a(e,Yt,n),g(be,e,n),a(e,At,n),a(e,me,n),H(me,ge),H(ge,ut),g(Pe,ut,null),H(me,cs),H(me,it),a(e,Qt,n),a(e,De,n),a(e,qt,n),a(e,Ke,n),a(e,Lt,n),g(Oe,e,n),a(e,Pt,n),a(e,et,n),a(e,Dt,n),g(tt,e,n),a(e,Kt,n),a(e,st,n),a(e,Ot,n),g($e,e,n),a(e,es,n),a(e,yt,n),ts=!0},p(e,[n]){const lt={};n&2&&(lt.$$scope={dirty:n,ctx:e}),ee.$set(lt);const Mt={};n&2&&(Mt.$$scope={dirty:n,ctx:e}),fe.$set(Mt);const bt={};n&2&&(bt.$$scope={dirty:n,ctx:e}),Me.$set(bt);const at={};n&2&&(at.$$scope={dirty:n,ctx:e}),be.$set(at);const gt={};n&2&&(gt.$$scope={dirty:n,ctx:e}),$e.$set(gt)},i(e){ts||($(_.$$.fragment,e),$(Z.$$.fragment,e),$(x.$$.fragment,e),$(ee.$$.fragment,e),$(te.$$.fragment,e),$(se.$$.fragment,e),$(le.$$.fragment,e),$(ke.$$.fragment,e),$(Ce.$$.fragment,e),$(xe.$$.fragment,e),$(Re.$$.fragment,e),$(Be.$$.fragment,e),$(Ne.$$.fragment,e),$(Ie.$$.fragment,e),$(fe.$$.fragment,e),$(Ee.$$.fragment,e),$(Ye.$$.fragment,e),$(Qe.$$.fragment,e),$(Le.$$.fragment,e),$(Me.$$.fragment,e),$(be.$$.fragment,e),$(Pe.$$.fragment,e),$(Oe.$$.fragment,e),$(tt.$$.fragment,e),$($e.$$.fragment,e),ts=!0)},o(e){j(_.$$.fragment,e),j(Z.$$.fragment,e),j(x.$$.fragment,e),j(ee.$$.fragment,e),j(te.$$.fragment,e),j(se.$$.fragment,e),j(le.$$.fragment,e),j(ke.$$.fragment,e),j(Ce.$$.fragment,e),j(xe.$$.fragment,e),j(Re.$$.fragment,e),j(Be.$$.fragment,e),j(Ne.$$.fragment,e),j(Ie.$$.fragment,e),j(fe.$$.fragment,e),j(Ee.$$.fragment,e),j(Ye.$$.fragment,e),j(Qe.$$.fragment,e),j(Le.$$.fragment,e),j(Me.$$.fragment,e),j(be.$$.fragment,e),j(Pe.$$.fragment,e),j(Oe.$$.fragment,e),j(tt.$$.fragment,e),j($e.$$.fragment,e),ts=!1},d(e){e&&(t(c),t(s),t(m),t(u),t(I),t(k),t(r),t(T),t(E),t(N),t(R),t(S),t(ae),t(A),t(D),t(ne),t(Q),t(K),t(oe),t(q),t(O),t(re),t(F),t(Ue),t(_e),t($t),t(jt),t(Je),t(wt),t(vt),t(Ze),t(Tt),t(Ut),t(Ge),t(_t),t(Ve),t(kt),t(ie),t(Jt),t(We),t(Ct),t(Zt),t(He),t(xt),t(Xe),t(Gt),t(Vt),t(ze),t(Rt),t(Wt),t(Se),t(Bt),t(Ht),t(pe),t(Xt),t(Fe),t(Nt),t(zt),t(Ae),t(It),t(St),t(qe),t(Et),t(ce),t(Ft),t(Yt),t(At),t(me),t(Qt),t(De),t(qt),t(Ke),t(Lt),t(Pt),t(et),t(Dt),t(Kt),t(st),t(Ot),t(es),t(yt)),t(l),w(_),w(Z,e),w(x,e),w(ee,e),w(te,e),w(se,e),w(le),w(ke,e),w(Ce,e),w(xe,e),w(Re),w(Be,e),w(Ne,e),w(Ie,e),w(fe,e),w(Ee),w(Ye,e),w(Qe,e),w(Le),w(Me,e),w(be,e),w(Pe),w(Oe,e),w(tt,e),w($e,e)}}}const fl={local:"summarization",sections:[{local:"load-billsum-dataset",title:"BillSum 데이터셋 가져오기"},{local:"preprocess",title:"전처리"},{local:"evaluate",title:"평가"},{local:"train",title:"학습"},{local:"inference",title:"추론"}],title:"요약"};function ul(J){return Ys(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Tl extends As{constructor(l){super(),Qs(this,l,ul,dl,Fs,{})}}export{Tl as component};
