import{s as Bs,o as zs,n as ce}from"../chunks/scheduler.889ebb13.js";import{S as Fs,i as Hs,g as d,s as o,u as M,A as Es,h as f,f as t,c as r,j as Q,v as y,y as T,k as X,o as B,a as l,w as $,d as b,t as j,x as w,m as Ws,n as Xs}from"../chunks/index.8980e686.js";import{T as es}from"../chunks/Tip.7191df11.js";import{Y as Vs}from"../chunks/Youtube.532e53e0.js";import{I as mt}from"../chunks/IconCopyLink.357761cd.js";import{C as v}from"../chunks/CodeBlock.25fc3430.js";import{D as As}from"../chunks/DocNotebookDropdown.f8a50280.js";import{F as ns,M as tt}from"../chunks/Markdown.31057263.js";function Ns(U){let s,c,a='<a href="../model_doc/bart">BART</a>, <a href="../model_doc/bert">BERT</a>, <a href="../model_doc/bert-generation">Bert Generation</a>, <a href="../model_doc/big_bird">BigBird</a>, <a href="../model_doc/bigbird_pegasus">BigBird-Pegasus</a>, <a href="../model_doc/biogpt">BioGpt</a>, <a href="../model_doc/blenderbot">Blenderbot</a>, <a href="../model_doc/blenderbot-small">BlenderbotSmall</a>, <a href="../model_doc/bloom">BLOOM</a>, <a href="../model_doc/camembert">CamemBERT</a>, <a href="../model_doc/codegen">CodeGen</a>, <a href="../model_doc/cpmant">CPM-Ant</a>, <a href="../model_doc/ctrl">CTRL</a>, <a href="../model_doc/data2vec-text">Data2VecText</a>, <a href="../model_doc/electra">ELECTRA</a>, <a href="../model_doc/ernie">ERNIE</a>, <a href="../model_doc/git">GIT</a>, <a href="../model_doc/gpt-sw3">GPT-Sw3</a>, <a href="../model_doc/gpt2">OpenAI GPT-2</a>, <a href="../model_doc/gpt_bigcode">GPTBigCode</a>, <a href="../model_doc/gpt_neo">GPT Neo</a>, <a href="../model_doc/gpt_neox">GPT NeoX</a>, <a href="../model_doc/gpt_neox_japanese">GPT NeoX Japanese</a>, <a href="../model_doc/gptj">GPT-J</a>, <a href="../model_doc/llama">LLaMA</a>, <a href="../model_doc/marian">Marian</a>, <a href="../model_doc/mbart">mBART</a>, <a href="../model_doc/mega">MEGA</a>, <a href="../model_doc/megatron-bert">Megatron-BERT</a>, <a href="../model_doc/mvp">MVP</a>, <a href="../model_doc/open-llama">OpenLlama</a>, <a href="../model_doc/openai-gpt">OpenAI GPT</a>, <a href="../model_doc/opt">OPT</a>, <a href="../model_doc/pegasus">Pegasus</a>, <a href="../model_doc/plbart">PLBart</a>, <a href="../model_doc/prophetnet">ProphetNet</a>, <a href="../model_doc/qdqbert">QDQBert</a>, <a href="../model_doc/reformer">Reformer</a>, <a href="../model_doc/rembert">RemBERT</a>, <a href="../model_doc/roberta">RoBERTa</a>, <a href="../model_doc/roberta-prelayernorm">RoBERTa-PreLayerNorm</a>, <a href="../model_doc/roc_bert">RoCBert</a>, <a href="../model_doc/roformer">RoFormer</a>, <a href="../model_doc/rwkv">RWKV</a>, <a href="../model_doc/speech_to_text_2">Speech2Text2</a>, <a href="../model_doc/transfo-xl">Transformer-XL</a>, <a href="../model_doc/trocr">TrOCR</a>, <a href="../model_doc/xglm">XGLM</a>, <a href="../model_doc/xlm">XLM</a>, <a href="../model_doc/xlm-prophetnet">XLM-ProphetNet</a>, <a href="../model_doc/xlm-roberta">XLM-RoBERTa</a>, <a href="../model_doc/xlm-roberta-xl">XLM-RoBERTa-XL</a>, <a href="../model_doc/xlnet">XLNet</a>, <a href="../model_doc/xmod">X-MOD</a>';return{c(){s=Ws(`이 안내서의 단계와 동일한 방법으로 인과 언어 모델링을 위해 다른 아키텍처를 미세 조정할 수 있습니다.
다음 아키텍처 중 하나를 선택하세요:

`),c=d("p"),c.innerHTML=a},l(p){s=Xs(p,`이 안내서의 단계와 동일한 방법으로 인과 언어 모델링을 위해 다른 아키텍처를 미세 조정할 수 있습니다.
다음 아키텍처 중 하나를 선택하세요:

`),c=f(p,"P",{"data-svelte-h":!0}),T(c)!=="svelte-8bi7rm"&&(c.innerHTML=a)},m(p,g){l(p,s,g),l(p,c,g)},p:ce,d(p){p&&(t(s),t(c))}}}function Qs(U){let s,c="패딩 토큰으로 종결 토큰을 사용하고 <code>mlm=False</code>로 설정하세요. 이렇게 하면 입력을 오른쪽으로 한 칸씩 시프트한 값을 레이블로 사용합니다:",a,p,g;return p=new v({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERhdGFDb2xsYXRvckZvckxhbmd1YWdlTW9kZWxpbmclMEElMEF0b2tlbml6ZXIucGFkX3Rva2VuJTIwJTNEJTIwdG9rZW5pemVyLmVvc190b2tlbiUwQWRhdGFfY29sbGF0b3IlMjAlM0QlMjBEYXRhQ29sbGF0b3JGb3JMYW5ndWFnZU1vZGVsaW5nKHRva2VuaXplciUzRHRva2VuaXplciUyQyUyMG1sbSUzREZhbHNlKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DataCollatorForLanguageModeling

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.pad_token = tokenizer.eos_token
<span class="hljs-meta">&gt;&gt;&gt; </span>data_collator = DataCollatorForLanguageModeling(tokenizer=tokenizer, mlm=<span class="hljs-literal">False</span>)`}}),{c(){s=d("p"),s.innerHTML=c,a=o(),M(p.$$.fragment)},l(u){s=f(u,"P",{"data-svelte-h":!0}),T(s)!=="svelte-xhgrka"&&(s.innerHTML=c),a=r(u),y(p.$$.fragment,u)},m(u,Z){l(u,s,Z),l(u,a,Z),$(p,u,Z),g=!0},p:ce,i(u){g||(b(p.$$.fragment,u),g=!0)},o(u){j(p.$$.fragment,u),g=!1},d(u){u&&(t(s),t(a)),w(p,u)}}}function Ys(U){let s,c;return s=new tt({props:{$$slots:{default:[Qs]},$$scope:{ctx:U}}}),{c(){M(s.$$.fragment)},l(a){y(s.$$.fragment,a)},m(a,p){$(s,a,p),c=!0},p(a,p){const g={};p&2&&(g.$$scope={dirty:p,ctx:a}),s.$set(g)},i(a){c||(b(s.$$.fragment,a),c=!0)},o(a){j(s.$$.fragment,a),c=!1},d(a){w(s,a)}}}function Ls(U){let s,c="패딩 토큰으로 종결 토큰을 사용하고 <code>mlm=False</code>로 설정하세요. 이렇게 하면 입력을 오른쪽으로 한 칸씩 시프트한 값을 레이블로 사용합니다:",a,p,g;return p=new v({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERhdGFDb2xsYXRvckZvckxhbmd1YWdlTW9kZWxpbmclMEElMEFkYXRhX2NvbGxhdG9yJTIwJTNEJTIwRGF0YUNvbGxhdG9yRm9yTGFuZ3VhZ2VNb2RlbGluZyh0b2tlbml6ZXIlM0R0b2tlbml6ZXIlMkMlMjBtbG0lM0RGYWxzZSUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIydGYlMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DataCollatorForLanguageModeling

<span class="hljs-meta">&gt;&gt;&gt; </span>data_collator = DataCollatorForLanguageModeling(tokenizer=tokenizer, mlm=<span class="hljs-literal">False</span>, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)`}}),{c(){s=d("p"),s.innerHTML=c,a=o(),M(p.$$.fragment)},l(u){s=f(u,"P",{"data-svelte-h":!0}),T(s)!=="svelte-xhgrka"&&(s.innerHTML=c),a=r(u),y(p.$$.fragment,u)},m(u,Z){l(u,s,Z),l(u,a,Z),$(p,u,Z),g=!0},p:ce,i(u){g||(b(p.$$.fragment,u),g=!0)},o(u){j(p.$$.fragment,u),g=!1},d(u){u&&(t(s),t(a)),w(p,u)}}}function qs(U){let s,c;return s=new tt({props:{$$slots:{default:[Ls]},$$scope:{ctx:U}}}),{c(){M(s.$$.fragment)},l(a){y(s.$$.fragment,a)},m(a,p){$(s,a,p),c=!0},p(a,p){const g={};p&2&&(g.$$scope={dirty:p,ctx:a}),s.$set(g)},i(a){c||(b(s.$$.fragment,a),c=!0)},o(a){j(s.$$.fragment,a),c=!1},d(a){w(s,a)}}}function Ss(U){let s,c='<code>Trainer</code>를 사용하여 모델을 미세 조정하는 방법을 잘 모르신다면 <a href="../training#train-with-pytorch-trainer">기본 튜토리얼</a>을 확인해보세요!';return{c(){s=d("p"),s.innerHTML=c},l(a){s=f(a,"P",{"data-svelte-h":!0}),T(s)!=="svelte-1n631xc"&&(s.innerHTML=c)},m(a,p){l(a,s,p)},p:ce,d(a){a&&t(s)}}}function Ps(U){let s,c,a,p="이제 모델을 훈련하기 준비가 되었습니다! <code>AutoModelForCausalLM</code>를 사용하여 DistilGPT2를 불러옵니다:",g,u,Z,x,W="여기까지 진행하면 세 단계만 남았습니다:",R,V,E="<li><code>TrainingArguments</code>에서 훈련 하이퍼파라미터를 정의하세요. <code>output_dir</code>은 유일한 필수 매개변수로, 모델을 저장할 위치를 지정합니다. (먼저 Hugging Face에 로그인 필수) <code>push_to_hub=True</code>로 설정하여 이 모델을 허브에 업로드할 수 있습니다.</li> <li>훈련 인수를 <code>Trainer</code>에 모델, 데이터 세트 및 데이터 콜레이터와 함께 전달하세요.</li> <li><code>train()</code>을 호출하여 모델을 미세 조정하세요.</li>",C,k,G,i,_="훈련이 완료되면 <code>evaluate()</code> 메소드를 사용하여 모델을 평가하고 퍼플렉서티를 얻을 수 있습니다:",z,A,F,q,P="그런 다음 <code>push_to_hub()</code> 메소드를 사용하여 모델을 허브에 공유하세요. 이렇게 하면 누구나 모델을 사용할 수 있습니다:",H,Y,N;return s=new es({props:{$$slots:{default:[Ss]},$$scope:{ctx:U}}}),u=new v({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTJDJTIwVHJhaW5pbmdBcmd1bWVudHMlMkMlMjBUcmFpbmVyJTBBJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JDYXVzYWxMTS5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsZ3B0MiUyMik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM, TrainingArguments, Trainer

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;distilgpt2&quot;</span>)`}}),k=new v({props:{code:"dHJhaW5pbmdfYXJncyUyMCUzRCUyMFRyYWluaW5nQXJndW1lbnRzKCUwQSUyMCUyMCUyMCUyMG91dHB1dF9kaXIlM0QlMjJteV9hd2Vzb21lX2VsaTVfY2xtLW1vZGVsJTIyJTJDJTBBJTIwJTIwJTIwJTIwZXZhbHVhdGlvbl9zdHJhdGVneSUzRCUyMmVwb2NoJTIyJTJDJTBBJTIwJTIwJTIwJTIwbGVhcm5pbmdfcmF0ZSUzRDJlLTUlMkMlMEElMjAlMjAlMjAlMjB3ZWlnaHRfZGVjYXklM0QwLjAxJTJDJTBBJTIwJTIwJTIwJTIwcHVzaF90b19odWIlM0RUcnVlJTJDJTBBKSUwQSUwQXRyYWluZXIlMjAlM0QlMjBUcmFpbmVyKCUwQSUyMCUyMCUyMCUyMG1vZGVsJTNEbW9kZWwlMkMlMEElMjAlMjAlMjAlMjBhcmdzJTNEdHJhaW5pbmdfYXJncyUyQyUwQSUyMCUyMCUyMCUyMHRyYWluX2RhdGFzZXQlM0RsbV9kYXRhc2V0JTVCJTIydHJhaW4lMjIlNUQlMkMlMEElMjAlMjAlMjAlMjBldmFsX2RhdGFzZXQlM0RsbV9kYXRhc2V0JTVCJTIydGVzdCUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMGRhdGFfY29sbGF0b3IlM0RkYXRhX2NvbGxhdG9yJTJDJTBBKSUwQSUwQXRyYWluZXIudHJhaW4oKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>training_args = TrainingArguments(
<span class="hljs-meta">... </span>    output_dir=<span class="hljs-string">&quot;my_awesome_eli5_clm-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>    weight_decay=<span class="hljs-number">0.01</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 = Trainer(
<span class="hljs-meta">... </span>    model=model,
<span class="hljs-meta">... </span>    args=training_args,
<span class="hljs-meta">... </span>    train_dataset=lm_dataset[<span class="hljs-string">&quot;train&quot;</span>],
<span class="hljs-meta">... </span>    eval_dataset=lm_dataset[<span class="hljs-string">&quot;test&quot;</span>],
<span class="hljs-meta">... </span>    data_collator=data_collator,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.train()`}}),A=new v({props:{code:"aW1wb3J0JTIwbWF0aCUwQSUwQWV2YWxfcmVzdWx0cyUyMCUzRCUyMHRyYWluZXIuZXZhbHVhdGUoKSUwQXByaW50KGYlMjJQZXJwbGV4aXR5JTNBJTIwJTdCbWF0aC5leHAoZXZhbF9yZXN1bHRzJTVCJ2V2YWxfbG9zcyclNUQpJTNBLjJmJTdEJTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> math

<span class="hljs-meta">&gt;&gt;&gt; </span>eval_results = trainer.evaluate()
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;Perplexity: <span class="hljs-subst">{math.exp(eval_results[<span class="hljs-string">&#x27;eval_loss&#x27;</span>]):<span class="hljs-number">.2</span>f}</span>&quot;</span>)
Perplexity: <span class="hljs-number">49.61</span>`}}),Y=new v({props:{code:"dHJhaW5lci5wdXNoX3RvX2h1Yigp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.push_to_hub()'}}),{c(){M(s.$$.fragment),c=o(),a=d("p"),a.innerHTML=p,g=o(),M(u.$$.fragment),Z=o(),x=d("p"),x.textContent=W,R=o(),V=d("ol"),V.innerHTML=E,C=o(),M(k.$$.fragment),G=o(),i=d("p"),i.innerHTML=_,z=o(),M(A.$$.fragment),F=o(),q=d("p"),q.innerHTML=P,H=o(),M(Y.$$.fragment)},l(h){y(s.$$.fragment,h),c=r(h),a=f(h,"P",{"data-svelte-h":!0}),T(a)!=="svelte-lq6v0y"&&(a.innerHTML=p),g=r(h),y(u.$$.fragment,h),Z=r(h),x=f(h,"P",{"data-svelte-h":!0}),T(x)!=="svelte-scyina"&&(x.textContent=W),R=r(h),V=f(h,"OL",{"data-svelte-h":!0}),T(V)!=="svelte-zqr9wu"&&(V.innerHTML=E),C=r(h),y(k.$$.fragment,h),G=r(h),i=f(h,"P",{"data-svelte-h":!0}),T(i)!=="svelte-amixb4"&&(i.innerHTML=_),z=r(h),y(A.$$.fragment,h),F=r(h),q=f(h,"P",{"data-svelte-h":!0}),T(q)!=="svelte-1bxxjwl"&&(q.innerHTML=P),H=r(h),y(Y.$$.fragment,h)},m(h,I){$(s,h,I),l(h,c,I),l(h,a,I),l(h,g,I),$(u,h,I),l(h,Z,I),l(h,x,I),l(h,R,I),l(h,V,I),l(h,C,I),$(k,h,I),l(h,G,I),l(h,i,I),l(h,z,I),$(A,h,I),l(h,F,I),l(h,q,I),l(h,H,I),$(Y,h,I),N=!0},p(h,I){const L={};I&2&&(L.$$scope={dirty:I,ctx:h}),s.$set(L)},i(h){N||(b(s.$$.fragment,h),b(u.$$.fragment,h),b(k.$$.fragment,h),b(A.$$.fragment,h),b(Y.$$.fragment,h),N=!0)},o(h){j(s.$$.fragment,h),j(u.$$.fragment,h),j(k.$$.fragment,h),j(A.$$.fragment,h),j(Y.$$.fragment,h),N=!1},d(h){h&&(t(c),t(a),t(g),t(Z),t(x),t(R),t(V),t(C),t(G),t(i),t(z),t(F),t(q),t(H)),w(s,h),w(u,h),w(k,h),w(A,h),w(Y,h)}}}function Ds(U){let s,c;return s=new tt({props:{$$slots:{default:[Ps]},$$scope:{ctx:U}}}),{c(){M(s.$$.fragment)},l(a){y(s.$$.fragment,a)},m(a,p){$(s,a,p),c=!0},p(a,p){const g={};p&2&&(g.$$scope={dirty:p,ctx:a}),s.$set(g)},i(a){c||(b(s.$$.fragment,a),c=!0)},o(a){j(s.$$.fragment,a),c=!1},d(a){w(s,a)}}}function Ks(U){let s,c='Keras를 사용하여 모델을 미세 조정하는 방법에 익숙하지 않다면 <a href="../training#train-a-tensorflow-model-with-keras">기본 튜토리얼</a>을 확인해보세요!';return{c(){s=d("p"),s.innerHTML=c},l(a){s=f(a,"P",{"data-svelte-h":!0}),T(s)!=="svelte-1qjtntp"&&(s.innerHTML=c)},m(a,p){l(a,s,p)},p:ce,d(a){a&&t(s)}}}function Os(U){let s,c,a,p,g,u="그런 다음 <code>TFAutoModelForCausalLM</code>를 사용하여 DistilGPT2를 불러옵니다:",Z,x,W,R,V="<code>prepare_tf_dataset()</code>을 사용하여 데이터 세트를 <code>tf.data.Dataset</code> 형식으로 변환하세요:",E,C,k,G,i='<a href="https://keras.io/api/models/model_training_apis/#compile-method" rel="nofollow"><code>compile</code></a>을 사용하여 모델을 훈련하기 위해 구성하세요. Transformers 모델은 모두 기본적인 작업 관련 손실 함수를 가지고 있으므로, 원한다면 별도로 지정하지 않아도 됩니다:',_,z,A,F,q="<code>PushToHubCallback</code>에서 모델과 토크나이저를 업로드할 위치를 지정할 수 있습니다:",P,H,Y,N,h='마지막으로, 모델을 훈련하기 위해 <a href="https://keras.io/api/models/model_training_apis/#fit-method" rel="nofollow"><code>fit</code></a>을 호출하세요. 훈련 데이터 세트, 검증 데이터 세트, 에폭 수 및 콜백을 전달하세요:',I,L,S,D,K="훈련이 완료되면 모델이 자동으로 허브에 업로드되어 모두가 사용할 수 있습니다!",he;return s=new es({props:{$$slots:{default:[Ks]},$$scope:{ctx:U}}}),a=new v({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>)`}}),x=new v({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGQXV0b01vZGVsRm9yQ2F1c2FsTE0lMEElMEFtb2RlbCUyMCUzRCUyMFRGQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMmRpc3RpbGdwdDIlMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFAutoModelForCausalLM

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFAutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;distilgpt2&quot;</span>)`}}),C=new v({props:{code:"dGZfdHJhaW5fc2V0JTIwJTNEJTIwbW9kZWwucHJlcGFyZV90Zl9kYXRhc2V0KCUwQSUyMCUyMCUyMCUyMGxtX2RhdGFzZXQlNUIlMjJ0cmFpbiUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMHNodWZmbGUlM0RUcnVlJTJDJTBBJTIwJTIwJTIwJTIwYmF0Y2hfc2l6ZSUzRDE2JTJDJTBBJTIwJTIwJTIwJTIwY29sbGF0ZV9mbiUzRGRhdGFfY29sbGF0b3IlMkMlMEEpJTBBJTBBdGZfdGVzdF9zZXQlMjAlM0QlMjBtb2RlbC5wcmVwYXJlX3RmX2RhdGFzZXQoJTBBJTIwJTIwJTIwJTIwbG1fZGF0YXNldCU1QiUyMnRlc3QlMjIlNUQlMkMlMEElMjAlMjAlMjAlMjBzaHVmZmxlJTNERmFsc2UlMkMlMEElMjAlMjAlMjAlMjBiYXRjaF9zaXplJTNEMTYlMkMlMEElMjAlMjAlMjAlMjBjb2xsYXRlX2ZuJTNEZGF0YV9jb2xsYXRvciUyQyUwQSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>tf_train_set = model.prepare_tf_dataset(
<span class="hljs-meta">... </span>    lm_dataset[<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>    lm_dataset[<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>)`}}),z=new v({props:{code:"aW1wb3J0JTIwdGVuc29yZmxvdyUyMGFzJTIwdGYlMEElMEFtb2RlbC5jb21waWxlKG9wdGltaXplciUzRG9wdGltaXplciklMjAlMjAlMjMlMjAlRUIlQjMlODQlRUIlOEYlODQlRUIlQTElOUMlMjBsb3NzJTIwJUVDJTlEJUI4JUVDJTlFJTkwJUVCJUE1JUJDJTIwJUVCJTg0JUEzJUVDJUE3JTgwJTIwJUVDJTk1JThBJUVDJTk1JTk4JUVDJTk2JUI0JUVDJTlBJTk0IQ==",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)  <span class="hljs-comment"># 별도로 loss 인자를 넣지 않았어요!</span>`}}),H=new v({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycy5rZXJhc19jYWxsYmFja3MlMjBpbXBvcnQlMjBQdXNoVG9IdWJDYWxsYmFjayUwQSUwQWNhbGxiYWNrJTIwJTNEJTIwUHVzaFRvSHViQ2FsbGJhY2soJTBBJTIwJTIwJTIwJTIwb3V0cHV0X2RpciUzRCUyMm15X2F3ZXNvbWVfZWxpNV9jbG0tbW9kZWwlMjIlMkMlMEElMjAlMjAlMjAlMjB0b2tlbml6ZXIlM0R0b2tlbml6ZXIlMkMlMEEp",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>callback = PushToHubCallback(
<span class="hljs-meta">... </span>    output_dir=<span class="hljs-string">&quot;my_awesome_eli5_clm-model&quot;</span>,
<span class="hljs-meta">... </span>    tokenizer=tokenizer,
<span class="hljs-meta">... </span>)`}}),L=new v({props:{code:"bW9kZWwuZml0KHglM0R0Zl90cmFpbl9zZXQlMkMlMjB2YWxpZGF0aW9uX2RhdGElM0R0Zl90ZXN0X3NldCUyQyUyMGVwb2NocyUzRDMlMkMlMjBjYWxsYmFja3MlM0QlNUJjYWxsYmFjayU1RCk=",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=[callback])'}}),{c(){M(s.$$.fragment),c=Ws(`
TensorFlow에서 모델을 미세 조정하려면, 먼저 옵티마이저 함수, 학습률 스케줄 및 일부 훈련 하이퍼파라미터를 설정하세요:

	`),M(a.$$.fragment),p=o(),g=d("p"),g.innerHTML=u,Z=o(),M(x.$$.fragment),W=o(),R=d("p"),R.innerHTML=V,E=o(),M(C.$$.fragment),k=o(),G=d("p"),G.innerHTML=i,_=o(),M(z.$$.fragment),A=o(),F=d("p"),F.innerHTML=q,P=o(),M(H.$$.fragment),Y=o(),N=d("p"),N.innerHTML=h,I=o(),M(L.$$.fragment),S=o(),D=d("p"),D.textContent=K},l(m){y(s.$$.fragment,m),c=Xs(m,`
TensorFlow에서 모델을 미세 조정하려면, 먼저 옵티마이저 함수, 학습률 스케줄 및 일부 훈련 하이퍼파라미터를 설정하세요:

	`),y(a.$$.fragment,m),p=r(m),g=f(m,"P",{"data-svelte-h":!0}),T(g)!=="svelte-1xfjl2y"&&(g.innerHTML=u),Z=r(m),y(x.$$.fragment,m),W=r(m),R=f(m,"P",{"data-svelte-h":!0}),T(R)!=="svelte-57oj0z"&&(R.innerHTML=V),E=r(m),y(C.$$.fragment,m),k=r(m),G=f(m,"P",{"data-svelte-h":!0}),T(G)!=="svelte-bkxxon"&&(G.innerHTML=i),_=r(m),y(z.$$.fragment,m),A=r(m),F=f(m,"P",{"data-svelte-h":!0}),T(F)!=="svelte-6m34m7"&&(F.innerHTML=q),P=r(m),y(H.$$.fragment,m),Y=r(m),N=f(m,"P",{"data-svelte-h":!0}),T(N)!=="svelte-az37qz"&&(N.innerHTML=h),I=r(m),y(L.$$.fragment,m),S=r(m),D=f(m,"P",{"data-svelte-h":!0}),T(D)!=="svelte-avna1r"&&(D.textContent=K)},m(m,J){$(s,m,J),l(m,c,J),$(a,m,J),l(m,p,J),l(m,g,J),l(m,Z,J),$(x,m,J),l(m,W,J),l(m,R,J),l(m,E,J),$(C,m,J),l(m,k,J),l(m,G,J),l(m,_,J),$(z,m,J),l(m,A,J),l(m,F,J),l(m,P,J),$(H,m,J),l(m,Y,J),l(m,N,J),l(m,I,J),$(L,m,J),l(m,S,J),l(m,D,J),he=!0},p(m,J){const de={};J&2&&(de.$$scope={dirty:J,ctx:m}),s.$set(de)},i(m){he||(b(s.$$.fragment,m),b(a.$$.fragment,m),b(x.$$.fragment,m),b(C.$$.fragment,m),b(z.$$.fragment,m),b(H.$$.fragment,m),b(L.$$.fragment,m),he=!0)},o(m){j(s.$$.fragment,m),j(a.$$.fragment,m),j(x.$$.fragment,m),j(C.$$.fragment,m),j(z.$$.fragment,m),j(H.$$.fragment,m),j(L.$$.fragment,m),he=!1},d(m){m&&(t(c),t(p),t(g),t(Z),t(W),t(R),t(E),t(k),t(G),t(_),t(A),t(F),t(P),t(Y),t(N),t(I),t(S),t(D)),w(s,m),w(a,m),w(x,m),w(C,m),w(z,m),w(H,m),w(L,m)}}}function el(U){let s,c;return s=new tt({props:{$$slots:{default:[Os]},$$scope:{ctx:U}}}),{c(){M(s.$$.fragment)},l(a){y(s.$$.fragment,a)},m(a,p){$(s,a,p),c=!0},p(a,p){const g={};p&2&&(g.$$scope={dirty:p,ctx:a}),s.$set(g)},i(a){c||(b(s.$$.fragment,a),c=!0)},o(a){j(s.$$.fragment,a),c=!1},d(a){w(s,a)}}}function tl(U){let s,c='인과 언어 모델링을 위해 모델을 미세 조정하는 더 자세한 예제는 해당하는 <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling.ipynb" rel="nofollow">PyTorch 노트북</a> 또는 <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling-tf.ipynb" rel="nofollow">TensorFlow 노트북</a>을 참조하세요.';return{c(){s=d("p"),s.innerHTML=c},l(a){s=f(a,"P",{"data-svelte-h":!0}),T(s)!=="svelte-7gnqxq"&&(s.innerHTML=c)},m(a,p){l(a,s,p)},p:ce,d(a){a&&t(s)}}}function sl(U){let s,c="텍스트를 토큰화하고 <code>input_ids</code>를 PyTorch 텐서로 반환하세요:",a,p,g,u,Z='<code>generate()</code> 메소드를 사용하여 텍스트를 생성하세요. 생성을 제어하는 다양한 텍스트 생성 전략과 매개변수에 대한 자세한 내용은 <a href="../generation_strategies">텍스트 생성 전략</a> 페이지를 확인하세요.',x,W,R,V,E="생성된 토큰 ID를 다시 텍스트로 디코딩하세요:",C,k,G;return p=new v({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJteV9hd2Vzb21lX2VsaTVfY2xtLW1vZGVsJTIyKSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplcihwcm9tcHQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKS5pbnB1dF9pZHM=",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_eli5_clm-model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(prompt, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).input_ids`}}),W=new v({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTBBJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JDYXVzYWxMTS5mcm9tX3ByZXRyYWluZWQoJTIybXlfYXdlc29tZV9lbGk1X2NsbS1tb2RlbCUyMiklMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoaW5wdXRzJTJDJTIwbWF4X25ld190b2tlbnMlM0QxMDAlMkMlMjBkb19zYW1wbGUlM0RUcnVlJTJDJTIwdG9wX2slM0Q1MCUyQyUyMHRvcF9wJTNEMC45NSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForCausalLM

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;my_awesome_eli5_clm-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">True</span>, top_k=<span class="hljs-number">50</span>, top_p=<span class="hljs-number">0.95</span>)`}}),k=new v({props:{code:"dG9rZW5pemVyLmJhdGNoX2RlY29kZShvdXRwdXRzJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.batch_decode(outputs, skip_special_tokens=<span class="hljs-literal">True</span>)
[<span class="hljs-string">&quot;Somatic hypermutation allows the immune system to react to drugs with the ability to adapt to a different environmental situation. In other words, a system of &#x27;hypermutation&#x27; can help the immune system to adapt to a different environmental situation or in some cases even a single life. In contrast, researchers at the University of Massachusetts-Boston have found that &#x27;hypermutation&#x27; is much stronger in mice than in humans but can be found in humans, and that it&#x27;s not completely unknown to the immune system. A study on how the immune system&quot;</span>]`}}),{c(){s=d("p"),s.innerHTML=c,a=o(),M(p.$$.fragment),g=o(),u=d("p"),u.innerHTML=Z,x=o(),M(W.$$.fragment),R=o(),V=d("p"),V.textContent=E,C=o(),M(k.$$.fragment)},l(i){s=f(i,"P",{"data-svelte-h":!0}),T(s)!=="svelte-1b4fw1g"&&(s.innerHTML=c),a=r(i),y(p.$$.fragment,i),g=r(i),u=f(i,"P",{"data-svelte-h":!0}),T(u)!=="svelte-3u1s1i"&&(u.innerHTML=Z),x=r(i),y(W.$$.fragment,i),R=r(i),V=f(i,"P",{"data-svelte-h":!0}),T(V)!=="svelte-1wns5q7"&&(V.textContent=E),C=r(i),y(k.$$.fragment,i)},m(i,_){l(i,s,_),l(i,a,_),$(p,i,_),l(i,g,_),l(i,u,_),l(i,x,_),$(W,i,_),l(i,R,_),l(i,V,_),l(i,C,_),$(k,i,_),G=!0},p:ce,i(i){G||(b(p.$$.fragment,i),b(W.$$.fragment,i),b(k.$$.fragment,i),G=!0)},o(i){j(p.$$.fragment,i),j(W.$$.fragment,i),j(k.$$.fragment,i),G=!1},d(i){i&&(t(s),t(a),t(g),t(u),t(x),t(R),t(V),t(C)),w(p,i),w(W,i),w(k,i)}}}function ll(U){let s,c;return s=new tt({props:{$$slots:{default:[sl]},$$scope:{ctx:U}}}),{c(){M(s.$$.fragment)},l(a){y(s.$$.fragment,a)},m(a,p){$(s,a,p),c=!0},p(a,p){const g={};p&2&&(g.$$scope={dirty:p,ctx:a}),s.$set(g)},i(a){c||(b(s.$$.fragment,a),c=!0)},o(a){j(s.$$.fragment,a),c=!1},d(a){w(s,a)}}}function al(U){let s,c="텍스트를 토큰화하고 <code>input_ids</code>를 TensorFlow 텐서로 반환하세요:",a,p,g,u,Z='<code>generate()</code> 메소드를 사용하여 요약을 생성하세요. 생성을 제어하는 다양한 텍스트 생성 전략과 매개변수에 대한 자세한 내용은 <a href="../generation_strategies">텍스트 생성 전략</a> 페이지를 확인하세요.',x,W,R,V,E="생성된 토큰 ID를 다시 텍스트로 디코딩하세요:",C,k,G;return p=new v({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJteV9hd2Vzb21lX2VsaTVfY2xtLW1vZGVsJTIyKSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplcihwcm9tcHQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnRmJTIyKS5pbnB1dF9pZHM=",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_eli5_clm-model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(prompt, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>).input_ids`}}),W=new v({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGQXV0b01vZGVsRm9yQ2F1c2FsTE0lMEElMEFtb2RlbCUyMCUzRCUyMFRGQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMm15X2F3ZXNvbWVfZWxpNV9jbG0tbW9kZWwlMjIpJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKGlucHV0X2lkcyUzRGlucHV0cyUyQyUyMG1heF9uZXdfdG9rZW5zJTNEMTAwJTJDJTIwZG9fc2FtcGxlJTNEVHJ1ZSUyQyUyMHRvcF9rJTNENTAlMkMlMjB0b3BfcCUzRDAuOTUp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFAutoModelForCausalLM

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFAutoModelForCausalLM.from_pretrained(<span class="hljs-string">&quot;my_awesome_eli5_clm-model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model.generate(input_ids=inputs, max_new_tokens=<span class="hljs-number">100</span>, do_sample=<span class="hljs-literal">True</span>, top_k=<span class="hljs-number">50</span>, top_p=<span class="hljs-number">0.95</span>)`}}),k=new v({props:{code:"dG9rZW5pemVyLmJhdGNoX2RlY29kZShvdXRwdXRzJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.batch_decode(outputs, skip_special_tokens=<span class="hljs-literal">True</span>)
[<span class="hljs-string">&#x27;Somatic hypermutation allows the immune system to detect the presence of other viruses as they become more prevalent. Therefore, researchers have identified a high proportion of human viruses. The proportion of virus-associated viruses in our study increases with age. Therefore, we propose a simple algorithm to detect the presence of these new viruses in our samples as a sign of improved immunity. A first study based on this algorithm, which will be published in Science on Friday, aims to show that this finding could translate into the development of a better vaccine that is more effective for&#x27;</span>]`}}),{c(){s=d("p"),s.innerHTML=c,a=o(),M(p.$$.fragment),g=o(),u=d("p"),u.innerHTML=Z,x=o(),M(W.$$.fragment),R=o(),V=d("p"),V.textContent=E,C=o(),M(k.$$.fragment)},l(i){s=f(i,"P",{"data-svelte-h":!0}),T(s)!=="svelte-jhzp8k"&&(s.innerHTML=c),a=r(i),y(p.$$.fragment,i),g=r(i),u=f(i,"P",{"data-svelte-h":!0}),T(u)!=="svelte-170xtje"&&(u.innerHTML=Z),x=r(i),y(W.$$.fragment,i),R=r(i),V=f(i,"P",{"data-svelte-h":!0}),T(V)!=="svelte-1wns5q7"&&(V.textContent=E),C=r(i),y(k.$$.fragment,i)},m(i,_){l(i,s,_),l(i,a,_),$(p,i,_),l(i,g,_),l(i,u,_),l(i,x,_),$(W,i,_),l(i,R,_),l(i,V,_),l(i,C,_),$(k,i,_),G=!0},p:ce,i(i){G||(b(p.$$.fragment,i),b(W.$$.fragment,i),b(k.$$.fragment,i),G=!0)},o(i){j(p.$$.fragment,i),j(W.$$.fragment,i),j(k.$$.fragment,i),G=!1},d(i){i&&(t(s),t(a),t(g),t(u),t(x),t(R),t(V),t(C)),w(p,i),w(W,i),w(k,i)}}}function nl(U){let s,c;return s=new tt({props:{$$slots:{default:[al]},$$scope:{ctx:U}}}),{c(){M(s.$$.fragment)},l(a){y(s.$$.fragment,a)},m(a,p){$(s,a,p),c=!0},p(a,p){const g={};p&2&&(g.$$scope={dirty:p,ctx:a}),s.$set(g)},i(a){c||(b(s.$$.fragment,a),c=!0)},o(a){j(s.$$.fragment,a),c=!1},d(a){w(s,a)}}}function pl(U){let s,c,a,p,g,u,Z,x,W,R,V="인과 언어 모델링",E,C,k,G,i=`언어 모델링은 인과적 언어 모델링과 마스크드 언어 모델링, 두 가지 유형으로 나뉩니다. 이 가이드에서는 인과적 언어 모델링을 설명합니다.
인과 언어 모델은 텍스트 생성에 자주 사용됩니다. 또 창의적인 방향으로 응용할 수 있습니다.
직접 사용하며 재미있는 탐구를 해보거나, Copilot 또는 CodeParrot와 같은 지능형 코딩 어시스턴트의 기반이 되기도 합니다.`,_,z,A,F,q=`인과 언어 모델링은 토큰 시퀀스에서 다음 토큰을 예측하며, 모델은 왼쪽의 토큰에만 접근할 수 있습니다.
이는 모델이 미래의 토큰을 볼 수 없다는 것을 의미합니다. 인과 언어 모델의 예로 GPT-2가 있죠.`,P,H,Y="이 가이드에서는 다음 작업을 수행하는 방법을 안내합니다:",N,h,I='<li><a href="https://huggingface.co/distilgpt2" rel="nofollow">DistilGPT2</a> 모델을 <a href="https://huggingface.co/datasets/eli5" rel="nofollow">ELI5</a> 데이터 세트의 <a href="https://www.reddit.com/r/askscience/" rel="nofollow">r/askscience</a> 하위 집합으로 미세 조정</li> <li>미세 조정된 모델을 추론에 사용</li>',L,S,D,K,he="시작하기 전에 필요한 라이브러리가 모두 설치되어 있는지 확인하세요:",m,J,de,fe,ps="커뮤니티에 모델을 업로드하고 공유하기 위해 Hugging Face 계정에 로그인하는 것을 권장합니다. 알림이 표시되면 토큰을 입력하여 로그인하세요:",ct,ue,ht,O,le,st,ge,ts,De,os="ELI5 데이터 세트 불러오기",dt,Me,rs=`먼저, 🤗 Datasets 라이브러리에서 r/askscience의 작은 하위 집합인 ELI5 데이터 세트를 불러옵니다.
이를 통해 전체 데이터 세트에서 학습하는 데 더 많은 시간을 투자하기 전에, 실험해봄으로써 모든 것이 작동하는지 확인할 수 있습니다.`,ft,ye,ut,$e,is="데이터 세트의 <code>train_asks</code> 분할을 <code>train_test_split</code> 메소드를 사용하여 학습 및 테스트 세트로 분할합니다:",gt,be,Mt,je,ms="그런 다음 예제를 살펴보세요:",yt,we,$t,Te,cs="많아 보일 수 있지만, 실제로는 <code>text</code> 필드만 중요합니다. 언어 모델링 작업의 장점은 레이블이 필요하지 않다는 것입니다. 다음 단어 <em>자체가</em> 레이블입니다. (이렇게 레이블을 제공하지 않아도 되는 학습을 비지도 학습이라고 일컫습니다)",bt,ee,ae,lt,_e,ss,Ke,hs="전처리",jt,Je,wt,xe,ds="다음 단계는 <code>text</code> 필드를 전처리하기 위해 DistilGPT2 토크나이저를 불러오는 것입니다.",Tt,ke,_t,Ue,fs='위의 예제에서 알 수 있듯이, <code>text</code> 필드는 <code>answers</code> 아래에 중첩되어 있습니다. 따라서 <a href="https://huggingface.co/docs/datasets/process.html#flatten" rel="nofollow"><code>flatten</code></a> 메소드를 사용하여 중첩 구조에서 <code>text</code> 하위 필드를 추출해야 합니다.',Jt,ve,xt,Ce,us="각 하위 필드는 이제 <code>answers</code> 접두사를 가진 별도의 열로 나뉘었으며, <code>text</code> 필드는 이제 리스트입니다. 각 문장을 개별적으로 토큰화하는 대신, 먼저 리스트를 문자열로 변환하여 한꺼번에 토큰화할 수 있습니다.",kt,Ge,gs="다음은 문자열 리스트를 결합하고 결과를 토큰화하는 첫 번째 전처리 함수입니다:",Ut,Ie,vt,Ze,Ms="이 전처리 함수를 전체 데이터 세트에 적용하려면 🤗 Datasets <code>map</code> 메소드를 사용하세요. <code>batched=True</code>로 설정하여 데이터셋의 여러 요소를 한 번에 처리하고, <code>num_proc</code>를 증가시켜 프로세스 수를 늘릴 수 있습니다. 필요 없는 열은 제거하세요:",Ct,Re,Gt,Ve,ys="이제 데이터 세트는 시퀀스가 토큰화됐지만, 일부 시퀀스는 모델의 최대 입력 길이보다 길 수 있습니다.",It,We,$s="이제 두 번째 전처리 함수를 사용하여",Zt,Xe,bs="<li>모든 시퀀스를 연결하고,</li> <li><code>block_size</code>로 정의된 길이로 연결된 시퀀스를 여러 개의 짧은 묶음으로 나눕니다. 이 값은 최대 입력 길이와 GPU RAM을 고려해 충분히 짧아야 합니다.</li>",Rt,Be,Vt,ze,js="전체 데이터 세트에 <code>group_texts</code> 함수를 적용하세요:",Wt,Fe,Xt,He,ws="그런 다음 <code>DataCollatorForLanguageModeling</code>을 사용하여 예제의 배치를 만듭니다. 데이터 세트 전체를 최대 길이로 패딩하는 것보다, 취합 단계에서 각 배치의 최대 길이로 문장을 <em>동적으로 패딩</em>하는 것이 더 효율적입니다.",Bt,ne,zt,te,pe,at,Ee,ls,Oe,Ts="훈련",Ft,oe,Ht,re,Et,se,ie,nt,Ae,as,et,_s="추론",At,Ne,Js="좋아요, 이제 모델을 미세 조정했으므로 추론에 사용할 수 있습니다!",Nt,Qe,xs="생성할 텍스트를 위한 프롬프트를 만들어보세요:",Qt,Ye,Yt,Le,ks="추론을 위해 미세 조정된 모델을 간단히 사용하는 가장 간단한 방법은 <code>pipeline()</code>에서 사용하는 것입니다. 모델과 함께 텍스트 생성을 위한 <code>pipeline</code>을 인스턴스화하고 텍스트를 전달하세요:",Lt,qe,qt,me,St,pt,Pt;return x=new mt({}),C=new As({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/language_modeling.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/ko/pytorch/language_modeling.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/ko/tensorflow/language_modeling.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ko/language_modeling.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ko/pytorch/language_modeling.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ko/tensorflow/language_modeling.ipynb"}]}}),z=new Vs({props:{id:"Vpjb1lu0MDk"}}),S=new es({props:{$$slots:{default:[Ns]},$$scope:{ctx:U}}}),J=new v({props:{code:"cGlwJTIwaW5zdGFsbCUyMHRyYW5zZm9ybWVycyUyMGRhdGFzZXRzJTIwZXZhbHVhdGU=",highlighted:"pip install transformers datasets evaluate"}}),ue=new v({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()`}}),ge=new mt({}),ye=new v({props:{code:"ZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBJTBBZWxpNSUyMCUzRCUyMGxvYWRfZGF0YXNldCglMjJlbGk1JTIyJTJDJTIwc3BsaXQlM0QlMjJ0cmFpbl9hc2tzJTVCJTNBNTAwMCU1RCUyMik=",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>eli5 = load_dataset(<span class="hljs-string">&quot;eli5&quot;</span>, split=<span class="hljs-string">&quot;train_asks[:5000]&quot;</span>)`}}),be=new v({props:{code:"ZWxpNSUyMCUzRCUyMGVsaTUudHJhaW5fdGVzdF9zcGxpdCh0ZXN0X3NpemUlM0QwLjIp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>eli5 = eli5.train_test_split(test_size=<span class="hljs-number">0.2</span>)'}}),we=new v({props:{code:"ZWxpNSU1QiUyMnRyYWluJTIyJTVEJTVCMCU1RA==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>eli5[<span class="hljs-string">&quot;train&quot;</span>][<span class="hljs-number">0</span>]
{<span class="hljs-string">&#x27;answers&#x27;</span>: {<span class="hljs-string">&#x27;a_id&#x27;</span>: [<span class="hljs-string">&#x27;c3d1aib&#x27;</span>, <span class="hljs-string">&#x27;c3d4lya&#x27;</span>],
  <span class="hljs-string">&#x27;score&#x27;</span>: [<span class="hljs-number">6</span>, <span class="hljs-number">3</span>],
  <span class="hljs-string">&#x27;text&#x27;</span>: [<span class="hljs-string">&quot;The velocity needed to remain in orbit is equal to the square root of Newton&#x27;s constant times the mass of earth divided by the distance from the center of the earth. I don&#x27;t know the altitude of that specific mission, but they&#x27;re usually around 300 km. That means he&#x27;s going 7-8 km/s.\\n\\nIn space there are no other forces acting on either the shuttle or the guy, so they stay in the same position relative to each other. If he were to become unable to return to the ship, he would presumably run out of oxygen, or slowly fall into the atmosphere and burn up.&quot;</span>,
   <span class="hljs-string">&quot;Hope you don&#x27;t mind me asking another question, but why aren&#x27;t there any stars visible in this photo?&quot;</span>]},
 <span class="hljs-string">&#x27;answers_urls&#x27;</span>: {<span class="hljs-string">&#x27;url&#x27;</span>: []},
 <span class="hljs-string">&#x27;document&#x27;</span>: <span class="hljs-string">&#x27;&#x27;</span>,
 <span class="hljs-string">&#x27;q_id&#x27;</span>: <span class="hljs-string">&#x27;nyxfp&#x27;</span>,
 <span class="hljs-string">&#x27;selftext&#x27;</span>: <span class="hljs-string">&#x27;_URL_0_\\n\\nThis was on the front page earlier and I have a few questions about it. Is it possible to calculate how fast the astronaut would be orbiting the earth? Also how does he stay close to the shuttle so that he can return safely, i.e is he orbiting at the same speed and can therefore stay next to it? And finally if his propulsion system failed, would he eventually re-enter the atmosphere and presumably die?&#x27;</span>,
 <span class="hljs-string">&#x27;selftext_urls&#x27;</span>: {<span class="hljs-string">&#x27;url&#x27;</span>: [<span class="hljs-string">&#x27;http://apod.nasa.gov/apod/image/1201/freeflyer_nasa_3000.jpg&#x27;</span>]},
 <span class="hljs-string">&#x27;subreddit&#x27;</span>: <span class="hljs-string">&#x27;askscience&#x27;</span>,
 <span class="hljs-string">&#x27;title&#x27;</span>: <span class="hljs-string">&#x27;Few questions about this space walk photograph.&#x27;</span>,
 <span class="hljs-string">&#x27;title_urls&#x27;</span>: {<span class="hljs-string">&#x27;url&#x27;</span>: []}}`}}),_e=new mt({}),Je=new Vs({props:{id:"ma1TrR7gE7I"}}),ke=new v({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJkaXN0aWxncHQyJTIyKQ==",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;distilgpt2&quot;</span>)`}}),ve=new v({props:{code:"ZWxpNSUyMCUzRCUyMGVsaTUuZmxhdHRlbigpJTBBZWxpNSU1QiUyMnRyYWluJTIyJTVEJTVCMCU1RA==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>eli5 = eli5.flatten()
<span class="hljs-meta">&gt;&gt;&gt; </span>eli5[<span class="hljs-string">&quot;train&quot;</span>][<span class="hljs-number">0</span>]
{<span class="hljs-string">&#x27;answers.a_id&#x27;</span>: [<span class="hljs-string">&#x27;c3d1aib&#x27;</span>, <span class="hljs-string">&#x27;c3d4lya&#x27;</span>],
 <span class="hljs-string">&#x27;answers.score&#x27;</span>: [<span class="hljs-number">6</span>, <span class="hljs-number">3</span>],
 <span class="hljs-string">&#x27;answers.text&#x27;</span>: [<span class="hljs-string">&quot;The velocity needed to remain in orbit is equal to the square root of Newton&#x27;s constant times the mass of earth divided by the distance from the center of the earth. I don&#x27;t know the altitude of that specific mission, but they&#x27;re usually around 300 km. That means he&#x27;s going 7-8 km/s.\\n\\nIn space there are no other forces acting on either the shuttle or the guy, so they stay in the same position relative to each other. If he were to become unable to return to the ship, he would presumably run out of oxygen, or slowly fall into the atmosphere and burn up.&quot;</span>,
  <span class="hljs-string">&quot;Hope you don&#x27;t mind me asking another question, but why aren&#x27;t there any stars visible in this photo?&quot;</span>],
 <span class="hljs-string">&#x27;answers_urls.url&#x27;</span>: [],
 <span class="hljs-string">&#x27;document&#x27;</span>: <span class="hljs-string">&#x27;&#x27;</span>,
 <span class="hljs-string">&#x27;q_id&#x27;</span>: <span class="hljs-string">&#x27;nyxfp&#x27;</span>,
 <span class="hljs-string">&#x27;selftext&#x27;</span>: <span class="hljs-string">&#x27;_URL_0_\\n\\nThis was on the front page earlier and I have a few questions about it. Is it possible to calculate how fast the astronaut would be orbiting the earth? Also how does he stay close to the shuttle so that he can return safely, i.e is he orbiting at the same speed and can therefore stay next to it? And finally if his propulsion system failed, would he eventually re-enter the atmosphere and presumably die?&#x27;</span>,
 <span class="hljs-string">&#x27;selftext_urls.url&#x27;</span>: [<span class="hljs-string">&#x27;http://apod.nasa.gov/apod/image/1201/freeflyer_nasa_3000.jpg&#x27;</span>],
 <span class="hljs-string">&#x27;subreddit&#x27;</span>: <span class="hljs-string">&#x27;askscience&#x27;</span>,
 <span class="hljs-string">&#x27;title&#x27;</span>: <span class="hljs-string">&#x27;Few questions about this space walk photograph.&#x27;</span>,
 <span class="hljs-string">&#x27;title_urls.url&#x27;</span>: []}`}}),Ie=new v({props:{code:"ZGVmJTIwcHJlcHJvY2Vzc19mdW5jdGlvbihleGFtcGxlcyklM0ElMEElMjAlMjAlMjAlMjByZXR1cm4lMjB0b2tlbml6ZXIoJTVCJTIyJTIwJTIyLmpvaW4oeCklMjBmb3IlMjB4JTIwaW4lMjBleGFtcGxlcyU1QiUyMmFuc3dlcnMudGV4dCUyMiU1RCU1RCk=",highlighted:`<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>    <span class="hljs-keyword">return</span> tokenizer([<span class="hljs-string">&quot; &quot;</span>.join(x) <span class="hljs-keyword">for</span> x <span class="hljs-keyword">in</span> examples[<span class="hljs-string">&quot;answers.text&quot;</span>]])`}}),Re=new v({props:{code:"dG9rZW5pemVkX2VsaTUlMjAlM0QlMjBlbGk1Lm1hcCglMEElMjAlMjAlMjAlMjBwcmVwcm9jZXNzX2Z1bmN0aW9uJTJDJTBBJTIwJTIwJTIwJTIwYmF0Y2hlZCUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjBudW1fcHJvYyUzRDQlMkMlMEElMjAlMjAlMjAlMjByZW1vdmVfY29sdW1ucyUzRGVsaTUlNUIlMjJ0cmFpbiUyMiU1RC5jb2x1bW5fbmFtZXMlMkMlMEEp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>tokenized_eli5 = eli5.<span class="hljs-built_in">map</span>(
<span class="hljs-meta">... </span>    preprocess_function,
<span class="hljs-meta">... </span>    batched=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>    num_proc=<span class="hljs-number">4</span>,
<span class="hljs-meta">... </span>    remove_columns=eli5[<span class="hljs-string">&quot;train&quot;</span>].column_names,
<span class="hljs-meta">... </span>)`}}),Be=new v({props:{code:"YmxvY2tfc2l6ZSUyMCUzRCUyMDEyOCUwQSUwQSUwQWRlZiUyMGdyb3VwX3RleHRzKGV4YW1wbGVzKSUzQSUwQSUyMCUyMCUyMCUyMCUyMyUyMENvbmNhdGVuYXRlJTIwYWxsJTIwdGV4dHMuJTBBJTIwJTIwJTIwJTIwY29uY2F0ZW5hdGVkX2V4YW1wbGVzJTIwJTNEJTIwJTdCayUzQSUyMHN1bShleGFtcGxlcyU1QmslNUQlMkMlMjAlNUIlNUQpJTIwZm9yJTIwayUyMGluJTIwZXhhbXBsZXMua2V5cygpJTdEJTBBJTIwJTIwJTIwJTIwdG90YWxfbGVuZ3RoJTIwJTNEJTIwbGVuKGNvbmNhdGVuYXRlZF9leGFtcGxlcyU1Qmxpc3QoZXhhbXBsZXMua2V5cygpKSU1QjAlNUQlNUQpJTBBJTIwJTIwJTIwJTIwJTIzJTIwV2UlMjBkcm9wJTIwdGhlJTIwc21hbGwlMjByZW1haW5kZXIlMkMlMjB3ZSUyMGNvdWxkJTIwYWRkJTIwcGFkZGluZyUyMGlmJTIwdGhlJTIwbW9kZWwlMjBzdXBwb3J0ZWQlMjBpdCUyMGluc3RlYWQlMjBvZiUyMHRoaXMlMjBkcm9wJTJDJTIweW91JTIwY2FuJTBBJTIwJTIwJTIwJTIwJTIzJTIwY3VzdG9taXplJTIwdGhpcyUyMHBhcnQlMjB0byUyMHlvdXIlMjBuZWVkcy4lMEElMjAlMjAlMjAlMjBpZiUyMHRvdGFsX2xlbmd0aCUyMCUzRSUzRCUyMGJsb2NrX3NpemUlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjB0b3RhbF9sZW5ndGglMjAlM0QlMjAodG90YWxfbGVuZ3RoJTIwJTJGJTJGJTIwYmxvY2tfc2l6ZSklMjAqJTIwYmxvY2tfc2l6ZSUwQSUyMCUyMCUyMCUyMCUyMyUyMFNwbGl0JTIwYnklMjBjaHVua3MlMjBvZiUyMGJsb2NrX3NpemUuJTBBJTIwJTIwJTIwJTIwcmVzdWx0JTIwJTNEJTIwJTdCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwayUzQSUyMCU1QnQlNUJpJTIwJTNBJTIwaSUyMCUyQiUyMGJsb2NrX3NpemUlNUQlMjBmb3IlMjBpJTIwaW4lMjByYW5nZSgwJTJDJTIwdG90YWxfbGVuZ3RoJTJDJTIwYmxvY2tfc2l6ZSklNUQlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBmb3IlMjBrJTJDJTIwdCUyMGluJTIwY29uY2F0ZW5hdGVkX2V4YW1wbGVzLml0ZW1zKCklMEElMjAlMjAlMjAlMjAlN0QlMEElMjAlMjAlMjAlMjByZXN1bHQlNUIlMjJsYWJlbHMlMjIlNUQlMjAlM0QlMjByZXN1bHQlNUIlMjJpbnB1dF9pZHMlMjIlNUQuY29weSgpJTBBJTIwJTIwJTIwJTIwcmV0dXJuJTIwcmVzdWx0",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>block_size = <span class="hljs-number">128</span>


<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">def</span> <span class="hljs-title function_">group_texts</span>(<span class="hljs-params">examples</span>):
<span class="hljs-meta">... </span>    <span class="hljs-comment"># Concatenate all texts.</span>
<span class="hljs-meta">... </span>    concatenated_examples = {k: <span class="hljs-built_in">sum</span>(examples[k], []) <span class="hljs-keyword">for</span> k <span class="hljs-keyword">in</span> examples.keys()}
<span class="hljs-meta">... </span>    total_length = <span class="hljs-built_in">len</span>(concatenated_examples[<span class="hljs-built_in">list</span>(examples.keys())[<span class="hljs-number">0</span>]])
<span class="hljs-meta">... </span>    <span class="hljs-comment"># We drop the small remainder, we could add padding if the model supported it instead of this drop, you can</span>
<span class="hljs-meta">... </span>    <span class="hljs-comment"># customize this part to your needs.</span>
<span class="hljs-meta">... </span>    <span class="hljs-keyword">if</span> total_length &gt;= block_size:
<span class="hljs-meta">... </span>        total_length = (total_length // block_size) * block_size
<span class="hljs-meta">... </span>    <span class="hljs-comment"># Split by chunks of block_size.</span>
<span class="hljs-meta">... </span>    result = {
<span class="hljs-meta">... </span>        k: [t[i : i + block_size] <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> <span class="hljs-built_in">range</span>(<span class="hljs-number">0</span>, total_length, block_size)]
<span class="hljs-meta">... </span>        <span class="hljs-keyword">for</span> k, t <span class="hljs-keyword">in</span> concatenated_examples.items()
<span class="hljs-meta">... </span>    }
<span class="hljs-meta">... </span>    result[<span class="hljs-string">&quot;labels&quot;</span>] = result[<span class="hljs-string">&quot;input_ids&quot;</span>].copy()
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> result`}}),Fe=new v({props:{code:"bG1fZGF0YXNldCUyMCUzRCUyMHRva2VuaXplZF9lbGk1Lm1hcChncm91cF90ZXh0cyUyQyUyMGJhdGNoZWQlM0RUcnVlJTJDJTIwbnVtX3Byb2MlM0Q0KQ==",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>lm_dataset = tokenized_eli5.<span class="hljs-built_in">map</span>(group_texts, batched=<span class="hljs-literal">True</span>, num_proc=<span class="hljs-number">4</span>)'}}),ne=new ns({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[qs],pytorch:[Ys]},$$scope:{ctx:U}}}),Ee=new mt({}),oe=new ns({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[el],pytorch:[Ds]},$$scope:{ctx:U}}}),re=new es({props:{$$slots:{default:[tl]},$$scope:{ctx:U}}}),Ae=new mt({}),Ye=new v({props:{code:"cHJvbXB0JTIwJTNEJTIwJTIyU29tYXRpYyUyMGh5cGVybXV0YXRpb24lMjBhbGxvd3MlMjB0aGUlMjBpbW11bmUlMjBzeXN0ZW0lMjB0byUyMg==",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;Somatic hypermutation allows the immune system to&quot;</span>'}}),qe=new v({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBZ2VuZXJhdG9yJTIwJTNEJTIwcGlwZWxpbmUoJTIydGV4dC1nZW5lcmF0aW9uJTIyJTJDJTIwbW9kZWwlM0QlMjJteV9hd2Vzb21lX2VsaTVfY2xtLW1vZGVsJTIyKSUwQWdlbmVyYXRvcihwcm9tcHQp",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>generator = pipeline(<span class="hljs-string">&quot;text-generation&quot;</span>, model=<span class="hljs-string">&quot;my_awesome_eli5_clm-model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>generator(prompt)
[{<span class="hljs-string">&#x27;generated_text&#x27;</span>: <span class="hljs-string">&quot;Somatic hypermutation allows the immune system to be able to effectively reverse the damage caused by an infection.\\n\\n\\nThe damage caused by an infection is caused by the immune system&#x27;s ability to perform its own self-correcting tasks.&quot;</span>}]`}}),me=new ns({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[nl],pytorch:[ll]},$$scope:{ctx:U}}}),{c(){s=d("meta"),c=o(),a=d("p"),p=o(),g=d("h1"),u=d("a"),Z=d("span"),M(x.$$.fragment),W=o(),R=d("span"),R.textContent=V,E=o(),M(C.$$.fragment),k=o(),G=d("p"),G.textContent=i,_=o(),M(z.$$.fragment),A=o(),F=d("p"),F.textContent=q,P=o(),H=d("p"),H.textContent=Y,N=o(),h=d("ol"),h.innerHTML=I,L=o(),M(S.$$.fragment),D=o(),K=d("p"),K.textContent=he,m=o(),M(J.$$.fragment),de=o(),fe=d("p"),fe.textContent=ps,ct=o(),M(ue.$$.fragment),ht=o(),O=d("h2"),le=d("a"),st=d("span"),M(ge.$$.fragment),ts=o(),De=d("span"),De.textContent=os,dt=o(),Me=d("p"),Me.textContent=rs,ft=o(),M(ye.$$.fragment),ut=o(),$e=d("p"),$e.innerHTML=is,gt=o(),M(be.$$.fragment),Mt=o(),je=d("p"),je.textContent=ms,yt=o(),M(we.$$.fragment),$t=o(),Te=d("p"),Te.innerHTML=cs,bt=o(),ee=d("h2"),ae=d("a"),lt=d("span"),M(_e.$$.fragment),ss=o(),Ke=d("span"),Ke.textContent=hs,jt=o(),M(Je.$$.fragment),wt=o(),xe=d("p"),xe.innerHTML=ds,Tt=o(),M(ke.$$.fragment),_t=o(),Ue=d("p"),Ue.innerHTML=fs,Jt=o(),M(ve.$$.fragment),xt=o(),Ce=d("p"),Ce.innerHTML=us,kt=o(),Ge=d("p"),Ge.textContent=gs,Ut=o(),M(Ie.$$.fragment),vt=o(),Ze=d("p"),Ze.innerHTML=Ms,Ct=o(),M(Re.$$.fragment),Gt=o(),Ve=d("p"),Ve.textContent=ys,It=o(),We=d("p"),We.textContent=$s,Zt=o(),Xe=d("ul"),Xe.innerHTML=bs,Rt=o(),M(Be.$$.fragment),Vt=o(),ze=d("p"),ze.innerHTML=js,Wt=o(),M(Fe.$$.fragment),Xt=o(),He=d("p"),He.innerHTML=ws,Bt=o(),M(ne.$$.fragment),zt=o(),te=d("h2"),pe=d("a"),at=d("span"),M(Ee.$$.fragment),ls=o(),Oe=d("span"),Oe.textContent=Ts,Ft=o(),M(oe.$$.fragment),Ht=o(),M(re.$$.fragment),Et=o(),se=d("h2"),ie=d("a"),nt=d("span"),M(Ae.$$.fragment),as=o(),et=d("span"),et.textContent=_s,At=o(),Ne=d("p"),Ne.textContent=Js,Nt=o(),Qe=d("p"),Qe.textContent=xs,Qt=o(),M(Ye.$$.fragment),Yt=o(),Le=d("p"),Le.innerHTML=ks,Lt=o(),M(qe.$$.fragment),qt=o(),M(me.$$.fragment),St=o(),pt=d("p"),this.h()},l(e){const n=Es("svelte-1phssyn",document.head);s=f(n,"META",{name:!0,content:!0}),n.forEach(t),c=r(e),a=f(e,"P",{}),Q(a).forEach(t),p=r(e),g=f(e,"H1",{class:!0});var Se=Q(g);u=f(Se,"A",{id:!0,class:!0,href:!0});var ot=Q(u);Z=f(ot,"SPAN",{});var rt=Q(Z);y(x.$$.fragment,rt),rt.forEach(t),ot.forEach(t),W=r(Se),R=f(Se,"SPAN",{"data-svelte-h":!0}),T(R)!=="svelte-1hvvhyg"&&(R.textContent=V),Se.forEach(t),E=r(e),y(C.$$.fragment,e),k=r(e),G=f(e,"P",{"data-svelte-h":!0}),T(G)!=="svelte-zdtuex"&&(G.textContent=i),_=r(e),y(z.$$.fragment,e),A=r(e),F=f(e,"P",{"data-svelte-h":!0}),T(F)!=="svelte-611b95"&&(F.textContent=q),P=r(e),H=f(e,"P",{"data-svelte-h":!0}),T(H)!=="svelte-x18r2q"&&(H.textContent=Y),N=r(e),h=f(e,"OL",{"data-svelte-h":!0}),T(h)!=="svelte-cwdzqr"&&(h.innerHTML=I),L=r(e),y(S.$$.fragment,e),D=r(e),K=f(e,"P",{"data-svelte-h":!0}),T(K)!=="svelte-1k0z9pm"&&(K.textContent=he),m=r(e),y(J.$$.fragment,e),de=r(e),fe=f(e,"P",{"data-svelte-h":!0}),T(fe)!=="svelte-tqxze0"&&(fe.textContent=ps),ct=r(e),y(ue.$$.fragment,e),ht=r(e),O=f(e,"H2",{class:!0});var Pe=Q(O);le=f(Pe,"A",{id:!0,class:!0,href:!0});var it=Q(le);st=f(it,"SPAN",{});var Us=Q(st);y(ge.$$.fragment,Us),Us.forEach(t),it.forEach(t),ts=r(Pe),De=f(Pe,"SPAN",{"data-svelte-h":!0}),T(De)!=="svelte-14ot0k"&&(De.textContent=os),Pe.forEach(t),dt=r(e),Me=f(e,"P",{"data-svelte-h":!0}),T(Me)!=="svelte-8ukoq1"&&(Me.textContent=rs),ft=r(e),y(ye.$$.fragment,e),ut=r(e),$e=f(e,"P",{"data-svelte-h":!0}),T($e)!=="svelte-12jrw1i"&&($e.innerHTML=is),gt=r(e),y(be.$$.fragment,e),Mt=r(e),je=f(e,"P",{"data-svelte-h":!0}),T(je)!=="svelte-12bood2"&&(je.textContent=ms),yt=r(e),y(we.$$.fragment,e),$t=r(e),Te=f(e,"P",{"data-svelte-h":!0}),T(Te)!=="svelte-j851qf"&&(Te.innerHTML=cs),bt=r(e),ee=f(e,"H2",{class:!0});var Dt=Q(ee);ae=f(Dt,"A",{id:!0,class:!0,href:!0});var vs=Q(ae);lt=f(vs,"SPAN",{});var Cs=Q(lt);y(_e.$$.fragment,Cs),Cs.forEach(t),vs.forEach(t),ss=r(Dt),Ke=f(Dt,"SPAN",{"data-svelte-h":!0}),T(Ke)!=="svelte-1cte2wb"&&(Ke.textContent=hs),Dt.forEach(t),jt=r(e),y(Je.$$.fragment,e),wt=r(e),xe=f(e,"P",{"data-svelte-h":!0}),T(xe)!=="svelte-vkts6u"&&(xe.innerHTML=ds),Tt=r(e),y(ke.$$.fragment,e),_t=r(e),Ue=f(e,"P",{"data-svelte-h":!0}),T(Ue)!=="svelte-ti0izn"&&(Ue.innerHTML=fs),Jt=r(e),y(ve.$$.fragment,e),xt=r(e),Ce=f(e,"P",{"data-svelte-h":!0}),T(Ce)!=="svelte-16uyepd"&&(Ce.innerHTML=us),kt=r(e),Ge=f(e,"P",{"data-svelte-h":!0}),T(Ge)!=="svelte-1n68t0t"&&(Ge.textContent=gs),Ut=r(e),y(Ie.$$.fragment,e),vt=r(e),Ze=f(e,"P",{"data-svelte-h":!0}),T(Ze)!=="svelte-321xw1"&&(Ze.innerHTML=Ms),Ct=r(e),y(Re.$$.fragment,e),Gt=r(e),Ve=f(e,"P",{"data-svelte-h":!0}),T(Ve)!=="svelte-lan0yv"&&(Ve.textContent=ys),It=r(e),We=f(e,"P",{"data-svelte-h":!0}),T(We)!=="svelte-1mquexd"&&(We.textContent=$s),Zt=r(e),Xe=f(e,"UL",{"data-svelte-h":!0}),T(Xe)!=="svelte-hoxk8w"&&(Xe.innerHTML=bs),Rt=r(e),y(Be.$$.fragment,e),Vt=r(e),ze=f(e,"P",{"data-svelte-h":!0}),T(ze)!=="svelte-51k2an"&&(ze.innerHTML=js),Wt=r(e),y(Fe.$$.fragment,e),Xt=r(e),He=f(e,"P",{"data-svelte-h":!0}),T(He)!=="svelte-n2vyhz"&&(He.innerHTML=ws),Bt=r(e),y(ne.$$.fragment,e),zt=r(e),te=f(e,"H2",{class:!0});var Kt=Q(te);pe=f(Kt,"A",{id:!0,class:!0,href:!0});var Gs=Q(pe);at=f(Gs,"SPAN",{});var Is=Q(at);y(Ee.$$.fragment,Is),Is.forEach(t),Gs.forEach(t),ls=r(Kt),Oe=f(Kt,"SPAN",{"data-svelte-h":!0}),T(Oe)!=="svelte-tdy10p"&&(Oe.textContent=Ts),Kt.forEach(t),Ft=r(e),y(oe.$$.fragment,e),Ht=r(e),y(re.$$.fragment,e),Et=r(e),se=f(e,"H2",{class:!0});var Ot=Q(se);ie=f(Ot,"A",{id:!0,class:!0,href:!0});var Zs=Q(ie);nt=f(Zs,"SPAN",{});var Rs=Q(nt);y(Ae.$$.fragment,Rs),Rs.forEach(t),Zs.forEach(t),as=r(Ot),et=f(Ot,"SPAN",{"data-svelte-h":!0}),T(et)!=="svelte-8litrx"&&(et.textContent=_s),Ot.forEach(t),At=r(e),Ne=f(e,"P",{"data-svelte-h":!0}),T(Ne)!=="svelte-jox0kl"&&(Ne.textContent=Js),Nt=r(e),Qe=f(e,"P",{"data-svelte-h":!0}),T(Qe)!=="svelte-itb1wv"&&(Qe.textContent=xs),Qt=r(e),y(Ye.$$.fragment,e),Yt=r(e),Le=f(e,"P",{"data-svelte-h":!0}),T(Le)!=="svelte-3cxlyd"&&(Le.innerHTML=ks),Lt=r(e),y(qe.$$.fragment,e),qt=r(e),y(me.$$.fragment,e),St=r(e),pt=f(e,"P",{}),Q(pt).forEach(t),this.h()},h(){X(s,"name","hf:doc:metadata"),X(s,"content",JSON.stringify(ol)),X(u,"id","causal-language-modeling"),X(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"),X(u,"href","#causal-language-modeling"),X(g,"class","relative group"),X(le,"id","load-eli5-dataset"),X(le,"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"),X(le,"href","#load-eli5-dataset"),X(O,"class","relative group"),X(ae,"id","preprocess"),X(ae,"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"),X(ae,"href","#preprocess"),X(ee,"class","relative group"),X(pe,"id","train"),X(pe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),X(pe,"href","#train"),X(te,"class","relative group"),X(ie,"id","inference"),X(ie,"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"),X(ie,"href","#inference"),X(se,"class","relative group")},m(e,n){B(document.head,s),l(e,c,n),l(e,a,n),l(e,p,n),l(e,g,n),B(g,u),B(u,Z),$(x,Z,null),B(g,W),B(g,R),l(e,E,n),$(C,e,n),l(e,k,n),l(e,G,n),l(e,_,n),$(z,e,n),l(e,A,n),l(e,F,n),l(e,P,n),l(e,H,n),l(e,N,n),l(e,h,n),l(e,L,n),$(S,e,n),l(e,D,n),l(e,K,n),l(e,m,n),$(J,e,n),l(e,de,n),l(e,fe,n),l(e,ct,n),$(ue,e,n),l(e,ht,n),l(e,O,n),B(O,le),B(le,st),$(ge,st,null),B(O,ts),B(O,De),l(e,dt,n),l(e,Me,n),l(e,ft,n),$(ye,e,n),l(e,ut,n),l(e,$e,n),l(e,gt,n),$(be,e,n),l(e,Mt,n),l(e,je,n),l(e,yt,n),$(we,e,n),l(e,$t,n),l(e,Te,n),l(e,bt,n),l(e,ee,n),B(ee,ae),B(ae,lt),$(_e,lt,null),B(ee,ss),B(ee,Ke),l(e,jt,n),$(Je,e,n),l(e,wt,n),l(e,xe,n),l(e,Tt,n),$(ke,e,n),l(e,_t,n),l(e,Ue,n),l(e,Jt,n),$(ve,e,n),l(e,xt,n),l(e,Ce,n),l(e,kt,n),l(e,Ge,n),l(e,Ut,n),$(Ie,e,n),l(e,vt,n),l(e,Ze,n),l(e,Ct,n),$(Re,e,n),l(e,Gt,n),l(e,Ve,n),l(e,It,n),l(e,We,n),l(e,Zt,n),l(e,Xe,n),l(e,Rt,n),$(Be,e,n),l(e,Vt,n),l(e,ze,n),l(e,Wt,n),$(Fe,e,n),l(e,Xt,n),l(e,He,n),l(e,Bt,n),$(ne,e,n),l(e,zt,n),l(e,te,n),B(te,pe),B(pe,at),$(Ee,at,null),B(te,ls),B(te,Oe),l(e,Ft,n),$(oe,e,n),l(e,Ht,n),$(re,e,n),l(e,Et,n),l(e,se,n),B(se,ie),B(ie,nt),$(Ae,nt,null),B(se,as),B(se,et),l(e,At,n),l(e,Ne,n),l(e,Nt,n),l(e,Qe,n),l(e,Qt,n),$(Ye,e,n),l(e,Yt,n),l(e,Le,n),l(e,Lt,n),$(qe,e,n),l(e,qt,n),$(me,e,n),l(e,St,n),l(e,pt,n),Pt=!0},p(e,[n]){const Se={};n&2&&(Se.$$scope={dirty:n,ctx:e}),S.$set(Se);const ot={};n&2&&(ot.$$scope={dirty:n,ctx:e}),ne.$set(ot);const rt={};n&2&&(rt.$$scope={dirty:n,ctx:e}),oe.$set(rt);const Pe={};n&2&&(Pe.$$scope={dirty:n,ctx:e}),re.$set(Pe);const it={};n&2&&(it.$$scope={dirty:n,ctx:e}),me.$set(it)},i(e){Pt||(b(x.$$.fragment,e),b(C.$$.fragment,e),b(z.$$.fragment,e),b(S.$$.fragment,e),b(J.$$.fragment,e),b(ue.$$.fragment,e),b(ge.$$.fragment,e),b(ye.$$.fragment,e),b(be.$$.fragment,e),b(we.$$.fragment,e),b(_e.$$.fragment,e),b(Je.$$.fragment,e),b(ke.$$.fragment,e),b(ve.$$.fragment,e),b(Ie.$$.fragment,e),b(Re.$$.fragment,e),b(Be.$$.fragment,e),b(Fe.$$.fragment,e),b(ne.$$.fragment,e),b(Ee.$$.fragment,e),b(oe.$$.fragment,e),b(re.$$.fragment,e),b(Ae.$$.fragment,e),b(Ye.$$.fragment,e),b(qe.$$.fragment,e),b(me.$$.fragment,e),Pt=!0)},o(e){j(x.$$.fragment,e),j(C.$$.fragment,e),j(z.$$.fragment,e),j(S.$$.fragment,e),j(J.$$.fragment,e),j(ue.$$.fragment,e),j(ge.$$.fragment,e),j(ye.$$.fragment,e),j(be.$$.fragment,e),j(we.$$.fragment,e),j(_e.$$.fragment,e),j(Je.$$.fragment,e),j(ke.$$.fragment,e),j(ve.$$.fragment,e),j(Ie.$$.fragment,e),j(Re.$$.fragment,e),j(Be.$$.fragment,e),j(Fe.$$.fragment,e),j(ne.$$.fragment,e),j(Ee.$$.fragment,e),j(oe.$$.fragment,e),j(re.$$.fragment,e),j(Ae.$$.fragment,e),j(Ye.$$.fragment,e),j(qe.$$.fragment,e),j(me.$$.fragment,e),Pt=!1},d(e){e&&(t(c),t(a),t(p),t(g),t(E),t(k),t(G),t(_),t(A),t(F),t(P),t(H),t(N),t(h),t(L),t(D),t(K),t(m),t(de),t(fe),t(ct),t(ht),t(O),t(dt),t(Me),t(ft),t(ut),t($e),t(gt),t(Mt),t(je),t(yt),t($t),t(Te),t(bt),t(ee),t(jt),t(wt),t(xe),t(Tt),t(_t),t(Ue),t(Jt),t(xt),t(Ce),t(kt),t(Ge),t(Ut),t(vt),t(Ze),t(Ct),t(Gt),t(Ve),t(It),t(We),t(Zt),t(Xe),t(Rt),t(Vt),t(ze),t(Wt),t(Xt),t(He),t(Bt),t(zt),t(te),t(Ft),t(Ht),t(Et),t(se),t(At),t(Ne),t(Nt),t(Qe),t(Qt),t(Yt),t(Le),t(Lt),t(qt),t(St),t(pt)),t(s),w(x),w(C,e),w(z,e),w(S,e),w(J,e),w(ue,e),w(ge),w(ye,e),w(be,e),w(we,e),w(_e),w(Je,e),w(ke,e),w(ve,e),w(Ie,e),w(Re,e),w(Be,e),w(Fe,e),w(ne,e),w(Ee),w(oe,e),w(re,e),w(Ae),w(Ye,e),w(qe,e),w(me,e)}}}const ol={local:"causal-language-modeling",sections:[{local:"load-eli5-dataset",title:"ELI5 데이터 세트 불러오기"},{local:"preprocess",title:"전처리"},{local:"train",title:"훈련"},{local:"inference",title:"추론"}],title:"인과 언어 모델링"};function rl(U){return zs(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ml extends Fs{constructor(s){super(),Hs(this,s,rl,pl,Bs,{})}}export{Ml as component};
