import{S as Vh,i as Ih,s as Lh,e as s,k as d,w as x,t as o,M as Jh,c as a,d as e,m as _,x as P,a as m,h as i,b as T,G as h,g as p,y as q,o as k,p as Ht,q as b,B as A,v as Kh,n as Rt}from"../../chunks/vendor-hf-doc-builder.js";import{Y as Rh}from"../../chunks/Youtube-hf-doc-builder.js";import{I as _n}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{C as F}from"../../chunks/CodeBlock-hf-doc-builder.js";import{C as Gh}from"../../chunks/CourseFloatingBanner-hf-doc-builder.js";import{F as Yh}from"../../chunks/FrameworkSwitchCourse-hf-doc-builder.js";import"../../chunks/DocNotebookDropdown-hf-doc-builder.js";function Uh(y){let c,l;return c=new Gh({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/section3_tf.ipynb"},{label:"Aws Studio",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/master/course/vi/chapter2/section3_tf.ipynb"}]}}),{c(){x(c.$$.fragment)},l(n){P(c.$$.fragment,n)},m(n,g){q(c,n,g),l=!0},i(n){l||(b(c.$$.fragment,n),l=!0)},o(n){k(c.$$.fragment,n),l=!1},d(n){A(c,n)}}}function Qh(y){let c,l;return c=new Gh({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/section3_pt.ipynb"},{label:"Aws Studio",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/master/course/vi/chapter2/section3_pt.ipynb"}]}}),{c(){x(c.$$.fragment)},l(n){P(c.$$.fragment,n)},m(n,g){q(c,n,g),l=!0},i(n){l||(b(c.$$.fragment,n),l=!0)},o(n){k(c.$$.fragment,n),l=!1},d(n){A(c,n)}}}function Wh(y){let c,l;return c=new Rh({props:{id:"d3JVgghSOew"}}),{c(){x(c.$$.fragment)},l(n){P(c.$$.fragment,n)},m(n,g){q(c,n,g),l=!0},i(n){l||(b(c.$$.fragment,n),l=!0)},o(n){k(c.$$.fragment,n),l=!1},d(n){A(c,n)}}}function Xh(y){let c,l;return c=new Rh({props:{id:"AhChOFRegn4"}}),{c(){x(c.$$.fragment)},l(n){P(c.$$.fragment,n)},m(n,g){q(c,n,g),l=!0},i(n){l||(b(c.$$.fragment,n),l=!0)},o(n){k(c.$$.fragment,n),l=!1},d(n){A(c,n)}}}function Zh(y){let c,l,n,g,w,E,C,$,B,j;return{c(){c=s("p"),l=o("Trong ph\u1EA7n n\xE0y, ch\xFAng ta s\u1EBD xem x\xE9t k\u1EF9 h\u01A1n v\u1EC1 vi\u1EC7c t\u1EA1o v\xE0 s\u1EED d\u1EE5ng m\u1ED9t m\xF4 h\xECnh. Ch\xFAng t\xF4i s\u1EBD s\u1EED d\u1EE5ng "),n=s("code"),g=o("TFAutoModel"),w=o(", r\u1EA5t ti\u1EC7n l\u1EE3i khi b\u1EA1n mu\u1ED1n kh\u1EDFi t\u1EA1o b\u1EA5t k\u1EF3 m\xF4 h\xECnh n\xE0o t\u1EEB m\u1ED9t checkpoint."),E=d(),C=s("p"),$=s("code"),B=o("TFAutoModel"),j=o(" v\xE0 t\u1EA5t c\u1EA3 c\xE1c l\u1EDBp h\u1ECD h\xE0ng c\u1EE7a n\xF3 th\u1EF1c ra l\xE0 c\xE1c h\xE0m \u0111\xF3ng g\xF3i \u0111\u01A1n gi\u1EA3n tr\xEAn nhi\u1EC1u lo\u1EA1i m\xF4 h\xECnh c\xF3 s\u1EB5n trong th\u01B0 vi\u1EC7n. \u0110\xF3 l\xE0 m\u1ED9t h\xE0m \u0111\xF3ng g\xF3i th\xF4ng minh v\xEC n\xF3 c\xF3 th\u1EC3 t\u1EF1 \u0111\u1ED9ng \u0111o\xE1n ki\u1EBFn tr\xFAc m\xF4 h\xECnh th\xEDch h\u1EE3p cho checkpoint c\u1EE7a b\u1EA1n v\xE0 sau \u0111\xF3 kh\u1EDFi t\u1EA1o m\u1ED9t m\xF4 h\xECnh v\u1EDBi ki\u1EBFn tr\xFAc n\xE0y.")},l(v){c=a(v,"P",{});var u=m(c);l=i(u,"Trong ph\u1EA7n n\xE0y, ch\xFAng ta s\u1EBD xem x\xE9t k\u1EF9 h\u01A1n v\u1EC1 vi\u1EC7c t\u1EA1o v\xE0 s\u1EED d\u1EE5ng m\u1ED9t m\xF4 h\xECnh. Ch\xFAng t\xF4i s\u1EBD s\u1EED d\u1EE5ng "),n=a(u,"CODE",{});var f=m(n);g=i(f,"TFAutoModel"),f.forEach(e),w=i(u,", r\u1EA5t ti\u1EC7n l\u1EE3i khi b\u1EA1n mu\u1ED1n kh\u1EDFi t\u1EA1o b\u1EA5t k\u1EF3 m\xF4 h\xECnh n\xE0o t\u1EEB m\u1ED9t checkpoint."),u.forEach(e),E=_(v),C=a(v,"P",{});var M=m(C);$=a(M,"CODE",{});var N=m($);B=i(N,"TFAutoModel"),N.forEach(e),j=i(M," v\xE0 t\u1EA5t c\u1EA3 c\xE1c l\u1EDBp h\u1ECD h\xE0ng c\u1EE7a n\xF3 th\u1EF1c ra l\xE0 c\xE1c h\xE0m \u0111\xF3ng g\xF3i \u0111\u01A1n gi\u1EA3n tr\xEAn nhi\u1EC1u lo\u1EA1i m\xF4 h\xECnh c\xF3 s\u1EB5n trong th\u01B0 vi\u1EC7n. \u0110\xF3 l\xE0 m\u1ED9t h\xE0m \u0111\xF3ng g\xF3i th\xF4ng minh v\xEC n\xF3 c\xF3 th\u1EC3 t\u1EF1 \u0111\u1ED9ng \u0111o\xE1n ki\u1EBFn tr\xFAc m\xF4 h\xECnh th\xEDch h\u1EE3p cho checkpoint c\u1EE7a b\u1EA1n v\xE0 sau \u0111\xF3 kh\u1EDFi t\u1EA1o m\u1ED9t m\xF4 h\xECnh v\u1EDBi ki\u1EBFn tr\xFAc n\xE0y."),M.forEach(e)},m(v,u){p(v,c,u),h(c,l),h(c,n),h(n,g),h(c,w),p(v,E,u),p(v,C,u),h(C,$),h($,B),h(C,j)},d(v){v&&e(c),v&&e(E),v&&e(C)}}}function tr(y){let c,l,n,g,w,E,C,$,B,j;return{c(){c=s("p"),l=o("Trong ph\u1EA7n n\xE0y, ch\xFAng ta s\u1EBD xem x\xE9t k\u1EF9 h\u01A1n v\u1EC1 vi\u1EC7c t\u1EA1o v\xE0 s\u1EED d\u1EE5ng m\u1ED9t m\xF4 h\xECnh. Ch\xFAng t\xF4i s\u1EBD s\u1EED d\u1EE5ng "),n=s("code"),g=o("AutoModel"),w=o(", r\u1EA5t ti\u1EC7n l\u1EE3i khi b\u1EA1n mu\u1ED1n kh\u1EDFi t\u1EA1o b\u1EA5t k\u1EF3 m\xF4 h\xECnh n\xE0o t\u1EEB m\u1ED9t checkpoint."),E=d(),C=s("p"),$=s("code"),B=o("AutoModel"),j=o(" v\xE0 t\u1EA5t c\u1EA3 c\xE1c l\u1EDBp h\u1ECD h\xE0ng c\u1EE7a n\xF3 th\u1EF1c ra l\xE0 c\xE1c h\xE0m \u0111\xF3ng g\xF3i \u0111\u01A1n gi\u1EA3n tr\xEAn nhi\u1EC1u lo\u1EA1i m\xF4 h\xECnh c\xF3 s\u1EB5n trong th\u01B0 vi\u1EC7n. \u0110\xF3 l\xE0 m\u1ED9t h\xE0m \u0111\xF3ng g\xF3i th\xF4ng minh v\xEC n\xF3 c\xF3 th\u1EC3 t\u1EF1 \u0111\u1ED9ng \u0111o\xE1n ki\u1EBFn tr\xFAc m\xF4 h\xECnh th\xEDch h\u1EE3p cho checkpoint c\u1EE7a b\u1EA1n v\xE0 sau \u0111\xF3 kh\u1EDFi t\u1EA1o m\u1ED9t m\xF4 h\xECnh v\u1EDBi ki\u1EBFn tr\xFAc n\xE0y.")},l(v){c=a(v,"P",{});var u=m(c);l=i(u,"Trong ph\u1EA7n n\xE0y, ch\xFAng ta s\u1EBD xem x\xE9t k\u1EF9 h\u01A1n v\u1EC1 vi\u1EC7c t\u1EA1o v\xE0 s\u1EED d\u1EE5ng m\u1ED9t m\xF4 h\xECnh. Ch\xFAng t\xF4i s\u1EBD s\u1EED d\u1EE5ng "),n=a(u,"CODE",{});var f=m(n);g=i(f,"AutoModel"),f.forEach(e),w=i(u,", r\u1EA5t ti\u1EC7n l\u1EE3i khi b\u1EA1n mu\u1ED1n kh\u1EDFi t\u1EA1o b\u1EA5t k\u1EF3 m\xF4 h\xECnh n\xE0o t\u1EEB m\u1ED9t checkpoint."),u.forEach(e),E=_(v),C=a(v,"P",{});var M=m(C);$=a(M,"CODE",{});var N=m($);B=i(N,"AutoModel"),N.forEach(e),j=i(M," v\xE0 t\u1EA5t c\u1EA3 c\xE1c l\u1EDBp h\u1ECD h\xE0ng c\u1EE7a n\xF3 th\u1EF1c ra l\xE0 c\xE1c h\xE0m \u0111\xF3ng g\xF3i \u0111\u01A1n gi\u1EA3n tr\xEAn nhi\u1EC1u lo\u1EA1i m\xF4 h\xECnh c\xF3 s\u1EB5n trong th\u01B0 vi\u1EC7n. \u0110\xF3 l\xE0 m\u1ED9t h\xE0m \u0111\xF3ng g\xF3i th\xF4ng minh v\xEC n\xF3 c\xF3 th\u1EC3 t\u1EF1 \u0111\u1ED9ng \u0111o\xE1n ki\u1EBFn tr\xFAc m\xF4 h\xECnh th\xEDch h\u1EE3p cho checkpoint c\u1EE7a b\u1EA1n v\xE0 sau \u0111\xF3 kh\u1EDFi t\u1EA1o m\u1ED9t m\xF4 h\xECnh v\u1EDBi ki\u1EBFn tr\xFAc n\xE0y."),M.forEach(e)},m(v,u){p(v,c,u),h(c,l),h(c,n),h(n,g),h(c,w),p(v,E,u),p(v,C,u),h(C,$),h($,B),h(C,j)},d(v){v&&e(c),v&&e(E),v&&e(C)}}}function nr(y){let c,l;return c=new F({props:{code:`from transformers import BertConfig, TFBertModel

# Building the config
config = BertConfig()

# Building the model from the config
model = TFBertModel(config)`,highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> BertConfig, TFBertModel

<span class="hljs-comment"># Building the config</span>
config = BertConfig()

<span class="hljs-comment"># Building the model from the config</span>
model = TFBertModel(config)`}}),{c(){x(c.$$.fragment)},l(n){P(c.$$.fragment,n)},m(n,g){q(c,n,g),l=!0},i(n){l||(b(c.$$.fragment,n),l=!0)},o(n){k(c.$$.fragment,n),l=!1},d(n){A(c,n)}}}function er(y){let c,l;return c=new F({props:{code:`from transformers import BertConfig, BertModel

# Building the config
config = BertConfig()

# Building the model from the config
model = BertModel(config)`,highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> BertConfig, BertModel

<span class="hljs-comment"># Building the config</span>
config = BertConfig()

<span class="hljs-comment"># Building the model from the config</span>
model = BertModel(config)`}}),{c(){x(c.$$.fragment)},l(n){P(c.$$.fragment,n)},m(n,g){q(c,n,g),l=!0},i(n){l||(b(c.$$.fragment,n),l=!0)},o(n){k(c.$$.fragment,n),l=!1},d(n){A(c,n)}}}function cr(y){let c,l;return c=new F({props:{code:`from transformers import BertConfig, TFBertModel

config = BertConfig()
model = TFBertModel(config)

# Model is randomly initialized!`,highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> BertConfig, TFBertModel

config = BertConfig()
model = TFBertModel(config)

<span class="hljs-comment"># Model is randomly initialized!</span>`}}),{c(){x(c.$$.fragment)},l(n){P(c.$$.fragment,n)},m(n,g){q(c,n,g),l=!0},i(n){l||(b(c.$$.fragment,n),l=!0)},o(n){k(c.$$.fragment,n),l=!1},d(n){A(c,n)}}}function hr(y){let c,l;return c=new F({props:{code:`from transformers import BertConfig, BertModel

config = BertConfig()
model = BertModel(config)

# Model is randomly initialized!`,highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> BertConfig, BertModel

config = BertConfig()
model = BertModel(config)

<span class="hljs-comment"># Model is randomly initialized!</span>`}}),{c(){x(c.$$.fragment)},l(n){P(c.$$.fragment,n)},m(n,g){q(c,n,g),l=!0},i(n){l||(b(c.$$.fragment,n),l=!0)},o(n){k(c.$$.fragment,n),l=!1},d(n){A(c,n)}}}function rr(y){let c,l,n,g,w,E,C,$,B,j,v;return c=new F({props:{code:`from transformers import TFBertModel

model = TFBertModel.from_pretrained("bert-base-cased")`,highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFBertModel

model = TFBertModel.from_pretrained(<span class="hljs-string">&quot;bert-base-cased&quot;</span>)`}}),{c(){x(c.$$.fragment),l=d(),n=s("p"),g=o("Nh\u01B0 b\u1EA1n \u0111\xE3 th\u1EA5y tr\u01B0\u1EDBc \u0111\xF3, ch\xFAng ta c\xF3 th\u1EC3 thay th\u1EBF "),w=s("code"),E=o("BertModel"),C=o(" b\u1EB1ng "),$=s("code"),B=o("TFAutoModel"),j=o(" t\u01B0\u01A1ng \u0111\u01B0\u01A1ng. Ch\xFAng ta s\u1EBD l\xE0m \u0111i\u1EC1u n\xE0y t\u1EEB b\xE2y gi\u1EDD v\xEC \u0111i\u1EC1u n\xE0y t\u1EA1o ra c\xE1c \u0111o\u1EA1n m\xE3 checkpoint b\u1EA5t kh\u1EA3 tri; n\u1EBFu m\xE3 c\u1EE7a b\u1EA1n ho\u1EA1t \u0111\u1ED9ng cho m\u1ED9t checkpoint, n\xF3 s\u1EBD ho\u1EA1t \u0111\u1ED9ng li\u1EC1n m\u1EA1ch v\u1EDBi m\u1ED9t checkpoint kh\xE1c. \u0110i\u1EC1u n\xE0y \xE1p d\u1EE5ng ngay c\u1EA3 khi ki\u1EBFn tr\xFAc kh\xE1c nhau, mi\u1EC5n l\xE0 checkpoint \u0111\xE3 \u0111\u01B0\u1EE3c hu\u1EA5n luy\u1EC7n cho m\u1ED9t t\xE1c v\u1EE5 t\u01B0\u01A1ng t\u1EF1 (v\xED d\u1EE5: m\u1ED9t t\xE1c v\u1EE5 ph\xE2n t\xEDch c\u1EA3m x\xFAc).")},l(u){P(c.$$.fragment,u),l=_(u),n=a(u,"P",{});var f=m(n);g=i(f,"Nh\u01B0 b\u1EA1n \u0111\xE3 th\u1EA5y tr\u01B0\u1EDBc \u0111\xF3, ch\xFAng ta c\xF3 th\u1EC3 thay th\u1EBF "),w=a(f,"CODE",{});var M=m(w);E=i(M,"BertModel"),M.forEach(e),C=i(f," b\u1EB1ng "),$=a(f,"CODE",{});var N=m($);B=i(N,"TFAutoModel"),N.forEach(e),j=i(f," t\u01B0\u01A1ng \u0111\u01B0\u01A1ng. Ch\xFAng ta s\u1EBD l\xE0m \u0111i\u1EC1u n\xE0y t\u1EEB b\xE2y gi\u1EDD v\xEC \u0111i\u1EC1u n\xE0y t\u1EA1o ra c\xE1c \u0111o\u1EA1n m\xE3 checkpoint b\u1EA5t kh\u1EA3 tri; n\u1EBFu m\xE3 c\u1EE7a b\u1EA1n ho\u1EA1t \u0111\u1ED9ng cho m\u1ED9t checkpoint, n\xF3 s\u1EBD ho\u1EA1t \u0111\u1ED9ng li\u1EC1n m\u1EA1ch v\u1EDBi m\u1ED9t checkpoint kh\xE1c. \u0110i\u1EC1u n\xE0y \xE1p d\u1EE5ng ngay c\u1EA3 khi ki\u1EBFn tr\xFAc kh\xE1c nhau, mi\u1EC5n l\xE0 checkpoint \u0111\xE3 \u0111\u01B0\u1EE3c hu\u1EA5n luy\u1EC7n cho m\u1ED9t t\xE1c v\u1EE5 t\u01B0\u01A1ng t\u1EF1 (v\xED d\u1EE5: m\u1ED9t t\xE1c v\u1EE5 ph\xE2n t\xEDch c\u1EA3m x\xFAc)."),f.forEach(e)},m(u,f){q(c,u,f),p(u,l,f),p(u,n,f),h(n,g),h(n,w),h(w,E),h(n,C),h(n,$),h($,B),h(n,j),v=!0},i(u){v||(b(c.$$.fragment,u),v=!0)},o(u){k(c.$$.fragment,u),v=!1},d(u){A(c,u),u&&e(l),u&&e(n)}}}function or(y){let c,l,n,g,w,E,C,$,B,j,v;return c=new F({props:{code:`from transformers import BertModel

model = BertModel.from_pretrained("bert-base-cased")`,highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> BertModel

model = BertModel.from_pretrained(<span class="hljs-string">&quot;bert-base-cased&quot;</span>)`}}),{c(){x(c.$$.fragment),l=d(),n=s("p"),g=o("Nh\u01B0 b\u1EA1n \u0111\xE3 th\u1EA5y tr\u01B0\u1EDBc \u0111\xF3, ch\xFAng ta c\xF3 th\u1EC3 thay th\u1EBF "),w=s("code"),E=o("BertModel"),C=o(" b\u1EB1ng "),$=s("code"),B=o("AutoModel"),j=o(" t\u01B0\u01A1ng \u0111\u01B0\u01A1ng. Ch\xFAng ta s\u1EBD l\xE0m \u0111i\u1EC1u n\xE0y t\u1EEB b\xE2y gi\u1EDD v\xEC \u0111i\u1EC1u n\xE0y t\u1EA1o ra c\xE1c \u0111o\u1EA1n m\xE3 checkpoint b\u1EA5t kh\u1EA3 tri; n\u1EBFu m\xE3 c\u1EE7a b\u1EA1n ho\u1EA1t \u0111\u1ED9ng cho m\u1ED9t checkpoint, n\xF3 s\u1EBD ho\u1EA1t \u0111\u1ED9ng li\u1EC1n m\u1EA1ch v\u1EDBi m\u1ED9t checkpoint kh\xE1c. \u0110i\u1EC1u n\xE0y \xE1p d\u1EE5ng ngay c\u1EA3 khi ki\u1EBFn tr\xFAc kh\xE1c nhau, mi\u1EC5n l\xE0 checkpoint \u0111\xE3 \u0111\u01B0\u1EE3c hu\u1EA5n luy\u1EC7n cho m\u1ED9t t\xE1c v\u1EE5 t\u01B0\u01A1ng t\u1EF1 (v\xED d\u1EE5: m\u1ED9t t\xE1c v\u1EE5 ph\xE2n t\xEDch c\u1EA3m x\xFAc).")},l(u){P(c.$$.fragment,u),l=_(u),n=a(u,"P",{});var f=m(n);g=i(f,"Nh\u01B0 b\u1EA1n \u0111\xE3 th\u1EA5y tr\u01B0\u1EDBc \u0111\xF3, ch\xFAng ta c\xF3 th\u1EC3 thay th\u1EBF "),w=a(f,"CODE",{});var M=m(w);E=i(M,"BertModel"),M.forEach(e),C=i(f," b\u1EB1ng "),$=a(f,"CODE",{});var N=m($);B=i(N,"AutoModel"),N.forEach(e),j=i(f," t\u01B0\u01A1ng \u0111\u01B0\u01A1ng. Ch\xFAng ta s\u1EBD l\xE0m \u0111i\u1EC1u n\xE0y t\u1EEB b\xE2y gi\u1EDD v\xEC \u0111i\u1EC1u n\xE0y t\u1EA1o ra c\xE1c \u0111o\u1EA1n m\xE3 checkpoint b\u1EA5t kh\u1EA3 tri; n\u1EBFu m\xE3 c\u1EE7a b\u1EA1n ho\u1EA1t \u0111\u1ED9ng cho m\u1ED9t checkpoint, n\xF3 s\u1EBD ho\u1EA1t \u0111\u1ED9ng li\u1EC1n m\u1EA1ch v\u1EDBi m\u1ED9t checkpoint kh\xE1c. \u0110i\u1EC1u n\xE0y \xE1p d\u1EE5ng ngay c\u1EA3 khi ki\u1EBFn tr\xFAc kh\xE1c nhau, mi\u1EC5n l\xE0 checkpoint \u0111\xE3 \u0111\u01B0\u1EE3c hu\u1EA5n luy\u1EC7n cho m\u1ED9t t\xE1c v\u1EE5 t\u01B0\u01A1ng t\u1EF1 (v\xED d\u1EE5: m\u1ED9t t\xE1c v\u1EE5 ph\xE2n t\xEDch c\u1EA3m x\xFAc)."),f.forEach(e)},m(u,f){q(c,u,f),p(u,l,f),p(u,n,f),h(n,g),h(n,w),h(w,E),h(n,C),h(n,$),h($,B),h(n,j),v=!0},i(u){v||(b(c.$$.fragment,u),v=!0)},o(u){k(c.$$.fragment,u),v=!1},d(u){A(c,u),u&&e(l),u&&e(n)}}}function ir(y){let c,l;return c=new F({props:{code:`ls directory_on_my_computer

config.json tf_model.h5`,highlighted:`ls <span class="hljs-keyword">directory_on_my_computer
</span>
<span class="hljs-built_in">config</span>.<span class="hljs-keyword">json </span>tf_model.h5`}}),{c(){x(c.$$.fragment)},l(n){P(c.$$.fragment,n)},m(n,g){q(c,n,g),l=!0},i(n){l||(b(c.$$.fragment,n),l=!0)},o(n){k(c.$$.fragment,n),l=!1},d(n){A(c,n)}}}function lr(y){let c,l;return c=new F({props:{code:`ls directory_on_my_computer

config.json pytorch_model.bin`,highlighted:`ls <span class="hljs-keyword">directory_on_my_computer
</span>
<span class="hljs-built_in">config</span>.<span class="hljs-keyword">json </span>pytorch_model.<span class="hljs-keyword">bin</span>`}}),{c(){x(c.$$.fragment)},l(n){P(c.$$.fragment,n)},m(n,g){q(c,n,g),l=!0},i(n){l||(b(c.$$.fragment,n),l=!0)},o(n){k(c.$$.fragment,n),l=!1},d(n){A(c,n)}}}function sr(y){let c,l,n,g,w,E,C,$,B,j,v;return{c(){c=s("p"),l=o("T\u1EC7p "),n=s("em"),g=o("tf_model.h5"),w=o(" \u0111\u01B0\u1EE3c g\u1ECDi l\xE0 "),E=s("em"),C=o("state dictionary"),$=o(" ("),B=s("em"),j=o("t\u1EEB \u0111i\u1EC3n tr\u1EA1ng th\xE1i"),v=o("); n\xF3 ch\u1EE9a t\u1EA5t c\u1EA3 c\xE1c tr\u1ECDng s\u1ED1 m\xF4 h\xECnh c\u1EE7a b\u1EA1n. Hai t\u1EADp tin \u0111i \u0111\xF4i v\u1EDBi nhau; c\u1EA5u h\xECnh l\xE0 c\u1EA7n thi\u1EBFt \u0111\u1EC3 bi\u1EBFt ki\u1EBFn tr\xFAc m\xF4 h\xECnh c\u1EE7a b\u1EA1n, trong khi tr\u1ECDng s\u1ED1 m\xF4 h\xECnh l\xE0 th\xF4ng s\u1ED1 c\u1EE7a m\xF4 h\xECnh c\u1EE7a b\u1EA1n.")},l(u){c=a(u,"P",{});var f=m(c);l=i(f,"T\u1EC7p "),n=a(f,"EM",{});var M=m(n);g=i(M,"tf_model.h5"),M.forEach(e),w=i(f," \u0111\u01B0\u1EE3c g\u1ECDi l\xE0 "),E=a(f,"EM",{});var N=m(E);C=i(N,"state dictionary"),N.forEach(e),$=i(f," ("),B=a(f,"EM",{});var S=m(B);j=i(S,"t\u1EEB \u0111i\u1EC3n tr\u1EA1ng th\xE1i"),S.forEach(e),v=i(f,"); n\xF3 ch\u1EE9a t\u1EA5t c\u1EA3 c\xE1c tr\u1ECDng s\u1ED1 m\xF4 h\xECnh c\u1EE7a b\u1EA1n. Hai t\u1EADp tin \u0111i \u0111\xF4i v\u1EDBi nhau; c\u1EA5u h\xECnh l\xE0 c\u1EA7n thi\u1EBFt \u0111\u1EC3 bi\u1EBFt ki\u1EBFn tr\xFAc m\xF4 h\xECnh c\u1EE7a b\u1EA1n, trong khi tr\u1ECDng s\u1ED1 m\xF4 h\xECnh l\xE0 th\xF4ng s\u1ED1 c\u1EE7a m\xF4 h\xECnh c\u1EE7a b\u1EA1n."),f.forEach(e)},m(u,f){p(u,c,f),h(c,l),h(c,n),h(n,g),h(c,w),h(c,E),h(E,C),h(c,$),h(c,B),h(B,j),h(c,v)},d(u){u&&e(c)}}}function ar(y){let c,l,n,g,w,E,C,$,B,j,v;return{c(){c=s("p"),l=o("T\u1EC7p "),n=s("em"),g=o("pytorch_model.bin"),w=o(" \u0111\u01B0\u1EE3c g\u1ECDi l\xE0 "),E=s("em"),C=o("state dictionary"),$=o(" ("),B=s("em"),j=o("t\u1EEB \u0111i\u1EC3n tr\u1EA1ng th\xE1i"),v=o("); n\xF3 ch\u1EE9a t\u1EA5t c\u1EA3 c\xE1c tr\u1ECDng s\u1ED1 m\xF4 h\xECnh c\u1EE7a b\u1EA1n. Hai t\u1EADp tin \u0111i \u0111\xF4i v\u1EDBi nhau; c\u1EA5u h\xECnh l\xE0 c\u1EA7n thi\u1EBFt \u0111\u1EC3 bi\u1EBFt ki\u1EBFn tr\xFAc m\xF4 h\xECnh c\u1EE7a b\u1EA1n, trong khi tr\u1ECDng s\u1ED1 m\xF4 h\xECnh l\xE0 th\xF4ng s\u1ED1 c\u1EE7a m\xF4 h\xECnh c\u1EE7a b\u1EA1n.")},l(u){c=a(u,"P",{});var f=m(c);l=i(f,"T\u1EC7p "),n=a(f,"EM",{});var M=m(n);g=i(M,"pytorch_model.bin"),M.forEach(e),w=i(f," \u0111\u01B0\u1EE3c g\u1ECDi l\xE0 "),E=a(f,"EM",{});var N=m(E);C=i(N,"state dictionary"),N.forEach(e),$=i(f," ("),B=a(f,"EM",{});var S=m(B);j=i(S,"t\u1EEB \u0111i\u1EC3n tr\u1EA1ng th\xE1i"),S.forEach(e),v=i(f,"); n\xF3 ch\u1EE9a t\u1EA5t c\u1EA3 c\xE1c tr\u1ECDng s\u1ED1 m\xF4 h\xECnh c\u1EE7a b\u1EA1n. Hai t\u1EADp tin \u0111i \u0111\xF4i v\u1EDBi nhau; c\u1EA5u h\xECnh l\xE0 c\u1EA7n thi\u1EBFt \u0111\u1EC3 bi\u1EBFt ki\u1EBFn tr\xFAc m\xF4 h\xECnh c\u1EE7a b\u1EA1n, trong khi tr\u1ECDng s\u1ED1 m\xF4 h\xECnh l\xE0 th\xF4ng s\u1ED1 c\u1EE7a m\xF4 h\xECnh c\u1EE7a b\u1EA1n."),f.forEach(e)},m(u,f){p(u,c,f),h(c,l),h(c,n),h(n,g),h(c,w),h(c,E),h(E,C),h(c,$),h(c,B),h(B,j),h(c,v)},d(u){u&&e(c)}}}function mr(y){let c,l;return c=new F({props:{code:`import tensorflow as tf

model_inputs = tf.constant(encoded_sequences)`,highlighted:`<span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf

model_inputs = tf.constant(encoded_sequences)`}}),{c(){x(c.$$.fragment)},l(n){P(c.$$.fragment,n)},m(n,g){q(c,n,g),l=!0},i(n){l||(b(c.$$.fragment,n),l=!0)},o(n){k(c.$$.fragment,n),l=!1},d(n){A(c,n)}}}function pr(y){let c,l;return c=new F({props:{code:`import torch

model_inputs = torch.tensor(encoded_sequences)`,highlighted:`<span class="hljs-keyword">import</span> torch

model_inputs = torch.tensor(encoded_sequences)`}}),{c(){x(c.$$.fragment)},l(n){P(c.$$.fragment,n)},m(n,g){q(c,n,g),l=!0},i(n){l||(b(c.$$.fragment,n),l=!0)},o(n){k(c.$$.fragment,n),l=!1},d(n){A(c,n)}}}function ur(y){let c,l,n,g,w,E,C,$,B,j,v,u,f,M,N,S,H,Gt,Vt,It,xe,Rn,X,rt,vn,kt,Pe,kn,qe,Gn,Lt,Ae,Vn,R,G,Jt,Kt,Ne,In,bt,Ln,yt,Jn,O,Se,bn,Fe,Oe,yn,ze,De,$n,He,Re,Kn,Z,ot,En,$t,Ge,wn,Ve,Yn,Yt,Ie,Un,V,I,Ut,it,Le,Qt,Je,Ke,Qn,lt,Ye,Cn,Ue,Qe,Wn,L,J,Wt,z,We,Bn,Xe,Ze,Mn,tc,nc,Et,ec,cc,Xn,Xt,hc,Zn,D,rc,Tn,oc,ic,jn,lc,sc,xn,ac,mc,te,st,pc,wt,uc,fc,ne,tt,at,Pn,Ct,gc,qn,dc,ee,W,_c,An,vc,kc,Nn,bc,yc,ce,Bt,he,Zt,$c,re,K,Y,tn,mt,Ec,Sn,wc,Cc,oe,nn,nt,pt,Fn,Mt,Bc,On,Mc,ie,en,Tc,le,cn,jc,se,hn,xc,ae,Tt,me,ut,Pc,zn,qc,Ac,pe,jt,ue,rn,Nc,fe,U,Q,on,et,ft,Dn,xt,Sc,Hn,Fc,ge,ln,Oc,de,Pt,_e,sn,zc,ve;n=new Yh({props:{fw:y[0]}}),$=new _n({});const Dc=[Qh,Uh],qt=[];function Hc(t,r){return t[0]==="pt"?0:1}f=Hc(y),M=qt[f]=Dc[f](y);const Rc=[Xh,Wh],At=[];function Gc(t,r){return t[0]==="pt"?0:1}S=Gc(y),H=At[S]=Rc[S](y);function Vc(t,r){return t[0]==="pt"?tr:Zh}let ke=Vc(y),ct=ke(y);kt=new _n({});const Ic=[er,nr],Nt=[];function Lc(t,r){return t[0]==="pt"?0:1}R=Lc(y),G=Nt[R]=Ic[R](y),bt=new F({props:{code:"print(config)",highlighted:'<span class="hljs-built_in">print</span>(config)'}}),yt=new F({props:{code:`BertConfig {
  [...]
  "hidden_size": 768,
  "intermediate_size": 3072,
  "max_position_embeddings": 512,
  "num_attention_heads": 12,
  "num_hidden_layers": 12,
  [...]
}`,highlighted:`BertConfig {
  [...]
  <span class="hljs-string">&quot;hidden_size&quot;</span>: <span class="hljs-number">768</span>,
  <span class="hljs-string">&quot;intermediate_size&quot;</span>: <span class="hljs-number">3072</span>,
  <span class="hljs-string">&quot;max_position_embeddings&quot;</span>: <span class="hljs-number">512</span>,
  <span class="hljs-string">&quot;num_attention_heads&quot;</span>: <span class="hljs-number">12</span>,
  <span class="hljs-string">&quot;num_hidden_layers&quot;</span>: <span class="hljs-number">12</span>,
  [...]
}`}}),$t=new _n({});const Jc=[hr,cr],St=[];function Kc(t,r){return t[0]==="pt"?0:1}V=Kc(y),I=St[V]=Jc[V](y);const Yc=[or,rr],Ft=[];function Uc(t,r){return t[0]==="pt"?0:1}L=Uc(y),J=Ft[L]=Yc[L](y),Ct=new _n({}),Bt=new F({props:{code:'model.save_pretrained("directory_on_my_computer")',highlighted:'model.save_pretrained(<span class="hljs-string">&quot;directory_on_my_computer&quot;</span>)'}});const Qc=[lr,ir],Ot=[];function Wc(t,r){return t[0]==="pt"?0:1}K=Wc(y),Y=Ot[K]=Qc[K](y);function Xc(t,r){return t[0]==="pt"?ar:sr}let be=Xc(y),ht=be(y);Mt=new _n({}),Tt=new F({props:{code:'sequences = ["Hello!", "Cool.", "Nice!"]',highlighted:'sequences = [<span class="hljs-string">&quot;Hello!&quot;</span>, <span class="hljs-string">&quot;Cool.&quot;</span>, <span class="hljs-string">&quot;Nice!&quot;</span>]'}}),jt=new F({props:{code:`encoded_sequences = [
    [101, 7592, 999, 102],
    [101, 4658, 1012, 102],
    [101, 3835, 999, 102],
]`,highlighted:`encoded_sequences = [
    [<span class="hljs-number">101</span>, <span class="hljs-number">7592</span>, <span class="hljs-number">999</span>, <span class="hljs-number">102</span>],
    [<span class="hljs-number">101</span>, <span class="hljs-number">4658</span>, <span class="hljs-number">1012</span>, <span class="hljs-number">102</span>],
    [<span class="hljs-number">101</span>, <span class="hljs-number">3835</span>, <span class="hljs-number">999</span>, <span class="hljs-number">102</span>],
]`}});const Zc=[pr,mr],zt=[];function th(t,r){return t[0]==="pt"?0:1}return U=th(y),Q=zt[U]=Zc[U](y),xt=new _n({}),Pt=new F({props:{code:"output = model(model_inputs)",highlighted:"output = model(model_inputs)"}}),{c(){c=s("meta"),l=d(),x(n.$$.fragment),g=d(),w=s("h1"),E=s("a"),C=s("span"),x($.$$.fragment),B=d(),j=s("span"),v=o("C\xE1c m\xF4 h\xECnh"),u=d(),M.c(),N=d(),H.c(),Gt=d(),ct.c(),Vt=d(),It=s("p"),xe=o("Tuy nhi\xEAn, n\u1EBFu b\u1EA1n bi\u1EBFt lo\u1EA1i m\xF4 h\xECnh b\u1EA1n mu\u1ED1n s\u1EED d\u1EE5ng, b\u1EA1n c\xF3 th\u1EC3 s\u1EED d\u1EE5ng tr\u1EF1c ti\u1EBFp l\u1EDBp \u0111\u1ECBnh ngh\u0129a ki\u1EBFn tr\xFAc c\u1EE7a n\xF3. Ch\xFAng ta h\xE3y xem c\xE1ch n\xE0y ho\u1EA1t \u0111\u1ED9ng v\u1EDBi m\xF4 h\xECnh BERT."),Rn=d(),X=s("h2"),rt=s("a"),vn=s("span"),x(kt.$$.fragment),Pe=d(),kn=s("span"),qe=o("T\u1EA1o ra m\u1ED9t Transformer"),Gn=d(),Lt=s("p"),Ae=o("\u0110i\u1EC1u \u0111\u1EA7u ti\xEAn ta c\u1EA7n l\xE0m \u0111\u1EC3 kh\u1EDFi t\u1EA1o m\xF4 h\xECnh BERT l\xE0 t\u1EA3i m\u1ED9t c\u1EA5u h\xECnh:"),Vn=d(),G.c(),Jt=d(),Kt=s("p"),Ne=o("C\u1EA5u h\xECnh ch\u1EE9a nhi\u1EC1u thu\u1ED9c t\xEDnh \u0111\u01B0\u1EE3c s\u1EED d\u1EE5ng \u0111\u1EC3 x\xE2y d\u1EF1ng m\xF4 h\xECnh:"),In=d(),x(bt.$$.fragment),Ln=d(),x(yt.$$.fragment),Jn=d(),O=s("p"),Se=o("M\u1EB7c d\xF9 b\u1EA1n ch\u01B0a th\u1EA5y t\u1EA5t c\u1EA3 c\xE1c thu\u1ED9c t\xEDnh n\xE0y c\xF3 t\xE1c d\u1EE5ng g\xEC, nh\u01B0ng b\u1EA1n n\xEAn nh\u1EADn ra m\u1ED9t s\u1ED1 trong s\u1ED1 ch\xFAng: thu\u1ED9c t\xEDnh "),bn=s("code"),Fe=o("hidden_size"),Oe=o(" x\xE1c \u0111\u1ECBnh k\xEDch th\u01B0\u1EDBc c\u1EE7a vect\u01A1 "),yn=s("code"),ze=o("hidden_states"),De=o(" v\xE0 "),$n=s("code"),He=o("num_hidden_layers"),Re=o(" x\xE1c \u0111\u1ECBnh s\u1ED1 l\u1EDBp m\xE0 m\xF4 h\xECnh Transformer c\xF3."),Kn=d(),Z=s("h3"),ot=s("a"),En=s("span"),x($t.$$.fragment),Ge=d(),wn=s("span"),Ve=o("C\xE1c ph\u01B0\u01A1ng ph\xE1p t\u1EA3i kh\xE1c nhau"),Yn=d(),Yt=s("p"),Ie=o("Vi\u1EC7c t\u1EA1o m\xF4 h\xECnh t\u1EEB c\u1EA5u h\xECnh m\u1EB7c \u0111\u1ECBnh s\u1EBD kh\u1EDFi t\u1EA1o m\xF4 h\xECnh \u0111\xF3 v\u1EDBi c\xE1c gi\xE1 tr\u1ECB ng\u1EABu nhi\xEAn:"),Un=d(),I.c(),Ut=d(),it=s("p"),Le=o("M\xF4 h\xECnh c\xF3 th\u1EC3 \u0111\u01B0\u1EE3c s\u1EED d\u1EE5ng \u1EDF tr\u1EA1ng th\xE1i n\xE0y, nh\u01B0ng n\xF3 s\u1EBD tr\u1EA3 ra v\xF4 ngh\u0129a; n\xF3 c\u1EA7n \u0111\u01B0\u1EE3c hu\u1EA5n luy\u1EC7n tr\u01B0\u1EDBc. Ch\xFAng ta c\xF3 th\u1EC3 hu\u1EA5n luy\u1EC7n m\xF4 h\xECnh t\u1EEB \u0111\u1EA7u t\xE1c v\u1EE5 n\xE0y, nh\u01B0ng nh\u01B0 b\u1EA1n \u0111\xE3 th\u1EA5y trong "),Qt=s("a"),Je=o("Ch\u01B0\u01A1ng 1"),Ke=o(", \u0111i\u1EC1u n\xE0y s\u1EBD \u0111\xF2i h\u1ECFi m\u1ED9t th\u1EDDi gian d\xE0i v\xE0 nhi\u1EC1u d\u1EEF li\u1EC7u, v\xE0 n\xF3 s\u1EBD t\xE1c \u0111\u1ED9ng \u0111\xE1ng k\u1EC3 t\u1EDBi m\xF4i tr\u01B0\u1EDDng. \u0110\u1EC3 tr\xE1nh n\u1ED7 l\u1EF1c kh\xF4ng c\u1EA7n thi\u1EBFt v\xE0 tr\xF9ng l\u1EB7p, kh\u1EA3 n\u0103ng chia s\u1EBB v\xE0 s\u1EED d\u1EE5ng l\u1EA1i c\xE1c m\xF4 h\xECnh \u0111\xE3 \u0111\u01B0\u1EE3c hu\u1EA5n luy\u1EC7n tr\u1EDF n\xEAn b\u1EAFt bu\u1ED9c."),Qn=d(),lt=s("p"),Ye=o("Vi\u1EC7c t\u1EA3i m\u1ED9t m\xF4 h\xECnh Transformer \u0111\xE3 \u0111\u01B0\u1EE3c hu\u1EA5n luy\u1EC7n tr\u01B0\u1EDBc r\u1EA5t \u0111\u01A1n gi\u1EA3n - ch\xFAng ta c\xF3 th\u1EC3 th\u1EF1c hi\u1EC7n vi\u1EC7c n\xE0y b\u1EB1ng c\xE1ch s\u1EED d\u1EE5ng ph\u01B0\u01A1ng th\u1EE9c "),Cn=s("code"),Ue=o("from_pretrained()"),Qe=o(":"),Wn=d(),J.c(),Wt=d(),z=s("p"),We=o("Trong \u0111o\u1EA1n m\xE3 \u1EDF tr\xEAn, ta kh\xF4ng s\u1EED d\u1EE5ng "),Bn=s("code"),Xe=o("BertConfig"),Ze=o(" v\xE0 thay v\xE0o \u0111\xF3, t\u1EA3i m\u1ED9t m\xF4 h\xECnh \u0111\u01B0\u1EE3c \u0111\xE0o t\u1EA1o tr\u01B0\u1EDBc th\xF4ng qua m\xE3 \u0111\u1ECBnh danh "),Mn=s("code"),tc=o("bert-base-cased"),nc=o(". \u0110\xE2y l\xE0 m\u1ED9t checkpoint m\xF4 h\xECnh do ch\xEDnh c\xE1c t\xE1c gi\u1EA3 c\u1EE7a BERT hu\u1EA5n luy\u1EC7n; b\u1EA1n c\xF3 th\u1EC3 t\xECm th\xEAm th\xF4ng tin chi ti\u1EBFt v\u1EC1 n\xF3 trong "),Et=s("a"),ec=o("th\u1EBB m\xF4 h\xECnh"),cc=o("."),Xn=d(),Xt=s("p"),hc=o("M\xF4 h\xECnh n\xE0y hi\u1EC7n \u0111\xE3 \u0111\u01B0\u1EE3c kh\u1EDFi t\u1EA1o v\u1EDBi t\u1EA5t c\u1EA3 c\xE1c tr\u1ECDng s\u1ED1 c\u1EE7a checkpoint. N\xF3 c\xF3 th\u1EC3 \u0111\u01B0\u1EE3c s\u1EED d\u1EE5ng tr\u1EF1c ti\u1EBFp \u0111\u1EC3 lu\u1EADn suy v\u1EC1 c\xE1c t\xE1c v\u1EE5 m\xE0 n\xF3 \u0111\xE3 \u0111\u01B0\u1EE3c hu\u1EA5n luy\u1EC7n, v\xE0 n\xF3 c\u0169ng c\xF3 th\u1EC3 \u0111\u01B0\u1EE3c tinh ch\u1EC9nh tr\xEAn m\u1ED9t t\xE1c v\u1EE5 m\u1EDBi. B\u1EB1ng c\xE1ch hu\u1EA5n luy\u1EC7n v\u1EDBi tr\u1ECDng s\u1ED1 \u0111\xE3 \u0111\u01B0\u1EE3c hu\u1EA5n luy\u1EC7n tr\u01B0\u1EDBc ch\u1EE9 kh\xF4ng ph\u1EA3i t\u1EEB \u0111\u1EA7u, ch\xFAng ta c\xF3 th\u1EC3 nhanh ch\xF3ng \u0111\u1EA1t \u0111\u01B0\u1EE3c k\u1EBFt qu\u1EA3 t\u1ED1t."),Zn=d(),D=s("p"),rc=o("C\xE1c tr\u1ECDng s\u1ED1 \u0111\xE3 \u0111\u01B0\u1EE3c t\u1EA3i xu\u1ED1ng v\xE0 l\u01B0u v\xE0o b\u1ED9 nh\u1EDB cache (v\xEC v\u1EADy c\xE1c l\u1EC7nh g\u1ECDi t\u1EDBi ph\u01B0\u01A1ng th\u1EE9c "),Tn=s("code"),oc=o("from_pretrained()"),ic=o(" trong t\u01B0\u01A1ng lai s\u1EBD kh\xF4ng t\u1EA3i xu\u1ED1ng l\u1EA1i ch\xFAng) trong th\u01B0 m\u1EE5c b\u1ED9 nh\u1EDB cache, m\u1EB7c \u0111\u1ECBnh l\xE0 "),jn=s("em"),lc=o("~/.cache/huggingface/transformers"),sc=o(". B\u1EA1n c\xF3 th\u1EC3 t\xF9y ch\u1EC9nh th\u01B0 m\u1EE5c b\u1ED9 nh\u1EDB cache c\u1EE7a m\xECnh b\u1EB1ng c\xE1ch \u0111\u1EB7t bi\u1EBFn m\xF4i tr\u01B0\u1EDDng "),xn=s("code"),ac=o("HF_HOME"),mc=o("."),te=d(),st=s("p"),pc=o("S\u1ED1 \u0111\u1ECBnh danh \u0111\u01B0\u1EE3c s\u1EED d\u1EE5ng \u0111\u1EC3 t\u1EA3i m\xF4 h\xECnh c\xF3 th\u1EC3 l\xE0 s\u1ED1 \u0111\u1ECBnh danh c\u1EE7a b\u1EA5t k\u1EF3 m\xF4 h\xECnh n\xE0o tr\xEAn Model Hub, mi\u1EC5n l\xE0 n\xF3 t\u01B0\u01A1ng th\xEDch v\u1EDBi ki\u1EBFn \u200B\u200Btr\xFAc BERT. To\xE0n b\u1ED9 danh s\xE1ch c\xE1c checkpoint BERT hi\u1EC7n c\xF3 c\xF3 th\u1EC3 \u0111\u01B0\u1EE3c t\xECm th\u1EA5y "),wt=s("a"),uc=o("t\u1EA1i \u0111\xE2y"),fc=o("."),ne=d(),tt=s("h3"),at=s("a"),Pn=s("span"),x(Ct.$$.fragment),gc=d(),qn=s("span"),dc=o("Ph\u01B0\u01A1ng ph\xE1p l\u01B0u tr\u1EEF checkpoint"),ee=d(),W=s("p"),_c=o("L\u01B0u m\u1ED9t m\xF4 h\xECnh c\u0169ng d\u1EC5 d\xE0ng nh\u01B0 t\u1EA3i m\u1ED9t m\xF4 h\xECnh - ch\xFAng ta s\u1EED d\u1EE5ng ph\u01B0\u01A1ng th\u1EE9c "),An=s("code"),vc=o("save_pretrained()"),kc=o(", t\u01B0\u01A1ng t\u1EF1 v\u1EDBi ph\u01B0\u01A1ng th\u1EE9c "),Nn=s("code"),bc=o("from_pretrained()"),yc=o(":"),ce=d(),x(Bt.$$.fragment),he=d(),Zt=s("p"),$c=o("Thao t\xE1c n\xE0y s\u1EBD l\u01B0u hai t\u1EC7p v\xE0o \u0111\u0129a c\u1EE7a b\u1EA1n:"),re=d(),Y.c(),tn=d(),mt=s("p"),Ec=o("N\u1EBFu b\u1EA1n xem t\u1EC7p "),Sn=s("em"),wc=o("config.json"),Cc=o(", b\u1EA1n s\u1EBD nh\u1EADn ra c\xE1c thu\u1ED9c t\xEDnh c\u1EA7n thi\u1EBFt \u0111\u1EC3 x\xE2y d\u1EF1ng ki\u1EBFn tr\xFAc m\xF4 h\xECnh. T\u1EC7p n\xE0y c\u0169ng ch\u1EE9a m\u1ED9t s\u1ED1 si\xEAu d\u1EEF li\u1EC7u, ch\u1EB3ng h\u1EA1n nh\u01B0 \u0111i\u1EC3m b\u1EAFt ngu\u1ED3n c\u1EE7a checkpoint v\xE0 phi\xEAn b\u1EA3n \u{1F917} Transformers b\u1EA1n \u0111ang s\u1EED d\u1EE5ng khi b\u1EA1n l\u01B0u checkpoint l\u1EA7n cu\u1ED1i."),oe=d(),ht.c(),nn=d(),nt=s("h2"),pt=s("a"),Fn=s("span"),x(Mt.$$.fragment),Bc=d(),On=s("span"),Mc=o("S\u1EED d\u1EE5ng m\xF4 h\xECnh Transformer \u0111\u1EC3 lu\u1EADn suy"),ie=d(),en=s("p"),Tc=o("Gi\u1EDD b\u1EA1n \u0111\xE3 bi\u1EBFt c\xE1ch t\u1EA3i v\xE0 l\u01B0u m\u1ED9t m\xF4 h\xECnh, h\xE3y th\u1EED s\u1EED d\u1EE5ng n\xF3 \u0111\u1EC3 \u0111\u01B0a ra m\u1ED9t s\u1ED1 d\u1EF1 \u0111o\xE1n. C\xE1c m\xF4 h\xECnh Transfomer ch\u1EC9 c\xF3 th\u1EC3 x\u1EED l\xFD s\u1ED1 - c\xE1c s\u1ED1 m\xE0 tokenizer t\u1EA1o ra. Nh\u01B0ng tr\u01B0\u1EDBc khi ch\xFAng ta th\u1EA3o lu\u1EADn v\u1EC1 tokenizer, ch\xFAng ta h\xE3y kh\xE1m ph\xE1 nh\u1EEFng y\u1EBFu t\u1ED1 \u0111\u1EA7u v\xE0o m\xE0 m\xF4 h\xECnh ch\u1EA5p nh\u1EADn."),le=d(),cn=s("p"),jc=o("Tokenizer c\xF3 th\u1EC3 \u0111\u1EA3m nh\u1EADn vi\u1EC7c truy\u1EC1n c\xE1c \u0111\u1EA7u v\xE0o \u0111\u1EBFn c\xE1c tensor c\u1EE7a khung th\xEDch h\u1EE3p, nh\u01B0ng \u0111\u1EC3 gi\xFAp b\u1EA1n hi\u1EC3u nh\u1EEFng g\xEC \u0111ang x\u1EA3y ra, ch\xFAng ta s\u1EBD xem x\xE9t nhanh nh\u1EEFng g\xEC ph\u1EA3i th\u1EF1c hi\u1EC7n tr\u01B0\u1EDBc khi g\u1EEDi \u0111\u1EA7u v\xE0o cho m\xF4 h\xECnh."),se=d(),hn=s("p"),xc=o("Gi\u1EA3 s\u1EED ch\xFAng ta c\xF3 m\u1ED9t v\xE0i chu\u1ED7i nh\u01B0 sau:"),ae=d(),x(Tt.$$.fragment),me=d(),ut=s("p"),Pc=o("Tokenizer chuy\u1EC3n \u0111\u1ED5i c\xE1c ch\u1EC9 s\u1ED1 n\xE0y th\xE0nh c\xE1c ch\u1EC9 m\u1EE5c t\u1EEB v\u1EF1ng th\u01B0\u1EDDng \u0111\u01B0\u1EE3c g\u1ECDi l\xE0 "),zn=s("em"),qc=o("ID \u0111\u1EA7u v\xE0o"),Ac=o(". M\u1ED7i chu\u1ED7i gi\u1EDD l\xE0 m\u1ED9t danh s\xE1ch c\xE1c s\u1ED1! K\u1EBFt qu\u1EA3 \u0111\u1EA7u ra l\xE0:"),pe=d(),x(jt.$$.fragment),ue=d(),rn=s("p"),Nc=o("\u0110\xE2y l\xE0 danh s\xE1ch c\xE1c chu\u1ED7i \u0111\u01B0\u1EE3c m\xE3 h\xF3a: danh s\xE1ch c\xE1c danh s\xE1ch. Tensor ch\u1EC9 ch\u1EA5p nh\u1EADn d\u1EA1ng h\xECnh ch\u1EEF nh\u1EADt (h\xE3y ngh\u0129 t\u1EDBi ma tr\u1EADn). \u201CM\u1EA3ng\u201D n\xE0y \u0111\xE3 c\xF3 d\u1EA1ng h\xECnh ch\u1EEF nh\u1EADt, v\xEC v\u1EADy vi\u1EC7c chuy\u1EC3n \u0111\u1ED5i n\xF3 th\xE0nh m\u1ED9t tensor r\u1EA5t d\u1EC5 d\xE0ng:"),fe=d(),Q.c(),on=d(),et=s("h3"),ft=s("a"),Dn=s("span"),x(xt.$$.fragment),Sc=d(),Hn=s("span"),Fc=o("S\u1EED d\u1EE5ng tensor l\xE0m \u0111\u1EA7u v\xE0o m\xF4 h\xECnh"),ge=d(),ln=s("p"),Oc=o("Vi\u1EC7c s\u1EED d\u1EE5ng c\xE1c tensors v\u1EDBi m\xF4 h\xECnh c\u1EF1c k\u1EF3 \u0111\u01A1n gi\u1EA3n - ch\xFAng ta ch\u1EC9 c\u1EA7n g\u1ECDi m\xF4 h\xECnh v\u1EDBi c\xE1c \u0111\u1EA7u v\xE0o:"),de=d(),x(Pt.$$.fragment),_e=d(),sn=s("p"),zc=o("M\u1EB7c d\xF9 m\xF4 h\xECnh ch\u1EA5p nh\u1EADn r\u1EA5t nhi\u1EC1u tham s\u1ED1 kh\xE1c nhau, nh\u01B0ng ch\u1EC9 c\xE1c ID \u0111\u1EA7u v\xE0o l\xE0 c\u1EA7n thi\u1EBFt. Ch\xFAng t\xF4i s\u1EBD gi\u1EA3i th\xEDch nh\u1EEFng g\xEC c\xE1c tham s\u1ED1 kh\xE1c l\xE0m v\xE0 khi n\xE0o ch\xFAng \u0111\u01B0\u1EE3c y\xEAu c\u1EA7u sau, nh\u01B0ng tr\u01B0\u1EDBc ti\xEAn, ch\xFAng ta c\u1EA7n xem x\xE9t k\u1EF9 h\u01A1n c\xE1c b\u1ED9 tokenizer t\u1EA1o ra c\xE1c \u0111\u1EA7u v\xE0o m\xE0 m\u1ED9t m\xF4 h\xECnh Transformer c\xF3 th\u1EC3 hi\u1EC3u \u0111\u01B0\u1EE3c."),this.h()},l(t){const r=Jh('[data-svelte="svelte-1phssyn"]',document.head);c=a(r,"META",{name:!0,content:!0}),r.forEach(e),l=_(t),P(n.$$.fragment,t),g=_(t),w=a(t,"H1",{class:!0});var Dt=m(w);E=a(Dt,"A",{id:!0,class:!0,href:!0});var an=m(E);C=a(an,"SPAN",{});var mn=m(C);P($.$$.fragment,mn),mn.forEach(e),an.forEach(e),B=_(Dt),j=a(Dt,"SPAN",{});var pn=m(j);v=i(pn,"C\xE1c m\xF4 h\xECnh"),pn.forEach(e),Dt.forEach(e),u=_(t),M.l(t),N=_(t),H.l(t),Gt=_(t),ct.l(t),Vt=_(t),It=a(t,"P",{});var un=m(It);xe=i(un,"Tuy nhi\xEAn, n\u1EBFu b\u1EA1n bi\u1EBFt lo\u1EA1i m\xF4 h\xECnh b\u1EA1n mu\u1ED1n s\u1EED d\u1EE5ng, b\u1EA1n c\xF3 th\u1EC3 s\u1EED d\u1EE5ng tr\u1EF1c ti\u1EBFp l\u1EDBp \u0111\u1ECBnh ngh\u0129a ki\u1EBFn tr\xFAc c\u1EE7a n\xF3. Ch\xFAng ta h\xE3y xem c\xE1ch n\xE0y ho\u1EA1t \u0111\u1ED9ng v\u1EDBi m\xF4 h\xECnh BERT."),un.forEach(e),Rn=_(t),X=a(t,"H2",{class:!0});var gt=m(X);rt=a(gt,"A",{id:!0,class:!0,href:!0});var fn=m(rt);vn=a(fn,"SPAN",{});var gn=m(vn);P(kt.$$.fragment,gn),gn.forEach(e),fn.forEach(e),Pe=_(gt),kn=a(gt,"SPAN",{});var nh=m(kn);qe=i(nh,"T\u1EA1o ra m\u1ED9t Transformer"),nh.forEach(e),gt.forEach(e),Gn=_(t),Lt=a(t,"P",{});var eh=m(Lt);Ae=i(eh,"\u0110i\u1EC1u \u0111\u1EA7u ti\xEAn ta c\u1EA7n l\xE0m \u0111\u1EC3 kh\u1EDFi t\u1EA1o m\xF4 h\xECnh BERT l\xE0 t\u1EA3i m\u1ED9t c\u1EA5u h\xECnh:"),eh.forEach(e),Vn=_(t),G.l(t),Jt=_(t),Kt=a(t,"P",{});var ch=m(Kt);Ne=i(ch,"C\u1EA5u h\xECnh ch\u1EE9a nhi\u1EC1u thu\u1ED9c t\xEDnh \u0111\u01B0\u1EE3c s\u1EED d\u1EE5ng \u0111\u1EC3 x\xE2y d\u1EF1ng m\xF4 h\xECnh:"),ch.forEach(e),In=_(t),P(bt.$$.fragment,t),Ln=_(t),P(yt.$$.fragment,t),Jn=_(t),O=a(t,"P",{});var dt=m(O);Se=i(dt,"M\u1EB7c d\xF9 b\u1EA1n ch\u01B0a th\u1EA5y t\u1EA5t c\u1EA3 c\xE1c thu\u1ED9c t\xEDnh n\xE0y c\xF3 t\xE1c d\u1EE5ng g\xEC, nh\u01B0ng b\u1EA1n n\xEAn nh\u1EADn ra m\u1ED9t s\u1ED1 trong s\u1ED1 ch\xFAng: thu\u1ED9c t\xEDnh "),bn=a(dt,"CODE",{});var hh=m(bn);Fe=i(hh,"hidden_size"),hh.forEach(e),Oe=i(dt," x\xE1c \u0111\u1ECBnh k\xEDch th\u01B0\u1EDBc c\u1EE7a vect\u01A1 "),yn=a(dt,"CODE",{});var rh=m(yn);ze=i(rh,"hidden_states"),rh.forEach(e),De=i(dt," v\xE0 "),$n=a(dt,"CODE",{});var oh=m($n);He=i(oh,"num_hidden_layers"),oh.forEach(e),Re=i(dt," x\xE1c \u0111\u1ECBnh s\u1ED1 l\u1EDBp m\xE0 m\xF4 h\xECnh Transformer c\xF3."),dt.forEach(e),Kn=_(t),Z=a(t,"H3",{class:!0});var ye=m(Z);ot=a(ye,"A",{id:!0,class:!0,href:!0});var ih=m(ot);En=a(ih,"SPAN",{});var lh=m(En);P($t.$$.fragment,lh),lh.forEach(e),ih.forEach(e),Ge=_(ye),wn=a(ye,"SPAN",{});var sh=m(wn);Ve=i(sh,"C\xE1c ph\u01B0\u01A1ng ph\xE1p t\u1EA3i kh\xE1c nhau"),sh.forEach(e),ye.forEach(e),Yn=_(t),Yt=a(t,"P",{});var ah=m(Yt);Ie=i(ah,"Vi\u1EC7c t\u1EA1o m\xF4 h\xECnh t\u1EEB c\u1EA5u h\xECnh m\u1EB7c \u0111\u1ECBnh s\u1EBD kh\u1EDFi t\u1EA1o m\xF4 h\xECnh \u0111\xF3 v\u1EDBi c\xE1c gi\xE1 tr\u1ECB ng\u1EABu nhi\xEAn:"),ah.forEach(e),Un=_(t),I.l(t),Ut=_(t),it=a(t,"P",{});var $e=m(it);Le=i($e,"M\xF4 h\xECnh c\xF3 th\u1EC3 \u0111\u01B0\u1EE3c s\u1EED d\u1EE5ng \u1EDF tr\u1EA1ng th\xE1i n\xE0y, nh\u01B0ng n\xF3 s\u1EBD tr\u1EA3 ra v\xF4 ngh\u0129a; n\xF3 c\u1EA7n \u0111\u01B0\u1EE3c hu\u1EA5n luy\u1EC7n tr\u01B0\u1EDBc. Ch\xFAng ta c\xF3 th\u1EC3 hu\u1EA5n luy\u1EC7n m\xF4 h\xECnh t\u1EEB \u0111\u1EA7u t\xE1c v\u1EE5 n\xE0y, nh\u01B0ng nh\u01B0 b\u1EA1n \u0111\xE3 th\u1EA5y trong "),Qt=a($e,"A",{href:!0});var mh=m(Qt);Je=i(mh,"Ch\u01B0\u01A1ng 1"),mh.forEach(e),Ke=i($e,", \u0111i\u1EC1u n\xE0y s\u1EBD \u0111\xF2i h\u1ECFi m\u1ED9t th\u1EDDi gian d\xE0i v\xE0 nhi\u1EC1u d\u1EEF li\u1EC7u, v\xE0 n\xF3 s\u1EBD t\xE1c \u0111\u1ED9ng \u0111\xE1ng k\u1EC3 t\u1EDBi m\xF4i tr\u01B0\u1EDDng. \u0110\u1EC3 tr\xE1nh n\u1ED7 l\u1EF1c kh\xF4ng c\u1EA7n thi\u1EBFt v\xE0 tr\xF9ng l\u1EB7p, kh\u1EA3 n\u0103ng chia s\u1EBB v\xE0 s\u1EED d\u1EE5ng l\u1EA1i c\xE1c m\xF4 h\xECnh \u0111\xE3 \u0111\u01B0\u1EE3c hu\u1EA5n luy\u1EC7n tr\u1EDF n\xEAn b\u1EAFt bu\u1ED9c."),$e.forEach(e),Qn=_(t),lt=a(t,"P",{});var Ee=m(lt);Ye=i(Ee,"Vi\u1EC7c t\u1EA3i m\u1ED9t m\xF4 h\xECnh Transformer \u0111\xE3 \u0111\u01B0\u1EE3c hu\u1EA5n luy\u1EC7n tr\u01B0\u1EDBc r\u1EA5t \u0111\u01A1n gi\u1EA3n - ch\xFAng ta c\xF3 th\u1EC3 th\u1EF1c hi\u1EC7n vi\u1EC7c n\xE0y b\u1EB1ng c\xE1ch s\u1EED d\u1EE5ng ph\u01B0\u01A1ng th\u1EE9c "),Cn=a(Ee,"CODE",{});var ph=m(Cn);Ue=i(ph,"from_pretrained()"),ph.forEach(e),Qe=i(Ee,":"),Ee.forEach(e),Wn=_(t),J.l(t),Wt=_(t),z=a(t,"P",{});var _t=m(z);We=i(_t,"Trong \u0111o\u1EA1n m\xE3 \u1EDF tr\xEAn, ta kh\xF4ng s\u1EED d\u1EE5ng "),Bn=a(_t,"CODE",{});var uh=m(Bn);Xe=i(uh,"BertConfig"),uh.forEach(e),Ze=i(_t," v\xE0 thay v\xE0o \u0111\xF3, t\u1EA3i m\u1ED9t m\xF4 h\xECnh \u0111\u01B0\u1EE3c \u0111\xE0o t\u1EA1o tr\u01B0\u1EDBc th\xF4ng qua m\xE3 \u0111\u1ECBnh danh "),Mn=a(_t,"CODE",{});var fh=m(Mn);tc=i(fh,"bert-base-cased"),fh.forEach(e),nc=i(_t,". \u0110\xE2y l\xE0 m\u1ED9t checkpoint m\xF4 h\xECnh do ch\xEDnh c\xE1c t\xE1c gi\u1EA3 c\u1EE7a BERT hu\u1EA5n luy\u1EC7n; b\u1EA1n c\xF3 th\u1EC3 t\xECm th\xEAm th\xF4ng tin chi ti\u1EBFt v\u1EC1 n\xF3 trong "),Et=a(_t,"A",{href:!0,rel:!0});var gh=m(Et);ec=i(gh,"th\u1EBB m\xF4 h\xECnh"),gh.forEach(e),cc=i(_t,"."),_t.forEach(e),Xn=_(t),Xt=a(t,"P",{});var dh=m(Xt);hc=i(dh,"M\xF4 h\xECnh n\xE0y hi\u1EC7n \u0111\xE3 \u0111\u01B0\u1EE3c kh\u1EDFi t\u1EA1o v\u1EDBi t\u1EA5t c\u1EA3 c\xE1c tr\u1ECDng s\u1ED1 c\u1EE7a checkpoint. N\xF3 c\xF3 th\u1EC3 \u0111\u01B0\u1EE3c s\u1EED d\u1EE5ng tr\u1EF1c ti\u1EBFp \u0111\u1EC3 lu\u1EADn suy v\u1EC1 c\xE1c t\xE1c v\u1EE5 m\xE0 n\xF3 \u0111\xE3 \u0111\u01B0\u1EE3c hu\u1EA5n luy\u1EC7n, v\xE0 n\xF3 c\u0169ng c\xF3 th\u1EC3 \u0111\u01B0\u1EE3c tinh ch\u1EC9nh tr\xEAn m\u1ED9t t\xE1c v\u1EE5 m\u1EDBi. B\u1EB1ng c\xE1ch hu\u1EA5n luy\u1EC7n v\u1EDBi tr\u1ECDng s\u1ED1 \u0111\xE3 \u0111\u01B0\u1EE3c hu\u1EA5n luy\u1EC7n tr\u01B0\u1EDBc ch\u1EE9 kh\xF4ng ph\u1EA3i t\u1EEB \u0111\u1EA7u, ch\xFAng ta c\xF3 th\u1EC3 nhanh ch\xF3ng \u0111\u1EA1t \u0111\u01B0\u1EE3c k\u1EBFt qu\u1EA3 t\u1ED1t."),dh.forEach(e),Zn=_(t),D=a(t,"P",{});var vt=m(D);rc=i(vt,"C\xE1c tr\u1ECDng s\u1ED1 \u0111\xE3 \u0111\u01B0\u1EE3c t\u1EA3i xu\u1ED1ng v\xE0 l\u01B0u v\xE0o b\u1ED9 nh\u1EDB cache (v\xEC v\u1EADy c\xE1c l\u1EC7nh g\u1ECDi t\u1EDBi ph\u01B0\u01A1ng th\u1EE9c "),Tn=a(vt,"CODE",{});var _h=m(Tn);oc=i(_h,"from_pretrained()"),_h.forEach(e),ic=i(vt," trong t\u01B0\u01A1ng lai s\u1EBD kh\xF4ng t\u1EA3i xu\u1ED1ng l\u1EA1i ch\xFAng) trong th\u01B0 m\u1EE5c b\u1ED9 nh\u1EDB cache, m\u1EB7c \u0111\u1ECBnh l\xE0 "),jn=a(vt,"EM",{});var vh=m(jn);lc=i(vh,"~/.cache/huggingface/transformers"),vh.forEach(e),sc=i(vt,". B\u1EA1n c\xF3 th\u1EC3 t\xF9y ch\u1EC9nh th\u01B0 m\u1EE5c b\u1ED9 nh\u1EDB cache c\u1EE7a m\xECnh b\u1EB1ng c\xE1ch \u0111\u1EB7t bi\u1EBFn m\xF4i tr\u01B0\u1EDDng "),xn=a(vt,"CODE",{});var kh=m(xn);ac=i(kh,"HF_HOME"),kh.forEach(e),mc=i(vt,"."),vt.forEach(e),te=_(t),st=a(t,"P",{});var we=m(st);pc=i(we,"S\u1ED1 \u0111\u1ECBnh danh \u0111\u01B0\u1EE3c s\u1EED d\u1EE5ng \u0111\u1EC3 t\u1EA3i m\xF4 h\xECnh c\xF3 th\u1EC3 l\xE0 s\u1ED1 \u0111\u1ECBnh danh c\u1EE7a b\u1EA5t k\u1EF3 m\xF4 h\xECnh n\xE0o tr\xEAn Model Hub, mi\u1EC5n l\xE0 n\xF3 t\u01B0\u01A1ng th\xEDch v\u1EDBi ki\u1EBFn \u200B\u200Btr\xFAc BERT. To\xE0n b\u1ED9 danh s\xE1ch c\xE1c checkpoint BERT hi\u1EC7n c\xF3 c\xF3 th\u1EC3 \u0111\u01B0\u1EE3c t\xECm th\u1EA5y "),wt=a(we,"A",{href:!0,rel:!0});var bh=m(wt);uc=i(bh,"t\u1EA1i \u0111\xE2y"),bh.forEach(e),fc=i(we,"."),we.forEach(e),ne=_(t),tt=a(t,"H3",{class:!0});var Ce=m(tt);at=a(Ce,"A",{id:!0,class:!0,href:!0});var yh=m(at);Pn=a(yh,"SPAN",{});var $h=m(Pn);P(Ct.$$.fragment,$h),$h.forEach(e),yh.forEach(e),gc=_(Ce),qn=a(Ce,"SPAN",{});var Eh=m(qn);dc=i(Eh,"Ph\u01B0\u01A1ng ph\xE1p l\u01B0u tr\u1EEF checkpoint"),Eh.forEach(e),Ce.forEach(e),ee=_(t),W=a(t,"P",{});var dn=m(W);_c=i(dn,"L\u01B0u m\u1ED9t m\xF4 h\xECnh c\u0169ng d\u1EC5 d\xE0ng nh\u01B0 t\u1EA3i m\u1ED9t m\xF4 h\xECnh - ch\xFAng ta s\u1EED d\u1EE5ng ph\u01B0\u01A1ng th\u1EE9c "),An=a(dn,"CODE",{});var wh=m(An);vc=i(wh,"save_pretrained()"),wh.forEach(e),kc=i(dn,", t\u01B0\u01A1ng t\u1EF1 v\u1EDBi ph\u01B0\u01A1ng th\u1EE9c "),Nn=a(dn,"CODE",{});var Ch=m(Nn);bc=i(Ch,"from_pretrained()"),Ch.forEach(e),yc=i(dn,":"),dn.forEach(e),ce=_(t),P(Bt.$$.fragment,t),he=_(t),Zt=a(t,"P",{});var Bh=m(Zt);$c=i(Bh,"Thao t\xE1c n\xE0y s\u1EBD l\u01B0u hai t\u1EC7p v\xE0o \u0111\u0129a c\u1EE7a b\u1EA1n:"),Bh.forEach(e),re=_(t),Y.l(t),tn=_(t),mt=a(t,"P",{});var Be=m(mt);Ec=i(Be,"N\u1EBFu b\u1EA1n xem t\u1EC7p "),Sn=a(Be,"EM",{});var Mh=m(Sn);wc=i(Mh,"config.json"),Mh.forEach(e),Cc=i(Be,", b\u1EA1n s\u1EBD nh\u1EADn ra c\xE1c thu\u1ED9c t\xEDnh c\u1EA7n thi\u1EBFt \u0111\u1EC3 x\xE2y d\u1EF1ng ki\u1EBFn tr\xFAc m\xF4 h\xECnh. T\u1EC7p n\xE0y c\u0169ng ch\u1EE9a m\u1ED9t s\u1ED1 si\xEAu d\u1EEF li\u1EC7u, ch\u1EB3ng h\u1EA1n nh\u01B0 \u0111i\u1EC3m b\u1EAFt ngu\u1ED3n c\u1EE7a checkpoint v\xE0 phi\xEAn b\u1EA3n \u{1F917} Transformers b\u1EA1n \u0111ang s\u1EED d\u1EE5ng khi b\u1EA1n l\u01B0u checkpoint l\u1EA7n cu\u1ED1i."),Be.forEach(e),oe=_(t),ht.l(t),nn=_(t),nt=a(t,"H2",{class:!0});var Me=m(nt);pt=a(Me,"A",{id:!0,class:!0,href:!0});var Th=m(pt);Fn=a(Th,"SPAN",{});var jh=m(Fn);P(Mt.$$.fragment,jh),jh.forEach(e),Th.forEach(e),Bc=_(Me),On=a(Me,"SPAN",{});var xh=m(On);Mc=i(xh,"S\u1EED d\u1EE5ng m\xF4 h\xECnh Transformer \u0111\u1EC3 lu\u1EADn suy"),xh.forEach(e),Me.forEach(e),ie=_(t),en=a(t,"P",{});var Ph=m(en);Tc=i(Ph,"Gi\u1EDD b\u1EA1n \u0111\xE3 bi\u1EBFt c\xE1ch t\u1EA3i v\xE0 l\u01B0u m\u1ED9t m\xF4 h\xECnh, h\xE3y th\u1EED s\u1EED d\u1EE5ng n\xF3 \u0111\u1EC3 \u0111\u01B0a ra m\u1ED9t s\u1ED1 d\u1EF1 \u0111o\xE1n. C\xE1c m\xF4 h\xECnh Transfomer ch\u1EC9 c\xF3 th\u1EC3 x\u1EED l\xFD s\u1ED1 - c\xE1c s\u1ED1 m\xE0 tokenizer t\u1EA1o ra. Nh\u01B0ng tr\u01B0\u1EDBc khi ch\xFAng ta th\u1EA3o lu\u1EADn v\u1EC1 tokenizer, ch\xFAng ta h\xE3y kh\xE1m ph\xE1 nh\u1EEFng y\u1EBFu t\u1ED1 \u0111\u1EA7u v\xE0o m\xE0 m\xF4 h\xECnh ch\u1EA5p nh\u1EADn."),Ph.forEach(e),le=_(t),cn=a(t,"P",{});var qh=m(cn);jc=i(qh,"Tokenizer c\xF3 th\u1EC3 \u0111\u1EA3m nh\u1EADn vi\u1EC7c truy\u1EC1n c\xE1c \u0111\u1EA7u v\xE0o \u0111\u1EBFn c\xE1c tensor c\u1EE7a khung th\xEDch h\u1EE3p, nh\u01B0ng \u0111\u1EC3 gi\xFAp b\u1EA1n hi\u1EC3u nh\u1EEFng g\xEC \u0111ang x\u1EA3y ra, ch\xFAng ta s\u1EBD xem x\xE9t nhanh nh\u1EEFng g\xEC ph\u1EA3i th\u1EF1c hi\u1EC7n tr\u01B0\u1EDBc khi g\u1EEDi \u0111\u1EA7u v\xE0o cho m\xF4 h\xECnh."),qh.forEach(e),se=_(t),hn=a(t,"P",{});var Ah=m(hn);xc=i(Ah,"Gi\u1EA3 s\u1EED ch\xFAng ta c\xF3 m\u1ED9t v\xE0i chu\u1ED7i nh\u01B0 sau:"),Ah.forEach(e),ae=_(t),P(Tt.$$.fragment,t),me=_(t),ut=a(t,"P",{});var Te=m(ut);Pc=i(Te,"Tokenizer chuy\u1EC3n \u0111\u1ED5i c\xE1c ch\u1EC9 s\u1ED1 n\xE0y th\xE0nh c\xE1c ch\u1EC9 m\u1EE5c t\u1EEB v\u1EF1ng th\u01B0\u1EDDng \u0111\u01B0\u1EE3c g\u1ECDi l\xE0 "),zn=a(Te,"EM",{});var Nh=m(zn);qc=i(Nh,"ID \u0111\u1EA7u v\xE0o"),Nh.forEach(e),Ac=i(Te,". M\u1ED7i chu\u1ED7i gi\u1EDD l\xE0 m\u1ED9t danh s\xE1ch c\xE1c s\u1ED1! K\u1EBFt qu\u1EA3 \u0111\u1EA7u ra l\xE0:"),Te.forEach(e),pe=_(t),P(jt.$$.fragment,t),ue=_(t),rn=a(t,"P",{});var Sh=m(rn);Nc=i(Sh,"\u0110\xE2y l\xE0 danh s\xE1ch c\xE1c chu\u1ED7i \u0111\u01B0\u1EE3c m\xE3 h\xF3a: danh s\xE1ch c\xE1c danh s\xE1ch. Tensor ch\u1EC9 ch\u1EA5p nh\u1EADn d\u1EA1ng h\xECnh ch\u1EEF nh\u1EADt (h\xE3y ngh\u0129 t\u1EDBi ma tr\u1EADn). \u201CM\u1EA3ng\u201D n\xE0y \u0111\xE3 c\xF3 d\u1EA1ng h\xECnh ch\u1EEF nh\u1EADt, v\xEC v\u1EADy vi\u1EC7c chuy\u1EC3n \u0111\u1ED5i n\xF3 th\xE0nh m\u1ED9t tensor r\u1EA5t d\u1EC5 d\xE0ng:"),Sh.forEach(e),fe=_(t),Q.l(t),on=_(t),et=a(t,"H3",{class:!0});var je=m(et);ft=a(je,"A",{id:!0,class:!0,href:!0});var Fh=m(ft);Dn=a(Fh,"SPAN",{});var Oh=m(Dn);P(xt.$$.fragment,Oh),Oh.forEach(e),Fh.forEach(e),Sc=_(je),Hn=a(je,"SPAN",{});var zh=m(Hn);Fc=i(zh,"S\u1EED d\u1EE5ng tensor l\xE0m \u0111\u1EA7u v\xE0o m\xF4 h\xECnh"),zh.forEach(e),je.forEach(e),ge=_(t),ln=a(t,"P",{});var Dh=m(ln);Oc=i(Dh,"Vi\u1EC7c s\u1EED d\u1EE5ng c\xE1c tensors v\u1EDBi m\xF4 h\xECnh c\u1EF1c k\u1EF3 \u0111\u01A1n gi\u1EA3n - ch\xFAng ta ch\u1EC9 c\u1EA7n g\u1ECDi m\xF4 h\xECnh v\u1EDBi c\xE1c \u0111\u1EA7u v\xE0o:"),Dh.forEach(e),de=_(t),P(Pt.$$.fragment,t),_e=_(t),sn=a(t,"P",{});var Hh=m(sn);zc=i(Hh,"M\u1EB7c d\xF9 m\xF4 h\xECnh ch\u1EA5p nh\u1EADn r\u1EA5t nhi\u1EC1u tham s\u1ED1 kh\xE1c nhau, nh\u01B0ng ch\u1EC9 c\xE1c ID \u0111\u1EA7u v\xE0o l\xE0 c\u1EA7n thi\u1EBFt. Ch\xFAng t\xF4i s\u1EBD gi\u1EA3i th\xEDch nh\u1EEFng g\xEC c\xE1c tham s\u1ED1 kh\xE1c l\xE0m v\xE0 khi n\xE0o ch\xFAng \u0111\u01B0\u1EE3c y\xEAu c\u1EA7u sau, nh\u01B0ng tr\u01B0\u1EDBc ti\xEAn, ch\xFAng ta c\u1EA7n xem x\xE9t k\u1EF9 h\u01A1n c\xE1c b\u1ED9 tokenizer t\u1EA1o ra c\xE1c \u0111\u1EA7u v\xE0o m\xE0 m\u1ED9t m\xF4 h\xECnh Transformer c\xF3 th\u1EC3 hi\u1EC3u \u0111\u01B0\u1EE3c."),Hh.forEach(e),this.h()},h(){T(c,"name","hf:doc:metadata"),T(c,"content",JSON.stringify(fr)),T(E,"id","cc-m-hnh"),T(E,"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"),T(E,"href","#cc-m-hnh"),T(w,"class","relative group"),T(rt,"id","to-ra-mt-transformer"),T(rt,"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"),T(rt,"href","#to-ra-mt-transformer"),T(X,"class","relative group"),T(ot,"id","cc-phng-php-ti-khc-nhau"),T(ot,"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"),T(ot,"href","#cc-phng-php-ti-khc-nhau"),T(Z,"class","relative group"),T(Qt,"href","/course/chapter1"),T(Et,"href","https://huggingface.co/bert-base-cased"),T(Et,"rel","nofollow"),T(wt,"href","https://huggingface.co/models?filter=bert"),T(wt,"rel","nofollow"),T(at,"id","phng-php-lu-tr-checkpoint"),T(at,"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"),T(at,"href","#phng-php-lu-tr-checkpoint"),T(tt,"class","relative group"),T(pt,"id","s-dng-m-hnh-transformer-lun-suy"),T(pt,"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"),T(pt,"href","#s-dng-m-hnh-transformer-lun-suy"),T(nt,"class","relative group"),T(ft,"id","s-dng-tensor-lm-u-vo-m-hnh"),T(ft,"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"),T(ft,"href","#s-dng-tensor-lm-u-vo-m-hnh"),T(et,"class","relative group")},m(t,r){h(document.head,c),p(t,l,r),q(n,t,r),p(t,g,r),p(t,w,r),h(w,E),h(E,C),q($,C,null),h(w,B),h(w,j),h(j,v),p(t,u,r),qt[f].m(t,r),p(t,N,r),At[S].m(t,r),p(t,Gt,r),ct.m(t,r),p(t,Vt,r),p(t,It,r),h(It,xe),p(t,Rn,r),p(t,X,r),h(X,rt),h(rt,vn),q(kt,vn,null),h(X,Pe),h(X,kn),h(kn,qe),p(t,Gn,r),p(t,Lt,r),h(Lt,Ae),p(t,Vn,r),Nt[R].m(t,r),p(t,Jt,r),p(t,Kt,r),h(Kt,Ne),p(t,In,r),q(bt,t,r),p(t,Ln,r),q(yt,t,r),p(t,Jn,r),p(t,O,r),h(O,Se),h(O,bn),h(bn,Fe),h(O,Oe),h(O,yn),h(yn,ze),h(O,De),h(O,$n),h($n,He),h(O,Re),p(t,Kn,r),p(t,Z,r),h(Z,ot),h(ot,En),q($t,En,null),h(Z,Ge),h(Z,wn),h(wn,Ve),p(t,Yn,r),p(t,Yt,r),h(Yt,Ie),p(t,Un,r),St[V].m(t,r),p(t,Ut,r),p(t,it,r),h(it,Le),h(it,Qt),h(Qt,Je),h(it,Ke),p(t,Qn,r),p(t,lt,r),h(lt,Ye),h(lt,Cn),h(Cn,Ue),h(lt,Qe),p(t,Wn,r),Ft[L].m(t,r),p(t,Wt,r),p(t,z,r),h(z,We),h(z,Bn),h(Bn,Xe),h(z,Ze),h(z,Mn),h(Mn,tc),h(z,nc),h(z,Et),h(Et,ec),h(z,cc),p(t,Xn,r),p(t,Xt,r),h(Xt,hc),p(t,Zn,r),p(t,D,r),h(D,rc),h(D,Tn),h(Tn,oc),h(D,ic),h(D,jn),h(jn,lc),h(D,sc),h(D,xn),h(xn,ac),h(D,mc),p(t,te,r),p(t,st,r),h(st,pc),h(st,wt),h(wt,uc),h(st,fc),p(t,ne,r),p(t,tt,r),h(tt,at),h(at,Pn),q(Ct,Pn,null),h(tt,gc),h(tt,qn),h(qn,dc),p(t,ee,r),p(t,W,r),h(W,_c),h(W,An),h(An,vc),h(W,kc),h(W,Nn),h(Nn,bc),h(W,yc),p(t,ce,r),q(Bt,t,r),p(t,he,r),p(t,Zt,r),h(Zt,$c),p(t,re,r),Ot[K].m(t,r),p(t,tn,r),p(t,mt,r),h(mt,Ec),h(mt,Sn),h(Sn,wc),h(mt,Cc),p(t,oe,r),ht.m(t,r),p(t,nn,r),p(t,nt,r),h(nt,pt),h(pt,Fn),q(Mt,Fn,null),h(nt,Bc),h(nt,On),h(On,Mc),p(t,ie,r),p(t,en,r),h(en,Tc),p(t,le,r),p(t,cn,r),h(cn,jc),p(t,se,r),p(t,hn,r),h(hn,xc),p(t,ae,r),q(Tt,t,r),p(t,me,r),p(t,ut,r),h(ut,Pc),h(ut,zn),h(zn,qc),h(ut,Ac),p(t,pe,r),q(jt,t,r),p(t,ue,r),p(t,rn,r),h(rn,Nc),p(t,fe,r),zt[U].m(t,r),p(t,on,r),p(t,et,r),h(et,ft),h(ft,Dn),q(xt,Dn,null),h(et,Sc),h(et,Hn),h(Hn,Fc),p(t,ge,r),p(t,ln,r),h(ln,Oc),p(t,de,r),q(Pt,t,r),p(t,_e,r),p(t,sn,r),h(sn,zc),ve=!0},p(t,[r]){const Dt={};r&1&&(Dt.fw=t[0]),n.$set(Dt);let an=f;f=Hc(t),f!==an&&(Rt(),k(qt[an],1,1,()=>{qt[an]=null}),Ht(),M=qt[f],M||(M=qt[f]=Dc[f](t),M.c()),b(M,1),M.m(N.parentNode,N));let mn=S;S=Gc(t),S!==mn&&(Rt(),k(At[mn],1,1,()=>{At[mn]=null}),Ht(),H=At[S],H||(H=At[S]=Rc[S](t),H.c()),b(H,1),H.m(Gt.parentNode,Gt)),ke!==(ke=Vc(t))&&(ct.d(1),ct=ke(t),ct&&(ct.c(),ct.m(Vt.parentNode,Vt)));let pn=R;R=Lc(t),R!==pn&&(Rt(),k(Nt[pn],1,1,()=>{Nt[pn]=null}),Ht(),G=Nt[R],G||(G=Nt[R]=Ic[R](t),G.c()),b(G,1),G.m(Jt.parentNode,Jt));let un=V;V=Kc(t),V!==un&&(Rt(),k(St[un],1,1,()=>{St[un]=null}),Ht(),I=St[V],I||(I=St[V]=Jc[V](t),I.c()),b(I,1),I.m(Ut.parentNode,Ut));let gt=L;L=Uc(t),L!==gt&&(Rt(),k(Ft[gt],1,1,()=>{Ft[gt]=null}),Ht(),J=Ft[L],J||(J=Ft[L]=Yc[L](t),J.c()),b(J,1),J.m(Wt.parentNode,Wt));let fn=K;K=Wc(t),K!==fn&&(Rt(),k(Ot[fn],1,1,()=>{Ot[fn]=null}),Ht(),Y=Ot[K],Y||(Y=Ot[K]=Qc[K](t),Y.c()),b(Y,1),Y.m(tn.parentNode,tn)),be!==(be=Xc(t))&&(ht.d(1),ht=be(t),ht&&(ht.c(),ht.m(nn.parentNode,nn)));let gn=U;U=th(t),U!==gn&&(Rt(),k(zt[gn],1,1,()=>{zt[gn]=null}),Ht(),Q=zt[U],Q||(Q=zt[U]=Zc[U](t),Q.c()),b(Q,1),Q.m(on.parentNode,on))},i(t){ve||(b(n.$$.fragment,t),b($.$$.fragment,t),b(M),b(H),b(kt.$$.fragment,t),b(G),b(bt.$$.fragment,t),b(yt.$$.fragment,t),b($t.$$.fragment,t),b(I),b(J),b(Ct.$$.fragment,t),b(Bt.$$.fragment,t),b(Y),b(Mt.$$.fragment,t),b(Tt.$$.fragment,t),b(jt.$$.fragment,t),b(Q),b(xt.$$.fragment,t),b(Pt.$$.fragment,t),ve=!0)},o(t){k(n.$$.fragment,t),k($.$$.fragment,t),k(M),k(H),k(kt.$$.fragment,t),k(G),k(bt.$$.fragment,t),k(yt.$$.fragment,t),k($t.$$.fragment,t),k(I),k(J),k(Ct.$$.fragment,t),k(Bt.$$.fragment,t),k(Y),k(Mt.$$.fragment,t),k(Tt.$$.fragment,t),k(jt.$$.fragment,t),k(Q),k(xt.$$.fragment,t),k(Pt.$$.fragment,t),ve=!1},d(t){e(c),t&&e(l),A(n,t),t&&e(g),t&&e(w),A($),t&&e(u),qt[f].d(t),t&&e(N),At[S].d(t),t&&e(Gt),ct.d(t),t&&e(Vt),t&&e(It),t&&e(Rn),t&&e(X),A(kt),t&&e(Gn),t&&e(Lt),t&&e(Vn),Nt[R].d(t),t&&e(Jt),t&&e(Kt),t&&e(In),A(bt,t),t&&e(Ln),A(yt,t),t&&e(Jn),t&&e(O),t&&e(Kn),t&&e(Z),A($t),t&&e(Yn),t&&e(Yt),t&&e(Un),St[V].d(t),t&&e(Ut),t&&e(it),t&&e(Qn),t&&e(lt),t&&e(Wn),Ft[L].d(t),t&&e(Wt),t&&e(z),t&&e(Xn),t&&e(Xt),t&&e(Zn),t&&e(D),t&&e(te),t&&e(st),t&&e(ne),t&&e(tt),A(Ct),t&&e(ee),t&&e(W),t&&e(ce),A(Bt,t),t&&e(he),t&&e(Zt),t&&e(re),Ot[K].d(t),t&&e(tn),t&&e(mt),t&&e(oe),ht.d(t),t&&e(nn),t&&e(nt),A(Mt),t&&e(ie),t&&e(en),t&&e(le),t&&e(cn),t&&e(se),t&&e(hn),t&&e(ae),A(Tt,t),t&&e(me),t&&e(ut),t&&e(pe),A(jt,t),t&&e(ue),t&&e(rn),t&&e(fe),zt[U].d(t),t&&e(on),t&&e(et),A(xt),t&&e(ge),t&&e(ln),t&&e(de),A(Pt,t),t&&e(_e),t&&e(sn)}}}const fr={local:"cc-m-hnh",sections:[{local:"to-ra-mt-transformer",sections:[{local:"cc-phng-php-ti-khc-nhau",title:"C\xE1c ph\u01B0\u01A1ng ph\xE1p t\u1EA3i kh\xE1c nhau"},{local:"phng-php-lu-tr-checkpoint",title:"Ph\u01B0\u01A1ng ph\xE1p l\u01B0u tr\u1EEF checkpoint"}],title:"T\u1EA1o ra m\u1ED9t Transformer"},{local:"s-dng-m-hnh-transformer-lun-suy",sections:[{local:"s-dng-tensor-lm-u-vo-m-hnh",title:"S\u1EED d\u1EE5ng tensor l\xE0m \u0111\u1EA7u v\xE0o m\xF4 h\xECnh"}],title:"S\u1EED d\u1EE5ng m\xF4 h\xECnh Transformer \u0111\u1EC3 lu\u1EADn suy"}],title:"C\xE1c m\xF4 h\xECnh"};function gr(y,c,l){let n="pt";return Kh(()=>{const g=new URLSearchParams(window.location.search);l(0,n=g.get("fw")||"pt")}),[n]}class Er extends Vh{constructor(c){super();Ih(this,c,gr,ur,Lh,{})}}export{Er as default,fr as metadata};
