import{s as X,n as Y,o as Z}from"../chunks/scheduler.cc52f4b9.js";import{S as L,i as K,e as f,s as o,c as U,h as F,a as g,d as t,b as n,f as G,g as j,j as N,k as P,l as O,m as a,n as q,t as w,o as J,p as T}from"../chunks/index.d2856393.js";import{C as D,H as ee,E as se}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.e6659d4e.js";import{C as te}from"../chunks/CodeBlock.9c179ed7.js";import{C as ae}from"../chunks/CourseFloatingBanner.1c404cc0.js";function oe(R){let l,$,M,k,r,C,i,v,p,I,m,z="Se sua intenção é usar um modelo pré-treinado ou uma versão ajustada em produção, esteja ciente de que, embora esses modelos sejam ferramentas poderosas, eles vêm com limitações. A maior delas é que, para possibilitar o pré-treinamento em grandes quantidades de dados, os pesquisadores muitas vezes raspam todo o conteúdo que encontram, tirando o melhor e o pior do que está disponível na internet.",B,u,E="Para dar uma ilustração rápida, vamos voltar ao exemplo de um pipeline <code>fill-mask</code> com o modelo BERT:",x,c,_,d,H='Quando solicitado a preencher a palavra que falta nessas duas frases, o modelo dá apenas uma resposta livre de gênero (garçom/garçonete). As outras são ocupações de trabalho geralmente associadas a um gênero específico - e sim, prostituta acabou entre as 5 principais possibilidades que o modelo associa a “mulher” e “trabalho”. Isso acontece mesmo que o BERT seja um dos raros modelos de Transformer não construídos por meio de coleta de dados de toda a Internet, mas usando dados aparentemente neutros (ele é treinado com datasets da <a href="https://huggingface.co/datasets/wikipedia" rel="nofollow">Wikipedia em inglês</a> e <a href="https://huggingface.co/datasets/bookcorpus" rel="nofollow">BookCorpus</a>).',Q,y,A="Quando você usa essas ferramentas, você precisa ter em mente que o modelo original que você está usando pode facilmente gerar conteúdo sexista, racista ou homofóbico. O ajuste fino do modelo em seus dados não fará com que esse viés intrínseco desapareça.",V,h,W,b,S;return r=new D({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),i=new ee({props:{title:"Vieses e limitações",local:"vieses-e-limitações",headingTag:"h1"}}),p=new ae({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/pt/chapter1/section8.ipynb](https://colab.research.google.com/github/huggingface/notebooks/blob/master/course/pt/chapter1/section8.ipynb)"},{label:"Aws Studio",value:"[https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/master/course/pt/chapter1/section8.ipynb](https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/master/course/pt/chapter1/section8.ipynb)"}]}}),c=new te({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBdW5tYXNrZXIlMjAlM0QlMjBwaXBlbGluZSglMjJmaWxsLW1hc2slMjIlMkMlMjBtb2RlbCUzRCUyMmJlcnQtYmFzZS11bmNhc2VkJTIyKSUwQXJlc3VsdCUyMCUzRCUyMHVubWFza2VyKCUyMlRoaXMlMjBtYW4lMjB3b3JrcyUyMGFzJTIwYSUyMCU1Qk1BU0slNUQuJTIyKSUwQXByaW50KCU1QnIlNUIlMjJ0b2tlbl9zdHIlMjIlNUQlMjBmb3IlMjByJTIwaW4lMjByZXN1bHQlNUQpJTBBJTBBcmVzdWx0JTIwJTNEJTIwdW5tYXNrZXIoJTIyVGhpcyUyMHdvbWFuJTIwd29ya3MlMjBhcyUyMGElMjAlNUJNQVNLJTVELiUyMiklMEFwcmludCglNUJyJTVCJTIydG9rZW5fc3RyJTIyJTVEJTIwZm9yJTIwciUyMGluJTIwcmVzdWx0JTVEKSUwQSUwQSU1QiUyMmxhd3llciUyMiUyQyUyMCUyMmNhcnBlbnRlciUyMiUyQyUyMCUyMmRvY3RvciUyMiUyQyUyMCUyMndhaXRlciUyMiUyQyUyMCUyMm1lY2hhbmljJTIyJTVEJTBBJTVCJTIybnVyc2UlMjIlMkMlMjAlMjJ3YWl0cmVzcyUyMiUyQyUyMCUyMnRlYWNoZXIlMjIlMkMlMjAlMjJtYWlkJTIyJTJDJTIwJTIycHJvc3RpdHV0ZSUyMiU1RA==",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])

[<span class="hljs-string">&quot;lawyer&quot;</span>, <span class="hljs-string">&quot;carpenter&quot;</span>, <span class="hljs-string">&quot;doctor&quot;</span>, <span class="hljs-string">&quot;waiter&quot;</span>, <span class="hljs-string">&quot;mechanic&quot;</span>]
[<span class="hljs-string">&quot;nurse&quot;</span>, <span class="hljs-string">&quot;waitress&quot;</span>, <span class="hljs-string">&quot;teacher&quot;</span>, <span class="hljs-string">&quot;maid&quot;</span>, <span class="hljs-string">&quot;prostitute&quot;</span>]`,wrap:!1}}),h=new se({props:{source:"https://github.com/huggingface/course/blob/main/chapters/pt/chapter1/8.mdx"}}),{c(){l=f("meta"),$=o(),M=f("p"),k=o(),U(r.$$.fragment),C=o(),U(i.$$.fragment),v=o(),U(p.$$.fragment),I=o(),m=f("p"),m.textContent=z,B=o(),u=f("p"),u.innerHTML=E,x=o(),U(c.$$.fragment),_=o(),d=f("p"),d.innerHTML=H,Q=o(),y=f("p"),y.textContent=A,V=o(),U(h.$$.fragment),W=o(),b=f("p"),this.h()},l(e){const s=F("svelte-u9bgzb",document.head);l=g(s,"META",{name:!0,content:!0}),s.forEach(t),$=n(e),M=g(e,"P",{}),G(M).forEach(t),k=n(e),j(r.$$.fragment,e),C=n(e),j(i.$$.fragment,e),v=n(e),j(p.$$.fragment,e),I=n(e),m=g(e,"P",{"data-svelte-h":!0}),N(m)!=="svelte-16y7c0b"&&(m.textContent=z),B=n(e),u=g(e,"P",{"data-svelte-h":!0}),N(u)!=="svelte-my30tl"&&(u.innerHTML=E),x=n(e),j(c.$$.fragment,e),_=n(e),d=g(e,"P",{"data-svelte-h":!0}),N(d)!=="svelte-15xahqt"&&(d.innerHTML=H),Q=n(e),y=g(e,"P",{"data-svelte-h":!0}),N(y)!=="svelte-1m5nzel"&&(y.textContent=A),V=n(e),j(h.$$.fragment,e),W=n(e),b=g(e,"P",{}),G(b).forEach(t),this.h()},h(){P(l,"name","hf:doc:metadata"),P(l,"content",ne)},m(e,s){O(document.head,l),a(e,$,s),a(e,M,s),a(e,k,s),q(r,e,s),a(e,C,s),q(i,e,s),a(e,v,s),q(p,e,s),a(e,I,s),a(e,m,s),a(e,B,s),a(e,u,s),a(e,x,s),q(c,e,s),a(e,_,s),a(e,d,s),a(e,Q,s),a(e,y,s),a(e,V,s),q(h,e,s),a(e,W,s),a(e,b,s),S=!0},p:Y,i(e){S||(w(r.$$.fragment,e),w(i.$$.fragment,e),w(p.$$.fragment,e),w(c.$$.fragment,e),w(h.$$.fragment,e),S=!0)},o(e){J(r.$$.fragment,e),J(i.$$.fragment,e),J(p.$$.fragment,e),J(c.$$.fragment,e),J(h.$$.fragment,e),S=!1},d(e){e&&(t($),t(M),t(k),t(C),t(v),t(I),t(m),t(B),t(u),t(x),t(_),t(d),t(Q),t(y),t(V),t(W),t(b)),t(l),T(r,e),T(i,e),T(p,e),T(c,e),T(h,e)}}}const ne='{"title":"Vieses e limitações","local":"vieses-e-limitações","sections":[],"depth":1}';function le(R){return Z(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ce extends L{constructor(l){super(),K(this,l,le,oe,X,{})}}export{ce as component};
