import{s as Z,n as F,o as P}from"../chunks/scheduler.37c15a92.js";import{S as X,i as Y,g as f,s as n,r as v,A as L,h as y,f as s,c as l,j as z,u as I,x as _,k as A,y as K,a,v as V,d as W,t as N,w as q}from"../chunks/index.2bf4358c.js";import{C as R}from"../chunks/CodeBlock.4f5fc1ad.js";import{C as D}from"../chunks/CourseFloatingBanner.15ba07e6.js";import{H as O}from"../chunks/Heading.8ada512a.js";function ee(Q){let i,b,g,M,o,k,r,j,p,E="If your intent is to use a pretrained model or a fine-tuned version in production, please be aware that, while these models are powerful tools, they come with limitations. The biggest of these is that, to enable pretraining on large amounts of data, researchers often scrape all the content they can find, taking the best as well as the worst of what is available on the internet.",J,c,G="To give a quick illustration, let’s go back the example of a <code>fill-mask</code> pipeline with the BERT model:",T,h,x,m,$,u,H='When asked to fill in the missing word in these two sentences, the model gives only one gender-free answer (waiter/waitress). The others are work occupations usually associated with one specific gender — and yes, prostitute ended up in the top 5 possibilities the model associates with “woman” and “work.” This happens even though BERT is one of the rare Transformer models not built by scraping data from all over the internet, but rather using apparently neutral data (it’s trained on the <a href="https://huggingface.co/datasets/wikipedia" rel="nofollow">English Wikipedia</a> and <a href="https://huggingface.co/datasets/bookcorpus" rel="nofollow">BookCorpus</a> datasets).',U,d,S="When you use these tools, you therefore need to keep in the back of your mind that the original model you are using could very easily generate sexist, racist, or homophobic content. Fine-tuning the model on your data won’t make this intrinsic bias disappear.",C,w,B;return o=new O({props:{title:"Bias and limitations",local:"bias-and-limitations",headingTag:"h1"}}),r=new D({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/en/chapter1/section8.ipynb"},{label:"Aws Studio",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/master/course/en/chapter1/section8.ipynb"}]}}),h=new R({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}}),m=new R({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}}),{c(){i=f("meta"),b=n(),g=f("p"),M=n(),v(o.$$.fragment),k=n(),v(r.$$.fragment),j=n(),p=f("p"),p.textContent=E,J=n(),c=f("p"),c.innerHTML=G,T=n(),v(h.$$.fragment),x=n(),v(m.$$.fragment),$=n(),u=f("p"),u.innerHTML=H,U=n(),d=f("p"),d.textContent=S,C=n(),w=f("p"),this.h()},l(e){const t=L("svelte-u9bgzb",document.head);i=y(t,"META",{name:!0,content:!0}),t.forEach(s),b=l(e),g=y(e,"P",{}),z(g).forEach(s),M=l(e),I(o.$$.fragment,e),k=l(e),I(r.$$.fragment,e),j=l(e),p=y(e,"P",{"data-svelte-h":!0}),_(p)!=="svelte-1q5fkuw"&&(p.textContent=E),J=l(e),c=y(e,"P",{"data-svelte-h":!0}),_(c)!=="svelte-lenr95"&&(c.innerHTML=G),T=l(e),I(h.$$.fragment,e),x=l(e),I(m.$$.fragment,e),$=l(e),u=y(e,"P",{"data-svelte-h":!0}),_(u)!=="svelte-heqc6c"&&(u.innerHTML=H),U=l(e),d=y(e,"P",{"data-svelte-h":!0}),_(d)!=="svelte-u698k"&&(d.textContent=S),C=l(e),w=y(e,"P",{}),z(w).forEach(s),this.h()},h(){A(i,"name","hf:doc:metadata"),A(i,"content",te)},m(e,t){K(document.head,i),a(e,b,t),a(e,g,t),a(e,M,t),V(o,e,t),a(e,k,t),V(r,e,t),a(e,j,t),a(e,p,t),a(e,J,t),a(e,c,t),a(e,T,t),V(h,e,t),a(e,x,t),V(m,e,t),a(e,$,t),a(e,u,t),a(e,U,t),a(e,d,t),a(e,C,t),a(e,w,t),B=!0},p:F,i(e){B||(W(o.$$.fragment,e),W(r.$$.fragment,e),W(h.$$.fragment,e),W(m.$$.fragment,e),B=!0)},o(e){N(o.$$.fragment,e),N(r.$$.fragment,e),N(h.$$.fragment,e),N(m.$$.fragment,e),B=!1},d(e){e&&(s(b),s(g),s(M),s(k),s(j),s(p),s(J),s(c),s(T),s(x),s($),s(u),s(U),s(d),s(C),s(w)),s(i),q(o,e),q(r,e),q(h,e),q(m,e)}}}const te='{"title":"Bias and limitations","local":"bias-and-limitations","sections":[],"depth":1}';function se(Q){return P(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class re extends X{constructor(i){super(),Y(this,i,se,ee,Z,{})}}export{re as component};
