import{s as Ps,o as Ks,n as st}from"../chunks/scheduler.56730f09.js";import{S as Os,i as te,g as w,s as o,r as g,A as se,h as b,f as l,c as i,j as qs,u as d,x as T,k as Ss,y as ee,a,v as M,d as $,t as y,w as j,m as le,n as ae}from"../chunks/index.1f144517.js";import{T as Js}from"../chunks/Tip.41e845e5.js";import{Y as Ds}from"../chunks/Youtube.62e0f062.js";import{C as Z}from"../chunks/CodeBlock.738eeccb.js";import{D as ne}from"../chunks/DocNotebookDropdown.243c3df7.js";import{F as xs,M as Rt}from"../chunks/Markdown.c541024b.js";import{H as Ft,E as pe}from"../chunks/EditOnGithub.854793f1.js";function re(k){let s,c='이 작업과 호환되는 모든 아키텍처와 체크포인트를 보려면 <a href="https://huggingface.co/tasks/text-generation" rel="nofollow">작업 페이지</a>를 확인하는 것이 좋습니다.';return{c(){s=w("p"),s.innerHTML=c},l(e){s=b(e,"P",{"data-svelte-h":!0}),T(s)!=="svelte-mlywsx"&&(s.innerHTML=c)},m(e,m){a(e,s,m)},p:st,d(e){e&&l(s)}}}function oe(k){let s,c="패딩 토큰으로 종결 토큰을 사용하고 <code>mlm=False</code>로 설정하세요. 이렇게 하면 입력을 오른쪽으로 한 칸씩 시프트한 값을 레이블로 사용합니다:",e,m,h;return m=new Z({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>)`,wrap:!1}}),{c(){s=w("p"),s.innerHTML=c,e=o(),g(m.$$.fragment)},l(f){s=b(f,"P",{"data-svelte-h":!0}),T(s)!=="svelte-xhgrka"&&(s.innerHTML=c),e=i(f),d(m.$$.fragment,f)},m(f,v){a(f,s,v),a(f,e,v),M(m,f,v),h=!0},p:st,i(f){h||($(m.$$.fragment,f),h=!0)},o(f){y(m.$$.fragment,f),h=!1},d(f){f&&(l(s),l(e)),j(m,f)}}}function ie(k){let s,c;return s=new Rt({props:{$$slots:{default:[oe]},$$scope:{ctx:k}}}),{c(){g(s.$$.fragment)},l(e){d(s.$$.fragment,e)},m(e,m){M(s,e,m),c=!0},p(e,m){const h={};m&2&&(h.$$scope={dirty:m,ctx:e}),s.$set(h)},i(e){c||($(s.$$.fragment,e),c=!0)},o(e){y(s.$$.fragment,e),c=!1},d(e){j(s,e)}}}function me(k){let s,c="패딩 토큰으로 종결 토큰을 사용하고 <code>mlm=False</code>로 설정하세요. 이렇게 하면 입력을 오른쪽으로 한 칸씩 시프트한 값을 레이블로 사용합니다:",e,m,h;return m=new Z({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>)`,wrap:!1}}),{c(){s=w("p"),s.innerHTML=c,e=o(),g(m.$$.fragment)},l(f){s=b(f,"P",{"data-svelte-h":!0}),T(s)!=="svelte-xhgrka"&&(s.innerHTML=c),e=i(f),d(m.$$.fragment,f)},m(f,v){a(f,s,v),a(f,e,v),M(m,f,v),h=!0},p:st,i(f){h||($(m.$$.fragment,f),h=!0)},o(f){y(m.$$.fragment,f),h=!1},d(f){f&&(l(s),l(e)),j(m,f)}}}function ce(k){let s,c;return s=new Rt({props:{$$slots:{default:[me]},$$scope:{ctx:k}}}),{c(){g(s.$$.fragment)},l(e){d(s.$$.fragment,e)},m(e,m){M(s,e,m),c=!0},p(e,m){const h={};m&2&&(h.$$scope={dirty:m,ctx:e}),s.$set(h)},i(e){c||($(s.$$.fragment,e),c=!0)},o(e){y(s.$$.fragment,e),c=!1},d(e){j(s,e)}}}function ue(k){let s,c='<code>Trainer</code>를 사용하여 모델을 미세 조정하는 방법을 잘 모르신다면 <a href="../training#train-with-pytorch-trainer">기본 튜토리얼</a>을 확인해보세요!';return{c(){s=w("p"),s.innerHTML=c},l(e){s=b(e,"P",{"data-svelte-h":!0}),T(s)!=="svelte-1n631xc"&&(s.innerHTML=c)},m(e,m){a(e,s,m)},p:st,d(e){e&&l(s)}}}function fe(k){let s,c,e,m="이제 모델을 훈련하기 준비가 되었습니다! <code>AutoModelForCausalLM</code>를 사용하여 DistilGPT2를 불러옵니다:",h,f,v,I,G="여기까지 진행하면 세 단계만 남았습니다:",R,C,X="<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>",V,x,W,p,J="훈련이 완료되면 <code>evaluate()</code> 메소드를 사용하여 모델을 평가하고 퍼플렉서티를 얻을 수 있습니다:",Q,Y,z,N,L="그런 다음 <code>push_to_hub()</code> 메소드를 사용하여 모델을 허브에 공유하세요. 이렇게 하면 누구나 모델을 사용할 수 있습니다:",F,E,B;return s=new Js({props:{$$slots:{default:[ue]},$$scope:{ctx:k}}}),f=new Z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvckNhdXNhbExNJTJDJTIwVHJhaW5pbmdBcmd1bWVudHMlMkMlMjBUcmFpbmVyJTBBJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JDYXVzYWxMTS5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsYmVydCUyRmRpc3RpbGdwdDIlMjIp",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;distilbert/distilgpt2&quot;</span>)`,wrap:!1}}),x=new Z({props:{code:"dHJhaW5pbmdfYXJncyUyMCUzRCUyMFRyYWluaW5nQXJndW1lbnRzKCUwQSUyMCUyMCUyMCUyMG91dHB1dF9kaXIlM0QlMjJteV9hd2Vzb21lX2VsaTVfY2xtLW1vZGVsJTIyJTJDJTBBJTIwJTIwJTIwJTIwZXZhbF9zdHJhdGVneSUzRCUyMmVwb2NoJTIyJTJDJTBBJTIwJTIwJTIwJTIwbGVhcm5pbmdfcmF0ZSUzRDJlLTUlMkMlMEElMjAlMjAlMjAlMjB3ZWlnaHRfZGVjYXklM0QwLjAxJTJDJTBBJTIwJTIwJTIwJTIwcHVzaF90b19odWIlM0RUcnVlJTJDJTBBKSUwQSUwQXRyYWluZXIlMjAlM0QlMjBUcmFpbmVyKCUwQSUyMCUyMCUyMCUyMG1vZGVsJTNEbW9kZWwlMkMlMEElMjAlMjAlMjAlMjBhcmdzJTNEdHJhaW5pbmdfYXJncyUyQyUwQSUyMCUyMCUyMCUyMHRyYWluX2RhdGFzZXQlM0RsbV9kYXRhc2V0JTVCJTIydHJhaW4lMjIlNUQlMkMlMEElMjAlMjAlMjAlMjBldmFsX2RhdGFzZXQlM0RsbV9kYXRhc2V0JTVCJTIydGVzdCUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMGRhdGFfY29sbGF0b3IlM0RkYXRhX2NvbGxhdG9yJTJDJTBBKSUwQSUwQXRyYWluZXIudHJhaW4oKQ==",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>    eval_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()`,wrap:!1}}),Y=new Z({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>`,wrap:!1}}),E=new Z({props:{code:"dHJhaW5lci5wdXNoX3RvX2h1Yigp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.push_to_hub()',wrap:!1}}),{c(){g(s.$$.fragment),c=o(),e=w("p"),e.innerHTML=m,h=o(),g(f.$$.fragment),v=o(),I=w("p"),I.textContent=G,R=o(),C=w("ol"),C.innerHTML=X,V=o(),g(x.$$.fragment),W=o(),p=w("p"),p.innerHTML=J,Q=o(),g(Y.$$.fragment),z=o(),N=w("p"),N.innerHTML=L,F=o(),g(E.$$.fragment)},l(u){d(s.$$.fragment,u),c=i(u),e=b(u,"P",{"data-svelte-h":!0}),T(e)!=="svelte-lq6v0y"&&(e.innerHTML=m),h=i(u),d(f.$$.fragment,u),v=i(u),I=b(u,"P",{"data-svelte-h":!0}),T(I)!=="svelte-scyina"&&(I.textContent=G),R=i(u),C=b(u,"OL",{"data-svelte-h":!0}),T(C)!=="svelte-zqr9wu"&&(C.innerHTML=X),V=i(u),d(x.$$.fragment,u),W=i(u),p=b(u,"P",{"data-svelte-h":!0}),T(p)!=="svelte-amixb4"&&(p.innerHTML=J),Q=i(u),d(Y.$$.fragment,u),z=i(u),N=b(u,"P",{"data-svelte-h":!0}),T(N)!=="svelte-1bxxjwl"&&(N.innerHTML=L),F=i(u),d(E.$$.fragment,u)},m(u,_){M(s,u,_),a(u,c,_),a(u,e,_),a(u,h,_),M(f,u,_),a(u,v,_),a(u,I,_),a(u,R,_),a(u,C,_),a(u,V,_),M(x,u,_),a(u,W,_),a(u,p,_),a(u,Q,_),M(Y,u,_),a(u,z,_),a(u,N,_),a(u,F,_),M(E,u,_),B=!0},p(u,_){const H={};_&2&&(H.$$scope={dirty:_,ctx:u}),s.$set(H)},i(u){B||($(s.$$.fragment,u),$(f.$$.fragment,u),$(x.$$.fragment,u),$(Y.$$.fragment,u),$(E.$$.fragment,u),B=!0)},o(u){y(s.$$.fragment,u),y(f.$$.fragment,u),y(x.$$.fragment,u),y(Y.$$.fragment,u),y(E.$$.fragment,u),B=!1},d(u){u&&(l(c),l(e),l(h),l(v),l(I),l(R),l(C),l(V),l(W),l(p),l(Q),l(z),l(N),l(F)),j(s,u),j(f,u),j(x,u),j(Y,u),j(E,u)}}}function he(k){let s,c;return s=new Rt({props:{$$slots:{default:[fe]},$$scope:{ctx:k}}}),{c(){g(s.$$.fragment)},l(e){d(s.$$.fragment,e)},m(e,m){M(s,e,m),c=!0},p(e,m){const h={};m&2&&(h.$$scope={dirty:m,ctx:e}),s.$set(h)},i(e){c||($(s.$$.fragment,e),c=!0)},o(e){y(s.$$.fragment,e),c=!1},d(e){j(s,e)}}}function ge(k){let s,c='Keras를 사용하여 모델을 미세 조정하는 방법에 익숙하지 않다면 <a href="../training#train-a-tensorflow-model-with-keras">기본 튜토리얼</a>을 확인해보세요!';return{c(){s=w("p"),s.innerHTML=c},l(e){s=b(e,"P",{"data-svelte-h":!0}),T(s)!=="svelte-1qjtntp"&&(s.innerHTML=c)},m(e,m){a(e,s,m)},p:st,d(e){e&&l(s)}}}function de(k){let s,c,e,m,h,f="그런 다음 <code>TFAutoModelForCausalLM</code>를 사용하여 DistilGPT2를 불러옵니다:",v,I,G,R,C="<code>prepare_tf_dataset()</code>을 사용하여 데이터 세트를 <code>tf.data.Dataset</code> 형식으로 변환하세요:",X,V,x,W,p='<a href="https://keras.io/api/models/model_training_apis/#compile-method" rel="nofollow"><code>compile</code></a>을 사용하여 모델을 훈련하기 위해 구성하세요. Transformers 모델은 모두 기본적인 작업 관련 손실 함수를 가지고 있으므로, 원한다면 별도로 지정하지 않아도 됩니다:',J,Q,Y,z,N="<code>PushToHubCallback</code>에서 모델과 토크나이저를 업로드할 위치를 지정할 수 있습니다:",L,F,E,B,u='마지막으로, 모델을 훈련하기 위해 <a href="https://keras.io/api/models/model_training_apis/#fit-method" rel="nofollow"><code>fit</code></a>을 호출하세요. 훈련 데이터 세트, 검증 데이터 세트, 에폭 수 및 콜백을 전달하세요:',_,H,S,A,Wt="훈련이 완료되면 모델이 자동으로 허브에 업로드되어 모두가 사용할 수 있습니다!",D;return s=new Js({props:{$$slots:{default:[ge]},$$scope:{ctx:k}}}),e=new Z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMGNyZWF0ZV9vcHRpbWl6ZXIlMkMlMjBBZGFtV2VpZ2h0RGVjYXklMEElMEFvcHRpbWl6ZXIlMjAlM0QlMjBBZGFtV2VpZ2h0RGVjYXkobGVhcm5pbmdfcmF0ZSUzRDJlLTUlMkMlMjB3ZWlnaHRfZGVjYXlfcmF0ZSUzRDAuMDEp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> create_optimizer, AdamWeightDecay

<span class="hljs-meta">&gt;&gt;&gt; </span>optimizer = AdamWeightDecay(learning_rate=<span class="hljs-number">2e-5</span>, weight_decay_rate=<span class="hljs-number">0.01</span>)`,wrap:!1}}),I=new Z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGQXV0b01vZGVsRm9yQ2F1c2FsTE0lMEElMEFtb2RlbCUyMCUzRCUyMFRGQXV0b01vZGVsRm9yQ2F1c2FsTE0uZnJvbV9wcmV0cmFpbmVkKCUyMmRpc3RpbGJlcnQlMkZkaXN0aWxncHQyJTIyKQ==",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;distilbert/distilgpt2&quot;</span>)`,wrap:!1}}),V=new Z({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>)`,wrap:!1}}),Q=new Z({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>`,wrap:!1}}),F=new Z({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>)`,wrap:!1}}),H=new Z({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])',wrap:!1}}),{c(){g(s.$$.fragment),c=le(`
TensorFlow에서 모델을 미세 조정하려면, 먼저 옵티마이저 함수, 학습률 스케줄 및 일부 훈련 하이퍼파라미터를 설정하세요:

	`),g(e.$$.fragment),m=o(),h=w("p"),h.innerHTML=f,v=o(),g(I.$$.fragment),G=o(),R=w("p"),R.innerHTML=C,X=o(),g(V.$$.fragment),x=o(),W=w("p"),W.innerHTML=p,J=o(),g(Q.$$.fragment),Y=o(),z=w("p"),z.innerHTML=N,L=o(),g(F.$$.fragment),E=o(),B=w("p"),B.innerHTML=u,_=o(),g(H.$$.fragment),S=o(),A=w("p"),A.textContent=Wt},l(r){d(s.$$.fragment,r),c=ae(r,`
TensorFlow에서 모델을 미세 조정하려면, 먼저 옵티마이저 함수, 학습률 스케줄 및 일부 훈련 하이퍼파라미터를 설정하세요:

	`),d(e.$$.fragment,r),m=i(r),h=b(r,"P",{"data-svelte-h":!0}),T(h)!=="svelte-1xfjl2y"&&(h.innerHTML=f),v=i(r),d(I.$$.fragment,r),G=i(r),R=b(r,"P",{"data-svelte-h":!0}),T(R)!=="svelte-57oj0z"&&(R.innerHTML=C),X=i(r),d(V.$$.fragment,r),x=i(r),W=b(r,"P",{"data-svelte-h":!0}),T(W)!=="svelte-bkxxon"&&(W.innerHTML=p),J=i(r),d(Q.$$.fragment,r),Y=i(r),z=b(r,"P",{"data-svelte-h":!0}),T(z)!=="svelte-6m34m7"&&(z.innerHTML=N),L=i(r),d(F.$$.fragment,r),E=i(r),B=b(r,"P",{"data-svelte-h":!0}),T(B)!=="svelte-az37qz"&&(B.innerHTML=u),_=i(r),d(H.$$.fragment,r),S=i(r),A=b(r,"P",{"data-svelte-h":!0}),T(A)!=="svelte-avna1r"&&(A.textContent=Wt)},m(r,U){M(s,r,U),a(r,c,U),M(e,r,U),a(r,m,U),a(r,h,U),a(r,v,U),M(I,r,U),a(r,G,U),a(r,R,U),a(r,X,U),M(V,r,U),a(r,x,U),a(r,W,U),a(r,J,U),M(Q,r,U),a(r,Y,U),a(r,z,U),a(r,L,U),M(F,r,U),a(r,E,U),a(r,B,U),a(r,_,U),M(H,r,U),a(r,S,U),a(r,A,U),D=!0},p(r,U){const q={};U&2&&(q.$$scope={dirty:U,ctx:r}),s.$set(q)},i(r){D||($(s.$$.fragment,r),$(e.$$.fragment,r),$(I.$$.fragment,r),$(V.$$.fragment,r),$(Q.$$.fragment,r),$(F.$$.fragment,r),$(H.$$.fragment,r),D=!0)},o(r){y(s.$$.fragment,r),y(e.$$.fragment,r),y(I.$$.fragment,r),y(V.$$.fragment,r),y(Q.$$.fragment,r),y(F.$$.fragment,r),y(H.$$.fragment,r),D=!1},d(r){r&&(l(c),l(m),l(h),l(v),l(G),l(R),l(X),l(x),l(W),l(J),l(Y),l(z),l(L),l(E),l(B),l(_),l(S),l(A)),j(s,r),j(e,r),j(I,r),j(V,r),j(Q,r),j(F,r),j(H,r)}}}function Me(k){let s,c;return s=new Rt({props:{$$slots:{default:[de]},$$scope:{ctx:k}}}),{c(){g(s.$$.fragment)},l(e){d(s.$$.fragment,e)},m(e,m){M(s,e,m),c=!0},p(e,m){const h={};m&2&&(h.$$scope={dirty:m,ctx:e}),s.$set(h)},i(e){c||($(s.$$.fragment,e),c=!0)},o(e){y(s.$$.fragment,e),c=!1},d(e){j(s,e)}}}function $e(k){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=w("p"),s.innerHTML=c},l(e){s=b(e,"P",{"data-svelte-h":!0}),T(s)!=="svelte-7gnqxq"&&(s.innerHTML=c)},m(e,m){a(e,s,m)},p:st,d(e){e&&l(s)}}}function ye(k){let s,c="텍스트를 토큰화하고 <code>input_ids</code>를 PyTorch 텐서로 반환하세요:",e,m,h,f,v='<code>generate()</code> 메소드를 사용하여 텍스트를 생성하세요. 생성을 제어하는 다양한 텍스트 생성 전략과 매개변수에 대한 자세한 내용은 <a href="../generation_strategies">텍스트 생성 전략</a> 페이지를 확인하세요.',I,G,R,C,X="생성된 토큰 ID를 다시 텍스트로 디코딩하세요:",V,x,W;return m=new Z({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`,wrap:!1}}),G=new Z({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>)`,wrap:!1}}),x=new Z({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>]`,wrap:!1}}),{c(){s=w("p"),s.innerHTML=c,e=o(),g(m.$$.fragment),h=o(),f=w("p"),f.innerHTML=v,I=o(),g(G.$$.fragment),R=o(),C=w("p"),C.textContent=X,V=o(),g(x.$$.fragment)},l(p){s=b(p,"P",{"data-svelte-h":!0}),T(s)!=="svelte-1b4fw1g"&&(s.innerHTML=c),e=i(p),d(m.$$.fragment,p),h=i(p),f=b(p,"P",{"data-svelte-h":!0}),T(f)!=="svelte-3u1s1i"&&(f.innerHTML=v),I=i(p),d(G.$$.fragment,p),R=i(p),C=b(p,"P",{"data-svelte-h":!0}),T(C)!=="svelte-1wns5q7"&&(C.textContent=X),V=i(p),d(x.$$.fragment,p)},m(p,J){a(p,s,J),a(p,e,J),M(m,p,J),a(p,h,J),a(p,f,J),a(p,I,J),M(G,p,J),a(p,R,J),a(p,C,J),a(p,V,J),M(x,p,J),W=!0},p:st,i(p){W||($(m.$$.fragment,p),$(G.$$.fragment,p),$(x.$$.fragment,p),W=!0)},o(p){y(m.$$.fragment,p),y(G.$$.fragment,p),y(x.$$.fragment,p),W=!1},d(p){p&&(l(s),l(e),l(h),l(f),l(I),l(R),l(C),l(V)),j(m,p),j(G,p),j(x,p)}}}function je(k){let s,c;return s=new Rt({props:{$$slots:{default:[ye]},$$scope:{ctx:k}}}),{c(){g(s.$$.fragment)},l(e){d(s.$$.fragment,e)},m(e,m){M(s,e,m),c=!0},p(e,m){const h={};m&2&&(h.$$scope={dirty:m,ctx:e}),s.$set(h)},i(e){c||($(s.$$.fragment,e),c=!0)},o(e){y(s.$$.fragment,e),c=!1},d(e){j(s,e)}}}function we(k){let s,c="텍스트를 토큰화하고 <code>input_ids</code>를 TensorFlow 텐서로 반환하세요:",e,m,h,f,v='<code>~transformers.generation_tf_utils.TFGenerationMixin.generate</code> 메소드를 사용하여 요약을 생성하세요. 생성을 제어하는 다양한 텍스트 생성 전략과 매개변수에 대한 자세한 내용은 <a href="../generation_strategies">텍스트 생성 전략</a> 페이지를 확인하세요.',I,G,R,C,X="생성된 토큰 ID를 다시 텍스트로 디코딩하세요:",V,x,W;return m=new Z({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`,wrap:!1}}),G=new Z({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>)`,wrap:!1}}),x=new Z({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>]`,wrap:!1}}),{c(){s=w("p"),s.innerHTML=c,e=o(),g(m.$$.fragment),h=o(),f=w("p"),f.innerHTML=v,I=o(),g(G.$$.fragment),R=o(),C=w("p"),C.textContent=X,V=o(),g(x.$$.fragment)},l(p){s=b(p,"P",{"data-svelte-h":!0}),T(s)!=="svelte-jhzp8k"&&(s.innerHTML=c),e=i(p),d(m.$$.fragment,p),h=i(p),f=b(p,"P",{"data-svelte-h":!0}),T(f)!=="svelte-10xpnv5"&&(f.innerHTML=v),I=i(p),d(G.$$.fragment,p),R=i(p),C=b(p,"P",{"data-svelte-h":!0}),T(C)!=="svelte-1wns5q7"&&(C.textContent=X),V=i(p),d(x.$$.fragment,p)},m(p,J){a(p,s,J),a(p,e,J),M(m,p,J),a(p,h,J),a(p,f,J),a(p,I,J),M(G,p,J),a(p,R,J),a(p,C,J),a(p,V,J),M(x,p,J),W=!0},p:st,i(p){W||($(m.$$.fragment,p),$(G.$$.fragment,p),$(x.$$.fragment,p),W=!0)},o(p){y(m.$$.fragment,p),y(G.$$.fragment,p),y(x.$$.fragment,p),W=!1},d(p){p&&(l(s),l(e),l(h),l(f),l(I),l(R),l(C),l(V)),j(m,p),j(G,p),j(x,p)}}}function be(k){let s,c;return s=new Rt({props:{$$slots:{default:[we]},$$scope:{ctx:k}}}),{c(){g(s.$$.fragment)},l(e){d(s.$$.fragment,e)},m(e,m){M(s,e,m),c=!0},p(e,m){const h={};m&2&&(h.$$scope={dirty:m,ctx:e}),s.$set(h)},i(e){c||($(s.$$.fragment,e),c=!0)},o(e){y(s.$$.fragment,e),c=!1},d(e){j(s,e)}}}function Te(k){let s,c,e,m,h,f,v,I,G,R=`언어 모델링은 인과적 언어 모델링과 마스크드 언어 모델링, 두 가지 유형으로 나뉩니다. 이 가이드에서는 인과적 언어 모델링을 설명합니다.
인과 언어 모델은 텍스트 생성에 자주 사용됩니다. 또 창의적인 방향으로 응용할 수 있습니다.
직접 사용하며 재미있는 탐구를 해보거나, Copilot 또는 CodeParrot와 같은 지능형 코딩 어시스턴트의 기반이 되기도 합니다.`,C,X,V,x,W=`인과 언어 모델링은 토큰 시퀀스에서 다음 토큰을 예측하며, 모델은 왼쪽의 토큰에만 접근할 수 있습니다.
이는 모델이 미래의 토큰을 볼 수 없다는 것을 의미합니다. 인과 언어 모델의 예로 GPT-2가 있죠.`,p,J,Q="이 가이드에서는 다음 작업을 수행하는 방법을 안내합니다:",Y,z,N='<li><a href="https://huggingface.co/distilbert/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,F,E,B,u="시작하기 전에 필요한 라이브러리가 모두 설치되어 있는지 확인하세요:",_,H,S,A,Wt="커뮤니티에 모델을 업로드하고 공유하기 위해 Hugging Face 계정에 로그인하는 것을 권장합니다. 알림이 표시되면 토큰을 입력하여 로그인하세요:",D,r,U,q,zt,et,Us=`먼저, 🤗 Datasets 라이브러리에서 r/askscience의 작은 하위 집합인 ELI5 데이터 세트를 불러옵니다.
이를 통해 전체 데이터 세트에서 학습하는 데 더 많은 시간을 투자하기 전에, 실험해봄으로써 모든 것이 작동하는지 확인할 수 있습니다.`,Bt,lt,Ht,at,_s="데이터 세트의 <code>train_asks</code> 분할을 <code>train_test_split</code> 메소드를 사용하여 학습 및 테스트 세트로 분할합니다:",Yt,nt,Et,pt,ks="그런 다음 예제를 살펴보세요:",Qt,rt,At,ot,vs="많아 보일 수 있지만, 실제로는 <code>text</code> 필드만 중요합니다. 언어 모델링 작업의 장점은 레이블이 필요하지 않다는 것입니다. 다음 단어 <em>자체가</em> 레이블입니다. (이렇게 레이블을 제공하지 않아도 되는 학습을 비지도 학습이라고 일컫습니다)",Nt,it,Lt,mt,qt,ct,Gs="다음 단계는 <code>text</code> 필드를 전처리하기 위해 DistilGPT2 토크나이저를 불러오는 것입니다.",St,ut,Dt,ft,Cs='위의 예제에서 알 수 있듯이, <code>text</code> 필드는 <code>answers</code> 아래에 중첩되어 있습니다. 따라서 <a href="https://huggingface.co/docs/datasets/process#flatten" rel="nofollow"><code>flatten</code></a> 메소드를 사용하여 중첩 구조에서 <code>text</code> 하위 필드를 추출해야 합니다.',Pt,ht,Kt,gt,Zs="각 하위 필드는 이제 <code>answers</code> 접두사를 가진 별도의 열로 나뉘었으며, <code>text</code> 필드는 이제 리스트입니다. 각 문장을 개별적으로 토큰화하는 대신, 먼저 리스트를 문자열로 변환하여 한꺼번에 토큰화할 수 있습니다.",Ot,dt,Is="다음은 문자열 리스트를 결합하고 결과를 토큰화하는 첫 번째 전처리 함수입니다:",ts,Mt,ss,$t,Vs="이 전처리 함수를 전체 데이터 세트에 적용하려면 🤗 Datasets <code>map</code> 메소드를 사용하세요. <code>batched=True</code>로 설정하여 데이터셋의 여러 요소를 한 번에 처리하고, <code>num_proc</code>를 증가시켜 프로세스 수를 늘릴 수 있습니다. 필요 없는 열은 제거하세요:",es,yt,ls,jt,Rs="이제 데이터 세트는 시퀀스가 토큰화됐지만, 일부 시퀀스는 모델의 최대 입력 길이보다 길 수 있습니다.",as,wt,Ws="이제 두 번째 전처리 함수를 사용하여",ns,bt,Xs="<li>모든 시퀀스를 연결하고,</li> <li><code>block_size</code>로 정의된 길이로 연결된 시퀀스를 여러 개의 짧은 묶음으로 나눕니다. 이 값은 최대 입력 길이와 GPU RAM을 고려해 충분히 짧아야 합니다.</li>",ps,Tt,rs,Jt,Fs="전체 데이터 세트에 <code>group_texts</code> 함수를 적용하세요:",os,xt,is,Ut,zs="그런 다음 <code>DataCollatorForLanguageModeling</code>을 사용하여 예제의 배치를 만듭니다. 데이터 세트 전체를 최대 길이로 패딩하는 것보다, 취합 단계에서 각 배치의 최대 길이로 문장을 <em>동적으로 패딩</em>하는 것이 더 효율적입니다.",ms,P,cs,_t,us,K,fs,O,hs,kt,gs,vt,Bs="좋아요, 이제 모델을 미세 조정했으므로 추론에 사용할 수 있습니다!",ds,Gt,Hs="생성할 텍스트를 위한 프롬프트를 만들어보세요:",Ms,Ct,$s,Zt,Ys="추론을 위해 미세 조정된 모델을 간단히 사용하는 가장 간단한 방법은 <code>pipeline()</code>에서 사용하는 것입니다. 모델과 함께 텍스트 생성을 위한 <code>pipeline</code>을 인스턴스화하고 텍스트를 전달하세요:",ys,It,js,tt,ws,Vt,bs,Xt,Ts;return h=new Ft({props:{title:"인과 언어 모델링",local:"causal-language-modeling",headingTag:"h1"}}),v=new ne({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"}]}}),X=new Ds({props:{id:"Vpjb1lu0MDk"}}),F=new Js({props:{$$slots:{default:[re]},$$scope:{ctx:k}}}),H=new Z({props:{code:"cGlwJTIwaW5zdGFsbCUyMHRyYW5zZm9ybWVycyUyMGRhdGFzZXRzJTIwZXZhbHVhdGU=",highlighted:"pip install transformers datasets evaluate",wrap:!1}}),r=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}}),q=new Ft({props:{title:"ELI5 데이터 세트 불러오기",local:"load-eli5-dataset",headingTag:"h2"}}),lt=new Z({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>)`,wrap:!1}}),nt=new Z({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>)',wrap:!1}}),rt=new Z({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>: []}}`,wrap:!1}}),it=new Ft({props:{title:"전처리",local:"preprocess",headingTag:"h2"}}),mt=new Ds({props:{id:"ma1TrR7gE7I"}}),ut=new Z({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJkaXN0aWxiZXJ0JTJGZGlzdGlsZ3B0MiUyMik=",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;distilbert/distilgpt2&quot;</span>)`,wrap:!1}}),ht=new Z({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>: []}`,wrap:!1}}),Mt=new Z({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>]])`,wrap:!1}}),yt=new Z({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>)`,wrap:!1}}),Tt=new Z({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`,wrap:!1}}),xt=new Z({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>)',wrap:!1}}),P=new xs({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[ce],pytorch:[ie]},$$scope:{ctx:k}}}),_t=new Ft({props:{title:"훈련",local:"train",headingTag:"h2"}}),K=new xs({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[Me],pytorch:[he]},$$scope:{ctx:k}}}),O=new Js({props:{$$slots:{default:[$e]},$$scope:{ctx:k}}}),kt=new Ft({props:{title:"추론",local:"inference",headingTag:"h2"}}),Ct=new Z({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>',wrap:!1}}),It=new Z({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>}]`,wrap:!1}}),tt=new xs({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[be],pytorch:[je]},$$scope:{ctx:k}}}),Vt=new pe({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/ko/tasks/language_modeling.md"}}),{c(){s=w("meta"),c=o(),e=w("p"),m=o(),g(h.$$.fragment),f=o(),g(v.$$.fragment),I=o(),G=w("p"),G.textContent=R,C=o(),g(X.$$.fragment),V=o(),x=w("p"),x.textContent=W,p=o(),J=w("p"),J.textContent=Q,Y=o(),z=w("ol"),z.innerHTML=N,L=o(),g(F.$$.fragment),E=o(),B=w("p"),B.textContent=u,_=o(),g(H.$$.fragment),S=o(),A=w("p"),A.textContent=Wt,D=o(),g(r.$$.fragment),U=o(),g(q.$$.fragment),zt=o(),et=w("p"),et.textContent=Us,Bt=o(),g(lt.$$.fragment),Ht=o(),at=w("p"),at.innerHTML=_s,Yt=o(),g(nt.$$.fragment),Et=o(),pt=w("p"),pt.textContent=ks,Qt=o(),g(rt.$$.fragment),At=o(),ot=w("p"),ot.innerHTML=vs,Nt=o(),g(it.$$.fragment),Lt=o(),g(mt.$$.fragment),qt=o(),ct=w("p"),ct.innerHTML=Gs,St=o(),g(ut.$$.fragment),Dt=o(),ft=w("p"),ft.innerHTML=Cs,Pt=o(),g(ht.$$.fragment),Kt=o(),gt=w("p"),gt.innerHTML=Zs,Ot=o(),dt=w("p"),dt.textContent=Is,ts=o(),g(Mt.$$.fragment),ss=o(),$t=w("p"),$t.innerHTML=Vs,es=o(),g(yt.$$.fragment),ls=o(),jt=w("p"),jt.textContent=Rs,as=o(),wt=w("p"),wt.textContent=Ws,ns=o(),bt=w("ul"),bt.innerHTML=Xs,ps=o(),g(Tt.$$.fragment),rs=o(),Jt=w("p"),Jt.innerHTML=Fs,os=o(),g(xt.$$.fragment),is=o(),Ut=w("p"),Ut.innerHTML=zs,ms=o(),g(P.$$.fragment),cs=o(),g(_t.$$.fragment),us=o(),g(K.$$.fragment),fs=o(),g(O.$$.fragment),hs=o(),g(kt.$$.fragment),gs=o(),vt=w("p"),vt.textContent=Bs,ds=o(),Gt=w("p"),Gt.textContent=Hs,Ms=o(),g(Ct.$$.fragment),$s=o(),Zt=w("p"),Zt.innerHTML=Ys,ys=o(),g(It.$$.fragment),js=o(),g(tt.$$.fragment),ws=o(),g(Vt.$$.fragment),bs=o(),Xt=w("p"),this.h()},l(t){const n=se("svelte-u9bgzb",document.head);s=b(n,"META",{name:!0,content:!0}),n.forEach(l),c=i(t),e=b(t,"P",{}),qs(e).forEach(l),m=i(t),d(h.$$.fragment,t),f=i(t),d(v.$$.fragment,t),I=i(t),G=b(t,"P",{"data-svelte-h":!0}),T(G)!=="svelte-zdtuex"&&(G.textContent=R),C=i(t),d(X.$$.fragment,t),V=i(t),x=b(t,"P",{"data-svelte-h":!0}),T(x)!=="svelte-611b95"&&(x.textContent=W),p=i(t),J=b(t,"P",{"data-svelte-h":!0}),T(J)!=="svelte-x18r2q"&&(J.textContent=Q),Y=i(t),z=b(t,"OL",{"data-svelte-h":!0}),T(z)!=="svelte-uvx0a8"&&(z.innerHTML=N),L=i(t),d(F.$$.fragment,t),E=i(t),B=b(t,"P",{"data-svelte-h":!0}),T(B)!=="svelte-1k0z9pm"&&(B.textContent=u),_=i(t),d(H.$$.fragment,t),S=i(t),A=b(t,"P",{"data-svelte-h":!0}),T(A)!=="svelte-tqxze0"&&(A.textContent=Wt),D=i(t),d(r.$$.fragment,t),U=i(t),d(q.$$.fragment,t),zt=i(t),et=b(t,"P",{"data-svelte-h":!0}),T(et)!=="svelte-8ukoq1"&&(et.textContent=Us),Bt=i(t),d(lt.$$.fragment,t),Ht=i(t),at=b(t,"P",{"data-svelte-h":!0}),T(at)!=="svelte-12jrw1i"&&(at.innerHTML=_s),Yt=i(t),d(nt.$$.fragment,t),Et=i(t),pt=b(t,"P",{"data-svelte-h":!0}),T(pt)!=="svelte-12bood2"&&(pt.textContent=ks),Qt=i(t),d(rt.$$.fragment,t),At=i(t),ot=b(t,"P",{"data-svelte-h":!0}),T(ot)!=="svelte-j851qf"&&(ot.innerHTML=vs),Nt=i(t),d(it.$$.fragment,t),Lt=i(t),d(mt.$$.fragment,t),qt=i(t),ct=b(t,"P",{"data-svelte-h":!0}),T(ct)!=="svelte-vkts6u"&&(ct.innerHTML=Gs),St=i(t),d(ut.$$.fragment,t),Dt=i(t),ft=b(t,"P",{"data-svelte-h":!0}),T(ft)!=="svelte-cu6vm0"&&(ft.innerHTML=Cs),Pt=i(t),d(ht.$$.fragment,t),Kt=i(t),gt=b(t,"P",{"data-svelte-h":!0}),T(gt)!=="svelte-16uyepd"&&(gt.innerHTML=Zs),Ot=i(t),dt=b(t,"P",{"data-svelte-h":!0}),T(dt)!=="svelte-1n68t0t"&&(dt.textContent=Is),ts=i(t),d(Mt.$$.fragment,t),ss=i(t),$t=b(t,"P",{"data-svelte-h":!0}),T($t)!=="svelte-321xw1"&&($t.innerHTML=Vs),es=i(t),d(yt.$$.fragment,t),ls=i(t),jt=b(t,"P",{"data-svelte-h":!0}),T(jt)!=="svelte-lan0yv"&&(jt.textContent=Rs),as=i(t),wt=b(t,"P",{"data-svelte-h":!0}),T(wt)!=="svelte-1mquexd"&&(wt.textContent=Ws),ns=i(t),bt=b(t,"UL",{"data-svelte-h":!0}),T(bt)!=="svelte-hoxk8w"&&(bt.innerHTML=Xs),ps=i(t),d(Tt.$$.fragment,t),rs=i(t),Jt=b(t,"P",{"data-svelte-h":!0}),T(Jt)!=="svelte-51k2an"&&(Jt.innerHTML=Fs),os=i(t),d(xt.$$.fragment,t),is=i(t),Ut=b(t,"P",{"data-svelte-h":!0}),T(Ut)!=="svelte-n2vyhz"&&(Ut.innerHTML=zs),ms=i(t),d(P.$$.fragment,t),cs=i(t),d(_t.$$.fragment,t),us=i(t),d(K.$$.fragment,t),fs=i(t),d(O.$$.fragment,t),hs=i(t),d(kt.$$.fragment,t),gs=i(t),vt=b(t,"P",{"data-svelte-h":!0}),T(vt)!=="svelte-jox0kl"&&(vt.textContent=Bs),ds=i(t),Gt=b(t,"P",{"data-svelte-h":!0}),T(Gt)!=="svelte-itb1wv"&&(Gt.textContent=Hs),Ms=i(t),d(Ct.$$.fragment,t),$s=i(t),Zt=b(t,"P",{"data-svelte-h":!0}),T(Zt)!=="svelte-3cxlyd"&&(Zt.innerHTML=Ys),ys=i(t),d(It.$$.fragment,t),js=i(t),d(tt.$$.fragment,t),ws=i(t),d(Vt.$$.fragment,t),bs=i(t),Xt=b(t,"P",{}),qs(Xt).forEach(l),this.h()},h(){Ss(s,"name","hf:doc:metadata"),Ss(s,"content",Je)},m(t,n){ee(document.head,s),a(t,c,n),a(t,e,n),a(t,m,n),M(h,t,n),a(t,f,n),M(v,t,n),a(t,I,n),a(t,G,n),a(t,C,n),M(X,t,n),a(t,V,n),a(t,x,n),a(t,p,n),a(t,J,n),a(t,Y,n),a(t,z,n),a(t,L,n),M(F,t,n),a(t,E,n),a(t,B,n),a(t,_,n),M(H,t,n),a(t,S,n),a(t,A,n),a(t,D,n),M(r,t,n),a(t,U,n),M(q,t,n),a(t,zt,n),a(t,et,n),a(t,Bt,n),M(lt,t,n),a(t,Ht,n),a(t,at,n),a(t,Yt,n),M(nt,t,n),a(t,Et,n),a(t,pt,n),a(t,Qt,n),M(rt,t,n),a(t,At,n),a(t,ot,n),a(t,Nt,n),M(it,t,n),a(t,Lt,n),M(mt,t,n),a(t,qt,n),a(t,ct,n),a(t,St,n),M(ut,t,n),a(t,Dt,n),a(t,ft,n),a(t,Pt,n),M(ht,t,n),a(t,Kt,n),a(t,gt,n),a(t,Ot,n),a(t,dt,n),a(t,ts,n),M(Mt,t,n),a(t,ss,n),a(t,$t,n),a(t,es,n),M(yt,t,n),a(t,ls,n),a(t,jt,n),a(t,as,n),a(t,wt,n),a(t,ns,n),a(t,bt,n),a(t,ps,n),M(Tt,t,n),a(t,rs,n),a(t,Jt,n),a(t,os,n),M(xt,t,n),a(t,is,n),a(t,Ut,n),a(t,ms,n),M(P,t,n),a(t,cs,n),M(_t,t,n),a(t,us,n),M(K,t,n),a(t,fs,n),M(O,t,n),a(t,hs,n),M(kt,t,n),a(t,gs,n),a(t,vt,n),a(t,ds,n),a(t,Gt,n),a(t,Ms,n),M(Ct,t,n),a(t,$s,n),a(t,Zt,n),a(t,ys,n),M(It,t,n),a(t,js,n),M(tt,t,n),a(t,ws,n),M(Vt,t,n),a(t,bs,n),a(t,Xt,n),Ts=!0},p(t,[n]){const Es={};n&2&&(Es.$$scope={dirty:n,ctx:t}),F.$set(Es);const Qs={};n&2&&(Qs.$$scope={dirty:n,ctx:t}),P.$set(Qs);const As={};n&2&&(As.$$scope={dirty:n,ctx:t}),K.$set(As);const Ns={};n&2&&(Ns.$$scope={dirty:n,ctx:t}),O.$set(Ns);const Ls={};n&2&&(Ls.$$scope={dirty:n,ctx:t}),tt.$set(Ls)},i(t){Ts||($(h.$$.fragment,t),$(v.$$.fragment,t),$(X.$$.fragment,t),$(F.$$.fragment,t),$(H.$$.fragment,t),$(r.$$.fragment,t),$(q.$$.fragment,t),$(lt.$$.fragment,t),$(nt.$$.fragment,t),$(rt.$$.fragment,t),$(it.$$.fragment,t),$(mt.$$.fragment,t),$(ut.$$.fragment,t),$(ht.$$.fragment,t),$(Mt.$$.fragment,t),$(yt.$$.fragment,t),$(Tt.$$.fragment,t),$(xt.$$.fragment,t),$(P.$$.fragment,t),$(_t.$$.fragment,t),$(K.$$.fragment,t),$(O.$$.fragment,t),$(kt.$$.fragment,t),$(Ct.$$.fragment,t),$(It.$$.fragment,t),$(tt.$$.fragment,t),$(Vt.$$.fragment,t),Ts=!0)},o(t){y(h.$$.fragment,t),y(v.$$.fragment,t),y(X.$$.fragment,t),y(F.$$.fragment,t),y(H.$$.fragment,t),y(r.$$.fragment,t),y(q.$$.fragment,t),y(lt.$$.fragment,t),y(nt.$$.fragment,t),y(rt.$$.fragment,t),y(it.$$.fragment,t),y(mt.$$.fragment,t),y(ut.$$.fragment,t),y(ht.$$.fragment,t),y(Mt.$$.fragment,t),y(yt.$$.fragment,t),y(Tt.$$.fragment,t),y(xt.$$.fragment,t),y(P.$$.fragment,t),y(_t.$$.fragment,t),y(K.$$.fragment,t),y(O.$$.fragment,t),y(kt.$$.fragment,t),y(Ct.$$.fragment,t),y(It.$$.fragment,t),y(tt.$$.fragment,t),y(Vt.$$.fragment,t),Ts=!1},d(t){t&&(l(c),l(e),l(m),l(f),l(I),l(G),l(C),l(V),l(x),l(p),l(J),l(Y),l(z),l(L),l(E),l(B),l(_),l(S),l(A),l(D),l(U),l(zt),l(et),l(Bt),l(Ht),l(at),l(Yt),l(Et),l(pt),l(Qt),l(At),l(ot),l(Nt),l(Lt),l(qt),l(ct),l(St),l(Dt),l(ft),l(Pt),l(Kt),l(gt),l(Ot),l(dt),l(ts),l(ss),l($t),l(es),l(ls),l(jt),l(as),l(wt),l(ns),l(bt),l(ps),l(rs),l(Jt),l(os),l(is),l(Ut),l(ms),l(cs),l(us),l(fs),l(hs),l(gs),l(vt),l(ds),l(Gt),l(Ms),l($s),l(Zt),l(ys),l(js),l(ws),l(bs),l(Xt)),l(s),j(h,t),j(v,t),j(X,t),j(F,t),j(H,t),j(r,t),j(q,t),j(lt,t),j(nt,t),j(rt,t),j(it,t),j(mt,t),j(ut,t),j(ht,t),j(Mt,t),j(yt,t),j(Tt,t),j(xt,t),j(P,t),j(_t,t),j(K,t),j(O,t),j(kt,t),j(Ct,t),j(It,t),j(tt,t),j(Vt,t)}}}const Je='{"title":"인과 언어 모델링","local":"causal-language-modeling","sections":[{"title":"ELI5 데이터 세트 불러오기","local":"load-eli5-dataset","sections":[],"depth":2},{"title":"전처리","local":"preprocess","sections":[],"depth":2},{"title":"훈련","local":"train","sections":[],"depth":2},{"title":"추론","local":"inference","sections":[],"depth":2}],"depth":1}';function xe(k){return Ks(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Ve extends Os{constructor(s){super(),te(this,s,xe,Te,Ps,{})}}export{Ve as component};
