import{S as us,i as cs,s as fs,e as n,k as c,w as L,t as f,M as hs,c as l,d as a,m as h,a as i,x as G,h as d,b as p,G as e,g as r,y as I,L as ds,q as W,o as F,B as H,v as ks}from"../../chunks/vendor-hf-doc-builder.js";import{I as ws}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{C as ms}from"../../chunks/CodeBlock-hf-doc-builder.js";import{C as gs}from"../../chunks/CourseFloatingBanner-hf-doc-builder.js";import"../../chunks/DocNotebookDropdown-hf-doc-builder.js";function _s(as){let m,A,u,k,q,w,J,B,O,C,g,S,j,U,T,v,D,P,_,M,$,N,o,Q,b,V,X,x,Y,Z,R,y,ss,K;return w=new ws({}),g=new gs({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/zh-CN/chapter1/section8.ipynb"},{label:"Aws Studio",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/master/course/zh-CN/chapter1/section8.ipynb"}]}}),_=new ms({props:{code:`from transformers import pipeline

unmasker = pipeline("fill-mask", model="bert-base-uncased")
result = unmasker("This man works as a [MASK].")
print([r["token_str"] for r in result])

result = unmasker("This woman works as a [MASK].")
print([r["token_str"] for r in result])`,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])`}}),$=new ms({props:{code:`['lawyer', 'carpenter', 'doctor', 'waiter', 'mechanic']
['nurse', 'waitress', 'teacher', 'maid', 'prostitute']`,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>]`}}),{c(){m=n("meta"),A=c(),u=n("h1"),k=n("a"),q=n("span"),L(w.$$.fragment),J=c(),B=n("span"),O=f("Bias and limitations"),C=c(),L(g.$$.fragment),S=c(),j=n("p"),U=f("\u5982\u679C\u60A8\u6253\u7B97\u5728\u6B63\u5F0F\u7684\u9879\u76EE\u4E2D\u4F7F\u7528\u7ECF\u8FC7\u9884\u8BAD\u7EC3\u6216\u7ECF\u8FC7\u5FAE\u8C03\u7684\u6A21\u578B\u3002\u8BF7\u6CE8\u610F\uFF1A\u867D\u7136\u8FD9\u4E9B\u6A21\u578B\u662F\u5F88\u5F3A\u5927\uFF0C\u4F46\u5B83\u4EEC\u4E5F\u6709\u5C40\u9650\u6027\u3002\u5176\u4E2D\u6700\u5927\u7684\u4E00\u4E2A\u95EE\u9898\u662F\uFF0C\u4E3A\u4E86\u5BF9\u5927\u91CF\u6570\u636E\u8FDB\u884C\u9884\u8BAD\u7EC3\uFF0C\u7814\u7A76\u4EBA\u5458\u901A\u5E38\u4F1A\u641C\u96C6\u6240\u6709\u4ED6\u4EEC\u80FD\u627E\u5230\u7684\u5185\u5BB9\uFF0C\u4E2D\u95F4\u53EF\u80FD\u5939\u5E26\u4E00\u4E9B\u610F\u8BC6\u5F62\u6001\u6216\u8005\u4EF7\u503C\u89C2\u7684\u523B\u677F\u5370\u8C61\u3002"),T=c(),v=n("p"),D=f("\u4E3A\u4E86\u5FEB\u901F\u89E3\u91CA\u6E05\u695A\u8FD9\u4E2A\u95EE\u9898\uFF0C\u8BA9\u6211\u4EEC\u56DE\u5230\u4E00\u4E2A\u4F7F\u7528BERT\u6A21\u578B\u7684pipeline\u7684\u4F8B\u5B50\uFF1A"),P=c(),L(_.$$.fragment),M=c(),L($.$$.fragment),N=c(),o=n("p"),Q=f("\u5F53\u8981\u6C42\u6A21\u578B\u586B\u5199\u8FD9\u4E24\u53E5\u8BDD\u4E2D\u7F3A\u5C11\u7684\u5355\u8BCD\u65F6\uFF0C\u6A21\u578B\u7ED9\u51FA\u7684\u7B54\u6848\u4E2D\uFF0C\u53EA\u6709\u4E00\u4E2A\u4E0E\u6027\u522B\u65E0\u5173\uFF08\u670D\u52A1\u5458/\u5973\u670D\u52A1\u5458\uFF09\u3002\u5176\u4ED6\u804C\u4E1A\u901A\u5E38\u4E0E\u67D0\u4E00\u7279\u5B9A\u6027\u522B\u76F8\u5173\uFF0C\u5993\u5973\u6700\u7EC8\u8FDB\u5165\u4E86\u6A21\u578B\u4E2D\u4E0E\u201C\u5973\u4EBA\u201D\u548C\u201C\u5DE5\u4F5C\u201D\u76F8\u5173\u7684\u524D\u4E94\u4F4D\u3002\u5C3D\u7BA1BERT\u662F\u4F7F\u7528\u7ECF\u8FC7\u7B5B\u9009\u548C\u6E05\u6D17\u540E\uFF0C\u660E\u663E\u4E2D\u7ACB\u7684\u6570\u636E\u96C6\u4E0A\u5EFA\u7ACB\u7684\u7684Transformer\u6A21\u578B\uFF0C\u800C\u4E0D\u662F\u901A\u8FC7\u4ECE\u4E92\u8054\u7F51\u4E0A\u641C\u96C6\u6570\u636E\uFF08\u5B83\u662F\u5728"),b=n("a"),V=f("Wikipedia \u82F1\u6587"),X=f("\u548C"),x=n("a"),Y=f("BookCorpus"),Z=f("\u6570\u636E\u96C6\uFF09\u3002"),R=c(),y=n("p"),ss=f("\u56E0\u6B64\uFF0C\u5F53\u60A8\u4F7F\u7528\u8FD9\u4E9B\u5DE5\u5177\u65F6\uFF0C\u60A8\u9700\u8981\u8BB0\u4F4F\uFF0C\u4F7F\u7528\u7684\u539F\u59CB\u6A21\u578B\u7684\u65F6\u5019\uFF0C\u5F88\u5BB9\u6613\u751F\u6210\u6027\u522B\u6B67\u89C6\u3001\u79CD\u65CF\u4E3B\u4E49\u6216\u6050\u540C\u5185\u5BB9\u3002\u8FD9\u79CD\u56FA\u6709\u504F\u89C1\u4E0D\u4F1A\u968F\u7740\u5FAE\u8C03\u6A21\u578B\u800C\u4F7F\u6D88\u5931\u3002"),this.h()},l(s){const t=hs('[data-svelte="svelte-1phssyn"]',document.head);m=l(t,"META",{name:!0,content:!0}),t.forEach(a),A=h(s),u=l(s,"H1",{class:!0});var z=i(u);k=l(z,"A",{id:!0,class:!0,href:!0});var ts=i(k);q=l(ts,"SPAN",{});var es=i(q);G(w.$$.fragment,es),es.forEach(a),ts.forEach(a),J=h(z),B=l(z,"SPAN",{});var rs=i(B);O=d(rs,"Bias and limitations"),rs.forEach(a),z.forEach(a),C=h(s),G(g.$$.fragment,s),S=h(s),j=l(s,"P",{});var ns=i(j);U=d(ns,"\u5982\u679C\u60A8\u6253\u7B97\u5728\u6B63\u5F0F\u7684\u9879\u76EE\u4E2D\u4F7F\u7528\u7ECF\u8FC7\u9884\u8BAD\u7EC3\u6216\u7ECF\u8FC7\u5FAE\u8C03\u7684\u6A21\u578B\u3002\u8BF7\u6CE8\u610F\uFF1A\u867D\u7136\u8FD9\u4E9B\u6A21\u578B\u662F\u5F88\u5F3A\u5927\uFF0C\u4F46\u5B83\u4EEC\u4E5F\u6709\u5C40\u9650\u6027\u3002\u5176\u4E2D\u6700\u5927\u7684\u4E00\u4E2A\u95EE\u9898\u662F\uFF0C\u4E3A\u4E86\u5BF9\u5927\u91CF\u6570\u636E\u8FDB\u884C\u9884\u8BAD\u7EC3\uFF0C\u7814\u7A76\u4EBA\u5458\u901A\u5E38\u4F1A\u641C\u96C6\u6240\u6709\u4ED6\u4EEC\u80FD\u627E\u5230\u7684\u5185\u5BB9\uFF0C\u4E2D\u95F4\u53EF\u80FD\u5939\u5E26\u4E00\u4E9B\u610F\u8BC6\u5F62\u6001\u6216\u8005\u4EF7\u503C\u89C2\u7684\u523B\u677F\u5370\u8C61\u3002"),ns.forEach(a),T=h(s),v=l(s,"P",{});var ls=i(v);D=d(ls,"\u4E3A\u4E86\u5FEB\u901F\u89E3\u91CA\u6E05\u695A\u8FD9\u4E2A\u95EE\u9898\uFF0C\u8BA9\u6211\u4EEC\u56DE\u5230\u4E00\u4E2A\u4F7F\u7528BERT\u6A21\u578B\u7684pipeline\u7684\u4F8B\u5B50\uFF1A"),ls.forEach(a),P=h(s),G(_.$$.fragment,s),M=h(s),G($.$$.fragment,s),N=h(s),o=l(s,"P",{});var E=i(o);Q=d(E,"\u5F53\u8981\u6C42\u6A21\u578B\u586B\u5199\u8FD9\u4E24\u53E5\u8BDD\u4E2D\u7F3A\u5C11\u7684\u5355\u8BCD\u65F6\uFF0C\u6A21\u578B\u7ED9\u51FA\u7684\u7B54\u6848\u4E2D\uFF0C\u53EA\u6709\u4E00\u4E2A\u4E0E\u6027\u522B\u65E0\u5173\uFF08\u670D\u52A1\u5458/\u5973\u670D\u52A1\u5458\uFF09\u3002\u5176\u4ED6\u804C\u4E1A\u901A\u5E38\u4E0E\u67D0\u4E00\u7279\u5B9A\u6027\u522B\u76F8\u5173\uFF0C\u5993\u5973\u6700\u7EC8\u8FDB\u5165\u4E86\u6A21\u578B\u4E2D\u4E0E\u201C\u5973\u4EBA\u201D\u548C\u201C\u5DE5\u4F5C\u201D\u76F8\u5173\u7684\u524D\u4E94\u4F4D\u3002\u5C3D\u7BA1BERT\u662F\u4F7F\u7528\u7ECF\u8FC7\u7B5B\u9009\u548C\u6E05\u6D17\u540E\uFF0C\u660E\u663E\u4E2D\u7ACB\u7684\u6570\u636E\u96C6\u4E0A\u5EFA\u7ACB\u7684\u7684Transformer\u6A21\u578B\uFF0C\u800C\u4E0D\u662F\u901A\u8FC7\u4ECE\u4E92\u8054\u7F51\u4E0A\u641C\u96C6\u6570\u636E\uFF08\u5B83\u662F\u5728"),b=l(E,"A",{href:!0,rel:!0});var os=i(b);V=d(os,"Wikipedia \u82F1\u6587"),os.forEach(a),X=d(E,"\u548C"),x=l(E,"A",{href:!0,rel:!0});var is=i(x);Y=d(is,"BookCorpus"),is.forEach(a),Z=d(E,"\u6570\u636E\u96C6\uFF09\u3002"),E.forEach(a),R=h(s),y=l(s,"P",{});var ps=i(y);ss=d(ps,"\u56E0\u6B64\uFF0C\u5F53\u60A8\u4F7F\u7528\u8FD9\u4E9B\u5DE5\u5177\u65F6\uFF0C\u60A8\u9700\u8981\u8BB0\u4F4F\uFF0C\u4F7F\u7528\u7684\u539F\u59CB\u6A21\u578B\u7684\u65F6\u5019\uFF0C\u5F88\u5BB9\u6613\u751F\u6210\u6027\u522B\u6B67\u89C6\u3001\u79CD\u65CF\u4E3B\u4E49\u6216\u6050\u540C\u5185\u5BB9\u3002\u8FD9\u79CD\u56FA\u6709\u504F\u89C1\u4E0D\u4F1A\u968F\u7740\u5FAE\u8C03\u6A21\u578B\u800C\u4F7F\u6D88\u5931\u3002"),ps.forEach(a),this.h()},h(){p(m,"name","hf:doc:metadata"),p(m,"content",JSON.stringify($s)),p(k,"id","bias-and-limitations"),p(k,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(k,"href","#bias-and-limitations"),p(u,"class","relative group"),p(b,"href","https://huggingface.co/datasets/wikipedia"),p(b,"rel","nofollow"),p(x,"href","https://huggingface.co/datasets/bookcorpus"),p(x,"rel","nofollow")},m(s,t){e(document.head,m),r(s,A,t),r(s,u,t),e(u,k),e(k,q),I(w,q,null),e(u,J),e(u,B),e(B,O),r(s,C,t),I(g,s,t),r(s,S,t),r(s,j,t),e(j,U),r(s,T,t),r(s,v,t),e(v,D),r(s,P,t),I(_,s,t),r(s,M,t),I($,s,t),r(s,N,t),r(s,o,t),e(o,Q),e(o,b),e(b,V),e(o,X),e(o,x),e(x,Y),e(o,Z),r(s,R,t),r(s,y,t),e(y,ss),K=!0},p:ds,i(s){K||(W(w.$$.fragment,s),W(g.$$.fragment,s),W(_.$$.fragment,s),W($.$$.fragment,s),K=!0)},o(s){F(w.$$.fragment,s),F(g.$$.fragment,s),F(_.$$.fragment,s),F($.$$.fragment,s),K=!1},d(s){a(m),s&&a(A),s&&a(u),H(w),s&&a(C),H(g,s),s&&a(S),s&&a(j),s&&a(T),s&&a(v),s&&a(P),H(_,s),s&&a(M),H($,s),s&&a(N),s&&a(o),s&&a(R),s&&a(y)}}}const $s={local:"bias-and-limitations",title:"Bias and limitations"};function bs(as){return ks(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class qs extends us{constructor(m){super();cs(this,m,bs,_s,fs,{})}}export{qs as default,$s as metadata};
