import{S as Wo,i as Bo,s as No,e as i,k as h,w as f,t as l,M as Ao,c as p,d as s,m,a as r,x as d,h as t,b as c,N as Xo,G as a,g as o,y,q as w,o as j,B as g,v as Ro,L as Vo}from"../chunks/vendor-hf-doc-builder.js";import{T as Yp}from"../chunks/Tip-hf-doc-builder.js";import{I as Z}from"../chunks/IconCopyLink-hf-doc-builder.js";import{C as k}from"../chunks/CodeBlock-hf-doc-builder.js";function Yo(ae){let u,J,v,T,_;return{c(){u=i("p"),J=l("Take a look at the "),v=i("a"),T=l("pipeline()"),_=l(" documentation for a complete list of supported tasks and available parameters."),this.h()},l(x){u=p(x,"P",{});var E=r(u);J=t(E,"Take a look at the "),v=p(E,"A",{href:!0});var U=r(v);T=t(U,"pipeline()"),U.forEach(s),_=t(E," documentation for a complete list of supported tasks and available parameters."),E.forEach(s),this.h()},h(){c(v,"href","/docs/transformers/v4.30.0/en/main_classes/pipelines#transformers.pipeline")},m(x,E){o(x,u,E),a(u,J),a(u,v),a(v,T),a(u,_)},d(x){x&&s(u)}}}function Co(ae){let u;return{c(){u=l(`Creating an inference engine is a complex topic which deserves it's own
page.`)},l(J){u=t(J,`Creating an inference engine is a complex topic which deserves it's own
page.`)},m(J,v){o(J,u,v)},d(J){J&&s(u)}}}function So(ae){let u,J,v,T,_,x,E,U,le;return U=new k({props:{code:"c3VkbyUyMGFwdCUyMGluc3RhbGwlMjAteSUyMHRlc3NlcmFjdC1vY3IlMEFwaXAlMjBpbnN0YWxsJTIwcHl0ZXNzZXJhY3Q=",highlighted:`sudo apt install -y tesseract-ocr
pip install pytesseract`}}),{c(){u=i("p"),J=l("To run the example above you need to have "),v=i("a"),T=i("code"),_=l("pytesseract"),x=l(" installed in addition to \u{1F917} Transformers:"),E=h(),f(U.$$.fragment),this.h()},l(M){u=p(M,"P",{});var b=r(u);J=t(b,"To run the example above you need to have "),v=p(b,"A",{href:!0,rel:!0});var Js=r(v);T=p(Js,"CODE",{});var C=r(T);_=t(C,"pytesseract"),C.forEach(s),Js.forEach(s),x=t(b," installed in addition to \u{1F917} Transformers:"),b.forEach(s),E=m(M),d(U.$$.fragment,M),this.h()},h(){c(v,"href","https://pypi.org/project/pytesseract/"),c(v,"rel","nofollow")},m(M,b){o(M,u,b),a(u,J),a(u,v),a(v,T),a(T,_),a(u,x),o(M,E,b),y(U,M,b),le=!0},p:Vo,i(M){le||(w(U.$$.fragment,M),le=!0)},o(M){j(U.$$.fragment,M),le=!1},d(M){M&&s(u),M&&s(E),g(U,M)}}}function qo(ae){let u,J,v,T,_,x,E,U,le,M,b,Js,C,Pt,zt,We,Ht,Qt,Ts,Dt,Lt,ll,W,Be,Ot,xs,Kt,en,sn,ca,an,ln,Ne,tn,ks,nn,pn,tl,te,nl,S,ne,ha,Ae,rn,ma,on,il,I,cn,Us,hn,mn,Es,un,fn,$s,dn,yn,pl,_s,Xe,wn,Is,jn,gn,rl,Re,ol,Ve,Ye,vn,Gs,bn,Mn,cl,Ce,hl,B,Jn,Se,Tn,xn,qe,kn,Un,ml,Fe,ul,ie,En,Zs,$n,_n,fl,Ws,In,dl,Pe,yl,Bs,Gn,wl,Ns,As,Zn,jl,Xs,Rs,Wn,gl,q,pe,ua,ze,Bn,fa,Nn,vl,He,Vs,An,Xn,bl,Qe,Ml,Ys,Rn,Jl,F,re,da,De,Vn,ya,Yn,Tl,oe,Cn,wa,Sn,qn,xl,Le,kl,N,Fn,ja,Pn,zn,Oe,Hn,Qn,Ul,Ke,El,G,Dn,ga,Ln,On,va,Kn,ei,ba,si,ai,$l,P,ce,Ma,es,li,Ja,ti,_l,he,ni,ss,ii,pi,Il,Cs,ri,Gl,as,Zl,Ss,oi,Wl,me,ci,qs,Ta,hi,mi,Bl,z,ue,xa,ls,ui,ka,fi,Nl,A,di,fe,yi,Ua,wi,ji,gi,Ea,vi,bi,Al,ts,Xl,de,Mi,$a,Ji,Ti,Rl,X,xi,Fs,ki,Ui,_a,Ei,$i,Vl,ye,_i,ns,Ii,Gi,Yl,H,we,Ia,is,Zi,Ga,Wi,Cl,Ps,Bi,Sl,ps,ql,R,Ni,Za,Ai,Xi,rs,Ri,Vi,Fl,je,Yi,Wa,Ci,Si,Pl,ge,qi,os,Fi,Pi,zl,cs,Hl,Q,ve,Ba,hs,zi,Na,Hi,Ql,be,Dl,zs,Hs,Qi,Ll,D,Me,Aa,ms,Di,Xa,Li,Ol,Je,Oi,Qs,Ki,ep,Kl,Ds,sp,et,Ls,Os,Cp,st,us,at,L,Te,Ra,fs,ap,Va,lp,lt,xe,tp,Ks,np,ip,tt,ds,nt,O,ke,Ya,ys,pp,Ca,rp,it,Ue,op,ea,cp,hp,pt,Ee,mp,ws,up,fp,rt,js,ot,$e,ct,K,_e,Sa,gs,dp,ee,yp,qa,wp,jp,Fa,gp,vp,ht,$,bp,Pa,Mp,Jp,za,Tp,xp,Ha,kp,Up,Qa,Ep,$p,mt,V,_p,Da,Ip,Gp,La,Zp,Wp,ut,vs,ft,se,Bp,Oa,Np,Ap,Ka,Xp,dt,bs,yt,sa,Rp,wt;return x=new Z({}),te=new Yp({props:{$$slots:{default:[Yo]},$$scope:{ctx:ae}}}),Ae=new Z({}),Re=new k({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBZ2VuZXJhdG9yJTIwJTNEJTIwcGlwZWxpbmUodGFzayUzRCUyMmF1dG9tYXRpYy1zcGVlY2gtcmVjb2duaXRpb24lMjIp",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>generator = pipeline(task=<span class="hljs-string">&quot;automatic-speech-recognition&quot;</span>)`}}),Ce=new k({props:{code:"Z2VuZXJhdG9yKCUyMmh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZkYXRhc2V0cyUyRk5hcnNpbCUyRmFzcl9kdW1teSUyRnJlc29sdmUlMkZtYWluJTJGbWxrLmZsYWMlMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>generator(<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 BUT ONE DAY THIS NATION WILL RISE UP LIVE UP THE TRUE MEANING OF ITS TREES&#x27;</span>}`}}),Fe=new k({props:{code:"Z2VuZXJhdG9yJTIwJTNEJTIwcGlwZWxpbmUobW9kZWwlM0QlMjJvcGVuYWklMkZ3aGlzcGVyLWxhcmdlJTIyKSUwQWdlbmVyYXRvciglMjJodHRwcyUzQSUyRiUyRmh1Z2dpbmdmYWNlLmNvJTJGZGF0YXNldHMlMkZOYXJzaWwlMkZhc3JfZHVtbXklMkZyZXNvbHZlJTJGbWFpbiUyRm1say5mbGFjJTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>generator = pipeline(model=<span class="hljs-string">&quot;openai/whisper-large&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>generator(<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>}`}}),Pe=new k({props:{code:"Z2VuZXJhdG9yKCUwQSUyMCUyMCUyMCUyMCU1QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMmh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZkYXRhc2V0cyUyRk5hcnNpbCUyRmFzcl9kdW1teSUyRnJlc29sdmUlMkZtYWluJTJGbWxrLmZsYWMlMjIlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjJodHRwcyUzQSUyRiUyRmh1Z2dpbmdmYWNlLmNvJTJGZGF0YXNldHMlMkZOYXJzaWwlMkZhc3JfZHVtbXklMkZyZXNvbHZlJTJGbWFpbiUyRjEuZmxhYyUyMiUyQyUwQSUyMCUyMCUyMCUyMCU1RCUwQSk=",highlighted:`generator(
    [
        <span class="hljs-string">&quot;https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac&quot;</span>,
        <span class="hljs-string">&quot;https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/1.flac&quot;</span>,
    ]
)`}}),ze=new Z({}),Qe=new k({props:{code:"Z2VuZXJhdG9yJTIwJTNEJTIwcGlwZWxpbmUobW9kZWwlM0QlMjJvcGVuYWklMkZ3aGlzcGVyLWxhcmdlJTIyJTJDJTIwbXlfcGFyYW1ldGVyJTNEMSklMEFvdXQlMjAlM0QlMjBnZW5lcmF0b3IoLi4uKSUyMCUyMCUyMyUyMFRoaXMlMjB3aWxsJTIwdXNlJTIwJTYwbXlfcGFyYW1ldGVyJTNEMSU2MC4lMEFvdXQlMjAlM0QlMjBnZW5lcmF0b3IoLi4uJTJDJTIwbXlfcGFyYW1ldGVyJTNEMiklMjAlMjAlMjMlMjBUaGlzJTIwd2lsbCUyMG92ZXJyaWRlJTIwYW5kJTIwdXNlJTIwJTYwbXlfcGFyYW1ldGVyJTNEMiU2MC4lMEFvdXQlMjAlM0QlMjBnZW5lcmF0b3IoLi4uKSUyMCUyMCUyMyUyMFRoaXMlMjB3aWxsJTIwZ28lMjBiYWNrJTIwdG8lMjB1c2luZyUyMCU2MG15X3BhcmFtZXRlciUzRDElNjAu",highlighted:'generator = pipeline(model=<span class="hljs-string">&quot;openai/whisper-large&quot;</span>, my_parameter=<span class="hljs-number">1</span>)\nout = generator(...)  <span class="hljs-comment"># This will use `my_parameter=1`.</span>\nout = generator(..., my_parameter=<span class="hljs-number">2</span>)  <span class="hljs-comment"># This will override and use `my_parameter=2`.</span>\nout = generator(...)  <span class="hljs-comment"># This will go back to using `my_parameter=1`.</span>'}}),De=new Z({}),Le=new k({props:{code:"Z2VuZXJhdG9yJTIwJTNEJTIwcGlwZWxpbmUobW9kZWwlM0QlMjJvcGVuYWklMkZ3aGlzcGVyLWxhcmdlJTIyJTJDJTIwZGV2aWNlJTNEMCk=",highlighted:'generator = pipeline(model=<span class="hljs-string">&quot;openai/whisper-large&quot;</span>, device=<span class="hljs-number">0</span>)'}}),Ke=new k({props:{code:"JTIzIXBpcCUyMGluc3RhbGwlMjBhY2NlbGVyYXRlJTBBZ2VuZXJhdG9yJTIwJTNEJTIwcGlwZWxpbmUobW9kZWwlM0QlMjJvcGVuYWklMkZ3aGlzcGVyLWxhcmdlJTIyJTJDJTIwZGV2aWNlX21hcCUzRCUyMmF1dG8lMjIp",highlighted:`<span class="hljs-comment">#!pip install accelerate</span>
generator = pipeline(model=<span class="hljs-string">&quot;openai/whisper-large&quot;</span>, device_map=<span class="hljs-string">&quot;auto&quot;</span>)`}}),es=new Z({}),as=new k({props:{code:"Z2VuZXJhdG9yJTIwJTNEJTIwcGlwZWxpbmUobW9kZWwlM0QlMjJvcGVuYWklMkZ3aGlzcGVyLWxhcmdlJTIyJTJDJTIwZGV2aWNlJTNEMCUyQyUyMGJhdGNoX3NpemUlM0QyKSUwQWF1ZGlvX2ZpbGVuYW1lcyUyMCUzRCUyMCU1QmYlMjJhdWRpb18lN0JpJTdELmZsYWMlMjIlMjBmb3IlMjBpJTIwaW4lMjByYW5nZSgxMCklNUQlMEF0ZXh0cyUyMCUzRCUyMGdlbmVyYXRvcihhdWRpb19maWxlbmFtZXMp",highlighted:`generator = pipeline(model=<span class="hljs-string">&quot;openai/whisper-large&quot;</span>, device=<span class="hljs-number">0</span>, batch_size=<span class="hljs-number">2</span>)
audio_filenames = [<span class="hljs-string">f&quot;audio_<span class="hljs-subst">{i}</span>.flac&quot;</span> <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> <span class="hljs-built_in">range</span>(<span class="hljs-number">10</span>)]
texts = generator(audio_filenames)`}}),ls=new Z({}),ts=new k({props:{code:"JTIzJTIwTm90JTIwdXNpbmclMjB3aGlzcGVyJTJDJTIwYXMlMjBpdCUyMGNhbm5vdCUyMHByb3ZpZGUlMjB0aW1lc3RhbXBzLiUwQWdlbmVyYXRvciUyMCUzRCUyMHBpcGVsaW5lKG1vZGVsJTNEJTIyZmFjZWJvb2slMkZ3YXYydmVjMi1sYXJnZS05NjBoLWx2NjAtc2VsZiUyMiUyQyUyMHJldHVybl90aW1lc3RhbXBzJTNEJTIyd29yZCUyMiklMEFnZW5lcmF0b3IoJTIyaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRmRhdGFzZXRzJTJGTmFyc2lsJTJGYXNyX2R1bW15JTJGcmVzb2x2ZSUyRm1haW4lMkZtbGsuZmxhYyUyMik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Not using whisper, as it cannot provide timestamps.</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>generator = pipeline(model=<span class="hljs-string">&quot;facebook/wav2vec2-large-960h-lv60-self&quot;</span>, return_timestamps=<span class="hljs-string">&quot;word&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>generator(<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 BUT ONE DAY THIS NATION WILL RISE UP AND LIVE OUT THE TRUE MEANING OF ITS CREED&#x27;</span>, <span class="hljs-string">&#x27;chunks&#x27;</span>: [{<span class="hljs-string">&#x27;text&#x27;</span>: <span class="hljs-string">&#x27;I&#x27;</span>, <span class="hljs-string">&#x27;timestamp&#x27;</span>: (<span class="hljs-number">1.22</span>, <span class="hljs-number">1.24</span>)}, {<span class="hljs-string">&#x27;text&#x27;</span>: <span class="hljs-string">&#x27;HAVE&#x27;</span>, <span class="hljs-string">&#x27;timestamp&#x27;</span>: (<span class="hljs-number">1.42</span>, <span class="hljs-number">1.58</span>)}, {<span class="hljs-string">&#x27;text&#x27;</span>: <span class="hljs-string">&#x27;A&#x27;</span>, <span class="hljs-string">&#x27;timestamp&#x27;</span>: (<span class="hljs-number">1.66</span>, <span class="hljs-number">1.68</span>)}, {<span class="hljs-string">&#x27;text&#x27;</span>: <span class="hljs-string">&#x27;DREAM&#x27;</span>, <span class="hljs-string">&#x27;timestamp&#x27;</span>: (<span class="hljs-number">1.76</span>, <span class="hljs-number">2.14</span>)}, {<span class="hljs-string">&#x27;text&#x27;</span>: <span class="hljs-string">&#x27;BUT&#x27;</span>, <span class="hljs-string">&#x27;timestamp&#x27;</span>: (<span class="hljs-number">3.68</span>, <span class="hljs-number">3.8</span>)}, {<span class="hljs-string">&#x27;text&#x27;</span>: <span class="hljs-string">&#x27;ONE&#x27;</span>, <span class="hljs-string">&#x27;timestamp&#x27;</span>: (<span class="hljs-number">3.94</span>, <span class="hljs-number">4.06</span>)}, {<span class="hljs-string">&#x27;text&#x27;</span>: <span class="hljs-string">&#x27;DAY&#x27;</span>, <span class="hljs-string">&#x27;timestamp&#x27;</span>: (<span class="hljs-number">4.16</span>, <span class="hljs-number">4.3</span>)}, {<span class="hljs-string">&#x27;text&#x27;</span>: <span class="hljs-string">&#x27;THIS&#x27;</span>, <span class="hljs-string">&#x27;timestamp&#x27;</span>: (<span class="hljs-number">6.36</span>, <span class="hljs-number">6.54</span>)}, {<span class="hljs-string">&#x27;text&#x27;</span>: <span class="hljs-string">&#x27;NATION&#x27;</span>, <span class="hljs-string">&#x27;timestamp&#x27;</span>: (<span class="hljs-number">6.68</span>, <span class="hljs-number">7.1</span>)}, {<span class="hljs-string">&#x27;text&#x27;</span>: <span class="hljs-string">&#x27;WILL&#x27;</span>, <span class="hljs-string">&#x27;timestamp&#x27;</span>: (<span class="hljs-number">7.32</span>, <span class="hljs-number">7.56</span>)}, {<span class="hljs-string">&#x27;text&#x27;</span>: <span class="hljs-string">&#x27;RISE&#x27;</span>, <span class="hljs-string">&#x27;timestamp&#x27;</span>: (<span class="hljs-number">7.8</span>, <span class="hljs-number">8.26</span>)}, {<span class="hljs-string">&#x27;text&#x27;</span>: <span class="hljs-string">&#x27;UP&#x27;</span>, <span class="hljs-string">&#x27;timestamp&#x27;</span>: (<span class="hljs-number">8.38</span>, <span class="hljs-number">8.48</span>)}, {<span class="hljs-string">&#x27;text&#x27;</span>: <span class="hljs-string">&#x27;AND&#x27;</span>, <span class="hljs-string">&#x27;timestamp&#x27;</span>: (<span class="hljs-number">10.08</span>, <span class="hljs-number">10.18</span>)}, {<span class="hljs-string">&#x27;text&#x27;</span>: <span class="hljs-string">&#x27;LIVE&#x27;</span>, <span class="hljs-string">&#x27;timestamp&#x27;</span>: (<span class="hljs-number">10.26</span>, <span class="hljs-number">10.48</span>)}, {<span class="hljs-string">&#x27;text&#x27;</span>: <span class="hljs-string">&#x27;OUT&#x27;</span>, <span class="hljs-string">&#x27;timestamp&#x27;</span>: (<span class="hljs-number">10.58</span>, <span class="hljs-number">10.7</span>)}, {<span class="hljs-string">&#x27;text&#x27;</span>: <span class="hljs-string">&#x27;THE&#x27;</span>, <span class="hljs-string">&#x27;timestamp&#x27;</span>: (<span class="hljs-number">10.82</span>, <span class="hljs-number">10.9</span>)}, {<span class="hljs-string">&#x27;text&#x27;</span>: <span class="hljs-string">&#x27;TRUE&#x27;</span>, <span class="hljs-string">&#x27;timestamp&#x27;</span>: (<span class="hljs-number">10.98</span>, <span class="hljs-number">11.18</span>)}, {<span class="hljs-string">&#x27;text&#x27;</span>: <span class="hljs-string">&#x27;MEANING&#x27;</span>, <span class="hljs-string">&#x27;timestamp&#x27;</span>: (<span class="hljs-number">11.26</span>, <span class="hljs-number">11.58</span>)}, {<span class="hljs-string">&#x27;text&#x27;</span>: <span class="hljs-string">&#x27;OF&#x27;</span>, <span class="hljs-string">&#x27;timestamp&#x27;</span>: (<span class="hljs-number">11.66</span>, <span class="hljs-number">11.7</span>)}, {<span class="hljs-string">&#x27;text&#x27;</span>: <span class="hljs-string">&#x27;ITS&#x27;</span>, <span class="hljs-string">&#x27;timestamp&#x27;</span>: (<span class="hljs-number">11.76</span>, <span class="hljs-number">11.88</span>)}, {<span class="hljs-string">&#x27;text&#x27;</span>: <span class="hljs-string">&#x27;CREED&#x27;</span>, <span class="hljs-string">&#x27;timestamp&#x27;</span>: (<span class="hljs-number">12.0</span>, <span class="hljs-number">12.38</span>)}]}`}}),is=new Z({}),ps=new k({props:{code:"ZGVmJTIwZGF0YSgpJTNBJTBBJTIwJTIwJTIwJTIwZm9yJTIwaSUyMGluJTIwcmFuZ2UoMTAwMCklM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjB5aWVsZCUyMGYlMjJNeSUyMGV4YW1wbGUlMjAlN0JpJTdEJTIyJTBBJTBBJTBBcGlwZSUyMCUzRCUyMHBpcGVsaW5lKG1vZGVsJTNEJTIyZ3B0MiUyMiUyQyUyMGRldmljZSUzRDApJTBBZ2VuZXJhdGVkX2NoYXJhY3RlcnMlMjAlM0QlMjAwJTBBZm9yJTIwb3V0JTIwaW4lMjBwaXBlKGRhdGEoKSklM0ElMEElMjAlMjAlMjAlMjBnZW5lcmF0ZWRfY2hhcmFjdGVycyUyMCUyQiUzRCUyMGxlbihvdXQlNUIwJTVEJTVCJTIyZ2VuZXJhdGVkX3RleHQlMjIlNUQp",highlighted:`<span class="hljs-keyword">def</span> <span class="hljs-title function_">data</span>():
    <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> <span class="hljs-built_in">range</span>(<span class="hljs-number">1000</span>):
        <span class="hljs-keyword">yield</span> <span class="hljs-string">f&quot;My example <span class="hljs-subst">{i}</span>&quot;</span>


pipe = pipeline(model=<span class="hljs-string">&quot;gpt2&quot;</span>, device=<span class="hljs-number">0</span>)
generated_characters = <span class="hljs-number">0</span>
<span class="hljs-keyword">for</span> out <span class="hljs-keyword">in</span> pipe(data()):
    generated_characters += <span class="hljs-built_in">len</span>(out[<span class="hljs-number">0</span>][<span class="hljs-string">&quot;generated_text&quot;</span>])`}}),cs=new k({props:{code:"JTIzJTIwS2V5RGF0YXNldCUyMGlzJTIwYSUyMHV0aWwlMjB0aGF0JTIwd2lsbCUyMGp1c3QlMjBvdXRwdXQlMjB0aGUlMjBpdGVtJTIwd2UncmUlMjBpbnRlcmVzdGVkJTIwaW4uJTBBZnJvbSUyMHRyYW5zZm9ybWVycy5waXBlbGluZXMucHRfdXRpbHMlMjBpbXBvcnQlMjBLZXlEYXRhc2V0JTBBZnJvbSUyMGRhdGFzZXRzJTIwaW1wb3J0JTIwbG9hZF9kYXRhc2V0JTBBJTBBcGlwZSUyMCUzRCUyMHBpcGVsaW5lKG1vZGVsJTNEJTIyaGYtaW50ZXJuYWwtdGVzdGluZyUyRnRpbnktcmFuZG9tLXdhdjJ2ZWMyJTIyJTJDJTIwZGV2aWNlJTNEMCklMEFkYXRhc2V0JTIwJTNEJTIwbG9hZF9kYXRhc2V0KCUyMmhmLWludGVybmFsLXRlc3RpbmclMkZsaWJyaXNwZWVjaF9hc3JfZHVtbXklMjIlMkMlMjAlMjJjbGVhbiUyMiUyQyUyMHNwbGl0JTNEJTIydmFsaWRhdGlvbiU1QiUzQTEwJTVEJTIyKSUwQSUwQWZvciUyMG91dCUyMGluJTIwcGlwZShLZXlEYXRhc2V0KGRhdGFzZXQlMkMlMjAlMjJhdWRpbyUyMikpJTNBJTBBJTIwJTIwJTIwJTIwcHJpbnQob3V0KQ==",highlighted:`<span class="hljs-comment"># KeyDataset is a util that will just output the item we&#x27;re interested in.</span>
<span class="hljs-keyword">from</span> transformers.pipelines.pt_utils <span class="hljs-keyword">import</span> KeyDataset
<span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset

pipe = pipeline(model=<span class="hljs-string">&quot;hf-internal-testing/tiny-random-wav2vec2&quot;</span>, device=<span class="hljs-number">0</span>)
dataset = load_dataset(<span class="hljs-string">&quot;hf-internal-testing/librispeech_asr_dummy&quot;</span>, <span class="hljs-string">&quot;clean&quot;</span>, split=<span class="hljs-string">&quot;validation[:10]&quot;</span>)

<span class="hljs-keyword">for</span> out <span class="hljs-keyword">in</span> pipe(KeyDataset(dataset, <span class="hljs-string">&quot;audio&quot;</span>)):
    <span class="hljs-built_in">print</span>(out)`}}),hs=new Z({}),be=new Yp({props:{$$slots:{default:[Co]},$$scope:{ctx:ae}}}),ms=new Z({}),us=new k({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBdmlzaW9uX2NsYXNzaWZpZXIlMjAlM0QlMjBwaXBlbGluZShtb2RlbCUzRCUyMmdvb2dsZSUyRnZpdC1iYXNlLXBhdGNoMTYtMjI0JTIyKSUwQXByZWRzJTIwJTNEJTIwdmlzaW9uX2NsYXNzaWZpZXIoJTBBJTIwJTIwJTIwJTIwaW1hZ2VzJTNEJTIyaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRmRhdGFzZXRzJTJGaHVnZ2luZ2ZhY2UlMkZkb2N1bWVudGF0aW9uLWltYWdlcyUyRnJlc29sdmUlMkZtYWluJTJGcGlwZWxpbmUtY2F0LWNob25rLmpwZWclMjIlMEEpJTBBcHJlZHMlMjAlM0QlMjAlNUIlN0IlMjJzY29yZSUyMiUzQSUyMHJvdW5kKHByZWQlNUIlMjJzY29yZSUyMiU1RCUyQyUyMDQpJTJDJTIwJTIybGFiZWwlMjIlM0ElMjBwcmVkJTVCJTIybGFiZWwlMjIlNUQlN0QlMjBmb3IlMjBwcmVkJTIwaW4lMjBwcmVkcyU1RCUwQXByZWRz",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>vision_classifier = pipeline(model=<span class="hljs-string">&quot;google/vit-base-patch16-224&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>preds = vision_classifier(
<span class="hljs-meta">... </span>    images=<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>preds
[{<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>}]`}}),fs=new Z({}),ds=new k({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBJTIzJTIwVGhpcyUyMG1vZGVsJTIwaXMlMjBhJTIwJTYwemVyby1zaG90LWNsYXNzaWZpY2F0aW9uJTYwJTIwbW9kZWwuJTBBJTIzJTIwSXQlMjB3aWxsJTIwY2xhc3NpZnklMjB0ZXh0JTJDJTIwZXhjZXB0JTIweW91JTIwYXJlJTIwZnJlZSUyMHRvJTIwY2hvb3NlJTIwYW55JTIwbGFiZWwlMjB5b3UlMjBtaWdodCUyMGltYWdpbmUlMEFjbGFzc2lmaWVyJTIwJTNEJTIwcGlwZWxpbmUobW9kZWwlM0QlMjJmYWNlYm9vayUyRmJhcnQtbGFyZ2UtbW5saSUyMiklMEFjbGFzc2lmaWVyKCUwQSUyMCUyMCUyMCUyMCUyMkklMjBoYXZlJTIwYSUyMHByb2JsZW0lMjB3aXRoJTIwbXklMjBpcGhvbmUlMjB0aGF0JTIwbmVlZHMlMjB0byUyMGJlJTIwcmVzb2x2ZWQlMjBhc2FwISElMjIlMkMlMEElMjAlMjAlMjAlMjBjYW5kaWRhdGVfbGFiZWxzJTNEJTVCJTIydXJnZW50JTIyJTJDJTIwJTIybm90JTIwdXJnZW50JTIyJTJDJTIwJTIycGhvbmUlMjIlMkMlMjAlMjJ0YWJsZXQlMjIlMkMlMjAlMjJjb21wdXRlciUyMiU1RCUyQyUwQSk=",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-comment"># This model is a \`zero-shot-classification\` model.</span>
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># It will classify text, except you are free to choose any label you might imagine</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>classifier = pipeline(model=<span class="hljs-string">&quot;facebook/bart-large-mnli&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>classifier(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;I have a problem with my iphone that needs to be resolved asap!!&quot;</span>,
<span class="hljs-meta">... </span>    candidate_labels=[<span class="hljs-string">&quot;urgent&quot;</span>, <span class="hljs-string">&quot;not urgent&quot;</span>, <span class="hljs-string">&quot;phone&quot;</span>, <span class="hljs-string">&quot;tablet&quot;</span>, <span class="hljs-string">&quot;computer&quot;</span>],
<span class="hljs-meta">... </span>)
{<span class="hljs-string">&#x27;sequence&#x27;</span>: <span class="hljs-string">&#x27;I have a problem with my iphone that needs to be resolved asap!!&#x27;</span>, <span class="hljs-string">&#x27;labels&#x27;</span>: [<span class="hljs-string">&#x27;urgent&#x27;</span>, <span class="hljs-string">&#x27;phone&#x27;</span>, <span class="hljs-string">&#x27;computer&#x27;</span>, <span class="hljs-string">&#x27;not urgent&#x27;</span>, <span class="hljs-string">&#x27;tablet&#x27;</span>], <span class="hljs-string">&#x27;scores&#x27;</span>: [<span class="hljs-number">0.504</span>, <span class="hljs-number">0.479</span>, <span class="hljs-number">0.013</span>, <span class="hljs-number">0.003</span>, <span class="hljs-number">0.002</span>]}`}}),ys=new Z({}),js=new k({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBdnFhJTIwJTNEJTIwcGlwZWxpbmUobW9kZWwlM0QlMjJpbXBpcmElMkZsYXlvdXRsbS1kb2N1bWVudC1xYSUyMiklMEF2cWEoJTBBJTIwJTIwJTIwJTIwaW1hZ2UlM0QlMjJodHRwcyUzQSUyRiUyRmh1Z2dpbmdmYWNlLmNvJTJGc3BhY2VzJTJGaW1waXJhJTJGZG9jcXVlcnklMkZyZXNvbHZlJTJGMjM1OTIyM2MxODM3YTc1ODc0MDJiZGEwZjI2NDMzODJhNmVlZmVhYiUyRmludm9pY2UucG5nJTIyJTJDJTBBJTIwJTIwJTIwJTIwcXVlc3Rpb24lM0QlMjJXaGF0JTIwaXMlMjB0aGUlMjBpbnZvaWNlJTIwbnVtYmVyJTNGJTIyJTJDJTBBKQ==",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>vqa = pipeline(model=<span class="hljs-string">&quot;impira/layoutlm-document-qa&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>vqa(
<span class="hljs-meta">... </span>    image=<span class="hljs-string">&quot;https://huggingface.co/spaces/impira/docquery/resolve/2359223c1837a7587402bda0f2643382a6eefeab/invoice.png&quot;</span>,
<span class="hljs-meta">... </span>    question=<span class="hljs-string">&quot;What is the invoice number?&quot;</span>,
<span class="hljs-meta">... </span>)
[{<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.42515</span>, <span class="hljs-string">&#x27;answer&#x27;</span>: <span class="hljs-string">&#x27;us-001&#x27;</span>, <span class="hljs-string">&#x27;start&#x27;</span>: <span class="hljs-number">16</span>, <span class="hljs-string">&#x27;end&#x27;</span>: <span class="hljs-number">16</span>}]`}}),$e=new Yp({props:{$$slots:{default:[So]},$$scope:{ctx:ae}}}),gs=new Z({}),vs=new k({props:{code:"JTIzJTIwcGlwJTIwaW5zdGFsbCUyMGFjY2VsZXJhdGUlMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjB0cmFuc2Zvcm1lcnMlMjBpbXBvcnQlMjBwaXBlbGluZSUwQSUwQXBpcGUlMjAlM0QlMjBwaXBlbGluZShtb2RlbCUzRCUyMmZhY2Vib29rJTJGb3B0LTEuM2IlMjIlMkMlMjB0b3JjaF9kdHlwZSUzRHRvcmNoLmJmbG9hdDE2JTJDJTIwZGV2aWNlX21hcCUzRCUyMmF1dG8lMjIpJTBBb3V0cHV0JTIwJTNEJTIwcGlwZSglMjJUaGlzJTIwaXMlMjBhJTIwY29vbCUyMGV4YW1wbGUhJTIyJTJDJTIwZG9fc2FtcGxlJTNEVHJ1ZSUyQyUyMHRvcF9wJTNEMC45NSk=",highlighted:`<span class="hljs-comment"># pip install accelerate</span>
<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

pipe = pipeline(model=<span class="hljs-string">&quot;facebook/opt-1.3b&quot;</span>, torch_dtype=torch.bfloat16, device_map=<span class="hljs-string">&quot;auto&quot;</span>)
output = pipe(<span class="hljs-string">&quot;This is a cool example!&quot;</span>, do_sample=<span class="hljs-literal">True</span>, top_p=<span class="hljs-number">0.95</span>)`}}),bs=new k({props:{code:"JTIzJTIwcGlwJTIwaW5zdGFsbCUyMGFjY2VsZXJhdGUlMjBiaXRzYW5kYnl0ZXMlMEFpbXBvcnQlMjB0b3JjaCUwQWZyb20lMjB0cmFuc2Zvcm1lcnMlMjBpbXBvcnQlMjBwaXBlbGluZSUwQSUwQXBpcGUlMjAlM0QlMjBwaXBlbGluZShtb2RlbCUzRCUyMmZhY2Vib29rJTJGb3B0LTEuM2IlMjIlMkMlMjBkZXZpY2VfbWFwJTNEJTIyYXV0byUyMiUyQyUyMG1vZGVsX2t3YXJncyUzRCU3QiUyMmxvYWRfaW5fOGJpdCUyMiUzQSUyMFRydWUlN0QpJTBBb3V0cHV0JTIwJTNEJTIwcGlwZSglMjJUaGlzJTIwaXMlMjBhJTIwY29vbCUyMGV4YW1wbGUhJTIyJTJDJTIwZG9fc2FtcGxlJTNEVHJ1ZSUyQyUyMHRvcF9wJTNEMC45NSk=",highlighted:`<span class="hljs-comment"># pip install accelerate bitsandbytes</span>
<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

pipe = pipeline(model=<span class="hljs-string">&quot;facebook/opt-1.3b&quot;</span>, device_map=<span class="hljs-string">&quot;auto&quot;</span>, model_kwargs={<span class="hljs-string">&quot;load_in_8bit&quot;</span>: <span class="hljs-literal">True</span>})
output = pipe(<span class="hljs-string">&quot;This is a cool example!&quot;</span>, do_sample=<span class="hljs-literal">True</span>, top_p=<span class="hljs-number">0.95</span>)`}}),{c(){u=i("meta"),J=h(),v=i("h1"),T=i("a"),_=i("span"),f(x.$$.fragment),E=h(),U=i("span"),le=l("Pipelines for inference"),M=h(),b=i("p"),Js=l("The "),C=i("a"),Pt=l("pipeline()"),zt=l(" makes it simple to use any model from the "),We=i("a"),Ht=l("Hub"),Qt=l(" for inference on any language, computer vision, speech, and multimodal tasks. Even if you don\u2019t have experience with a specific modality or aren\u2019t familiar with the underlying code behind the models, you can still use them for inference with the "),Ts=i("a"),Dt=l("pipeline()"),Lt=l("! This tutorial will teach you to:"),ll=h(),W=i("ul"),Be=i("li"),Ot=l("Use a "),xs=i("a"),Kt=l("pipeline()"),en=l(" for inference."),sn=h(),ca=i("li"),an=l("Use a specific tokenizer or model."),ln=h(),Ne=i("li"),tn=l("Use a "),ks=i("a"),nn=l("pipeline()"),pn=l(" for audio, vision, and multimodal tasks."),tl=h(),f(te.$$.fragment),nl=h(),S=i("h2"),ne=i("a"),ha=i("span"),f(Ae.$$.fragment),rn=h(),ma=i("span"),on=l("Pipeline usage"),il=h(),I=i("p"),cn=l("While each task has an associated "),Us=i("a"),hn=l("pipeline()"),mn=l(", it is simpler to use the general "),Es=i("a"),un=l("pipeline()"),fn=l(" abstraction which contains all the task-specific pipelines. The "),$s=i("a"),dn=l("pipeline()"),yn=l(" automatically loads a default model and a preprocessing class capable of inference for your task."),pl=h(),_s=i("ol"),Xe=i("li"),wn=l("Start by creating a "),Is=i("a"),jn=l("pipeline()"),gn=l(" and specify an inference task:"),rl=h(),f(Re.$$.fragment),ol=h(),Ve=i("ol"),Ye=i("li"),vn=l("Pass your input text to the "),Gs=i("a"),bn=l("pipeline()"),Mn=l(":"),cl=h(),f(Ce.$$.fragment),hl=h(),B=i("p"),Jn=l("Not the result you had in mind? Check out some of the "),Se=i("a"),Tn=l("most downloaded automatic speech recognition models"),xn=l(` on the Hub to see if you can get a better transcription.
Let\u2019s try `),qe=i("a"),kn=l("openai/whisper-large"),Un=l(":"),ml=h(),f(Fe.$$.fragment),ul=h(),ie=i("p"),En=l(`Now this result looks more accurate!
We really encourage you to check out the Hub for models in different languages, models specialized in your field, and more.
You can check out and compare model results directly from your browser on the Hub to see if it fits or
handles corner cases better than other ones.
And if you don\u2019t find a model for your use case, you can always start `),Zs=i("a"),$n=l("training"),_n=l(" your own!"),fl=h(),Ws=i("p"),In=l("If you have several inputs, you can pass your input as a list:"),dl=h(),f(Pe.$$.fragment),yl=h(),Bs=i("p"),Gn=l("If you want to iterate over a whole dataset, or want to use it for inference in a webserver, check out dedicated parts"),wl=h(),Ns=i("p"),As=i("a"),Zn=l("Using pipelines on a dataset"),jl=h(),Xs=i("p"),Rs=i("a"),Wn=l("Using pipelines for a webserver"),gl=h(),q=i("h2"),pe=i("a"),ua=i("span"),f(ze.$$.fragment),Bn=h(),fa=i("span"),Nn=l("Parameters"),vl=h(),He=i("p"),Vs=i("a"),An=l("pipeline()"),Xn=l(` supports many parameters; some are task specific, and some are general to all pipelines.
In general you can specify parameters anywhere you want:`),bl=h(),f(Qe.$$.fragment),Ml=h(),Ys=i("p"),Rn=l("Let\u2019s check out 3 important ones:"),Jl=h(),F=i("h3"),re=i("a"),da=i("span"),f(De.$$.fragment),Vn=h(),ya=i("span"),Yn=l("Device"),Tl=h(),oe=i("p"),Cn=l("If you use "),wa=i("code"),Sn=l("device=n"),qn=l(`, the pipeline automatically puts the model on the specified device.
This will work regardless of whether you are using PyTorch or Tensorflow.`),xl=h(),f(Le.$$.fragment),kl=h(),N=i("p"),Fn=l("If the model is too large for a single GPU, you can set "),ja=i("code"),Pn=l('device_map="auto"'),zn=l(" to allow \u{1F917} "),Oe=i("a"),Hn=l("Accelerate"),Qn=l(" to automatically determine how to load and store the model weights."),Ul=h(),f(Ke.$$.fragment),El=h(),G=i("p"),Dn=l("Note that if  "),ga=i("code"),Ln=l('device_map="auto"'),On=l(" is passed, there is no need to add the argument "),va=i("code"),Kn=l("device=device"),ei=l(" when instantiating your "),ba=i("code"),si=l("pipeline"),ai=l(" as you may encounter some unexpected behavior!"),$l=h(),P=i("h3"),ce=i("a"),Ma=i("span"),f(es.$$.fragment),li=h(),Ja=i("span"),ti=l("Batch size"),_l=h(),he=i("p"),ni=l("By default, pipelines will not batch inference for reasons explained in detail "),ss=i("a"),ii=l("here"),pi=l(". The reason is that batching is not necessarily faster, and can actually be quite slower in some cases."),Il=h(),Cs=i("p"),ri=l("But if it works in your use case, you can use:"),Gl=h(),f(as.$$.fragment),Zl=h(),Ss=i("p"),oi=l(`This runs the pipeline on the 10 provided audio files, but it will pass them in batches of 2
to the model (which is on a GPU, where batching is more likely to help) without requiring any further code from you.
The output should always match what you would have received without batching. It is only meant as a way to help you get more speed out of a pipeline.`),Wl=h(),me=i("p"),ci=l("Pipelines can also alleviate some of the complexities of batching because, for some pipelines, a single item (like a long audio file) needs to be chunked into multiple parts to be processed by a model. The pipeline performs this "),qs=i("a"),Ta=i("em"),hi=l("chunk batching"),mi=l(" for you."),Bl=h(),z=i("h3"),ue=i("a"),xa=i("span"),f(ls.$$.fragment),ui=h(),ka=i("span"),fi=l("Task specific parameters"),Nl=h(),A=i("p"),di=l(`All tasks provide task specific parameters which allow for additional flexibility and options to help you get your job done.
For instance, the `),fe=i("a"),yi=l("transformers.AutomaticSpeechRecognitionPipeline."),Ua=i("strong"),wi=l("call"),ji=l("()"),gi=l(" method has a "),Ea=i("code"),vi=l("return_timestamps"),bi=l(" parameter which sounds promising for subtitling videos:"),Al=h(),f(ts.$$.fragment),Xl=h(),de=i("p"),Mi=l("As you can see, the model inferred the text and also outputted "),$a=i("strong"),Ji=l("when"),Ti=l(` the various words were pronounced
in the sentence.`),Rl=h(),X=i("p"),xi=l(`There are many parameters available for each task, so check out each task\u2019s API reference to see what you can tinker with!
For instance, the `),Fs=i("a"),ki=l("AutomaticSpeechRecognitionPipeline"),Ui=l(" has a "),_a=i("code"),Ei=l("chunk_length_s"),$i=l(" parameter which is helpful for working on really long audio files (for example, subtitling entire movies or hour-long videos) that a model typically cannot handle on its own."),Vl=h(),ye=i("p"),_i=l("If you can\u2019t find a parameter that would really help you out, feel free to "),ns=i("a"),Ii=l("request it"),Gi=l("!"),Yl=h(),H=i("h2"),we=i("a"),Ia=i("span"),f(is.$$.fragment),Zi=h(),Ga=i("span"),Wi=l("Using pipelines on a dataset"),Cl=h(),Ps=i("p"),Bi=l("The pipeline can also run inference on a large dataset. The easiest way we recommend doing this is by using an iterator:"),Sl=h(),f(ps.$$.fragment),ql=h(),R=i("p"),Ni=l("The iterator "),Za=i("code"),Ai=l("data()"),Xi=l(` yields each result, and the pipeline automatically
recognizes the input is iterable and will start fetching the data while
it continues to process it on the GPU (this uses `),rs=i("a"),Ri=l("DataLoader"),Vi=l(` under the hood).
This is important because you don\u2019t have to allocate memory for the whole dataset
and you can feed the GPU as fast as possible.`),Fl=h(),je=i("p"),Yi=l("Since batching could speed things up, it may be useful to try tuning the "),Wa=i("code"),Ci=l("batch_size"),Si=l(" parameter here."),Pl=h(),ge=i("p"),qi=l("The simplest way to iterate over a dataset is to just load one from \u{1F917} "),os=i("a"),Fi=l("Datasets"),Pi=l(":"),zl=h(),f(cs.$$.fragment),Hl=h(),Q=i("h2"),ve=i("a"),Ba=i("span"),f(hs.$$.fragment),zi=h(),Na=i("span"),Hi=l("Using pipelines for a webserver"),Ql=h(),f(be.$$.fragment),Dl=h(),zs=i("p"),Hs=i("a"),Qi=l("Link"),Ll=h(),D=i("h2"),Me=i("a"),Aa=i("span"),f(ms.$$.fragment),Di=h(),Xa=i("span"),Li=l("Vision pipeline"),Ol=h(),Je=i("p"),Oi=l("Using a "),Qs=i("a"),Ki=l("pipeline()"),ep=l(" for vision tasks is practically identical."),Kl=h(),Ds=i("p"),sp=l("Specify your task and pass your image to the classifier. The image can be a link or a local path to the image. For example, what species of cat is shown below?"),et=h(),Ls=i("p"),Os=i("img"),st=h(),f(us.$$.fragment),at=h(),L=i("h2"),Te=i("a"),Ra=i("span"),f(fs.$$.fragment),ap=h(),Va=i("span"),lp=l("Text pipeline"),lt=h(),xe=i("p"),tp=l("Using a "),Ks=i("a"),np=l("pipeline()"),ip=l(" for NLP tasks is practically identical."),tt=h(),f(ds.$$.fragment),nt=h(),O=i("h2"),ke=i("a"),Ya=i("span"),f(ys.$$.fragment),pp=h(),Ca=i("span"),rp=l("Multimodal pipeline"),it=h(),Ue=i("p"),op=l("The "),ea=i("a"),cp=l("pipeline()"),hp=l(" supports more than one modality. For example, a visual question answering (VQA) task combines text and image. Feel free to use any image link you like and a question you want to ask about the image. The image can be a URL or a local path to the image."),pt=h(),Ee=i("p"),mp=l("For example, if you use this "),ws=i("a"),up=l("invoice image"),fp=l(":"),rt=h(),f(js.$$.fragment),ot=h(),f($e.$$.fragment),ct=h(),K=i("h2"),_e=i("a"),Sa=i("span"),f(gs.$$.fragment),dp=h(),ee=i("span"),yp=l("Using "),qa=i("code"),wp=l("pipeline"),jp=l(" on large models with \u{1F917} "),Fa=i("code"),gp=l("accelerate"),vp=l(":"),ht=h(),$=i("p"),bp=l("You can easily run "),Pa=i("code"),Mp=l("pipeline"),Jp=l(" on large models using \u{1F917} "),za=i("code"),Tp=l("accelerate"),xp=l("! First make sure you have installed "),Ha=i("code"),kp=l("accelerate"),Up=l(" with "),Qa=i("code"),Ep=l("pip install accelerate"),$p=l("."),mt=h(),V=i("p"),_p=l("First load your model using "),Da=i("code"),Ip=l('device_map="auto"'),Gp=l("! We will use "),La=i("code"),Zp=l("facebook/opt-1.3b"),Wp=l(" for our example."),ut=h(),f(vs.$$.fragment),ft=h(),se=i("p"),Bp=l("You can also pass 8-bit loaded models if you install "),Oa=i("code"),Np=l("bitsandbytes"),Ap=l(" and add the argument "),Ka=i("code"),Xp=l("load_in_8bit=True"),dt=h(),f(bs.$$.fragment),yt=h(),sa=i("p"),Rp=l("Note that you can replace the checkpoint with any of the Hugging Face model that supports large model loading such as BLOOM!"),this.h()},l(e){const n=Ao('[data-svelte="svelte-1phssyn"]',document.head);u=p(n,"META",{name:!0,content:!0}),n.forEach(s),J=m(e),v=p(e,"H1",{class:!0});var Ms=r(v);T=p(Ms,"A",{id:!0,class:!0,href:!0});var el=r(T);_=p(el,"SPAN",{});var sl=r(_);d(x.$$.fragment,sl),sl.forEach(s),el.forEach(s),E=m(Ms),U=p(Ms,"SPAN",{});var Sp=r(U);le=t(Sp,"Pipelines for inference"),Sp.forEach(s),Ms.forEach(s),M=m(e),b=p(e,"P",{});var Ie=r(b);Js=t(Ie,"The "),C=p(Ie,"A",{href:!0});var qp=r(C);Pt=t(qp,"pipeline()"),qp.forEach(s),zt=t(Ie," makes it simple to use any model from the "),We=p(Ie,"A",{href:!0,rel:!0});var Fp=r(We);Ht=t(Fp,"Hub"),Fp.forEach(s),Qt=t(Ie," for inference on any language, computer vision, speech, and multimodal tasks. Even if you don\u2019t have experience with a specific modality or aren\u2019t familiar with the underlying code behind the models, you can still use them for inference with the "),Ts=p(Ie,"A",{href:!0});var Pp=r(Ts);Dt=t(Pp,"pipeline()"),Pp.forEach(s),Lt=t(Ie,"! This tutorial will teach you to:"),Ie.forEach(s),ll=m(e),W=p(e,"UL",{});var aa=r(W);Be=p(aa,"LI",{});var jt=r(Be);Ot=t(jt,"Use a "),xs=p(jt,"A",{href:!0});var zp=r(xs);Kt=t(zp,"pipeline()"),zp.forEach(s),en=t(jt," for inference."),jt.forEach(s),sn=m(aa),ca=p(aa,"LI",{});var Hp=r(ca);an=t(Hp,"Use a specific tokenizer or model."),Hp.forEach(s),ln=m(aa),Ne=p(aa,"LI",{});var gt=r(Ne);tn=t(gt,"Use a "),ks=p(gt,"A",{href:!0});var Qp=r(ks);nn=t(Qp,"pipeline()"),Qp.forEach(s),pn=t(gt," for audio, vision, and multimodal tasks."),gt.forEach(s),aa.forEach(s),tl=m(e),d(te.$$.fragment,e),nl=m(e),S=p(e,"H2",{class:!0});var vt=r(S);ne=p(vt,"A",{id:!0,class:!0,href:!0});var Dp=r(ne);ha=p(Dp,"SPAN",{});var Lp=r(ha);d(Ae.$$.fragment,Lp),Lp.forEach(s),Dp.forEach(s),rn=m(vt),ma=p(vt,"SPAN",{});var Op=r(ma);on=t(Op,"Pipeline usage"),Op.forEach(s),vt.forEach(s),il=m(e),I=p(e,"P",{});var Ge=r(I);cn=t(Ge,"While each task has an associated "),Us=p(Ge,"A",{href:!0});var Kp=r(Us);hn=t(Kp,"pipeline()"),Kp.forEach(s),mn=t(Ge,", it is simpler to use the general "),Es=p(Ge,"A",{href:!0});var er=r(Es);un=t(er,"pipeline()"),er.forEach(s),fn=t(Ge," abstraction which contains all the task-specific pipelines. The "),$s=p(Ge,"A",{href:!0});var sr=r($s);dn=t(sr,"pipeline()"),sr.forEach(s),yn=t(Ge," automatically loads a default model and a preprocessing class capable of inference for your task."),Ge.forEach(s),pl=m(e),_s=p(e,"OL",{});var ar=r(_s);Xe=p(ar,"LI",{});var bt=r(Xe);wn=t(bt,"Start by creating a "),Is=p(bt,"A",{href:!0});var lr=r(Is);jn=t(lr,"pipeline()"),lr.forEach(s),gn=t(bt," and specify an inference task:"),bt.forEach(s),ar.forEach(s),rl=m(e),d(Re.$$.fragment,e),ol=m(e),Ve=p(e,"OL",{start:!0});var tr=r(Ve);Ye=p(tr,"LI",{});var Mt=r(Ye);vn=t(Mt,"Pass your input text to the "),Gs=p(Mt,"A",{href:!0});var nr=r(Gs);bn=t(nr,"pipeline()"),nr.forEach(s),Mn=t(Mt,":"),Mt.forEach(s),tr.forEach(s),cl=m(e),d(Ce.$$.fragment,e),hl=m(e),B=p(e,"P",{});var la=r(B);Jn=t(la,"Not the result you had in mind? Check out some of the "),Se=p(la,"A",{href:!0,rel:!0});var ir=r(Se);Tn=t(ir,"most downloaded automatic speech recognition models"),ir.forEach(s),xn=t(la,` on the Hub to see if you can get a better transcription.
Let\u2019s try `),qe=p(la,"A",{href:!0,rel:!0});var pr=r(qe);kn=t(pr,"openai/whisper-large"),pr.forEach(s),Un=t(la,":"),la.forEach(s),ml=m(e),d(Fe.$$.fragment,e),ul=m(e),ie=p(e,"P",{});var Jt=r(ie);En=t(Jt,`Now this result looks more accurate!
We really encourage you to check out the Hub for models in different languages, models specialized in your field, and more.
You can check out and compare model results directly from your browser on the Hub to see if it fits or
handles corner cases better than other ones.
And if you don\u2019t find a model for your use case, you can always start `),Zs=p(Jt,"A",{href:!0});var rr=r(Zs);$n=t(rr,"training"),rr.forEach(s),_n=t(Jt," your own!"),Jt.forEach(s),fl=m(e),Ws=p(e,"P",{});var or=r(Ws);In=t(or,"If you have several inputs, you can pass your input as a list:"),or.forEach(s),dl=m(e),d(Pe.$$.fragment,e),yl=m(e),Bs=p(e,"P",{});var cr=r(Bs);Gn=t(cr,"If you want to iterate over a whole dataset, or want to use it for inference in a webserver, check out dedicated parts"),cr.forEach(s),wl=m(e),Ns=p(e,"P",{});var hr=r(Ns);As=p(hr,"A",{href:!0});var mr=r(As);Zn=t(mr,"Using pipelines on a dataset"),mr.forEach(s),hr.forEach(s),jl=m(e),Xs=p(e,"P",{});var ur=r(Xs);Rs=p(ur,"A",{href:!0});var fr=r(Rs);Wn=t(fr,"Using pipelines for a webserver"),fr.forEach(s),ur.forEach(s),gl=m(e),q=p(e,"H2",{class:!0});var Tt=r(q);pe=p(Tt,"A",{id:!0,class:!0,href:!0});var dr=r(pe);ua=p(dr,"SPAN",{});var yr=r(ua);d(ze.$$.fragment,yr),yr.forEach(s),dr.forEach(s),Bn=m(Tt),fa=p(Tt,"SPAN",{});var wr=r(fa);Nn=t(wr,"Parameters"),wr.forEach(s),Tt.forEach(s),vl=m(e),He=p(e,"P",{});var Vp=r(He);Vs=p(Vp,"A",{href:!0});var jr=r(Vs);An=t(jr,"pipeline()"),jr.forEach(s),Xn=t(Vp,` supports many parameters; some are task specific, and some are general to all pipelines.
In general you can specify parameters anywhere you want:`),Vp.forEach(s),bl=m(e),d(Qe.$$.fragment,e),Ml=m(e),Ys=p(e,"P",{});var gr=r(Ys);Rn=t(gr,"Let\u2019s check out 3 important ones:"),gr.forEach(s),Jl=m(e),F=p(e,"H3",{class:!0});var xt=r(F);re=p(xt,"A",{id:!0,class:!0,href:!0});var vr=r(re);da=p(vr,"SPAN",{});var br=r(da);d(De.$$.fragment,br),br.forEach(s),vr.forEach(s),Vn=m(xt),ya=p(xt,"SPAN",{});var Mr=r(ya);Yn=t(Mr,"Device"),Mr.forEach(s),xt.forEach(s),Tl=m(e),oe=p(e,"P",{});var kt=r(oe);Cn=t(kt,"If you use "),wa=p(kt,"CODE",{});var Jr=r(wa);Sn=t(Jr,"device=n"),Jr.forEach(s),qn=t(kt,`, the pipeline automatically puts the model on the specified device.
This will work regardless of whether you are using PyTorch or Tensorflow.`),kt.forEach(s),xl=m(e),d(Le.$$.fragment,e),kl=m(e),N=p(e,"P",{});var ta=r(N);Fn=t(ta,"If the model is too large for a single GPU, you can set "),ja=p(ta,"CODE",{});var Tr=r(ja);Pn=t(Tr,'device_map="auto"'),Tr.forEach(s),zn=t(ta," to allow \u{1F917} "),Oe=p(ta,"A",{href:!0,rel:!0});var xr=r(Oe);Hn=t(xr,"Accelerate"),xr.forEach(s),Qn=t(ta," to automatically determine how to load and store the model weights."),ta.forEach(s),Ul=m(e),d(Ke.$$.fragment,e),El=m(e),G=p(e,"P",{});var Ze=r(G);Dn=t(Ze,"Note that if  "),ga=p(Ze,"CODE",{});var kr=r(ga);Ln=t(kr,'device_map="auto"'),kr.forEach(s),On=t(Ze," is passed, there is no need to add the argument "),va=p(Ze,"CODE",{});var Ur=r(va);Kn=t(Ur,"device=device"),Ur.forEach(s),ei=t(Ze," when instantiating your "),ba=p(Ze,"CODE",{});var Er=r(ba);si=t(Er,"pipeline"),Er.forEach(s),ai=t(Ze," as you may encounter some unexpected behavior!"),Ze.forEach(s),$l=m(e),P=p(e,"H3",{class:!0});var Ut=r(P);ce=p(Ut,"A",{id:!0,class:!0,href:!0});var $r=r(ce);Ma=p($r,"SPAN",{});var _r=r(Ma);d(es.$$.fragment,_r),_r.forEach(s),$r.forEach(s),li=m(Ut),Ja=p(Ut,"SPAN",{});var Ir=r(Ja);ti=t(Ir,"Batch size"),Ir.forEach(s),Ut.forEach(s),_l=m(e),he=p(e,"P",{});var Et=r(he);ni=t(Et,"By default, pipelines will not batch inference for reasons explained in detail "),ss=p(Et,"A",{href:!0,rel:!0});var Gr=r(ss);ii=t(Gr,"here"),Gr.forEach(s),pi=t(Et,". The reason is that batching is not necessarily faster, and can actually be quite slower in some cases."),Et.forEach(s),Il=m(e),Cs=p(e,"P",{});var Zr=r(Cs);ri=t(Zr,"But if it works in your use case, you can use:"),Zr.forEach(s),Gl=m(e),d(as.$$.fragment,e),Zl=m(e),Ss=p(e,"P",{});var Wr=r(Ss);oi=t(Wr,`This runs the pipeline on the 10 provided audio files, but it will pass them in batches of 2
to the model (which is on a GPU, where batching is more likely to help) without requiring any further code from you.
The output should always match what you would have received without batching. It is only meant as a way to help you get more speed out of a pipeline.`),Wr.forEach(s),Wl=m(e),me=p(e,"P",{});var $t=r(me);ci=t($t,"Pipelines can also alleviate some of the complexities of batching because, for some pipelines, a single item (like a long audio file) needs to be chunked into multiple parts to be processed by a model. The pipeline performs this "),qs=p($t,"A",{href:!0});var Br=r(qs);Ta=p(Br,"EM",{});var Nr=r(Ta);hi=t(Nr,"chunk batching"),Nr.forEach(s),Br.forEach(s),mi=t($t," for you."),$t.forEach(s),Bl=m(e),z=p(e,"H3",{class:!0});var _t=r(z);ue=p(_t,"A",{id:!0,class:!0,href:!0});var Ar=r(ue);xa=p(Ar,"SPAN",{});var Xr=r(xa);d(ls.$$.fragment,Xr),Xr.forEach(s),Ar.forEach(s),ui=m(_t),ka=p(_t,"SPAN",{});var Rr=r(ka);fi=t(Rr,"Task specific parameters"),Rr.forEach(s),_t.forEach(s),Nl=m(e),A=p(e,"P",{});var na=r(A);di=t(na,`All tasks provide task specific parameters which allow for additional flexibility and options to help you get your job done.
For instance, the `),fe=p(na,"A",{href:!0});var It=r(fe);yi=t(It,"transformers.AutomaticSpeechRecognitionPipeline."),Ua=p(It,"STRONG",{});var Vr=r(Ua);wi=t(Vr,"call"),Vr.forEach(s),ji=t(It,"()"),It.forEach(s),gi=t(na," method has a "),Ea=p(na,"CODE",{});var Yr=r(Ea);vi=t(Yr,"return_timestamps"),Yr.forEach(s),bi=t(na," parameter which sounds promising for subtitling videos:"),na.forEach(s),Al=m(e),d(ts.$$.fragment,e),Xl=m(e),de=p(e,"P",{});var Gt=r(de);Mi=t(Gt,"As you can see, the model inferred the text and also outputted "),$a=p(Gt,"STRONG",{});var Cr=r($a);Ji=t(Cr,"when"),Cr.forEach(s),Ti=t(Gt,` the various words were pronounced
in the sentence.`),Gt.forEach(s),Rl=m(e),X=p(e,"P",{});var ia=r(X);xi=t(ia,`There are many parameters available for each task, so check out each task\u2019s API reference to see what you can tinker with!
For instance, the `),Fs=p(ia,"A",{href:!0});var Sr=r(Fs);ki=t(Sr,"AutomaticSpeechRecognitionPipeline"),Sr.forEach(s),Ui=t(ia," has a "),_a=p(ia,"CODE",{});var qr=r(_a);Ei=t(qr,"chunk_length_s"),qr.forEach(s),$i=t(ia," parameter which is helpful for working on really long audio files (for example, subtitling entire movies or hour-long videos) that a model typically cannot handle on its own."),ia.forEach(s),Vl=m(e),ye=p(e,"P",{});var Zt=r(ye);_i=t(Zt,"If you can\u2019t find a parameter that would really help you out, feel free to "),ns=p(Zt,"A",{href:!0,rel:!0});var Fr=r(ns);Ii=t(Fr,"request it"),Fr.forEach(s),Gi=t(Zt,"!"),Zt.forEach(s),Yl=m(e),H=p(e,"H2",{class:!0});var Wt=r(H);we=p(Wt,"A",{id:!0,class:!0,href:!0});var Pr=r(we);Ia=p(Pr,"SPAN",{});var zr=r(Ia);d(is.$$.fragment,zr),zr.forEach(s),Pr.forEach(s),Zi=m(Wt),Ga=p(Wt,"SPAN",{});var Hr=r(Ga);Wi=t(Hr,"Using pipelines on a dataset"),Hr.forEach(s),Wt.forEach(s),Cl=m(e),Ps=p(e,"P",{});var Qr=r(Ps);Bi=t(Qr,"The pipeline can also run inference on a large dataset. The easiest way we recommend doing this is by using an iterator:"),Qr.forEach(s),Sl=m(e),d(ps.$$.fragment,e),ql=m(e),R=p(e,"P",{});var pa=r(R);Ni=t(pa,"The iterator "),Za=p(pa,"CODE",{});var Dr=r(Za);Ai=t(Dr,"data()"),Dr.forEach(s),Xi=t(pa,` yields each result, and the pipeline automatically
recognizes the input is iterable and will start fetching the data while
it continues to process it on the GPU (this uses `),rs=p(pa,"A",{href:!0,rel:!0});var Lr=r(rs);Ri=t(Lr,"DataLoader"),Lr.forEach(s),Vi=t(pa,` under the hood).
This is important because you don\u2019t have to allocate memory for the whole dataset
and you can feed the GPU as fast as possible.`),pa.forEach(s),Fl=m(e),je=p(e,"P",{});var Bt=r(je);Yi=t(Bt,"Since batching could speed things up, it may be useful to try tuning the "),Wa=p(Bt,"CODE",{});var Or=r(Wa);Ci=t(Or,"batch_size"),Or.forEach(s),Si=t(Bt," parameter here."),Bt.forEach(s),Pl=m(e),ge=p(e,"P",{});var Nt=r(ge);qi=t(Nt,"The simplest way to iterate over a dataset is to just load one from \u{1F917} "),os=p(Nt,"A",{href:!0,rel:!0});var Kr=r(os);Fi=t(Kr,"Datasets"),Kr.forEach(s),Pi=t(Nt,":"),Nt.forEach(s),zl=m(e),d(cs.$$.fragment,e),Hl=m(e),Q=p(e,"H2",{class:!0});var At=r(Q);ve=p(At,"A",{id:!0,class:!0,href:!0});var eo=r(ve);Ba=p(eo,"SPAN",{});var so=r(Ba);d(hs.$$.fragment,so),so.forEach(s),eo.forEach(s),zi=m(At),Na=p(At,"SPAN",{});var ao=r(Na);Hi=t(ao,"Using pipelines for a webserver"),ao.forEach(s),At.forEach(s),Ql=m(e),d(be.$$.fragment,e),Dl=m(e),zs=p(e,"P",{});var lo=r(zs);Hs=p(lo,"A",{href:!0});var to=r(Hs);Qi=t(to,"Link"),to.forEach(s),lo.forEach(s),Ll=m(e),D=p(e,"H2",{class:!0});var Xt=r(D);Me=p(Xt,"A",{id:!0,class:!0,href:!0});var no=r(Me);Aa=p(no,"SPAN",{});var io=r(Aa);d(ms.$$.fragment,io),io.forEach(s),no.forEach(s),Di=m(Xt),Xa=p(Xt,"SPAN",{});var po=r(Xa);Li=t(po,"Vision pipeline"),po.forEach(s),Xt.forEach(s),Ol=m(e),Je=p(e,"P",{});var Rt=r(Je);Oi=t(Rt,"Using a "),Qs=p(Rt,"A",{href:!0});var ro=r(Qs);Ki=t(ro,"pipeline()"),ro.forEach(s),ep=t(Rt," for vision tasks is practically identical."),Rt.forEach(s),Kl=m(e),Ds=p(e,"P",{});var oo=r(Ds);sp=t(oo,"Specify your task and pass your image to the classifier. The image can be a link or a local path to the image. For example, what species of cat is shown below?"),oo.forEach(s),et=m(e),Ls=p(e,"P",{});var co=r(Ls);Os=p(co,"IMG",{src:!0,alt:!0}),co.forEach(s),st=m(e),d(us.$$.fragment,e),at=m(e),L=p(e,"H2",{class:!0});var Vt=r(L);Te=p(Vt,"A",{id:!0,class:!0,href:!0});var ho=r(Te);Ra=p(ho,"SPAN",{});var mo=r(Ra);d(fs.$$.fragment,mo),mo.forEach(s),ho.forEach(s),ap=m(Vt),Va=p(Vt,"SPAN",{});var uo=r(Va);lp=t(uo,"Text pipeline"),uo.forEach(s),Vt.forEach(s),lt=m(e),xe=p(e,"P",{});var Yt=r(xe);tp=t(Yt,"Using a "),Ks=p(Yt,"A",{href:!0});var fo=r(Ks);np=t(fo,"pipeline()"),fo.forEach(s),ip=t(Yt," for NLP tasks is practically identical."),Yt.forEach(s),tt=m(e),d(ds.$$.fragment,e),nt=m(e),O=p(e,"H2",{class:!0});var Ct=r(O);ke=p(Ct,"A",{id:!0,class:!0,href:!0});var yo=r(ke);Ya=p(yo,"SPAN",{});var wo=r(Ya);d(ys.$$.fragment,wo),wo.forEach(s),yo.forEach(s),pp=m(Ct),Ca=p(Ct,"SPAN",{});var jo=r(Ca);rp=t(jo,"Multimodal pipeline"),jo.forEach(s),Ct.forEach(s),it=m(e),Ue=p(e,"P",{});var St=r(Ue);op=t(St,"The "),ea=p(St,"A",{href:!0});var go=r(ea);cp=t(go,"pipeline()"),go.forEach(s),hp=t(St," supports more than one modality. For example, a visual question answering (VQA) task combines text and image. Feel free to use any image link you like and a question you want to ask about the image. The image can be a URL or a local path to the image."),St.forEach(s),pt=m(e),Ee=p(e,"P",{});var qt=r(Ee);mp=t(qt,"For example, if you use this "),ws=p(qt,"A",{href:!0,rel:!0});var vo=r(ws);up=t(vo,"invoice image"),vo.forEach(s),fp=t(qt,":"),qt.forEach(s),rt=m(e),d(js.$$.fragment,e),ot=m(e),d($e.$$.fragment,e),ct=m(e),K=p(e,"H2",{class:!0});var Ft=r(K);_e=p(Ft,"A",{id:!0,class:!0,href:!0});var bo=r(_e);Sa=p(bo,"SPAN",{});var Mo=r(Sa);d(gs.$$.fragment,Mo),Mo.forEach(s),bo.forEach(s),dp=m(Ft),ee=p(Ft,"SPAN",{});var ra=r(ee);yp=t(ra,"Using "),qa=p(ra,"CODE",{});var Jo=r(qa);wp=t(Jo,"pipeline"),Jo.forEach(s),jp=t(ra," on large models with \u{1F917} "),Fa=p(ra,"CODE",{});var To=r(Fa);gp=t(To,"accelerate"),To.forEach(s),vp=t(ra,":"),ra.forEach(s),Ft.forEach(s),ht=m(e),$=p(e,"P",{});var Y=r($);bp=t(Y,"You can easily run "),Pa=p(Y,"CODE",{});var xo=r(Pa);Mp=t(xo,"pipeline"),xo.forEach(s),Jp=t(Y," on large models using \u{1F917} "),za=p(Y,"CODE",{});var ko=r(za);Tp=t(ko,"accelerate"),ko.forEach(s),xp=t(Y,"! First make sure you have installed "),Ha=p(Y,"CODE",{});var Uo=r(Ha);kp=t(Uo,"accelerate"),Uo.forEach(s),Up=t(Y," with "),Qa=p(Y,"CODE",{});var Eo=r(Qa);Ep=t(Eo,"pip install accelerate"),Eo.forEach(s),$p=t(Y,"."),Y.forEach(s),mt=m(e),V=p(e,"P",{});var oa=r(V);_p=t(oa,"First load your model using "),Da=p(oa,"CODE",{});var $o=r(Da);Ip=t($o,'device_map="auto"'),$o.forEach(s),Gp=t(oa,"! We will use "),La=p(oa,"CODE",{});var _o=r(La);Zp=t(_o,"facebook/opt-1.3b"),_o.forEach(s),Wp=t(oa," for our example."),oa.forEach(s),ut=m(e),d(vs.$$.fragment,e),ft=m(e),se=p(e,"P",{});var al=r(se);Bp=t(al,"You can also pass 8-bit loaded models if you install "),Oa=p(al,"CODE",{});var Io=r(Oa);Np=t(Io,"bitsandbytes"),Io.forEach(s),Ap=t(al," and add the argument "),Ka=p(al,"CODE",{});var Go=r(Ka);Xp=t(Go,"load_in_8bit=True"),Go.forEach(s),al.forEach(s),dt=m(e),d(bs.$$.fragment,e),yt=m(e),sa=p(e,"P",{});var Zo=r(sa);Rp=t(Zo,"Note that you can replace the checkpoint with any of the Hugging Face model that supports large model loading such as BLOOM!"),Zo.forEach(s),this.h()},h(){c(u,"name","hf:doc:metadata"),c(u,"content",JSON.stringify(Fo)),c(T,"id","pipelines-for-inference"),c(T,"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"),c(T,"href","#pipelines-for-inference"),c(v,"class","relative group"),c(C,"href","/docs/transformers/v4.30.0/en/main_classes/pipelines#transformers.pipeline"),c(We,"href","https://huggingface.co/models"),c(We,"rel","nofollow"),c(Ts,"href","/docs/transformers/v4.30.0/en/main_classes/pipelines#transformers.pipeline"),c(xs,"href","/docs/transformers/v4.30.0/en/main_classes/pipelines#transformers.pipeline"),c(ks,"href","/docs/transformers/v4.30.0/en/main_classes/pipelines#transformers.pipeline"),c(ne,"id","pipeline-usage"),c(ne,"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"),c(ne,"href","#pipeline-usage"),c(S,"class","relative group"),c(Us,"href","/docs/transformers/v4.30.0/en/main_classes/pipelines#transformers.pipeline"),c(Es,"href","/docs/transformers/v4.30.0/en/main_classes/pipelines#transformers.pipeline"),c($s,"href","/docs/transformers/v4.30.0/en/main_classes/pipelines#transformers.pipeline"),c(Is,"href","/docs/transformers/v4.30.0/en/main_classes/pipelines#transformers.pipeline"),c(Gs,"href","/docs/transformers/v4.30.0/en/main_classes/pipelines#transformers.pipeline"),c(Ve,"start","2"),c(Se,"href","https://huggingface.co/models?pipeline_tag=automatic-speech-recognition&sort=downloads"),c(Se,"rel","nofollow"),c(qe,"href","https://huggingface.co/openai/whisper-large"),c(qe,"rel","nofollow"),c(Zs,"href","training"),c(As,"href","#using-pipelines-on-a-dataset"),c(Rs,"href","./pipeline_webserver"),c(pe,"id","parameters"),c(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"),c(pe,"href","#parameters"),c(q,"class","relative group"),c(Vs,"href","/docs/transformers/v4.30.0/en/main_classes/pipelines#transformers.pipeline"),c(re,"id","device"),c(re,"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"),c(re,"href","#device"),c(F,"class","relative group"),c(Oe,"href","https://huggingface.co/docs/accelerate"),c(Oe,"rel","nofollow"),c(ce,"id","batch-size"),c(ce,"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"),c(ce,"href","#batch-size"),c(P,"class","relative group"),c(ss,"href","https://huggingface.co/docs/transformers/main_classes/pipelines#pipeline-batching"),c(ss,"rel","nofollow"),c(qs,"href","./main_classes/pipelines#pipeline-chunk-batching"),c(ue,"id","task-specific-parameters"),c(ue,"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"),c(ue,"href","#task-specific-parameters"),c(z,"class","relative group"),c(fe,"href","/docs/transformers/v4.30.0/en/main_classes/pipelines#transformers.AutomaticSpeechRecognitionPipeline.__call__"),c(Fs,"href","/docs/transformers/v4.30.0/en/main_classes/pipelines#transformers.AutomaticSpeechRecognitionPipeline"),c(ns,"href","https://github.com/huggingface/transformers/issues/new?assignees=&labels=feature&template=feature-request.yml"),c(ns,"rel","nofollow"),c(we,"id","using-pipelines-on-a-dataset"),c(we,"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"),c(we,"href","#using-pipelines-on-a-dataset"),c(H,"class","relative group"),c(rs,"href","https://pytorch.org/docs/stable/data.html#torch.utils.data.DataLoader"),c(rs,"rel","nofollow"),c(os,"href","https://github.com/huggingface/datasets/"),c(os,"rel","nofollow"),c(ve,"id","using-pipelines-for-a-webserver"),c(ve,"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"),c(ve,"href","#using-pipelines-for-a-webserver"),c(Q,"class","relative group"),c(Hs,"href","./pipeline_webserver"),c(Me,"id","vision-pipeline"),c(Me,"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"),c(Me,"href","#vision-pipeline"),c(D,"class","relative group"),c(Qs,"href","/docs/transformers/v4.30.0/en/main_classes/pipelines#transformers.pipeline"),Xo(Os.src,Cp="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg")||c(Os,"src",Cp),c(Os,"alt","pipeline-cat-chonk"),c(Te,"id","text-pipeline"),c(Te,"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"),c(Te,"href","#text-pipeline"),c(L,"class","relative group"),c(Ks,"href","/docs/transformers/v4.30.0/en/main_classes/pipelines#transformers.pipeline"),c(ke,"id","multimodal-pipeline"),c(ke,"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"),c(ke,"href","#multimodal-pipeline"),c(O,"class","relative group"),c(ea,"href","/docs/transformers/v4.30.0/en/main_classes/pipelines#transformers.pipeline"),c(ws,"href","https://huggingface.co/spaces/impira/docquery/resolve/2359223c1837a7587402bda0f2643382a6eefeab/invoice.png"),c(ws,"rel","nofollow"),c(_e,"id","using-pipeline-on-large-models-with-accelerate"),c(_e,"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"),c(_e,"href","#using-pipeline-on-large-models-with-accelerate"),c(K,"class","relative group")},m(e,n){a(document.head,u),o(e,J,n),o(e,v,n),a(v,T),a(T,_),y(x,_,null),a(v,E),a(v,U),a(U,le),o(e,M,n),o(e,b,n),a(b,Js),a(b,C),a(C,Pt),a(b,zt),a(b,We),a(We,Ht),a(b,Qt),a(b,Ts),a(Ts,Dt),a(b,Lt),o(e,ll,n),o(e,W,n),a(W,Be),a(Be,Ot),a(Be,xs),a(xs,Kt),a(Be,en),a(W,sn),a(W,ca),a(ca,an),a(W,ln),a(W,Ne),a(Ne,tn),a(Ne,ks),a(ks,nn),a(Ne,pn),o(e,tl,n),y(te,e,n),o(e,nl,n),o(e,S,n),a(S,ne),a(ne,ha),y(Ae,ha,null),a(S,rn),a(S,ma),a(ma,on),o(e,il,n),o(e,I,n),a(I,cn),a(I,Us),a(Us,hn),a(I,mn),a(I,Es),a(Es,un),a(I,fn),a(I,$s),a($s,dn),a(I,yn),o(e,pl,n),o(e,_s,n),a(_s,Xe),a(Xe,wn),a(Xe,Is),a(Is,jn),a(Xe,gn),o(e,rl,n),y(Re,e,n),o(e,ol,n),o(e,Ve,n),a(Ve,Ye),a(Ye,vn),a(Ye,Gs),a(Gs,bn),a(Ye,Mn),o(e,cl,n),y(Ce,e,n),o(e,hl,n),o(e,B,n),a(B,Jn),a(B,Se),a(Se,Tn),a(B,xn),a(B,qe),a(qe,kn),a(B,Un),o(e,ml,n),y(Fe,e,n),o(e,ul,n),o(e,ie,n),a(ie,En),a(ie,Zs),a(Zs,$n),a(ie,_n),o(e,fl,n),o(e,Ws,n),a(Ws,In),o(e,dl,n),y(Pe,e,n),o(e,yl,n),o(e,Bs,n),a(Bs,Gn),o(e,wl,n),o(e,Ns,n),a(Ns,As),a(As,Zn),o(e,jl,n),o(e,Xs,n),a(Xs,Rs),a(Rs,Wn),o(e,gl,n),o(e,q,n),a(q,pe),a(pe,ua),y(ze,ua,null),a(q,Bn),a(q,fa),a(fa,Nn),o(e,vl,n),o(e,He,n),a(He,Vs),a(Vs,An),a(He,Xn),o(e,bl,n),y(Qe,e,n),o(e,Ml,n),o(e,Ys,n),a(Ys,Rn),o(e,Jl,n),o(e,F,n),a(F,re),a(re,da),y(De,da,null),a(F,Vn),a(F,ya),a(ya,Yn),o(e,Tl,n),o(e,oe,n),a(oe,Cn),a(oe,wa),a(wa,Sn),a(oe,qn),o(e,xl,n),y(Le,e,n),o(e,kl,n),o(e,N,n),a(N,Fn),a(N,ja),a(ja,Pn),a(N,zn),a(N,Oe),a(Oe,Hn),a(N,Qn),o(e,Ul,n),y(Ke,e,n),o(e,El,n),o(e,G,n),a(G,Dn),a(G,ga),a(ga,Ln),a(G,On),a(G,va),a(va,Kn),a(G,ei),a(G,ba),a(ba,si),a(G,ai),o(e,$l,n),o(e,P,n),a(P,ce),a(ce,Ma),y(es,Ma,null),a(P,li),a(P,Ja),a(Ja,ti),o(e,_l,n),o(e,he,n),a(he,ni),a(he,ss),a(ss,ii),a(he,pi),o(e,Il,n),o(e,Cs,n),a(Cs,ri),o(e,Gl,n),y(as,e,n),o(e,Zl,n),o(e,Ss,n),a(Ss,oi),o(e,Wl,n),o(e,me,n),a(me,ci),a(me,qs),a(qs,Ta),a(Ta,hi),a(me,mi),o(e,Bl,n),o(e,z,n),a(z,ue),a(ue,xa),y(ls,xa,null),a(z,ui),a(z,ka),a(ka,fi),o(e,Nl,n),o(e,A,n),a(A,di),a(A,fe),a(fe,yi),a(fe,Ua),a(Ua,wi),a(fe,ji),a(A,gi),a(A,Ea),a(Ea,vi),a(A,bi),o(e,Al,n),y(ts,e,n),o(e,Xl,n),o(e,de,n),a(de,Mi),a(de,$a),a($a,Ji),a(de,Ti),o(e,Rl,n),o(e,X,n),a(X,xi),a(X,Fs),a(Fs,ki),a(X,Ui),a(X,_a),a(_a,Ei),a(X,$i),o(e,Vl,n),o(e,ye,n),a(ye,_i),a(ye,ns),a(ns,Ii),a(ye,Gi),o(e,Yl,n),o(e,H,n),a(H,we),a(we,Ia),y(is,Ia,null),a(H,Zi),a(H,Ga),a(Ga,Wi),o(e,Cl,n),o(e,Ps,n),a(Ps,Bi),o(e,Sl,n),y(ps,e,n),o(e,ql,n),o(e,R,n),a(R,Ni),a(R,Za),a(Za,Ai),a(R,Xi),a(R,rs),a(rs,Ri),a(R,Vi),o(e,Fl,n),o(e,je,n),a(je,Yi),a(je,Wa),a(Wa,Ci),a(je,Si),o(e,Pl,n),o(e,ge,n),a(ge,qi),a(ge,os),a(os,Fi),a(ge,Pi),o(e,zl,n),y(cs,e,n),o(e,Hl,n),o(e,Q,n),a(Q,ve),a(ve,Ba),y(hs,Ba,null),a(Q,zi),a(Q,Na),a(Na,Hi),o(e,Ql,n),y(be,e,n),o(e,Dl,n),o(e,zs,n),a(zs,Hs),a(Hs,Qi),o(e,Ll,n),o(e,D,n),a(D,Me),a(Me,Aa),y(ms,Aa,null),a(D,Di),a(D,Xa),a(Xa,Li),o(e,Ol,n),o(e,Je,n),a(Je,Oi),a(Je,Qs),a(Qs,Ki),a(Je,ep),o(e,Kl,n),o(e,Ds,n),a(Ds,sp),o(e,et,n),o(e,Ls,n),a(Ls,Os),o(e,st,n),y(us,e,n),o(e,at,n),o(e,L,n),a(L,Te),a(Te,Ra),y(fs,Ra,null),a(L,ap),a(L,Va),a(Va,lp),o(e,lt,n),o(e,xe,n),a(xe,tp),a(xe,Ks),a(Ks,np),a(xe,ip),o(e,tt,n),y(ds,e,n),o(e,nt,n),o(e,O,n),a(O,ke),a(ke,Ya),y(ys,Ya,null),a(O,pp),a(O,Ca),a(Ca,rp),o(e,it,n),o(e,Ue,n),a(Ue,op),a(Ue,ea),a(ea,cp),a(Ue,hp),o(e,pt,n),o(e,Ee,n),a(Ee,mp),a(Ee,ws),a(ws,up),a(Ee,fp),o(e,rt,n),y(js,e,n),o(e,ot,n),y($e,e,n),o(e,ct,n),o(e,K,n),a(K,_e),a(_e,Sa),y(gs,Sa,null),a(K,dp),a(K,ee),a(ee,yp),a(ee,qa),a(qa,wp),a(ee,jp),a(ee,Fa),a(Fa,gp),a(ee,vp),o(e,ht,n),o(e,$,n),a($,bp),a($,Pa),a(Pa,Mp),a($,Jp),a($,za),a(za,Tp),a($,xp),a($,Ha),a(Ha,kp),a($,Up),a($,Qa),a(Qa,Ep),a($,$p),o(e,mt,n),o(e,V,n),a(V,_p),a(V,Da),a(Da,Ip),a(V,Gp),a(V,La),a(La,Zp),a(V,Wp),o(e,ut,n),y(vs,e,n),o(e,ft,n),o(e,se,n),a(se,Bp),a(se,Oa),a(Oa,Np),a(se,Ap),a(se,Ka),a(Ka,Xp),o(e,dt,n),y(bs,e,n),o(e,yt,n),o(e,sa,n),a(sa,Rp),wt=!0},p(e,[n]){const Ms={};n&2&&(Ms.$$scope={dirty:n,ctx:e}),te.$set(Ms);const el={};n&2&&(el.$$scope={dirty:n,ctx:e}),be.$set(el);const sl={};n&2&&(sl.$$scope={dirty:n,ctx:e}),$e.$set(sl)},i(e){wt||(w(x.$$.fragment,e),w(te.$$.fragment,e),w(Ae.$$.fragment,e),w(Re.$$.fragment,e),w(Ce.$$.fragment,e),w(Fe.$$.fragment,e),w(Pe.$$.fragment,e),w(ze.$$.fragment,e),w(Qe.$$.fragment,e),w(De.$$.fragment,e),w(Le.$$.fragment,e),w(Ke.$$.fragment,e),w(es.$$.fragment,e),w(as.$$.fragment,e),w(ls.$$.fragment,e),w(ts.$$.fragment,e),w(is.$$.fragment,e),w(ps.$$.fragment,e),w(cs.$$.fragment,e),w(hs.$$.fragment,e),w(be.$$.fragment,e),w(ms.$$.fragment,e),w(us.$$.fragment,e),w(fs.$$.fragment,e),w(ds.$$.fragment,e),w(ys.$$.fragment,e),w(js.$$.fragment,e),w($e.$$.fragment,e),w(gs.$$.fragment,e),w(vs.$$.fragment,e),w(bs.$$.fragment,e),wt=!0)},o(e){j(x.$$.fragment,e),j(te.$$.fragment,e),j(Ae.$$.fragment,e),j(Re.$$.fragment,e),j(Ce.$$.fragment,e),j(Fe.$$.fragment,e),j(Pe.$$.fragment,e),j(ze.$$.fragment,e),j(Qe.$$.fragment,e),j(De.$$.fragment,e),j(Le.$$.fragment,e),j(Ke.$$.fragment,e),j(es.$$.fragment,e),j(as.$$.fragment,e),j(ls.$$.fragment,e),j(ts.$$.fragment,e),j(is.$$.fragment,e),j(ps.$$.fragment,e),j(cs.$$.fragment,e),j(hs.$$.fragment,e),j(be.$$.fragment,e),j(ms.$$.fragment,e),j(us.$$.fragment,e),j(fs.$$.fragment,e),j(ds.$$.fragment,e),j(ys.$$.fragment,e),j(js.$$.fragment,e),j($e.$$.fragment,e),j(gs.$$.fragment,e),j(vs.$$.fragment,e),j(bs.$$.fragment,e),wt=!1},d(e){s(u),e&&s(J),e&&s(v),g(x),e&&s(M),e&&s(b),e&&s(ll),e&&s(W),e&&s(tl),g(te,e),e&&s(nl),e&&s(S),g(Ae),e&&s(il),e&&s(I),e&&s(pl),e&&s(_s),e&&s(rl),g(Re,e),e&&s(ol),e&&s(Ve),e&&s(cl),g(Ce,e),e&&s(hl),e&&s(B),e&&s(ml),g(Fe,e),e&&s(ul),e&&s(ie),e&&s(fl),e&&s(Ws),e&&s(dl),g(Pe,e),e&&s(yl),e&&s(Bs),e&&s(wl),e&&s(Ns),e&&s(jl),e&&s(Xs),e&&s(gl),e&&s(q),g(ze),e&&s(vl),e&&s(He),e&&s(bl),g(Qe,e),e&&s(Ml),e&&s(Ys),e&&s(Jl),e&&s(F),g(De),e&&s(Tl),e&&s(oe),e&&s(xl),g(Le,e),e&&s(kl),e&&s(N),e&&s(Ul),g(Ke,e),e&&s(El),e&&s(G),e&&s($l),e&&s(P),g(es),e&&s(_l),e&&s(he),e&&s(Il),e&&s(Cs),e&&s(Gl),g(as,e),e&&s(Zl),e&&s(Ss),e&&s(Wl),e&&s(me),e&&s(Bl),e&&s(z),g(ls),e&&s(Nl),e&&s(A),e&&s(Al),g(ts,e),e&&s(Xl),e&&s(de),e&&s(Rl),e&&s(X),e&&s(Vl),e&&s(ye),e&&s(Yl),e&&s(H),g(is),e&&s(Cl),e&&s(Ps),e&&s(Sl),g(ps,e),e&&s(ql),e&&s(R),e&&s(Fl),e&&s(je),e&&s(Pl),e&&s(ge),e&&s(zl),g(cs,e),e&&s(Hl),e&&s(Q),g(hs),e&&s(Ql),g(be,e),e&&s(Dl),e&&s(zs),e&&s(Ll),e&&s(D),g(ms),e&&s(Ol),e&&s(Je),e&&s(Kl),e&&s(Ds),e&&s(et),e&&s(Ls),e&&s(st),g(us,e),e&&s(at),e&&s(L),g(fs),e&&s(lt),e&&s(xe),e&&s(tt),g(ds,e),e&&s(nt),e&&s(O),g(ys),e&&s(it),e&&s(Ue),e&&s(pt),e&&s(Ee),e&&s(rt),g(js,e),e&&s(ot),g($e,e),e&&s(ct),e&&s(K),g(gs),e&&s(ht),e&&s($),e&&s(mt),e&&s(V),e&&s(ut),g(vs,e),e&&s(ft),e&&s(se),e&&s(dt),g(bs,e),e&&s(yt),e&&s(sa)}}}const Fo={local:"pipelines-for-inference",sections:[{local:"pipeline-usage",title:"Pipeline usage"},{local:"parameters",sections:[{local:"device",title:"Device"},{local:"batch-size",title:"Batch size"},{local:"task-specific-parameters",title:"Task specific parameters"}],title:"Parameters"},{local:"using-pipelines-on-a-dataset",title:"Using pipelines on a dataset"},{local:"using-pipelines-for-a-webserver",title:"Using pipelines for a webserver"},{local:"vision-pipeline",title:"Vision pipeline"},{local:"text-pipeline",title:"Text pipeline"},{local:"multimodal-pipeline",title:"Multimodal pipeline"},{local:"using-pipeline-on-large-models-with-accelerate",title:"Using `pipeline` on large models with \u{1F917} `accelerate`:"}],title:"Pipelines for inference"};function Po(ae){return Ro(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Lo extends Wo{constructor(u){super();Bo(this,u,Po,qo,No,{})}}export{Lo as default,Fo as metadata};
