import{s as F,n as Y,o as K}from"../chunks/scheduler.cc52f4b9.js";import{S as D,i as O,e as g,s as l,c as $,h as ss,a as b,d as e,b as n,f as L,g as d,j as S,k as P,l as ts,m as a,n as j,t as w,o as J,p as x}from"../chunks/index.ccfa71ad.js";import{C as es,H as as,E as ls}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.bf6e17b3.js";import{C as X}from"../chunks/CodeBlock.d683ceb4.js";import{C as ns}from"../chunks/CourseFloatingBanner.23e5afab.js";function rs(q){let r,C,k,U,p,B,i,_,o,I,c,z="사전 학습된 혹은 미세 조정된 모델을 프로덕션 단계에서 사용하실 계획이라면, 이러한 모델들은 강력한 툴이지만 한계가 있음을 반드시 명심하셔야 합니다. 가장 큰 한계점은 리서처들이 무수히 많은 양의 데이터를 사전 학습에 사용하기 위해, 인터넷상에서 모을 수 있는 양질의 데이터와 함께 그렇지 않은 데이터까지 수집했을 가능성이 있다는 것입니다.",V,m,A="이를 빠르게 보여드리기 위해 <code>fill-mask</code> 파이프라인에 BERT 모델을 연결한 예제를 다시 살펴보겠습니다:",W,u,v,f,N,h,R='주어의 성별만 바꾼 두 문장에서 빠진 단어를 채울 때, 모델은 성별과 관계 없는 공통 답변(waiter/waitress)을 하나만 내놓았습니다.  다른 답변들은 일반적으로 특정 성별에 편향된 답변이었습니다. 이를테면, 모델은 매춘이라는 단어와 연관된 상위 5개의 단어에 “여성”과 “일”을 포함시켰습니다. BERT가 전체 인터넷 상의 텍스트를 이용하여 사전 학습된 것이 아니라 <a href="https://huggingface.co/datasets/wikipedia" rel="nofollow">English Wikipedia</a> 와 <a href="https://huggingface.co/datasets/bookcorpus" rel="nofollow">BookCorpus</a> 같이 상당히 중립적인 데이터를 이용해 사전 학습 되었음에도 불구하고 이러한 현상이 일어납니다.',E,y,Z="따라서 이러한 툴을 사용하실 때에는 항상 여러분이 사용할 원본 모델이 젠더, 인종, 동성애 등에 대해 혐오 표현을 할 가능성이 매우 높다는 것을 주의하셔야 합니다. 이러한 모델은 미세 조정을 거쳐도 내제된 편향성을 없애지 못합니다.",G,M,Q,T,H;return p=new es({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),i=new as({props:{title:"편향과 한계",local:"편향과-한계",headingTag:"h1"}}),o=new ns({props:{chapter:1,classNames:"absolute z-10 right-0 top-0",notebooks:[{label:"Google Colab",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/master/course/ko/chapter1/section8.ipynb"},{label:"Aws Studio",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/master/course/ko/chapter1/section8.ipynb"}]}}),u=new X({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBdW5tYXNrZXIlMjAlM0QlMjBwaXBlbGluZSglMjJmaWxsLW1hc2slMjIlMkMlMjBtb2RlbCUzRCUyMmJlcnQtYmFzZS11bmNhc2VkJTIyKSUwQXJlc3VsdCUyMCUzRCUyMHVubWFza2VyKCUyMlRoaXMlMjBtYW4lMjB3b3JrcyUyMGFzJTIwYSUyMCU1Qk1BU0slNUQuJTIyKSUwQXByaW50KCU1QnIlNUIlMjJ0b2tlbl9zdHIlMjIlNUQlMjBmb3IlMjByJTIwaW4lMjByZXN1bHQlNUQpJTBBJTBBcmVzdWx0JTIwJTNEJTIwdW5tYXNrZXIoJTIyVGhpcyUyMHdvbWFuJTIwd29ya3MlMjBhcyUyMGElMjAlNUJNQVNLJTVELiUyMiklMEFwcmludCglNUJyJTVCJTIydG9rZW5fc3RyJTIyJTVEJTIwZm9yJTIwciUyMGluJTIwcmVzdWx0JTVEKQ==",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

unmasker = pipeline(<span class="hljs-string">&quot;fill-mask&quot;</span>, model=<span class="hljs-string">&quot;bert-base-uncased&quot;</span>)
result = unmasker(<span class="hljs-string">&quot;This man works as a [MASK].&quot;</span>)
<span class="hljs-built_in">print</span>([r[<span class="hljs-string">&quot;token_str&quot;</span>] <span class="hljs-keyword">for</span> r <span class="hljs-keyword">in</span> result])

result = unmasker(<span class="hljs-string">&quot;This woman works as a [MASK].&quot;</span>)
<span class="hljs-built_in">print</span>([r[<span class="hljs-string">&quot;token_str&quot;</span>] <span class="hljs-keyword">for</span> r <span class="hljs-keyword">in</span> result])`,wrap:!1}}),f=new X({props:{code:"JTVCJ2xhd3llciclMkMlMjAnY2FycGVudGVyJyUyQyUyMCdkb2N0b3InJTJDJTIwJ3dhaXRlciclMkMlMjAnbWVjaGFuaWMnJTVEJTBBJTVCJ251cnNlJyUyQyUyMCd3YWl0cmVzcyclMkMlMjAndGVhY2hlciclMkMlMjAnbWFpZCclMkMlMjAncHJvc3RpdHV0ZSclNUQ=",highlighted:`[<span class="hljs-string">&#x27;lawyer&#x27;</span>, <span class="hljs-string">&#x27;carpenter&#x27;</span>, <span class="hljs-string">&#x27;doctor&#x27;</span>, <span class="hljs-string">&#x27;waiter&#x27;</span>, <span class="hljs-string">&#x27;mechanic&#x27;</span>]
[<span class="hljs-string">&#x27;nurse&#x27;</span>, <span class="hljs-string">&#x27;waitress&#x27;</span>, <span class="hljs-string">&#x27;teacher&#x27;</span>, <span class="hljs-string">&#x27;maid&#x27;</span>, <span class="hljs-string">&#x27;prostitute&#x27;</span>]`,wrap:!1}}),M=new ls({props:{source:"https://github.com/huggingface/course/blob/main/chapters/ko/chapter1/8.mdx"}}),{c(){r=g("meta"),C=l(),k=g("p"),U=l(),$(p.$$.fragment),B=l(),$(i.$$.fragment),_=l(),$(o.$$.fragment),I=l(),c=g("p"),c.textContent=z,V=l(),m=g("p"),m.innerHTML=A,W=l(),$(u.$$.fragment),v=l(),$(f.$$.fragment),N=l(),h=g("p"),h.innerHTML=R,E=l(),y=g("p"),y.textContent=Z,G=l(),$(M.$$.fragment),Q=l(),T=g("p"),this.h()},l(s){const t=ss("svelte-u9bgzb",document.head);r=b(t,"META",{name:!0,content:!0}),t.forEach(e),C=n(s),k=b(s,"P",{}),L(k).forEach(e),U=n(s),d(p.$$.fragment,s),B=n(s),d(i.$$.fragment,s),_=n(s),d(o.$$.fragment,s),I=n(s),c=b(s,"P",{"data-svelte-h":!0}),S(c)!=="svelte-wi12pj"&&(c.textContent=z),V=n(s),m=b(s,"P",{"data-svelte-h":!0}),S(m)!=="svelte-13l9y7t"&&(m.innerHTML=A),W=n(s),d(u.$$.fragment,s),v=n(s),d(f.$$.fragment,s),N=n(s),h=b(s,"P",{"data-svelte-h":!0}),S(h)!=="svelte-8t4x27"&&(h.innerHTML=R),E=n(s),y=b(s,"P",{"data-svelte-h":!0}),S(y)!=="svelte-17vsb8r"&&(y.textContent=Z),G=n(s),d(M.$$.fragment,s),Q=n(s),T=b(s,"P",{}),L(T).forEach(e),this.h()},h(){P(r,"name","hf:doc:metadata"),P(r,"content",ps)},m(s,t){ts(document.head,r),a(s,C,t),a(s,k,t),a(s,U,t),j(p,s,t),a(s,B,t),j(i,s,t),a(s,_,t),j(o,s,t),a(s,I,t),a(s,c,t),a(s,V,t),a(s,m,t),a(s,W,t),j(u,s,t),a(s,v,t),j(f,s,t),a(s,N,t),a(s,h,t),a(s,E,t),a(s,y,t),a(s,G,t),j(M,s,t),a(s,Q,t),a(s,T,t),H=!0},p:Y,i(s){H||(w(p.$$.fragment,s),w(i.$$.fragment,s),w(o.$$.fragment,s),w(u.$$.fragment,s),w(f.$$.fragment,s),w(M.$$.fragment,s),H=!0)},o(s){J(p.$$.fragment,s),J(i.$$.fragment,s),J(o.$$.fragment,s),J(u.$$.fragment,s),J(f.$$.fragment,s),J(M.$$.fragment,s),H=!1},d(s){s&&(e(C),e(k),e(U),e(B),e(_),e(I),e(c),e(V),e(m),e(W),e(v),e(N),e(h),e(E),e(y),e(G),e(Q),e(T)),e(r),x(p,s),x(i,s),x(o,s),x(u,s),x(f,s),x(M,s)}}}const ps='{"title":"편향과 한계","local":"편향과-한계","sections":[],"depth":1}';function is(q){return K(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class hs extends D{constructor(r){super(),O(this,r,is,rs,F,{})}}export{hs as component};
