import{s as Es,o as Fs,n as we}from"../chunks/scheduler.56730f09.js";import{S as zs,i as Ss,g as f,s as o,u,A as Ys,h,f as t,c,j as N,v as y,y as j,k as W,o as G,a,w as $,d as b,t as g,x as w,m as Is,n as Ns}from"../chunks/index.ba464511.js";import{T as as}from"../chunks/Tip.70442610.js";import{Y as Hs}from"../chunks/Youtube.7b20230c.js";import{I as nt}from"../chunks/IconCopyLink.89bde88e.js";import{C as Z}from"../chunks/CodeBlock.2302fd0d.js";import{D as Qs}from"../chunks/DocNotebookDropdown.68fd8653.js";import{F as cs,M as pt}from"../chunks/Markdown.6303afae.js";function As(v){let l,m,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=Is(`이 태스크 가이드는 아래 모델 아키텍처에도 응용할 수 있습니다.

`),m=f("p"),m.innerHTML=s},l(i){l=Ns(i,`이 태스크 가이드는 아래 모델 아키텍처에도 응용할 수 있습니다.

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

<span class="hljs-meta">&gt;&gt;&gt; </span>data_collator = DataCollatorForSeq2Seq(tokenizer=tokenizer, model=checkpoint)`,wrap:!1}}),{c(){u(l.$$.fragment)},l(s){y(l.$$.fragment,s)},m(s,i){$(l,s,i),m=!0},p:we,i(s){m||(b(l.$$.fragment,s),m=!0)},o(s){g(l.$$.fragment,s),m=!1},d(s){w(l,s)}}}function Ls(v){let l,m;return l=new pt({props:{$$slots:{default:[qs]},$$scope:{ctx:v}}}),{c(){u(l.$$.fragment)},l(s){y(l.$$.fragment,s)},m(s,i){$(l,s,i),m=!0},p(s,i){const d={};i&2&&(d.$$scope={dirty:i,ctx:s}),l.$set(d)},i(s){m||(b(l.$$.fragment,s),m=!0)},o(s){g(l.$$.fragment,s),m=!1},d(s){w(l,s)}}}function Ps(v){let l,m;return l=new Z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERhdGFDb2xsYXRvckZvclNlcTJTZXElMEElMEFkYXRhX2NvbGxhdG9yJTIwJTNEJTIwRGF0YUNvbGxhdG9yRm9yU2VxMlNlcSh0b2tlbml6ZXIlM0R0b2tlbml6ZXIlMkMlMjBtb2RlbCUzRGNoZWNrcG9pbnQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnRmJTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DataCollatorForSeq2Seq

<span class="hljs-meta">&gt;&gt;&gt; </span>data_collator = DataCollatorForSeq2Seq(tokenizer=tokenizer, model=checkpoint, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)`,wrap:!1}}),{c(){u(l.$$.fragment)},l(s){y(l.$$.fragment,s)},m(s,i){$(l,s,i),m=!0},p:we,i(s){m||(b(l.$$.fragment,s),m=!0)},o(s){g(l.$$.fragment,s),m=!1},d(s){w(l,s)}}}function Ds(v){let l,m;return l=new pt({props:{$$slots:{default:[Ps]},$$scope:{ctx:v}}}),{c(){u(l.$$.fragment)},l(s){y(l.$$.fragment,s)},m(s,i){$(l,s,i),m=!0},p(s,i){const d={};i&2&&(d.$$scope={dirty:i,ctx:s}),l.$set(d)},i(s){m||(b(l.$$.fragment,s),m=!0)},o(s){g(l.$$.fragment,s),m=!1},d(s){w(l,s)}}}function Ks(v){let l,m='<code>Trainer</code>로 모델을 파인튜닝하는 방법에 익숙하지 않다면 <a href="../training#train-with-pytorch-trainer">여기</a>에서 기본 튜토리얼을 살펴보시기 바랍니다!';return{c(){l=f("p"),l.innerHTML=m},l(s){l=h(s,"P",{"data-svelte-h":!0}),j(l)!=="svelte-1ba0r5n"&&(l.innerHTML=m)},m(s,i){a(s,l,i)},p:we,d(s){s&&t(l)}}}function Os(v){let l,m,s,i="모델을 훈련시킬 준비가 되었군요! <code>AutoModelForSeq2SeqLM</code>으로 T5를 로드하세요:",d,U,H,_,V="이제 세 단계만 거치면 끝입니다:",R,X,E="<li><code>Seq2SeqTrainingArguments</code>에서 훈련 하이퍼파라미터를 정의하세요. 유일한 필수 매개변수는 모델을 저장할 위치인 <code>output_dir</code>입니다. 모델을 Hub에 푸시하기 위해 <code>push_to_hub=True</code>로 설정하세요. (모델을 업로드하려면 Hugging Face에 로그인해야 합니다.) <code>Trainer</code>는 에폭이 끝날때마다 SacreBLEU 메트릭을 평가하고 훈련 체크포인트를 저장합니다.</li> <li><code>Seq2SeqTrainer</code>에 훈련 인수를 전달하세요. 모델, 데이터 세트, 토크나이저, data collator 및 <code>compute_metrics</code> 함수도 덩달아 전달해야 합니다.</li> <li><code>train()</code>을 호출하여 모델을 파인튜닝하세요.</li>",C,k,x,r,J="학습이 완료되면 <code>push_to_hub()</code> 메서드로 모델을 Hub에 공유하세요. 이러면 누구나 모델을 사용할 수 있게 됩니다:",Q,z,I;return l=new as({props:{$$slots:{default:[Ks]},$$scope:{ctx:v}}}),U=new Z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvclNlcTJTZXFMTSUyQyUyMFNlcTJTZXFUcmFpbmluZ0FyZ3VtZW50cyUyQyUyMFNlcTJTZXFUcmFpbmVyJTBBJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JTZXEyU2VxTE0uZnJvbV9wcmV0cmFpbmVkKGNoZWNrcG9pbnQp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForSeq2SeqLM, Seq2SeqTrainingArguments, Seq2SeqTrainer

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForSeq2SeqLM.from_pretrained(checkpoint)`,wrap:!1}}),k=new Z({props:{code:"dHJhaW5pbmdfYXJncyUyMCUzRCUyMFNlcTJTZXFUcmFpbmluZ0FyZ3VtZW50cyglMEElMjAlMjAlMjAlMjBvdXRwdXRfZGlyJTNEJTIybXlfYXdlc29tZV9vcHVzX2Jvb2tzX21vZGVsJTIyJTJDJTBBJTIwJTIwJTIwJTIwZXZhbHVhdGlvbl9zdHJhdGVneSUzRCUyMmVwb2NoJTIyJTJDJTBBJTIwJTIwJTIwJTIwbGVhcm5pbmdfcmF0ZSUzRDJlLTUlMkMlMEElMjAlMjAlMjAlMjBwZXJfZGV2aWNlX3RyYWluX2JhdGNoX3NpemUlM0QxNiUyQyUwQSUyMCUyMCUyMCUyMHBlcl9kZXZpY2VfZXZhbF9iYXRjaF9zaXplJTNEMTYlMkMlMEElMjAlMjAlMjAlMjB3ZWlnaHRfZGVjYXklM0QwLjAxJTJDJTBBJTIwJTIwJTIwJTIwc2F2ZV90b3RhbF9saW1pdCUzRDMlMkMlMEElMjAlMjAlMjAlMjBudW1fdHJhaW5fZXBvY2hzJTNEMiUyQyUwQSUyMCUyMCUyMCUyMHByZWRpY3Rfd2l0aF9nZW5lcmF0ZSUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjBmcDE2JTNEVHJ1ZSUyQyUwQSUyMCUyMCUyMCUyMHB1c2hfdG9faHViJTNEVHJ1ZSUyQyUwQSklMEElMEF0cmFpbmVyJTIwJTNEJTIwU2VxMlNlcVRyYWluZXIoJTBBJTIwJTIwJTIwJTIwbW9kZWwlM0Rtb2RlbCUyQyUwQSUyMCUyMCUyMCUyMGFyZ3MlM0R0cmFpbmluZ19hcmdzJTJDJTBBJTIwJTIwJTIwJTIwdHJhaW5fZGF0YXNldCUzRHRva2VuaXplZF9ib29rcyU1QiUyMnRyYWluJTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwZXZhbF9kYXRhc2V0JTNEdG9rZW5pemVkX2Jvb2tzJTVCJTIydGVzdCUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMHRva2VuaXplciUzRHRva2VuaXplciUyQyUwQSUyMCUyMCUyMCUyMGRhdGFfY29sbGF0b3IlM0RkYXRhX2NvbGxhdG9yJTJDJTBBJTIwJTIwJTIwJTIwY29tcHV0ZV9tZXRyaWNzJTNEY29tcHV0ZV9tZXRyaWNzJTJDJTBBKSUwQSUwQXRyYWluZXIudHJhaW4oKQ==",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_opus_books_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">2</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_books[<span class="hljs-string">&quot;train&quot;</span>],
<span class="hljs-meta">... </span>    eval_dataset=tokenized_books[<span class="hljs-string">&quot;test&quot;</span>],
<span class="hljs-meta">... </span>    tokenizer=tokenizer,
<span class="hljs-meta">... </span>    data_collator=data_collator,
<span class="hljs-meta">... </span>    compute_metrics=compute_metrics,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.train()`,wrap:!1}}),z=new Z({props:{code:"dHJhaW5lci5wdXNoX3RvX2h1Yigp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.push_to_hub()',wrap:!1}}),{c(){u(l.$$.fragment),m=o(),s=f("p"),s.innerHTML=i,d=o(),u(U.$$.fragment),H=o(),_=f("p"),_.textContent=V,R=o(),X=f("ol"),X.innerHTML=E,C=o(),u(k.$$.fragment),x=o(),r=f("p"),r.innerHTML=J,Q=o(),u(z.$$.fragment)},l(M){y(l.$$.fragment,M),m=c(M),s=h(M,"P",{"data-svelte-h":!0}),j(s)!=="svelte-4h5y1d"&&(s.innerHTML=i),d=c(M),y(U.$$.fragment,M),H=c(M),_=h(M,"P",{"data-svelte-h":!0}),j(_)!=="svelte-14zzcxs"&&(_.textContent=V),R=c(M),X=h(M,"OL",{"data-svelte-h":!0}),j(X)!=="svelte-df1avs"&&(X.innerHTML=E),C=c(M),y(k.$$.fragment,M),x=c(M),r=h(M,"P",{"data-svelte-h":!0}),j(r)!=="svelte-y88jp6"&&(r.innerHTML=J),Q=c(M),y(z.$$.fragment,M)},m(M,B){$(l,M,B),a(M,m,B),a(M,s,B),a(M,d,B),$(U,M,B),a(M,H,B),a(M,_,B),a(M,R,B),a(M,X,B),a(M,C,B),$(k,M,B),a(M,x,B),a(M,r,B),a(M,Q,B),$(z,M,B),I=!0},p(M,B){const F={};B&2&&(F.$$scope={dirty:B,ctx:M}),l.$set(F)},i(M){I||(b(l.$$.fragment,M),b(U.$$.fragment,M),b(k.$$.fragment,M),b(z.$$.fragment,M),I=!0)},o(M){g(l.$$.fragment,M),g(U.$$.fragment,M),g(k.$$.fragment,M),g(z.$$.fragment,M),I=!1},d(M){M&&(t(m),t(s),t(d),t(H),t(_),t(R),t(X),t(C),t(x),t(r),t(Q)),w(l,M),w(U,M),w(k,M),w(z,M)}}}function el(v){let l,m;return l=new pt({props:{$$slots:{default:[Os]},$$scope:{ctx:v}}}),{c(){u(l.$$.fragment)},l(s){y(l.$$.fragment,s)},m(s,i){$(l,s,i),m=!0},p(s,i){const d={};i&2&&(d.$$scope={dirty:i,ctx:s}),l.$set(d)},i(s){m||(b(l.$$.fragment,s),m=!0)},o(s){g(l.$$.fragment,s),m=!1},d(s){w(l,s)}}}function tl(v){let l,m='Keras로 모델을 파인튜닝하는 방법이 익숙하지 않다면, <a href="../training#train-a-tensorflow-model-with-keras">여기</a>에서 기본 튜토리얼을 살펴보시기 바랍니다!';return{c(){l=f("p"),l.innerHTML=m},l(s){l=h(s,"P",{"data-svelte-h":!0}),j(l)!=="svelte-5a866m"&&(l.innerHTML=m)},m(s,i){a(s,l,i)},p:we,d(s){s&&t(l)}}}function sl(v){let l,m,s,i,d,U="이제 <code>TFAutoModelForSeq2SeqLM</code>로 T5를 가져오세요:",H,_,V,R,X="<code>prepare_tf_dataset()</code>로 데이터 세트를 <code>tf.data.Dataset</code> 형식으로 변환하세요:",E,C,k,x,r='훈련하기 위해 <a href="https://keras.io/api/models/model_training_apis/#compile-method" rel="nofollow"><code>compile</code></a> 메서드로 모델을 구성하세요:',J,Q,z,I,M='훈련을 시작하기 전에 예측값으로부터 SacreBLEU 메트릭을 계산하는 방법과 모델을 Hub에 업로드하는 방법 두 가지를 미리 설정해둬야 합니다. 둘 다 <a href="../main_classes/keras_callbacks">Keras callbacks</a>로 구현하세요.',B,F,rt="<code>KerasMetricCallback</code>에 <code>compute_metrics</code> 함수를 전달하세요.",te,Y,se,A,ot="모델과 토크나이저를 업로드할 위치를 <code>PushToHubCallback</code>에서 지정하세요:",le,q,ae,L,ct="이제 콜백들을 한데로 묶어주세요:",ne,P,pe,S,O='드디어 모델을 훈련시킬 모든 준비를 마쳤군요! 이제 훈련 및 검증 데이터 세트에 <a href="https://keras.io/api/models/model_training_apis/#fit-method" rel="nofollow"><code>fit</code></a> 메서드를 에폭 수와 만들어둔 콜백과 함께 호출하여 모델을 파인튜닝하세요:',ee,D,fe,K,mt="학습이 완료되면 모델이 자동으로 Hub에 업로드되고, 누구나 사용할 수 있게 됩니다!",re;return l=new as({props:{$$slots:{default:[tl]},$$scope:{ctx:v}}}),s=new Z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEFkYW1XZWlnaHREZWNheSUwQSUwQW9wdGltaXplciUyMCUzRCUyMEFkYW1XZWlnaHREZWNheShsZWFybmluZ19yYXRlJTNEMmUtNSUyQyUyMHdlaWdodF9kZWNheV9yYXRlJTNEMC4wMSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> 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}}),_=new Z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGQXV0b01vZGVsRm9yU2VxMlNlcUxNJTBBJTBBbW9kZWwlMjAlM0QlMjBURkF1dG9Nb2RlbEZvclNlcTJTZXFMTS5mcm9tX3ByZXRyYWluZWQoY2hlY2twb2ludCk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFAutoModelForSeq2SeqLM

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFAutoModelForSeq2SeqLM.from_pretrained(checkpoint)`,wrap:!1}}),C=new Z({props:{code:"dGZfdHJhaW5fc2V0JTIwJTNEJTIwbW9kZWwucHJlcGFyZV90Zl9kYXRhc2V0KCUwQSUyMCUyMCUyMCUyMHRva2VuaXplZF9ib29rcyU1QiUyMnRyYWluJTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwc2h1ZmZsZSUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjBiYXRjaF9zaXplJTNEMTYlMkMlMEElMjAlMjAlMjAlMjBjb2xsYXRlX2ZuJTNEZGF0YV9jb2xsYXRvciUyQyUwQSklMEElMEF0Zl90ZXN0X3NldCUyMCUzRCUyMG1vZGVsLnByZXBhcmVfdGZfZGF0YXNldCglMEElMjAlMjAlMjAlMjB0b2tlbml6ZWRfYm9va3MlNUIlMjJ0ZXN0JTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwc2h1ZmZsZSUzREZhbHNlJTJDJTBBJTIwJTIwJTIwJTIwYmF0Y2hfc2l6ZSUzRDE2JTJDJTBBJTIwJTIwJTIwJTIwY29sbGF0ZV9mbiUzRGRhdGFfY29sbGF0b3IlMkMlMEEp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>tf_train_set = model.prepare_tf_dataset(
<span class="hljs-meta">... </span>    tokenized_books[<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_books[<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}}),Q=new Z({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}}),Y=new Z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycy5rZXJhc19jYWxsYmFja3MlMjBpbXBvcnQlMjBLZXJhc01ldHJpY0NhbGxiYWNrJTBBJTBBbWV0cmljX2NhbGxiYWNrJTIwJTNEJTIwS2VyYXNNZXRyaWNDYWxsYmFjayhtZXRyaWNfZm4lM0Rjb21wdXRlX21ldHJpY3MlMkMlMjBldmFsX2RhdGFzZXQlM0R0Zl92YWxpZGF0aW9uX3NldCk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers.keras_callbacks <span class="hljs-keyword">import</span> KerasMetricCallback

<span class="hljs-meta">&gt;&gt;&gt; </span>metric_callback = KerasMetricCallback(metric_fn=compute_metrics, eval_dataset=tf_validation_set)`,wrap:!1}}),q=new Z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycy5rZXJhc19jYWxsYmFja3MlMjBpbXBvcnQlMjBQdXNoVG9IdWJDYWxsYmFjayUwQSUwQXB1c2hfdG9faHViX2NhbGxiYWNrJTIwJTNEJTIwUHVzaFRvSHViQ2FsbGJhY2soJTBBJTIwJTIwJTIwJTIwb3V0cHV0X2RpciUzRCUyMm15X2F3ZXNvbWVfb3B1c19ib29rc19tb2RlbCUyMiUyQyUwQSUyMCUyMCUyMCUyMHRva2VuaXplciUzRHRva2VuaXplciUyQyUwQSk=",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_opus_books_model&quot;</span>,
<span class="hljs-meta">... </span>    tokenizer=tokenizer,
<span class="hljs-meta">... </span>)`,wrap:!1}}),P=new Z({props:{code:"Y2FsbGJhY2tzJTIwJTNEJTIwJTVCbWV0cmljX2NhbGxiYWNrJTJDJTIwcHVzaF90b19odWJfY2FsbGJhY2slNUQ=",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>callbacks = [metric_callback, push_to_hub_callback]',wrap:!1}}),D=new Z({props:{code:"bW9kZWwuZml0KHglM0R0Zl90cmFpbl9zZXQlMkMlMjB2YWxpZGF0aW9uX2RhdGElM0R0Zl90ZXN0X3NldCUyQyUyMGVwb2NocyUzRDMlMkMlMjBjYWxsYmFja3MlM0RjYWxsYmFja3Mp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>model.fit(x=tf_train_set, validation_data=tf_test_set, epochs=<span class="hljs-number">3</span>, callbacks=callbacks)',wrap:!1}}),{c(){u(l.$$.fragment),m=Is(`
TensorFlow에서 모델을 파인튜닝하려면 우선 optimizer 함수, 학습률 스케줄 등의 훈련 하이퍼파라미터를 설정하세요:

	`),u(s.$$.fragment),i=o(),d=f("p"),d.innerHTML=U,H=o(),u(_.$$.fragment),V=o(),R=f("p"),R.innerHTML=X,E=o(),u(C.$$.fragment),k=o(),x=f("p"),x.innerHTML=r,J=o(),u(Q.$$.fragment),z=o(),I=f("p"),I.innerHTML=M,B=o(),F=f("p"),F.innerHTML=rt,te=o(),u(Y.$$.fragment),se=o(),A=f("p"),A.innerHTML=ot,le=o(),u(q.$$.fragment),ae=o(),L=f("p"),L.textContent=ct,ne=o(),u(P.$$.fragment),pe=o(),S=f("p"),S.innerHTML=O,ee=o(),u(D.$$.fragment),fe=o(),K=f("p"),K.textContent=mt},l(n){y(l.$$.fragment,n),m=Ns(n,`
TensorFlow에서 모델을 파인튜닝하려면 우선 optimizer 함수, 학습률 스케줄 등의 훈련 하이퍼파라미터를 설정하세요:

	`),y(s.$$.fragment,n),i=c(n),d=h(n,"P",{"data-svelte-h":!0}),j(d)!=="svelte-187gdfo"&&(d.innerHTML=U),H=c(n),y(_.$$.fragment,n),V=c(n),R=h(n,"P",{"data-svelte-h":!0}),j(R)!=="svelte-bc4nau"&&(R.innerHTML=X),E=c(n),y(C.$$.fragment,n),k=c(n),x=h(n,"P",{"data-svelte-h":!0}),j(x)!=="svelte-lcjrv5"&&(x.innerHTML=r),J=c(n),y(Q.$$.fragment,n),z=c(n),I=h(n,"P",{"data-svelte-h":!0}),j(I)!=="svelte-1r18s5x"&&(I.innerHTML=M),B=c(n),F=h(n,"P",{"data-svelte-h":!0}),j(F)!=="svelte-1g3zl6s"&&(F.innerHTML=rt),te=c(n),y(Y.$$.fragment,n),se=c(n),A=h(n,"P",{"data-svelte-h":!0}),j(A)!=="svelte-1b0ip2a"&&(A.innerHTML=ot),le=c(n),y(q.$$.fragment,n),ae=c(n),L=h(n,"P",{"data-svelte-h":!0}),j(L)!=="svelte-1hl7vtj"&&(L.textContent=ct),ne=c(n),y(P.$$.fragment,n),pe=c(n),S=h(n,"P",{"data-svelte-h":!0}),j(S)!=="svelte-13m2vb0"&&(S.innerHTML=O),ee=c(n),y(D.$$.fragment,n),fe=c(n),K=h(n,"P",{"data-svelte-h":!0}),j(K)!=="svelte-w4puhc"&&(K.textContent=mt)},m(n,T){$(l,n,T),a(n,m,T),$(s,n,T),a(n,i,T),a(n,d,T),a(n,H,T),$(_,n,T),a(n,V,T),a(n,R,T),a(n,E,T),$(C,n,T),a(n,k,T),a(n,x,T),a(n,J,T),$(Q,n,T),a(n,z,T),a(n,I,T),a(n,B,T),a(n,F,T),a(n,te,T),$(Y,n,T),a(n,se,T),a(n,A,T),a(n,le,T),$(q,n,T),a(n,ae,T),a(n,L,T),a(n,ne,T),$(P,n,T),a(n,pe,T),a(n,S,T),a(n,ee,T),$(D,n,T),a(n,fe,T),a(n,K,T),re=!0},p(n,T){const je={};T&2&&(je.$$scope={dirty:T,ctx:n}),l.$set(je)},i(n){re||(b(l.$$.fragment,n),b(s.$$.fragment,n),b(_.$$.fragment,n),b(C.$$.fragment,n),b(Q.$$.fragment,n),b(Y.$$.fragment,n),b(q.$$.fragment,n),b(P.$$.fragment,n),b(D.$$.fragment,n),re=!0)},o(n){g(l.$$.fragment,n),g(s.$$.fragment,n),g(_.$$.fragment,n),g(C.$$.fragment,n),g(Q.$$.fragment,n),g(Y.$$.fragment,n),g(q.$$.fragment,n),g(P.$$.fragment,n),g(D.$$.fragment,n),re=!1},d(n){n&&(t(m),t(i),t(d),t(H),t(V),t(R),t(E),t(k),t(x),t(J),t(z),t(I),t(B),t(F),t(te),t(se),t(A),t(le),t(ae),t(L),t(ne),t(pe),t(S),t(ee),t(fe),t(K)),w(l,n),w(s,n),w(_,n),w(C,n),w(Q,n),w(Y,n),w(q,n),w(P,n),w(D,n)}}}function ll(v){let l,m;return l=new pt({props:{$$slots:{default:[sl]},$$scope:{ctx:v}}}),{c(){u(l.$$.fragment)},l(s){y(l.$$.fragment,s)},m(s,i){$(l,s,i),m=!0},p(s,i){const d={};i&2&&(d.$$scope={dirty:i,ctx:s}),l.$set(d)},i(s){m||(b(l.$$.fragment,s),m=!0)},o(s){g(l.$$.fragment,s),m=!1},d(s){w(l,s)}}}function al(v){let l,m='번역을 위해 모델을 파인튜닝하는 방법에 대한 보다 자세한 예제는 해당 <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/translation.ipynb" rel="nofollow">PyTorch 노트북</a> 또는 <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/translation-tf.ipynb" rel="nofollow">TensorFlow 노트북</a>을 참조하세요.';return{c(){l=f("p"),l.innerHTML=m},l(s){l=h(s,"P",{"data-svelte-h":!0}),j(l)!=="svelte-ar4lcc"&&(l.innerHTML=m)},m(s,i){a(s,l,i)},p:we,d(s){s&&t(l)}}}function nl(v){let l,m="텍스트를 토큰화하고 <code>input_ids</code>를 PyTorch 텐서로 반환하세요:",s,i,d,U,H='<code>generate()</code> 메서드로 번역을 생성하세요. 다양한 텍스트 생성 전략 및 생성을 제어하기 위한 매개변수에 대한 자세한 내용은 <a href="../main_classes/text_generation">Text Generation</a> API를 살펴보시기 바랍니다.',_,V,R,X,E="생성된 토큰 ID들을 다시 텍스트로 디코딩하세요:",C,k,x;return i=new Z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJteV9hd2Vzb21lX29wdXNfYm9va3NfbW9kZWwlMjIpJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKHRleHQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKS5pbnB1dF9pZHM=",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;my_awesome_opus_books_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}}),V=new Z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvclNlcTJTZXFMTSUwQSUwQW1vZGVsJTIwJTNEJTIwQXV0b01vZGVsRm9yU2VxMlNlcUxNLmZyb21fcHJldHJhaW5lZCglMjJteV9hd2Vzb21lX29wdXNfYm9va3NfbW9kZWwlMjIpJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKGlucHV0cyUyQyUyMG1heF9uZXdfdG9rZW5zJTNENDAlMkMlMjBkb19zYW1wbGUlM0RUcnVlJTJDJTIwdG9wX2slM0QzMCUyQyUyMHRvcF9wJTNEMC45NSk=",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;my_awesome_opus_books_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model.generate(inputs, max_new_tokens=<span class="hljs-number">40</span>, do_sample=<span class="hljs-literal">True</span>, top_k=<span class="hljs-number">30</span>, top_p=<span class="hljs-number">0.95</span>)`,wrap:!1}}),k=new Z({props:{code:"dG9rZW5pemVyLmRlY29kZShvdXRwdXRzJTVCMCU1RCUyQyUyMHNraXBfc3BlY2lhbF90b2tlbnMlM0RUcnVlKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.decode(outputs[<span class="hljs-number">0</span>], skip_special_tokens=<span class="hljs-literal">True</span>)
<span class="hljs-string">&#x27;Les lignées partagent des ressources avec des bactéries enfixant l&#x27;</span>azote.<span class="hljs-string">&#x27;</span>`,wrap:!1}}),{c(){l=f("p"),l.innerHTML=m,s=o(),u(i.$$.fragment),d=o(),U=f("p"),U.innerHTML=H,_=o(),u(V.$$.fragment),R=o(),X=f("p"),X.textContent=E,C=o(),u(k.$$.fragment)},l(r){l=h(r,"P",{"data-svelte-h":!0}),j(l)!=="svelte-1b4fw1g"&&(l.innerHTML=m),s=c(r),y(i.$$.fragment,r),d=c(r),U=h(r,"P",{"data-svelte-h":!0}),j(U)!=="svelte-14d7ihu"&&(U.innerHTML=H),_=c(r),y(V.$$.fragment,r),R=c(r),X=h(r,"P",{"data-svelte-h":!0}),j(X)!=="svelte-1u14r4v"&&(X.textContent=E),C=c(r),y(k.$$.fragment,r)},m(r,J){a(r,l,J),a(r,s,J),$(i,r,J),a(r,d,J),a(r,U,J),a(r,_,J),$(V,r,J),a(r,R,J),a(r,X,J),a(r,C,J),$(k,r,J),x=!0},p:we,i(r){x||(b(i.$$.fragment,r),b(V.$$.fragment,r),b(k.$$.fragment,r),x=!0)},o(r){g(i.$$.fragment,r),g(V.$$.fragment,r),g(k.$$.fragment,r),x=!1},d(r){r&&(t(l),t(s),t(d),t(U),t(_),t(R),t(X),t(C)),w(i,r),w(V,r),w(k,r)}}}function pl(v){let l,m;return l=new pt({props:{$$slots:{default:[nl]},$$scope:{ctx:v}}}),{c(){u(l.$$.fragment)},l(s){y(l.$$.fragment,s)},m(s,i){$(l,s,i),m=!0},p(s,i){const d={};i&2&&(d.$$scope={dirty:i,ctx:s}),l.$set(d)},i(s){m||(b(l.$$.fragment,s),m=!0)},o(s){g(l.$$.fragment,s),m=!1},d(s){w(l,s)}}}function rl(v){let l,m="텍스트를 토큰화하고 <code>input_ids</code>를 TensorFlow 텐서로 반환하세요:",s,i,d,U,H='<code>generate()</code> 메서드로 번역을 생성하세요. 다양한 텍스트 생성 전략 및 생성을 제어하기 위한 매개변수에 대한 자세한 내용은 <a href="../main_classes/text_generation">Text Generation</a> API를 살펴보시기 바랍니다.',_,V,R,X,E="생성된 토큰 ID들을 다시 텍스트로 디코딩하세요:",C,k,x;return i=new Z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJteV9hd2Vzb21lX29wdXNfYm9va3NfbW9kZWwlMjIpJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKHRleHQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnRmJTIyKS5pbnB1dF9pZHM=",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;my_awesome_opus_books_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}}),V=new Z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGQXV0b01vZGVsRm9yU2VxMlNlcUxNJTBBJTBBbW9kZWwlMjAlM0QlMjBURkF1dG9Nb2RlbEZvclNlcTJTZXFMTS5mcm9tX3ByZXRyYWluZWQoJTIybXlfYXdlc29tZV9vcHVzX2Jvb2tzX21vZGVsJTIyKSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbC5nZW5lcmF0ZShpbnB1dHMlMkMlMjBtYXhfbmV3X3Rva2VucyUzRDQwJTJDJTIwZG9fc2FtcGxlJTNEVHJ1ZSUyQyUyMHRvcF9rJTNEMzAlMkMlMjB0b3BfcCUzRDAuOTUp",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;my_awesome_opus_books_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model.generate(inputs, max_new_tokens=<span class="hljs-number">40</span>, do_sample=<span class="hljs-literal">True</span>, top_k=<span class="hljs-number">30</span>, top_p=<span class="hljs-number">0.95</span>)`,wrap:!1}}),k=new Z({props:{code:"dG9rZW5pemVyLmRlY29kZShvdXRwdXRzJTVCMCU1RCUyQyUyMHNraXBfc3BlY2lhbF90b2tlbnMlM0RUcnVlKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.decode(outputs[<span class="hljs-number">0</span>], skip_special_tokens=<span class="hljs-literal">True</span>)
<span class="hljs-string">&#x27;Les lugumes partagent les ressources avec des bactéries fixatrices d&#x27;</span>azote.<span class="hljs-string">&#x27;</span>`,wrap:!1}}),{c(){l=f("p"),l.innerHTML=m,s=o(),u(i.$$.fragment),d=o(),U=f("p"),U.innerHTML=H,_=o(),u(V.$$.fragment),R=o(),X=f("p"),X.textContent=E,C=o(),u(k.$$.fragment)},l(r){l=h(r,"P",{"data-svelte-h":!0}),j(l)!=="svelte-jhzp8k"&&(l.innerHTML=m),s=c(r),y(i.$$.fragment,r),d=c(r),U=h(r,"P",{"data-svelte-h":!0}),j(U)!=="svelte-14d7ihu"&&(U.innerHTML=H),_=c(r),y(V.$$.fragment,r),R=c(r),X=h(r,"P",{"data-svelte-h":!0}),j(X)!=="svelte-1u14r4v"&&(X.textContent=E),C=c(r),y(k.$$.fragment,r)},m(r,J){a(r,l,J),a(r,s,J),$(i,r,J),a(r,d,J),a(r,U,J),a(r,_,J),$(V,r,J),a(r,R,J),a(r,X,J),a(r,C,J),$(k,r,J),x=!0},p:we,i(r){x||(b(i.$$.fragment,r),b(V.$$.fragment,r),b(k.$$.fragment,r),x=!0)},o(r){g(i.$$.fragment,r),g(V.$$.fragment,r),g(k.$$.fragment,r),x=!1},d(r){r&&(t(l),t(s),t(d),t(U),t(_),t(R),t(X),t(C)),w(i,r),w(V,r),w(k,r)}}}function ol(v){let l,m;return l=new pt({props:{$$slots:{default:[rl]},$$scope:{ctx:v}}}),{c(){u(l.$$.fragment)},l(s){y(l.$$.fragment,s)},m(s,i){$(l,s,i),m=!0},p(s,i){const d={};i&2&&(d.$$scope={dirty:i,ctx:s}),l.$set(d)},i(s){m||(b(l.$$.fragment,s),m=!0)},o(s){g(l.$$.fragment,s),m=!1},d(s){w(l,s)}}}function cl(v){let l,m,s,i,d,U,H,_,V,R,X="번역",E,C,k,x,r,J,Q="번역은 한 언어로 된 시퀀스를 다른 언어로 변환합니다. 번역이나 요약은 입력을 받아 일련의 출력을 반환하는 강력한 프레임워크인 시퀀스-투-시퀀스 문제로 구성할 수 있는 대표적인 태스크입니다. 번역 시스템은 일반적으로 다른 언어로 된 텍스트 간의 번역에 사용되지만, 음성 간의 통역이나 텍스트-음성 또는 음성-텍스트와 같은 조합에도 사용될 수 있습니다.",z,I,M="이 가이드에서 학습할 내용은:",B,F,rt='<li>영어 텍스트를 프랑스어로 번역하기 위해 <a href="https://huggingface.co/t5-small" rel="nofollow">T5</a> 모델을 OPUS Books 데이터세트의 영어-프랑스어 하위 집합으로 파인튜닝하는 방법과</li> <li>파인튜닝된 모델을 추론에 사용하는 방법입니다.</li>',te,Y,se,A,ot="시작하기 전에 필요한 라이브러리가 모두 설치되어 있는지 확인하세요:",le,q,ae,L,ct="모델을 업로드하고 커뮤니티와 공유할 수 있도록 Hugging Face 계정에 로그인하는 것이 좋습니다. 새로운 창이 표시되면 토큰을 입력하여 로그인하세요.",ne,P,pe,S,O,ee,D,fe,K,mt="OPUS Books 데이터세트 가져오기",re,n,T='먼저 🤗 Datasets 라이브러리에서 <a href="https://huggingface.co/datasets/opus_books" rel="nofollow">OPUS Books</a> 데이터세트의 영어-프랑스어 하위 집합을 가져오세요.',je,Te,bt,Je,ms="데이터세트를 <code>train_test_split</code> 메서드를 사용하여 훈련 및 테스트 데이터로 분할하세요.",gt,Ue,wt,_e,is="훈련 데이터에서 예시를 살펴볼까요?",jt,ke,Tt,ve,fs="반환된 딕셔너리의 <code>translation</code> 키가 텍스트의 영어, 프랑스어 버전을 포함하고 있는 것을 볼 수 있습니다.",Jt,oe,he,it,Ze,ns,tt,hs="전처리",Ut,Ce,_t,xe,Ms="다음 단계로 영어-프랑스어 쌍을 처리하기 위해 T5 토크나이저를 가져오세요.",kt,Re,vt,Xe,ds="만들 전처리 함수는 아래 요구사항을 충족해야 합니다:",Zt,Be,us="<li>T5가 번역 태스크임을 인지할 수 있도록 입력 앞에 프롬프트를 추가하세요. 여러 NLP 태스크를 할 수 있는 모델 중 일부는 이렇게 태스크 프롬프트를 미리 줘야합니다.</li> <li>원어(영어)과 번역어(프랑스어)를 별도로 토큰화하세요. 영어 어휘로 사전 학습된 토크나이저로 프랑스어 텍스트를 토큰화할 수는 없기 때문입니다.</li> <li><code>max_length</code> 매개변수로 설정한 최대 길이보다 길지 않도록 시퀀스를 truncate하세요.</li>",Ct,Ve,xt,We,ys="전체 데이터세트에 전처리 함수를 적용하려면 🤗 Datasets의 <code>map</code> 메서드를 사용하세요. <code>map</code> 함수의 속도를 높이려면 <code>batched=True</code>를 설정하여 데이터세트의 여러 요소를 한 번에 처리하는 방법이 있습니다.",Rt,Ge,Xt,He,$s="이제 <code>DataCollatorForSeq2Seq</code>를 사용하여 예제 배치를 생성합니다. 데이터세트의 최대 길이로 전부를 padding하는 대신, 데이터 정렬 중 각 배치의 최대 길이로 문장을 <em>동적으로 padding</em>하는 것이 더 효율적입니다.",Bt,Me,Vt,ce,de,ft,Ie,ps,st,bs="평가",Wt,Ne,gs='훈련 중에 메트릭을 포함하면 모델의 성능을 평가하는 데 도움이 됩니다. 🤗 <a href="https://huggingface.co/docs/evaluate/index" rel="nofollow">Evaluate</a> 라이브러리로 평가 방법(evaluation method)을 빠르게 가져올 수 있습니다. 현재 태스크에 적합한 SacreBLEU 메트릭을 가져오세요. (메트릭을 가져오고 계산하는 방법에 대해 자세히 알아보려면 🤗 Evaluate <a href="https://huggingface.co/docs/evaluate/a_quick_tour" rel="nofollow">둘러보기</a>를 참조하세요):',Gt,Ee,Ht,Fe,ws="그런 다음 <code>compute</code>에 예측값과 레이블을 전달하여 SacreBLEU 점수를 계산하는 함수를 생성하세요:",It,ze,Nt,Se,js="이제 <code>compute_metrics</code> 함수는 준비되었고, 훈련 과정을 설정할 때 다시 살펴볼 예정입니다.",Et,me,ue,ht,Ye,rs,lt,Ts="훈련",Ft,ye,zt,$e,St,ie,be,Mt,Qe,os,at,Js="추론",Yt,Ae,Us="좋아요, 이제 모델을 파인튜닝했으니 추론에 사용할 수 있습니다!",Qt,qe,_s="다른 언어로 번역하고 싶은 텍스트를 써보세요. T5의 경우 원하는 태스크를 입력의 접두사로 추가해야 합니다. 예를 들어 영어에서 프랑스어로 번역하는 경우, 아래와 같은 접두사가 추가됩니다:",At,Le,qt,Pe,ks="파인튜닝된 모델로 추론하기에 제일 간단한 방법은 <code>pipeline()</code>을 사용하는 것입니다. 해당 모델로 번역 <code>pipeline</code>을 만든 뒤, 텍스트를 전달하세요:",Lt,De,Pt,Ke,vs="원한다면 <code>pipeline</code>의 결과를 직접 복제할 수도 있습니다:",Dt,ge,Kt,dt,Ot;return _=new nt({}),C=new Qs({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/translation.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/ko/pytorch/translation.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/ko/tensorflow/translation.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ko/translation.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ko/pytorch/translation.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ko/tensorflow/translation.ipynb"}]}}),x=new Hs({props:{id:"1JvfrvZgi6c"}}),Y=new as({props:{$$slots:{default:[As]},$$scope:{ctx:v}}}),q=new Z({props:{code:"cGlwJTIwaW5zdGFsbCUyMHRyYW5zZm9ybWVycyUyMGRhdGFzZXRzJTIwZXZhbHVhdGUlMjBzYWNyZWJsZXU=",highlighted:"pip install transformers datasets evaluate sacrebleu",wrap:!1}}),P=new Z({props:{code:"ZnJvbSUyMGh1Z2dpbmdmYWNlX2h1YiUyMGltcG9ydCUyMG5vdGVib29rX2xvZ2luJTBBJTBBbm90ZWJvb2tfbG9naW4oKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> notebook_login

<span class="hljs-meta">&gt;&gt;&gt; </span>notebook_login()`,wrap:!1}}),D=new nt({}),Te=new Z({props:{code:"ZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBJTBBYm9va3MlMjAlM0QlMjBsb2FkX2RhdGFzZXQoJTIyb3B1c19ib29rcyUyMiUyQyUyMCUyMmVuLWZyJTIyKQ==",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>books = load_dataset(<span class="hljs-string">&quot;opus_books&quot;</span>, <span class="hljs-string">&quot;en-fr&quot;</span>)`,wrap:!1}}),Ue=new Z({props:{code:"Ym9va3MlMjAlM0QlMjBib29rcyU1QiUyMnRyYWluJTIyJTVELnRyYWluX3Rlc3Rfc3BsaXQodGVzdF9zaXplJTNEMC4yKQ==",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>books = books[<span class="hljs-string">&quot;train&quot;</span>].train_test_split(test_size=<span class="hljs-number">0.2</span>)',wrap:!1}}),ke=new Z({props:{code:"Ym9va3MlNUIlMjJ0cmFpbiUyMiU1RCU1QjAlNUQ=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>books[<span class="hljs-string">&quot;train&quot;</span>][<span class="hljs-number">0</span>]
{<span class="hljs-string">&#x27;id&#x27;</span>: <span class="hljs-string">&#x27;90560&#x27;</span>,
 <span class="hljs-string">&#x27;translation&#x27;</span>: {<span class="hljs-string">&#x27;en&#x27;</span>: <span class="hljs-string">&#x27;But this lofty plateau measured only a few fathoms, and soon we reentered Our Element.&#x27;</span>,
  <span class="hljs-string">&#x27;fr&#x27;</span>: <span class="hljs-string">&#x27;Mais ce plateau élevé ne mesurait que quelques toises, et bientôt nous fûmes rentrés dans notre élément.&#x27;</span>}}`,wrap:!1}}),Ze=new nt({}),Ce=new Hs({props:{id:"XAR8jnZZuUs"}}),Re=new Z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEFjaGVja3BvaW50JTIwJTNEJTIwJTIydDUtc21hbGwlMjIlMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZChjaGVja3BvaW50KQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>checkpoint = <span class="hljs-string">&quot;t5-small&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(checkpoint)`,wrap:!1}}),Ve=new Z({props:{code:"c291cmNlX2xhbmclMjAlM0QlMjAlMjJlbiUyMiUwQXRhcmdldF9sYW5nJTIwJTNEJTIwJTIyZnIlMjIlMEFwcmVmaXglMjAlM0QlMjAlMjJ0cmFuc2xhdGUlMjBFbmdsaXNoJTIwdG8lMjBGcmVuY2glM0ElMjAlMjIlMEElMEElMEFkZWYlMjBwcmVwcm9jZXNzX2Z1bmN0aW9uKGV4YW1wbGVzKSUzQSUwQSUyMCUyMCUyMCUyMGlucHV0cyUyMCUzRCUyMCU1QnByZWZpeCUyMCUyQiUyMGV4YW1wbGUlNUJzb3VyY2VfbGFuZyU1RCUyMGZvciUyMGV4YW1wbGUlMjBpbiUyMGV4YW1wbGVzJTVCJTIydHJhbnNsYXRpb24lMjIlNUQlNUQlMEElMjAlMjAlMjAlMjB0YXJnZXRzJTIwJTNEJTIwJTVCZXhhbXBsZSU1QnRhcmdldF9sYW5nJTVEJTIwZm9yJTIwZXhhbXBsZSUyMGluJTIwZXhhbXBsZXMlNUIlMjJ0cmFuc2xhdGlvbiUyMiU1RCU1RCUwQSUyMCUyMCUyMCUyMG1vZGVsX2lucHV0cyUyMCUzRCUyMHRva2VuaXplcihpbnB1dHMlMkMlMjB0ZXh0X3RhcmdldCUzRHRhcmdldHMlMkMlMjBtYXhfbGVuZ3RoJTNEMTI4JTJDJTIwdHJ1bmNhdGlvbiUzRFRydWUpJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwbW9kZWxfaW5wdXRz",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>source_lang = <span class="hljs-string">&quot;en&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>target_lang = <span class="hljs-string">&quot;fr&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>prefix = <span class="hljs-string">&quot;translate English to French: &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 + example[source_lang] <span class="hljs-keyword">for</span> example <span class="hljs-keyword">in</span> examples[<span class="hljs-string">&quot;translation&quot;</span>]]
<span class="hljs-meta">... </span>    targets = [example[target_lang] <span class="hljs-keyword">for</span> example <span class="hljs-keyword">in</span> examples[<span class="hljs-string">&quot;translation&quot;</span>]]
<span class="hljs-meta">... </span>    model_inputs = tokenizer(inputs, text_target=targets, max_length=<span class="hljs-number">128</span>, truncation=<span class="hljs-literal">True</span>)
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> model_inputs`,wrap:!1}}),Ge=new Z({props:{code:"dG9rZW5pemVkX2Jvb2tzJTIwJTNEJTIwYm9va3MubWFwKHByZXByb2Nlc3NfZnVuY3Rpb24lMkMlMjBiYXRjaGVkJTNEVHJ1ZSk=",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>tokenized_books = books.<span class="hljs-built_in">map</span>(preprocess_function, batched=<span class="hljs-literal">True</span>)',wrap:!1}}),Me=new cs({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[Ds],pytorch:[Ls]},$$scope:{ctx:v}}}),Ie=new nt({}),Ee=new Z({props:{code:"aW1wb3J0JTIwZXZhbHVhdGUlMEElMEFtZXRyaWMlMjAlM0QlMjBldmFsdWF0ZS5sb2FkKCUyMnNhY3JlYmxldSUyMik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> evaluate

<span class="hljs-meta">&gt;&gt;&gt; </span>metric = evaluate.load(<span class="hljs-string">&quot;sacrebleu&quot;</span>)`,wrap:!1}}),ze=new Z({props:{code:"aW1wb3J0JTIwbnVtcHklMjBhcyUyMG5wJTBBJTBBJTBBZGVmJTIwcG9zdHByb2Nlc3NfdGV4dChwcmVkcyUyQyUyMGxhYmVscyklM0ElMEElMjAlMjAlMjAlMjBwcmVkcyUyMCUzRCUyMCU1QnByZWQuc3RyaXAoKSUyMGZvciUyMHByZWQlMjBpbiUyMHByZWRzJTVEJTBBJTIwJTIwJTIwJTIwbGFiZWxzJTIwJTNEJTIwJTVCJTVCbGFiZWwuc3RyaXAoKSU1RCUyMGZvciUyMGxhYmVsJTIwaW4lMjBsYWJlbHMlNUQlMEElMEElMjAlMjAlMjAlMjByZXR1cm4lMjBwcmVkcyUyQyUyMGxhYmVscyUwQSUwQSUwQWRlZiUyMGNvbXB1dGVfbWV0cmljcyhldmFsX3ByZWRzKSUzQSUwQSUyMCUyMCUyMCUyMHByZWRzJTJDJTIwbGFiZWxzJTIwJTNEJTIwZXZhbF9wcmVkcyUwQSUyMCUyMCUyMCUyMGlmJTIwaXNpbnN0YW5jZShwcmVkcyUyQyUyMHR1cGxlKSUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHByZWRzJTIwJTNEJTIwcHJlZHMlNUIwJTVEJTBBJTIwJTIwJTIwJTIwZGVjb2RlZF9wcmVkcyUyMCUzRCUyMHRva2VuaXplci5iYXRjaF9kZWNvZGUocHJlZHMlMkMlMjBza2lwX3NwZWNpYWxfdG9rZW5zJTNEVHJ1ZSklMEElMEElMjAlMjAlMjAlMjBsYWJlbHMlMjAlM0QlMjBucC53aGVyZShsYWJlbHMlMjAhJTNEJTIwLTEwMCUyQyUyMGxhYmVscyUyQyUyMHRva2VuaXplci5wYWRfdG9rZW5faWQpJTBBJTIwJTIwJTIwJTIwZGVjb2RlZF9sYWJlbHMlMjAlM0QlMjB0b2tlbml6ZXIuYmF0Y2hfZGVjb2RlKGxhYmVscyUyQyUyMHNraXBfc3BlY2lhbF90b2tlbnMlM0RUcnVlKSUwQSUwQSUyMCUyMCUyMCUyMGRlY29kZWRfcHJlZHMlMkMlMjBkZWNvZGVkX2xhYmVscyUyMCUzRCUyMHBvc3Rwcm9jZXNzX3RleHQoZGVjb2RlZF9wcmVkcyUyQyUyMGRlY29kZWRfbGFiZWxzKSUwQSUwQSUyMCUyMCUyMCUyMHJlc3VsdCUyMCUzRCUyMG1ldHJpYy5jb21wdXRlKHByZWRpY3Rpb25zJTNEZGVjb2RlZF9wcmVkcyUyQyUyMHJlZmVyZW5jZXMlM0RkZWNvZGVkX2xhYmVscyklMEElMjAlMjAlMjAlMjByZXN1bHQlMjAlM0QlMjAlN0IlMjJibGV1JTIyJTNBJTIwcmVzdWx0JTVCJTIyc2NvcmUlMjIlNUQlN0QlMEElMEElMjAlMjAlMjAlMjBwcmVkaWN0aW9uX2xlbnMlMjAlM0QlMjAlNUJucC5jb3VudF9ub256ZXJvKHByZWQlMjAhJTNEJTIwdG9rZW5pemVyLnBhZF90b2tlbl9pZCklMjBmb3IlMjBwcmVkJTIwaW4lMjBwcmVkcyU1RCUwQSUyMCUyMCUyMCUyMHJlc3VsdCU1QiUyMmdlbl9sZW4lMjIlNUQlMjAlM0QlMjBucC5tZWFuKHByZWRpY3Rpb25fbGVucyklMEElMjAlMjAlMjAlMjByZXN1bHQlMjAlM0QlMjAlN0JrJTNBJTIwcm91bmQodiUyQyUyMDQpJTIwZm9yJTIwayUyQyUyMHYlMjBpbiUyMHJlc3VsdC5pdGVtcygpJTdEJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwcmVzdWx0",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_">postprocess_text</span>(<span class="hljs-params">preds, labels</span>):
<span class="hljs-meta">... </span>    preds = [pred.strip() <span class="hljs-keyword">for</span> pred <span class="hljs-keyword">in</span> preds]
<span class="hljs-meta">... </span>    labels = [[label.strip()] <span class="hljs-keyword">for</span> label <span class="hljs-keyword">in</span> labels]

<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> preds, labels


<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_preds</span>):
<span class="hljs-meta">... </span>    preds, labels = eval_preds
<span class="hljs-meta">... </span>    <span class="hljs-keyword">if</span> <span class="hljs-built_in">isinstance</span>(preds, <span class="hljs-built_in">tuple</span>):
<span class="hljs-meta">... </span>        preds = preds[<span class="hljs-number">0</span>]
<span class="hljs-meta">... </span>    decoded_preds = tokenizer.batch_decode(preds, 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>    decoded_preds, decoded_labels = postprocess_text(decoded_preds, decoded_labels)

<span class="hljs-meta">... </span>    result = metric.compute(predictions=decoded_preds, references=decoded_labels)
<span class="hljs-meta">... </span>    result = {<span class="hljs-string">&quot;bleu&quot;</span>: result[<span class="hljs-string">&quot;score&quot;</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> preds]
<span class="hljs-meta">... </span>    result[<span class="hljs-string">&quot;gen_len&quot;</span>] = np.mean(prediction_lens)
<span class="hljs-meta">... </span>    result = {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()}
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> result`,wrap:!1}}),Ye=new nt({}),ye=new cs({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[ll],pytorch:[el]},$$scope:{ctx:v}}}),$e=new as({props:{$$slots:{default:[al]},$$scope:{ctx:v}}}),Qe=new nt({}),Le=new Z({props:{code:"dGV4dCUyMCUzRCUyMCUyMnRyYW5zbGF0ZSUyMEVuZ2xpc2glMjB0byUyMEZyZW5jaCUzQSUyMExlZ3VtZXMlMjBzaGFyZSUyMHJlc291cmNlcyUyMHdpdGglMjBuaXRyb2dlbi1maXhpbmclMjBiYWN0ZXJpYS4lMjI=",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>text = <span class="hljs-string">&quot;translate English to French: Legumes share resources with nitrogen-fixing bacteria.&quot;</span>',wrap:!1}}),De=new Z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBdHJhbnNsYXRvciUyMCUzRCUyMHBpcGVsaW5lKCUyMnRyYW5zbGF0aW9uJTIyJTJDJTIwbW9kZWwlM0QlMjJteV9hd2Vzb21lX29wdXNfYm9va3NfbW9kZWwlMjIpJTBBdHJhbnNsYXRvcih0ZXh0KQ==",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>translator = pipeline(<span class="hljs-string">&quot;translation&quot;</span>, model=<span class="hljs-string">&quot;my_awesome_opus_books_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>translator(text)
[{<span class="hljs-string">&#x27;translation_text&#x27;</span>: <span class="hljs-string">&#x27;Legumes partagent des ressources avec des bactéries azotantes.&#x27;</span>}]`,wrap:!1}}),ge=new cs({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[ol],pytorch:[pl]},$$scope:{ctx:v}}}),{c(){l=f("meta"),m=o(),s=f("p"),i=o(),d=f("h1"),U=f("a"),H=f("span"),u(_.$$.fragment),V=o(),R=f("span"),R.textContent=X,E=o(),u(C.$$.fragment),k=o(),u(x.$$.fragment),r=o(),J=f("p"),J.textContent=Q,z=o(),I=f("p"),I.textContent=M,B=o(),F=f("ol"),F.innerHTML=rt,te=o(),u(Y.$$.fragment),se=o(),A=f("p"),A.textContent=ot,le=o(),u(q.$$.fragment),ae=o(),L=f("p"),L.textContent=ct,ne=o(),u(P.$$.fragment),pe=o(),S=f("h2"),O=f("a"),ee=f("span"),u(D.$$.fragment),fe=o(),K=f("span"),K.textContent=mt,re=o(),n=f("p"),n.innerHTML=T,je=o(),u(Te.$$.fragment),bt=o(),Je=f("p"),Je.innerHTML=ms,gt=o(),u(Ue.$$.fragment),wt=o(),_e=f("p"),_e.textContent=is,jt=o(),u(ke.$$.fragment),Tt=o(),ve=f("p"),ve.innerHTML=fs,Jt=o(),oe=f("h2"),he=f("a"),it=f("span"),u(Ze.$$.fragment),ns=o(),tt=f("span"),tt.textContent=hs,Ut=o(),u(Ce.$$.fragment),_t=o(),xe=f("p"),xe.textContent=Ms,kt=o(),u(Re.$$.fragment),vt=o(),Xe=f("p"),Xe.textContent=ds,Zt=o(),Be=f("ol"),Be.innerHTML=us,Ct=o(),u(Ve.$$.fragment),xt=o(),We=f("p"),We.innerHTML=ys,Rt=o(),u(Ge.$$.fragment),Xt=o(),He=f("p"),He.innerHTML=$s,Bt=o(),u(Me.$$.fragment),Vt=o(),ce=f("h2"),de=f("a"),ft=f("span"),u(Ie.$$.fragment),ps=o(),st=f("span"),st.textContent=bs,Wt=o(),Ne=f("p"),Ne.innerHTML=gs,Gt=o(),u(Ee.$$.fragment),Ht=o(),Fe=f("p"),Fe.innerHTML=ws,It=o(),u(ze.$$.fragment),Nt=o(),Se=f("p"),Se.innerHTML=js,Et=o(),me=f("h2"),ue=f("a"),ht=f("span"),u(Ye.$$.fragment),rs=o(),lt=f("span"),lt.textContent=Ts,Ft=o(),u(ye.$$.fragment),zt=o(),u($e.$$.fragment),St=o(),ie=f("h2"),be=f("a"),Mt=f("span"),u(Qe.$$.fragment),os=o(),at=f("span"),at.textContent=Js,Yt=o(),Ae=f("p"),Ae.textContent=Us,Qt=o(),qe=f("p"),qe.textContent=_s,At=o(),u(Le.$$.fragment),qt=o(),Pe=f("p"),Pe.innerHTML=ks,Lt=o(),u(De.$$.fragment),Pt=o(),Ke=f("p"),Ke.innerHTML=vs,Dt=o(),u(ge.$$.fragment),Kt=o(),dt=f("p"),this.h()},l(e){const p=Ys("svelte-1phssyn",document.head);l=h(p,"META",{name:!0,content:!0}),p.forEach(t),m=c(e),s=h(e,"P",{}),N(s).forEach(t),i=c(e),d=h(e,"H1",{class:!0});var Oe=N(d);U=h(Oe,"A",{id:!0,class:!0,href:!0});var ut=N(U);H=h(ut,"SPAN",{});var yt=N(H);y(_.$$.fragment,yt),yt.forEach(t),ut.forEach(t),V=c(Oe),R=h(Oe,"SPAN",{"data-svelte-h":!0}),j(R)!=="svelte-19kkq20"&&(R.textContent=X),Oe.forEach(t),E=c(e),y(C.$$.fragment,e),k=c(e),y(x.$$.fragment,e),r=c(e),J=h(e,"P",{"data-svelte-h":!0}),j(J)!=="svelte-1k3fp3p"&&(J.textContent=Q),z=c(e),I=h(e,"P",{"data-svelte-h":!0}),j(I)!=="svelte-14hiaa1"&&(I.textContent=M),B=c(e),F=h(e,"OL",{"data-svelte-h":!0}),j(F)!=="svelte-lo1okf"&&(F.innerHTML=rt),te=c(e),y(Y.$$.fragment,e),se=c(e),A=h(e,"P",{"data-svelte-h":!0}),j(A)!=="svelte-1k0z9pm"&&(A.textContent=ot),le=c(e),y(q.$$.fragment,e),ae=c(e),L=h(e,"P",{"data-svelte-h":!0}),j(L)!=="svelte-1jstx1u"&&(L.textContent=ct),ne=c(e),y(P.$$.fragment,e),pe=c(e),S=h(e,"H2",{class:!0});var et=N(S);O=h(et,"A",{id:!0,class:!0,href:!0});var $t=N(O);ee=h($t,"SPAN",{});var Zs=N(ee);y(D.$$.fragment,Zs),Zs.forEach(t),$t.forEach(t),fe=c(et),K=h(et,"SPAN",{"data-svelte-h":!0}),j(K)!=="svelte-pni3fs"&&(K.textContent=mt),et.forEach(t),re=c(e),n=h(e,"P",{"data-svelte-h":!0}),j(n)!=="svelte-adgncb"&&(n.innerHTML=T),je=c(e),y(Te.$$.fragment,e),bt=c(e),Je=h(e,"P",{"data-svelte-h":!0}),j(Je)!=="svelte-19d5a0p"&&(Je.innerHTML=ms),gt=c(e),y(Ue.$$.fragment,e),wt=c(e),_e=h(e,"P",{"data-svelte-h":!0}),j(_e)!=="svelte-o7e31d"&&(_e.textContent=is),jt=c(e),y(ke.$$.fragment,e),Tt=c(e),ve=h(e,"P",{"data-svelte-h":!0}),j(ve)!=="svelte-18ww8rs"&&(ve.innerHTML=fs),Jt=c(e),oe=h(e,"H2",{class:!0});var es=N(oe);he=h(es,"A",{id:!0,class:!0,href:!0});var Cs=N(he);it=h(Cs,"SPAN",{});var xs=N(it);y(Ze.$$.fragment,xs),xs.forEach(t),Cs.forEach(t),ns=c(es),tt=h(es,"SPAN",{"data-svelte-h":!0}),j(tt)!=="svelte-1cte2wb"&&(tt.textContent=hs),es.forEach(t),Ut=c(e),y(Ce.$$.fragment,e),_t=c(e),xe=h(e,"P",{"data-svelte-h":!0}),j(xe)!=="svelte-1mrpk7j"&&(xe.textContent=Ms),kt=c(e),y(Re.$$.fragment,e),vt=c(e),Xe=h(e,"P",{"data-svelte-h":!0}),j(Xe)!=="svelte-cw39ls"&&(Xe.textContent=ds),Zt=c(e),Be=h(e,"OL",{"data-svelte-h":!0}),j(Be)!=="svelte-1a06q10"&&(Be.innerHTML=us),Ct=c(e),y(Ve.$$.fragment,e),xt=c(e),We=h(e,"P",{"data-svelte-h":!0}),j(We)!=="svelte-1lmdyeh"&&(We.innerHTML=ys),Rt=c(e),y(Ge.$$.fragment,e),Xt=c(e),He=h(e,"P",{"data-svelte-h":!0}),j(He)!=="svelte-1lgij5g"&&(He.innerHTML=$s),Bt=c(e),y(Me.$$.fragment,e),Vt=c(e),ce=h(e,"H2",{class:!0});var ts=N(ce);de=h(ts,"A",{id:!0,class:!0,href:!0});var Rs=N(de);ft=h(Rs,"SPAN",{});var Xs=N(ft);y(Ie.$$.fragment,Xs),Xs.forEach(t),Rs.forEach(t),ps=c(ts),st=h(ts,"SPAN",{"data-svelte-h":!0}),j(st)!=="svelte-fd7xxy"&&(st.textContent=bs),ts.forEach(t),Wt=c(e),Ne=h(e,"P",{"data-svelte-h":!0}),j(Ne)!=="svelte-1fiqbd1"&&(Ne.innerHTML=gs),Gt=c(e),y(Ee.$$.fragment,e),Ht=c(e),Fe=h(e,"P",{"data-svelte-h":!0}),j(Fe)!=="svelte-1925cbb"&&(Fe.innerHTML=ws),It=c(e),y(ze.$$.fragment,e),Nt=c(e),Se=h(e,"P",{"data-svelte-h":!0}),j(Se)!=="svelte-11m7xom"&&(Se.innerHTML=js),Et=c(e),me=h(e,"H2",{class:!0});var ss=N(me);ue=h(ss,"A",{id:!0,class:!0,href:!0});var Bs=N(ue);ht=h(Bs,"SPAN",{});var Vs=N(ht);y(Ye.$$.fragment,Vs),Vs.forEach(t),Bs.forEach(t),rs=c(ss),lt=h(ss,"SPAN",{"data-svelte-h":!0}),j(lt)!=="svelte-tdy10p"&&(lt.textContent=Ts),ss.forEach(t),Ft=c(e),y(ye.$$.fragment,e),zt=c(e),y($e.$$.fragment,e),St=c(e),ie=h(e,"H2",{class:!0});var ls=N(ie);be=h(ls,"A",{id:!0,class:!0,href:!0});var Ws=N(be);Mt=h(Ws,"SPAN",{});var Gs=N(Mt);y(Qe.$$.fragment,Gs),Gs.forEach(t),Ws.forEach(t),os=c(ls),at=h(ls,"SPAN",{"data-svelte-h":!0}),j(at)!=="svelte-8litrx"&&(at.textContent=Js),ls.forEach(t),Yt=c(e),Ae=h(e,"P",{"data-svelte-h":!0}),j(Ae)!=="svelte-1nv1rsn"&&(Ae.textContent=Us),Qt=c(e),qe=h(e,"P",{"data-svelte-h":!0}),j(qe)!=="svelte-1kbteb5"&&(qe.textContent=_s),At=c(e),y(Le.$$.fragment,e),qt=c(e),Pe=h(e,"P",{"data-svelte-h":!0}),j(Pe)!=="svelte-19gmubo"&&(Pe.innerHTML=ks),Lt=c(e),y(De.$$.fragment,e),Pt=c(e),Ke=h(e,"P",{"data-svelte-h":!0}),j(Ke)!=="svelte-ckakkh"&&(Ke.innerHTML=vs),Dt=c(e),y(ge.$$.fragment,e),Kt=c(e),dt=h(e,"P",{}),N(dt).forEach(t),this.h()},h(){W(l,"name","hf:doc:metadata"),W(l,"content",JSON.stringify(ml)),W(U,"id","translation"),W(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"),W(U,"href","#translation"),W(d,"class","relative group"),W(O,"id","load-opus-books-dataset"),W(O,"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"),W(O,"href","#load-opus-books-dataset"),W(S,"class","relative group"),W(he,"id","preprocess"),W(he,"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"),W(he,"href","#preprocess"),W(oe,"class","relative group"),W(de,"id","evalulate"),W(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"),W(de,"href","#evalulate"),W(ce,"class","relative group"),W(ue,"id","train"),W(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"),W(ue,"href","#train"),W(me,"class","relative group"),W(be,"id","inference"),W(be,"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"),W(be,"href","#inference"),W(ie,"class","relative group")},m(e,p){G(document.head,l),a(e,m,p),a(e,s,p),a(e,i,p),a(e,d,p),G(d,U),G(U,H),$(_,H,null),G(d,V),G(d,R),a(e,E,p),$(C,e,p),a(e,k,p),$(x,e,p),a(e,r,p),a(e,J,p),a(e,z,p),a(e,I,p),a(e,B,p),a(e,F,p),a(e,te,p),$(Y,e,p),a(e,se,p),a(e,A,p),a(e,le,p),$(q,e,p),a(e,ae,p),a(e,L,p),a(e,ne,p),$(P,e,p),a(e,pe,p),a(e,S,p),G(S,O),G(O,ee),$(D,ee,null),G(S,fe),G(S,K),a(e,re,p),a(e,n,p),a(e,je,p),$(Te,e,p),a(e,bt,p),a(e,Je,p),a(e,gt,p),$(Ue,e,p),a(e,wt,p),a(e,_e,p),a(e,jt,p),$(ke,e,p),a(e,Tt,p),a(e,ve,p),a(e,Jt,p),a(e,oe,p),G(oe,he),G(he,it),$(Ze,it,null),G(oe,ns),G(oe,tt),a(e,Ut,p),$(Ce,e,p),a(e,_t,p),a(e,xe,p),a(e,kt,p),$(Re,e,p),a(e,vt,p),a(e,Xe,p),a(e,Zt,p),a(e,Be,p),a(e,Ct,p),$(Ve,e,p),a(e,xt,p),a(e,We,p),a(e,Rt,p),$(Ge,e,p),a(e,Xt,p),a(e,He,p),a(e,Bt,p),$(Me,e,p),a(e,Vt,p),a(e,ce,p),G(ce,de),G(de,ft),$(Ie,ft,null),G(ce,ps),G(ce,st),a(e,Wt,p),a(e,Ne,p),a(e,Gt,p),$(Ee,e,p),a(e,Ht,p),a(e,Fe,p),a(e,It,p),$(ze,e,p),a(e,Nt,p),a(e,Se,p),a(e,Et,p),a(e,me,p),G(me,ue),G(ue,ht),$(Ye,ht,null),G(me,rs),G(me,lt),a(e,Ft,p),$(ye,e,p),a(e,zt,p),$($e,e,p),a(e,St,p),a(e,ie,p),G(ie,be),G(be,Mt),$(Qe,Mt,null),G(ie,os),G(ie,at),a(e,Yt,p),a(e,Ae,p),a(e,Qt,p),a(e,qe,p),a(e,At,p),$(Le,e,p),a(e,qt,p),a(e,Pe,p),a(e,Lt,p),$(De,e,p),a(e,Pt,p),a(e,Ke,p),a(e,Dt,p),$(ge,e,p),a(e,Kt,p),a(e,dt,p),Ot=!0},p(e,[p]){const Oe={};p&2&&(Oe.$$scope={dirty:p,ctx:e}),Y.$set(Oe);const ut={};p&2&&(ut.$$scope={dirty:p,ctx:e}),Me.$set(ut);const yt={};p&2&&(yt.$$scope={dirty:p,ctx:e}),ye.$set(yt);const et={};p&2&&(et.$$scope={dirty:p,ctx:e}),$e.$set(et);const $t={};p&2&&($t.$$scope={dirty:p,ctx:e}),ge.$set($t)},i(e){Ot||(b(_.$$.fragment,e),b(C.$$.fragment,e),b(x.$$.fragment,e),b(Y.$$.fragment,e),b(q.$$.fragment,e),b(P.$$.fragment,e),b(D.$$.fragment,e),b(Te.$$.fragment,e),b(Ue.$$.fragment,e),b(ke.$$.fragment,e),b(Ze.$$.fragment,e),b(Ce.$$.fragment,e),b(Re.$$.fragment,e),b(Ve.$$.fragment,e),b(Ge.$$.fragment,e),b(Me.$$.fragment,e),b(Ie.$$.fragment,e),b(Ee.$$.fragment,e),b(ze.$$.fragment,e),b(Ye.$$.fragment,e),b(ye.$$.fragment,e),b($e.$$.fragment,e),b(Qe.$$.fragment,e),b(Le.$$.fragment,e),b(De.$$.fragment,e),b(ge.$$.fragment,e),Ot=!0)},o(e){g(_.$$.fragment,e),g(C.$$.fragment,e),g(x.$$.fragment,e),g(Y.$$.fragment,e),g(q.$$.fragment,e),g(P.$$.fragment,e),g(D.$$.fragment,e),g(Te.$$.fragment,e),g(Ue.$$.fragment,e),g(ke.$$.fragment,e),g(Ze.$$.fragment,e),g(Ce.$$.fragment,e),g(Re.$$.fragment,e),g(Ve.$$.fragment,e),g(Ge.$$.fragment,e),g(Me.$$.fragment,e),g(Ie.$$.fragment,e),g(Ee.$$.fragment,e),g(ze.$$.fragment,e),g(Ye.$$.fragment,e),g(ye.$$.fragment,e),g($e.$$.fragment,e),g(Qe.$$.fragment,e),g(Le.$$.fragment,e),g(De.$$.fragment,e),g(ge.$$.fragment,e),Ot=!1},d(e){e&&(t(m),t(s),t(i),t(d),t(E),t(k),t(r),t(J),t(z),t(I),t(B),t(F),t(te),t(se),t(A),t(le),t(ae),t(L),t(ne),t(pe),t(S),t(re),t(n),t(je),t(bt),t(Je),t(gt),t(wt),t(_e),t(jt),t(Tt),t(ve),t(Jt),t(oe),t(Ut),t(_t),t(xe),t(kt),t(vt),t(Xe),t(Zt),t(Be),t(Ct),t(xt),t(We),t(Rt),t(Xt),t(He),t(Bt),t(Vt),t(ce),t(Wt),t(Ne),t(Gt),t(Ht),t(Fe),t(It),t(Nt),t(Se),t(Et),t(me),t(Ft),t(zt),t(St),t(ie),t(Yt),t(Ae),t(Qt),t(qe),t(At),t(qt),t(Pe),t(Lt),t(Pt),t(Ke),t(Dt),t(Kt),t(dt)),t(l),w(_),w(C,e),w(x,e),w(Y,e),w(q,e),w(P,e),w(D),w(Te,e),w(Ue,e),w(ke,e),w(Ze),w(Ce,e),w(Re,e),w(Ve,e),w(Ge,e),w(Me,e),w(Ie),w(Ee,e),w(ze,e),w(Ye),w(ye,e),w($e,e),w(Qe),w(Le,e),w(De,e),w(ge,e)}}}const ml={local:"translation",sections:[{local:"load-opus-books-dataset",title:"OPUS Books 데이터세트 가져오기"},{local:"preprocess",title:"전처리"},{local:"evalulate",title:"평가"},{local:"train",title:"훈련"},{local:"inference",title:"추론"}],title:"번역"};function il(v){return Fs(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class gl extends zs{constructor(l){super(),Ss(this,l,il,cl,Es,{})}}export{gl as component};
