import{S as si,i as ti,s as ni,H as li,e as i,c as o,a as p,d as s,b as h,g as l,I as ai,J as ri,K as ii,q as d,o as b,k as f,w as v,t as a,U as oi,m as u,x as w,h as r,Z as ei,F as t,y as x,B as y,v as pi}from"../../chunks/vendor-bb19ac22.js";import{I as _s}from"../../chunks/IconCopyLink-c8585c58.js";import{C as q}from"../../chunks/CodeBlock-b04e45b4.js";import{D as fi}from"../../chunks/DocNotebookDropdown-3adb354e.js";function ui(j){let m,c;const $=j[3].default,_=li($,j,j[2],null);return{c(){m=i("div"),_&&_.c(),this.h()},l(g){m=o(g,"DIV",{class:!0});var E=p(m);_&&_.l(E),E.forEach(s),this.h()},h(){h(m,"class","course-tip "+(j[0]==="orange"?"course-tip-orange":"")+" bg-gradient-to-br dark:bg-gradient-to-r before:border-"+j[0]+"-500 dark:before:border-"+j[0]+"-800 from-"+j[0]+"-50 dark:from-gray-900 to-white dark:to-gray-950 border border-"+j[0]+"-50 text-"+j[0]+"-700 dark:text-gray-400")},m(g,E){l(g,m,E),_&&_.m(m,null),c=!0},p(g,[E]){_&&_.p&&(!c||E&4)&&ai(_,$,g,g[2],c?ii($,g[2],E,null):ri(g[2]),null)},i(g){c||(d(_,g),c=!0)},o(g){b(_,g),c=!1},d(g){g&&s(m),_&&_.d(g)}}}function mi(j,m,c){let{$$slots:$={},$$scope:_}=m,{warning:g=!1}=m;const E=g?"orange":"green";return j.$$set=k=>{"warning"in k&&c(1,g=k.warning),"$$scope"in k&&c(2,_=k.$$scope)},[E,g,_,$]}class he extends si{constructor(m){super();ti(this,m,mi,ui,ni,{warning:1})}}function ci(j){let m,c,$,_,g,E,k,N,ge;return{c(){m=a("\u{1F440} \u770B\u5230\u90A3\u4E2A\u53F3\u4E0A\u89D2\u7684 "),c=i("em"),$=a("\u5728Colab\u4E2D\u6253\u5F00"),_=a(`\u7684\u6309\u94AE\u4E86\u5417? \u5355\u51FB\u5B83\u5C31\u53EF\u4EE5\u6253\u5F00\u4E00\u4E2A\u5305\u542B\u672C\u8282\u6240\u6709\u4EE3\u7801\u793A\u4F8B\u7684 Google Colab \u7B14\u8BB0\u672C\u3002 \u6BCF\u4E00\u4E2A\u6709\u5B9E\u4F8B\u4EE3\u7801\u7684\u5C0F\u8282\u90FD\u4F1A\u6709\u5B83\u3002
`),g=i("p"),E=a("\u5982\u679C\u60A8\u60F3\u5728\u672C\u5730\u8FD0\u884C\u793A\u4F8B\uFF0C\u6211\u4EEC\u5EFA\u8BAE\u60A8\u67E5\u770B"),k=i("a"),N=a("\u51C6\u5907"),ge=a("."),this.h()},l(P){m=r(P,"\u{1F440} \u770B\u5230\u90A3\u4E2A\u53F3\u4E0A\u89D2\u7684 "),c=o(P,"EM",{});var S=p(c);$=r(S,"\u5728Colab\u4E2D\u6253\u5F00"),S.forEach(s),_=r(P,`\u7684\u6309\u94AE\u4E86\u5417? \u5355\u51FB\u5B83\u5C31\u53EF\u4EE5\u6253\u5F00\u4E00\u4E2A\u5305\u542B\u672C\u8282\u6240\u6709\u4EE3\u7801\u793A\u4F8B\u7684 Google Colab \u7B14\u8BB0\u672C\u3002 \u6BCF\u4E00\u4E2A\u6709\u5B9E\u4F8B\u4EE3\u7801\u7684\u5C0F\u8282\u90FD\u4F1A\u6709\u5B83\u3002
`),g=o(P,"P",{});var z=p(g);E=r(z,"\u5982\u679C\u60A8\u60F3\u5728\u672C\u5730\u8FD0\u884C\u793A\u4F8B\uFF0C\u6211\u4EEC\u5EFA\u8BAE\u60A8\u67E5\u770B"),k=o(z,"A",{href:!0});var M=p(k);N=r(M,"\u51C6\u5907"),M.forEach(s),ge=r(z,"."),z.forEach(s),this.h()},h(){h(k,"href","/course/chapter0")},m(P,S){l(P,m,S),l(P,c,S),t(c,$),l(P,_,S),l(P,g,S),t(g,E),t(g,k),t(k,N),t(g,ge)},d(P){P&&s(m),P&&s(c),P&&s(_),P&&s(g)}}}function hi(j){let m;return{c(){m=a("\u26A0\uFE0F Hugging Face Hub \u4E0D\u9650\u4E8E Transformer \u6A21\u578B\u3002\u4EFB\u4F55\u4EBA\u90FD\u53EF\u4EE5\u5206\u4EAB\u4ED6\u4EEC\u60F3\u8981\u7684\u4EFB\u4F55\u7C7B\u578B\u7684\u6A21\u578B\u6216\u6570\u636E\u96C6\uFF01\u521B\u5EFA\u4E00\u4E2A Huggingface.co \u5E10\u6237(https://huggingface.co/join)\u4EE5\u4F7F\u7528\u6240\u6709\u53EF\u7528\u529F\u80FD\uFF01")},l(c){m=r(c,"\u26A0\uFE0F Hugging Face Hub \u4E0D\u9650\u4E8E Transformer \u6A21\u578B\u3002\u4EFB\u4F55\u4EBA\u90FD\u53EF\u4EE5\u5206\u4EAB\u4ED6\u4EEC\u60F3\u8981\u7684\u4EFB\u4F55\u7C7B\u578B\u7684\u6A21\u578B\u6216\u6570\u636E\u96C6\uFF01\u521B\u5EFA\u4E00\u4E2A Huggingface.co \u5E10\u6237(https://huggingface.co/join)\u4EE5\u4F7F\u7528\u6240\u6709\u53EF\u7528\u529F\u80FD\uFF01")},m(c,$){l(c,m,$)},d(c){c&&s(m)}}}function gi(j){let m;return{c(){m=a("\u270F\uFE0F**\u5FEB\u6765\u8BD5\u8BD5\u5427\uFF01**\u4F7F\u7528\u60A8\u81EA\u5DF1\u7684\u5E8F\u5217\u548C\u6807\u7B7E\uFF0C\u770B\u770B\u6A21\u578B\u7684\u884C\u4E3A\u3002")},l(c){m=r(c,"\u270F\uFE0F**\u5FEB\u6765\u8BD5\u8BD5\u5427\uFF01**\u4F7F\u7528\u60A8\u81EA\u5DF1\u7684\u5E8F\u5217\u548C\u6807\u7B7E\uFF0C\u770B\u770B\u6A21\u578B\u7684\u884C\u4E3A\u3002")},m(c,$){l(c,m,$)},d(c){c&&s(m)}}}function $i(j){let m;return{c(){m=a("\u270F\uFE0F**\u5FEB\u6765\u8BD5\u8BD5\u5427\uFF01**\u4F7F\u7528 num_return_sequences \u548C max_length \u53C2\u6570\u751F\u6210\u4E24\u4E2A\u53E5\u5B50\uFF0C\u6BCF\u4E2A\u53E5\u5B50 15 \u4E2A\u5355\u8BCD\u3002")},l(c){m=r(c,"\u270F\uFE0F**\u5FEB\u6765\u8BD5\u8BD5\u5427\uFF01**\u4F7F\u7528 num_return_sequences \u548C max_length \u53C2\u6570\u751F\u6210\u4E24\u4E2A\u53E5\u5B50\uFF0C\u6BCF\u4E2A\u53E5\u5B50 15 \u4E2A\u5355\u8BCD\u3002")},m(c,$){l(c,m,$)},d(c){c&&s(m)}}}function _i(j){let m;return{c(){m=a("\u270F\uFE0F**\u5FEB\u6765\u8BD5\u8BD5\u5427\uFF01**\u4F7F\u7528\u6807\u7B7E\u7B5B\u9009\u67E5\u627E\u53E6\u4E00\u79CD\u8BED\u8A00\u7684\u6587\u672C\u751F\u6210\u6A21\u578B\u3002\u4F7F\u7528\u5C0F\u7EC4\u4EF6\u6D4B\u8BD5\u5E76\u5728pipeline\u4E2D\u4F7F\u7528\u5B83\uFF01")},l(c){m=r(c,"\u270F\uFE0F**\u5FEB\u6765\u8BD5\u8BD5\u5427\uFF01**\u4F7F\u7528\u6807\u7B7E\u7B5B\u9009\u67E5\u627E\u53E6\u4E00\u79CD\u8BED\u8A00\u7684\u6587\u672C\u751F\u6210\u6A21\u578B\u3002\u4F7F\u7528\u5C0F\u7EC4\u4EF6\u6D4B\u8BD5\u5E76\u5728pipeline\u4E2D\u4F7F\u7528\u5B83\uFF01")},m(c,$){l(c,m,$)},d(c){c&&s(m)}}}function di(j){let m;return{c(){m=a("\u270F\uFE0F**\u5FEB\u6765\u8BD5\u8BD5\u5427\uFF01**\u5728 Hub \u4E0A\u641C\u7D22\u57FA\u4E8E bert \u7684\u6A21\u578B\u5E76\u5728\u63A8\u7406 API \u5C0F\u7EC4\u4EF6\u4E2D\u627E\u5230\u5B83\u7684\u63A9\u7801\u3002\u8FD9\u4E2A\u6A21\u578B\u5BF9\u4E0A\u9762pipeline\u793A\u4F8B\u4E2D\u7684\u53E5\u5B50\u9884\u6D4B\u4E86\u4EC0\u4E48\uFF1F")},l(c){m=r(c,"\u270F\uFE0F**\u5FEB\u6765\u8BD5\u8BD5\u5427\uFF01**\u5728 Hub \u4E0A\u641C\u7D22\u57FA\u4E8E bert \u7684\u6A21\u578B\u5E76\u5728\u63A8\u7406 API \u5C0F\u7EC4\u4EF6\u4E2D\u627E\u5230\u5B83\u7684\u63A9\u7801\u3002\u8FD9\u4E2A\u6A21\u578B\u5BF9\u4E0A\u9762pipeline\u793A\u4F8B\u4E2D\u7684\u53E5\u5B50\u9884\u6D4B\u4E86\u4EC0\u4E48\uFF1F")},m(c,$){l(c,m,$)},d(c){c&&s(m)}}}function bi(j){let m;return{c(){m=a("\u270F\uFE0F**\u5FEB\u6765\u8BD5\u8BD5\u5427\uFF01**\u5728\u6A21\u578B\u4E2D\u5FC3\uFF08hub\uFF09\u641C\u7D22\u80FD\u591F\u7528\u82F1\u8BED\u8FDB\u884C\u8BCD\u6027\u6807\u6CE8\uFF08\u901A\u5E38\u7F29\u5199\u4E3A POS\uFF09\u7684\u6A21\u578B\u3002\u8FD9\u4E2A\u6A21\u578B\u5BF9\u4E0A\u9762\u4F8B\u5B50\u4E2D\u7684\u53E5\u5B50\u9884\u6D4B\u4E86\u4EC0\u4E48\uFF1F")},l(c){m=r(c,"\u270F\uFE0F**\u5FEB\u6765\u8BD5\u8BD5\u5427\uFF01**\u5728\u6A21\u578B\u4E2D\u5FC3\uFF08hub\uFF09\u641C\u7D22\u80FD\u591F\u7528\u82F1\u8BED\u8FDB\u884C\u8BCD\u6027\u6807\u6CE8\uFF08\u901A\u5E38\u7F29\u5199\u4E3A POS\uFF09\u7684\u6A21\u578B\u3002\u8FD9\u4E2A\u6A21\u578B\u5BF9\u4E0A\u9762\u4F8B\u5B50\u4E2D\u7684\u53E5\u5B50\u9884\u6D4B\u4E86\u4EC0\u4E48\uFF1F")},m(c,$){l(c,m,$)},d(c){c&&s(m)}}}function vi(j){let m,c,$,_,g;return{c(){m=i("p"),c=a("\u270F\uFE0F"),$=i("strong"),_=a("\u5FEB\u6765\u8BD5\u8BD5\u5427\uFF01"),g=a("\u641C\u7D22\u5176\u4ED6\u8BED\u8A00\u7684\u7FFB\u8BD1\u6A21\u578B\uFF0C\u5C1D\u8BD5\u5C06\u524D\u4E00\u53E5\u7FFB\u8BD1\u6210\u51E0\u79CD\u4E0D\u540C\u7684\u8BED\u8A00\u3002")},l(E){m=o(E,"P",{});var k=p(m);c=r(k,"\u270F\uFE0F"),$=o(k,"STRONG",{});var N=p($);_=r(N,"\u5FEB\u6765\u8BD5\u8BD5\u5427\uFF01"),N.forEach(s),g=r(k,"\u641C\u7D22\u5176\u4ED6\u8BED\u8A00\u7684\u7FFB\u8BD1\u6A21\u578B\uFF0C\u5C1D\u8BD5\u5C06\u524D\u4E00\u53E5\u7FFB\u8BD1\u6210\u51E0\u79CD\u4E0D\u540C\u7684\u8BED\u8A00\u3002"),k.forEach(s)},m(E,k){l(E,m,k),t(m,c),t(m,$),t($,_),t(m,g)},d(E){E&&s(m)}}}function wi(j){let m,c,$,_,g,E,k,N,ge,P,S,z,M,Gn,$t,Z,_t,B,K,ds,$e,Fn,bs,Ln,dt,O,Qe,Oa,Cn,_e,zn,Mn,de,Bn,Un,bt,Y,vt,Xe,Vn,wt,U,Q,vs,be,Wn,ws,Dn,xt,A,Ra,yt,X,Jn,xs,Zn,Kn,jt,ve,Et,we,kt,es,Yn,Tt,xe,Pt,ye,It,ee,Qn,ys,Xn,el,qt,ss,sl,St,R,js,tl,nl,Es,ll,al,ks,rl,Ht,se,il,je,ol,pl,At,T,ts,Ts,fl,ul,ml,Ps,Is,cl,hl,ns,qs,gl,$l,_l,Ss,Hs,dl,bl,As,Ns,vl,wl,Os,Rs,xl,yl,Gs,Fs,jl,El,Ls,Cs,kl,Tl,zs,Ms,Pl,Nt,ls,Il,Ot,Ee,ql,Rt,ke,Gt,Te,Ft,as,Sl,Lt,te,Ct,Pe,Hl,zt,Ie,Mt,qe,Bt,G,Al,Bs,Nl,Ol,Us,Rl,Gl,Ut,ne,Vt,V,le,Vs,Se,Fl,Ws,Ll,Wt,ae,Cl,He,Ds,zl,Ml,Dt,Ae,Jt,Ne,Zt,rs,Bl,Kt,is,Ul,Yt,re,Qt,W,ie,Js,Oe,Vl,Zs,Wl,Xt,oe,Dl,Re,Jl,Zl,en,D,pe,Ks,Ge,Kl,Ys,Yl,sn,os,Ql,tn,Fe,nn,J,Qs,Xl,ea,Xs,sa,ta,ln,fe,an,Le,na,rn,ps,la,on,Ce,pn,fs,aa,fn,H,ra,et,ia,oa,st,pa,fa,tt,ua,ma,nt,ca,ha,un,ue,mn,ze,ga,cn,us,$a,hn,Me,gn,ms,_a,$n,Be,da,_n,Ue,dn,Ve,bn,F,ba,lt,va,wa,at,xa,ya,vn,We,ja,wn,De,xn,Je,yn,L,Ea,rt,ka,Ta,it,Pa,Ia,jn,me,En,ce,qa,ot,Sa,Ha,kn;return E=new _s({}),S=new fi({props:{classNames:"absolute z-10 right-0 top-0",options:[{label:"Google Colab",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/master/course/chapter1/section3.ipynb"},{label:"Aws Studio",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/master/course/chapter1/section3.ipynb"}]}}),Z=new he({props:{$$slots:{default:[ci]},$$scope:{ctx:j}}}),$e=new _s({}),Y=new he({props:{$$slots:{default:[hi]},$$scope:{ctx:j}}}),be=new _s({}),ve=new q({props:{code:`from transformers import pipeline

classifier = pipeline("sentiment-analysis")
classifier("I've been waiting for a HuggingFace course my whole life.")`,highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

classifier = pipeline(<span class="hljs-string">&quot;sentiment-analysis&quot;</span>)
classifier(<span class="hljs-string">&quot;I&#x27;ve been waiting for a HuggingFace course my whole life.&quot;</span>)`}}),we=new q({props:{code:"[{'label': 'POSITIVE', 'score': 0.9598047137260437}]",highlighted:'[{<span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;POSITIVE&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.9598047137260437</span>}]'}}),xe=new q({props:{code:`classifier(
    ["I've been waiting for a HuggingFace course my whole life.", "I hate this so much!"]
)`,highlighted:`classifier(
    [<span class="hljs-string">&quot;I&#x27;ve been waiting for a HuggingFace course my whole life.&quot;</span>, <span class="hljs-string">&quot;I hate this so much!&quot;</span>]
)`}}),ye=new q({props:{code:`[{'label': 'POSITIVE', 'score': 0.9598047137260437},
 {'label': 'NEGATIVE', 'score': 0.9994558095932007}]`,highlighted:`[{<span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;POSITIVE&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.9598047137260437</span>},
 {<span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;NEGATIVE&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.9994558095932007</span>}]`}}),ke=new q({props:{code:`from transformers import pipeline

classifier = pipeline("zero-shot-classification")
classifier(
    "This is a course about the Transformers library",
    candidate_labels=["education", "politics", "business"],
)`,highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

classifier = pipeline(<span class="hljs-string">&quot;zero-shot-classification&quot;</span>)
classifier(
    <span class="hljs-string">&quot;This is a course about the Transformers library&quot;</span>,
    candidate_labels=[<span class="hljs-string">&quot;education&quot;</span>, <span class="hljs-string">&quot;politics&quot;</span>, <span class="hljs-string">&quot;business&quot;</span>],
)`}}),Te=new q({props:{code:`{'sequence': 'This is a course about the Transformers library',
 'labels': ['education', 'business', 'politics'],
 'scores': [0.8445963859558105, 0.111976258456707, 0.043427448719739914]}`,highlighted:`{<span class="hljs-string">&#x27;sequence&#x27;</span>: <span class="hljs-string">&#x27;This is a course about the Transformers library&#x27;</span>,
 <span class="hljs-string">&#x27;labels&#x27;</span>: [<span class="hljs-string">&#x27;education&#x27;</span>, <span class="hljs-string">&#x27;business&#x27;</span>, <span class="hljs-string">&#x27;politics&#x27;</span>],
 <span class="hljs-string">&#x27;scores&#x27;</span>: [<span class="hljs-number">0.8445963859558105</span>, <span class="hljs-number">0.111976258456707</span>, <span class="hljs-number">0.043427448719739914</span>]}`}}),te=new he({props:{$$slots:{default:[gi]},$$scope:{ctx:j}}}),Ie=new q({props:{code:`from transformers import pipeline

generator = pipeline("text-generation")
generator("In this course, we will teach you how to")`,highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

generator = pipeline(<span class="hljs-string">&quot;text-generation&quot;</span>)
generator(<span class="hljs-string">&quot;In this course, we will teach you how to&quot;</span>)`}}),qe=new q({props:{code:`[{'generated_text': 'In this course, we will teach you how to understand and use '
                    'data flow and data interchange when handling user data. We '
                    'will be working with one or more of the most commonly used '
                    'data flows \u2014 data flows of various types, as seen by the '
                    'HTTP'}]`,highlighted:`[{<span class="hljs-string">&#x27;generated_text&#x27;</span>: <span class="hljs-string">&#x27;In this course, we will teach you how to understand and use &#x27;</span>
                    <span class="hljs-string">&#x27;data flow and data interchange when handling user data. We &#x27;</span>
                    <span class="hljs-string">&#x27;will be working with one or more of the most commonly used &#x27;</span>
                    <span class="hljs-string">&#x27;data flows \u2014 data flows of various types, as seen by the &#x27;</span>
                    <span class="hljs-string">&#x27;HTTP&#x27;</span>}]`}}),ne=new he({props:{$$slots:{default:[$i]},$$scope:{ctx:j}}}),Se=new _s({}),Ae=new q({props:{code:`from transformers import pipeline

generator = pipeline("text-generation", model="distilgpt2")
generator(
    "In this course, we will teach you how to",
    max_length=30,
    num_return_sequences=2,
)`,highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

generator = pipeline(<span class="hljs-string">&quot;text-generation&quot;</span>, model=<span class="hljs-string">&quot;distilgpt2&quot;</span>)
generator(
    <span class="hljs-string">&quot;In this course, we will teach you how to&quot;</span>,
    max_length=<span class="hljs-number">30</span>,
    num_return_sequences=<span class="hljs-number">2</span>,
)`}}),Ne=new q({props:{code:`[{'generated_text': 'In this course, we will teach you how to manipulate the world and '
                    'move your mental and physical capabilities to your advantage.'},
 {'generated_text': 'In this course, we will teach you how to become an expert and '
                    'practice realtime, and with a hands on experience on both real '
                    'time and real'}]`,highlighted:`[{<span class="hljs-string">&#x27;generated_text&#x27;</span>: <span class="hljs-string">&#x27;In this course, we will teach you how to manipulate the world and &#x27;</span>
                    <span class="hljs-string">&#x27;move your mental and physical capabilities to your advantage.&#x27;</span>},
 {<span class="hljs-string">&#x27;generated_text&#x27;</span>: <span class="hljs-string">&#x27;In this course, we will teach you how to become an expert and &#x27;</span>
                    <span class="hljs-string">&#x27;practice realtime, and with a hands on experience on both real &#x27;</span>
                    <span class="hljs-string">&#x27;time and real&#x27;</span>}]`}}),re=new he({props:{$$slots:{default:[_i]},$$scope:{ctx:j}}}),Oe=new _s({}),Ge=new _s({}),Fe=new q({props:{code:`\`\`\`python out
[{'sequence': 'This course will teach you all about mathematical models.',
  'score': 0.19619831442832947,
  'token': 30412,
  'token_str': ' mathematical'},
 {'sequence': 'This course will teach you all about computational models.',
  'score': 0.04052725434303284,
  'token': 38163,
  'token_str': ' computational'}]`,highlighted:`\`\`\`python <span class="hljs-keyword">out</span>
[{<span class="hljs-symbol">&#x27;sequence</span>&#x27;: <span class="hljs-symbol">&#x27;This</span> course will teach you <span class="hljs-keyword">all</span> about mathematical models.&#x27;,
  <span class="hljs-symbol">&#x27;score</span>&#x27;: <span class="hljs-number">0.19619831442832947</span>,
  <span class="hljs-symbol">&#x27;token</span>&#x27;: <span class="hljs-number">30412</span>,
  <span class="hljs-symbol">&#x27;token_str</span>&#x27;: &#x27; mathematical&#x27;},
 {<span class="hljs-symbol">&#x27;sequence</span>&#x27;: <span class="hljs-symbol">&#x27;This</span> course will teach you <span class="hljs-keyword">all</span> about computational models.&#x27;,
  <span class="hljs-symbol">&#x27;score</span>&#x27;: <span class="hljs-number">0.04052725434303284</span>,
  <span class="hljs-symbol">&#x27;token</span>&#x27;: <span class="hljs-number">38163</span>,
  <span class="hljs-symbol">&#x27;token_str</span>&#x27;: &#x27; computational&#x27;}]`}}),fe=new he({props:{$$slots:{default:[di]},$$scope:{ctx:j}}}),Ce=new q({props:{code:`\`\`\`python out
[{'entity_group': 'PER', 'score': 0.99816, 'word': 'Sylvain', 'start': 11, 'end': 18}, 
 {'entity_group': 'ORG', 'score': 0.97960, 'word': 'Hugging Face', 'start': 33, 'end': 45}, 
 {'entity_group': 'LOC', 'score': 0.99321, 'word': 'Brooklyn', 'start': 49, 'end': 57}
]`,highlighted:`\`\`\`python <span class="hljs-keyword">out</span>
[{<span class="hljs-symbol">&#x27;entity_group</span>&#x27;: <span class="hljs-symbol">&#x27;PER</span>&#x27;, <span class="hljs-symbol">&#x27;score</span>&#x27;: <span class="hljs-number">0.99816</span>, <span class="hljs-symbol">&#x27;word</span>&#x27;: <span class="hljs-symbol">&#x27;Sylvain</span>&#x27;, <span class="hljs-symbol">&#x27;start</span>&#x27;: <span class="hljs-number">11</span>, <span class="hljs-symbol">&#x27;end</span>&#x27;: <span class="hljs-number">18</span>}, 
 {<span class="hljs-symbol">&#x27;entity_group</span>&#x27;: <span class="hljs-symbol">&#x27;ORG</span>&#x27;, <span class="hljs-symbol">&#x27;score</span>&#x27;: <span class="hljs-number">0.97960</span>, <span class="hljs-symbol">&#x27;word</span>&#x27;: <span class="hljs-symbol">&#x27;Hugging</span> Face&#x27;, <span class="hljs-symbol">&#x27;start</span>&#x27;: <span class="hljs-number">33</span>, <span class="hljs-symbol">&#x27;end</span>&#x27;: <span class="hljs-number">45</span>}, 
 {<span class="hljs-symbol">&#x27;entity_group</span>&#x27;: <span class="hljs-symbol">&#x27;LOC</span>&#x27;, <span class="hljs-symbol">&#x27;score</span>&#x27;: <span class="hljs-number">0.99321</span>, <span class="hljs-symbol">&#x27;word</span>&#x27;: <span class="hljs-symbol">&#x27;Brooklyn</span>&#x27;, <span class="hljs-symbol">&#x27;start</span>&#x27;: <span class="hljs-number">49</span>, <span class="hljs-symbol">&#x27;end</span>&#x27;: <span class="hljs-number">57</span>}
]`}}),ue=new he({props:{$$slots:{default:[bi]},$$scope:{ctx:j}}}),Me=new q({props:{code:`\`\`\`python out
{'score': 0.6385916471481323, 'start': 33, 'end': 45, 'answer': 'Hugging Face'}
klyn",
)
`,highlighted:`\`\`\`python <span class="hljs-keyword">out</span>
{<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0</span>.<span class="hljs-number">6385916471481323</span>, <span class="hljs-string">&#x27;start&#x27;</span>: <span class="hljs-number">33</span>, <span class="hljs-string">&#x27;end&#x27;</span>: <span class="hljs-number">45</span>, <span class="hljs-string">&#x27;answer&#x27;</span>: <span class="hljs-string">&#x27;Hugging Face&#x27;</span>}
<span class="hljs-keyword">klyn</span>&quot;,
)
`}}),Ue=new q({props:{code:`from transformers import pipeline

summarizer = pipeline("summarization")
summarizer(
    """
    America has changed dramatically during recent years. Not only has the number of 
    graduates in traditional engineering disciplines such as mechanical, civil, 
    electrical, chemical, and aeronautical engineering declined, but in most of 
    the premier American universities engineering curricula now concentrate on 
    and encourage largely the study of engineering science. As a result, there 
    are declining offerings in engineering subjects dealing with infrastructure, 
    the environment, and related issues, and greater concentration on high 
    technology subjects, largely supporting increasingly complex scientific 
    developments. While the latter is important, it should not be at the expense 
    of more traditional engineering.

    Rapidly developing economies such as China and India, as well as other 
    industrial countries in Europe and Asia, continue to encourage and advance 
    the teaching of engineering. Both China and India, respectively, graduate 
    six and eight times as many traditional engineers as does the United States. 
    Other industrial countries at minimum maintain their output, while America 
    suffers an increasingly serious decline in the number of engineering graduates 
    and a lack of well-educated engineers.
"""
)`,highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

summarizer = pipeline(<span class="hljs-string">&quot;summarization&quot;</span>)
summarizer(
    <span class="hljs-string">&quot;&quot;&quot;
    America has changed dramatically during recent years. Not only has the number of 
    graduates in traditional engineering disciplines such as mechanical, civil, 
    electrical, chemical, and aeronautical engineering declined, but in most of 
    the premier American universities engineering curricula now concentrate on 
    and encourage largely the study of engineering science. As a result, there 
    are declining offerings in engineering subjects dealing with infrastructure, 
    the environment, and related issues, and greater concentration on high 
    technology subjects, largely supporting increasingly complex scientific 
    developments. While the latter is important, it should not be at the expense 
    of more traditional engineering.

    Rapidly developing economies such as China and India, as well as other 
    industrial countries in Europe and Asia, continue to encourage and advance 
    the teaching of engineering. Both China and India, respectively, graduate 
    six and eight times as many traditional engineers as does the United States. 
    Other industrial countries at minimum maintain their output, while America 
    suffers an increasingly serious decline in the number of engineering graduates 
    and a lack of well-educated engineers.
&quot;&quot;&quot;</span>
)`}}),Ve=new q({props:{code:`[{'summary_text': ' America has changed dramatically during recent years . The '
                  'number of engineering graduates in the U.S. has declined in '
                  'traditional engineering disciplines such as mechanical, civil '
                  ', electrical, chemical, and aeronautical engineering . Rapidly '
                  'developing economies such as China and India, as well as other '
                  'industrial countries in Europe and Asia, continue to encourage '
                  'and advance engineering .'}]`,highlighted:`[{<span class="hljs-string">&#x27;summary_text&#x27;</span>: <span class="hljs-string">&#x27; America has changed dramatically during recent years . The &#x27;</span>
                  <span class="hljs-string">&#x27;number of engineering graduates in the U.S. has declined in &#x27;</span>
                  <span class="hljs-string">&#x27;traditional engineering disciplines such as mechanical, civil &#x27;</span>
                  <span class="hljs-string">&#x27;, electrical, chemical, and aeronautical engineering . Rapidly &#x27;</span>
                  <span class="hljs-string">&#x27;developing economies such as China and India, as well as other &#x27;</span>
                  <span class="hljs-string">&#x27;industrial countries in Europe and Asia, continue to encourage &#x27;</span>
                  <span class="hljs-string">&#x27;and advance engineering .&#x27;</span>}]`}}),De=new q({props:{code:`from transformers import pipeline

translator = pipeline("translation", model="Helsinki-NLP/opus-mt-fr-en")
translator("Ce cours est produit par Hugging Face.")`,highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

translator = pipeline(<span class="hljs-string">&quot;translation&quot;</span>, model=<span class="hljs-string">&quot;Helsinki-NLP/opus-mt-fr-en&quot;</span>)
translator(<span class="hljs-string">&quot;Ce cours est produit par Hugging Face.&quot;</span>)`}}),Je=new q({props:{code:`[{'translation_text': 'This course is produced by Hugging Face.'}]
`,highlighted:`[{<span class="hljs-string">&#x27;translation_text&#x27;</span>: <span class="hljs-string">&#x27;This course is produced by Hugging Face.&#x27;</span>}]
`}}),me=new he({props:{$$slots:{default:[vi]},$$scope:{ctx:j}}}),{c(){m=i("meta"),c=f(),$=i("h1"),_=i("a"),g=i("span"),v(E.$$.fragment),k=f(),N=i("span"),ge=a("Transformers\u80FD\u505A\u4EC0\u4E48\uFF1F"),P=f(),v(S.$$.fragment),z=f(),M=i("p"),Gn=a("\u5728\u672C\u8282\u4E2D\uFF0C\u6211\u4EEC\u5C06\u770B\u770B Transformer \u6A21\u578B\u53EF\u4EE5\u505A\u4EC0\u4E48\uFF0C\u5E76\u4F7F\u7528 \u{1F917} Transformers \u5E93\u4E2D\u7684\u7B2C\u4E00\u4E2A\u5DE5\u5177\uFF1Apipeline() \u51FD\u6570\u3002"),$t=f(),v(Z.$$.fragment),_t=f(),B=i("h2"),K=i("a"),ds=i("span"),v($e.$$.fragment),Fn=f(),bs=i("span"),Ln=a("Transformer\u88AB\u5E94\u7528\u4E8E\u5404\u4E2A\u65B9\u9762\uFF01"),dt=a(`

Transformer \u6A21\u578B\u7528\u4E8E\u89E3\u51B3\u5404\u79CD NLP \u4EFB\u52A1\uFF0C\u5C31\u50CF\u4E0A\u4E00\u8282\u4E2D\u63D0\u5230\u7684\u90A3\u6837\u3002\u4EE5\u4E0B\u662F\u4E00\u4E9B\u4F7F\u7528 Hugging Face \u548C Transformer \u6A21\u578B\u7684\u516C\u53F8\u548C\u7EC4\u7EC7\uFF0C\u4ED6\u4EEC\u4E5F\u901A\u8FC7\u5206\u4EAB\u4ED6\u4EEC\u7684\u6A21\u578B\u56DE\u9988\u793E\u533A\uFF1A
`),O=i("p"),Qe=i("img"),Cn=f(),_e=i("a"),zn=a("\u{1F917} Transformers \u5E93"),Mn=a("\u63D0\u4F9B\u4E86\u521B\u5EFA\u548C\u4F7F\u7528\u8FD9\u4E9B\u5171\u4EAB\u6A21\u578B\u7684\u529F\u80FD\u3002"),de=i("a"),Bn=a("\u6A21\u578B\u4E2D\u5FC3\uFF08hub\uFF09"),Un=a("\u5305\u542B\u6570\u5343\u4E2A\u4EFB\u4F55\u4EBA\u90FD\u53EF\u4EE5\u4E0B\u8F7D\u548C\u4F7F\u7528\u7684\u9884\u8BAD\u7EC3\u6A21\u578B\u3002\u60A8\u8FD8\u53EF\u4EE5\u5C06\u81EA\u5DF1\u7684\u6A21\u578B\u4E0A\u4F20\u5230 Hub\uFF01"),bt=f(),v(Y.$$.fragment),vt=f(),Xe=i("p"),Vn=a("\u5728\u6DF1\u5165\u7814\u7A76 Transformer \u6A21\u578B\u7684\u5E95\u5C42\u5DE5\u4F5C\u539F\u7406\u4E4B\u524D\uFF0C\u8BA9\u6211\u4EEC\u5148\u770B\u51E0\u4E2A\u793A\u4F8B\uFF0C\u770B\u770B\u5B83\u4EEC\u5982\u4F55\u7528\u4E8E\u89E3\u51B3\u4E00\u4E9B\u6709\u8DA3\u7684 NLP \u95EE\u9898\u3002"),wt=f(),U=i("h2"),Q=i("a"),vs=i("span"),v(be.$$.fragment),Wn=f(),ws=i("span"),Dn=a("\u4F7F\u7528pipelines"),xt=f(),A=i("iframe"),yt=a(`
(\u8FD9\u91CC\u6709\u4E00\u4E2A\u89C6\u9891\uFF0C\u4F46\u662F\u56FD\u5185\u53EF\u80FD\u6253\u4E0D\u5F00,\u8BD1\u8005\u6CE8)
`),X=i("p"),Jn=a("\u{1F917} Transformers \u5E93\u4E2D\u6700\u57FA\u672C\u7684\u5BF9\u8C61\u662F "),xs=i("strong"),Zn=a("pipeline()"),Kn=a(" \u51FD\u6570\u3002\u5B83\u5C06\u6A21\u578B\u4E0E\u5176\u5FC5\u8981\u7684\u9884\u5904\u7406\u548C\u540E\u5904\u7406\u6B65\u9AA4\u8FDE\u63A5\u8D77\u6765\uFF0C\u4F7F\u6211\u4EEC\u80FD\u591F\u901A\u8FC7\u76F4\u63A5\u8F93\u5165\u4EFB\u4F55\u6587\u672C\u5E76\u83B7\u5F97\u6700\u7EC8\u7684\u7B54\u6848\uFF1A"),jt=f(),v(ve.$$.fragment),Et=f(),v(we.$$.fragment),kt=f(),es=i("p"),Yn=a("\u6211\u4EEC\u4E5F\u53EF\u4EE5\u591A\u4F20\u51E0\u53E5\uFF01"),Tt=f(),v(xe.$$.fragment),Pt=f(),v(ye.$$.fragment),It=f(),ee=i("p"),Qn=a("\u9ED8\u8BA4\u60C5\u51B5\u4E0B\uFF0C\u6B64pipeline\u9009\u62E9\u4E00\u4E2A\u7279\u5B9A\u7684\u9884\u8BAD\u7EC3\u6A21\u578B\uFF0C\u8BE5\u6A21\u578B\u5DF2\u9488\u5BF9\u82F1\u8BED\u60C5\u611F\u5206\u6790\u8FDB\u884C\u4E86\u5FAE\u8C03\u3002\u521B\u5EFA"),ys=i("strong"),Xn=a("\u5206\u7C7B\u5668"),el=a("\u5BF9\u8C61\u65F6\uFF0C\u5C06\u4E0B\u8F7D\u5E76\u7F13\u5B58\u6A21\u578B\u3002\u5982\u679C\u60A8\u91CD\u65B0\u8FD0\u884C\u8BE5\u547D\u4EE4\uFF0C\u5219\u5C06\u4F7F\u7528\u7F13\u5B58\u7684\u6A21\u578B\uFF0C\u65E0\u9700\u518D\u6B21\u4E0B\u8F7D\u6A21\u578B\u3002"),qt=f(),ss=i("p"),sl=a("\u5C06\u4E00\u4E9B\u6587\u672C\u4F20\u9012\u5230pipeline\u65F6\u6D89\u53CA\u4E09\u4E2A\u4E3B\u8981\u6B65\u9AA4\uFF1A"),St=f(),R=i("ol"),js=i("li"),tl=a("\u6587\u672C\u88AB\u9884\u5904\u7406\u4E3A\u6A21\u578B\u53EF\u4EE5\u7406\u89E3\u7684\u683C\u5F0F\u3002"),nl=f(),Es=i("li"),ll=a("\u9884\u5904\u7406\u7684\u8F93\u5165\u88AB\u4F20\u9012\u7ED9\u6A21\u578B\u3002"),al=f(),ks=i("li"),rl=a("\u6A21\u578B\u5904\u7406\u540E\u8F93\u51FA\u6700\u7EC8\u4EBA\u7C7B\u53EF\u4EE5\u7406\u89E3\u7684\u7ED3\u679C\u3002"),Ht=f(),se=i("p"),il=a("\u76EE\u524D"),je=i("a"),ol=a("\u53EF\u7528\u7684\u4E00\u4E9Bpipeline"),pl=a("\u662F\uFF1A"),At=f(),T=i("ul"),ts=i("li"),Ts=i("strong"),fl=a("\u7279\u5F81\u63D0\u53D6"),ul=a("\uFF08\u83B7\u53D6\u6587\u672C\u7684\u5411\u91CF\u8868\u793A\uFF09"),ml=f(),Ps=i("li"),Is=i("strong"),cl=a("\u586B\u5145\u7A7A\u7F3A"),hl=f(),ns=i("li"),qs=i("strong"),gl=a("ner"),$l=a("\uFF08\u547D\u540D\u5B9E\u4F53\u8BC6\u522B\uFF09"),_l=f(),Ss=i("li"),Hs=i("strong"),dl=a("\u95EE\u7B54"),bl=f(),As=i("li"),Ns=i("strong"),vl=a("\u60C5\u611F\u5206\u6790"),wl=f(),Os=i("li"),Rs=i("strong"),xl=a("\u6587\u672C\u6458\u8981"),yl=f(),Gs=i("li"),Fs=i("strong"),jl=a("\u6587\u672C\u751F\u6210"),El=f(),Ls=i("li"),Cs=i("strong"),kl=a("\u7FFB\u8BD1"),Tl=f(),zs=i("li"),Ms=i("strong"),Pl=a("\u96F6\u6837\u672C\u5206\u7C7B"),Nt=f(),ls=i("p"),Il=a("\u8BA9\u6211\u4EEC\u6765\u770B\u770B\u5176\u4E2D\u7684\u4E00\u4E9B\u5427\uFF01"),Ot=f(),Ee=i("h2"),ql=a("\u96F6\u6837\u672C\u5206\u7C7B"),Rt=a(`
\u6211\u4EEC\u5C06\u9996\u5148\u5904\u7406\u4E00\u9879\u975E\u5E38\u5177\u6311\u6218\u6027\u7684\u4EFB\u52A1\uFF0C\u6211\u4EEC\u9700\u8981\u5BF9\u5C1A\u672A\u6807\u8BB0\u7684\u6587\u672C\u8FDB\u884C\u5206\u7C7B\u3002\u8FD9\u662F\u5B9E\u9645\u9879\u76EE\u4E2D\u7684\u5E38\u89C1\u573A\u666F\uFF0C\u56E0\u4E3A\u6CE8\u91CA\u6587\u672C\u901A\u5E38\u5F88\u8017\u65F6\u5E76\u4E14\u9700\u8981\u9886\u57DF\u4E13\u4E1A\u77E5\u8BC6\u3002\u5BF9\u4E8E\u8FD9\u9879\u4EFB\u52A1**zero-shot-classification**pipeline\u975E\u5E38\u5F3A\u5927\uFF1A\u5B83\u5141\u8BB8\u60A8\u76F4\u63A5\u6307\u5B9A\u7528\u4E8E\u5206\u7C7B\u7684\u6807\u7B7E\uFF0C\u56E0\u6B64\u60A8\u4E0D\u5FC5\u4F9D\u8D56\u9884\u8BAD\u7EC3\u6A21\u578B\u7684\u6807\u7B7E\u3002\u4E0B\u9762\u7684\u6A21\u578B\u5C55\u793A\u4E86\u5982\u4F55\u4F7F\u7528\u8FD9\u4E24\u4E2A\u6807\u7B7E\u5C06\u53E5\u5B50\u5206\u7C7B\u4E3A\u6B63\u9762\u6216\u8D1F\u9762\u2014\u2014\u4F46\u4E5F\u53EF\u4EE5\u4F7F\u7528\u60A8\u559C\u6B22\u7684\u4EFB\u4F55\u5176\u4ED6\u6807\u7B7E\u96C6\u5BF9\u6587\u672C\u8FDB\u884C\u5206\u7C7B\u3002

	`),v(ke.$$.fragment),Gt=f(),v(Te.$$.fragment),Ft=f(),as=i("p"),Sl=a("\u6B64pipeline\u79F0\u4E3Azero-shot\uFF0C\u56E0\u4E3A\u60A8\u4E0D\u9700\u8981\u5BF9\u6570\u636E\u4E0A\u7684\u6A21\u578B\u8FDB\u884C\u5FAE\u8C03\u5373\u53EF\u4F7F\u7528\u5B83\u3002\u5B83\u53EF\u4EE5\u76F4\u63A5\u8FD4\u56DE\u60A8\u60F3\u8981\u7684\u4EFB\u4F55\u6807\u7B7E\u5217\u8868\u7684\u6982\u7387\u5206\u6570\uFF01"),Lt=f(),v(te.$$.fragment),Ct=f(),Pe=i("h2"),Hl=a("\u6587\u672C\u751F\u6210"),zt=a(`
\u73B0\u5728\u8BA9\u6211\u4EEC\u770B\u770B\u5982\u4F55\u4F7F\u7528pipeline\u6765\u751F\u6210\u4E00\u4E9B\u6587\u672C\u3002\u8FD9\u91CC\u7684\u4E3B\u8981\u4F7F\u7528\u65B9\u6CD5\u662F\u60A8\u63D0\u4F9B\u4E00\u4E2A\u63D0\u793A\uFF0C\u6A21\u578B\u5C06\u901A\u8FC7\u751F\u6210\u5269\u4F59\u7684\u6587\u672C\u6765\u81EA\u52A8\u5B8C\u6210\u6574\u6BB5\u8BDD\u3002\u8FD9\u7C7B\u4F3C\u4E8E\u8BB8\u591A\u624B\u673A\u4E0A\u7684\u9884\u6D4B\u6587\u672C\u529F\u80FD\u3002\u6587\u672C\u751F\u6210\u6D89\u53CA\u968F\u673A\u6027\uFF0C\u56E0\u6B64\u5982\u679C\u60A8\u6CA1\u6709\u5F97\u5230\u76F8\u540C\u7684\u5982\u4E0B\u6240\u793A\u7684\u7ED3\u679C\uFF0C\u8FD9\u662F\u6B63\u5E38\u7684\u3002

	`),v(Ie.$$.fragment),Mt=f(),v(qe.$$.fragment),Bt=f(),G=i("p"),Al=a("\u60A8\u53EF\u4EE5\u4F7F\u7528\u53C2\u6570 "),Bs=i("strong"),Nl=a("num_return_sequences"),Ol=a(" \u63A7\u5236\u751F\u6210\u591A\u5C11\u4E2A\u4E0D\u540C\u7684\u5E8F\u5217\uFF0C\u5E76\u4F7F\u7528\u53C2\u6570 "),Us=i("strong"),Rl=a("max_length"),Gl=a(" \u63A7\u5236\u8F93\u51FA\u6587\u672C\u7684\u603B\u957F\u5EA6\u3002"),Ut=f(),v(ne.$$.fragment),Vt=f(),V=i("h2"),le=i("a"),Vs=i("span"),v(Se.$$.fragment),Fl=f(),Ws=i("span"),Ll=a("\u5728pipeline\u4E2D\u4F7F\u7528 Hub \u4E2D\u7684\u5176\u4ED6\u6A21\u578B"),Wt=a(`

\u524D\u9762\u7684\u793A\u4F8B\u4F7F\u7528\u4E86\u9ED8\u8BA4\u6A21\u578B\uFF0C\u4F46\u60A8\u4E5F\u53EF\u4EE5\u4ECE Hub \u4E2D\u9009\u62E9\u7279\u5B9A\u6A21\u578B\u4EE5\u5728\u7279\u5B9A\u4EFB\u52A1\u7684pipeline\u4E2D\u4F7F\u7528 - \u4F8B\u5982\uFF0C\u6587\u672C\u751F\u6210\u3002\u8F6C\u5230[\u6A21\u578B\u4E2D\u5FC3\uFF08hub\uFF09](https://huggingface.co/models)\u5E76\u5355\u51FB\u5DE6\u4FA7\u7684\u76F8\u5E94\u6807\u7B7E\u5C06\u4F1A\u53EA\u663E\u793A\u8BE5\u4EFB\u52A1\u652F\u6301\u7684\u6A21\u578B\u3002[\u4F8B\u5982\u8FD9\u6837](https://huggingface.co/models?pipeline_tag=text-generation)\u3002
`),ae=i("p"),Cl=a("\u8BA9\u6211\u4EEC\u8BD5\u8BD5 "),He=i("a"),Ds=i("strong"),zl=a("distilgpt2"),Ml=a(" \u6A21\u578B\u5427\uFF01\u4EE5\u4E0B\u662F\u5982\u4F55\u5728\u4E0E\u4EE5\u524D\u76F8\u540C\u7684pipeline\u4E2D\u52A0\u8F7D\u5B83\uFF1A"),Dt=f(),v(Ae.$$.fragment),Jt=f(),v(Ne.$$.fragment),Zt=f(),rs=i("p"),Bl=a("\u60A8\u53EF\u4EE5\u901A\u8FC7\u5355\u51FB\u8BED\u8A00\u6807\u7B7E\u6765\u7B5B\u9009\u641C\u7D22\u7ED3\u679C\uFF0C\u7136\u540E\u9009\u62E9\u53E6\u4E00\u79CD\u6587\u672C\u751F\u6210\u6A21\u578B\u7684\u6A21\u578B\u3002\u6A21\u578B\u4E2D\u5FC3\uFF08hub\uFF09\u751A\u81F3\u5305\u542B\u652F\u6301\u591A\u79CD\u8BED\u8A00\u7684\u591A\u8BED\u8A00\u6A21\u578B\u3002"),Kt=f(),is=i("p"),Ul=a("\u901A\u8FC7\u5355\u51FB\u9009\u62E9\u6A21\u578B\u540E\uFF0C\u60A8\u4F1A\u770B\u5230\u6709\u4E00\u4E2A\u5C0F\u7EC4\u4EF6\uFF0C\u53EF\u8BA9\u60A8\u76F4\u63A5\u5728\u7EBF\u8BD5\u7528\u3002\u901A\u8FC7\u8FD9\u79CD\u65B9\u5F0F\uFF0C\u60A8\u53EF\u4EE5\u5728\u4E0B\u8F7D\u4E4B\u524D\u5FEB\u901F\u6D4B\u8BD5\u6A21\u578B\u7684\u529F\u80FD\u3002"),Yt=f(),v(re.$$.fragment),Qt=f(),W=i("h2"),ie=i("a"),Js=i("span"),v(Oe.$$.fragment),Vl=f(),Zs=i("span"),Wl=a("\u63A8\u7406 API"),Xt=a(`

\u6240\u6709\u6A21\u578B\u90FD\u53EF\u4EE5\u4F7F\u7528 Inference API \u76F4\u63A5\u901A\u8FC7\u6D4F\u89C8\u5668\u8FDB\u884C\u6D4B\u8BD5\uFF0C\u8BE5 API \u53EF\u5728 [Hugging Face \u7F51\u7AD9](https://huggingface.co/)\u4E0A\u627E\u5230\u3002\u901A\u8FC7\u8F93\u5165\u81EA\u5B9A\u4E49\u6587\u672C\u5E76\u89C2\u5BDF\u6A21\u578B\u7684\u8F93\u51FA\uFF0C\u60A8\u53EF\u4EE5\u76F4\u63A5\u5728\u6B64\u9875\u9762\u4E0A\u4F7F\u7528\u6A21\u578B\u3002
`),oe=i("p"),Dl=a("\u5C0F\u7EC4\u4EF6\u5F62\u5F0F\u7684\u63A8\u7406 API \u4E5F\u53EF\u4F5C\u4E3A\u4ED8\u8D39\u4EA7\u54C1\u4F7F\u7528\uFF0C\u5982\u679C\u60A8\u7684\u5DE5\u4F5C\u6D41\u7A0B\u9700\u8981\u5B83\uFF0C\u5B83\u4F1A\u6D3E\u4E0A\u7528\u573A\u3002\u6709\u5173\u66F4\u591A\u8BE6\u7EC6\u4FE1\u606F\uFF0C\u8BF7\u53C2\u9605"),Re=i("a"),Jl=a("\u5B9A\u4EF7\u9875\u9762"),Zl=a("\u3002"),en=f(),D=i("h2"),pe=i("a"),Ks=i("span"),v(Ge.$$.fragment),Kl=f(),Ys=i("span"),Yl=a("Mask filling"),sn=a(`

\u60A8\u5C06\u5C1D\u8BD5\u7684\u4E0B\u4E00\u4E2Apipeline\u662F **fill-mask**\u3002\u6B64\u4EFB\u52A1\u7684\u60F3\u6CD5\u662F\u586B\u5145\u7ED9\u5B9A\u6587\u672C\u4E2D\u7684\u7A7A\u767D\uFF1A
\`\`\`python
from transformers import pipeline
`),os=i("p"),Ql=a(`unmasker = pipeline(\u201Cfill-mask\u201D)
unmasker(\u201CThis course will teach you all about <mask> models.\u201D, top_k=2)`),tn=f(),v(Fe.$$.fragment),nn=f(),J=i("p"),Qs=i("strong"),Xl=a("top_k"),ea=a(" \u53C2\u6570\u63A7\u5236\u8981\u663E\u793A\u7684\u7ED3\u679C\u6709\u591A\u5C11\u79CD\u3002\u8BF7\u6CE8\u610F\uFF0C\u8FD9\u91CC\u6A21\u578B\u586B\u5145\u4E86\u7279\u6B8A\u7684< "),Xs=i("strong"),sa=a("mask"),ta=a(" >\u8BCD\uFF0C\u5B83\u901A\u5E38\u88AB\u79F0\u4E3A\u63A9\u7801\u6807\u8BB0\u3002\u5176\u4ED6\u63A9\u7801\u586B\u5145\u6A21\u578B\u53EF\u80FD\u6709\u4E0D\u540C\u7684\u63A9\u7801\u6807\u8BB0\uFF0C\u56E0\u6B64\u5728\u63A2\u7D22\u5176\u4ED6\u6A21\u578B\u65F6\u8981\u9A8C\u8BC1\u6B63\u786E\u7684\u63A9\u7801\u5B57\u662F\u4EC0\u4E48\u3002\u68C0\u67E5\u5B83\u7684\u4E00\u79CD\u65B9\u6CD5\u662F\u67E5\u770B\u5C0F\u7EC4\u4EF6\u4E2D\u4F7F\u7528\u7684\u63A9\u7801\u3002"),ln=f(),v(fe.$$.fragment),an=f(),Le=i("h2"),na=a("\u547D\u540D\u5B9E\u4F53\u8BC6\u522B"),rn=a(`
\u547D\u540D\u5B9E\u4F53\u8BC6\u522B (NER) \u662F\u4E00\u9879\u4EFB\u52A1\uFF0C\u5176\u4E2D\u6A21\u578B\u5FC5\u987B\u627E\u5230\u8F93\u5165\u6587\u672C\u7684\u54EA\u4E9B\u90E8\u5206\u5BF9\u5E94\u4E8E\u8BF8\u5982\u4EBA\u5458\u3001\u4F4D\u7F6E\u6216\u7EC4\u7EC7\u4E4B\u7C7B\u7684\u5B9E\u4F53\u3002\u8BA9\u6211\u4EEC\u770B\u4E00\u4E2A\u4F8B\u5B50\uFF1A
\`\`\`python
from transformers import pipeline
`),ps=i("p"),la=a(`ner = pipeline(\u201Cner\u201D, grouped_entities=True)
ner(\u201CMy name is Sylvain and I work at Hugging Face in Brooklyn.\u201C)`),on=f(),v(Ce.$$.fragment),pn=f(),fs=i("p"),aa=a("\u5728\u8FD9\u91CC\uFF0C\u6A21\u578B\u6B63\u786E\u5730\u8BC6\u522B\u51FA Sylvain \u662F\u4E00\u4E2A\u4EBA (PER)\uFF0CHugging Face \u662F\u4E00\u4E2A\u7EC4\u7EC7 (ORG)\uFF0C\u800C\u5E03\u9C81\u514B\u6797\u662F\u4E00\u4E2A\u4F4D\u7F6E (LOC)\u3002"),fn=f(),H=i("p"),ra=a("\u6211\u4EEC\u5728pipeline\u521B\u5EFA\u51FD\u6570\u4E2D\u4F20\u9012\u9009\u9879 "),et=i("strong"),ia=a("grouped_entities=True"),oa=a(" \u4EE5\u544A\u8BC9pipeline\u5C06\u5BF9\u5E94\u4E8E\u540C\u4E00\u5B9E\u4F53\u7684\u53E5\u5B50\u90E8\u5206\u91CD\u65B0\u7EC4\u5408\u5728\u4E00\u8D77\uFF1A\u8FD9\u91CC\u6A21\u578B\u6B63\u786E\u5730\u5C06\u201CHugging\u201D\u548C\u201CFace\u201D\u5206\u7EC4\u4E3A\u4E00\u4E2A\u7EC4\u7EC7\uFF0C\u5373\u4F7F\u540D\u79F0\u7531\u591A\u4E2A\u8BCD\u7EC4\u6210\u3002\u4E8B\u5B9E\u4E0A\uFF0C\u6B63\u5982\u6211\u4EEC\u5373\u5C06\u5728\u4E0B\u4E00\u7AE0\u770B\u5230\u7684\uFF0C\u9884\u5904\u7406\u751A\u81F3\u4F1A\u5C06\u4E00\u4E9B\u5355\u8BCD\u5206\u6210\u66F4\u5C0F\u7684\u90E8\u5206\u3002\u4F8B\u5982\uFF0C"),st=i("strong"),pa=a("Sylvain"),fa=a(" \u5206\u5272\u4E3A\u4E86\u56DB\u90E8\u5206\uFF1A"),tt=i("strong"),ua=a("S\u3001##yl\u3001##va"),ma=a(" \u548C "),nt=i("strong"),ca=a("##in"),ha=a("\u3002\u5728\u540E\u5904\u7406\u6B65\u9AA4\u4E2D\uFF0Cpipeline\u6210\u529F\u5730\u91CD\u65B0\u7EC4\u5408\u4E86\u8FD9\u4E9B\u90E8\u5206\u3002"),un=f(),v(ue.$$.fragment),mn=f(),ze=i("h2"),ga=a("\u95EE\u7B54\u7CFB\u7EDF"),cn=a(`
\u95EE\u7B54pipeline\u4F7F\u7528\u6765\u81EA\u7ED9\u5B9A\u4E0A\u4E0B\u6587\u7684\u4FE1\u606F\u56DE\u7B54\u95EE\u9898\uFF1A
\`\`\`python
from transformers import pipeline
`),us=i("p"),$a=a(`question_answerer = pipeline(\u201Cquestion-answering\u201D)
question_answerer(
question=\u201CWhere do I work?\u201D,
context=\u201CMy name is Sylvain and I work at Hugging Face in Brooklyn\u201D,
)`),hn=f(),v(Me.$$.fragment),gn=f(),ms=i("p"),_a=a("\u8BF7\u6CE8\u610F\uFF0C\u6B64pipeline\u901A\u8FC7\u4ECE\u63D0\u4F9B\u7684\u4E0A\u4E0B\u6587\u4E2D\u63D0\u53D6\u4FE1\u606F\u6765\u5DE5\u4F5C\uFF1B\u5B83\u4E0D\u4F1A\u51ED\u7A7A\u751F\u6210\u7B54\u6848\u3002"),$n=f(),Be=i("h2"),da=a("\u6587\u672C\u6458\u8981"),_n=a(`
\u6587\u672C\u6458\u8981\u662F\u5C06\u6587\u672C\u7F29\u51CF\u4E3A\u8F83\u77ED\u6587\u672C\u7684\u4EFB\u52A1\uFF0C\u540C\u65F6\u4FDD\u7559\u6587\u672C\u4E2D\u7684\u4E3B\u8981\uFF08\u91CD\u8981\uFF09\u4FE1\u606F\u3002\u4E0B\u9762\u662F\u4E00\u4E2A\u4F8B\u5B50\uFF1A

	`),v(Ue.$$.fragment),dn=f(),v(Ve.$$.fragment),bn=f(),F=i("p"),ba=a("\u4E0E\u6587\u672C\u751F\u6210\u4E00\u6837\uFF0C\u60A8\u6307\u5B9A\u7ED3\u679C\u7684 "),lt=i("strong"),va=a("max_length"),wa=a(" \u6216 "),at=i("strong"),xa=a("min_length"),ya=a("\u3002"),vn=f(),We=i("h2"),ja=a("\u7FFB\u8BD1"),wn=a(`
\u5BF9\u4E8E\u7FFB\u8BD1\uFF0C\u5982\u679C\u60A8\u5728\u4EFB\u52A1\u540D\u79F0\u4E2D\u63D0\u4F9B\u8BED\u8A00\u5BF9\uFF08\u4F8B\u5982\u201C**translation_en_to_fr**\u201D\uFF09\uFF0C\u5219\u53EF\u4EE5\u4F7F\u7528\u9ED8\u8BA4\u6A21\u578B\uFF0C\u4F46\u6700\u7B80\u5355\u7684\u65B9\u6CD5\u662F\u5728[\u6A21\u578B\u4E2D\u5FC3\uFF08hub\uFF09](https://huggingface.co/models)\u9009\u62E9\u8981\u4F7F\u7528\u7684\u6A21\u578B\u3002\u5728\u8FD9\u91CC\uFF0C\u6211\u4EEC\u5C06\u5C1D\u8BD5\u4ECE\u6CD5\u8BED\u7FFB\u8BD1\u6210\u82F1\u8BED\uFF1A

	`),v(De.$$.fragment),xn=f(),v(Je.$$.fragment),yn=f(),L=i("p"),Ea=a("\u4E0E\u6587\u672C\u751F\u6210\u548C\u6458\u8981\u4E00\u6837\uFF0C\u60A8\u53EF\u4EE5\u6307\u5B9A\u7ED3\u679C\u7684 "),rt=i("strong"),ka=a("max_length"),Ta=a(" \u6216 "),it=i("strong"),Pa=a("min_length"),Ia=a("\u3002"),jn=f(),v(me.$$.fragment),En=f(),ce=i("p"),qa=a("\u5230\u76EE\u524D\u4E3A\u6B62\u663E\u793A\u7684pipeline\u4E3B\u8981\u7528\u4E8E\u6F14\u793A\u76EE\u7684\u3002\u5B83\u4EEC\u662F\u4E3A\u7279\u5B9A\u4EFB\u52A1\u800C\u7F16\u7A0B\u7684\uFF0C\u4E0D\u80FD\u5BF9\u4ED6\u4EEC\u8FDB\u884C\u81EA\u5B9A\u4E49\u7684\u4FEE\u6539\u3002\u5728\u4E0B\u4E00\u7AE0\u4E2D\uFF0C\u60A8\u5C06\u4E86\u89E3 "),ot=i("strong"),Sa=a("pipeline()"),Ha=a(" \u51FD\u6570\u5185\u90E8\u7684\u5185\u5BB9\u4EE5\u53CA\u5982\u4F55\u8FDB\u884C\u81EA\u5B9A\u4E49\u7684\u4FEE\u6539\u3002"),this.h()},l(e){const n=oi('[data-svelte="svelte-1phssyn"]',document.head);m=o(n,"META",{name:!0,content:!0}),n.forEach(s),c=u(e),$=o(e,"H1",{class:!0});var Ze=p($);_=o(Ze,"A",{id:!0,class:!0,href:!0});var pt=p(_);g=o(pt,"SPAN",{});var ft=p(g);w(E.$$.fragment,ft),ft.forEach(s),pt.forEach(s),k=u(Ze),N=o(Ze,"SPAN",{});var ut=p(N);ge=r(ut,"Transformers\u80FD\u505A\u4EC0\u4E48\uFF1F"),ut.forEach(s),Ze.forEach(s),P=u(e),w(S.$$.fragment,e),z=u(e),M=o(e,"P",{});var mt=p(M);Gn=r(mt,"\u5728\u672C\u8282\u4E2D\uFF0C\u6211\u4EEC\u5C06\u770B\u770B Transformer \u6A21\u578B\u53EF\u4EE5\u505A\u4EC0\u4E48\uFF0C\u5E76\u4F7F\u7528 \u{1F917} Transformers \u5E93\u4E2D\u7684\u7B2C\u4E00\u4E2A\u5DE5\u5177\uFF1Apipeline() \u51FD\u6570\u3002"),mt.forEach(s),$t=u(e),w(Z.$$.fragment,e),_t=u(e),B=o(e,"H2",{class:!0});var Ke=p(B);K=o(Ke,"A",{id:!0,class:!0,href:!0});var ct=p(K);ds=o(ct,"SPAN",{});var ht=p(ds);w($e.$$.fragment,ht),ht.forEach(s),ct.forEach(s),Fn=u(Ke),bs=o(Ke,"SPAN",{});var Ga=p(bs);Ln=r(Ga,"Transformer\u88AB\u5E94\u7528\u4E8E\u5404\u4E2A\u65B9\u9762\uFF01"),Ga.forEach(s),Ke.forEach(s),dt=r(e,`

Transformer \u6A21\u578B\u7528\u4E8E\u89E3\u51B3\u5404\u79CD NLP \u4EFB\u52A1\uFF0C\u5C31\u50CF\u4E0A\u4E00\u8282\u4E2D\u63D0\u5230\u7684\u90A3\u6837\u3002\u4EE5\u4E0B\u662F\u4E00\u4E9B\u4F7F\u7528 Hugging Face \u548C Transformer \u6A21\u578B\u7684\u516C\u53F8\u548C\u7EC4\u7EC7\uFF0C\u4ED6\u4EEC\u4E5F\u901A\u8FC7\u5206\u4EAB\u4ED6\u4EEC\u7684\u6A21\u578B\u56DE\u9988\u793E\u533A\uFF1A
`),O=o(e,"P",{});var Ye=p(O);Qe=o(Ye,"IMG",{src:!0,alt:!0}),Cn=u(Ye),_e=o(Ye,"A",{href:!0,rel:!0});var Fa=p(_e);zn=r(Fa,"\u{1F917} Transformers \u5E93"),Fa.forEach(s),Mn=r(Ye,"\u63D0\u4F9B\u4E86\u521B\u5EFA\u548C\u4F7F\u7528\u8FD9\u4E9B\u5171\u4EAB\u6A21\u578B\u7684\u529F\u80FD\u3002"),de=o(Ye,"A",{href:!0,rel:!0});var La=p(de);Bn=r(La,"\u6A21\u578B\u4E2D\u5FC3\uFF08hub\uFF09"),La.forEach(s),Un=r(Ye,"\u5305\u542B\u6570\u5343\u4E2A\u4EFB\u4F55\u4EBA\u90FD\u53EF\u4EE5\u4E0B\u8F7D\u548C\u4F7F\u7528\u7684\u9884\u8BAD\u7EC3\u6A21\u578B\u3002\u60A8\u8FD8\u53EF\u4EE5\u5C06\u81EA\u5DF1\u7684\u6A21\u578B\u4E0A\u4F20\u5230 Hub\uFF01"),Ye.forEach(s),bt=u(e),w(Y.$$.fragment,e),vt=u(e),Xe=o(e,"P",{});var Ca=p(Xe);Vn=r(Ca,"\u5728\u6DF1\u5165\u7814\u7A76 Transformer \u6A21\u578B\u7684\u5E95\u5C42\u5DE5\u4F5C\u539F\u7406\u4E4B\u524D\uFF0C\u8BA9\u6211\u4EEC\u5148\u770B\u51E0\u4E2A\u793A\u4F8B\uFF0C\u770B\u770B\u5B83\u4EEC\u5982\u4F55\u7528\u4E8E\u89E3\u51B3\u4E00\u4E9B\u6709\u8DA3\u7684 NLP \u95EE\u9898\u3002"),Ca.forEach(s),wt=u(e),U=o(e,"H2",{class:!0});var Tn=p(U);Q=o(Tn,"A",{id:!0,class:!0,href:!0});var za=p(Q);vs=o(za,"SPAN",{});var Ma=p(vs);w(be.$$.fragment,Ma),Ma.forEach(s),za.forEach(s),Wn=u(Tn),ws=o(Tn,"SPAN",{});var Ba=p(ws);Dn=r(Ba,"\u4F7F\u7528pipelines"),Ba.forEach(s),Tn.forEach(s),xt=u(e),A=o(e,"IFRAME",{width:!0,height:!0,src:!0,title:!0,frameborder:!0,allow:!0}),p(A).forEach(s),yt=r(e,`
(\u8FD9\u91CC\u6709\u4E00\u4E2A\u89C6\u9891\uFF0C\u4F46\u662F\u56FD\u5185\u53EF\u80FD\u6253\u4E0D\u5F00,\u8BD1\u8005\u6CE8)
`),X=o(e,"P",{});var Pn=p(X);Jn=r(Pn,"\u{1F917} Transformers \u5E93\u4E2D\u6700\u57FA\u672C\u7684\u5BF9\u8C61\u662F "),xs=o(Pn,"STRONG",{});var Ua=p(xs);Zn=r(Ua,"pipeline()"),Ua.forEach(s),Kn=r(Pn," \u51FD\u6570\u3002\u5B83\u5C06\u6A21\u578B\u4E0E\u5176\u5FC5\u8981\u7684\u9884\u5904\u7406\u548C\u540E\u5904\u7406\u6B65\u9AA4\u8FDE\u63A5\u8D77\u6765\uFF0C\u4F7F\u6211\u4EEC\u80FD\u591F\u901A\u8FC7\u76F4\u63A5\u8F93\u5165\u4EFB\u4F55\u6587\u672C\u5E76\u83B7\u5F97\u6700\u7EC8\u7684\u7B54\u6848\uFF1A"),Pn.forEach(s),jt=u(e),w(ve.$$.fragment,e),Et=u(e),w(we.$$.fragment,e),kt=u(e),es=o(e,"P",{});var Va=p(es);Yn=r(Va,"\u6211\u4EEC\u4E5F\u53EF\u4EE5\u591A\u4F20\u51E0\u53E5\uFF01"),Va.forEach(s),Tt=u(e),w(xe.$$.fragment,e),Pt=u(e),w(ye.$$.fragment,e),It=u(e),ee=o(e,"P",{});var In=p(ee);Qn=r(In,"\u9ED8\u8BA4\u60C5\u51B5\u4E0B\uFF0C\u6B64pipeline\u9009\u62E9\u4E00\u4E2A\u7279\u5B9A\u7684\u9884\u8BAD\u7EC3\u6A21\u578B\uFF0C\u8BE5\u6A21\u578B\u5DF2\u9488\u5BF9\u82F1\u8BED\u60C5\u611F\u5206\u6790\u8FDB\u884C\u4E86\u5FAE\u8C03\u3002\u521B\u5EFA"),ys=o(In,"STRONG",{});var Wa=p(ys);Xn=r(Wa,"\u5206\u7C7B\u5668"),Wa.forEach(s),el=r(In,"\u5BF9\u8C61\u65F6\uFF0C\u5C06\u4E0B\u8F7D\u5E76\u7F13\u5B58\u6A21\u578B\u3002\u5982\u679C\u60A8\u91CD\u65B0\u8FD0\u884C\u8BE5\u547D\u4EE4\uFF0C\u5219\u5C06\u4F7F\u7528\u7F13\u5B58\u7684\u6A21\u578B\uFF0C\u65E0\u9700\u518D\u6B21\u4E0B\u8F7D\u6A21\u578B\u3002"),In.forEach(s),qt=u(e),ss=o(e,"P",{});var Da=p(ss);sl=r(Da,"\u5C06\u4E00\u4E9B\u6587\u672C\u4F20\u9012\u5230pipeline\u65F6\u6D89\u53CA\u4E09\u4E2A\u4E3B\u8981\u6B65\u9AA4\uFF1A"),Da.forEach(s),St=u(e),R=o(e,"OL",{});var cs=p(R);js=o(cs,"LI",{});var Ja=p(js);tl=r(Ja,"\u6587\u672C\u88AB\u9884\u5904\u7406\u4E3A\u6A21\u578B\u53EF\u4EE5\u7406\u89E3\u7684\u683C\u5F0F\u3002"),Ja.forEach(s),nl=u(cs),Es=o(cs,"LI",{});var Za=p(Es);ll=r(Za,"\u9884\u5904\u7406\u7684\u8F93\u5165\u88AB\u4F20\u9012\u7ED9\u6A21\u578B\u3002"),Za.forEach(s),al=u(cs),ks=o(cs,"LI",{});var Ka=p(ks);rl=r(Ka,"\u6A21\u578B\u5904\u7406\u540E\u8F93\u51FA\u6700\u7EC8\u4EBA\u7C7B\u53EF\u4EE5\u7406\u89E3\u7684\u7ED3\u679C\u3002"),Ka.forEach(s),cs.forEach(s),Ht=u(e),se=o(e,"P",{});var qn=p(se);il=r(qn,"\u76EE\u524D"),je=o(qn,"A",{href:!0,rel:!0});var Ya=p(je);ol=r(Ya,"\u53EF\u7528\u7684\u4E00\u4E9Bpipeline"),Ya.forEach(s),pl=r(qn,"\u662F\uFF1A"),qn.forEach(s),At=u(e),T=o(e,"UL",{});var I=p(T);ts=o(I,"LI",{});var Aa=p(ts);Ts=o(Aa,"STRONG",{});var Qa=p(Ts);fl=r(Qa,"\u7279\u5F81\u63D0\u53D6"),Qa.forEach(s),ul=r(Aa,"\uFF08\u83B7\u53D6\u6587\u672C\u7684\u5411\u91CF\u8868\u793A\uFF09"),Aa.forEach(s),ml=u(I),Ps=o(I,"LI",{});var Xa=p(Ps);Is=o(Xa,"STRONG",{});var er=p(Is);cl=r(er,"\u586B\u5145\u7A7A\u7F3A"),er.forEach(s),Xa.forEach(s),hl=u(I),ns=o(I,"LI",{});var Na=p(ns);qs=o(Na,"STRONG",{});var sr=p(qs);gl=r(sr,"ner"),sr.forEach(s),$l=r(Na,"\uFF08\u547D\u540D\u5B9E\u4F53\u8BC6\u522B\uFF09"),Na.forEach(s),_l=u(I),Ss=o(I,"LI",{});var tr=p(Ss);Hs=o(tr,"STRONG",{});var nr=p(Hs);dl=r(nr,"\u95EE\u7B54"),nr.forEach(s),tr.forEach(s),bl=u(I),As=o(I,"LI",{});var lr=p(As);Ns=o(lr,"STRONG",{});var ar=p(Ns);vl=r(ar,"\u60C5\u611F\u5206\u6790"),ar.forEach(s),lr.forEach(s),wl=u(I),Os=o(I,"LI",{});var rr=p(Os);Rs=o(rr,"STRONG",{});var ir=p(Rs);xl=r(ir,"\u6587\u672C\u6458\u8981"),ir.forEach(s),rr.forEach(s),yl=u(I),Gs=o(I,"LI",{});var or=p(Gs);Fs=o(or,"STRONG",{});var pr=p(Fs);jl=r(pr,"\u6587\u672C\u751F\u6210"),pr.forEach(s),or.forEach(s),El=u(I),Ls=o(I,"LI",{});var fr=p(Ls);Cs=o(fr,"STRONG",{});var ur=p(Cs);kl=r(ur,"\u7FFB\u8BD1"),ur.forEach(s),fr.forEach(s),Tl=u(I),zs=o(I,"LI",{});var mr=p(zs);Ms=o(mr,"STRONG",{});var cr=p(Ms);Pl=r(cr,"\u96F6\u6837\u672C\u5206\u7C7B"),cr.forEach(s),mr.forEach(s),I.forEach(s),Nt=u(e),ls=o(e,"P",{});var hr=p(ls);Il=r(hr,"\u8BA9\u6211\u4EEC\u6765\u770B\u770B\u5176\u4E2D\u7684\u4E00\u4E9B\u5427\uFF01"),hr.forEach(s),Ot=u(e),Ee=o(e,"H2",{id:!0});var gr=p(Ee);ql=r(gr,"\u96F6\u6837\u672C\u5206\u7C7B"),gr.forEach(s),Rt=r(e,`
\u6211\u4EEC\u5C06\u9996\u5148\u5904\u7406\u4E00\u9879\u975E\u5E38\u5177\u6311\u6218\u6027\u7684\u4EFB\u52A1\uFF0C\u6211\u4EEC\u9700\u8981\u5BF9\u5C1A\u672A\u6807\u8BB0\u7684\u6587\u672C\u8FDB\u884C\u5206\u7C7B\u3002\u8FD9\u662F\u5B9E\u9645\u9879\u76EE\u4E2D\u7684\u5E38\u89C1\u573A\u666F\uFF0C\u56E0\u4E3A\u6CE8\u91CA\u6587\u672C\u901A\u5E38\u5F88\u8017\u65F6\u5E76\u4E14\u9700\u8981\u9886\u57DF\u4E13\u4E1A\u77E5\u8BC6\u3002\u5BF9\u4E8E\u8FD9\u9879\u4EFB\u52A1**zero-shot-classification**pipeline\u975E\u5E38\u5F3A\u5927\uFF1A\u5B83\u5141\u8BB8\u60A8\u76F4\u63A5\u6307\u5B9A\u7528\u4E8E\u5206\u7C7B\u7684\u6807\u7B7E\uFF0C\u56E0\u6B64\u60A8\u4E0D\u5FC5\u4F9D\u8D56\u9884\u8BAD\u7EC3\u6A21\u578B\u7684\u6807\u7B7E\u3002\u4E0B\u9762\u7684\u6A21\u578B\u5C55\u793A\u4E86\u5982\u4F55\u4F7F\u7528\u8FD9\u4E24\u4E2A\u6807\u7B7E\u5C06\u53E5\u5B50\u5206\u7C7B\u4E3A\u6B63\u9762\u6216\u8D1F\u9762\u2014\u2014\u4F46\u4E5F\u53EF\u4EE5\u4F7F\u7528\u60A8\u559C\u6B22\u7684\u4EFB\u4F55\u5176\u4ED6\u6807\u7B7E\u96C6\u5BF9\u6587\u672C\u8FDB\u884C\u5206\u7C7B\u3002

	`),w(ke.$$.fragment,e),Gt=u(e),w(Te.$$.fragment,e),Ft=u(e),as=o(e,"P",{});var $r=p(as);Sl=r($r,"\u6B64pipeline\u79F0\u4E3Azero-shot\uFF0C\u56E0\u4E3A\u60A8\u4E0D\u9700\u8981\u5BF9\u6570\u636E\u4E0A\u7684\u6A21\u578B\u8FDB\u884C\u5FAE\u8C03\u5373\u53EF\u4F7F\u7528\u5B83\u3002\u5B83\u53EF\u4EE5\u76F4\u63A5\u8FD4\u56DE\u60A8\u60F3\u8981\u7684\u4EFB\u4F55\u6807\u7B7E\u5217\u8868\u7684\u6982\u7387\u5206\u6570\uFF01"),$r.forEach(s),Lt=u(e),w(te.$$.fragment,e),Ct=u(e),Pe=o(e,"H2",{id:!0});var _r=p(Pe);Hl=r(_r,"\u6587\u672C\u751F\u6210"),_r.forEach(s),zt=r(e,`
\u73B0\u5728\u8BA9\u6211\u4EEC\u770B\u770B\u5982\u4F55\u4F7F\u7528pipeline\u6765\u751F\u6210\u4E00\u4E9B\u6587\u672C\u3002\u8FD9\u91CC\u7684\u4E3B\u8981\u4F7F\u7528\u65B9\u6CD5\u662F\u60A8\u63D0\u4F9B\u4E00\u4E2A\u63D0\u793A\uFF0C\u6A21\u578B\u5C06\u901A\u8FC7\u751F\u6210\u5269\u4F59\u7684\u6587\u672C\u6765\u81EA\u52A8\u5B8C\u6210\u6574\u6BB5\u8BDD\u3002\u8FD9\u7C7B\u4F3C\u4E8E\u8BB8\u591A\u624B\u673A\u4E0A\u7684\u9884\u6D4B\u6587\u672C\u529F\u80FD\u3002\u6587\u672C\u751F\u6210\u6D89\u53CA\u968F\u673A\u6027\uFF0C\u56E0\u6B64\u5982\u679C\u60A8\u6CA1\u6709\u5F97\u5230\u76F8\u540C\u7684\u5982\u4E0B\u6240\u793A\u7684\u7ED3\u679C\uFF0C\u8FD9\u662F\u6B63\u5E38\u7684\u3002

	`),w(Ie.$$.fragment,e),Mt=u(e),w(qe.$$.fragment,e),Bt=u(e),G=o(e,"P",{});var hs=p(G);Al=r(hs,"\u60A8\u53EF\u4EE5\u4F7F\u7528\u53C2\u6570 "),Bs=o(hs,"STRONG",{});var dr=p(Bs);Nl=r(dr,"num_return_sequences"),dr.forEach(s),Ol=r(hs," \u63A7\u5236\u751F\u6210\u591A\u5C11\u4E2A\u4E0D\u540C\u7684\u5E8F\u5217\uFF0C\u5E76\u4F7F\u7528\u53C2\u6570 "),Us=o(hs,"STRONG",{});var br=p(Us);Rl=r(br,"max_length"),br.forEach(s),Gl=r(hs," \u63A7\u5236\u8F93\u51FA\u6587\u672C\u7684\u603B\u957F\u5EA6\u3002"),hs.forEach(s),Ut=u(e),w(ne.$$.fragment,e),Vt=u(e),V=o(e,"H2",{class:!0});var Sn=p(V);le=o(Sn,"A",{id:!0,class:!0,href:!0});var vr=p(le);Vs=o(vr,"SPAN",{});var wr=p(Vs);w(Se.$$.fragment,wr),wr.forEach(s),vr.forEach(s),Fl=u(Sn),Ws=o(Sn,"SPAN",{});var xr=p(Ws);Ll=r(xr,"\u5728pipeline\u4E2D\u4F7F\u7528 Hub \u4E2D\u7684\u5176\u4ED6\u6A21\u578B"),xr.forEach(s),Sn.forEach(s),Wt=r(e,`

\u524D\u9762\u7684\u793A\u4F8B\u4F7F\u7528\u4E86\u9ED8\u8BA4\u6A21\u578B\uFF0C\u4F46\u60A8\u4E5F\u53EF\u4EE5\u4ECE Hub \u4E2D\u9009\u62E9\u7279\u5B9A\u6A21\u578B\u4EE5\u5728\u7279\u5B9A\u4EFB\u52A1\u7684pipeline\u4E2D\u4F7F\u7528 - \u4F8B\u5982\uFF0C\u6587\u672C\u751F\u6210\u3002\u8F6C\u5230[\u6A21\u578B\u4E2D\u5FC3\uFF08hub\uFF09](https://huggingface.co/models)\u5E76\u5355\u51FB\u5DE6\u4FA7\u7684\u76F8\u5E94\u6807\u7B7E\u5C06\u4F1A\u53EA\u663E\u793A\u8BE5\u4EFB\u52A1\u652F\u6301\u7684\u6A21\u578B\u3002[\u4F8B\u5982\u8FD9\u6837](https://huggingface.co/models?pipeline_tag=text-generation)\u3002
`),ae=o(e,"P",{});var Hn=p(ae);Cl=r(Hn,"\u8BA9\u6211\u4EEC\u8BD5\u8BD5 "),He=o(Hn,"A",{href:!0,rel:!0});var yr=p(He);Ds=o(yr,"STRONG",{});var jr=p(Ds);zl=r(jr,"distilgpt2"),jr.forEach(s),yr.forEach(s),Ml=r(Hn," \u6A21\u578B\u5427\uFF01\u4EE5\u4E0B\u662F\u5982\u4F55\u5728\u4E0E\u4EE5\u524D\u76F8\u540C\u7684pipeline\u4E2D\u52A0\u8F7D\u5B83\uFF1A"),Hn.forEach(s),Dt=u(e),w(Ae.$$.fragment,e),Jt=u(e),w(Ne.$$.fragment,e),Zt=u(e),rs=o(e,"P",{});var Er=p(rs);Bl=r(Er,"\u60A8\u53EF\u4EE5\u901A\u8FC7\u5355\u51FB\u8BED\u8A00\u6807\u7B7E\u6765\u7B5B\u9009\u641C\u7D22\u7ED3\u679C\uFF0C\u7136\u540E\u9009\u62E9\u53E6\u4E00\u79CD\u6587\u672C\u751F\u6210\u6A21\u578B\u7684\u6A21\u578B\u3002\u6A21\u578B\u4E2D\u5FC3\uFF08hub\uFF09\u751A\u81F3\u5305\u542B\u652F\u6301\u591A\u79CD\u8BED\u8A00\u7684\u591A\u8BED\u8A00\u6A21\u578B\u3002"),Er.forEach(s),Kt=u(e),is=o(e,"P",{});var kr=p(is);Ul=r(kr,"\u901A\u8FC7\u5355\u51FB\u9009\u62E9\u6A21\u578B\u540E\uFF0C\u60A8\u4F1A\u770B\u5230\u6709\u4E00\u4E2A\u5C0F\u7EC4\u4EF6\uFF0C\u53EF\u8BA9\u60A8\u76F4\u63A5\u5728\u7EBF\u8BD5\u7528\u3002\u901A\u8FC7\u8FD9\u79CD\u65B9\u5F0F\uFF0C\u60A8\u53EF\u4EE5\u5728\u4E0B\u8F7D\u4E4B\u524D\u5FEB\u901F\u6D4B\u8BD5\u6A21\u578B\u7684\u529F\u80FD\u3002"),kr.forEach(s),Yt=u(e),w(re.$$.fragment,e),Qt=u(e),W=o(e,"H2",{class:!0});var An=p(W);ie=o(An,"A",{id:!0,class:!0,href:!0});var Tr=p(ie);Js=o(Tr,"SPAN",{});var Pr=p(Js);w(Oe.$$.fragment,Pr),Pr.forEach(s),Tr.forEach(s),Vl=u(An),Zs=o(An,"SPAN",{});var Ir=p(Zs);Wl=r(Ir,"\u63A8\u7406 API"),Ir.forEach(s),An.forEach(s),Xt=r(e,`

\u6240\u6709\u6A21\u578B\u90FD\u53EF\u4EE5\u4F7F\u7528 Inference API \u76F4\u63A5\u901A\u8FC7\u6D4F\u89C8\u5668\u8FDB\u884C\u6D4B\u8BD5\uFF0C\u8BE5 API \u53EF\u5728 [Hugging Face \u7F51\u7AD9](https://huggingface.co/)\u4E0A\u627E\u5230\u3002\u901A\u8FC7\u8F93\u5165\u81EA\u5B9A\u4E49\u6587\u672C\u5E76\u89C2\u5BDF\u6A21\u578B\u7684\u8F93\u51FA\uFF0C\u60A8\u53EF\u4EE5\u76F4\u63A5\u5728\u6B64\u9875\u9762\u4E0A\u4F7F\u7528\u6A21\u578B\u3002
`),oe=o(e,"P",{});var Nn=p(oe);Dl=r(Nn,"\u5C0F\u7EC4\u4EF6\u5F62\u5F0F\u7684\u63A8\u7406 API \u4E5F\u53EF\u4F5C\u4E3A\u4ED8\u8D39\u4EA7\u54C1\u4F7F\u7528\uFF0C\u5982\u679C\u60A8\u7684\u5DE5\u4F5C\u6D41\u7A0B\u9700\u8981\u5B83\uFF0C\u5B83\u4F1A\u6D3E\u4E0A\u7528\u573A\u3002\u6709\u5173\u66F4\u591A\u8BE6\u7EC6\u4FE1\u606F\uFF0C\u8BF7\u53C2\u9605"),Re=o(Nn,"A",{href:!0,rel:!0});var qr=p(Re);Jl=r(qr,"\u5B9A\u4EF7\u9875\u9762"),qr.forEach(s),Zl=r(Nn,"\u3002"),Nn.forEach(s),en=u(e),D=o(e,"H2",{class:!0});var On=p(D);pe=o(On,"A",{id:!0,class:!0,href:!0});var Sr=p(pe);Ks=o(Sr,"SPAN",{});var Hr=p(Ks);w(Ge.$$.fragment,Hr),Hr.forEach(s),Sr.forEach(s),Kl=u(On),Ys=o(On,"SPAN",{});var Ar=p(Ys);Yl=r(Ar,"Mask filling"),Ar.forEach(s),On.forEach(s),sn=r(e,`

\u60A8\u5C06\u5C1D\u8BD5\u7684\u4E0B\u4E00\u4E2Apipeline\u662F **fill-mask**\u3002\u6B64\u4EFB\u52A1\u7684\u60F3\u6CD5\u662F\u586B\u5145\u7ED9\u5B9A\u6587\u672C\u4E2D\u7684\u7A7A\u767D\uFF1A
\`\`\`python
from transformers import pipeline
`),os=o(e,"P",{});var Nr=p(os);Ql=r(Nr,`unmasker = pipeline(\u201Cfill-mask\u201D)
unmasker(\u201CThis course will teach you all about <mask> models.\u201D, top_k=2)`),Nr.forEach(s),tn=u(e),w(Fe.$$.fragment,e),nn=u(e),J=o(e,"P",{});var gt=p(J);Qs=o(gt,"STRONG",{});var Or=p(Qs);Xl=r(Or,"top_k"),Or.forEach(s),ea=r(gt," \u53C2\u6570\u63A7\u5236\u8981\u663E\u793A\u7684\u7ED3\u679C\u6709\u591A\u5C11\u79CD\u3002\u8BF7\u6CE8\u610F\uFF0C\u8FD9\u91CC\u6A21\u578B\u586B\u5145\u4E86\u7279\u6B8A\u7684< "),Xs=o(gt,"STRONG",{});var Rr=p(Xs);sa=r(Rr,"mask"),Rr.forEach(s),ta=r(gt," >\u8BCD\uFF0C\u5B83\u901A\u5E38\u88AB\u79F0\u4E3A\u63A9\u7801\u6807\u8BB0\u3002\u5176\u4ED6\u63A9\u7801\u586B\u5145\u6A21\u578B\u53EF\u80FD\u6709\u4E0D\u540C\u7684\u63A9\u7801\u6807\u8BB0\uFF0C\u56E0\u6B64\u5728\u63A2\u7D22\u5176\u4ED6\u6A21\u578B\u65F6\u8981\u9A8C\u8BC1\u6B63\u786E\u7684\u63A9\u7801\u5B57\u662F\u4EC0\u4E48\u3002\u68C0\u67E5\u5B83\u7684\u4E00\u79CD\u65B9\u6CD5\u662F\u67E5\u770B\u5C0F\u7EC4\u4EF6\u4E2D\u4F7F\u7528\u7684\u63A9\u7801\u3002"),gt.forEach(s),ln=u(e),w(fe.$$.fragment,e),an=u(e),Le=o(e,"H2",{id:!0});var Gr=p(Le);na=r(Gr,"\u547D\u540D\u5B9E\u4F53\u8BC6\u522B"),Gr.forEach(s),rn=r(e,`
\u547D\u540D\u5B9E\u4F53\u8BC6\u522B (NER) \u662F\u4E00\u9879\u4EFB\u52A1\uFF0C\u5176\u4E2D\u6A21\u578B\u5FC5\u987B\u627E\u5230\u8F93\u5165\u6587\u672C\u7684\u54EA\u4E9B\u90E8\u5206\u5BF9\u5E94\u4E8E\u8BF8\u5982\u4EBA\u5458\u3001\u4F4D\u7F6E\u6216\u7EC4\u7EC7\u4E4B\u7C7B\u7684\u5B9E\u4F53\u3002\u8BA9\u6211\u4EEC\u770B\u4E00\u4E2A\u4F8B\u5B50\uFF1A
\`\`\`python
from transformers import pipeline
`),ps=o(e,"P",{});var Fr=p(ps);la=r(Fr,`ner = pipeline(\u201Cner\u201D, grouped_entities=True)
ner(\u201CMy name is Sylvain and I work at Hugging Face in Brooklyn.\u201C)`),Fr.forEach(s),on=u(e),w(Ce.$$.fragment,e),pn=u(e),fs=o(e,"P",{});var Lr=p(fs);aa=r(Lr,"\u5728\u8FD9\u91CC\uFF0C\u6A21\u578B\u6B63\u786E\u5730\u8BC6\u522B\u51FA Sylvain \u662F\u4E00\u4E2A\u4EBA (PER)\uFF0CHugging Face \u662F\u4E00\u4E2A\u7EC4\u7EC7 (ORG)\uFF0C\u800C\u5E03\u9C81\u514B\u6797\u662F\u4E00\u4E2A\u4F4D\u7F6E (LOC)\u3002"),Lr.forEach(s),fn=u(e),H=o(e,"P",{});var C=p(H);ra=r(C,"\u6211\u4EEC\u5728pipeline\u521B\u5EFA\u51FD\u6570\u4E2D\u4F20\u9012\u9009\u9879 "),et=o(C,"STRONG",{});var Cr=p(et);ia=r(Cr,"grouped_entities=True"),Cr.forEach(s),oa=r(C," \u4EE5\u544A\u8BC9pipeline\u5C06\u5BF9\u5E94\u4E8E\u540C\u4E00\u5B9E\u4F53\u7684\u53E5\u5B50\u90E8\u5206\u91CD\u65B0\u7EC4\u5408\u5728\u4E00\u8D77\uFF1A\u8FD9\u91CC\u6A21\u578B\u6B63\u786E\u5730\u5C06\u201CHugging\u201D\u548C\u201CFace\u201D\u5206\u7EC4\u4E3A\u4E00\u4E2A\u7EC4\u7EC7\uFF0C\u5373\u4F7F\u540D\u79F0\u7531\u591A\u4E2A\u8BCD\u7EC4\u6210\u3002\u4E8B\u5B9E\u4E0A\uFF0C\u6B63\u5982\u6211\u4EEC\u5373\u5C06\u5728\u4E0B\u4E00\u7AE0\u770B\u5230\u7684\uFF0C\u9884\u5904\u7406\u751A\u81F3\u4F1A\u5C06\u4E00\u4E9B\u5355\u8BCD\u5206\u6210\u66F4\u5C0F\u7684\u90E8\u5206\u3002\u4F8B\u5982\uFF0C"),st=o(C,"STRONG",{});var zr=p(st);pa=r(zr,"Sylvain"),zr.forEach(s),fa=r(C," \u5206\u5272\u4E3A\u4E86\u56DB\u90E8\u5206\uFF1A"),tt=o(C,"STRONG",{});var Mr=p(tt);ua=r(Mr,"S\u3001##yl\u3001##va"),Mr.forEach(s),ma=r(C," \u548C "),nt=o(C,"STRONG",{});var Br=p(nt);ca=r(Br,"##in"),Br.forEach(s),ha=r(C,"\u3002\u5728\u540E\u5904\u7406\u6B65\u9AA4\u4E2D\uFF0Cpipeline\u6210\u529F\u5730\u91CD\u65B0\u7EC4\u5408\u4E86\u8FD9\u4E9B\u90E8\u5206\u3002"),C.forEach(s),un=u(e),w(ue.$$.fragment,e),mn=u(e),ze=o(e,"H2",{id:!0});var Ur=p(ze);ga=r(Ur,"\u95EE\u7B54\u7CFB\u7EDF"),Ur.forEach(s),cn=r(e,`
\u95EE\u7B54pipeline\u4F7F\u7528\u6765\u81EA\u7ED9\u5B9A\u4E0A\u4E0B\u6587\u7684\u4FE1\u606F\u56DE\u7B54\u95EE\u9898\uFF1A
\`\`\`python
from transformers import pipeline
`),us=o(e,"P",{});var Vr=p(us);$a=r(Vr,`question_answerer = pipeline(\u201Cquestion-answering\u201D)
question_answerer(
question=\u201CWhere do I work?\u201D,
context=\u201CMy name is Sylvain and I work at Hugging Face in Brooklyn\u201D,
)`),Vr.forEach(s),hn=u(e),w(Me.$$.fragment,e),gn=u(e),ms=o(e,"P",{});var Wr=p(ms);_a=r(Wr,"\u8BF7\u6CE8\u610F\uFF0C\u6B64pipeline\u901A\u8FC7\u4ECE\u63D0\u4F9B\u7684\u4E0A\u4E0B\u6587\u4E2D\u63D0\u53D6\u4FE1\u606F\u6765\u5DE5\u4F5C\uFF1B\u5B83\u4E0D\u4F1A\u51ED\u7A7A\u751F\u6210\u7B54\u6848\u3002"),Wr.forEach(s),$n=u(e),Be=o(e,"H2",{id:!0});var Dr=p(Be);da=r(Dr,"\u6587\u672C\u6458\u8981"),Dr.forEach(s),_n=r(e,`
\u6587\u672C\u6458\u8981\u662F\u5C06\u6587\u672C\u7F29\u51CF\u4E3A\u8F83\u77ED\u6587\u672C\u7684\u4EFB\u52A1\uFF0C\u540C\u65F6\u4FDD\u7559\u6587\u672C\u4E2D\u7684\u4E3B\u8981\uFF08\u91CD\u8981\uFF09\u4FE1\u606F\u3002\u4E0B\u9762\u662F\u4E00\u4E2A\u4F8B\u5B50\uFF1A

	`),w(Ue.$$.fragment,e),dn=u(e),w(Ve.$$.fragment,e),bn=u(e),F=o(e,"P",{});var gs=p(F);ba=r(gs,"\u4E0E\u6587\u672C\u751F\u6210\u4E00\u6837\uFF0C\u60A8\u6307\u5B9A\u7ED3\u679C\u7684 "),lt=o(gs,"STRONG",{});var Jr=p(lt);va=r(Jr,"max_length"),Jr.forEach(s),wa=r(gs," \u6216 "),at=o(gs,"STRONG",{});var Zr=p(at);xa=r(Zr,"min_length"),Zr.forEach(s),ya=r(gs,"\u3002"),gs.forEach(s),vn=u(e),We=o(e,"H2",{id:!0});var Kr=p(We);ja=r(Kr,"\u7FFB\u8BD1"),Kr.forEach(s),wn=r(e,`
\u5BF9\u4E8E\u7FFB\u8BD1\uFF0C\u5982\u679C\u60A8\u5728\u4EFB\u52A1\u540D\u79F0\u4E2D\u63D0\u4F9B\u8BED\u8A00\u5BF9\uFF08\u4F8B\u5982\u201C**translation_en_to_fr**\u201D\uFF09\uFF0C\u5219\u53EF\u4EE5\u4F7F\u7528\u9ED8\u8BA4\u6A21\u578B\uFF0C\u4F46\u6700\u7B80\u5355\u7684\u65B9\u6CD5\u662F\u5728[\u6A21\u578B\u4E2D\u5FC3\uFF08hub\uFF09](https://huggingface.co/models)\u9009\u62E9\u8981\u4F7F\u7528\u7684\u6A21\u578B\u3002\u5728\u8FD9\u91CC\uFF0C\u6211\u4EEC\u5C06\u5C1D\u8BD5\u4ECE\u6CD5\u8BED\u7FFB\u8BD1\u6210\u82F1\u8BED\uFF1A

	`),w(De.$$.fragment,e),xn=u(e),w(Je.$$.fragment,e),yn=u(e),L=o(e,"P",{});var $s=p(L);Ea=r($s,"\u4E0E\u6587\u672C\u751F\u6210\u548C\u6458\u8981\u4E00\u6837\uFF0C\u60A8\u53EF\u4EE5\u6307\u5B9A\u7ED3\u679C\u7684 "),rt=o($s,"STRONG",{});var Yr=p(rt);ka=r(Yr,"max_length"),Yr.forEach(s),Ta=r($s," \u6216 "),it=o($s,"STRONG",{});var Qr=p(it);Pa=r(Qr,"min_length"),Qr.forEach(s),Ia=r($s,"\u3002"),$s.forEach(s),jn=u(e),w(me.$$.fragment,e),En=u(e),ce=o(e,"P",{});var Rn=p(ce);qa=r(Rn,"\u5230\u76EE\u524D\u4E3A\u6B62\u663E\u793A\u7684pipeline\u4E3B\u8981\u7528\u4E8E\u6F14\u793A\u76EE\u7684\u3002\u5B83\u4EEC\u662F\u4E3A\u7279\u5B9A\u4EFB\u52A1\u800C\u7F16\u7A0B\u7684\uFF0C\u4E0D\u80FD\u5BF9\u4ED6\u4EEC\u8FDB\u884C\u81EA\u5B9A\u4E49\u7684\u4FEE\u6539\u3002\u5728\u4E0B\u4E00\u7AE0\u4E2D\uFF0C\u60A8\u5C06\u4E86\u89E3 "),ot=o(Rn,"STRONG",{});var Xr=p(ot);Sa=r(Xr,"pipeline()"),Xr.forEach(s),Ha=r(Rn," \u51FD\u6570\u5185\u90E8\u7684\u5185\u5BB9\u4EE5\u53CA\u5982\u4F55\u8FDB\u884C\u81EA\u5B9A\u4E49\u7684\u4FEE\u6539\u3002"),Rn.forEach(s),this.h()},h(){h(m,"name","hf:doc:metadata"),h(m,"content",JSON.stringify(xi)),h(_,"id","transformers"),h(_,"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"),h(_,"href","#transformers"),h($,"class","relative group"),h(K,"id","transformer"),h(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"),h(K,"href","#transformer"),h(B,"class","relative group"),ei(Qe.src,Oa="https://huggingface.co/course/static/chapter1/companies.PNG")||h(Qe,"src",Oa),h(Qe,"alt","\u4F7F\u7528 Hugging Face \u7684\u516C\u53F8"),h(_e,"href","https://github.com/huggingface/transformers"),h(_e,"rel","nofollow"),h(de,"href","https://huggingface.co/models"),h(de,"rel","nofollow"),h(Q,"id","pipelines"),h(Q,"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"),h(Q,"href","#pipelines"),h(U,"class","relative group"),h(A,"width","605"),h(A,"height","320"),ei(A.src,Ra="https://www.youtube.com/embed/tiZFewofSLM")||h(A,"src",Ra),h(A,"title","YouTube video player"),h(A,"frameborder","0"),h(A,"allow","accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"),A.allowFullscreen=!0,h(je,"href","https://huggingface.co/transformers/main_classes/pipelines.html"),h(je,"rel","nofollow"),h(Ee,"id",""),h(Pe,"id",""),h(le,"id","pipeline-hub"),h(le,"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"),h(le,"href","#pipeline-hub"),h(V,"class","relative group"),h(He,"href","https://huggingface.co/distilgpt2"),h(He,"rel","nofollow"),h(ie,"id","api"),h(ie,"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"),h(ie,"href","#api"),h(W,"class","relative group"),h(Re,"href","https://huggingface.co/pricing"),h(Re,"rel","nofollow"),h(pe,"id","mask-filling"),h(pe,"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"),h(pe,"href","#mask-filling"),h(D,"class","relative group"),h(Le,"id",""),h(ze,"id",""),h(Be,"id",""),h(We,"id","")},m(e,n){t(document.head,m),l(e,c,n),l(e,$,n),t($,_),t(_,g),x(E,g,null),t($,k),t($,N),t(N,ge),l(e,P,n),x(S,e,n),l(e,z,n),l(e,M,n),t(M,Gn),l(e,$t,n),x(Z,e,n),l(e,_t,n),l(e,B,n),t(B,K),t(K,ds),x($e,ds,null),t(B,Fn),t(B,bs),t(bs,Ln),l(e,dt,n),l(e,O,n),t(O,Qe),t(O,Cn),t(O,_e),t(_e,zn),t(O,Mn),t(O,de),t(de,Bn),t(O,Un),l(e,bt,n),x(Y,e,n),l(e,vt,n),l(e,Xe,n),t(Xe,Vn),l(e,wt,n),l(e,U,n),t(U,Q),t(Q,vs),x(be,vs,null),t(U,Wn),t(U,ws),t(ws,Dn),l(e,xt,n),l(e,A,n),l(e,yt,n),l(e,X,n),t(X,Jn),t(X,xs),t(xs,Zn),t(X,Kn),l(e,jt,n),x(ve,e,n),l(e,Et,n),x(we,e,n),l(e,kt,n),l(e,es,n),t(es,Yn),l(e,Tt,n),x(xe,e,n),l(e,Pt,n),x(ye,e,n),l(e,It,n),l(e,ee,n),t(ee,Qn),t(ee,ys),t(ys,Xn),t(ee,el),l(e,qt,n),l(e,ss,n),t(ss,sl),l(e,St,n),l(e,R,n),t(R,js),t(js,tl),t(R,nl),t(R,Es),t(Es,ll),t(R,al),t(R,ks),t(ks,rl),l(e,Ht,n),l(e,se,n),t(se,il),t(se,je),t(je,ol),t(se,pl),l(e,At,n),l(e,T,n),t(T,ts),t(ts,Ts),t(Ts,fl),t(ts,ul),t(T,ml),t(T,Ps),t(Ps,Is),t(Is,cl),t(T,hl),t(T,ns),t(ns,qs),t(qs,gl),t(ns,$l),t(T,_l),t(T,Ss),t(Ss,Hs),t(Hs,dl),t(T,bl),t(T,As),t(As,Ns),t(Ns,vl),t(T,wl),t(T,Os),t(Os,Rs),t(Rs,xl),t(T,yl),t(T,Gs),t(Gs,Fs),t(Fs,jl),t(T,El),t(T,Ls),t(Ls,Cs),t(Cs,kl),t(T,Tl),t(T,zs),t(zs,Ms),t(Ms,Pl),l(e,Nt,n),l(e,ls,n),t(ls,Il),l(e,Ot,n),l(e,Ee,n),t(Ee,ql),l(e,Rt,n),x(ke,e,n),l(e,Gt,n),x(Te,e,n),l(e,Ft,n),l(e,as,n),t(as,Sl),l(e,Lt,n),x(te,e,n),l(e,Ct,n),l(e,Pe,n),t(Pe,Hl),l(e,zt,n),x(Ie,e,n),l(e,Mt,n),x(qe,e,n),l(e,Bt,n),l(e,G,n),t(G,Al),t(G,Bs),t(Bs,Nl),t(G,Ol),t(G,Us),t(Us,Rl),t(G,Gl),l(e,Ut,n),x(ne,e,n),l(e,Vt,n),l(e,V,n),t(V,le),t(le,Vs),x(Se,Vs,null),t(V,Fl),t(V,Ws),t(Ws,Ll),l(e,Wt,n),l(e,ae,n),t(ae,Cl),t(ae,He),t(He,Ds),t(Ds,zl),t(ae,Ml),l(e,Dt,n),x(Ae,e,n),l(e,Jt,n),x(Ne,e,n),l(e,Zt,n),l(e,rs,n),t(rs,Bl),l(e,Kt,n),l(e,is,n),t(is,Ul),l(e,Yt,n),x(re,e,n),l(e,Qt,n),l(e,W,n),t(W,ie),t(ie,Js),x(Oe,Js,null),t(W,Vl),t(W,Zs),t(Zs,Wl),l(e,Xt,n),l(e,oe,n),t(oe,Dl),t(oe,Re),t(Re,Jl),t(oe,Zl),l(e,en,n),l(e,D,n),t(D,pe),t(pe,Ks),x(Ge,Ks,null),t(D,Kl),t(D,Ys),t(Ys,Yl),l(e,sn,n),l(e,os,n),t(os,Ql),l(e,tn,n),x(Fe,e,n),l(e,nn,n),l(e,J,n),t(J,Qs),t(Qs,Xl),t(J,ea),t(J,Xs),t(Xs,sa),t(J,ta),l(e,ln,n),x(fe,e,n),l(e,an,n),l(e,Le,n),t(Le,na),l(e,rn,n),l(e,ps,n),t(ps,la),l(e,on,n),x(Ce,e,n),l(e,pn,n),l(e,fs,n),t(fs,aa),l(e,fn,n),l(e,H,n),t(H,ra),t(H,et),t(et,ia),t(H,oa),t(H,st),t(st,pa),t(H,fa),t(H,tt),t(tt,ua),t(H,ma),t(H,nt),t(nt,ca),t(H,ha),l(e,un,n),x(ue,e,n),l(e,mn,n),l(e,ze,n),t(ze,ga),l(e,cn,n),l(e,us,n),t(us,$a),l(e,hn,n),x(Me,e,n),l(e,gn,n),l(e,ms,n),t(ms,_a),l(e,$n,n),l(e,Be,n),t(Be,da),l(e,_n,n),x(Ue,e,n),l(e,dn,n),x(Ve,e,n),l(e,bn,n),l(e,F,n),t(F,ba),t(F,lt),t(lt,va),t(F,wa),t(F,at),t(at,xa),t(F,ya),l(e,vn,n),l(e,We,n),t(We,ja),l(e,wn,n),x(De,e,n),l(e,xn,n),x(Je,e,n),l(e,yn,n),l(e,L,n),t(L,Ea),t(L,rt),t(rt,ka),t(L,Ta),t(L,it),t(it,Pa),t(L,Ia),l(e,jn,n),x(me,e,n),l(e,En,n),l(e,ce,n),t(ce,qa),t(ce,ot),t(ot,Sa),t(ce,Ha),kn=!0},p(e,[n]){const Ze={};n&2&&(Ze.$$scope={dirty:n,ctx:e}),Z.$set(Ze);const pt={};n&2&&(pt.$$scope={dirty:n,ctx:e}),Y.$set(pt);const ft={};n&2&&(ft.$$scope={dirty:n,ctx:e}),te.$set(ft);const ut={};n&2&&(ut.$$scope={dirty:n,ctx:e}),ne.$set(ut);const mt={};n&2&&(mt.$$scope={dirty:n,ctx:e}),re.$set(mt);const Ke={};n&2&&(Ke.$$scope={dirty:n,ctx:e}),fe.$set(Ke);const ct={};n&2&&(ct.$$scope={dirty:n,ctx:e}),ue.$set(ct);const ht={};n&2&&(ht.$$scope={dirty:n,ctx:e}),me.$set(ht)},i(e){kn||(d(E.$$.fragment,e),d(S.$$.fragment,e),d(Z.$$.fragment,e),d($e.$$.fragment,e),d(Y.$$.fragment,e),d(be.$$.fragment,e),d(ve.$$.fragment,e),d(we.$$.fragment,e),d(xe.$$.fragment,e),d(ye.$$.fragment,e),d(ke.$$.fragment,e),d(Te.$$.fragment,e),d(te.$$.fragment,e),d(Ie.$$.fragment,e),d(qe.$$.fragment,e),d(ne.$$.fragment,e),d(Se.$$.fragment,e),d(Ae.$$.fragment,e),d(Ne.$$.fragment,e),d(re.$$.fragment,e),d(Oe.$$.fragment,e),d(Ge.$$.fragment,e),d(Fe.$$.fragment,e),d(fe.$$.fragment,e),d(Ce.$$.fragment,e),d(ue.$$.fragment,e),d(Me.$$.fragment,e),d(Ue.$$.fragment,e),d(Ve.$$.fragment,e),d(De.$$.fragment,e),d(Je.$$.fragment,e),d(me.$$.fragment,e),kn=!0)},o(e){b(E.$$.fragment,e),b(S.$$.fragment,e),b(Z.$$.fragment,e),b($e.$$.fragment,e),b(Y.$$.fragment,e),b(be.$$.fragment,e),b(ve.$$.fragment,e),b(we.$$.fragment,e),b(xe.$$.fragment,e),b(ye.$$.fragment,e),b(ke.$$.fragment,e),b(Te.$$.fragment,e),b(te.$$.fragment,e),b(Ie.$$.fragment,e),b(qe.$$.fragment,e),b(ne.$$.fragment,e),b(Se.$$.fragment,e),b(Ae.$$.fragment,e),b(Ne.$$.fragment,e),b(re.$$.fragment,e),b(Oe.$$.fragment,e),b(Ge.$$.fragment,e),b(Fe.$$.fragment,e),b(fe.$$.fragment,e),b(Ce.$$.fragment,e),b(ue.$$.fragment,e),b(Me.$$.fragment,e),b(Ue.$$.fragment,e),b(Ve.$$.fragment,e),b(De.$$.fragment,e),b(Je.$$.fragment,e),b(me.$$.fragment,e),kn=!1},d(e){s(m),e&&s(c),e&&s($),y(E),e&&s(P),y(S,e),e&&s(z),e&&s(M),e&&s($t),y(Z,e),e&&s(_t),e&&s(B),y($e),e&&s(dt),e&&s(O),e&&s(bt),y(Y,e),e&&s(vt),e&&s(Xe),e&&s(wt),e&&s(U),y(be),e&&s(xt),e&&s(A),e&&s(yt),e&&s(X),e&&s(jt),y(ve,e),e&&s(Et),y(we,e),e&&s(kt),e&&s(es),e&&s(Tt),y(xe,e),e&&s(Pt),y(ye,e),e&&s(It),e&&s(ee),e&&s(qt),e&&s(ss),e&&s(St),e&&s(R),e&&s(Ht),e&&s(se),e&&s(At),e&&s(T),e&&s(Nt),e&&s(ls),e&&s(Ot),e&&s(Ee),e&&s(Rt),y(ke,e),e&&s(Gt),y(Te,e),e&&s(Ft),e&&s(as),e&&s(Lt),y(te,e),e&&s(Ct),e&&s(Pe),e&&s(zt),y(Ie,e),e&&s(Mt),y(qe,e),e&&s(Bt),e&&s(G),e&&s(Ut),y(ne,e),e&&s(Vt),e&&s(V),y(Se),e&&s(Wt),e&&s(ae),e&&s(Dt),y(Ae,e),e&&s(Jt),y(Ne,e),e&&s(Zt),e&&s(rs),e&&s(Kt),e&&s(is),e&&s(Yt),y(re,e),e&&s(Qt),e&&s(W),y(Oe),e&&s(Xt),e&&s(oe),e&&s(en),e&&s(D),y(Ge),e&&s(sn),e&&s(os),e&&s(tn),y(Fe,e),e&&s(nn),e&&s(J),e&&s(ln),y(fe,e),e&&s(an),e&&s(Le),e&&s(rn),e&&s(ps),e&&s(on),y(Ce,e),e&&s(pn),e&&s(fs),e&&s(fn),e&&s(H),e&&s(un),y(ue,e),e&&s(mn),e&&s(ze),e&&s(cn),e&&s(us),e&&s(hn),y(Me,e),e&&s(gn),e&&s(ms),e&&s($n),e&&s(Be),e&&s(_n),y(Ue,e),e&&s(dn),y(Ve,e),e&&s(bn),e&&s(F),e&&s(vn),e&&s(We),e&&s(wn),y(De,e),e&&s(xn),y(Je,e),e&&s(yn),e&&s(L),e&&s(jn),y(me,e),e&&s(En),e&&s(ce)}}}const xi={local:"transformers",sections:[{local:"transformer",title:"Transformer\u88AB\u5E94\u7528\u4E8E\u5404\u4E2A\u65B9\u9762\uFF01"},{local:"pipelines",title:"\u4F7F\u7528pipelines"},{local:"",title:"\u96F6\u6837\u672C\u5206\u7C7B"},{local:"",title:"\u6587\u672C\u751F\u6210"},{local:"pipeline-hub",title:"\u5728pipeline\u4E2D\u4F7F\u7528 Hub \u4E2D\u7684\u5176\u4ED6\u6A21\u578B"},{local:"api",title:"\u63A8\u7406 API"},{local:"mask-filling",title:"Mask filling"},{local:"",title:"\u547D\u540D\u5B9E\u4F53\u8BC6\u522B"},{local:"",title:"\u95EE\u7B54\u7CFB\u7EDF"},{local:"",title:"\u6587\u672C\u6458\u8981"},{local:"",title:"\u7FFB\u8BD1"}],title:"Transformers\u80FD\u505A\u4EC0\u4E48\uFF1F"};function yi(j){return pi(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Pi extends si{constructor(m){super();ti(this,m,yi,wi,ni,{})}}export{Pi as default,xi as metadata};
