import{S as ep,i as sp,s as ap,e as n,k as c,w as u,t as r,M as tp,c as l,d as s,m as f,a as i,x as d,h as p,b as h,N as np,G as a,g as o,y as g,q as v,o as y,B as w,v as lp,L as ip}from"../chunks/vendor-hf-doc-builder.js";import{T as _i}from"../chunks/Tip-hf-doc-builder.js";import{I as N}from"../chunks/IconCopyLink-hf-doc-builder.js";import{C as A}from"../chunks/CodeBlock-hf-doc-builder.js";function rp(Y){let m,$,j,_,P;return{c(){m=n("p"),$=r("Take a look at the "),j=n("a"),_=r("pipeline()"),P=r(" documentation for a complete list of supported tasks and available parameters."),this.h()},l(k){m=l(k,"P",{});var q=i(m);$=p(q,"Take a look at the "),j=l(q,"A",{href:!0});var E=i(j);_=p(E,"pipeline()"),E.forEach(s),P=p(q," documentation for a complete list of supported tasks and available parameters."),q.forEach(s),this.h()},h(){h(j,"href","/docs/transformers/main/en/main_classes/pipelines#transformers.pipeline")},m(k,q){o(k,m,q),a(m,$),a(m,j),a(j,_),a(m,P)},d(k){k&&s(m)}}}function pp(Y){let m;return{c(){m=r(`Creating an inference engine is a complex topic which deserves it's own
page.`)},l($){m=p($,`Creating an inference engine is a complex topic which deserves it's own
page.`)},m($,j){o($,m,j)},d($){$&&s(m)}}}function op(Y){let m,$,j,_,P,k,q,E,Q;return E=new A({props:{code:`sudo apt install -y tesseract-ocr
pip install pytesseract`,highlighted:`sudo apt install -y tesseract-ocr
pip install pytesseract`}}),{c(){m=n("p"),$=r("To run the example above you need to have "),j=n("a"),_=n("code"),P=r("pytesseract"),k=r(" installed in addition to \u{1F917} Transformers:"),q=c(),u(E.$$.fragment),this.h()},l(b){m=l(b,"P",{});var x=i(m);$=p(x,"To run the example above you need to have "),j=l(x,"A",{href:!0,rel:!0});var cs=i(j);_=l(cs,"CODE",{});var O=i(_);P=p(O,"pytesseract"),O.forEach(s),cs.forEach(s),k=p(x," installed in addition to \u{1F917} Transformers:"),x.forEach(s),q=f(b),d(E.$$.fragment,b),this.h()},h(){h(j,"href","https://pypi.org/project/pytesseract/"),h(j,"rel","nofollow")},m(b,x){o(b,m,x),a(m,$),a(m,j),a(j,_),a(_,P),a(m,k),o(b,q,x),g(E,b,x),Q=!0},p:ip,i(b){Q||(v(E.$$.fragment,b),Q=!0)},o(b){y(E.$$.fragment,b),Q=!1},d(b){b&&s(m),b&&s(q),w(E,b)}}}function hp(Y){let m,$,j,_,P,k,q,E,Q,b,x,cs,O,pn,on,ke,hn,cn,fs,fn,mn,qa,I,Ee,un,ms,dn,gn,vn,Ys,yn,wn,qe,jn,us,xn,bn,Aa,J,Pa,R,X,Qs,Ae,$n,Js,_n,Ta,T,kn,ds,En,qn,gs,An,Pn,vs,Tn,Nn,Na,ys,Pe,In,ws,Sn,Un,Ia,Te,Sa,Ne,Ie,Ln,js,Dn,Hn,Ua,Se,La,S,On,Ue,Rn,zn,Le,Cn,Fn,Da,De,Ha,Z,Mn,xs,Gn,Bn,Oa,bs,Vn,Ra,He,za,$s,Wn,Ca,_s,ks,Kn,Fa,Es,qs,Yn,Ma,z,ee,Xs,Oe,Qn,Zs,Jn,Ga,Re,As,Xn,Zn,Ba,ze,Va,Ps,el,Wa,C,se,ea,Ce,sl,sa,al,Ka,ae,tl,aa,nl,ll,Ya,Fe,Qa,U,il,ta,rl,pl,Me,ol,hl,Ja,Ge,Xa,F,te,na,Be,cl,la,fl,Za,ne,ml,Ve,ul,dl,et,Ts,gl,st,We,at,Ns,vl,tt,le,yl,Is,ia,wl,jl,nt,M,ie,ra,Ke,xl,pa,bl,lt,L,$l,re,_l,oa,kl,El,ql,ha,Al,Pl,it,Ye,rt,pe,Tl,ca,Nl,Il,pt,D,Sl,Ss,Ul,Ll,fa,Dl,Hl,ot,oe,Ol,Qe,Rl,zl,ht,G,he,ma,Je,Cl,ua,Fl,ct,Us,Ml,ft,Xe,mt,H,Gl,da,Bl,Vl,Ze,Wl,Kl,ut,ce,Yl,ga,Ql,Jl,dt,fe,Xl,es,Zl,ei,gt,ss,vt,B,me,va,as,si,ya,ai,yt,ue,wt,Ls,Ds,ti,jt,V,de,wa,ts,ni,ja,li,xt,ge,ii,Hs,ri,pi,bt,Os,oi,$t,Rs,zs,ki,_t,ns,kt,W,ve,xa,ls,hi,ba,ci,Et,ye,fi,Cs,mi,ui,qt,is,At,K,we,$a,rs,di,_a,gi,Pt,je,vi,Fs,yi,wi,Tt,xe,ji,ps,xi,bi,Nt,os,It,be,St;return k=new N({}),J=new _i({props:{$$slots:{default:[rp]},$$scope:{ctx:Y}}}),Ae=new N({}),Te=new A({props:{code:`from transformers import pipeline

generator = pipeline(task="automatic-speech-recognition")`,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>)`}}),Se=new A({props:{code:'generator("https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac")',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>}`}}),De=new A({props:{code:`generator = pipeline(model="openai/whisper-large")
generator("https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac")`,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>}`}}),He=new A({props:{code:`generator(
    [
        "https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac",
        "https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/1.flac",
    ]
)`,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>,
    ]
)`}}),Oe=new N({}),ze=new A({props:{code:'generator(model="openai/whisper-large", my_parameter=1)\nout = generate(...)  # This will use `my_parameter=1`.\nout = generate(..., my_parameter=2)  # This will override and use `my_parameter=2`.\nout = generate(...)  # This will go back to using `my_parameter=1`.',highlighted:'generator(model=<span class="hljs-string">&quot;openai/whisper-large&quot;</span>, my_parameter=<span class="hljs-number">1</span>)\nout = generate(...)  <span class="hljs-comment"># This will use `my_parameter=1`.</span>\nout = generate(..., my_parameter=<span class="hljs-number">2</span>)  <span class="hljs-comment"># This will override and use `my_parameter=2`.</span>\nout = generate(...)  <span class="hljs-comment"># This will go back to using `my_parameter=1`.</span>'}}),Ce=new N({}),Fe=new A({props:{code:'generator(model="openai/whisper-large", device=0)',highlighted:'generator(model=<span class="hljs-string">&quot;openai/whisper-large&quot;</span>, device=<span class="hljs-number">0</span>)'}}),Ge=new A({props:{code:`#!pip install accelerate
generator(model="openai/whisper-large", device_map="auto")`,highlighted:`<span class="hljs-comment">#!pip install accelerate</span>
generator(model=<span class="hljs-string">&quot;openai/whisper-large&quot;</span>, device_map=<span class="hljs-string">&quot;auto&quot;</span>)`}}),Be=new N({}),We=new A({props:{code:`generator(model="openai/whisper-large", device=0, batch_size=2)
audio_filenames = [f"audio_{i}.flac" for i in range(10)]
texts = generator(audio_filenames)`,highlighted:`generator(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)`}}),Ke=new N({}),Ye=new A({props:{code:`# Not using whisper, as it cannot provide timestamps.
generator = pipeline(model="facebook/wav2vec2-large-960h-lv60-self", return_timestamps="word")
generator("https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac")`,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>)}]}`}}),Je=new N({}),Xe=new A({props:{code:`def data():
    for i in range(1000):
        yield f"My example {i}"


pipe = pipeline(model="gpt2", device=0)
generated_characters = 0
for out in pipe(data()):
    generated_characters += len(out[0]["generated_text"])`,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>])`}}),ss=new A({props:{code:`# KeyDataset is a util that will just output the item we're interested in.
from transformers.pipelines.pt_utils import KeyDataset
from datasets import load_dataset

pipe = pipeline(model="hf-internal-testing/tiny-random-wav2vec2", device=0)
dataset = load_dataset("hf-internal-testing/librispeech_asr_dummy", "clean", split="validation[:10]")

for out in pipe(KeyDataset(dataset, "audio")):
    print(out)`,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)`}}),as=new N({}),ue=new _i({props:{$$slots:{default:[pp]},$$scope:{ctx:Y}}}),ts=new N({}),ns=new A({props:{code:`from transformers import pipeline

vision_classifier = pipeline(model="google/vit-base-patch16-224")
preds = vision_classifier(
    images="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg"
)
preds = [{"score": round(pred["score"], 4), "label": pred["label"]} for pred in preds]
preds`,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>}]`}}),ls=new N({}),is=new A({props:{code:`from transformers import pipeline

# This model is a \`zero-shot-classification\` model.
# It will classify text, except you are free to choose any label you might imagine
classifier = pipeline(model="facebook/bart-large-mnli")
classifier(
    "I have a problem with my iphone that needs to be resolved asap!!",
    candidate_labels=["urgent", "not urgent", "phone", "tablet", "computer"],
)`,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>]}`}}),rs=new N({}),os=new A({props:{code:`from transformers import pipeline

vqa = pipeline(model="impira/layoutlm-document-qa")
vqa(
    image="https://huggingface.co/spaces/impira/docquery/resolve/2359223c1837a7587402bda0f2643382a6eefeab/invoice.png",
    question="What is the invoice number?",
)`,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.42514941096305847</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>}]`}}),be=new _i({props:{$$slots:{default:[op]},$$scope:{ctx:Y}}}),{c(){m=n("meta"),$=c(),j=n("h1"),_=n("a"),P=n("span"),u(k.$$.fragment),q=c(),E=n("span"),Q=r("Pipelines for inference"),b=c(),x=n("p"),cs=r("The "),O=n("a"),pn=r("pipeline()"),on=r(" makes it simple to use any model from the "),ke=n("a"),hn=r("Hub"),cn=r(" 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 "),fs=n("a"),fn=r("pipeline()"),mn=r("! This tutorial will teach you to:"),qa=c(),I=n("ul"),Ee=n("li"),un=r("Use a "),ms=n("a"),dn=r("pipeline()"),gn=r(" for inference."),vn=c(),Ys=n("li"),yn=r("Use a specific tokenizer or model."),wn=c(),qe=n("li"),jn=r("Use a "),us=n("a"),xn=r("pipeline()"),bn=r(" for audio, vision, and multimodal tasks."),Aa=c(),u(J.$$.fragment),Pa=c(),R=n("h2"),X=n("a"),Qs=n("span"),u(Ae.$$.fragment),$n=c(),Js=n("span"),_n=r("Pipeline usage"),Ta=c(),T=n("p"),kn=r("While each task has an associated "),ds=n("a"),En=r("pipeline()"),qn=r(", it is simpler to use the general "),gs=n("a"),An=r("pipeline()"),Pn=r(" abstraction which contains all the task-specific pipelines. The "),vs=n("a"),Tn=r("pipeline()"),Nn=r(" automatically loads a default model and a preprocessing class capable of inference for your task."),Na=c(),ys=n("ol"),Pe=n("li"),In=r("Start by creating a "),ws=n("a"),Sn=r("pipeline()"),Un=r(" and specify an inference task:"),Ia=c(),u(Te.$$.fragment),Sa=c(),Ne=n("ol"),Ie=n("li"),Ln=r("Pass your input text to the "),js=n("a"),Dn=r("pipeline()"),Hn=r(":"),Ua=c(),u(Se.$$.fragment),La=c(),S=n("p"),On=r("Not the result you had in mind? Check out some of the "),Ue=n("a"),Rn=r("most downloaded automatic speech recognition models"),zn=r(` on the Hub to see if you can get a better transcription.
Let\u2019s try `),Le=n("a"),Cn=r("openai/whisper-large"),Fn=r(":"),Da=c(),u(De.$$.fragment),Ha=c(),Z=n("p"),Mn=r(`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 `),xs=n("a"),Gn=r("training"),Bn=r(" your own!"),Oa=c(),bs=n("p"),Vn=r("If you have several inputs, you can pass your input as a list:"),Ra=c(),u(He.$$.fragment),za=c(),$s=n("p"),Wn=r("If you want to iterate over a whole dataset, or want to use it for inference in a webserver, check out dedicated parts"),Ca=c(),_s=n("p"),ks=n("a"),Kn=r("Using pipelines on a dataset"),Fa=c(),Es=n("p"),qs=n("a"),Yn=r("Using pipelines for a webserver"),Ma=c(),z=n("h2"),ee=n("a"),Xs=n("span"),u(Oe.$$.fragment),Qn=c(),Zs=n("span"),Jn=r("Parameters"),Ga=c(),Re=n("p"),As=n("a"),Xn=r("pipeline()"),Zn=r(` supports many parameters; some are task specific, and some are general to all pipelines.
In general you can specify parameters anywhere you want:`),Ba=c(),u(ze.$$.fragment),Va=c(),Ps=n("p"),el=r("Let\u2019s check out 3 important ones:"),Wa=c(),C=n("h3"),se=n("a"),ea=n("span"),u(Ce.$$.fragment),sl=c(),sa=n("span"),al=r("Device"),Ka=c(),ae=n("p"),tl=r("If you use "),aa=n("code"),nl=r("device=n"),ll=r(`, the pipeline automatically puts the model on the specified device.
This will work regardless of whether you are using PyTorch or Tensorflow.`),Ya=c(),u(Fe.$$.fragment),Qa=c(),U=n("p"),il=r("If the model is too large for a single GPU, you can set "),ta=n("code"),rl=r('device_map="auto"'),pl=r(" to allow \u{1F917} "),Me=n("a"),ol=r("Accelerate"),hl=r(" to automatically determine how to load and store the model weights."),Ja=c(),u(Ge.$$.fragment),Xa=c(),F=n("h3"),te=n("a"),na=n("span"),u(Be.$$.fragment),cl=c(),la=n("span"),fl=r("Batch size"),Za=c(),ne=n("p"),ml=r("By default, pipelines will not batch inference for reasons explained in detail "),Ve=n("a"),ul=r("here"),dl=r(". The reason is that batching is not necessarily faster, and can actually be quite slower in some cases."),et=c(),Ts=n("p"),gl=r("But if it works in your use case, you can use:"),st=c(),u(We.$$.fragment),at=c(),Ns=n("p"),vl=r(`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.`),tt=c(),le=n("p"),yl=r("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 "),Is=n("a"),ia=n("em"),wl=r("chunk batching"),jl=r(" for you."),nt=c(),M=n("h3"),ie=n("a"),ra=n("span"),u(Ke.$$.fragment),xl=c(),pa=n("span"),bl=r("Task specific parameters"),lt=c(),L=n("p"),$l=r(`All tasks provide task specific parameters which allow for additional flexibility and options to help you get your job done.
For instance, the `),re=n("a"),_l=r("transformers.AutomaticSpeechRecognitionPipeline."),oa=n("strong"),kl=r("call"),El=r("()"),ql=r(" method has a "),ha=n("code"),Al=r("return_timestamps"),Pl=r(" parameter which sounds promising for subtitling videos:"),it=c(),u(Ye.$$.fragment),rt=c(),pe=n("p"),Tl=r("As you can see, the model inferred the text and also outputted "),ca=n("strong"),Nl=r("when"),Il=r(` the various words were pronounced
in the sentence.`),pt=c(),D=n("p"),Sl=r(`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 `),Ss=n("a"),Ul=r("AutomaticSpeechRecognitionPipeline"),Ll=r(" has a "),fa=n("code"),Dl=r("chunk_length_s"),Hl=r(" 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."),ot=c(),oe=n("p"),Ol=r("If you can\u2019t find a parameter that would really help you out, feel free to "),Qe=n("a"),Rl=r("request it"),zl=r("!"),ht=c(),G=n("h2"),he=n("a"),ma=n("span"),u(Je.$$.fragment),Cl=c(),ua=n("span"),Fl=r("Using pipelines on a dataset"),ct=c(),Us=n("p"),Ml=r("The pipeline can also run inference on a large dataset. The easiest way we recommend doing this is by using an iterator:"),ft=c(),u(Xe.$$.fragment),mt=c(),H=n("p"),Gl=r("The iterator "),da=n("code"),Bl=r("data()"),Vl=r(` 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 `),Ze=n("a"),Wl=r("DataLoader"),Kl=r(` 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.`),ut=c(),ce=n("p"),Yl=r("Since batching could speed things up, it may be useful to try tuning the "),ga=n("code"),Ql=r("batch_size"),Jl=r(" parameter here."),dt=c(),fe=n("p"),Xl=r("The simplest way to iterate over a dataset is to just load one from \u{1F917} "),es=n("a"),Zl=r("Datasets"),ei=r(":"),gt=c(),u(ss.$$.fragment),vt=c(),B=n("h2"),me=n("a"),va=n("span"),u(as.$$.fragment),si=c(),ya=n("span"),ai=r("Using pipelines for a webserver"),yt=c(),u(ue.$$.fragment),wt=c(),Ls=n("p"),Ds=n("a"),ti=r("Link"),jt=c(),V=n("h2"),de=n("a"),wa=n("span"),u(ts.$$.fragment),ni=c(),ja=n("span"),li=r("Vision pipeline"),xt=c(),ge=n("p"),ii=r("Using a "),Hs=n("a"),ri=r("pipeline()"),pi=r(" for vision tasks is practically identical."),bt=c(),Os=n("p"),oi=r("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?"),$t=c(),Rs=n("p"),zs=n("img"),_t=c(),u(ns.$$.fragment),kt=c(),W=n("h2"),ve=n("a"),xa=n("span"),u(ls.$$.fragment),hi=c(),ba=n("span"),ci=r("Text pipeline"),Et=c(),ye=n("p"),fi=r("Using a "),Cs=n("a"),mi=r("pipeline()"),ui=r(" for NLP tasks is practically identical."),qt=c(),u(is.$$.fragment),At=c(),K=n("h2"),we=n("a"),$a=n("span"),u(rs.$$.fragment),di=c(),_a=n("span"),gi=r("Multimodal pipeline"),Pt=c(),je=n("p"),vi=r("The "),Fs=n("a"),yi=r("pipeline()"),wi=r(" 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."),Tt=c(),xe=n("p"),ji=r("For example, if you use this "),ps=n("a"),xi=r("invoice image"),bi=r(":"),Nt=c(),u(os.$$.fragment),It=c(),u(be.$$.fragment),this.h()},l(e){const t=tp('[data-svelte="svelte-1phssyn"]',document.head);m=l(t,"META",{name:!0,content:!0}),t.forEach(s),$=f(e),j=l(e,"H1",{class:!0});var hs=i(j);_=l(hs,"A",{id:!0,class:!0,href:!0});var ka=i(_);P=l(ka,"SPAN",{});var Ea=i(P);d(k.$$.fragment,Ea),Ea.forEach(s),ka.forEach(s),q=f(hs),E=l(hs,"SPAN",{});var Ei=i(E);Q=p(Ei,"Pipelines for inference"),Ei.forEach(s),hs.forEach(s),b=f(e),x=l(e,"P",{});var $e=i(x);cs=p($e,"The "),O=l($e,"A",{href:!0});var qi=i(O);pn=p(qi,"pipeline()"),qi.forEach(s),on=p($e," makes it simple to use any model from the "),ke=l($e,"A",{href:!0,rel:!0});var Ai=i(ke);hn=p(Ai,"Hub"),Ai.forEach(s),cn=p($e," 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 "),fs=l($e,"A",{href:!0});var Pi=i(fs);fn=p(Pi,"pipeline()"),Pi.forEach(s),mn=p($e,"! This tutorial will teach you to:"),$e.forEach(s),qa=f(e),I=l(e,"UL",{});var Ms=i(I);Ee=l(Ms,"LI",{});var Ut=i(Ee);un=p(Ut,"Use a "),ms=l(Ut,"A",{href:!0});var Ti=i(ms);dn=p(Ti,"pipeline()"),Ti.forEach(s),gn=p(Ut," for inference."),Ut.forEach(s),vn=f(Ms),Ys=l(Ms,"LI",{});var Ni=i(Ys);yn=p(Ni,"Use a specific tokenizer or model."),Ni.forEach(s),wn=f(Ms),qe=l(Ms,"LI",{});var Lt=i(qe);jn=p(Lt,"Use a "),us=l(Lt,"A",{href:!0});var Ii=i(us);xn=p(Ii,"pipeline()"),Ii.forEach(s),bn=p(Lt," for audio, vision, and multimodal tasks."),Lt.forEach(s),Ms.forEach(s),Aa=f(e),d(J.$$.fragment,e),Pa=f(e),R=l(e,"H2",{class:!0});var Dt=i(R);X=l(Dt,"A",{id:!0,class:!0,href:!0});var Si=i(X);Qs=l(Si,"SPAN",{});var Ui=i(Qs);d(Ae.$$.fragment,Ui),Ui.forEach(s),Si.forEach(s),$n=f(Dt),Js=l(Dt,"SPAN",{});var Li=i(Js);_n=p(Li,"Pipeline usage"),Li.forEach(s),Dt.forEach(s),Ta=f(e),T=l(e,"P",{});var _e=i(T);kn=p(_e,"While each task has an associated "),ds=l(_e,"A",{href:!0});var Di=i(ds);En=p(Di,"pipeline()"),Di.forEach(s),qn=p(_e,", it is simpler to use the general "),gs=l(_e,"A",{href:!0});var Hi=i(gs);An=p(Hi,"pipeline()"),Hi.forEach(s),Pn=p(_e," abstraction which contains all the task-specific pipelines. The "),vs=l(_e,"A",{href:!0});var Oi=i(vs);Tn=p(Oi,"pipeline()"),Oi.forEach(s),Nn=p(_e," automatically loads a default model and a preprocessing class capable of inference for your task."),_e.forEach(s),Na=f(e),ys=l(e,"OL",{});var Ri=i(ys);Pe=l(Ri,"LI",{});var Ht=i(Pe);In=p(Ht,"Start by creating a "),ws=l(Ht,"A",{href:!0});var zi=i(ws);Sn=p(zi,"pipeline()"),zi.forEach(s),Un=p(Ht," and specify an inference task:"),Ht.forEach(s),Ri.forEach(s),Ia=f(e),d(Te.$$.fragment,e),Sa=f(e),Ne=l(e,"OL",{start:!0});var Ci=i(Ne);Ie=l(Ci,"LI",{});var Ot=i(Ie);Ln=p(Ot,"Pass your input text to the "),js=l(Ot,"A",{href:!0});var Fi=i(js);Dn=p(Fi,"pipeline()"),Fi.forEach(s),Hn=p(Ot,":"),Ot.forEach(s),Ci.forEach(s),Ua=f(e),d(Se.$$.fragment,e),La=f(e),S=l(e,"P",{});var Gs=i(S);On=p(Gs,"Not the result you had in mind? Check out some of the "),Ue=l(Gs,"A",{href:!0,rel:!0});var Mi=i(Ue);Rn=p(Mi,"most downloaded automatic speech recognition models"),Mi.forEach(s),zn=p(Gs,` on the Hub to see if you can get a better transcription.
Let\u2019s try `),Le=l(Gs,"A",{href:!0,rel:!0});var Gi=i(Le);Cn=p(Gi,"openai/whisper-large"),Gi.forEach(s),Fn=p(Gs,":"),Gs.forEach(s),Da=f(e),d(De.$$.fragment,e),Ha=f(e),Z=l(e,"P",{});var Rt=i(Z);Mn=p(Rt,`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 `),xs=l(Rt,"A",{href:!0});var Bi=i(xs);Gn=p(Bi,"training"),Bi.forEach(s),Bn=p(Rt," your own!"),Rt.forEach(s),Oa=f(e),bs=l(e,"P",{});var Vi=i(bs);Vn=p(Vi,"If you have several inputs, you can pass your input as a list:"),Vi.forEach(s),Ra=f(e),d(He.$$.fragment,e),za=f(e),$s=l(e,"P",{});var Wi=i($s);Wn=p(Wi,"If you want to iterate over a whole dataset, or want to use it for inference in a webserver, check out dedicated parts"),Wi.forEach(s),Ca=f(e),_s=l(e,"P",{});var Ki=i(_s);ks=l(Ki,"A",{href:!0});var Yi=i(ks);Kn=p(Yi,"Using pipelines on a dataset"),Yi.forEach(s),Ki.forEach(s),Fa=f(e),Es=l(e,"P",{});var Qi=i(Es);qs=l(Qi,"A",{href:!0});var Ji=i(qs);Yn=p(Ji,"Using pipelines for a webserver"),Ji.forEach(s),Qi.forEach(s),Ma=f(e),z=l(e,"H2",{class:!0});var zt=i(z);ee=l(zt,"A",{id:!0,class:!0,href:!0});var Xi=i(ee);Xs=l(Xi,"SPAN",{});var Zi=i(Xs);d(Oe.$$.fragment,Zi),Zi.forEach(s),Xi.forEach(s),Qn=f(zt),Zs=l(zt,"SPAN",{});var er=i(Zs);Jn=p(er,"Parameters"),er.forEach(s),zt.forEach(s),Ga=f(e),Re=l(e,"P",{});var $i=i(Re);As=l($i,"A",{href:!0});var sr=i(As);Xn=p(sr,"pipeline()"),sr.forEach(s),Zn=p($i,` supports many parameters; some are task specific, and some are general to all pipelines.
In general you can specify parameters anywhere you want:`),$i.forEach(s),Ba=f(e),d(ze.$$.fragment,e),Va=f(e),Ps=l(e,"P",{});var ar=i(Ps);el=p(ar,"Let\u2019s check out 3 important ones:"),ar.forEach(s),Wa=f(e),C=l(e,"H3",{class:!0});var Ct=i(C);se=l(Ct,"A",{id:!0,class:!0,href:!0});var tr=i(se);ea=l(tr,"SPAN",{});var nr=i(ea);d(Ce.$$.fragment,nr),nr.forEach(s),tr.forEach(s),sl=f(Ct),sa=l(Ct,"SPAN",{});var lr=i(sa);al=p(lr,"Device"),lr.forEach(s),Ct.forEach(s),Ka=f(e),ae=l(e,"P",{});var Ft=i(ae);tl=p(Ft,"If you use "),aa=l(Ft,"CODE",{});var ir=i(aa);nl=p(ir,"device=n"),ir.forEach(s),ll=p(Ft,`, the pipeline automatically puts the model on the specified device.
This will work regardless of whether you are using PyTorch or Tensorflow.`),Ft.forEach(s),Ya=f(e),d(Fe.$$.fragment,e),Qa=f(e),U=l(e,"P",{});var Bs=i(U);il=p(Bs,"If the model is too large for a single GPU, you can set "),ta=l(Bs,"CODE",{});var rr=i(ta);rl=p(rr,'device_map="auto"'),rr.forEach(s),pl=p(Bs," to allow \u{1F917} "),Me=l(Bs,"A",{href:!0,rel:!0});var pr=i(Me);ol=p(pr,"Accelerate"),pr.forEach(s),hl=p(Bs," to automatically determine how to load and store the model weights."),Bs.forEach(s),Ja=f(e),d(Ge.$$.fragment,e),Xa=f(e),F=l(e,"H3",{class:!0});var Mt=i(F);te=l(Mt,"A",{id:!0,class:!0,href:!0});var or=i(te);na=l(or,"SPAN",{});var hr=i(na);d(Be.$$.fragment,hr),hr.forEach(s),or.forEach(s),cl=f(Mt),la=l(Mt,"SPAN",{});var cr=i(la);fl=p(cr,"Batch size"),cr.forEach(s),Mt.forEach(s),Za=f(e),ne=l(e,"P",{});var Gt=i(ne);ml=p(Gt,"By default, pipelines will not batch inference for reasons explained in detail "),Ve=l(Gt,"A",{href:!0,rel:!0});var fr=i(Ve);ul=p(fr,"here"),fr.forEach(s),dl=p(Gt,". The reason is that batching is not necessarily faster, and can actually be quite slower in some cases."),Gt.forEach(s),et=f(e),Ts=l(e,"P",{});var mr=i(Ts);gl=p(mr,"But if it works in your use case, you can use:"),mr.forEach(s),st=f(e),d(We.$$.fragment,e),at=f(e),Ns=l(e,"P",{});var ur=i(Ns);vl=p(ur,`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.`),ur.forEach(s),tt=f(e),le=l(e,"P",{});var Bt=i(le);yl=p(Bt,"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 "),Is=l(Bt,"A",{href:!0});var dr=i(Is);ia=l(dr,"EM",{});var gr=i(ia);wl=p(gr,"chunk batching"),gr.forEach(s),dr.forEach(s),jl=p(Bt," for you."),Bt.forEach(s),nt=f(e),M=l(e,"H3",{class:!0});var Vt=i(M);ie=l(Vt,"A",{id:!0,class:!0,href:!0});var vr=i(ie);ra=l(vr,"SPAN",{});var yr=i(ra);d(Ke.$$.fragment,yr),yr.forEach(s),vr.forEach(s),xl=f(Vt),pa=l(Vt,"SPAN",{});var wr=i(pa);bl=p(wr,"Task specific parameters"),wr.forEach(s),Vt.forEach(s),lt=f(e),L=l(e,"P",{});var Vs=i(L);$l=p(Vs,`All tasks provide task specific parameters which allow for additional flexibility and options to help you get your job done.
For instance, the `),re=l(Vs,"A",{href:!0});var Wt=i(re);_l=p(Wt,"transformers.AutomaticSpeechRecognitionPipeline."),oa=l(Wt,"STRONG",{});var jr=i(oa);kl=p(jr,"call"),jr.forEach(s),El=p(Wt,"()"),Wt.forEach(s),ql=p(Vs," method has a "),ha=l(Vs,"CODE",{});var xr=i(ha);Al=p(xr,"return_timestamps"),xr.forEach(s),Pl=p(Vs," parameter which sounds promising for subtitling videos:"),Vs.forEach(s),it=f(e),d(Ye.$$.fragment,e),rt=f(e),pe=l(e,"P",{});var Kt=i(pe);Tl=p(Kt,"As you can see, the model inferred the text and also outputted "),ca=l(Kt,"STRONG",{});var br=i(ca);Nl=p(br,"when"),br.forEach(s),Il=p(Kt,` the various words were pronounced
in the sentence.`),Kt.forEach(s),pt=f(e),D=l(e,"P",{});var Ws=i(D);Sl=p(Ws,`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 `),Ss=l(Ws,"A",{href:!0});var $r=i(Ss);Ul=p($r,"AutomaticSpeechRecognitionPipeline"),$r.forEach(s),Ll=p(Ws," has a "),fa=l(Ws,"CODE",{});var _r=i(fa);Dl=p(_r,"chunk_length_s"),_r.forEach(s),Hl=p(Ws," 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."),Ws.forEach(s),ot=f(e),oe=l(e,"P",{});var Yt=i(oe);Ol=p(Yt,"If you can\u2019t find a parameter that would really help you out, feel free to "),Qe=l(Yt,"A",{href:!0,rel:!0});var kr=i(Qe);Rl=p(kr,"request it"),kr.forEach(s),zl=p(Yt,"!"),Yt.forEach(s),ht=f(e),G=l(e,"H2",{class:!0});var Qt=i(G);he=l(Qt,"A",{id:!0,class:!0,href:!0});var Er=i(he);ma=l(Er,"SPAN",{});var qr=i(ma);d(Je.$$.fragment,qr),qr.forEach(s),Er.forEach(s),Cl=f(Qt),ua=l(Qt,"SPAN",{});var Ar=i(ua);Fl=p(Ar,"Using pipelines on a dataset"),Ar.forEach(s),Qt.forEach(s),ct=f(e),Us=l(e,"P",{});var Pr=i(Us);Ml=p(Pr,"The pipeline can also run inference on a large dataset. The easiest way we recommend doing this is by using an iterator:"),Pr.forEach(s),ft=f(e),d(Xe.$$.fragment,e),mt=f(e),H=l(e,"P",{});var Ks=i(H);Gl=p(Ks,"The iterator "),da=l(Ks,"CODE",{});var Tr=i(da);Bl=p(Tr,"data()"),Tr.forEach(s),Vl=p(Ks,` 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 `),Ze=l(Ks,"A",{href:!0,rel:!0});var Nr=i(Ze);Wl=p(Nr,"DataLoader"),Nr.forEach(s),Kl=p(Ks,` 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.`),Ks.forEach(s),ut=f(e),ce=l(e,"P",{});var Jt=i(ce);Yl=p(Jt,"Since batching could speed things up, it may be useful to try tuning the "),ga=l(Jt,"CODE",{});var Ir=i(ga);Ql=p(Ir,"batch_size"),Ir.forEach(s),Jl=p(Jt," parameter here."),Jt.forEach(s),dt=f(e),fe=l(e,"P",{});var Xt=i(fe);Xl=p(Xt,"The simplest way to iterate over a dataset is to just load one from \u{1F917} "),es=l(Xt,"A",{href:!0,rel:!0});var Sr=i(es);Zl=p(Sr,"Datasets"),Sr.forEach(s),ei=p(Xt,":"),Xt.forEach(s),gt=f(e),d(ss.$$.fragment,e),vt=f(e),B=l(e,"H2",{class:!0});var Zt=i(B);me=l(Zt,"A",{id:!0,class:!0,href:!0});var Ur=i(me);va=l(Ur,"SPAN",{});var Lr=i(va);d(as.$$.fragment,Lr),Lr.forEach(s),Ur.forEach(s),si=f(Zt),ya=l(Zt,"SPAN",{});var Dr=i(ya);ai=p(Dr,"Using pipelines for a webserver"),Dr.forEach(s),Zt.forEach(s),yt=f(e),d(ue.$$.fragment,e),wt=f(e),Ls=l(e,"P",{});var Hr=i(Ls);Ds=l(Hr,"A",{href:!0});var Or=i(Ds);ti=p(Or,"Link"),Or.forEach(s),Hr.forEach(s),jt=f(e),V=l(e,"H2",{class:!0});var en=i(V);de=l(en,"A",{id:!0,class:!0,href:!0});var Rr=i(de);wa=l(Rr,"SPAN",{});var zr=i(wa);d(ts.$$.fragment,zr),zr.forEach(s),Rr.forEach(s),ni=f(en),ja=l(en,"SPAN",{});var Cr=i(ja);li=p(Cr,"Vision pipeline"),Cr.forEach(s),en.forEach(s),xt=f(e),ge=l(e,"P",{});var sn=i(ge);ii=p(sn,"Using a "),Hs=l(sn,"A",{href:!0});var Fr=i(Hs);ri=p(Fr,"pipeline()"),Fr.forEach(s),pi=p(sn," for vision tasks is practically identical."),sn.forEach(s),bt=f(e),Os=l(e,"P",{});var Mr=i(Os);oi=p(Mr,"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?"),Mr.forEach(s),$t=f(e),Rs=l(e,"P",{});var Gr=i(Rs);zs=l(Gr,"IMG",{src:!0,alt:!0}),Gr.forEach(s),_t=f(e),d(ns.$$.fragment,e),kt=f(e),W=l(e,"H2",{class:!0});var an=i(W);ve=l(an,"A",{id:!0,class:!0,href:!0});var Br=i(ve);xa=l(Br,"SPAN",{});var Vr=i(xa);d(ls.$$.fragment,Vr),Vr.forEach(s),Br.forEach(s),hi=f(an),ba=l(an,"SPAN",{});var Wr=i(ba);ci=p(Wr,"Text pipeline"),Wr.forEach(s),an.forEach(s),Et=f(e),ye=l(e,"P",{});var tn=i(ye);fi=p(tn,"Using a "),Cs=l(tn,"A",{href:!0});var Kr=i(Cs);mi=p(Kr,"pipeline()"),Kr.forEach(s),ui=p(tn," for NLP tasks is practically identical."),tn.forEach(s),qt=f(e),d(is.$$.fragment,e),At=f(e),K=l(e,"H2",{class:!0});var nn=i(K);we=l(nn,"A",{id:!0,class:!0,href:!0});var Yr=i(we);$a=l(Yr,"SPAN",{});var Qr=i($a);d(rs.$$.fragment,Qr),Qr.forEach(s),Yr.forEach(s),di=f(nn),_a=l(nn,"SPAN",{});var Jr=i(_a);gi=p(Jr,"Multimodal pipeline"),Jr.forEach(s),nn.forEach(s),Pt=f(e),je=l(e,"P",{});var ln=i(je);vi=p(ln,"The "),Fs=l(ln,"A",{href:!0});var Xr=i(Fs);yi=p(Xr,"pipeline()"),Xr.forEach(s),wi=p(ln," 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."),ln.forEach(s),Tt=f(e),xe=l(e,"P",{});var rn=i(xe);ji=p(rn,"For example, if you use this "),ps=l(rn,"A",{href:!0,rel:!0});var Zr=i(ps);xi=p(Zr,"invoice image"),Zr.forEach(s),bi=p(rn,":"),rn.forEach(s),Nt=f(e),d(os.$$.fragment,e),It=f(e),d(be.$$.fragment,e),this.h()},h(){h(m,"name","hf:doc:metadata"),h(m,"content",JSON.stringify(cp)),h(_,"id","pipelines-for-inference"),h(_,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(_,"href","#pipelines-for-inference"),h(j,"class","relative group"),h(O,"href","/docs/transformers/main/en/main_classes/pipelines#transformers.pipeline"),h(ke,"href","https://huggingface.co/models"),h(ke,"rel","nofollow"),h(fs,"href","/docs/transformers/main/en/main_classes/pipelines#transformers.pipeline"),h(ms,"href","/docs/transformers/main/en/main_classes/pipelines#transformers.pipeline"),h(us,"href","/docs/transformers/main/en/main_classes/pipelines#transformers.pipeline"),h(X,"id","pipeline-usage"),h(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"),h(X,"href","#pipeline-usage"),h(R,"class","relative group"),h(ds,"href","/docs/transformers/main/en/main_classes/pipelines#transformers.pipeline"),h(gs,"href","/docs/transformers/main/en/main_classes/pipelines#transformers.pipeline"),h(vs,"href","/docs/transformers/main/en/main_classes/pipelines#transformers.pipeline"),h(ws,"href","/docs/transformers/main/en/main_classes/pipelines#transformers.pipeline"),h(js,"href","/docs/transformers/main/en/main_classes/pipelines#transformers.pipeline"),h(Ne,"start","2"),h(Ue,"href","https://huggingface.co/models?pipeline_tag=automatic-speech-recognition&sort=downloads"),h(Ue,"rel","nofollow"),h(Le,"href","https://huggingface.co/openai/whisper-large"),h(Le,"rel","nofollow"),h(xs,"href","training"),h(ks,"href","#using-pipelines-on-a-dataset"),h(qs,"href","./pipeline_webserver"),h(ee,"id","parameters"),h(ee,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(ee,"href","#parameters"),h(z,"class","relative group"),h(As,"href","/docs/transformers/main/en/main_classes/pipelines#transformers.pipeline"),h(se,"id","device"),h(se,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(se,"href","#device"),h(C,"class","relative group"),h(Me,"href","https://huggingface.co/docs/accelerate"),h(Me,"rel","nofollow"),h(te,"id","batch-size"),h(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"),h(te,"href","#batch-size"),h(F,"class","relative group"),h(Ve,"href","https://huggingface.co/docs/transformers/main_classes/pipelines#pipeline-batching"),h(Ve,"rel","nofollow"),h(Is,"href","./main_classes/pipelines#pipeline-chunk-batching"),h(ie,"id","task-specific-parameters"),h(ie,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(ie,"href","#task-specific-parameters"),h(M,"class","relative group"),h(re,"href","/docs/transformers/main/en/main_classes/pipelines#transformers.AutomaticSpeechRecognitionPipeline.__call__"),h(Ss,"href","/docs/transformers/main/en/main_classes/pipelines#transformers.AutomaticSpeechRecognitionPipeline"),h(Qe,"href","https://github.com/huggingface/transformers/issues/new?assignees=&labels=feature&template=feature-request.yml"),h(Qe,"rel","nofollow"),h(he,"id","using-pipelines-on-a-dataset"),h(he,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(he,"href","#using-pipelines-on-a-dataset"),h(G,"class","relative group"),h(Ze,"href","https://pytorch.org/docs/stable/data.html#torch.utils.data.DataLoader"),h(Ze,"rel","nofollow"),h(es,"href","https://github.com/huggingface/datasets/"),h(es,"rel","nofollow"),h(me,"id","using-pipelines-for-a-webserver"),h(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"),h(me,"href","#using-pipelines-for-a-webserver"),h(B,"class","relative group"),h(Ds,"href","./pipeline_webserver"),h(de,"id","vision-pipeline"),h(de,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),h(de,"href","#vision-pipeline"),h(V,"class","relative group"),h(Hs,"href","/docs/transformers/main/en/main_classes/pipelines#transformers.pipeline"),np(zs.src,ki="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg")||h(zs,"src",ki),h(zs,"alt","pipeline-cat-chonk"),h(ve,"id","text-pipeline"),h(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"),h(ve,"href","#text-pipeline"),h(W,"class","relative group"),h(Cs,"href","/docs/transformers/main/en/main_classes/pipelines#transformers.pipeline"),h(we,"id","multimodal-pipeline"),h(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"),h(we,"href","#multimodal-pipeline"),h(K,"class","relative group"),h(Fs,"href","/docs/transformers/main/en/main_classes/pipelines#transformers.pipeline"),h(ps,"href","https://huggingface.co/spaces/impira/docquery/resolve/2359223c1837a7587402bda0f2643382a6eefeab/invoice.png"),h(ps,"rel","nofollow")},m(e,t){a(document.head,m),o(e,$,t),o(e,j,t),a(j,_),a(_,P),g(k,P,null),a(j,q),a(j,E),a(E,Q),o(e,b,t),o(e,x,t),a(x,cs),a(x,O),a(O,pn),a(x,on),a(x,ke),a(ke,hn),a(x,cn),a(x,fs),a(fs,fn),a(x,mn),o(e,qa,t),o(e,I,t),a(I,Ee),a(Ee,un),a(Ee,ms),a(ms,dn),a(Ee,gn),a(I,vn),a(I,Ys),a(Ys,yn),a(I,wn),a(I,qe),a(qe,jn),a(qe,us),a(us,xn),a(qe,bn),o(e,Aa,t),g(J,e,t),o(e,Pa,t),o(e,R,t),a(R,X),a(X,Qs),g(Ae,Qs,null),a(R,$n),a(R,Js),a(Js,_n),o(e,Ta,t),o(e,T,t),a(T,kn),a(T,ds),a(ds,En),a(T,qn),a(T,gs),a(gs,An),a(T,Pn),a(T,vs),a(vs,Tn),a(T,Nn),o(e,Na,t),o(e,ys,t),a(ys,Pe),a(Pe,In),a(Pe,ws),a(ws,Sn),a(Pe,Un),o(e,Ia,t),g(Te,e,t),o(e,Sa,t),o(e,Ne,t),a(Ne,Ie),a(Ie,Ln),a(Ie,js),a(js,Dn),a(Ie,Hn),o(e,Ua,t),g(Se,e,t),o(e,La,t),o(e,S,t),a(S,On),a(S,Ue),a(Ue,Rn),a(S,zn),a(S,Le),a(Le,Cn),a(S,Fn),o(e,Da,t),g(De,e,t),o(e,Ha,t),o(e,Z,t),a(Z,Mn),a(Z,xs),a(xs,Gn),a(Z,Bn),o(e,Oa,t),o(e,bs,t),a(bs,Vn),o(e,Ra,t),g(He,e,t),o(e,za,t),o(e,$s,t),a($s,Wn),o(e,Ca,t),o(e,_s,t),a(_s,ks),a(ks,Kn),o(e,Fa,t),o(e,Es,t),a(Es,qs),a(qs,Yn),o(e,Ma,t),o(e,z,t),a(z,ee),a(ee,Xs),g(Oe,Xs,null),a(z,Qn),a(z,Zs),a(Zs,Jn),o(e,Ga,t),o(e,Re,t),a(Re,As),a(As,Xn),a(Re,Zn),o(e,Ba,t),g(ze,e,t),o(e,Va,t),o(e,Ps,t),a(Ps,el),o(e,Wa,t),o(e,C,t),a(C,se),a(se,ea),g(Ce,ea,null),a(C,sl),a(C,sa),a(sa,al),o(e,Ka,t),o(e,ae,t),a(ae,tl),a(ae,aa),a(aa,nl),a(ae,ll),o(e,Ya,t),g(Fe,e,t),o(e,Qa,t),o(e,U,t),a(U,il),a(U,ta),a(ta,rl),a(U,pl),a(U,Me),a(Me,ol),a(U,hl),o(e,Ja,t),g(Ge,e,t),o(e,Xa,t),o(e,F,t),a(F,te),a(te,na),g(Be,na,null),a(F,cl),a(F,la),a(la,fl),o(e,Za,t),o(e,ne,t),a(ne,ml),a(ne,Ve),a(Ve,ul),a(ne,dl),o(e,et,t),o(e,Ts,t),a(Ts,gl),o(e,st,t),g(We,e,t),o(e,at,t),o(e,Ns,t),a(Ns,vl),o(e,tt,t),o(e,le,t),a(le,yl),a(le,Is),a(Is,ia),a(ia,wl),a(le,jl),o(e,nt,t),o(e,M,t),a(M,ie),a(ie,ra),g(Ke,ra,null),a(M,xl),a(M,pa),a(pa,bl),o(e,lt,t),o(e,L,t),a(L,$l),a(L,re),a(re,_l),a(re,oa),a(oa,kl),a(re,El),a(L,ql),a(L,ha),a(ha,Al),a(L,Pl),o(e,it,t),g(Ye,e,t),o(e,rt,t),o(e,pe,t),a(pe,Tl),a(pe,ca),a(ca,Nl),a(pe,Il),o(e,pt,t),o(e,D,t),a(D,Sl),a(D,Ss),a(Ss,Ul),a(D,Ll),a(D,fa),a(fa,Dl),a(D,Hl),o(e,ot,t),o(e,oe,t),a(oe,Ol),a(oe,Qe),a(Qe,Rl),a(oe,zl),o(e,ht,t),o(e,G,t),a(G,he),a(he,ma),g(Je,ma,null),a(G,Cl),a(G,ua),a(ua,Fl),o(e,ct,t),o(e,Us,t),a(Us,Ml),o(e,ft,t),g(Xe,e,t),o(e,mt,t),o(e,H,t),a(H,Gl),a(H,da),a(da,Bl),a(H,Vl),a(H,Ze),a(Ze,Wl),a(H,Kl),o(e,ut,t),o(e,ce,t),a(ce,Yl),a(ce,ga),a(ga,Ql),a(ce,Jl),o(e,dt,t),o(e,fe,t),a(fe,Xl),a(fe,es),a(es,Zl),a(fe,ei),o(e,gt,t),g(ss,e,t),o(e,vt,t),o(e,B,t),a(B,me),a(me,va),g(as,va,null),a(B,si),a(B,ya),a(ya,ai),o(e,yt,t),g(ue,e,t),o(e,wt,t),o(e,Ls,t),a(Ls,Ds),a(Ds,ti),o(e,jt,t),o(e,V,t),a(V,de),a(de,wa),g(ts,wa,null),a(V,ni),a(V,ja),a(ja,li),o(e,xt,t),o(e,ge,t),a(ge,ii),a(ge,Hs),a(Hs,ri),a(ge,pi),o(e,bt,t),o(e,Os,t),a(Os,oi),o(e,$t,t),o(e,Rs,t),a(Rs,zs),o(e,_t,t),g(ns,e,t),o(e,kt,t),o(e,W,t),a(W,ve),a(ve,xa),g(ls,xa,null),a(W,hi),a(W,ba),a(ba,ci),o(e,Et,t),o(e,ye,t),a(ye,fi),a(ye,Cs),a(Cs,mi),a(ye,ui),o(e,qt,t),g(is,e,t),o(e,At,t),o(e,K,t),a(K,we),a(we,$a),g(rs,$a,null),a(K,di),a(K,_a),a(_a,gi),o(e,Pt,t),o(e,je,t),a(je,vi),a(je,Fs),a(Fs,yi),a(je,wi),o(e,Tt,t),o(e,xe,t),a(xe,ji),a(xe,ps),a(ps,xi),a(xe,bi),o(e,Nt,t),g(os,e,t),o(e,It,t),g(be,e,t),St=!0},p(e,[t]){const hs={};t&2&&(hs.$$scope={dirty:t,ctx:e}),J.$set(hs);const ka={};t&2&&(ka.$$scope={dirty:t,ctx:e}),ue.$set(ka);const Ea={};t&2&&(Ea.$$scope={dirty:t,ctx:e}),be.$set(Ea)},i(e){St||(v(k.$$.fragment,e),v(J.$$.fragment,e),v(Ae.$$.fragment,e),v(Te.$$.fragment,e),v(Se.$$.fragment,e),v(De.$$.fragment,e),v(He.$$.fragment,e),v(Oe.$$.fragment,e),v(ze.$$.fragment,e),v(Ce.$$.fragment,e),v(Fe.$$.fragment,e),v(Ge.$$.fragment,e),v(Be.$$.fragment,e),v(We.$$.fragment,e),v(Ke.$$.fragment,e),v(Ye.$$.fragment,e),v(Je.$$.fragment,e),v(Xe.$$.fragment,e),v(ss.$$.fragment,e),v(as.$$.fragment,e),v(ue.$$.fragment,e),v(ts.$$.fragment,e),v(ns.$$.fragment,e),v(ls.$$.fragment,e),v(is.$$.fragment,e),v(rs.$$.fragment,e),v(os.$$.fragment,e),v(be.$$.fragment,e),St=!0)},o(e){y(k.$$.fragment,e),y(J.$$.fragment,e),y(Ae.$$.fragment,e),y(Te.$$.fragment,e),y(Se.$$.fragment,e),y(De.$$.fragment,e),y(He.$$.fragment,e),y(Oe.$$.fragment,e),y(ze.$$.fragment,e),y(Ce.$$.fragment,e),y(Fe.$$.fragment,e),y(Ge.$$.fragment,e),y(Be.$$.fragment,e),y(We.$$.fragment,e),y(Ke.$$.fragment,e),y(Ye.$$.fragment,e),y(Je.$$.fragment,e),y(Xe.$$.fragment,e),y(ss.$$.fragment,e),y(as.$$.fragment,e),y(ue.$$.fragment,e),y(ts.$$.fragment,e),y(ns.$$.fragment,e),y(ls.$$.fragment,e),y(is.$$.fragment,e),y(rs.$$.fragment,e),y(os.$$.fragment,e),y(be.$$.fragment,e),St=!1},d(e){s(m),e&&s($),e&&s(j),w(k),e&&s(b),e&&s(x),e&&s(qa),e&&s(I),e&&s(Aa),w(J,e),e&&s(Pa),e&&s(R),w(Ae),e&&s(Ta),e&&s(T),e&&s(Na),e&&s(ys),e&&s(Ia),w(Te,e),e&&s(Sa),e&&s(Ne),e&&s(Ua),w(Se,e),e&&s(La),e&&s(S),e&&s(Da),w(De,e),e&&s(Ha),e&&s(Z),e&&s(Oa),e&&s(bs),e&&s(Ra),w(He,e),e&&s(za),e&&s($s),e&&s(Ca),e&&s(_s),e&&s(Fa),e&&s(Es),e&&s(Ma),e&&s(z),w(Oe),e&&s(Ga),e&&s(Re),e&&s(Ba),w(ze,e),e&&s(Va),e&&s(Ps),e&&s(Wa),e&&s(C),w(Ce),e&&s(Ka),e&&s(ae),e&&s(Ya),w(Fe,e),e&&s(Qa),e&&s(U),e&&s(Ja),w(Ge,e),e&&s(Xa),e&&s(F),w(Be),e&&s(Za),e&&s(ne),e&&s(et),e&&s(Ts),e&&s(st),w(We,e),e&&s(at),e&&s(Ns),e&&s(tt),e&&s(le),e&&s(nt),e&&s(M),w(Ke),e&&s(lt),e&&s(L),e&&s(it),w(Ye,e),e&&s(rt),e&&s(pe),e&&s(pt),e&&s(D),e&&s(ot),e&&s(oe),e&&s(ht),e&&s(G),w(Je),e&&s(ct),e&&s(Us),e&&s(ft),w(Xe,e),e&&s(mt),e&&s(H),e&&s(ut),e&&s(ce),e&&s(dt),e&&s(fe),e&&s(gt),w(ss,e),e&&s(vt),e&&s(B),w(as),e&&s(yt),w(ue,e),e&&s(wt),e&&s(Ls),e&&s(jt),e&&s(V),w(ts),e&&s(xt),e&&s(ge),e&&s(bt),e&&s(Os),e&&s($t),e&&s(Rs),e&&s(_t),w(ns,e),e&&s(kt),e&&s(W),w(ls),e&&s(Et),e&&s(ye),e&&s(qt),w(is,e),e&&s(At),e&&s(K),w(rs),e&&s(Pt),e&&s(je),e&&s(Tt),e&&s(xe),e&&s(Nt),w(os,e),e&&s(It),w(be,e)}}}const cp={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"}],title:"Pipelines for inference"};function fp(Y){return lp(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class vp extends ep{constructor(m){super();sp(this,m,fp,hp,ap,{})}}export{vp as default,cp as metadata};
