import{S as jp,i as kp,s as Ep,e as i,k as m,w as T,t as a,M as vp,c as f,d as s,m as _,x as g,a as u,h as o,b as I,N as Kt,G as l,g as p,y as P,o as j,p as pe,q as k,B as C,v as wp,n as ie}from"../../chunks/vendor-hf-doc-builder.js";import{T as dp}from"../../chunks/Tip-hf-doc-builder.js";import{Y as hp}from"../../chunks/Youtube-hf-doc-builder.js";import{C as F}from"../../chunks/CodeBlock-hf-doc-builder.js";import{D as $p}from"../../chunks/DocNotebookDropdown-hf-doc-builder.js";import{F as yp}from"../../chunks/FrameworkSwitchCourse-hf-doc-builder.js";function Tp(v){let t,c;return t=new $p({props:{classNames:"absolute z-10 right-0 top-0",options:[{label:"Google Colab",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/master/course/chapter2/section2_tf.ipynb"},{label:"Aws Studio",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/master/course/chapter2/section2_tf.ipynb"}]}}),{c(){T(t.$$.fragment)},l(n){g(t.$$.fragment,n)},m(n,b){P(t,n,b),c=!0},i(n){c||(k(t.$$.fragment,n),c=!0)},o(n){j(t.$$.fragment,n),c=!1},d(n){C(t,n)}}}function gp(v){let t,c;return t=new $p({props:{classNames:"absolute z-10 right-0 top-0",options:[{label:"Google Colab",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/master/course/chapter2/section2_pt.ipynb"},{label:"Aws Studio",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/master/course/chapter2/section2_pt.ipynb"}]}}),{c(){T(t.$$.fragment)},l(n){g(t.$$.fragment,n)},m(n,b){P(t,n,b),c=!0},i(n){c||(k(t.$$.fragment,n),c=!0)},o(n){j(t.$$.fragment,n),c=!1},d(n){C(t,n)}}}function Pp(v){let t;return{c(){t=a("\u8FD9\u662F\u7B2C\u4E00\u90E8\u5206\uFF0C\u6839\u636E\u60A8\u4F7F\u7528PyTorch\u6216\u8005TensorFlow\uFF0C\u5185\u5BB9\u7565\u6709\u4E0D\u540C\u3002\u70B9\u51FB\u6807\u9898\u4E0A\u65B9\u7684\u5E73\u53F0\uFF0C\u9009\u62E9\u60A8\u559C\u6B22\u7684\u5E73\u53F0\uFF01")},l(c){t=o(c,"\u8FD9\u662F\u7B2C\u4E00\u90E8\u5206\uFF0C\u6839\u636E\u60A8\u4F7F\u7528PyTorch\u6216\u8005TensorFlow\uFF0C\u5185\u5BB9\u7565\u6709\u4E0D\u540C\u3002\u70B9\u51FB\u6807\u9898\u4E0A\u65B9\u7684\u5E73\u53F0\uFF0C\u9009\u62E9\u60A8\u559C\u6B22\u7684\u5E73\u53F0\uFF01")},m(c,n){p(c,t,n)},d(c){c&&s(t)}}}function Cp(v){let t,c;return t=new hp({props:{id:"wVN12smEvqg"}}),{c(){T(t.$$.fragment)},l(n){g(t.$$.fragment,n)},m(n,b){P(t,n,b),c=!0},i(n){c||(k(t.$$.fragment,n),c=!0)},o(n){j(t.$$.fragment,n),c=!1},d(n){C(t,n)}}}function Mp(v){let t,c;return t=new hp({props:{id:"1pedAIvTWXk"}}),{c(){T(t.$$.fragment)},l(n){g(t.$$.fragment,n)},m(n,b){P(t,n,b),c=!0},i(n){c||(k(t.$$.fragment,n),c=!0)},o(n){j(t.$$.fragment,n),c=!1},d(n){C(t,n)}}}function Ip(v){let t,c;return t=new F({props:{code:`raw_inputs = [
    "I've been waiting for a HuggingFace course my whole life.",
    "I hate this so much!",
]
inputs = tokenizer(raw_inputs, padding=True, truncation=True, return_tensors="tf")
print(inputs)`,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)`}}),{c(){T(t.$$.fragment)},l(n){g(t.$$.fragment,n)},m(n,b){P(t,n,b),c=!0},i(n){c||(k(t.$$.fragment,n),c=!0)},o(n){j(t.$$.fragment,n),c=!1},d(n){C(t,n)}}}function xp(v){let t,c;return t=new F({props:{code:`raw_inputs = [
    "I've been waiting for a HuggingFace course my whole life.",
    "I hate this so much!",
]
inputs = tokenizer(raw_inputs, padding=True, truncation=True, return_tensors="pt")
print(inputs)`,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)`}}),{c(){T(t.$$.fragment)},l(n){g(t.$$.fragment,n)},m(n,b){P(t,n,b),c=!0},i(n){c||(k(t.$$.fragment,n),c=!0)},o(n){j(t.$$.fragment,n),c=!1},d(n){C(t,n)}}}function Dp(v){let t,c,n,b,d;return b=new F({props:{code:`{
    'input_ids': <tf.Tensor: shape=(2, 16), dtype=int32, numpy=
        array([
            [  101,  1045,  1005,  2310,  2042,  3403,  2005,  1037, 17662, 12172,  2607,  2026,  2878,  2166,  1012,   102],
            [  101,  1045,  5223,  2023,  2061,  2172,   999,   102,     0,     0,     0,     0,     0,     0,     0,     0]
        ], dtype=int32)>, 
    'attention_mask': <tf.Tensor: shape=(2, 16), dtype=int32, numpy=
        array([
            [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
            [1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0]
        ], dtype=int32)>
}`,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">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-number">0</span>]
        ], dtype=int32)&gt;
}`}}),{c(){t=i("p"),c=a("\u4EE5\u4E0B\u662FTensorFlow\u5F20\u91CF\u7684\u7ED3\u679C\uFF1A"),n=m(),T(b.$$.fragment)},l(h){t=f(h,"P",{});var w=u(t);c=o(w,"\u4EE5\u4E0B\u662FTensorFlow\u5F20\u91CF\u7684\u7ED3\u679C\uFF1A"),w.forEach(s),n=_(h),g(b.$$.fragment,h)},m(h,w){p(h,t,w),l(t,c),p(h,n,w),P(b,h,w),d=!0},i(h){d||(k(b.$$.fragment,h),d=!0)},o(h){j(b.$$.fragment,h),d=!1},d(h){h&&s(t),h&&s(n),C(b,h)}}}function Fp(v){let t,c,n,b,d;return b=new F({props:{code:`{
    'input_ids': tensor([
        [  101,  1045,  1005,  2310,  2042,  3403,  2005,  1037, 17662, 12172, 2607,  2026,  2878,  2166,  1012,   102],
        [  101,  1045,  5223,  2023,  2061,  2172,   999,   102,     0,     0,     0,     0,     0,     0,     0,     0]
    ]), 
    'attention_mask': tensor([
        [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
        [1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0]
    ])
}`,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">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-number">0</span>]
    ])
}`}}),{c(){t=i("p"),c=a("\u4EE5\u4E0B\u662FPyTorch\u5F20\u91CF\u7684\u7ED3\u679C\uFF1A"),n=m(),T(b.$$.fragment)},l(h){t=f(h,"P",{});var w=u(t);c=o(w,"\u4EE5\u4E0B\u662FPyTorch\u5F20\u91CF\u7684\u7ED3\u679C\uFF1A"),w.forEach(s),n=_(h),g(b.$$.fragment,h)},m(h,w){p(h,t,w),l(t,c),p(h,n,w),P(b,h,w),d=!0},i(h){d||(k(b.$$.fragment,h),d=!0)},o(h){j(b.$$.fragment,h),d=!1},d(h){h&&s(t),h&&s(n),C(b,h)}}}function qp(v){let t,c,n,b,d,h,w,x,M,y,D;return y=new F({props:{code:"",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)`}}),{c(){t=i("p"),c=a("\u6211\u4EEC\u53EF\u4EE5\u50CF\u4F7F\u7528\u6807\u8BB0\u5668\u4E00\u6837\u4E0B\u8F7D\u9884\u8BAD\u7EC3\u6A21\u578B\u3002\u{1F917} Transformers\u63D0\u4F9B\u4E86\u4E00\u4E2A"),n=i("code"),b=a("TFAutoModel"),d=a("\u7C7B\uFF0C\u8BE5\u7C7B\u8FD8\u5177\u6709"),h=i("code"),w=a("from_pretrained()"),x=a("\u65B9\u6CD5\uFF1A"),M=m(),T(y.$$.fragment)},l($){t=f($,"P",{});var E=u(t);c=o(E,"\u6211\u4EEC\u53EF\u4EE5\u50CF\u4F7F\u7528\u6807\u8BB0\u5668\u4E00\u6837\u4E0B\u8F7D\u9884\u8BAD\u7EC3\u6A21\u578B\u3002\u{1F917} Transformers\u63D0\u4F9B\u4E86\u4E00\u4E2A"),n=f(E,"CODE",{});var q=u(n);b=o(q,"TFAutoModel"),q.forEach(s),d=o(E,"\u7C7B\uFF0C\u8BE5\u7C7B\u8FD8\u5177\u6709"),h=f(E,"CODE",{});var O=u(h);w=o(O,"from_pretrained()"),O.forEach(s),x=o(E,"\u65B9\u6CD5\uFF1A"),E.forEach(s),M=_($),g(y.$$.fragment,$)},m($,E){p($,t,E),l(t,c),l(t,n),l(n,b),l(t,d),l(t,h),l(h,w),l(t,x),p($,M,E),P(y,$,E),D=!0},i($){D||(k(y.$$.fragment,$),D=!0)},o($){j(y.$$.fragment,$),D=!1},d($){$&&s(t),$&&s(M),C(y,$)}}}function Ap(v){let t,c,n,b,d,h,w,x,M,y,D;return y=new F({props:{code:"",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)`}}),{c(){t=i("p"),c=a("\u6211\u4EEC\u53EF\u4EE5\u50CF\u4F7F\u7528\u6807\u8BB0\u5668\u4E00\u6837\u4E0B\u8F7D\u9884\u8BAD\u7EC3\u6A21\u578B\u3002\u{1F917} Transformers\u63D0\u4F9B\u4E86\u4E00\u4E2A"),n=i("code"),b=a("AutoModel"),d=a("\u7C7B\uFF0C\u8BE5\u7C7B\u8FD8\u5177\u6709"),h=i("code"),w=a("from_pretrained()"),x=a("\u65B9\u6CD5\uFF1A"),M=m(),T(y.$$.fragment)},l($){t=f($,"P",{});var E=u(t);c=o(E,"\u6211\u4EEC\u53EF\u4EE5\u50CF\u4F7F\u7528\u6807\u8BB0\u5668\u4E00\u6837\u4E0B\u8F7D\u9884\u8BAD\u7EC3\u6A21\u578B\u3002\u{1F917} Transformers\u63D0\u4F9B\u4E86\u4E00\u4E2A"),n=f(E,"CODE",{});var q=u(n);b=o(q,"AutoModel"),q.forEach(s),d=o(E,"\u7C7B\uFF0C\u8BE5\u7C7B\u8FD8\u5177\u6709"),h=f(E,"CODE",{});var O=u(h);w=o(O,"from_pretrained()"),O.forEach(s),x=o(E,"\u65B9\u6CD5\uFF1A"),E.forEach(s),M=_($),g(y.$$.fragment,$)},m($,E){p($,t,E),l(t,c),l(t,n),l(n,b),l(t,d),l(t,h),l(h,w),l(t,x),p($,M,E),P(y,$,E),D=!0},i($){D||(k(y.$$.fragment,$),D=!0)},o($){j(y.$$.fragment,$),D=!1},d($){$&&s(t),$&&s(M),C(y,$)}}}function Op(v){let t,c,n,b;return t=new F({props:{code:`outputs = model(inputs)
print(outputs.last_hidden_state.shape)`,highlighted:`outputs = model(inputs)
<span class="hljs-built_in">print</span>(outputs.last_hidden_state.shape)`}}),n=new F({props:{code:"(2, 16, 768)",highlighted:'(<span class="hljs-number">2</span>, <span class="hljs-number">16</span>, <span class="hljs-number">768</span>)'}}),{c(){T(t.$$.fragment),c=m(),T(n.$$.fragment)},l(d){g(t.$$.fragment,d),c=_(d),g(n.$$.fragment,d)},m(d,h){P(t,d,h),p(d,c,h),P(n,d,h),b=!0},i(d){b||(k(t.$$.fragment,d),k(n.$$.fragment,d),b=!0)},o(d){j(t.$$.fragment,d),j(n.$$.fragment,d),b=!1},d(d){C(t,d),d&&s(c),C(n,d)}}}function Sp(v){let t,c,n,b;return t=new F({props:{code:`outputs = model(**inputs)
print(outputs.last_hidden_state.shape)`,highlighted:`outputs = model(**inputs)
<span class="hljs-built_in">print</span>(outputs.last_hidden_state.shape)`}}),n=new F({props:{code:"torch.Size([2, 16, 768])",highlighted:'torch.Size([<span class="hljs-number">2</span>, <span class="hljs-number">16</span>, <span class="hljs-number">768</span>])'}}),{c(){T(t.$$.fragment),c=m(),T(n.$$.fragment)},l(d){g(t.$$.fragment,d),c=_(d),g(n.$$.fragment,d)},m(d,h){P(t,d,h),p(d,c,h),P(n,d,h),b=!0},i(d){b||(k(t.$$.fragment,d),k(n.$$.fragment,d),b=!0)},o(d){j(t.$$.fragment,d),j(n.$$.fragment,d),b=!1},d(d){C(t,d),d&&s(c),C(n,d)}}}function Np(v){let t,c,n,b,d,h,w,x,M,y,D;return y=new F({props:{code:"",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)`}}),{c(){t=i("p"),c=a("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\u2019t actually use the "),n=i("code"),b=a("TFAutoModel"),d=a(" class, but "),h=i("code"),w=a("TFAutoModelForSequenceClassification"),x=a(":"),M=m(),T(y.$$.fragment)},l($){t=f($,"P",{});var E=u(t);c=o(E,"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\u2019t actually use the "),n=f(E,"CODE",{});var q=u(n);b=o(q,"TFAutoModel"),q.forEach(s),d=o(E," class, but "),h=f(E,"CODE",{});var O=u(h);w=o(O,"TFAutoModelForSequenceClassification"),O.forEach(s),x=o(E,":"),E.forEach(s),M=_($),g(y.$$.fragment,$)},m($,E){p($,t,E),l(t,c),l(t,n),l(n,b),l(t,d),l(t,h),l(h,w),l(t,x),p($,M,E),P(y,$,E),D=!0},i($){D||(k(y.$$.fragment,$),D=!0)},o($){j(y.$$.fragment,$),D=!1},d($){$&&s(t),$&&s(M),C(y,$)}}}function Lp(v){let t,c,n,b,d,h,w,x,M,y,D;return y=new F({props:{code:"",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)`}}),{c(){t=i("p"),c=a("\u5BF9\u4E8E\u6211\u4EEC\u7684\u793A\u4F8B\uFF0C\u6211\u4EEC\u9700\u8981\u4E00\u4E2A\u5E26\u6709\u5E8F\u5217\u5206\u7C7B\u5934\u7684\u6A21\u578B\uFF08\u80FD\u591F\u5C06\u53E5\u5B50\u5206\u7C7B\u4E3A\u80AF\u5B9A\u6216\u5426\u5B9A\uFF09\u3002\u56E0\u6B64\uFF0C\u6211\u4EEC\u5B9E\u9645\u4E0A\u4E0D\u4F1A\u4F7F\u7528"),n=i("code"),b=a("AutoModel"),d=a("\u7C7B\uFF0C\u800C\u662F\u4F7F\u7528"),h=i("code"),w=a("AutoModelForSequenceClassification"),x=a("\uFF1A"),M=m(),T(y.$$.fragment)},l($){t=f($,"P",{});var E=u(t);c=o(E,"\u5BF9\u4E8E\u6211\u4EEC\u7684\u793A\u4F8B\uFF0C\u6211\u4EEC\u9700\u8981\u4E00\u4E2A\u5E26\u6709\u5E8F\u5217\u5206\u7C7B\u5934\u7684\u6A21\u578B\uFF08\u80FD\u591F\u5C06\u53E5\u5B50\u5206\u7C7B\u4E3A\u80AF\u5B9A\u6216\u5426\u5B9A\uFF09\u3002\u56E0\u6B64\uFF0C\u6211\u4EEC\u5B9E\u9645\u4E0A\u4E0D\u4F1A\u4F7F\u7528"),n=f(E,"CODE",{});var q=u(n);b=o(q,"AutoModel"),q.forEach(s),d=o(E,"\u7C7B\uFF0C\u800C\u662F\u4F7F\u7528"),h=f(E,"CODE",{});var O=u(h);w=o(O,"AutoModelForSequenceClassification"),O.forEach(s),x=o(E,"\uFF1A"),E.forEach(s),M=_($),g(y.$$.fragment,$)},m($,E){p($,t,E),l(t,c),l(t,n),l(n,b),l(t,d),l(t,h),l(h,w),l(t,x),p($,M,E),P(y,$,E),D=!0},i($){D||(k(y.$$.fragment,$),D=!0)},o($){j(y.$$.fragment,$),D=!1},d($){$&&s(t),$&&s(M),C(y,$)}}}function zp(v){let t,c;return t=new F({props:{code:"(2, 2)",highlighted:'(<span class="hljs-number">2</span>, <span class="hljs-number">2</span>)'}}),{c(){T(t.$$.fragment)},l(n){g(t.$$.fragment,n)},m(n,b){P(t,n,b),c=!0},i(n){c||(k(t.$$.fragment,n),c=!0)},o(n){j(t.$$.fragment,n),c=!1},d(n){C(t,n)}}}function Gp(v){let t,c;return t=new F({props:{code:"torch.Size([2, 2])",highlighted:'torch.Size([<span class="hljs-number">2</span>, <span class="hljs-number">2</span>])'}}),{c(){T(t.$$.fragment)},l(n){g(t.$$.fragment,n)},m(n,b){P(t,n,b),c=!0},i(n){c||(k(t.$$.fragment,n),c=!0)},o(n){j(t.$$.fragment,n),c=!1},d(n){C(t,n)}}}function Hp(v){let t,c;return t=new F({props:{code:`<tf.Tensor: shape=(2, 2), dtype=float32, numpy=
    array([[-1.5606991,  1.6122842],
           [ 4.169231 , -3.3464472]], dtype=float32)>`,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;`}}),{c(){T(t.$$.fragment)},l(n){g(t.$$.fragment,n)},m(n,b){P(t,n,b),c=!0},i(n){c||(k(t.$$.fragment,n),c=!0)},o(n){j(t.$$.fragment,n),c=!1},d(n){C(t,n)}}}function Vp(v){let t,c;return t=new F({props:{code:`tensor([[-1.5607,  1.6123],
        [ 4.1692, -3.3464]], grad_fn=<AddmmBackward>)`,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;)`}}),{c(){T(t.$$.fragment)},l(n){g(t.$$.fragment,n)},m(n,b){P(t,n,b),c=!0},i(n){c||(k(t.$$.fragment,n),c=!0)},o(n){j(t.$$.fragment,n),c=!1},d(n){C(t,n)}}}function Bp(v){let t,c;return t=new F({props:{code:"",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)`}}),{c(){T(t.$$.fragment)},l(n){g(t.$$.fragment,n)},m(n,b){P(t,n,b),c=!0},i(n){c||(k(t.$$.fragment,n),c=!0)},o(n){j(t.$$.fragment,n),c=!1},d(n){C(t,n)}}}function Rp(v){let t,c;return t=new F({props:{code:"",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)`}}),{c(){T(t.$$.fragment)},l(n){g(t.$$.fragment,n)},m(n,b){P(t,n,b),c=!0},i(n){c||(k(t.$$.fragment,n),c=!0)},o(n){j(t.$$.fragment,n),c=!1},d(n){C(t,n)}}}function Up(v){let t,c;return t=new F({props:{code:`tf.Tensor(
[[4.01951671e-02 9.59804833e-01]
 [9.9945587e-01 5.4418424e-04]], shape=(2, 2), dtype=float32)`,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)`}}),{c(){T(t.$$.fragment)},l(n){g(t.$$.fragment,n)},m(n,b){P(t,n,b),c=!0},i(n){c||(k(t.$$.fragment,n),c=!0)},o(n){j(t.$$.fragment,n),c=!1},d(n){C(t,n)}}}function Qp(v){let t,c;return t=new F({props:{code:`tensor([[4.0195e-02, 9.5980e-01],
        [9.9946e-01, 5.4418e-04]], grad_fn=<SoftmaxBackward>)`,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;)`}}),{c(){T(t.$$.fragment)},l(n){g(t.$$.fragment,n)},m(n,b){P(t,n,b),c=!0},i(n){c||(k(t.$$.fragment,n),c=!0)},o(n){j(t.$$.fragment,n),c=!1},d(n){C(t,n)}}}function Yp(v){let t,c,n,b,d;return{c(){t=i("p"),c=a("\u270F\uFE0F "),n=i("strong"),b=a("\u8BD5\u8BD5\u770B\uFF01"),d=a(" \u9009\u62E9\u4E24\u4E2A\uFF08\u6216\u66F4\u591A\uFF09\u4F60\u81EA\u5DF1\u7684\u6587\u672C\u5E76\u5728\u7BA1\u9053\u4E2D\u8FD0\u884C\u5B83\u4EEC\u3002\u7136\u540E\u81EA\u5DF1\u590D\u5236\u5728\u8FD9\u91CC\u770B\u5230\u7684\u6B65\u9AA4\uFF0C\u5E76\u68C0\u67E5\u662F\u5426\u83B7\u5F97\u76F8\u540C\u7684\u7ED3\u679C\uFF01")},l(h){t=f(h,"P",{});var w=u(t);c=o(w,"\u270F\uFE0F "),n=f(w,"STRONG",{});var x=u(n);b=o(x,"\u8BD5\u8BD5\u770B\uFF01"),x.forEach(s),d=o(w," \u9009\u62E9\u4E24\u4E2A\uFF08\u6216\u66F4\u591A\uFF09\u4F60\u81EA\u5DF1\u7684\u6587\u672C\u5E76\u5728\u7BA1\u9053\u4E2D\u8FD0\u884C\u5B83\u4EEC\u3002\u7136\u540E\u81EA\u5DF1\u590D\u5236\u5728\u8FD9\u91CC\u770B\u5230\u7684\u6B65\u9AA4\uFF0C\u5E76\u68C0\u67E5\u662F\u5426\u83B7\u5F97\u76F8\u540C\u7684\u7ED3\u679C\uFF01"),w.forEach(s)},m(h,w){p(h,t,w),l(t,c),l(t,n),l(n,b),l(t,d)},d(h){h&&s(t)}}}function Jp(v){let t,c,n,b,d,h,w,x,M,y,D,$,E,q,O,je,Zt,ms,en,sn,Wl,Oe,Xl,_s,ln,Kl,Se,Zl,ke,tn,bs,nn,rn,et,he,Ne,Ma,an,Le,Ia,st,ds,on,lt,ze,pn,tt,Ee,fn,sl,cn,un,nt,fe,Ge,mn,ll,_n,bn,dn,tl,hn,$n,nl,jn,rt,z,kn,He,En,vn,rl,wn,yn,al,Tn,gn,at,G,Pn,ol,Cn,Mn,pl,In,xn,Ve,Dn,Fn,ot,Be,pt,hs,qn,it,ve,An,il,On,Sn,ft,we,Nn,fl,Ln,zn,ct,B,R,$s,js,Gn,ut,U,Q,ks,N,Hn,cl,Vn,Bn,ul,Rn,Un,ml,Qn,Yn,_l,Jn,Wn,mt,Re,Xn,_t,Y,J,Es,vs,Kn,bt,H,Zn,bl,er,sr,dl,lr,tr,hl,nr,rr,dt,ws,ar,ht,ce,or,$l,pr,ir,ys,fr,cr,$t,Ue,ur,jt,Ts,mr,kt,ue,gs,jl,_r,br,dr,Ps,kl,hr,$r,jr,Cs,El,kr,Er,Et,Ms,vr,vt,Is,wr,wt,W,X,xs,V,yr,vl,Tr,gr,wl,Pr,Cr,yl,Mr,Ir,yt,Qe,xr,Tt,Ds,Dr,gt,$e,Ye,xa,Fr,Je,Da,Pt,Fs,qr,Ct,qs,Ar,Mt,As,Or,It,A,Os,Tl,Sr,Nr,Lr,gl,Pl,zr,Gr,Cl,Ml,Hr,Vr,Il,xl,Br,Rr,Dl,Fl,Ur,Qr,ql,Al,Yr,Jr,Ol,Sl,Wr,Xr,Nl,Kr,xt,K,Z,Ss,Ns,Zr,Dt,We,Ft,ee,se,Ls,zs,ea,qt,Xe,sa,At,Gs,la,Ot,Ke,St,le,te,Hs,L,ta,Ll,na,ra,zl,aa,oa,Gl,pa,ia,Ze,fa,ca,Nt,ne,re,Vs,ae,oe,Bs,me,ua,Hl,ma,_a,Vl,ba,da,Lt,ye,ha,Bl,$a,ja,zt,es,Gt,ss,Ht,Rs,ka,Vt,Te,Rl,Ea,va,Ul,wa,Bt,Us,ya,Rt,ge,Ut;n=new yp({props:{fw:v[0]}});const Fa=[gp,Tp],ls=[];function qa(e,r){return e[0]==="pt"?0:1}x=qa(v),M=ls[x]=Fa[x](v),D=new dp({props:{$$slots:{default:[Pp]},$$scope:{ctx:v}}});const Aa=[Mp,Cp],ts=[];function Oa(e,r){return e[0]==="pt"?0:1}E=Oa(v),q=ts[E]=Aa[E](v),Oe=new F({props:{code:"",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>,
    ]
)`}}),Se=new F({props:{code:`[{'label': 'POSITIVE', 'score': 0.9598047137260437},
 {'label': 'NEGATIVE', 'score': 0.9994558095932007}]`,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>}]`}}),Be=new F({props:{code:"",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)`}});const Sa=[xp,Ip],ns=[];function Na(e,r){return e[0]==="pt"?0:1}B=Na(v),R=ns[B]=Sa[B](v);const La=[Fp,Dp],rs=[];function za(e,r){return e[0]==="pt"?0:1}U=za(v),Q=rs[U]=La[U](v);const Ga=[Ap,qp],as=[];function Ha(e,r){return e[0]==="pt"?0:1}Y=Ha(v),J=as[Y]=Ga[Y](v);const Va=[Sp,Op],os=[];function Ba(e,r){return e[0]==="pt"?0:1}W=Ba(v),X=os[W]=Va[W](v);const Ra=[Lp,Np],ps=[];function Ua(e,r){return e[0]==="pt"?0:1}K=Ua(v),Z=ps[K]=Ra[K](v),We=new F({props:{code:"print(outputs.logits.shape)",highlighted:'<span class="hljs-built_in">print</span>(outputs.logits.shape)'}});const Qa=[Gp,zp],is=[];function Ya(e,r){return e[0]==="pt"?0:1}ee=Ya(v),se=is[ee]=Qa[ee](v),Ke=new F({props:{code:"print(outputs.logits)",highlighted:'<span class="hljs-built_in">print</span>(outputs.logits)'}});const Ja=[Vp,Hp],fs=[];function Wa(e,r){return e[0]==="pt"?0:1}le=Wa(v),te=fs[le]=Ja[le](v);const Xa=[Rp,Bp],cs=[];function Ka(e,r){return e[0]==="pt"?0:1}ne=Ka(v),re=cs[ne]=Xa[ne](v);const Za=[Qp,Up],us=[];function eo(e,r){return e[0]==="pt"?0:1}return ae=eo(v),oe=us[ae]=Za[ae](v),es=new F({props:{code:"model.config.id2label",highlighted:"model.config.id2label"}}),ss=new F({props:{code:"{0: 'NEGATIVE', 1: 'POSITIVE'}",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>}'}}),ge=new dp({props:{$$slots:{default:[Yp]},$$scope:{ctx:v}}}),{c(){t=i("meta"),c=m(),T(n.$$.fragment),b=m(),d=i("h1"),h=a("\u7BA1\u9053\u7684\u5185\u90E8"),w=m(),M.c(),y=m(),T(D.$$.fragment),$=m(),q.c(),O=m(),je=i("p"),Zt=a("\u8BA9\u6211\u4EEC\u4ECE\u4E00\u4E2A\u5B8C\u6574\u7684\u793A\u4F8B\u5F00\u59CB\uFF0C\u770B\u770B\u5728"),ms=i("a"),en=a("Chapter 1"),sn=a("\u4E2D\u6267\u884C\u4EE5\u4E0B\u4EE3\u7801\u65F6\u5728\u5E55\u540E\u53D1\u751F\u4E86\u4EC0\u4E48"),Wl=m(),T(Oe.$$.fragment),Xl=m(),_s=i("p"),ln=a("\u83B7\u5F97:"),Kl=m(),T(Se.$$.fragment),Zl=m(),ke=i("p"),tn=a("\u6B63\u5982\u6211\u4EEC\u5728"),bs=i("a"),nn=a("Chapter 1"),rn=a("\u4E2D\u770B\u5230\u7684\uFF0C\u6B64\u7BA1\u9053\u5C06\u4E09\u4E2A\u6B65\u9AA4\u7EC4\u5408\u5728\u4E00\u8D77\uFF1A\u9884\u5904\u7406\u3001\u901A\u8FC7\u6A21\u578B\u4F20\u9012\u8F93\u5165\u548C\u540E\u5904\u7406\uFF1A"),et=m(),he=i("div"),Ne=i("img"),an=m(),Le=i("img"),st=m(),ds=i("p"),on=a("\u8BA9\u6211\u4EEC\u5FEB\u901F\u6D4F\u89C8\u4E00\u4E0B\u8FD9\u4E9B\u5185\u5BB9\u3002"),lt=m(),ze=i("h2"),pn=a("\u4F7F\u7528\u5206\u8BCD\u5668\u8FDB\u884C\u9884\u5904\u7406"),tt=m(),Ee=i("p"),fn=a("\u4E0E\u5176\u4ED6\u795E\u7ECF\u7F51\u7EDC\u4E00\u6837\uFF0CTransformer\u6A21\u578B\u65E0\u6CD5\u76F4\u63A5\u5904\u7406\u539F\u59CB\u6587\u672C\uFF0C \u56E0\u6B64\u6211\u4EEC\u7BA1\u9053\u7684\u7B2C\u4E00\u6B65\u662F\u5C06\u6587\u672C\u8F93\u5165\u8F6C\u6362\u4E3A\u6A21\u578B\u80FD\u591F\u7406\u89E3\u7684\u6570\u5B57\u3002 \u4E3A\u6B64\uFF0C\u6211\u4EEC\u4F7F\u7528"),sl=i("em"),cn=a("tokenizer"),un=a("(\u6807\u8BB0\u5668)\uFF0C\u8D1F\u8D23\uFF1A"),nt=m(),fe=i("ul"),Ge=i("li"),mn=a("\u5C06\u8F93\u5165\u62C6\u5206\u4E3A\u5355\u8BCD\u3001\u5B50\u5355\u8BCD\u6216\u7B26\u53F7\uFF08\u5982\u6807\u70B9\u7B26\u53F7\uFF09\uFF0C\u79F0\u4E3A\u6807\u8BB0("),ll=i("em"),_n=a("token"),bn=a(")"),dn=m(),tl=i("li"),hn=a("\u5C06\u6BCF\u4E2A\u6807\u8BB0(token)\u6620\u5C04\u5230\u4E00\u4E2A\u6574\u6570"),$n=m(),nl=i("li"),jn=a("\u6DFB\u52A0\u53EF\u80FD\u5BF9\u6A21\u578B\u6709\u7528\u7684\u5176\u4ED6\u8F93\u5165"),rt=m(),z=i("p"),kn=a("\u6240\u6709\u8FD9\u4E9B\u9884\u5904\u7406\u90FD\u9700\u8981\u4EE5\u4E0E\u6A21\u578B\u9884\u8BAD\u7EC3\u65F6\u5B8C\u5168\u76F8\u540C\u7684\u65B9\u5F0F\u5B8C\u6210\uFF0C\u56E0\u6B64\u6211\u4EEC\u9996\u5148\u9700\u8981\u4ECE"),He=i("a"),En=a("Model Hub"),vn=a("\u4E2D\u4E0B\u8F7D\u8FD9\u4E9B\u4FE1\u606F\u3002\u4E3A\u6B64\uFF0C\u6211\u4EEC\u4F7F\u7528"),rl=i("code"),wn=a("AutoTokenizer"),yn=a("\u7C7B\u53CA\u5176"),al=i("code"),Tn=a("from_pretrained()"),gn=a("\u65B9\u6CD5\u3002\u4F7F\u7528\u6211\u4EEC\u6A21\u578B\u7684\u68C0\u67E5\u70B9\u540D\u79F0\uFF0C\u5B83\u5C06\u81EA\u52A8\u83B7\u53D6\u4E0E\u6A21\u578B\u7684\u6807\u8BB0\u5668\u76F8\u5173\u8054\u7684\u6570\u636E\uFF0C\u5E76\u5BF9\u5176\u8FDB\u884C\u7F13\u5B58\uFF08\u56E0\u6B64\u53EA\u6709\u5728\u60A8\u7B2C\u4E00\u6B21\u8FD0\u884C\u4E0B\u9762\u7684\u4EE3\u7801\u65F6\u624D\u4F1A\u4E0B\u8F7D\uFF09\u3002"),at=m(),G=i("p"),Pn=a("\u56E0\u4E3A"),ol=i("code"),Cn=a("sentiment-analysis"),Mn=a("\uFF08\u60C5\u7EEA\u5206\u6790\uFF09\u7BA1\u9053\u7684\u9ED8\u8BA4\u68C0\u67E5\u70B9\u662F"),pl=i("code"),In=a("distilbert-base-uncased-finetuned-sst-2-english"),xn=a("\uFF08\u4F60\u53EF\u4EE5\u770B\u5230\u5B83\u7684\u6A21\u578B\u5361"),Ve=i("a"),Dn=a("here"),Fn=a(")\uFF0C\u6211\u4EEC\u8FD0\u884C\u4EE5\u4E0B\u7A0B\u5E8F\uFF1A"),ot=m(),T(Be.$$.fragment),pt=m(),hs=i("p"),qn=a("\u4E00\u65E6\u6211\u4EEC\u6709\u4E86\u6807\u8BB0\u5668\uFF0C\u6211\u4EEC\u5C31\u53EF\u4EE5\u76F4\u63A5\u5C06\u6211\u4EEC\u7684\u53E5\u5B50\u4F20\u9012\u7ED9\u5B83\uFF0C\u7136\u540E\u6211\u4EEC\u5C31\u4F1A\u5F97\u5230\u4E00\u672C\u5B57\u5178\uFF0C\u5B83\u53EF\u4EE5\u63D0\u4F9B\u7ED9\u6211\u4EEC\u7684\u6A21\u578B\uFF01\u5269\u4E0B\u8981\u505A\u7684\u552F\u4E00\u4E00\u4EF6\u4E8B\u5C31\u662F\u5C06\u8F93\u5165ID\u5217\u8868\u8F6C\u6362\u4E3A\u5F20\u91CF\u3002"),it=m(),ve=i("p"),An=a("\u60A8\u53EF\u4EE5\u4F7F\u7528\u{1F917} Transformers\uFF0C\u800C\u4E0D\u5FC5\u62C5\u5FC3\u54EA\u4E2AML\u6846\u67B6\u88AB\u7528\u4F5C\u540E\u7AEF\uFF1B\u5B83\u53EF\u80FD\u662FPyTorch\u6216TensorFlow\uFF0C\u6216Flax\u3002\u4F46\u662F\uFF0CTransformers\u578B\u53F7\u53EA\u63A5\u53D7"),il=i("em"),On=a("\u5F20\u91CF"),Sn=a("\u4F5C\u4E3A\u8F93\u5165\u3002\u5982\u679C\u8FD9\u662F\u4F60\u7B2C\u4E00\u6B21\u542C\u8BF4\u5F20\u91CF\uFF0C\u4F60\u53EF\u4EE5\u628A\u5B83\u4EEC\u60F3\u8C61\u6210NumPy\u6570\u7EC4\u3002NumPy\u6570\u7EC4\u53EF\u4EE5\u662F\u6807\u91CF\uFF080D\uFF09\u3001\u5411\u91CF\uFF081D\uFF09\u3001\u77E9\u9635\uFF082D\uFF09\u6216\u5177\u6709\u66F4\u591A\u7EF4\u5EA6\u3002\u5B83\u5B9E\u9645\u4E0A\u662F\u5F20\u91CF\uFF1B\u5176\u4ED6ML\u6846\u67B6\u7684\u5F20\u91CF\u884C\u4E3A\u7C7B\u4F3C\uFF0C\u901A\u5E38\u4E0ENumPy\u6570\u7EC4\u4E00\u6837\u6613\u4E8E\u5B9E\u4F8B\u5316\u3002"),ft=m(),we=i("p"),Nn=a("\u8981\u6307\u5B9A\u8981\u8FD4\u56DE\u7684\u5F20\u91CF\u7C7B\u578B\uFF08PyTorch\u3001TensorFlow\u6216plain NumPy\uFF09\uFF0C\u6211\u4EEC\u4F7F\u7528"),fl=i("code"),Ln=a("return_tensors"),zn=a("\u53C2\u6570\uFF1A"),ct=m(),R.c(),$s=m(),js=i("p"),Gn=a("\u73B0\u5728\u4E0D\u8981\u62C5\u5FC3\u586B\u5145\u548C\u622A\u65AD\uFF1B\u6211\u4EEC\u7A0D\u540E\u4F1A\u89E3\u91CA\u8FD9\u4E9B\u3002\u8FD9\u91CC\u8981\u8BB0\u4F4F\u7684\u4E3B\u8981\u4E8B\u60C5\u662F\uFF0C\u60A8\u53EF\u4EE5\u4F20\u9012\u4E00\u4E2A\u53E5\u5B50\u6216\u4E00\u7EC4\u53E5\u5B50\uFF0C\u8FD8\u53EF\u4EE5\u6307\u5B9A\u8981\u8FD4\u56DE\u7684\u5F20\u91CF\u7C7B\u578B\uFF08\u5982\u679C\u6CA1\u6709\u4F20\u9012\u7C7B\u578B\uFF0C\u60A8\u5C06\u5F97\u5230\u4E00\u7EC4\u5217\u8868\uFF09\u3002"),ut=m(),Q.c(),ks=m(),N=i("p"),Hn=a("\u8F93\u51FA\u672C\u8EAB\u662F\u4E00\u4E2A\u5305\u542B\u4E24\u4E2A\u952E\u7684\u5B57\u5178\uFF0C"),cl=i("code"),Vn=a("input_ids"),Bn=a("\u548C"),ul=i("code"),Rn=a("attention_mask"),Un=a("\u3002"),ml=i("code"),Qn=a("input_ids"),Yn=a("\u5305\u542B\u4E24\u884C\u6574\u6570\uFF08\u6BCF\u4E2A\u53E5\u5B50\u4E00\u884C\uFF09\uFF0C\u5B83\u4EEC\u662F\u6BCF\u4E2A\u53E5\u5B50\u4E2D\u6807\u8BB0\u7684\u552F\u4E00\u6807\u8BB0\uFF08token\uFF09\u3002\u6211\u4EEC\u5C06\u5728\u672C\u7AE0\u540E\u9762\u89E3\u91CA\u4EC0\u4E48\u662F"),_l=i("code"),Jn=a("attention_mask"),Wn=a("\u3002"),mt=m(),Re=i("h2"),Xn=a("\u6D4F\u89C8\u6A21\u578B"),_t=m(),J.c(),Es=m(),vs=i("p"),Kn=a("\u5728\u8FD9\u4E2A\u4EE3\u7801\u7247\u6BB5\u4E2D\uFF0C\u6211\u4EEC\u4E0B\u8F7D\u4E86\u4E4B\u524D\u5728\u7BA1\u9053\u4E2D\u4F7F\u7528\u7684\u76F8\u540C\u68C0\u67E5\u70B9\uFF08\u5B83\u5B9E\u9645\u4E0A\u5E94\u8BE5\u5DF2\u7ECF\u88AB\u7F13\u5B58\uFF09\uFF0C\u5E76\u7528\u5B83\u5B9E\u4F8B\u5316\u4E86\u4E00\u4E2A\u6A21\u578B\u3002"),bt=m(),H=i("p"),Zn=a("\u8FD9\u4E2A\u67B6\u6784\u53EA\u5305\u542B\u57FA\u672C\u8F6C\u6362\u5668\u6A21\u5757\uFF1A\u7ED9\u5B9A\u4E00\u4E9B\u8F93\u5165\uFF0C\u5B83\u8F93\u51FA\u6211\u4EEC\u5C06\u8C03\u7528\u7684\u5185\u5BB9"),bl=i("em"),er=a("\u9690\u85CF\u72B6\u6001\uFF08hidden states\uFF09"),sr=a("\uFF0C\u4EA6\u79F0"),dl=i("em"),lr=a("\u7279\u5F81\uFF08features\uFF09"),tr=a("\u3002\u5BF9\u4E8E\u6BCF\u4E2A\u6A21\u578B\u8F93\u5165\uFF0C\u6211\u4EEC\u5C06\u68C0\u7D22\u4E00\u4E2A\u9AD8\u7EF4\u5411\u91CF\uFF0C\u8868\u793A"),hl=i("strong"),nr=a("Transformer\u6A21\u578B\u5BF9\u8BE5\u8F93\u5165\u7684\u4E0A\u4E0B\u6587\u7406\u89E3"),rr=a("\u3002"),dt=m(),ws=i("p"),ar=a("\u5982\u679C\u8FD9\u4E0D\u5408\u7406\uFF0C\u4E0D\u8981\u62C5\u5FC3\u3002\u6211\u4EEC\u4EE5\u540E\u518D\u89E3\u91CA\u3002"),ht=m(),ce=i("p"),or=a("\u867D\u7136\u8FD9\u4E9B\u9690\u85CF\u72B6\u6001\u672C\u8EAB\u53EF\u80FD\u5F88\u6709\u7528\uFF0C\u4F46\u5B83\u4EEC\u901A\u5E38\u662F\u6A21\u578B\u53E6\u4E00\u90E8\u5206\uFF08\u79F0\u4E3A"),$l=i("em"),pr=a("\u5934\u90E8(head)"),ir=a("\uFF09\u7684\u8F93\u5165\u3002 \u5728"),ys=i("a"),fr=a("Chapter 1"),cr=a("\u4E2D\uFF0C\u53EF\u4EE5\u4F7F\u7528\u76F8\u540C\u7684\u4F53\u7CFB\u7ED3\u6784\u6267\u884C\u4E0D\u540C\u7684\u4EFB\u52A1\uFF0C\u4F46\u8FD9\u4E9B\u4EFB\u52A1\u4E2D\u7684\u6BCF\u4E2A\u4EFB\u52A1\u90FD\u6709\u4E00\u4E2A\u4E0E\u4E4B\u5173\u8054\u7684\u4E0D\u540C\u5934\u3002"),$t=m(),Ue=i("h3"),ur=a("\u9AD8\u7EF4\u5411\u91CF\uFF1F"),jt=m(),Ts=i("p"),mr=a("Transformers\u6A21\u5757\u7684\u77E2\u91CF\u8F93\u51FA\u901A\u5E38\u8F83\u5927\u3002\u5B83\u901A\u5E38\u6709\u4E09\u4E2A\u7EF4\u5EA6\uFF1A"),kt=m(),ue=i("ul"),gs=i("li"),jl=i("strong"),_r=a("Batch size"),br=a(": \u4E00\u6B21\u5904\u7406\u7684\u5E8F\u5217\u6570\uFF08\u5728\u6211\u4EEC\u7684\u793A\u4F8B\u4E2D\u4E3A2\uFF09\u3002"),dr=m(),Ps=i("li"),kl=i("strong"),hr=a("Sequence length"),$r=a(": \u5E8F\u5217\u7684\u6570\u503C\u8868\u793A\u7684\u957F\u5EA6\uFF08\u5728\u6211\u4EEC\u7684\u793A\u4F8B\u4E2D\u4E3A16\uFF09\u3002"),jr=m(),Cs=i("li"),El=i("strong"),kr=a("Hidden size"),Er=a(": \u6BCF\u4E2A\u6A21\u578B\u8F93\u5165\u7684\u5411\u91CF\u7EF4\u5EA6\u3002"),Et=m(),Ms=i("p"),vr=a("\u7531\u4E8E\u6700\u540E\u4E00\u4E2A\u503C\uFF0C\u5B83\u88AB\u79F0\u4E3A\u201C\u9AD8\u7EF4\u201D\u3002\u9690\u85CF\u7684\u5927\u5C0F\u53EF\u80FD\u975E\u5E38\u5927\uFF08768\u901A\u5E38\u7528\u4E8E\u8F83\u5C0F\u7684\u578B\u53F7\uFF0C\u800C\u5728\u8F83\u5927\u7684\u578B\u53F7\u4E2D\uFF0C\u8FD9\u53EF\u80FD\u8FBE\u52303072\u6216\u66F4\u5927\uFF09\u3002"),vt=m(),Is=i("p"),wr=a("\u5982\u679C\u6211\u4EEC\u5C06\u9884\u5904\u7406\u7684\u8F93\u5165\u8F93\u5165\u5230\u6A21\u578B\u4E2D\uFF0C\u6211\u4EEC\u53EF\u4EE5\u770B\u5230\u8FD9\u4E00\u70B9\uFF1A"),wt=m(),X.c(),xs=m(),V=i("p"),yr=a("\u6CE8\u610F\u{1F917} Transformers\u6A21\u578B\u7684\u8F93\u51FA\u4E0E"),vl=i("code"),Tr=a("namedtuple"),gr=a("\u6216\u8BCD\u5178\u76F8\u4F3C\u3002\u60A8\u53EF\u4EE5\u901A\u8FC7\u5C5E\u6027\uFF08\u5C31\u50CF\u6211\u4EEC\u6240\u505A\u7684\u90A3\u6837\uFF09\u6216\u952E\uFF08"),wl=i("code"),Pr=a('\u8F93\u51FA["last_hidden_state"]'),Cr=a("\uFF09\u8BBF\u95EE\u5143\u7D20\uFF0C\u751A\u81F3\u53EF\u4EE5\u901A\u8FC7\u7D22\u5F15\u8BBF\u95EE\u5143\u7D20\uFF0C\u524D\u63D0\u662F\u60A8\u786E\u5207\u77E5\u9053\u8981\u67E5\u627E\u7684\u5185\u5BB9\u5728\u54EA\u91CC\uFF08"),yl=i("code"),Mr=a("outputs[0]"),Ir=a("\uFF09\u3002"),yt=m(),Qe=i("h3"),xr=a("\u6A21\u578B\u5934\uFF1A\u6570\u5B57\u7684\u610F\u4E49"),Tt=m(),Ds=i("p"),Dr=a("\u6A21\u578B\u5934\u5C06\u9690\u85CF\u72B6\u6001\u7684\u9AD8\u7EF4\u5411\u91CF\u4F5C\u4E3A\u8F93\u5165\uFF0C\u5E76\u5C06\u5176\u6295\u5F71\u5230\u4E0D\u540C\u7684\u7EF4\u5EA6\u3002\u5B83\u4EEC\u901A\u5E38\u7531\u4E00\u4E2A\u6216\u51E0\u4E2A\u7EBF\u6027\u5C42\u7EC4\u6210\uFF1A"),gt=m(),$e=i("div"),Ye=i("img"),Fr=m(),Je=i("img"),Pt=m(),Fs=i("p"),qr=a("Transformers\u6A21\u578B\u7684\u8F93\u51FA\u76F4\u63A5\u53D1\u9001\u5230\u6A21\u578B\u5934\u8FDB\u884C\u5904\u7406\u3002"),Ct=m(),qs=i("p"),Ar=a("\u5728\u6B64\u56FE\u4E2D\uFF0C\u6A21\u578B\u7531\u5176\u5D4C\u5165\u5C42\u548C\u540E\u7EED\u5C42\u8868\u793A\u3002\u5D4C\u5165\u5C42\u5C06\u6807\u8BB0\u5316\u8F93\u5165\u4E2D\u7684\u6BCF\u4E2A\u8F93\u5165ID\u8F6C\u6362\u4E3A\u8868\u793A\u5173\u8054\u6807\u8BB0(token)\u7684\u5411\u91CF\u3002\u540E\u7EED\u5C42\u4F7F\u7528\u6CE8\u610F\u673A\u5236\u64CD\u7EB5\u8FD9\u4E9B\u5411\u91CF\uFF0C\u4EE5\u751F\u6210\u53E5\u5B50\u7684\u6700\u7EC8\u8868\u793A\u3002"),Mt=m(),As=i("p"),Or=a("\u{1F917} Transformers\u4E2D\u6709\u8BB8\u591A\u4E0D\u540C\u7684\u4F53\u7CFB\u7ED3\u6784\uFF0C\u6BCF\u79CD\u4F53\u7CFB\u7ED3\u6784\u90FD\u662F\u56F4\u7ED5\u5904\u7406\u7279\u5B9A\u4EFB\u52A1\u800C\u8BBE\u8BA1\u7684\u3002\u4EE5\u4E0B\u662F\u4E00\u4E2A\u975E\u8BE6\u5C3D\u7684\u5217\u8868\uFF1A"),It=m(),A=i("ul"),Os=i("li"),Tl=i("code"),Sr=a("*Model"),Nr=a(" (retrieve the hidden states)"),Lr=m(),gl=i("li"),Pl=i("code"),zr=a("*ForCausalLM"),Gr=m(),Cl=i("li"),Ml=i("code"),Hr=a("*ForMaskedLM"),Vr=m(),Il=i("li"),xl=i("code"),Br=a("*ForMultipleChoice"),Rr=m(),Dl=i("li"),Fl=i("code"),Ur=a("*ForQuestionAnswering"),Qr=m(),ql=i("li"),Al=i("code"),Yr=a("*ForSequenceClassification"),Jr=m(),Ol=i("li"),Sl=i("code"),Wr=a("*ForTokenClassification"),Xr=m(),Nl=i("li"),Kr=a("\u4EE5\u53CA\u5176\u4ED6 \u{1F917}"),xt=m(),Z.c(),Ss=m(),Ns=i("p"),Zr=a("\u73B0\u5728\uFF0C\u5982\u679C\u6211\u4EEC\u89C2\u5BDF\u8F93\u5165\u7684\u5F62\u72B6\uFF0C\u7EF4\u5EA6\u5C06\u4F4E\u5F97\u591A\uFF1A\u6A21\u578B\u5934\u5C06\u6211\u4EEC\u4E4B\u524D\u770B\u5230\u7684\u9AD8\u7EF4\u5411\u91CF\u4F5C\u4E3A\u8F93\u5165\uFF0C\u5E76\u8F93\u51FA\u5305\u542B\u4E24\u4E2A\u503C\u7684\u5411\u91CF\uFF08\u6BCF\u4E2A\u6807\u7B7E\u4E00\u4E2A\uFF09\uFF1A"),Dt=m(),T(We.$$.fragment),Ft=m(),se.c(),Ls=m(),zs=i("p"),ea=a("\u56E0\u4E3A\u6211\u4EEC\u53EA\u6709\u4E24\u4E2A\u53E5\u5B50\u548C\u4E24\u4E2A\u6807\u7B7E\uFF0C\u6240\u4EE5\u6211\u4EEC\u4ECE\u6A21\u578B\u4E2D\u5F97\u5230\u7684\u7ED3\u679C\u662F2 x 2\u7684\u5F62\u72B6\u3002"),qt=m(),Xe=i("h2"),sa=a("\u5BF9\u8F93\u51FA\u8FDB\u884C\u540E\u5904\u7406"),At=m(),Gs=i("p"),la=a("\u6211\u4EEC\u4ECE\u6A21\u578B\u4E2D\u5F97\u5230\u7684\u8F93\u51FA\u503C\u672C\u8EAB\u5E76\u4E0D\u4E00\u5B9A\u6709\u610F\u4E49\u3002\u6211\u4EEC\u6765\u770B\u770B,"),Ot=m(),T(Ke.$$.fragment),St=m(),te.c(),Hs=m(),L=i("p"),ta=a("\u6211\u4EEC\u7684\u6A21\u578B\u9884\u6D4B\u7B2C\u4E00\u53E5\u4E3A"),Ll=i("code"),na=a("[-1.5607, 1.6123]"),ra=a("\uFF0C\u7B2C\u4E8C\u53E5\u4E3A"),zl=i("code"),aa=a("[ 4.1692, -3.3464]"),oa=a("\u3002\u8FD9\u4E9B\u4E0D\u662F\u6982\u7387\uFF0C\u800C\u662F"),Gl=i("em"),pa=a("logits"),ia=a("\uFF0C\u5373\u6A21\u578B\u6700\u540E\u4E00\u5C42\u8F93\u51FA\u7684\u539F\u59CB\u975E\u6807\u51C6\u5316\u5206\u6570\u3002\u8981\u8F6C\u6362\u4E3A\u6982\u7387\uFF0C\u5B83\u4EEC\u9700\u8981\u7ECF\u8FC7"),Ze=i("a"),fa=a("SoftMax"),ca=a("\u5C42\uFF08\u6240\u6709\u{1F917}Transformers\u6A21\u578B\u8F93\u51FAlogits\uFF0C\u56E0\u4E3A\u7528\u4E8E\u8BAD\u7EC3\u7684\u635F\u8017\u51FD\u6570\u901A\u5E38\u4F1A\u5C06\u6700\u540E\u7684\u6FC0\u6D3B\u51FD\u6570\uFF08\u5982SoftMax\uFF09\u4E0E\u5B9E\u9645\u635F\u8017\u51FD\u6570\uFF08\u5982\u4EA4\u53C9\u71B5\uFF09\u878D\u5408\uFF09\uFF1A"),Nt=m(),re.c(),Vs=m(),oe.c(),Bs=m(),me=i("p"),ua=a("\u73B0\u5728\u6211\u4EEC\u53EF\u4EE5\u770B\u5230\uFF0C\u6A21\u578B\u9884\u6D4B\u7B2C\u4E00\u53E5\u4E3A"),Hl=i("code"),ma=a("[0.0402, 0.9598]"),_a=a("\uFF0C\u7B2C\u4E8C\u53E5\u4E3A"),Vl=i("code"),ba=a("[0.9995, 0.0005]"),da=a("\u3002\u8FD9\u4E9B\u662F\u53EF\u8BC6\u522B\u7684\u6982\u7387\u5206\u6570\u3002"),Lt=m(),ye=i("p"),ha=a("\u4E3A\u4E86\u83B7\u5F97\u6BCF\u4E2A\u4F4D\u7F6E\u5BF9\u5E94\u7684\u6807\u7B7E\uFF0C\u6211\u4EEC\u53EF\u4EE5\u68C0\u67E5\u6A21\u578B\u914D\u7F6E\u7684"),Bl=i("code"),$a=a("id2label"),ja=a("\u5C5E\u6027\uFF08\u4E0B\u4E00\u8282\u5C06\u5BF9\u6B64\u8FDB\u884C\u8BE6\u7EC6\u4ECB\u7ECD\uFF09\uFF1A"),zt=m(),T(es.$$.fragment),Gt=m(),T(ss.$$.fragment),Ht=m(),Rs=i("p"),ka=a("\u73B0\u5728\u6211\u4EEC\u53EF\u4EE5\u5F97\u51FA\u7ED3\u8BBA\uFF0C\u8BE5\u6A21\u578B\u9884\u6D4B\u4E86\u4EE5\u4E0B\u51E0\u70B9\uFF1A"),Vt=m(),Te=i("ul"),Rl=i("li"),Ea=a("\u7B2C\u4E00\u53E5\uFF1A\u5426\u5B9A\uFF1A0.0402\uFF0C\u80AF\u5B9A\uFF1A0.9598"),va=m(),Ul=i("li"),wa=a("\u7B2C\u4E8C\u53E5\uFF1A\u5426\u5B9A\uFF1A0.9995\uFF0C\u80AF\u5B9A\uFF1A0.0005"),Bt=m(),Us=i("p"),ya=a("\u6211\u4EEC\u5DF2\u7ECF\u6210\u529F\u5730\u590D\u5236\u4E86\u7BA1\u9053\u7684\u4E09\u4E2A\u6B65\u9AA4\uFF1A\u4F7F\u7528\u6807\u8BB0\u5316\u5668\u8FDB\u884C\u9884\u5904\u7406\u3001\u901A\u8FC7\u6A21\u578B\u4F20\u9012\u8F93\u5165\u4EE5\u53CA\u540E\u5904\u7406\uFF01\u73B0\u5728\uFF0C\u8BA9\u6211\u4EEC\u82B1\u4E00\u4E9B\u65F6\u95F4\u6DF1\u5165\u4E86\u89E3\u8FD9\u4E9B\u6B65\u9AA4\u4E2D\u7684\u6BCF\u4E00\u6B65\u3002"),Rt=m(),T(ge.$$.fragment),this.h()},l(e){const r=vp('[data-svelte="svelte-1phssyn"]',document.head);t=f(r,"META",{name:!0,content:!0}),r.forEach(s),c=_(e),g(n.$$.fragment,e),b=_(e),d=f(e,"H1",{id:!0});var Ql=u(d);h=o(Ql,"\u7BA1\u9053\u7684\u5185\u90E8"),Ql.forEach(s),w=_(e),M.l(e),y=_(e),g(D.$$.fragment,e),$=_(e),q.l(e),O=_(e),je=f(e,"P",{});var Pe=u(je);Zt=o(Pe,"\u8BA9\u6211\u4EEC\u4ECE\u4E00\u4E2A\u5B8C\u6574\u7684\u793A\u4F8B\u5F00\u59CB\uFF0C\u770B\u770B\u5728"),ms=f(Pe,"A",{href:!0});var Yl=u(ms);en=o(Yl,"Chapter 1"),Yl.forEach(s),sn=o(Pe,"\u4E2D\u6267\u884C\u4EE5\u4E0B\u4EE3\u7801\u65F6\u5728\u5E55\u540E\u53D1\u751F\u4E86\u4EC0\u4E48"),Pe.forEach(s),Wl=_(e),g(Oe.$$.fragment,e),Xl=_(e),_s=f(e,"P",{});var Qs=u(_s);ln=o(Qs,"\u83B7\u5F97:"),Qs.forEach(s),Kl=_(e),g(Se.$$.fragment,e),Zl=_(e),ke=f(e,"P",{});var Ce=u(ke);tn=o(Ce,"\u6B63\u5982\u6211\u4EEC\u5728"),bs=f(Ce,"A",{href:!0});var Ys=u(bs);nn=o(Ys,"Chapter 1"),Ys.forEach(s),rn=o(Ce,"\u4E2D\u770B\u5230\u7684\uFF0C\u6B64\u7BA1\u9053\u5C06\u4E09\u4E2A\u6B65\u9AA4\u7EC4\u5408\u5728\u4E00\u8D77\uFF1A\u9884\u5904\u7406\u3001\u901A\u8FC7\u6A21\u578B\u4F20\u9012\u8F93\u5165\u548C\u540E\u5904\u7406\uFF1A"),Ce.forEach(s),et=_(e),he=f(e,"DIV",{class:!0});var Me=u(he);Ne=f(Me,"IMG",{class:!0,src:!0,alt:!0}),an=_(Me),Le=f(Me,"IMG",{class:!0,src:!0,alt:!0}),Me.forEach(s),st=_(e),ds=f(e,"P",{});var Js=u(ds);on=o(Js,"\u8BA9\u6211\u4EEC\u5FEB\u901F\u6D4F\u89C8\u4E00\u4E0B\u8FD9\u4E9B\u5185\u5BB9\u3002"),Js.forEach(s),lt=_(e),ze=f(e,"H2",{id:!0});var Ws=u(ze);pn=o(Ws,"\u4F7F\u7528\u5206\u8BCD\u5668\u8FDB\u884C\u9884\u5904\u7406"),Ws.forEach(s),tt=_(e),Ee=f(e,"P",{});var Ie=u(Ee);fn=o(Ie,"\u4E0E\u5176\u4ED6\u795E\u7ECF\u7F51\u7EDC\u4E00\u6837\uFF0CTransformer\u6A21\u578B\u65E0\u6CD5\u76F4\u63A5\u5904\u7406\u539F\u59CB\u6587\u672C\uFF0C \u56E0\u6B64\u6211\u4EEC\u7BA1\u9053\u7684\u7B2C\u4E00\u6B65\u662F\u5C06\u6587\u672C\u8F93\u5165\u8F6C\u6362\u4E3A\u6A21\u578B\u80FD\u591F\u7406\u89E3\u7684\u6570\u5B57\u3002 \u4E3A\u6B64\uFF0C\u6211\u4EEC\u4F7F\u7528"),sl=f(Ie,"EM",{});var Xs=u(sl);cn=o(Xs,"tokenizer"),Xs.forEach(s),un=o(Ie,"(\u6807\u8BB0\u5668)\uFF0C\u8D1F\u8D23\uFF1A"),Ie.forEach(s),nt=_(e),fe=f(e,"UL",{});var _e=u(fe);Ge=f(_e,"LI",{});var xe=u(Ge);mn=o(xe,"\u5C06\u8F93\u5165\u62C6\u5206\u4E3A\u5355\u8BCD\u3001\u5B50\u5355\u8BCD\u6216\u7B26\u53F7\uFF08\u5982\u6807\u70B9\u7B26\u53F7\uFF09\uFF0C\u79F0\u4E3A\u6807\u8BB0("),ll=f(xe,"EM",{});var Jl=u(ll);_n=o(Jl,"token"),Jl.forEach(s),bn=o(xe,")"),xe.forEach(s),dn=_(_e),tl=f(_e,"LI",{});var so=u(tl);hn=o(so,"\u5C06\u6BCF\u4E2A\u6807\u8BB0(token)\u6620\u5C04\u5230\u4E00\u4E2A\u6574\u6570"),so.forEach(s),$n=_(_e),nl=f(_e,"LI",{});var lo=u(nl);jn=o(lo,"\u6DFB\u52A0\u53EF\u80FD\u5BF9\u6A21\u578B\u6709\u7528\u7684\u5176\u4ED6\u8F93\u5165"),lo.forEach(s),_e.forEach(s),rt=_(e),z=f(e,"P",{});var De=u(z);kn=o(De,"\u6240\u6709\u8FD9\u4E9B\u9884\u5904\u7406\u90FD\u9700\u8981\u4EE5\u4E0E\u6A21\u578B\u9884\u8BAD\u7EC3\u65F6\u5B8C\u5168\u76F8\u540C\u7684\u65B9\u5F0F\u5B8C\u6210\uFF0C\u56E0\u6B64\u6211\u4EEC\u9996\u5148\u9700\u8981\u4ECE"),He=f(De,"A",{href:!0,rel:!0});var to=u(He);En=o(to,"Model Hub"),to.forEach(s),vn=o(De,"\u4E2D\u4E0B\u8F7D\u8FD9\u4E9B\u4FE1\u606F\u3002\u4E3A\u6B64\uFF0C\u6211\u4EEC\u4F7F\u7528"),rl=f(De,"CODE",{});var no=u(rl);wn=o(no,"AutoTokenizer"),no.forEach(s),yn=o(De,"\u7C7B\u53CA\u5176"),al=f(De,"CODE",{});var ro=u(al);Tn=o(ro,"from_pretrained()"),ro.forEach(s),gn=o(De,"\u65B9\u6CD5\u3002\u4F7F\u7528\u6211\u4EEC\u6A21\u578B\u7684\u68C0\u67E5\u70B9\u540D\u79F0\uFF0C\u5B83\u5C06\u81EA\u52A8\u83B7\u53D6\u4E0E\u6A21\u578B\u7684\u6807\u8BB0\u5668\u76F8\u5173\u8054\u7684\u6570\u636E\uFF0C\u5E76\u5BF9\u5176\u8FDB\u884C\u7F13\u5B58\uFF08\u56E0\u6B64\u53EA\u6709\u5728\u60A8\u7B2C\u4E00\u6B21\u8FD0\u884C\u4E0B\u9762\u7684\u4EE3\u7801\u65F6\u624D\u4F1A\u4E0B\u8F7D\uFF09\u3002"),De.forEach(s),at=_(e),G=f(e,"P",{});var Fe=u(G);Pn=o(Fe,"\u56E0\u4E3A"),ol=f(Fe,"CODE",{});var ao=u(ol);Cn=o(ao,"sentiment-analysis"),ao.forEach(s),Mn=o(Fe,"\uFF08\u60C5\u7EEA\u5206\u6790\uFF09\u7BA1\u9053\u7684\u9ED8\u8BA4\u68C0\u67E5\u70B9\u662F"),pl=f(Fe,"CODE",{});var oo=u(pl);In=o(oo,"distilbert-base-uncased-finetuned-sst-2-english"),oo.forEach(s),xn=o(Fe,"\uFF08\u4F60\u53EF\u4EE5\u770B\u5230\u5B83\u7684\u6A21\u578B\u5361"),Ve=f(Fe,"A",{href:!0,rel:!0});var po=u(Ve);Dn=o(po,"here"),po.forEach(s),Fn=o(Fe,")\uFF0C\u6211\u4EEC\u8FD0\u884C\u4EE5\u4E0B\u7A0B\u5E8F\uFF1A"),Fe.forEach(s),ot=_(e),g(Be.$$.fragment,e),pt=_(e),hs=f(e,"P",{});var io=u(hs);qn=o(io,"\u4E00\u65E6\u6211\u4EEC\u6709\u4E86\u6807\u8BB0\u5668\uFF0C\u6211\u4EEC\u5C31\u53EF\u4EE5\u76F4\u63A5\u5C06\u6211\u4EEC\u7684\u53E5\u5B50\u4F20\u9012\u7ED9\u5B83\uFF0C\u7136\u540E\u6211\u4EEC\u5C31\u4F1A\u5F97\u5230\u4E00\u672C\u5B57\u5178\uFF0C\u5B83\u53EF\u4EE5\u63D0\u4F9B\u7ED9\u6211\u4EEC\u7684\u6A21\u578B\uFF01\u5269\u4E0B\u8981\u505A\u7684\u552F\u4E00\u4E00\u4EF6\u4E8B\u5C31\u662F\u5C06\u8F93\u5165ID\u5217\u8868\u8F6C\u6362\u4E3A\u5F20\u91CF\u3002"),io.forEach(s),it=_(e),ve=f(e,"P",{});var Qt=u(ve);An=o(Qt,"\u60A8\u53EF\u4EE5\u4F7F\u7528\u{1F917} Transformers\uFF0C\u800C\u4E0D\u5FC5\u62C5\u5FC3\u54EA\u4E2AML\u6846\u67B6\u88AB\u7528\u4F5C\u540E\u7AEF\uFF1B\u5B83\u53EF\u80FD\u662FPyTorch\u6216TensorFlow\uFF0C\u6216Flax\u3002\u4F46\u662F\uFF0CTransformers\u578B\u53F7\u53EA\u63A5\u53D7"),il=f(Qt,"EM",{});var fo=u(il);On=o(fo,"\u5F20\u91CF"),fo.forEach(s),Sn=o(Qt,"\u4F5C\u4E3A\u8F93\u5165\u3002\u5982\u679C\u8FD9\u662F\u4F60\u7B2C\u4E00\u6B21\u542C\u8BF4\u5F20\u91CF\uFF0C\u4F60\u53EF\u4EE5\u628A\u5B83\u4EEC\u60F3\u8C61\u6210NumPy\u6570\u7EC4\u3002NumPy\u6570\u7EC4\u53EF\u4EE5\u662F\u6807\u91CF\uFF080D\uFF09\u3001\u5411\u91CF\uFF081D\uFF09\u3001\u77E9\u9635\uFF082D\uFF09\u6216\u5177\u6709\u66F4\u591A\u7EF4\u5EA6\u3002\u5B83\u5B9E\u9645\u4E0A\u662F\u5F20\u91CF\uFF1B\u5176\u4ED6ML\u6846\u67B6\u7684\u5F20\u91CF\u884C\u4E3A\u7C7B\u4F3C\uFF0C\u901A\u5E38\u4E0ENumPy\u6570\u7EC4\u4E00\u6837\u6613\u4E8E\u5B9E\u4F8B\u5316\u3002"),Qt.forEach(s),ft=_(e),we=f(e,"P",{});var Yt=u(we);Nn=o(Yt,"\u8981\u6307\u5B9A\u8981\u8FD4\u56DE\u7684\u5F20\u91CF\u7C7B\u578B\uFF08PyTorch\u3001TensorFlow\u6216plain NumPy\uFF09\uFF0C\u6211\u4EEC\u4F7F\u7528"),fl=f(Yt,"CODE",{});var co=u(fl);Ln=o(co,"return_tensors"),co.forEach(s),zn=o(Yt,"\u53C2\u6570\uFF1A"),Yt.forEach(s),ct=_(e),R.l(e),$s=_(e),js=f(e,"P",{});var uo=u(js);Gn=o(uo,"\u73B0\u5728\u4E0D\u8981\u62C5\u5FC3\u586B\u5145\u548C\u622A\u65AD\uFF1B\u6211\u4EEC\u7A0D\u540E\u4F1A\u89E3\u91CA\u8FD9\u4E9B\u3002\u8FD9\u91CC\u8981\u8BB0\u4F4F\u7684\u4E3B\u8981\u4E8B\u60C5\u662F\uFF0C\u60A8\u53EF\u4EE5\u4F20\u9012\u4E00\u4E2A\u53E5\u5B50\u6216\u4E00\u7EC4\u53E5\u5B50\uFF0C\u8FD8\u53EF\u4EE5\u6307\u5B9A\u8981\u8FD4\u56DE\u7684\u5F20\u91CF\u7C7B\u578B\uFF08\u5982\u679C\u6CA1\u6709\u4F20\u9012\u7C7B\u578B\uFF0C\u60A8\u5C06\u5F97\u5230\u4E00\u7EC4\u5217\u8868\uFF09\u3002"),uo.forEach(s),ut=_(e),Q.l(e),ks=_(e),N=f(e,"P",{});var be=u(N);Hn=o(be,"\u8F93\u51FA\u672C\u8EAB\u662F\u4E00\u4E2A\u5305\u542B\u4E24\u4E2A\u952E\u7684\u5B57\u5178\uFF0C"),cl=f(be,"CODE",{});var mo=u(cl);Vn=o(mo,"input_ids"),mo.forEach(s),Bn=o(be,"\u548C"),ul=f(be,"CODE",{});var _o=u(ul);Rn=o(_o,"attention_mask"),_o.forEach(s),Un=o(be,"\u3002"),ml=f(be,"CODE",{});var bo=u(ml);Qn=o(bo,"input_ids"),bo.forEach(s),Yn=o(be,"\u5305\u542B\u4E24\u884C\u6574\u6570\uFF08\u6BCF\u4E2A\u53E5\u5B50\u4E00\u884C\uFF09\uFF0C\u5B83\u4EEC\u662F\u6BCF\u4E2A\u53E5\u5B50\u4E2D\u6807\u8BB0\u7684\u552F\u4E00\u6807\u8BB0\uFF08token\uFF09\u3002\u6211\u4EEC\u5C06\u5728\u672C\u7AE0\u540E\u9762\u89E3\u91CA\u4EC0\u4E48\u662F"),_l=f(be,"CODE",{});var ho=u(_l);Jn=o(ho,"attention_mask"),ho.forEach(s),Wn=o(be,"\u3002"),be.forEach(s),mt=_(e),Re=f(e,"H2",{id:!0});var $o=u(Re);Xn=o($o,"\u6D4F\u89C8\u6A21\u578B"),$o.forEach(s),_t=_(e),J.l(e),Es=_(e),vs=f(e,"P",{});var jo=u(vs);Kn=o(jo,"\u5728\u8FD9\u4E2A\u4EE3\u7801\u7247\u6BB5\u4E2D\uFF0C\u6211\u4EEC\u4E0B\u8F7D\u4E86\u4E4B\u524D\u5728\u7BA1\u9053\u4E2D\u4F7F\u7528\u7684\u76F8\u540C\u68C0\u67E5\u70B9\uFF08\u5B83\u5B9E\u9645\u4E0A\u5E94\u8BE5\u5DF2\u7ECF\u88AB\u7F13\u5B58\uFF09\uFF0C\u5E76\u7528\u5B83\u5B9E\u4F8B\u5316\u4E86\u4E00\u4E2A\u6A21\u578B\u3002"),jo.forEach(s),bt=_(e),H=f(e,"P",{});var qe=u(H);Zn=o(qe,"\u8FD9\u4E2A\u67B6\u6784\u53EA\u5305\u542B\u57FA\u672C\u8F6C\u6362\u5668\u6A21\u5757\uFF1A\u7ED9\u5B9A\u4E00\u4E9B\u8F93\u5165\uFF0C\u5B83\u8F93\u51FA\u6211\u4EEC\u5C06\u8C03\u7528\u7684\u5185\u5BB9"),bl=f(qe,"EM",{});var ko=u(bl);er=o(ko,"\u9690\u85CF\u72B6\u6001\uFF08hidden states\uFF09"),ko.forEach(s),sr=o(qe,"\uFF0C\u4EA6\u79F0"),dl=f(qe,"EM",{});var Eo=u(dl);lr=o(Eo,"\u7279\u5F81\uFF08features\uFF09"),Eo.forEach(s),tr=o(qe,"\u3002\u5BF9\u4E8E\u6BCF\u4E2A\u6A21\u578B\u8F93\u5165\uFF0C\u6211\u4EEC\u5C06\u68C0\u7D22\u4E00\u4E2A\u9AD8\u7EF4\u5411\u91CF\uFF0C\u8868\u793A"),hl=f(qe,"STRONG",{});var vo=u(hl);nr=o(vo,"Transformer\u6A21\u578B\u5BF9\u8BE5\u8F93\u5165\u7684\u4E0A\u4E0B\u6587\u7406\u89E3"),vo.forEach(s),rr=o(qe,"\u3002"),qe.forEach(s),dt=_(e),ws=f(e,"P",{});var wo=u(ws);ar=o(wo,"\u5982\u679C\u8FD9\u4E0D\u5408\u7406\uFF0C\u4E0D\u8981\u62C5\u5FC3\u3002\u6211\u4EEC\u4EE5\u540E\u518D\u89E3\u91CA\u3002"),wo.forEach(s),ht=_(e),ce=f(e,"P",{});var Ks=u(ce);or=o(Ks,"\u867D\u7136\u8FD9\u4E9B\u9690\u85CF\u72B6\u6001\u672C\u8EAB\u53EF\u80FD\u5F88\u6709\u7528\uFF0C\u4F46\u5B83\u4EEC\u901A\u5E38\u662F\u6A21\u578B\u53E6\u4E00\u90E8\u5206\uFF08\u79F0\u4E3A"),$l=f(Ks,"EM",{});var yo=u($l);pr=o(yo,"\u5934\u90E8(head)"),yo.forEach(s),ir=o(Ks,"\uFF09\u7684\u8F93\u5165\u3002 \u5728"),ys=f(Ks,"A",{href:!0});var To=u(ys);fr=o(To,"Chapter 1"),To.forEach(s),cr=o(Ks,"\u4E2D\uFF0C\u53EF\u4EE5\u4F7F\u7528\u76F8\u540C\u7684\u4F53\u7CFB\u7ED3\u6784\u6267\u884C\u4E0D\u540C\u7684\u4EFB\u52A1\uFF0C\u4F46\u8FD9\u4E9B\u4EFB\u52A1\u4E2D\u7684\u6BCF\u4E2A\u4EFB\u52A1\u90FD\u6709\u4E00\u4E2A\u4E0E\u4E4B\u5173\u8054\u7684\u4E0D\u540C\u5934\u3002"),Ks.forEach(s),$t=_(e),Ue=f(e,"H3",{id:!0});var go=u(Ue);ur=o(go,"\u9AD8\u7EF4\u5411\u91CF\uFF1F"),go.forEach(s),jt=_(e),Ts=f(e,"P",{});var Po=u(Ts);mr=o(Po,"Transformers\u6A21\u5757\u7684\u77E2\u91CF\u8F93\u51FA\u901A\u5E38\u8F83\u5927\u3002\u5B83\u901A\u5E38\u6709\u4E09\u4E2A\u7EF4\u5EA6\uFF1A"),Po.forEach(s),kt=_(e),ue=f(e,"UL",{});var Zs=u(ue);gs=f(Zs,"LI",{});var Ta=u(gs);jl=f(Ta,"STRONG",{});var Co=u(jl);_r=o(Co,"Batch size"),Co.forEach(s),br=o(Ta,": \u4E00\u6B21\u5904\u7406\u7684\u5E8F\u5217\u6570\uFF08\u5728\u6211\u4EEC\u7684\u793A\u4F8B\u4E2D\u4E3A2\uFF09\u3002"),Ta.forEach(s),dr=_(Zs),Ps=f(Zs,"LI",{});var ga=u(Ps);kl=f(ga,"STRONG",{});var Mo=u(kl);hr=o(Mo,"Sequence length"),Mo.forEach(s),$r=o(ga,": \u5E8F\u5217\u7684\u6570\u503C\u8868\u793A\u7684\u957F\u5EA6\uFF08\u5728\u6211\u4EEC\u7684\u793A\u4F8B\u4E2D\u4E3A16\uFF09\u3002"),ga.forEach(s),jr=_(Zs),Cs=f(Zs,"LI",{});var Pa=u(Cs);El=f(Pa,"STRONG",{});var Io=u(El);kr=o(Io,"Hidden size"),Io.forEach(s),Er=o(Pa,": \u6BCF\u4E2A\u6A21\u578B\u8F93\u5165\u7684\u5411\u91CF\u7EF4\u5EA6\u3002"),Pa.forEach(s),Zs.forEach(s),Et=_(e),Ms=f(e,"P",{});var xo=u(Ms);vr=o(xo,"\u7531\u4E8E\u6700\u540E\u4E00\u4E2A\u503C\uFF0C\u5B83\u88AB\u79F0\u4E3A\u201C\u9AD8\u7EF4\u201D\u3002\u9690\u85CF\u7684\u5927\u5C0F\u53EF\u80FD\u975E\u5E38\u5927\uFF08768\u901A\u5E38\u7528\u4E8E\u8F83\u5C0F\u7684\u578B\u53F7\uFF0C\u800C\u5728\u8F83\u5927\u7684\u578B\u53F7\u4E2D\uFF0C\u8FD9\u53EF\u80FD\u8FBE\u52303072\u6216\u66F4\u5927\uFF09\u3002"),xo.forEach(s),vt=_(e),Is=f(e,"P",{});var Do=u(Is);wr=o(Do,"\u5982\u679C\u6211\u4EEC\u5C06\u9884\u5904\u7406\u7684\u8F93\u5165\u8F93\u5165\u5230\u6A21\u578B\u4E2D\uFF0C\u6211\u4EEC\u53EF\u4EE5\u770B\u5230\u8FD9\u4E00\u70B9\uFF1A"),Do.forEach(s),wt=_(e),X.l(e),xs=_(e),V=f(e,"P",{});var Ae=u(V);yr=o(Ae,"\u6CE8\u610F\u{1F917} Transformers\u6A21\u578B\u7684\u8F93\u51FA\u4E0E"),vl=f(Ae,"CODE",{});var Fo=u(vl);Tr=o(Fo,"namedtuple"),Fo.forEach(s),gr=o(Ae,"\u6216\u8BCD\u5178\u76F8\u4F3C\u3002\u60A8\u53EF\u4EE5\u901A\u8FC7\u5C5E\u6027\uFF08\u5C31\u50CF\u6211\u4EEC\u6240\u505A\u7684\u90A3\u6837\uFF09\u6216\u952E\uFF08"),wl=f(Ae,"CODE",{});var qo=u(wl);Pr=o(qo,'\u8F93\u51FA["last_hidden_state"]'),qo.forEach(s),Cr=o(Ae,"\uFF09\u8BBF\u95EE\u5143\u7D20\uFF0C\u751A\u81F3\u53EF\u4EE5\u901A\u8FC7\u7D22\u5F15\u8BBF\u95EE\u5143\u7D20\uFF0C\u524D\u63D0\u662F\u60A8\u786E\u5207\u77E5\u9053\u8981\u67E5\u627E\u7684\u5185\u5BB9\u5728\u54EA\u91CC\uFF08"),yl=f(Ae,"CODE",{});var Ao=u(yl);Mr=o(Ao,"outputs[0]"),Ao.forEach(s),Ir=o(Ae,"\uFF09\u3002"),Ae.forEach(s),yt=_(e),Qe=f(e,"H3",{id:!0});var Oo=u(Qe);xr=o(Oo,"\u6A21\u578B\u5934\uFF1A\u6570\u5B57\u7684\u610F\u4E49"),Oo.forEach(s),Tt=_(e),Ds=f(e,"P",{});var So=u(Ds);Dr=o(So,"\u6A21\u578B\u5934\u5C06\u9690\u85CF\u72B6\u6001\u7684\u9AD8\u7EF4\u5411\u91CF\u4F5C\u4E3A\u8F93\u5165\uFF0C\u5E76\u5C06\u5176\u6295\u5F71\u5230\u4E0D\u540C\u7684\u7EF4\u5EA6\u3002\u5B83\u4EEC\u901A\u5E38\u7531\u4E00\u4E2A\u6216\u51E0\u4E2A\u7EBF\u6027\u5C42\u7EC4\u6210\uFF1A"),So.forEach(s),gt=_(e),$e=f(e,"DIV",{class:!0});var Jt=u($e);Ye=f(Jt,"IMG",{class:!0,src:!0,alt:!0}),Fr=_(Jt),Je=f(Jt,"IMG",{class:!0,src:!0,alt:!0}),Jt.forEach(s),Pt=_(e),Fs=f(e,"P",{});var No=u(Fs);qr=o(No,"Transformers\u6A21\u578B\u7684\u8F93\u51FA\u76F4\u63A5\u53D1\u9001\u5230\u6A21\u578B\u5934\u8FDB\u884C\u5904\u7406\u3002"),No.forEach(s),Ct=_(e),qs=f(e,"P",{});var Lo=u(qs);Ar=o(Lo,"\u5728\u6B64\u56FE\u4E2D\uFF0C\u6A21\u578B\u7531\u5176\u5D4C\u5165\u5C42\u548C\u540E\u7EED\u5C42\u8868\u793A\u3002\u5D4C\u5165\u5C42\u5C06\u6807\u8BB0\u5316\u8F93\u5165\u4E2D\u7684\u6BCF\u4E2A\u8F93\u5165ID\u8F6C\u6362\u4E3A\u8868\u793A\u5173\u8054\u6807\u8BB0(token)\u7684\u5411\u91CF\u3002\u540E\u7EED\u5C42\u4F7F\u7528\u6CE8\u610F\u673A\u5236\u64CD\u7EB5\u8FD9\u4E9B\u5411\u91CF\uFF0C\u4EE5\u751F\u6210\u53E5\u5B50\u7684\u6700\u7EC8\u8868\u793A\u3002"),Lo.forEach(s),Mt=_(e),As=f(e,"P",{});var zo=u(As);Or=o(zo,"\u{1F917} Transformers\u4E2D\u6709\u8BB8\u591A\u4E0D\u540C\u7684\u4F53\u7CFB\u7ED3\u6784\uFF0C\u6BCF\u79CD\u4F53\u7CFB\u7ED3\u6784\u90FD\u662F\u56F4\u7ED5\u5904\u7406\u7279\u5B9A\u4EFB\u52A1\u800C\u8BBE\u8BA1\u7684\u3002\u4EE5\u4E0B\u662F\u4E00\u4E2A\u975E\u8BE6\u5C3D\u7684\u5217\u8868\uFF1A"),zo.forEach(s),It=_(e),A=f(e,"UL",{});var S=u(A);Os=f(S,"LI",{});var Ca=u(Os);Tl=f(Ca,"CODE",{});var Go=u(Tl);Sr=o(Go,"*Model"),Go.forEach(s),Nr=o(Ca," (retrieve the hidden states)"),Ca.forEach(s),Lr=_(S),gl=f(S,"LI",{});var Ho=u(gl);Pl=f(Ho,"CODE",{});var Vo=u(Pl);zr=o(Vo,"*ForCausalLM"),Vo.forEach(s),Ho.forEach(s),Gr=_(S),Cl=f(S,"LI",{});var Bo=u(Cl);Ml=f(Bo,"CODE",{});var Ro=u(Ml);Hr=o(Ro,"*ForMaskedLM"),Ro.forEach(s),Bo.forEach(s),Vr=_(S),Il=f(S,"LI",{});var Uo=u(Il);xl=f(Uo,"CODE",{});var Qo=u(xl);Br=o(Qo,"*ForMultipleChoice"),Qo.forEach(s),Uo.forEach(s),Rr=_(S),Dl=f(S,"LI",{});var Yo=u(Dl);Fl=f(Yo,"CODE",{});var Jo=u(Fl);Ur=o(Jo,"*ForQuestionAnswering"),Jo.forEach(s),Yo.forEach(s),Qr=_(S),ql=f(S,"LI",{});var Wo=u(ql);Al=f(Wo,"CODE",{});var Xo=u(Al);Yr=o(Xo,"*ForSequenceClassification"),Xo.forEach(s),Wo.forEach(s),Jr=_(S),Ol=f(S,"LI",{});var Ko=u(Ol);Sl=f(Ko,"CODE",{});var Zo=u(Sl);Wr=o(Zo,"*ForTokenClassification"),Zo.forEach(s),Ko.forEach(s),Xr=_(S),Nl=f(S,"LI",{});var ep=u(Nl);Kr=o(ep,"\u4EE5\u53CA\u5176\u4ED6 \u{1F917}"),ep.forEach(s),S.forEach(s),xt=_(e),Z.l(e),Ss=_(e),Ns=f(e,"P",{});var sp=u(Ns);Zr=o(sp,"\u73B0\u5728\uFF0C\u5982\u679C\u6211\u4EEC\u89C2\u5BDF\u8F93\u5165\u7684\u5F62\u72B6\uFF0C\u7EF4\u5EA6\u5C06\u4F4E\u5F97\u591A\uFF1A\u6A21\u578B\u5934\u5C06\u6211\u4EEC\u4E4B\u524D\u770B\u5230\u7684\u9AD8\u7EF4\u5411\u91CF\u4F5C\u4E3A\u8F93\u5165\uFF0C\u5E76\u8F93\u51FA\u5305\u542B\u4E24\u4E2A\u503C\u7684\u5411\u91CF\uFF08\u6BCF\u4E2A\u6807\u7B7E\u4E00\u4E2A\uFF09\uFF1A"),sp.forEach(s),Dt=_(e),g(We.$$.fragment,e),Ft=_(e),se.l(e),Ls=_(e),zs=f(e,"P",{});var lp=u(zs);ea=o(lp,"\u56E0\u4E3A\u6211\u4EEC\u53EA\u6709\u4E24\u4E2A\u53E5\u5B50\u548C\u4E24\u4E2A\u6807\u7B7E\uFF0C\u6240\u4EE5\u6211\u4EEC\u4ECE\u6A21\u578B\u4E2D\u5F97\u5230\u7684\u7ED3\u679C\u662F2 x 2\u7684\u5F62\u72B6\u3002"),lp.forEach(s),qt=_(e),Xe=f(e,"H2",{id:!0});var tp=u(Xe);sa=o(tp,"\u5BF9\u8F93\u51FA\u8FDB\u884C\u540E\u5904\u7406"),tp.forEach(s),At=_(e),Gs=f(e,"P",{});var np=u(Gs);la=o(np,"\u6211\u4EEC\u4ECE\u6A21\u578B\u4E2D\u5F97\u5230\u7684\u8F93\u51FA\u503C\u672C\u8EAB\u5E76\u4E0D\u4E00\u5B9A\u6709\u610F\u4E49\u3002\u6211\u4EEC\u6765\u770B\u770B,"),np.forEach(s),Ot=_(e),g(Ke.$$.fragment,e),St=_(e),te.l(e),Hs=_(e),L=f(e,"P",{});var de=u(L);ta=o(de,"\u6211\u4EEC\u7684\u6A21\u578B\u9884\u6D4B\u7B2C\u4E00\u53E5\u4E3A"),Ll=f(de,"CODE",{});var rp=u(Ll);na=o(rp,"[-1.5607, 1.6123]"),rp.forEach(s),ra=o(de,"\uFF0C\u7B2C\u4E8C\u53E5\u4E3A"),zl=f(de,"CODE",{});var ap=u(zl);aa=o(ap,"[ 4.1692, -3.3464]"),ap.forEach(s),oa=o(de,"\u3002\u8FD9\u4E9B\u4E0D\u662F\u6982\u7387\uFF0C\u800C\u662F"),Gl=f(de,"EM",{});var op=u(Gl);pa=o(op,"logits"),op.forEach(s),ia=o(de,"\uFF0C\u5373\u6A21\u578B\u6700\u540E\u4E00\u5C42\u8F93\u51FA\u7684\u539F\u59CB\u975E\u6807\u51C6\u5316\u5206\u6570\u3002\u8981\u8F6C\u6362\u4E3A\u6982\u7387\uFF0C\u5B83\u4EEC\u9700\u8981\u7ECF\u8FC7"),Ze=f(de,"A",{href:!0,rel:!0});var pp=u(Ze);fa=o(pp,"SoftMax"),pp.forEach(s),ca=o(de,"\u5C42\uFF08\u6240\u6709\u{1F917}Transformers\u6A21\u578B\u8F93\u51FAlogits\uFF0C\u56E0\u4E3A\u7528\u4E8E\u8BAD\u7EC3\u7684\u635F\u8017\u51FD\u6570\u901A\u5E38\u4F1A\u5C06\u6700\u540E\u7684\u6FC0\u6D3B\u51FD\u6570\uFF08\u5982SoftMax\uFF09\u4E0E\u5B9E\u9645\u635F\u8017\u51FD\u6570\uFF08\u5982\u4EA4\u53C9\u71B5\uFF09\u878D\u5408\uFF09\uFF1A"),de.forEach(s),Nt=_(e),re.l(e),Vs=_(e),oe.l(e),Bs=_(e),me=f(e,"P",{});var el=u(me);ua=o(el,"\u73B0\u5728\u6211\u4EEC\u53EF\u4EE5\u770B\u5230\uFF0C\u6A21\u578B\u9884\u6D4B\u7B2C\u4E00\u53E5\u4E3A"),Hl=f(el,"CODE",{});var ip=u(Hl);ma=o(ip,"[0.0402, 0.9598]"),ip.forEach(s),_a=o(el,"\uFF0C\u7B2C\u4E8C\u53E5\u4E3A"),Vl=f(el,"CODE",{});var fp=u(Vl);ba=o(fp,"[0.9995, 0.0005]"),fp.forEach(s),da=o(el,"\u3002\u8FD9\u4E9B\u662F\u53EF\u8BC6\u522B\u7684\u6982\u7387\u5206\u6570\u3002"),el.forEach(s),Lt=_(e),ye=f(e,"P",{});var Wt=u(ye);ha=o(Wt,"\u4E3A\u4E86\u83B7\u5F97\u6BCF\u4E2A\u4F4D\u7F6E\u5BF9\u5E94\u7684\u6807\u7B7E\uFF0C\u6211\u4EEC\u53EF\u4EE5\u68C0\u67E5\u6A21\u578B\u914D\u7F6E\u7684"),Bl=f(Wt,"CODE",{});var cp=u(Bl);$a=o(cp,"id2label"),cp.forEach(s),ja=o(Wt,"\u5C5E\u6027\uFF08\u4E0B\u4E00\u8282\u5C06\u5BF9\u6B64\u8FDB\u884C\u8BE6\u7EC6\u4ECB\u7ECD\uFF09\uFF1A"),Wt.forEach(s),zt=_(e),g(es.$$.fragment,e),Gt=_(e),g(ss.$$.fragment,e),Ht=_(e),Rs=f(e,"P",{});var up=u(Rs);ka=o(up,"\u73B0\u5728\u6211\u4EEC\u53EF\u4EE5\u5F97\u51FA\u7ED3\u8BBA\uFF0C\u8BE5\u6A21\u578B\u9884\u6D4B\u4E86\u4EE5\u4E0B\u51E0\u70B9\uFF1A"),up.forEach(s),Vt=_(e),Te=f(e,"UL",{});var Xt=u(Te);Rl=f(Xt,"LI",{});var mp=u(Rl);Ea=o(mp,"\u7B2C\u4E00\u53E5\uFF1A\u5426\u5B9A\uFF1A0.0402\uFF0C\u80AF\u5B9A\uFF1A0.9598"),mp.forEach(s),va=_(Xt),Ul=f(Xt,"LI",{});var _p=u(Ul);wa=o(_p,"\u7B2C\u4E8C\u53E5\uFF1A\u5426\u5B9A\uFF1A0.9995\uFF0C\u80AF\u5B9A\uFF1A0.0005"),_p.forEach(s),Xt.forEach(s),Bt=_(e),Us=f(e,"P",{});var bp=u(Us);ya=o(bp,"\u6211\u4EEC\u5DF2\u7ECF\u6210\u529F\u5730\u590D\u5236\u4E86\u7BA1\u9053\u7684\u4E09\u4E2A\u6B65\u9AA4\uFF1A\u4F7F\u7528\u6807\u8BB0\u5316\u5668\u8FDB\u884C\u9884\u5904\u7406\u3001\u901A\u8FC7\u6A21\u578B\u4F20\u9012\u8F93\u5165\u4EE5\u53CA\u540E\u5904\u7406\uFF01\u73B0\u5728\uFF0C\u8BA9\u6211\u4EEC\u82B1\u4E00\u4E9B\u65F6\u95F4\u6DF1\u5165\u4E86\u89E3\u8FD9\u4E9B\u6B65\u9AA4\u4E2D\u7684\u6BCF\u4E00\u6B65\u3002"),bp.forEach(s),Rt=_(e),g(ge.$$.fragment,e),this.h()},h(){I(t,"name","hf:doc:metadata"),I(t,"content",JSON.stringify(Wp)),I(d,"id",""),I(ms,"href","/course/chapter1"),I(bs,"href","/course/chapter1"),I(Ne,"class","block dark:hidden"),Kt(Ne.src,Ma="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter2/full_nlp_pipeline.svg")||I(Ne,"src",Ma),I(Ne,"alt","The full NLP pipeline: tokenization of text, conversion to IDs, and inference through the Transformer model and the model head."),I(Le,"class","hidden dark:block"),Kt(Le.src,Ia="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter2/full_nlp_pipeline-dark.svg")||I(Le,"src",Ia),I(Le,"alt","The full NLP pipeline: tokenization of text, conversion to IDs, and inference through the Transformer model and the model head."),I(he,"class","flex justify-center"),I(ze,"id",""),I(He,"href","https://huggingface.co/models"),I(He,"rel","nofollow"),I(Ve,"href","https://huggingface.co/distilbert-base-uncased-finetuned-sst-2-english"),I(Ve,"rel","nofollow"),I(Re,"id",""),I(ys,"href","/course/chapter1"),I(Ue,"id",""),I(Qe,"id",""),I(Ye,"class","block dark:hidden"),Kt(Ye.src,xa="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter2/transformer_and_head.svg")||I(Ye,"src",xa),I(Ye,"alt","A Transformer network alongside its head."),I(Je,"class","hidden dark:block"),Kt(Je.src,Da="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter2/transformer_and_head-dark.svg")||I(Je,"src",Da),I(Je,"alt","A Transformer network alongside its head."),I($e,"class","flex justify-center"),I(Xe,"id",""),I(Ze,"href","https://en.wikipedia.org/wiki/Softmax_function"),I(Ze,"rel","nofollow")},m(e,r){l(document.head,t),p(e,c,r),P(n,e,r),p(e,b,r),p(e,d,r),l(d,h),p(e,w,r),ls[x].m(e,r),p(e,y,r),P(D,e,r),p(e,$,r),ts[E].m(e,r),p(e,O,r),p(e,je,r),l(je,Zt),l(je,ms),l(ms,en),l(je,sn),p(e,Wl,r),P(Oe,e,r),p(e,Xl,r),p(e,_s,r),l(_s,ln),p(e,Kl,r),P(Se,e,r),p(e,Zl,r),p(e,ke,r),l(ke,tn),l(ke,bs),l(bs,nn),l(ke,rn),p(e,et,r),p(e,he,r),l(he,Ne),l(he,an),l(he,Le),p(e,st,r),p(e,ds,r),l(ds,on),p(e,lt,r),p(e,ze,r),l(ze,pn),p(e,tt,r),p(e,Ee,r),l(Ee,fn),l(Ee,sl),l(sl,cn),l(Ee,un),p(e,nt,r),p(e,fe,r),l(fe,Ge),l(Ge,mn),l(Ge,ll),l(ll,_n),l(Ge,bn),l(fe,dn),l(fe,tl),l(tl,hn),l(fe,$n),l(fe,nl),l(nl,jn),p(e,rt,r),p(e,z,r),l(z,kn),l(z,He),l(He,En),l(z,vn),l(z,rl),l(rl,wn),l(z,yn),l(z,al),l(al,Tn),l(z,gn),p(e,at,r),p(e,G,r),l(G,Pn),l(G,ol),l(ol,Cn),l(G,Mn),l(G,pl),l(pl,In),l(G,xn),l(G,Ve),l(Ve,Dn),l(G,Fn),p(e,ot,r),P(Be,e,r),p(e,pt,r),p(e,hs,r),l(hs,qn),p(e,it,r),p(e,ve,r),l(ve,An),l(ve,il),l(il,On),l(ve,Sn),p(e,ft,r),p(e,we,r),l(we,Nn),l(we,fl),l(fl,Ln),l(we,zn),p(e,ct,r),ns[B].m(e,r),p(e,$s,r),p(e,js,r),l(js,Gn),p(e,ut,r),rs[U].m(e,r),p(e,ks,r),p(e,N,r),l(N,Hn),l(N,cl),l(cl,Vn),l(N,Bn),l(N,ul),l(ul,Rn),l(N,Un),l(N,ml),l(ml,Qn),l(N,Yn),l(N,_l),l(_l,Jn),l(N,Wn),p(e,mt,r),p(e,Re,r),l(Re,Xn),p(e,_t,r),as[Y].m(e,r),p(e,Es,r),p(e,vs,r),l(vs,Kn),p(e,bt,r),p(e,H,r),l(H,Zn),l(H,bl),l(bl,er),l(H,sr),l(H,dl),l(dl,lr),l(H,tr),l(H,hl),l(hl,nr),l(H,rr),p(e,dt,r),p(e,ws,r),l(ws,ar),p(e,ht,r),p(e,ce,r),l(ce,or),l(ce,$l),l($l,pr),l(ce,ir),l(ce,ys),l(ys,fr),l(ce,cr),p(e,$t,r),p(e,Ue,r),l(Ue,ur),p(e,jt,r),p(e,Ts,r),l(Ts,mr),p(e,kt,r),p(e,ue,r),l(ue,gs),l(gs,jl),l(jl,_r),l(gs,br),l(ue,dr),l(ue,Ps),l(Ps,kl),l(kl,hr),l(Ps,$r),l(ue,jr),l(ue,Cs),l(Cs,El),l(El,kr),l(Cs,Er),p(e,Et,r),p(e,Ms,r),l(Ms,vr),p(e,vt,r),p(e,Is,r),l(Is,wr),p(e,wt,r),os[W].m(e,r),p(e,xs,r),p(e,V,r),l(V,yr),l(V,vl),l(vl,Tr),l(V,gr),l(V,wl),l(wl,Pr),l(V,Cr),l(V,yl),l(yl,Mr),l(V,Ir),p(e,yt,r),p(e,Qe,r),l(Qe,xr),p(e,Tt,r),p(e,Ds,r),l(Ds,Dr),p(e,gt,r),p(e,$e,r),l($e,Ye),l($e,Fr),l($e,Je),p(e,Pt,r),p(e,Fs,r),l(Fs,qr),p(e,Ct,r),p(e,qs,r),l(qs,Ar),p(e,Mt,r),p(e,As,r),l(As,Or),p(e,It,r),p(e,A,r),l(A,Os),l(Os,Tl),l(Tl,Sr),l(Os,Nr),l(A,Lr),l(A,gl),l(gl,Pl),l(Pl,zr),l(A,Gr),l(A,Cl),l(Cl,Ml),l(Ml,Hr),l(A,Vr),l(A,Il),l(Il,xl),l(xl,Br),l(A,Rr),l(A,Dl),l(Dl,Fl),l(Fl,Ur),l(A,Qr),l(A,ql),l(ql,Al),l(Al,Yr),l(A,Jr),l(A,Ol),l(Ol,Sl),l(Sl,Wr),l(A,Xr),l(A,Nl),l(Nl,Kr),p(e,xt,r),ps[K].m(e,r),p(e,Ss,r),p(e,Ns,r),l(Ns,Zr),p(e,Dt,r),P(We,e,r),p(e,Ft,r),is[ee].m(e,r),p(e,Ls,r),p(e,zs,r),l(zs,ea),p(e,qt,r),p(e,Xe,r),l(Xe,sa),p(e,At,r),p(e,Gs,r),l(Gs,la),p(e,Ot,r),P(Ke,e,r),p(e,St,r),fs[le].m(e,r),p(e,Hs,r),p(e,L,r),l(L,ta),l(L,Ll),l(Ll,na),l(L,ra),l(L,zl),l(zl,aa),l(L,oa),l(L,Gl),l(Gl,pa),l(L,ia),l(L,Ze),l(Ze,fa),l(L,ca),p(e,Nt,r),cs[ne].m(e,r),p(e,Vs,r),us[ae].m(e,r),p(e,Bs,r),p(e,me,r),l(me,ua),l(me,Hl),l(Hl,ma),l(me,_a),l(me,Vl),l(Vl,ba),l(me,da),p(e,Lt,r),p(e,ye,r),l(ye,ha),l(ye,Bl),l(Bl,$a),l(ye,ja),p(e,zt,r),P(es,e,r),p(e,Gt,r),P(ss,e,r),p(e,Ht,r),p(e,Rs,r),l(Rs,ka),p(e,Vt,r),p(e,Te,r),l(Te,Rl),l(Rl,Ea),l(Te,va),l(Te,Ul),l(Ul,wa),p(e,Bt,r),p(e,Us,r),l(Us,ya),p(e,Rt,r),P(ge,e,r),Ut=!0},p(e,[r]){const Ql={};r&1&&(Ql.fw=e[0]),n.$set(Ql);let Pe=x;x=qa(e),x!==Pe&&(ie(),j(ls[Pe],1,1,()=>{ls[Pe]=null}),pe(),M=ls[x],M||(M=ls[x]=Fa[x](e),M.c()),k(M,1),M.m(y.parentNode,y));const Yl={};r&2&&(Yl.$$scope={dirty:r,ctx:e}),D.$set(Yl);let Qs=E;E=Oa(e),E!==Qs&&(ie(),j(ts[Qs],1,1,()=>{ts[Qs]=null}),pe(),q=ts[E],q||(q=ts[E]=Aa[E](e),q.c()),k(q,1),q.m(O.parentNode,O));let Ce=B;B=Na(e),B!==Ce&&(ie(),j(ns[Ce],1,1,()=>{ns[Ce]=null}),pe(),R=ns[B],R||(R=ns[B]=Sa[B](e),R.c()),k(R,1),R.m($s.parentNode,$s));let Ys=U;U=za(e),U!==Ys&&(ie(),j(rs[Ys],1,1,()=>{rs[Ys]=null}),pe(),Q=rs[U],Q||(Q=rs[U]=La[U](e),Q.c()),k(Q,1),Q.m(ks.parentNode,ks));let Me=Y;Y=Ha(e),Y!==Me&&(ie(),j(as[Me],1,1,()=>{as[Me]=null}),pe(),J=as[Y],J||(J=as[Y]=Ga[Y](e),J.c()),k(J,1),J.m(Es.parentNode,Es));let Js=W;W=Ba(e),W!==Js&&(ie(),j(os[Js],1,1,()=>{os[Js]=null}),pe(),X=os[W],X||(X=os[W]=Va[W](e),X.c()),k(X,1),X.m(xs.parentNode,xs));let Ws=K;K=Ua(e),K!==Ws&&(ie(),j(ps[Ws],1,1,()=>{ps[Ws]=null}),pe(),Z=ps[K],Z||(Z=ps[K]=Ra[K](e),Z.c()),k(Z,1),Z.m(Ss.parentNode,Ss));let Ie=ee;ee=Ya(e),ee!==Ie&&(ie(),j(is[Ie],1,1,()=>{is[Ie]=null}),pe(),se=is[ee],se||(se=is[ee]=Qa[ee](e),se.c()),k(se,1),se.m(Ls.parentNode,Ls));let Xs=le;le=Wa(e),le!==Xs&&(ie(),j(fs[Xs],1,1,()=>{fs[Xs]=null}),pe(),te=fs[le],te||(te=fs[le]=Ja[le](e),te.c()),k(te,1),te.m(Hs.parentNode,Hs));let _e=ne;ne=Ka(e),ne!==_e&&(ie(),j(cs[_e],1,1,()=>{cs[_e]=null}),pe(),re=cs[ne],re||(re=cs[ne]=Xa[ne](e),re.c()),k(re,1),re.m(Vs.parentNode,Vs));let xe=ae;ae=eo(e),ae!==xe&&(ie(),j(us[xe],1,1,()=>{us[xe]=null}),pe(),oe=us[ae],oe||(oe=us[ae]=Za[ae](e),oe.c()),k(oe,1),oe.m(Bs.parentNode,Bs));const Jl={};r&2&&(Jl.$$scope={dirty:r,ctx:e}),ge.$set(Jl)},i(e){Ut||(k(n.$$.fragment,e),k(M),k(D.$$.fragment,e),k(q),k(Oe.$$.fragment,e),k(Se.$$.fragment,e),k(Be.$$.fragment,e),k(R),k(Q),k(J),k(X),k(Z),k(We.$$.fragment,e),k(se),k(Ke.$$.fragment,e),k(te),k(re),k(oe),k(es.$$.fragment,e),k(ss.$$.fragment,e),k(ge.$$.fragment,e),Ut=!0)},o(e){j(n.$$.fragment,e),j(M),j(D.$$.fragment,e),j(q),j(Oe.$$.fragment,e),j(Se.$$.fragment,e),j(Be.$$.fragment,e),j(R),j(Q),j(J),j(X),j(Z),j(We.$$.fragment,e),j(se),j(Ke.$$.fragment,e),j(te),j(re),j(oe),j(es.$$.fragment,e),j(ss.$$.fragment,e),j(ge.$$.fragment,e),Ut=!1},d(e){s(t),e&&s(c),C(n,e),e&&s(b),e&&s(d),e&&s(w),ls[x].d(e),e&&s(y),C(D,e),e&&s($),ts[E].d(e),e&&s(O),e&&s(je),e&&s(Wl),C(Oe,e),e&&s(Xl),e&&s(_s),e&&s(Kl),C(Se,e),e&&s(Zl),e&&s(ke),e&&s(et),e&&s(he),e&&s(st),e&&s(ds),e&&s(lt),e&&s(ze),e&&s(tt),e&&s(Ee),e&&s(nt),e&&s(fe),e&&s(rt),e&&s(z),e&&s(at),e&&s(G),e&&s(ot),C(Be,e),e&&s(pt),e&&s(hs),e&&s(it),e&&s(ve),e&&s(ft),e&&s(we),e&&s(ct),ns[B].d(e),e&&s($s),e&&s(js),e&&s(ut),rs[U].d(e),e&&s(ks),e&&s(N),e&&s(mt),e&&s(Re),e&&s(_t),as[Y].d(e),e&&s(Es),e&&s(vs),e&&s(bt),e&&s(H),e&&s(dt),e&&s(ws),e&&s(ht),e&&s(ce),e&&s($t),e&&s(Ue),e&&s(jt),e&&s(Ts),e&&s(kt),e&&s(ue),e&&s(Et),e&&s(Ms),e&&s(vt),e&&s(Is),e&&s(wt),os[W].d(e),e&&s(xs),e&&s(V),e&&s(yt),e&&s(Qe),e&&s(Tt),e&&s(Ds),e&&s(gt),e&&s($e),e&&s(Pt),e&&s(Fs),e&&s(Ct),e&&s(qs),e&&s(Mt),e&&s(As),e&&s(It),e&&s(A),e&&s(xt),ps[K].d(e),e&&s(Ss),e&&s(Ns),e&&s(Dt),C(We,e),e&&s(Ft),is[ee].d(e),e&&s(Ls),e&&s(zs),e&&s(qt),e&&s(Xe),e&&s(At),e&&s(Gs),e&&s(Ot),C(Ke,e),e&&s(St),fs[le].d(e),e&&s(Hs),e&&s(L),e&&s(Nt),cs[ne].d(e),e&&s(Vs),us[ae].d(e),e&&s(Bs),e&&s(me),e&&s(Lt),e&&s(ye),e&&s(zt),C(es,e),e&&s(Gt),C(ss,e),e&&s(Ht),e&&s(Rs),e&&s(Vt),e&&s(Te),e&&s(Bt),e&&s(Us),e&&s(Rt),C(ge,e)}}}const Wp={local:"",sections:[{local:"",title:"\u4F7F\u7528\u5206\u8BCD\u5668\u8FDB\u884C\u9884\u5904\u7406"},{local:"",sections:[{local:"",title:"\u9AD8\u7EF4\u5411\u91CF\uFF1F"},{local:"",title:"\u6A21\u578B\u5934\uFF1A\u6570\u5B57\u7684\u610F\u4E49"}],title:"\u6D4F\u89C8\u6A21\u578B"},{local:"",title:"\u5BF9\u8F93\u51FA\u8FDB\u884C\u540E\u5904\u7406"}],title:"\u7BA1\u9053\u7684\u5185\u90E8"};function Xp(v,t,c){let n="pt";return wp(()=>{const b=new URLSearchParams(window.location.search);c(0,n=b.get("fw")||"pt")}),[n]}class ni extends jp{constructor(t){super();kp(this,t,Xp,Jp,Ep,{})}}export{ni as default,Wp as metadata};
