import{s as Yt,o as St,n as ss}from"../chunks/scheduler.56730f09.js";import{S as Lt,i as Dt,g as J,s as i,r as u,A as Pt,h as g,f as a,c as o,j as Et,u as j,x as T,k as Nt,y as Kt,a as n,v as f,d as w,t as h,w as d,m as Ot,n as se}from"../chunks/index.1f144517.js";import{T as Jt}from"../chunks/Tip.41e845e5.js";import{Y as qt}from"../chunks/Youtube.62e0f062.js";import{C as x}from"../chunks/CodeBlock.738eeccb.js";import{D as te}from"../chunks/DocNotebookDropdown.243c3df7.js";import{F as gt,M as xs}from"../chunks/Markdown.c541024b.js";import{H as Rs,E as ee}from"../chunks/EditOnGithub.854793f1.js";function le(I){let l,m='이 작업과 호환되는 모든 아키텍처와 체크포인트를 보려면 <a href="https://huggingface.co/tasks/question-answering" rel="nofollow">작업 페이지</a>를 확인하는 것이 좋습니다.';return{c(){l=J("p"),l.innerHTML=m},l(e){l=g(e,"P",{"data-svelte-h":!0}),T(l)!=="svelte-1dkxcum"&&(l.innerHTML=m)},m(e,M){n(e,l,M)},p:ss,d(e){e&&a(l)}}}function ae(I){let l,m;return l=new x({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERlZmF1bHREYXRhQ29sbGF0b3IlMEElMEFkYXRhX2NvbGxhdG9yJTIwJTNEJTIwRGVmYXVsdERhdGFDb2xsYXRvcigp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DefaultDataCollator

<span class="hljs-meta">&gt;&gt;&gt; </span>data_collator = DefaultDataCollator()`,wrap:!1}}),{c(){u(l.$$.fragment)},l(e){j(l.$$.fragment,e)},m(e,M){f(l,e,M),m=!0},p:ss,i(e){m||(w(l.$$.fragment,e),m=!0)},o(e){h(l.$$.fragment,e),m=!1},d(e){d(l,e)}}}function ne(I){let l,m;return l=new xs({props:{$$slots:{default:[ae]},$$scope:{ctx:I}}}),{c(){u(l.$$.fragment)},l(e){j(l.$$.fragment,e)},m(e,M){f(l,e,M),m=!0},p(e,M){const y={};M&2&&(y.$$scope={dirty:M,ctx:e}),l.$set(y)},i(e){m||(w(l.$$.fragment,e),m=!0)},o(e){h(l.$$.fragment,e),m=!1},d(e){d(l,e)}}}function pe(I){let l,m;return l=new x({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMERlZmF1bHREYXRhQ29sbGF0b3IlMEElMEFkYXRhX2NvbGxhdG9yJTIwJTNEJTIwRGVmYXVsdERhdGFDb2xsYXRvcihyZXR1cm5fdGVuc29ycyUzRCUyMnRmJTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DefaultDataCollator

<span class="hljs-meta">&gt;&gt;&gt; </span>data_collator = DefaultDataCollator(return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)`,wrap:!1}}),{c(){u(l.$$.fragment)},l(e){j(l.$$.fragment,e)},m(e,M){f(l,e,M),m=!0},p:ss,i(e){m||(w(l.$$.fragment,e),m=!0)},o(e){h(l.$$.fragment,e),m=!1},d(e){d(l,e)}}}function re(I){let l,m;return l=new xs({props:{$$slots:{default:[pe]},$$scope:{ctx:I}}}),{c(){u(l.$$.fragment)},l(e){j(l.$$.fragment,e)},m(e,M){f(l,e,M),m=!0},p(e,M){const y={};M&2&&(y.$$scope={dirty:M,ctx:e}),l.$set(y)},i(e){m||(w(l.$$.fragment,e),m=!0)},o(e){h(l.$$.fragment,e),m=!1},d(e){d(l,e)}}}function ie(I){let l,m='<code>Trainer</code>를 이용해 모델을 미세 조정하는 것에 익숙하지 않다면, <a href="../training#train-with-pytorch-trainer">여기</a>에서 기초 튜토리얼을 살펴보세요!';return{c(){l=J("p"),l.innerHTML=m},l(e){l=g(e,"P",{"data-svelte-h":!0}),T(l)!=="svelte-1mkjug2"&&(l.innerHTML=m)},m(e,M){n(e,l,M)},p:ss,d(e){e&&a(l)}}}function oe(I){let l,m,e,M="이제 모델 훈련을 시작할 준비가 되었습니다! <code>AutoModelForQuestionAnswering</code>으로 DistilBERT를 가져옵니다:",y,_,v,X,Z="이제 세 단계만 남았습니다:",B,b,F="<li><code>TrainingArguments</code>에서 훈련 하이퍼파라미터를 정합니다. 꼭 필요한 매개변수는 모델을 저장할 위치를 지정하는 <code>output_dir</code> 입니다. <code>push_to_hub=True</code>로 설정해서 이 모델을 Hub로 푸시합니다 (모델을 업로드하려면 Hugging Face에 로그인해야 합니다).</li> <li>모델, 데이터 세트, 토크나이저, 데이터 콜레이터와 함께 <code>Trainer</code>에 훈련 인수들을 전달합니다.</li> <li><code>train()</code>을 호출해서 모델을 미세 조정합니다.</li>",G,$,W,k,V="훈련이 완료되면, <code>push_to_hub()</code> 매소드를 사용해 모델을 Hub에 공유해서 모든 사람들이 사용할 수 있게 공유해주세요:",A,U,R;return l=new Jt({props:{$$slots:{default:[ie]},$$scope:{ctx:I}}}),_=new x({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvclF1ZXN0aW9uQW5zd2VyaW5nJTJDJTIwVHJhaW5pbmdBcmd1bWVudHMlMkMlMjBUcmFpbmVyJTBBJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JRdWVzdGlvbkFuc3dlcmluZy5mcm9tX3ByZXRyYWluZWQoJTIyZGlzdGlsYmVydCUyRmRpc3RpbGJlcnQtYmFzZS11bmNhc2VkJTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForQuestionAnswering, TrainingArguments, Trainer

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForQuestionAnswering.from_pretrained(<span class="hljs-string">&quot;distilbert/distilbert-base-uncased&quot;</span>)`,wrap:!1}}),$=new x({props:{code:"dHJhaW5pbmdfYXJncyUyMCUzRCUyMFRyYWluaW5nQXJndW1lbnRzKCUwQSUyMCUyMCUyMCUyMG91dHB1dF9kaXIlM0QlMjJteV9hd2Vzb21lX3FhX21vZGVsJTIyJTJDJTBBJTIwJTIwJTIwJTIwZXZhbF9zdHJhdGVneSUzRCUyMmVwb2NoJTIyJTJDJTBBJTIwJTIwJTIwJTIwbGVhcm5pbmdfcmF0ZSUzRDJlLTUlMkMlMEElMjAlMjAlMjAlMjBwZXJfZGV2aWNlX3RyYWluX2JhdGNoX3NpemUlM0QxNiUyQyUwQSUyMCUyMCUyMCUyMHBlcl9kZXZpY2VfZXZhbF9iYXRjaF9zaXplJTNEMTYlMkMlMEElMjAlMjAlMjAlMjBudW1fdHJhaW5fZXBvY2hzJTNEMyUyQyUwQSUyMCUyMCUyMCUyMHdlaWdodF9kZWNheSUzRDAuMDElMkMlMEElMjAlMjAlMjAlMjBwdXNoX3RvX2h1YiUzRFRydWUlMkMlMEEpJTBBJTBBdHJhaW5lciUyMCUzRCUyMFRyYWluZXIoJTBBJTIwJTIwJTIwJTIwbW9kZWwlM0Rtb2RlbCUyQyUwQSUyMCUyMCUyMCUyMGFyZ3MlM0R0cmFpbmluZ19hcmdzJTJDJTBBJTIwJTIwJTIwJTIwdHJhaW5fZGF0YXNldCUzRHRva2VuaXplZF9zcXVhZCU1QiUyMnRyYWluJTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwZXZhbF9kYXRhc2V0JTNEdG9rZW5pemVkX3NxdWFkJTVCJTIydGVzdCUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMHRva2VuaXplciUzRHRva2VuaXplciUyQyUwQSUyMCUyMCUyMCUyMGRhdGFfY29sbGF0b3IlM0RkYXRhX2NvbGxhdG9yJTJDJTBBKSUwQSUwQXRyYWluZXIudHJhaW4oKQ==",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_qa_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>    per_device_train_batch_size=<span class="hljs-number">16</span>,
<span class="hljs-meta">... </span>    per_device_eval_batch_size=<span class="hljs-number">16</span>,
<span class="hljs-meta">... </span>    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=tokenized_squad[<span class="hljs-string">&quot;train&quot;</span>],
<span class="hljs-meta">... </span>    eval_dataset=tokenized_squad[<span class="hljs-string">&quot;test&quot;</span>],
<span class="hljs-meta">... </span>    tokenizer=tokenizer,
<span class="hljs-meta">... </span>    data_collator=data_collator,
<span class="hljs-meta">... </span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.train()`,wrap:!1}}),U=new x({props:{code:"dHJhaW5lci5wdXNoX3RvX2h1Yigp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>trainer.push_to_hub()',wrap:!1}}),{c(){u(l.$$.fragment),m=i(),e=J("p"),e.innerHTML=M,y=i(),u(_.$$.fragment),v=i(),X=J("p"),X.textContent=Z,B=i(),b=J("ol"),b.innerHTML=F,G=i(),u($.$$.fragment),W=i(),k=J("p"),k.innerHTML=V,A=i(),u(U.$$.fragment)},l(t){j(l.$$.fragment,t),m=o(t),e=g(t,"P",{"data-svelte-h":!0}),T(e)!=="svelte-1l92urq"&&(e.innerHTML=M),y=o(t),j(_.$$.fragment,t),v=o(t),X=g(t,"P",{"data-svelte-h":!0}),T(X)!=="svelte-1vwg7jz"&&(X.textContent=Z),B=o(t),b=g(t,"OL",{"data-svelte-h":!0}),T(b)!=="svelte-11eqy5p"&&(b.innerHTML=F),G=o(t),j($.$$.fragment,t),W=o(t),k=g(t,"P",{"data-svelte-h":!0}),T(k)!=="svelte-1btg14f"&&(k.innerHTML=V),A=o(t),j(U.$$.fragment,t)},m(t,c){f(l,t,c),n(t,m,c),n(t,e,c),n(t,y,c),f(_,t,c),n(t,v,c),n(t,X,c),n(t,B,c),n(t,b,c),n(t,G,c),f($,t,c),n(t,W,c),n(t,k,c),n(t,A,c),f(U,t,c),R=!0},p(t,c){const z={};c&2&&(z.$$scope={dirty:c,ctx:t}),l.$set(z)},i(t){R||(w(l.$$.fragment,t),w(_.$$.fragment,t),w($.$$.fragment,t),w(U.$$.fragment,t),R=!0)},o(t){h(l.$$.fragment,t),h(_.$$.fragment,t),h($.$$.fragment,t),h(U.$$.fragment,t),R=!1},d(t){t&&(a(m),a(e),a(y),a(v),a(X),a(B),a(b),a(G),a(W),a(k),a(A)),d(l,t),d(_,t),d($,t),d(U,t)}}}function me(I){let l,m;return l=new xs({props:{$$slots:{default:[oe]},$$scope:{ctx:I}}}),{c(){u(l.$$.fragment)},l(e){j(l.$$.fragment,e)},m(e,M){f(l,e,M),m=!0},p(e,M){const y={};M&2&&(y.$$scope={dirty:M,ctx:e}),l.$set(y)},i(e){m||(w(l.$$.fragment,e),m=!0)},o(e){h(l.$$.fragment,e),m=!1},d(e){d(l,e)}}}function Me(I){let l,m='Keras로 모델을 미세 조정하는 것에 익숙하지 않다면, <a href="../training#train-a-tensorflow-model-with-keras">여기</a>에서 기초 튜토리얼을 살펴보세요!';return{c(){l=J("p"),l.innerHTML=m},l(e){l=g(e,"P",{"data-svelte-h":!0}),T(l)!=="svelte-1313y60"&&(l.innerHTML=m)},m(e,M){n(e,l,M)},p:ss,d(e){e&&a(l)}}}function ce(I){let l,m,e,M,y,_="그 다음 <code>TFAutoModelForQuestionAnswering</code>으로 DistilBERT를 가져옵니다:",v,X,Z,B,b="<code>prepare_tf_dataset()</code>을 사용해서 데이터 세트를 <code>tf.data.Dataset</code> 형식으로 변환합니다:",F,G,$,W,k='<a href="https://keras.io/api/models/model_training_apis/#compile-method" rel="nofollow"><code>compile</code></a>로 훈련할 모델을 설정합니다:',V,A,U,R,t="마지막으로 모델을 Hub로 푸시할 방법을 설정합니다. <code>PushToHubCallback</code>에서 모델과 토크나이저를 푸시할 경로를 설정합니다:",c,z,q,H,Bs='드디어 모델 훈련을 시작할 준비가 되었습니다! 훈련 데이터 세트와 평가 데이터 세트, 에폭 수, 콜백을 설정한 후 <a href="https://keras.io/api/models/model_training_apis/#fit-method" rel="nofollow"><code>fit</code></a>을 이용해 모델을 미세 조정합니다:',Y,Q,S,E,Gs="훈련이 완료되면 모델이 자동으로 Hub에 업로드되어 누구나 사용할 수 있습니다!",L;return l=new Jt({props:{$$slots:{default:[Me]},$$scope:{ctx:I}}}),e=new x({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMGNyZWF0ZV9vcHRpbWl6ZXIlMEElMEFiYXRjaF9zaXplJTIwJTNEJTIwMTYlMEFudW1fZXBvY2hzJTIwJTNEJTIwMiUwQXRvdGFsX3RyYWluX3N0ZXBzJTIwJTNEJTIwKGxlbih0b2tlbml6ZWRfc3F1YWQlNUIlMjJ0cmFpbiUyMiU1RCklMjAlMkYlMkYlMjBiYXRjaF9zaXplKSUyMColMjBudW1fZXBvY2hzJTBBb3B0aW1pemVyJTJDJTIwc2NoZWR1bGUlMjAlM0QlMjBjcmVhdGVfb3B0aW1pemVyKCUwQSUyMCUyMCUyMCUyMGluaXRfbHIlM0QyZS01JTJDJTBBJTIwJTIwJTIwJTIwbnVtX3dhcm11cF9zdGVwcyUzRDAlMkMlMEElMjAlMjAlMjAlMjBudW1fdHJhaW5fc3RlcHMlM0R0b3RhbF90cmFpbl9zdGVwcyUyQyUwQSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> create_optimizer

<span class="hljs-meta">&gt;&gt;&gt; </span>batch_size = <span class="hljs-number">16</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>num_epochs = <span class="hljs-number">2</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>total_train_steps = (<span class="hljs-built_in">len</span>(tokenized_squad[<span class="hljs-string">&quot;train&quot;</span>]) // batch_size) * num_epochs
<span class="hljs-meta">&gt;&gt;&gt; </span>optimizer, schedule = create_optimizer(
<span class="hljs-meta">... </span>    init_lr=<span class="hljs-number">2e-5</span>,
<span class="hljs-meta">... </span>    num_warmup_steps=<span class="hljs-number">0</span>,
<span class="hljs-meta">... </span>    num_train_steps=total_train_steps,
<span class="hljs-meta">... </span>)`,wrap:!1}}),X=new x({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGQXV0b01vZGVsRm9yUXVlc3Rpb25BbnN3ZXJpbmclMEElMEFtb2RlbCUyMCUzRCUyMFRGQXV0b01vZGVsRm9yUXVlc3Rpb25BbnN3ZXJpbmcoJTIyZGlzdGlsYmVydCUyRmRpc3RpbGJlcnQtYmFzZS11bmNhc2VkJTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFAutoModelForQuestionAnswering

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFAutoModelForQuestionAnswering(<span class="hljs-string">&quot;distilbert/distilbert-base-uncased&quot;</span>)`,wrap:!1}}),G=new x({props:{code:"dGZfdHJhaW5fc2V0JTIwJTNEJTIwbW9kZWwucHJlcGFyZV90Zl9kYXRhc2V0KCUwQSUyMCUyMCUyMCUyMHRva2VuaXplZF9zcXVhZCU1QiUyMnRyYWluJTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwc2h1ZmZsZSUzRFRydWUlMkMlMEElMjAlMjAlMjAlMjBiYXRjaF9zaXplJTNEMTYlMkMlMEElMjAlMjAlMjAlMjBjb2xsYXRlX2ZuJTNEZGF0YV9jb2xsYXRvciUyQyUwQSklMEElMEF0Zl92YWxpZGF0aW9uX3NldCUyMCUzRCUyMG1vZGVsLnByZXBhcmVfdGZfZGF0YXNldCglMEElMjAlMjAlMjAlMjB0b2tlbml6ZWRfc3F1YWQlNUIlMjJ0ZXN0JTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwc2h1ZmZsZSUzREZhbHNlJTJDJTBBJTIwJTIwJTIwJTIwYmF0Y2hfc2l6ZSUzRDE2JTJDJTBBJTIwJTIwJTIwJTIwY29sbGF0ZV9mbiUzRGRhdGFfY29sbGF0b3IlMkMlMEEp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>tf_train_set = model.prepare_tf_dataset(
<span class="hljs-meta">... </span>    tokenized_squad[<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_validation_set = model.prepare_tf_dataset(
<span class="hljs-meta">... </span>    tokenized_squad[<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}}),A=new x({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}}),z=new x({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycy5rZXJhc19jYWxsYmFja3MlMjBpbXBvcnQlMjBQdXNoVG9IdWJDYWxsYmFjayUwQSUwQWNhbGxiYWNrJTIwJTNEJTIwUHVzaFRvSHViQ2FsbGJhY2soJTBBJTIwJTIwJTIwJTIwb3V0cHV0X2RpciUzRCUyMm15X2F3ZXNvbWVfcWFfbW9kZWwlMjIlMkMlMEElMjAlMjAlMjAlMjB0b2tlbml6ZXIlM0R0b2tlbml6ZXIlMkMlMEEp",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_qa_model&quot;</span>,
<span class="hljs-meta">... </span>    tokenizer=tokenizer,
<span class="hljs-meta">... </span>)`,wrap:!1}}),Q=new x({props:{code:"bW9kZWwuZml0KHglM0R0Zl90cmFpbl9zZXQlMkMlMjB2YWxpZGF0aW9uX2RhdGElM0R0Zl92YWxpZGF0aW9uX3NldCUyQyUyMGVwb2NocyUzRDMlMkMlMjBjYWxsYmFja3MlM0QlNUJjYWxsYmFjayU1RCk=",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>model.fit(x=tf_train_set, validation_data=tf_validation_set, epochs=<span class="hljs-number">3</span>, callbacks=[callback])',wrap:!1}}),{c(){u(l.$$.fragment),m=Ot(`
TensorFlow를 이용한 모델을 미세 조정하려면 옵티마이저 함수, 학습률 스케쥴 및 몇 가지 훈련 하이퍼파라미터를 설정하는 것부터 시작해야합니다:

	`),u(e.$$.fragment),M=i(),y=J("p"),y.innerHTML=_,v=i(),u(X.$$.fragment),Z=i(),B=J("p"),B.innerHTML=b,F=i(),u(G.$$.fragment),$=i(),W=J("p"),W.innerHTML=k,V=i(),u(A.$$.fragment),U=i(),R=J("p"),R.innerHTML=t,c=i(),u(z.$$.fragment),q=i(),H=J("p"),H.innerHTML=Bs,Y=i(),u(Q.$$.fragment),S=i(),E=J("p"),E.textContent=Gs},l(r){j(l.$$.fragment,r),m=se(r,`
TensorFlow를 이용한 모델을 미세 조정하려면 옵티마이저 함수, 학습률 스케쥴 및 몇 가지 훈련 하이퍼파라미터를 설정하는 것부터 시작해야합니다:

	`),j(e.$$.fragment,r),M=o(r),y=g(r,"P",{"data-svelte-h":!0}),T(y)!=="svelte-1bkfga3"&&(y.innerHTML=_),v=o(r),j(X.$$.fragment,r),Z=o(r),B=g(r,"P",{"data-svelte-h":!0}),T(B)!=="svelte-1nof74s"&&(B.innerHTML=b),F=o(r),j(G.$$.fragment,r),$=o(r),W=g(r,"P",{"data-svelte-h":!0}),T(W)!=="svelte-1ieukoa"&&(W.innerHTML=k),V=o(r),j(A.$$.fragment,r),U=o(r),R=g(r,"P",{"data-svelte-h":!0}),T(R)!=="svelte-ivpgxr"&&(R.innerHTML=t),c=o(r),j(z.$$.fragment,r),q=o(r),H=g(r,"P",{"data-svelte-h":!0}),T(H)!=="svelte-1fld86y"&&(H.innerHTML=Bs),Y=o(r),j(Q.$$.fragment,r),S=o(r),E=g(r,"P",{"data-svelte-h":!0}),T(E)!=="svelte-ga84hg"&&(E.textContent=Gs)},m(r,C){f(l,r,C),n(r,m,C),f(e,r,C),n(r,M,C),n(r,y,C),n(r,v,C),f(X,r,C),n(r,Z,C),n(r,B,C),n(r,F,C),f(G,r,C),n(r,$,C),n(r,W,C),n(r,V,C),f(A,r,C),n(r,U,C),n(r,R,C),n(r,c,C),f(z,r,C),n(r,q,C),n(r,H,C),n(r,Y,C),f(Q,r,C),n(r,S,C),n(r,E,C),L=!0},p(r,C){const N={};C&2&&(N.$$scope={dirty:C,ctx:r}),l.$set(N)},i(r){L||(w(l.$$.fragment,r),w(e.$$.fragment,r),w(X.$$.fragment,r),w(G.$$.fragment,r),w(A.$$.fragment,r),w(z.$$.fragment,r),w(Q.$$.fragment,r),L=!0)},o(r){h(l.$$.fragment,r),h(e.$$.fragment,r),h(X.$$.fragment,r),h(G.$$.fragment,r),h(A.$$.fragment,r),h(z.$$.fragment,r),h(Q.$$.fragment,r),L=!1},d(r){r&&(a(m),a(M),a(y),a(v),a(Z),a(B),a(F),a($),a(W),a(V),a(U),a(R),a(c),a(q),a(H),a(Y),a(S),a(E)),d(l,r),d(e,r),d(X,r),d(G,r),d(A,r),d(z,r),d(Q,r)}}}function ue(I){let l,m;return l=new xs({props:{$$slots:{default:[ce]},$$scope:{ctx:I}}}),{c(){u(l.$$.fragment)},l(e){j(l.$$.fragment,e)},m(e,M){f(l,e,M),m=!0},p(e,M){const y={};M&2&&(y.$$scope={dirty:M,ctx:e}),l.$set(y)},i(e){m||(w(l.$$.fragment,e),m=!0)},o(e){h(l.$$.fragment,e),m=!1},d(e){d(l,e)}}}function je(I){let l,m='질의 응답을 위해 모델을 미세 조정하는 방법에 대한 더 자세한 예시는 <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/question_answering.ipynb" rel="nofollow">PyTorch notebook</a> 또는 <a href="https://colab.research.google.com/github/huggingface/notebooks/blob/main/examples/question_answering-tf.ipynb" rel="nofollow">TensorFlow notebook</a>을 참조하세요.';return{c(){l=J("p"),l.innerHTML=m},l(e){l=g(e,"P",{"data-svelte-h":!0}),T(l)!=="svelte-1ikgkjc"&&(l.innerHTML=m)},m(e,M){n(e,l,M)},p:ss,d(e){e&&a(l)}}}function fe(I){let l,m="텍스트를 토큰화해서 PyTorch 텐서를 반환합니다:",e,M,y,_,v="모델에 입력을 전달하고 <code>logits</code>을 반환합니다:",X,Z,B,b,F="모델의 출력에서 시작 및 종료 위치가 어딘지 가장 높은 확률을 얻습니다:",G,$,W,k,V="예측된 토큰을 해독해서 답을 얻습니다:",A,U,R;return M=new x({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJteV9hd2Vzb21lX3FhX21vZGVsJTIyKSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplcihxdWVzdGlvbiUyQyUyMGNvbnRleHQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKQ==",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_qa_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(question, context, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)`,wrap:!1}}),Z=new x({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvclF1ZXN0aW9uQW5zd2VyaW5nJTBBJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JRdWVzdGlvbkFuc3dlcmluZy5mcm9tX3ByZXRyYWluZWQoJTIybXlfYXdlc29tZV9xYV9tb2RlbCUyMiklMEF3aXRoJTIwdG9yY2gubm9fZ3JhZCgpJTNBJTBBJTIwJTIwJTIwJTIwb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForQuestionAnswering

<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForQuestionAnswering.from_pretrained(<span class="hljs-string">&quot;my_awesome_qa_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">with</span> torch.no_grad():
<span class="hljs-meta">... </span>    outputs = model(**inputs)`,wrap:!1}}),$=new x({props:{code:"YW5zd2VyX3N0YXJ0X2luZGV4JTIwJTNEJTIwb3V0cHV0cy5zdGFydF9sb2dpdHMuYXJnbWF4KCklMEFhbnN3ZXJfZW5kX2luZGV4JTIwJTNEJTIwb3V0cHV0cy5lbmRfbG9naXRzLmFyZ21heCgp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>answer_start_index = outputs.start_logits.argmax()
<span class="hljs-meta">&gt;&gt;&gt; </span>answer_end_index = outputs.end_logits.argmax()`,wrap:!1}}),U=new x({props:{code:"cHJlZGljdF9hbnN3ZXJfdG9rZW5zJTIwJTNEJTIwaW5wdXRzLmlucHV0X2lkcyU1QjAlMkMlMjBhbnN3ZXJfc3RhcnRfaW5kZXglMjAlM0ElMjBhbnN3ZXJfZW5kX2luZGV4JTIwJTJCJTIwMSU1RCUwQXRva2VuaXplci5kZWNvZGUocHJlZGljdF9hbnN3ZXJfdG9rZW5zKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>predict_answer_tokens = inputs.input_ids[<span class="hljs-number">0</span>, answer_start_index : answer_end_index + <span class="hljs-number">1</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.decode(predict_answer_tokens)
<span class="hljs-string">&#x27;176 billion parameters and can generate text in 46 languages natural languages and 13&#x27;</span>`,wrap:!1}}),{c(){l=J("p"),l.textContent=m,e=i(),u(M.$$.fragment),y=i(),_=J("p"),_.innerHTML=v,X=i(),u(Z.$$.fragment),B=i(),b=J("p"),b.textContent=F,G=i(),u($.$$.fragment),W=i(),k=J("p"),k.textContent=V,A=i(),u(U.$$.fragment)},l(t){l=g(t,"P",{"data-svelte-h":!0}),T(l)!=="svelte-hm1s3x"&&(l.textContent=m),e=o(t),j(M.$$.fragment,t),y=o(t),_=g(t,"P",{"data-svelte-h":!0}),T(_)!=="svelte-kli2cc"&&(_.innerHTML=v),X=o(t),j(Z.$$.fragment,t),B=o(t),b=g(t,"P",{"data-svelte-h":!0}),T(b)!=="svelte-1cy5gzu"&&(b.textContent=F),G=o(t),j($.$$.fragment,t),W=o(t),k=g(t,"P",{"data-svelte-h":!0}),T(k)!=="svelte-1hhfukj"&&(k.textContent=V),A=o(t),j(U.$$.fragment,t)},m(t,c){n(t,l,c),n(t,e,c),f(M,t,c),n(t,y,c),n(t,_,c),n(t,X,c),f(Z,t,c),n(t,B,c),n(t,b,c),n(t,G,c),f($,t,c),n(t,W,c),n(t,k,c),n(t,A,c),f(U,t,c),R=!0},p:ss,i(t){R||(w(M.$$.fragment,t),w(Z.$$.fragment,t),w($.$$.fragment,t),w(U.$$.fragment,t),R=!0)},o(t){h(M.$$.fragment,t),h(Z.$$.fragment,t),h($.$$.fragment,t),h(U.$$.fragment,t),R=!1},d(t){t&&(a(l),a(e),a(y),a(_),a(X),a(B),a(b),a(G),a(W),a(k),a(A)),d(M,t),d(Z,t),d($,t),d(U,t)}}}function we(I){let l,m;return l=new xs({props:{$$slots:{default:[fe]},$$scope:{ctx:I}}}),{c(){u(l.$$.fragment)},l(e){j(l.$$.fragment,e)},m(e,M){f(l,e,M),m=!0},p(e,M){const y={};M&2&&(y.$$scope={dirty:M,ctx:e}),l.$set(y)},i(e){m||(w(l.$$.fragment,e),m=!0)},o(e){h(l.$$.fragment,e),m=!1},d(e){d(l,e)}}}function he(I){let l,m="텍스트를 토큰화해서 TensorFlow 텐서를 반환합니다:",e,M,y,_,v="모델에 입력을 전달하고 <code>logits</code>을 반환합니다:",X,Z,B,b,F="모델의 출력에서 시작 및 종료 위치가 어딘지 가장 높은 확률을 얻습니다:",G,$,W,k,V="예측된 토큰을 해독해서 답을 얻습니다:",A,U,R;return M=new x({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJteV9hd2Vzb21lX3FhX21vZGVsJTIyKSUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplcihxdWVzdGlvbiUyQyUyMHRleHQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnRmJTIyKQ==",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_qa_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(question, text, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)`,wrap:!1}}),Z=new x({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGQXV0b01vZGVsRm9yUXVlc3Rpb25BbnN3ZXJpbmclMEElMEFtb2RlbCUyMCUzRCUyMFRGQXV0b01vZGVsRm9yUXVlc3Rpb25BbnN3ZXJpbmcuZnJvbV9wcmV0cmFpbmVkKCUyMm15X2F3ZXNvbWVfcWFfbW9kZWwlMjIpJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFAutoModelForQuestionAnswering

<span class="hljs-meta">&gt;&gt;&gt; </span>model = TFAutoModelForQuestionAnswering.from_pretrained(<span class="hljs-string">&quot;my_awesome_qa_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)`,wrap:!1}}),$=new x({props:{code:"YW5zd2VyX3N0YXJ0X2luZGV4JTIwJTNEJTIwaW50KHRmLm1hdGguYXJnbWF4KG91dHB1dHMuc3RhcnRfbG9naXRzJTJDJTIwYXhpcyUzRC0xKSU1QjAlNUQpJTBBYW5zd2VyX2VuZF9pbmRleCUyMCUzRCUyMGludCh0Zi5tYXRoLmFyZ21heChvdXRwdXRzLmVuZF9sb2dpdHMlMkMlMjBheGlzJTNELTEpJTVCMCU1RCk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>answer_start_index = <span class="hljs-built_in">int</span>(tf.math.argmax(outputs.start_logits, axis=-<span class="hljs-number">1</span>)[<span class="hljs-number">0</span>])
<span class="hljs-meta">&gt;&gt;&gt; </span>answer_end_index = <span class="hljs-built_in">int</span>(tf.math.argmax(outputs.end_logits, axis=-<span class="hljs-number">1</span>)[<span class="hljs-number">0</span>])`,wrap:!1}}),U=new x({props:{code:"cHJlZGljdF9hbnN3ZXJfdG9rZW5zJTIwJTNEJTIwaW5wdXRzLmlucHV0X2lkcyU1QjAlMkMlMjBhbnN3ZXJfc3RhcnRfaW5kZXglMjAlM0ElMjBhbnN3ZXJfZW5kX2luZGV4JTIwJTJCJTIwMSU1RCUwQXRva2VuaXplci5kZWNvZGUocHJlZGljdF9hbnN3ZXJfdG9rZW5zKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>predict_answer_tokens = inputs.input_ids[<span class="hljs-number">0</span>, answer_start_index : answer_end_index + <span class="hljs-number">1</span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.decode(predict_answer_tokens)
<span class="hljs-string">&#x27;176 billion parameters and can generate text in 46 languages natural languages and 13&#x27;</span>`,wrap:!1}}),{c(){l=J("p"),l.textContent=m,e=i(),u(M.$$.fragment),y=i(),_=J("p"),_.innerHTML=v,X=i(),u(Z.$$.fragment),B=i(),b=J("p"),b.textContent=F,G=i(),u($.$$.fragment),W=i(),k=J("p"),k.textContent=V,A=i(),u(U.$$.fragment)},l(t){l=g(t,"P",{"data-svelte-h":!0}),T(l)!=="svelte-e85p7z"&&(l.textContent=m),e=o(t),j(M.$$.fragment,t),y=o(t),_=g(t,"P",{"data-svelte-h":!0}),T(_)!=="svelte-kli2cc"&&(_.innerHTML=v),X=o(t),j(Z.$$.fragment,t),B=o(t),b=g(t,"P",{"data-svelte-h":!0}),T(b)!=="svelte-1cy5gzu"&&(b.textContent=F),G=o(t),j($.$$.fragment,t),W=o(t),k=g(t,"P",{"data-svelte-h":!0}),T(k)!=="svelte-1hhfukj"&&(k.textContent=V),A=o(t),j(U.$$.fragment,t)},m(t,c){n(t,l,c),n(t,e,c),f(M,t,c),n(t,y,c),n(t,_,c),n(t,X,c),f(Z,t,c),n(t,B,c),n(t,b,c),n(t,G,c),f($,t,c),n(t,W,c),n(t,k,c),n(t,A,c),f(U,t,c),R=!0},p:ss,i(t){R||(w(M.$$.fragment,t),w(Z.$$.fragment,t),w($.$$.fragment,t),w(U.$$.fragment,t),R=!0)},o(t){h(M.$$.fragment,t),h(Z.$$.fragment,t),h($.$$.fragment,t),h(U.$$.fragment,t),R=!1},d(t){t&&(a(l),a(e),a(y),a(_),a(X),a(B),a(b),a(G),a(W),a(k),a(A)),d(M,t),d(Z,t),d($,t),d(U,t)}}}function de(I){let l,m;return l=new xs({props:{$$slots:{default:[he]},$$scope:{ctx:I}}}),{c(){u(l.$$.fragment)},l(e){j(l.$$.fragment,e)},m(e,M){f(l,e,M),m=!0},p(e,M){const y={};M&2&&(y.$$scope={dirty:M,ctx:e}),l.$set(y)},i(e){m||(w(l.$$.fragment,e),m=!0)},o(e){h(l.$$.fragment,e),m=!1},d(e){d(l,e)}}}function ye(I){let l,m,e,M,y,_,v,X,Z,B,b,F="질의 응답 태스크는 주어진 질문에 대한 답변을 제공합니다. Alexa, Siri 또는 Google과 같은 가상 비서에게 날씨가 어떤지 물어본 적이 있다면 질의 응답 모델을 사용해본 적이 있을 것입니다. 질의 응답 태스크에는 일반적으로 두 가지 유형이 있습니다.",G,$,W="<li>추출적(Extractive) 질의 응답: 주어진 문맥에서 답변을 추출합니다.</li> <li>생성적(Abstractive) 질의 응답: 문맥에서 질문에 올바르게 답하는 답변을 생성합니다.</li>",k,V,A="이 가이드는 다음과 같은 방법들을 보여줍니다.",U,R,t='<li>추출적 질의 응답을 하기 위해 <a href="https://huggingface.co/datasets/squad" rel="nofollow">SQuAD</a> 데이터 세트에서 <a href="https://huggingface.co/distilbert/distilbert-base-uncased" rel="nofollow">DistilBERT</a> 미세 조정하기</li> <li>추론에 미세 조정된 모델 사용하기</li>',c,z,q,H,Bs="시작하기 전에, 필요한 라이브러리가 모두 설치되어 있는지 확인하세요:",Y,Q,S,E,Gs="여러분의 모델을 업로드하고 커뮤니티에 공유할 수 있도록 Hugging Face 계정에 로그인하는 것이 좋습니다. 메시지가 표시되면 토큰을 입력해서 로그인합니다:",L,r,C,N,As,ts,Tt="먼저 🤗 Datasets 라이브러리에서 SQuAD 데이터 세트의 일부를 가져옵니다. 이렇게 하면 전체 데이터 세트로 훈련하며 더 많은 시간을 할애하기 전에 모든 것이 잘 작동하는지 실험하고 확인할 수 있습니다.",vs,es,Vs,ls,$t="데이터 세트의 분할된 <code>train</code>을 <code>train_test_split</code> 메소드를 사용해 훈련 데이터 세트와 테스트 데이터 세트로 나누어줍니다:",zs,as,Fs,ns,bt="그리고나서 예시로 데이터를 하나 살펴봅니다:",Hs,ps,Qs,rs,Ut="이 중에서 몇 가지 중요한 항목이 있습니다:",Es,is,Ct="<li><code>answers</code>: 답안 토큰의 시작 위치와 답안 텍스트</li> <li><code>context</code>: 모델이 답을 추출하는데 필요한 배경 지식</li> <li><code>question</code>: 모델이 답해야 하는 질문</li>",Ns,os,qs,ms,Ys,Ms,It="다음 단계에서는 <code>question</code> 및 <code>context</code> 항목을 처리하기 위해 DistilBERT 토크나이저를 가져옵니다:",Ss,cs,Ls,us,_t="질의 응답 태스크와 관련해서 특히 유의해야할 몇 가지 전처리 단계가 있습니다:",Ds,js,Zt="<li>데이터 세트의 일부 예제에는 모델의 최대 입력 길이를 초과하는 매우 긴 <code>context</code>가 있을 수 있습니다. 긴 시퀀스를 다루기 위해서는, <code>truncation=&quot;only_second&quot;</code>로 설정해 <code>context</code>만 잘라내면 됩니다.</li> <li>그 다음, <code>return_offset_mapping=True</code>로 설정해 답변의 시작과 종료 위치를 원래의 <code>context</code>에 매핑합니다.</li> <li>매핑을 완료하면, 이제 답변에서 시작 토큰과 종료 토큰을 찾을 수 있습니다. 오프셋의 어느 부분이 <code>question</code>과 <code>context</code>에 해당하는지 찾을 수 있도록 <code>sequence_ids</code> 메소드를 사용하세요.</li>",Ps,fs,kt="다음은 <code>answer</code>의 시작 토큰과 종료 토큰을 잘라내서 <code>context</code>에 매핑하는 함수를 만드는 방법입니다:",Ks,ws,Os,hs,Xt="모든 데이터 세트에 전처리를 적용하려면, 🤗 Datasets <code>map</code> 함수를 사용하세요. <code>batched=True</code>로 설정해 데이터 세트의 여러 요소들을 한 번에 처리하면 <code>map</code> 함수의 속도를 빠르게 할 수 있습니다. 필요하지 않은 열은 모두 제거합니다:",st,ds,tt,ys,Rt="이제 <code>DefaultDataCollator</code>를 이용해 예시 배치를 생성합니다. 🤗 Transformers의 다른 데이터 콜레이터(data collator)와 달리, <code>DefaultDataCollator</code>는 패딩과 같은 추가 전처리를 적용하지 않습니다:",et,D,lt,Js,at,P,nt,K,pt,gs,rt,Ts,xt="질의 응답을 평가하려면 상당한 양의 후처리가 필요합니다. 시간이 너무 많이 걸리지 않도록 이 가이드에서는 평가 단계를 생략합니다. <code>Trainer</code>는 훈련 과정에서 평가 손실(evaluation loss)을 계속 계산하기 때문에 모델의 성능을 대략적으로 알 수 있습니다.",it,$s,Bt='시간에 여유가 있고 질의 응답 모델을 평가하는 방법에 관심이 있다면 🤗 Hugging Face Course의 <a href="https://huggingface.co/course/chapter7/7?fw=pt#postprocessing" rel="nofollow">Question answering</a> 챕터를 살펴보세요!',ot,bs,mt,Us,Gt="이제 모델을 미세 조정했으니 추론에 사용할 수 있습니다!",Mt,Cs,Wt="질문과 모델이 예측하기 원하는 문맥(context)를 생각해보세요:",ct,Is,ut,_s,At="추론을 위해 미세 조정한 모델을 테스트하는 가장 쉬운 방법은 <code>pipeline()</code>을 사용하는 것 입니다. 모델을 사용해 질의 응답을 하기 위해서 <code>pipeline</code>을 인스턴스화하고 텍스트를 입력합니다:",jt,Zs,ft,ks,vt="원한다면 <code>pipeline</code>의 결과를 직접 복제할 수도 있습니다:",wt,O,ht,Xs,dt,Ws,yt;return y=new Rs({props:{title:"질의 응답(Question Answering)",local:"question-answering",headingTag:"h1"}}),v=new te({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/question_answering.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/ko/pytorch/question_answering.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/ko/tensorflow/question_answering.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ko/question_answering.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ko/pytorch/question_answering.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/ko/tensorflow/question_answering.ipynb"}]}}),Z=new qt({props:{id:"ajPx5LwJD-I"}}),z=new Jt({props:{$$slots:{default:[le]},$$scope:{ctx:I}}}),Q=new x({props:{code:"cGlwJTIwaW5zdGFsbCUyMHRyYW5zZm9ybWVycyUyMGRhdGFzZXRzJTIwZXZhbHVhdGU=",highlighted:"pip install transformers datasets evaluate",wrap:!1}}),r=new x({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}}),N=new Rs({props:{title:"SQuAD 데이터 세트 가져오기",local:"load-squad-dataset",headingTag:"h2"}}),es=new x({props:{code:"ZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBJTBBc3F1YWQlMjAlM0QlMjBsb2FkX2RhdGFzZXQoJTIyc3F1YWQlMjIlMkMlMjBzcGxpdCUzRCUyMnRyYWluJTVCJTNBNTAwMCU1RCUyMik=",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>squad = load_dataset(<span class="hljs-string">&quot;squad&quot;</span>, split=<span class="hljs-string">&quot;train[:5000]&quot;</span>)`,wrap:!1}}),as=new x({props:{code:"c3F1YWQlMjAlM0QlMjBzcXVhZC50cmFpbl90ZXN0X3NwbGl0KHRlc3Rfc2l6ZSUzRDAuMik=",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>squad = squad.train_test_split(test_size=<span class="hljs-number">0.2</span>)',wrap:!1}}),ps=new x({props:{code:"c3F1YWQlNUIlMjJ0cmFpbiUyMiU1RCU1QjAlNUQ=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>squad[<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;answer_start&#x27;</span>: [<span class="hljs-number">515</span>], <span class="hljs-string">&#x27;text&#x27;</span>: [<span class="hljs-string">&#x27;Saint Bernadette Soubirous&#x27;</span>]},
 <span class="hljs-string">&#x27;context&#x27;</span>: <span class="hljs-string">&#x27;Architecturally, the school has a Catholic character. Atop the Main Building\\&#x27;s gold dome is a golden statue of the Virgin Mary. Immediately in front of the Main Building and facing it, is a copper statue of Christ with arms upraised with the legend &quot;Venite Ad Me Omnes&quot;. Next to the Main Building is the Basilica of the Sacred Heart. Immediately behind the basilica is the Grotto, a Marian place of prayer and reflection. It is a replica of the grotto at Lourdes, France where the Virgin Mary reputedly appeared to Saint Bernadette Soubirous in 1858. At the end of the main drive (and in a direct line that connects through 3 statues and the Gold Dome), is a simple, modern stone statue of Mary.&#x27;</span>,
 <span class="hljs-string">&#x27;id&#x27;</span>: <span class="hljs-string">&#x27;5733be284776f41900661182&#x27;</span>,
 <span class="hljs-string">&#x27;question&#x27;</span>: <span class="hljs-string">&#x27;To whom did the Virgin Mary allegedly appear in 1858 in Lourdes France?&#x27;</span>,
 <span class="hljs-string">&#x27;title&#x27;</span>: <span class="hljs-string">&#x27;University_of_Notre_Dame&#x27;</span>
}`,wrap:!1}}),os=new Rs({props:{title:"전처리",local:"preprocess",headingTag:"h2"}}),ms=new qt({props:{id:"qgaM0weJHpA"}}),cs=new x({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJkaXN0aWxiZXJ0JTJGZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQlMjIp",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/distilbert-base-uncased&quot;</span>)`,wrap:!1}}),ws=new x({props:{code:"ZGVmJTIwcHJlcHJvY2Vzc19mdW5jdGlvbihleGFtcGxlcyklM0ElMEElMjAlMjAlMjAlMjBxdWVzdGlvbnMlMjAlM0QlMjAlNUJxLnN0cmlwKCklMjBmb3IlMjBxJTIwaW4lMjBleGFtcGxlcyU1QiUyMnF1ZXN0aW9uJTIyJTVEJTVEJTBBJTIwJTIwJTIwJTIwaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKCUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHF1ZXN0aW9ucyUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGV4YW1wbGVzJTVCJTIyY29udGV4dCUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMG1heF9sZW5ndGglM0QzODQlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjB0cnVuY2F0aW9uJTNEJTIyb25seV9zZWNvbmQlMjIlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjByZXR1cm5fb2Zmc2V0c19tYXBwaW5nJTNEVHJ1ZSUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHBhZGRpbmclM0QlMjJtYXhfbGVuZ3RoJTIyJTJDJTBBJTIwJTIwJTIwJTIwKSUwQSUwQSUyMCUyMCUyMCUyMG9mZnNldF9tYXBwaW5nJTIwJTNEJTIwaW5wdXRzLnBvcCglMjJvZmZzZXRfbWFwcGluZyUyMiklMEElMjAlMjAlMjAlMjBhbnN3ZXJzJTIwJTNEJTIwZXhhbXBsZXMlNUIlMjJhbnN3ZXJzJTIyJTVEJTBBJTIwJTIwJTIwJTIwc3RhcnRfcG9zaXRpb25zJTIwJTNEJTIwJTVCJTVEJTBBJTIwJTIwJTIwJTIwZW5kX3Bvc2l0aW9ucyUyMCUzRCUyMCU1QiU1RCUwQSUwQSUyMCUyMCUyMCUyMGZvciUyMGklMkMlMjBvZmZzZXQlMjBpbiUyMGVudW1lcmF0ZShvZmZzZXRfbWFwcGluZyklM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBhbnN3ZXIlMjAlM0QlMjBhbnN3ZXJzJTVCaSU1RCUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHN0YXJ0X2NoYXIlMjAlM0QlMjBhbnN3ZXIlNUIlMjJhbnN3ZXJfc3RhcnQlMjIlNUQlNUIwJTVEJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwZW5kX2NoYXIlMjAlM0QlMjBhbnN3ZXIlNUIlMjJhbnN3ZXJfc3RhcnQlMjIlNUQlNUIwJTVEJTIwJTJCJTIwbGVuKGFuc3dlciU1QiUyMnRleHQlMjIlNUQlNUIwJTVEKSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHNlcXVlbmNlX2lkcyUyMCUzRCUyMGlucHV0cy5zZXF1ZW5jZV9pZHMoaSklMEElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjMlMjBGaW5kJTIwdGhlJTIwc3RhcnQlMjBhbmQlMjBlbmQlMjBvZiUyMHRoZSUyMGNvbnRleHQlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBpZHglMjAlM0QlMjAwJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwd2hpbGUlMjBzZXF1ZW5jZV9pZHMlNUJpZHglNUQlMjAhJTNEJTIwMSUzQSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGlkeCUyMCUyQiUzRCUyMDElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBjb250ZXh0X3N0YXJ0JTIwJTNEJTIwaWR4JTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwd2hpbGUlMjBzZXF1ZW5jZV9pZHMlNUJpZHglNUQlMjAlM0QlM0QlMjAxJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwaWR4JTIwJTJCJTNEJTIwMSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGNvbnRleHRfZW5kJTIwJTNEJTIwaWR4JTIwLSUyMDElMEElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjMlMjBJZiUyMHRoZSUyMGFuc3dlciUyMGlzJTIwbm90JTIwZnVsbHklMjBpbnNpZGUlMjB0aGUlMjBjb250ZXh0JTJDJTIwbGFiZWwlMjBpdCUyMCgwJTJDJTIwMCklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBpZiUyMG9mZnNldCU1QmNvbnRleHRfc3RhcnQlNUQlNUIwJTVEJTIwJTNFJTIwZW5kX2NoYXIlMjBvciUyMG9mZnNldCU1QmNvbnRleHRfZW5kJTVEJTVCMSU1RCUyMCUzQyUyMHN0YXJ0X2NoYXIlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBzdGFydF9wb3NpdGlvbnMuYXBwZW5kKDApJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwZW5kX3Bvc2l0aW9ucy5hcHBlbmQoMCklMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBlbHNlJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIzJTIwT3RoZXJ3aXNlJTIwaXQncyUyMHRoZSUyMHN0YXJ0JTIwYW5kJTIwZW5kJTIwdG9rZW4lMjBwb3NpdGlvbnMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBpZHglMjAlM0QlMjBjb250ZXh0X3N0YXJ0JTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwd2hpbGUlMjBpZHglMjAlM0MlM0QlMjBjb250ZXh0X2VuZCUyMGFuZCUyMG9mZnNldCU1QmlkeCU1RCU1QjAlNUQlMjAlM0MlM0QlMjBzdGFydF9jaGFyJTNBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwaWR4JTIwJTJCJTNEJTIwMSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMHN0YXJ0X3Bvc2l0aW9ucy5hcHBlbmQoaWR4JTIwLSUyMDEpJTBBJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwaWR4JTIwJTNEJTIwY29udGV4dF9lbmQlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjB3aGlsZSUyMGlkeCUyMCUzRSUzRCUyMGNvbnRleHRfc3RhcnQlMjBhbmQlMjBvZmZzZXQlNUJpZHglNUQlNUIxJTVEJTIwJTNFJTNEJTIwZW5kX2NoYXIlM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjBpZHglMjAtJTNEJTIwMSUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMGVuZF9wb3NpdGlvbnMuYXBwZW5kKGlkeCUyMCUyQiUyMDEpJTBBJTBBJTIwJTIwJTIwJTIwaW5wdXRzJTVCJTIyc3RhcnRfcG9zaXRpb25zJTIyJTVEJTIwJTNEJTIwc3RhcnRfcG9zaXRpb25zJTBBJTIwJTIwJTIwJTIwaW5wdXRzJTVCJTIyZW5kX3Bvc2l0aW9ucyUyMiU1RCUyMCUzRCUyMGVuZF9wb3NpdGlvbnMlMEElMjAlMjAlMjAlMjByZXR1cm4lMjBpbnB1dHM=",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>    questions = [q.strip() <span class="hljs-keyword">for</span> q <span class="hljs-keyword">in</span> examples[<span class="hljs-string">&quot;question&quot;</span>]]
<span class="hljs-meta">... </span>    inputs = tokenizer(
<span class="hljs-meta">... </span>        questions,
<span class="hljs-meta">... </span>        examples[<span class="hljs-string">&quot;context&quot;</span>],
<span class="hljs-meta">... </span>        max_length=<span class="hljs-number">384</span>,
<span class="hljs-meta">... </span>        truncation=<span class="hljs-string">&quot;only_second&quot;</span>,
<span class="hljs-meta">... </span>        return_offsets_mapping=<span class="hljs-literal">True</span>,
<span class="hljs-meta">... </span>        padding=<span class="hljs-string">&quot;max_length&quot;</span>,
<span class="hljs-meta">... </span>    )

<span class="hljs-meta">... </span>    offset_mapping = inputs.pop(<span class="hljs-string">&quot;offset_mapping&quot;</span>)
<span class="hljs-meta">... </span>    answers = examples[<span class="hljs-string">&quot;answers&quot;</span>]
<span class="hljs-meta">... </span>    start_positions = []
<span class="hljs-meta">... </span>    end_positions = []

<span class="hljs-meta">... </span>    <span class="hljs-keyword">for</span> i, offset <span class="hljs-keyword">in</span> <span class="hljs-built_in">enumerate</span>(offset_mapping):
<span class="hljs-meta">... </span>        answer = answers[i]
<span class="hljs-meta">... </span>        start_char = answer[<span class="hljs-string">&quot;answer_start&quot;</span>][<span class="hljs-number">0</span>]
<span class="hljs-meta">... </span>        end_char = answer[<span class="hljs-string">&quot;answer_start&quot;</span>][<span class="hljs-number">0</span>] + <span class="hljs-built_in">len</span>(answer[<span class="hljs-string">&quot;text&quot;</span>][<span class="hljs-number">0</span>])
<span class="hljs-meta">... </span>        sequence_ids = inputs.sequence_ids(i)

<span class="hljs-meta">... </span>        <span class="hljs-comment"># Find the start and end of the context</span>
<span class="hljs-meta">... </span>        idx = <span class="hljs-number">0</span>
<span class="hljs-meta">... </span>        <span class="hljs-keyword">while</span> sequence_ids[idx] != <span class="hljs-number">1</span>:
<span class="hljs-meta">... </span>            idx += <span class="hljs-number">1</span>
<span class="hljs-meta">... </span>        context_start = idx
<span class="hljs-meta">... </span>        <span class="hljs-keyword">while</span> sequence_ids[idx] == <span class="hljs-number">1</span>:
<span class="hljs-meta">... </span>            idx += <span class="hljs-number">1</span>
<span class="hljs-meta">... </span>        context_end = idx - <span class="hljs-number">1</span>

<span class="hljs-meta">... </span>        <span class="hljs-comment"># If the answer is not fully inside the context, label it (0, 0)</span>
<span class="hljs-meta">... </span>        <span class="hljs-keyword">if</span> offset[context_start][<span class="hljs-number">0</span>] &gt; end_char <span class="hljs-keyword">or</span> offset[context_end][<span class="hljs-number">1</span>] &lt; start_char:
<span class="hljs-meta">... </span>            start_positions.append(<span class="hljs-number">0</span>)
<span class="hljs-meta">... </span>            end_positions.append(<span class="hljs-number">0</span>)
<span class="hljs-meta">... </span>        <span class="hljs-keyword">else</span>:
<span class="hljs-meta">... </span>            <span class="hljs-comment"># Otherwise it&#x27;s the start and end token positions</span>
<span class="hljs-meta">... </span>            idx = context_start
<span class="hljs-meta">... </span>            <span class="hljs-keyword">while</span> idx &lt;= context_end <span class="hljs-keyword">and</span> offset[idx][<span class="hljs-number">0</span>] &lt;= start_char:
<span class="hljs-meta">... </span>                idx += <span class="hljs-number">1</span>
<span class="hljs-meta">... </span>            start_positions.append(idx - <span class="hljs-number">1</span>)

<span class="hljs-meta">... </span>            idx = context_end
<span class="hljs-meta">... </span>            <span class="hljs-keyword">while</span> idx &gt;= context_start <span class="hljs-keyword">and</span> offset[idx][<span class="hljs-number">1</span>] &gt;= end_char:
<span class="hljs-meta">... </span>                idx -= <span class="hljs-number">1</span>
<span class="hljs-meta">... </span>            end_positions.append(idx + <span class="hljs-number">1</span>)

<span class="hljs-meta">... </span>    inputs[<span class="hljs-string">&quot;start_positions&quot;</span>] = start_positions
<span class="hljs-meta">... </span>    inputs[<span class="hljs-string">&quot;end_positions&quot;</span>] = end_positions
<span class="hljs-meta">... </span>    <span class="hljs-keyword">return</span> inputs`,wrap:!1}}),ds=new x({props:{code:"dG9rZW5pemVkX3NxdWFkJTIwJTNEJTIwc3F1YWQubWFwKHByZXByb2Nlc3NfZnVuY3Rpb24lMkMlMjBiYXRjaGVkJTNEVHJ1ZSUyQyUyMHJlbW92ZV9jb2x1bW5zJTNEc3F1YWQlNUIlMjJ0cmFpbiUyMiU1RC5jb2x1bW5fbmFtZXMp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>tokenized_squad = squad.<span class="hljs-built_in">map</span>(preprocess_function, batched=<span class="hljs-literal">True</span>, remove_columns=squad[<span class="hljs-string">&quot;train&quot;</span>].column_names)',wrap:!1}}),D=new gt({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[re],pytorch:[ne]},$$scope:{ctx:I}}}),Js=new Rs({props:{title:"훈련",local:"train",headingTag:"h2"}}),P=new gt({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[ue],pytorch:[me]},$$scope:{ctx:I}}}),K=new Jt({props:{$$slots:{default:[je]},$$scope:{ctx:I}}}),gs=new Rs({props:{title:"평가",local:"evaluate",headingTag:"h2"}}),bs=new Rs({props:{title:"추론",local:"inference",headingTag:"h2"}}),Is=new x({props:{code:"cXVlc3Rpb24lMjAlM0QlMjAlMjJIb3clMjBtYW55JTIwcHJvZ3JhbW1pbmclMjBsYW5ndWFnZXMlMjBkb2VzJTIwQkxPT00lMjBzdXBwb3J0JTNGJTIyJTBBY29udGV4dCUyMCUzRCUyMCUyMkJMT09NJTIwaGFzJTIwMTc2JTIwYmlsbGlvbiUyMHBhcmFtZXRlcnMlMjBhbmQlMjBjYW4lMjBnZW5lcmF0ZSUyMHRleHQlMjBpbiUyMDQ2JTIwbGFuZ3VhZ2VzJTIwbmF0dXJhbCUyMGxhbmd1YWdlcyUyMGFuZCUyMDEzJTIwcHJvZ3JhbW1pbmclMjBsYW5ndWFnZXMuJTIy",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>question = <span class="hljs-string">&quot;How many programming languages does BLOOM support?&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>context = <span class="hljs-string">&quot;BLOOM has 176 billion parameters and can generate text in 46 languages natural languages and 13 programming languages.&quot;</span>`,wrap:!1}}),Zs=new x({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBcXVlc3Rpb25fYW5zd2VyZXIlMjAlM0QlMjBwaXBlbGluZSglMjJxdWVzdGlvbi1hbnN3ZXJpbmclMjIlMkMlMjBtb2RlbCUzRCUyMm15X2F3ZXNvbWVfcWFfbW9kZWwlMjIpJTBBcXVlc3Rpb25fYW5zd2VyZXIocXVlc3Rpb24lM0RxdWVzdGlvbiUyQyUyMGNvbnRleHQlM0Rjb250ZXh0KQ==",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>question_answerer = pipeline(<span class="hljs-string">&quot;question-answering&quot;</span>, model=<span class="hljs-string">&quot;my_awesome_qa_model&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>question_answerer(question=question, context=context)
{<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.2058267742395401</span>,
 <span class="hljs-string">&#x27;start&#x27;</span>: <span class="hljs-number">10</span>,
 <span class="hljs-string">&#x27;end&#x27;</span>: <span class="hljs-number">95</span>,
 <span class="hljs-string">&#x27;answer&#x27;</span>: <span class="hljs-string">&#x27;176 billion parameters and can generate text in 46 languages natural languages and 13&#x27;</span>}`,wrap:!1}}),O=new gt({props:{pytorch:!0,tensorflow:!0,jax:!1,$$slots:{tensorflow:[de],pytorch:[we]},$$scope:{ctx:I}}}),Xs=new ee({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/ko/tasks/question_answering.md"}}),{c(){l=J("meta"),m=i(),e=J("p"),M=i(),u(y.$$.fragment),_=i(),u(v.$$.fragment),X=i(),u(Z.$$.fragment),B=i(),b=J("p"),b.textContent=F,G=i(),$=J("ul"),$.innerHTML=W,k=i(),V=J("p"),V.textContent=A,U=i(),R=J("ol"),R.innerHTML=t,c=i(),u(z.$$.fragment),q=i(),H=J("p"),H.textContent=Bs,Y=i(),u(Q.$$.fragment),S=i(),E=J("p"),E.textContent=Gs,L=i(),u(r.$$.fragment),C=i(),u(N.$$.fragment),As=i(),ts=J("p"),ts.textContent=Tt,vs=i(),u(es.$$.fragment),Vs=i(),ls=J("p"),ls.innerHTML=$t,zs=i(),u(as.$$.fragment),Fs=i(),ns=J("p"),ns.textContent=bt,Hs=i(),u(ps.$$.fragment),Qs=i(),rs=J("p"),rs.textContent=Ut,Es=i(),is=J("ul"),is.innerHTML=Ct,Ns=i(),u(os.$$.fragment),qs=i(),u(ms.$$.fragment),Ys=i(),Ms=J("p"),Ms.innerHTML=It,Ss=i(),u(cs.$$.fragment),Ls=i(),us=J("p"),us.textContent=_t,Ds=i(),js=J("ol"),js.innerHTML=Zt,Ps=i(),fs=J("p"),fs.innerHTML=kt,Ks=i(),u(ws.$$.fragment),Os=i(),hs=J("p"),hs.innerHTML=Xt,st=i(),u(ds.$$.fragment),tt=i(),ys=J("p"),ys.innerHTML=Rt,et=i(),u(D.$$.fragment),lt=i(),u(Js.$$.fragment),at=i(),u(P.$$.fragment),nt=i(),u(K.$$.fragment),pt=i(),u(gs.$$.fragment),rt=i(),Ts=J("p"),Ts.innerHTML=xt,it=i(),$s=J("p"),$s.innerHTML=Bt,ot=i(),u(bs.$$.fragment),mt=i(),Us=J("p"),Us.textContent=Gt,Mt=i(),Cs=J("p"),Cs.textContent=Wt,ct=i(),u(Is.$$.fragment),ut=i(),_s=J("p"),_s.innerHTML=At,jt=i(),u(Zs.$$.fragment),ft=i(),ks=J("p"),ks.innerHTML=vt,wt=i(),u(O.$$.fragment),ht=i(),u(Xs.$$.fragment),dt=i(),Ws=J("p"),this.h()},l(s){const p=Pt("svelte-u9bgzb",document.head);l=g(p,"META",{name:!0,content:!0}),p.forEach(a),m=o(s),e=g(s,"P",{}),Et(e).forEach(a),M=o(s),j(y.$$.fragment,s),_=o(s),j(v.$$.fragment,s),X=o(s),j(Z.$$.fragment,s),B=o(s),b=g(s,"P",{"data-svelte-h":!0}),T(b)!=="svelte-egp0yq"&&(b.textContent=F),G=o(s),$=g(s,"UL",{"data-svelte-h":!0}),T($)!=="svelte-1l55cmw"&&($.innerHTML=W),k=o(s),V=g(s,"P",{"data-svelte-h":!0}),T(V)!=="svelte-1a7n7l8"&&(V.textContent=A),U=o(s),R=g(s,"OL",{"data-svelte-h":!0}),T(R)!=="svelte-tct7qf"&&(R.innerHTML=t),c=o(s),j(z.$$.fragment,s),q=o(s),H=g(s,"P",{"data-svelte-h":!0}),T(H)!=="svelte-19ozuj4"&&(H.textContent=Bs),Y=o(s),j(Q.$$.fragment,s),S=o(s),E=g(s,"P",{"data-svelte-h":!0}),T(E)!=="svelte-1tz3h56"&&(E.textContent=Gs),L=o(s),j(r.$$.fragment,s),C=o(s),j(N.$$.fragment,s),As=o(s),ts=g(s,"P",{"data-svelte-h":!0}),T(ts)!=="svelte-ufwwq5"&&(ts.textContent=Tt),vs=o(s),j(es.$$.fragment,s),Vs=o(s),ls=g(s,"P",{"data-svelte-h":!0}),T(ls)!=="svelte-1mkzjhu"&&(ls.innerHTML=$t),zs=o(s),j(as.$$.fragment,s),Fs=o(s),ns=g(s,"P",{"data-svelte-h":!0}),T(ns)!=="svelte-iguerl"&&(ns.textContent=bt),Hs=o(s),j(ps.$$.fragment,s),Qs=o(s),rs=g(s,"P",{"data-svelte-h":!0}),T(rs)!=="svelte-xbz2jo"&&(rs.textContent=Ut),Es=o(s),is=g(s,"UL",{"data-svelte-h":!0}),T(is)!=="svelte-xcrfgi"&&(is.innerHTML=Ct),Ns=o(s),j(os.$$.fragment,s),qs=o(s),j(ms.$$.fragment,s),Ys=o(s),Ms=g(s,"P",{"data-svelte-h":!0}),T(Ms)!=="svelte-1s1xwu7"&&(Ms.innerHTML=It),Ss=o(s),j(cs.$$.fragment,s),Ls=o(s),us=g(s,"P",{"data-svelte-h":!0}),T(us)!=="svelte-gwemrx"&&(us.textContent=_t),Ds=o(s),js=g(s,"OL",{"data-svelte-h":!0}),T(js)!=="svelte-18o3dcu"&&(js.innerHTML=Zt),Ps=o(s),fs=g(s,"P",{"data-svelte-h":!0}),T(fs)!=="svelte-16yk931"&&(fs.innerHTML=kt),Ks=o(s),j(ws.$$.fragment,s),Os=o(s),hs=g(s,"P",{"data-svelte-h":!0}),T(hs)!=="svelte-10qnkwc"&&(hs.innerHTML=Xt),st=o(s),j(ds.$$.fragment,s),tt=o(s),ys=g(s,"P",{"data-svelte-h":!0}),T(ys)!=="svelte-1i4emod"&&(ys.innerHTML=Rt),et=o(s),j(D.$$.fragment,s),lt=o(s),j(Js.$$.fragment,s),at=o(s),j(P.$$.fragment,s),nt=o(s),j(K.$$.fragment,s),pt=o(s),j(gs.$$.fragment,s),rt=o(s),Ts=g(s,"P",{"data-svelte-h":!0}),T(Ts)!=="svelte-h42vxk"&&(Ts.innerHTML=xt),it=o(s),$s=g(s,"P",{"data-svelte-h":!0}),T($s)!=="svelte-179emkt"&&($s.innerHTML=Bt),ot=o(s),j(bs.$$.fragment,s),mt=o(s),Us=g(s,"P",{"data-svelte-h":!0}),T(Us)!=="svelte-174wmmm"&&(Us.textContent=Gt),Mt=o(s),Cs=g(s,"P",{"data-svelte-h":!0}),T(Cs)!=="svelte-19ecll8"&&(Cs.textContent=Wt),ct=o(s),j(Is.$$.fragment,s),ut=o(s),_s=g(s,"P",{"data-svelte-h":!0}),T(_s)!=="svelte-18d8pbh"&&(_s.innerHTML=At),jt=o(s),j(Zs.$$.fragment,s),ft=o(s),ks=g(s,"P",{"data-svelte-h":!0}),T(ks)!=="svelte-ckakkh"&&(ks.innerHTML=vt),wt=o(s),j(O.$$.fragment,s),ht=o(s),j(Xs.$$.fragment,s),dt=o(s),Ws=g(s,"P",{}),Et(Ws).forEach(a),this.h()},h(){Nt(l,"name","hf:doc:metadata"),Nt(l,"content",Je)},m(s,p){Kt(document.head,l),n(s,m,p),n(s,e,p),n(s,M,p),f(y,s,p),n(s,_,p),f(v,s,p),n(s,X,p),f(Z,s,p),n(s,B,p),n(s,b,p),n(s,G,p),n(s,$,p),n(s,k,p),n(s,V,p),n(s,U,p),n(s,R,p),n(s,c,p),f(z,s,p),n(s,q,p),n(s,H,p),n(s,Y,p),f(Q,s,p),n(s,S,p),n(s,E,p),n(s,L,p),f(r,s,p),n(s,C,p),f(N,s,p),n(s,As,p),n(s,ts,p),n(s,vs,p),f(es,s,p),n(s,Vs,p),n(s,ls,p),n(s,zs,p),f(as,s,p),n(s,Fs,p),n(s,ns,p),n(s,Hs,p),f(ps,s,p),n(s,Qs,p),n(s,rs,p),n(s,Es,p),n(s,is,p),n(s,Ns,p),f(os,s,p),n(s,qs,p),f(ms,s,p),n(s,Ys,p),n(s,Ms,p),n(s,Ss,p),f(cs,s,p),n(s,Ls,p),n(s,us,p),n(s,Ds,p),n(s,js,p),n(s,Ps,p),n(s,fs,p),n(s,Ks,p),f(ws,s,p),n(s,Os,p),n(s,hs,p),n(s,st,p),f(ds,s,p),n(s,tt,p),n(s,ys,p),n(s,et,p),f(D,s,p),n(s,lt,p),f(Js,s,p),n(s,at,p),f(P,s,p),n(s,nt,p),f(K,s,p),n(s,pt,p),f(gs,s,p),n(s,rt,p),n(s,Ts,p),n(s,it,p),n(s,$s,p),n(s,ot,p),f(bs,s,p),n(s,mt,p),n(s,Us,p),n(s,Mt,p),n(s,Cs,p),n(s,ct,p),f(Is,s,p),n(s,ut,p),n(s,_s,p),n(s,jt,p),f(Zs,s,p),n(s,ft,p),n(s,ks,p),n(s,wt,p),f(O,s,p),n(s,ht,p),f(Xs,s,p),n(s,dt,p),n(s,Ws,p),yt=!0},p(s,[p]){const Vt={};p&2&&(Vt.$$scope={dirty:p,ctx:s}),z.$set(Vt);const zt={};p&2&&(zt.$$scope={dirty:p,ctx:s}),D.$set(zt);const Ft={};p&2&&(Ft.$$scope={dirty:p,ctx:s}),P.$set(Ft);const Ht={};p&2&&(Ht.$$scope={dirty:p,ctx:s}),K.$set(Ht);const Qt={};p&2&&(Qt.$$scope={dirty:p,ctx:s}),O.$set(Qt)},i(s){yt||(w(y.$$.fragment,s),w(v.$$.fragment,s),w(Z.$$.fragment,s),w(z.$$.fragment,s),w(Q.$$.fragment,s),w(r.$$.fragment,s),w(N.$$.fragment,s),w(es.$$.fragment,s),w(as.$$.fragment,s),w(ps.$$.fragment,s),w(os.$$.fragment,s),w(ms.$$.fragment,s),w(cs.$$.fragment,s),w(ws.$$.fragment,s),w(ds.$$.fragment,s),w(D.$$.fragment,s),w(Js.$$.fragment,s),w(P.$$.fragment,s),w(K.$$.fragment,s),w(gs.$$.fragment,s),w(bs.$$.fragment,s),w(Is.$$.fragment,s),w(Zs.$$.fragment,s),w(O.$$.fragment,s),w(Xs.$$.fragment,s),yt=!0)},o(s){h(y.$$.fragment,s),h(v.$$.fragment,s),h(Z.$$.fragment,s),h(z.$$.fragment,s),h(Q.$$.fragment,s),h(r.$$.fragment,s),h(N.$$.fragment,s),h(es.$$.fragment,s),h(as.$$.fragment,s),h(ps.$$.fragment,s),h(os.$$.fragment,s),h(ms.$$.fragment,s),h(cs.$$.fragment,s),h(ws.$$.fragment,s),h(ds.$$.fragment,s),h(D.$$.fragment,s),h(Js.$$.fragment,s),h(P.$$.fragment,s),h(K.$$.fragment,s),h(gs.$$.fragment,s),h(bs.$$.fragment,s),h(Is.$$.fragment,s),h(Zs.$$.fragment,s),h(O.$$.fragment,s),h(Xs.$$.fragment,s),yt=!1},d(s){s&&(a(m),a(e),a(M),a(_),a(X),a(B),a(b),a(G),a($),a(k),a(V),a(U),a(R),a(c),a(q),a(H),a(Y),a(S),a(E),a(L),a(C),a(As),a(ts),a(vs),a(Vs),a(ls),a(zs),a(Fs),a(ns),a(Hs),a(Qs),a(rs),a(Es),a(is),a(Ns),a(qs),a(Ys),a(Ms),a(Ss),a(Ls),a(us),a(Ds),a(js),a(Ps),a(fs),a(Ks),a(Os),a(hs),a(st),a(tt),a(ys),a(et),a(lt),a(at),a(nt),a(pt),a(rt),a(Ts),a(it),a($s),a(ot),a(mt),a(Us),a(Mt),a(Cs),a(ct),a(ut),a(_s),a(jt),a(ft),a(ks),a(wt),a(ht),a(dt),a(Ws)),a(l),d(y,s),d(v,s),d(Z,s),d(z,s),d(Q,s),d(r,s),d(N,s),d(es,s),d(as,s),d(ps,s),d(os,s),d(ms,s),d(cs,s),d(ws,s),d(ds,s),d(D,s),d(Js,s),d(P,s),d(K,s),d(gs,s),d(bs,s),d(Is,s),d(Zs,s),d(O,s),d(Xs,s)}}}const Je='{"title":"질의 응답(Question Answering)","local":"question-answering","sections":[{"title":"SQuAD 데이터 세트 가져오기","local":"load-squad-dataset","sections":[],"depth":2},{"title":"전처리","local":"preprocess","sections":[],"depth":2},{"title":"훈련","local":"train","sections":[],"depth":2},{"title":"평가","local":"evaluate","sections":[],"depth":2},{"title":"추론","local":"inference","sections":[],"depth":2}],"depth":1}';function ge(I){return St(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ke extends Lt{constructor(l){super(),Dt(this,l,ge,ye,Yt,{})}}export{ke as component};
