import{s as qt,o as St,n as ss}from"../chunks/scheduler.56730f09.js";import{S as Pt,i as Dt,g as b,s as o,r as g,A as Kt,h as w,f as l,c as i,j as Qt,u as M,x as T,k as At,y as Ot,a,v as d,d as j,t as y,w as $,m as se,n as te}from"../chunks/index.1f144517.js";import{T as wt}from"../chunks/Tip.41e845e5.js";import{Y as Lt}from"../chunks/Youtube.62e0f062.js";import{C as I}from"../chunks/CodeBlock.738eeccb.js";import{D as ee}from"../chunks/DocNotebookDropdown.243c3df7.js";import{F as Tt,M as Ws}from"../chunks/Markdown.3289e0dc.js";import{H as Xs,E as le}from"../chunks/EditOnGithub.854793f1.js";function ae(Z){let t,c='이 작업과 호환되는 모든 아키텍처와 체크포인트를 보려면 <a href="https://huggingface.co/tasks/fill-mask" rel="nofollow">작업 페이지</a>를 확인하는 것이 좋습니다.';return{c(){t=b("p"),t.innerHTML=c},l(e){t=w(e,"P",{"data-svelte-h":!0}),T(t)!=="svelte-12d81x1"&&(t.innerHTML=c)},m(e,m){a(e,t,m)},p:ss,d(e){e&&l(t)}}}function ne(Z){let t,c="시퀀스 끝 토큰을 패딩 토큰으로 사용하고 데이터를 반복할 때마다 토큰을 무작위로 마스킹하도록 <code>mlm_-probability</code>를 지정합니다:",e,m,u;return m=new I({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERhdGFDb2xsYXRvckZvckxhbmd1YWdlTW9kZWxpbmclMEElMEF0b2tlbml6ZXIucGFkX3Rva2VuJTIwJTNEJTIwdG9rZW5pemVyLmVvc190b2tlbiUwQWRhdGFfY29sbGF0b3IlMjAlM0QlMjBEYXRhQ29sbGF0b3JGb3JMYW5ndWFnZU1vZGVsaW5nKHRva2VuaXplciUzRHRva2VuaXplciUyQyUyMG1sbV9wcm9iYWJpbGl0eSUzRDAuMTUp",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_probability=<span class="hljs-number">0.15</span>)`,wrap:!1}}),{c(){t=b("p"),t.innerHTML=c,e=o(),g(m.$$.fragment)},l(f){t=w(f,"P",{"data-svelte-h":!0}),T(t)!=="svelte-5j66ud"&&(t.innerHTML=c),e=i(f),M(m.$$.fragment,f)},m(f,G){a(f,t,G),a(f,e,G),d(m,f,G),u=!0},p:ss,i(f){u||(j(m.$$.fragment,f),u=!0)},o(f){y(m.$$.fragment,f),u=!1},d(f){f&&(l(t),l(e)),$(m,f)}}}function pe(Z){let t,c;return t=new Ws({props:{$$slots:{default:[ne]},$$scope:{ctx:Z}}}),{c(){g(t.$$.fragment)},l(e){M(t.$$.fragment,e)},m(e,m){d(t,e,m),c=!0},p(e,m){const u={};m&2&&(u.$$scope={dirty:m,ctx:e}),t.$set(u)},i(e){c||(j(t.$$.fragment,e),c=!0)},o(e){y(t.$$.fragment,e),c=!1},d(e){$(t,e)}}}function re(Z){let t,c="시퀀스 끝 토큰을 패딩 토큰으로 사용하고 데이터를 반복할 때마다 토큰을 무작위로 마스킹하도록 <code>mlm_-probability</code>를 지정합니다:",e,m,u;return m=new I({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERhdGFDb2xsYXRvckZvckxhbmd1YWdlTW9kZWxpbmclMEElMEFkYXRhX2NvbGxhdG9yJTIwJTNEJTIwRGF0YUNvbGxhdG9yRm9yTGFuZ3VhZ2VNb2RlbGluZyh0b2tlbml6ZXIlM0R0b2tlbml6ZXIlMkMlMjBtbG1fcHJvYmFiaWxpdHklM0QwLjE1JTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJ0ZiUyMik=",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_probability=<span class="hljs-number">0.15</span>, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)`,wrap:!1}}),{c(){t=b("p"),t.innerHTML=c,e=o(),g(m.$$.fragment)},l(f){t=w(f,"P",{"data-svelte-h":!0}),T(t)!=="svelte-5j66ud"&&(t.innerHTML=c),e=i(f),M(m.$$.fragment,f)},m(f,G){a(f,t,G),a(f,e,G),d(m,f,G),u=!0},p:ss,i(f){u||(j(m.$$.fragment,f),u=!0)},o(f){y(m.$$.fragment,f),u=!1},d(f){f&&(l(t),l(e)),$(m,f)}}}function oe(Z){let t,c;return t=new Ws({props:{$$slots:{default:[re]},$$scope:{ctx:Z}}}),{c(){g(t.$$.fragment)},l(e){M(t.$$.fragment,e)},m(e,m){d(t,e,m),c=!0},p(e,m){const u={};m&2&&(u.$$scope={dirty:m,ctx:e}),t.$set(u)},i(e){c||(j(t.$$.fragment,e),c=!0)},o(e){y(t.$$.fragment,e),c=!1},d(e){$(t,e)}}}function ie(Z){let t,c='<code>Trainer</code>로 모델을 미세 조정하는 데 익숙하지 않다면 기본 튜토리얼 <a href="../training#train-with-pytorch-trainer">여기</a>를 살펴보세요!';return{c(){t=b("p"),t.innerHTML=c},l(e){t=w(e,"P",{"data-svelte-h":!0}),T(t)!=="svelte-mnr18a"&&(t.innerHTML=c)},m(e,m){a(e,t,m)},p:ss,d(e){e&&l(t)}}}function me(Z){let t,c,e,m="이제 모델 훈련을 시작할 준비가 되었습니다! <code>AutoModelForMaskedLM</code>를 사용해 DistilRoBERTa 모델을 가져옵니다:",u,f,G,C,v="이제 세 단계가 남았습니다:",W,U,H="<li><code>TrainingArguments</code>의 훈련 하이퍼파라미터를 정의합니다. 모델 저장 위치를 지정하는 <code>output_dir</code>은 유일한 필수 파라미터입니다. <code>push_to_hub=True</code>를 설정하여 이 모델을 Hub에 업로드합니다 (모델을 업로드하려면 Hugging Face에 로그인해야 합니다).</li> <li>모델, 데이터 세트 및 데이터 콜레이터(collator)와 함께 훈련 인수를 <code>Trainer</code>에 전달합니다.</li> <li><code>train()</code>을 호출하여 모델을 미세 조정합니다.</li>",R,k,V,p,J="훈련이 완료되면 <code>evaluate()</code> 메소드를 사용하여 펄플렉서티(perplexity)를 계산하고 모델을 평가합니다:",E,B,X,Y,N="그리고 <code>push_to_hub()</code> 메소드를 사용해 다른 사람들이 사용할 수 있도록, Hub로 모델을 업로드합니다.",Q,F,z;return t=new wt({props:{$$slots:{default:[ie]},$$scope:{ctx:Z}}}),f=new I({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvck1hc2tlZExNJTBBJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JNYXNrZWRMTS5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsYmVydCUyRmRpc3RpbHJvYmVydGEtYmFzZSUyMik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForMaskedLM

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForMaskedLM.from_pretrained(<span class="hljs-string">&quot;distilbert/distilroberta-base&quot;</span>)`,wrap:!1}}),k=new I({props:{code:"dHJhaW5pbmdfYXJncyUyMCUzRCUyMFRyYWluaW5nQXJndW1lbnRzKCUwQSUyMCUyMCUyMCUyMG91dHB1dF9kaXIlM0QlMjJteV9hd2Vzb21lX2VsaTVfbWxtX21vZGVsJTIyJTJDJTBBJTIwJTIwJTIwJTIwZXZhbF9zdHJhdGVneSUzRCUyMmVwb2NoJTIyJTJDJTBBJTIwJTIwJTIwJTIwbGVhcm5pbmdfcmF0ZSUzRDJlLTUlMkMlMEElMjAlMjAlMjAlMjBudW1fdHJhaW5fZXBvY2hzJTNEMyUyQyUwQSUyMCUyMCUyMCUyMHdlaWdodF9kZWNheSUzRDAuMDElMkMlMEElMjAlMjAlMjAlMjBwdXNoX3RvX2h1YiUzRFRydWUlMkMlMEEpJTBBJTBBdHJhaW5lciUyMCUzRCUyMFRyYWluZXIoJTBBJTIwJTIwJTIwJTIwbW9kZWwlM0Rtb2RlbCUyQyUwQSUyMCUyMCUyMCUyMGFyZ3MlM0R0cmFpbmluZ19hcmdzJTJDJTBBJTIwJTIwJTIwJTIwdHJhaW5fZGF0YXNldCUzRGxtX2RhdGFzZXQlNUIlMjJ0cmFpbiUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMGV2YWxfZGF0YXNldCUzRGxtX2RhdGFzZXQlNUIlMjJ0ZXN0JTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwZGF0YV9jb2xsYXRvciUzRGRhdGFfY29sbGF0b3IlMkMlMEEpJTBBJTBBdHJhaW5lci50cmFpbigp",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_mlm_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>    num_train_epochs=<span class="hljs-number">3</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}}),B=new I({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">8.76</span>`,wrap:!1}}),F=new I({props:{code:"dHJhaW5lci5wdXNoX3RvX2h1Yigp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.push_to_hub()',wrap:!1}}),{c(){g(t.$$.fragment),c=o(),e=b("p"),e.innerHTML=m,u=o(),g(f.$$.fragment),G=o(),C=b("p"),C.textContent=v,W=o(),U=b("ol"),U.innerHTML=H,R=o(),g(k.$$.fragment),V=o(),p=b("p"),p.innerHTML=J,E=o(),g(B.$$.fragment),X=o(),Y=b("p"),Y.innerHTML=N,Q=o(),g(F.$$.fragment)},l(h){M(t.$$.fragment,h),c=i(h),e=w(h,"P",{"data-svelte-h":!0}),T(e)!=="svelte-j58c41"&&(e.innerHTML=m),u=i(h),M(f.$$.fragment,h),G=i(h),C=w(h,"P",{"data-svelte-h":!0}),T(C)!=="svelte-adwu43"&&(C.textContent=v),W=i(h),U=w(h,"OL",{"data-svelte-h":!0}),T(U)!=="svelte-1qz54pn"&&(U.innerHTML=H),R=i(h),M(k.$$.fragment,h),V=i(h),p=w(h,"P",{"data-svelte-h":!0}),T(p)!=="svelte-d2qmt2"&&(p.innerHTML=J),E=i(h),M(B.$$.fragment,h),X=i(h),Y=w(h,"P",{"data-svelte-h":!0}),T(Y)!=="svelte-1sgaay4"&&(Y.innerHTML=N),Q=i(h),M(F.$$.fragment,h)},m(h,_){d(t,h,_),a(h,c,_),a(h,e,_),a(h,u,_),d(f,h,_),a(h,G,_),a(h,C,_),a(h,W,_),a(h,U,_),a(h,R,_),d(k,h,_),a(h,V,_),a(h,p,_),a(h,E,_),d(B,h,_),a(h,X,_),a(h,Y,_),a(h,Q,_),d(F,h,_),z=!0},p(h,_){const L={};_&2&&(L.$$scope={dirty:_,ctx:h}),t.$set(L)},i(h){z||(j(t.$$.fragment,h),j(f.$$.fragment,h),j(k.$$.fragment,h),j(B.$$.fragment,h),j(F.$$.fragment,h),z=!0)},o(h){y(t.$$.fragment,h),y(f.$$.fragment,h),y(k.$$.fragment,h),y(B.$$.fragment,h),y(F.$$.fragment,h),z=!1},d(h){h&&(l(c),l(e),l(u),l(G),l(C),l(W),l(U),l(R),l(V),l(p),l(E),l(X),l(Y),l(Q)),$(t,h),$(f,h),$(k,h),$(B,h),$(F,h)}}}function ce(Z){let t,c;return t=new Ws({props:{$$slots:{default:[me]},$$scope:{ctx:Z}}}),{c(){g(t.$$.fragment)},l(e){M(t.$$.fragment,e)},m(e,m){d(t,e,m),c=!0},p(e,m){const u={};m&2&&(u.$$scope={dirty:m,ctx:e}),t.$set(u)},i(e){c||(j(t.$$.fragment,e),c=!0)},o(e){y(t.$$.fragment,e),c=!1},d(e){$(t,e)}}}function he(Z){let t,c='Keras로 모델을 미세 조정하는 데 익숙하지 않다면 기본 튜토리얼 <a href="../training#train-a-tensorflow-model-with-keras">여기</a>를 살펴보세요!';return{c(){t=b("p"),t.innerHTML=c},l(e){t=w(e,"P",{"data-svelte-h":!0}),T(t)!=="svelte-2dbfdz"&&(t.innerHTML=c)},m(e,m){a(e,t,m)},p:ss,d(e){e&&l(t)}}}function fe(Z){let t,c,e,m,u,f="다음으로 <code>TFAutoModelForMaskedLM</code>를 사용해 DistilRoBERTa 모델을 가져옵니다:",G,C,v,W,U="<code>prepare_tf_dataset()</code> 메소드를 사용해 데이터 세트를 <code>tf.data.Dataset</code> 형식으로 변환하세요:",H,R,k,V,p='<a href="https://keras.io/api/models/model_training_apis/#compile-method" rel="nofollow"><code>compile</code></a> 메소드를 통해 모델 훈련을 구성합니다:',J,E,B,X,Y="이는 업로드할 모델과 토크나이저의 위치를 <code>PushToHubCallback</code>에 지정하여 수행할 수 있습니다:",N,Q,F,z,h=`드디어 모델을 훈련할 준비가 되었습니다!
모델을 미세 조정할 때 훈련 및 검증 데이터 세트, 에포크 수, 콜백이 포함된 <a href="https://keras.io/api/models/model_training_apis/#fit-method" rel="nofollow"><code>fit</code></a>을 호출합니다:`,_,L,S,A,ts="훈련이 완료되면, 자동으로 Hub로 업로드되어 누구나 사용할 수 있습니다!",q;return t=new wt({props:{$$slots:{default:[he]},$$scope:{ctx:Z}}}),e=new I({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}}),C=new I({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGQXV0b01vZGVsRm9yTWFza2VkTE0lMEElMEFtb2RlbCUyMCUzRCUyMFRGQXV0b01vZGVsRm9yTWFza2VkTE0uZnJvbV9wcmV0cmFpbmVkKCUyMmRpc3RpbGJlcnQlMkZkaXN0aWxyb2JlcnRhLWJhc2UlMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFAutoModelForMaskedLM

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFAutoModelForMaskedLM.from_pretrained(<span class="hljs-string">&quot;distilbert/distilroberta-base&quot;</span>)`,wrap:!1}}),R=new I({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}}),E=new I({props:{code:"aW1wb3J0JTIwdGVuc29yZmxvdyUyMGFzJTIwdGYlMEElMEFtb2RlbC5jb21waWxlKG9wdGltaXplciUzRG9wdGltaXplcik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf

<span class="hljs-meta">&gt;&gt;&gt; </span>model.<span class="hljs-built_in">compile</span>(optimizer=optimizer)`,wrap:!1}}),Q=new I({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycy5rZXJhc19jYWxsYmFja3MlMjBpbXBvcnQlMjBQdXNoVG9IdWJDYWxsYmFjayUwQSUwQWNhbGxiYWNrJTIwJTNEJTIwUHVzaFRvSHViQ2FsbGJhY2soJTBBJTIwJTIwJTIwJTIwb3V0cHV0X2RpciUzRCUyMm15X2F3ZXNvbWVfZWxpNV9tbG1fbW9kZWwlMjIlMkMlMEElMjAlMjAlMjAlMjB0b2tlbml6ZXIlM0R0b2tlbml6ZXIlMkMlMEEp",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_mlm_model&quot;</span>,
<span class="hljs-meta">... </span>    tokenizer=tokenizer,
<span class="hljs-meta">... </span>)`,wrap:!1}}),L=new I({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(t.$$.fragment),c=se(`
TensorFlow로 모델을 미세 조정하기 위해서는 옵티마이저(optimizer) 함수 설정, 학습률(learning rate) 스케쥴링, 훈련 하이퍼파라미터 설정부터 시작하세요:

	`),g(e.$$.fragment),m=o(),u=b("p"),u.innerHTML=f,G=o(),g(C.$$.fragment),v=o(),W=b("p"),W.innerHTML=U,H=o(),g(R.$$.fragment),k=o(),V=b("p"),V.innerHTML=p,J=o(),g(E.$$.fragment),B=o(),X=b("p"),X.innerHTML=Y,N=o(),g(Q.$$.fragment),F=o(),z=b("p"),z.innerHTML=h,_=o(),g(L.$$.fragment),S=o(),A=b("p"),A.textContent=ts},l(r){M(t.$$.fragment,r),c=te(r,`
TensorFlow로 모델을 미세 조정하기 위해서는 옵티마이저(optimizer) 함수 설정, 학습률(learning rate) 스케쥴링, 훈련 하이퍼파라미터 설정부터 시작하세요:

	`),M(e.$$.fragment,r),m=i(r),u=w(r,"P",{"data-svelte-h":!0}),T(u)!=="svelte-gg210g"&&(u.innerHTML=f),G=i(r),M(C.$$.fragment,r),v=i(r),W=w(r,"P",{"data-svelte-h":!0}),T(W)!=="svelte-s4fgj9"&&(W.innerHTML=U),H=i(r),M(R.$$.fragment,r),k=i(r),V=w(r,"P",{"data-svelte-h":!0}),T(V)!=="svelte-1nhrjql"&&(V.innerHTML=p),J=i(r),M(E.$$.fragment,r),B=i(r),X=w(r,"P",{"data-svelte-h":!0}),T(X)!=="svelte-5310au"&&(X.innerHTML=Y),N=i(r),M(Q.$$.fragment,r),F=i(r),z=w(r,"P",{"data-svelte-h":!0}),T(z)!=="svelte-3mv0xn"&&(z.innerHTML=h),_=i(r),M(L.$$.fragment,r),S=i(r),A=w(r,"P",{"data-svelte-h":!0}),T(A)!=="svelte-1v3ov90"&&(A.textContent=ts)},m(r,x){d(t,r,x),a(r,c,x),d(e,r,x),a(r,m,x),a(r,u,x),a(r,G,x),d(C,r,x),a(r,v,x),a(r,W,x),a(r,H,x),d(R,r,x),a(r,k,x),a(r,V,x),a(r,J,x),d(E,r,x),a(r,B,x),a(r,X,x),a(r,N,x),d(Q,r,x),a(r,F,x),a(r,z,x),a(r,_,x),d(L,r,x),a(r,S,x),a(r,A,x),q=!0},p(r,x){const Rs={};x&2&&(Rs.$$scope={dirty:x,ctx:r}),t.$set(Rs)},i(r){q||(j(t.$$.fragment,r),j(e.$$.fragment,r),j(C.$$.fragment,r),j(R.$$.fragment,r),j(E.$$.fragment,r),j(Q.$$.fragment,r),j(L.$$.fragment,r),q=!0)},o(r){y(t.$$.fragment,r),y(e.$$.fragment,r),y(C.$$.fragment,r),y(R.$$.fragment,r),y(E.$$.fragment,r),y(Q.$$.fragment,r),y(L.$$.fragment,r),q=!1},d(r){r&&(l(c),l(m),l(u),l(G),l(v),l(W),l(H),l(k),l(V),l(J),l(B),l(X),l(N),l(F),l(z),l(_),l(S),l(A)),$(t,r),$(e,r),$(C,r),$(R,r),$(E,r),$(Q,r),$(L,r)}}}function ue(Z){let t,c;return t=new Ws({props:{$$slots:{default:[fe]},$$scope:{ctx:Z}}}),{c(){g(t.$$.fragment)},l(e){M(t.$$.fragment,e)},m(e,m){d(t,e,m),c=!0},p(e,m){const u={};m&2&&(u.$$scope={dirty:m,ctx:e}),t.$set(u)},i(e){c||(j(t.$$.fragment,e),c=!0)},o(e){y(t.$$.fragment,e),c=!1},d(e){$(t,e)}}}function ge(Z){let t,c=`마스킹된 언어 모델링을 위해 모델을 미세 조정하는 방법에 대한 보다 심층적인 예제는
<a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling.ipynb" rel="nofollow">PyTorch notebook</a>
또는 <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/language_modeling-tf.ipynb" rel="nofollow">TensorFlow notebook</a>을 참조하세요.`;return{c(){t=b("p"),t.innerHTML=c},l(e){t=w(e,"P",{"data-svelte-h":!0}),T(t)!=="svelte-rnza4"&&(t.innerHTML=c)},m(e,m){a(e,t,m)},p:ss,d(e){e&&l(t)}}}function Me(Z){let t,c=`텍스트를 토큰화하고 <code>input_ids</code>를 PyTorch 텐서 형태로 반환합니다.
또한, <code>&lt;mask&gt;</code> 토큰의 위치를 지정해야 합니다:`,e,m,u,f,G="모델에 <code>inputs</code>를 입력하고, 마스킹된 토큰의 <code>logits</code>를 반환합니다:",C,v,W,U,H="그런 다음 가장 높은 확률은 가진 마스크 토큰 3개를 반환하고, 출력합니다:",R,k,V;return m=new I({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJteV9hd2Vzb21lX2VsaTVfbWxtX21vZGVsJTIyKSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplcih0ZXh0JTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEFtYXNrX3Rva2VuX2luZGV4JTIwJTNEJTIwdG9yY2gud2hlcmUoaW5wdXRzJTVCJTIyaW5wdXRfaWRzJTIyJTVEJTIwJTNEJTNEJTIwdG9rZW5pemVyLm1hc2tfdG9rZW5faWQpJTVCMSU1RA==",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_mlm_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(text, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>mask_token_index = torch.where(inputs[<span class="hljs-string">&quot;input_ids&quot;</span>] == tokenizer.mask_token_id)[<span class="hljs-number">1</span>]`,wrap:!1}}),v=new I({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvck1hc2tlZExNJTBBJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JNYXNrZWRMTS5mcm9tX3ByZXRyYWluZWQoJTIyc3RldmhsaXUlMkZteV9hd2Vzb21lX2VsaTVfbWxtX21vZGVsJTIyKSUwQWxvZ2l0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKS5sb2dpdHMlMEFtYXNrX3Rva2VuX2xvZ2l0cyUyMCUzRCUyMGxvZ2l0cyU1QjAlMkMlMjBtYXNrX3Rva2VuX2luZGV4JTJDJTIwJTNBJTVE",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForMaskedLM

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForMaskedLM.from_pretrained(<span class="hljs-string">&quot;stevhliu/my_awesome_eli5_mlm_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = model(**inputs).logits
<span class="hljs-meta">&gt;&gt;&gt; </span>mask_token_logits = logits[<span class="hljs-number">0</span>, mask_token_index, :]`,wrap:!1}}),k=new I({props:{code:"dG9wXzNfdG9rZW5zJTIwJTNEJTIwdG9yY2gudG9wayhtYXNrX3Rva2VuX2xvZ2l0cyUyQyUyMDMlMkMlMjBkaW0lM0QxKS5pbmRpY2VzJTVCMCU1RC50b2xpc3QoKSUwQSUwQWZvciUyMHRva2VuJTIwaW4lMjB0b3BfM190b2tlbnMlM0ElMEElMjAlMjAlMjAlMjBwcmludCh0ZXh0LnJlcGxhY2UodG9rZW5pemVyLm1hc2tfdG9rZW4lMkMlMjB0b2tlbml6ZXIuZGVjb2RlKCU1QnRva2VuJTVEKSkp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>top_3_tokens = torch.topk(mask_token_logits, <span class="hljs-number">3</span>, dim=<span class="hljs-number">1</span>).indices[<span class="hljs-number">0</span>].tolist()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> token <span class="hljs-keyword">in</span> top_3_tokens:
<span class="hljs-meta">... </span>    <span class="hljs-built_in">print</span>(text.replace(tokenizer.mask_token, tokenizer.decode([token])))
The Milky Way <span class="hljs-keyword">is</span> a spiral galaxy.
The Milky Way <span class="hljs-keyword">is</span> a massive galaxy.
The Milky Way <span class="hljs-keyword">is</span> a small galaxy.`,wrap:!1}}),{c(){t=b("p"),t.innerHTML=c,e=o(),g(m.$$.fragment),u=o(),f=b("p"),f.innerHTML=G,C=o(),g(v.$$.fragment),W=o(),U=b("p"),U.textContent=H,R=o(),g(k.$$.fragment)},l(p){t=w(p,"P",{"data-svelte-h":!0}),T(t)!=="svelte-1iuu1u"&&(t.innerHTML=c),e=i(p),M(m.$$.fragment,p),u=i(p),f=w(p,"P",{"data-svelte-h":!0}),T(f)!=="svelte-zykhjj"&&(f.innerHTML=G),C=i(p),M(v.$$.fragment,p),W=i(p),U=w(p,"P",{"data-svelte-h":!0}),T(U)!=="svelte-pa5g1"&&(U.textContent=H),R=i(p),M(k.$$.fragment,p)},m(p,J){a(p,t,J),a(p,e,J),d(m,p,J),a(p,u,J),a(p,f,J),a(p,C,J),d(v,p,J),a(p,W,J),a(p,U,J),a(p,R,J),d(k,p,J),V=!0},p:ss,i(p){V||(j(m.$$.fragment,p),j(v.$$.fragment,p),j(k.$$.fragment,p),V=!0)},o(p){y(m.$$.fragment,p),y(v.$$.fragment,p),y(k.$$.fragment,p),V=!1},d(p){p&&(l(t),l(e),l(u),l(f),l(C),l(W),l(U),l(R)),$(m,p),$(v,p),$(k,p)}}}function de(Z){let t,c;return t=new Ws({props:{$$slots:{default:[Me]},$$scope:{ctx:Z}}}),{c(){g(t.$$.fragment)},l(e){M(t.$$.fragment,e)},m(e,m){d(t,e,m),c=!0},p(e,m){const u={};m&2&&(u.$$scope={dirty:m,ctx:e}),t.$set(u)},i(e){c||(j(t.$$.fragment,e),c=!0)},o(e){y(t.$$.fragment,e),c=!1},d(e){$(t,e)}}}function je(Z){let t,c=`텍스트를 토큰화하고 <code>input_ids</code>를 TensorFlow 텐서 형태로 반환합니다.
또한, <code>&lt;mask&gt;</code> 토큰의 위치를 지정해야 합니다:`,e,m,u,f,G="모델에 <code>inputs</code>를 입력하고, 마스킹된 토큰의 <code>logits</code>를 반환합니다:",C,v,W,U,H="그런 다음 가장 높은 확률은 가진 마스크 토큰 3개를 반환하고, 출력합니다:",R,k,V;return m=new I({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJteV9hd2Vzb21lX2VsaTVfbWxtX21vZGVsJTIyKSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplcih0ZXh0JTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJ0ZiUyMiklMEFtYXNrX3Rva2VuX2luZGV4JTIwJTNEJTIwdGYud2hlcmUoaW5wdXRzJTVCJTIyaW5wdXRfaWRzJTIyJTVEJTIwJTNEJTNEJTIwdG9rZW5pemVyLm1hc2tfdG9rZW5faWQpJTVCMCUyQyUyMDElNUQ=",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_mlm_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(text, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>mask_token_index = tf.where(inputs[<span class="hljs-string">&quot;input_ids&quot;</span>] == tokenizer.mask_token_id)[<span class="hljs-number">0</span>, <span class="hljs-number">1</span>]`,wrap:!1}}),v=new I({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGQXV0b01vZGVsRm9yTWFza2VkTE0lMEElMEFtb2RlbCUyMCUzRCUyMFRGQXV0b01vZGVsRm9yTWFza2VkTE0uZnJvbV9wcmV0cmFpbmVkKCUyMnN0ZXZobGl1JTJGbXlfYXdlc29tZV9lbGk1X21sbV9tb2RlbCUyMiklMEFsb2dpdHMlMjAlM0QlMjBtb2RlbCgqKmlucHV0cykubG9naXRzJTBBbWFza190b2tlbl9sb2dpdHMlMjAlM0QlMjBsb2dpdHMlNUIwJTJDJTIwbWFza190b2tlbl9pbmRleCUyQyUyMCUzQSU1RA==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFAutoModelForMaskedLM

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFAutoModelForMaskedLM.from_pretrained(<span class="hljs-string">&quot;stevhliu/my_awesome_eli5_mlm_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>logits = model(**inputs).logits
<span class="hljs-meta">&gt;&gt;&gt; </span>mask_token_logits = logits[<span class="hljs-number">0</span>, mask_token_index, :]`,wrap:!1}}),k=new I({props:{code:"dG9wXzNfdG9rZW5zJTIwJTNEJTIwdGYubWF0aC50b3BfayhtYXNrX3Rva2VuX2xvZ2l0cyUyQyUyMDMpLmluZGljZXMubnVtcHkoKSUwQSUwQWZvciUyMHRva2VuJTIwaW4lMjB0b3BfM190b2tlbnMlM0ElMEElMjAlMjAlMjAlMjBwcmludCh0ZXh0LnJlcGxhY2UodG9rZW5pemVyLm1hc2tfdG9rZW4lMkMlMjB0b2tlbml6ZXIuZGVjb2RlKCU1QnRva2VuJTVEKSkp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>top_3_tokens = tf.math.top_k(mask_token_logits, <span class="hljs-number">3</span>).indices.numpy()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">for</span> token <span class="hljs-keyword">in</span> top_3_tokens:
<span class="hljs-meta">... </span>    <span class="hljs-built_in">print</span>(text.replace(tokenizer.mask_token, tokenizer.decode([token])))
The Milky Way <span class="hljs-keyword">is</span> a spiral galaxy.
The Milky Way <span class="hljs-keyword">is</span> a massive galaxy.
The Milky Way <span class="hljs-keyword">is</span> a small galaxy.`,wrap:!1}}),{c(){t=b("p"),t.innerHTML=c,e=o(),g(m.$$.fragment),u=o(),f=b("p"),f.innerHTML=G,C=o(),g(v.$$.fragment),W=o(),U=b("p"),U.textContent=H,R=o(),g(k.$$.fragment)},l(p){t=w(p,"P",{"data-svelte-h":!0}),T(t)!=="svelte-67cw7a"&&(t.innerHTML=c),e=i(p),M(m.$$.fragment,p),u=i(p),f=w(p,"P",{"data-svelte-h":!0}),T(f)!=="svelte-zykhjj"&&(f.innerHTML=G),C=i(p),M(v.$$.fragment,p),W=i(p),U=w(p,"P",{"data-svelte-h":!0}),T(U)!=="svelte-pa5g1"&&(U.textContent=H),R=i(p),M(k.$$.fragment,p)},m(p,J){a(p,t,J),a(p,e,J),d(m,p,J),a(p,u,J),a(p,f,J),a(p,C,J),d(v,p,J),a(p,W,J),a(p,U,J),a(p,R,J),d(k,p,J),V=!0},p:ss,i(p){V||(j(m.$$.fragment,p),j(v.$$.fragment,p),j(k.$$.fragment,p),V=!0)},o(p){y(m.$$.fragment,p),y(v.$$.fragment,p),y(k.$$.fragment,p),V=!1},d(p){p&&(l(t),l(e),l(u),l(f),l(C),l(W),l(U),l(R)),$(m,p),$(v,p),$(k,p)}}}function ye(Z){let t,c;return t=new Ws({props:{$$slots:{default:[je]},$$scope:{ctx:Z}}}),{c(){g(t.$$.fragment)},l(e){M(t.$$.fragment,e)},m(e,m){d(t,e,m),c=!0},p(e,m){const u={};m&2&&(u.$$scope={dirty:m,ctx:e}),t.$set(u)},i(e){c||(j(t.$$.fragment,e),c=!0)},o(e){y(t.$$.fragment,e),c=!1},d(e){$(t,e)}}}function $e(Z){let t,c,e,m,u,f,G,C,v,W,U,H=`마스킹된 언어 모델링은 시퀀스에서 마스킹된 토큰을 예측하며, 모델은 양방향으로 토큰에 액세스할 수 있습니다.
즉, 모델은 토큰의 왼쪽과 오른쪽 양쪽에서 접근할 수 있습니다.
마스킹된 언어 모델링은 전체 시퀀스에 대한 문맥적 이해가 필요한 작업에 적합하며, BERT가 그 예에 해당합니다.`,R,k,V="이번 가이드에서 다룰 내용은 다음과 같습니다:",p,J,E='<li><a href="https://huggingface.co/datasets/eli5" rel="nofollow">ELI5</a> 데이터 세트에서 <a href="https://www.reddit.com/r/askscience/" rel="nofollow">r/askscience</a> 부분을 사용해 <a href="https://huggingface.co/distilbert/distilroberta-base" rel="nofollow">DistilRoBERTa</a> 모델을 미세 조정합니다.</li> <li>추론 시에 직접 미세 조정한 모델을 사용합니다.</li>',B,X,Y,N,Q="시작하기 전에 필요한 라이브러리가 모두 설치되어 있는지 확인하세요:",F,z,h,_,L="Hugging Face 계정에 로그인하여 모델을 업로드하고 커뮤니티와의 공유를 권장합니다. 메시지가 표시되면(When prompted) 토큰을 입력하여 로그인합니다:",S,A,ts,q,r,x,Rs=`먼저 🤗 Datasets 라이브러리에서 ELI5 데이터 세트의 r/askscience 중 일부만 가져옵니다.
이렇게 하면 전체 데이터 세트 학습에 더 많은 시간을 할애하기 전에 모든 것이 작동하는지 실험하고 확인할 수 있습니다.`,zs,es,Bs,ls,Jt="데이터 세트의 <code>train_asks</code>를 <code>train_test_split</code> 메소드를 사용해 훈련 데이터와 테스트 데이터로 분할합니다:",Fs,as,Hs,ns,kt="그리고 아래 예시를 살펴보세요:",Es,ps,Ys,rs,xt=`많아 보일 수 있지만 실제로는 <code>text</code> 필드에만 집중하면 됩나다.
언어 모델링 작업의 멋진 점은 (비지도 학습으로) <em>다음 단어가 레이블</em>이기 때문에 레이블이 따로 필요하지 않습니다.`,Ns,os,Qs,is,As,ms,_t="마스킹된 언어 모델링을 위해, 다음 단계로 DistilRoBERTa 토크나이저를 가져와서 <code>text</code> 하위 필드를 처리합니다:",Ls,cs,qs,hs,Ut=`위의 예제에서와 마찬가지로, <code>text</code> 필드는 <code>answers</code> 안에 중첩되어 있습니다.
따라서 중첩된 구조에서 <a href="https://huggingface.co/docs/datasets/process#flatten" rel="nofollow"><code>flatten</code></a> 메소드를 사용하여 <code>text</code> 하위 필드를 추출합니다:`,Ss,fs,Ps,us,Zt=`이제 각 하위 필드는 <code>answers</code> 접두사(prefix)로 표시된 대로 별도의 열이 되고, <code>text</code> 필드는 이제 리스트가 되었습니다.
각 문장을 개별적으로 토큰화하는 대신 리스트를 문자열로 변환하여 한번에 토큰화할 수 있습니다.`,Ds,gs,Gt="다음은 각 예제에 대해 문자열로 이루어진 리스트를 <code>join</code>하고 결과를 토큰화하는 첫 번째 전처리 함수입니다:",Ks,Ms,Os,ds,vt=`이 전처리 함수를 전체 데이터 세트에 적용하기 위해 🤗 Datasets <code>map</code> 메소드를 사용합니다.
데이터 세트의 여러 요소를 한 번에 처리하도록 <code>batched=True</code>를 설정하고 <code>num_proc</code>로 처리 횟수를 늘리면 <code>map</code> 함수의 속도를 높일 수 있습니다.
필요하지 않은 열은 제거합니다:`,st,js,tt,ys,It="이 데이터 세트에는 토큰 시퀀스가 포함되어 있지만 이 중 일부는 모델의 최대 입력 길이보다 깁니다.",et,$s,Ct="이제 두 번째 전처리 함수를 사용해",lt,bs,Wt="<li>모든 시퀀스를 연결하고</li> <li>연결된 시퀀스를 정의한 <code>block_size</code> 보다 더 짧은 덩어리로 분할하는데, 이 덩어리는 모델의 최대 입력 길이보다 짧고 GPU RAM이 수용할 수 있는 길이여야 합니다.</li>",at,ws,nt,Ts,Rt="전체 데이터 세트에 <code>group_texts</code> 함수를 적용합니다:",pt,Js,rt,ks,Vt=`이제 <code>DataCollatorForLanguageModeling</code>을 사용하여 데이터 예제의 배치를 생성합니다.
데이터 세트 전체를 최대 길이로 패딩하는 것보다 collation 단계에서 매 배치안에서의 최대 길이로 문장을 <em>동적으로 패딩</em>하는 것이 더 효율적입니다.`,ot,P,it,xs,mt,D,ct,K,ht,_s,ft,Us,Xt="지금까지 모델 미세 조정을 잘 했으니, 추론에 사용할 수 있습니다!",ut,Zs,zt="모델이 빈칸을 채울 텍스트를 스페셜 토큰(special token)인 <code>&lt;mask&gt;</code> 토큰으로 표시합니다:",gt,Gs,Mt,vs,Bt=`추론을 위해 미세 조정한 모델을 테스트하는 가장 간단한 방법은 <code>pipeline()</code>에서 사용하는 것입니다.
<code>fill-mask</code>태스크로 <code>pipeline</code>을 인스턴스화하고 텍스트를 전달합니다.
<code>top_k</code> 매개변수를 사용하여 반환하는 예측의 수를 지정할 수 있습니다:`,dt,Is,jt,O,yt,Cs,$t,Vs,bt;return u=new Xs({props:{title:"마스킹된 언어 모델링(Masked language modeling)",local:"masked-language-modeling",headingTag:"h1"}}),G=new ee({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/masked_language_modeling.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/ko/pytorch/masked_language_modeling.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/ko/tensorflow/masked_language_modeling.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ko/masked_language_modeling.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ko/pytorch/masked_language_modeling.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ko/tensorflow/masked_language_modeling.ipynb"}]}}),v=new Lt({props:{id:"mqElG5QJWUg"}}),X=new wt({props:{$$slots:{default:[ae]},$$scope:{ctx:Z}}}),z=new I({props:{code:"cGlwJTIwaW5zdGFsbCUyMHRyYW5zZm9ybWVycyUyMGRhdGFzZXRzJTIwZXZhbHVhdGU=",highlighted:"pip install transformers datasets evaluate",wrap:!1}}),A=new I({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 Xs({props:{title:"ELI5 데이터 세트 가져오기",local:"load-eli5-dataset",headingTag:"h2"}}),es=new I({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}}),as=new I({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}}),ps=new I({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}}),os=new Xs({props:{title:"전처리",local:"preprocess",headingTag:"h2"}}),is=new Lt({props:{id:"8PmhEIXhBvI"}}),cs=new I({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJkaXN0aWxiZXJ0JTJGZGlzdGlscm9iZXJ0YS1iYXNlJTIyKQ==",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/distilroberta-base&quot;</span>)`,wrap:!1}}),fs=new I({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}}),Ms=new I({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}}),js=new I({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}}),ws=new I({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}}),Js=new I({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 Tt({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[oe],pytorch:[pe]},$$scope:{ctx:Z}}}),xs=new Xs({props:{title:"훈련",local:"train",headingTag:"h2"}}),D=new Tt({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[ue],pytorch:[ce]},$$scope:{ctx:Z}}}),K=new wt({props:{$$slots:{default:[ge]},$$scope:{ctx:Z}}}),_s=new Xs({props:{title:"추론",local:"inference",headingTag:"h2"}}),Gs=new I({props:{code:"dGV4dCUyMCUzRCUyMCUyMlRoZSUyME1pbGt5JTIwV2F5JTIwaXMlMjBhJTIwJTNDbWFzayUzRSUyMGdhbGF4eS4lMjI=",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>text = <span class="hljs-string">&quot;The Milky Way is a &lt;mask&gt; galaxy.&quot;</span>',wrap:!1}}),Is=new I({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBbWFza19maWxsZXIlMjAlM0QlMjBwaXBlbGluZSglMjJmaWxsLW1hc2slMjIlMkMlMjAlMjJzdGV2aGxpdSUyRm15X2F3ZXNvbWVfZWxpNV9tbG1fbW9kZWwlMjIpJTBBbWFza19maWxsZXIodGV4dCUyQyUyMHRvcF9rJTNEMyk=",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>mask_filler = pipeline(<span class="hljs-string">&quot;fill-mask&quot;</span>, <span class="hljs-string">&quot;stevhliu/my_awesome_eli5_mlm_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>mask_filler(text, top_k=<span class="hljs-number">3</span>)
[{<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.5150994658470154</span>,
  <span class="hljs-string">&#x27;token&#x27;</span>: <span class="hljs-number">21300</span>,
  <span class="hljs-string">&#x27;token_str&#x27;</span>: <span class="hljs-string">&#x27; spiral&#x27;</span>,
  <span class="hljs-string">&#x27;sequence&#x27;</span>: <span class="hljs-string">&#x27;The Milky Way is a spiral galaxy.&#x27;</span>},
 {<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.07087188959121704</span>,
  <span class="hljs-string">&#x27;token&#x27;</span>: <span class="hljs-number">2232</span>,
  <span class="hljs-string">&#x27;token_str&#x27;</span>: <span class="hljs-string">&#x27; massive&#x27;</span>,
  <span class="hljs-string">&#x27;sequence&#x27;</span>: <span class="hljs-string">&#x27;The Milky Way is a massive galaxy.&#x27;</span>},
 {<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.06434620916843414</span>,
  <span class="hljs-string">&#x27;token&#x27;</span>: <span class="hljs-number">650</span>,
  <span class="hljs-string">&#x27;token_str&#x27;</span>: <span class="hljs-string">&#x27; small&#x27;</span>,
  <span class="hljs-string">&#x27;sequence&#x27;</span>: <span class="hljs-string">&#x27;The Milky Way is a small galaxy.&#x27;</span>}]`,wrap:!1}}),O=new Tt({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[ye],pytorch:[de]},$$scope:{ctx:Z}}}),Cs=new le({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/ko/tasks/masked_language_modeling.md"}}),{c(){t=b("meta"),c=o(),e=b("p"),m=o(),g(u.$$.fragment),f=o(),g(G.$$.fragment),C=o(),g(v.$$.fragment),W=o(),U=b("p"),U.textContent=H,R=o(),k=b("p"),k.textContent=V,p=o(),J=b("ol"),J.innerHTML=E,B=o(),g(X.$$.fragment),Y=o(),N=b("p"),N.textContent=Q,F=o(),g(z.$$.fragment),h=o(),_=b("p"),_.textContent=L,S=o(),g(A.$$.fragment),ts=o(),g(q.$$.fragment),r=o(),x=b("p"),x.textContent=Rs,zs=o(),g(es.$$.fragment),Bs=o(),ls=b("p"),ls.innerHTML=Jt,Fs=o(),g(as.$$.fragment),Hs=o(),ns=b("p"),ns.textContent=kt,Es=o(),g(ps.$$.fragment),Ys=o(),rs=b("p"),rs.innerHTML=xt,Ns=o(),g(os.$$.fragment),Qs=o(),g(is.$$.fragment),As=o(),ms=b("p"),ms.innerHTML=_t,Ls=o(),g(cs.$$.fragment),qs=o(),hs=b("p"),hs.innerHTML=Ut,Ss=o(),g(fs.$$.fragment),Ps=o(),us=b("p"),us.innerHTML=Zt,Ds=o(),gs=b("p"),gs.innerHTML=Gt,Ks=o(),g(Ms.$$.fragment),Os=o(),ds=b("p"),ds.innerHTML=vt,st=o(),g(js.$$.fragment),tt=o(),ys=b("p"),ys.textContent=It,et=o(),$s=b("p"),$s.textContent=Ct,lt=o(),bs=b("ul"),bs.innerHTML=Wt,at=o(),g(ws.$$.fragment),nt=o(),Ts=b("p"),Ts.innerHTML=Rt,pt=o(),g(Js.$$.fragment),rt=o(),ks=b("p"),ks.innerHTML=Vt,ot=o(),g(P.$$.fragment),it=o(),g(xs.$$.fragment),mt=o(),g(D.$$.fragment),ct=o(),g(K.$$.fragment),ht=o(),g(_s.$$.fragment),ft=o(),Us=b("p"),Us.textContent=Xt,ut=o(),Zs=b("p"),Zs.innerHTML=zt,gt=o(),g(Gs.$$.fragment),Mt=o(),vs=b("p"),vs.innerHTML=Bt,dt=o(),g(Is.$$.fragment),jt=o(),g(O.$$.fragment),yt=o(),g(Cs.$$.fragment),$t=o(),Vs=b("p"),this.h()},l(s){const n=Kt("svelte-u9bgzb",document.head);t=w(n,"META",{name:!0,content:!0}),n.forEach(l),c=i(s),e=w(s,"P",{}),Qt(e).forEach(l),m=i(s),M(u.$$.fragment,s),f=i(s),M(G.$$.fragment,s),C=i(s),M(v.$$.fragment,s),W=i(s),U=w(s,"P",{"data-svelte-h":!0}),T(U)!=="svelte-1n9q4rf"&&(U.textContent=H),R=i(s),k=w(s,"P",{"data-svelte-h":!0}),T(k)!=="svelte-ccgtvl"&&(k.textContent=V),p=i(s),J=w(s,"OL",{"data-svelte-h":!0}),T(J)!=="svelte-1foddhj"&&(J.innerHTML=E),B=i(s),M(X.$$.fragment,s),Y=i(s),N=w(s,"P",{"data-svelte-h":!0}),T(N)!=="svelte-1k0z9pm"&&(N.textContent=Q),F=i(s),M(z.$$.fragment,s),h=i(s),_=w(s,"P",{"data-svelte-h":!0}),T(_)!=="svelte-m2mub0"&&(_.textContent=L),S=i(s),M(A.$$.fragment,s),ts=i(s),M(q.$$.fragment,s),r=i(s),x=w(s,"P",{"data-svelte-h":!0}),T(x)!=="svelte-vr9p67"&&(x.textContent=Rs),zs=i(s),M(es.$$.fragment,s),Bs=i(s),ls=w(s,"P",{"data-svelte-h":!0}),T(ls)!=="svelte-297gyr"&&(ls.innerHTML=Jt),Fs=i(s),M(as.$$.fragment,s),Hs=i(s),ns=w(s,"P",{"data-svelte-h":!0}),T(ns)!=="svelte-1aqlhyu"&&(ns.textContent=kt),Es=i(s),M(ps.$$.fragment,s),Ys=i(s),rs=w(s,"P",{"data-svelte-h":!0}),T(rs)!=="svelte-1cy2b9o"&&(rs.innerHTML=xt),Ns=i(s),M(os.$$.fragment,s),Qs=i(s),M(is.$$.fragment,s),As=i(s),ms=w(s,"P",{"data-svelte-h":!0}),T(ms)!=="svelte-1a969tz"&&(ms.innerHTML=_t),Ls=i(s),M(cs.$$.fragment,s),qs=i(s),hs=w(s,"P",{"data-svelte-h":!0}),T(hs)!=="svelte-1u6kx23"&&(hs.innerHTML=Ut),Ss=i(s),M(fs.$$.fragment,s),Ps=i(s),us=w(s,"P",{"data-svelte-h":!0}),T(us)!=="svelte-1tsflso"&&(us.innerHTML=Zt),Ds=i(s),gs=w(s,"P",{"data-svelte-h":!0}),T(gs)!=="svelte-1ry86e0"&&(gs.innerHTML=Gt),Ks=i(s),M(Ms.$$.fragment,s),Os=i(s),ds=w(s,"P",{"data-svelte-h":!0}),T(ds)!=="svelte-hhkhvj"&&(ds.innerHTML=vt),st=i(s),M(js.$$.fragment,s),tt=i(s),ys=w(s,"P",{"data-svelte-h":!0}),T(ys)!=="svelte-2gfwha"&&(ys.textContent=It),et=i(s),$s=w(s,"P",{"data-svelte-h":!0}),T($s)!=="svelte-dy2yct"&&($s.textContent=Ct),lt=i(s),bs=w(s,"UL",{"data-svelte-h":!0}),T(bs)!=="svelte-1t9aqgv"&&(bs.innerHTML=Wt),at=i(s),M(ws.$$.fragment,s),nt=i(s),Ts=w(s,"P",{"data-svelte-h":!0}),T(Ts)!=="svelte-by0nu8"&&(Ts.innerHTML=Rt),pt=i(s),M(Js.$$.fragment,s),rt=i(s),ks=w(s,"P",{"data-svelte-h":!0}),T(ks)!=="svelte-izyzcu"&&(ks.innerHTML=Vt),ot=i(s),M(P.$$.fragment,s),it=i(s),M(xs.$$.fragment,s),mt=i(s),M(D.$$.fragment,s),ct=i(s),M(K.$$.fragment,s),ht=i(s),M(_s.$$.fragment,s),ft=i(s),Us=w(s,"P",{"data-svelte-h":!0}),T(Us)!=="svelte-8jfat8"&&(Us.textContent=Xt),ut=i(s),Zs=w(s,"P",{"data-svelte-h":!0}),T(Zs)!=="svelte-9tmh7v"&&(Zs.innerHTML=zt),gt=i(s),M(Gs.$$.fragment,s),Mt=i(s),vs=w(s,"P",{"data-svelte-h":!0}),T(vs)!=="svelte-1pw875r"&&(vs.innerHTML=Bt),dt=i(s),M(Is.$$.fragment,s),jt=i(s),M(O.$$.fragment,s),yt=i(s),M(Cs.$$.fragment,s),$t=i(s),Vs=w(s,"P",{}),Qt(Vs).forEach(l),this.h()},h(){At(t,"name","hf:doc:metadata"),At(t,"content",be)},m(s,n){Ot(document.head,t),a(s,c,n),a(s,e,n),a(s,m,n),d(u,s,n),a(s,f,n),d(G,s,n),a(s,C,n),d(v,s,n),a(s,W,n),a(s,U,n),a(s,R,n),a(s,k,n),a(s,p,n),a(s,J,n),a(s,B,n),d(X,s,n),a(s,Y,n),a(s,N,n),a(s,F,n),d(z,s,n),a(s,h,n),a(s,_,n),a(s,S,n),d(A,s,n),a(s,ts,n),d(q,s,n),a(s,r,n),a(s,x,n),a(s,zs,n),d(es,s,n),a(s,Bs,n),a(s,ls,n),a(s,Fs,n),d(as,s,n),a(s,Hs,n),a(s,ns,n),a(s,Es,n),d(ps,s,n),a(s,Ys,n),a(s,rs,n),a(s,Ns,n),d(os,s,n),a(s,Qs,n),d(is,s,n),a(s,As,n),a(s,ms,n),a(s,Ls,n),d(cs,s,n),a(s,qs,n),a(s,hs,n),a(s,Ss,n),d(fs,s,n),a(s,Ps,n),a(s,us,n),a(s,Ds,n),a(s,gs,n),a(s,Ks,n),d(Ms,s,n),a(s,Os,n),a(s,ds,n),a(s,st,n),d(js,s,n),a(s,tt,n),a(s,ys,n),a(s,et,n),a(s,$s,n),a(s,lt,n),a(s,bs,n),a(s,at,n),d(ws,s,n),a(s,nt,n),a(s,Ts,n),a(s,pt,n),d(Js,s,n),a(s,rt,n),a(s,ks,n),a(s,ot,n),d(P,s,n),a(s,it,n),d(xs,s,n),a(s,mt,n),d(D,s,n),a(s,ct,n),d(K,s,n),a(s,ht,n),d(_s,s,n),a(s,ft,n),a(s,Us,n),a(s,ut,n),a(s,Zs,n),a(s,gt,n),d(Gs,s,n),a(s,Mt,n),a(s,vs,n),a(s,dt,n),d(Is,s,n),a(s,jt,n),d(O,s,n),a(s,yt,n),d(Cs,s,n),a(s,$t,n),a(s,Vs,n),bt=!0},p(s,[n]){const Ft={};n&2&&(Ft.$$scope={dirty:n,ctx:s}),X.$set(Ft);const Ht={};n&2&&(Ht.$$scope={dirty:n,ctx:s}),P.$set(Ht);const Et={};n&2&&(Et.$$scope={dirty:n,ctx:s}),D.$set(Et);const Yt={};n&2&&(Yt.$$scope={dirty:n,ctx:s}),K.$set(Yt);const Nt={};n&2&&(Nt.$$scope={dirty:n,ctx:s}),O.$set(Nt)},i(s){bt||(j(u.$$.fragment,s),j(G.$$.fragment,s),j(v.$$.fragment,s),j(X.$$.fragment,s),j(z.$$.fragment,s),j(A.$$.fragment,s),j(q.$$.fragment,s),j(es.$$.fragment,s),j(as.$$.fragment,s),j(ps.$$.fragment,s),j(os.$$.fragment,s),j(is.$$.fragment,s),j(cs.$$.fragment,s),j(fs.$$.fragment,s),j(Ms.$$.fragment,s),j(js.$$.fragment,s),j(ws.$$.fragment,s),j(Js.$$.fragment,s),j(P.$$.fragment,s),j(xs.$$.fragment,s),j(D.$$.fragment,s),j(K.$$.fragment,s),j(_s.$$.fragment,s),j(Gs.$$.fragment,s),j(Is.$$.fragment,s),j(O.$$.fragment,s),j(Cs.$$.fragment,s),bt=!0)},o(s){y(u.$$.fragment,s),y(G.$$.fragment,s),y(v.$$.fragment,s),y(X.$$.fragment,s),y(z.$$.fragment,s),y(A.$$.fragment,s),y(q.$$.fragment,s),y(es.$$.fragment,s),y(as.$$.fragment,s),y(ps.$$.fragment,s),y(os.$$.fragment,s),y(is.$$.fragment,s),y(cs.$$.fragment,s),y(fs.$$.fragment,s),y(Ms.$$.fragment,s),y(js.$$.fragment,s),y(ws.$$.fragment,s),y(Js.$$.fragment,s),y(P.$$.fragment,s),y(xs.$$.fragment,s),y(D.$$.fragment,s),y(K.$$.fragment,s),y(_s.$$.fragment,s),y(Gs.$$.fragment,s),y(Is.$$.fragment,s),y(O.$$.fragment,s),y(Cs.$$.fragment,s),bt=!1},d(s){s&&(l(c),l(e),l(m),l(f),l(C),l(W),l(U),l(R),l(k),l(p),l(J),l(B),l(Y),l(N),l(F),l(h),l(_),l(S),l(ts),l(r),l(x),l(zs),l(Bs),l(ls),l(Fs),l(Hs),l(ns),l(Es),l(Ys),l(rs),l(Ns),l(Qs),l(As),l(ms),l(Ls),l(qs),l(hs),l(Ss),l(Ps),l(us),l(Ds),l(gs),l(Ks),l(Os),l(ds),l(st),l(tt),l(ys),l(et),l($s),l(lt),l(bs),l(at),l(nt),l(Ts),l(pt),l(rt),l(ks),l(ot),l(it),l(mt),l(ct),l(ht),l(ft),l(Us),l(ut),l(Zs),l(gt),l(Mt),l(vs),l(dt),l(jt),l(yt),l($t),l(Vs)),l(t),$(u,s),$(G,s),$(v,s),$(X,s),$(z,s),$(A,s),$(q,s),$(es,s),$(as,s),$(ps,s),$(os,s),$(is,s),$(cs,s),$(fs,s),$(Ms,s),$(js,s),$(ws,s),$(Js,s),$(P,s),$(xs,s),$(D,s),$(K,s),$(_s,s),$(Gs,s),$(Is,s),$(O,s),$(Cs,s)}}}const be='{"title":"마스킹된 언어 모델링(Masked language modeling)","local":"masked-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 we(Z){return St(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ve extends Pt{constructor(t){super(),Dt(this,t,we,$e,qt,{})}}export{ve as component};
