import{s as Bt,o as Lt,n as Ft}from"../chunks/scheduler.cc52f4b9.js";import{S as Xt,i as Yt,e as f,s as c,c as J,h as Pt,a as T,d as n,b as M,f as Ht,g as d,j as b,k as Us,l as qt,m as a,n as U,o,u as L,t as m,p as j,q as Kt,r as Ot,v as F}from"../chunks/index.9480bb2b.js";import{T as St}from"../chunks/Tip.f7b80743.js";import{C as en,H as Tl,E as ln}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.009dc98d.js";import{Y as Rt}from"../chunks/Youtube.7b12d9e8.js";import{C as h}from"../chunks/CodeBlock.184aadb6.js";import{C as Wt}from"../chunks/CourseFloatingBanner.6488bde3.js";import{F as sn}from"../chunks/FrameworkSwitchCourse.42d12053.js";function tn(y){let s,r;return s=new Wt({props:{chapter:2,classNames:"absolute z-10 right-0 top-0",notebooks:[{label:"Google Colab",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/master/course/zh-CN/chapter2/section2_tf.ipynb"},{label:"Aws Studio",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/master/course/zh-CN/chapter2/section2_tf.ipynb"}]}}),{c(){J(s.$$.fragment)},l(l){d(s.$$.fragment,l)},m(l,i){U(s,l,i),r=!0},i(l){r||(m(s.$$.fragment,l),r=!0)},o(l){o(s.$$.fragment,l),r=!1},d(l){j(s,l)}}}function nn(y){let s,r;return s=new Wt({props:{chapter:2,classNames:"absolute z-10 right-0 top-0",notebooks:[{label:"Google Colab",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/master/course/zh-CN/chapter2/section2_pt.ipynb"},{label:"Aws Studio",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/master/course/zh-CN/chapter2/section2_pt.ipynb"}]}}),{c(){J(s.$$.fragment)},l(l){d(s.$$.fragment,l)},m(l,i){U(s,l,i),r=!0},i(l){r||(m(s.$$.fragment,l),r=!0)},o(l){o(s.$$.fragment,l),r=!1},d(l){j(s,l)}}}function an(y){let s;return{c(){s=Kt("这是第一部分，根据你使用 PyTorch 或者 TensorFlow，内容略有不同。点击标题上方的平台，选择你喜欢的平台！")},l(r){s=Ot(r,"这是第一部分，根据你使用 PyTorch 或者 TensorFlow，内容略有不同。点击标题上方的平台，选择你喜欢的平台！")},m(r,l){a(r,s,l)},d(r){r&&n(s)}}}function rn(y){let s,r;return s=new Rt({props:{id:"wVN12smEvqg"}}),{c(){J(s.$$.fragment)},l(l){d(s.$$.fragment,l)},m(l,i){U(s,l,i),r=!0},i(l){r||(m(s.$$.fragment,l),r=!0)},o(l){o(s.$$.fragment,l),r=!1},d(l){j(s,l)}}}function pn(y){let s,r;return s=new Rt({props:{id:"1pedAIvTWXk"}}),{c(){J(s.$$.fragment)},l(l){d(s.$$.fragment,l)},m(l,i){U(s,l,i),r=!0},i(l){r||(m(s.$$.fragment,l),r=!0)},o(l){o(s.$$.fragment,l),r=!1},d(l){j(s,l)}}}function cn(y){let s,r;return s=new h({props:{code:"cmF3X2lucHV0cyUyMCUzRCUyMCU1QiUwQSUyMCUyMCUyMCUyMCUyMkkndmUlMjBiZWVuJTIwd2FpdGluZyUyMGZvciUyMGElMjBIdWdnaW5nRmFjZSUyMGNvdXJzZSUyMG15JTIwd2hvbGUlMjBsaWZlLiUyMiUyQyUwQSUyMCUyMCUyMCUyMCUyMkklMjBoYXRlJTIwdGhpcyUyMHNvJTIwbXVjaCElMjIlMkMlMEElNUQlMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIocmF3X2lucHV0cyUyQyUyMHBhZGRpbmclM0RUcnVlJTJDJTIwdHJ1bmNhdGlvbiUzRFRydWUlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnRmJTIyKSUwQXByaW50KGlucHV0cyk=",highlighted:`raw_inputs = [
    <span class="hljs-string">&quot;I&#x27;ve been waiting for a HuggingFace course my whole life.&quot;</span>,
    <span class="hljs-string">&quot;I hate this so much!&quot;</span>,
]
inputs = tokenizer(raw_inputs, padding=<span class="hljs-literal">True</span>, truncation=<span class="hljs-literal">True</span>, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)
<span class="hljs-built_in">print</span>(inputs)`,wrap:!1}}),{c(){J(s.$$.fragment)},l(l){d(s.$$.fragment,l)},m(l,i){U(s,l,i),r=!0},i(l){r||(m(s.$$.fragment,l),r=!0)},o(l){o(s.$$.fragment,l),r=!1},d(l){j(s,l)}}}function Mn(y){let s,r;return s=new h({props:{code:"cmF3X2lucHV0cyUyMCUzRCUyMCU1QiUwQSUyMCUyMCUyMCUyMCUyMkkndmUlMjBiZWVuJTIwd2FpdGluZyUyMGZvciUyMGElMjBIdWdnaW5nRmFjZSUyMGNvdXJzZSUyMG15JTIwd2hvbGUlMjBsaWZlLiUyMiUyQyUwQSUyMCUyMCUyMCUyMCUyMkklMjBoYXRlJTIwdGhpcyUyMHNvJTIwbXVjaCElMjIlMkMlMEElNUQlMEFpbnB1dHMlMjAlM0QlMjB0b2tlbml6ZXIocmF3X2lucHV0cyUyQyUyMHBhZGRpbmclM0RUcnVlJTJDJTIwdHJ1bmNhdGlvbiUzRFRydWUlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQXByaW50KGlucHV0cyk=",highlighted:`raw_inputs = [
    <span class="hljs-string">&quot;I&#x27;ve been waiting for a HuggingFace course my whole life.&quot;</span>,
    <span class="hljs-string">&quot;I hate this so much!&quot;</span>,
]
inputs = tokenizer(raw_inputs, padding=<span class="hljs-literal">True</span>, truncation=<span class="hljs-literal">True</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-built_in">print</span>(inputs)`,wrap:!1}}),{c(){J(s.$$.fragment)},l(l){d(s.$$.fragment,l)},m(l,i){U(s,l,i),r=!0},i(l){r||(m(s.$$.fragment,l),r=!0)},o(l){o(s.$$.fragment,l),r=!1},d(l){j(s,l)}}}function un(y){let s,r="以下是 TensorFlow 张量的结果：",l,i,u;return i=new h({props:{code:"JTdCJTBBJTIwJTIwJTIwJTIwJ2lucHV0X2lkcyclM0ElMjAlM0N0Zi5UZW5zb3IlM0ElMjBzaGFwZSUzRCgyJTJDJTIwMTYpJTJDJTIwZHR5cGUlM0RpbnQzMiUyQyUyMG51bXB5JTNEJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwYXJyYXkoJTVCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTVCJTIwJTIwMTAxJTJDJTIwJTIwMTA0NSUyQyUyMCUyMDEwMDUlMkMlMjAlMjAyMzEwJTJDJTIwJTIwMjA0MiUyQyUyMCUyMDM0MDMlMkMlMjAlMjAyMDA1JTJDJTIwJTIwMTAzNyUyQyUyMDE3NjYyJTJDJTIwMTIxNzIlMkMlMjAlMjAyNjA3JTJDJTIwJTIwMjAyNiUyQyUyMCUyMDI4NzglMkMlMjAlMjAyMTY2JTJDJTIwJTIwMTAxMiUyQyUyMCUyMCUyMDEwMiU1RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU1QiUyMCUyMDEwMSUyQyUyMCUyMDEwNDUlMkMlMjAlMjA1MjIzJTJDJTIwJTIwMjAyMyUyQyUyMCUyMDIwNjElMkMlMjAlMjAyMTcyJTJDJTIwJTIwJTIwOTk5JTJDJTIwJTIwJTIwMTAyJTJDJTIwJTIwJTIwJTIwJTIwMCUyQyUyMCUyMCUyMCUyMCUyMDAlMkMlMjAlMjAlMjAlMjAlMjAwJTJDJTIwJTIwJTIwJTIwJTIwMCUyQyUyMCUyMCUyMCUyMCUyMDAlMkMlMjAlMjAlMjAlMjAlMjAwJTJDJTIwJTIwJTIwJTIwJTIwMCUyQyUyMCUyMCUyMCUyMCUyMDAlNUQlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlNUQlMkMlMjBkdHlwZSUzRGludDMyKSUzRSUyQyUyMCUwQSUyMCUyMCUyMCUyMCdhdHRlbnRpb25fbWFzayclM0ElMjAlM0N0Zi5UZW5zb3IlM0ElMjBzaGFwZSUzRCgyJTJDJTIwMTYpJTJDJTIwZHR5cGUlM0RpbnQzMiUyQyUyMG51bXB5JTNEJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwYXJyYXkoJTVCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTVCMSUyQyUyMDElMkMlMjAxJTJDJTIwMSUyQyUyMDElMkMlMjAxJTJDJTIwMSUyQyUyMDElMkMlMjAxJTJDJTIwMSUyQyUyMDElMkMlMjAxJTJDJTIwMSUyQyUyMDElMkMlMjAxJTJDJTIwMSU1RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU1QjElMkMlMjAxJTJDJTIwMSUyQyUyMDElMkMlMjAxJTJDJTIwMSUyQyUyMDElMkMlMjAxJTJDJTIwMCUyQyUyMDAlMkMlMjAwJTJDJTIwMCUyQyUyMDAlMkMlMjAwJTJDJTIwMCUyQyUyMDAlNUQlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlNUQlMkMlMjBkdHlwZSUzRGludDMyKSUzRSUwQSU3RA==",highlighted:`{
    <span class="hljs-string">&#x27;input_ids&#x27;</span>: &lt;tf.Tensor: shape=(<span class="hljs-number">2</span>, <span class="hljs-number">16</span>), dtype=int32, numpy=
        array([
            [  <span class="hljs-number">101</span>,  <span class="hljs-number">1045</span>,  <span class="hljs-number">1005</span>,  <span class="hljs-number">2310</span>,  <span class="hljs-number">2042</span>,  <span class="hljs-number">3403</span>,  <span class="hljs-number">2005</span>,  <span class="hljs-number">1037</span>, <span class="hljs-number">17662</span>, <span class="hljs-number">12172</span>,  <span class="hljs-number">2607</span>,  <span class="hljs-number">2026</span>,  <span class="hljs-number">2878</span>,  <span class="hljs-number">2166</span>,  <span class="hljs-number">1012</span>,   <span class="hljs-number">102</span>],
            [  <span class="hljs-number">101</span>,  <span class="hljs-number">1045</span>,  <span class="hljs-number">5223</span>,  <span class="hljs-number">2023</span>,  <span class="hljs-number">2061</span>,  <span class="hljs-number">2172</span>,   <span class="hljs-number">999</span>,   <span class="hljs-number">102</span>,     <span class="hljs-number">0</span>,     <span class="hljs-number">0</span>,     <span class="hljs-number">0</span>,     <span class="hljs-number">0</span>,     <span class="hljs-number">0</span>,     <span class="hljs-number">0</span>,     <span class="hljs-number">0</span>,     <span class="hljs-number">0</span>]
        ], dtype=int32)&gt;, 
    <span class="hljs-string">&#x27;attention_mask&#x27;</span>: &lt;tf.Tensor: shape=(<span class="hljs-number">2</span>, <span class="hljs-number">16</span>), dtype=int32, numpy=
        array([
            [<span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>],
            [<span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>]
        ], dtype=int32)&gt;
}`,wrap:!1}}),{c(){s=f("p"),s.textContent=r,l=c(),J(i.$$.fragment)},l(p){s=T(p,"P",{"data-svelte-h":!0}),b(s)!=="svelte-1dn69pk"&&(s.textContent=r),l=M(p),d(i.$$.fragment,p)},m(p,w){a(p,s,w),a(p,l,w),U(i,p,w),u=!0},i(p){u||(m(i.$$.fragment,p),u=!0)},o(p){o(i.$$.fragment,p),u=!1},d(p){p&&(n(s),n(l)),j(i,p)}}}function on(y){let s,r="以下是 PyTorch 张量的结果：",l,i,u;return i=new h({props:{code:"JTdCJTBBJTIwJTIwJTIwJTIwJ2lucHV0X2lkcyclM0ElMjB0ZW5zb3IoJTVCJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTVCJTIwJTIwMTAxJTJDJTIwJTIwMTA0NSUyQyUyMCUyMDEwMDUlMkMlMjAlMjAyMzEwJTJDJTIwJTIwMjA0MiUyQyUyMCUyMDM0MDMlMkMlMjAlMjAyMDA1JTJDJTIwJTIwMTAzNyUyQyUyMDE3NjYyJTJDJTIwMTIxNzIlMkMlMjAyNjA3JTJDJTIwJTIwMjAyNiUyQyUyMCUyMDI4NzglMkMlMjAlMjAyMTY2JTJDJTIwJTIwMTAxMiUyQyUyMCUyMCUyMDEwMiU1RCUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCU1QiUyMCUyMDEwMSUyQyUyMCUyMDEwNDUlMkMlMjAlMjA1MjIzJTJDJTIwJTIwMjAyMyUyQyUyMCUyMDIwNjElMkMlMjAlMjAyMTcyJTJDJTIwJTIwJTIwOTk5JTJDJTIwJTIwJTIwMTAyJTJDJTIwJTIwJTIwJTIwJTIwMCUyQyUyMCUyMCUyMCUyMCUyMDAlMkMlMjAlMjAlMjAlMjAlMjAwJTJDJTIwJTIwJTIwJTIwJTIwMCUyQyUyMCUyMCUyMCUyMCUyMDAlMkMlMjAlMjAlMjAlMjAlMjAwJTJDJTIwJTIwJTIwJTIwJTIwMCUyQyUyMCUyMCUyMCUyMCUyMDAlNUQlMEElMjAlMjAlMjAlMjAlNUQpJTJDJTIwJTBBJTIwJTIwJTIwJTIwJ2F0dGVudGlvbl9tYXNrJyUzQSUyMHRlbnNvciglNUIlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlNUIxJTJDJTIwMSUyQyUyMDElMkMlMjAxJTJDJTIwMSUyQyUyMDElMkMlMjAxJTJDJTIwMSUyQyUyMDElMkMlMjAxJTJDJTIwMSUyQyUyMDElMkMlMjAxJTJDJTIwMSUyQyUyMDElMkMlMjAxJTVEJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTVCMSUyQyUyMDElMkMlMjAxJTJDJTIwMSUyQyUyMDElMkMlMjAxJTJDJTIwMSUyQyUyMDElMkMlMjAwJTJDJTIwMCUyQyUyMDAlMkMlMjAwJTJDJTIwMCUyQyUyMDAlMkMlMjAwJTJDJTIwMCU1RCUwQSUyMCUyMCUyMCUyMCU1RCklMEElN0Q=",highlighted:`{
    <span class="hljs-string">&#x27;input_ids&#x27;</span>: tensor([
        [  <span class="hljs-number">101</span>,  <span class="hljs-number">1045</span>,  <span class="hljs-number">1005</span>,  <span class="hljs-number">2310</span>,  <span class="hljs-number">2042</span>,  <span class="hljs-number">3403</span>,  <span class="hljs-number">2005</span>,  <span class="hljs-number">1037</span>, <span class="hljs-number">17662</span>, <span class="hljs-number">12172</span>, <span class="hljs-number">2607</span>,  <span class="hljs-number">2026</span>,  <span class="hljs-number">2878</span>,  <span class="hljs-number">2166</span>,  <span class="hljs-number">1012</span>,   <span class="hljs-number">102</span>],
        [  <span class="hljs-number">101</span>,  <span class="hljs-number">1045</span>,  <span class="hljs-number">5223</span>,  <span class="hljs-number">2023</span>,  <span class="hljs-number">2061</span>,  <span class="hljs-number">2172</span>,   <span class="hljs-number">999</span>,   <span class="hljs-number">102</span>,     <span class="hljs-number">0</span>,     <span class="hljs-number">0</span>,     <span class="hljs-number">0</span>,     <span class="hljs-number">0</span>,     <span class="hljs-number">0</span>,     <span class="hljs-number">0</span>,     <span class="hljs-number">0</span>,     <span class="hljs-number">0</span>]
    ]), 
    <span class="hljs-string">&#x27;attention_mask&#x27;</span>: tensor([
        [<span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>],
        [<span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>]
    ])
}`,wrap:!1}}),{c(){s=f("p"),s.textContent=r,l=c(),J(i.$$.fragment)},l(p){s=T(p,"P",{"data-svelte-h":!0}),b(s)!=="svelte-dkb67s"&&(s.textContent=r),l=M(p),d(i.$$.fragment,p)},m(p,w){a(p,s,w),a(p,l,w),U(i,p,w),u=!0},i(p){u||(m(i.$$.fragment,p),u=!0)},o(p){o(i.$$.fragment,p),u=!1},d(p){p&&(n(s),n(l)),j(i,p)}}}function mn(y){let s,r="我们可以像使用 tokenizer 一样下载预训练模型。Transformers 提供了一个 <code>TFAutoModel</code> 类，它也有一个 <code>from_pretrained()</code> 方法：",l,i,u;return i=new h({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGQXV0b01vZGVsJTBBJTBBY2hlY2twb2ludCUyMCUzRCUyMCUyMmRpc3RpbGJlcnQtYmFzZS11bmNhc2VkLWZpbmV0dW5lZC1zc3QtMi1lbmdsaXNoJTIyJTBBbW9kZWwlMjAlM0QlMjBURkF1dG9Nb2RlbC5mcm9tX3ByZXRyYWluZWQoY2hlY2twb2ludCk=",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFAutoModel

checkpoint = <span class="hljs-string">&quot;distilbert-base-uncased-finetuned-sst-2-english&quot;</span>
model = TFAutoModel.from_pretrained(checkpoint)`,wrap:!1}}),{c(){s=f("p"),s.innerHTML=r,l=c(),J(i.$$.fragment)},l(p){s=T(p,"P",{"data-svelte-h":!0}),b(s)!=="svelte-1fen8d4"&&(s.innerHTML=r),l=M(p),d(i.$$.fragment,p)},m(p,w){a(p,s,w),a(p,l,w),U(i,p,w),u=!0},i(p){u||(m(i.$$.fragment,p),u=!0)},o(p){o(i.$$.fragment,p),u=!1},d(p){p&&(n(s),n(l)),j(i,p)}}}function yn(y){let s,r="我们可以像使用 tokenizer 一样下载预训练模型。Transformers 提供了一个 <code>AutoModel</code> 类，它也有一个 <code>from_pretrained()</code> 方法：",l,i,u;return i=new h({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbCUwQSUwQWNoZWNrcG9pbnQlMjAlM0QlMjAlMjJkaXN0aWxiZXJ0LWJhc2UtdW5jYXNlZC1maW5ldHVuZWQtc3N0LTItZW5nbGlzaCUyMiUwQW1vZGVsJTIwJTNEJTIwQXV0b01vZGVsLmZyb21fcHJldHJhaW5lZChjaGVja3BvaW50KQ==",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModel

checkpoint = <span class="hljs-string">&quot;distilbert-base-uncased-finetuned-sst-2-english&quot;</span>
model = AutoModel.from_pretrained(checkpoint)`,wrap:!1}}),{c(){s=f("p"),s.innerHTML=r,l=c(),J(i.$$.fragment)},l(p){s=T(p,"P",{"data-svelte-h":!0}),b(s)!=="svelte-1lq4g4u"&&(s.innerHTML=r),l=M(p),d(i.$$.fragment,p)},m(p,w){a(p,s,w),a(p,l,w),U(i,p,w),u=!0},i(p){u||(m(i.$$.fragment,p),u=!0)},o(p){o(i.$$.fragment,p),u=!1},d(p){p&&(n(s),n(l)),j(i,p)}}}function fn(y){let s,r,l,i;return s=new h({props:{code:"b3V0cHV0cyUyMCUzRCUyMG1vZGVsKGlucHV0cyklMEFwcmludChvdXRwdXRzLmxhc3RfaGlkZGVuX3N0YXRlLnNoYXBlKQ==",highlighted:`outputs = model(inputs)
<span class="hljs-built_in">print</span>(outputs.last_hidden_state.shape)`,wrap:!1}}),l=new h({props:{code:"KDIlMkMlMjAxNiUyQyUyMDc2OCk=",highlighted:'(<span class="hljs-number">2</span>, <span class="hljs-number">16</span>, <span class="hljs-number">768</span>)',wrap:!1}}),{c(){J(s.$$.fragment),r=c(),J(l.$$.fragment)},l(u){d(s.$$.fragment,u),r=M(u),d(l.$$.fragment,u)},m(u,p){U(s,u,p),a(u,r,p),U(l,u,p),i=!0},i(u){i||(m(s.$$.fragment,u),m(l.$$.fragment,u),i=!0)},o(u){o(s.$$.fragment,u),o(l.$$.fragment,u),i=!1},d(u){u&&n(r),j(s,u),j(l,u)}}}function Tn(y){let s,r,l,i;return s=new h({props:{code:"b3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKSUwQXByaW50KG91dHB1dHMubGFzdF9oaWRkZW5fc3RhdGUuc2hhcGUp",highlighted:`outputs = model(**inputs)
<span class="hljs-built_in">print</span>(outputs.last_hidden_state.shape)`,wrap:!1}}),l=new h({props:{code:"dG9yY2guU2l6ZSglNUIyJTJDJTIwMTYlMkMlMjA3NjglNUQp",highlighted:'torch.Size([<span class="hljs-number">2</span>, <span class="hljs-number">16</span>, <span class="hljs-number">768</span>])',wrap:!1}}),{c(){J(s.$$.fragment),r=c(),J(l.$$.fragment)},l(u){d(s.$$.fragment,u),r=M(u),d(l.$$.fragment,u)},m(u,p){U(s,u,p),a(u,r,p),U(l,u,p),i=!0},i(u){i||(m(s.$$.fragment,u),m(l.$$.fragment,u),i=!0)},o(u){o(s.$$.fragment,u),o(l.$$.fragment,u),i=!1},d(u){u&&n(r),j(s,u),j(l,u)}}}function bn(y){let s,r="以情感分类为例，我们需要一个带有序列分类头的模型（能够将句子分类为积极或消极）。因此，我们不选用 <code>TFAutoModel</code> 类，而是使用 <code>TFAutoModelForSequenceClassification</code> 。也就是说前面写的 model = TFAutoModel.from_pretrained(checkpoint)并不能得到情感分类任务的结果，因为没有加载 Model head。",l,i,u;return i=new h({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMFRGQXV0b01vZGVsRm9yU2VxdWVuY2VDbGFzc2lmaWNhdGlvbiUwQSUwQWNoZWNrcG9pbnQlMjAlM0QlMjAlMjJkaXN0aWxiZXJ0LWJhc2UtdW5jYXNlZC1maW5ldHVuZWQtc3N0LTItZW5nbGlzaCUyMiUwQW1vZGVsJTIwJTNEJTIwVEZBdXRvTW9kZWxGb3JTZXF1ZW5jZUNsYXNzaWZpY2F0aW9uLmZyb21fcHJldHJhaW5lZChjaGVja3BvaW50KSUwQW91dHB1dHMlMjAlM0QlMjBtb2RlbChpbnB1dHMp",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFAutoModelForSequenceClassification

checkpoint = <span class="hljs-string">&quot;distilbert-base-uncased-finetuned-sst-2-english&quot;</span>
model = TFAutoModelForSequenceClassification.from_pretrained(checkpoint)
outputs = model(inputs)`,wrap:!1}}),{c(){s=f("p"),s.innerHTML=r,l=c(),J(i.$$.fragment)},l(p){s=T(p,"P",{"data-svelte-h":!0}),b(s)!=="svelte-18pu2qp"&&(s.innerHTML=r),l=M(p),d(i.$$.fragment,p)},m(p,w){a(p,s,w),a(p,l,w),U(i,p,w),u=!0},i(p){u||(m(i.$$.fragment,p),u=!0)},o(p){o(i.$$.fragment,p),u=!1},d(p){p&&(n(s),n(l)),j(i,p)}}}function Jn(y){let s,r=`以情感分类为例，我们需要一个带有序列分类头的模型（能够将句子分类为积极或消极）。因此，我们不选用 <code>AutoModel</code> 类，而是使用 <code>AutoModelForSequenceClassification</code> 。也就是说前面写的 <code>model = AutoModel.from_pretrained(checkpoint)</code> 并不能得到情感分类任务的结果，因为没有加载 Model head。
<code>AutoModelForSequenceClassification</code> 类在 <code>AutoModel</code> 的基础上添加了一个序列分类头部，可以
将文本分类为不同的类别。`,l,i,u;return i=new h({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24lMEElMEFjaGVja3BvaW50JTIwJTNEJTIwJTIyZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQtZmluZXR1bmVkLXNzdC0yLWVuZ2xpc2glMjIlMEFtb2RlbCUyMCUzRCUyMEF1dG9Nb2RlbEZvclNlcXVlbmNlQ2xhc3NpZmljYXRpb24uZnJvbV9wcmV0cmFpbmVkKGNoZWNrcG9pbnQpJTBBb3V0cHV0cyUyMCUzRCUyMG1vZGVsKCoqaW5wdXRzKQ==",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForSequenceClassification

checkpoint = <span class="hljs-string">&quot;distilbert-base-uncased-finetuned-sst-2-english&quot;</span>
model = AutoModelForSequenceClassification.from_pretrained(checkpoint)
outputs = model(**inputs)`,wrap:!1}}),{c(){s=f("p"),s.innerHTML=r,l=c(),J(i.$$.fragment)},l(p){s=T(p,"P",{"data-svelte-h":!0}),b(s)!=="svelte-28ah74"&&(s.innerHTML=r),l=M(p),d(i.$$.fragment,p)},m(p,w){a(p,s,w),a(p,l,w),U(i,p,w),u=!0},i(p){u||(m(i.$$.fragment,p),u=!0)},o(p){o(i.$$.fragment,p),u=!1},d(p){p&&(n(s),n(l)),j(i,p)}}}function dn(y){let s,r;return s=new h({props:{code:"KDIlMkMlMjAyKQ==",highlighted:'(<span class="hljs-number">2</span>, <span class="hljs-number">2</span>)',wrap:!1}}),{c(){J(s.$$.fragment)},l(l){d(s.$$.fragment,l)},m(l,i){U(s,l,i),r=!0},i(l){r||(m(s.$$.fragment,l),r=!0)},o(l){o(s.$$.fragment,l),r=!1},d(l){j(s,l)}}}function Un(y){let s,r;return s=new h({props:{code:"dG9yY2guU2l6ZSglNUIyJTJDJTIwMiU1RCk=",highlighted:'torch.Size([<span class="hljs-number">2</span>, <span class="hljs-number">2</span>])',wrap:!1}}),{c(){J(s.$$.fragment)},l(l){d(s.$$.fragment,l)},m(l,i){U(s,l,i),r=!0},i(l){r||(m(s.$$.fragment,l),r=!0)},o(l){o(s.$$.fragment,l),r=!1},d(l){j(s,l)}}}function jn(y){let s,r;return s=new h({props:{code:"JTNDdGYuVGVuc29yJTNBJTIwc2hhcGUlM0QoMiUyQyUyMDIpJTJDJTIwZHR5cGUlM0RmbG9hdDMyJTJDJTIwbnVtcHklM0QlMEElMjAlMjAlMjAlMjBhcnJheSglNUIlNUItMS41NjA2OTkxJTJDJTIwJTIwMS42MTIyODQyJTVEJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTVCJTIwNC4xNjkyMzElMjAlMkMlMjAtMy4zNDY0NDcyJTVEJTVEJTJDJTIwZHR5cGUlM0RmbG9hdDMyKSUzRQ==",highlighted:`&lt;tf.Tensor: shape=(<span class="hljs-number">2</span>, <span class="hljs-number">2</span>), dtype=float32, numpy=
    array([[-<span class="hljs-number">1.5606991</span>,  <span class="hljs-number">1.6122842</span>],
           [ <span class="hljs-number">4.169231</span> , -<span class="hljs-number">3.3464472</span>]], dtype=float32)&gt;`,wrap:!1}}),{c(){J(s.$$.fragment)},l(l){d(s.$$.fragment,l)},m(l,i){U(s,l,i),r=!0},i(l){r||(m(s.$$.fragment,l),r=!0)},o(l){o(s.$$.fragment,l),r=!1},d(l){j(s,l)}}}function wn(y){let s,r;return s=new h({props:{code:"dGVuc29yKCU1QiU1Qi0xLjU2MDclMkMlMjAlMjAxLjYxMjMlNUQlMkMlMEElMjAlMjAlMjAlMjAlMjAlMjAlMjAlMjAlNUIlMjA0LjE2OTIlMkMlMjAtMy4zNDY0JTVEJTVEJTJDJTIwZ3JhZF9mbiUzRCUzQ0FkZG1tQmFja3dhcmQlM0Up",highlighted:`tensor([[-<span class="hljs-number">1.5607</span>,  <span class="hljs-number">1.6123</span>],
        [ <span class="hljs-number">4.1692</span>, -<span class="hljs-number">3.3464</span>]], grad_fn=&lt;AddmmBackward&gt;)`,wrap:!1}}),{c(){J(s.$$.fragment)},l(l){d(s.$$.fragment,l)},m(l,i){U(s,l,i),r=!0},i(l){r||(m(s.$$.fragment,l),r=!0)},o(l){o(s.$$.fragment,l),r=!1},d(l){j(s,l)}}}function hn(y){let s,r;return s=new h({props:{code:"aW1wb3J0JTIwdGVuc29yZmxvdyUyMGFzJTIwdGYlMEElMEFwcmVkaWN0aW9ucyUyMCUzRCUyMHRmLm1hdGguc29mdG1heChvdXRwdXRzLmxvZ2l0cyUyQyUyMGF4aXMlM0QtMSklMEFwcmludChwcmVkaWN0aW9ucyk=",highlighted:`<span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf

predictions = tf.math.softmax(outputs.logits, axis=-<span class="hljs-number">1</span>)
<span class="hljs-built_in">print</span>(predictions)`,wrap:!1}}),{c(){J(s.$$.fragment)},l(l){d(s.$$.fragment,l)},m(l,i){U(s,l,i),r=!0},i(l){r||(m(s.$$.fragment,l),r=!0)},o(l){o(s.$$.fragment,l),r=!1},d(l){j(s,l)}}}function $n(y){let s,r;return s=new h({props:{code:"aW1wb3J0JTIwdG9yY2glMEElMEFwcmVkaWN0aW9ucyUyMCUzRCUyMHRvcmNoLm5uLmZ1bmN0aW9uYWwuc29mdG1heChvdXRwdXRzLmxvZ2l0cyUyQyUyMGRpbSUzRC0xKSUwQXByaW50KHByZWRpY3Rpb25zKQ==",highlighted:`<span class="hljs-keyword">import</span> torch

predictions = torch.nn.functional.softmax(outputs.logits, dim=-<span class="hljs-number">1</span>)
<span class="hljs-built_in">print</span>(predictions)`,wrap:!1}}),{c(){J(s.$$.fragment)},l(l){d(s.$$.fragment,l)},m(l,i){U(s,l,i),r=!0},i(l){r||(m(s.$$.fragment,l),r=!0)},o(l){o(s.$$.fragment,l),r=!1},d(l){j(s,l)}}}function _n(y){let s,r;return s=new h({props:{code:"dGYuVGVuc29yKCUwQSU1QiU1QjQuMDE5NTE2NzFlLTAyJTIwOS41OTgwNDgzM2UtMDElNUQlMEElMjAlNUI5Ljk5NDU1ODdlLTAxJTIwNS40NDE4NDI0ZS0wNCU1RCU1RCUyQyUyMHNoYXBlJTNEKDIlMkMlMjAyKSUyQyUyMGR0eXBlJTNEZmxvYXQzMik=",highlighted:`tf.Tensor(
[[<span class="hljs-number">4.01951671e-02</span> <span class="hljs-number">9.59804833e-01</span>]
 [<span class="hljs-number">9.9945587e-01</span> <span class="hljs-number">5.4418424e-04</span>]], shape=(<span class="hljs-number">2</span>, <span class="hljs-number">2</span>), dtype=float32)`,wrap:!1}}),{c(){J(s.$$.fragment)},l(l){d(s.$$.fragment,l)},m(l,i){U(s,l,i),r=!0},i(l){r||(m(s.$$.fragment,l),r=!0)},o(l){o(s.$$.fragment,l),r=!1},d(l){j(s,l)}}}function Cn(y){let s,r;return s=new h({props:{code:"dGVuc29yKCU1QiU1QjQuMDE5NWUtMDIlMkMlMjA5LjU5ODBlLTAxJTVEJTJDJTBBJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTIwJTVCOS45OTQ2ZS0wMSUyQyUyMDUuNDQxOGUtMDQlNUQlNUQlMkMlMjBncmFkX2ZuJTNEJTNDU29mdG1heEJhY2t3YXJkJTNFKQ==",highlighted:`tensor([[<span class="hljs-number">4.0195e-02</span>, <span class="hljs-number">9.5980e-01</span>],
        [<span class="hljs-number">9.9946e-01</span>, <span class="hljs-number">5.4418e-04</span>]], grad_fn=&lt;SoftmaxBackward&gt;)`,wrap:!1}}),{c(){J(s.$$.fragment)},l(l){d(s.$$.fragment,l)},m(l,i){U(s,l,i),r=!0},i(l){r||(m(s.$$.fragment,l),r=!0)},o(l){o(s.$$.fragment,l),r=!1},d(l){j(s,l)}}}function kn(y){let s,r="✏️ <strong>试试看！</strong> 选择两个（或更多）句子并分别在 <code>sentiment-analysis</code> 管道和自己实现的管道中运行它们。看一看是否获得的结果是不是相同的！";return{c(){s=f("p"),s.innerHTML=r},l(l){s=T(l,"P",{"data-svelte-h":!0}),b(s)!=="svelte-1ln08qa"&&(s.innerHTML=r)},m(l,i){a(l,s,i)},p:Ft,d(l){l&&n(s)}}}function In(y){let s,r,l,i,u,p,w,Jl,K,dl,$,_,al,X,Ul,C,k,rl,O,vs='让我们从一个完整的示例开始，看看在 <a href="/course/chapter1">第一章</a> 中执行以下代码时在幕后发生了什么',jl,ee,wl,le,Qs="获得如下输出：",hl,se,$l,te,Ns='正如我们在 <a href="/course/chapter1">第一章</a> 中看到的，这个 pipeline 集成了三个步骤：预处理、模型计算和后处理：',_l,Y,Ds='<img class="block dark:hidden" src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter2/full_nlp_pipeline.svg" alt="The full NLP pipeline: tokenization of text, conversion to IDs, and inference through the Transformer model and the model head."/> <img class="hidden dark:block" src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter2/full_nlp_pipeline-dark.svg" alt="The full NLP pipeline: tokenization of text, conversion to IDs, and inference through the Transformer model and the model head."/>',Cl,ne,Es="让我们先简单了解一下这三个步骤。",kl,ae,Il,re,Gs="与其他神经网络一样，Transformer 模型无法直接处理原始文本，因此我们管道的第一步是将文本输入转换为模型能够理解的数字。为此，我们使用 tokenizer（ tokenizer ），它将负责：",gl,pe,zs="<li>将输入拆分为单词、子单词或符号（如标点符号），称为 <strong>token</strong>（标记）</li> <li>将每个标记（token）映射到一个数字，称为 <strong>input ID</strong>（inputs ID）</li> <li>添加模型需要的其他输入，例如特殊标记（如 <code>[CLS]</code> 和 <code>[SEP]</code> ）</li> <li><ul><li>位置编码：指示每个标记在句子中的位置。</li></ul></li> <li><ul><li>段落标记：区分不同段落的文本。</li></ul></li> <li><ul><li>特殊标记：例如 [CLS] 和 [SEP] 标记，用于标识句子的开头和结尾。</li></ul></li>",Al,ie,Zs='在使用模型时所有这些预处理都需要与模型预训练时的方式完全相同，因此我们首先需要从 <a href="https://huggingface.co/models" rel="nofollow">Model Hub</a> 中下载这些信息。为此，我们使用 <code>AutoTokenizer</code> 类和它的 <code>from_pretrained()</code> 方法，并输入我们模型 checkpoint 的名称，它将自动获取与模型的 tokenizer 相关联的数据，并对其进行缓存（因此只有在你第一次运行下面的代码时才会下载）。',xl,ce,Vs='<code>sentiment-analysis</code> （情绪分析）管道默认的 checkpoint 是 <code>distilbert-base-uncased-finetuned-sst-2-english</code> （你可以在 <a href="https://huggingface.co/distilbert-base-uncased-finetuned-sst-2-english" rel="nofollow">这里</a> ）看到它的模型卡片，我们运行以下代码：',vl,Me,Ql,ue,Hs="当我们有了 tokenizer，我们就可以直接将我们的句子传递给它，我们就会得到一个 <code>input ID（inputs ID）</code> 的列表！剩下要做的唯一一件事就是将 input ID 列表转换为 tensor（张量）。",Nl,oe,Ss="你在使用🤗 Transformers 时，您无需担心它背后的机器学习框架；它可能是 PyTorch 或 TensorFlow，或 Flax。但是，Transformers 模型只接受 <code>tensor（张量）</code> 作为输入。如果这是你第一次听说 tensor，你可以把它们想象成 NumPy 数组。NumPy 数组可以是标量（0D）、向量（1D）、矩阵（2D）或具有更多维度。这些都可以称为 tensor；其他 ML 框架的 tensor 使用方法也类似，通常与 NumPy 数组一样容易创建。",Dl,me,Rs="我们可以使用 <code>return_tensors</code> 参数指定我们想要得到的 tensor 的类型（PyTorch、TensorFlow 或纯 NumPy），",El,I,g,pl,ye,Ws="现在不要担心 padding（填充）和 truncation（截断）；我们稍后会解释这些。这里要记住的是，你可以传递一个句子或一组句子，还可以指定要返回的 tensor 类型（如果没有传递类型，默认返回的是 python 中的 list 格式）。",Gl,A,x,il,fe,Bs="输出是一个包含两个键， <code>input_ids</code> 和 <code>attention_mask</code> 。 <code>input_ids</code> 包含两行整数（每个句子一行），它们是每个句子中 token 的 ID。我们将在本章后面解释什么是 <code>attention_mask</code> 。",zl,Te,Zl,v,Q,cl,be,Ls="在这段代码中，我们将之前在 pipeline 中使用的 checkpoint（实际上应该已经被缓存了）下载下来，并用它实例化了一个模型。",Vl,Je,Fs="这个模型只包含基本的 Transformer 模块：输入一些句子，它输出我们将称为 <code>hidden states（隐状态）</code> ，也被称为特征。每个输入，我们都可以获取一个高维向量，代表 Transformer 模型对该输入的上下文理解。",Hl,de,Xs="如果这有些难以理解，不要担心。我们以后再解释。",Sl,Ue,Ys='这些隐状态本身就很有用，它们被称为模型头（head），通常是模型另一部分的输入。在 <a href="/course/chapter1">第一章</a> 中，可以使用相同的体系结构的模型执行不同的任务，这是因为每个任务都有一个对应的模型头。',Rl,je,Wl,we,Ps="Transformers 模块的矢量输出通常较大。它通常有三个维度：",Bl,he,qs="<li><strong>Batch size</strong>（批次大小）：一次处理的序列数（在我们的示例中为 2）。</li> <li><strong>Sequence length</strong>（序列长度）：表示序列（句子）的长度（在我们的示例中为 16）。</li> <li><strong>Hidden size</strong>（隐藏层大小）：每个模型输入的向量维度。</li>",Ll,$e,Ks="之所以说它是“高维度”的，是因为最后一个维度值。隐藏层维度可以非常大（对于较小的模型，常见的是 768，对于较大的模型，这个数字可以达到 3072 或更多）。",Fl,_e,Os="如果我们将预处理的之后的值输入到模型中，我们会得到以下输入：",Xl,N,D,Ml,Ce,et="注意，🤗 Transformers 模型的输出有些像 <code>namedtuple</code> 或词典。你可以通过使用“.”+属性（就像我们在上面示例中所做的那样）或键（ <code>outputs[&quot;last_hidden_state&quot;]</code> ）访问元素，如果你确切知道要查找的内容的位置（ <code>outputs[0]</code> ），也可以通过索引访问元素。",Yl,ke,Pl,Ie,lt="Transformers 模型的输出会直接发送到模型头进行处理。",ql,ge,st="模型头通常由一个或几个线性层组成，它的输入是隐状态的高维向量，它会并将其投影到不同的维度。",Kl,P,tt='<img class="block dark:hidden" src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter2/transformer_and_head.svg" alt="A Transformer network alongside its head."/> <img class="hidden dark:block" src="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter2/transformer_and_head-dark.svg" alt="A Transformer network alongside its head."/>',Ol,Ae,nt="在此图中，模型由其嵌入层和后续层表示。嵌入层将 tokenize 后输入中的每个 inputs ID 转换为表示关联 token 的向量。后续层使用注意机制操纵这些向量，生成句子的最终表示。",es,xe,at="Transformers 中有许多不同的体系结构，每种体系结构都是围绕处理特定任务而设计的。以下是一个非详尽的列表：",ls,ve,rt="<li><code>*Model</code> （隐状态检索）</li> <li><code>*ForCausalLM</code></li> <li><code>*ForMaskedLM</code></li> <li><code>*ForMultipleChoice</code></li> <li><code>*ForQuestionAnswering</code></li> <li><code>*ForSequenceClassification</code></li> <li><code>*ForTokenClassification</code></li> <li>以及其他 🤗</li>",ss,E,G,ul,Qe,pt=`如果我们看一下现在输出的形状，其维度会降低很多：模型头接收我们之前看到的高维向量作为输入，并输出包含两个值（每种标签一个）的向量。正如您所见，输出向量的尺寸与输入向量相比要小得多。这是因为模型头将输入向量中的信息压缩成两个值，每个标签一个
264	<code>python 265 </code>python：`,ts,Ne,ns,z,Z,ol,De,it="由于我们只有两个句子和两种标签，所以我们从模型中得到的结果的形状是 2 x 2。",as,Ee,rs,Ge,ct="我们从模型中得到的输出值本身并不一定有意义。我们来看看，",ps,ze,is,V,H,ml,Ze,Mt='我们的模型预测第一句为 <code>[-1.5607, 1.6123]</code> ，第二句为 <code>[ 4.1692, -3.3464]</code> 。这些不是概率，而是 <code>logits（对数几率）</code> ，是模型最后一层输出的原始的、未标准化的分数。要转换为概率，它们需要经过 <a href="https://en.wikipedia.org/wiki/Softmax_function" rel="nofollow">SoftMax</a> 层（所有🤗Transformers 模型的输出都是 logits，因为训练时的损失函数通常会将最后的激活函数（如 SoftMax）与实际的损失函数（如交叉熵）融合）：',cs,S,R,yl,W,B,fl,Ve,ut="现在我们可以看到，模型预测第一句的输出是 <code>[0.0402, 0.9598]</code> ，第二句 <code>[0.9995, 0.0005]</code> 。这些是可直接使用的概率分数。",Ms,He,ot="为了获得每个分数对应的标签，我们可以查看模型配置的 <code>id2label</code> 属性（下一节将对此进行详细介绍），该属性将每个模型输出的 ID 映射到相应的标签：",us,Se,os,Re,ms,We,mt="现在我们可以得出结论，模型预测如下：",ys,Be,yt="<li>第一句：消极的概率：0.0402，积极的概率：0.9598</li> <li>第二句：消极的概率：0.9995，积极的概率：0.0005</li>",fs,Le,ft="我们已经成功地复刻了管道的三个步骤：使用 tokenizer 进行预处理、通过模型传递输入以及后处理！接下来，让我们花一些时间深入了解这些步骤中的每一步。",Ts,q,bs,Fe,Js,bl,ds;u=new sn({props:{fw:y[0]}}),w=new en({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),K=new Tl({props:{title:"Pipeline 的内部",local:"Pipeline 的内部",headingTag:"h1"}});const Tt=[nn,tn],Xe=[];function bt(e,t){return e[0]==="pt"?0:1}$=bt(y),_=Xe[$]=Tt[$](y),X=new St({props:{$$slots:{default:[an]},$$scope:{ctx:y}}});const Jt=[pn,rn],Ye=[];function dt(e,t){return e[0]==="pt"?0:1}C=dt(y),k=Ye[C]=Jt[C](y),ee=new h({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMHBpcGVsaW5lJTBBJTBBY2xhc3NpZmllciUyMCUzRCUyMHBpcGVsaW5lKCUyMnNlbnRpbWVudC1hbmFseXNpcyUyMiklMEFjbGFzc2lmaWVyKCUwQSUyMCUyMCUyMCUyMCU1QiUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMkkndmUlMjBiZWVuJTIwd2FpdGluZyUyMGZvciUyMGElMjBIdWdnaW5nRmFjZSUyMGNvdXJzZSUyMG15JTIwd2hvbGUlMjBsaWZlLiUyMiUyQyUwQSUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMCUyMkklMjBoYXRlJTIwdGhpcyUyMHNvJTIwbXVjaCElMjIlMkMlMEElMjAlMjAlMjAlMjAlNUQlMEEp",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

classifier = pipeline(<span class="hljs-string">&quot;sentiment-analysis&quot;</span>)
classifier(
    [
        <span class="hljs-string">&quot;I&#x27;ve been waiting for a HuggingFace course my whole life.&quot;</span>,
        <span class="hljs-string">&quot;I hate this so much!&quot;</span>,
    ]
)`,wrap:!1}}),se=new h({props:{code:"JTVCJTdCJ2xhYmVsJyUzQSUyMCdQT1NJVElWRSclMkMlMjAnc2NvcmUnJTNBJTIwMC45NTk4MDQ3MTM3MjYwNDM3JTdEJTJDJTBBJTIwJTdCJ2xhYmVsJyUzQSUyMCdORUdBVElWRSclMkMlMjAnc2NvcmUnJTNBJTIwMC45OTk0NTU4MDk1OTMyMDA3JTdEJTVE",highlighted:`[{<span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;POSITIVE&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.9598047137260437</span>},
 {<span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-string">&#x27;NEGATIVE&#x27;</span>, <span class="hljs-string">&#x27;score&#x27;</span>: <span class="hljs-number">0.9994558095932007</span>}]`,wrap:!1}}),ae=new Tl({props:{title:"使用 tokenizer（ tokenizer ）进行预处理",local:"使用 tokenizer（ tokenizer ）进行预处理",headingTag:"h2"}}),Me=new h({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMEElMEFjaGVja3BvaW50JTIwJTNEJTIwJTIyZGlzdGlsYmVydC1iYXNlLXVuY2FzZWQtZmluZXR1bmVkLXNzdC0yLWVuZ2xpc2glMjIlMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZChjaGVja3BvaW50KQ==",highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer

checkpoint = <span class="hljs-string">&quot;distilbert-base-uncased-finetuned-sst-2-english&quot;</span>
tokenizer = AutoTokenizer.from_pretrained(checkpoint)`,wrap:!1}});const Ut=[Mn,cn],Pe=[];function jt(e,t){return e[0]==="pt"?0:1}I=jt(y),g=Pe[I]=Ut[I](y);const wt=[on,un],qe=[];function ht(e,t){return e[0]==="pt"?0:1}A=ht(y),x=qe[A]=wt[A](y),Te=new Tl({props:{title:"探索模型",local:"探索模型",headingTag:"h2"}});const $t=[yn,mn],Ke=[];function _t(e,t){return e[0]==="pt"?0:1}v=_t(y),Q=Ke[v]=$t[v](y),je=new Tl({props:{title:"高维向量？",local:"高维向量？",headingTag:"h3"}});const Ct=[Tn,fn],Oe=[];function kt(e,t){return e[0]==="pt"?0:1}N=kt(y),D=Oe[N]=Ct[N](y),ke=new Tl({props:{title:"模型头：理解数字的意义",local:"模型头：理解数字的意义",headingTag:"h3"}});const It=[Jn,bn],el=[];function gt(e,t){return e[0]==="pt"?0:1}E=gt(y),G=el[E]=It[E](y),Ne=new h({props:{code:"cHJpbnQob3V0cHV0cy5sb2dpdHMuc2hhcGUp",highlighted:'<span class="hljs-built_in">print</span>(outputs.logits.shape)',wrap:!1}});const At=[Un,dn],ll=[];function xt(e,t){return e[0]==="pt"?0:1}z=xt(y),Z=ll[z]=At[z](y),Ee=new Tl({props:{title:"对输出进行后序处理",local:"对输出进行后处理",headingTag:"h2"}}),ze=new h({props:{code:"cHJpbnQob3V0cHV0cy5sb2dpdHMp",highlighted:'<span class="hljs-built_in">print</span>(outputs.logits)',wrap:!1}});const vt=[wn,jn],sl=[];function Qt(e,t){return e[0]==="pt"?0:1}V=Qt(y),H=sl[V]=vt[V](y);const Nt=[$n,hn],tl=[];function Dt(e,t){return e[0]==="pt"?0:1}S=Dt(y),R=tl[S]=Nt[S](y);const Et=[Cn,_n],nl=[];function Gt(e,t){return e[0]==="pt"?0:1}return W=Gt(y),B=nl[W]=Et[W](y),Se=new h({props:{code:"bW9kZWwuY29uZmlnLmlkMmxhYmVs",highlighted:"model.config.id2label",wrap:!1}}),Re=new h({props:{code:"JTdCMCUzQSUyMCdORUdBVElWRSclMkMlMjAxJTNBJTIwJ1BPU0lUSVZFJyU3RA==",highlighted:'{<span class="hljs-number">0</span>: <span class="hljs-string">&#x27;NEGATIVE&#x27;</span>, <span class="hljs-number">1</span>: <span class="hljs-string">&#x27;POSITIVE&#x27;</span>}',wrap:!1}}),q=new St({props:{$$slots:{default:[kn]},$$scope:{ctx:y}}}),Fe=new ln({props:{source:"https://github.com/huggingface/course/blob/main/chapters/zh-CN/chapter2/2.mdx"}}),{c(){s=f("meta"),r=c(),l=f("p"),i=c(),J(u.$$.fragment),p=c(),J(w.$$.fragment),Jl=c(),J(K.$$.fragment),dl=c(),_.c(),al=c(),J(X.$$.fragment),Ul=c(),k.c(),rl=c(),O=f("p"),O.innerHTML=vs,jl=c(),J(ee.$$.fragment),wl=c(),le=f("p"),le.textContent=Qs,hl=c(),J(se.$$.fragment),$l=c(),te=f("p"),te.innerHTML=Ns,_l=c(),Y=f("div"),Y.innerHTML=Ds,Cl=c(),ne=f("p"),ne.textContent=Es,kl=c(),J(ae.$$.fragment),Il=c(),re=f("p"),re.textContent=Gs,gl=c(),pe=f("ul"),pe.innerHTML=zs,Al=c(),ie=f("p"),ie.innerHTML=Zs,xl=c(),ce=f("p"),ce.innerHTML=Vs,vl=c(),J(Me.$$.fragment),Ql=c(),ue=f("p"),ue.innerHTML=Hs,Nl=c(),oe=f("p"),oe.innerHTML=Ss,Dl=c(),me=f("p"),me.innerHTML=Rs,El=c(),g.c(),pl=c(),ye=f("p"),ye.textContent=Ws,Gl=c(),x.c(),il=c(),fe=f("p"),fe.innerHTML=Bs,zl=c(),J(Te.$$.fragment),Zl=c(),Q.c(),cl=c(),be=f("p"),be.textContent=Ls,Vl=c(),Je=f("p"),Je.innerHTML=Fs,Hl=c(),de=f("p"),de.textContent=Xs,Sl=c(),Ue=f("p"),Ue.innerHTML=Ys,Rl=c(),J(je.$$.fragment),Wl=c(),we=f("p"),we.textContent=Ps,Bl=c(),he=f("ul"),he.innerHTML=qs,Ll=c(),$e=f("p"),$e.textContent=Ks,Fl=c(),_e=f("p"),_e.textContent=Os,Xl=c(),D.c(),Ml=c(),Ce=f("p"),Ce.innerHTML=et,Yl=c(),J(ke.$$.fragment),Pl=c(),Ie=f("p"),Ie.textContent=lt,ql=c(),ge=f("p"),ge.textContent=st,Kl=c(),P=f("div"),P.innerHTML=tt,Ol=c(),Ae=f("p"),Ae.textContent=nt,es=c(),xe=f("p"),xe.textContent=at,ls=c(),ve=f("ul"),ve.innerHTML=rt,ss=c(),G.c(),ul=c(),Qe=f("p"),Qe.innerHTML=pt,ts=c(),J(Ne.$$.fragment),ns=c(),Z.c(),ol=c(),De=f("p"),De.textContent=it,as=c(),J(Ee.$$.fragment),rs=c(),Ge=f("p"),Ge.textContent=ct,ps=c(),J(ze.$$.fragment),is=c(),H.c(),ml=c(),Ze=f("p"),Ze.innerHTML=Mt,cs=c(),R.c(),yl=c(),B.c(),fl=c(),Ve=f("p"),Ve.innerHTML=ut,Ms=c(),He=f("p"),He.innerHTML=ot,us=c(),J(Se.$$.fragment),os=c(),J(Re.$$.fragment),ms=c(),We=f("p"),We.textContent=mt,ys=c(),Be=f("ul"),Be.innerHTML=yt,fs=c(),Le=f("p"),Le.textContent=ft,Ts=c(),J(q.$$.fragment),bs=c(),J(Fe.$$.fragment),Js=c(),bl=f("p"),this.h()},l(e){const t=Pt("svelte-u9bgzb",document.head);s=T(t,"META",{name:!0,content:!0}),t.forEach(n),r=M(e),l=T(e,"P",{}),Ht(l).forEach(n),i=M(e),d(u.$$.fragment,e),p=M(e),d(w.$$.fragment,e),Jl=M(e),d(K.$$.fragment,e),dl=M(e),_.l(e),al=M(e),d(X.$$.fragment,e),Ul=M(e),k.l(e),rl=M(e),O=T(e,"P",{"data-svelte-h":!0}),b(O)!=="svelte-1quufcj"&&(O.innerHTML=vs),jl=M(e),d(ee.$$.fragment,e),wl=M(e),le=T(e,"P",{"data-svelte-h":!0}),b(le)!=="svelte-9mk32u"&&(le.textContent=Qs),hl=M(e),d(se.$$.fragment,e),$l=M(e),te=T(e,"P",{"data-svelte-h":!0}),b(te)!=="svelte-12e1b9i"&&(te.innerHTML=Ns),_l=M(e),Y=T(e,"DIV",{class:!0,"data-svelte-h":!0}),b(Y)!=="svelte-fbe70j"&&(Y.innerHTML=Ds),Cl=M(e),ne=T(e,"P",{"data-svelte-h":!0}),b(ne)!=="svelte-bgtnom"&&(ne.textContent=Es),kl=M(e),d(ae.$$.fragment,e),Il=M(e),re=T(e,"P",{"data-svelte-h":!0}),b(re)!=="svelte-1hj6urj"&&(re.textContent=Gs),gl=M(e),pe=T(e,"UL",{"data-svelte-h":!0}),b(pe)!=="svelte-t07ups"&&(pe.innerHTML=zs),Al=M(e),ie=T(e,"P",{"data-svelte-h":!0}),b(ie)!=="svelte-mov6l8"&&(ie.innerHTML=Zs),xl=M(e),ce=T(e,"P",{"data-svelte-h":!0}),b(ce)!=="svelte-81i5fv"&&(ce.innerHTML=Vs),vl=M(e),d(Me.$$.fragment,e),Ql=M(e),ue=T(e,"P",{"data-svelte-h":!0}),b(ue)!=="svelte-1hfz0wz"&&(ue.innerHTML=Hs),Nl=M(e),oe=T(e,"P",{"data-svelte-h":!0}),b(oe)!=="svelte-1lglukt"&&(oe.innerHTML=Ss),Dl=M(e),me=T(e,"P",{"data-svelte-h":!0}),b(me)!=="svelte-13xrm4"&&(me.innerHTML=Rs),El=M(e),g.l(e),pl=M(e),ye=T(e,"P",{"data-svelte-h":!0}),b(ye)!=="svelte-vq5r4w"&&(ye.textContent=Ws),Gl=M(e),x.l(e),il=M(e),fe=T(e,"P",{"data-svelte-h":!0}),b(fe)!=="svelte-88e2df"&&(fe.innerHTML=Bs),zl=M(e),d(Te.$$.fragment,e),Zl=M(e),Q.l(e),cl=M(e),be=T(e,"P",{"data-svelte-h":!0}),b(be)!=="svelte-8mioqo"&&(be.textContent=Ls),Vl=M(e),Je=T(e,"P",{"data-svelte-h":!0}),b(Je)!=="svelte-1lxyp0x"&&(Je.innerHTML=Fs),Hl=M(e),de=T(e,"P",{"data-svelte-h":!0}),b(de)!=="svelte-1d8kvbh"&&(de.textContent=Xs),Sl=M(e),Ue=T(e,"P",{"data-svelte-h":!0}),b(Ue)!=="svelte-1tuwl71"&&(Ue.innerHTML=Ys),Rl=M(e),d(je.$$.fragment,e),Wl=M(e),we=T(e,"P",{"data-svelte-h":!0}),b(we)!=="svelte-1iqx2et"&&(we.textContent=Ps),Bl=M(e),he=T(e,"UL",{"data-svelte-h":!0}),b(he)!=="svelte-88j1pa"&&(he.innerHTML=qs),Ll=M(e),$e=T(e,"P",{"data-svelte-h":!0}),b($e)!=="svelte-lhldzs"&&($e.textContent=Ks),Fl=M(e),_e=T(e,"P",{"data-svelte-h":!0}),b(_e)!=="svelte-1n6zqkz"&&(_e.textContent=Os),Xl=M(e),D.l(e),Ml=M(e),Ce=T(e,"P",{"data-svelte-h":!0}),b(Ce)!=="svelte-15nw09q"&&(Ce.innerHTML=et),Yl=M(e),d(ke.$$.fragment,e),Pl=M(e),Ie=T(e,"P",{"data-svelte-h":!0}),b(Ie)!=="svelte-5ol48z"&&(Ie.textContent=lt),ql=M(e),ge=T(e,"P",{"data-svelte-h":!0}),b(ge)!=="svelte-14ytwag"&&(ge.textContent=st),Kl=M(e),P=T(e,"DIV",{class:!0,"data-svelte-h":!0}),b(P)!=="svelte-8mo6lt"&&(P.innerHTML=tt),Ol=M(e),Ae=T(e,"P",{"data-svelte-h":!0}),b(Ae)!=="svelte-1qqfmxp"&&(Ae.textContent=nt),es=M(e),xe=T(e,"P",{"data-svelte-h":!0}),b(xe)!=="svelte-1tckzev"&&(xe.textContent=at),ls=M(e),ve=T(e,"UL",{"data-svelte-h":!0}),b(ve)!=="svelte-8snvi5"&&(ve.innerHTML=rt),ss=M(e),G.l(e),ul=M(e),Qe=T(e,"P",{"data-svelte-h":!0}),b(Qe)!=="svelte-27lfxx"&&(Qe.innerHTML=pt),ts=M(e),d(Ne.$$.fragment,e),ns=M(e),Z.l(e),ol=M(e),De=T(e,"P",{"data-svelte-h":!0}),b(De)!=="svelte-qfxzfa"&&(De.textContent=it),as=M(e),d(Ee.$$.fragment,e),rs=M(e),Ge=T(e,"P",{"data-svelte-h":!0}),b(Ge)!=="svelte-1kuvu71"&&(Ge.textContent=ct),ps=M(e),d(ze.$$.fragment,e),is=M(e),H.l(e),ml=M(e),Ze=T(e,"P",{"data-svelte-h":!0}),b(Ze)!=="svelte-1wzsjkh"&&(Ze.innerHTML=Mt),cs=M(e),R.l(e),yl=M(e),B.l(e),fl=M(e),Ve=T(e,"P",{"data-svelte-h":!0}),b(Ve)!=="svelte-wdsaw8"&&(Ve.innerHTML=ut),Ms=M(e),He=T(e,"P",{"data-svelte-h":!0}),b(He)!=="svelte-74q99a"&&(He.innerHTML=ot),us=M(e),d(Se.$$.fragment,e),os=M(e),d(Re.$$.fragment,e),ms=M(e),We=T(e,"P",{"data-svelte-h":!0}),b(We)!=="svelte-sq0n3"&&(We.textContent=mt),ys=M(e),Be=T(e,"UL",{"data-svelte-h":!0}),b(Be)!=="svelte-2rh2"&&(Be.innerHTML=yt),fs=M(e),Le=T(e,"P",{"data-svelte-h":!0}),b(Le)!=="svelte-1daz6p4"&&(Le.textContent=ft),Ts=M(e),d(q.$$.fragment,e),bs=M(e),d(Fe.$$.fragment,e),Js=M(e),bl=T(e,"P",{}),Ht(bl).forEach(n),this.h()},h(){Us(s,"name","hf:doc:metadata"),Us(s,"content",gn),Us(Y,"class","flex justify-center"),Us(P,"class","flex justify-center")},m(e,t){qt(document.head,s),a(e,r,t),a(e,l,t),a(e,i,t),U(u,e,t),a(e,p,t),U(w,e,t),a(e,Jl,t),U(K,e,t),a(e,dl,t),Xe[$].m(e,t),a(e,al,t),U(X,e,t),a(e,Ul,t),Ye[C].m(e,t),a(e,rl,t),a(e,O,t),a(e,jl,t),U(ee,e,t),a(e,wl,t),a(e,le,t),a(e,hl,t),U(se,e,t),a(e,$l,t),a(e,te,t),a(e,_l,t),a(e,Y,t),a(e,Cl,t),a(e,ne,t),a(e,kl,t),U(ae,e,t),a(e,Il,t),a(e,re,t),a(e,gl,t),a(e,pe,t),a(e,Al,t),a(e,ie,t),a(e,xl,t),a(e,ce,t),a(e,vl,t),U(Me,e,t),a(e,Ql,t),a(e,ue,t),a(e,Nl,t),a(e,oe,t),a(e,Dl,t),a(e,me,t),a(e,El,t),Pe[I].m(e,t),a(e,pl,t),a(e,ye,t),a(e,Gl,t),qe[A].m(e,t),a(e,il,t),a(e,fe,t),a(e,zl,t),U(Te,e,t),a(e,Zl,t),Ke[v].m(e,t),a(e,cl,t),a(e,be,t),a(e,Vl,t),a(e,Je,t),a(e,Hl,t),a(e,de,t),a(e,Sl,t),a(e,Ue,t),a(e,Rl,t),U(je,e,t),a(e,Wl,t),a(e,we,t),a(e,Bl,t),a(e,he,t),a(e,Ll,t),a(e,$e,t),a(e,Fl,t),a(e,_e,t),a(e,Xl,t),Oe[N].m(e,t),a(e,Ml,t),a(e,Ce,t),a(e,Yl,t),U(ke,e,t),a(e,Pl,t),a(e,Ie,t),a(e,ql,t),a(e,ge,t),a(e,Kl,t),a(e,P,t),a(e,Ol,t),a(e,Ae,t),a(e,es,t),a(e,xe,t),a(e,ls,t),a(e,ve,t),a(e,ss,t),el[E].m(e,t),a(e,ul,t),a(e,Qe,t),a(e,ts,t),U(Ne,e,t),a(e,ns,t),ll[z].m(e,t),a(e,ol,t),a(e,De,t),a(e,as,t),U(Ee,e,t),a(e,rs,t),a(e,Ge,t),a(e,ps,t),U(ze,e,t),a(e,is,t),sl[V].m(e,t),a(e,ml,t),a(e,Ze,t),a(e,cs,t),tl[S].m(e,t),a(e,yl,t),nl[W].m(e,t),a(e,fl,t),a(e,Ve,t),a(e,Ms,t),a(e,He,t),a(e,us,t),U(Se,e,t),a(e,os,t),U(Re,e,t),a(e,ms,t),a(e,We,t),a(e,ys,t),a(e,Be,t),a(e,fs,t),a(e,Le,t),a(e,Ts,t),U(q,e,t),a(e,bs,t),U(Fe,e,t),a(e,Js,t),a(e,bl,t),ds=!0},p(e,[t]){const zt={};t&1&&(zt.fw=e[0]),u.$set(zt);let js=$;$=bt(e),$!==js&&(F(),o(Xe[js],1,1,()=>{Xe[js]=null}),L(),_=Xe[$],_||(_=Xe[$]=Tt[$](e),_.c()),m(_,1),_.m(al.parentNode,al));const Zt={};t&2&&(Zt.$$scope={dirty:t,ctx:e}),X.$set(Zt);let ws=C;C=dt(e),C!==ws&&(F(),o(Ye[ws],1,1,()=>{Ye[ws]=null}),L(),k=Ye[C],k||(k=Ye[C]=Jt[C](e),k.c()),m(k,1),k.m(rl.parentNode,rl));let hs=I;I=jt(e),I!==hs&&(F(),o(Pe[hs],1,1,()=>{Pe[hs]=null}),L(),g=Pe[I],g||(g=Pe[I]=Ut[I](e),g.c()),m(g,1),g.m(pl.parentNode,pl));let $s=A;A=ht(e),A!==$s&&(F(),o(qe[$s],1,1,()=>{qe[$s]=null}),L(),x=qe[A],x||(x=qe[A]=wt[A](e),x.c()),m(x,1),x.m(il.parentNode,il));let _s=v;v=_t(e),v!==_s&&(F(),o(Ke[_s],1,1,()=>{Ke[_s]=null}),L(),Q=Ke[v],Q||(Q=Ke[v]=$t[v](e),Q.c()),m(Q,1),Q.m(cl.parentNode,cl));let Cs=N;N=kt(e),N!==Cs&&(F(),o(Oe[Cs],1,1,()=>{Oe[Cs]=null}),L(),D=Oe[N],D||(D=Oe[N]=Ct[N](e),D.c()),m(D,1),D.m(Ml.parentNode,Ml));let ks=E;E=gt(e),E!==ks&&(F(),o(el[ks],1,1,()=>{el[ks]=null}),L(),G=el[E],G||(G=el[E]=It[E](e),G.c()),m(G,1),G.m(ul.parentNode,ul));let Is=z;z=xt(e),z!==Is&&(F(),o(ll[Is],1,1,()=>{ll[Is]=null}),L(),Z=ll[z],Z||(Z=ll[z]=At[z](e),Z.c()),m(Z,1),Z.m(ol.parentNode,ol));let gs=V;V=Qt(e),V!==gs&&(F(),o(sl[gs],1,1,()=>{sl[gs]=null}),L(),H=sl[V],H||(H=sl[V]=vt[V](e),H.c()),m(H,1),H.m(ml.parentNode,ml));let As=S;S=Dt(e),S!==As&&(F(),o(tl[As],1,1,()=>{tl[As]=null}),L(),R=tl[S],R||(R=tl[S]=Nt[S](e),R.c()),m(R,1),R.m(yl.parentNode,yl));let xs=W;W=Gt(e),W!==xs&&(F(),o(nl[xs],1,1,()=>{nl[xs]=null}),L(),B=nl[W],B||(B=nl[W]=Et[W](e),B.c()),m(B,1),B.m(fl.parentNode,fl));const Vt={};t&2&&(Vt.$$scope={dirty:t,ctx:e}),q.$set(Vt)},i(e){ds||(m(u.$$.fragment,e),m(w.$$.fragment,e),m(K.$$.fragment,e),m(_),m(X.$$.fragment,e),m(k),m(ee.$$.fragment,e),m(se.$$.fragment,e),m(ae.$$.fragment,e),m(Me.$$.fragment,e),m(g),m(x),m(Te.$$.fragment,e),m(Q),m(je.$$.fragment,e),m(D),m(ke.$$.fragment,e),m(G),m(Ne.$$.fragment,e),m(Z),m(Ee.$$.fragment,e),m(ze.$$.fragment,e),m(H),m(R),m(B),m(Se.$$.fragment,e),m(Re.$$.fragment,e),m(q.$$.fragment,e),m(Fe.$$.fragment,e),ds=!0)},o(e){o(u.$$.fragment,e),o(w.$$.fragment,e),o(K.$$.fragment,e),o(_),o(X.$$.fragment,e),o(k),o(ee.$$.fragment,e),o(se.$$.fragment,e),o(ae.$$.fragment,e),o(Me.$$.fragment,e),o(g),o(x),o(Te.$$.fragment,e),o(Q),o(je.$$.fragment,e),o(D),o(ke.$$.fragment,e),o(G),o(Ne.$$.fragment,e),o(Z),o(Ee.$$.fragment,e),o(ze.$$.fragment,e),o(H),o(R),o(B),o(Se.$$.fragment,e),o(Re.$$.fragment,e),o(q.$$.fragment,e),o(Fe.$$.fragment,e),ds=!1},d(e){e&&(n(r),n(l),n(i),n(p),n(Jl),n(dl),n(al),n(Ul),n(rl),n(O),n(jl),n(wl),n(le),n(hl),n($l),n(te),n(_l),n(Y),n(Cl),n(ne),n(kl),n(Il),n(re),n(gl),n(pe),n(Al),n(ie),n(xl),n(ce),n(vl),n(Ql),n(ue),n(Nl),n(oe),n(Dl),n(me),n(El),n(pl),n(ye),n(Gl),n(il),n(fe),n(zl),n(Zl),n(cl),n(be),n(Vl),n(Je),n(Hl),n(de),n(Sl),n(Ue),n(Rl),n(Wl),n(we),n(Bl),n(he),n(Ll),n($e),n(Fl),n(_e),n(Xl),n(Ml),n(Ce),n(Yl),n(Pl),n(Ie),n(ql),n(ge),n(Kl),n(P),n(Ol),n(Ae),n(es),n(xe),n(ls),n(ve),n(ss),n(ul),n(Qe),n(ts),n(ns),n(ol),n(De),n(as),n(rs),n(Ge),n(ps),n(is),n(ml),n(Ze),n(cs),n(yl),n(fl),n(Ve),n(Ms),n(He),n(us),n(os),n(ms),n(We),n(ys),n(Be),n(fs),n(Le),n(Ts),n(bs),n(Js),n(bl)),n(s),j(u,e),j(w,e),j(K,e),Xe[$].d(e),j(X,e),Ye[C].d(e),j(ee,e),j(se,e),j(ae,e),j(Me,e),Pe[I].d(e),qe[A].d(e),j(Te,e),Ke[v].d(e),j(je,e),Oe[N].d(e),j(ke,e),el[E].d(e),j(Ne,e),ll[z].d(e),j(Ee,e),j(ze,e),sl[V].d(e),tl[S].d(e),nl[W].d(e),j(Se,e),j(Re,e),j(q,e),j(Fe,e)}}}const gn='{"title":"Pipeline 的内部","local":"Pipeline 的内部","sections":[{"title":"使用 tokenizer（ tokenizer ）进行预处理","local":"使用 tokenizer（ tokenizer ）进行预处理","sections":[],"depth":2},{"title":"探索模型","local":"探索模型","sections":[{"title":"高维向量？","local":"高维向量？","sections":[],"depth":3},{"title":"模型头：理解数字的意义","local":"模型头：理解数字的意义","sections":[],"depth":3}],"depth":2},{"title":"对输出进行后序处理","local":"对输出进行后处理","sections":[],"depth":2}],"depth":1}';function An(y,s,r){let l="pt";return Lt(()=>{const i=new URLSearchParams(window.location.search);r(0,l=i.get("fw")||"pt")}),[l]}class Zn extends Xt{constructor(s){super(),Yt(this,s,An,In,Bt,{})}}export{Zn as component};
