import{S as Vp,i as Rp,s as Ap,e as t,k as r,w as u,t as c,M as zp,c as n,d as e,m as p,a as l,x as d,h,b as m,G as a,g as o,y as f,L as Sp,q as g,o as y,B as j,v as Qp}from"../chunks/vendor-hf-doc-builder.js";import{I as b}from"../chunks/IconCopyLink-hf-doc-builder.js";import{C as w}from"../chunks/CodeBlock-hf-doc-builder.js";function Yp(Bo){let T,et,U,X,Se,xs,On,Qe,sl,at,ie,el,tt,oe,al,nt,I,L,Ye,ks,tl,Xe,nl,lt,re,ll,it,pe,il,ot,Z,F,Le,Ts,ol,Fe,rl,rt,ce,pl,pt,M,Pe,cl,hl,De,ml,ul,Ke,dl,fl,Oe,gl,ct,Us,ht,B,P,sa,Is,yl,ea,jl,mt,he,bl,ut,me,wl,dt,Zs,ft,E,D,aa,Bs,Ml,ta,vl,gt,K,Jl,ue,xl,kl,yt,de,Tl,jt,O,na,Ul,Il,la,Zl,bt,W,ss,ia,Es,Bl,oa,El,wt,fe,Wl,Mt,v,ra,ql,$l,pa,Nl,Gl,ca,_l,Cl,ha,Hl,vt,Ws,Jt,q,es,ma,qs,Vl,ua,Rl,xt,ge,Al,kt,x,da,zl,Sl,fa,Ql,Yl,ga,Xl,Tt,$s,Ut,$,as,ya,Ns,Ll,ja,Fl,It,ye,Pl,Zt,ts,ba,Dl,Kl,Gs,Ol,wa,si,ei,Bt,je,ai,Et,_s,Wt,N,ns,Ma,Cs,ti,va,ni,qt,be,li,$t,we,ii,Nt,ls,Ja,oi,ri,xa,pi,Gt,Hs,_t,G,is,ka,Vs,ci,Ta,hi,Ct,Me,mi,Ht,_,os,Ua,Rs,ui,Ia,di,Vt,ve,fi,Rt,rs,C,gi,Za,yi,ji,Ba,bi,wi,Mi,J,vi,Ea,Ji,xi,Wa,ki,Ti,qa,Ui,Ii,At,As,zt,H,ps,$a,zs,Zi,Na,Bi,St,cs,Ei,Je,Wi,qi,Qt,xe,$i,Yt,hs,Ga,Ni,Gi,_a,_i,Xt,Ss,Lt,V,ms,Ca,Qs,Ci,Ha,Hi,Ft,ke,Vi,Pt,Te,Ri,Dt,us,Va,Ai,zi,R,Si,Ue,Qi,Yi,Ie,Xi,Li,Kt,Ys,Ot,A,ds,Ra,Xs,Fi,Aa,Pi,sn,Ze,Di,en,Be,Ki,an,fs,za,Oi,so,Ls,eo,Ee,ao,to,tn,Fs,nn,z,gs,Sa,Ps,no,Qa,lo,ln,We,io,on,qe,oo,rn,Ds,pn,S,ys,Ya,Ks,ro,Xa,po,cn,$e,co,hn,Ne,ho,mn,js,Os,La,mo,uo,se,fo,ee,Fa,go,yo,ae,un,Q,bs,Pa,te,jo,Da,bo,dn,Ge,wo,fn,_e,Mo,gn,Y,ws,Ka,ne,vo,Oa,Jo,yn,Ce,xo,jn,le,bn,k,ko,He,To,Uo,st,Io,Zo,wn;return xs=new b({}),ks=new b({}),Ts=new b({}),Us=new w({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBY2xhc3NpZmllciUyMCUzRCUyMHBpcGVsaW5lKHRhc2slM0QlMjJhdWRpby1jbGFzc2lmaWNhdGlvbiUyMiUyQyUyMG1vZGVsJTNEJTIyc3VwZXJiJTJGaHViZXJ0LWJhc2Utc3VwZXJiLWVyJTIyKSUwQXByZWRzJTIwJTNEJTIwY2xhc3NpZmllciglMjJodHRwcyUzQSUyRiUyRmh1Z2dpbmdmYWNlLmNvJTJGZGF0YXNldHMlMkZOYXJzaWwlMkZhc3JfZHVtbXklMkZyZXNvbHZlJTJGbWFpbiUyRm1say5mbGFjJTIyKSUwQXByZWRzJTIwJTNEJTIwJTVCJTdCJTIyc2NvcmUlMjIlM0ElMjByb3VuZChwcmVkJTVCJTIyc2NvcmUlMjIlNUQlMkMlMjA0KSUyQyUyMCUyMmxhYmVsJTIyJTNBJTIwcHJlZCU1QiUyMmxhYmVsJTIyJTVEJTdEJTIwZm9yJTIwcHJlZCUyMGluJTIwcHJlZHMlNUQlMEFwcmVkcw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

<span class="hljs-meta">&gt;&gt;&gt; </span>classifier = pipeline(task=<span class="hljs-string">&quot;audio-classification&quot;</span>, model=<span class="hljs-string">&quot;superb/hubert-base-superb-er&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>preds = classifier(<span class="hljs-string">&quot;https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>preds = [{<span class="hljs-string">&quot;score&quot;</span>: <span class="hljs-built_in">round</span>(pred[<span class="hljs-string">&quot;score&quot;</span>], <span class="hljs-number">4</span>), <span class="hljs-string">&quot;label&quot;</span>: pred[<span class="hljs-string">&quot;label&quot;</span>]} <span class="hljs-keyword">for</span> pred <span class="hljs-keyword">in</span> preds]
<span class="hljs-meta">&gt;&gt;&gt; </span>preds
[{<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.4532</span>, <span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;hap&#x27;</span>},
 {<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.3622</span>, <span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;sad&#x27;</span>},
 {<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.0943</span>, <span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;neu&#x27;</span>},
 {<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.0903</span>, <span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;ang&#x27;</span>}]`}}),Is=new b({}),Zs=new w({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBdHJhbnNjcmliZXIlMjAlM0QlMjBwaXBlbGluZSh0YXNrJTNEJTIyYXV0b21hdGljLXNwZWVjaC1yZWNvZ25pdGlvbiUyMiUyQyUyMG1vZGVsJTNEJTIyb3BlbmFpJTJGd2hpc3Blci1zbWFsbCUyMiklMEF0cmFuc2NyaWJlciglMjJodHRwcyUzQSUyRiUyRmh1Z2dpbmdmYWNlLmNvJTJGZGF0YXNldHMlMkZOYXJzaWwlMkZhc3JfZHVtbXklMkZyZXNvbHZlJTJGbWFpbiUyRm1say5mbGFjJTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

<span class="hljs-meta">&gt;&gt;&gt; </span>transcriber = pipeline(task=<span class="hljs-string">&quot;automatic-speech-recognition&quot;</span>, model=<span class="hljs-string">&quot;openai/whisper-small&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>transcriber(<span class="hljs-string">&quot;https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac&quot;</span>)
{<span class="hljs-string">&#x27;text&#x27;</span>: <span class="hljs-string">&#x27; I have a dream that one day this nation will rise up and live out the true meaning of its creed.&#x27;</span>}`}}),Bs=new b({}),Es=new b({}),Ws=new w({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBY2xhc3NpZmllciUyMCUzRCUyMHBpcGVsaW5lKHRhc2slM0QlMjJpbWFnZS1jbGFzc2lmaWNhdGlvbiUyMiklMEFwcmVkcyUyMCUzRCUyMGNsYXNzaWZpZXIoJTBBJTIwJTIwJTIwJTIwJTIyaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRmRhdGFzZXRzJTJGaHVnZ2luZ2ZhY2UlMkZkb2N1bWVudGF0aW9uLWltYWdlcyUyRnJlc29sdmUlMkZtYWluJTJGcGlwZWxpbmUtY2F0LWNob25rLmpwZWclMjIlMEEpJTBBcHJlZHMlMjAlM0QlMjAlNUIlN0IlMjJzY29yZSUyMiUzQSUyMHJvdW5kKHByZWQlNUIlMjJzY29yZSUyMiU1RCUyQyUyMDQpJTJDJTIwJTIybGFiZWwlMjIlM0ElMjBwcmVkJTVCJTIybGFiZWwlMjIlNUQlN0QlMjBmb3IlMjBwcmVkJTIwaW4lMjBwcmVkcyU1RCUwQXByaW50KCpwcmVkcyUyQyUyMHNlcCUzRCUyMiU1Q24lMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

<span class="hljs-meta">&gt;&gt;&gt; </span>classifier = pipeline(task=<span class="hljs-string">&quot;image-classification&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>preds = classifier(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg&quot;</span>
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>preds = [{<span class="hljs-string">&quot;score&quot;</span>: <span class="hljs-built_in">round</span>(pred[<span class="hljs-string">&quot;score&quot;</span>], <span class="hljs-number">4</span>), <span class="hljs-string">&quot;label&quot;</span>: pred[<span class="hljs-string">&quot;label&quot;</span>]} <span class="hljs-keyword">for</span> pred <span class="hljs-keyword">in</span> preds]
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(*preds, sep=<span class="hljs-string">&quot;\\n&quot;</span>)
{<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.4335</span>, <span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;lynx, catamount&#x27;</span>}
{<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.0348</span>, <span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;cougar, puma, catamount, mountain lion, painter, panther, Felis concolor&#x27;</span>}
{<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.0324</span>, <span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;snow leopard, ounce, Panthera uncia&#x27;</span>}
{<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.0239</span>, <span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;Egyptian cat&#x27;</span>}
{<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.0229</span>, <span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;tiger cat&#x27;</span>}`}}),qs=new b({}),$s=new w({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBZGV0ZWN0b3IlMjAlM0QlMjBwaXBlbGluZSh0YXNrJTNEJTIyb2JqZWN0LWRldGVjdGlvbiUyMiklMEFwcmVkcyUyMCUzRCUyMGRldGVjdG9yKCUwQSUyMCUyMCUyMCUyMCUyMmh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZkYXRhc2V0cyUyRmh1Z2dpbmdmYWNlJTJGZG9jdW1lbnRhdGlvbi1pbWFnZXMlMkZyZXNvbHZlJTJGbWFpbiUyRnBpcGVsaW5lLWNhdC1jaG9uay5qcGVnJTIyJTBBKSUwQXByZWRzJTIwJTNEJTIwJTVCJTdCJTIyc2NvcmUlMjIlM0ElMjByb3VuZChwcmVkJTVCJTIyc2NvcmUlMjIlNUQlMkMlMjA0KSUyQyUyMCUyMmxhYmVsJTIyJTNBJTIwcHJlZCU1QiUyMmxhYmVsJTIyJTVEJTJDJTIwJTIyYm94JTIyJTNBJTIwcHJlZCU1QiUyMmJveCUyMiU1RCU3RCUyMGZvciUyMHByZWQlMjBpbiUyMHByZWRzJTVEJTBBcHJlZHM=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

<span class="hljs-meta">&gt;&gt;&gt; </span>detector = pipeline(task=<span class="hljs-string">&quot;object-detection&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>preds = detector(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg&quot;</span>
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>preds = [{<span class="hljs-string">&quot;score&quot;</span>: <span class="hljs-built_in">round</span>(pred[<span class="hljs-string">&quot;score&quot;</span>], <span class="hljs-number">4</span>), <span class="hljs-string">&quot;label&quot;</span>: pred[<span class="hljs-string">&quot;label&quot;</span>], <span class="hljs-string">&quot;box&quot;</span>: pred[<span class="hljs-string">&quot;box&quot;</span>]} <span class="hljs-keyword">for</span> pred <span class="hljs-keyword">in</span> preds]
<span class="hljs-meta">&gt;&gt;&gt; </span>preds
[{<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.9865</span>,
  <span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;cat&#x27;</span>,
  <span class="hljs-string">&#x27;box&#x27;</span>: {<span class="hljs-string">&#x27;xmin&#x27;</span>: <span class="hljs-number">178</span>, <span class="hljs-string">&#x27;ymin&#x27;</span>: <span class="hljs-number">154</span>, <span class="hljs-string">&#x27;xmax&#x27;</span>: <span class="hljs-number">882</span>, <span class="hljs-string">&#x27;ymax&#x27;</span>: <span class="hljs-number">598</span>}}]`}}),Ns=new b({}),_s=new w({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBc2VnbWVudGVyJTIwJTNEJTIwcGlwZWxpbmUodGFzayUzRCUyMmltYWdlLXNlZ21lbnRhdGlvbiUyMiklMEFwcmVkcyUyMCUzRCUyMHNlZ21lbnRlciglMEElMjAlMjAlMjAlMjAlMjJodHRwcyUzQSUyRiUyRmh1Z2dpbmdmYWNlLmNvJTJGZGF0YXNldHMlMkZodWdnaW5nZmFjZSUyRmRvY3VtZW50YXRpb24taW1hZ2VzJTJGcmVzb2x2ZSUyRm1haW4lMkZwaXBlbGluZS1jYXQtY2hvbmsuanBlZyUyMiUwQSklMEFwcmVkcyUyMCUzRCUyMCU1QiU3QiUyMnNjb3JlJTIyJTNBJTIwcm91bmQocHJlZCU1QiUyMnNjb3JlJTIyJTVEJTJDJTIwNCklMkMlMjAlMjJsYWJlbCUyMiUzQSUyMHByZWQlNUIlMjJsYWJlbCUyMiU1RCU3RCUyMGZvciUyMHByZWQlMjBpbiUyMHByZWRzJTVEJTBBcHJpbnQoKnByZWRzJTJDJTIwc2VwJTNEJTIyJTVDbiUyMik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

<span class="hljs-meta">&gt;&gt;&gt; </span>segmenter = pipeline(task=<span class="hljs-string">&quot;image-segmentation&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>preds = segmenter(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg&quot;</span>
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>preds = [{<span class="hljs-string">&quot;score&quot;</span>: <span class="hljs-built_in">round</span>(pred[<span class="hljs-string">&quot;score&quot;</span>], <span class="hljs-number">4</span>), <span class="hljs-string">&quot;label&quot;</span>: pred[<span class="hljs-string">&quot;label&quot;</span>]} <span class="hljs-keyword">for</span> pred <span class="hljs-keyword">in</span> preds]
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(*preds, sep=<span class="hljs-string">&quot;\\n&quot;</span>)
{<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.9879</span>, <span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;LABEL_184&#x27;</span>}
{<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.9973</span>, <span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;snow&#x27;</span>}
{<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.9972</span>, <span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;cat&#x27;</span>}`}}),Cs=new b({}),Hs=new w({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBZGVwdGhfZXN0aW1hdG9yJTIwJTNEJTIwcGlwZWxpbmUodGFzayUzRCUyMmRlcHRoLWVzdGltYXRpb24lMjIpJTBBcHJlZHMlMjAlM0QlMjBkZXB0aF9lc3RpbWF0b3IoJTBBJTIwJTIwJTIwJTIwJTIyaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRmRhdGFzZXRzJTJGaHVnZ2luZ2ZhY2UlMkZkb2N1bWVudGF0aW9uLWltYWdlcyUyRnJlc29sdmUlMkZtYWluJTJGcGlwZWxpbmUtY2F0LWNob25rLmpwZWclMjIlMEEp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

<span class="hljs-meta">&gt;&gt;&gt; </span>depth_estimator = pipeline(task=<span class="hljs-string">&quot;depth-estimation&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>preds = depth_estimator(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg&quot;</span>
<span class="hljs-meta">... </span>)`}}),Vs=new b({}),Rs=new b({}),As=new w({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBY2xhc3NpZmllciUyMCUzRCUyMHBpcGVsaW5lKHRhc2slM0QlMjJzZW50aW1lbnQtYW5hbHlzaXMlMjIpJTBBcHJlZHMlMjAlM0QlMjBjbGFzc2lmaWVyKCUyMkh1Z2dpbmclMjBGYWNlJTIwaXMlMjB0aGUlMjBiZXN0JTIwdGhpbmclMjBzaW5jZSUyMHNsaWNlZCUyMGJyZWFkISUyMiklMEFwcmVkcyUyMCUzRCUyMCU1QiU3QiUyMnNjb3JlJTIyJTNBJTIwcm91bmQocHJlZCU1QiUyMnNjb3JlJTIyJTVEJTJDJTIwNCklMkMlMjAlMjJsYWJlbCUyMiUzQSUyMHByZWQlNUIlMjJsYWJlbCUyMiU1RCU3RCUyMGZvciUyMHByZWQlMjBpbiUyMHByZWRzJTVEJTBBcHJlZHM=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

<span class="hljs-meta">&gt;&gt;&gt; </span>classifier = pipeline(task=<span class="hljs-string">&quot;sentiment-analysis&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>preds = classifier(<span class="hljs-string">&quot;Hugging Face is the best thing since sliced bread!&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>preds = [{<span class="hljs-string">&quot;score&quot;</span>: <span class="hljs-built_in">round</span>(pred[<span class="hljs-string">&quot;score&quot;</span>], <span class="hljs-number">4</span>), <span class="hljs-string">&quot;label&quot;</span>: pred[<span class="hljs-string">&quot;label&quot;</span>]} <span class="hljs-keyword">for</span> pred <span class="hljs-keyword">in</span> preds]
<span class="hljs-meta">&gt;&gt;&gt; </span>preds
[{<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.9991</span>, <span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;POSITIVE&#x27;</span>}]`}}),zs=new b({}),Ss=new w({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBY2xhc3NpZmllciUyMCUzRCUyMHBpcGVsaW5lKHRhc2slM0QlMjJuZXIlMjIpJTBBcHJlZHMlMjAlM0QlMjBjbGFzc2lmaWVyKCUyMkh1Z2dpbmclMjBGYWNlJTIwaXMlMjBhJTIwRnJlbmNoJTIwY29tcGFueSUyMGJhc2VkJTIwaW4lMjBOZXclMjBZb3JrJTIwQ2l0eS4lMjIpJTBBcHJlZHMlMjAlM0QlMjAlNUIlMEElMjAlMjAlMjAlMjAlN0IlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJlbnRpdHklMjIlM0ElMjBwcmVkJTVCJTIyZW50aXR5JTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIyc2NvcmUlMjIlM0ElMjByb3VuZChwcmVkJTVCJTIyc2NvcmUlMjIlNUQlMkMlMjA0KSUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMmluZGV4JTIyJTNBJTIwcHJlZCU1QiUyMmluZGV4JTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIyd29yZCUyMiUzQSUyMHByZWQlNUIlMjJ3b3JkJTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIyc3RhcnQlMjIlM0ElMjBwcmVkJTVCJTIyc3RhcnQlMjIlNUQlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJlbmQlMjIlM0ElMjBwcmVkJTVCJTIyZW5kJTIyJTVEJTJDJTBBJTIwJTIwJTIwJTIwJTdEJTBBJTIwJTIwJTIwJTIwZm9yJTIwcHJlZCUyMGluJTIwcHJlZHMlMEElNUQlMEFwcmludCgqcHJlZHMlMkMlMjBzZXAlM0QlMjIlNUNuJTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

<span class="hljs-meta">&gt;&gt;&gt; </span>classifier = pipeline(task=<span class="hljs-string">&quot;ner&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>preds = classifier(<span class="hljs-string">&quot;Hugging Face is a French company based in New York City.&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>preds = [
<span class="hljs-meta">... </span>    {
<span class="hljs-meta">... </span>        <span class="hljs-string">&quot;entity&quot;</span>: pred[<span class="hljs-string">&quot;entity&quot;</span>],
<span class="hljs-meta">... </span>        <span class="hljs-string">&quot;score&quot;</span>: <span class="hljs-built_in">round</span>(pred[<span class="hljs-string">&quot;score&quot;</span>], <span class="hljs-number">4</span>),
<span class="hljs-meta">... </span>        <span class="hljs-string">&quot;index&quot;</span>: pred[<span class="hljs-string">&quot;index&quot;</span>],
<span class="hljs-meta">... </span>        <span class="hljs-string">&quot;word&quot;</span>: pred[<span class="hljs-string">&quot;word&quot;</span>],
<span class="hljs-meta">... </span>        <span class="hljs-string">&quot;start&quot;</span>: pred[<span class="hljs-string">&quot;start&quot;</span>],
<span class="hljs-meta">... </span>        <span class="hljs-string">&quot;end&quot;</span>: pred[<span class="hljs-string">&quot;end&quot;</span>],
<span class="hljs-meta">... </span>    }
<span class="hljs-meta">... </span>    <span class="hljs-keyword">for</span> pred <span class="hljs-keyword">in</span> preds
<span class="hljs-meta">... </span>]
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(*preds, sep=<span class="hljs-string">&quot;\\n&quot;</span>)
{<span class="hljs-string">&#x27;entity&#x27;</span>: <span class="hljs-string">&#x27;I-ORG&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.9968</span>, <span class="hljs-string">&#x27;index&#x27;</span>: <span class="hljs-number">1</span>, <span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;Hu&#x27;</span>, <span class="hljs-string">&#x27;start&#x27;</span>: <span class="hljs-number">0</span>, <span class="hljs-string">&#x27;end&#x27;</span>: <span class="hljs-number">2</span>}
{<span class="hljs-string">&#x27;entity&#x27;</span>: <span class="hljs-string">&#x27;I-ORG&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.9293</span>, <span class="hljs-string">&#x27;index&#x27;</span>: <span class="hljs-number">2</span>, <span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;##gging&#x27;</span>, <span class="hljs-string">&#x27;start&#x27;</span>: <span class="hljs-number">2</span>, <span class="hljs-string">&#x27;end&#x27;</span>: <span class="hljs-number">7</span>}
{<span class="hljs-string">&#x27;entity&#x27;</span>: <span class="hljs-string">&#x27;I-ORG&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.9763</span>, <span class="hljs-string">&#x27;index&#x27;</span>: <span class="hljs-number">3</span>, <span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;Face&#x27;</span>, <span class="hljs-string">&#x27;start&#x27;</span>: <span class="hljs-number">8</span>, <span class="hljs-string">&#x27;end&#x27;</span>: <span class="hljs-number">12</span>}
{<span class="hljs-string">&#x27;entity&#x27;</span>: <span class="hljs-string">&#x27;I-MISC&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.9983</span>, <span class="hljs-string">&#x27;index&#x27;</span>: <span class="hljs-number">6</span>, <span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;French&#x27;</span>, <span class="hljs-string">&#x27;start&#x27;</span>: <span class="hljs-number">18</span>, <span class="hljs-string">&#x27;end&#x27;</span>: <span class="hljs-number">24</span>}
{<span class="hljs-string">&#x27;entity&#x27;</span>: <span class="hljs-string">&#x27;I-LOC&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.999</span>, <span class="hljs-string">&#x27;index&#x27;</span>: <span class="hljs-number">10</span>, <span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;New&#x27;</span>, <span class="hljs-string">&#x27;start&#x27;</span>: <span class="hljs-number">42</span>, <span class="hljs-string">&#x27;end&#x27;</span>: <span class="hljs-number">45</span>}
{<span class="hljs-string">&#x27;entity&#x27;</span>: <span class="hljs-string">&#x27;I-LOC&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.9987</span>, <span class="hljs-string">&#x27;index&#x27;</span>: <span class="hljs-number">11</span>, <span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;York&#x27;</span>, <span class="hljs-string">&#x27;start&#x27;</span>: <span class="hljs-number">46</span>, <span class="hljs-string">&#x27;end&#x27;</span>: <span class="hljs-number">50</span>}
{<span class="hljs-string">&#x27;entity&#x27;</span>: <span class="hljs-string">&#x27;I-LOC&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.9992</span>, <span class="hljs-string">&#x27;index&#x27;</span>: <span class="hljs-number">12</span>, <span class="hljs-string">&#x27;word&#x27;</span>: <span class="hljs-string">&#x27;City&#x27;</span>, <span class="hljs-string">&#x27;start&#x27;</span>: <span class="hljs-number">51</span>, <span class="hljs-string">&#x27;end&#x27;</span>: <span class="hljs-number">55</span>}`}}),Qs=new b({}),Ys=new w({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBcXVlc3Rpb25fYW5zd2VyZXIlMjAlM0QlMjBwaXBlbGluZSh0YXNrJTNEJTIycXVlc3Rpb24tYW5zd2VyaW5nJTIyKSUwQXByZWRzJTIwJTNEJTIwcXVlc3Rpb25fYW5zd2VyZXIoJTBBJTIwJTIwJTIwJTIwcXVlc3Rpb24lM0QlMjJXaGF0JTIwaXMlMjB0aGUlMjBuYW1lJTIwb2YlMjB0aGUlMjByZXBvc2l0b3J5JTNGJTIyJTJDJTBBJTIwJTIwJTIwJTIwY29udGV4dCUzRCUyMlRoZSUyMG5hbWUlMjBvZiUyMHRoZSUyMHJlcG9zaXRvcnklMjBpcyUyMGh1Z2dpbmdmYWNlJTJGdHJhbnNmb3JtZXJzJTIyJTJDJTBBKSUwQXByaW50KCUwQSUyMCUyMCUyMCUyMGYlMjJzY29yZSUzQSUyMCU3QnJvdW5kKHByZWRzJTVCJ3Njb3JlJyU1RCUyQyUyMDQpJTdEJTJDJTIwc3RhcnQlM0ElMjAlN0JwcmVkcyU1QidzdGFydCclNUQlN0QlMkMlMjBlbmQlM0ElMjAlN0JwcmVkcyU1QidlbmQnJTVEJTdEJTJDJTIwYW5zd2VyJTNBJTIwJTdCcHJlZHMlNUInYW5zd2VyJyU1RCU3RCUyMiUwQSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

<span class="hljs-meta">&gt;&gt;&gt; </span>question_answerer = pipeline(task=<span class="hljs-string">&quot;question-answering&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>preds = question_answerer(
<span class="hljs-meta">... </span>    question=<span class="hljs-string">&quot;What is the name of the repository?&quot;</span>,
<span class="hljs-meta">... </span>    context=<span class="hljs-string">&quot;The name of the repository is huggingface/transformers&quot;</span>,
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(
<span class="hljs-meta">... </span>    <span class="hljs-string">f&quot;score: <span class="hljs-subst">{<span class="hljs-built_in">round</span>(preds[<span class="hljs-string">&#x27;score&#x27;</span>], <span class="hljs-number">4</span>)}</span>, start: <span class="hljs-subst">{preds[<span class="hljs-string">&#x27;start&#x27;</span>]}</span>, end: <span class="hljs-subst">{preds[<span class="hljs-string">&#x27;end&#x27;</span>]}</span>, answer: <span class="hljs-subst">{preds[<span class="hljs-string">&#x27;answer&#x27;</span>]}</span>&quot;</span>
<span class="hljs-meta">... </span>)
score: <span class="hljs-number">0.9327</span>, start: <span class="hljs-number">30</span>, end: <span class="hljs-number">54</span>, answer: huggingface/transformers`}}),Xs=new b({}),Fs=new w({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBc3VtbWFyaXplciUyMCUzRCUyMHBpcGVsaW5lKHRhc2slM0QlMjJzdW1tYXJpemF0aW9uJTIyKSUwQXN1bW1hcml6ZXIoJTBBJTIwJTIwJTIwJTIwJTIySW4lMjB0aGlzJTIwd29yayUyQyUyMHdlJTIwcHJlc2VudGVkJTIwdGhlJTIwVHJhbnNmb3JtZXIlMkMlMjB0aGUlMjBmaXJzdCUyMHNlcXVlbmNlJTIwdHJhbnNkdWN0aW9uJTIwbW9kZWwlMjBiYXNlZCUyMGVudGlyZWx5JTIwb24lMjBhdHRlbnRpb24lMkMlMjByZXBsYWNpbmclMjB0aGUlMjByZWN1cnJlbnQlMjBsYXllcnMlMjBtb3N0JTIwY29tbW9ubHklMjB1c2VkJTIwaW4lMjBlbmNvZGVyLWRlY29kZXIlMjBhcmNoaXRlY3R1cmVzJTIwd2l0aCUyMG11bHRpLWhlYWRlZCUyMHNlbGYtYXR0ZW50aW9uLiUyMEZvciUyMHRyYW5zbGF0aW9uJTIwdGFza3MlMkMlMjB0aGUlMjBUcmFuc2Zvcm1lciUyMGNhbiUyMGJlJTIwdHJhaW5lZCUyMHNpZ25pZmljYW50bHklMjBmYXN0ZXIlMjB0aGFuJTIwYXJjaGl0ZWN0dXJlcyUyMGJhc2VkJTIwb24lMjByZWN1cnJlbnQlMjBvciUyMGNvbnZvbHV0aW9uYWwlMjBsYXllcnMuJTIwT24lMjBib3RoJTIwV01UJTIwMjAxNCUyMEVuZ2xpc2gtdG8tR2VybWFuJTIwYW5kJTIwV01UJTIwMjAxNCUyMEVuZ2xpc2gtdG8tRnJlbmNoJTIwdHJhbnNsYXRpb24lMjB0YXNrcyUyQyUyMHdlJTIwYWNoaWV2ZSUyMGElMjBuZXclMjBzdGF0ZSUyMG9mJTIwdGhlJTIwYXJ0LiUyMEluJTIwdGhlJTIwZm9ybWVyJTIwdGFzayUyMG91ciUyMGJlc3QlMjBtb2RlbCUyMG91dHBlcmZvcm1zJTIwZXZlbiUyMGFsbCUyMHByZXZpb3VzbHklMjByZXBvcnRlZCUyMGVuc2VtYmxlcy4lMjIlMEEp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

<span class="hljs-meta">&gt;&gt;&gt; </span>summarizer = pipeline(task=<span class="hljs-string">&quot;summarization&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>summarizer(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;In this work, we presented the Transformer, the first sequence transduction model based entirely on attention, replacing the recurrent layers most commonly used in encoder-decoder architectures with multi-headed self-attention. For translation tasks, the Transformer can be trained significantly faster than architectures based on recurrent or convolutional layers. On both WMT 2014 English-to-German and WMT 2014 English-to-French translation tasks, we achieve a new state of the art. In the former task our best model outperforms even all previously reported ensembles.&quot;</span>
<span class="hljs-meta">... </span>)
[{<span class="hljs-string">&#x27;summary_text&#x27;</span>: <span class="hljs-string">&#x27; The Transformer is the first sequence transduction model based entirely on attention . It replaces the recurrent layers most commonly used in encoder-decoder architectures with multi-headed self-attention . For translation tasks, the Transformer can be trained significantly faster than architectures based on recurrent or convolutional layers .&#x27;</span>}]`}}),Ps=new b({}),Ds=new w({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBdGV4dCUyMCUzRCUyMCUyMnRyYW5zbGF0ZSUyMEVuZ2xpc2glMjB0byUyMEZyZW5jaCUzQSUyMEh1Z2dpbmclMjBGYWNlJTIwaXMlMjBhJTIwY29tbXVuaXR5LWJhc2VkJTIwb3Blbi1zb3VyY2UlMjBwbGF0Zm9ybSUyMGZvciUyMG1hY2hpbmUlMjBsZWFybmluZy4lMjIlMEF0cmFuc2xhdG9yJTIwJTNEJTIwcGlwZWxpbmUodGFzayUzRCUyMnRyYW5zbGF0aW9uJTIyJTJDJTIwbW9kZWwlM0QlMjJ0NS1zbWFsbCUyMiklMEF0cmFuc2xhdG9yKHRleHQp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

<span class="hljs-meta">&gt;&gt;&gt; </span>text = <span class="hljs-string">&quot;translate English to French: Hugging Face is a community-based open-source platform for machine learning.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>translator = pipeline(task=<span class="hljs-string">&quot;translation&quot;</span>, model=<span class="hljs-string">&quot;t5-small&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>translator(text)
[{<span class="hljs-string">&#x27;translation_text&#x27;</span>: <span class="hljs-string">&quot;Hugging Face est une tribune communautaire de l&#x27;apprentissage des machines.&quot;</span>}]`}}),Ks=new b({}),se=new w({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBcHJvbXB0JTIwJTNEJTIwJTIySHVnZ2luZyUyMEZhY2UlMjBpcyUyMGElMjBjb21tdW5pdHktYmFzZWQlMjBvcGVuLXNvdXJjZSUyMHBsYXRmb3JtJTIwZm9yJTIwbWFjaGluZSUyMGxlYXJuaW5nLiUyMiUwQWdlbmVyYXRvciUyMCUzRCUyMHBpcGVsaW5lKHRhc2slM0QlMjJ0ZXh0LWdlbmVyYXRpb24lMjIpJTBBZ2VuZXJhdG9yKHByb21wdCklMjAlMjAlMjMlMjBkb2N0ZXN0JTNBJTIwJTJCU0tJUA==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

<span class="hljs-meta">&gt;&gt;&gt; </span>prompt = <span class="hljs-string">&quot;Hugging Face is a community-based open-source platform for machine learning.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>generator = pipeline(task=<span class="hljs-string">&quot;text-generation&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>generator(prompt)  <span class="hljs-comment"># doctest: +SKIP</span>`}}),ae=new w({props:{code:"dGV4dCUyMCUzRCUyMCUyMkh1Z2dpbmclMjBGYWNlJTIwaXMlMjBhJTIwY29tbXVuaXR5LWJhc2VkJTIwb3Blbi1zb3VyY2UlMjAlM0NtYXNrJTNFJTIwZm9yJTIwbWFjaGluZSUyMGxlYXJuaW5nLiUyMiUwQWZpbGxfbWFzayUyMCUzRCUyMHBpcGVsaW5lKHRhc2slM0QlMjJmaWxsLW1hc2slMjIpJTBBcHJlZHMlMjAlM0QlMjBmaWxsX21hc2sodGV4dCUyQyUyMHRvcF9rJTNEMSklMEFwcmVkcyUyMCUzRCUyMCU1QiUwQSUyMCUyMCUyMCUyMCU3QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMnNjb3JlJTIyJTNBJTIwcm91bmQocHJlZCU1QiUyMnNjb3JlJTIyJTVEJTJDJTIwNCklMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJ0b2tlbiUyMiUzQSUyMHByZWQlNUIlMjJ0b2tlbiUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMnRva2VuX3N0ciUyMiUzQSUyMHByZWQlNUIlMjJ0b2tlbl9zdHIlMjIlNUQlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJzZXF1ZW5jZSUyMiUzQSUyMHByZWQlNUIlMjJzZXF1ZW5jZSUyMiU1RCUyQyUwQSUyMCUyMCUyMCUyMCU3RCUwQSUyMCUyMCUyMCUyMGZvciUyMHByZWQlMjBpbiUyMHByZWRzJTBBJTVEJTBBcHJlZHM=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>text = <span class="hljs-string">&quot;Hugging Face is a community-based open-source &lt;mask&gt; for machine learning.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>fill_mask = pipeline(task=<span class="hljs-string">&quot;fill-mask&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>preds = fill_mask(text, top_k=<span class="hljs-number">1</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>preds = [
<span class="hljs-meta">... </span>    {
<span class="hljs-meta">... </span>        <span class="hljs-string">&quot;score&quot;</span>: <span class="hljs-built_in">round</span>(pred[<span class="hljs-string">&quot;score&quot;</span>], <span class="hljs-number">4</span>),
<span class="hljs-meta">... </span>        <span class="hljs-string">&quot;token&quot;</span>: pred[<span class="hljs-string">&quot;token&quot;</span>],
<span class="hljs-meta">... </span>        <span class="hljs-string">&quot;token_str&quot;</span>: pred[<span class="hljs-string">&quot;token_str&quot;</span>],
<span class="hljs-meta">... </span>        <span class="hljs-string">&quot;sequence&quot;</span>: pred[<span class="hljs-string">&quot;sequence&quot;</span>],
<span class="hljs-meta">... </span>    }
<span class="hljs-meta">... </span>    <span class="hljs-keyword">for</span> pred <span class="hljs-keyword">in</span> preds
<span class="hljs-meta">... </span>]
<span class="hljs-meta">&gt;&gt;&gt; </span>preds
[{<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.2236</span>,
  <span class="hljs-string">&#x27;token&#x27;</span>: <span class="hljs-number">1761</span>,
  <span class="hljs-string">&#x27;token_str&#x27;</span>: <span class="hljs-string">&#x27; platform&#x27;</span>,
  <span class="hljs-string">&#x27;sequence&#x27;</span>: <span class="hljs-string">&#x27;Hugging Face is a community-based open-source platform for machine learning.&#x27;</span>}]`}}),te=new b({}),ne=new b({}),le=new w({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBZnJvbSUyMFBJTCUyMGltcG9ydCUyMEltYWdlJTBBaW1wb3J0JTIwcmVxdWVzdHMlMEElMEF1cmwlMjAlM0QlMjAlMjJodHRwcyUzQSUyRiUyRmRhdGFzZXRzLXNlcnZlci5odWdnaW5nZmFjZS5jbyUyRmFzc2V0cyUyRmhmLWludGVybmFsLXRlc3RpbmclMkZleGFtcGxlLWRvY3VtZW50cyUyRi0tJTJGaGYtaW50ZXJuYWwtdGVzdGluZy0tZXhhbXBsZS1kb2N1bWVudHMlMkZ0ZXN0JTJGMiUyRmltYWdlJTJGaW1hZ2UuanBnJTIyJTBBaW1hZ2UlMjAlM0QlMjBJbWFnZS5vcGVuKHJlcXVlc3RzLmdldCh1cmwlMkMlMjBzdHJlYW0lM0RUcnVlKS5yYXcpJTBBJTBBZG9jX3F1ZXN0aW9uX2Fuc3dlcmVyJTIwJTNEJTIwcGlwZWxpbmUoJTIyZG9jdW1lbnQtcXVlc3Rpb24tYW5zd2VyaW5nJTIyJTJDJTIwbW9kZWwlM0QlMjJtYWdvcnNodW5vdiUyRmxheW91dGxtLWludm9pY2VzJTIyKSUwQXByZWRzJTIwJTNEJTIwZG9jX3F1ZXN0aW9uX2Fuc3dlcmVyKCUwQSUyMCUyMCUyMCUyMHF1ZXN0aW9uJTNEJTIyV2hhdCUyMGlzJTIwdGhlJTIwdG90YWwlMjBhbW91bnQlM0YlMjIlMkMlMEElMjAlMjAlMjAlMjBpbWFnZSUzRGltYWdlJTJDJTBBKSUwQXByZWRz",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> PIL <span class="hljs-keyword">import</span> Image
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> requests

<span class="hljs-meta">&gt;&gt;&gt; </span>url = <span class="hljs-string">&quot;https://datasets-server.huggingface.co/assets/hf-internal-testing/example-documents/--/hf-internal-testing--example-documents/test/2/image/image.jpg&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>image = Image.<span class="hljs-built_in">open</span>(requests.get(url, stream=<span class="hljs-literal">True</span>).raw)

<span class="hljs-meta">&gt;&gt;&gt; </span>doc_question_answerer = pipeline(<span class="hljs-string">&quot;document-question-answering&quot;</span>, model=<span class="hljs-string">&quot;magorshunov/layoutlm-invoices&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>preds = doc_question_answerer(
<span class="hljs-meta">... </span>    question=<span class="hljs-string">&quot;What is the total amount?&quot;</span>,
<span class="hljs-meta">... </span>    image=image,
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>preds
[{<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.8531</span>, <span class="hljs-string">&#x27;answer&#x27;</span>: <span class="hljs-string">&#x27;17,000&#x27;</span>, <span class="hljs-string">&#x27;start&#x27;</span>: <span class="hljs-number">4</span>, <span class="hljs-string">&#x27;end&#x27;</span>: <span class="hljs-number">4</span>}]`}}),{c(){T=t("meta"),et=r(),U=t("h1"),X=t("a"),Se=t("span"),u(xs.$$.fragment),On=r(),Qe=t("span"),sl=c("What \u{1F917} Transformers can do"),at=r(),ie=t("p"),el=c("\u{1F917} Transformers is a library of pretrained state-of-the-art models for natural language processing (NLP), computer vision, and audio and speech processing tasks. Not only does the library contain Transformer models, but it also has non-Transformer models like modern convolutional networks for computer vision tasks. If you look at some of the most popular consumer products today, like smartphones, apps, and televisions, odds are that some kind of deep learning technology is behind it. Want to remove a background object from a picture taken by your smartphone? This is an example of a panoptic segmentation task (don\u2019t worry if you don\u2019t know what this means yet, we\u2019ll describe it in the following sections!)."),tt=r(),oe=t("p"),al=c("This page provides an overview of the different speech and audio, computer vision, and NLP tasks that can be solved with the \u{1F917} Transformers library in just three lines of code!"),nt=r(),I=t("h2"),L=t("a"),Ye=t("span"),u(ks.$$.fragment),tl=r(),Xe=t("span"),nl=c("Audio"),lt=r(),re=t("p"),ll=c("Audio and speech processing tasks are a little different from the other modalities mainly because audio as an input is a continuous signal. Unlike text, a raw audio waveform can\u2019t be neatly split into discrete chunks the way a sentence can be divided into words. To get around this, the raw audio signal is typically sampled at regular intervals. If you take more samples within an interval, the sampling rate is higher, and the audio more closely resembles the original audio source."),it=r(),pe=t("p"),il=c("Previous approaches preprocessed the audio to extract useful features from it. It is now more common to start audio and speech processing tasks by directly feeding the raw audio waveform to a feature encoder to extract an audio representation. This simplifies the preprocessing step and allows the model to learn the most essential features."),ot=r(),Z=t("h3"),F=t("a"),Le=t("span"),u(Ts.$$.fragment),ol=r(),Fe=t("span"),rl=c("Audio classification"),rt=r(),ce=t("p"),pl=c("Audio classification is a task that labels audio data from a predefined set of classes. It is a broad category with many specific applications, some of which include:"),pt=r(),M=t("ul"),Pe=t("li"),cl=c("acoustic scene classification: label audio with a scene label (\u201Coffice\u201D, \u201Cbeach\u201D, \u201Cstadium\u201D)"),hl=r(),De=t("li"),ml=c("acoustic event detection: label audio with a sound event label (\u201Ccar horn\u201D, \u201Cwhale calling\u201D, \u201Cglass breaking\u201D)"),ul=r(),Ke=t("li"),dl=c("tagging: label audio containing multiple sounds (birdsongs, speaker identification in a meeting)"),fl=r(),Oe=t("li"),gl=c("music classification: label music with a genre label (\u201Cmetal\u201D, \u201Chip-hop\u201D, \u201Ccountry\u201D)"),ct=r(),u(Us.$$.fragment),ht=r(),B=t("h3"),P=t("a"),sa=t("span"),u(Is.$$.fragment),yl=r(),ea=t("span"),jl=c("Automatic speech recognition"),mt=r(),he=t("p"),bl=c("Automatic speech recognition (ASR) transcribes speech into text. It is one of the most common audio tasks due partly to speech being such a natural form of human communication. Today, ASR systems are embedded in \u201Csmart\u201D technology products like speakers, phones, and cars. We can ask our virtual assistants to play music, set reminders, and tell us the weather."),ut=r(),me=t("p"),wl=c("But one of the key challenges Transformer architectures have helped with is in low-resource languages. By pretraining on large amounts of speech data, finetuning the model on only one hour of labeled speech data in a low-resource language can still produce high-quality results compared to previous ASR systems trained on 100x more labeled data."),dt=r(),u(Zs.$$.fragment),ft=r(),E=t("h2"),D=t("a"),aa=t("span"),u(Bs.$$.fragment),Ml=r(),ta=t("span"),vl=c("Computer vision"),gt=r(),K=t("p"),Jl=c("One of the first and earliest successful computer vision tasks was recognizing images of zip code numbers using a "),ue=t("a"),xl=c("convolutional neural network (CNN)"),kl=c(". An image is composed of pixels, and each pixel has a numerical value. This makes it easy to represent an image as a matrix of pixel values. Each particular combination of pixel values describes the colors of an image."),yt=r(),de=t("p"),Tl=c("Two general ways computer vision tasks can be solved are:"),jt=r(),O=t("ol"),na=t("li"),Ul=c("Use convolutions to learn the hierarchical features of an image from low-level features to high-level abstract things."),Il=r(),la=t("li"),Zl=c("Split an image into patches and use a Transformer to gradually learn how each image patch is related to each other to form an image. Unlike the bottom-up approach favored by a CNN, this is kind of like starting out with a blurry image and then gradually bringing it into focus."),bt=r(),W=t("h3"),ss=t("a"),ia=t("span"),u(Es.$$.fragment),Bl=r(),oa=t("span"),El=c("Image classification"),wt=r(),fe=t("p"),Wl=c("Image classification labels an entire image from a predefined set of classes. Like most classification tasks, there are many practical use cases for image classification, some of which include:"),Mt=r(),v=t("ul"),ra=t("li"),ql=c("healthcare: label medical images to detect disease or monitor patient health"),$l=r(),pa=t("li"),Nl=c("environment: label satellite images to monitor deforestation, inform wildland management or detect wildfires"),Gl=r(),ca=t("li"),_l=c("agriculture: label images of crops to monitor plant health or satellite images for land use monitoring"),Cl=r(),ha=t("li"),Hl=c("ecology: label images of animal or plant species to monitor wildlife populations or track endangered species"),vt=r(),u(Ws.$$.fragment),Jt=r(),q=t("h3"),es=t("a"),ma=t("span"),u(qs.$$.fragment),Vl=r(),ua=t("span"),Rl=c("Object detection"),xt=r(),ge=t("p"),Al=c("Unlike image classification, object detection identifies multiple objects within an image and the objects\u2019 positions in an image (defined by the bounding box). Some example applications of object detection include:"),kt=r(),x=t("ul"),da=t("li"),zl=c("self-driving vehicles: detect everyday traffic objects such as other vehicles, pedestrians, and traffic lights"),Sl=r(),fa=t("li"),Ql=c("remote sensing: disaster monitoring, urban planning, and weather forecasting"),Yl=r(),ga=t("li"),Xl=c("defect detection: detect cracks or structural damage in buildings, and manufacturing defects"),Tt=r(),u($s.$$.fragment),Ut=r(),$=t("h3"),as=t("a"),ya=t("span"),u(Ns.$$.fragment),Ll=r(),ja=t("span"),Fl=c("Image segmentation"),It=r(),ye=t("p"),Pl=c("Image segmentation is a pixel-level task that assigns every pixel in an image to a class. It differs from object detection, which uses bounding boxes to label and predict objects in an image because segmentation is more granular. Segmentation can detect objects at a pixel-level. There are several types of image segmentation:"),Zt=r(),ts=t("ul"),ba=t("li"),Dl=c("instance segmentation: in addition to labeling the class of an object, it also labels each distinct instance of an object (\u201Cdog-1\u201D, \u201Cdog-2\u201D)"),Kl=r(),Gs=t("li"),Ol=c("panoptic segmentation: a combination of semantic and instance segmentation; it labels each pixel with a semantic class "),wa=t("strong"),si=c("and"),ei=c(" each distinct instance of an object"),Bt=r(),je=t("p"),ai=c("Segmentation tasks are helpful in self-driving vehicles to create a pixel-level map of the world around them so they can navigate safely around pedestrians and other vehicles. It is also useful for medical imaging, where the task\u2019s finer granularity can help identify abnormal cells or organ features. Image segmentation can also be used in ecommerce to virtually try on clothes or create augmented reality experiences by overlaying objects in the real world through your camera."),Et=r(),u(_s.$$.fragment),Wt=r(),N=t("h3"),ns=t("a"),Ma=t("span"),u(Cs.$$.fragment),ti=r(),va=t("span"),ni=c("Depth estimation"),qt=r(),be=t("p"),li=c("Depth estimation predicts the distance of each pixel in an image from the camera. This computer vision task is especially important for scene understanding and reconstruction. For example, in self-driving cars, vehicles need to understand how far objects like pedestrians, traffic signs, and other vehicles are to avoid obstacles and collisions. Depth information is also helpful for constructing 3D representations from 2D images and can be used to create high-quality 3D representations of biological structures or buildings."),$t=r(),we=t("p"),ii=c("There are two approaches to depth estimation:"),Nt=r(),ls=t("ul"),Ja=t("li"),oi=c("stereo: depths are estimated by comparing two images of the same image from slightly different angles"),ri=r(),xa=t("li"),pi=c("monocular: depths are estimated from a single image"),Gt=r(),u(Hs.$$.fragment),_t=r(),G=t("h2"),is=t("a"),ka=t("span"),u(Vs.$$.fragment),ci=r(),Ta=t("span"),hi=c("Natural language processing"),Ct=r(),Me=t("p"),mi=c("NLP tasks are among the most common types of tasks because text is such a natural way for us to communicate. To get text into a format recognized by a model, it needs to be tokenized. This means dividing a sequence of text into separate words or subwords (tokens) and then converting these tokens into numbers. As a result, you can represent a sequence of text as a sequence of numbers, and once you have a sequence of numbers, it can be input into a model to solve all sorts of NLP tasks!"),Ht=r(),_=t("h3"),os=t("a"),Ua=t("span"),u(Rs.$$.fragment),ui=r(),Ia=t("span"),di=c("Text classification"),Vt=r(),ve=t("p"),fi=c("Like classification tasks in any modality, text classification labels a sequence of text (it can be sentence-level, a paragraph, or a document) from a predefined set of classes. There are many practical applications for text classification, some of which include:"),Rt=r(),rs=t("ul"),C=t("li"),gi=c("sentiment analysis: label text according to some polarity like "),Za=t("code"),yi=c("positive"),ji=c(" or "),Ba=t("code"),bi=c("negative"),wi=c(" which can inform and support decision-making in fields like politics, finance, and marketing"),Mi=r(),J=t("li"),vi=c("content classification: label text according to some topic to help organize and filter information in news and social media feeds ("),Ea=t("code"),Ji=c("weather"),xi=c(", "),Wa=t("code"),ki=c("sports"),Ti=c(", "),qa=t("code"),Ui=c("finance"),Ii=c(", etc.)"),At=r(),u(As.$$.fragment),zt=r(),H=t("h3"),ps=t("a"),$a=t("span"),u(zs.$$.fragment),Zi=r(),Na=t("span"),Bi=c("Token classification"),St=r(),cs=t("p"),Ei=c("In any NLP task, text is preprocessed by separating the sequence of text into individual words or subwords. These are known as "),Je=t("a"),Wi=c("tokens"),qi=c(". Token classification assigns each token a label from a predefined set of classes."),Qt=r(),xe=t("p"),$i=c("Two common types of token classification are:"),Yt=r(),hs=t("ul"),Ga=t("li"),Ni=c("named entity recognition (NER): label a token according to an entity category like organization, person, location or date. NER is especially popular in biomedical settings, where it can label genes, proteins, and drug names."),Gi=r(),_a=t("li"),_i=c("part-of-speech tagging (POS): label a token according to its part-of-speech like noun, verb, or adjective. POS is useful for helping translation systems understand how two identical words are grammatically different (bank as a noun versus bank as a verb)."),Xt=r(),u(Ss.$$.fragment),Lt=r(),V=t("h3"),ms=t("a"),Ca=t("span"),u(Qs.$$.fragment),Ci=r(),Ha=t("span"),Hi=c("Question answering"),Ft=r(),ke=t("p"),Vi=c("Question answering is another token-level task that returns an answer to a question, sometimes with context (open-domain) and other times without context (closed-domain). This task happens whenever we ask a virtual assistant something like whether a restaurant is open. It can also provide customer or technical support and help search engines retrieve the relevant information you\u2019re asking for."),Pt=r(),Te=t("p"),Ri=c("There are two common types of question answering:"),Dt=r(),us=t("ul"),Va=t("li"),Ai=c("extractive: given a question and some context, the answer is a span of text from the context the model must extract"),zi=r(),R=t("li"),Si=c("abstractive: given a question and some context, the answer is generated from the context; this approach is handled by the "),Ue=t("a"),Qi=c("Text2TextGenerationPipeline"),Yi=c(" instead of the "),Ie=t("a"),Xi=c("QuestionAnsweringPipeline"),Li=c(" shown below"),Kt=r(),u(Ys.$$.fragment),Ot=r(),A=t("h3"),ds=t("a"),Ra=t("span"),u(Xs.$$.fragment),Fi=r(),Aa=t("span"),Pi=c("Summarization"),sn=r(),Ze=t("p"),Di=c("Summarization creates a shorter version of a text from a longer one while trying to preserve most of the meaning of the original document. Summarization is a sequence-to-sequence task; it outputs a shorter text sequence than the input. There are a lot of long-form documents that can be summarized to help readers quickly understand the main points. Legislative bills, legal and financial documents, patents, and scientific papers are a few examples of documents that could be summarized to save readers time and serve as a reading aid."),en=r(),Be=t("p"),Ki=c("Like question answering, there are two types of summarization:"),an=r(),fs=t("ul"),za=t("li"),Oi=c("extractive: identify and extract the most important sentences from the original text"),so=r(),Ls=t("li"),eo=c("abstractive: generate the target summary (which may include new words not in the input document) from the original text; the "),Ee=t("a"),ao=c("SummarizationPipeline"),to=c(" uses the abstractive approach"),tn=r(),u(Fs.$$.fragment),nn=r(),z=t("h3"),gs=t("a"),Sa=t("span"),u(Ps.$$.fragment),no=r(),Qa=t("span"),lo=c("Translation"),ln=r(),We=t("p"),io=c("Translation converts a sequence of text in one language to another. It is important in helping people from different backgrounds communicate with each other, help translate content to reach wider audiences, and even be a learning tool to help people learn a new language. Along with summarization, translation is a sequence-to-sequence task, meaning the model receives an input sequence and returns a target output sequence."),on=r(),qe=t("p"),oo=c("In the early days, translation models were mostly monolingual, but recently, there has been increasing interest in multilingual models that can translate between many pairs of languages."),rn=r(),u(Ds.$$.fragment),pn=r(),S=t("h3"),ys=t("a"),Ya=t("span"),u(Ks.$$.fragment),ro=r(),Xa=t("span"),po=c("Language modeling"),cn=r(),$e=t("p"),co=c("Language modeling is a task that predicts a word in a sequence of text. It has become a very popular NLP task because a pretrained language model can be finetuned for many other downstream tasks. Lately, there has been a lot of interest in large language models (LLMs) which demonstrate zero- or few-shot learning. This means the model can solve tasks it wasn\u2019t explicitly trained to do! Language models can be used to generate fluent and convincing text, though you need to be careful since the text may not always be accurate."),hn=r(),Ne=t("p"),ho=c("There are two types of language modeling:"),mn=r(),js=t("ul"),Os=t("li"),La=t("p"),mo=c("causal: the model\u2019s objective is to predict the next token in a sequence, and future tokens are masked"),uo=r(),u(se.$$.fragment),fo=r(),ee=t("li"),Fa=t("p"),go=c("masked: the model\u2019s objective is to predict a masked token in a sequence with full access to the tokens in the sequence"),yo=r(),u(ae.$$.fragment),un=r(),Q=t("h2"),bs=t("a"),Pa=t("span"),u(te.$$.fragment),jo=r(),Da=t("span"),bo=c("Multimodal"),dn=r(),Ge=t("p"),wo=c("Multimodal tasks require a model to process multiple data modalities (text, image, audio, video) to solve a particular problem. Image captioning is an example of a multimodal task where the model takes an image as input and outputs a sequence of text describing the image or some properties of the image."),fn=r(),_e=t("p"),Mo=c("Although multimodal models work with different data types or modalities, internally, the preprocessing steps help the model convert all the data types into embeddings (vectors or list of numbers that holds meaningful information about the data). For a task like image captioning, the model learns relationships between image embeddings and text embeddings."),gn=r(),Y=t("h3"),ws=t("a"),Ka=t("span"),u(ne.$$.fragment),vo=r(),Oa=t("span"),Jo=c("Document question answering"),yn=r(),Ce=t("p"),xo=c("Document question answering is a task that answers natural language questions from a document. Unlike a token-level question answering task which takes text as input, document question answering takes an image of a document as input along with a question about the document and returns an answer. Document question answering can be used to parse structured documents and extract key information from it. In the example below, the total amount and change due can be extracted from a receipt."),jn=r(),u(le.$$.fragment),bn=r(),k=t("p"),ko=c("Hopefully, this page has given you some more background information about all the types of tasks in each modality and the practical importance of each one. In the next "),He=t("a"),To=c("section"),Uo=c(", you\u2019ll learn "),st=t("strong"),Io=c("how"),Zo=c(" \u{1F917} Transformers work to solve these tasks."),this.h()},l(s){const i=zp('[data-svelte="svelte-1phssyn"]',document.head);T=n(i,"META",{name:!0,content:!0}),i.forEach(e),et=p(s),U=n(s,"H1",{class:!0});var Mn=l(U);X=n(Mn,"A",{id:!0,class:!0,href:!0});var Eo=l(X);Se=n(Eo,"SPAN",{});var Wo=l(Se);d(xs.$$.fragment,Wo),Wo.forEach(e),Eo.forEach(e),On=p(Mn),Qe=n(Mn,"SPAN",{});var qo=l(Qe);sl=h(qo,"What \u{1F917} Transformers can do"),qo.forEach(e),Mn.forEach(e),at=p(s),ie=n(s,"P",{});var $o=l(ie);el=h($o,"\u{1F917} Transformers is a library of pretrained state-of-the-art models for natural language processing (NLP), computer vision, and audio and speech processing tasks. Not only does the library contain Transformer models, but it also has non-Transformer models like modern convolutional networks for computer vision tasks. If you look at some of the most popular consumer products today, like smartphones, apps, and televisions, odds are that some kind of deep learning technology is behind it. Want to remove a background object from a picture taken by your smartphone? This is an example of a panoptic segmentation task (don\u2019t worry if you don\u2019t know what this means yet, we\u2019ll describe it in the following sections!)."),$o.forEach(e),tt=p(s),oe=n(s,"P",{});var No=l(oe);al=h(No,"This page provides an overview of the different speech and audio, computer vision, and NLP tasks that can be solved with the \u{1F917} Transformers library in just three lines of code!"),No.forEach(e),nt=p(s),I=n(s,"H2",{class:!0});var vn=l(I);L=n(vn,"A",{id:!0,class:!0,href:!0});var Go=l(L);Ye=n(Go,"SPAN",{});var _o=l(Ye);d(ks.$$.fragment,_o),_o.forEach(e),Go.forEach(e),tl=p(vn),Xe=n(vn,"SPAN",{});var Co=l(Xe);nl=h(Co,"Audio"),Co.forEach(e),vn.forEach(e),lt=p(s),re=n(s,"P",{});var Ho=l(re);ll=h(Ho,"Audio and speech processing tasks are a little different from the other modalities mainly because audio as an input is a continuous signal. Unlike text, a raw audio waveform can\u2019t be neatly split into discrete chunks the way a sentence can be divided into words. To get around this, the raw audio signal is typically sampled at regular intervals. If you take more samples within an interval, the sampling rate is higher, and the audio more closely resembles the original audio source."),Ho.forEach(e),it=p(s),pe=n(s,"P",{});var Vo=l(pe);il=h(Vo,"Previous approaches preprocessed the audio to extract useful features from it. It is now more common to start audio and speech processing tasks by directly feeding the raw audio waveform to a feature encoder to extract an audio representation. This simplifies the preprocessing step and allows the model to learn the most essential features."),Vo.forEach(e),ot=p(s),Z=n(s,"H3",{class:!0});var Jn=l(Z);F=n(Jn,"A",{id:!0,class:!0,href:!0});var Ro=l(F);Le=n(Ro,"SPAN",{});var Ao=l(Le);d(Ts.$$.fragment,Ao),Ao.forEach(e),Ro.forEach(e),ol=p(Jn),Fe=n(Jn,"SPAN",{});var zo=l(Fe);rl=h(zo,"Audio classification"),zo.forEach(e),Jn.forEach(e),rt=p(s),ce=n(s,"P",{});var So=l(ce);pl=h(So,"Audio classification is a task that labels audio data from a predefined set of classes. It is a broad category with many specific applications, some of which include:"),So.forEach(e),pt=p(s),M=n(s,"UL",{});var Ms=l(M);Pe=n(Ms,"LI",{});var Qo=l(Pe);cl=h(Qo,"acoustic scene classification: label audio with a scene label (\u201Coffice\u201D, \u201Cbeach\u201D, \u201Cstadium\u201D)"),Qo.forEach(e),hl=p(Ms),De=n(Ms,"LI",{});var Yo=l(De);ml=h(Yo,"acoustic event detection: label audio with a sound event label (\u201Ccar horn\u201D, \u201Cwhale calling\u201D, \u201Cglass breaking\u201D)"),Yo.forEach(e),ul=p(Ms),Ke=n(Ms,"LI",{});var Xo=l(Ke);dl=h(Xo,"tagging: label audio containing multiple sounds (birdsongs, speaker identification in a meeting)"),Xo.forEach(e),fl=p(Ms),Oe=n(Ms,"LI",{});var Lo=l(Oe);gl=h(Lo,"music classification: label music with a genre label (\u201Cmetal\u201D, \u201Chip-hop\u201D, \u201Ccountry\u201D)"),Lo.forEach(e),Ms.forEach(e),ct=p(s),d(Us.$$.fragment,s),ht=p(s),B=n(s,"H3",{class:!0});var xn=l(B);P=n(xn,"A",{id:!0,class:!0,href:!0});var Fo=l(P);sa=n(Fo,"SPAN",{});var Po=l(sa);d(Is.$$.fragment,Po),Po.forEach(e),Fo.forEach(e),yl=p(xn),ea=n(xn,"SPAN",{});var Do=l(ea);jl=h(Do,"Automatic speech recognition"),Do.forEach(e),xn.forEach(e),mt=p(s),he=n(s,"P",{});var Ko=l(he);bl=h(Ko,"Automatic speech recognition (ASR) transcribes speech into text. It is one of the most common audio tasks due partly to speech being such a natural form of human communication. Today, ASR systems are embedded in \u201Csmart\u201D technology products like speakers, phones, and cars. We can ask our virtual assistants to play music, set reminders, and tell us the weather."),Ko.forEach(e),ut=p(s),me=n(s,"P",{});var Oo=l(me);wl=h(Oo,"But one of the key challenges Transformer architectures have helped with is in low-resource languages. By pretraining on large amounts of speech data, finetuning the model on only one hour of labeled speech data in a low-resource language can still produce high-quality results compared to previous ASR systems trained on 100x more labeled data."),Oo.forEach(e),dt=p(s),d(Zs.$$.fragment,s),ft=p(s),E=n(s,"H2",{class:!0});var kn=l(E);D=n(kn,"A",{id:!0,class:!0,href:!0});var sr=l(D);aa=n(sr,"SPAN",{});var er=l(aa);d(Bs.$$.fragment,er),er.forEach(e),sr.forEach(e),Ml=p(kn),ta=n(kn,"SPAN",{});var ar=l(ta);vl=h(ar,"Computer vision"),ar.forEach(e),kn.forEach(e),gt=p(s),K=n(s,"P",{});var Tn=l(K);Jl=h(Tn,"One of the first and earliest successful computer vision tasks was recognizing images of zip code numbers using a "),ue=n(Tn,"A",{href:!0});var tr=l(ue);xl=h(tr,"convolutional neural network (CNN)"),tr.forEach(e),kl=h(Tn,". An image is composed of pixels, and each pixel has a numerical value. This makes it easy to represent an image as a matrix of pixel values. Each particular combination of pixel values describes the colors of an image."),Tn.forEach(e),yt=p(s),de=n(s,"P",{});var nr=l(de);Tl=h(nr,"Two general ways computer vision tasks can be solved are:"),nr.forEach(e),jt=p(s),O=n(s,"OL",{});var Un=l(O);na=n(Un,"LI",{});var lr=l(na);Ul=h(lr,"Use convolutions to learn the hierarchical features of an image from low-level features to high-level abstract things."),lr.forEach(e),Il=p(Un),la=n(Un,"LI",{});var ir=l(la);Zl=h(ir,"Split an image into patches and use a Transformer to gradually learn how each image patch is related to each other to form an image. Unlike the bottom-up approach favored by a CNN, this is kind of like starting out with a blurry image and then gradually bringing it into focus."),ir.forEach(e),Un.forEach(e),bt=p(s),W=n(s,"H3",{class:!0});var In=l(W);ss=n(In,"A",{id:!0,class:!0,href:!0});var or=l(ss);ia=n(or,"SPAN",{});var rr=l(ia);d(Es.$$.fragment,rr),rr.forEach(e),or.forEach(e),Bl=p(In),oa=n(In,"SPAN",{});var pr=l(oa);El=h(pr,"Image classification"),pr.forEach(e),In.forEach(e),wt=p(s),fe=n(s,"P",{});var cr=l(fe);Wl=h(cr,"Image classification labels an entire image from a predefined set of classes. Like most classification tasks, there are many practical use cases for image classification, some of which include:"),cr.forEach(e),Mt=p(s),v=n(s,"UL",{});var vs=l(v);ra=n(vs,"LI",{});var hr=l(ra);ql=h(hr,"healthcare: label medical images to detect disease or monitor patient health"),hr.forEach(e),$l=p(vs),pa=n(vs,"LI",{});var mr=l(pa);Nl=h(mr,"environment: label satellite images to monitor deforestation, inform wildland management or detect wildfires"),mr.forEach(e),Gl=p(vs),ca=n(vs,"LI",{});var ur=l(ca);_l=h(ur,"agriculture: label images of crops to monitor plant health or satellite images for land use monitoring"),ur.forEach(e),Cl=p(vs),ha=n(vs,"LI",{});var dr=l(ha);Hl=h(dr,"ecology: label images of animal or plant species to monitor wildlife populations or track endangered species"),dr.forEach(e),vs.forEach(e),vt=p(s),d(Ws.$$.fragment,s),Jt=p(s),q=n(s,"H3",{class:!0});var Zn=l(q);es=n(Zn,"A",{id:!0,class:!0,href:!0});var fr=l(es);ma=n(fr,"SPAN",{});var gr=l(ma);d(qs.$$.fragment,gr),gr.forEach(e),fr.forEach(e),Vl=p(Zn),ua=n(Zn,"SPAN",{});var yr=l(ua);Rl=h(yr,"Object detection"),yr.forEach(e),Zn.forEach(e),xt=p(s),ge=n(s,"P",{});var jr=l(ge);Al=h(jr,"Unlike image classification, object detection identifies multiple objects within an image and the objects\u2019 positions in an image (defined by the bounding box). Some example applications of object detection include:"),jr.forEach(e),kt=p(s),x=n(s,"UL",{});var Ve=l(x);da=n(Ve,"LI",{});var br=l(da);zl=h(br,"self-driving vehicles: detect everyday traffic objects such as other vehicles, pedestrians, and traffic lights"),br.forEach(e),Sl=p(Ve),fa=n(Ve,"LI",{});var wr=l(fa);Ql=h(wr,"remote sensing: disaster monitoring, urban planning, and weather forecasting"),wr.forEach(e),Yl=p(Ve),ga=n(Ve,"LI",{});var Mr=l(ga);Xl=h(Mr,"defect detection: detect cracks or structural damage in buildings, and manufacturing defects"),Mr.forEach(e),Ve.forEach(e),Tt=p(s),d($s.$$.fragment,s),Ut=p(s),$=n(s,"H3",{class:!0});var Bn=l($);as=n(Bn,"A",{id:!0,class:!0,href:!0});var vr=l(as);ya=n(vr,"SPAN",{});var Jr=l(ya);d(Ns.$$.fragment,Jr),Jr.forEach(e),vr.forEach(e),Ll=p(Bn),ja=n(Bn,"SPAN",{});var xr=l(ja);Fl=h(xr,"Image segmentation"),xr.forEach(e),Bn.forEach(e),It=p(s),ye=n(s,"P",{});var kr=l(ye);Pl=h(kr,"Image segmentation is a pixel-level task that assigns every pixel in an image to a class. It differs from object detection, which uses bounding boxes to label and predict objects in an image because segmentation is more granular. Segmentation can detect objects at a pixel-level. There are several types of image segmentation:"),kr.forEach(e),Zt=p(s),ts=n(s,"UL",{});var En=l(ts);ba=n(En,"LI",{});var Tr=l(ba);Dl=h(Tr,"instance segmentation: in addition to labeling the class of an object, it also labels each distinct instance of an object (\u201Cdog-1\u201D, \u201Cdog-2\u201D)"),Tr.forEach(e),Kl=p(En),Gs=n(En,"LI",{});var Wn=l(Gs);Ol=h(Wn,"panoptic segmentation: a combination of semantic and instance segmentation; it labels each pixel with a semantic class "),wa=n(Wn,"STRONG",{});var Ur=l(wa);si=h(Ur,"and"),Ur.forEach(e),ei=h(Wn," each distinct instance of an object"),Wn.forEach(e),En.forEach(e),Bt=p(s),je=n(s,"P",{});var Ir=l(je);ai=h(Ir,"Segmentation tasks are helpful in self-driving vehicles to create a pixel-level map of the world around them so they can navigate safely around pedestrians and other vehicles. It is also useful for medical imaging, where the task\u2019s finer granularity can help identify abnormal cells or organ features. Image segmentation can also be used in ecommerce to virtually try on clothes or create augmented reality experiences by overlaying objects in the real world through your camera."),Ir.forEach(e),Et=p(s),d(_s.$$.fragment,s),Wt=p(s),N=n(s,"H3",{class:!0});var qn=l(N);ns=n(qn,"A",{id:!0,class:!0,href:!0});var Zr=l(ns);Ma=n(Zr,"SPAN",{});var Br=l(Ma);d(Cs.$$.fragment,Br),Br.forEach(e),Zr.forEach(e),ti=p(qn),va=n(qn,"SPAN",{});var Er=l(va);ni=h(Er,"Depth estimation"),Er.forEach(e),qn.forEach(e),qt=p(s),be=n(s,"P",{});var Wr=l(be);li=h(Wr,"Depth estimation predicts the distance of each pixel in an image from the camera. This computer vision task is especially important for scene understanding and reconstruction. For example, in self-driving cars, vehicles need to understand how far objects like pedestrians, traffic signs, and other vehicles are to avoid obstacles and collisions. Depth information is also helpful for constructing 3D representations from 2D images and can be used to create high-quality 3D representations of biological structures or buildings."),Wr.forEach(e),$t=p(s),we=n(s,"P",{});var qr=l(we);ii=h(qr,"There are two approaches to depth estimation:"),qr.forEach(e),Nt=p(s),ls=n(s,"UL",{});var $n=l(ls);Ja=n($n,"LI",{});var $r=l(Ja);oi=h($r,"stereo: depths are estimated by comparing two images of the same image from slightly different angles"),$r.forEach(e),ri=p($n),xa=n($n,"LI",{});var Nr=l(xa);pi=h(Nr,"monocular: depths are estimated from a single image"),Nr.forEach(e),$n.forEach(e),Gt=p(s),d(Hs.$$.fragment,s),_t=p(s),G=n(s,"H2",{class:!0});var Nn=l(G);is=n(Nn,"A",{id:!0,class:!0,href:!0});var Gr=l(is);ka=n(Gr,"SPAN",{});var _r=l(ka);d(Vs.$$.fragment,_r),_r.forEach(e),Gr.forEach(e),ci=p(Nn),Ta=n(Nn,"SPAN",{});var Cr=l(Ta);hi=h(Cr,"Natural language processing"),Cr.forEach(e),Nn.forEach(e),Ct=p(s),Me=n(s,"P",{});var Hr=l(Me);mi=h(Hr,"NLP tasks are among the most common types of tasks because text is such a natural way for us to communicate. To get text into a format recognized by a model, it needs to be tokenized. This means dividing a sequence of text into separate words or subwords (tokens) and then converting these tokens into numbers. As a result, you can represent a sequence of text as a sequence of numbers, and once you have a sequence of numbers, it can be input into a model to solve all sorts of NLP tasks!"),Hr.forEach(e),Ht=p(s),_=n(s,"H3",{class:!0});var Gn=l(_);os=n(Gn,"A",{id:!0,class:!0,href:!0});var Vr=l(os);Ua=n(Vr,"SPAN",{});var Rr=l(Ua);d(Rs.$$.fragment,Rr),Rr.forEach(e),Vr.forEach(e),ui=p(Gn),Ia=n(Gn,"SPAN",{});var Ar=l(Ia);di=h(Ar,"Text classification"),Ar.forEach(e),Gn.forEach(e),Vt=p(s),ve=n(s,"P",{});var zr=l(ve);fi=h(zr,"Like classification tasks in any modality, text classification labels a sequence of text (it can be sentence-level, a paragraph, or a document) from a predefined set of classes. There are many practical applications for text classification, some of which include:"),zr.forEach(e),Rt=p(s),rs=n(s,"UL",{});var _n=l(rs);C=n(_n,"LI",{});var Re=l(C);gi=h(Re,"sentiment analysis: label text according to some polarity like "),Za=n(Re,"CODE",{});var Sr=l(Za);yi=h(Sr,"positive"),Sr.forEach(e),ji=h(Re," or "),Ba=n(Re,"CODE",{});var Qr=l(Ba);bi=h(Qr,"negative"),Qr.forEach(e),wi=h(Re," which can inform and support decision-making in fields like politics, finance, and marketing"),Re.forEach(e),Mi=p(_n),J=n(_n,"LI",{});var Js=l(J);vi=h(Js,"content classification: label text according to some topic to help organize and filter information in news and social media feeds ("),Ea=n(Js,"CODE",{});var Yr=l(Ea);Ji=h(Yr,"weather"),Yr.forEach(e),xi=h(Js,", "),Wa=n(Js,"CODE",{});var Xr=l(Wa);ki=h(Xr,"sports"),Xr.forEach(e),Ti=h(Js,", "),qa=n(Js,"CODE",{});var Lr=l(qa);Ui=h(Lr,"finance"),Lr.forEach(e),Ii=h(Js,", etc.)"),Js.forEach(e),_n.forEach(e),At=p(s),d(As.$$.fragment,s),zt=p(s),H=n(s,"H3",{class:!0});var Cn=l(H);ps=n(Cn,"A",{id:!0,class:!0,href:!0});var Fr=l(ps);$a=n(Fr,"SPAN",{});var Pr=l($a);d(zs.$$.fragment,Pr),Pr.forEach(e),Fr.forEach(e),Zi=p(Cn),Na=n(Cn,"SPAN",{});var Dr=l(Na);Bi=h(Dr,"Token classification"),Dr.forEach(e),Cn.forEach(e),St=p(s),cs=n(s,"P",{});var Hn=l(cs);Ei=h(Hn,"In any NLP task, text is preprocessed by separating the sequence of text into individual words or subwords. These are known as "),Je=n(Hn,"A",{href:!0});var Kr=l(Je);Wi=h(Kr,"tokens"),Kr.forEach(e),qi=h(Hn,". Token classification assigns each token a label from a predefined set of classes."),Hn.forEach(e),Qt=p(s),xe=n(s,"P",{});var Or=l(xe);$i=h(Or,"Two common types of token classification are:"),Or.forEach(e),Yt=p(s),hs=n(s,"UL",{});var Vn=l(hs);Ga=n(Vn,"LI",{});var sp=l(Ga);Ni=h(sp,"named entity recognition (NER): label a token according to an entity category like organization, person, location or date. NER is especially popular in biomedical settings, where it can label genes, proteins, and drug names."),sp.forEach(e),Gi=p(Vn),_a=n(Vn,"LI",{});var ep=l(_a);_i=h(ep,"part-of-speech tagging (POS): label a token according to its part-of-speech like noun, verb, or adjective. POS is useful for helping translation systems understand how two identical words are grammatically different (bank as a noun versus bank as a verb)."),ep.forEach(e),Vn.forEach(e),Xt=p(s),d(Ss.$$.fragment,s),Lt=p(s),V=n(s,"H3",{class:!0});var Rn=l(V);ms=n(Rn,"A",{id:!0,class:!0,href:!0});var ap=l(ms);Ca=n(ap,"SPAN",{});var tp=l(Ca);d(Qs.$$.fragment,tp),tp.forEach(e),ap.forEach(e),Ci=p(Rn),Ha=n(Rn,"SPAN",{});var np=l(Ha);Hi=h(np,"Question answering"),np.forEach(e),Rn.forEach(e),Ft=p(s),ke=n(s,"P",{});var lp=l(ke);Vi=h(lp,"Question answering is another token-level task that returns an answer to a question, sometimes with context (open-domain) and other times without context (closed-domain). This task happens whenever we ask a virtual assistant something like whether a restaurant is open. It can also provide customer or technical support and help search engines retrieve the relevant information you\u2019re asking for."),lp.forEach(e),Pt=p(s),Te=n(s,"P",{});var ip=l(Te);Ri=h(ip,"There are two common types of question answering:"),ip.forEach(e),Dt=p(s),us=n(s,"UL",{});var An=l(us);Va=n(An,"LI",{});var op=l(Va);Ai=h(op,"extractive: given a question and some context, the answer is a span of text from the context the model must extract"),op.forEach(e),zi=p(An),R=n(An,"LI",{});var Ae=l(R);Si=h(Ae,"abstractive: given a question and some context, the answer is generated from the context; this approach is handled by the "),Ue=n(Ae,"A",{href:!0});var rp=l(Ue);Qi=h(rp,"Text2TextGenerationPipeline"),rp.forEach(e),Yi=h(Ae," instead of the "),Ie=n(Ae,"A",{href:!0});var pp=l(Ie);Xi=h(pp,"QuestionAnsweringPipeline"),pp.forEach(e),Li=h(Ae," shown below"),Ae.forEach(e),An.forEach(e),Kt=p(s),d(Ys.$$.fragment,s),Ot=p(s),A=n(s,"H3",{class:!0});var zn=l(A);ds=n(zn,"A",{id:!0,class:!0,href:!0});var cp=l(ds);Ra=n(cp,"SPAN",{});var hp=l(Ra);d(Xs.$$.fragment,hp),hp.forEach(e),cp.forEach(e),Fi=p(zn),Aa=n(zn,"SPAN",{});var mp=l(Aa);Pi=h(mp,"Summarization"),mp.forEach(e),zn.forEach(e),sn=p(s),Ze=n(s,"P",{});var up=l(Ze);Di=h(up,"Summarization creates a shorter version of a text from a longer one while trying to preserve most of the meaning of the original document. Summarization is a sequence-to-sequence task; it outputs a shorter text sequence than the input. There are a lot of long-form documents that can be summarized to help readers quickly understand the main points. Legislative bills, legal and financial documents, patents, and scientific papers are a few examples of documents that could be summarized to save readers time and serve as a reading aid."),up.forEach(e),en=p(s),Be=n(s,"P",{});var dp=l(Be);Ki=h(dp,"Like question answering, there are two types of summarization:"),dp.forEach(e),an=p(s),fs=n(s,"UL",{});var Sn=l(fs);za=n(Sn,"LI",{});var fp=l(za);Oi=h(fp,"extractive: identify and extract the most important sentences from the original text"),fp.forEach(e),so=p(Sn),Ls=n(Sn,"LI",{});var Qn=l(Ls);eo=h(Qn,"abstractive: generate the target summary (which may include new words not in the input document) from the original text; the "),Ee=n(Qn,"A",{href:!0});var gp=l(Ee);ao=h(gp,"SummarizationPipeline"),gp.forEach(e),to=h(Qn," uses the abstractive approach"),Qn.forEach(e),Sn.forEach(e),tn=p(s),d(Fs.$$.fragment,s),nn=p(s),z=n(s,"H3",{class:!0});var Yn=l(z);gs=n(Yn,"A",{id:!0,class:!0,href:!0});var yp=l(gs);Sa=n(yp,"SPAN",{});var jp=l(Sa);d(Ps.$$.fragment,jp),jp.forEach(e),yp.forEach(e),no=p(Yn),Qa=n(Yn,"SPAN",{});var bp=l(Qa);lo=h(bp,"Translation"),bp.forEach(e),Yn.forEach(e),ln=p(s),We=n(s,"P",{});var wp=l(We);io=h(wp,"Translation converts a sequence of text in one language to another. It is important in helping people from different backgrounds communicate with each other, help translate content to reach wider audiences, and even be a learning tool to help people learn a new language. Along with summarization, translation is a sequence-to-sequence task, meaning the model receives an input sequence and returns a target output sequence."),wp.forEach(e),on=p(s),qe=n(s,"P",{});var Mp=l(qe);oo=h(Mp,"In the early days, translation models were mostly monolingual, but recently, there has been increasing interest in multilingual models that can translate between many pairs of languages."),Mp.forEach(e),rn=p(s),d(Ds.$$.fragment,s),pn=p(s),S=n(s,"H3",{class:!0});var Xn=l(S);ys=n(Xn,"A",{id:!0,class:!0,href:!0});var vp=l(ys);Ya=n(vp,"SPAN",{});var Jp=l(Ya);d(Ks.$$.fragment,Jp),Jp.forEach(e),vp.forEach(e),ro=p(Xn),Xa=n(Xn,"SPAN",{});var xp=l(Xa);po=h(xp,"Language modeling"),xp.forEach(e),Xn.forEach(e),cn=p(s),$e=n(s,"P",{});var kp=l($e);co=h(kp,"Language modeling is a task that predicts a word in a sequence of text. It has become a very popular NLP task because a pretrained language model can be finetuned for many other downstream tasks. Lately, there has been a lot of interest in large language models (LLMs) which demonstrate zero- or few-shot learning. This means the model can solve tasks it wasn\u2019t explicitly trained to do! Language models can be used to generate fluent and convincing text, though you need to be careful since the text may not always be accurate."),kp.forEach(e),hn=p(s),Ne=n(s,"P",{});var Tp=l(Ne);ho=h(Tp,"There are two types of language modeling:"),Tp.forEach(e),mn=p(s),js=n(s,"UL",{});var Ln=l(js);Os=n(Ln,"LI",{});var Fn=l(Os);La=n(Fn,"P",{});var Up=l(La);mo=h(Up,"causal: the model\u2019s objective is to predict the next token in a sequence, and future tokens are masked"),Up.forEach(e),uo=p(Fn),d(se.$$.fragment,Fn),Fn.forEach(e),fo=p(Ln),ee=n(Ln,"LI",{});var Pn=l(ee);Fa=n(Pn,"P",{});var Ip=l(Fa);go=h(Ip,"masked: the model\u2019s objective is to predict a masked token in a sequence with full access to the tokens in the sequence"),Ip.forEach(e),yo=p(Pn),d(ae.$$.fragment,Pn),Pn.forEach(e),Ln.forEach(e),un=p(s),Q=n(s,"H2",{class:!0});var Dn=l(Q);bs=n(Dn,"A",{id:!0,class:!0,href:!0});var Zp=l(bs);Pa=n(Zp,"SPAN",{});var Bp=l(Pa);d(te.$$.fragment,Bp),Bp.forEach(e),Zp.forEach(e),jo=p(Dn),Da=n(Dn,"SPAN",{});var Ep=l(Da);bo=h(Ep,"Multimodal"),Ep.forEach(e),Dn.forEach(e),dn=p(s),Ge=n(s,"P",{});var Wp=l(Ge);wo=h(Wp,"Multimodal tasks require a model to process multiple data modalities (text, image, audio, video) to solve a particular problem. Image captioning is an example of a multimodal task where the model takes an image as input and outputs a sequence of text describing the image or some properties of the image."),Wp.forEach(e),fn=p(s),_e=n(s,"P",{});var qp=l(_e);Mo=h(qp,"Although multimodal models work with different data types or modalities, internally, the preprocessing steps help the model convert all the data types into embeddings (vectors or list of numbers that holds meaningful information about the data). For a task like image captioning, the model learns relationships between image embeddings and text embeddings."),qp.forEach(e),gn=p(s),Y=n(s,"H3",{class:!0});var Kn=l(Y);ws=n(Kn,"A",{id:!0,class:!0,href:!0});var $p=l(ws);Ka=n($p,"SPAN",{});var Np=l(Ka);d(ne.$$.fragment,Np),Np.forEach(e),$p.forEach(e),vo=p(Kn),Oa=n(Kn,"SPAN",{});var Gp=l(Oa);Jo=h(Gp,"Document question answering"),Gp.forEach(e),Kn.forEach(e),yn=p(s),Ce=n(s,"P",{});var _p=l(Ce);xo=h(_p,"Document question answering is a task that answers natural language questions from a document. Unlike a token-level question answering task which takes text as input, document question answering takes an image of a document as input along with a question about the document and returns an answer. Document question answering can be used to parse structured documents and extract key information from it. In the example below, the total amount and change due can be extracted from a receipt."),_p.forEach(e),jn=p(s),d(le.$$.fragment,s),bn=p(s),k=n(s,"P",{});var ze=l(k);ko=h(ze,"Hopefully, this page has given you some more background information about all the types of tasks in each modality and the practical importance of each one. In the next "),He=n(ze,"A",{href:!0});var Cp=l(He);To=h(Cp,"section"),Cp.forEach(e),Uo=h(ze,", you\u2019ll learn "),st=n(ze,"STRONG",{});var Hp=l(st);Io=h(Hp,"how"),Hp.forEach(e),Zo=h(ze," \u{1F917} Transformers work to solve these tasks."),ze.forEach(e),this.h()},h(){m(T,"name","hf:doc:metadata"),m(T,"content",JSON.stringify(Xp)),m(X,"id","what-transformers-can-do"),m(X,"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"),m(X,"href","#what-transformers-can-do"),m(U,"class","relative group"),m(L,"id","audio"),m(L,"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"),m(L,"href","#audio"),m(I,"class","relative group"),m(F,"id","audio-classification"),m(F,"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"),m(F,"href","#audio-classification"),m(Z,"class","relative group"),m(P,"id","automatic-speech-recognition"),m(P,"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"),m(P,"href","#automatic-speech-recognition"),m(B,"class","relative group"),m(D,"id","computer-vision"),m(D,"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"),m(D,"href","#computer-vision"),m(E,"class","relative group"),m(ue,"href","glossary#convolution"),m(ss,"id","image-classification"),m(ss,"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"),m(ss,"href","#image-classification"),m(W,"class","relative group"),m(es,"id","object-detection"),m(es,"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"),m(es,"href","#object-detection"),m(q,"class","relative group"),m(as,"id","image-segmentation"),m(as,"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"),m(as,"href","#image-segmentation"),m($,"class","relative group"),m(ns,"id","depth-estimation"),m(ns,"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"),m(ns,"href","#depth-estimation"),m(N,"class","relative group"),m(is,"id","natural-language-processing"),m(is,"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"),m(is,"href","#natural-language-processing"),m(G,"class","relative group"),m(os,"id","text-classification"),m(os,"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"),m(os,"href","#text-classification"),m(_,"class","relative group"),m(ps,"id","token-classification"),m(ps,"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"),m(ps,"href","#token-classification"),m(H,"class","relative group"),m(Je,"href","/glossary#token"),m(ms,"id","question-answering"),m(ms,"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"),m(ms,"href","#question-answering"),m(V,"class","relative group"),m(Ue,"href","/docs/transformers/main/en/main_classes/pipelines#transformers.Text2TextGenerationPipeline"),m(Ie,"href","/docs/transformers/main/en/main_classes/pipelines#transformers.QuestionAnsweringPipeline"),m(ds,"id","summarization"),m(ds,"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"),m(ds,"href","#summarization"),m(A,"class","relative group"),m(Ee,"href","/docs/transformers/main/en/main_classes/pipelines#transformers.SummarizationPipeline"),m(gs,"id","translation"),m(gs,"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"),m(gs,"href","#translation"),m(z,"class","relative group"),m(ys,"id","language-modeling"),m(ys,"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"),m(ys,"href","#language-modeling"),m(S,"class","relative group"),m(bs,"id","multimodal"),m(bs,"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"),m(bs,"href","#multimodal"),m(Q,"class","relative group"),m(ws,"id","document-question-answering"),m(ws,"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"),m(ws,"href","#document-question-answering"),m(Y,"class","relative group"),m(He,"href","tasks_explained")},m(s,i){a(document.head,T),o(s,et,i),o(s,U,i),a(U,X),a(X,Se),f(xs,Se,null),a(U,On),a(U,Qe),a(Qe,sl),o(s,at,i),o(s,ie,i),a(ie,el),o(s,tt,i),o(s,oe,i),a(oe,al),o(s,nt,i),o(s,I,i),a(I,L),a(L,Ye),f(ks,Ye,null),a(I,tl),a(I,Xe),a(Xe,nl),o(s,lt,i),o(s,re,i),a(re,ll),o(s,it,i),o(s,pe,i),a(pe,il),o(s,ot,i),o(s,Z,i),a(Z,F),a(F,Le),f(Ts,Le,null),a(Z,ol),a(Z,Fe),a(Fe,rl),o(s,rt,i),o(s,ce,i),a(ce,pl),o(s,pt,i),o(s,M,i),a(M,Pe),a(Pe,cl),a(M,hl),a(M,De),a(De,ml),a(M,ul),a(M,Ke),a(Ke,dl),a(M,fl),a(M,Oe),a(Oe,gl),o(s,ct,i),f(Us,s,i),o(s,ht,i),o(s,B,i),a(B,P),a(P,sa),f(Is,sa,null),a(B,yl),a(B,ea),a(ea,jl),o(s,mt,i),o(s,he,i),a(he,bl),o(s,ut,i),o(s,me,i),a(me,wl),o(s,dt,i),f(Zs,s,i),o(s,ft,i),o(s,E,i),a(E,D),a(D,aa),f(Bs,aa,null),a(E,Ml),a(E,ta),a(ta,vl),o(s,gt,i),o(s,K,i),a(K,Jl),a(K,ue),a(ue,xl),a(K,kl),o(s,yt,i),o(s,de,i),a(de,Tl),o(s,jt,i),o(s,O,i),a(O,na),a(na,Ul),a(O,Il),a(O,la),a(la,Zl),o(s,bt,i),o(s,W,i),a(W,ss),a(ss,ia),f(Es,ia,null),a(W,Bl),a(W,oa),a(oa,El),o(s,wt,i),o(s,fe,i),a(fe,Wl),o(s,Mt,i),o(s,v,i),a(v,ra),a(ra,ql),a(v,$l),a(v,pa),a(pa,Nl),a(v,Gl),a(v,ca),a(ca,_l),a(v,Cl),a(v,ha),a(ha,Hl),o(s,vt,i),f(Ws,s,i),o(s,Jt,i),o(s,q,i),a(q,es),a(es,ma),f(qs,ma,null),a(q,Vl),a(q,ua),a(ua,Rl),o(s,xt,i),o(s,ge,i),a(ge,Al),o(s,kt,i),o(s,x,i),a(x,da),a(da,zl),a(x,Sl),a(x,fa),a(fa,Ql),a(x,Yl),a(x,ga),a(ga,Xl),o(s,Tt,i),f($s,s,i),o(s,Ut,i),o(s,$,i),a($,as),a(as,ya),f(Ns,ya,null),a($,Ll),a($,ja),a(ja,Fl),o(s,It,i),o(s,ye,i),a(ye,Pl),o(s,Zt,i),o(s,ts,i),a(ts,ba),a(ba,Dl),a(ts,Kl),a(ts,Gs),a(Gs,Ol),a(Gs,wa),a(wa,si),a(Gs,ei),o(s,Bt,i),o(s,je,i),a(je,ai),o(s,Et,i),f(_s,s,i),o(s,Wt,i),o(s,N,i),a(N,ns),a(ns,Ma),f(Cs,Ma,null),a(N,ti),a(N,va),a(va,ni),o(s,qt,i),o(s,be,i),a(be,li),o(s,$t,i),o(s,we,i),a(we,ii),o(s,Nt,i),o(s,ls,i),a(ls,Ja),a(Ja,oi),a(ls,ri),a(ls,xa),a(xa,pi),o(s,Gt,i),f(Hs,s,i),o(s,_t,i),o(s,G,i),a(G,is),a(is,ka),f(Vs,ka,null),a(G,ci),a(G,Ta),a(Ta,hi),o(s,Ct,i),o(s,Me,i),a(Me,mi),o(s,Ht,i),o(s,_,i),a(_,os),a(os,Ua),f(Rs,Ua,null),a(_,ui),a(_,Ia),a(Ia,di),o(s,Vt,i),o(s,ve,i),a(ve,fi),o(s,Rt,i),o(s,rs,i),a(rs,C),a(C,gi),a(C,Za),a(Za,yi),a(C,ji),a(C,Ba),a(Ba,bi),a(C,wi),a(rs,Mi),a(rs,J),a(J,vi),a(J,Ea),a(Ea,Ji),a(J,xi),a(J,Wa),a(Wa,ki),a(J,Ti),a(J,qa),a(qa,Ui),a(J,Ii),o(s,At,i),f(As,s,i),o(s,zt,i),o(s,H,i),a(H,ps),a(ps,$a),f(zs,$a,null),a(H,Zi),a(H,Na),a(Na,Bi),o(s,St,i),o(s,cs,i),a(cs,Ei),a(cs,Je),a(Je,Wi),a(cs,qi),o(s,Qt,i),o(s,xe,i),a(xe,$i),o(s,Yt,i),o(s,hs,i),a(hs,Ga),a(Ga,Ni),a(hs,Gi),a(hs,_a),a(_a,_i),o(s,Xt,i),f(Ss,s,i),o(s,Lt,i),o(s,V,i),a(V,ms),a(ms,Ca),f(Qs,Ca,null),a(V,Ci),a(V,Ha),a(Ha,Hi),o(s,Ft,i),o(s,ke,i),a(ke,Vi),o(s,Pt,i),o(s,Te,i),a(Te,Ri),o(s,Dt,i),o(s,us,i),a(us,Va),a(Va,Ai),a(us,zi),a(us,R),a(R,Si),a(R,Ue),a(Ue,Qi),a(R,Yi),a(R,Ie),a(Ie,Xi),a(R,Li),o(s,Kt,i),f(Ys,s,i),o(s,Ot,i),o(s,A,i),a(A,ds),a(ds,Ra),f(Xs,Ra,null),a(A,Fi),a(A,Aa),a(Aa,Pi),o(s,sn,i),o(s,Ze,i),a(Ze,Di),o(s,en,i),o(s,Be,i),a(Be,Ki),o(s,an,i),o(s,fs,i),a(fs,za),a(za,Oi),a(fs,so),a(fs,Ls),a(Ls,eo),a(Ls,Ee),a(Ee,ao),a(Ls,to),o(s,tn,i),f(Fs,s,i),o(s,nn,i),o(s,z,i),a(z,gs),a(gs,Sa),f(Ps,Sa,null),a(z,no),a(z,Qa),a(Qa,lo),o(s,ln,i),o(s,We,i),a(We,io),o(s,on,i),o(s,qe,i),a(qe,oo),o(s,rn,i),f(Ds,s,i),o(s,pn,i),o(s,S,i),a(S,ys),a(ys,Ya),f(Ks,Ya,null),a(S,ro),a(S,Xa),a(Xa,po),o(s,cn,i),o(s,$e,i),a($e,co),o(s,hn,i),o(s,Ne,i),a(Ne,ho),o(s,mn,i),o(s,js,i),a(js,Os),a(Os,La),a(La,mo),a(Os,uo),f(se,Os,null),a(js,fo),a(js,ee),a(ee,Fa),a(Fa,go),a(ee,yo),f(ae,ee,null),o(s,un,i),o(s,Q,i),a(Q,bs),a(bs,Pa),f(te,Pa,null),a(Q,jo),a(Q,Da),a(Da,bo),o(s,dn,i),o(s,Ge,i),a(Ge,wo),o(s,fn,i),o(s,_e,i),a(_e,Mo),o(s,gn,i),o(s,Y,i),a(Y,ws),a(ws,Ka),f(ne,Ka,null),a(Y,vo),a(Y,Oa),a(Oa,Jo),o(s,yn,i),o(s,Ce,i),a(Ce,xo),o(s,jn,i),f(le,s,i),o(s,bn,i),o(s,k,i),a(k,ko),a(k,He),a(He,To),a(k,Uo),a(k,st),a(st,Io),a(k,Zo),wn=!0},p:Sp,i(s){wn||(g(xs.$$.fragment,s),g(ks.$$.fragment,s),g(Ts.$$.fragment,s),g(Us.$$.fragment,s),g(Is.$$.fragment,s),g(Zs.$$.fragment,s),g(Bs.$$.fragment,s),g(Es.$$.fragment,s),g(Ws.$$.fragment,s),g(qs.$$.fragment,s),g($s.$$.fragment,s),g(Ns.$$.fragment,s),g(_s.$$.fragment,s),g(Cs.$$.fragment,s),g(Hs.$$.fragment,s),g(Vs.$$.fragment,s),g(Rs.$$.fragment,s),g(As.$$.fragment,s),g(zs.$$.fragment,s),g(Ss.$$.fragment,s),g(Qs.$$.fragment,s),g(Ys.$$.fragment,s),g(Xs.$$.fragment,s),g(Fs.$$.fragment,s),g(Ps.$$.fragment,s),g(Ds.$$.fragment,s),g(Ks.$$.fragment,s),g(se.$$.fragment,s),g(ae.$$.fragment,s),g(te.$$.fragment,s),g(ne.$$.fragment,s),g(le.$$.fragment,s),wn=!0)},o(s){y(xs.$$.fragment,s),y(ks.$$.fragment,s),y(Ts.$$.fragment,s),y(Us.$$.fragment,s),y(Is.$$.fragment,s),y(Zs.$$.fragment,s),y(Bs.$$.fragment,s),y(Es.$$.fragment,s),y(Ws.$$.fragment,s),y(qs.$$.fragment,s),y($s.$$.fragment,s),y(Ns.$$.fragment,s),y(_s.$$.fragment,s),y(Cs.$$.fragment,s),y(Hs.$$.fragment,s),y(Vs.$$.fragment,s),y(Rs.$$.fragment,s),y(As.$$.fragment,s),y(zs.$$.fragment,s),y(Ss.$$.fragment,s),y(Qs.$$.fragment,s),y(Ys.$$.fragment,s),y(Xs.$$.fragment,s),y(Fs.$$.fragment,s),y(Ps.$$.fragment,s),y(Ds.$$.fragment,s),y(Ks.$$.fragment,s),y(se.$$.fragment,s),y(ae.$$.fragment,s),y(te.$$.fragment,s),y(ne.$$.fragment,s),y(le.$$.fragment,s),wn=!1},d(s){e(T),s&&e(et),s&&e(U),j(xs),s&&e(at),s&&e(ie),s&&e(tt),s&&e(oe),s&&e(nt),s&&e(I),j(ks),s&&e(lt),s&&e(re),s&&e(it),s&&e(pe),s&&e(ot),s&&e(Z),j(Ts),s&&e(rt),s&&e(ce),s&&e(pt),s&&e(M),s&&e(ct),j(Us,s),s&&e(ht),s&&e(B),j(Is),s&&e(mt),s&&e(he),s&&e(ut),s&&e(me),s&&e(dt),j(Zs,s),s&&e(ft),s&&e(E),j(Bs),s&&e(gt),s&&e(K),s&&e(yt),s&&e(de),s&&e(jt),s&&e(O),s&&e(bt),s&&e(W),j(Es),s&&e(wt),s&&e(fe),s&&e(Mt),s&&e(v),s&&e(vt),j(Ws,s),s&&e(Jt),s&&e(q),j(qs),s&&e(xt),s&&e(ge),s&&e(kt),s&&e(x),s&&e(Tt),j($s,s),s&&e(Ut),s&&e($),j(Ns),s&&e(It),s&&e(ye),s&&e(Zt),s&&e(ts),s&&e(Bt),s&&e(je),s&&e(Et),j(_s,s),s&&e(Wt),s&&e(N),j(Cs),s&&e(qt),s&&e(be),s&&e($t),s&&e(we),s&&e(Nt),s&&e(ls),s&&e(Gt),j(Hs,s),s&&e(_t),s&&e(G),j(Vs),s&&e(Ct),s&&e(Me),s&&e(Ht),s&&e(_),j(Rs),s&&e(Vt),s&&e(ve),s&&e(Rt),s&&e(rs),s&&e(At),j(As,s),s&&e(zt),s&&e(H),j(zs),s&&e(St),s&&e(cs),s&&e(Qt),s&&e(xe),s&&e(Yt),s&&e(hs),s&&e(Xt),j(Ss,s),s&&e(Lt),s&&e(V),j(Qs),s&&e(Ft),s&&e(ke),s&&e(Pt),s&&e(Te),s&&e(Dt),s&&e(us),s&&e(Kt),j(Ys,s),s&&e(Ot),s&&e(A),j(Xs),s&&e(sn),s&&e(Ze),s&&e(en),s&&e(Be),s&&e(an),s&&e(fs),s&&e(tn),j(Fs,s),s&&e(nn),s&&e(z),j(Ps),s&&e(ln),s&&e(We),s&&e(on),s&&e(qe),s&&e(rn),j(Ds,s),s&&e(pn),s&&e(S),j(Ks),s&&e(cn),s&&e($e),s&&e(hn),s&&e(Ne),s&&e(mn),s&&e(js),j(se),j(ae),s&&e(un),s&&e(Q),j(te),s&&e(dn),s&&e(Ge),s&&e(fn),s&&e(_e),s&&e(gn),s&&e(Y),j(ne),s&&e(yn),s&&e(Ce),s&&e(jn),j(le,s),s&&e(bn),s&&e(k)}}}const Xp={local:"what-transformers-can-do",sections:[{local:"audio",sections:[{local:"audio-classification",title:"Audio classification"},{local:"automatic-speech-recognition",title:"Automatic speech recognition"}],title:"Audio"},{local:"computer-vision",sections:[{local:"image-classification",title:"Image classification"},{local:"object-detection",title:"Object detection"},{local:"image-segmentation",title:"Image segmentation"},{local:"depth-estimation",title:"Depth estimation"}],title:"Computer vision"},{local:"natural-language-processing",sections:[{local:"text-classification",title:"Text classification"},{local:"token-classification",title:"Token classification"},{local:"question-answering",title:"Question answering"},{local:"summarization",title:"Summarization"},{local:"translation",title:"Translation"},{local:"language-modeling",title:"Language modeling"}],title:"Natural language processing"},{local:"multimodal",sections:[{local:"document-question-answering",title:"Document question answering"}],title:"Multimodal"}],title:"What \u{1F917} Transformers can do"};function Lp(Bo){return Qp(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Kp extends Vp{constructor(T){super();Rp(this,T,Lp,Yp,Ap,{})}}export{Kp as default,Xp as metadata};
