import{s as At,o as Lt,n as pe}from"../chunks/scheduler.56730f09.js";import{S as Pt,i as Dt,g as $,s as i,r as f,A as Kt,h as j,f as l,c as p,j as Et,u as d,x as T,k as Yt,y as Ot,a,v as u,d as y,t as M,w as b,m as Qt,n as qt}from"../chunks/index.1f144517.js";import{T as Tt}from"../chunks/Tip.41e845e5.js";import{Y as es}from"../chunks/Youtube.62e0f062.js";import{C}from"../chunks/CodeBlock.738eeccb.js";import{D as ts}from"../chunks/DocNotebookDropdown.b2e82107.js";import{F as Ut,M as Fe}from"../chunks/Markdown.c541024b.js";import{H as Ne}from"../chunks/Heading.57d46534.js";function ss(k){let s,c,t='<a href="../model_doc/bart">BART</a>, <a href="../model_doc/bigbird_pegasus">BigBird-Pegasus</a>, <a href="../model_doc/blenderbot">Blenderbot</a>, <a href="../model_doc/blenderbot-small">BlenderbotSmall</a>, <a href="../model_doc/encoder-decoder">Encoder decoder</a>, <a href="../model_doc/fsmt">FairSeq Machine-Translation</a>, <a href="../model_doc/gptsan-japanese">GPTSAN-japanese</a>, <a href="../model_doc/led">LED</a>, <a href="../model_doc/longt5">LongT5</a>, <a href="../model_doc/m2m_100">M2M100</a>, <a href="../model_doc/marian">Marian</a>, <a href="../model_doc/mbart">mBART</a>, <a href="../model_doc/mt5">MT5</a>, <a href="../model_doc/mvp">MVP</a>, <a href="../model_doc/nllb">NLLB</a>, <a href="../model_doc/nllb-moe">NLLB-MOE</a>, <a href="../model_doc/pegasus">Pegasus</a>, <a href="../model_doc/pegasus_x">PEGASUS-X</a>, <a href="../model_doc/plbart">PLBart</a>, <a href="../model_doc/prophetnet">ProphetNet</a>, <a href="../model_doc/switch_transformers">SwitchTransformers</a>, <a href="../model_doc/t5">T5</a>, <a href="../model_doc/xlm-prophetnet">XLM-ProphetNet</a>';return{c(){s=Qt(`이 튜토리얼에서 설명하는 작업은 다음 모델 아키텍처에서 지원됩니다:

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

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

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

<span class="hljs-meta">&gt;&gt;&gt; </span>data_collator = DataCollatorForSeq2Seq(tokenizer=tokenizer, model=checkpoint, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)`,wrap:!1}}),{c(){f(s.$$.fragment)},l(t){d(s.$$.fragment,t)},m(t,m){u(s,t,m),c=!0},p:pe,i(t){c||(y(s.$$.fragment,t),c=!0)},o(t){M(s.$$.fragment,t),c=!1},d(t){b(s,t)}}}function os(k){let s,c;return s=new Fe({props:{$$slots:{default:[ns]},$$scope:{ctx:k}}}),{c(){f(s.$$.fragment)},l(t){d(s.$$.fragment,t)},m(t,m){u(s,t,m),c=!0},p(t,m){const g={};m&2&&(g.$$scope={dirty:m,ctx:t}),s.$set(g)},i(t){c||(y(s.$$.fragment,t),c=!0)},o(t){M(s.$$.fragment,t),c=!1},d(t){b(s,t)}}}function rs(k){let s,c='모델을 <code>Trainer</code>로 파인튜닝 하는 것이 익숙하지 않다면, <a href="../training#train-with-pytorch-trainer">여기</a>에서 기본 튜토리얼을 확인해보세요!';return{c(){s=$("p"),s.innerHTML=c},l(t){s=j(t,"P",{"data-svelte-h":!0}),T(s)!=="svelte-1v8fl5q"&&(s.innerHTML=c)},m(t,m){a(t,s,m)},p:pe,d(t){t&&l(s)}}}function is(k){let s,c,t,m="이제 모델 학습을 시작할 준비가 되었습니다! <code>AutoModelForSeq2SeqLM</code>로 T5를 가져오세요:",g,v,B,G,Z="이제 세 단계만 남았습니다:",V,J,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>`,R,_,W,r,U="학습이 완료되면, 누구나 모델을 사용할 수 있도록 <code>push_to_hub()</code> 메소드로 Hub에 공유합니다:",N,z,X;return s=new Tt({props:{$$slots:{default:[rs]},$$scope:{ctx:k}}}),v=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvclNlcTJTZXFMTSUyQyUyMFNlcTJTZXFUcmFpbmluZ0FyZ3VtZW50cyUyQyUyMFNlcTJTZXFUcmFpbmVyJTBBJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JTZXEyU2VxTE0uZnJvbV9wcmV0cmFpbmVkKGNoZWNrcG9pbnQp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForSeq2SeqLM, Seq2SeqTrainingArguments, Seq2SeqTrainer

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

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

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

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

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

	`),f(t.$$.fragment),m=i(),g=$("p"),g.innerHTML=v,B=i(),f(G.$$.fragment),Z=i(),V=$("p"),V.innerHTML=J,I=i(),f(R.$$.fragment),_=i(),W=$("p"),W.innerHTML=r,U=i(),f(N.$$.fragment),z=i(),X=$("p"),X.innerHTML=h,x=i(),H=$("p"),H.innerHTML=ce,E=i(),f(O.$$.fragment),le=i(),F=$("p"),F.innerHTML=me,Y=i(),f(ee.$$.fragment),ae=i(),S=$("p"),S.textContent=he,Q=i(),f(q.$$.fragment),A=i(),te=$("p"),te.innerHTML=fe,L=i(),f(P.$$.fragment),D=i(),se=$("p"),se.textContent=de},l(o){d(s.$$.fragment,o),c=qt(o,`
TensorFlow에서 모델을 파인튜닝하려면, 먼저 옵티마이저, 학습률 스케줄 그리고 몇 가지 학습 하이퍼파라미터를 설정하세요:

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

<span class="hljs-meta">&gt;&gt;&gt; </span>notebook_login()`,wrap:!1}}),Q=new Ne({props:{title:"BillSum 데이터셋 가져오기",local:"load-billsum-dataset",headingTag:"h2"}}),L=new C({props:{code:"ZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBJTBBYmlsbHN1bSUyMCUzRCUyMGxvYWRfZGF0YXNldCglMjJiaWxsc3VtJTIyJTJDJTIwc3BsaXQlM0QlMjJjYV90ZXN0JTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset

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

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


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

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

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

<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> {k: <span class="hljs-built_in">round</span>(v, <span class="hljs-number">4</span>) <span class="hljs-keyword">for</span> k, v <span class="hljs-keyword">in</span> result.items()}`,wrap:!1}}),Ve=new Ne({props:{title:"학습",local:"train",headingTag:"h2"}}),oe=new Ut({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[hs],pytorch:[ps]},$$scope:{ctx:k}}}),re=new Tt({props:{$$slots:{default:[fs]},$$scope:{ctx:k}}}),Re=new Ne({props:{title:"추론",local:"inference",headingTag:"h2"}}),Xe=new C({props:{code:"dGV4dCUyMCUzRCUyMCUyMnN1bW1hcml6ZSUzQSUyMFRoZSUyMEluZmxhdGlvbiUyMFJlZHVjdGlvbiUyMEFjdCUyMGxvd2VycyUyMHByZXNjcmlwdGlvbiUyMGRydWclMjBjb3N0cyUyQyUyMGhlYWx0aCUyMGNhcmUlMjBjb3N0cyUyQyUyMGFuZCUyMGVuZXJneSUyMGNvc3RzLiUyMEl0J3MlMjB0aGUlMjBtb3N0JTIwYWdncmVzc2l2ZSUyMGFjdGlvbiUyMG9uJTIwdGFja2xpbmclMjB0aGUlMjBjbGltYXRlJTIwY3Jpc2lzJTIwaW4lMjBBbWVyaWNhbiUyMGhpc3RvcnklMkMlMjB3aGljaCUyMHdpbGwlMjBsaWZ0JTIwdXAlMjBBbWVyaWNhbiUyMHdvcmtlcnMlMjBhbmQlMjBjcmVhdGUlMjBnb29kLXBheWluZyUyQyUyMHVuaW9uJTIwam9icyUyMGFjcm9zcyUyMHRoZSUyMGNvdW50cnkuJTIwSXQnbGwlMjBsb3dlciUyMHRoZSUyMGRlZmljaXQlMjBhbmQlMjBhc2slMjB0aGUlMjB1bHRyYS13ZWFsdGh5JTIwYW5kJTIwY29ycG9yYXRpb25zJTIwdG8lMjBwYXklMjB0aGVpciUyMGZhaXIlMjBzaGFyZS4lMjBBbmQlMjBubyUyMG9uZSUyMG1ha2luZyUyMHVuZGVyJTIwJTI0NDAwJTJDMDAwJTIwcGVyJTIweWVhciUyMHdpbGwlMjBwYXklMjBhJTIwcGVubnklMjBtb3JlJTIwaW4lMjB0YXhlcy4lMjI=",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>text = <span class="hljs-string">&quot;summarize: The Inflation Reduction Act lowers prescription drug costs, health care costs, and energy costs. It&#x27;s the most aggressive action on tackling the climate crisis in American history, which will lift up American workers and create good-paying, union jobs across the country. It&#x27;ll lower the deficit and ask the ultra-wealthy and corporations to pay their fair share. And no one making under $400,000 per year will pay a penny more in taxes.&quot;</span>',wrap:!1}}),ze=new C({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBc3VtbWFyaXplciUyMCUzRCUyMHBpcGVsaW5lKCUyMnN1bW1hcml6YXRpb24lMjIlMkMlMjBtb2RlbCUzRCUyMnN0ZXZobGl1JTJGbXlfYXdlc29tZV9iaWxsc3VtX21vZGVsJTIyKSUwQXN1bW1hcml6ZXIodGV4dCk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

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