import{s as pt,o as it,n as nt}from"../chunks/scheduler.9991993c.js";import{S as rt,i as mt,g as p,s as a,r as m,A as ct,h as i,f as l,c as n,j as at,u as c,x as r,k as ol,y as ht,a as t,v as h,d as o,t as M,w as u,m as ot,n as Mt}from"../chunks/index.7fc9a5e7.js";import{T as Ml}from"../chunks/Tip.9de92fc6.js";import{C as J}from"../chunks/CodeBlock.e11cba92.js";import{H as b,E as ut}from"../chunks/EditOnGithub.84ab7f0e.js";function ft($){let f,y='请查看<a href="/docs/transformers/main/zh/main_classes/pipelines#transformers.pipeline">pipeline()</a>文档以获取已支持的任务和可用参数的完整列表。';return{c(){f=p("p"),f.innerHTML=y},l(T){f=i(T,"P",{"data-svelte-h":!0}),r(f)!=="svelte-1vqov51"&&(f.innerHTML=y)},m(T,d){t(T,f,d)},p:nt,d(T){T&&l(f)}}}function jt($){let f;return{c(){f=ot("创建推理引擎是一个复杂的主题，值得有自己的页面。")},l(y){f=Mt(y,"创建推理引擎是一个复杂的主题，值得有自己的页面。")},m(y,T){t(y,f,T)},d(y){y&&l(f)}}}function Jt($){let f,y='要运行上面的示例，除了🤗 Transformers之外，您需要安装<a href="https://pypi.org/project/pytesseract/" rel="nofollow"><code>pytesseract</code></a>。',T,d,w;return d=new J({props:{code:"c3VkbyUyMGFwdCUyMGluc3RhbGwlMjAteSUyMHRlc3NlcmFjdC1vY3IlMEFwaXAlMjBpbnN0YWxsJTIwcHl0ZXNzZXJhY3Q=",highlighted:`sudo apt install -y tesseract-ocr
pip install pytesseract`,wrap:!1}}),{c(){f=p("p"),f.innerHTML=y,T=a(),m(d.$$.fragment)},l(j){f=i(j,"P",{"data-svelte-h":!0}),r(f)!=="svelte-9d8qcy"&&(f.innerHTML=y),T=n(j),c(d.$$.fragment,j)},m(j,g){t(j,f,g),t(j,T,g),h(d,j,g),w=!0},p:nt,i(j){w||(o(d.$$.fragment,j),w=!0)},o(j){M(d.$$.fragment,j),w=!1},d(j){j&&(l(f),l(T)),u(d,j)}}}function Tt($){let f,y,T,d,w,j,g,ul='<a href="/docs/transformers/main/zh/main_classes/pipelines#transformers.pipeline">pipeline()</a> 让使用<a href="https://huggingface.co/models" rel="nofollow">Hub</a>上的任何模型进行任何语言、计算机视觉、语音以及多模态任务的推理变得非常简单。即使您对特定的模态没有经验，或者不熟悉模型的源码，您仍然可以使用<a href="/docs/transformers/main/zh/main_classes/pipelines#transformers.pipeline">pipeline()</a>进行推理！本教程将教您：',Ss,v,fl='<li>如何使用<a href="/docs/transformers/main/zh/main_classes/pipelines#transformers.pipeline">pipeline()</a> 进行推理。</li> <li>如何使用特定的<code>tokenizer</code>(分词器)或模型。</li> <li>如何使用<a href="/docs/transformers/main/zh/main_classes/pipelines#transformers.pipeline">pipeline()</a> 进行音频、视觉和多模态任务的推理。</li>',Fs,U,Qs,B,Es,x,jl='虽然每个任务都有一个关联的<a href="/docs/transformers/main/zh/main_classes/pipelines#transformers.pipeline">pipeline()</a>，但使用通用的抽象的<a href="/docs/transformers/main/zh/main_classes/pipelines#transformers.pipeline">pipeline()</a>更加简单，其中包含所有特定任务的<code>pipelines</code>。<a href="/docs/transformers/main/zh/main_classes/pipelines#transformers.pipeline">pipeline()</a>会自动加载一个默认模型和一个能够进行任务推理的预处理类。让我们以使用<a href="/docs/transformers/main/zh/main_classes/pipelines#transformers.pipeline">pipeline()</a>进行自动语音识别（ASR）或语音转文本为例。',Ps,W,Jl='<li>首先，创建一个<a href="/docs/transformers/main/zh/main_classes/pipelines#transformers.pipeline">pipeline()</a>并指定推理任务：</li>',As,k,Ds,Z,Tl='<li>将您的输入传递给<a href="/docs/transformers/main/zh/main_classes/pipelines#transformers.pipeline">pipeline()</a>。对于语音识别，这通常是一个音频输入文件：</li>',Ks,X,Os,H,yl=`您没有得到您期望的结果？可以在Hub上查看一些<a href="https://huggingface.co/models?pipeline_tag=automatic-speech-recognition&amp;sort=trending" rel="nofollow">最受欢迎的自动语音识别模型</a>
，看看是否可以获得更好的转录。`,se,C,dl=`让我们尝试来自 OpenAI 的<a href="https://huggingface.co/openai/whisper-large" rel="nofollow">Whisper large-v2</a> 模型。Whisperb比Wav2Vec2晚2年发布，使用接近10倍的数据进行了训练。因此，它在大多数下游基准测试上击败了Wav2Vec2。
它还具有预测标点和大小写的附加优势，而Wav2Vec2则无法实现这些功能。`,ee,R,wl="让我们在这里尝试一下，看看它的表现如何：",le,_,te,V,bl=`现在这个结果看起来更准确了！要进行深入的Wav2Vec2与Whisper比较，请参阅<a href="https://huggingface.co/learn/audio-course/chapter5/asr_models" rel="nofollow">音频变换器课程</a>。
我们鼓励您在 Hub 上查看不同语言的模型，以及专业领域的模型等。您可以在Hub上直接查看并比较模型的结果，以确定是否适合或处理边缘情况是否比其他模型更好。如果您没有找到适用于您的用例的模型，您始终可以<a href="training">训练</a>自己的模型！`,ae,Y,gl="如果您有多个输入，您可以将输入作为列表传递：",ne,N,pe,z,$l="<code>Pipelines</code>非常适合用于测试，因为从一个模型切换到另一个模型非常琐碎；但是，还有一些方法可以将它们优化后用于大型工作负载而不仅仅是测试。请查看以下指南，深入探讨如何迭代整个数据集或在Web服务器中使用<code>Pipelines</code>：",ie,q,Ul='<li><a href="#using-pipelines-on-a-dataset">在数据集上使用流水线</a></li> <li><a href="./pipeline_webserver">在Web服务器中使用流水线</a></li>',re,L,me,S,Zl='<a href="/docs/transformers/main/zh/main_classes/pipelines#transformers.pipeline">pipeline()</a> 支持许多参数；有些是适用于特定任务的，而有些适用于所有<code>pipeline</code>。通常情况下，您可以在任何地方指定对应参数：',ce,F,he,Q,Il="让我们查看其中的三个重要参数：",oe,E,Me,P,Gl="如果您使用 <code>device=n</code>，<code>pipeline</code>会自动将模型放在指定的设备上。无论您使用PyTorch还是Tensorflow，这都可以工作。",ue,A,fe,D,vl='如果模型对于单个GPU来说过于庞大，并且您正在使用PyTorch，您可以设置 <code>device_map=&quot;auto&quot;</code> 以自动确定如何加载和存储模型权重。使用 <code>device_map</code> 参数需要安装🤗 <a href="https://huggingface.co/docs/accelerate" rel="nofollow">Accelerate</a> 软件包：',je,K,Je,O,Bl="以下代码会自动在各个设备上加载和存储模型权重：",Te,ss,ye,es,xl="请注意，如果传递了 <code>device_map=&quot;auto&quot;</code>，在实例化您的 <code>pipeline</code> 时不需要添加 <code>device=device</code> 参数，否则可能会遇到一些意外的状况！",de,ls,we,ts,Wl='默认情况下，<code>pipelines</code>不会进行批量推理，原因在<a href="https://huggingface.co/docs/transformers/main_classes/pipelines#pipeline-batching" rel="nofollow">这里</a>详细解释。因为批处理不一定更快，实际上在某些情况下可能会更慢。',be,as,kl="但如果在您的用例中起作用，您可以使用：",ge,ns,$e,ps,Xl="以上代码会在提供的4个音频文件上运行<code>pipeline</code>，它会将它们以2个一组的批次传递给模型（模型在GPU上，此时批处理更有可能有所帮助），而您无需编写额外的代码。输出应始终与没有批处理时收到的结果相一致。它只是一种帮助您更快地使用<code>pipeline</code>的方式。",Ue,is,Hl='<code>pipeline</code>也可以减轻一些批处理的复杂性，因为对于某些<code>pipeline</code>，需要将单个项目（如长音频文件）分成多个部分以供模型处理。<code>pipeline</code>为您执行这种<a href="./main_classes/pipelines#pipeline-chunk-batching"><em>chunk batching</em></a>。',Ze,rs,Ie,ms,Cl=`所有任务都提供了特定于任务的参数，这些参数提供额外的灵活性和选择，以帮助您完成工作。
例如，<a href="/docs/transformers/main/zh/main_classes/pipelines#transformers.AutomaticSpeechRecognitionPipeline.__call__">transformers.AutomaticSpeechRecognitionPipeline.<strong>call</strong>()</a> 方法具有一个 <code>return_timestamps</code> 参数，对于字幕视频似乎很有帮助：`,Ge,cs,ve,hs,Rl="正如您所看到的，模型推断出了文本，还输出了各个句子发音的<strong>时间</strong>。",Be,os,_l='每个任务都有许多可用的参数，因此请查看每个任务的API参考，以了解您可以进行哪些调整！例如，<a href="/docs/transformers/main/zh/main_classes/pipelines#transformers.AutomaticSpeechRecognitionPipeline">AutomaticSpeechRecognitionPipeline</a> 具有 <code>chunk_length_s</code> 参数，对于处理非常长的音频文件（例如，为整部电影或长达一小时的视频配字幕）非常有帮助，这通常是模型无法单独处理的：',xe,Ms,We,us,Vl='如果您找不到一个真正有帮助的参数，欢迎<a href="https://github.com/huggingface/transformers/issues/new?assignees=&amp;labels=feature&amp;template=feature-request.yml" rel="nofollow">提出请求</a>！',ke,fs,Xe,js,Yl="<code>pipelines</code>也可以对大型数据集进行推理。我们建议使用迭代器来完成这一任务，这是最简单的方法：",He,Js,Ce,Ts,Nl='迭代器 <code>data()</code> 会产生每个结果，<code>pipelines</code>会自动识别输入为可迭代对象，并在GPU上处理数据的同时开始获取数据（在底层使用<a href="https://pytorch.org/docs/stable/data.html#torch.utils.data.DataLoader" rel="nofollow">DataLoader</a>）。这一点非常重要，因为您不必为整个数据集分配内存，可以尽可能快地将数据传送到GPU。',Re,ys,zl="由于批处理可以加速处理，因此在这里尝试调整 <code>batch_size</code> 参数可能会很有用。",_e,ds,ql='迭代数据集的最简单方法就是从🤗 <a href="https://github.com/huggingface/datasets/" rel="nofollow">Datasets</a> 中加载数据集：',Ve,ws,Ye,bs,Ne,I,ze,gs,Ll='<a href="./pipeline_webserver">链接</a>',qe,$s,Le,Us,Sl='对于视觉任务，使用<a href="/docs/transformers/main/zh/main_classes/pipelines#transformers.pipeline">pipeline()</a> 几乎是相同的。',Se,Zs,Fl="指定您的任务并将图像传递给分类器。图像可以是链接、本地路径或base64编码的图像。例如，下面显示的是哪种品种的猫？",Fe,Is,Ql='<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/pipeline-cat-chonk.jpeg" alt="pipeline-cat-chonk"/>',Qe,Gs,Ee,vs,Pe,Bs,El='对于NLP任务，使用<a href="/docs/transformers/main/zh/main_classes/pipelines#transformers.pipeline">pipeline()</a> 几乎是相同的。',Ae,xs,De,Ws,Ke,ks,Pl='<a href="/docs/transformers/main/zh/main_classes/pipelines#transformers.pipeline">pipeline()</a> 支持多个模态。例如，视觉问题回答（VQA）任务结合了文本和图像。请随意使用您喜欢的任何图像链接和您想要问关于该图像的问题。图像可以是URL或图像的本地路径。',Oe,Xs,Al='例如，如果您使用这个<a href="https://huggingface.co/spaces/impira/docquery/resolve/2359223c1837a7587402bda0f2643382a6eefeab/invoice.png" rel="nofollow">invoice image</a>：',sl,Hs,el,G,ll,Cs,tl,Rs,Dl="您可以轻松地使用🤗 <code>accelerate</code>在大模型上运行 <code>pipeline</code>！首先确保您已经使用 <code>pip install accelerate</code> 安装了 <code>accelerate</code>。",al,_s,Kl="首先使用 <code>device_map=&quot;auto&quot;</code> 加载您的模型！我们将在示例中使用 <code>facebook/opt-1.3b</code>。",nl,Vs,pl,Ys,Ol="如果安装 <code>bitsandbytes</code> 并添加参数 <code>load_in_8bit=True</code>，您还可以传递8位加载的模型。",il,Ns,rl,zs,st="请注意，您可以将<code>checkpoint </code>替换为任何支持大模型加载的Hugging Face模型，比如BLOOM！",ml,qs,cl,Ls,hl;return w=new b({props:{title:"推理pipeline",local:"推理pipeline",headingTag:"h1"}}),U=new Ml({props:{$$slots:{default:[ft]},$$scope:{ctx:$}}}),B=new b({props:{title:"Pipeline使用",local:"pipeline使用",headingTag:"h2"}}),k=new J({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBdHJhbnNjcmliZXIlMjAlM0QlMjBwaXBlbGluZSh0YXNrJTNEJTIyYXV0b21hdGljLXNwZWVjaC1yZWNvZ25pdGlvbiUyMik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

<span class="hljs-meta">&gt;&gt;&gt; </span>transcriber = pipeline(task=<span class="hljs-string">&quot;automatic-speech-recognition&quot;</span>)`,wrap:!1}}),X=new J({props:{code:"dHJhbnNjcmliZXIoJTIyaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRmRhdGFzZXRzJTJGTmFyc2lsJTJGYXNyX2R1bW15JTJGcmVzb2x2ZSUyRm1haW4lMkZtbGsuZmxhYyUyMik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>transcriber(<span class="hljs-string">&quot;https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac&quot;</span>)
{<span class="hljs-string">&#x27;text&#x27;</span>: <span class="hljs-string">&#x27;I HAVE A DREAM BUT ONE DAY THIS NATION WILL RISE UP LIVE UP THE TRUE MEANING OF ITS TREES&#x27;</span>}`,wrap:!1}}),_=new J({props:{code:"dHJhbnNjcmliZXIlMjAlM0QlMjBwaXBlbGluZShtb2RlbCUzRCUyMm9wZW5haSUyRndoaXNwZXItbGFyZ2UtdjIlMjIpJTBBdHJhbnNjcmliZXIoJTIyaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRmRhdGFzZXRzJTJGTmFyc2lsJTJGYXNyX2R1bW15JTJGcmVzb2x2ZSUyRm1haW4lMkZtbGsuZmxhYyUyMik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>transcriber = pipeline(model=<span class="hljs-string">&quot;openai/whisper-large-v2&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>transcriber(<span class="hljs-string">&quot;https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac&quot;</span>)
{<span class="hljs-string">&#x27;text&#x27;</span>: <span class="hljs-string">&#x27; I have a dream that one day this nation will rise up and live out the true meaning of its creed.&#x27;</span>}`,wrap:!1}}),N=new J({props:{code:"dHJhbnNjcmliZXIoJTBBJTIwJTIwJTIwJTIwJTVCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIyaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRmRhdGFzZXRzJTJGTmFyc2lsJTJGYXNyX2R1bW15JTJGcmVzb2x2ZSUyRm1haW4lMkZtbGsuZmxhYyUyMiUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMmh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZkYXRhc2V0cyUyRk5hcnNpbCUyRmFzcl9kdW1teSUyRnJlc29sdmUlMkZtYWluJTJGMS5mbGFjJTIyJTJDJTBBJTIwJTIwJTIwJTIwJTVEJTBBKQ==",highlighted:`transcriber(
    [
        <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>,
    ]
)`,wrap:!1}}),L=new b({props:{title:"参数",local:"参数",headingTag:"h2"}}),F=new J({props:{code:"dHJhbnNjcmliZXIlMjAlM0QlMjBwaXBlbGluZShtb2RlbCUzRCUyMm9wZW5haSUyRndoaXNwZXItbGFyZ2UtdjIlMjIlMkMlMjBteV9wYXJhbWV0ZXIlM0QxKSUwQSUwQW91dCUyMCUzRCUyMHRyYW5zY3JpYmVyKC4uLiklMjAlMjAlMjMlMjBUaGlzJTIwd2lsbCUyMHVzZSUyMCU2MG15X3BhcmFtZXRlciUzRDElNjAuJTBBb3V0JTIwJTNEJTIwdHJhbnNjcmliZXIoLi4uJTJDJTIwbXlfcGFyYW1ldGVyJTNEMiklMjAlMjAlMjMlMjBUaGlzJTIwd2lsbCUyMG92ZXJyaWRlJTIwYW5kJTIwdXNlJTIwJTYwbXlfcGFyYW1ldGVyJTNEMiU2MC4lMEFvdXQlMjAlM0QlMjB0cmFuc2NyaWJlciguLi4pJTIwJTIwJTIzJTIwVGhpcyUyMHdpbGwlMjBnbyUyMGJhY2slMjB0byUyMHVzaW5nJTIwJTYwbXlfcGFyYW1ldGVyJTNEMSU2MC4=",highlighted:'transcriber = pipeline(model=<span class="hljs-string">&quot;openai/whisper-large-v2&quot;</span>, my_parameter=<span class="hljs-number">1</span>)\n\nout = transcriber(...)  <span class="hljs-comment"># This will use `my_parameter=1`.</span>\nout = transcriber(..., my_parameter=<span class="hljs-number">2</span>)  <span class="hljs-comment"># This will override and use `my_parameter=2`.</span>\nout = transcriber(...)  <span class="hljs-comment"># This will go back to using `my_parameter=1`.</span>',wrap:!1}}),E=new b({props:{title:"设备",local:"设备",headingTag:"h3"}}),A=new J({props:{code:"dHJhbnNjcmliZXIlMjAlM0QlMjBwaXBlbGluZShtb2RlbCUzRCUyMm9wZW5haSUyRndoaXNwZXItbGFyZ2UtdjIlMjIlMkMlMjBkZXZpY2UlM0QwKQ==",highlighted:'transcriber = pipeline(model=<span class="hljs-string">&quot;openai/whisper-large-v2&quot;</span>, device=<span class="hljs-number">0</span>)',wrap:!1}}),K=new J({props:{code:"cGlwJTIwaW5zdGFsbCUyMC0tdXBncmFkZSUyMGFjY2VsZXJhdGU=",highlighted:"pip install --upgrade accelerate",wrap:!1}}),ss=new J({props:{code:"dHJhbnNjcmliZXIlMjAlM0QlMjBwaXBlbGluZShtb2RlbCUzRCUyMm9wZW5haSUyRndoaXNwZXItbGFyZ2UtdjIlMjIlMkMlMjBkZXZpY2VfbWFwJTNEJTIyYXV0byUyMik=",highlighted:'transcriber = pipeline(model=<span class="hljs-string">&quot;openai/whisper-large-v2&quot;</span>, device_map=<span class="hljs-string">&quot;auto&quot;</span>)',wrap:!1}}),ls=new b({props:{title:"批量大小",local:"批量大小",headingTag:"h3"}}),ns=new J({props:{code:"dHJhbnNjcmliZXIlMjAlM0QlMjBwaXBlbGluZShtb2RlbCUzRCUyMm9wZW5haSUyRndoaXNwZXItbGFyZ2UtdjIlMjIlMkMlMjBkZXZpY2UlM0QwJTJDJTIwYmF0Y2hfc2l6ZSUzRDIpJTBBYXVkaW9fZmlsZW5hbWVzJTIwJTNEJTIwJTVCZiUyMmh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZkYXRhc2V0cyUyRk5hcnNpbCUyRmFzcl9kdW1teSUyRnJlc29sdmUlMkZtYWluJTJGJTdCaSU3RC5mbGFjJTIyJTIwZm9yJTIwaSUyMGluJTIwcmFuZ2UoMSUyQyUyMDUpJTVEJTBBdGV4dHMlMjAlM0QlMjB0cmFuc2NyaWJlcihhdWRpb19maWxlbmFtZXMp",highlighted:`transcriber = pipeline(model=<span class="hljs-string">&quot;openai/whisper-large-v2&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;https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/<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">1</span>, <span class="hljs-number">5</span>)]
texts = transcriber(audio_filenames)`,wrap:!1}}),rs=new b({props:{title:"任务特定参数",local:"任务特定参数",headingTag:"h3"}}),cs=new J({props:{code:"dHJhbnNjcmliZXIlMjAlM0QlMjBwaXBlbGluZShtb2RlbCUzRCUyMm9wZW5haSUyRndoaXNwZXItbGFyZ2UtdjIlMjIlMkMlMjByZXR1cm5fdGltZXN0YW1wcyUzRFRydWUpJTBBdHJhbnNjcmliZXIoJTIyaHR0cHMlM0ElMkYlMkZodWdnaW5nZmFjZS5jbyUyRmRhdGFzZXRzJTJGTmFyc2lsJTJGYXNyX2R1bW15JTJGcmVzb2x2ZSUyRm1haW4lMkZtbGsuZmxhYyUyMik=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>transcriber = pipeline(model=<span class="hljs-string">&quot;openai/whisper-large-v2&quot;</span>, return_timestamps=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>transcriber(<span class="hljs-string">&quot;https://huggingface.co/datasets/Narsil/asr_dummy/resolve/main/mlk.flac&quot;</span>)
{<span class="hljs-string">&#x27;text&#x27;</span>: <span class="hljs-string">&#x27; I have a dream that one day this nation will rise up and live out the true meaning of its creed.&#x27;</span>, <span class="hljs-string">&#x27;chunks&#x27;</span>: [{<span class="hljs-string">&#x27;timestamp&#x27;</span>: (<span class="hljs-number">0.0</span>, <span class="hljs-number">11.88</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&#x27;</span>}, {<span class="hljs-string">&#x27;timestamp&#x27;</span>: (<span class="hljs-number">11.88</span>, <span class="hljs-number">12.38</span>), <span class="hljs-string">&#x27;text&#x27;</span>: <span class="hljs-string">&#x27; creed.&#x27;</span>}]}`,wrap:!1}}),Ms=new J({props:{code:"dHJhbnNjcmliZXIlMjAlM0QlMjBwaXBlbGluZShtb2RlbCUzRCUyMm9wZW5haSUyRndoaXNwZXItbGFyZ2UtdjIlMjIlMkMlMjBjaHVua19sZW5ndGhfcyUzRDMwJTJDJTIwcmV0dXJuX3RpbWVzdGFtcHMlM0RUcnVlKSUwQXRyYW5zY3JpYmVyKCUyMmh0dHBzJTNBJTJGJTJGaHVnZ2luZ2ZhY2UuY28lMkZkYXRhc2V0cyUyRnNhbmNoaXQtZ2FuZGhpJTJGbGlicmlzcGVlY2hfbG9uZyUyRnJlc29sdmUlMkZtYWluJTJGYXVkaW8ud2F2JTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>transcriber = pipeline(model=<span class="hljs-string">&quot;openai/whisper-large-v2&quot;</span>, chunk_length_s=<span class="hljs-number">30</span>, return_timestamps=<span class="hljs-literal">True</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>transcriber(<span class="hljs-string">&quot;https://huggingface.co/datasets/sanchit-gandhi/librispeech_long/resolve/main/audio.wav&quot;</span>)
{<span class="hljs-string">&#x27;text&#x27;</span>: <span class="hljs-string">&quot; Chapter 16. I might have told you of the beginning of this liaison in a few lines, but I wanted you to see every step by which we came.  I, too, agree to whatever Marguerite wished, Marguerite to be unable to live apart from me. It was the day after the evening...</span>`,wrap:!1}}),fs=new b({props:{title:"在数据集上使用pipelines",local:"在数据集上使用pipelines",headingTag:"h2"}}),Js=new J({props:{code:"ZGVmJTIwZGF0YSgpJTNBJTBBJTIwJTIwJTIwJTIwZm9yJTIwaSUyMGluJTIwcmFuZ2UoMTAwMCklM0ElMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjB5aWVsZCUyMGYlMjJNeSUyMGV4YW1wbGUlMjAlN0JpJTdEJTIyJTBBJTBBJTBBcGlwZSUyMCUzRCUyMHBpcGVsaW5lKG1vZGVsJTNEJTIyb3BlbmFpLWNvbW11bml0eSUyRmdwdDIlMjIlMkMlMjBkZXZpY2UlM0QwKSUwQWdlbmVyYXRlZF9jaGFyYWN0ZXJzJTIwJTNEJTIwMCUwQWZvciUyMG91dCUyMGluJTIwcGlwZShkYXRhKCkpJTNBJTBBJTIwJTIwJTIwJTIwZ2VuZXJhdGVkX2NoYXJhY3RlcnMlMjAlMkIlM0QlMjBsZW4ob3V0JTVCMCU1RCU1QiUyMmdlbmVyYXRlZF90ZXh0JTIyJTVEKQ==",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;openai-community/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>])`,wrap:!1}}),ws=new J({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)`,wrap:!1}}),bs=new b({props:{title:"在Web服务器上使用pipelines",local:"在web服务器上使用pipelines",headingTag:"h2"}}),I=new Ml({props:{$$slots:{default:[jt]},$$scope:{ctx:$}}}),$s=new b({props:{title:"视觉流水线",local:"视觉流水线",headingTag:"h2"}}),Gs=new J({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>}]`,wrap:!1}}),vs=new b({props:{title:"文本流水线",local:"文本流水线",headingTag:"h2"}}),xs=new J({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>]}`,wrap:!1}}),Ws=new b({props:{title:"多模态流水线",local:"多模态流水线",headingTag:"h2"}}),Hs=new J({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBdnFhJTIwJTNEJTIwcGlwZWxpbmUobW9kZWwlM0QlMjJpbXBpcmElMkZsYXlvdXRsbS1kb2N1bWVudC1xYSUyMiklMEFvdXRwdXQlMjAlM0QlMjB2cWEoJTBBJTIwJTIwJTIwJTIwaW1hZ2UlM0QlMjJodHRwcyUzQSUyRiUyRmh1Z2dpbmdmYWNlLmNvJTJGc3BhY2VzJTJGaW1waXJhJTJGZG9jcXVlcnklMkZyZXNvbHZlJTJGMjM1OTIyM2MxODM3YTc1ODc0MDJiZGEwZjI2NDMzODJhNmVlZmVhYiUyRmludm9pY2UucG5nJTIyJTJDJTBBJTIwJTIwJTIwJTIwcXVlc3Rpb24lM0QlMjJXaGF0JTIwaXMlMjB0aGUlMjBpbnZvaWNlJTIwbnVtYmVyJTNGJTIyJTJDJTBBKSUwQW91dHB1dCU1QjAlNUQlNUIlMjJzY29yZSUyMiU1RCUyMCUzRCUyMHJvdW5kKG91dHB1dCU1QjAlNUQlNUIlMjJzY29yZSUyMiU1RCUyQyUyMDMpJTBBb3V0cHV0",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>output = 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-meta">&gt;&gt;&gt; </span>output[<span class="hljs-number">0</span>][<span class="hljs-string">&quot;score&quot;</span>] = <span class="hljs-built_in">round</span>(output[<span class="hljs-number">0</span>][<span class="hljs-string">&quot;score&quot;</span>], <span class="hljs-number">3</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>output
[{<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.425</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>}]`,wrap:!1}}),G=new Ml({props:{$$slots:{default:[Jt]},$$scope:{ctx:$}}}),Cs=new b({props:{title:"在大模型上使用🤗 accelerate 和 pipeline ：",local:"在大模型上使用-accelerate-和-pipeline-",headingTag:"h2"}}),Vs=new J({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>)`,wrap:!1}}),Ns=new J({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>)`,wrap:!1}}),qs=new ut({props:{source:"https://github.com/huggingface/transformers/blob/main/docs/source/zh/pipeline_tutorial.md"}}),{c(){f=p("meta"),y=a(),T=p("p"),d=a(),m(w.$$.fragment),j=a(),g=p("p"),g.innerHTML=ul,Ss=a(),v=p("ul"),v.innerHTML=fl,Fs=a(),m(U.$$.fragment),Qs=a(),m(B.$$.fragment),Es=a(),x=p("p"),x.innerHTML=jl,Ps=a(),W=p("ol"),W.innerHTML=Jl,As=a(),m(k.$$.fragment),Ds=a(),Z=p("ol"),Z.innerHTML=Tl,Ks=a(),m(X.$$.fragment),Os=a(),H=p("p"),H.innerHTML=yl,se=a(),C=p("p"),C.innerHTML=dl,ee=a(),R=p("p"),R.textContent=wl,le=a(),m(_.$$.fragment),te=a(),V=p("p"),V.innerHTML=bl,ae=a(),Y=p("p"),Y.textContent=gl,ne=a(),m(N.$$.fragment),pe=a(),z=p("p"),z.innerHTML=$l,ie=a(),q=p("ul"),q.innerHTML=Ul,re=a(),m(L.$$.fragment),me=a(),S=p("p"),S.innerHTML=Zl,ce=a(),m(F.$$.fragment),he=a(),Q=p("p"),Q.textContent=Il,oe=a(),m(E.$$.fragment),Me=a(),P=p("p"),P.innerHTML=Gl,ue=a(),m(A.$$.fragment),fe=a(),D=p("p"),D.innerHTML=vl,je=a(),m(K.$$.fragment),Je=a(),O=p("p"),O.textContent=Bl,Te=a(),m(ss.$$.fragment),ye=a(),es=p("p"),es.innerHTML=xl,de=a(),m(ls.$$.fragment),we=a(),ts=p("p"),ts.innerHTML=Wl,be=a(),as=p("p"),as.textContent=kl,ge=a(),m(ns.$$.fragment),$e=a(),ps=p("p"),ps.innerHTML=Xl,Ue=a(),is=p("p"),is.innerHTML=Hl,Ze=a(),m(rs.$$.fragment),Ie=a(),ms=p("p"),ms.innerHTML=Cl,Ge=a(),m(cs.$$.fragment),ve=a(),hs=p("p"),hs.innerHTML=Rl,Be=a(),os=p("p"),os.innerHTML=_l,xe=a(),m(Ms.$$.fragment),We=a(),us=p("p"),us.innerHTML=Vl,ke=a(),m(fs.$$.fragment),Xe=a(),js=p("p"),js.innerHTML=Yl,He=a(),m(Js.$$.fragment),Ce=a(),Ts=p("p"),Ts.innerHTML=Nl,Re=a(),ys=p("p"),ys.innerHTML=zl,_e=a(),ds=p("p"),ds.innerHTML=ql,Ve=a(),m(ws.$$.fragment),Ye=a(),m(bs.$$.fragment),Ne=a(),m(I.$$.fragment),ze=a(),gs=p("p"),gs.innerHTML=Ll,qe=a(),m($s.$$.fragment),Le=a(),Us=p("p"),Us.innerHTML=Sl,Se=a(),Zs=p("p"),Zs.textContent=Fl,Fe=a(),Is=p("p"),Is.innerHTML=Ql,Qe=a(),m(Gs.$$.fragment),Ee=a(),m(vs.$$.fragment),Pe=a(),Bs=p("p"),Bs.innerHTML=El,Ae=a(),m(xs.$$.fragment),De=a(),m(Ws.$$.fragment),Ke=a(),ks=p("p"),ks.innerHTML=Pl,Oe=a(),Xs=p("p"),Xs.innerHTML=Al,sl=a(),m(Hs.$$.fragment),el=a(),m(G.$$.fragment),ll=a(),m(Cs.$$.fragment),tl=a(),Rs=p("p"),Rs.innerHTML=Dl,al=a(),_s=p("p"),_s.innerHTML=Kl,nl=a(),m(Vs.$$.fragment),pl=a(),Ys=p("p"),Ys.innerHTML=Ol,il=a(),m(Ns.$$.fragment),rl=a(),zs=p("p"),zs.innerHTML=st,ml=a(),m(qs.$$.fragment),cl=a(),Ls=p("p"),this.h()},l(s){const e=ct("svelte-u9bgzb",document.head);f=i(e,"META",{name:!0,content:!0}),e.forEach(l),y=n(s),T=i(s,"P",{}),at(T).forEach(l),d=n(s),c(w.$$.fragment,s),j=n(s),g=i(s,"P",{"data-svelte-h":!0}),r(g)!=="svelte-lw96tf"&&(g.innerHTML=ul),Ss=n(s),v=i(s,"UL",{"data-svelte-h":!0}),r(v)!=="svelte-35en5s"&&(v.innerHTML=fl),Fs=n(s),c(U.$$.fragment,s),Qs=n(s),c(B.$$.fragment,s),Es=n(s),x=i(s,"P",{"data-svelte-h":!0}),r(x)!=="svelte-16ajsqq"&&(x.innerHTML=jl),Ps=n(s),W=i(s,"OL",{"data-svelte-h":!0}),r(W)!=="svelte-10c2mjp"&&(W.innerHTML=Jl),As=n(s),c(k.$$.fragment,s),Ds=n(s),Z=i(s,"OL",{start:!0,"data-svelte-h":!0}),r(Z)!=="svelte-18ct6g6"&&(Z.innerHTML=Tl),Ks=n(s),c(X.$$.fragment,s),Os=n(s),H=i(s,"P",{"data-svelte-h":!0}),r(H)!=="svelte-wuyqla"&&(H.innerHTML=yl),se=n(s),C=i(s,"P",{"data-svelte-h":!0}),r(C)!=="svelte-1og2a64"&&(C.innerHTML=dl),ee=n(s),R=i(s,"P",{"data-svelte-h":!0}),r(R)!=="svelte-y6rqea"&&(R.textContent=wl),le=n(s),c(_.$$.fragment,s),te=n(s),V=i(s,"P",{"data-svelte-h":!0}),r(V)!=="svelte-7v8a2b"&&(V.innerHTML=bl),ae=n(s),Y=i(s,"P",{"data-svelte-h":!0}),r(Y)!=="svelte-1hufjes"&&(Y.textContent=gl),ne=n(s),c(N.$$.fragment,s),pe=n(s),z=i(s,"P",{"data-svelte-h":!0}),r(z)!=="svelte-cjxg4p"&&(z.innerHTML=$l),ie=n(s),q=i(s,"UL",{"data-svelte-h":!0}),r(q)!=="svelte-r6yb7c"&&(q.innerHTML=Ul),re=n(s),c(L.$$.fragment,s),me=n(s),S=i(s,"P",{"data-svelte-h":!0}),r(S)!=="svelte-1089hst"&&(S.innerHTML=Zl),ce=n(s),c(F.$$.fragment,s),he=n(s),Q=i(s,"P",{"data-svelte-h":!0}),r(Q)!=="svelte-u8ryko"&&(Q.textContent=Il),oe=n(s),c(E.$$.fragment,s),Me=n(s),P=i(s,"P",{"data-svelte-h":!0}),r(P)!=="svelte-idsrr1"&&(P.innerHTML=Gl),ue=n(s),c(A.$$.fragment,s),fe=n(s),D=i(s,"P",{"data-svelte-h":!0}),r(D)!=="svelte-1658hsh"&&(D.innerHTML=vl),je=n(s),c(K.$$.fragment,s),Je=n(s),O=i(s,"P",{"data-svelte-h":!0}),r(O)!=="svelte-ftwjlg"&&(O.textContent=Bl),Te=n(s),c(ss.$$.fragment,s),ye=n(s),es=i(s,"P",{"data-svelte-h":!0}),r(es)!=="svelte-15xcnf9"&&(es.innerHTML=xl),de=n(s),c(ls.$$.fragment,s),we=n(s),ts=i(s,"P",{"data-svelte-h":!0}),r(ts)!=="svelte-lwvdk2"&&(ts.innerHTML=Wl),be=n(s),as=i(s,"P",{"data-svelte-h":!0}),r(as)!=="svelte-1ht982g"&&(as.textContent=kl),ge=n(s),c(ns.$$.fragment,s),$e=n(s),ps=i(s,"P",{"data-svelte-h":!0}),r(ps)!=="svelte-occjw6"&&(ps.innerHTML=Xl),Ue=n(s),is=i(s,"P",{"data-svelte-h":!0}),r(is)!=="svelte-1aawhlf"&&(is.innerHTML=Hl),Ze=n(s),c(rs.$$.fragment,s),Ie=n(s),ms=i(s,"P",{"data-svelte-h":!0}),r(ms)!=="svelte-1019x35"&&(ms.innerHTML=Cl),Ge=n(s),c(cs.$$.fragment,s),ve=n(s),hs=i(s,"P",{"data-svelte-h":!0}),r(hs)!=="svelte-118drgt"&&(hs.innerHTML=Rl),Be=n(s),os=i(s,"P",{"data-svelte-h":!0}),r(os)!=="svelte-os8z2d"&&(os.innerHTML=_l),xe=n(s),c(Ms.$$.fragment,s),We=n(s),us=i(s,"P",{"data-svelte-h":!0}),r(us)!=="svelte-o57d00"&&(us.innerHTML=Vl),ke=n(s),c(fs.$$.fragment,s),Xe=n(s),js=i(s,"P",{"data-svelte-h":!0}),r(js)!=="svelte-3vy3oi"&&(js.innerHTML=Yl),He=n(s),c(Js.$$.fragment,s),Ce=n(s),Ts=i(s,"P",{"data-svelte-h":!0}),r(Ts)!=="svelte-ug61kl"&&(Ts.innerHTML=Nl),Re=n(s),ys=i(s,"P",{"data-svelte-h":!0}),r(ys)!=="svelte-ty0yyf"&&(ys.innerHTML=zl),_e=n(s),ds=i(s,"P",{"data-svelte-h":!0}),r(ds)!=="svelte-1hgrt8v"&&(ds.innerHTML=ql),Ve=n(s),c(ws.$$.fragment,s),Ye=n(s),c(bs.$$.fragment,s),Ne=n(s),c(I.$$.fragment,s),ze=n(s),gs=i(s,"P",{"data-svelte-h":!0}),r(gs)!=="svelte-1lz0h23"&&(gs.innerHTML=Ll),qe=n(s),c($s.$$.fragment,s),Le=n(s),Us=i(s,"P",{"data-svelte-h":!0}),r(Us)!=="svelte-fa647q"&&(Us.innerHTML=Sl),Se=n(s),Zs=i(s,"P",{"data-svelte-h":!0}),r(Zs)!=="svelte-h0nzrm"&&(Zs.textContent=Fl),Fe=n(s),Is=i(s,"P",{"data-svelte-h":!0}),r(Is)!=="svelte-1bks2jw"&&(Is.innerHTML=Ql),Qe=n(s),c(Gs.$$.fragment,s),Ee=n(s),c(vs.$$.fragment,s),Pe=n(s),Bs=i(s,"P",{"data-svelte-h":!0}),r(Bs)!=="svelte-bitqm7"&&(Bs.innerHTML=El),Ae=n(s),c(xs.$$.fragment,s),De=n(s),c(Ws.$$.fragment,s),Ke=n(s),ks=i(s,"P",{"data-svelte-h":!0}),r(ks)!=="svelte-5a4mre"&&(ks.innerHTML=Pl),Oe=n(s),Xs=i(s,"P",{"data-svelte-h":!0}),r(Xs)!=="svelte-13a1pna"&&(Xs.innerHTML=Al),sl=n(s),c(Hs.$$.fragment,s),el=n(s),c(G.$$.fragment,s),ll=n(s),c(Cs.$$.fragment,s),tl=n(s),Rs=i(s,"P",{"data-svelte-h":!0}),r(Rs)!=="svelte-2liy51"&&(Rs.innerHTML=Dl),al=n(s),_s=i(s,"P",{"data-svelte-h":!0}),r(_s)!=="svelte-15lp4hn"&&(_s.innerHTML=Kl),nl=n(s),c(Vs.$$.fragment,s),pl=n(s),Ys=i(s,"P",{"data-svelte-h":!0}),r(Ys)!=="svelte-5lgja0"&&(Ys.innerHTML=Ol),il=n(s),c(Ns.$$.fragment,s),rl=n(s),zs=i(s,"P",{"data-svelte-h":!0}),r(zs)!=="svelte-y7nde"&&(zs.innerHTML=st),ml=n(s),c(qs.$$.fragment,s),cl=n(s),Ls=i(s,"P",{}),at(Ls).forEach(l),this.h()},h(){ol(f,"name","hf:doc:metadata"),ol(f,"content",yt),ol(Z,"start","2")},m(s,e){ht(document.head,f),t(s,y,e),t(s,T,e),t(s,d,e),h(w,s,e),t(s,j,e),t(s,g,e),t(s,Ss,e),t(s,v,e),t(s,Fs,e),h(U,s,e),t(s,Qs,e),h(B,s,e),t(s,Es,e),t(s,x,e),t(s,Ps,e),t(s,W,e),t(s,As,e),h(k,s,e),t(s,Ds,e),t(s,Z,e),t(s,Ks,e),h(X,s,e),t(s,Os,e),t(s,H,e),t(s,se,e),t(s,C,e),t(s,ee,e),t(s,R,e),t(s,le,e),h(_,s,e),t(s,te,e),t(s,V,e),t(s,ae,e),t(s,Y,e),t(s,ne,e),h(N,s,e),t(s,pe,e),t(s,z,e),t(s,ie,e),t(s,q,e),t(s,re,e),h(L,s,e),t(s,me,e),t(s,S,e),t(s,ce,e),h(F,s,e),t(s,he,e),t(s,Q,e),t(s,oe,e),h(E,s,e),t(s,Me,e),t(s,P,e),t(s,ue,e),h(A,s,e),t(s,fe,e),t(s,D,e),t(s,je,e),h(K,s,e),t(s,Je,e),t(s,O,e),t(s,Te,e),h(ss,s,e),t(s,ye,e),t(s,es,e),t(s,de,e),h(ls,s,e),t(s,we,e),t(s,ts,e),t(s,be,e),t(s,as,e),t(s,ge,e),h(ns,s,e),t(s,$e,e),t(s,ps,e),t(s,Ue,e),t(s,is,e),t(s,Ze,e),h(rs,s,e),t(s,Ie,e),t(s,ms,e),t(s,Ge,e),h(cs,s,e),t(s,ve,e),t(s,hs,e),t(s,Be,e),t(s,os,e),t(s,xe,e),h(Ms,s,e),t(s,We,e),t(s,us,e),t(s,ke,e),h(fs,s,e),t(s,Xe,e),t(s,js,e),t(s,He,e),h(Js,s,e),t(s,Ce,e),t(s,Ts,e),t(s,Re,e),t(s,ys,e),t(s,_e,e),t(s,ds,e),t(s,Ve,e),h(ws,s,e),t(s,Ye,e),h(bs,s,e),t(s,Ne,e),h(I,s,e),t(s,ze,e),t(s,gs,e),t(s,qe,e),h($s,s,e),t(s,Le,e),t(s,Us,e),t(s,Se,e),t(s,Zs,e),t(s,Fe,e),t(s,Is,e),t(s,Qe,e),h(Gs,s,e),t(s,Ee,e),h(vs,s,e),t(s,Pe,e),t(s,Bs,e),t(s,Ae,e),h(xs,s,e),t(s,De,e),h(Ws,s,e),t(s,Ke,e),t(s,ks,e),t(s,Oe,e),t(s,Xs,e),t(s,sl,e),h(Hs,s,e),t(s,el,e),h(G,s,e),t(s,ll,e),h(Cs,s,e),t(s,tl,e),t(s,Rs,e),t(s,al,e),t(s,_s,e),t(s,nl,e),h(Vs,s,e),t(s,pl,e),t(s,Ys,e),t(s,il,e),h(Ns,s,e),t(s,rl,e),t(s,zs,e),t(s,ml,e),h(qs,s,e),t(s,cl,e),t(s,Ls,e),hl=!0},p(s,[e]){const et={};e&2&&(et.$$scope={dirty:e,ctx:s}),U.$set(et);const lt={};e&2&&(lt.$$scope={dirty:e,ctx:s}),I.$set(lt);const tt={};e&2&&(tt.$$scope={dirty:e,ctx:s}),G.$set(tt)},i(s){hl||(o(w.$$.fragment,s),o(U.$$.fragment,s),o(B.$$.fragment,s),o(k.$$.fragment,s),o(X.$$.fragment,s),o(_.$$.fragment,s),o(N.$$.fragment,s),o(L.$$.fragment,s),o(F.$$.fragment,s),o(E.$$.fragment,s),o(A.$$.fragment,s),o(K.$$.fragment,s),o(ss.$$.fragment,s),o(ls.$$.fragment,s),o(ns.$$.fragment,s),o(rs.$$.fragment,s),o(cs.$$.fragment,s),o(Ms.$$.fragment,s),o(fs.$$.fragment,s),o(Js.$$.fragment,s),o(ws.$$.fragment,s),o(bs.$$.fragment,s),o(I.$$.fragment,s),o($s.$$.fragment,s),o(Gs.$$.fragment,s),o(vs.$$.fragment,s),o(xs.$$.fragment,s),o(Ws.$$.fragment,s),o(Hs.$$.fragment,s),o(G.$$.fragment,s),o(Cs.$$.fragment,s),o(Vs.$$.fragment,s),o(Ns.$$.fragment,s),o(qs.$$.fragment,s),hl=!0)},o(s){M(w.$$.fragment,s),M(U.$$.fragment,s),M(B.$$.fragment,s),M(k.$$.fragment,s),M(X.$$.fragment,s),M(_.$$.fragment,s),M(N.$$.fragment,s),M(L.$$.fragment,s),M(F.$$.fragment,s),M(E.$$.fragment,s),M(A.$$.fragment,s),M(K.$$.fragment,s),M(ss.$$.fragment,s),M(ls.$$.fragment,s),M(ns.$$.fragment,s),M(rs.$$.fragment,s),M(cs.$$.fragment,s),M(Ms.$$.fragment,s),M(fs.$$.fragment,s),M(Js.$$.fragment,s),M(ws.$$.fragment,s),M(bs.$$.fragment,s),M(I.$$.fragment,s),M($s.$$.fragment,s),M(Gs.$$.fragment,s),M(vs.$$.fragment,s),M(xs.$$.fragment,s),M(Ws.$$.fragment,s),M(Hs.$$.fragment,s),M(G.$$.fragment,s),M(Cs.$$.fragment,s),M(Vs.$$.fragment,s),M(Ns.$$.fragment,s),M(qs.$$.fragment,s),hl=!1},d(s){s&&(l(y),l(T),l(d),l(j),l(g),l(Ss),l(v),l(Fs),l(Qs),l(Es),l(x),l(Ps),l(W),l(As),l(Ds),l(Z),l(Ks),l(Os),l(H),l(se),l(C),l(ee),l(R),l(le),l(te),l(V),l(ae),l(Y),l(ne),l(pe),l(z),l(ie),l(q),l(re),l(me),l(S),l(ce),l(he),l(Q),l(oe),l(Me),l(P),l(ue),l(fe),l(D),l(je),l(Je),l(O),l(Te),l(ye),l(es),l(de),l(we),l(ts),l(be),l(as),l(ge),l($e),l(ps),l(Ue),l(is),l(Ze),l(Ie),l(ms),l(Ge),l(ve),l(hs),l(Be),l(os),l(xe),l(We),l(us),l(ke),l(Xe),l(js),l(He),l(Ce),l(Ts),l(Re),l(ys),l(_e),l(ds),l(Ve),l(Ye),l(Ne),l(ze),l(gs),l(qe),l(Le),l(Us),l(Se),l(Zs),l(Fe),l(Is),l(Qe),l(Ee),l(Pe),l(Bs),l(Ae),l(De),l(Ke),l(ks),l(Oe),l(Xs),l(sl),l(el),l(ll),l(tl),l(Rs),l(al),l(_s),l(nl),l(pl),l(Ys),l(il),l(rl),l(zs),l(ml),l(cl),l(Ls)),l(f),u(w,s),u(U,s),u(B,s),u(k,s),u(X,s),u(_,s),u(N,s),u(L,s),u(F,s),u(E,s),u(A,s),u(K,s),u(ss,s),u(ls,s),u(ns,s),u(rs,s),u(cs,s),u(Ms,s),u(fs,s),u(Js,s),u(ws,s),u(bs,s),u(I,s),u($s,s),u(Gs,s),u(vs,s),u(xs,s),u(Ws,s),u(Hs,s),u(G,s),u(Cs,s),u(Vs,s),u(Ns,s),u(qs,s)}}}const yt='{"title":"推理pipeline","local":"推理pipeline","sections":[{"title":"Pipeline使用","local":"pipeline使用","sections":[],"depth":2},{"title":"参数","local":"参数","sections":[{"title":"设备","local":"设备","sections":[],"depth":3},{"title":"批量大小","local":"批量大小","sections":[],"depth":3},{"title":"任务特定参数","local":"任务特定参数","sections":[],"depth":3}],"depth":2},{"title":"在数据集上使用pipelines","local":"在数据集上使用pipelines","sections":[],"depth":2},{"title":"在Web服务器上使用pipelines","local":"在web服务器上使用pipelines","sections":[],"depth":2},{"title":"视觉流水线","local":"视觉流水线","sections":[],"depth":2},{"title":"文本流水线","local":"文本流水线","sections":[],"depth":2},{"title":"多模态流水线","local":"多模态流水线","sections":[],"depth":2},{"title":"在大模型上使用🤗 accelerate 和 pipeline ：","local":"在大模型上使用-accelerate-和-pipeline-","sections":[],"depth":2}],"depth":1}';function dt($){return it(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Zt extends rt{constructor(f){super(),mt(this,f,dt,Tt,pt,{})}}export{Zt as component};
