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

<span class="hljs-meta">&gt;&gt;&gt; </span>vqa = pipeline(model=<span class="hljs-string">&quot;impira/layoutlm-document-qa&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>vqa(
<span class="hljs-meta">... </span>    image=<span class="hljs-string">&quot;https://huggingface.co/spaces/impira/docquery/resolve/2359223c1837a7587402bda0f2643382a6eefeab/invoice.png&quot;</span>,
<span class="hljs-meta">... </span>    question=<span class="hljs-string">&quot;What is the invoice number?&quot;</span>,
<span class="hljs-meta">... </span>)
[{<span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.42515</span>, <span class="hljs-string">&#x27;answer&#x27;</span>: <span class="hljs-string">&#x27;us-001&#x27;</span>, <span class="hljs-string">&#x27;start&#x27;</span>: <span class="hljs-number">16</span>, <span class="hljs-string">&#x27;end&#x27;</span>: <span class="hljs-number">16</span>}]`,wrap:!1}}),v=new hl({props:{$$slots:{default:[ut]},$$scope:{ctx:$}}}),Ce=new b({props:{title:"在大模型上使用🤗 accelerate 和 pipeline ：",local:"在大模型上使用-accelerate-和-pipeline-",headingTag:"h2"}}),Ve=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}}),Ne=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}}),{c(){f=p("meta"),y=a(),T=p("p"),w=a(),c(d.$$.fragment),j=a(),g=p("p"),g.innerHTML=ol,Le=a(),G=p("ul"),G.innerHTML=Ml,Se=a(),c(U.$$.fragment),Fe=a(),c(B.$$.fragment),Qe=a(),x=p("p"),x.innerHTML=ul,Ee=a(),k=p("ol"),k.innerHTML=fl,Pe=a(),c(W.$$.fragment),Ae=a(),Z=p("ol"),Z.innerHTML=jl,De=a(),c(X.$$.fragment),Ke=a(),H=p("p"),H.innerHTML=Jl,Oe=a(),C=p("p"),C.innerHTML=Tl,es=a(),R=p("p"),R.textContent=yl,ss=a(),c(_.$$.fragment),ls=a(),V=p("p"),V.innerHTML=wl,ts=a(),Y=p("p"),Y.textContent=dl,as=a(),c(N.$$.fragment),ns=a(),z=p("p"),z.innerHTML=bl,ps=a(),q=p("ul"),q.innerHTML=gl,is=a(),c(L.$$.fragment),rs=a(),S=p("p"),S.innerHTML=$l,cs=a(),c(F.$$.fragment),ms=a(),Q=p("p"),Q.textContent=Ul,hs=a(),c(E.$$.fragment),os=a(),P=p("p"),P.innerHTML=Zl,Ms=a(),c(A.$$.fragment),us=a(),D=p("p"),D.innerHTML=Il,fs=a(),c(K.$$.fragment),js=a(),O=p("p"),O.textContent=vl,Js=a(),c(ee.$$.fragment),Ts=a(),se=p("p"),se.innerHTML=Gl,ys=a(),c(le.$$.fragment),ws=a(),te=p("p"),te.innerHTML=Bl,ds=a(),ae=p("p"),ae.textContent=xl,bs=a(),c(ne.$$.fragment),gs=a(),pe=p("p"),pe.innerHTML=kl,$s=a(),ie=p("p"),ie.innerHTML=Wl,Us=a(),c(re.$$.fragment),Zs=a(),ce=p("p"),ce.innerHTML=Xl,Is=a(),c(me.$$.fragment),vs=a(),he=p("p"),he.innerHTML=Hl,Gs=a(),oe=p("p"),oe.innerHTML=Cl,Bs=a(),c(Me.$$.fragment),xs=a(),ue=p("p"),ue.innerHTML=Rl,ks=a(),c(fe.$$.fragment),Ws=a(),je=p("p"),je.innerHTML=_l,Xs=a(),c(Je.$$.fragment),Hs=a(),Te=p("p"),Te.innerHTML=Vl,Cs=a(),ye=p("p"),ye.innerHTML=Yl,Rs=a(),we=p("p"),we.innerHTML=Nl,_s=a(),c(de.$$.fragment),Vs=a(),c(be.$$.fragment),Ys=a(),c(I.$$.fragment),Ns=a(),ge=p("p"),ge.innerHTML=zl,zs=a(),c($e.$$.fragment),qs=a(),Ue=p("p"),Ue.innerHTML=ql,Ls=a(),Ze=p("p"),Ze.textContent=Ll,Ss=a(),Ie=p("p"),Ie.innerHTML=Sl,Fs=a(),c(ve.$$.fragment),Qs=a(),c(Ge.$$.fragment),Es=a(),Be=p("p"),Be.innerHTML=Fl,Ps=a(),c(xe.$$.fragment),As=a(),c(ke.$$.fragment),Ds=a(),We=p("p"),We.innerHTML=Ql,Ks=a(),Xe=p("p"),Xe.innerHTML=El,Os=a(),c(He.$$.fragment),el=a(),c(v.$$.fragment),sl=a(),c(Ce.$$.fragment),ll=a(),Re=p("p"),Re.innerHTML=Pl,tl=a(),_e=p("p"),_e.innerHTML=Al,al=a(),c(Ve.$$.fragment),nl=a(),Ye=p("p"),Ye.innerHTML=Dl,pl=a(),c(Ne.$$.fragment),il=a(),ze=p("p"),ze.innerHTML=Kl,rl=a(),qe=p("p"),this.h()},l(e){const s=rt("svelte-u9bgzb",document.head);f=i(s,"META",{name:!0,content:!0}),s.forEach(l),y=n(e),T=i(e,"P",{}),lt(T).forEach(l),w=n(e),m(d.$$.fragment,e),j=n(e),g=i(e,"P",{"data-svelte-h":!0}),r(g)!=="svelte-4toq83"&&(g.innerHTML=ol),Le=n(e),G=i(e,"UL",{"data-svelte-h":!0}),r(G)!=="svelte-1rdfrw8"&&(G.innerHTML=Ml),Se=n(e),m(U.$$.fragment,e),Fe=n(e),m(B.$$.fragment,e),Qe=n(e),x=i(e,"P",{"data-svelte-h":!0}),r(x)!=="svelte-1uqyo92"&&(x.innerHTML=ul),Ee=n(e),k=i(e,"OL",{"data-svelte-h":!0}),r(k)!=="svelte-tg417j"&&(k.innerHTML=fl),Pe=n(e),m(W.$$.fragment,e),Ae=n(e),Z=i(e,"OL",{start:!0,"data-svelte-h":!0}),r(Z)!=="svelte-tbwepw"&&(Z.innerHTML=jl),De=n(e),m(X.$$.fragment,e),Ke=n(e),H=i(e,"P",{"data-svelte-h":!0}),r(H)!=="svelte-wuyqla"&&(H.innerHTML=Jl),Oe=n(e),C=i(e,"P",{"data-svelte-h":!0}),r(C)!=="svelte-1og2a64"&&(C.innerHTML=Tl),es=n(e),R=i(e,"P",{"data-svelte-h":!0}),r(R)!=="svelte-y6rqea"&&(R.textContent=yl),ss=n(e),m(_.$$.fragment,e),ls=n(e),V=i(e,"P",{"data-svelte-h":!0}),r(V)!=="svelte-7v8a2b"&&(V.innerHTML=wl),ts=n(e),Y=i(e,"P",{"data-svelte-h":!0}),r(Y)!=="svelte-1hufjes"&&(Y.textContent=dl),as=n(e),m(N.$$.fragment,e),ns=n(e),z=i(e,"P",{"data-svelte-h":!0}),r(z)!=="svelte-cjxg4p"&&(z.innerHTML=bl),ps=n(e),q=i(e,"UL",{"data-svelte-h":!0}),r(q)!=="svelte-r6yb7c"&&(q.innerHTML=gl),is=n(e),m(L.$$.fragment,e),rs=n(e),S=i(e,"P",{"data-svelte-h":!0}),r(S)!=="svelte-1ufnjkh"&&(S.innerHTML=$l),cs=n(e),m(F.$$.fragment,e),ms=n(e),Q=i(e,"P",{"data-svelte-h":!0}),r(Q)!=="svelte-u8ryko"&&(Q.textContent=Ul),hs=n(e),m(E.$$.fragment,e),os=n(e),P=i(e,"P",{"data-svelte-h":!0}),r(P)!=="svelte-idsrr1"&&(P.innerHTML=Zl),Ms=n(e),m(A.$$.fragment,e),us=n(e),D=i(e,"P",{"data-svelte-h":!0}),r(D)!=="svelte-1658hsh"&&(D.innerHTML=Il),fs=n(e),m(K.$$.fragment,e),js=n(e),O=i(e,"P",{"data-svelte-h":!0}),r(O)!=="svelte-ftwjlg"&&(O.textContent=vl),Js=n(e),m(ee.$$.fragment,e),Ts=n(e),se=i(e,"P",{"data-svelte-h":!0}),r(se)!=="svelte-15xcnf9"&&(se.innerHTML=Gl),ys=n(e),m(le.$$.fragment,e),ws=n(e),te=i(e,"P",{"data-svelte-h":!0}),r(te)!=="svelte-lwvdk2"&&(te.innerHTML=Bl),ds=n(e),ae=i(e,"P",{"data-svelte-h":!0}),r(ae)!=="svelte-1ht982g"&&(ae.textContent=xl),bs=n(e),m(ne.$$.fragment,e),gs=n(e),pe=i(e,"P",{"data-svelte-h":!0}),r(pe)!=="svelte-occjw6"&&(pe.innerHTML=kl),$s=n(e),ie=i(e,"P",{"data-svelte-h":!0}),r(ie)!=="svelte-1aawhlf"&&(ie.innerHTML=Wl),Us=n(e),m(re.$$.fragment,e),Zs=n(e),ce=i(e,"P",{"data-svelte-h":!0}),r(ce)!=="svelte-1ujfi8z"&&(ce.innerHTML=Xl),Is=n(e),m(me.$$.fragment,e),vs=n(e),he=i(e,"P",{"data-svelte-h":!0}),r(he)!=="svelte-118drgt"&&(he.innerHTML=Hl),Gs=n(e),oe=i(e,"P",{"data-svelte-h":!0}),r(oe)!=="svelte-1mkq4nt"&&(oe.innerHTML=Cl),Bs=n(e),m(Me.$$.fragment,e),xs=n(e),ue=i(e,"P",{"data-svelte-h":!0}),r(ue)!=="svelte-o57d00"&&(ue.innerHTML=Rl),ks=n(e),m(fe.$$.fragment,e),Ws=n(e),je=i(e,"P",{"data-svelte-h":!0}),r(je)!=="svelte-3vy3oi"&&(je.innerHTML=_l),Xs=n(e),m(Je.$$.fragment,e),Hs=n(e),Te=i(e,"P",{"data-svelte-h":!0}),r(Te)!=="svelte-ug61kl"&&(Te.innerHTML=Vl),Cs=n(e),ye=i(e,"P",{"data-svelte-h":!0}),r(ye)!=="svelte-ty0yyf"&&(ye.innerHTML=Yl),Rs=n(e),we=i(e,"P",{"data-svelte-h":!0}),r(we)!=="svelte-1hgrt8v"&&(we.innerHTML=Nl),_s=n(e),m(de.$$.fragment,e),Vs=n(e),m(be.$$.fragment,e),Ys=n(e),m(I.$$.fragment,e),Ns=n(e),ge=i(e,"P",{"data-svelte-h":!0}),r(ge)!=="svelte-1lz0h23"&&(ge.innerHTML=zl),zs=n(e),m($e.$$.fragment,e),qs=n(e),Ue=i(e,"P",{"data-svelte-h":!0}),r(Ue)!=="svelte-1k2rnnm"&&(Ue.innerHTML=ql),Ls=n(e),Ze=i(e,"P",{"data-svelte-h":!0}),r(Ze)!=="svelte-h0nzrm"&&(Ze.textContent=Ll),Ss=n(e),Ie=i(e,"P",{"data-svelte-h":!0}),r(Ie)!=="svelte-1bks2jw"&&(Ie.innerHTML=Sl),Fs=n(e),m(ve.$$.fragment,e),Qs=n(e),m(Ge.$$.fragment,e),Es=n(e),Be=i(e,"P",{"data-svelte-h":!0}),r(Be)!=="svelte-7bhcu3"&&(Be.innerHTML=Fl),Ps=n(e),m(xe.$$.fragment,e),As=n(e),m(ke.$$.fragment,e),Ds=n(e),We=i(e,"P",{"data-svelte-h":!0}),r(We)!=="svelte-1i3u9x8"&&(We.innerHTML=Ql),Ks=n(e),Xe=i(e,"P",{"data-svelte-h":!0}),r(Xe)!=="svelte-13a1pna"&&(Xe.innerHTML=El),Os=n(e),m(He.$$.fragment,e),el=n(e),m(v.$$.fragment,e),sl=n(e),m(Ce.$$.fragment,e),ll=n(e),Re=i(e,"P",{"data-svelte-h":!0}),r(Re)!=="svelte-2liy51"&&(Re.innerHTML=Pl),tl=n(e),_e=i(e,"P",{"data-svelte-h":!0}),r(_e)!=="svelte-15lp4hn"&&(_e.innerHTML=Al),al=n(e),m(Ve.$$.fragment,e),nl=n(e),Ye=i(e,"P",{"data-svelte-h":!0}),r(Ye)!=="svelte-5lgja0"&&(Ye.innerHTML=Dl),pl=n(e),m(Ne.$$.fragment,e),il=n(e),ze=i(e,"P",{"data-svelte-h":!0}),r(ze)!=="svelte-y7nde"&&(ze.innerHTML=Kl),rl=n(e),qe=i(e,"P",{}),lt(qe).forEach(l),this.h()},h(){ml(f,"name","hf:doc:metadata"),ml(f,"content",jt),ml(Z,"start","2")},m(e,s){ct(document.head,f),t(e,y,s),t(e,T,s),t(e,w,s),h(d,e,s),t(e,j,s),t(e,g,s),t(e,Le,s),t(e,G,s),t(e,Se,s),h(U,e,s),t(e,Fe,s),h(B,e,s),t(e,Qe,s),t(e,x,s),t(e,Ee,s),t(e,k,s),t(e,Pe,s),h(W,e,s),t(e,Ae,s),t(e,Z,s),t(e,De,s),h(X,e,s),t(e,Ke,s),t(e,H,s),t(e,Oe,s),t(e,C,s),t(e,es,s),t(e,R,s),t(e,ss,s),h(_,e,s),t(e,ls,s),t(e,V,s),t(e,ts,s),t(e,Y,s),t(e,as,s),h(N,e,s),t(e,ns,s),t(e,z,s),t(e,ps,s),t(e,q,s),t(e,is,s),h(L,e,s),t(e,rs,s),t(e,S,s),t(e,cs,s),h(F,e,s),t(e,ms,s),t(e,Q,s),t(e,hs,s),h(E,e,s),t(e,os,s),t(e,P,s),t(e,Ms,s),h(A,e,s),t(e,us,s),t(e,D,s),t(e,fs,s),h(K,e,s),t(e,js,s),t(e,O,s),t(e,Js,s),h(ee,e,s),t(e,Ts,s),t(e,se,s),t(e,ys,s),h(le,e,s),t(e,ws,s),t(e,te,s),t(e,ds,s),t(e,ae,s),t(e,bs,s),h(ne,e,s),t(e,gs,s),t(e,pe,s),t(e,$s,s),t(e,ie,s),t(e,Us,s),h(re,e,s),t(e,Zs,s),t(e,ce,s),t(e,Is,s),h(me,e,s),t(e,vs,s),t(e,he,s),t(e,Gs,s),t(e,oe,s),t(e,Bs,s),h(Me,e,s),t(e,xs,s),t(e,ue,s),t(e,ks,s),h(fe,e,s),t(e,Ws,s),t(e,je,s),t(e,Xs,s),h(Je,e,s),t(e,Hs,s),t(e,Te,s),t(e,Cs,s),t(e,ye,s),t(e,Rs,s),t(e,we,s),t(e,_s,s),h(de,e,s),t(e,Vs,s),h(be,e,s),t(e,Ys,s),h(I,e,s),t(e,Ns,s),t(e,ge,s),t(e,zs,s),h($e,e,s),t(e,qs,s),t(e,Ue,s),t(e,Ls,s),t(e,Ze,s),t(e,Ss,s),t(e,Ie,s),t(e,Fs,s),h(ve,e,s),t(e,Qs,s),h(Ge,e,s),t(e,Es,s),t(e,Be,s),t(e,Ps,s),h(xe,e,s),t(e,As,s),h(ke,e,s),t(e,Ds,s),t(e,We,s),t(e,Ks,s),t(e,Xe,s),t(e,Os,s),h(He,e,s),t(e,el,s),h(v,e,s),t(e,sl,s),h(Ce,e,s),t(e,ll,s),t(e,Re,s),t(e,tl,s),t(e,_e,s),t(e,al,s),h(Ve,e,s),t(e,nl,s),t(e,Ye,s),t(e,pl,s),h(Ne,e,s),t(e,il,s),t(e,ze,s),t(e,rl,s),t(e,qe,s),cl=!0},p(e,[s]){const Ol={};s&2&&(Ol.$$scope={dirty:s,ctx:e}),U.$set(Ol);const et={};s&2&&(et.$$scope={dirty:s,ctx:e}),I.$set(et);const st={};s&2&&(st.$$scope={dirty:s,ctx:e}),v.$set(st)},i(e){cl||(o(d.$$.fragment,e),o(U.$$.fragment,e),o(B.$$.fragment,e),o(W.$$.fragment,e),o(X.$$.fragment,e),o(_.$$.fragment,e),o(N.$$.fragment,e),o(L.$$.fragment,e),o(F.$$.fragment,e),o(E.$$.fragment,e),o(A.$$.fragment,e),o(K.$$.fragment,e),o(ee.$$.fragment,e),o(le.$$.fragment,e),o(ne.$$.fragment,e),o(re.$$.fragment,e),o(me.$$.fragment,e),o(Me.$$.fragment,e),o(fe.$$.fragment,e),o(Je.$$.fragment,e),o(de.$$.fragment,e),o(be.$$.fragment,e),o(I.$$.fragment,e),o($e.$$.fragment,e),o(ve.$$.fragment,e),o(Ge.$$.fragment,e),o(xe.$$.fragment,e),o(ke.$$.fragment,e),o(He.$$.fragment,e),o(v.$$.fragment,e),o(Ce.$$.fragment,e),o(Ve.$$.fragment,e),o(Ne.$$.fragment,e),cl=!0)},o(e){M(d.$$.fragment,e),M(U.$$.fragment,e),M(B.$$.fragment,e),M(W.$$.fragment,e),M(X.$$.fragment,e),M(_.$$.fragment,e),M(N.$$.fragment,e),M(L.$$.fragment,e),M(F.$$.fragment,e),M(E.$$.fragment,e),M(A.$$.fragment,e),M(K.$$.fragment,e),M(ee.$$.fragment,e),M(le.$$.fragment,e),M(ne.$$.fragment,e),M(re.$$.fragment,e),M(me.$$.fragment,e),M(Me.$$.fragment,e),M(fe.$$.fragment,e),M(Je.$$.fragment,e),M(de.$$.fragment,e),M(be.$$.fragment,e),M(I.$$.fragment,e),M($e.$$.fragment,e),M(ve.$$.fragment,e),M(Ge.$$.fragment,e),M(xe.$$.fragment,e),M(ke.$$.fragment,e),M(He.$$.fragment,e),M(v.$$.fragment,e),M(Ce.$$.fragment,e),M(Ve.$$.fragment,e),M(Ne.$$.fragment,e),cl=!1},d(e){e&&(l(y),l(T),l(w),l(j),l(g),l(Le),l(G),l(Se),l(Fe),l(Qe),l(x),l(Ee),l(k),l(Pe),l(Ae),l(Z),l(De),l(Ke),l(H),l(Oe),l(C),l(es),l(R),l(ss),l(ls),l(V),l(ts),l(Y),l(as),l(ns),l(z),l(ps),l(q),l(is),l(rs),l(S),l(cs),l(ms),l(Q),l(hs),l(os),l(P),l(Ms),l(us),l(D),l(fs),l(js),l(O),l(Js),l(Ts),l(se),l(ys),l(ws),l(te),l(ds),l(ae),l(bs),l(gs),l(pe),l($s),l(ie),l(Us),l(Zs),l(ce),l(Is),l(vs),l(he),l(Gs),l(oe),l(Bs),l(xs),l(ue),l(ks),l(Ws),l(je),l(Xs),l(Hs),l(Te),l(Cs),l(ye),l(Rs),l(we),l(_s),l(Vs),l(Ys),l(Ns),l(ge),l(zs),l(qs),l(Ue),l(Ls),l(Ze),l(Ss),l(Ie),l(Fs),l(Qs),l(Es),l(Be),l(Ps),l(As),l(Ds),l(We),l(Ks),l(Xe),l(Os),l(el),l(sl),l(ll),l(Re),l(tl),l(_e),l(al),l(nl),l(Ye),l(pl),l(il),l(ze),l(rl),l(qe)),l(f),u(d,e),u(U,e),u(B,e),u(W,e),u(X,e),u(_,e),u(N,e),u(L,e),u(F,e),u(E,e),u(A,e),u(K,e),u(ee,e),u(le,e),u(ne,e),u(re,e),u(me,e),u(Me,e),u(fe,e),u(Je,e),u(de,e),u(be,e),u(I,e),u($e,e),u(ve,e),u(Ge,e),u(xe,e),u(ke,e),u(He,e),u(v,e),u(Ce,e),u(Ve,e),u(Ne,e)}}}const jt='{"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 Jt($){return nt(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class gt extends pt{constructor(f){super(),it(this,f,Jt,ft,at,{})}}export{gt as component};
