import{s as P,n as X,o as Y}from"../chunks/scheduler.37c15a92.js";import{S as L,i as K,g as y,s as n,r as M,A as D,h as g,f as s,c as l,j as R,u as k,x as G,k as Z,y as O,a,v as j,d as J,t as T,w as $}from"../chunks/index.7cb9c9b8.js";import{C as F}from"../chunks/CodeBlock.abae2786.js";import{C as ee}from"../chunks/CourseFloatingBanner.df82c153.js";import{H as te,E as se}from"../chunks/getInferenceSnippets.b6a8c7d2.js";function ae(Q){let i,x,b,U,o,C,r,B,p,H="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.",v,c,S="To give a quick illustration, let’s go back the example of a <code>fill-mask</code> pipeline with the BERT model:",I,h,_,m,V,u,z='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).',W,d,A="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.",N,f,q,w,E;return o=new te({props:{title:"Bias and limitations",local:"bias-and-limitations",headingTag:"h1"}}),r=new ee({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 F({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 F({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}}),f=new se({props:{source:"https://github.com/huggingface/course/blob/main/chapters/en/chapter1/9.mdx"}}),{c(){i=y("meta"),x=n(),b=y("p"),U=n(),M(o.$$.fragment),C=n(),M(r.$$.fragment),B=n(),p=y("p"),p.textContent=H,v=n(),c=y("p"),c.innerHTML=S,I=n(),M(h.$$.fragment),_=n(),M(m.$$.fragment),V=n(),u=y("p"),u.innerHTML=z,W=n(),d=y("p"),d.textContent=A,N=n(),M(f.$$.fragment),q=n(),w=y("p"),this.h()},l(e){const t=D("svelte-u9bgzb",document.head);i=g(t,"META",{name:!0,content:!0}),t.forEach(s),x=l(e),b=g(e,"P",{}),R(b).forEach(s),U=l(e),k(o.$$.fragment,e),C=l(e),k(r.$$.fragment,e),B=l(e),p=g(e,"P",{"data-svelte-h":!0}),G(p)!=="svelte-1q5fkuw"&&(p.textContent=H),v=l(e),c=g(e,"P",{"data-svelte-h":!0}),G(c)!=="svelte-lenr95"&&(c.innerHTML=S),I=l(e),k(h.$$.fragment,e),_=l(e),k(m.$$.fragment,e),V=l(e),u=g(e,"P",{"data-svelte-h":!0}),G(u)!=="svelte-heqc6c"&&(u.innerHTML=z),W=l(e),d=g(e,"P",{"data-svelte-h":!0}),G(d)!=="svelte-u698k"&&(d.textContent=A),N=l(e),k(f.$$.fragment,e),q=l(e),w=g(e,"P",{}),R(w).forEach(s),this.h()},h(){Z(i,"name","hf:doc:metadata"),Z(i,"content",ne)},m(e,t){O(document.head,i),a(e,x,t),a(e,b,t),a(e,U,t),j(o,e,t),a(e,C,t),j(r,e,t),a(e,B,t),a(e,p,t),a(e,v,t),a(e,c,t),a(e,I,t),j(h,e,t),a(e,_,t),j(m,e,t),a(e,V,t),a(e,u,t),a(e,W,t),a(e,d,t),a(e,N,t),j(f,e,t),a(e,q,t),a(e,w,t),E=!0},p:X,i(e){E||(J(o.$$.fragment,e),J(r.$$.fragment,e),J(h.$$.fragment,e),J(m.$$.fragment,e),J(f.$$.fragment,e),E=!0)},o(e){T(o.$$.fragment,e),T(r.$$.fragment,e),T(h.$$.fragment,e),T(m.$$.fragment,e),T(f.$$.fragment,e),E=!1},d(e){e&&(s(x),s(b),s(U),s(C),s(B),s(p),s(v),s(c),s(I),s(_),s(V),s(u),s(W),s(d),s(N),s(q),s(w)),s(i),$(o,e),$(r,e),$(h,e),$(m,e),$(f,e)}}}const ne='{"title":"Bias and limitations","local":"bias-and-limitations","sections":[],"depth":1}';function le(Q){return Y(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class he extends L{constructor(i){super(),K(this,i,le,ae,P,{})}}export{he as component};
