import{S as ki,i as $i,s as yi,e as h,k as m,w,t as c,M as ji,c as i,d as t,m as f,x,a as o,h as a,b as j,N as Il,G as e,g as u,y as T,o as v,p as pn,q as k,B as C,v as Ei,n as mn}from"../../chunks/vendor-hf-doc-builder.js";import{T as _i}from"../../chunks/Tip-hf-doc-builder.js";import{Y as bi}from"../../chunks/Youtube-hf-doc-builder.js";import{I as be}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{C as A}from"../../chunks/CodeBlock-hf-doc-builder.js";import{C as vi}from"../../chunks/CourseFloatingBanner-hf-doc-builder.js";import{F as wi}from"../../chunks/FrameworkSwitchCourse-hf-doc-builder.js";import"../../chunks/DocNotebookDropdown-hf-doc-builder.js";function xi(y){let s,p;return s=new vi({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/vi/chapter2/section2_tf.ipynb"},{label:"Aws Studio",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/master/course/vi/chapter2/section2_tf.ipynb"}]}}),{c(){w(s.$$.fragment)},l(l){x(s.$$.fragment,l)},m(l,g){T(s,l,g),p=!0},i(l){p||(k(s.$$.fragment,l),p=!0)},o(l){v(s.$$.fragment,l),p=!1},d(l){C(s,l)}}}function Ti(y){let s,p;return s=new vi({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/vi/chapter2/section2_pt.ipynb"},{label:"Aws Studio",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/master/course/vi/chapter2/section2_pt.ipynb"}]}}),{c(){w(s.$$.fragment)},l(l){x(s.$$.fragment,l)},m(l,g){T(s,l,g),p=!0},i(l){p||(k(s.$$.fragment,l),p=!0)},o(l){v(s.$$.fragment,l),p=!1},d(l){C(s,l)}}}function Ci(y){let s;return{c(){s=c("\u0110\xE2y l\xE0 ph\u1EA7n \u0111\u1EA7u ti\xEAn c\xF3 n\u1ED9i dung h\u01A1i kh\xE1c m\u1ED9t ch\xFAt t\xF9y thu\u1ED9c v\xE0o vi\u1EC7c b\u1EA1n s\u1EED d\u1EE5ng PyTorch hay TensorFlow. Chuy\u1EC3n \u0111\u1ED5i c\xF4ng t\u1EAFc tr\xEAn \u0111\u1EA7u ti\xEAu \u0111\u1EC1 \u0111\u1EC3 ch\u1ECDn n\u1EC1n t\u1EA3ng b\u1EA1n th\xEDch!")},l(p){s=a(p,"\u0110\xE2y l\xE0 ph\u1EA7n \u0111\u1EA7u ti\xEAn c\xF3 n\u1ED9i dung h\u01A1i kh\xE1c m\u1ED9t ch\xFAt t\xF9y thu\u1ED9c v\xE0o vi\u1EC7c b\u1EA1n s\u1EED d\u1EE5ng PyTorch hay TensorFlow. Chuy\u1EC3n \u0111\u1ED5i c\xF4ng t\u1EAFc tr\xEAn \u0111\u1EA7u ti\xEAu \u0111\u1EC1 \u0111\u1EC3 ch\u1ECDn n\u1EC1n t\u1EA3ng b\u1EA1n th\xEDch!")},m(p,l){u(p,s,l)},d(p){p&&t(s)}}}function qi(y){let s,p;return s=new bi({props:{id:"wVN12smEvqg"}}),{c(){w(s.$$.fragment)},l(l){x(s.$$.fragment,l)},m(l,g){T(s,l,g),p=!0},i(l){p||(k(s.$$.fragment,l),p=!0)},o(l){v(s.$$.fragment,l),p=!1},d(l){C(s,l)}}}function Pi(y){let s,p;return s=new bi({props:{id:"1pedAIvTWXk"}}),{c(){w(s.$$.fragment)},l(l){x(s.$$.fragment,l)},m(l,g){T(s,l,g),p=!0},i(l){p||(k(s.$$.fragment,l),p=!0)},o(l){v(s.$$.fragment,l),p=!1},d(l){C(s,l)}}}function Mi(y){let s,p;return s=new A({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(){w(s.$$.fragment)},l(l){x(s.$$.fragment,l)},m(l,g){T(s,l,g),p=!0},i(l){p||(k(s.$$.fragment,l),p=!0)},o(l){v(s.$$.fragment,l),p=!1},d(l){C(s,l)}}}function Ai(y){let s,p;return s=new A({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(){w(s.$$.fragment)},l(l){x(s.$$.fragment,l)},m(l,g){T(s,l,g),p=!0},i(l){p||(k(s.$$.fragment,l),p=!0)},o(l){v(s.$$.fragment,l),p=!1},d(l){C(s,l)}}}function Ii(y){let s,p,l,g,_;return g=new A({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(){s=h("p"),p=c("\u0110\xE2y l\xE0 k\u1EBFt qu\u1EA3 t\u01B0\u01A1ng \u1EE9ng tensor Tensorflow:"),l=m(),w(g.$$.fragment)},l(d){s=i(d,"P",{});var q=o(s);p=a(q,"\u0110\xE2y l\xE0 k\u1EBFt qu\u1EA3 t\u01B0\u01A1ng \u1EE9ng tensor Tensorflow:"),q.forEach(t),l=f(d),x(g.$$.fragment,d)},m(d,q){u(d,s,q),e(s,p),u(d,l,q),T(g,d,q),_=!0},i(d){_||(k(g.$$.fragment,d),_=!0)},o(d){v(g.$$.fragment,d),_=!1},d(d){d&&t(s),d&&t(l),C(g,d)}}}function Ni(y){let s,p,l,g,_;return g=new A({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(){s=h("p"),p=c("\u0110\xE2y l\xE0 k\u1EBFt qu\u1EA3 t\u01B0\u01A1ng \u1EE9ng tensor PyTorch:"),l=m(),w(g.$$.fragment)},l(d){s=i(d,"P",{});var q=o(s);p=a(q,"\u0110\xE2y l\xE0 k\u1EBFt qu\u1EA3 t\u01B0\u01A1ng \u1EE9ng tensor PyTorch:"),q.forEach(t),l=f(d),x(g.$$.fragment,d)},m(d,q){u(d,s,q),e(s,p),u(d,l,q),T(g,d,q),_=!0},i(d){_||(k(g.$$.fragment,d),_=!0)},o(d){v(g.$$.fragment,d),_=!1},d(d){d&&t(s),d&&t(l),C(g,d)}}}function Si(y){let s,p,l,g,_,d,q,M,P,E,I;return E=new A({props:{code:`from transformers import TFAutoModel

checkpoint = "distilbert-base-uncased-finetuned-sst-2-english"
model = TFAutoModel.from_pretrained(checkpoint)`,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(){s=h("p"),p=c("Ch\xFAng ta c\xF3 th\u1EC3 t\u1EA3i xu\u1ED1ng m\xF4 h\xECnh \u0111\u01B0\u1EE3c hu\u1EA5n luy\u1EC7n tr\u01B0\u1EDBc c\u1EE7a m\xECnh gi\u1ED1ng nh\u01B0 c\xE1ch \u0111\xE3 l\xE0m v\u1EDBi tokenizer. \u{1F917} Transformers cung c\u1EA5p m\u1ED9t l\u1EDBp "),l=h("code"),g=c("TFAutoModel"),_=c(" c\u0169ng c\xF3 ph\u01B0\u01A1ng th\u1EE9c "),d=h("code"),q=c("from_pretrained()"),M=c(":"),P=m(),w(E.$$.fragment)},l(b){s=i(b,"P",{});var $=o(s);p=a($,"Ch\xFAng ta c\xF3 th\u1EC3 t\u1EA3i xu\u1ED1ng m\xF4 h\xECnh \u0111\u01B0\u1EE3c hu\u1EA5n luy\u1EC7n tr\u01B0\u1EDBc c\u1EE7a m\xECnh gi\u1ED1ng nh\u01B0 c\xE1ch \u0111\xE3 l\xE0m v\u1EDBi tokenizer. \u{1F917} Transformers cung c\u1EA5p m\u1ED9t l\u1EDBp "),l=i($,"CODE",{});var N=o(l);g=a(N,"TFAutoModel"),N.forEach(t),_=a($," c\u0169ng c\xF3 ph\u01B0\u01A1ng th\u1EE9c "),d=i($,"CODE",{});var F=o(d);q=a(F,"from_pretrained()"),F.forEach(t),M=a($,":"),$.forEach(t),P=f(b),x(E.$$.fragment,b)},m(b,$){u(b,s,$),e(s,p),e(s,l),e(l,g),e(s,_),e(s,d),e(d,q),e(s,M),u(b,P,$),T(E,b,$),I=!0},i(b){I||(k(E.$$.fragment,b),I=!0)},o(b){v(E.$$.fragment,b),I=!1},d(b){b&&t(s),b&&t(P),C(E,b)}}}function Fi(y){let s,p,l,g,_,d,q,M,P,E,I;return E=new A({props:{code:`from transformers import AutoModel

checkpoint = "distilbert-base-uncased-finetuned-sst-2-english"
model = AutoModel.from_pretrained(checkpoint)`,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(){s=h("p"),p=c("Ch\xFAng ta c\xF3 th\u1EC3 t\u1EA3i xu\u1ED1ng m\xF4 h\xECnh \u0111\u01B0\u1EE3c hu\u1EA5n luy\u1EC7n tr\u01B0\u1EDBc c\u1EE7a m\xECnh gi\u1ED1ng nh\u01B0 c\xE1ch \u0111\xE3 l\xE0m v\u1EDBi tokenizer. \u{1F917} Transformers cung c\u1EA5p m\u1ED9t l\u1EDBp "),l=h("code"),g=c("AutoModel"),_=c(" c\u0169ng c\xF3 ph\u01B0\u01A1ng th\u1EE9c "),d=h("code"),q=c("from_pretrained()"),M=c(":"),P=m(),w(E.$$.fragment)},l(b){s=i(b,"P",{});var $=o(s);p=a($,"Ch\xFAng ta c\xF3 th\u1EC3 t\u1EA3i xu\u1ED1ng m\xF4 h\xECnh \u0111\u01B0\u1EE3c hu\u1EA5n luy\u1EC7n tr\u01B0\u1EDBc c\u1EE7a m\xECnh gi\u1ED1ng nh\u01B0 c\xE1ch \u0111\xE3 l\xE0m v\u1EDBi tokenizer. \u{1F917} Transformers cung c\u1EA5p m\u1ED9t l\u1EDBp "),l=i($,"CODE",{});var N=o(l);g=a(N,"AutoModel"),N.forEach(t),_=a($," c\u0169ng c\xF3 ph\u01B0\u01A1ng th\u1EE9c "),d=i($,"CODE",{});var F=o(d);q=a(F,"from_pretrained()"),F.forEach(t),M=a($,":"),$.forEach(t),P=f(b),x(E.$$.fragment,b)},m(b,$){u(b,s,$),e(s,p),e(s,l),e(l,g),e(s,_),e(s,d),e(d,q),e(s,M),u(b,P,$),T(E,b,$),I=!0},i(b){I||(k(E.$$.fragment,b),I=!0)},o(b){v(E.$$.fragment,b),I=!1},d(b){b&&t(s),b&&t(P),C(E,b)}}}function Di(y){let s,p,l,g;return s=new A({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)`}}),l=new A({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(){w(s.$$.fragment),p=m(),w(l.$$.fragment)},l(_){x(s.$$.fragment,_),p=f(_),x(l.$$.fragment,_)},m(_,d){T(s,_,d),u(_,p,d),T(l,_,d),g=!0},i(_){g||(k(s.$$.fragment,_),k(l.$$.fragment,_),g=!0)},o(_){v(s.$$.fragment,_),v(l.$$.fragment,_),g=!1},d(_){C(s,_),_&&t(p),C(l,_)}}}function Oi(y){let s,p,l,g;return s=new A({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)`}}),l=new A({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(){w(s.$$.fragment),p=m(),w(l.$$.fragment)},l(_){x(s.$$.fragment,_),p=f(_),x(l.$$.fragment,_)},m(_,d){T(s,_,d),u(_,p,d),T(l,_,d),g=!0},i(_){g||(k(s.$$.fragment,_),k(l.$$.fragment,_),g=!0)},o(_){v(s.$$.fragment,_),v(l.$$.fragment,_),g=!1},d(_){C(s,_),_&&t(p),C(l,_)}}}function zi(y){let s,p,l,g,_,d,q,M,P,E,I;return E=new A({props:{code:`from transformers import TFAutoModelForSequenceClassification

checkpoint = "distilbert-base-uncased-finetuned-sst-2-english"
model = TFAutoModelForSequenceClassification.from_pretrained(checkpoint)
outputs = model(inputs)`,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(){s=h("p"),p=c("V\u1EDBi v\xED d\u1EE5 c\u1EE7a m\xECnh, ch\xFAng ta s\u1EBD c\u1EA7n m\u1ED9t m\xF4 h\xECnh c\xF3 \u0111\u1EA7u ph\xE2n lo\u1EA1i tu\u1EA7n t\u1EF1 (\u0111\u1EC3 c\xF3 th\u1EC3 ph\xE2n lo\u1EA1i c\xE1c c\xE2u l\xE0 kh\u1EB3ng \u0111\u1ECBnh ho\u1EB7c ph\u1EE7 \u0111\u1ECBnh). V\xEC v\u1EADy, ta s\u1EBD kh\xF4ng s\u1EED d\u1EE5ng l\u1EDBp "),l=h("code"),g=c("TFAutoModel"),_=c(" m\xE0 l\xE0 "),d=h("code"),q=c("TFAutoModelForSequenceClassification"),M=c(":"),P=m(),w(E.$$.fragment)},l(b){s=i(b,"P",{});var $=o(s);p=a($,"V\u1EDBi v\xED d\u1EE5 c\u1EE7a m\xECnh, ch\xFAng ta s\u1EBD c\u1EA7n m\u1ED9t m\xF4 h\xECnh c\xF3 \u0111\u1EA7u ph\xE2n lo\u1EA1i tu\u1EA7n t\u1EF1 (\u0111\u1EC3 c\xF3 th\u1EC3 ph\xE2n lo\u1EA1i c\xE1c c\xE2u l\xE0 kh\u1EB3ng \u0111\u1ECBnh ho\u1EB7c ph\u1EE7 \u0111\u1ECBnh). V\xEC v\u1EADy, ta s\u1EBD kh\xF4ng s\u1EED d\u1EE5ng l\u1EDBp "),l=i($,"CODE",{});var N=o(l);g=a(N,"TFAutoModel"),N.forEach(t),_=a($," m\xE0 l\xE0 "),d=i($,"CODE",{});var F=o(d);q=a(F,"TFAutoModelForSequenceClassification"),F.forEach(t),M=a($,":"),$.forEach(t),P=f(b),x(E.$$.fragment,b)},m(b,$){u(b,s,$),e(s,p),e(s,l),e(l,g),e(s,_),e(s,d),e(d,q),e(s,M),u(b,P,$),T(E,b,$),I=!0},i(b){I||(k(E.$$.fragment,b),I=!0)},o(b){v(E.$$.fragment,b),I=!1},d(b){b&&t(s),b&&t(P),C(E,b)}}}function Li(y){let s,p,l,g,_,d,q,M,P,E,I;return E=new A({props:{code:`from transformers import AutoModelForSequenceClassification

checkpoint = "distilbert-base-uncased-finetuned-sst-2-english"
model = AutoModelForSequenceClassification.from_pretrained(checkpoint)
outputs = model(**inputs)`,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(){s=h("p"),p=c("V\u1EDBi v\xED d\u1EE5 c\u1EE7a m\xECnh, ch\xFAng ta s\u1EBD c\u1EA7n m\u1ED9t m\xF4 h\xECnh c\xF3 \u0111\u1EA7u ph\xE2n lo\u1EA1i tu\u1EA7n t\u1EF1 (\u0111\u1EC3 c\xF3 th\u1EC3 ph\xE2n lo\u1EA1i c\xE1c c\xE2u l\xE0 kh\u1EB3ng \u0111\u1ECBnh ho\u1EB7c ph\u1EE7 \u0111\u1ECBnh). V\xEC v\u1EADy, ta s\u1EBD kh\xF4ng s\u1EED d\u1EE5ng l\u1EDBp "),l=h("code"),g=c("AutoModel"),_=c(" m\xE0 l\xE0 "),d=h("code"),q=c("AutoModelForSequenceClassification"),M=c(":"),P=m(),w(E.$$.fragment)},l(b){s=i(b,"P",{});var $=o(s);p=a($,"V\u1EDBi v\xED d\u1EE5 c\u1EE7a m\xECnh, ch\xFAng ta s\u1EBD c\u1EA7n m\u1ED9t m\xF4 h\xECnh c\xF3 \u0111\u1EA7u ph\xE2n lo\u1EA1i tu\u1EA7n t\u1EF1 (\u0111\u1EC3 c\xF3 th\u1EC3 ph\xE2n lo\u1EA1i c\xE1c c\xE2u l\xE0 kh\u1EB3ng \u0111\u1ECBnh ho\u1EB7c ph\u1EE7 \u0111\u1ECBnh). V\xEC v\u1EADy, ta s\u1EBD kh\xF4ng s\u1EED d\u1EE5ng l\u1EDBp "),l=i($,"CODE",{});var N=o(l);g=a(N,"AutoModel"),N.forEach(t),_=a($," m\xE0 l\xE0 "),d=i($,"CODE",{});var F=o(d);q=a(F,"AutoModelForSequenceClassification"),F.forEach(t),M=a($,":"),$.forEach(t),P=f(b),x(E.$$.fragment,b)},m(b,$){u(b,s,$),e(s,p),e(s,l),e(l,g),e(s,_),e(s,d),e(d,q),e(s,M),u(b,P,$),T(E,b,$),I=!0},i(b){I||(k(E.$$.fragment,b),I=!0)},o(b){v(E.$$.fragment,b),I=!1},d(b){b&&t(s),b&&t(P),C(E,b)}}}function Hi(y){let s,p;return s=new A({props:{code:"(2, 2)",highlighted:'(<span class="hljs-number">2</span>, <span class="hljs-number">2</span>)'}}),{c(){w(s.$$.fragment)},l(l){x(s.$$.fragment,l)},m(l,g){T(s,l,g),p=!0},i(l){p||(k(s.$$.fragment,l),p=!0)},o(l){v(s.$$.fragment,l),p=!1},d(l){C(s,l)}}}function Vi(y){let s,p;return s=new A({props:{code:"torch.Size([2, 2])",highlighted:'torch.Size([<span class="hljs-number">2</span>, <span class="hljs-number">2</span>])'}}),{c(){w(s.$$.fragment)},l(l){x(s.$$.fragment,l)},m(l,g){T(s,l,g),p=!0},i(l){p||(k(s.$$.fragment,l),p=!0)},o(l){v(s.$$.fragment,l),p=!1},d(l){C(s,l)}}}function Gi(y){let s,p;return s=new A({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(){w(s.$$.fragment)},l(l){x(s.$$.fragment,l)},m(l,g){T(s,l,g),p=!0},i(l){p||(k(s.$$.fragment,l),p=!0)},o(l){v(s.$$.fragment,l),p=!1},d(l){C(s,l)}}}function Bi(y){let s,p;return s=new A({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(){w(s.$$.fragment)},l(l){x(s.$$.fragment,l)},m(l,g){T(s,l,g),p=!0},i(l){p||(k(s.$$.fragment,l),p=!0)},o(l){v(s.$$.fragment,l),p=!1},d(l){C(s,l)}}}function Ki(y){let s,p;return s=new A({props:{code:`import tensorflow as tf

predictions = tf.math.softmax(outputs.logits, axis=-1)
print(predictions)`,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(){w(s.$$.fragment)},l(l){x(s.$$.fragment,l)},m(l,g){T(s,l,g),p=!0},i(l){p||(k(s.$$.fragment,l),p=!0)},o(l){v(s.$$.fragment,l),p=!1},d(l){C(s,l)}}}function Ui(y){let s,p;return s=new A({props:{code:`import torch

predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
print(predictions)`,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(){w(s.$$.fragment)},l(l){x(s.$$.fragment,l)},m(l,g){T(s,l,g),p=!0},i(l){p||(k(s.$$.fragment,l),p=!0)},o(l){v(s.$$.fragment,l),p=!1},d(l){C(s,l)}}}function Ri(y){let s,p;return s=new A({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(){w(s.$$.fragment)},l(l){x(s.$$.fragment,l)},m(l,g){T(s,l,g),p=!0},i(l){p||(k(s.$$.fragment,l),p=!0)},o(l){v(s.$$.fragment,l),p=!1},d(l){C(s,l)}}}function Qi(y){let s,p;return s=new A({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(){w(s.$$.fragment)},l(l){x(s.$$.fragment,l)},m(l,g){T(s,l,g),p=!0},i(l){p||(k(s.$$.fragment,l),p=!0)},o(l){v(s.$$.fragment,l),p=!1},d(l){C(s,l)}}}function Yi(y){let s,p,l,g,_,d,q,M;return{c(){s=h("p"),p=c("\u270F\uFE0F "),l=h("strong"),g=c("Th\u1EED nghi\u1EC7m th\xF4i!"),_=c(" Ch\u1ECDn hai (ho\u1EB7c nhi\u1EC1u) v\u0103n b\u1EA3n c\u1EE7a ri\xEAng b\u1EA1n v\xE0 ch\u1EA1y ch\xFAng th\xF4ng qua "),d=h("code"),q=c("sentiment-analysis"),M=c(". Sau \u0111\xF3, t\u1EF1 m\xECnh l\u1EB7p l\u1EA1i c\xE1c b\u01B0\u1EDBc b\u1EA1n \u0111\xE3 th\u1EA5y \u1EDF \u0111\xE2y v\xE0 ki\u1EC3m tra xem b\u1EA1n c\xF3 thu \u0111\u01B0\u1EE3c k\u1EBFt qu\u1EA3 t\u01B0\u01A1ng t\u1EF1 kh\xF4ng!")},l(P){s=i(P,"P",{});var E=o(s);p=a(E,"\u270F\uFE0F "),l=i(E,"STRONG",{});var I=o(l);g=a(I,"Th\u1EED nghi\u1EC7m th\xF4i!"),I.forEach(t),_=a(E," Ch\u1ECDn hai (ho\u1EB7c nhi\u1EC1u) v\u0103n b\u1EA3n c\u1EE7a ri\xEAng b\u1EA1n v\xE0 ch\u1EA1y ch\xFAng th\xF4ng qua "),d=i(E,"CODE",{});var b=o(d);q=a(b,"sentiment-analysis"),b.forEach(t),M=a(E,". Sau \u0111\xF3, t\u1EF1 m\xECnh l\u1EB7p l\u1EA1i c\xE1c b\u01B0\u1EDBc b\u1EA1n \u0111\xE3 th\u1EA5y \u1EDF \u0111\xE2y v\xE0 ki\u1EC3m tra xem b\u1EA1n c\xF3 thu \u0111\u01B0\u1EE3c k\u1EBFt qu\u1EA3 t\u01B0\u01A1ng t\u1EF1 kh\xF4ng!"),E.forEach(t)},m(P,E){u(P,s,E),e(s,p),e(s,l),e(l,g),e(s,_),e(s,d),e(d,q),e(s,M)},d(P){P&&t(s)}}}function Ji(y){let s,p,l,g,_,d,q,M,P,E,I,b,$,N,F,Tn,ws,K,U,xt,Cn,Nl,Tt,Sl,Fl,xs,Yn,Ts,Ct,Dl,Cs,Jn,qs,qn,Ol,qt,zl,Ll,Ps,kn,Wn,br,Hl,Xn,vr,Ms,Pt,Vl,As,$n,Pn,ve,Zn,Gl,ke,Bl,Is,Mn,Kl,$e,Ul,Rl,Ns,fn,Mt,Ql,ye,Yl,Jl,je,Wl,Xl,Ee,Zl,Ss,H,nc,nt,tc,ec,we,sc,lc,xe,cc,ac,Fs,V,rc,Te,hc,ic,Ce,oc,uc,tt,pc,mc,Ds,et,Os,At,fc,zs,An,gc,qe,dc,_c,Ls,In,bc,Pe,vc,kc,Hs,R,Q,It,Nt,$c,Vs,Y,J,St,O,yc,Me,jc,Ec,Ae,wc,xc,Ie,Tc,Cc,Ne,qc,Pc,Gs,yn,Nn,Se,st,Mc,Fe,Ac,Bs,W,X,Ft,Dt,Ic,Ks,z,Nc,De,Sc,Fc,Oe,Dc,Oc,ze,zc,Lc,Le,Hc,Vc,Us,Ot,Gc,Rs,G,Bc,He,Kc,Uc,Ve,Rc,Qc,zt,Yc,Jc,Qs,jn,Sn,Ge,lt,Wc,Be,Xc,Ys,Lt,Zc,Js,gn,Ht,Ke,na,ta,ea,Vt,Ue,sa,la,ca,Gt,Re,aa,ra,Ws,Bt,ha,Xs,Kt,ia,Zs,Z,nn,Ut,B,oa,Qe,ua,pa,Ye,ma,fa,Je,ga,da,nl,En,Fn,We,ct,_a,Xe,ba,tl,Rt,va,el,wn,at,kr,ka,rt,$r,sl,Qt,$a,ll,Yt,ya,cl,Jt,ja,al,S,Wt,Ze,Ea,wa,xa,ns,ts,Ta,Ca,es,ss,qa,Pa,ls,cs,Ma,Aa,as,rs,Ia,Na,hs,is,Sa,Fa,os,us,Da,Oa,ps,za,rl,tn,en,Xt,Zt,La,hl,ht,il,sn,ln,ne,te,Ha,ol,xn,Dn,ms,it,Va,fs,Ga,ul,ee,Ba,pl,ot,ml,cn,an,se,L,Ka,gs,Ua,Ra,ds,Qa,Ya,_s,Ja,Wa,ut,Xa,Za,fl,rn,hn,le,on,un,ce,dn,nr,bs,tr,er,vs,sr,lr,gl,On,cr,ks,ar,rr,dl,pt,_l,mt,bl,ae,hr,vl,zn,$s,ir,or,ys,ur,kl,re,pr,$l,Ln,yl;l=new wi({props:{fw:y[0]}}),M=new be({});const yr=[Ti,xi],ft=[];function jr(n,r){return n[0]==="pt"?0:1}$=jr(y),N=ft[$]=yr[$](y),Tn=new _i({props:{$$slots:{default:[Ci]},$$scope:{ctx:y}}});const Er=[Pi,qi],gt=[];function wr(n,r){return n[0]==="pt"?0:1}K=wr(y),U=gt[K]=Er[K](y),Yn=new A({props:{code:`from transformers import pipeline

classifier = pipeline("sentiment-analysis")
classifier(
    [
        "I've been waiting for a HuggingFace course my whole life.",
        "I hate this so much!",
    ]
)`,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>,
    ]
)`}}),Jn=new A({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>}]`}}),Zn=new be({}),et=new A({props:{code:`from transformers import AutoTokenizer

checkpoint = "distilbert-base-uncased-finetuned-sst-2-english"
tokenizer = AutoTokenizer.from_pretrained(checkpoint)`,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 xr=[Ai,Mi],dt=[];function Tr(n,r){return n[0]==="pt"?0:1}R=Tr(y),Q=dt[R]=xr[R](y);const Cr=[Ni,Ii],_t=[];function qr(n,r){return n[0]==="pt"?0:1}Y=qr(y),J=_t[Y]=Cr[Y](y),st=new be({});const Pr=[Fi,Si],bt=[];function Mr(n,r){return n[0]==="pt"?0:1}W=Mr(y),X=bt[W]=Pr[W](y),lt=new be({});const Ar=[Oi,Di],vt=[];function Ir(n,r){return n[0]==="pt"?0:1}Z=Ir(y),nn=vt[Z]=Ar[Z](y),ct=new be({});const Nr=[Li,zi],kt=[];function Sr(n,r){return n[0]==="pt"?0:1}tn=Sr(y),en=kt[tn]=Nr[tn](y),ht=new A({props:{code:"print(outputs.logits.shape)",highlighted:'<span class="hljs-built_in">print</span>(outputs.logits.shape)'}});const Fr=[Vi,Hi],$t=[];function Dr(n,r){return n[0]==="pt"?0:1}sn=Dr(y),ln=$t[sn]=Fr[sn](y),it=new be({}),ot=new A({props:{code:"print(outputs.logits)",highlighted:'<span class="hljs-built_in">print</span>(outputs.logits)'}});const Or=[Bi,Gi],yt=[];function zr(n,r){return n[0]==="pt"?0:1}cn=zr(y),an=yt[cn]=Or[cn](y);const Lr=[Ui,Ki],jt=[];function Hr(n,r){return n[0]==="pt"?0:1}rn=Hr(y),hn=jt[rn]=Lr[rn](y);const Vr=[Qi,Ri],Et=[];function Gr(n,r){return n[0]==="pt"?0:1}return on=Gr(y),un=Et[on]=Vr[on](y),pt=new A({props:{code:"model.config.id2label",highlighted:"model.config.id2label"}}),mt=new A({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>}'}}),Ln=new _i({props:{$$slots:{default:[Yi]},$$scope:{ctx:y}}}),{c(){s=h("meta"),p=m(),w(l.$$.fragment),g=m(),_=h("h1"),d=h("a"),q=h("span"),w(M.$$.fragment),P=m(),E=h("span"),I=c("\u0110\u1EB1ng sau pipeline"),b=m(),N.c(),F=m(),w(Tn.$$.fragment),ws=m(),U.c(),xt=m(),Cn=h("p"),Nl=c("H\xE3y b\u1EAFt \u0111\u1EA7u v\u1EDBi m\u1ED9t v\xED d\u1EE5 ho\xE0n ch\u1EC9nh, c\xF9ng xem nh\u1EEFng g\xEC x\u1EA3y ra ph\xEDa sau khi ch\xFAng t\xF4i th\u1EF1c thi \u0111o\u1EA1n m\xE3 sau trong "),Tt=h("a"),Sl=c("Ch\u01B0\u01A1ng 1"),Fl=c(":"),xs=m(),w(Yn.$$.fragment),Ts=m(),Ct=h("p"),Dl=c("v\xE0 thu \u0111\u01B0\u1EE3c:"),Cs=m(),w(Jn.$$.fragment),qs=m(),qn=h("p"),Ol=c("Nh\u01B0 ch\xFAng ta \u0111\xE3 th\u1EA5y trong "),qt=h("a"),zl=c("Ch\u01B0\u01A1ng 1"),Ll=c(", pipeline n\xE0y nh\xF3m ba b\u01B0\u1EDBc l\u1EA1i v\u1EDBi nhau: ti\u1EC1n x\u1EED l\xFD, \u0111\u01B0a c\xE1c \u0111\u1EA7u v\xE0o qua m\xF4 h\xECnh v\xE0 h\u1EADu x\u1EED l\xFD:"),Ps=m(),kn=h("div"),Wn=h("img"),Hl=m(),Xn=h("img"),Ms=m(),Pt=h("p"),Vl=c("H\xE3y c\xF9ng \u0111i qua t\u1EEBng ph\u1EA7n n\xE0y."),As=m(),$n=h("h2"),Pn=h("a"),ve=h("span"),w(Zn.$$.fragment),Gl=m(),ke=h("span"),Bl=c("Ti\u1EC1n x\u1EED l\xFD v\u1EDBi m\u1ED9t tokenizer"),Is=m(),Mn=h("p"),Kl=c("Gi\u1ED1ng nh\u01B0 c\xE1c m\u1EA1ng n\u01A1-ron kh\xE1c, c\xE1c m\xF4 h\xECnh Transformers kh\xF4ng th\u1EC3 x\u1EED l\xFD tr\u1EF1c ti\u1EBFp v\u0103n b\u1EA3n th\xF4, v\xEC v\u1EADy b\u01B0\u1EDBc \u0111\u1EA7u ti\xEAn trong quy tr\xECnh c\u1EE7a ch\xFAng ta l\xE0 chuy\u1EC3n c\xE1c \u0111\u1EA7u v\xE0o v\u0103n b\u1EA3n th\xE0nh d\u1EA1ng s\u1ED1 m\xE0 m\xF4 h\xECnh c\xF3 th\u1EC3 hi\u1EC3u \u0111\u01B0\u1EE3c. \u0110\u1EC3 l\xE0m \u0111i\u1EC1u n\xE0y, ch\xFAng ta s\u1EED d\u1EE5ng "),$e=h("em"),Ul=c("tokenizer"),Rl=c(", h\xE0m s\u1EBD ch\u1ECBu tr\xE1ch nhi\u1EC7m v\u1EC1:"),Ns=m(),fn=h("ul"),Mt=h("li"),Ql=c("T\xE1ch \u0111\u1EA7u v\xE0o th\xE0nh c\xE1c t\u1EEB, t\u1EEB ph\u1EE5, ho\u1EB7c k\xFD hi\u1EC7u (nh\u01B0 d\u1EA5u ch\u1EA5m c\xE2u) \u0111\u01B0\u1EE3c g\u1ECDi l\xE0 "),ye=h("em"),Yl=c("tokens"),Jl=m(),je=h("li"),Wl=c("\xC1nh x\u1EA1 m\u1ED7i token th\xE0nh m\u1ED9t s\u1ED1 nguy\xEAn"),Xl=m(),Ee=h("li"),Zl=c("Th\xEAm \u0111\u1EA7u v\xE0o b\u1ED5 sung c\xF3 th\u1EC3 h\u1EEFu \xEDch cho m\xF4 h\xECnh"),Ss=m(),H=h("p"),nc=c("T\u1EA5t c\u1EA3 qu\xE1 tr\xECnh ti\u1EC1n x\u1EED l\xFD n\xE0y c\u1EA7n \u0111\u01B0\u1EE3c th\u1EF1c hi\u1EC7n gi\u1ED1ng h\u1EC7t nh\u01B0 khi m\xF4 h\xECnh \u0111\u01B0\u1EE3c hu\u1EA5n luy\u1EC7n tr\u01B0\u1EDBc, v\xEC v\u1EADy tr\u01B0\u1EDBc ti\xEAn ch\xFAng ta c\u1EA7n t\u1EA3i xu\u1ED1ng th\xF4ng tin \u0111\xF3 t\u1EEB "),nt=h("a"),tc=c("Model Hub"),ec=c(". \u0110\u1EC3 l\xE0m \u0111i\u1EC1u n\xE0y, ch\xFAng t\xF4i s\u1EED d\u1EE5ng l\u1EDBp "),we=h("code"),sc=c("AutoTokenizer"),lc=c(" v\xE0 ph\u01B0\u01A1ng th\u1EE9c "),xe=h("code"),cc=c("from_pretrained()"),ac=c(" c\u1EE7a n\xF3. S\u1EED d\u1EE5ng t\xEAn checkpoint m\xF4 h\xECnh c\u1EE7a ch\xFAng ta, n\xF3 s\u1EBD t\u1EF1 \u0111\u1ED9ng t\xECm n\u1EA1p d\u1EEF li\u1EC7u \u0111\u01B0\u1EE3c li\xEAn k\u1EBFt v\u1EDBi tokenizer c\u1EE7a m\xF4 h\xECnh v\xE0 l\u01B0u v\xE0o b\u1ED9 nh\u1EDB cache (v\xEC v\u1EADy n\xF3 ch\u1EC9 \u0111\u01B0\u1EE3c t\u1EA3i xu\u1ED1ng l\u1EA7n \u0111\u1EA7u ti\xEAn b\u1EA1n ch\u1EA1y m\xE3 b\xEAn d\u01B0\u1EDBi)."),Fs=m(),V=h("p"),rc=c("V\xEC checkpoint m\u1EB7c \u0111\u1ECBnh c\u1EE7a "),Te=h("code"),hc=c("sentiment-analysis"),ic=c(" l\xE0 "),Ce=h("code"),oc=c("distilbert-base-unsased-finetuned-sst-2-english"),uc=c(" (b\u1EA1n c\xF3 th\u1EC3 xem th\u1EBB m\xF4 h\xECnh c\u1EE7a n\xF3 "),tt=h("a"),pc=c("t\u1EA1i \u0111\xE2y"),mc=c("), ch\xFAng ta ch\u1EA1y nh\u01B0 sau:"),Ds=m(),w(et.$$.fragment),Os=m(),At=h("p"),fc=c("Khi c\xF3 tokenizer r\u1ED3i, ch\xFAng ta c\xF3 th\u1EC3 truy\u1EC1n tr\u1EF1c ti\u1EBFp c\xE1c c\xE2u c\u1EE7a m\xECnh v\xE0o b\xEAn trong v\xE0 nh\u1EADn l\u1EA1i m\u1ED9t t\u1EEB \u0111i\u1EC3n \u0111\xE3 s\u1EB5n s\xE0ng \u0111\u1EC3 cung c\u1EA5p cho m\xF4 h\xECnh! Vi\u1EC7c duy nh\u1EA5t c\u1EA7n l\xE0m l\xE0 chuy\u1EC3n \u0111\u1ED5i danh s\xE1ch c\xE1c ID \u0111\u1EA7u v\xE0o th\xE0nh c\xE1c tensor."),zs=m(),An=h("p"),gc=c("B\u1EA1n c\xF3 th\u1EC3 s\u1EED d\u1EE5ng \u{1F917} Transformers m\xE0 kh\xF4ng ph\u1EA3i lo l\u1EAFng v\u1EC1 khung ML n\xE0o \u0111\u01B0\u1EE3c s\u1EED d\u1EE5ng ph\xEDa d\u01B0\u1EDBi; n\xF3 c\xF3 th\u1EC3 l\xE0 PyTorch ho\u1EB7c TensorFlow ho\u1EB7c Flax \u0111\u1ED1i v\u1EDBi m\u1ED9t s\u1ED1 m\xF4 h\xECnh. Tuy nhi\xEAn, c\xE1c m\xF4 h\xECnh Transformer ch\u1EC9 ch\u1EA5p nh\u1EADn "),qe=h("em"),dc=c("tensor"),_c=c(" l\xE0m \u0111\u1EA7u v\xE0o. N\u1EBFu \u0111\xE2y l\xE0 l\u1EA7n \u0111\u1EA7u ti\xEAn b\u1EA1n nghe v\u1EC1 tensor, b\u1EA1n c\xF3 th\u1EC3 ngh\u0129 ch\xFAng nh\u01B0 l\xE0 m\u1EA3ng NumPy. M\u1EA3ng NumPy c\xF3 th\u1EC3 l\xE0 gi\xE1 tr\u1ECB v\xF4 h\u01B0\u1EDBng (0D), vect\u01A1 (1D), ma tr\u1EADn (2D) ho\u1EB7c c\xF3 nhi\u1EC1u k\xEDch th\u01B0\u1EDBc h\u01A1n. N\xF3 th\u1EF1c s\u1EF1 l\xE0 m\u1ED9t tensor; C\xE1c tensor c\u1EE7a c\xE1c khung ML kh\xE1c ho\u1EA1t \u0111\u1ED9ng t\u01B0\u01A1ng t\u1EF1 v\xE0 th\u01B0\u1EDDng kh\u1EDFi t\u1EA1o \u0111\u01A1n gi\u1EA3n nh\u01B0 c\xE1c m\u1EA3ng NumPy."),Ls=m(),In=h("p"),bc=c("\u0110\u1EC3 ch\u1EC9 \u0111\u1ECBnh lo\u1EA1i tensors m\xE0 ch\xFAng ta mu\u1ED1n tr\u1EA3 v\u1EC1 (PyTorch, TensorFlow ho\u1EB7c thu\u1EA7n NumPy), ta s\u1EED d\u1EE5ng tham s\u1ED1 "),Pe=h("code"),vc=c("return_tensors"),kc=c(":"),Hs=m(),Q.c(),It=m(),Nt=h("p"),$c=c("\u0110\u1EEBng lo l\u1EAFng v\u1EC1 padding (\u0111\u1EC7m) v\xE0 truncation (c\u1EAFt b\u1EDBt) v\u1ED9i; ch\xFAng t\xF4i s\u1EBD gi\u1EA3i th\xEDch nh\u1EEFng \u0111i\u1EC1u \u0111\xF3 sau. Nh\u1EEFng \u0111i\u1EC1u ch\xEDnh c\u1EA7n nh\u1EDB \u1EDF \u0111\xE2y l\xE0 b\u1EA1n c\xF3 th\u1EC3 chuy\u1EC3n m\u1ED9t c\xE2u ho\u1EB7c m\u1ED9t danh s\xE1ch c\xE1c c\xE2u, c\u0169ng nh\u01B0 ch\u1EC9 \u0111\u1ECBnh lo\u1EA1i tensors b\u1EA1n mu\u1ED1n l\u1EA5y l\u1EA1i (n\u1EBFu kh\xF4ng c\xF3 lo\u1EA1i n\xE0o \u0111\u01B0\u1EE3c truy\u1EC1n v\xE0o, m\u1EB7c \u0111\u1ECBnh b\u1EA1n s\u1EBD nh\u1EADn \u0111\u01B0\u1EE3c k\u1EBFt qu\u1EA3 tr\u1EA3 v\u1EC1 l\xE0 m\u1ED9t danh s\xE1ch)."),Vs=m(),J.c(),St=m(),O=h("p"),yc=c("B\u1EA3n th\xE2n k\u1EBFt qu\u1EA3 \u0111\u1EA7u ra l\xE0 m\u1ED9t t\u1EEB \u0111i\u1EC3n c\xF3 ch\u1EE9a hai kh\xF3a, "),Me=h("code"),jc=c("input_ids"),Ec=c(" v\xE0 "),Ae=h("code"),wc=c("attention_mask"),xc=c(". "),Ie=h("code"),Tc=c("input_ids"),Cc=c(" ch\u1EE9a hai h\xE0ng s\u1ED1 nguy\xEAn (m\u1ED9t cho m\u1ED7i c\xE2u) l\xE0 s\u1ED1 nh\u1EADn d\u1EA1ng duy nh\u1EA5t c\u1EE7a token trong m\u1ED7i c\xE2u. Ch\xFAng t\xF4i s\u1EBD gi\u1EA3i th\xEDch "),Ne=h("code"),qc=c("attention_mask"),Pc=c(" l\xE0 g\xEC \u1EDF ph\u1EA7n sau c\u1EE7a ch\u01B0\u01A1ng n\xE0y."),Gs=m(),yn=h("h2"),Nn=h("a"),Se=h("span"),w(st.$$.fragment),Mc=m(),Fe=h("span"),Ac=c("\u0110i qua m\xF4 h\xECnh"),Bs=m(),X.c(),Ft=m(),Dt=h("p"),Ic=c("Trong \u0111o\u1EA1n m\xE3 n\xE0y, ch\xFAng ta \u0111\xE3 t\u1EA3i xu\u1ED1ng c\xF9ng m\u1ED9t checkpoint \u0111\xE3 s\u1EED d\u1EE5ng trong pipeline c\u1EE7a m\xECnh tr\u01B0\u1EDBc \u0111\xE2y (n\xF3 \u0111\u01B0\u1EE3c l\u01B0u v\xE0o b\u1ED9 nh\u1EDB \u0111\u1EC7m r\u1ED3i) v\xE0 kh\u1EDFi t\u1EA1o m\u1ED9t m\xF4 h\xECnh v\u1EDBi n\xF3."),Ks=m(),z=h("p"),Nc=c("Ki\u1EBFn tr\xFAc n\xE0y ch\u1EC9 ch\u1EE9a m\xF4-\u0111un Transformer c\u01A1 s\u1EDF: v\u1EDBi m\u1ED9t s\u1ED1 \u0111\u1EA7u v\xE0o, n\xF3 xu\u1EA5t ra c\xE1i m\xE0 ch\xFAng ta s\u1EBD g\u1ECDi l\xE0 "),De=h("em"),Sc=c("hidden states"),Fc=c(" ("),Oe=h("em"),Dc=c("tr\u1EA1ng th\xE1i \u1EA9n"),Oc=c("), c\xF2n \u0111\u01B0\u1EE3c g\u1ECDi l\xE0 "),ze=h("em"),zc=c("\u0111\u1EB7c tr\u01B0ng"),Lc=c(". \u0110\u1ED1i v\u1EDBi m\u1ED7i \u0111\u1EA7u v\xE0o m\xF4 h\xECnh, ch\xFAng ta s\u1EBD truy xu\u1EA5t m\u1ED9t vect\u01A1 \u0111a chi\u1EC1u \u0111\u1EA1i di\u1EC7n cho "),Le=h("strong"),Hc=c("s\u1EF1 hi\u1EC3u theo ng\u1EEF c\u1EA3nh c\u1EE7a \u0111\u1EA7u v\xE0o \u0111\xF3 b\u1EB1ng m\xF4 h\xECnh Transformer"),Vc=c("."),Us=m(),Ot=h("p"),Gc=c("N\u1EBFu \u0111i\u1EC1u n\xE0y kh\xF4ng h\u1EE3p l\xFD, \u0111\u1EEBng lo l\u1EAFng v\u1EC1 n\xF3. Ch\xFAng t\xF4i s\u1EBD gi\u1EA3i th\xEDch t\u1EA5t c\u1EA3 sau."),Rs=m(),G=h("p"),Bc=c("M\u1EB7c d\xF9 nh\u1EEFng tr\u1EA1ng th\xE1i \u1EA9n n\xE0y c\xF3 th\u1EC3 t\u1EF1 h\u1EEFu \xEDch, nh\u01B0ng ch\xFAng th\u01B0\u1EDDng l\xE0 \u0111\u1EA7u v\xE0o cho m\u1ED9t ph\u1EA7n kh\xE1c c\u1EE7a m\xF4 h\xECnh, \u0111\u01B0\u1EE3c g\u1ECDi l\xE0 "),He=h("em"),Kc=c("head"),Uc=c(" ("),Ve=h("em"),Rc=c("\u0111\u1EA7u"),Qc=c("). Trong "),zt=h("a"),Yc=c("Chapter 1"),Jc=c(", c\xE1c t\xE1c v\u1EE5 kh\xE1c nhau c\xF3 th\u1EC3 \u0111\u01B0\u1EE3c th\u1EF1c hi\u1EC7n v\u1EDBi c\xF9ng m\u1ED9t ki\u1EBFn tr\xFAc, nh\u01B0ng m\u1ED7i t\xE1c v\u1EE5 n\xE0y s\u1EBD c\xF3 m\u1ED9t ph\u1EA7n \u0111\u1EA7u kh\xE1c nhau \u0111\u01B0\u1EE3c li\xEAn k\u1EBFt v\u1EDBi n\xF3."),Qs=m(),jn=h("h3"),Sn=h("a"),Ge=h("span"),w(lt.$$.fragment),Wc=m(),Be=h("span"),Xc=c("M\u1ED9t vect\u01A1 \u0111a chi\u1EC1u"),Ys=m(),Lt=h("p"),Zc=c("\u0110\u1EA7u ra vect\u01A1 c\u1EE7a m\xF4-\u0111un Transformer th\u01B0\u1EDDng l\u1EDBn v\u1EDBi ba chi\u1EC1u:"),Js=m(),gn=h("ul"),Ht=h("li"),Ke=h("strong"),na=c("K\xEDch th\u01B0\u1EDBc batch (l\xF4)"),ta=c(": S\u1ED1 chu\u1ED7i \u0111\u01B0\u1EE3c x\u1EED l\xFD t\u1EA1i m\u1ED9t th\u1EDDi \u0111i\u1EC3m (trong v\xED d\u1EE5 c\u1EE7a ch\xFAng t\xF4i l\xE0 2)."),ea=m(),Vt=h("li"),Ue=h("strong"),sa=c("\u0110\u1ED9 d\xE0i chu\u1ED7i"),la=c(": \u0110\u1ED9 d\xE0i bi\u1EC3u di\u1EC5n s\u1ED1 c\u1EE7a chu\u1ED7i (trong v\xED d\u1EE5 c\u1EE7a ch\xFAng t\xF4i l\xE0 16)."),ca=m(),Gt=h("li"),Re=h("strong"),aa=c("K\xEDch th\u01B0\u1EDBc \u1EA9n"),ra=c(": K\xEDch th\u01B0\u1EDBc vect\u01A1 c\u1EE7a m\u1ED7i \u0111\u1EA7u v\xE0o m\xF4 h\xECnh."),Ws=m(),Bt=h("p"),ha=c("N\xF3 \u0111\u01B0\u1EE3c cho l\xE0 \u201Cc\xF3 s\u1ED1 chi\u1EC1u cao\u201D v\xEC gi\xE1 tr\u1ECB cu\u1ED1i c\xF9ng. K\xEDch th\u01B0\u1EDBc \u1EA9n c\xF3 th\u1EC3 r\u1EA5t l\u1EDBn (768 l\xE0 gi\xE1 tr\u1ECB ph\u1ED5 bi\u1EBFn cho c\xE1c m\xF4 h\xECnh nh\u1ECF h\u01A1n v\xE0 trong c\xE1c m\xF4 h\xECnh l\u1EDBn h\u01A1n, con s\u1ED1 n\xE0y c\xF3 th\u1EC3 \u0111\u1EA1t t\u1EDBi 3072 ho\u1EB7c h\u01A1n)."),Xs=m(),Kt=h("p"),ia=c("C\xF3 th\u1EC3 th\u1EA5y \u0111i\u1EC1u n\xE0y n\u1EBFu ch\xFAng ta cung c\u1EA5p c\xE1c \u0111\u1EA7u v\xE0o \u0111\xE3 x\u1EED l\xFD tr\u01B0\u1EDBc cho m\xF4 h\xECnh c\u1EE7a m\xECnh:"),Zs=m(),nn.c(),Ut=m(),B=h("p"),oa=c("L\u01B0u \xFD r\u1EB1ng \u0111\u1EA7u ra c\u1EE7a c\xE1c m\xF4 h\xECnh \u{1F917} Transformers ho\u1EA1t \u0111\u1ED9ng gi\u1ED1ng nh\u01B0 c\xE1c "),Qe=h("code"),ua=c("namedtuple"),pa=c(" ho\u1EB7c t\u1EEB \u0111i\u1EC3n. B\u1EA1n c\xF3 th\u1EC3 truy c\u1EADp c\xE1c ph\u1EA7n t\u1EED theo thu\u1ED9c t\xEDnh (nh\u01B0 ch\xFAng ta \u0111\xE3 l\xE0m) ho\u1EB7c theo kh\xF3a ("),Ye=h("code"),ma=c('outputs["last_hidden_state"]'),fa=c("), ho\u1EB7c th\u1EADm ch\xED theo ch\u1EC9 m\u1EE5c n\u1EBFu b\u1EA1n bi\u1EBFt ch\xEDnh x\xE1c n\u01A1i b\u1EA1n \u0111ang t\xECm ki\u1EBFm ("),Je=h("code"),ga=c("outputs[0]"),da=c(")."),nl=m(),En=h("h3"),Fn=h("a"),We=h("span"),w(ct.$$.fragment),_a=m(),Xe=h("span"),ba=c("\u0110\u1EA7u m\xF4 h\xECnh: H\u1EE3p l\xFD t\u1EDDi t\u1EEBng con s\u1ED1"),tl=m(),Rt=h("p"),va=c("C\xE1c \u0111\u1EA7u m\xF4 h\xECnh l\u1EA5y vector \u0111a chi\u1EC1u c\u1EE7a c\xE1c tr\u1EA1ng th\xE1i \u1EA9n l\xE0m \u0111\u1EA7u v\xE0o v\xE0 chi\u1EBFu ch\xFAng l\xEAn m\u1ED9t chi\u1EC1u kh\xE1c. Ch\xFAng th\u01B0\u1EDDng bao g\u1ED3m m\u1ED9t ho\u1EB7c m\u1ED9t v\xE0i l\u1EDBp tuy\u1EBFn t\xEDnh:"),el=m(),wn=h("div"),at=h("img"),ka=m(),rt=h("img"),sl=m(),Qt=h("p"),$a=c("\u0110\u1EA7u ra c\u1EE7a m\xF4 h\xECnh Transformer \u0111\u01B0\u1EE3c g\u1EEDi tr\u1EF1c ti\u1EBFp \u0111\u1EBFn \u0111\u1EA7u m\xF4 h\xECnh \u0111\u1EC3 \u0111\u01B0\u1EE3c x\u1EED l\xFD."),ll=m(),Yt=h("p"),ya=c("Trong bi\u1EC3u \u0111\u1ED3 n\xE0y, m\xF4 h\xECnh \u0111\u01B0\u1EE3c bi\u1EC3u di\u1EC5n b\u1EB1ng l\u1EDBp nh\xFAng c\u1EE7a n\xF3 v\xE0 c\xE1c l\u1EDBp ti\u1EBFp theo. L\u1EDBp nh\xFAng chuy\u1EC3n \u0111\u1ED5i m\u1ED7i ID trong \u0111\u1EA7u v\xE0o \u0111\u01B0\u1EE3c m\xE3 h\xF3a th\xE0nh m\u1ED9t vect\u01A1 \u0111\u1EA1i di\u1EC7n cho token \u0111\u01B0\u1EE3c li\xEAn k\u1EBFt. C\xE1c l\u1EDBp ti\u1EBFp theo thao t\xE1c c\xE1c vect\u01A1 \u0111\xF3 b\u1EB1ng c\xE1ch s\u1EED d\u1EE5ng c\u01A1 ch\u1EBF ch\xFA \xFD \u0111\u1EC3 t\u1EA1o ra bi\u1EC3u di\u1EC5n cu\u1ED1i c\xF9ng c\u1EE7a c\xE1c c\xE2u."),cl=m(),Jt=h("p"),ja=c("C\xF3 nhi\u1EC1u ki\u1EBFn tr\xFAc kh\xE1c nhau c\xF3 s\u1EB5n trong \u{1F917} Transformers, v\u1EDBi m\u1ED7i ki\u1EBFn tr\xFAc \u0111\u01B0\u1EE3c thi\u1EBFt k\u1EBF xoay quanh m\u1ED9t t\xE1c v\u1EE5 c\u1EE5 th\u1EC3. \u0110\xE2y l\xE0 danh s\xE1ch kh\xF4ng \u0111\u1EA7y \u0111\u1EE7:"),al=m(),S=h("ul"),Wt=h("li"),Ze=h("code"),Ea=c("*Model"),wa=c(" (truy xu\u1EA5t c\xE1c tr\u1EA1ng th\xE1i \u1EA9n)"),xa=m(),ns=h("li"),ts=h("code"),Ta=c("*ForCausalLM"),Ca=m(),es=h("li"),ss=h("code"),qa=c("*ForMaskedLM"),Pa=m(),ls=h("li"),cs=h("code"),Ma=c("*ForMultipleChoice"),Aa=m(),as=h("li"),rs=h("code"),Ia=c("*ForQuestionAnswering"),Na=m(),hs=h("li"),is=h("code"),Sa=c("*ForSequenceClassification"),Fa=m(),os=h("li"),us=h("code"),Da=c("*ForTokenClassification"),Oa=m(),ps=h("li"),za=c("and others \u{1F917}"),rl=m(),en.c(),Xt=m(),Zt=h("p"),La=c("Gi\u1EDD th\xEC n\u1EBFu ch\xFAng ta nh\xECn v\xE0o h\xECnh d\u1EA1ng c\xE1c \u0111\u1EA7u v\xE0o c\u1EE7a m\xECnh, k\xEDch th\u01B0\u1EDBc s\u1EBD th\u1EA5p h\u01A1n nhi\u1EC1u: \u0111\u1EA7u m\xF4 h\xECnh l\u1EA5y c\xE1c vect\u01A1 \u0111a chi\u1EC1u m\xE0 ch\xFAng ta \u0111\xE3 th\u1EA5y tr\u01B0\u1EDBc \u0111\xE2y v\xE0 xu\u1EA5t ra c\xE1c vect\u01A1 c\xF3 ch\u1EE9a hai gi\xE1 tr\u1ECB (m\u1ED7i gi\xE1 tr\u1ECB t\u01B0\u01A1ng \u1EE9ng m\u1ED9t nh\xE3n):"),hl=m(),w(ht.$$.fragment),il=m(),ln.c(),ne=m(),te=h("p"),Ha=c("V\xEC ch\xFAng ta ch\u1EC9 c\xF3 hai c\xE2u v\xE0 hai nh\xE3n, k\u1EBFt qu\u1EA3 nh\u1EADn \u0111\u01B0\u1EE3c t\u1EEB m\xF4 h\xECnh c\u1EE7a ch\xFAng ta l\xE0 d\u1EA1ng 2 x 2."),ol=m(),xn=h("h2"),Dn=h("a"),ms=h("span"),w(it.$$.fragment),Va=m(),fs=h("span"),Ga=c("H\u1EADu x\u1EED l\xFD \u0111\u1EA7u ra"),ul=m(),ee=h("p"),Ba=c("C\xE1c gi\xE1 tr\u1ECB ch\xFAng ta nh\u1EADn \u0111\u01B0\u1EE3c d\u01B0\u1EDBi d\u1EA1ng \u0111\u1EA7u ra t\u1EEB m\xF4 h\xECnh kh\xF4ng nh\u1EA5t thi\u1EBFt ph\u1EA3i t\u1EF1 c\xF3 ngh\u0129a. H\xE3y c\xF9ng xem:"),pl=m(),w(ot.$$.fragment),ml=m(),an.c(),se=m(),L=h("p"),Ka=c("M\xF4 h\xECnh \u0111\xE3 d\u1EF1 \u0111o\xE1n "),gs=h("code"),Ua=c("[-1.5607, 1.6123]"),Ra=c(" cho c\xE2u \u0111\u1EA7u ti\xEAn v\xE0 "),ds=h("code"),Qa=c("[4.1692, -3.3464]"),Ya=c(" cho c\xE2u th\u1EE9 hai. \u0110\xF3 kh\xF4ng ph\u1EA3i l\xE0 x\xE1c su\u1EA5t m\xE0 l\xE0 "),_s=h("em"),Ja=c("logits"),Wa=c(", \u0111i\u1EC3m s\u1ED1 th\xF4, ch\u01B0a chu\u1EA9n h\xF3a \u0111\u01B0\u1EE3c xu\u1EA5t ra b\u1EDFi l\u1EDBp cu\u1ED1i c\xF9ng c\u1EE7a m\xF4 h\xECnh. \u0110\u1EC3 \u0111\u01B0\u1EE3c chuy\u1EC3n \u0111\u1ED5i th\xE0nh x\xE1c su\u1EA5t, ch\xFAng c\u1EA7n ph\u1EA3i tr\u1EA3i qua l\u1EDBp "),ut=h("a"),Xa=c("SoftMax"),Za=c(" (t\u1EA5t c\u1EA3 c\xE1c m\xF4 h\xECnh \u{1F917} Transformers \u0111\u1EC1u xu\u1EA5t ra logits, v\xEC h\xE0m m\u1EA5t m\xE1t cho vi\u1EC7c hu\u1EA5n luy\u1EC7n th\u01B0\u1EDDng s\u1EBD k\u1EBFt h\u1EE3p h\xE0m k\xEDch ho\u1EA1t cu\u1ED1i c\xF9ng, ch\u1EB3ng h\u1EA1n nh\u01B0 SoftMax, v\u1EDBi h\xE0m m\u1EA5t m\xE1t th\u1EF1c t\u1EBF, ch\u1EB3ng h\u1EA1n nh\u01B0 entropy ch\xE9o):"),fl=m(),hn.c(),le=m(),un.c(),ce=m(),dn=h("p"),nr=c("B\xE2y gi\u1EDD ch\xFAng ta c\xF3 th\u1EC3 th\u1EA5y r\u1EB1ng m\xF4 h\xECnh \u0111\xE3 d\u1EF1 \u0111o\xE1n "),bs=h("code"),tr=c("[0.0402, 0.9598]"),er=c(" cho c\xE2u \u0111\u1EA7u ti\xEAn v\xE0 "),vs=h("code"),sr=c("[0.9995, 0.0005]"),lr=c(" cho c\xE2u th\u1EE9 hai. \u0110\xE2y l\xE0 nh\u1EEFng \u0111i\u1EC3m x\xE1c su\u1EA5t d\u1EC5 nh\u1EADn bi\u1EBFt."),gl=m(),On=h("p"),cr=c("\u0110\u1EC3 l\u1EA5y c\xE1c nh\xE3n t\u01B0\u01A1ng \u1EE9ng v\u1EDBi t\u1EEBng v\u1ECB tr\xED, ch\xFAng ta c\xF3 th\u1EC3 ki\u1EC3m tra thu\u1ED9c t\xEDnh "),ks=h("code"),ar=c("id2label"),rr=c(" c\u1EE7a c\u1EA5u h\xECnh m\xF4 h\xECnh (t\xECm hi\u1EC3u th\xEAm v\u1EC1 \u0111i\u1EC1u n\xE0y trong ph\u1EA7n ti\u1EBFp theo):"),dl=m(),w(pt.$$.fragment),_l=m(),w(mt.$$.fragment),bl=m(),ae=h("p"),hr=c("B\xE2y gi\u1EDD ch\xFAng ta c\xF3 th\u1EC3 k\u1EBFt lu\u1EADn r\u1EB1ng m\xF4 h\xECnh \u0111\xE3 d\u1EF1 \u0111o\xE1n nh\u01B0 sau:"),vl=m(),zn=h("ul"),$s=h("li"),ir=c("C\xE2u \u0111\u1EA7u ti\xEAn: TI\xCAU C\u1EF0C: 0,0402, T\xCDCH C\u1EF0C: 0,9598"),or=m(),ys=h("li"),ur=c("C\xE2u th\u1EE9 hai: TI\xCAU C\u1EF0C: 0,9995, T\xCDCH C\u1EF0C: 0,0005"),kl=m(),re=h("p"),pr=c("Ch\xFAng t\xF4i \u0111\xE3 t\xE1i t\u1EA1o th\xE0nh c\xF4ng ba b\u01B0\u1EDBc c\u1EE7a quy tr\xECnh: ti\u1EC1n x\u1EED l\xFD b\u1EB1ng tokenizers, \u0111\u01B0a \u0111\u1EA7u v\xE0o qua m\xF4 h\xECnh v\xE0 h\u1EADu x\u1EED l\xFD! Gi\u1EDD th\xEC ch\xFAng ta h\xE3y d\xE0nh m\u1ED9t ch\xFAt th\u1EDDi gian \u0111\u1EC3 \u0111i s\xE2u h\u01A1n v\xE0o t\u1EEBng b\u01B0\u1EDBc \u0111\xF3."),$l=m(),w(Ln.$$.fragment),this.h()},l(n){const r=ji('[data-svelte="svelte-1phssyn"]',document.head);s=i(r,"META",{name:!0,content:!0}),r.forEach(t),p=f(n),x(l.$$.fragment,n),g=f(n),_=i(n,"H1",{class:!0});var wt=o(_);d=i(wt,"A",{id:!0,class:!0,href:!0});var he=o(d);q=i(he,"SPAN",{});var js=o(q);x(M.$$.fragment,js),js.forEach(t),he.forEach(t),P=f(wt),E=i(wt,"SPAN",{});var ie=o(E);I=a(ie,"\u0110\u1EB1ng sau pipeline"),ie.forEach(t),wt.forEach(t),b=f(n),N.l(n),F=f(n),x(Tn.$$.fragment,n),ws=f(n),U.l(n),xt=f(n),Cn=i(n,"P",{});var Hn=o(Cn);Nl=a(Hn,"H\xE3y b\u1EAFt \u0111\u1EA7u v\u1EDBi m\u1ED9t v\xED d\u1EE5 ho\xE0n ch\u1EC9nh, c\xF9ng xem nh\u1EEFng g\xEC x\u1EA3y ra ph\xEDa sau khi ch\xFAng t\xF4i th\u1EF1c thi \u0111o\u1EA1n m\xE3 sau trong "),Tt=i(Hn,"A",{href:!0});var oe=o(Tt);Sl=a(oe,"Ch\u01B0\u01A1ng 1"),oe.forEach(t),Fl=a(Hn,":"),Hn.forEach(t),xs=f(n),x(Yn.$$.fragment,n),Ts=f(n),Ct=i(n,"P",{});var ue=o(Ct);Dl=a(ue,"v\xE0 thu \u0111\u01B0\u1EE3c:"),ue.forEach(t),Cs=f(n),x(Jn.$$.fragment,n),qs=f(n),qn=i(n,"P",{});var Vn=o(qn);Ol=a(Vn,"Nh\u01B0 ch\xFAng ta \u0111\xE3 th\u1EA5y trong "),qt=i(Vn,"A",{href:!0});var pe=o(qt);zl=a(pe,"Ch\u01B0\u01A1ng 1"),pe.forEach(t),Ll=a(Vn,", pipeline n\xE0y nh\xF3m ba b\u01B0\u1EDBc l\u1EA1i v\u1EDBi nhau: ti\u1EC1n x\u1EED l\xFD, \u0111\u01B0a c\xE1c \u0111\u1EA7u v\xE0o qua m\xF4 h\xECnh v\xE0 h\u1EADu x\u1EED l\xFD:"),Vn.forEach(t),Ps=f(n),kn=i(n,"DIV",{class:!0});var Gn=o(kn);Wn=i(Gn,"IMG",{class:!0,src:!0,alt:!0}),Hl=f(Gn),Xn=i(Gn,"IMG",{class:!0,src:!0,alt:!0}),Gn.forEach(t),Ms=f(n),Pt=i(n,"P",{});var me=o(Pt);Vl=a(me,"H\xE3y c\xF9ng \u0111i qua t\u1EEBng ph\u1EA7n n\xE0y."),me.forEach(t),As=f(n),$n=i(n,"H2",{class:!0});var Bn=o($n);Pn=i(Bn,"A",{id:!0,class:!0,href:!0});var fe=o(Pn);ve=i(fe,"SPAN",{});var Es=o(ve);x(Zn.$$.fragment,Es),Es.forEach(t),fe.forEach(t),Gl=f(Bn),ke=i(Bn,"SPAN",{});var Br=o(ke);Bl=a(Br,"Ti\u1EC1n x\u1EED l\xFD v\u1EDBi m\u1ED9t tokenizer"),Br.forEach(t),Bn.forEach(t),Is=f(n),Mn=i(n,"P",{});var jl=o(Mn);Kl=a(jl,"Gi\u1ED1ng nh\u01B0 c\xE1c m\u1EA1ng n\u01A1-ron kh\xE1c, c\xE1c m\xF4 h\xECnh Transformers kh\xF4ng th\u1EC3 x\u1EED l\xFD tr\u1EF1c ti\u1EBFp v\u0103n b\u1EA3n th\xF4, v\xEC v\u1EADy b\u01B0\u1EDBc \u0111\u1EA7u ti\xEAn trong quy tr\xECnh c\u1EE7a ch\xFAng ta l\xE0 chuy\u1EC3n c\xE1c \u0111\u1EA7u v\xE0o v\u0103n b\u1EA3n th\xE0nh d\u1EA1ng s\u1ED1 m\xE0 m\xF4 h\xECnh c\xF3 th\u1EC3 hi\u1EC3u \u0111\u01B0\u1EE3c. \u0110\u1EC3 l\xE0m \u0111i\u1EC1u n\xE0y, ch\xFAng ta s\u1EED d\u1EE5ng "),$e=i(jl,"EM",{});var Kr=o($e);Ul=a(Kr,"tokenizer"),Kr.forEach(t),Rl=a(jl,", h\xE0m s\u1EBD ch\u1ECBu tr\xE1ch nhi\u1EC7m v\u1EC1:"),jl.forEach(t),Ns=f(n),fn=i(n,"UL",{});var ge=o(fn);Mt=i(ge,"LI",{});var mr=o(Mt);Ql=a(mr,"T\xE1ch \u0111\u1EA7u v\xE0o th\xE0nh c\xE1c t\u1EEB, t\u1EEB ph\u1EE5, ho\u1EB7c k\xFD hi\u1EC7u (nh\u01B0 d\u1EA5u ch\u1EA5m c\xE2u) \u0111\u01B0\u1EE3c g\u1ECDi l\xE0 "),ye=i(mr,"EM",{});var Ur=o(ye);Yl=a(Ur,"tokens"),Ur.forEach(t),mr.forEach(t),Jl=f(ge),je=i(ge,"LI",{});var Rr=o(je);Wl=a(Rr,"\xC1nh x\u1EA1 m\u1ED7i token th\xE0nh m\u1ED9t s\u1ED1 nguy\xEAn"),Rr.forEach(t),Xl=f(ge),Ee=i(ge,"LI",{});var Qr=o(Ee);Zl=a(Qr,"Th\xEAm \u0111\u1EA7u v\xE0o b\u1ED5 sung c\xF3 th\u1EC3 h\u1EEFu \xEDch cho m\xF4 h\xECnh"),Qr.forEach(t),ge.forEach(t),Ss=f(n),H=i(n,"P",{});var Kn=o(H);nc=a(Kn,"T\u1EA5t c\u1EA3 qu\xE1 tr\xECnh ti\u1EC1n x\u1EED l\xFD n\xE0y c\u1EA7n \u0111\u01B0\u1EE3c th\u1EF1c hi\u1EC7n gi\u1ED1ng h\u1EC7t nh\u01B0 khi m\xF4 h\xECnh \u0111\u01B0\u1EE3c hu\u1EA5n luy\u1EC7n tr\u01B0\u1EDBc, v\xEC v\u1EADy tr\u01B0\u1EDBc ti\xEAn ch\xFAng ta c\u1EA7n t\u1EA3i xu\u1ED1ng th\xF4ng tin \u0111\xF3 t\u1EEB "),nt=i(Kn,"A",{href:!0,rel:!0});var Yr=o(nt);tc=a(Yr,"Model Hub"),Yr.forEach(t),ec=a(Kn,". \u0110\u1EC3 l\xE0m \u0111i\u1EC1u n\xE0y, ch\xFAng t\xF4i s\u1EED d\u1EE5ng l\u1EDBp "),we=i(Kn,"CODE",{});var Jr=o(we);sc=a(Jr,"AutoTokenizer"),Jr.forEach(t),lc=a(Kn," v\xE0 ph\u01B0\u01A1ng th\u1EE9c "),xe=i(Kn,"CODE",{});var Wr=o(xe);cc=a(Wr,"from_pretrained()"),Wr.forEach(t),ac=a(Kn," c\u1EE7a n\xF3. S\u1EED d\u1EE5ng t\xEAn checkpoint m\xF4 h\xECnh c\u1EE7a ch\xFAng ta, n\xF3 s\u1EBD t\u1EF1 \u0111\u1ED9ng t\xECm n\u1EA1p d\u1EEF li\u1EC7u \u0111\u01B0\u1EE3c li\xEAn k\u1EBFt v\u1EDBi tokenizer c\u1EE7a m\xF4 h\xECnh v\xE0 l\u01B0u v\xE0o b\u1ED9 nh\u1EDB cache (v\xEC v\u1EADy n\xF3 ch\u1EC9 \u0111\u01B0\u1EE3c t\u1EA3i xu\u1ED1ng l\u1EA7n \u0111\u1EA7u ti\xEAn b\u1EA1n ch\u1EA1y m\xE3 b\xEAn d\u01B0\u1EDBi)."),Kn.forEach(t),Fs=f(n),V=i(n,"P",{});var Un=o(V);rc=a(Un,"V\xEC checkpoint m\u1EB7c \u0111\u1ECBnh c\u1EE7a "),Te=i(Un,"CODE",{});var Xr=o(Te);hc=a(Xr,"sentiment-analysis"),Xr.forEach(t),ic=a(Un," l\xE0 "),Ce=i(Un,"CODE",{});var Zr=o(Ce);oc=a(Zr,"distilbert-base-unsased-finetuned-sst-2-english"),Zr.forEach(t),uc=a(Un," (b\u1EA1n c\xF3 th\u1EC3 xem th\u1EBB m\xF4 h\xECnh c\u1EE7a n\xF3 "),tt=i(Un,"A",{href:!0,rel:!0});var nh=o(tt);pc=a(nh,"t\u1EA1i \u0111\xE2y"),nh.forEach(t),mc=a(Un,"), ch\xFAng ta ch\u1EA1y nh\u01B0 sau:"),Un.forEach(t),Ds=f(n),x(et.$$.fragment,n),Os=f(n),At=i(n,"P",{});var th=o(At);fc=a(th,"Khi c\xF3 tokenizer r\u1ED3i, ch\xFAng ta c\xF3 th\u1EC3 truy\u1EC1n tr\u1EF1c ti\u1EBFp c\xE1c c\xE2u c\u1EE7a m\xECnh v\xE0o b\xEAn trong v\xE0 nh\u1EADn l\u1EA1i m\u1ED9t t\u1EEB \u0111i\u1EC3n \u0111\xE3 s\u1EB5n s\xE0ng \u0111\u1EC3 cung c\u1EA5p cho m\xF4 h\xECnh! Vi\u1EC7c duy nh\u1EA5t c\u1EA7n l\xE0m l\xE0 chuy\u1EC3n \u0111\u1ED5i danh s\xE1ch c\xE1c ID \u0111\u1EA7u v\xE0o th\xE0nh c\xE1c tensor."),th.forEach(t),zs=f(n),An=i(n,"P",{});var El=o(An);gc=a(El,"B\u1EA1n c\xF3 th\u1EC3 s\u1EED d\u1EE5ng \u{1F917} Transformers m\xE0 kh\xF4ng ph\u1EA3i lo l\u1EAFng v\u1EC1 khung ML n\xE0o \u0111\u01B0\u1EE3c s\u1EED d\u1EE5ng ph\xEDa d\u01B0\u1EDBi; n\xF3 c\xF3 th\u1EC3 l\xE0 PyTorch ho\u1EB7c TensorFlow ho\u1EB7c Flax \u0111\u1ED1i v\u1EDBi m\u1ED9t s\u1ED1 m\xF4 h\xECnh. Tuy nhi\xEAn, c\xE1c m\xF4 h\xECnh Transformer ch\u1EC9 ch\u1EA5p nh\u1EADn "),qe=i(El,"EM",{});var eh=o(qe);dc=a(eh,"tensor"),eh.forEach(t),_c=a(El," l\xE0m \u0111\u1EA7u v\xE0o. N\u1EBFu \u0111\xE2y l\xE0 l\u1EA7n \u0111\u1EA7u ti\xEAn b\u1EA1n nghe v\u1EC1 tensor, b\u1EA1n c\xF3 th\u1EC3 ngh\u0129 ch\xFAng nh\u01B0 l\xE0 m\u1EA3ng NumPy. M\u1EA3ng NumPy c\xF3 th\u1EC3 l\xE0 gi\xE1 tr\u1ECB v\xF4 h\u01B0\u1EDBng (0D), vect\u01A1 (1D), ma tr\u1EADn (2D) ho\u1EB7c c\xF3 nhi\u1EC1u k\xEDch th\u01B0\u1EDBc h\u01A1n. N\xF3 th\u1EF1c s\u1EF1 l\xE0 m\u1ED9t tensor; C\xE1c tensor c\u1EE7a c\xE1c khung ML kh\xE1c ho\u1EA1t \u0111\u1ED9ng t\u01B0\u01A1ng t\u1EF1 v\xE0 th\u01B0\u1EDDng kh\u1EDFi t\u1EA1o \u0111\u01A1n gi\u1EA3n nh\u01B0 c\xE1c m\u1EA3ng NumPy."),El.forEach(t),Ls=f(n),In=i(n,"P",{});var wl=o(In);bc=a(wl,"\u0110\u1EC3 ch\u1EC9 \u0111\u1ECBnh lo\u1EA1i tensors m\xE0 ch\xFAng ta mu\u1ED1n tr\u1EA3 v\u1EC1 (PyTorch, TensorFlow ho\u1EB7c thu\u1EA7n NumPy), ta s\u1EED d\u1EE5ng tham s\u1ED1 "),Pe=i(wl,"CODE",{});var sh=o(Pe);vc=a(sh,"return_tensors"),sh.forEach(t),kc=a(wl,":"),wl.forEach(t),Hs=f(n),Q.l(n),It=f(n),Nt=i(n,"P",{});var lh=o(Nt);$c=a(lh,"\u0110\u1EEBng lo l\u1EAFng v\u1EC1 padding (\u0111\u1EC7m) v\xE0 truncation (c\u1EAFt b\u1EDBt) v\u1ED9i; ch\xFAng t\xF4i s\u1EBD gi\u1EA3i th\xEDch nh\u1EEFng \u0111i\u1EC1u \u0111\xF3 sau. Nh\u1EEFng \u0111i\u1EC1u ch\xEDnh c\u1EA7n nh\u1EDB \u1EDF \u0111\xE2y l\xE0 b\u1EA1n c\xF3 th\u1EC3 chuy\u1EC3n m\u1ED9t c\xE2u ho\u1EB7c m\u1ED9t danh s\xE1ch c\xE1c c\xE2u, c\u0169ng nh\u01B0 ch\u1EC9 \u0111\u1ECBnh lo\u1EA1i tensors b\u1EA1n mu\u1ED1n l\u1EA5y l\u1EA1i (n\u1EBFu kh\xF4ng c\xF3 lo\u1EA1i n\xE0o \u0111\u01B0\u1EE3c truy\u1EC1n v\xE0o, m\u1EB7c \u0111\u1ECBnh b\u1EA1n s\u1EBD nh\u1EADn \u0111\u01B0\u1EE3c k\u1EBFt qu\u1EA3 tr\u1EA3 v\u1EC1 l\xE0 m\u1ED9t danh s\xE1ch)."),lh.forEach(t),Vs=f(n),J.l(n),St=f(n),O=i(n,"P",{});var _n=o(O);yc=a(_n,"B\u1EA3n th\xE2n k\u1EBFt qu\u1EA3 \u0111\u1EA7u ra l\xE0 m\u1ED9t t\u1EEB \u0111i\u1EC3n c\xF3 ch\u1EE9a hai kh\xF3a, "),Me=i(_n,"CODE",{});var ch=o(Me);jc=a(ch,"input_ids"),ch.forEach(t),Ec=a(_n," v\xE0 "),Ae=i(_n,"CODE",{});var ah=o(Ae);wc=a(ah,"attention_mask"),ah.forEach(t),xc=a(_n,". "),Ie=i(_n,"CODE",{});var rh=o(Ie);Tc=a(rh,"input_ids"),rh.forEach(t),Cc=a(_n," ch\u1EE9a hai h\xE0ng s\u1ED1 nguy\xEAn (m\u1ED9t cho m\u1ED7i c\xE2u) l\xE0 s\u1ED1 nh\u1EADn d\u1EA1ng duy nh\u1EA5t c\u1EE7a token trong m\u1ED7i c\xE2u. Ch\xFAng t\xF4i s\u1EBD gi\u1EA3i th\xEDch "),Ne=i(_n,"CODE",{});var hh=o(Ne);qc=a(hh,"attention_mask"),hh.forEach(t),Pc=a(_n," l\xE0 g\xEC \u1EDF ph\u1EA7n sau c\u1EE7a ch\u01B0\u01A1ng n\xE0y."),_n.forEach(t),Gs=f(n),yn=i(n,"H2",{class:!0});var xl=o(yn);Nn=i(xl,"A",{id:!0,class:!0,href:!0});var ih=o(Nn);Se=i(ih,"SPAN",{});var oh=o(Se);x(st.$$.fragment,oh),oh.forEach(t),ih.forEach(t),Mc=f(xl),Fe=i(xl,"SPAN",{});var uh=o(Fe);Ac=a(uh,"\u0110i qua m\xF4 h\xECnh"),uh.forEach(t),xl.forEach(t),Bs=f(n),X.l(n),Ft=f(n),Dt=i(n,"P",{});var ph=o(Dt);Ic=a(ph,"Trong \u0111o\u1EA1n m\xE3 n\xE0y, ch\xFAng ta \u0111\xE3 t\u1EA3i xu\u1ED1ng c\xF9ng m\u1ED9t checkpoint \u0111\xE3 s\u1EED d\u1EE5ng trong pipeline c\u1EE7a m\xECnh tr\u01B0\u1EDBc \u0111\xE2y (n\xF3 \u0111\u01B0\u1EE3c l\u01B0u v\xE0o b\u1ED9 nh\u1EDB \u0111\u1EC7m r\u1ED3i) v\xE0 kh\u1EDFi t\u1EA1o m\u1ED9t m\xF4 h\xECnh v\u1EDBi n\xF3."),ph.forEach(t),Ks=f(n),z=i(n,"P",{});var bn=o(z);Nc=a(bn,"Ki\u1EBFn tr\xFAc n\xE0y ch\u1EC9 ch\u1EE9a m\xF4-\u0111un Transformer c\u01A1 s\u1EDF: v\u1EDBi m\u1ED9t s\u1ED1 \u0111\u1EA7u v\xE0o, n\xF3 xu\u1EA5t ra c\xE1i m\xE0 ch\xFAng ta s\u1EBD g\u1ECDi l\xE0 "),De=i(bn,"EM",{});var mh=o(De);Sc=a(mh,"hidden states"),mh.forEach(t),Fc=a(bn," ("),Oe=i(bn,"EM",{});var fh=o(Oe);Dc=a(fh,"tr\u1EA1ng th\xE1i \u1EA9n"),fh.forEach(t),Oc=a(bn,"), c\xF2n \u0111\u01B0\u1EE3c g\u1ECDi l\xE0 "),ze=i(bn,"EM",{});var gh=o(ze);zc=a(gh,"\u0111\u1EB7c tr\u01B0ng"),gh.forEach(t),Lc=a(bn,". \u0110\u1ED1i v\u1EDBi m\u1ED7i \u0111\u1EA7u v\xE0o m\xF4 h\xECnh, ch\xFAng ta s\u1EBD truy xu\u1EA5t m\u1ED9t vect\u01A1 \u0111a chi\u1EC1u \u0111\u1EA1i di\u1EC7n cho "),Le=i(bn,"STRONG",{});var dh=o(Le);Hc=a(dh,"s\u1EF1 hi\u1EC3u theo ng\u1EEF c\u1EA3nh c\u1EE7a \u0111\u1EA7u v\xE0o \u0111\xF3 b\u1EB1ng m\xF4 h\xECnh Transformer"),dh.forEach(t),Vc=a(bn,"."),bn.forEach(t),Us=f(n),Ot=i(n,"P",{});var _h=o(Ot);Gc=a(_h,"N\u1EBFu \u0111i\u1EC1u n\xE0y kh\xF4ng h\u1EE3p l\xFD, \u0111\u1EEBng lo l\u1EAFng v\u1EC1 n\xF3. Ch\xFAng t\xF4i s\u1EBD gi\u1EA3i th\xEDch t\u1EA5t c\u1EA3 sau."),_h.forEach(t),Rs=f(n),G=i(n,"P",{});var Rn=o(G);Bc=a(Rn,"M\u1EB7c d\xF9 nh\u1EEFng tr\u1EA1ng th\xE1i \u1EA9n n\xE0y c\xF3 th\u1EC3 t\u1EF1 h\u1EEFu \xEDch, nh\u01B0ng ch\xFAng th\u01B0\u1EDDng l\xE0 \u0111\u1EA7u v\xE0o cho m\u1ED9t ph\u1EA7n kh\xE1c c\u1EE7a m\xF4 h\xECnh, \u0111\u01B0\u1EE3c g\u1ECDi l\xE0 "),He=i(Rn,"EM",{});var bh=o(He);Kc=a(bh,"head"),bh.forEach(t),Uc=a(Rn," ("),Ve=i(Rn,"EM",{});var vh=o(Ve);Rc=a(vh,"\u0111\u1EA7u"),vh.forEach(t),Qc=a(Rn,"). Trong "),zt=i(Rn,"A",{href:!0});var kh=o(zt);Yc=a(kh,"Chapter 1"),kh.forEach(t),Jc=a(Rn,", c\xE1c t\xE1c v\u1EE5 kh\xE1c nhau c\xF3 th\u1EC3 \u0111\u01B0\u1EE3c th\u1EF1c hi\u1EC7n v\u1EDBi c\xF9ng m\u1ED9t ki\u1EBFn tr\xFAc, nh\u01B0ng m\u1ED7i t\xE1c v\u1EE5 n\xE0y s\u1EBD c\xF3 m\u1ED9t ph\u1EA7n \u0111\u1EA7u kh\xE1c nhau \u0111\u01B0\u1EE3c li\xEAn k\u1EBFt v\u1EDBi n\xF3."),Rn.forEach(t),Qs=f(n),jn=i(n,"H3",{class:!0});var Tl=o(jn);Sn=i(Tl,"A",{id:!0,class:!0,href:!0});var $h=o(Sn);Ge=i($h,"SPAN",{});var yh=o(Ge);x(lt.$$.fragment,yh),yh.forEach(t),$h.forEach(t),Wc=f(Tl),Be=i(Tl,"SPAN",{});var jh=o(Be);Xc=a(jh,"M\u1ED9t vect\u01A1 \u0111a chi\u1EC1u"),jh.forEach(t),Tl.forEach(t),Ys=f(n),Lt=i(n,"P",{});var Eh=o(Lt);Zc=a(Eh,"\u0110\u1EA7u ra vect\u01A1 c\u1EE7a m\xF4-\u0111un Transformer th\u01B0\u1EDDng l\u1EDBn v\u1EDBi ba chi\u1EC1u:"),Eh.forEach(t),Js=f(n),gn=i(n,"UL",{});var de=o(gn);Ht=i(de,"LI",{});var fr=o(Ht);Ke=i(fr,"STRONG",{});var wh=o(Ke);na=a(wh,"K\xEDch th\u01B0\u1EDBc batch (l\xF4)"),wh.forEach(t),ta=a(fr,": S\u1ED1 chu\u1ED7i \u0111\u01B0\u1EE3c x\u1EED l\xFD t\u1EA1i m\u1ED9t th\u1EDDi \u0111i\u1EC3m (trong v\xED d\u1EE5 c\u1EE7a ch\xFAng t\xF4i l\xE0 2)."),fr.forEach(t),ea=f(de),Vt=i(de,"LI",{});var gr=o(Vt);Ue=i(gr,"STRONG",{});var xh=o(Ue);sa=a(xh,"\u0110\u1ED9 d\xE0i chu\u1ED7i"),xh.forEach(t),la=a(gr,": \u0110\u1ED9 d\xE0i bi\u1EC3u di\u1EC5n s\u1ED1 c\u1EE7a chu\u1ED7i (trong v\xED d\u1EE5 c\u1EE7a ch\xFAng t\xF4i l\xE0 16)."),gr.forEach(t),ca=f(de),Gt=i(de,"LI",{});var dr=o(Gt);Re=i(dr,"STRONG",{});var Th=o(Re);aa=a(Th,"K\xEDch th\u01B0\u1EDBc \u1EA9n"),Th.forEach(t),ra=a(dr,": K\xEDch th\u01B0\u1EDBc vect\u01A1 c\u1EE7a m\u1ED7i \u0111\u1EA7u v\xE0o m\xF4 h\xECnh."),dr.forEach(t),de.forEach(t),Ws=f(n),Bt=i(n,"P",{});var Ch=o(Bt);ha=a(Ch,"N\xF3 \u0111\u01B0\u1EE3c cho l\xE0 \u201Cc\xF3 s\u1ED1 chi\u1EC1u cao\u201D v\xEC gi\xE1 tr\u1ECB cu\u1ED1i c\xF9ng. K\xEDch th\u01B0\u1EDBc \u1EA9n c\xF3 th\u1EC3 r\u1EA5t l\u1EDBn (768 l\xE0 gi\xE1 tr\u1ECB ph\u1ED5 bi\u1EBFn cho c\xE1c m\xF4 h\xECnh nh\u1ECF h\u01A1n v\xE0 trong c\xE1c m\xF4 h\xECnh l\u1EDBn h\u01A1n, con s\u1ED1 n\xE0y c\xF3 th\u1EC3 \u0111\u1EA1t t\u1EDBi 3072 ho\u1EB7c h\u01A1n)."),Ch.forEach(t),Xs=f(n),Kt=i(n,"P",{});var qh=o(Kt);ia=a(qh,"C\xF3 th\u1EC3 th\u1EA5y \u0111i\u1EC1u n\xE0y n\u1EBFu ch\xFAng ta cung c\u1EA5p c\xE1c \u0111\u1EA7u v\xE0o \u0111\xE3 x\u1EED l\xFD tr\u01B0\u1EDBc cho m\xF4 h\xECnh c\u1EE7a m\xECnh:"),qh.forEach(t),Zs=f(n),nn.l(n),Ut=f(n),B=i(n,"P",{});var Qn=o(B);oa=a(Qn,"L\u01B0u \xFD r\u1EB1ng \u0111\u1EA7u ra c\u1EE7a c\xE1c m\xF4 h\xECnh \u{1F917} Transformers ho\u1EA1t \u0111\u1ED9ng gi\u1ED1ng nh\u01B0 c\xE1c "),Qe=i(Qn,"CODE",{});var Ph=o(Qe);ua=a(Ph,"namedtuple"),Ph.forEach(t),pa=a(Qn," ho\u1EB7c t\u1EEB \u0111i\u1EC3n. B\u1EA1n c\xF3 th\u1EC3 truy c\u1EADp c\xE1c ph\u1EA7n t\u1EED theo thu\u1ED9c t\xEDnh (nh\u01B0 ch\xFAng ta \u0111\xE3 l\xE0m) ho\u1EB7c theo kh\xF3a ("),Ye=i(Qn,"CODE",{});var Mh=o(Ye);ma=a(Mh,'outputs["last_hidden_state"]'),Mh.forEach(t),fa=a(Qn,"), ho\u1EB7c th\u1EADm ch\xED theo ch\u1EC9 m\u1EE5c n\u1EBFu b\u1EA1n bi\u1EBFt ch\xEDnh x\xE1c n\u01A1i b\u1EA1n \u0111ang t\xECm ki\u1EBFm ("),Je=i(Qn,"CODE",{});var Ah=o(Je);ga=a(Ah,"outputs[0]"),Ah.forEach(t),da=a(Qn,")."),Qn.forEach(t),nl=f(n),En=i(n,"H3",{class:!0});var Cl=o(En);Fn=i(Cl,"A",{id:!0,class:!0,href:!0});var Ih=o(Fn);We=i(Ih,"SPAN",{});var Nh=o(We);x(ct.$$.fragment,Nh),Nh.forEach(t),Ih.forEach(t),_a=f(Cl),Xe=i(Cl,"SPAN",{});var Sh=o(Xe);ba=a(Sh,"\u0110\u1EA7u m\xF4 h\xECnh: H\u1EE3p l\xFD t\u1EDDi t\u1EEBng con s\u1ED1"),Sh.forEach(t),Cl.forEach(t),tl=f(n),Rt=i(n,"P",{});var Fh=o(Rt);va=a(Fh,"C\xE1c \u0111\u1EA7u m\xF4 h\xECnh l\u1EA5y vector \u0111a chi\u1EC1u c\u1EE7a c\xE1c tr\u1EA1ng th\xE1i \u1EA9n l\xE0m \u0111\u1EA7u v\xE0o v\xE0 chi\u1EBFu ch\xFAng l\xEAn m\u1ED9t chi\u1EC1u kh\xE1c. Ch\xFAng th\u01B0\u1EDDng bao g\u1ED3m m\u1ED9t ho\u1EB7c m\u1ED9t v\xE0i l\u1EDBp tuy\u1EBFn t\xEDnh:"),Fh.forEach(t),el=f(n),wn=i(n,"DIV",{class:!0});var ql=o(wn);at=i(ql,"IMG",{class:!0,src:!0,alt:!0}),ka=f(ql),rt=i(ql,"IMG",{class:!0,src:!0,alt:!0}),ql.forEach(t),sl=f(n),Qt=i(n,"P",{});var Dh=o(Qt);$a=a(Dh,"\u0110\u1EA7u ra c\u1EE7a m\xF4 h\xECnh Transformer \u0111\u01B0\u1EE3c g\u1EEDi tr\u1EF1c ti\u1EBFp \u0111\u1EBFn \u0111\u1EA7u m\xF4 h\xECnh \u0111\u1EC3 \u0111\u01B0\u1EE3c x\u1EED l\xFD."),Dh.forEach(t),ll=f(n),Yt=i(n,"P",{});var Oh=o(Yt);ya=a(Oh,"Trong bi\u1EC3u \u0111\u1ED3 n\xE0y, m\xF4 h\xECnh \u0111\u01B0\u1EE3c bi\u1EC3u di\u1EC5n b\u1EB1ng l\u1EDBp nh\xFAng c\u1EE7a n\xF3 v\xE0 c\xE1c l\u1EDBp ti\u1EBFp theo. L\u1EDBp nh\xFAng chuy\u1EC3n \u0111\u1ED5i m\u1ED7i ID trong \u0111\u1EA7u v\xE0o \u0111\u01B0\u1EE3c m\xE3 h\xF3a th\xE0nh m\u1ED9t vect\u01A1 \u0111\u1EA1i di\u1EC7n cho token \u0111\u01B0\u1EE3c li\xEAn k\u1EBFt. C\xE1c l\u1EDBp ti\u1EBFp theo thao t\xE1c c\xE1c vect\u01A1 \u0111\xF3 b\u1EB1ng c\xE1ch s\u1EED d\u1EE5ng c\u01A1 ch\u1EBF ch\xFA \xFD \u0111\u1EC3 t\u1EA1o ra bi\u1EC3u di\u1EC5n cu\u1ED1i c\xF9ng c\u1EE7a c\xE1c c\xE2u."),Oh.forEach(t),cl=f(n),Jt=i(n,"P",{});var zh=o(Jt);ja=a(zh,"C\xF3 nhi\u1EC1u ki\u1EBFn tr\xFAc kh\xE1c nhau c\xF3 s\u1EB5n trong \u{1F917} Transformers, v\u1EDBi m\u1ED7i ki\u1EBFn tr\xFAc \u0111\u01B0\u1EE3c thi\u1EBFt k\u1EBF xoay quanh m\u1ED9t t\xE1c v\u1EE5 c\u1EE5 th\u1EC3. \u0110\xE2y l\xE0 danh s\xE1ch kh\xF4ng \u0111\u1EA7y \u0111\u1EE7:"),zh.forEach(t),al=f(n),S=i(n,"UL",{});var D=o(S);Wt=i(D,"LI",{});var _r=o(Wt);Ze=i(_r,"CODE",{});var Lh=o(Ze);Ea=a(Lh,"*Model"),Lh.forEach(t),wa=a(_r," (truy xu\u1EA5t c\xE1c tr\u1EA1ng th\xE1i \u1EA9n)"),_r.forEach(t),xa=f(D),ns=i(D,"LI",{});var Hh=o(ns);ts=i(Hh,"CODE",{});var Vh=o(ts);Ta=a(Vh,"*ForCausalLM"),Vh.forEach(t),Hh.forEach(t),Ca=f(D),es=i(D,"LI",{});var Gh=o(es);ss=i(Gh,"CODE",{});var Bh=o(ss);qa=a(Bh,"*ForMaskedLM"),Bh.forEach(t),Gh.forEach(t),Pa=f(D),ls=i(D,"LI",{});var Kh=o(ls);cs=i(Kh,"CODE",{});var Uh=o(cs);Ma=a(Uh,"*ForMultipleChoice"),Uh.forEach(t),Kh.forEach(t),Aa=f(D),as=i(D,"LI",{});var Rh=o(as);rs=i(Rh,"CODE",{});var Qh=o(rs);Ia=a(Qh,"*ForQuestionAnswering"),Qh.forEach(t),Rh.forEach(t),Na=f(D),hs=i(D,"LI",{});var Yh=o(hs);is=i(Yh,"CODE",{});var Jh=o(is);Sa=a(Jh,"*ForSequenceClassification"),Jh.forEach(t),Yh.forEach(t),Fa=f(D),os=i(D,"LI",{});var Wh=o(os);us=i(Wh,"CODE",{});var Xh=o(us);Da=a(Xh,"*ForTokenClassification"),Xh.forEach(t),Wh.forEach(t),Oa=f(D),ps=i(D,"LI",{});var Zh=o(ps);za=a(Zh,"and others \u{1F917}"),Zh.forEach(t),D.forEach(t),rl=f(n),en.l(n),Xt=f(n),Zt=i(n,"P",{});var ni=o(Zt);La=a(ni,"Gi\u1EDD th\xEC n\u1EBFu ch\xFAng ta nh\xECn v\xE0o h\xECnh d\u1EA1ng c\xE1c \u0111\u1EA7u v\xE0o c\u1EE7a m\xECnh, k\xEDch th\u01B0\u1EDBc s\u1EBD th\u1EA5p h\u01A1n nhi\u1EC1u: \u0111\u1EA7u m\xF4 h\xECnh l\u1EA5y c\xE1c vect\u01A1 \u0111a chi\u1EC1u m\xE0 ch\xFAng ta \u0111\xE3 th\u1EA5y tr\u01B0\u1EDBc \u0111\xE2y v\xE0 xu\u1EA5t ra c\xE1c vect\u01A1 c\xF3 ch\u1EE9a hai gi\xE1 tr\u1ECB (m\u1ED7i gi\xE1 tr\u1ECB t\u01B0\u01A1ng \u1EE9ng m\u1ED9t nh\xE3n):"),ni.forEach(t),hl=f(n),x(ht.$$.fragment,n),il=f(n),ln.l(n),ne=f(n),te=i(n,"P",{});var ti=o(te);Ha=a(ti,"V\xEC ch\xFAng ta ch\u1EC9 c\xF3 hai c\xE2u v\xE0 hai nh\xE3n, k\u1EBFt qu\u1EA3 nh\u1EADn \u0111\u01B0\u1EE3c t\u1EEB m\xF4 h\xECnh c\u1EE7a ch\xFAng ta l\xE0 d\u1EA1ng 2 x 2."),ti.forEach(t),ol=f(n),xn=i(n,"H2",{class:!0});var Pl=o(xn);Dn=i(Pl,"A",{id:!0,class:!0,href:!0});var ei=o(Dn);ms=i(ei,"SPAN",{});var si=o(ms);x(it.$$.fragment,si),si.forEach(t),ei.forEach(t),Va=f(Pl),fs=i(Pl,"SPAN",{});var li=o(fs);Ga=a(li,"H\u1EADu x\u1EED l\xFD \u0111\u1EA7u ra"),li.forEach(t),Pl.forEach(t),ul=f(n),ee=i(n,"P",{});var ci=o(ee);Ba=a(ci,"C\xE1c gi\xE1 tr\u1ECB ch\xFAng ta nh\u1EADn \u0111\u01B0\u1EE3c d\u01B0\u1EDBi d\u1EA1ng \u0111\u1EA7u ra t\u1EEB m\xF4 h\xECnh kh\xF4ng nh\u1EA5t thi\u1EBFt ph\u1EA3i t\u1EF1 c\xF3 ngh\u0129a. H\xE3y c\xF9ng xem:"),ci.forEach(t),pl=f(n),x(ot.$$.fragment,n),ml=f(n),an.l(n),se=f(n),L=i(n,"P",{});var vn=o(L);Ka=a(vn,"M\xF4 h\xECnh \u0111\xE3 d\u1EF1 \u0111o\xE1n "),gs=i(vn,"CODE",{});var ai=o(gs);Ua=a(ai,"[-1.5607, 1.6123]"),ai.forEach(t),Ra=a(vn," cho c\xE2u \u0111\u1EA7u ti\xEAn v\xE0 "),ds=i(vn,"CODE",{});var ri=o(ds);Qa=a(ri,"[4.1692, -3.3464]"),ri.forEach(t),Ya=a(vn," cho c\xE2u th\u1EE9 hai. \u0110\xF3 kh\xF4ng ph\u1EA3i l\xE0 x\xE1c su\u1EA5t m\xE0 l\xE0 "),_s=i(vn,"EM",{});var hi=o(_s);Ja=a(hi,"logits"),hi.forEach(t),Wa=a(vn,", \u0111i\u1EC3m s\u1ED1 th\xF4, ch\u01B0a chu\u1EA9n h\xF3a \u0111\u01B0\u1EE3c xu\u1EA5t ra b\u1EDFi l\u1EDBp cu\u1ED1i c\xF9ng c\u1EE7a m\xF4 h\xECnh. \u0110\u1EC3 \u0111\u01B0\u1EE3c chuy\u1EC3n \u0111\u1ED5i th\xE0nh x\xE1c su\u1EA5t, ch\xFAng c\u1EA7n ph\u1EA3i tr\u1EA3i qua l\u1EDBp "),ut=i(vn,"A",{href:!0,rel:!0});var ii=o(ut);Xa=a(ii,"SoftMax"),ii.forEach(t),Za=a(vn," (t\u1EA5t c\u1EA3 c\xE1c m\xF4 h\xECnh \u{1F917} Transformers \u0111\u1EC1u xu\u1EA5t ra logits, v\xEC h\xE0m m\u1EA5t m\xE1t cho vi\u1EC7c hu\u1EA5n luy\u1EC7n th\u01B0\u1EDDng s\u1EBD k\u1EBFt h\u1EE3p h\xE0m k\xEDch ho\u1EA1t cu\u1ED1i c\xF9ng, ch\u1EB3ng h\u1EA1n nh\u01B0 SoftMax, v\u1EDBi h\xE0m m\u1EA5t m\xE1t th\u1EF1c t\u1EBF, ch\u1EB3ng h\u1EA1n nh\u01B0 entropy ch\xE9o):"),vn.forEach(t),fl=f(n),hn.l(n),le=f(n),un.l(n),ce=f(n),dn=i(n,"P",{});var _e=o(dn);nr=a(_e,"B\xE2y gi\u1EDD ch\xFAng ta c\xF3 th\u1EC3 th\u1EA5y r\u1EB1ng m\xF4 h\xECnh \u0111\xE3 d\u1EF1 \u0111o\xE1n "),bs=i(_e,"CODE",{});var oi=o(bs);tr=a(oi,"[0.0402, 0.9598]"),oi.forEach(t),er=a(_e," cho c\xE2u \u0111\u1EA7u ti\xEAn v\xE0 "),vs=i(_e,"CODE",{});var ui=o(vs);sr=a(ui,"[0.9995, 0.0005]"),ui.forEach(t),lr=a(_e," cho c\xE2u th\u1EE9 hai. \u0110\xE2y l\xE0 nh\u1EEFng \u0111i\u1EC3m x\xE1c su\u1EA5t d\u1EC5 nh\u1EADn bi\u1EBFt."),_e.forEach(t),gl=f(n),On=i(n,"P",{});var Ml=o(On);cr=a(Ml,"\u0110\u1EC3 l\u1EA5y c\xE1c nh\xE3n t\u01B0\u01A1ng \u1EE9ng v\u1EDBi t\u1EEBng v\u1ECB tr\xED, ch\xFAng ta c\xF3 th\u1EC3 ki\u1EC3m tra thu\u1ED9c t\xEDnh "),ks=i(Ml,"CODE",{});var pi=o(ks);ar=a(pi,"id2label"),pi.forEach(t),rr=a(Ml," c\u1EE7a c\u1EA5u h\xECnh m\xF4 h\xECnh (t\xECm hi\u1EC3u th\xEAm v\u1EC1 \u0111i\u1EC1u n\xE0y trong ph\u1EA7n ti\u1EBFp theo):"),Ml.forEach(t),dl=f(n),x(pt.$$.fragment,n),_l=f(n),x(mt.$$.fragment,n),bl=f(n),ae=i(n,"P",{});var mi=o(ae);hr=a(mi,"B\xE2y gi\u1EDD ch\xFAng ta c\xF3 th\u1EC3 k\u1EBFt lu\u1EADn r\u1EB1ng m\xF4 h\xECnh \u0111\xE3 d\u1EF1 \u0111o\xE1n nh\u01B0 sau:"),mi.forEach(t),vl=f(n),zn=i(n,"UL",{});var Al=o(zn);$s=i(Al,"LI",{});var fi=o($s);ir=a(fi,"C\xE2u \u0111\u1EA7u ti\xEAn: TI\xCAU C\u1EF0C: 0,0402, T\xCDCH C\u1EF0C: 0,9598"),fi.forEach(t),or=f(Al),ys=i(Al,"LI",{});var gi=o(ys);ur=a(gi,"C\xE2u th\u1EE9 hai: TI\xCAU C\u1EF0C: 0,9995, T\xCDCH C\u1EF0C: 0,0005"),gi.forEach(t),Al.forEach(t),kl=f(n),re=i(n,"P",{});var di=o(re);pr=a(di,"Ch\xFAng t\xF4i \u0111\xE3 t\xE1i t\u1EA1o th\xE0nh c\xF4ng ba b\u01B0\u1EDBc c\u1EE7a quy tr\xECnh: ti\u1EC1n x\u1EED l\xFD b\u1EB1ng tokenizers, \u0111\u01B0a \u0111\u1EA7u v\xE0o qua m\xF4 h\xECnh v\xE0 h\u1EADu x\u1EED l\xFD! Gi\u1EDD th\xEC ch\xFAng ta h\xE3y d\xE0nh m\u1ED9t ch\xFAt th\u1EDDi gian \u0111\u1EC3 \u0111i s\xE2u h\u01A1n v\xE0o t\u1EEBng b\u01B0\u1EDBc \u0111\xF3."),di.forEach(t),$l=f(n),x(Ln.$$.fragment,n),this.h()},h(){j(s,"name","hf:doc:metadata"),j(s,"content",JSON.stringify(Wi)),j(d,"id","ng-sau-pipeline"),j(d,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),j(d,"href","#ng-sau-pipeline"),j(_,"class","relative group"),j(Tt,"href","/course/chapter1"),j(qt,"href","/course/chapter1"),j(Wn,"class","block dark:hidden"),Il(Wn.src,br="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter2/full_nlp_pipeline.svg")||j(Wn,"src",br),j(Wn,"alt","The full NLP pipeline: tokenization of text, conversion to IDs, and inference through the Transformer model and the model head."),j(Xn,"class","hidden dark:block"),Il(Xn.src,vr="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter2/full_nlp_pipeline-dark.svg")||j(Xn,"src",vr),j(Xn,"alt","The full NLP pipeline: tokenization of text, conversion to IDs, and inference through the Transformer model and the model head."),j(kn,"class","flex justify-center"),j(Pn,"id","tin-x-l-vi-mt-tokenizer"),j(Pn,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),j(Pn,"href","#tin-x-l-vi-mt-tokenizer"),j($n,"class","relative group"),j(nt,"href","https://huggingface.co/models"),j(nt,"rel","nofollow"),j(tt,"href","https://huggingface.co/distilbert-base-uncased-finetuned-sst-2-english"),j(tt,"rel","nofollow"),j(Nn,"id","i-qua-m-hnh"),j(Nn,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),j(Nn,"href","#i-qua-m-hnh"),j(yn,"class","relative group"),j(zt,"href","/course/chapter1"),j(Sn,"id","mt-vect-a-chiu"),j(Sn,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),j(Sn,"href","#mt-vect-a-chiu"),j(jn,"class","relative group"),j(Fn,"id","u-m-hnh-hp-l-ti-tng-con-s"),j(Fn,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),j(Fn,"href","#u-m-hnh-hp-l-ti-tng-con-s"),j(En,"class","relative group"),j(at,"class","block dark:hidden"),Il(at.src,kr="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter2/transformer_and_head.svg")||j(at,"src",kr),j(at,"alt","A Transformer network alongside its head."),j(rt,"class","hidden dark:block"),Il(rt.src,$r="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter2/transformer_and_head-dark.svg")||j(rt,"src",$r),j(rt,"alt","A Transformer network alongside its head."),j(wn,"class","flex justify-center"),j(Dn,"id","hu-x-l-u-ra"),j(Dn,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),j(Dn,"href","#hu-x-l-u-ra"),j(xn,"class","relative group"),j(ut,"href","https://en.wikipedia.org/wiki/Softmax_function"),j(ut,"rel","nofollow")},m(n,r){e(document.head,s),u(n,p,r),T(l,n,r),u(n,g,r),u(n,_,r),e(_,d),e(d,q),T(M,q,null),e(_,P),e(_,E),e(E,I),u(n,b,r),ft[$].m(n,r),u(n,F,r),T(Tn,n,r),u(n,ws,r),gt[K].m(n,r),u(n,xt,r),u(n,Cn,r),e(Cn,Nl),e(Cn,Tt),e(Tt,Sl),e(Cn,Fl),u(n,xs,r),T(Yn,n,r),u(n,Ts,r),u(n,Ct,r),e(Ct,Dl),u(n,Cs,r),T(Jn,n,r),u(n,qs,r),u(n,qn,r),e(qn,Ol),e(qn,qt),e(qt,zl),e(qn,Ll),u(n,Ps,r),u(n,kn,r),e(kn,Wn),e(kn,Hl),e(kn,Xn),u(n,Ms,r),u(n,Pt,r),e(Pt,Vl),u(n,As,r),u(n,$n,r),e($n,Pn),e(Pn,ve),T(Zn,ve,null),e($n,Gl),e($n,ke),e(ke,Bl),u(n,Is,r),u(n,Mn,r),e(Mn,Kl),e(Mn,$e),e($e,Ul),e(Mn,Rl),u(n,Ns,r),u(n,fn,r),e(fn,Mt),e(Mt,Ql),e(Mt,ye),e(ye,Yl),e(fn,Jl),e(fn,je),e(je,Wl),e(fn,Xl),e(fn,Ee),e(Ee,Zl),u(n,Ss,r),u(n,H,r),e(H,nc),e(H,nt),e(nt,tc),e(H,ec),e(H,we),e(we,sc),e(H,lc),e(H,xe),e(xe,cc),e(H,ac),u(n,Fs,r),u(n,V,r),e(V,rc),e(V,Te),e(Te,hc),e(V,ic),e(V,Ce),e(Ce,oc),e(V,uc),e(V,tt),e(tt,pc),e(V,mc),u(n,Ds,r),T(et,n,r),u(n,Os,r),u(n,At,r),e(At,fc),u(n,zs,r),u(n,An,r),e(An,gc),e(An,qe),e(qe,dc),e(An,_c),u(n,Ls,r),u(n,In,r),e(In,bc),e(In,Pe),e(Pe,vc),e(In,kc),u(n,Hs,r),dt[R].m(n,r),u(n,It,r),u(n,Nt,r),e(Nt,$c),u(n,Vs,r),_t[Y].m(n,r),u(n,St,r),u(n,O,r),e(O,yc),e(O,Me),e(Me,jc),e(O,Ec),e(O,Ae),e(Ae,wc),e(O,xc),e(O,Ie),e(Ie,Tc),e(O,Cc),e(O,Ne),e(Ne,qc),e(O,Pc),u(n,Gs,r),u(n,yn,r),e(yn,Nn),e(Nn,Se),T(st,Se,null),e(yn,Mc),e(yn,Fe),e(Fe,Ac),u(n,Bs,r),bt[W].m(n,r),u(n,Ft,r),u(n,Dt,r),e(Dt,Ic),u(n,Ks,r),u(n,z,r),e(z,Nc),e(z,De),e(De,Sc),e(z,Fc),e(z,Oe),e(Oe,Dc),e(z,Oc),e(z,ze),e(ze,zc),e(z,Lc),e(z,Le),e(Le,Hc),e(z,Vc),u(n,Us,r),u(n,Ot,r),e(Ot,Gc),u(n,Rs,r),u(n,G,r),e(G,Bc),e(G,He),e(He,Kc),e(G,Uc),e(G,Ve),e(Ve,Rc),e(G,Qc),e(G,zt),e(zt,Yc),e(G,Jc),u(n,Qs,r),u(n,jn,r),e(jn,Sn),e(Sn,Ge),T(lt,Ge,null),e(jn,Wc),e(jn,Be),e(Be,Xc),u(n,Ys,r),u(n,Lt,r),e(Lt,Zc),u(n,Js,r),u(n,gn,r),e(gn,Ht),e(Ht,Ke),e(Ke,na),e(Ht,ta),e(gn,ea),e(gn,Vt),e(Vt,Ue),e(Ue,sa),e(Vt,la),e(gn,ca),e(gn,Gt),e(Gt,Re),e(Re,aa),e(Gt,ra),u(n,Ws,r),u(n,Bt,r),e(Bt,ha),u(n,Xs,r),u(n,Kt,r),e(Kt,ia),u(n,Zs,r),vt[Z].m(n,r),u(n,Ut,r),u(n,B,r),e(B,oa),e(B,Qe),e(Qe,ua),e(B,pa),e(B,Ye),e(Ye,ma),e(B,fa),e(B,Je),e(Je,ga),e(B,da),u(n,nl,r),u(n,En,r),e(En,Fn),e(Fn,We),T(ct,We,null),e(En,_a),e(En,Xe),e(Xe,ba),u(n,tl,r),u(n,Rt,r),e(Rt,va),u(n,el,r),u(n,wn,r),e(wn,at),e(wn,ka),e(wn,rt),u(n,sl,r),u(n,Qt,r),e(Qt,$a),u(n,ll,r),u(n,Yt,r),e(Yt,ya),u(n,cl,r),u(n,Jt,r),e(Jt,ja),u(n,al,r),u(n,S,r),e(S,Wt),e(Wt,Ze),e(Ze,Ea),e(Wt,wa),e(S,xa),e(S,ns),e(ns,ts),e(ts,Ta),e(S,Ca),e(S,es),e(es,ss),e(ss,qa),e(S,Pa),e(S,ls),e(ls,cs),e(cs,Ma),e(S,Aa),e(S,as),e(as,rs),e(rs,Ia),e(S,Na),e(S,hs),e(hs,is),e(is,Sa),e(S,Fa),e(S,os),e(os,us),e(us,Da),e(S,Oa),e(S,ps),e(ps,za),u(n,rl,r),kt[tn].m(n,r),u(n,Xt,r),u(n,Zt,r),e(Zt,La),u(n,hl,r),T(ht,n,r),u(n,il,r),$t[sn].m(n,r),u(n,ne,r),u(n,te,r),e(te,Ha),u(n,ol,r),u(n,xn,r),e(xn,Dn),e(Dn,ms),T(it,ms,null),e(xn,Va),e(xn,fs),e(fs,Ga),u(n,ul,r),u(n,ee,r),e(ee,Ba),u(n,pl,r),T(ot,n,r),u(n,ml,r),yt[cn].m(n,r),u(n,se,r),u(n,L,r),e(L,Ka),e(L,gs),e(gs,Ua),e(L,Ra),e(L,ds),e(ds,Qa),e(L,Ya),e(L,_s),e(_s,Ja),e(L,Wa),e(L,ut),e(ut,Xa),e(L,Za),u(n,fl,r),jt[rn].m(n,r),u(n,le,r),Et[on].m(n,r),u(n,ce,r),u(n,dn,r),e(dn,nr),e(dn,bs),e(bs,tr),e(dn,er),e(dn,vs),e(vs,sr),e(dn,lr),u(n,gl,r),u(n,On,r),e(On,cr),e(On,ks),e(ks,ar),e(On,rr),u(n,dl,r),T(pt,n,r),u(n,_l,r),T(mt,n,r),u(n,bl,r),u(n,ae,r),e(ae,hr),u(n,vl,r),u(n,zn,r),e(zn,$s),e($s,ir),e(zn,or),e(zn,ys),e(ys,ur),u(n,kl,r),u(n,re,r),e(re,pr),u(n,$l,r),T(Ln,n,r),yl=!0},p(n,[r]){const wt={};r&1&&(wt.fw=n[0]),l.$set(wt);let he=$;$=jr(n),$!==he&&(mn(),v(ft[he],1,1,()=>{ft[he]=null}),pn(),N=ft[$],N||(N=ft[$]=yr[$](n),N.c()),k(N,1),N.m(F.parentNode,F));const js={};r&2&&(js.$$scope={dirty:r,ctx:n}),Tn.$set(js);let ie=K;K=wr(n),K!==ie&&(mn(),v(gt[ie],1,1,()=>{gt[ie]=null}),pn(),U=gt[K],U||(U=gt[K]=Er[K](n),U.c()),k(U,1),U.m(xt.parentNode,xt));let Hn=R;R=Tr(n),R!==Hn&&(mn(),v(dt[Hn],1,1,()=>{dt[Hn]=null}),pn(),Q=dt[R],Q||(Q=dt[R]=xr[R](n),Q.c()),k(Q,1),Q.m(It.parentNode,It));let oe=Y;Y=qr(n),Y!==oe&&(mn(),v(_t[oe],1,1,()=>{_t[oe]=null}),pn(),J=_t[Y],J||(J=_t[Y]=Cr[Y](n),J.c()),k(J,1),J.m(St.parentNode,St));let ue=W;W=Mr(n),W!==ue&&(mn(),v(bt[ue],1,1,()=>{bt[ue]=null}),pn(),X=bt[W],X||(X=bt[W]=Pr[W](n),X.c()),k(X,1),X.m(Ft.parentNode,Ft));let Vn=Z;Z=Ir(n),Z!==Vn&&(mn(),v(vt[Vn],1,1,()=>{vt[Vn]=null}),pn(),nn=vt[Z],nn||(nn=vt[Z]=Ar[Z](n),nn.c()),k(nn,1),nn.m(Ut.parentNode,Ut));let pe=tn;tn=Sr(n),tn!==pe&&(mn(),v(kt[pe],1,1,()=>{kt[pe]=null}),pn(),en=kt[tn],en||(en=kt[tn]=Nr[tn](n),en.c()),k(en,1),en.m(Xt.parentNode,Xt));let Gn=sn;sn=Dr(n),sn!==Gn&&(mn(),v($t[Gn],1,1,()=>{$t[Gn]=null}),pn(),ln=$t[sn],ln||(ln=$t[sn]=Fr[sn](n),ln.c()),k(ln,1),ln.m(ne.parentNode,ne));let me=cn;cn=zr(n),cn!==me&&(mn(),v(yt[me],1,1,()=>{yt[me]=null}),pn(),an=yt[cn],an||(an=yt[cn]=Or[cn](n),an.c()),k(an,1),an.m(se.parentNode,se));let Bn=rn;rn=Hr(n),rn!==Bn&&(mn(),v(jt[Bn],1,1,()=>{jt[Bn]=null}),pn(),hn=jt[rn],hn||(hn=jt[rn]=Lr[rn](n),hn.c()),k(hn,1),hn.m(le.parentNode,le));let fe=on;on=Gr(n),on!==fe&&(mn(),v(Et[fe],1,1,()=>{Et[fe]=null}),pn(),un=Et[on],un||(un=Et[on]=Vr[on](n),un.c()),k(un,1),un.m(ce.parentNode,ce));const Es={};r&2&&(Es.$$scope={dirty:r,ctx:n}),Ln.$set(Es)},i(n){yl||(k(l.$$.fragment,n),k(M.$$.fragment,n),k(N),k(Tn.$$.fragment,n),k(U),k(Yn.$$.fragment,n),k(Jn.$$.fragment,n),k(Zn.$$.fragment,n),k(et.$$.fragment,n),k(Q),k(J),k(st.$$.fragment,n),k(X),k(lt.$$.fragment,n),k(nn),k(ct.$$.fragment,n),k(en),k(ht.$$.fragment,n),k(ln),k(it.$$.fragment,n),k(ot.$$.fragment,n),k(an),k(hn),k(un),k(pt.$$.fragment,n),k(mt.$$.fragment,n),k(Ln.$$.fragment,n),yl=!0)},o(n){v(l.$$.fragment,n),v(M.$$.fragment,n),v(N),v(Tn.$$.fragment,n),v(U),v(Yn.$$.fragment,n),v(Jn.$$.fragment,n),v(Zn.$$.fragment,n),v(et.$$.fragment,n),v(Q),v(J),v(st.$$.fragment,n),v(X),v(lt.$$.fragment,n),v(nn),v(ct.$$.fragment,n),v(en),v(ht.$$.fragment,n),v(ln),v(it.$$.fragment,n),v(ot.$$.fragment,n),v(an),v(hn),v(un),v(pt.$$.fragment,n),v(mt.$$.fragment,n),v(Ln.$$.fragment,n),yl=!1},d(n){t(s),n&&t(p),C(l,n),n&&t(g),n&&t(_),C(M),n&&t(b),ft[$].d(n),n&&t(F),C(Tn,n),n&&t(ws),gt[K].d(n),n&&t(xt),n&&t(Cn),n&&t(xs),C(Yn,n),n&&t(Ts),n&&t(Ct),n&&t(Cs),C(Jn,n),n&&t(qs),n&&t(qn),n&&t(Ps),n&&t(kn),n&&t(Ms),n&&t(Pt),n&&t(As),n&&t($n),C(Zn),n&&t(Is),n&&t(Mn),n&&t(Ns),n&&t(fn),n&&t(Ss),n&&t(H),n&&t(Fs),n&&t(V),n&&t(Ds),C(et,n),n&&t(Os),n&&t(At),n&&t(zs),n&&t(An),n&&t(Ls),n&&t(In),n&&t(Hs),dt[R].d(n),n&&t(It),n&&t(Nt),n&&t(Vs),_t[Y].d(n),n&&t(St),n&&t(O),n&&t(Gs),n&&t(yn),C(st),n&&t(Bs),bt[W].d(n),n&&t(Ft),n&&t(Dt),n&&t(Ks),n&&t(z),n&&t(Us),n&&t(Ot),n&&t(Rs),n&&t(G),n&&t(Qs),n&&t(jn),C(lt),n&&t(Ys),n&&t(Lt),n&&t(Js),n&&t(gn),n&&t(Ws),n&&t(Bt),n&&t(Xs),n&&t(Kt),n&&t(Zs),vt[Z].d(n),n&&t(Ut),n&&t(B),n&&t(nl),n&&t(En),C(ct),n&&t(tl),n&&t(Rt),n&&t(el),n&&t(wn),n&&t(sl),n&&t(Qt),n&&t(ll),n&&t(Yt),n&&t(cl),n&&t(Jt),n&&t(al),n&&t(S),n&&t(rl),kt[tn].d(n),n&&t(Xt),n&&t(Zt),n&&t(hl),C(ht,n),n&&t(il),$t[sn].d(n),n&&t(ne),n&&t(te),n&&t(ol),n&&t(xn),C(it),n&&t(ul),n&&t(ee),n&&t(pl),C(ot,n),n&&t(ml),yt[cn].d(n),n&&t(se),n&&t(L),n&&t(fl),jt[rn].d(n),n&&t(le),Et[on].d(n),n&&t(ce),n&&t(dn),n&&t(gl),n&&t(On),n&&t(dl),C(pt,n),n&&t(_l),C(mt,n),n&&t(bl),n&&t(ae),n&&t(vl),n&&t(zn),n&&t(kl),n&&t(re),n&&t($l),C(Ln,n)}}}const Wi={local:"ng-sau-pipeline",sections:[{local:"tin-x-l-vi-mt-tokenizer",title:"Ti\u1EC1n x\u1EED l\xFD v\u1EDBi m\u1ED9t tokenizer"},{local:"i-qua-m-hnh",sections:[{local:"mt-vect-a-chiu",title:"M\u1ED9t vect\u01A1 \u0111a chi\u1EC1u"},{local:"u-m-hnh-hp-l-ti-tng-con-s",title:"\u0110\u1EA7u m\xF4 h\xECnh: H\u1EE3p l\xFD t\u1EDDi t\u1EEBng con s\u1ED1"}],title:"\u0110i qua m\xF4 h\xECnh"},{local:"hu-x-l-u-ra",title:"H\u1EADu x\u1EED l\xFD \u0111\u1EA7u ra"}],title:"\u0110\u1EB1ng sau pipeline"};function Xi(y,s,p){let l="pt";return Ei(()=>{const g=new URLSearchParams(window.location.search);p(0,l=g.get("fw")||"pt")}),[l]}class ro extends ki{constructor(s){super();$i(this,s,Xi,Ji,yi,{})}}export{ro as default,Wi as metadata};
