import{s as Ht,o as St,n as Wt}from"../chunks/scheduler.37c15a92.js";import{S as zt,i as Rt,g as f,s as c,r as J,A as Lt,h as T,f as n,c as M,j as Et,u as U,x as b,k as Ts,y as Bt,a,v as j,t as o,b as B,d as m,w,m as Ft,n as Xt,p as F}from"../chunks/index.2bf4358c.js";import{T as Gt}from"../chunks/Tip.363c041f.js";import{Y as Zt}from"../chunks/Youtube.1e50a667.js";import{C as h}from"../chunks/CodeBlock.4f5fc1ad.js";import{C as Vt}from"../chunks/CourseFloatingBanner.06521e8b.js";import{F as Yt}from"../chunks/FrameworkSwitchCourse.8d4d4ab6.js";import{H as yl,E as Pt}from"../chunks/EditOnGithub.8916dc7c.js";function qt(y){let s,r;return s=new Vt({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){U(s.$$.fragment,l)},m(l,i){j(s,l,i),r=!0},i(l){r||(m(s.$$.fragment,l),r=!0)},o(l){o(s.$$.fragment,l),r=!1},d(l){w(s,l)}}}function Kt(y){let s,r;return s=new Vt({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){U(s.$$.fragment,l)},m(l,i){j(s,l,i),r=!0},i(l){r||(m(s.$$.fragment,l),r=!0)},o(l){o(s.$$.fragment,l),r=!1},d(l){w(s,l)}}}function Ot(y){let s;return{c(){s=Ft("这是第一部分，根据您使用PyTorch或者TensorFlow，内容略有不同。点击标题上方的平台，选择您喜欢的平台！")},l(r){s=Xt(r,"这是第一部分，根据您使用PyTorch或者TensorFlow，内容略有不同。点击标题上方的平台，选择您喜欢的平台！")},m(r,l){a(r,s,l)},d(r){r&&n(s)}}}function en(y){let s,r;return s=new Zt({props:{id:"wVN12smEvqg"}}),{c(){J(s.$$.fragment)},l(l){U(s.$$.fragment,l)},m(l,i){j(s,l,i),r=!0},i(l){r||(m(s.$$.fragment,l),r=!0)},o(l){o(s.$$.fragment,l),r=!1},d(l){w(s,l)}}}function ln(y){let s,r;return s=new Zt({props:{id:"1pedAIvTWXk"}}),{c(){J(s.$$.fragment)},l(l){U(s.$$.fragment,l)},m(l,i){j(s,l,i),r=!0},i(l){r||(m(s.$$.fragment,l),r=!0)},o(l){o(s.$$.fragment,l),r=!1},d(l){w(s,l)}}}function sn(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){U(s.$$.fragment,l)},m(l,i){j(s,l,i),r=!0},i(l){r||(m(s.$$.fragment,l),r=!0)},o(l){o(s.$$.fragment,l),r=!1},d(l){w(s,l)}}}function tn(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){U(s.$$.fragment,l)},m(l,i){j(s,l,i),r=!0},i(l){r||(m(s.$$.fragment,l),r=!0)},o(l){o(s.$$.fragment,l),r=!1},d(l){w(s,l)}}}function nn(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-72qyl2"&&(s.textContent=r),l=M(p),U(i.$$.fragment,p)},m(p,d){a(p,s,d),a(p,l,d),j(i,p,d),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)),w(i,p)}}}function an(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-16afy86"&&(s.textContent=r),l=M(p),U(i.$$.fragment,p)},m(p,d){a(p,s,d),a(p,l,d),j(i,p,d),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)),w(i,p)}}}function rn(y){let s,r="我们可以像使用<em>tokenizer</em>一样下载预训练模型。🤗 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-kwgpu3"&&(s.innerHTML=r),l=M(p),U(i.$$.fragment,p)},m(p,d){a(p,s,d),a(p,l,d),j(i,p,d),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)),w(i,p)}}}function pn(y){let s,r="我们可以像使用<em>tokenizer</em>一样下载预训练模型。🤗 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-kwgpu3"&&(s.innerHTML=r),l=M(p),U(i.$$.fragment,p)},m(p,d){a(p,s,d),a(p,l,d),j(i,p,d),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)),w(i,p)}}}function cn(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){U(s.$$.fragment,u),r=M(u),U(l.$$.fragment,u)},m(u,p){j(s,u,p),a(u,r,p),j(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),w(s,u),w(l,u)}}}function Mn(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){U(s.$$.fragment,u),r=M(u),U(l.$$.fragment,u)},m(u,p){j(s,u,p),a(u,r,p),j(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),w(s,u),w(l,u)}}}function un(y){let s,r="For our example, we will need a model with a sequence classification head (to be able to classify the sentences as positive or negative). So, we won’t actually use the <code>TFAutoModel</code> class, but <code>TFAutoModelForSequenceClassification</code>:",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-6up9xi"&&(s.innerHTML=r),l=M(p),U(i.$$.fragment,p)},m(p,d){a(p,s,d),a(p,l,d),j(i,p,d),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)),w(i,p)}}}function on(y){let s,r=`对于我们的示例，我们需要一个带有序列分类头部的模型（能够将句子分类为肯定或否定）。 因此，我们实际上不会使用 <code>AutoModel</code> 类，而是使用 <code>AutoModelForSequenceClassification</code>(<code>AutoModel</code> 类只包含基本的 Transformer 模块，它可以提取文本的特征，但不能进行分类。
<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-1wwo5g0"&&(s.innerHTML=r),l=M(p),U(i.$$.fragment,p)},m(p,d){a(p,s,d),a(p,l,d),j(i,p,d),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)),w(i,p)}}}function mn(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){U(s.$$.fragment,l)},m(l,i){j(s,l,i),r=!0},i(l){r||(m(s.$$.fragment,l),r=!0)},o(l){o(s.$$.fragment,l),r=!1},d(l){w(s,l)}}}function yn(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){U(s.$$.fragment,l)},m(l,i){j(s,l,i),r=!0},i(l){r||(m(s.$$.fragment,l),r=!0)},o(l){o(s.$$.fragment,l),r=!1},d(l){w(s,l)}}}function fn(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){U(s.$$.fragment,l)},m(l,i){j(s,l,i),r=!0},i(l){r||(m(s.$$.fragment,l),r=!0)},o(l){o(s.$$.fragment,l),r=!1},d(l){w(s,l)}}}function Tn(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){U(s.$$.fragment,l)},m(l,i){j(s,l,i),r=!0},i(l){r||(m(s.$$.fragment,l),r=!0)},o(l){o(s.$$.fragment,l),r=!1},d(l){w(s,l)}}}function bn(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){U(s.$$.fragment,l)},m(l,i){j(s,l,i),r=!0},i(l){r||(m(s.$$.fragment,l),r=!0)},o(l){o(s.$$.fragment,l),r=!1},d(l){w(s,l)}}}function Jn(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){U(s.$$.fragment,l)},m(l,i){j(s,l,i),r=!0},i(l){r||(m(s.$$.fragment,l),r=!0)},o(l){o(s.$$.fragment,l),r=!1},d(l){w(s,l)}}}function Un(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){U(s.$$.fragment,l)},m(l,i){j(s,l,i),r=!0},i(l){r||(m(s.$$.fragment,l),r=!0)},o(l){o(s.$$.fragment,l),r=!1},d(l){w(s,l)}}}function jn(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){U(s.$$.fragment,l)},m(l,i){j(s,l,i),r=!0},i(l){r||(m(s.$$.fragment,l),r=!0)},o(l){o(s.$$.fragment,l),r=!1},d(l){w(s,l)}}}function wn(y){let s,r="✏️ <strong>试试看！</strong> 选择两个（或更多）你自己的文本并在管道中运行它们。然后自己复制在这里看到的步骤，并检查是否获得相同的结果！";return{c(){s=f("p"),s.innerHTML=r},l(l){s=T(l,"P",{"data-svelte-h":!0}),b(s)!=="svelte-ro1h4d"&&(s.innerHTML=r)},m(l,i){a(l,s,i)},p:Wt,d(l){l&&n(s)}}}function dn(y){let s,r,l,i,u,p,d,Tl,_,$,tl,X,bl,C,k,nl,K,Is='让我们从一个完整的示例开始，看看在<a href="/course/chapter1">Chapter 1</a>中执行以下代码时在幕后发生了什么',Jl,O,Ul,ee,gs="获得:",jl,le,wl,se,As='正如我们在<a href="/course/chapter1">Chapter 1</a>中看到的，这个 pipeline 集成了三个步骤：预处理、模型推理和后处理:',dl,Y,vs='<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."/>',hl,te,xs="让我们快速浏览一下这些内容。",_l,ne,$l,ae,Qs="与其他神经网络一样，Transformer模型无法直接处理原始文本， 因此pipeline的第一步是将文本输入转换为模型能够理解的数字。 为此，我们使用<em>tokenizer</em>(分词器)，负责：",Cl,re,Ns="<li>将输入拆分为单词、子单词或符号（如标点符号），称为标记(<em>token</em>)</li> <li>将每个标记(token)映射到一个整数</li> <li>添加其他可能对模型有用的输入：例如，位置编码等信息。</li> <li><ul><li>位置编码：指示每个词元在句子中的位置。</li></ul></li> <li><ul><li>段落标记：区分不同段落的文本。</li></ul></li> <li><ul><li>特殊标记：例如 [CLS] 和 [SEP] 标记，用于标识句子的开头和结尾。</li></ul></li>",kl,pe,Ds='所有预处理都需要以与模型预训练时完全相同的方式完成(保持分词方式的一致性非常重要，可以确保模型的性能和准确性)，因此我们首先需要从<a href="https://huggingface.co/models" rel="nofollow">Model Hub</a>中下载这些信息。为此，我们使用<code>AutoTokenizer</code>类及其<code>from_pretrained()</code>方法。使用我们模型的检查点名称，它将自动获取与模型的标记器相关联的数据，并对其进行缓存（因此只有在您第一次运行下面的代码时才会下载）。',Il,ie,Es='因为<code>sentiment-analysis</code>（情绪分析）Pipeline的默认检查点是<code>distilbert-base-uncased-finetuned-sst-2-english</code>（你可以看到它的模型介绍页<a href="https://huggingface.co/distilbert-base-uncased-finetuned-sst-2-english" rel="nofollow">here</a>)，我们运行以下程序：',gl,ce,Al,Me,Gs="一旦我们有了tokenizer，就可以直接将句子传递给它，然后我们会得到一个字典，它包含了可以输入到模型的数据。接下来，我们只需要将输入 ID 列表转换为张量即可。",vl,ue,Zs="使用 🤗 Transformers 时，您无需担心它背后的机器学习框架，它可以是 PyTorch、TensorFlow或 Flax。不过，Transformer 模型只接受<em>张量</em>作为输入。如果您不熟悉张量，可以把它看作 NumPy 数组。NumPy 数组可以是标量 (0D)、向量 (1D)、矩阵 (2D) 或更高维度的数组，本质上就是一个张量。其他机器学习框架中的张量也类似，通常与 NumPy 数组一样容易创建。",xl,oe,Vs="要指定要返回的张量类型（PyTorch、TensorFlow或plain NumPy），我们使用<code>return_tensors</code>参数：",Ql,I,g,al,me,Hs="暂时不用担心填充和截断，我们稍后会解释它们。这里主要需要记住的是，您可以传入单个句子或句子列表，并指定想要返回的张量类型（如果不指定类型，则会返回嵌套列表）。",Nl,A,v,rl,ye,Ss="输出本身是一个包含两个键的字典，<code>input_ids</code> 和 <code>attention_mask</code>。 <code>input_ids</code> 包含两行整数（每个句子一行），它们是每个句子中各个 token 的唯一标识符。我们将在本章后面解释 <code>attention_mask</code> 的作用。",Dl,fe,El,x,Q,pl,Te,Ws="在这段代码中，我们加载了之前在 pipeline 中使用的相同检查点（实际上它应该已经被缓存）并用它实例化了一个模型。",Gl,be,zs=`这个架构只包含基本的 Transformer 模块：给定一些输入，它会输出我们称之为<em>隐藏状态 (hidden states)</em> 的内容，也称为<em>特征 (features)</em>。对于每个模型输入，我们将检索一个高维向量，该向量表示 <strong>Transformer 模型对该输入的上下文理解</strong>。
如果你现在对隐藏状态和上下文理解的概念还不理解，也不用担心，我们会在后续的内容中详细解释这些概念，并举例说明它们是如何工作的。`,Zl,Je,Rs='虽然这些隐藏状态本身可能很有用，但它们通常作为下游任务的输入，例如模型<em>头部(head)</em>的输入。在<a href="/course/chapter1">Chapter 1</a>中，我们介绍了可以使用相同的架构执行不同的任务，但每个任务都会有不同的头部与之关联。',Vl,Ue,Hl,je,Ls="Transformers模块的向量输出通常较大。它通常有三个维度：",Sl,we,Bs="<li><strong>批次大小(Batch size)</strong>: 一次处理的序列数（在我们的示例中为2）。</li> <li><strong>序列长度 (Sequence length)</strong>: 序列的数值表示的长度（在我们的示例中为16）。</li> <li><strong>隐藏层维度(Hidden size)</strong>: 每个模型输入的向量维度。</li>",Wl,de,Fs="之所以说它是“高维度”的，是因为最后一个维度值。隐藏层维度可以非常大（对于较小的模型768 是常见的，而在较大的模型中，它可以达到 3072 或更多）。",zl,he,Xs="我们可以通过将预处理后的输入数据传递给模型来验证这一点：",Rl,N,D,il,_e,Ys="🤗 Transformers 模型的输出类似于 <code>namedtuple</code> 或字典。您可以通过属性 (就像我们之前所做的那样) 或键 (例如<code>outputs[&quot;last_hidden_state&quot;]</code>) 来访问元素，甚至可以通过索引访问元素 (例如 <code>outputs[0]</code>)，前提是您知道要查找的内容的位置。",Ll,$e,Bl,Ce,Ps="模型头接收隐藏状态的高维向量作为输入，并将其映射到另一个维度。它们通常由一个或几个线性层构成：",Fl,P,qs='<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."/>',Xl,ke,Ks="Transformers模型的输出直接发送到模型头进行处理。",Yl,Ie,Os="在此图中，模型由其嵌入层和后续层表示。嵌入层将标记化输入中的每个输入ID转换为表示关联标记(token)的向量。后续层使用注意机制操纵这些向量，以生成句子的最终表示。",Pl,ge,et="🤗 Transformers中有许多不同的体系结构，每种体系结构都是围绕处理特定任务而设计的。以下是一个非详尽的列表：",ql,Ae,lt="<li><code>*Model</code> (retrieve the hidden states)</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>",Kl,E,G,cl,ve,st=`现在，如果我们观察输出的shape，维度将低得多：模型头将我们之前看到的高维向量作为输入，并输出包含两个值的向量（每个标签一个）：
正如您所见，输出向量的尺寸与输入向量相比要小得多。这是因为模型头将输入向量中的信息压缩成两个值，每个标签一个`,Ol,xe,es,Z,V,Ml,Qe,tt="因为我们只有两个句子和两个标签，所以我们从模型中得到的结果是2 x 2的维度。",ls,Ne,ss,De,nt="我们从模型中得到的输出值本身并不一定有意义。我们来看看,",ts,Ee,ns,H,S,ul,Ge,at='我们的模型预测第一句为 <code>[-1.5607, 1.6123]</code>，第二句为 <code>[4.1692, -3.3464]</code>。这些不是概率，而是 <em>logits</em>，即模型最后一层输出的原始、未经归一化的分数。为了将其转换为概率，它们需要经过<a href="https://en.wikipedia.org/wiki/Softmax_function" rel="nofollow">SoftMax</a>层（所有 🤗 Transformers 模型都输出 logits，因为用于训练的损失函数通常会将最后的激活函数（例如 SoftMax）与实际的损失函数（例如交叉熵）融合在一起。',as,W,z,ol,R,L,ml,Ze,rt="现在我们可以看到，模型预测第一句为<code>[0.0402, 0.9598]</code>，第二句为<code>[0.9995, 0.0005]</code>。这些数字代表了模型预测每个类别（否定或肯定）的概率分值。",rs,Ve,pt=`为了获得每个位置对应的标签，我们可以检查模型配置的<code>id2label</code>属性（下一节将对此进行详细介绍）：
为了将这些概率分值转换为可识别的标签（“否定”或“肯定”），我们需要参考模型配置中的 id2label 属性。该属性将每个模型输出的 ID 映射到相应的标签。`,ps,He,is,Se,cs,We,it="根据 id2label 属性，我们可以得出以下结论：",Ms,ze,ct="<li>第一句：否定：0.0402，肯定：0.9598</li> <li>第二句：否定：0.9995，肯定：0.0005</li>",us,Re,Mt="至此，我们已经成功完成了文本分类任务的三个步骤：使用<em>tokenizer</em>对文本进行预处理;将预处理后的文本输入到模型中;对模型的输出结果进行后处理,并将预测结果转换为可识别的标签。接下来，我们将对这三个步骤进行更详细的解释。",os,q,ms,Le,ys,fl,fs;u=new Yt({props:{fw:y[0]}}),d=new yl({props:{title:"管道的内部",local:"管道的内部",headingTag:"h1"}});const ut=[Kt,qt],Be=[];function ot(e,t){return e[0]==="pt"?0:1}_=ot(y),$=Be[_]=ut[_](y),X=new Gt({props:{$$slots:{default:[Ot]},$$scope:{ctx:y}}});const mt=[ln,en],Fe=[];function yt(e,t){return e[0]==="pt"?0:1}C=yt(y),k=Fe[C]=mt[C](y),O=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}}),le=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}}),ne=new yl({props:{title:"使用分词器进行预处理",local:"使用分词器进行预处理",headingTag:"h2"}}),ce=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 ft=[tn,sn],Xe=[];function Tt(e,t){return e[0]==="pt"?0:1}I=Tt(y),g=Xe[I]=ft[I](y);const bt=[an,nn],Ye=[];function Jt(e,t){return e[0]==="pt"?0:1}A=Jt(y),v=Ye[A]=bt[A](y),fe=new yl({props:{title:"模型推理",local:"模型推理",headingTag:"h2"}});const Ut=[pn,rn],Pe=[];function jt(e,t){return e[0]==="pt"?0:1}x=jt(y),Q=Pe[x]=Ut[x](y),Ue=new yl({props:{title:"高维向量？",local:"高维向量？",headingTag:"h3"}});const wt=[Mn,cn],qe=[];function dt(e,t){return e[0]==="pt"?0:1}N=dt(y),D=qe[N]=wt[N](y),$e=new yl({props:{title:"模型头：数值的意义",local:"模型头：从数值中提取意义",headingTag:"h3"}});const ht=[on,un],Ke=[];function _t(e,t){return e[0]==="pt"?0:1}E=_t(y),G=Ke[E]=ht[E](y),xe=new h({props:{code:"cHJpbnQob3V0cHV0cy5sb2dpdHMuc2hhcGUp",highlighted:'<span class="hljs-built_in">print</span>(outputs.logits.shape)',wrap:!1}});const $t=[yn,mn],Oe=[];function Ct(e,t){return e[0]==="pt"?0:1}Z=Ct(y),V=Oe[Z]=$t[Z](y),Ne=new yl({props:{title:"对输出进行后处理",local:"对输出进行后处理",headingTag:"h2"}}),Ee=new h({props:{code:"cHJpbnQob3V0cHV0cy5sb2dpdHMp",highlighted:'<span class="hljs-built_in">print</span>(outputs.logits)',wrap:!1}});const kt=[Tn,fn],el=[];function It(e,t){return e[0]==="pt"?0:1}H=It(y),S=el[H]=kt[H](y);const gt=[Jn,bn],ll=[];function At(e,t){return e[0]==="pt"?0:1}W=At(y),z=ll[W]=gt[W](y);const vt=[jn,Un],sl=[];function xt(e,t){return e[0]==="pt"?0:1}return R=xt(y),L=sl[R]=vt[R](y),He=new h({props:{code:"bW9kZWwuY29uZmlnLmlkMmxhYmVs",highlighted:"model.config.id2label",wrap:!1}}),Se=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 Gt({props:{$$slots:{default:[wn]},$$scope:{ctx:y}}}),Le=new Pt({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(d.$$.fragment),Tl=c(),$.c(),tl=c(),J(X.$$.fragment),bl=c(),k.c(),nl=c(),K=f("p"),K.innerHTML=Is,Jl=c(),J(O.$$.fragment),Ul=c(),ee=f("p"),ee.textContent=gs,jl=c(),J(le.$$.fragment),wl=c(),se=f("p"),se.innerHTML=As,dl=c(),Y=f("div"),Y.innerHTML=vs,hl=c(),te=f("p"),te.textContent=xs,_l=c(),J(ne.$$.fragment),$l=c(),ae=f("p"),ae.innerHTML=Qs,Cl=c(),re=f("ul"),re.innerHTML=Ns,kl=c(),pe=f("p"),pe.innerHTML=Ds,Il=c(),ie=f("p"),ie.innerHTML=Es,gl=c(),J(ce.$$.fragment),Al=c(),Me=f("p"),Me.textContent=Gs,vl=c(),ue=f("p"),ue.innerHTML=Zs,xl=c(),oe=f("p"),oe.innerHTML=Vs,Ql=c(),g.c(),al=c(),me=f("p"),me.textContent=Hs,Nl=c(),v.c(),rl=c(),ye=f("p"),ye.innerHTML=Ss,Dl=c(),J(fe.$$.fragment),El=c(),Q.c(),pl=c(),Te=f("p"),Te.textContent=Ws,Gl=c(),be=f("p"),be.innerHTML=zs,Zl=c(),Je=f("p"),Je.innerHTML=Rs,Vl=c(),J(Ue.$$.fragment),Hl=c(),je=f("p"),je.textContent=Ls,Sl=c(),we=f("ul"),we.innerHTML=Bs,Wl=c(),de=f("p"),de.textContent=Fs,zl=c(),he=f("p"),he.textContent=Xs,Rl=c(),D.c(),il=c(),_e=f("p"),_e.innerHTML=Ys,Ll=c(),J($e.$$.fragment),Bl=c(),Ce=f("p"),Ce.textContent=Ps,Fl=c(),P=f("div"),P.innerHTML=qs,Xl=c(),ke=f("p"),ke.textContent=Ks,Yl=c(),Ie=f("p"),Ie.textContent=Os,Pl=c(),ge=f("p"),ge.textContent=et,ql=c(),Ae=f("ul"),Ae.innerHTML=lt,Kl=c(),G.c(),cl=c(),ve=f("p"),ve.textContent=st,Ol=c(),J(xe.$$.fragment),es=c(),V.c(),Ml=c(),Qe=f("p"),Qe.textContent=tt,ls=c(),J(Ne.$$.fragment),ss=c(),De=f("p"),De.textContent=nt,ts=c(),J(Ee.$$.fragment),ns=c(),S.c(),ul=c(),Ge=f("p"),Ge.innerHTML=at,as=c(),z.c(),ol=c(),L.c(),ml=c(),Ze=f("p"),Ze.innerHTML=rt,rs=c(),Ve=f("p"),Ve.innerHTML=pt,ps=c(),J(He.$$.fragment),is=c(),J(Se.$$.fragment),cs=c(),We=f("p"),We.textContent=it,Ms=c(),ze=f("ul"),ze.innerHTML=ct,us=c(),Re=f("p"),Re.innerHTML=Mt,os=c(),J(q.$$.fragment),ms=c(),J(Le.$$.fragment),ys=c(),fl=f("p"),this.h()},l(e){const t=Lt("svelte-u9bgzb",document.head);s=T(t,"META",{name:!0,content:!0}),t.forEach(n),r=M(e),l=T(e,"P",{}),Et(l).forEach(n),i=M(e),U(u.$$.fragment,e),p=M(e),U(d.$$.fragment,e),Tl=M(e),$.l(e),tl=M(e),U(X.$$.fragment,e),bl=M(e),k.l(e),nl=M(e),K=T(e,"P",{"data-svelte-h":!0}),b(K)!=="svelte-1j8jsnx"&&(K.innerHTML=Is),Jl=M(e),U(O.$$.fragment,e),Ul=M(e),ee=T(e,"P",{"data-svelte-h":!0}),b(ee)!=="svelte-dmlqno"&&(ee.textContent=gs),jl=M(e),U(le.$$.fragment,e),wl=M(e),se=T(e,"P",{"data-svelte-h":!0}),b(se)!=="svelte-wy2o2m"&&(se.innerHTML=As),dl=M(e),Y=T(e,"DIV",{class:!0,"data-svelte-h":!0}),b(Y)!=="svelte-fbe70j"&&(Y.innerHTML=vs),hl=M(e),te=T(e,"P",{"data-svelte-h":!0}),b(te)!=="svelte-k97r7m"&&(te.textContent=xs),_l=M(e),U(ne.$$.fragment,e),$l=M(e),ae=T(e,"P",{"data-svelte-h":!0}),b(ae)!=="svelte-l11xay"&&(ae.innerHTML=Qs),Cl=M(e),re=T(e,"UL",{"data-svelte-h":!0}),b(re)!=="svelte-hj2a7e"&&(re.innerHTML=Ns),kl=M(e),pe=T(e,"P",{"data-svelte-h":!0}),b(pe)!=="svelte-1n23if5"&&(pe.innerHTML=Ds),Il=M(e),ie=T(e,"P",{"data-svelte-h":!0}),b(ie)!=="svelte-ct9zmp"&&(ie.innerHTML=Es),gl=M(e),U(ce.$$.fragment,e),Al=M(e),Me=T(e,"P",{"data-svelte-h":!0}),b(Me)!=="svelte-159bk9g"&&(Me.textContent=Gs),vl=M(e),ue=T(e,"P",{"data-svelte-h":!0}),b(ue)!=="svelte-1ls0umr"&&(ue.innerHTML=Zs),xl=M(e),oe=T(e,"P",{"data-svelte-h":!0}),b(oe)!=="svelte-m68pv9"&&(oe.innerHTML=Vs),Ql=M(e),g.l(e),al=M(e),me=T(e,"P",{"data-svelte-h":!0}),b(me)!=="svelte-1lsp135"&&(me.textContent=Hs),Nl=M(e),v.l(e),rl=M(e),ye=T(e,"P",{"data-svelte-h":!0}),b(ye)!=="svelte-eqbw7n"&&(ye.innerHTML=Ss),Dl=M(e),U(fe.$$.fragment,e),El=M(e),Q.l(e),pl=M(e),Te=T(e,"P",{"data-svelte-h":!0}),b(Te)!=="svelte-1s12j5w"&&(Te.textContent=Ws),Gl=M(e),be=T(e,"P",{"data-svelte-h":!0}),b(be)!=="svelte-7zytmg"&&(be.innerHTML=zs),Zl=M(e),Je=T(e,"P",{"data-svelte-h":!0}),b(Je)!=="svelte-r2ui8f"&&(Je.innerHTML=Rs),Vl=M(e),U(Ue.$$.fragment,e),Hl=M(e),je=T(e,"P",{"data-svelte-h":!0}),b(je)!=="svelte-15nf7zo"&&(je.textContent=Ls),Sl=M(e),we=T(e,"UL",{"data-svelte-h":!0}),b(we)!=="svelte-h1yiys"&&(we.innerHTML=Bs),Wl=M(e),de=T(e,"P",{"data-svelte-h":!0}),b(de)!=="svelte-1hd2x17"&&(de.textContent=Fs),zl=M(e),he=T(e,"P",{"data-svelte-h":!0}),b(he)!=="svelte-1mxyrh5"&&(he.textContent=Xs),Rl=M(e),D.l(e),il=M(e),_e=T(e,"P",{"data-svelte-h":!0}),b(_e)!=="svelte-yitw94"&&(_e.innerHTML=Ys),Ll=M(e),U($e.$$.fragment,e),Bl=M(e),Ce=T(e,"P",{"data-svelte-h":!0}),b(Ce)!=="svelte-1ttrp1v"&&(Ce.textContent=Ps),Fl=M(e),P=T(e,"DIV",{class:!0,"data-svelte-h":!0}),b(P)!=="svelte-8mo6lt"&&(P.innerHTML=qs),Xl=M(e),ke=T(e,"P",{"data-svelte-h":!0}),b(ke)!=="svelte-18kk9ur"&&(ke.textContent=Ks),Yl=M(e),Ie=T(e,"P",{"data-svelte-h":!0}),b(Ie)!=="svelte-1gv9jev"&&(Ie.textContent=Os),Pl=M(e),ge=T(e,"P",{"data-svelte-h":!0}),b(ge)!=="svelte-10fdlre"&&(ge.textContent=et),ql=M(e),Ae=T(e,"UL",{"data-svelte-h":!0}),b(Ae)!=="svelte-dcpvgx"&&(Ae.innerHTML=lt),Kl=M(e),G.l(e),cl=M(e),ve=T(e,"P",{"data-svelte-h":!0}),b(ve)!=="svelte-sehdme"&&(ve.textContent=st),Ol=M(e),U(xe.$$.fragment,e),es=M(e),V.l(e),Ml=M(e),Qe=T(e,"P",{"data-svelte-h":!0}),b(Qe)!=="svelte-8wvk1s"&&(Qe.textContent=tt),ls=M(e),U(Ne.$$.fragment,e),ss=M(e),De=T(e,"P",{"data-svelte-h":!0}),b(De)!=="svelte-1eacukd"&&(De.textContent=nt),ts=M(e),U(Ee.$$.fragment,e),ns=M(e),S.l(e),ul=M(e),Ge=T(e,"P",{"data-svelte-h":!0}),b(Ge)!=="svelte-k8rzby"&&(Ge.innerHTML=at),as=M(e),z.l(e),ol=M(e),L.l(e),ml=M(e),Ze=T(e,"P",{"data-svelte-h":!0}),b(Ze)!=="svelte-v9bc8u"&&(Ze.innerHTML=rt),rs=M(e),Ve=T(e,"P",{"data-svelte-h":!0}),b(Ve)!=="svelte-1pepvuf"&&(Ve.innerHTML=pt),ps=M(e),U(He.$$.fragment,e),is=M(e),U(Se.$$.fragment,e),cs=M(e),We=T(e,"P",{"data-svelte-h":!0}),b(We)!=="svelte-qoaaxi"&&(We.textContent=it),Ms=M(e),ze=T(e,"UL",{"data-svelte-h":!0}),b(ze)!=="svelte-hx5asi"&&(ze.innerHTML=ct),us=M(e),Re=T(e,"P",{"data-svelte-h":!0}),b(Re)!=="svelte-1oi1kbl"&&(Re.innerHTML=Mt),os=M(e),U(q.$$.fragment,e),ms=M(e),U(Le.$$.fragment,e),ys=M(e),fl=T(e,"P",{}),Et(fl).forEach(n),this.h()},h(){Ts(s,"name","hf:doc:metadata"),Ts(s,"content",hn),Ts(Y,"class","flex justify-center"),Ts(P,"class","flex justify-center")},m(e,t){Bt(document.head,s),a(e,r,t),a(e,l,t),a(e,i,t),j(u,e,t),a(e,p,t),j(d,e,t),a(e,Tl,t),Be[_].m(e,t),a(e,tl,t),j(X,e,t),a(e,bl,t),Fe[C].m(e,t),a(e,nl,t),a(e,K,t),a(e,Jl,t),j(O,e,t),a(e,Ul,t),a(e,ee,t),a(e,jl,t),j(le,e,t),a(e,wl,t),a(e,se,t),a(e,dl,t),a(e,Y,t),a(e,hl,t),a(e,te,t),a(e,_l,t),j(ne,e,t),a(e,$l,t),a(e,ae,t),a(e,Cl,t),a(e,re,t),a(e,kl,t),a(e,pe,t),a(e,Il,t),a(e,ie,t),a(e,gl,t),j(ce,e,t),a(e,Al,t),a(e,Me,t),a(e,vl,t),a(e,ue,t),a(e,xl,t),a(e,oe,t),a(e,Ql,t),Xe[I].m(e,t),a(e,al,t),a(e,me,t),a(e,Nl,t),Ye[A].m(e,t),a(e,rl,t),a(e,ye,t),a(e,Dl,t),j(fe,e,t),a(e,El,t),Pe[x].m(e,t),a(e,pl,t),a(e,Te,t),a(e,Gl,t),a(e,be,t),a(e,Zl,t),a(e,Je,t),a(e,Vl,t),j(Ue,e,t),a(e,Hl,t),a(e,je,t),a(e,Sl,t),a(e,we,t),a(e,Wl,t),a(e,de,t),a(e,zl,t),a(e,he,t),a(e,Rl,t),qe[N].m(e,t),a(e,il,t),a(e,_e,t),a(e,Ll,t),j($e,e,t),a(e,Bl,t),a(e,Ce,t),a(e,Fl,t),a(e,P,t),a(e,Xl,t),a(e,ke,t),a(e,Yl,t),a(e,Ie,t),a(e,Pl,t),a(e,ge,t),a(e,ql,t),a(e,Ae,t),a(e,Kl,t),Ke[E].m(e,t),a(e,cl,t),a(e,ve,t),a(e,Ol,t),j(xe,e,t),a(e,es,t),Oe[Z].m(e,t),a(e,Ml,t),a(e,Qe,t),a(e,ls,t),j(Ne,e,t),a(e,ss,t),a(e,De,t),a(e,ts,t),j(Ee,e,t),a(e,ns,t),el[H].m(e,t),a(e,ul,t),a(e,Ge,t),a(e,as,t),ll[W].m(e,t),a(e,ol,t),sl[R].m(e,t),a(e,ml,t),a(e,Ze,t),a(e,rs,t),a(e,Ve,t),a(e,ps,t),j(He,e,t),a(e,is,t),j(Se,e,t),a(e,cs,t),a(e,We,t),a(e,Ms,t),a(e,ze,t),a(e,us,t),a(e,Re,t),a(e,os,t),j(q,e,t),a(e,ms,t),j(Le,e,t),a(e,ys,t),a(e,fl,t),fs=!0},p(e,[t]){const Qt={};t&1&&(Qt.fw=e[0]),u.$set(Qt);let bs=_;_=ot(e),_!==bs&&(F(),o(Be[bs],1,1,()=>{Be[bs]=null}),B(),$=Be[_],$||($=Be[_]=ut[_](e),$.c()),m($,1),$.m(tl.parentNode,tl));const Nt={};t&2&&(Nt.$$scope={dirty:t,ctx:e}),X.$set(Nt);let Js=C;C=yt(e),C!==Js&&(F(),o(Fe[Js],1,1,()=>{Fe[Js]=null}),B(),k=Fe[C],k||(k=Fe[C]=mt[C](e),k.c()),m(k,1),k.m(nl.parentNode,nl));let Us=I;I=Tt(e),I!==Us&&(F(),o(Xe[Us],1,1,()=>{Xe[Us]=null}),B(),g=Xe[I],g||(g=Xe[I]=ft[I](e),g.c()),m(g,1),g.m(al.parentNode,al));let js=A;A=Jt(e),A!==js&&(F(),o(Ye[js],1,1,()=>{Ye[js]=null}),B(),v=Ye[A],v||(v=Ye[A]=bt[A](e),v.c()),m(v,1),v.m(rl.parentNode,rl));let ws=x;x=jt(e),x!==ws&&(F(),o(Pe[ws],1,1,()=>{Pe[ws]=null}),B(),Q=Pe[x],Q||(Q=Pe[x]=Ut[x](e),Q.c()),m(Q,1),Q.m(pl.parentNode,pl));let ds=N;N=dt(e),N!==ds&&(F(),o(qe[ds],1,1,()=>{qe[ds]=null}),B(),D=qe[N],D||(D=qe[N]=wt[N](e),D.c()),m(D,1),D.m(il.parentNode,il));let hs=E;E=_t(e),E!==hs&&(F(),o(Ke[hs],1,1,()=>{Ke[hs]=null}),B(),G=Ke[E],G||(G=Ke[E]=ht[E](e),G.c()),m(G,1),G.m(cl.parentNode,cl));let _s=Z;Z=Ct(e),Z!==_s&&(F(),o(Oe[_s],1,1,()=>{Oe[_s]=null}),B(),V=Oe[Z],V||(V=Oe[Z]=$t[Z](e),V.c()),m(V,1),V.m(Ml.parentNode,Ml));let $s=H;H=It(e),H!==$s&&(F(),o(el[$s],1,1,()=>{el[$s]=null}),B(),S=el[H],S||(S=el[H]=kt[H](e),S.c()),m(S,1),S.m(ul.parentNode,ul));let Cs=W;W=At(e),W!==Cs&&(F(),o(ll[Cs],1,1,()=>{ll[Cs]=null}),B(),z=ll[W],z||(z=ll[W]=gt[W](e),z.c()),m(z,1),z.m(ol.parentNode,ol));let ks=R;R=xt(e),R!==ks&&(F(),o(sl[ks],1,1,()=>{sl[ks]=null}),B(),L=sl[R],L||(L=sl[R]=vt[R](e),L.c()),m(L,1),L.m(ml.parentNode,ml));const Dt={};t&2&&(Dt.$$scope={dirty:t,ctx:e}),q.$set(Dt)},i(e){fs||(m(u.$$.fragment,e),m(d.$$.fragment,e),m($),m(X.$$.fragment,e),m(k),m(O.$$.fragment,e),m(le.$$.fragment,e),m(ne.$$.fragment,e),m(ce.$$.fragment,e),m(g),m(v),m(fe.$$.fragment,e),m(Q),m(Ue.$$.fragment,e),m(D),m($e.$$.fragment,e),m(G),m(xe.$$.fragment,e),m(V),m(Ne.$$.fragment,e),m(Ee.$$.fragment,e),m(S),m(z),m(L),m(He.$$.fragment,e),m(Se.$$.fragment,e),m(q.$$.fragment,e),m(Le.$$.fragment,e),fs=!0)},o(e){o(u.$$.fragment,e),o(d.$$.fragment,e),o($),o(X.$$.fragment,e),o(k),o(O.$$.fragment,e),o(le.$$.fragment,e),o(ne.$$.fragment,e),o(ce.$$.fragment,e),o(g),o(v),o(fe.$$.fragment,e),o(Q),o(Ue.$$.fragment,e),o(D),o($e.$$.fragment,e),o(G),o(xe.$$.fragment,e),o(V),o(Ne.$$.fragment,e),o(Ee.$$.fragment,e),o(S),o(z),o(L),o(He.$$.fragment,e),o(Se.$$.fragment,e),o(q.$$.fragment,e),o(Le.$$.fragment,e),fs=!1},d(e){e&&(n(r),n(l),n(i),n(p),n(Tl),n(tl),n(bl),n(nl),n(K),n(Jl),n(Ul),n(ee),n(jl),n(wl),n(se),n(dl),n(Y),n(hl),n(te),n(_l),n($l),n(ae),n(Cl),n(re),n(kl),n(pe),n(Il),n(ie),n(gl),n(Al),n(Me),n(vl),n(ue),n(xl),n(oe),n(Ql),n(al),n(me),n(Nl),n(rl),n(ye),n(Dl),n(El),n(pl),n(Te),n(Gl),n(be),n(Zl),n(Je),n(Vl),n(Hl),n(je),n(Sl),n(we),n(Wl),n(de),n(zl),n(he),n(Rl),n(il),n(_e),n(Ll),n(Bl),n(Ce),n(Fl),n(P),n(Xl),n(ke),n(Yl),n(Ie),n(Pl),n(ge),n(ql),n(Ae),n(Kl),n(cl),n(ve),n(Ol),n(es),n(Ml),n(Qe),n(ls),n(ss),n(De),n(ts),n(ns),n(ul),n(Ge),n(as),n(ol),n(ml),n(Ze),n(rs),n(Ve),n(ps),n(is),n(cs),n(We),n(Ms),n(ze),n(us),n(Re),n(os),n(ms),n(ys),n(fl)),n(s),w(u,e),w(d,e),Be[_].d(e),w(X,e),Fe[C].d(e),w(O,e),w(le,e),w(ne,e),w(ce,e),Xe[I].d(e),Ye[A].d(e),w(fe,e),Pe[x].d(e),w(Ue,e),qe[N].d(e),w($e,e),Ke[E].d(e),w(xe,e),Oe[Z].d(e),w(Ne,e),w(Ee,e),el[H].d(e),ll[W].d(e),sl[R].d(e),w(He,e),w(Se,e),w(q,e),w(Le,e)}}}const hn='{"title":"管道的内部","local":"管道的内部","sections":[{"title":"使用分词器进行预处理","local":"使用分词器进行预处理","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 _n(y,s,r){let l="pt";return St(()=>{const i=new URLSearchParams(window.location.search);r(0,l=i.get("fw")||"pt")}),[l]}class Qn extends zt{constructor(s){super(),Rt(this,s,_n,dn,Ht,{})}}export{Qn as component};
