import{s as Rt,o as Wt,n as Bt}from"../chunks/scheduler.37c15a92.js";import{S as Lt,i as Ft,g as f,s as c,r as J,A as Xt,h as T,f as n,c as M,j as Zt,u as d,x as b,k as Js,y as Yt,a,v as U,t as o,b as L,d as m,w as j,m as Pt,n as qt,p as F}from"../chunks/index.2bf4358c.js";import{T as Vt}from"../chunks/Tip.363c041f.js";import{Y as Ht}from"../chunks/Youtube.1e50a667.js";import{C as h}from"../chunks/CodeBlock.4f5fc1ad.js";import{C as St}from"../chunks/CourseFloatingBanner.06521e8b.js";import{F as Kt}from"../chunks/FrameworkSwitchCourse.8d4d4ab6.js";import{H as fl,E as Ot}from"../chunks/EditOnGithub.8916dc7c.js";function en(y){let s,r;return s=new St({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 ln(y){let s,r;return s=new St({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 sn(y){let s;return{c(){s=Pt("这是第一部分，根据你使用 PyTorch 或者 TensorFlow，内容略有不同。点击标题上方的平台，选择你喜欢的平台！")},l(r){s=qt(r,"这是第一部分，根据你使用 PyTorch 或者 TensorFlow，内容略有不同。点击标题上方的平台，选择你喜欢的平台！")},m(r,l){a(r,s,l)},d(r){r&&n(s)}}}function tn(y){let s,r;return s=new Ht({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 nn(y){let s,r;return s=new Ht({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 an(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 rn(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 pn(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 cn(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 un(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 on(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 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){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 yn(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 fn(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 Tn(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 bn(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 dn(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 Un(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 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){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:"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 hn(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 _n(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:Bt,d(l){l&&n(s)}}}function $n(y){let s,r,l,i,u,p,w,bl,_,$,nl,X,Jl,C,k,al,K,As='让我们从一个完整的示例开始，看看在 <a href="/course/chapter1">第一章</a> 中执行以下代码时在幕后发生了什么',dl,O,Ul,ee,vs="获得如下输出：",jl,le,wl,se,xs='正如我们在 <a href="/course/chapter1">第一章</a> 中看到的，这个 pipeline 集成了三个步骤：预处理、模型计算和后处理：',hl,Y,Qs='<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."/>',_l,te,Ns="让我们先简单了解一下这三个步骤。",$l,ne,Cl,ae,Ds="与其他神经网络一样，Transformer 模型无法直接处理原始文本，因此我们管道的第一步是将文本输入转换为模型能够理解的数字。为此，我们使用 tokenizer（ tokenizer ），它将负责：",kl,re,Es="<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>",Il,pe,Gs='在使用模型时所有这些预处理都需要与模型预训练时的方式完全相同，因此我们首先需要从 <a href="https://huggingface.co/models" rel="nofollow">Model Hub</a> 中下载这些信息。为此，我们使用 <code>AutoTokenizer</code> 类和它的 <code>from_pretrained()</code> 方法，并输入我们模型 checkpoint 的名称，它将自动获取与模型的 tokenizer 相关联的数据，并对其进行缓存（因此只有在你第一次运行下面的代码时才会下载）。',gl,ie,zs='<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> ）看到它的模型卡片，我们运行以下代码：',Al,ce,vl,Me,Zs="当我们有了 tokenizer，我们就可以直接将我们的句子传递给它，我们就会得到一个 <code>input ID（inputs ID）</code> 的列表！剩下要做的唯一一件事就是将 input ID 列表转换为 tensor（张量）。",xl,ue,Vs="你在使用🤗 Transformers 时，您无需担心它背后的机器学习框架；它可能是 PyTorch 或 TensorFlow，或 Flax。但是，Transformers 模型只接受 <code>tensor（张量）</code> 作为输入。如果这是你第一次听说 tensor，你可以把它们想象成 NumPy 数组。NumPy 数组可以是标量（0D）、向量（1D）、矩阵（2D）或具有更多维度。这些都可以称为 tensor；其他 ML 框架的 tensor 使用方法也类似，通常与 NumPy 数组一样容易创建。",Ql,oe,Hs="我们可以使用 <code>return_tensors</code> 参数指定我们想要得到的 tensor 的类型（PyTorch、TensorFlow 或纯 NumPy），",Nl,I,g,rl,me,Ss="现在不要担心 padding（填充）和 truncation（截断）；我们稍后会解释这些。这里要记住的是，你可以传递一个句子或一组句子，还可以指定要返回的 tensor 类型（如果没有传递类型，默认返回的是 python 中的 list 格式）。",Dl,A,v,pl,ye,Rs="输出是一个包含两个键， <code>input_ids</code> 和 <code>attention_mask</code> 。 <code>input_ids</code> 包含两行整数（每个句子一行），它们是每个句子中 token 的 ID。我们将在本章后面解释什么是 <code>attention_mask</code> 。",El,fe,Gl,x,Q,il,Te,Ws="在这段代码中，我们将之前在 pipeline 中使用的 checkpoint（实际上应该已经被缓存了）下载下来，并用它实例化了一个模型。",zl,be,Bs="这个模型只包含基本的 Transformer 模块：输入一些句子，它输出我们将称为 <code>hidden states（隐状态）</code> ，也被称为特征。每个输入，我们都可以获取一个高维向量，代表 Transformer 模型对该输入的上下文理解。",Zl,Je,Ls="如果这有些难以理解，不要担心。我们以后再解释。",Vl,de,Fs='这些隐状态本身就很有用，它们被称为模型头（head），通常是模型另一部分的输入。在 <a href="/course/chapter1">第一章</a> 中，可以使用相同的体系结构的模型执行不同的任务，这是因为每个任务都有一个对应的模型头。',Hl,Ue,Sl,je,Xs="Transformers 模块的矢量输出通常较大。它通常有三个维度：",Rl,we,Ys="<li><strong>Batch size</strong>（批次大小）：一次处理的序列数（在我们的示例中为 2）。</li> <li><strong>Sequence length</strong>（序列长度）：表示序列（句子）的长度（在我们的示例中为 16）。</li> <li><strong>Hidden size</strong>（隐藏层大小）：每个模型输入的向量维度。</li>",Wl,he,Ps="之所以说它是“高维度”的，是因为最后一个维度值。隐藏层维度可以非常大（对于较小的模型，常见的是 768，对于较大的模型，这个数字可以达到 3072 或更多）。",Bl,_e,qs="如果我们将预处理的之后的值输入到模型中，我们会得到以下输入：",Ll,N,D,cl,$e,Ks="注意，🤗 Transformers 模型的输出有些像 <code>namedtuple</code> 或词典。你可以通过使用“.”+属性（就像我们在上面示例中所做的那样）或键（ <code>outputs[&quot;last_hidden_state&quot;]</code> ）访问元素，如果你确切知道要查找的内容的位置（ <code>outputs[0]</code> ），也可以通过索引访问元素。",Fl,Ce,Xl,ke,Os="Transformers 模型的输出会直接发送到模型头进行处理。",Yl,Ie,et="模型头通常由一个或几个线性层组成，它的输入是隐状态的高维向量，它会并将其投影到不同的维度。",Pl,P,lt='<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."/>',ql,ge,st="在此图中，模型由其嵌入层和后续层表示。嵌入层将 tokenize 后输入中的每个 inputs ID 转换为表示关联 token 的向量。后续层使用注意机制操纵这些向量，生成句子的最终表示。",Kl,Ae,tt="Transformers 中有许多不同的体系结构，每种体系结构都是围绕处理特定任务而设计的。以下是一个非详尽的列表：",Ol,ve,nt="<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>",es,E,G,Ml,xe,at=`如果我们看一下现在输出的形状，其维度会降低很多：模型头接收我们之前看到的高维向量作为输入，并输出包含两个值（每种标签一个）的向量。正如您所见，输出向量的尺寸与输入向量相比要小得多。这是因为模型头将输入向量中的信息压缩成两个值，每个标签一个
264	<code>python 265 </code>python：`,ls,Qe,ss,z,Z,ul,Ne,rt="由于我们只有两个句子和两钟标签，所以我们从模型中得到的结果的形状是 2 x 2。",ts,De,ns,Ee,pt="我们从模型中得到的输出值本身并不一定有意义。我们来看看，",as,Ge,rs,V,H,ol,ze,it='我们的模型预测第一句为 <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）与实际的损失函数（如交叉熵）融合）：',ps,S,R,ml,W,B,yl,Ze,ct="现在我们可以看到，模型预测第一句的输出是 <code>[0.0402, 0.9598]</code> ，第二句 <code>[0.9995, 0.0005]</code> 。这些是可直接使用的概率分数。",is,Ve,Mt="为了获得每个分数对应的标签，我们可以查看模型配置的 <code>id2label</code> 属性（下一节将对此进行详细介绍），该属性将每个模型输出的 ID 映射到相应的标签：",cs,He,Ms,Se,us,Re,ut="现在我们可以得出结论，模型预测如下：",os,We,ot="<li>第一句：消极的概率：0.0402，积极的概率：0.9598</li> <li>第二句：消极的概率：0.9995，积极的概率：0.0005</li>",ms,Be,mt="我们已经成功地复刻了管道的三个步骤：使用 tokenizer 进行预处理、通过模型传递输入以及后处理！接下来，让我们花一些时间深入了解这些步骤中的每一步。",ys,q,fs,Le,Ts,Tl,bs;u=new Kt({props:{fw:y[0]}}),w=new fl({props:{title:"Pipeline 的内部",local:"Pipeline 的内部",headingTag:"h1"}});const yt=[ln,en],Fe=[];function ft(e,t){return e[0]==="pt"?0:1}_=ft(y),$=Fe[_]=yt[_](y),X=new Vt({props:{$$slots:{default:[sn]},$$scope:{ctx:y}}});const Tt=[nn,tn],Xe=[];function bt(e,t){return e[0]==="pt"?0:1}C=bt(y),k=Xe[C]=Tt[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 fl({props:{title:"使用 tokenizer（ tokenizer ）进行预处理",local:"使用 tokenizer（ tokenizer ）进行预处理",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 Jt=[rn,an],Ye=[];function dt(e,t){return e[0]==="pt"?0:1}I=dt(y),g=Ye[I]=Jt[I](y);const Ut=[cn,pn],Pe=[];function jt(e,t){return e[0]==="pt"?0:1}A=jt(y),v=Pe[A]=Ut[A](y),fe=new fl({props:{title:"探索模型",local:"探索模型",headingTag:"h2"}});const wt=[un,Mn],qe=[];function ht(e,t){return e[0]==="pt"?0:1}x=ht(y),Q=qe[x]=wt[x](y),Ue=new fl({props:{title:"高维向量？",local:"高维向量？",headingTag:"h3"}});const _t=[mn,on],Ke=[];function $t(e,t){return e[0]==="pt"?0:1}N=$t(y),D=Ke[N]=_t[N](y),Ce=new fl({props:{title:"模型头：理解数字的意义",local:"模型头：理解数字的意义",headingTag:"h3"}});const Ct=[fn,yn],Oe=[];function kt(e,t){return e[0]==="pt"?0:1}E=kt(y),G=Oe[E]=Ct[E](y),Qe=new h({props:{code:"cHJpbnQob3V0cHV0cy5sb2dpdHMuc2hhcGUp",highlighted:'<span class="hljs-built_in">print</span>(outputs.logits.shape)',wrap:!1}});const It=[bn,Tn],el=[];function gt(e,t){return e[0]==="pt"?0:1}z=gt(y),Z=el[z]=It[z](y),De=new fl({props:{title:"对输出进行后序处理",local:"对输出进行后处理",headingTag:"h2"}}),Ge=new h({props:{code:"cHJpbnQob3V0cHV0cy5sb2dpdHMp",highlighted:'<span class="hljs-built_in">print</span>(outputs.logits)',wrap:!1}});const At=[dn,Jn],ll=[];function vt(e,t){return e[0]==="pt"?0:1}V=vt(y),H=ll[V]=At[V](y);const xt=[jn,Un],sl=[];function Qt(e,t){return e[0]==="pt"?0:1}S=Qt(y),R=sl[S]=xt[S](y);const Nt=[hn,wn],tl=[];function Dt(e,t){return e[0]==="pt"?0:1}return W=Dt(y),B=tl[W]=Nt[W](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 Vt({props:{$$slots:{default:[_n]},$$scope:{ctx:y}}}),Le=new Ot({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),bl=c(),$.c(),nl=c(),J(X.$$.fragment),Jl=c(),k.c(),al=c(),K=f("p"),K.innerHTML=As,dl=c(),J(O.$$.fragment),Ul=c(),ee=f("p"),ee.textContent=vs,jl=c(),J(le.$$.fragment),wl=c(),se=f("p"),se.innerHTML=xs,hl=c(),Y=f("div"),Y.innerHTML=Qs,_l=c(),te=f("p"),te.textContent=Ns,$l=c(),J(ne.$$.fragment),Cl=c(),ae=f("p"),ae.textContent=Ds,kl=c(),re=f("ul"),re.innerHTML=Es,Il=c(),pe=f("p"),pe.innerHTML=Gs,gl=c(),ie=f("p"),ie.innerHTML=zs,Al=c(),J(ce.$$.fragment),vl=c(),Me=f("p"),Me.innerHTML=Zs,xl=c(),ue=f("p"),ue.innerHTML=Vs,Ql=c(),oe=f("p"),oe.innerHTML=Hs,Nl=c(),g.c(),rl=c(),me=f("p"),me.textContent=Ss,Dl=c(),v.c(),pl=c(),ye=f("p"),ye.innerHTML=Rs,El=c(),J(fe.$$.fragment),Gl=c(),Q.c(),il=c(),Te=f("p"),Te.textContent=Ws,zl=c(),be=f("p"),be.innerHTML=Bs,Zl=c(),Je=f("p"),Je.textContent=Ls,Vl=c(),de=f("p"),de.innerHTML=Fs,Hl=c(),J(Ue.$$.fragment),Sl=c(),je=f("p"),je.textContent=Xs,Rl=c(),we=f("ul"),we.innerHTML=Ys,Wl=c(),he=f("p"),he.textContent=Ps,Bl=c(),_e=f("p"),_e.textContent=qs,Ll=c(),D.c(),cl=c(),$e=f("p"),$e.innerHTML=Ks,Fl=c(),J(Ce.$$.fragment),Xl=c(),ke=f("p"),ke.textContent=Os,Yl=c(),Ie=f("p"),Ie.textContent=et,Pl=c(),P=f("div"),P.innerHTML=lt,ql=c(),ge=f("p"),ge.textContent=st,Kl=c(),Ae=f("p"),Ae.textContent=tt,Ol=c(),ve=f("ul"),ve.innerHTML=nt,es=c(),G.c(),Ml=c(),xe=f("p"),xe.innerHTML=at,ls=c(),J(Qe.$$.fragment),ss=c(),Z.c(),ul=c(),Ne=f("p"),Ne.textContent=rt,ts=c(),J(De.$$.fragment),ns=c(),Ee=f("p"),Ee.textContent=pt,as=c(),J(Ge.$$.fragment),rs=c(),H.c(),ol=c(),ze=f("p"),ze.innerHTML=it,ps=c(),R.c(),ml=c(),B.c(),yl=c(),Ze=f("p"),Ze.innerHTML=ct,is=c(),Ve=f("p"),Ve.innerHTML=Mt,cs=c(),J(He.$$.fragment),Ms=c(),J(Se.$$.fragment),us=c(),Re=f("p"),Re.textContent=ut,os=c(),We=f("ul"),We.innerHTML=ot,ms=c(),Be=f("p"),Be.textContent=mt,ys=c(),J(q.$$.fragment),fs=c(),J(Le.$$.fragment),Ts=c(),Tl=f("p"),this.h()},l(e){const t=Xt("svelte-u9bgzb",document.head);s=T(t,"META",{name:!0,content:!0}),t.forEach(n),r=M(e),l=T(e,"P",{}),Zt(l).forEach(n),i=M(e),d(u.$$.fragment,e),p=M(e),d(w.$$.fragment,e),bl=M(e),$.l(e),nl=M(e),d(X.$$.fragment,e),Jl=M(e),k.l(e),al=M(e),K=T(e,"P",{"data-svelte-h":!0}),b(K)!=="svelte-1quufcj"&&(K.innerHTML=As),dl=M(e),d(O.$$.fragment,e),Ul=M(e),ee=T(e,"P",{"data-svelte-h":!0}),b(ee)!=="svelte-9mk32u"&&(ee.textContent=vs),jl=M(e),d(le.$$.fragment,e),wl=M(e),se=T(e,"P",{"data-svelte-h":!0}),b(se)!=="svelte-12e1b9i"&&(se.innerHTML=xs),hl=M(e),Y=T(e,"DIV",{class:!0,"data-svelte-h":!0}),b(Y)!=="svelte-fbe70j"&&(Y.innerHTML=Qs),_l=M(e),te=T(e,"P",{"data-svelte-h":!0}),b(te)!=="svelte-bgtnom"&&(te.textContent=Ns),$l=M(e),d(ne.$$.fragment,e),Cl=M(e),ae=T(e,"P",{"data-svelte-h":!0}),b(ae)!=="svelte-1hj6urj"&&(ae.textContent=Ds),kl=M(e),re=T(e,"UL",{"data-svelte-h":!0}),b(re)!=="svelte-t07ups"&&(re.innerHTML=Es),Il=M(e),pe=T(e,"P",{"data-svelte-h":!0}),b(pe)!=="svelte-mov6l8"&&(pe.innerHTML=Gs),gl=M(e),ie=T(e,"P",{"data-svelte-h":!0}),b(ie)!=="svelte-81i5fv"&&(ie.innerHTML=zs),Al=M(e),d(ce.$$.fragment,e),vl=M(e),Me=T(e,"P",{"data-svelte-h":!0}),b(Me)!=="svelte-1hfz0wz"&&(Me.innerHTML=Zs),xl=M(e),ue=T(e,"P",{"data-svelte-h":!0}),b(ue)!=="svelte-1lglukt"&&(ue.innerHTML=Vs),Ql=M(e),oe=T(e,"P",{"data-svelte-h":!0}),b(oe)!=="svelte-13xrm4"&&(oe.innerHTML=Hs),Nl=M(e),g.l(e),rl=M(e),me=T(e,"P",{"data-svelte-h":!0}),b(me)!=="svelte-vq5r4w"&&(me.textContent=Ss),Dl=M(e),v.l(e),pl=M(e),ye=T(e,"P",{"data-svelte-h":!0}),b(ye)!=="svelte-88e2df"&&(ye.innerHTML=Rs),El=M(e),d(fe.$$.fragment,e),Gl=M(e),Q.l(e),il=M(e),Te=T(e,"P",{"data-svelte-h":!0}),b(Te)!=="svelte-8mioqo"&&(Te.textContent=Ws),zl=M(e),be=T(e,"P",{"data-svelte-h":!0}),b(be)!=="svelte-1lxyp0x"&&(be.innerHTML=Bs),Zl=M(e),Je=T(e,"P",{"data-svelte-h":!0}),b(Je)!=="svelte-1d8kvbh"&&(Je.textContent=Ls),Vl=M(e),de=T(e,"P",{"data-svelte-h":!0}),b(de)!=="svelte-1tuwl71"&&(de.innerHTML=Fs),Hl=M(e),d(Ue.$$.fragment,e),Sl=M(e),je=T(e,"P",{"data-svelte-h":!0}),b(je)!=="svelte-1iqx2et"&&(je.textContent=Xs),Rl=M(e),we=T(e,"UL",{"data-svelte-h":!0}),b(we)!=="svelte-88j1pa"&&(we.innerHTML=Ys),Wl=M(e),he=T(e,"P",{"data-svelte-h":!0}),b(he)!=="svelte-lhldzs"&&(he.textContent=Ps),Bl=M(e),_e=T(e,"P",{"data-svelte-h":!0}),b(_e)!=="svelte-1n6zqkz"&&(_e.textContent=qs),Ll=M(e),D.l(e),cl=M(e),$e=T(e,"P",{"data-svelte-h":!0}),b($e)!=="svelte-15nw09q"&&($e.innerHTML=Ks),Fl=M(e),d(Ce.$$.fragment,e),Xl=M(e),ke=T(e,"P",{"data-svelte-h":!0}),b(ke)!=="svelte-5ol48z"&&(ke.textContent=Os),Yl=M(e),Ie=T(e,"P",{"data-svelte-h":!0}),b(Ie)!=="svelte-14ytwag"&&(Ie.textContent=et),Pl=M(e),P=T(e,"DIV",{class:!0,"data-svelte-h":!0}),b(P)!=="svelte-8mo6lt"&&(P.innerHTML=lt),ql=M(e),ge=T(e,"P",{"data-svelte-h":!0}),b(ge)!=="svelte-1qqfmxp"&&(ge.textContent=st),Kl=M(e),Ae=T(e,"P",{"data-svelte-h":!0}),b(Ae)!=="svelte-1tckzev"&&(Ae.textContent=tt),Ol=M(e),ve=T(e,"UL",{"data-svelte-h":!0}),b(ve)!=="svelte-8snvi5"&&(ve.innerHTML=nt),es=M(e),G.l(e),Ml=M(e),xe=T(e,"P",{"data-svelte-h":!0}),b(xe)!=="svelte-27lfxx"&&(xe.innerHTML=at),ls=M(e),d(Qe.$$.fragment,e),ss=M(e),Z.l(e),ul=M(e),Ne=T(e,"P",{"data-svelte-h":!0}),b(Ne)!=="svelte-tthfl0"&&(Ne.textContent=rt),ts=M(e),d(De.$$.fragment,e),ns=M(e),Ee=T(e,"P",{"data-svelte-h":!0}),b(Ee)!=="svelte-1kuvu71"&&(Ee.textContent=pt),as=M(e),d(Ge.$$.fragment,e),rs=M(e),H.l(e),ol=M(e),ze=T(e,"P",{"data-svelte-h":!0}),b(ze)!=="svelte-1wzsjkh"&&(ze.innerHTML=it),ps=M(e),R.l(e),ml=M(e),B.l(e),yl=M(e),Ze=T(e,"P",{"data-svelte-h":!0}),b(Ze)!=="svelte-wdsaw8"&&(Ze.innerHTML=ct),is=M(e),Ve=T(e,"P",{"data-svelte-h":!0}),b(Ve)!=="svelte-74q99a"&&(Ve.innerHTML=Mt),cs=M(e),d(He.$$.fragment,e),Ms=M(e),d(Se.$$.fragment,e),us=M(e),Re=T(e,"P",{"data-svelte-h":!0}),b(Re)!=="svelte-sq0n3"&&(Re.textContent=ut),os=M(e),We=T(e,"UL",{"data-svelte-h":!0}),b(We)!=="svelte-2rh2"&&(We.innerHTML=ot),ms=M(e),Be=T(e,"P",{"data-svelte-h":!0}),b(Be)!=="svelte-1daz6p4"&&(Be.textContent=mt),ys=M(e),d(q.$$.fragment,e),fs=M(e),d(Le.$$.fragment,e),Ts=M(e),Tl=T(e,"P",{}),Zt(Tl).forEach(n),this.h()},h(){Js(s,"name","hf:doc:metadata"),Js(s,"content",Cn),Js(Y,"class","flex justify-center"),Js(P,"class","flex justify-center")},m(e,t){Yt(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,bl,t),Fe[_].m(e,t),a(e,nl,t),U(X,e,t),a(e,Jl,t),Xe[C].m(e,t),a(e,al,t),a(e,K,t),a(e,dl,t),U(O,e,t),a(e,Ul,t),a(e,ee,t),a(e,jl,t),U(le,e,t),a(e,wl,t),a(e,se,t),a(e,hl,t),a(e,Y,t),a(e,_l,t),a(e,te,t),a(e,$l,t),U(ne,e,t),a(e,Cl,t),a(e,ae,t),a(e,kl,t),a(e,re,t),a(e,Il,t),a(e,pe,t),a(e,gl,t),a(e,ie,t),a(e,Al,t),U(ce,e,t),a(e,vl,t),a(e,Me,t),a(e,xl,t),a(e,ue,t),a(e,Ql,t),a(e,oe,t),a(e,Nl,t),Ye[I].m(e,t),a(e,rl,t),a(e,me,t),a(e,Dl,t),Pe[A].m(e,t),a(e,pl,t),a(e,ye,t),a(e,El,t),U(fe,e,t),a(e,Gl,t),qe[x].m(e,t),a(e,il,t),a(e,Te,t),a(e,zl,t),a(e,be,t),a(e,Zl,t),a(e,Je,t),a(e,Vl,t),a(e,de,t),a(e,Hl,t),U(Ue,e,t),a(e,Sl,t),a(e,je,t),a(e,Rl,t),a(e,we,t),a(e,Wl,t),a(e,he,t),a(e,Bl,t),a(e,_e,t),a(e,Ll,t),Ke[N].m(e,t),a(e,cl,t),a(e,$e,t),a(e,Fl,t),U(Ce,e,t),a(e,Xl,t),a(e,ke,t),a(e,Yl,t),a(e,Ie,t),a(e,Pl,t),a(e,P,t),a(e,ql,t),a(e,ge,t),a(e,Kl,t),a(e,Ae,t),a(e,Ol,t),a(e,ve,t),a(e,es,t),Oe[E].m(e,t),a(e,Ml,t),a(e,xe,t),a(e,ls,t),U(Qe,e,t),a(e,ss,t),el[z].m(e,t),a(e,ul,t),a(e,Ne,t),a(e,ts,t),U(De,e,t),a(e,ns,t),a(e,Ee,t),a(e,as,t),U(Ge,e,t),a(e,rs,t),ll[V].m(e,t),a(e,ol,t),a(e,ze,t),a(e,ps,t),sl[S].m(e,t),a(e,ml,t),tl[W].m(e,t),a(e,yl,t),a(e,Ze,t),a(e,is,t),a(e,Ve,t),a(e,cs,t),U(He,e,t),a(e,Ms,t),U(Se,e,t),a(e,us,t),a(e,Re,t),a(e,os,t),a(e,We,t),a(e,ms,t),a(e,Be,t),a(e,ys,t),U(q,e,t),a(e,fs,t),U(Le,e,t),a(e,Ts,t),a(e,Tl,t),bs=!0},p(e,[t]){const Et={};t&1&&(Et.fw=e[0]),u.$set(Et);let ds=_;_=ft(e),_!==ds&&(F(),o(Fe[ds],1,1,()=>{Fe[ds]=null}),L(),$=Fe[_],$||($=Fe[_]=yt[_](e),$.c()),m($,1),$.m(nl.parentNode,nl));const Gt={};t&2&&(Gt.$$scope={dirty:t,ctx:e}),X.$set(Gt);let Us=C;C=bt(e),C!==Us&&(F(),o(Xe[Us],1,1,()=>{Xe[Us]=null}),L(),k=Xe[C],k||(k=Xe[C]=Tt[C](e),k.c()),m(k,1),k.m(al.parentNode,al));let js=I;I=dt(e),I!==js&&(F(),o(Ye[js],1,1,()=>{Ye[js]=null}),L(),g=Ye[I],g||(g=Ye[I]=Jt[I](e),g.c()),m(g,1),g.m(rl.parentNode,rl));let ws=A;A=jt(e),A!==ws&&(F(),o(Pe[ws],1,1,()=>{Pe[ws]=null}),L(),v=Pe[A],v||(v=Pe[A]=Ut[A](e),v.c()),m(v,1),v.m(pl.parentNode,pl));let hs=x;x=ht(e),x!==hs&&(F(),o(qe[hs],1,1,()=>{qe[hs]=null}),L(),Q=qe[x],Q||(Q=qe[x]=wt[x](e),Q.c()),m(Q,1),Q.m(il.parentNode,il));let _s=N;N=$t(e),N!==_s&&(F(),o(Ke[_s],1,1,()=>{Ke[_s]=null}),L(),D=Ke[N],D||(D=Ke[N]=_t[N](e),D.c()),m(D,1),D.m(cl.parentNode,cl));let $s=E;E=kt(e),E!==$s&&(F(),o(Oe[$s],1,1,()=>{Oe[$s]=null}),L(),G=Oe[E],G||(G=Oe[E]=Ct[E](e),G.c()),m(G,1),G.m(Ml.parentNode,Ml));let Cs=z;z=gt(e),z!==Cs&&(F(),o(el[Cs],1,1,()=>{el[Cs]=null}),L(),Z=el[z],Z||(Z=el[z]=It[z](e),Z.c()),m(Z,1),Z.m(ul.parentNode,ul));let ks=V;V=vt(e),V!==ks&&(F(),o(ll[ks],1,1,()=>{ll[ks]=null}),L(),H=ll[V],H||(H=ll[V]=At[V](e),H.c()),m(H,1),H.m(ol.parentNode,ol));let Is=S;S=Qt(e),S!==Is&&(F(),o(sl[Is],1,1,()=>{sl[Is]=null}),L(),R=sl[S],R||(R=sl[S]=xt[S](e),R.c()),m(R,1),R.m(ml.parentNode,ml));let gs=W;W=Dt(e),W!==gs&&(F(),o(tl[gs],1,1,()=>{tl[gs]=null}),L(),B=tl[W],B||(B=tl[W]=Nt[W](e),B.c()),m(B,1),B.m(yl.parentNode,yl));const zt={};t&2&&(zt.$$scope={dirty:t,ctx:e}),q.$set(zt)},i(e){bs||(m(u.$$.fragment,e),m(w.$$.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(Ce.$$.fragment,e),m(G),m(Qe.$$.fragment,e),m(Z),m(De.$$.fragment,e),m(Ge.$$.fragment,e),m(H),m(R),m(B),m(He.$$.fragment,e),m(Se.$$.fragment,e),m(q.$$.fragment,e),m(Le.$$.fragment,e),bs=!0)},o(e){o(u.$$.fragment,e),o(w.$$.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(Ce.$$.fragment,e),o(G),o(Qe.$$.fragment,e),o(Z),o(De.$$.fragment,e),o(Ge.$$.fragment,e),o(H),o(R),o(B),o(He.$$.fragment,e),o(Se.$$.fragment,e),o(q.$$.fragment,e),o(Le.$$.fragment,e),bs=!1},d(e){e&&(n(r),n(l),n(i),n(p),n(bl),n(nl),n(Jl),n(al),n(K),n(dl),n(Ul),n(ee),n(jl),n(wl),n(se),n(hl),n(Y),n(_l),n(te),n($l),n(Cl),n(ae),n(kl),n(re),n(Il),n(pe),n(gl),n(ie),n(Al),n(vl),n(Me),n(xl),n(ue),n(Ql),n(oe),n(Nl),n(rl),n(me),n(Dl),n(pl),n(ye),n(El),n(Gl),n(il),n(Te),n(zl),n(be),n(Zl),n(Je),n(Vl),n(de),n(Hl),n(Sl),n(je),n(Rl),n(we),n(Wl),n(he),n(Bl),n(_e),n(Ll),n(cl),n($e),n(Fl),n(Xl),n(ke),n(Yl),n(Ie),n(Pl),n(P),n(ql),n(ge),n(Kl),n(Ae),n(Ol),n(ve),n(es),n(Ml),n(xe),n(ls),n(ss),n(ul),n(Ne),n(ts),n(ns),n(Ee),n(as),n(rs),n(ol),n(ze),n(ps),n(ml),n(yl),n(Ze),n(is),n(Ve),n(cs),n(Ms),n(us),n(Re),n(os),n(We),n(ms),n(Be),n(ys),n(fs),n(Ts),n(Tl)),n(s),j(u,e),j(w,e),Fe[_].d(e),j(X,e),Xe[C].d(e),j(O,e),j(le,e),j(ne,e),j(ce,e),Ye[I].d(e),Pe[A].d(e),j(fe,e),qe[x].d(e),j(Ue,e),Ke[N].d(e),j(Ce,e),Oe[E].d(e),j(Qe,e),el[z].d(e),j(De,e),j(Ge,e),ll[V].d(e),sl[S].d(e),tl[W].d(e),j(He,e),j(Se,e),j(q,e),j(Le,e)}}}const Cn='{"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 kn(y,s,r){let l="pt";return Wt(()=>{const i=new URLSearchParams(window.location.search);r(0,l=i.get("fw")||"pt")}),[l]}class En extends Lt{constructor(s){super(),Ft(this,s,kn,$n,Rt,{})}}export{En as component};
