import{S as rf,i as cf,s as of,e as l,k as o,w as u,t as h,M as pf,c as r,d as t,m as p,x as m,a as c,h as i,b as k,G as e,g as s,y as g,q as d,o as f,B as b,v as uf}from"../../chunks/vendor-hf-doc-builder.js";import{T as Pe}from"../../chunks/Tip-hf-doc-builder.js";import{Y as mf}from"../../chunks/Youtube-hf-doc-builder.js";import{I as V}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{C as y}from"../../chunks/CodeBlock-hf-doc-builder.js";import{D as gf}from"../../chunks/DocNotebookDropdown-hf-doc-builder.js";import{F as df}from"../../chunks/FrameworkSwitchCourse-hf-doc-builder.js";function ff(P){let v,w,_,$,q;return{c(){v=l("p"),w=h("\u270F\uFE0F "),_=l("strong"),$=h("\u0110\u1EBFn l\u01B0\u1EE3t b\u1EA1n!"),q=h(" Ki\u1EC3m tra xem m\u1ECDi th\u1EE9 c\xF3 ch\xEDnh x\xE1c kh\xF4ng v\u1EDBi ph\u1EA7n t\u1EED th\u1EE9 hai c\u1EE7a t\u1EADp d\u1EEF li\u1EC7u hu\u1EA5n luy\u1EC7n.")},l(j){v=r(j,"P",{});var E=c(v);w=i(E,"\u270F\uFE0F "),_=r(E,"STRONG",{});var x=c(_);$=i(x,"\u0110\u1EBFn l\u01B0\u1EE3t b\u1EA1n!"),x.forEach(t),q=i(E," Ki\u1EC3m tra xem m\u1ECDi th\u1EE9 c\xF3 ch\xEDnh x\xE1c kh\xF4ng v\u1EDBi ph\u1EA7n t\u1EED th\u1EE9 hai c\u1EE7a t\u1EADp d\u1EEF li\u1EC7u hu\u1EA5n luy\u1EC7n."),E.forEach(t)},m(j,E){s(j,v,E),e(v,w),e(v,_),e(_,$),e(v,q)},d(j){j&&t(v)}}}function bf(P){let v,w;return{c(){v=l("p"),w=h("Trong ph\u1EA7n ti\u1EBFp theo c\u1EE7a kh\xF3a h\u1ECDc, ch\xFAng ta s\u1EBD xem x\xE9t c\xE1c k\u1EF9 thu\u1EADt n\xE2ng cao h\u01A1n c\xF3 th\u1EC3 gi\xFAp b\u1EA1n gi\u1EA3m dung l\u01B0\u1EE3ng b\u1ED9 nh\u1EDB v\xE0 cho ph\xE9p b\u1EA1n tinh ch\u1EC9nh c\xE1c m\xF4 h\xECnh l\u1EDBn nh\u1EA5t.")},l(_){v=r(_,"P",{});var $=c(v);w=i($,"Trong ph\u1EA7n ti\u1EBFp theo c\u1EE7a kh\xF3a h\u1ECDc, ch\xFAng ta s\u1EBD xem x\xE9t c\xE1c k\u1EF9 thu\u1EADt n\xE2ng cao h\u01A1n c\xF3 th\u1EC3 gi\xFAp b\u1EA1n gi\u1EA3m dung l\u01B0\u1EE3ng b\u1ED9 nh\u1EDB v\xE0 cho ph\xE9p b\u1EA1n tinh ch\u1EC9nh c\xE1c m\xF4 h\xECnh l\u1EDBn nh\u1EA5t."),$.forEach(t)},m(_,$){s(_,v,$),e(v,w)},d(_){_&&t(v)}}}function vf(P){let v,w,_,$,q,j,E,x;return{c(){v=l("p"),w=h("\u{1F4A1} B\u1EA1n ph\u1EA3i lu\xF4n \u0111\u1EA3m b\u1EA3o r\u1EB1ng m\xECnh c\xF3 th\u1EC3 ch\u1EA1y "),_=l("code"),$=h("trainr.evaluate()"),q=h(" tr\u01B0\u1EDBc khi kh\u1EDFi ch\u1EA1y "),j=l("code"),E=h("trainer.train()"),x=h(", \u0111\u1EC3 tr\xE1nh l\xE3ng ph\xED nhi\u1EC1u t\xE0i nguy\xEAn m\xE1y t\xEDnh tr\u01B0\u1EDBc khi g\u1EB7p l\u1ED7i.")},l(A){v=r(A,"P",{});var C=c(v);w=i(C,"\u{1F4A1} B\u1EA1n ph\u1EA3i lu\xF4n \u0111\u1EA3m b\u1EA3o r\u1EB1ng m\xECnh c\xF3 th\u1EC3 ch\u1EA1y "),_=r(C,"CODE",{});var I=c(_);$=i(I,"trainr.evaluate()"),I.forEach(t),q=i(C," tr\u01B0\u1EDBc khi kh\u1EDFi ch\u1EA1y "),j=r(C,"CODE",{});var O=c(j);E=i(O,"trainer.train()"),O.forEach(t),x=i(C,", \u0111\u1EC3 tr\xE1nh l\xE3ng ph\xED nhi\u1EC1u t\xE0i nguy\xEAn m\xE1y t\xEDnh tr\u01B0\u1EDBc khi g\u1EB7p l\u1ED7i."),C.forEach(t)},m(A,C){s(A,v,C),e(v,w),e(v,_),e(_,$),e(v,q),e(v,j),e(j,E),e(v,x)},d(A){A&&t(v)}}}function kf(P){let v,w,_,$,q,j,E,x,A,C,I;return{c(){v=l("p"),w=h("\u{1F4A1} N\u1EBFu b\u1EA1n \u0111ang s\u1EED d\u1EE5ng v\xF2ng l\u1EB7p hu\u1EA5n luy\u1EC7n th\u1EE7 c\xF4ng, c\xE1c b\u01B0\u1EDBc t\u01B0\u01A1ng t\u1EF1 s\u1EBD \xE1p d\u1EE5ng \u0111\u1EC3 g\u1EE1 l\u1ED7i quy tr\xECnh hu\u1EA5n luy\u1EC7n c\u1EE7a b\u1EA1n, nh\u01B0ng vi\u1EC7c t\xE1ch ch\xFAng ra s\u1EBD d\u1EC5 d\xE0ng h\u01A1n. Tuy nhi\xEAn, h\xE3y \u0111\u1EA3m b\u1EA3o r\u1EB1ng b\u1EA1n kh\xF4ng qu\xEAn "),_=l("code"),$=h("model.eval()"),q=h(" ho\u1EB7c "),j=l("code"),E=h("model.train()"),x=h(" \u1EDF \u0111\xFAng n\u01A1i, ho\u1EB7c "),A=l("code"),C=h("zero_grad()"),I=h(" \u1EDF m\u1ED7i b\u01B0\u1EDBc!")},l(O){v=r(O,"P",{});var T=c(v);w=i(T,"\u{1F4A1} N\u1EBFu b\u1EA1n \u0111ang s\u1EED d\u1EE5ng v\xF2ng l\u1EB7p hu\u1EA5n luy\u1EC7n th\u1EE7 c\xF4ng, c\xE1c b\u01B0\u1EDBc t\u01B0\u01A1ng t\u1EF1 s\u1EBD \xE1p d\u1EE5ng \u0111\u1EC3 g\u1EE1 l\u1ED7i quy tr\xECnh hu\u1EA5n luy\u1EC7n c\u1EE7a b\u1EA1n, nh\u01B0ng vi\u1EC7c t\xE1ch ch\xFAng ra s\u1EBD d\u1EC5 d\xE0ng h\u01A1n. Tuy nhi\xEAn, h\xE3y \u0111\u1EA3m b\u1EA3o r\u1EB1ng b\u1EA1n kh\xF4ng qu\xEAn "),_=r(T,"CODE",{});var it=c(_);$=i(it,"model.eval()"),it.forEach(t),q=i(T," ho\u1EB7c "),j=r(T,"CODE",{});var U=c(j);E=i(U,"model.train()"),U.forEach(t),x=i(T," \u1EDF \u0111\xFAng n\u01A1i, ho\u1EB7c "),A=r(T,"CODE",{});var Ae=c(A);C=i(Ae,"zero_grad()"),Ae.forEach(t),I=i(T," \u1EDF m\u1ED7i b\u01B0\u1EDBc!"),T.forEach(t)},m(O,T){s(O,v,T),e(v,w),e(v,_),e(_,$),e(v,q),e(v,j),e(j,E),e(v,x),e(v,A),e(A,C),e(v,I)},d(O){O&&t(v)}}}function yf(P){let v,w;return{c(){v=l("p"),w=h("\u26A0\uFE0F N\u1EBFu b\u1EA1n \u0111ang th\u1EF1c hi\u1EC7n hu\u1EA5n luy\u1EC7n ph\xE2n t\xE1n, h\xE3y in c\xE1c m\u1EABu t\u1EADp d\u1EEF li\u1EC7u c\u1EE7a b\u1EA1n trong m\u1ED7i quy tr\xECnh v\xE0 ki\u1EC3m tra ba l\u1EA7n \u0111\u1EC3 \u0111\u1EA3m b\u1EA3o b\u1EA1n nh\u1EADn \u0111\u01B0\u1EE3c \u0111i\u1EC1u t\u01B0\u01A1ng t\u1EF1. M\u1ED9t l\u1ED7i ph\u1ED5 bi\u1EBFn l\xE0 c\xF3 m\u1ED9t s\u1ED1 ngu\u1ED3n ng\u1EABu nhi\xEAn trong qu\xE1 tr\xECnh t\u1EA1o d\u1EEF li\u1EC7u khi\u1EBFn m\u1ED7i quy tr\xECnh c\xF3 m\u1ED9t phi\xEAn b\u1EA3n kh\xE1c nhau c\u1EE7a t\u1EADp d\u1EEF li\u1EC7u.")},l(_){v=r(_,"P",{});var $=c(v);w=i($,"\u26A0\uFE0F N\u1EBFu b\u1EA1n \u0111ang th\u1EF1c hi\u1EC7n hu\u1EA5n luy\u1EC7n ph\xE2n t\xE1n, h\xE3y in c\xE1c m\u1EABu t\u1EADp d\u1EEF li\u1EC7u c\u1EE7a b\u1EA1n trong m\u1ED7i quy tr\xECnh v\xE0 ki\u1EC3m tra ba l\u1EA7n \u0111\u1EC3 \u0111\u1EA3m b\u1EA3o b\u1EA1n nh\u1EADn \u0111\u01B0\u1EE3c \u0111i\u1EC1u t\u01B0\u01A1ng t\u1EF1. M\u1ED9t l\u1ED7i ph\u1ED5 bi\u1EBFn l\xE0 c\xF3 m\u1ED9t s\u1ED1 ngu\u1ED3n ng\u1EABu nhi\xEAn trong qu\xE1 tr\xECnh t\u1EA1o d\u1EEF li\u1EC7u khi\u1EBFn m\u1ED7i quy tr\xECnh c\xF3 m\u1ED9t phi\xEAn b\u1EA3n kh\xE1c nhau c\u1EE7a t\u1EADp d\u1EEF li\u1EC7u."),$.forEach(t)},m(_,$){s(_,v,$),e(v,w)},d(_){_&&t(v)}}}function _f(P){let v,w;return{c(){v=l("p"),w=h("\u{1F4A1} N\u1EBFu d\u1EEF li\u1EC7u hu\u1EA5n luy\u1EC7n c\u1EE7a b\u1EA1n kh\xF4ng c\xE2n b\u1EB1ng, h\xE3y \u0111\u1EA3m b\u1EA3o t\u1EA1o m\u1ED9t lo\u1EA1t d\u1EEF li\u1EC7u hu\u1EA5n luy\u1EC7n c\xF3 ch\u1EE9a t\u1EA5t c\u1EA3 c\xE1c nh\xE3n.")},l(_){v=r(_,"P",{});var $=c(v);w=i($,"\u{1F4A1} N\u1EBFu d\u1EEF li\u1EC7u hu\u1EA5n luy\u1EC7n c\u1EE7a b\u1EA1n kh\xF4ng c\xE2n b\u1EB1ng, h\xE3y \u0111\u1EA3m b\u1EA3o t\u1EA1o m\u1ED9t lo\u1EA1t d\u1EEF li\u1EC7u hu\u1EA5n luy\u1EC7n c\xF3 ch\u1EE9a t\u1EA5t c\u1EA3 c\xE1c nh\xE3n."),$.forEach(t)},m(_,$){s(_,v,$),e(v,w)},d(_){_&&t(v)}}}function $f(P){let v,w,_,$,q;return{c(){v=l("p"),w=h("\u26A0\uFE0F B\u1EA1n s\u1EBD ph\u1EA3i t\u1EA1o l\u1EA1i m\xF4 h\xECnh v\xE0 "),_=l("code"),$=h("Trainer"),q=h("c\u1EE7a m\xECnh sau b\xE0i ki\u1EC3m tra overfitt n\xE0y, v\xEC m\xF4 h\xECnh thu \u0111\u01B0\u1EE3c c\xF3 th\u1EC3 s\u1EBD kh\xF4ng th\u1EC3 kh\xF4i ph\u1EE5c v\xE0 h\u1ECDc \u0111\u01B0\u1EE3c \u0111i\u1EC1u g\xEC \u0111\xF3 h\u1EEFu \xEDch tr\xEAn t\u1EADp d\u1EEF li\u1EC7u \u0111\u1EA7y \u0111\u1EE7 c\u1EE7a b\u1EA1n.")},l(j){v=r(j,"P",{});var E=c(v);w=i(E,"\u26A0\uFE0F B\u1EA1n s\u1EBD ph\u1EA3i t\u1EA1o l\u1EA1i m\xF4 h\xECnh v\xE0 "),_=r(E,"CODE",{});var x=c(_);$=i(x,"Trainer"),x.forEach(t),q=i(E,"c\u1EE7a m\xECnh sau b\xE0i ki\u1EC3m tra overfitt n\xE0y, v\xEC m\xF4 h\xECnh thu \u0111\u01B0\u1EE3c c\xF3 th\u1EC3 s\u1EBD kh\xF4ng th\u1EC3 kh\xF4i ph\u1EE5c v\xE0 h\u1ECDc \u0111\u01B0\u1EE3c \u0111i\u1EC1u g\xEC \u0111\xF3 h\u1EEFu \xEDch tr\xEAn t\u1EADp d\u1EEF li\u1EC7u \u0111\u1EA7y \u0111\u1EE7 c\u1EE7a b\u1EA1n."),E.forEach(t)},m(j,E){s(j,v,E),e(v,w),e(v,_),e(_,$),e(v,q)},d(j){j&&t(v)}}}function wf(P){let v,w,_,$,q,j,E,x,A,C,I,O,T,it,U,Ae,De,Gr,Hr,Sa,Ir,Fr,vh,an,bn,Oa,lt,Kr,Ua,Wr,kh,rt,yh,F,Rr,Va,Yr,Xr,Ba,Jr,Qr,_h,vn,Zr,Ma,nc,tc,$h,kn,ec,ct,ac,sc,wh,ot,jh,ze,hc,Eh,pt,qh,sn,yn,La,ut,ic,Ga,lc,xh,_n,rc,Ha,cc,oc,Ch,$n,pc,Ia,uc,mc,Th,mt,Ph,gt,Ah,K,gc,Fa,dc,fc,Ka,bc,vc,Dh,D,kc,Wa,yc,_c,Ra,$c,wc,Ya,jc,Ec,Xa,qc,xc,zh,dt,Nh,Ne,Cc,Sh,ft,Oh,Se,Tc,Uh,bt,Vh,Oe,Pc,Bh,Ue,Ac,Mh,vt,Lh,kt,Gh,Ve,Dc,Hh,yt,Ih,_t,Fh,z,zc,Ja,Nc,Sc,Qa,Oc,Uc,Za,Vc,Bc,ns,Mc,Lc,Kh,$t,Wh,wt,Rh,W,Gc,jt,Hc,Ic,ts,Fc,Kc,Yh,wn,Wc,es,Rc,Yc,Xh,Et,Jh,qt,Qh,Be,Xc,Zh,xt,ni,Ct,ti,Me,Jc,ei,Tt,ai,Pt,si,R,Qc,as,Zc,no,ss,to,eo,hi,At,ii,Dt,li,Y,ao,hs,so,ho,is,io,lo,ri,Le,ro,ci,jn,oi,Ge,co,pi,He,oo,ui,hn,En,ls,zt,po,rs,uo,mi,N,mo,cs,go,fo,os,bo,vo,ps,ko,yo,us,_o,$o,gi,Nt,di,Ie,wo,fi,St,bi,X,jo,ms,Eo,qo,gs,xo,Co,vi,Ot,ki,Ut,yi,B,To,ds,Po,Ao,fs,Do,zo,bs,No,So,_i,M,Oo,vs,Uo,Vo,ks,Bo,Mo,ys,Lo,Go,$i,Vt,wi,Fe,Ho,ji,Bt,Ei,Ke,Io,qi,We,Fo,xi,Mt,Ci,S,Ko,_s,Wo,Ro,$s,Yo,Xo,ws,Jo,Qo,js,Zo,np,Ti,Lt,Pi,Re,tp,Ai,Ye,ep,Di,ln,qn,Es,Gt,ap,qs,sp,zi,Xe,hp,Ni,Ht,Si,xn,ip,xs,lp,rp,Oi,Je,cp,Ui,Qe,op,Vi,Cn,pp,Cs,up,mp,Bi,It,Mi,Ft,Li,Tn,gp,Ts,dp,fp,Gi,Kt,Hi,Wt,Ii,Ze,bp,Fi,Rt,Ki,Pn,vp,Ps,kp,yp,Wi,Yt,Ri,na,_p,Yi,Xt,Xi,ta,$p,Ji,rn,An,As,Jt,wp,Ds,jp,Qi,ea,Ep,Zi,Dn,qp,zs,xp,Cp,nl,Qt,tl,aa,Tp,el,J,Pp,Ns,Ap,Dp,Ss,zp,Np,al,Zt,sl,zn,Sp,Os,Op,Up,hl,cn,Nn,Us,ne,Vp,Vs,Bp,il,Sn,Mp,Bs,Lp,Gp,ll,sa,Hp,rl,On,cl,on,Un,Ms,te,Ip,Ls,Fp,ol,Vn,Kp,Gs,Wp,Rp,pl,ee,ul,ae,ml,ha,Yp,gl,Bn,Xp,Hs,Jp,Qp,dl,se,fl,he,bl,Mn,vl,ia,Zp,kl,ie,yl,la,nu,_l,le,$l,Q,tu,Is,eu,au,Fs,su,hu,wl,re,jl,ce,El,L,iu,Ks,lu,ru,Ws,cu,ou,Rs,pu,uu,ql,oe,xl,pe,Cl,Ln,mu,Ys,gu,du,Tl,ue,Pl,me,Al,ra,fu,Dl,ca,bu,zl,ge,Nl,oa,vu,Sl,Gn,Ol,pn,Hn,Xs,de,ku,Js,yu,Ul,pa,_u,Vl,un,In,Qs,fe,$u,Zs,wu,Bl,ua,ju,Ml,G,nh,Eu,qu,th,xu,Cu,eh,Tu,Pu,ah,Au,Ll,Fn,Gl,ma,Du,Hl,ga,zu,Il,da,Nu,Fl,mn,Kn,sh,be,Su,hh,Ou,Kl,fa,Uu,Wl,Wn,Vu,ih,Bu,Mu,Rl,ve,Yl,Rn,Xl,Yn,Lu,lh,Gu,Hu,Jl,ke,Ql,ye,Zl,ba,Iu,nr,va,Fu,tr,Xn,er,gn,Jn,rh,_e,Ku,ch,Wu,ar,Qn,Ru,oh,Yu,Xu,sr,ka,Ju,hr,ya,Qu,ir,dn,Zn,ph,$e,Zu,uh,nm,lr,nt,tm,we,em,am,rr,_a,sm,cr,H,$a,je,hm,im,lm,wa,Ee,rm,cm,om,ja,qe,pm,um,mm,Ea,xe,gm,dm,or,qa,fm,pr;return _=new df({props:{fw:P[0]}}),x=new V({}),T=new gf({props:{classNames:"absolute z-10 right-0 top-0",options:[{label:"Google Colab",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/master/course/vi/chapter8/section4_pt.ipynb"},{label:"Aws Studio",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/master/course/vi/chapter8/section4_pt.ipynb"}]}}),lt=new V({}),rt=new mf({props:{id:"L-WSwUWde1U"}}),ot=new y({props:{code:`from datasets import load_dataset
import evaluate
from transformers import (
    AutoTokenizer,
    AutoModelForSequenceClassification,
    TrainingArguments,
    Trainer,
)

raw_datasets = load_dataset("glue", "mnli")

model_checkpoint = "distilbert-base-uncased"
tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)


def preprocess_function(examples):
    return tokenizer(examples["premise"], examples["hypothesis"], truncation=True)


tokenized_datasets = raw_datasets.map(preprocess_function, batched=True)
model = AutoModelForSequenceClassification.from_pretrained(model_checkpoint)

args = TrainingArguments(
    f"distilbert-finetuned-mnli",
    evaluation_strategy="epoch",
    save_strategy="epoch",
    learning_rate=2e-5,
    num_train_epochs=3,
    weight_decay=0.01,
)

metric = evaluate.load("glue", "mnli")


def compute_metrics(eval_pred):
    predictions, labels = eval_pred
    return metric.compute(predictions=predictions, references=labels)


trainer = Trainer(
    model,
    args,
    train_dataset=raw_datasets["train"],
    eval_dataset=raw_datasets["validation_matched"],
    compute_metrics=compute_metrics,
)
trainer.train()`,highlighted:`<span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset
<span class="hljs-keyword">import</span> evaluate
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> (
    AutoTokenizer,
    AutoModelForSequenceClassification,
    TrainingArguments,
    Trainer,
)

raw_datasets = load_dataset(<span class="hljs-string">&quot;glue&quot;</span>, <span class="hljs-string">&quot;mnli&quot;</span>)

model_checkpoint = <span class="hljs-string">&quot;distilbert-base-uncased&quot;</span>
tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)


<span class="hljs-keyword">def</span> <span class="hljs-title function_">preprocess_function</span>(<span class="hljs-params">examples</span>):
    <span class="hljs-keyword">return</span> tokenizer(examples[<span class="hljs-string">&quot;premise&quot;</span>], examples[<span class="hljs-string">&quot;hypothesis&quot;</span>], truncation=<span class="hljs-literal">True</span>)


tokenized_datasets = raw_datasets.<span class="hljs-built_in">map</span>(preprocess_function, batched=<span class="hljs-literal">True</span>)
model = AutoModelForSequenceClassification.from_pretrained(model_checkpoint)

args = TrainingArguments(
    <span class="hljs-string">f&quot;distilbert-finetuned-mnli&quot;</span>,
    evaluation_strategy=<span class="hljs-string">&quot;epoch&quot;</span>,
    save_strategy=<span class="hljs-string">&quot;epoch&quot;</span>,
    learning_rate=<span class="hljs-number">2e-5</span>,
    num_train_epochs=<span class="hljs-number">3</span>,
    weight_decay=<span class="hljs-number">0.01</span>,
)

metric = evaluate.load(<span class="hljs-string">&quot;glue&quot;</span>, <span class="hljs-string">&quot;mnli&quot;</span>)


<span class="hljs-keyword">def</span> <span class="hljs-title function_">compute_metrics</span>(<span class="hljs-params">eval_pred</span>):
    predictions, labels = eval_pred
    <span class="hljs-keyword">return</span> metric.compute(predictions=predictions, references=labels)


trainer = Trainer(
    model,
    args,
    train_dataset=raw_datasets[<span class="hljs-string">&quot;train&quot;</span>],
    eval_dataset=raw_datasets[<span class="hljs-string">&quot;validation_matched&quot;</span>],
    compute_metrics=compute_metrics,
)
trainer.train()`}}),pt=new y({props:{code:"'ValueError: You have to specify either input_ids or inputs_embeds'",highlighted:'<span class="hljs-string">&#x27;ValueError: You have to specify either input_ids or inputs_embeds&#x27;</span>'}}),ut=new V({}),mt=new y({props:{code:"trainer.train_dataset[0]",highlighted:'trainer.train_dataset[<span class="hljs-number">0</span>]'}}),gt=new y({props:{code:`{'hypothesis': 'Product and geography are what make cream skimming work. ',
 'idx': 0,
 'label': 1,
 'premise': 'Conceptually cream skimming has two basic dimensions - product and geography.'}`,highlighted:`{<span class="hljs-string">&#x27;hypothesis&#x27;</span>: <span class="hljs-string">&#x27;Product and geography are what make cream skimming work. &#x27;</span>,
 <span class="hljs-string">&#x27;idx&#x27;</span>: <span class="hljs-number">0</span>,
 <span class="hljs-string">&#x27;label&#x27;</span>: <span class="hljs-number">1</span>,
 <span class="hljs-string">&#x27;premise&#x27;</span>: <span class="hljs-string">&#x27;Conceptually cream skimming has two basic dimensions - product and geography.&#x27;</span>}`}}),dt=new y({props:{code:`from datasets import load_dataset
import evaluate
from transformers import (
    AutoTokenizer,
    AutoModelForSequenceClassification,
    TrainingArguments,
    Trainer,
)

raw_datasets = load_dataset("glue", "mnli")

model_checkpoint = "distilbert-base-uncased"
tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)


def preprocess_function(examples):
    return tokenizer(examples["premise"], examples["hypothesis"], truncation=True)


tokenized_datasets = raw_datasets.map(preprocess_function, batched=True)
model = AutoModelForSequenceClassification.from_pretrained(model_checkpoint)

args = TrainingArguments(
    f"distilbert-finetuned-mnli",
    evaluation_strategy="epoch",
    save_strategy="epoch",
    learning_rate=2e-5,
    num_train_epochs=3,
    weight_decay=0.01,
)

metric = evaluate.load("glue", "mnli")


def compute_metrics(eval_pred):
    predictions, labels = eval_pred
    return metric.compute(predictions=predictions, references=labels)


trainer = Trainer(
    model,
    args,
    train_dataset=tokenized_datasets["train"],
    eval_dataset=tokenized_datasets["validation_matched"],
    compute_metrics=compute_metrics,
)
trainer.train()`,highlighted:`<span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset
<span class="hljs-keyword">import</span> evaluate
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> (
    AutoTokenizer,
    AutoModelForSequenceClassification,
    TrainingArguments,
    Trainer,
)

raw_datasets = load_dataset(<span class="hljs-string">&quot;glue&quot;</span>, <span class="hljs-string">&quot;mnli&quot;</span>)

model_checkpoint = <span class="hljs-string">&quot;distilbert-base-uncased&quot;</span>
tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)


<span class="hljs-keyword">def</span> <span class="hljs-title function_">preprocess_function</span>(<span class="hljs-params">examples</span>):
    <span class="hljs-keyword">return</span> tokenizer(examples[<span class="hljs-string">&quot;premise&quot;</span>], examples[<span class="hljs-string">&quot;hypothesis&quot;</span>], truncation=<span class="hljs-literal">True</span>)


tokenized_datasets = raw_datasets.<span class="hljs-built_in">map</span>(preprocess_function, batched=<span class="hljs-literal">True</span>)
model = AutoModelForSequenceClassification.from_pretrained(model_checkpoint)

args = TrainingArguments(
    <span class="hljs-string">f&quot;distilbert-finetuned-mnli&quot;</span>,
    evaluation_strategy=<span class="hljs-string">&quot;epoch&quot;</span>,
    save_strategy=<span class="hljs-string">&quot;epoch&quot;</span>,
    learning_rate=<span class="hljs-number">2e-5</span>,
    num_train_epochs=<span class="hljs-number">3</span>,
    weight_decay=<span class="hljs-number">0.01</span>,
)

metric = evaluate.load(<span class="hljs-string">&quot;glue&quot;</span>, <span class="hljs-string">&quot;mnli&quot;</span>)


<span class="hljs-keyword">def</span> <span class="hljs-title function_">compute_metrics</span>(<span class="hljs-params">eval_pred</span>):
    predictions, labels = eval_pred
    <span class="hljs-keyword">return</span> metric.compute(predictions=predictions, references=labels)


trainer = Trainer(
    model,
    args,
    train_dataset=tokenized_datasets[<span class="hljs-string">&quot;train&quot;</span>],
    eval_dataset=tokenized_datasets[<span class="hljs-string">&quot;validation_matched&quot;</span>],
    compute_metrics=compute_metrics,
)
trainer.train()`}}),ft=new y({props:{code:"'ValueError: expected sequence of length 43 at dim 1 (got 37)'",highlighted:'<span class="hljs-string">&#x27;ValueError: expected sequence of length 43 at dim 1 (got 37)&#x27;</span>'}}),bt=new y({props:{code:`~/git/transformers/src/transformers/data/data_collator.py in torch_default_data_collator(features)
    105                 batch[k] = torch.stack([f[k] for f in features])
    106             else:
--> 107                 batch[k] = torch.tensor([f[k] for f in features])
    108 
    109     return batch`,highlighted:`~/git/transformers/src/transformers/data/data_collator.py <span class="hljs-keyword">in</span> torch_default_data_collator(features)
    <span class="hljs-number">105</span>                 batch[k] = torch.stack([f[k] <span class="hljs-keyword">for</span> f <span class="hljs-keyword">in</span> features])
    <span class="hljs-number">106</span>             <span class="hljs-keyword">else</span>:
--&gt; <span class="hljs-number">107</span>                 batch[k] = torch.tensor([f[k] <span class="hljs-keyword">for</span> f <span class="hljs-keyword">in</span> features])
    <span class="hljs-number">108</span> 
    <span class="hljs-number">109</span>     <span class="hljs-keyword">return</span> batch`}}),vt=new y({props:{code:'tokenizer.decode(trainer.train_dataset[0]["input_ids"])',highlighted:'tokenizer.decode(trainer.train_dataset[<span class="hljs-number">0</span>][<span class="hljs-string">&quot;input_ids&quot;</span>])'}}),kt=new y({props:{code:"'[CLS] conceptually cream skimming has two basic dimensions - product and geography. [SEP] product and geography are what make cream skimming work. [SEP]'",highlighted:'<span class="hljs-string">&#x27;[CLS] conceptually cream skimming has two basic dimensions - product and geography. [SEP] product and geography are what make cream skimming work. [SEP]&#x27;</span>'}}),yt=new y({props:{code:"trainer.train_dataset[0].keys()",highlighted:'trainer.train_dataset[<span class="hljs-number">0</span>].keys()'}}),_t=new y({props:{code:"dict_keys(['attention_mask', 'hypothesis', 'idx', 'input_ids', 'label', 'premise'])",highlighted:'dict_keys([<span class="hljs-string">&#x27;attention_mask&#x27;</span>, <span class="hljs-string">&#x27;hypothesis&#x27;</span>, <span class="hljs-string">&#x27;idx&#x27;</span>, <span class="hljs-string">&#x27;input_ids&#x27;</span>, <span class="hljs-string">&#x27;label&#x27;</span>, <span class="hljs-string">&#x27;premise&#x27;</span>])'}}),$t=new y({props:{code:"type(trainer.model)",highlighted:'<span class="hljs-built_in">type</span>(trainer.model)'}}),wt=new y({props:{code:"transformers.models.distilbert.modeling_distilbert.DistilBertForSequenceClassification",highlighted:"transformers.models.distilbert.modeling_distilbert.DistilBertForSequenceClassification"}}),Et=new y({props:{code:'trainer.train_dataset[0]["attention_mask"]',highlighted:'trainer.train_dataset[<span class="hljs-number">0</span>][<span class="hljs-string">&quot;attention_mask&quot;</span>]'}}),qt=new y({props:{code:"[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]",highlighted:'[<span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>]'}}),xt=new y({props:{code:`len(trainer.train_dataset[0]["attention_mask"]) == len(
    trainer.train_dataset[0]["input_ids"]
)`,highlighted:`<span class="hljs-built_in">len</span>(trainer.train_dataset[<span class="hljs-number">0</span>][<span class="hljs-string">&quot;attention_mask&quot;</span>]) == <span class="hljs-built_in">len</span>(
    trainer.train_dataset[<span class="hljs-number">0</span>][<span class="hljs-string">&quot;input_ids&quot;</span>]
)`}}),Ct=new y({props:{code:"True",highlighted:'<span class="hljs-literal">True</span>'}}),Tt=new y({props:{code:'trainer.train_dataset[0]["label"]',highlighted:'trainer.train_dataset[<span class="hljs-number">0</span>][<span class="hljs-string">&quot;label&quot;</span>]'}}),Pt=new y({props:{code:"1",highlighted:'<span class="hljs-number">1</span>'}}),At=new y({props:{code:'trainer.train_dataset.features["label"].names',highlighted:'trainer.train_dataset.features[<span class="hljs-string">&quot;label&quot;</span>].names'}}),Dt=new y({props:{code:"['entailment', 'neutral', 'contradiction']",highlighted:'[<span class="hljs-string">&#x27;entailment&#x27;</span>, <span class="hljs-string">&#x27;neutral&#x27;</span>, <span class="hljs-string">&#x27;contradiction&#x27;</span>]'}}),jn=new Pe({props:{$$slots:{default:[ff]},$$scope:{ctx:P}}}),zt=new V({}),Nt=new y({props:{code:`for batch in trainer.get_train_dataloader():
    break`,highlighted:`<span class="hljs-keyword">for</span> batch <span class="hljs-keyword">in</span> trainer.get_train_dataloader():
    <span class="hljs-keyword">break</span>`}}),St=new y({props:{code:`~/git/transformers/src/transformers/data/data_collator.py in torch_default_data_collator(features)
    105                 batch[k] = torch.stack([f[k] for f in features])
    106             else:
--> 107                 batch[k] = torch.tensor([f[k] for f in features])
    108 
    109     return batch

ValueError: expected sequence of length 45 at dim 1 (got 76)`,highlighted:`~/git/transformers/src/transformers/data/data_collator.py <span class="hljs-keyword">in</span> torch_default_data_collator(features)
    <span class="hljs-number">105</span>                 batch[k] = torch.stack([f[k] <span class="hljs-keyword">for</span> f <span class="hljs-keyword">in</span> features])
    <span class="hljs-number">106</span>             <span class="hljs-keyword">else</span>:
--&gt; <span class="hljs-number">107</span>                 batch[k] = torch.tensor([f[k] <span class="hljs-keyword">for</span> f <span class="hljs-keyword">in</span> features])
    <span class="hljs-number">108</span> 
    <span class="hljs-number">109</span>     <span class="hljs-keyword">return</span> batch

ValueError: expected sequence of length <span class="hljs-number">45</span> at dim <span class="hljs-number">1</span> (got <span class="hljs-number">76</span>)`}}),Ot=new y({props:{code:`data_collator = trainer.get_train_dataloader().collate_fn
data_collator`,highlighted:`data_collator = trainer.get_train_dataloader().collate_fn
data_collator`}}),Ut=new y({props:{code:"<function transformers.data.data_collator.default_data_collator(features: List[InputDataClass], return_tensors='pt') -> Dict[str, Any]>",highlighted:'&lt;function transformers.data.data_collator.default_data_collator(features: <span class="hljs-type">List</span>[InputDataClass], return_tensors=<span class="hljs-string">&#x27;pt&#x27;</span>) -&gt; <span class="hljs-type">Dict</span>[<span class="hljs-built_in">str</span>, <span class="hljs-type">Any</span>]&gt;'}}),Vt=new y({props:{code:`from datasets import load_dataset
import evaluate
from transformers import (
    AutoTokenizer,
    AutoModelForSequenceClassification,
    DataCollatorWithPadding,
    TrainingArguments,
    Trainer,
)

raw_datasets = load_dataset("glue", "mnli")

model_checkpoint = "distilbert-base-uncased"
tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)


def preprocess_function(examples):
    return tokenizer(examples["premise"], examples["hypothesis"], truncation=True)


tokenized_datasets = raw_datasets.map(preprocess_function, batched=True)
model = AutoModelForSequenceClassification.from_pretrained(model_checkpoint)

args = TrainingArguments(
    f"distilbert-finetuned-mnli",
    evaluation_strategy="epoch",
    save_strategy="epoch",
    learning_rate=2e-5,
    num_train_epochs=3,
    weight_decay=0.01,
)

metric = evaluate.load("glue", "mnli")


def compute_metrics(eval_pred):
    predictions, labels = eval_pred
    return metric.compute(predictions=predictions, references=labels)


data_collator = DataCollatorWithPadding(tokenizer=tokenizer)

trainer = Trainer(
    model,
    args,
    train_dataset=tokenized_datasets["train"],
    eval_dataset=tokenized_datasets["validation_matched"],
    compute_metrics=compute_metrics,
    data_collator=data_collator,
    tokenizer=tokenizer,
)
trainer.train()`,highlighted:`<span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset
<span class="hljs-keyword">import</span> evaluate
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> (
    AutoTokenizer,
    AutoModelForSequenceClassification,
    DataCollatorWithPadding,
    TrainingArguments,
    Trainer,
)

raw_datasets = load_dataset(<span class="hljs-string">&quot;glue&quot;</span>, <span class="hljs-string">&quot;mnli&quot;</span>)

model_checkpoint = <span class="hljs-string">&quot;distilbert-base-uncased&quot;</span>
tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)


<span class="hljs-keyword">def</span> <span class="hljs-title function_">preprocess_function</span>(<span class="hljs-params">examples</span>):
    <span class="hljs-keyword">return</span> tokenizer(examples[<span class="hljs-string">&quot;premise&quot;</span>], examples[<span class="hljs-string">&quot;hypothesis&quot;</span>], truncation=<span class="hljs-literal">True</span>)


tokenized_datasets = raw_datasets.<span class="hljs-built_in">map</span>(preprocess_function, batched=<span class="hljs-literal">True</span>)
model = AutoModelForSequenceClassification.from_pretrained(model_checkpoint)

args = TrainingArguments(
    <span class="hljs-string">f&quot;distilbert-finetuned-mnli&quot;</span>,
    evaluation_strategy=<span class="hljs-string">&quot;epoch&quot;</span>,
    save_strategy=<span class="hljs-string">&quot;epoch&quot;</span>,
    learning_rate=<span class="hljs-number">2e-5</span>,
    num_train_epochs=<span class="hljs-number">3</span>,
    weight_decay=<span class="hljs-number">0.01</span>,
)

metric = evaluate.load(<span class="hljs-string">&quot;glue&quot;</span>, <span class="hljs-string">&quot;mnli&quot;</span>)


<span class="hljs-keyword">def</span> <span class="hljs-title function_">compute_metrics</span>(<span class="hljs-params">eval_pred</span>):
    predictions, labels = eval_pred
    <span class="hljs-keyword">return</span> metric.compute(predictions=predictions, references=labels)


data_collator = DataCollatorWithPadding(tokenizer=tokenizer)

trainer = Trainer(
    model,
    args,
    train_dataset=tokenized_datasets[<span class="hljs-string">&quot;train&quot;</span>],
    eval_dataset=tokenized_datasets[<span class="hljs-string">&quot;validation_matched&quot;</span>],
    compute_metrics=compute_metrics,
    data_collator=data_collator,
    tokenizer=tokenizer,
)
trainer.train()`}}),Bt=new y({props:{code:"RuntimeError: CUDA error: CUBLAS_STATUS_ALLOC_FAILED when calling `cublasCreate(handle)`",highlighted:"RuntimeError: CUDA error: CUBLAS_STATUS_ALLOC_FAILED when calling `cublasCreate(handle)`"}}),Mt=new y({props:{code:`data_collator = trainer.get_train_dataloader().collate_fn
batch = data_collator([trainer.train_dataset[i] for i in range(4)])`,highlighted:`data_collator = trainer.get_train_dataloader().collate_fn
batch = data_collator([trainer.train_dataset[i] <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> <span class="hljs-built_in">range</span>(<span class="hljs-number">4</span>)])`}}),Lt=new y({props:{code:`data_collator = trainer.get_train_dataloader().collate_fn
actual_train_set = trainer._remove_unused_columns(trainer.train_dataset)
batch = data_collator([actual_train_set[i] for i in range(4)])`,highlighted:`data_collator = trainer.get_train_dataloader().collate_fn
actual_train_set = trainer._remove_unused_columns(trainer.train_dataset)
batch = data_collator([actual_train_set[i] <span class="hljs-keyword">for</span> i <span class="hljs-keyword">in</span> <span class="hljs-built_in">range</span>(<span class="hljs-number">4</span>)])`}}),Gt=new V({}),Ht=new y({props:{code:`for batch in trainer.get_train_dataloader():
    break`,highlighted:`<span class="hljs-keyword">for</span> batch <span class="hljs-keyword">in</span> trainer.get_train_dataloader():
    <span class="hljs-keyword">break</span>`}}),It=new y({props:{code:"outputs = trainer.model.cpu()(**batch)",highlighted:"outputs = trainer.model.cpu()(**batch)"}}),Ft=new y({props:{code:`~/.pyenv/versions/3.7.9/envs/base/lib/python3.7/site-packages/torch/nn/functional.py in nll_loss(input, target, weight, size_average, ignore_index, reduce, reduction)
   2386         )
   2387     if dim == 2:
-> 2388         ret = torch._C._nn.nll_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index)
   2389     elif dim == 4:
   2390         ret = torch._C._nn.nll_loss2d(input, target, weight, _Reduction.get_enum(reduction), ignore_index)

IndexError: Target 2 is out of bounds.`,highlighted:`~/.pyenv/versions/<span class="hljs-number">3.7</span><span class="hljs-number">.9</span>/envs/base/lib/python3<span class="hljs-number">.7</span>/site-packages/torch/nn/functional.py <span class="hljs-keyword">in</span> nll_loss(<span class="hljs-built_in">input</span>, target, weight, size_average, ignore_index, reduce, reduction)
   <span class="hljs-number">2386</span>         )
   <span class="hljs-number">2387</span>     <span class="hljs-keyword">if</span> dim == <span class="hljs-number">2</span>:
-&gt; <span class="hljs-number">2388</span>         ret = torch._C._nn.nll_loss(<span class="hljs-built_in">input</span>, target, weight, _Reduction.get_enum(reduction), ignore_index)
   <span class="hljs-number">2389</span>     <span class="hljs-keyword">elif</span> dim == <span class="hljs-number">4</span>:
   <span class="hljs-number">2390</span>         ret = torch._C._nn.nll_loss2d(<span class="hljs-built_in">input</span>, target, weight, _Reduction.get_enum(reduction), ignore_index)

IndexError: Target <span class="hljs-number">2</span> <span class="hljs-keyword">is</span> out of bounds.`}}),Kt=new y({props:{code:"trainer.model.config.num_labels",highlighted:"trainer.model.config.num_labels"}}),Wt=new y({props:{code:"2",highlighted:'<span class="hljs-number">2</span>'}}),Rt=new y({props:{code:`from datasets import load_dataset
import evaluate
from transformers import (
    AutoTokenizer,
    AutoModelForSequenceClassification,
    DataCollatorWithPadding,
    TrainingArguments,
    Trainer,
)

raw_datasets = load_dataset("glue", "mnli")

model_checkpoint = "distilbert-base-uncased"
tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)


def preprocess_function(examples):
    return tokenizer(examples["premise"], examples["hypothesis"], truncation=True)


tokenized_datasets = raw_datasets.map(preprocess_function, batched=True)
model = AutoModelForSequenceClassification.from_pretrained(model_checkpoint, num_labels=3)

args = TrainingArguments(
    f"distilbert-finetuned-mnli",
    evaluation_strategy="epoch",
    save_strategy="epoch",
    learning_rate=2e-5,
    num_train_epochs=3,
    weight_decay=0.01,
)

metric = evaluate.load("glue", "mnli")


def compute_metrics(eval_pred):
    predictions, labels = eval_pred
    return metric.compute(predictions=predictions, references=labels)


data_collator = DataCollatorWithPadding(tokenizer=tokenizer)

trainer = Trainer(
    model,
    args,
    train_dataset=tokenized_datasets["train"],
    eval_dataset=tokenized_datasets["validation_matched"],
    compute_metrics=compute_metrics,
    data_collator=data_collator,
    tokenizer=tokenizer,
)`,highlighted:`<span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset
<span class="hljs-keyword">import</span> evaluate
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> (
    AutoTokenizer,
    AutoModelForSequenceClassification,
    DataCollatorWithPadding,
    TrainingArguments,
    Trainer,
)

raw_datasets = load_dataset(<span class="hljs-string">&quot;glue&quot;</span>, <span class="hljs-string">&quot;mnli&quot;</span>)

model_checkpoint = <span class="hljs-string">&quot;distilbert-base-uncased&quot;</span>
tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)


<span class="hljs-keyword">def</span> <span class="hljs-title function_">preprocess_function</span>(<span class="hljs-params">examples</span>):
    <span class="hljs-keyword">return</span> tokenizer(examples[<span class="hljs-string">&quot;premise&quot;</span>], examples[<span class="hljs-string">&quot;hypothesis&quot;</span>], truncation=<span class="hljs-literal">True</span>)


tokenized_datasets = raw_datasets.<span class="hljs-built_in">map</span>(preprocess_function, batched=<span class="hljs-literal">True</span>)
model = AutoModelForSequenceClassification.from_pretrained(model_checkpoint, num_labels=<span class="hljs-number">3</span>)

args = TrainingArguments(
    <span class="hljs-string">f&quot;distilbert-finetuned-mnli&quot;</span>,
    evaluation_strategy=<span class="hljs-string">&quot;epoch&quot;</span>,
    save_strategy=<span class="hljs-string">&quot;epoch&quot;</span>,
    learning_rate=<span class="hljs-number">2e-5</span>,
    num_train_epochs=<span class="hljs-number">3</span>,
    weight_decay=<span class="hljs-number">0.01</span>,
)

metric = evaluate.load(<span class="hljs-string">&quot;glue&quot;</span>, <span class="hljs-string">&quot;mnli&quot;</span>)


<span class="hljs-keyword">def</span> <span class="hljs-title function_">compute_metrics</span>(<span class="hljs-params">eval_pred</span>):
    predictions, labels = eval_pred
    <span class="hljs-keyword">return</span> metric.compute(predictions=predictions, references=labels)


data_collator = DataCollatorWithPadding(tokenizer=tokenizer)

trainer = Trainer(
    model,
    args,
    train_dataset=tokenized_datasets[<span class="hljs-string">&quot;train&quot;</span>],
    eval_dataset=tokenized_datasets[<span class="hljs-string">&quot;validation_matched&quot;</span>],
    compute_metrics=compute_metrics,
    data_collator=data_collator,
    tokenizer=tokenizer,
)`}}),Yt=new y({props:{code:`for batch in trainer.get_train_dataloader():
    break

outputs = trainer.model.cpu()(**batch)`,highlighted:`<span class="hljs-keyword">for</span> batch <span class="hljs-keyword">in</span> trainer.get_train_dataloader():
    <span class="hljs-keyword">break</span>

outputs = trainer.model.cpu()(**batch)`}}),Xt=new y({props:{code:`import torch

device = torch.device("cuda") if torch.cuda.is_available() else torch.device("cpu")
batch = {k: v.to(device) for k, v in batch.items()}

outputs = trainer.model.to(device)(**batch)`,highlighted:`<span class="hljs-keyword">import</span> torch

device = torch.device(<span class="hljs-string">&quot;cuda&quot;</span>) <span class="hljs-keyword">if</span> torch.cuda.is_available() <span class="hljs-keyword">else</span> torch.device(<span class="hljs-string">&quot;cpu&quot;</span>)
batch = {k: v.to(device) <span class="hljs-keyword">for</span> k, v <span class="hljs-keyword">in</span> batch.items()}

outputs = trainer.model.to(device)(**batch)`}}),Jt=new V({}),Qt=new y({props:{code:`loss = outputs.loss
loss.backward()`,highlighted:`loss = outputs.loss
loss.backward()`}}),Zt=new y({props:{code:`trainer.create_optimizer()
trainer.optimizer.step()`,highlighted:`trainer.create_optimizer()
trainer.optimizer.step()`}}),ne=new V({}),On=new Pe({props:{$$slots:{default:[bf]},$$scope:{ctx:P}}}),te=new V({}),ee=new y({props:{code:`# Qu\xE1 tr\xECnh n\xE0y s\u1EBD m\u1EA5t nhi\u1EC1u th\u1EDDi gian v\xE0 x\u1EA3y ra l\u1ED7i, v\xEC v\u1EADy b\u1EA1n kh\xF4ng n\xEAn ch\u1EA1y \xF4 n\xE0y
trainer.train()`,highlighted:`<span class="hljs-comment"># Qu\xE1 tr\xECnh n\xE0y s\u1EBD m\u1EA5t nhi\u1EC1u th\u1EDDi gian v\xE0 x\u1EA3y ra l\u1ED7i, v\xEC v\u1EADy b\u1EA1n kh\xF4ng n\xEAn ch\u1EA1y \xF4 n\xE0y</span>
trainer.train()`}}),ae=new y({props:{code:"TypeError: only size-1 arrays can be converted to Python scalars",highlighted:'TypeError: only size-<span class="hljs-number">1</span> arrays can be converted to Python scalars'}}),se=new y({props:{code:"trainer.evaluate()",highlighted:"trainer.evaluate()"}}),he=new y({props:{code:"TypeError: only size-1 arrays can be converted to Python scalars",highlighted:'TypeError: only size-<span class="hljs-number">1</span> arrays can be converted to Python scalars'}}),Mn=new Pe({props:{$$slots:{default:[vf]},$$scope:{ctx:P}}}),ie=new y({props:{code:`for batch in trainer.get_eval_dataloader():
    break

batch = {k: v.to(device) for k, v in batch.items()}

with torch.no_grad():
    outputs = trainer.model(**batch)`,highlighted:`<span class="hljs-keyword">for</span> batch <span class="hljs-keyword">in</span> trainer.get_eval_dataloader():
    <span class="hljs-keyword">break</span>

batch = {k: v.to(device) <span class="hljs-keyword">for</span> k, v <span class="hljs-keyword">in</span> batch.items()}

<span class="hljs-keyword">with</span> torch.no_grad():
    outputs = trainer.model(**batch)`}}),le=new y({props:{code:`~/git/datasets/src/datasets/metric.py in add_batch(self, predictions, references)
    431         """
    432         batch = {"predictions": predictions, "references": references}
--> 433         batch = self.info.features.encode_batch(batch)
    434         if self.writer is None:
    435             self._init_writer()`,highlighted:`~/git/datasets/src/datasets/metric.py <span class="hljs-keyword">in</span> add_batch(self, predictions, references)
    <span class="hljs-number">431</span>         <span class="hljs-string">&quot;&quot;&quot;
    432         batch = {&quot;predictions&quot;: predictions, &quot;references&quot;: references}
--&gt; 433         batch = self.info.features.encode_batch(batch)
    434         if self.writer is None:
    435             self._init_writer()</span>`}}),re=new y({props:{code:`predictions = outputs.logits.cpu().numpy()
labels = batch["labels"].cpu().numpy()

compute_metrics((predictions, labels))`,highlighted:`predictions = outputs.logits.cpu().numpy()
labels = batch[<span class="hljs-string">&quot;labels&quot;</span>].cpu().numpy()

compute_metrics((predictions, labels))`}}),ce=new y({props:{code:"TypeError: only size-1 arrays can be converted to Python scalars",highlighted:'TypeError: only size-<span class="hljs-number">1</span> arrays can be converted to Python scalars'}}),oe=new y({props:{code:"predictions.shape, labels.shape",highlighted:"predictions.shape, labels.shape"}}),pe=new y({props:{code:"((8, 3), (8,))",highlighted:'((<span class="hljs-number">8</span>, <span class="hljs-number">3</span>), (<span class="hljs-number">8</span>,))'}}),ue=new y({props:{code:`import numpy as np


def compute_metrics(eval_pred):
    predictions, labels = eval_pred
    predictions = np.argmax(predictions, axis=1)
    return metric.compute(predictions=predictions, references=labels)


compute_metrics((predictions, labels))`,highlighted:`<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np


<span class="hljs-keyword">def</span> <span class="hljs-title function_">compute_metrics</span>(<span class="hljs-params">eval_pred</span>):
    predictions, labels = eval_pred
    predictions = np.argmax(predictions, axis=<span class="hljs-number">1</span>)
    <span class="hljs-keyword">return</span> metric.compute(predictions=predictions, references=labels)


compute_metrics((predictions, labels))`}}),me=new y({props:{code:"{'accuracy': 0.625}",highlighted:'{<span class="hljs-string">&#x27;accuracy&#x27;</span>: <span class="hljs-number">0.625</span>}'}}),ge=new y({props:{code:`import numpy as np
from datasets import load_dataset
import evaluate
from transformers import (
    AutoTokenizer,
    AutoModelForSequenceClassification,
    DataCollatorWithPadding,
    TrainingArguments,
    Trainer,
)

raw_datasets = load_dataset("glue", "mnli")

model_checkpoint = "distilbert-base-uncased"
tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)


def preprocess_function(examples):
    return tokenizer(examples["premise"], examples["hypothesis"], truncation=True)


tokenized_datasets = raw_datasets.map(preprocess_function, batched=True)
model = AutoModelForSequenceClassification.from_pretrained(model_checkpoint, num_labels=3)

args = TrainingArguments(
    f"distilbert-finetuned-mnli",
    evaluation_strategy="epoch",
    save_strategy="epoch",
    learning_rate=2e-5,
    num_train_epochs=3,
    weight_decay=0.01,
)

metric = evaluate.load("glue", "mnli")


def compute_metrics(eval_pred):
    predictions, labels = eval_pred
    predictions = np.argmax(predictions, axis=1)
    return metric.compute(predictions=predictions, references=labels)


data_collator = DataCollatorWithPadding(tokenizer=tokenizer)

trainer = Trainer(
    model,
    args,
    train_dataset=tokenized_datasets["train"],
    eval_dataset=tokenized_datasets["validation_matched"],
    compute_metrics=compute_metrics,
    data_collator=data_collator,
    tokenizer=tokenizer,
)
trainer.train()`,highlighted:`<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np
<span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset
<span class="hljs-keyword">import</span> evaluate
<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> (
    AutoTokenizer,
    AutoModelForSequenceClassification,
    DataCollatorWithPadding,
    TrainingArguments,
    Trainer,
)

raw_datasets = load_dataset(<span class="hljs-string">&quot;glue&quot;</span>, <span class="hljs-string">&quot;mnli&quot;</span>)

model_checkpoint = <span class="hljs-string">&quot;distilbert-base-uncased&quot;</span>
tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)


<span class="hljs-keyword">def</span> <span class="hljs-title function_">preprocess_function</span>(<span class="hljs-params">examples</span>):
    <span class="hljs-keyword">return</span> tokenizer(examples[<span class="hljs-string">&quot;premise&quot;</span>], examples[<span class="hljs-string">&quot;hypothesis&quot;</span>], truncation=<span class="hljs-literal">True</span>)


tokenized_datasets = raw_datasets.<span class="hljs-built_in">map</span>(preprocess_function, batched=<span class="hljs-literal">True</span>)
model = AutoModelForSequenceClassification.from_pretrained(model_checkpoint, num_labels=<span class="hljs-number">3</span>)

args = TrainingArguments(
    <span class="hljs-string">f&quot;distilbert-finetuned-mnli&quot;</span>,
    evaluation_strategy=<span class="hljs-string">&quot;epoch&quot;</span>,
    save_strategy=<span class="hljs-string">&quot;epoch&quot;</span>,
    learning_rate=<span class="hljs-number">2e-5</span>,
    num_train_epochs=<span class="hljs-number">3</span>,
    weight_decay=<span class="hljs-number">0.01</span>,
)

metric = evaluate.load(<span class="hljs-string">&quot;glue&quot;</span>, <span class="hljs-string">&quot;mnli&quot;</span>)


<span class="hljs-keyword">def</span> <span class="hljs-title function_">compute_metrics</span>(<span class="hljs-params">eval_pred</span>):
    predictions, labels = eval_pred
    predictions = np.argmax(predictions, axis=<span class="hljs-number">1</span>)
    <span class="hljs-keyword">return</span> metric.compute(predictions=predictions, references=labels)


data_collator = DataCollatorWithPadding(tokenizer=tokenizer)

trainer = Trainer(
    model,
    args,
    train_dataset=tokenized_datasets[<span class="hljs-string">&quot;train&quot;</span>],
    eval_dataset=tokenized_datasets[<span class="hljs-string">&quot;validation_matched&quot;</span>],
    compute_metrics=compute_metrics,
    data_collator=data_collator,
    tokenizer=tokenizer,
)
trainer.train()`}}),Gn=new Pe({props:{$$slots:{default:[kf]},$$scope:{ctx:P}}}),de=new V({}),fe=new V({}),Fn=new Pe({props:{warning:!0,$$slots:{default:[yf]},$$scope:{ctx:P}}}),be=new V({}),ve=new y({props:{code:`for batch in trainer.get_train_dataloader():
    break

batch = {k: v.to(device) for k, v in batch.items()}
trainer.create_optimizer()

for _ in range(20):
    outputs = trainer.model(**batch)
    loss = outputs.loss
    loss.backward()
    trainer.optimizer.step()
    trainer.optimizer.zero_grad()`,highlighted:`<span class="hljs-keyword">for</span> batch <span class="hljs-keyword">in</span> trainer.get_train_dataloader():
    <span class="hljs-keyword">break</span>

batch = {k: v.to(device) <span class="hljs-keyword">for</span> k, v <span class="hljs-keyword">in</span> batch.items()}
trainer.create_optimizer()

<span class="hljs-keyword">for</span> _ <span class="hljs-keyword">in</span> <span class="hljs-built_in">range</span>(<span class="hljs-number">20</span>):
    outputs = trainer.model(**batch)
    loss = outputs.loss
    loss.backward()
    trainer.optimizer.step()
    trainer.optimizer.zero_grad()`}}),Rn=new Pe({props:{$$slots:{default:[_f]},$$scope:{ctx:P}}}),ke=new y({props:{code:`with torch.no_grad():
    outputs = trainer.model(**batch)
preds = outputs.logits
labels = batch["labels"]

compute_metrics((preds.cpu().numpy(), labels.cpu().numpy()))`,highlighted:`<span class="hljs-keyword">with</span> torch.no_grad():
    outputs = trainer.model(**batch)
preds = outputs.logits
labels = batch[<span class="hljs-string">&quot;labels&quot;</span>]

compute_metrics((preds.cpu().numpy(), labels.cpu().numpy()))`}}),ye=new y({props:{code:"{'accuracy': 1.0}",highlighted:'{<span class="hljs-string">&#x27;accuracy&#x27;</span>: <span class="hljs-number">1.0</span>}'}}),Xn=new Pe({props:{warning:!0,$$slots:{default:[$f]},$$scope:{ctx:P}}}),_e=new V({}),$e=new V({}),{c(){v=l("meta"),w=o(),u(_.$$.fragment),$=o(),q=l("h1"),j=l("a"),E=l("span"),u(x.$$.fragment),A=o(),C=l("span"),I=h("G\u1EE1 l\u1ED7i quy tr\xECnh hu\u1EA5n luy\u1EC7n"),O=o(),u(T.$$.fragment),it=o(),U=l("p"),Ae=h("B\u1EA1n \u0111\xE3 vi\u1EBFt m\u1ED9t k\u1ECBch b\u1EA3n tuy\u1EC7t \u0111\u1EB9p \u0111\u1EC3 hu\u1EA5n luy\u1EC7n ho\u1EB7c tinh ch\u1EC9nh m\u1ED9t m\xF4 h\xECnh trong m\u1ED9t t\xE1c v\u1EE5 nh\u1EA5t \u0111\u1ECBnh, tu\xE2n th\u1EE7 m\u1ED9t c\xE1ch nghi\xEAm t\xFAc l\u1EDDi khuy\xEAn t\u1EEB "),De=l("a"),Gr=h("Ch\u01B0\u01A1ng 7"),Hr=h(". Nh\u01B0ng khi b\u1EA1n kh\u1EDFi ch\u1EA1y l\u1EC7nh "),Sa=l("code"),Ir=h("trainr.train()"),Fr=h(", m\u1ED9t \u0111i\u1EC1u kinh kh\u1EE7ng x\u1EA3y ra: b\u1EA1n g\u1EB7p l\u1ED7i \u{1F631}! Ho\u1EB7c t\u1EC7 h\u01A1n, m\u1ECDi th\u1EE9 d\u01B0\u1EDDng nh\u01B0 \u1ED5n v\xE0 qu\xE1 tr\xECnh hu\u1EA5n luy\u1EC7n ch\u1EA1y m\xE0 kh\xF4ng c\xF3 l\u1ED7i, nh\u01B0ng m\xF4 h\xECnh k\u1EBFt qu\u1EA3 l\xE0 t\u1ED3i t\u1EC7. Trong ph\u1EA7n n\xE0y, ch\xFAng t\xF4i s\u1EBD ch\u1EC9 cho b\u1EA1n nh\u1EEFng g\xEC b\u1EA1n c\xF3 th\u1EC3 l\xE0m \u0111\u1EC3 g\u1EE1 l\u1ED7i c\xE1c lo\u1EA1i v\u1EA5n \u0111\u1EC1 n\xE0y."),vh=o(),an=l("h2"),bn=l("a"),Oa=l("span"),u(lt.$$.fragment),Kr=o(),Ua=l("span"),Wr=h("G\u1EE1 l\u1ED7i quy tr\xECnh hu\u1EA5n luy\u1EC7n"),kh=o(),u(rt.$$.fragment),yh=o(),F=l("p"),Rr=h("V\u1EA5n \u0111\u1EC1 khi b\u1EA1n g\u1EB7p l\u1ED7i trong "),Va=l("code"),Yr=h("trainr.train()"),Xr=h(" c\xF3 th\u1EC3 \u0111\u1EBFn t\u1EEB nhi\u1EC1u ngu\u1ED3n, v\xEC "),Ba=l("code"),Jr=h("Trainer"),Qr=h(" th\u01B0\u1EDDng t\u1EADp h\u1EE3p r\u1EA5t nhi\u1EC1u th\u1EE9 l\u1EA1i v\u1EDBi nhau. N\xF3 chuy\u1EC3n \u0111\u1ED5i b\u1ED9 d\u1EEF li\u1EC7u th\xE0nh c\xE1c dataloader, do \u0111\xF3, v\u1EA5n \u0111\u1EC1 c\xF3 th\u1EC3 l\xE0 m\u1ED9t c\xE1i g\xEC \u0111\xF3 sai trong b\u1ED9 d\u1EEF li\u1EC7u c\u1EE7a b\u1EA1n ho\u1EB7c m\u1ED9t s\u1ED1 v\u1EA5n \u0111\u1EC1 khi c\u1ED1 g\u1EAFng k\u1EBFt h\u1EE3p h\xE0ng lo\u1EA1t c\xE1c ph\u1EA7n t\u1EED c\u1EE7a b\u1ED9 d\u1EEF li\u1EC7u v\u1EDBi nhau. Sau \u0111\xF3, n\xF3 l\u1EA5y m\u1ED9t lo\u1EA1t d\u1EEF li\u1EC7u v\xE0 \u0111\u01B0a n\xF3 v\xE0o m\xF4 h\xECnh, v\xEC v\u1EADy v\u1EA5n \u0111\u1EC1 c\xF3 th\u1EC3 n\u1EB1m \u1EDF m\xE3 m\xF4 h\xECnh. Sau \u0111\xF3, n\xF3 t\xEDnh to\xE1n c\xE1c \u0111\u1ED9 d\u1ED1c v\xE0 th\u1EF1c hi\u1EC7n b\u01B0\u1EDBc t\u1ED1i \u01B0u h\xF3a, v\xEC v\u1EADy v\u1EA5n \u0111\u1EC1 c\u0169ng c\xF3 th\u1EC3 n\u1EB1m trong tr\xECnh t\u1ED1i \u01B0u h\xF3a c\u1EE7a b\u1EA1n. V\xE0 ngay c\u1EA3 khi m\u1ECDi th\u1EE9 di\u1EC5n ra t\u1ED1t \u0111\u1EB9p cho qu\xE1 tr\xECnh hu\u1EA5n luy\u1EC7n, v\u1EABn c\xF3 th\u1EC3 x\u1EA3y ra s\u1EF1 c\u1ED1 trong qu\xE1 tr\xECnh \u0111\xE1nh gi\xE1 n\u1EBFu c\xF3 v\u1EA5n \u0111\u1EC1 v\u1EDBi ch\u1EC9 s\u1ED1 c\u1EE7a b\u1EA1n."),_h=o(),vn=l("p"),Zr=h("C\xE1ch t\u1ED1t nh\u1EA5t \u0111\u1EC3 g\u1EE1 l\u1ED7i ph\xE1t sinh trong "),Ma=l("code"),nc=h("trainr.train()"),tc=h(" l\xE0 \u0111i qua to\xE0n pipeline n\xE0y theo c\xE1ch th\u1EE7 c\xF4ng \u0111\u1EC3 xem m\u1ECDi th\u1EE9 di\u1EC5n ra nh\u01B0 th\u1EBF n\xE0o. Sau \u0111\xF3, l\u1ED7i th\u01B0\u1EDDng r\u1EA5t d\u1EC5 gi\u1EA3i quy\u1EBFt."),$h=o(),kn=l("p"),ec=h("\u0110\u1EC3 ch\u1EE9ng minh \u0111i\u1EC1u n\xE0y, ch\xFAng ta s\u1EBD s\u1EED d\u1EE5ng t\u1EADp l\u1EC7nh (c\u1ED1 g\u1EAFng) tinh ch\u1EC9nh m\xF4 h\xECnh DistilBERT tr\xEAn "),ct=l("a"),ac=h("t\u1EADp d\u1EEF li\u1EC7u MNLI"),sc=h(":"),wh=o(),u(ot.$$.fragment),jh=o(),ze=l("p"),hc=h("N\u1EBFu b\u1EA1n c\u1ED1 g\u1EAFng th\u1EF1c thi n\xF3, b\u1EA1n s\u1EBD g\u1EB7p ph\u1EA3i m\u1ED9t l\u1ED7i kh\xE1 kh\xF3 hi\u1EC3u:"),Eh=o(),u(pt.$$.fragment),qh=o(),sn=l("h3"),yn=l("a"),La=l("span"),u(ut.$$.fragment),ic=o(),Ga=l("span"),lc=h("Ki\u1EC3m tra d\u1EEF li\u1EC7u c\u1EE7a b\u1EA1n"),xh=o(),_n=l("p"),rc=h("\u0110i\u1EC1u n\xE0y kh\xF4ng c\u1EA7n ph\u1EA3i n\xF3i, nh\u01B0ng n\u1EBFu d\u1EEF li\u1EC7u c\u1EE7a b\u1EA1n b\u1ECB h\u1ECFng, "),Ha=l("code"),cc=h("Trainer"),oc=h(" s\u1EBD kh\xF4ng th\u1EC3 t\u1EA1o ra c\xE1c l\xF4 ch\u1EE9 \u0111\u1EEBng n\xF3i \u0111\u1EBFn vi\u1EC7c hu\u1EA5n luy\u1EC7n m\xF4 h\xECnh c\u1EE7a b\u1EA1n. V\xEC v\u1EADy, \u0111i\u1EC1u \u0111\u1EA7u ti\xEAn, b\u1EA1n c\u1EA7n ph\u1EA3i xem x\xE9t nh\u1EEFng g\xEC b\xEAn trong b\u1ED9 hu\u1EA5n luy\u1EC7n c\u1EE7a b\u1EA1n."),Ch=o(),$n=l("p"),pc=h("\u0110\u1EC3 tr\xE1nh m\u1EA5t v\xF4 s\u1ED1 gi\u1EDD \u0111\u1EC3 c\u1ED1 g\u1EAFng s\u1EEDa m\u1ED9t c\xE1i g\xEC \u0111\xF3 kh\xF4ng ph\u1EA3i l\xE0 ngu\u1ED3n g\u1ED1c c\u1EE7a l\u1ED7i, ch\xFAng t\xF4i khuy\xEAn b\u1EA1n n\xEAn s\u1EED d\u1EE5ng "),Ia=l("code"),uc=h("trainr.train_dataset"),mc=h(" \u0111\u1EC3 ki\u1EC3m tra. V\xEC v\u1EADy, h\xE3y l\xE0m \u0111i\u1EC1u \u0111\xF3 \u1EDF \u0111\xE2y:"),Th=o(),u(mt.$$.fragment),Ph=o(),u(gt.$$.fragment),Ah=o(),K=l("p"),gc=h("B\u1EA1n c\xF3 nh\u1EADn th\u1EA5y \u0111i\u1EC1u g\xEC \u0111\xF3 sai kh\xF4ng? \u0110i\u1EC1u n\xE0y, c\xF9ng v\u1EDBi th\xF4ng b\xE1o l\u1ED7i v\u1EC1 vi\u1EC7c thi\u1EBFu "),Fa=l("code"),dc=h("input_ids"),fc=h(", s\u1EBD khi\u1EBFn b\u1EA1n nh\u1EADn ra \u0111\xF3 l\xE0 c\xE1c v\u0103n b\u1EA3n ch\u1EE9 kh\xF4ng ph\u1EA3i s\u1ED1 m\xE0 m\xF4 h\xECnh c\xF3 th\u1EC3 hi\u1EC3u \u0111\u01B0\u1EE3c. \u1EDE \u0111\xE2y, l\u1ED7i ban \u0111\u1EA7u r\u1EA5t d\u1EC5 g\xE2y hi\u1EC3u nh\u1EA7m b\u1EDFi v\xEC "),Ka=l("code"),bc=h("Trainer"),vc=h(" t\u1EF1 \u0111\u1ED9ng lo\u1EA1i b\u1ECF c\xE1c c\u1ED9t kh\xF4ng kh\u1EDBp v\u1EDBi \u0111\u1EB7c tr\u01B0ng c\u1EE7a m\xF4 h\xECnh (ngh\u0129a l\xE0 c\xE1c tham s\u1ED1 m\xE0 m\xF4 h\xECnh mong \u0111\u1EE3i). \u0110i\u1EC1u \u0111\xF3 c\xF3 ngh\u0129a l\xE0 \u1EDF \u0111\xE2y, m\u1ECDi th\u1EE9 ngo\u1EA1i tr\u1EEB nh\xE3n \u0111\u1EC1u b\u1ECB lo\u1EA1i b\u1ECF. Do \u0111\xF3, kh\xF4ng c\xF3 v\u1EA5n \u0111\u1EC1 g\xEC v\u1EDBi vi\u1EC7c t\u1EA1o c\xE1c l\xF4 v\xE0 sau \u0111\xF3 g\u1EEDi ch\xFAng \u0111\u1EBFn m\xF4 h\xECnh, \u0111i\u1EC1u n\xE0y do \u0111\xF3 ph\xE0n n\xE0n r\u1EB1ng n\xF3 kh\xF4ng nh\u1EADn \u0111\u01B0\u1EE3c \u0111\u1EA7u v\xE0o th\xEDch h\u1EE3p."),Dh=o(),D=l("p"),kc=h("T\u1EA1i sao d\u1EEF li\u1EC7u kh\xF4ng \u0111\u01B0\u1EE3c x\u1EED l\xFD? Ch\xFAng ta \u0111\xE3 s\u1EED d\u1EE5ng ph\u01B0\u01A1ng th\u1EE9c "),Wa=l("code"),yc=h("Dataset.map()"),_c=h(" tr\xEAn c\xE1c t\u1EADp d\u1EEF li\u1EC7u \u0111\u1EC3 \xE1p d\u1EE5ng tokenizer tr\xEAn m\u1ED7i m\u1EABu. Nh\u01B0ng n\u1EBFu b\u1EA1n xem k\u1EF9 m\xE3, b\u1EA1n s\u1EBD th\u1EA5y r\u1EB1ng ch\xFAng ta \u0111\xE3 m\u1EAFc sai l\u1EA7m khi chuy\u1EC3n c\xE1c b\u1ED9 hu\u1EA5n luy\u1EC7n v\xE0 ki\u1EC3m \u0111\u1ECBnh cho "),Ra=l("code"),$c=h("Trainer"),wc=h(". Thay v\xEC s\u1EED d\u1EE5ng "),Ya=l("code"),jc=h("tokenized_datasets"),Ec=h(" \u1EDF \u0111\xE2y, ch\xFAng ta \u0111\xE3 s\u1EED d\u1EE5ng "),Xa=l("code"),qc=h("raw_datasets"),xc=h(" \u{1F926}. V\xEC v\u1EADy, h\xE3y c\xF9ng s\u1EEDa ch\u1EEFa \u0111i\u1EC1u n\xE0y!"),zh=o(),u(dt.$$.fragment),Nh=o(),Ne=l("p"),Cc=h("M\xE3 m\u1EDBi n\xE0y b\xE2y gi\u1EDD s\u1EBD \u0111\u01B0a ra m\u1ED9t l\u1ED7i kh\xE1c (c\xF3 ti\u1EBFn tri\u1EC3n!):"),Sh=o(),u(ft.$$.fragment),Oh=o(),Se=l("p"),Tc=h("Nh\xECn v\xE0o d\u1EA5u truy v\u1EBFt, ch\xFAng ta c\xF3 th\u1EC3 th\u1EA5y l\u1ED7i x\u1EA3y ra trong b\u01B0\u1EDBc \u0111\u1ED1i chi\u1EBFu d\u1EEF li\u1EC7u:"),Uh=o(),u(bt.$$.fragment),Vh=o(),Oe=l("p"),Pc=h("V\xEC v\u1EADy, ch\xFAng ta n\xEAn chuy\u1EC3n sang \u0111i\u1EC1u \u0111\xF3. Tuy nhi\xEAn, tr\u01B0\u1EDBc khi th\u1EF1c hi\u1EC7n, ch\xFAng ta h\xE3y ho\xE0n th\xE0nh vi\u1EC7c ki\u1EC3m tra d\u1EEF li\u1EC7u c\u1EE7a m\xECnh, \u0111\u1EC3 ch\u1EAFc ch\u1EAFn r\u1EB1ng n\xF3 ch\xEDnh x\xE1c 100%."),Bh=o(),Ue=l("p"),Ac=h("M\u1ED9t \u0111i\u1EC1u b\u1EA1n lu\xF4n n\xEAn l\xE0m khi g\u1EE1 l\u1ED7i m\u1ED9t phi\xEAn hu\u1EA5n luy\u1EC7n l\xE0 xem x\xE9t c\xE1c \u0111\u1EA7u v\xE0o \u0111\u01B0\u1EE3c gi\u1EA3i m\xE3 c\u1EE7a m\xF4 h\xECnh c\u1EE7a b\u1EA1n. Ch\xFAng ta kh\xF4ng th\u1EC3 hi\u1EC3u \u0111\u01B0\u1EE3c nh\u1EEFng con s\u1ED1 m\xE0 ch\xFAng ta cung c\u1EA5p tr\u1EF1c ti\u1EBFp cho n\xF3, v\xEC v\u1EADy ch\xFAng ta n\xEAn xem nh\u1EEFng con s\u1ED1 \u0111\xF3 \u0111\u1EA1i di\u1EC7n cho \u0111i\u1EC1u g\xEC. V\xED d\u1EE5: trong th\u1ECB gi\xE1c m\xE1y t\xEDnh, \u0111i\u1EC1u \u0111\xF3 c\xF3 ngh\u0129a l\xE0 nh\xECn v\xE0o h\xECnh \u1EA3nh \u0111\u01B0\u1EE3c gi\u1EA3i m\xE3 c\u1EE7a c\xE1c pixel b\u1EA1n chuy\u1EC3n qua, trong l\u1EDDi n\xF3i, \u0111i\u1EC1u \u0111\xF3 c\xF3 ngh\u0129a l\xE0 nghe c\xE1c m\u1EABu \xE2m thanh \u0111\u01B0\u1EE3c gi\u1EA3i m\xE3 v\xE0 \u0111\u1ED1i v\u1EDBi v\xED d\u1EE5 NLP c\u1EE7a ch\xFAng ta \u1EDF \u0111\xE2y, \u0111i\u1EC1u \u0111\xF3 c\xF3 ngh\u0129a l\xE0 s\u1EED d\u1EE5ng tr\xECnh tokenizer \u0111\u1EC3 gi\u1EA3i m\xE3 \u0111\u1EA7u v\xE0o:"),Mh=o(),u(vt.$$.fragment),Lh=o(),u(kt.$$.fragment),Gh=o(),Ve=l("p"),Dc=h("V\xEC v\u1EADy, \u0111i\u1EC1u \u0111\xF3 c\xF3 v\u1EBB ch\xEDnh x\xE1c. B\u1EA1n n\xEAn l\xE0m \u0111i\u1EC1u n\xE0y cho t\u1EA5t c\u1EA3 c\xE1c ph\xEDm trong \u0111\u1EA7u v\xE0o:"),Hh=o(),u(yt.$$.fragment),Ih=o(),u(_t.$$.fragment),Fh=o(),z=l("p"),zc=h("L\u01B0u \xFD r\u1EB1ng c\xE1c kh\xF3a kh\xF4ng t\u01B0\u01A1ng \u1EE9ng v\u1EDBi \u0111\u1EA7u v\xE0o \u0111\u01B0\u1EE3c m\xF4 h\xECnh ch\u1EA5p nh\u1EADn s\u1EBD t\u1EF1 \u0111\u1ED9ng b\u1ECB lo\u1EA1i b\u1ECF, v\xEC v\u1EADy \u1EDF \u0111\xE2y ch\xFAng t\xF4i s\u1EBD ch\u1EC9 gi\u1EEF l\u1EA1i "),Ja=l("code"),Nc=h("input_ids"),Sc=h(", "),Qa=l("code"),Oc=h("attention_mask"),Uc=h(", v\xE0 "),Za=l("code"),Vc=h("label"),Bc=h(" (s\u1EBD \u0111\u01B0\u1EE3c \u0111\u1ED5i t\xEAn th\xE0nh "),ns=l("code"),Mc=h("labels"),Lc=h("). \u0110\u1EC3 ki\u1EC3m tra k\u1EF9 m\xF4 h\xECnh, b\u1EA1n c\xF3 th\u1EC3 in lo\u1EA1i m\xF4 h\xECnh c\u1EE7a m\xECnh, sau \u0111\xF3 ki\u1EC3m tra t\xE0i li\u1EC7u c\u1EE7a n\xF3:"),Kh=o(),u($t.$$.fragment),Wh=o(),u(wt.$$.fragment),Rh=o(),W=l("p"),Gc=h("V\xEC v\u1EADy, trong tr\u01B0\u1EDDng h\u1EE3p c\u1EE7a m\xECnh, ch\xFAng ta c\xF3 th\u1EC3 ki\u1EC3m tra c\xE1c tham s\u1ED1 \u0111\u01B0\u1EE3c ch\u1EA5p nh\u1EADn tr\xEAn "),jt=l("a"),Hc=h("trang n\xE0y"),Ic=h(". "),ts=l("code"),Fc=h("Trainer"),Kc=h(" c\u0169ng s\u1EBD ghi l\u1EA1i c\xE1c c\u1ED9t m\xE0 n\xF3 \u0111ang lo\u1EA1i b\u1ECF."),Yh=o(),wn=l("p"),Wc=h("Ch\xFAng ta \u0111\xE3 ki\u1EC3m tra xem c\xE1c ID \u0111\u1EA7u v\xE0o c\xF3 ch\xEDnh x\xE1c hay kh\xF4ng b\u1EB1ng c\xE1ch gi\u1EA3i m\xE3 ch\xFAng. Ti\u1EBFp theo l\xE0 "),es=l("code"),Rc=h("attention_mask"),Yc=h(":"),Xh=o(),u(Et.$$.fragment),Jh=o(),u(qt.$$.fragment),Qh=o(),Be=l("p"),Xc=h("V\xEC ch\xFAng ta kh\xF4ng \xE1p d\u1EE5ng \u0111\u1EC7m trong qu\xE1 tr\xECnh ti\u1EC1n x\u1EED l\xFD c\u1EE7a m\xECnh, \u0111i\u1EC1u n\xE0y c\xF3 v\u1EBB ho\xE0n to\xE0n t\u1EF1 nhi\xEAn. \u0110\u1EC3 \u0111\u1EA3m b\u1EA3o kh\xF4ng c\xF3 v\u1EA5n \u0111\u1EC1 g\xEC v\u1EDBi attention mask \u0111\xF3, h\xE3y ki\u1EC3m tra xem n\xF3 c\xF3 c\xF9ng \u0111\u1ED9 d\xE0i v\u1EDBi ID \u0111\u1EA7u v\xE0o c\u1EE7a ch\xFAng ta kh\xF4ng:"),Zh=o(),u(xt.$$.fragment),ni=o(),u(Ct.$$.fragment),ti=o(),Me=l("p"),Jc=h("T\u1ED1t \u0111\u1EA5y! Cu\u1ED1i c\xF9ng, h\xE3y ki\u1EC3m tra nh\xE3n c\u1EE7a m\xECnh:"),ei=o(),u(Tt.$$.fragment),ai=o(),u(Pt.$$.fragment),si=o(),R=l("p"),Qc=h("Gi\u1ED1ng nh\u01B0 c\xE1c ID \u0111\u1EA7u v\xE0o, \u0111\xE2y l\xE0 m\u1ED9t con s\u1ED1 kh\xF4ng th\u1EF1c s\u1EF1 c\xF3 \xFD ngh\u0129a. Nh\u01B0 ch\xFAng ta \u0111\xE3 th\u1EA5y tr\u01B0\u1EDBc \u0111\xE2y, \xE1nh x\u1EA1 gi\u1EEFa c\xE1c s\u1ED1 nguy\xEAn v\xE0 t\xEAn nh\xE3n \u0111\u01B0\u1EE3c l\u01B0u tr\u1EEF b\xEAn trong thu\u1ED9c t\xEDnh "),as=l("code"),Zc=h("names"),no=h(" c\u1EE7a "),ss=l("em"),to=h("\u0111\u1EB7c tr\u01B0ng"),eo=h(" t\u01B0\u01A1ng \u1EE9ng c\u1EE7a t\u1EADp d\u1EEF li\u1EC7u:"),hi=o(),u(At.$$.fragment),ii=o(),u(Dt.$$.fragment),li=o(),Y=l("p"),ao=h("V\xEC v\u1EADy, "),hs=l("code"),so=h("1"),ho=h(" c\xF3 ngh\u0129a l\xE0 "),is=l("code"),io=h("neutral"),lo=h(", c\xF3 ngh\u0129a l\xE0 hai c\xE2u ch\xFAng ta \u0111\xE3 th\u1EA5y \u1EDF tr\xEAn kh\xF4ng m\xE2u thu\u1EABn v\u1EDBi nhau v\xE0 c\xE2u \u0111\u1EA7u ti\xEAn kh\xF4ng bao h\xE0m c\xE2u th\u1EE9 hai. \u0110i\u1EC1u \u0111\xF3 c\xF3 v\u1EBB \u0111\xFAng!"),ri=o(),Le=l("p"),ro=h("Ch\xFAng ta kh\xF4ng c\xF3 token ID \u1EDF \u0111\xE2y, v\xEC DistilBERT kh\xF4ng mong \u0111\u1EE3i ch\xFAng; n\u1EBFu b\u1EA1n c\xF3 m\u1ED9t s\u1ED1 trong m\xF4 h\xECnh c\u1EE7a m\xECnh, b\u1EA1n c\u0169ng n\xEAn \u0111\u1EA3m b\u1EA3o r\u1EB1ng ch\xFAng kh\u1EDBp \u0111\xFAng v\u1EDBi v\u1ECB tr\xED c\u1EE7a c\xE2u \u0111\u1EA7u ti\xEAn v\xE0 c\xE2u th\u1EE9 hai trong \u0111\u1EA7u v\xE0o."),ci=o(),u(jn.$$.fragment),oi=o(),Ge=l("p"),co=h("Ch\xFAng ta ch\u1EC9 th\u1EF1c hi\u1EC7n ki\u1EC3m tra t\u1EADp hu\u1EA5n luy\u1EC7n \u1EDF \u0111\xE2y, nh\u01B0ng t\u1EA5t nhi\xEAn b\u1EA1n n\xEAn ki\u1EC3m tra k\u1EF9 c\xE1c t\u1EADp ki\u1EC3m \u0111\u1ECBnh v\xE0 ki\u1EC3m tra theo c\xF9ng m\u1ED9t c\xE1ch."),pi=o(),He=l("p"),oo=h("B\xE2y gi\u1EDD ch\xFAng ta bi\u1EBFt b\u1ED9 d\u1EEF li\u1EC7u c\u1EE7a m\xECnh tr\xF4ng \u1ED5n, \u0111\xE3 \u0111\u1EBFn l\xFAc ki\u1EC3m tra b\u01B0\u1EDBc ti\u1EBFp theo c\u1EE7a quy tr\xECnh hu\u1EA5n luy\u1EC7n."),ui=o(),hn=l("h3"),En=l("a"),ls=l("span"),u(zt.$$.fragment),po=o(),rs=l("span"),uo=h("T\u1EEB b\u1ED9 d\u1EEF li\u1EC7u th\xE0nh dataloader"),mi=o(),N=l("p"),mo=h("\u0110i\u1EC1u ti\u1EBFp theo c\xF3 th\u1EC3 x\u1EA3y ra sai s\xF3t trong quy tr\xECnh hu\u1EA5n luy\u1EC7n l\xE0 khi "),cs=l("code"),go=h("Trainer"),fo=h(" c\u1ED1 g\u1EAFng t\u1EA1o c\xE1c l\xF4 t\u1EEB t\u1EADp hu\u1EA5n luy\u1EC7n ho\u1EB7c ki\u1EC3m \u0111\u1ECBnh. Khi b\u1EA1n ch\u1EAFc ch\u1EAFn r\u1EB1ng t\u1EADp d\u1EEF li\u1EC7u c\u1EE7a "),os=l("code"),bo=h("Trainer"),vo=h(" l\xE0 ch\xEDnh x\xE1c, b\u1EA1n c\xF3 th\u1EC3 th\u1EED t\u1EA1o m\u1ED9t lo\u1EA1t theo c\xE1ch th\u1EE7 c\xF4ng b\u1EB1ng c\xE1ch th\u1EF1c hi\u1EC7n nh\u01B0 sau (thay th\u1EBF "),ps=l("code"),ko=h("train"),yo=h(" b\u1EB1ng "),us=l("code"),_o=h("eval"),$o=h(" cho dataloader ki\u1EC3m \u0111\u1ECBnh):"),gi=o(),u(Nt.$$.fragment),di=o(),Ie=l("p"),wo=h("M\xE3 n\xE0y t\u1EA1o ra dataloader hu\u1EA5n luy\u1EC7n, sau \u0111\xF3 l\u1EB7p qua n\xF3, d\u1EEBng l\u1EA1i \u1EDF l\u1EA7n l\u1EB7p \u0111\u1EA7u ti\xEAn. N\u1EBFu m\xE3 th\u1EF1c thi m\xE0 kh\xF4ng c\xF3 l\u1ED7i, b\u1EA1n c\xF3 l\xF4 hu\u1EA5n luy\u1EC7n \u0111\u1EA7u ti\xEAn m\xE0 b\u1EA1n c\xF3 th\u1EC3 ki\u1EC3m tra v\xE0 n\u1EBFu m\xE3 l\u1ED7i x\u1EA3y ra, b\u1EA1n bi\u1EBFt ch\u1EAFc ch\u1EAFn v\u1EA5n \u0111\u1EC1 n\u1EB1m trong dataloader, nh\u01B0 tr\u01B0\u1EDDng h\u1EE3p \u1EDF \u0111\xE2y:"),fi=o(),u(St.$$.fragment),bi=o(),X=l("p"),jo=h("Vi\u1EC7c ki\u1EC3m tra khung cu\u1ED1i c\xF9ng c\u1EE7a qu\xE1 tr\xECnh truy xu\u1EA5t s\u1EBD \u0111\u1EE7 \u0111\u1EC3 cung c\u1EA5p cho b\u1EA1n manh m\u1ED1i, nh\u01B0ng h\xE3y t\xECm hi\u1EC3u k\u1EF9 h\u01A1n m\u1ED9t ch\xFAt. H\u1EA7u h\u1EBFt c\xE1c v\u1EA5n \u0111\u1EC1 trong qu\xE1 tr\xECnh t\u1EA1o l\xF4 \u0111\u1EC1u ph\xE1t sinh do vi\u1EC7c \u0111\u1ED1i chi\u1EBFu c\xE1c v\xED d\u1EE5 th\xE0nh m\u1ED9t l\xF4 duy nh\u1EA5t, v\xEC v\u1EADy, \u0111i\u1EC1u \u0111\u1EA7u ti\xEAn c\u1EA7n ki\u1EC3m tra khi nghi ng\u1EDD l\xE0 "),ms=l("code"),Eo=h("collate_fn"),qo=h(" m\xE0 "),gs=l("code"),xo=h("DataLoader"),Co=h(" c\u1EE7a b\u1EA1n \u0111ang s\u1EED d\u1EE5ng:"),vi=o(),u(Ot.$$.fragment),ki=o(),u(Ut.$$.fragment),yi=o(),B=l("p"),To=h("V\xEC v\u1EADy, \u0111\xE2y l\xE0 "),ds=l("code"),Po=h("default_data_collator"),Ao=h(", nh\u01B0ng \u0111\xF3 kh\xF4ng ph\u1EA3i l\xE0 nh\u1EEFng g\xEC ch\xFAng ta mu\u1ED1n trong tr\u01B0\u1EDDng h\u1EE3p n\xE0y. Ch\xFAng ta mu\u1ED1n \u0111\u01B0a c\xE1c v\xED d\u1EE5 c\u1EE7a m\xECnh v\xE0o c\xE2u d\xE0i nh\u1EA5t trong l\xF4, \u0111\u01B0\u1EE3c th\u1EF1c hi\u1EC7n b\u1EDFi tr\xECnh \u0111\u1ED1i chi\u1EBFu "),fs=l("code"),Do=h("DataCollatorWithPadding"),zo=h(". V\xE0 tr\xECnh \u0111\u1ED1i chi\u1EBFu d\u1EEF li\u1EC7u n\xE0y \u0111\u01B0\u1EE3c cho l\xE0 \u0111\u01B0\u1EE3c s\u1EED d\u1EE5ng theo m\u1EB7c \u0111\u1ECBnh b\u1EDFi "),bs=l("code"),No=h("Trainer"),So=h(", v\u1EADy t\u1EA1i sao n\xF3 kh\xF4ng \u0111\u01B0\u1EE3c s\u1EED d\u1EE5ng \u1EDF \u0111\xE2y?"),_i=o(),M=l("p"),Oo=h("C\xE2u tr\u1EA3 l\u1EDDi l\xE0 v\xEC ch\xFAng ta \u0111\xE3 kh\xF4ng chuy\u1EC3n "),vs=l("code"),Uo=h("tokenizer"),Vo=h(" cho "),ks=l("code"),Bo=h("Trainer"),Mo=h(", v\xEC v\u1EADy n\xF3 kh\xF4ng th\u1EC3 t\u1EA1o "),ys=l("code"),Lo=h("DataCollatorWithPadding"),Go=h(" m\xE0 ch\xFAng ta mu\u1ED1n. Trong th\u1EF1c t\u1EBF, b\u1EA1n \u0111\u1EEBng bao gi\u1EDD ng\u1EA7n ng\u1EA1i chuy\u1EC3n m\u1ED9t c\xE1ch r\xF5 r\xE0ng b\u1ED9 \u0111\u1ED1i chi\u1EBFu d\u1EEF li\u1EC7u m\xE0 b\u1EA1n mu\u1ED1n s\u1EED d\u1EE5ng, \u0111\u1EC3 \u0111\u1EA3m b\u1EA3o r\u1EB1ng b\u1EA1n tr\xE1nh \u0111\u01B0\u1EE3c nh\u1EEFng lo\u1EA1i l\u1ED7i n\xE0y. H\xE3y \u0111i\u1EC1u ch\u1EC9nh m\xE3 c\u1EE7a ch\xFAng ta \u0111\u1EC3 th\u1EF1c hi\u1EC7n ch\xEDnh x\xE1c \u0111i\u1EC1u \u0111\xF3:"),$i=o(),u(Vt.$$.fragment),wi=o(),Fe=l("p"),Ho=h("Tin t\u1ED1t? Ch\xFAng ta kh\xF4ng g\u1EB7p l\u1ED7i nh\u01B0 tr\u01B0\u1EDBc n\u1EEFa, \u0111\xF3 ch\u1EAFc ch\u1EAFn l\xE0 s\u1EF1 ti\u1EBFn b\u1ED9. C\xE1c tin x\u1EA5u? Thay v\xE0o \u0111\xF3, ch\xFAng ta nh\u1EADn \u0111\u01B0\u1EE3c m\u1ED9t l\u1ED7i CUDA kh\xE9t ti\u1EBFng:"),ji=o(),u(Bt.$$.fragment),Ei=o(),Ke=l("p"),Io=h("\u0110i\u1EC1u n\xE0y th\u1EADt t\u1EC7 v\xEC l\u1ED7i CUDA n\xF3i chung r\u1EA5t kh\xF3 g\u1EE1 l\u1ED7i. Ch\xFAng ta s\u1EBD xem trong m\u1ED9t ph\xFAt n\u1EEFa c\xE1ch gi\u1EA3i quy\u1EBFt v\u1EA5n \u0111\u1EC1 n\xE0y, nh\u01B0ng tr\u01B0\u1EDBc ti\xEAn h\xE3y k\u1EBFt th\xFAc ph\xE2n t\xEDch c\u1EE7a ch\xFAng ta v\u1EC1 t\u1EA1o l\xF4."),qi=o(),We=l("p"),Fo=h("N\u1EBFu b\u1EA1n ch\u1EAFc ch\u1EAFn tr\xECnh \u0111\u1ED1i chi\u1EBFu d\u1EEF li\u1EC7u c\u1EE7a m\xECnh l\xE0 \u0111\xFAng, b\u1EA1n n\xEAn th\u1EED \xE1p d\u1EE5ng n\xF3 tr\xEAn m\u1ED9t v\xE0i m\u1EABu c\u1EE7a t\u1EADp d\u1EEF li\u1EC7u c\u1EE7a m\xECnh:"),xi=o(),u(Mt.$$.fragment),Ci=o(),S=l("p"),Ko=h("M\xE3 n\xE0y s\u1EBD kh\xF4ng th\xE0nh c\xF4ng v\xEC "),_s=l("code"),Wo=h("train_dataset"),Ro=h(" ch\u1EE9a c\xE1c c\u1ED9t chu\u1ED7i m\xE0 "),$s=l("code"),Yo=h("Trainer"),Xo=h(" th\u01B0\u1EDDng lo\u1EA1i b\u1ECF. B\u1EA1n c\xF3 th\u1EC3 x\xF3a ch\xFAng theo c\xE1ch th\u1EE7 c\xF4ng ho\u1EB7c n\u1EBFu b\u1EA1n mu\u1ED1n sao ch\xE9p ch\xEDnh x\xE1c nh\u1EEFng g\xEC m\xE0 "),ws=l("code"),Jo=h("Trainer"),Qo=h(" \u0111ang l\xE0m \u1EDF h\u1EADu tr\u01B0\u1EDDng, b\u1EA1n c\xF3 th\u1EC3 g\u1ECDi ph\u01B0\u01A1ng th\u1EE9c ri\xEAng  "),js=l("code"),Zo=h("Trainer._remove_unused_columns()"),np=h(" \u0111\u1EC3 th\u1EF1c hi\u1EC7n \u0111i\u1EC1u \u0111\xF3:"),Ti=o(),u(Lt.$$.fragment),Pi=o(),Re=l("p"),tp=h("Sau \u0111\xF3, b\u1EA1n s\u1EBD c\xF3 th\u1EC3 g\u1EE1 l\u1ED7i theo c\xE1ch th\u1EE7 c\xF4ng nh\u1EEFng g\xEC x\u1EA3y ra b\xEAn trong b\u1ED9 \u0111\u1ED1i chi\u1EBFu d\u1EEF li\u1EC7u n\u1EBFu l\u1ED7i v\u1EABn ti\u1EBFp di\u1EC5n."),Ai=o(),Ye=l("p"),ep=h("B\xE2y gi\u1EDD ch\xFAng ta \u0111\xE3 g\u1EE1 l\u1ED7i quy tr\xECnh t\u1EA1o l\xF4, \u0111\xE3 \u0111\u1EBFn l\xFAc chuy\u1EC3n qua m\xF4 h\xECnh!"),Di=o(),ln=l("h3"),qn=l("a"),Es=l("span"),u(Gt.$$.fragment),ap=o(),qs=l("span"),sp=h("Xem qua m\xF4 h\xECnh"),zi=o(),Xe=l("p"),hp=h("B\u1EA1n s\u1EBD c\xF3 th\u1EC3 nh\u1EADn \u0111\u01B0\u1EE3c m\u1ED9t l\xF4 b\u1EB1ng c\xE1ch th\u1EF1c hi\u1EC7n l\u1EC7nh sau:"),Ni=o(),u(Ht.$$.fragment),Si=o(),xn=l("p"),ip=h("N\u1EBFu b\u1EA1n \u0111ang ch\u1EA1y m\xE3 n\xE0y trong notebook, b\u1EA1n c\xF3 th\u1EC3 g\u1EB7p l\u1ED7i CUDA t\u01B0\u01A1ng t\u1EF1 nh\u01B0 l\u1ED7i \u0111\xE3 th\u1EA5y tr\u01B0\u1EDBc \u0111\xF3, trong tr\u01B0\u1EDDng h\u1EE3p \u0111\xF3, b\u1EA1n c\u1EA7n kh\u1EDFi \u0111\u1ED9ng l\u1EA1i notebook c\u1EE7a m\xECnh v\xE0 th\u1EF1c hi\u1EC7n l\u1EA1i \u0111o\u1EA1n m\xE3 cu\u1ED1i c\xF9ng m\xE0 kh\xF4ng c\xF3 d\xF2ng "),xs=l("code"),lp=h("trainer.train()"),rp=h(". \u0110\xF3 l\xE0 \u0111i\u1EC1u kh\xF3 ch\u1ECBu th\u1EE9 hai v\u1EC1 l\u1ED7i CUDA: ch\xFAng ph\xE1 v\u1EE1 kernel c\u1EE7a b\u1EA1n m\u1ED9t c\xE1ch kh\xF4ng th\u1EC3 kh\u1EAFc ph\u1EE5c \u0111\u01B0\u1EE3c. \u0110i\u1EC1u kh\xF3 ch\u1ECBu nh\u1EA5t v\u1EC1 ch\xFAng l\xE0 th\u1EF1c t\u1EBF l\xE0 ch\xFAng r\u1EA5t kh\xF3 \u0111\u1EC3 g\u1EE1 l\u1ED7i."),Oi=o(),Je=l("p"),cp=h("T\u1EA1i sao v\u1EADy? N\xF3 li\xEAn quan \u0111\u1EBFn c\xE1ch ho\u1EA1t \u0111\u1ED9ng c\u1EE7a GPU. Ch\xFAng c\u1EF1c k\u1EF3 hi\u1EC7u qu\u1EA3 trong vi\u1EC7c th\u1EF1c hi\u1EC7n song song nhi\u1EC1u thao t\xE1c, nh\u01B0ng h\u1EA1n ch\u1EBF l\xE0 khi m\u1ED9t trong c\xE1c l\u1EC7nh \u0111\xF3 d\u1EABn \u0111\u1EBFn l\u1ED7i, b\u1EA1n s\u1EBD kh\xF4ng bi\u1EBFt ngay l\u1EADp t\u1EE9c. Ch\u1EC9 khi ch\u01B0\u01A1ng tr\xECnh g\u1ECDi \u0111\u1ED3ng b\u1ED9 h\xF3a nhi\u1EC1u quy tr\xECnh tr\xEAn GPU th\xEC n\xF3 m\u1EDBi nh\u1EADn ra c\xF3 g\xEC \u0111\xF3 kh\xF4ng \u1ED5n, v\xEC v\u1EADy l\u1ED7i th\u1EF1c s\u1EF1 \u0111\u01B0\u1EE3c ph\xE1t sinh \u1EDF m\u1ED9t n\u01A1i kh\xF4ng li\xEAn quan g\xEC \u0111\u1EBFn nh\u1EEFng g\xEC \u0111\xE3 t\u1EA1o ra n\xF3. V\xED d\u1EE5, n\u1EBFu ch\xFAng ta xem l\u1EA1i l\u1EA7n truy xu\u1EA5t tr\u01B0\u1EDBc c\u1EE7a m\xECnh, l\u1ED7i \u0111\xE3 \u0111\u01B0\u1EE3c ph\xE1t sinh trong qu\xE1 tr\xECnh truy\u1EC1n ng\u01B0\u1EE3c, nh\u01B0ng ch\xFAng ta s\u1EBD th\u1EA5y trong m\u1ED9t ph\xFAt r\u1EB1ng n\xF3 th\u1EF1c s\u1EF1 b\u1EAFt ngu\u1ED3n t\u1EEB m\u1ED9t c\xE1i g\xEC \u0111\xF3 trong truy\u1EC1n th\u1EB3ng."),Ui=o(),Qe=l("p"),op=h("V\u1EADy l\xE0m c\xE1ch n\xE0o \u0111\u1EC3 g\u1EE1 nh\u1EEFng l\u1ED7i \u0111\xF3? C\xE2u tr\u1EA3 l\u1EDDi r\u1EA5t d\u1EC5 d\xE0ng: ch\xFAng t\xF4i kh\xF4ng. Tr\u1EEB khi l\u1ED7i CUDA c\u1EE7a b\u1EA1n l\xE0 l\u1ED7i h\u1EBFt b\u1ED9 nh\u1EDB (c\xF3 ngh\u0129a l\xE0 kh\xF4ng c\xF3 \u0111\u1EE7 b\u1ED9 nh\u1EDB trong GPU c\u1EE7a b\u1EA1n), b\u1EA1n n\xEAn quay l\u1EA1i CPU \u0111\u1EC3 g\u1EE1 l\u1ED7i."),Vi=o(),Cn=l("p"),pp=h("\u0110\u1EC3 th\u1EF1c hi\u1EC7n \u0111i\u1EC1u n\xE0y trong tr\u01B0\u1EDDng h\u1EE3p c\u1EE7a m\xECnh, ch\xFAng ta ch\u1EC9 c\u1EA7n \u0111\u1EB7t m\xF4 h\xECnh tr\u1EDF l\u1EA1i CPU v\xE0 g\u1ECDi n\xF3 v\xE0o l\xF4 c\u1EE7a m\xECnh - l\xF4 \u0111\u01B0\u1EE3c tr\u1EA3 v\u1EC1 b\u1EDFi "),Cs=l("code"),up=h("DataLoader"),mp=h(" v\u1EABn ch\u01B0a \u0111\u01B0\u1EE3c chuy\u1EC3n \u0111\u1EBFn GPU:"),Bi=o(),u(It.$$.fragment),Mi=o(),u(Ft.$$.fragment),Li=o(),Tn=l("p"),gp=h("V\xEC v\u1EADy, b\u1EE9c tranh ng\xE0y c\xE0ng r\xF5 r\xE0ng. Thay v\xEC g\u1EB7p l\u1ED7i CUDA, b\xE2y gi\u1EDD ch\xFAng ta c\xF3 "),Ts=l("code"),dp=h("IndexError"),fp=h(" trong t\xEDnh to\xE1n m\u1EA5t m\xE1t (v\xEC v\u1EADy kh\xF4ng li\xEAn quan g\xEC \u0111\u1EBFn lan truy\u1EC1n ng\u01B0\u1EE3c, nh\u01B0 ta \u0111\xE3 n\xF3i tr\u01B0\u1EDBc \u0111\xF3). Ch\xEDnh x\xE1c h\u01A1n, ch\xFAng ta c\xF3 th\u1EC3 th\u1EA5y r\u1EB1ng nh\xE3n 2 t\u1EA1o ra l\u1ED7i, v\xEC v\u1EADy \u0111\xE2y l\xE0 th\u1EDDi \u0111i\u1EC3m r\u1EA5t t\u1ED1t \u0111\u1EC3 ki\u1EC3m tra s\u1ED1 l\u01B0\u1EE3ng nh\xE3n c\u1EE7a m\xF4 h\xECnh c\u1EE7a ta:"),Gi=o(),u(Kt.$$.fragment),Hi=o(),u(Wt.$$.fragment),Ii=o(),Ze=l("p"),bp=h("V\u1EDBi hai nh\xE3n, ch\u1EC9 c\xF3 0 v\xE0 1 \u0111\u01B0\u1EE3c ph\xE9p l\xE0m nh\xE3n, nh\u01B0ng theo th\xF4ng b\xE1o l\u1ED7i, ch\xFAng t\xF4i nh\u1EADn \u0111\u01B0\u1EE3c 2. Nh\u1EADn \u0111\u01B0\u1EE3c 2 th\u1EF1c ra l\xE0 b\xECnh th\u01B0\u1EDDng: n\u1EBFu ch\xFAng ta nh\u1EDB t\xEAn nh\xE3n m\xE0 ch\xFAng ta \u0111\xE3 tr\xEDch xu\u1EA5t tr\u01B0\u1EDBc \u0111\xF3, c\xF3 ba, v\xEC v\u1EADy ch\xFAng ta c\xF3 ch\u1EC9 s\u1ED1 0 , 1 v\xE0 2 trong t\u1EADp d\u1EEF li\u1EC7u c\u1EE7a m\xECnh. V\u1EA5n \u0111\u1EC1 l\xE0 ch\xFAng ta \u0111\xE3 kh\xF4ng n\xF3i \u0111i\u1EC1u \u0111\xF3 v\u1EDBi m\xF4 h\xECnh c\u1EE7a m\xECnh, m\xF4 h\xECnh n\xE0y l\u1EBD ra ph\u1EA3i \u0111\u01B0\u1EE3c t\u1EA1o v\u1EDBi ba nh\xE3n. V\xEC v\u1EADy, ch\xFAng ta h\xE3y kh\u1EAFc ph\u1EE5c \u0111i\u1EC1u \u0111\xF3!"),Fi=o(),u(Rt.$$.fragment),Ki=o(),Pn=l("p"),vp=h("Ch\xFAng ta ch\u01B0a bao g\u1ED3m d\xF2ng "),Ps=l("code"),kp=h("trainer.train()"),yp=h(", \u0111\u1EC3 d\xE0nh th\u1EDDi gian ki\u1EC3m tra xem m\u1ECDi th\u1EE9 c\xF3 \u1ED5n kh\xF4ng. N\u1EBFu ch\xFAng ta y\xEAu c\u1EA7u m\u1ED9t l\xF4 v\xE0 chuy\u1EC3n n\xF3 v\xE0o m\xF4 h\xECnh c\u1EE7a m\xECnh, n\xF3 hi\u1EC7n ho\u1EA1t \u0111\u1ED9ng m\xE0 kh\xF4ng c\xF3 l\u1ED7i!"),Wi=o(),u(Yt.$$.fragment),Ri=o(),na=l("p"),_p=h("B\u01B0\u1EDBc ti\u1EBFp theo l\xE0 quay l\u1EA1i GPU v\xE0 ki\u1EC3m tra xem m\u1ECDi th\u1EE9 v\u1EABn ho\u1EA1t \u0111\u1ED9ng kh\xF4ng:"),Yi=o(),u(Xt.$$.fragment),Xi=o(),ta=l("p"),$p=h("N\u1EBFu b\u1EA1n v\u1EABn g\u1EB7p l\u1ED7i, h\xE3y \u0111\u1EA3m b\u1EA3o r\u1EB1ng b\u1EA1n kh\u1EDFi \u0111\u1ED9ng l\u1EA1i notebook c\u1EE7a m\xECnh v\xE0 ch\u1EC9 th\u1EF1c thi phi\xEAn b\u1EA3n cu\u1ED1i c\xF9ng c\u1EE7a t\u1EADp l\u1EC7nh."),Ji=o(),rn=l("h3"),An=l("a"),As=l("span"),u(Jt.$$.fragment),wp=o(),Ds=l("span"),jp=h("Th\u1EF1c hi\u1EC7n m\u1ED9t b\u01B0\u1EDBc t\u1ED1i \u01B0u h\xF3a"),Qi=o(),ea=l("p"),Ep=h("B\xE2y gi\u1EDD ta bi\u1EBFt r\u1EB1ng ch\xFAng ta c\xF3 th\u1EC3 x\xE2y d\u1EF1ng c\xE1c l\xF4 th\u1EF1c s\u1EF1 \u0111i qua m\xF4 h\xECnh, ch\xFAng ta \u0111\xE3 s\u1EB5n s\xE0ng cho b\u01B0\u1EDBc ti\u1EBFp theo c\u1EE7a quy tr\xECnh hu\u1EA5n luy\u1EC7n: t\xEDnh to\xE1n \u0111\u1ED9 d\u1ED1c v\xE0 th\u1EF1c hi\u1EC7n b\u01B0\u1EDBc t\u1ED1i \u01B0u h\xF3a."),Zi=o(),Dn=l("p"),qp=h("Ph\u1EA7n \u0111\u1EA7u ti\xEAn ch\u1EC9 l\xE0 v\u1EA5n \u0111\u1EC1 g\u1ECDi ph\u01B0\u01A1ng th\u1EE9c "),zs=l("code"),xp=h("backward()"),Cp=h(" khi t\xEDnh m\u1EA5t m\xE1t:"),nl=o(),u(Qt.$$.fragment),tl=o(),aa=l("p"),Tp=h("R\u1EA5t hi\u1EBFm khi g\u1EB7p l\u1ED7i \u1EDF giai \u0111o\u1EA1n n\xE0y, nh\u01B0ng n\u1EBFu b\u1EA1n g\u1EB7p l\u1ED7i, h\xE3y \u0111\u1EA3m b\u1EA3o quay l\u1EA1i CPU \u0111\u1EC3 nh\u1EADn \u0111\u01B0\u1EE3c th\xF4ng b\xE1o l\u1ED7i h\u1EEFu \xEDch."),el=o(),J=l("p"),Pp=h("To perform the optimization step, we just need to create the "),Ns=l("code"),Ap=h("optimizer"),Dp=h(" and call its "),Ss=l("code"),zp=h("step()"),Np=h(" method:"),al=o(),u(Zt.$$.fragment),sl=o(),zn=l("p"),Sp=h("M\u1ED9t l\u1EA7n n\u1EEFa, n\u1EBFu b\u1EA1n \u0111ang s\u1EED d\u1EE5ng tr\xECnh t\u1ED1i \u01B0u h\xF3a m\u1EB7c \u0111\u1ECBnh trong "),Os=l("code"),Op=h("Trainer"),Up=h(", b\u1EA1n s\u1EBD kh\xF4ng g\u1EB7p l\u1ED7i \u1EDF giai \u0111o\u1EA1n n\xE0y, nh\u01B0ng n\u1EBFu b\u1EA1n c\xF3 tr\xECnh t\u1ED1i \u01B0u h\xF3a t\xF9y ch\u1EC9nh, c\xF3 th\u1EC3 c\xF3 m\u1ED9t s\u1ED1 v\u1EA5n \u0111\u1EC1 c\u1EA7n g\u1EE1 l\u1ED7i \u1EDF \u0111\xE2y. \u0110\u1EEBng qu\xEAn quay l\u1EA1i CPU n\u1EBFu b\u1EA1n g\u1EB7p l\u1ED7i CUDA l\u1EA1 \u1EDF giai \u0111o\u1EA1n n\xE0y. N\xF3i v\u1EC1 l\u1ED7i CUDA, tr\u01B0\u1EDBc \u0111\xF3 ch\xFAng ta \u0111\xE3 \u0111\u1EC1 c\u1EADp \u0111\u1EBFn m\u1ED9t tr\u01B0\u1EDDng h\u1EE3p \u0111\u1EB7c bi\u1EC7t. B\xE2y gi\u1EDD ch\xFAng ta h\xE3y xem x\xE9t \u0111i\u1EC1u \u0111\xF3."),hl=o(),cn=l("h3"),Nn=l("a"),Us=l("span"),u(ne.$$.fragment),Vp=o(),Vs=l("span"),Bp=h("X\u1EED l\xFD l\u1ED7i h\u1EBFt b\u1ED9 nh\u1EDB CUDA"),il=o(),Sn=l("p"),Mp=h("B\u1EA5t c\u1EE9 khi n\xE0o b\u1EA1n nh\u1EADn \u0111\u01B0\u1EE3c th\xF4ng b\xE1o l\u1ED7i b\u1EAFt \u0111\u1EA7u b\u1EB1ng "),Bs=l("code"),Lp=h("RuntimeError: CUDA out of memory"),Gp=h(", \u0111i\u1EC1u n\xE0y cho bi\u1EBFt b\u1EA1n \u0111\xE3 h\u1EBFt b\u1ED9 nh\u1EDB GPU. \u0110i\u1EC1u n\xE0y kh\xF4ng \u0111\u01B0\u1EE3c li\xEAn k\u1EBFt tr\u1EF1c ti\u1EBFp v\u1EDBi m\xE3 c\u1EE7a b\u1EA1n v\xE0 n\xF3 c\xF3 th\u1EC3 x\u1EA3y ra v\u1EDBi m\u1ED9t t\u1EADp l\u1EC7nh ch\u1EA1y ho\xE0n to\xE0n t\u1ED1t. L\u1ED7i n\xE0y c\xF3 ngh\u0129a l\xE0 b\u1EA1n \u0111\xE3 c\u1ED1 g\u1EAFng \u0111\u01B0a qu\xE1 nhi\u1EC1u th\u1EE9 v\xE0o b\u1ED9 nh\u1EDB trong c\u1EE7a GPU v\xE0 d\u1EABn \u0111\u1EBFn l\u1ED7i. Gi\u1ED1ng nh\u01B0 v\u1EDBi c\xE1c l\u1ED7i CUDA kh\xE1c, b\u1EA1n s\u1EBD c\u1EA7n kh\u1EDFi \u0111\u1ED9ng l\u1EA1i kernel c\u1EE7a m\xECnh \u0111\u1EC3 \u1EDF v\u1ECB tr\xED m\xE0 b\u1EA1n c\xF3 th\u1EC3 ch\u1EA1y l\u1EA1i qu\xE1 tr\xECnh hu\u1EA5n luy\u1EC7n c\u1EE7a m\xECnh."),ll=o(),sa=l("p"),Hp=h("\u0110\u1EC3 gi\u1EA3i quy\u1EBFt v\u1EA5n \u0111\u1EC1 n\xE0y, b\u1EA1n ch\u1EC9 c\u1EA7n s\u1EED d\u1EE5ng \xEDt dung l\u01B0\u1EE3ng GPU h\u01A1n - \u0111i\u1EC1u m\xE0 n\xF3i th\xEC d\u1EC5 h\u01A1n l\xE0m. Tr\u01B0\u1EDBc ti\xEAn, h\xE3y \u0111\u1EA3m b\u1EA3o r\u1EB1ng b\u1EA1n kh\xF4ng c\xF3 hai m\xF4 h\xECnh GPU tr\xEAn c\xF9ng m\u1ED9t l\xFAc (t\u1EA5t nhi\xEAn l\xE0 tr\u1EEB khi \u0111\xF3 l\xE0 y\xEAu c\u1EA7u cho v\u1EA5n \u0111\u1EC1 c\u1EE7a b\u1EA1n). Sau \u0111\xF3, b\u1EA1n c\xF3 th\u1EC3 n\xEAn gi\u1EA3m k\xEDch th\u01B0\u1EDBc l\xF4 c\u1EE7a m\xECnh, v\xEC n\xF3 \u1EA3nh h\u01B0\u1EDFng tr\u1EF1c ti\u1EBFp \u0111\u1EBFn k\xEDch th\u01B0\u1EDBc c\u1EE7a t\u1EA5t c\u1EA3 c\xE1c \u0111\u1EA7u ra trung gian c\u1EE7a m\xF4 h\xECnh v\xE0 \u0111\u1ED9 d\u1ED1c c\u1EE7a ch\xFAng. N\u1EBFu s\u1EF1 c\u1ED1 v\u1EABn ti\u1EBFp di\u1EC5n, h\xE3y xem x\xE9t s\u1EED d\u1EE5ng phi\xEAn b\u1EA3n m\xF4 h\xECnh nh\u1ECF h\u01A1n c\u1EE7a b\u1EA1n."),rl=o(),u(On.$$.fragment),cl=o(),on=l("h3"),Un=l("a"),Ms=l("span"),u(te.$$.fragment),Ip=o(),Ls=l("span"),Fp=h("\u0110\xE1nh gi\xE1 m\xF4 h\xECnh"),ol=o(),Vn=l("p"),Kp=h("B\xE2y gi\u1EDD ch\xFAng t\xF4i \u0111\xE3 gi\u1EA3i quy\u1EBFt t\u1EA5t c\u1EA3 c\xE1c v\u1EA5n \u0111\u1EC1 v\u1EDBi m\xE3 c\u1EE7a m\xECnh, m\u1ECDi th\u1EE9 \u0111\u1EC1u ho\xE0n h\u1EA3o v\xE0 qu\xE1 tr\xECnh hu\u1EA5n luy\u1EC7n s\u1EBD di\u1EC5n ra su\xF4n s\u1EBB, ph\u1EA3i kh\xF4ng? Kh\xF4ng qu\xE1 nhanh! N\u1EBFu b\u1EA1n ch\u1EA1y l\u1EC7nh "),Gs=l("code"),Wp=h("trainer.train()"),Rp=h(", l\xFAc \u0111\u1EA7u m\u1ECDi th\u1EE9 s\u1EBD \u1ED5n, nh\u01B0ng sau m\u1ED9t th\u1EDDi gian, b\u1EA1n s\u1EBD nh\u1EADn \u0111\u01B0\u1EE3c nh\u1EEFng \u0111i\u1EC1u sau:"),pl=o(),u(ee.$$.fragment),ul=o(),u(ae.$$.fragment),ml=o(),ha=l("p"),Yp=h("B\u1EA1n s\u1EBD nh\u1EADn ra l\u1ED7i n\xE0y xu\u1EA5t hi\u1EC7n trong giai \u0111o\u1EA1n ki\u1EC3m \u0111\u1ECBnh, v\xEC v\u1EADy \u0111\xE2y l\xE0 \u0111i\u1EC1u cu\u1ED1i c\xF9ng ch\xFAng t\xF4i s\u1EBD c\u1EA7n g\u1EE1 l\u1ED7i."),gl=o(),Bn=l("p"),Xp=h("B\u1EA1n c\xF3 th\u1EC3 ch\u1EA1y v\xF2ng l\u1EB7p ki\u1EC3m \u0111\u1ECBnh c\u1EE7a "),Hs=l("code"),Jp=h("Trainer"),Qp=h(" m\u1ED9t c\xE1ch \u0111\u1ED9c l\u1EADp \u0111\u1EC3 h\xECnh th\xE0nh kh\xF3a hu\u1EA5n luy\u1EC7n nh\u01B0 sau:"),dl=o(),u(se.$$.fragment),fl=o(),u(he.$$.fragment),bl=o(),u(Mn.$$.fragment),vl=o(),ia=l("p"),Zp=h("Tr\u01B0\u1EDBc khi c\u1ED1 g\u1EAFng g\u1EE1 l\u1ED7i m\u1ED9t v\u1EA5n \u0111\u1EC1 trong v\xF2ng ki\u1EC3m \u0111\u1ECBnh, tr\u01B0\u1EDBc ti\xEAn b\u1EA1n n\xEAn \u0111\u1EA3m b\u1EA3o r\u1EB1ng b\u1EA1n \u0111\xE3 xem x\xE9t d\u1EEF li\u1EC7u, c\xF3 th\u1EC3 t\u1EA1o m\u1ED9t l\xF4 \u0111\xFAng c\xE1ch v\xE0 c\xF3 th\u1EC3 ch\u1EA1y m\xF4 h\xECnh c\u1EE7a b\u1EA1n tr\xEAn \u0111\xF3. Ch\xFAng ta \u0111\xE3 ho\xE0n th\xE0nh t\u1EA5t c\u1EA3 c\xE1c b\u01B0\u1EDBc \u0111\xF3, v\xEC v\u1EADy m\xE3 sau c\xF3 th\u1EC3 \u0111\u01B0\u1EE3c th\u1EF1c thi m\xE0 kh\xF4ng c\xF3 l\u1ED7i:"),kl=o(),u(ie.$$.fragment),yl=o(),la=l("p"),nu=h("L\u1ED7i xu\u1EA5t hi\u1EC7n sau \u0111\xF3, v\xE0o cu\u1ED1i giai \u0111o\u1EA1n \u0111\xE1nh gi\xE1 v\xE0 n\u1EBFu ch\xFAng ta xem l\u1EA1i b\u1EA3n ghi l\u1EA1i, ch\xFAng ta th\u1EA5y \u0111i\u1EC1u n\xE0y:"),_l=o(),u(le.$$.fragment),$l=o(),Q=l("p"),tu=h("\u0110i\u1EC1u n\xE0y cho ch\xFAng t\xF4i bi\u1EBFt r\u1EB1ng l\u1ED7i b\u1EAFt ngu\u1ED3n t\u1EEB m\xF4-\u0111un "),Is=l("code"),eu=h("datasets/metric.py"),au=h(" - v\xEC v\u1EADy \u0111\xE2y l\xE0 s\u1EF1 c\u1ED1 v\u1EDBi h\xE0m "),Fs=l("code"),su=h("compute_metrics()"),hu=h(" c\u1EE7a m\xECnh. N\xF3 c\u1EA7n m\u1ED9t b\u1ED9 d\u1EEF li\u1EC7u v\u1EDBi c\xE1c logits v\xE0 c\xE1c nh\xE3n d\u01B0\u1EDBi d\u1EA1ng m\u1EA3ng NumPy, v\xEC v\u1EADy ch\xFAng ta h\xE3y th\u1EED cung c\u1EA5p cho n\xF3 r\u1EB1ng:"),wl=o(),u(re.$$.fragment),jl=o(),u(ce.$$.fragment),El=o(),L=l("p"),iu=h("Ch\xFAng ta nh\u1EADn \u0111\u01B0\u1EE3c c\xF9ng m\u1ED9t l\u1ED7i, v\xEC v\u1EADy v\u1EA5n \u0111\u1EC1 ch\u1EAFc ch\u1EAFn n\u1EB1m \u1EDF h\xE0m \u0111\xF3. N\u1EBFu ch\xFAng ta nh\xECn l\u1EA1i m\xE3 c\u1EE7a n\xF3, ch\xFAng ta th\u1EA5y n\xF3 ch\u1EC9 chuy\u1EC3n ti\u1EBFp c\xE1c  "),Ks=l("code"),lu=h("predictions"),ru=h(" v\xE0 "),Ws=l("code"),cu=h("labels"),ou=h("  \u0111\u1EBFn "),Rs=l("code"),pu=h("metric.compute()"),uu=h(". V\u1EADy c\xF3 v\u1EA5n \u0111\u1EC1 g\xEC v\u1EDBi ph\u01B0\u01A1ng ph\xE1p \u0111\xF3 kh\xF4ng? Kh\xF4ng h\u1EB3n v\u1EADy. Ch\xFAng ta h\xE3y xem nhanh c\xE1c h\xECnh d\u1EA1ng:"),ql=o(),u(oe.$$.fragment),xl=o(),u(pe.$$.fragment),Cl=o(),Ln=l("p"),mu=h("C\xE1c d\u1EF1 \u0111o\xE1n c\u1EE7a ch\xFAng t\xF4i v\u1EABn l\xE0 logit, kh\xF4ng ph\u1EA3i d\u1EF1 \u0111o\xE1n th\u1EF1c t\u1EBF, \u0111\xF3 l\xE0 l\xFD do t\u1EA1i sao s\u1ED1 li\u1EC7u tr\u1EA3 v\u1EC1 l\u1ED7i (h\u01A1i t\u1ED1i ngh\u0129a) n\xE0y. Vi\u1EC7c s\u1EEDa ch\u1EEFa kh\xE1 d\u1EC5 d\xE0ng; ch\xFAng ta ch\u1EC9 c\u1EA7n th\xEAm m\u1ED9t argmax trong h\xE0m "),Ys=l("code"),gu=h("compute_metrics()"),du=h(":"),Tl=o(),u(ue.$$.fragment),Pl=o(),u(me.$$.fragment),Al=o(),ra=l("p"),fu=h("B\xE2y gi\u1EDD l\u1ED7i c\u1EE7a ch\xFAng ta \u0111\xE3 \u0111\u01B0\u1EE3c s\u1EEDa ch\u1EEFa! \u0110\xE2y l\xE0 l\u1EA7n cu\u1ED1i c\xF9ng, v\xEC v\u1EADy k\u1ECBch b\u1EA3n c\u1EE7a ch\xFAng ta b\xE2y gi\u1EDD s\u1EBD \u0111\xE0o t\u1EA1o m\u1ED9t m\xF4 h\xECnh \u0111\xFAng c\xE1ch."),Dl=o(),ca=l("p"),bu=h("\u0110\u1EC3 tham kh\u1EA3o, \u0111\xE2y l\xE0 t\u1EADp l\u1EC7nh ho\xE0n to\xE0n c\u1ED1 \u0111\u1ECBnh:"),zl=o(),u(ge.$$.fragment),Nl=o(),oa=l("p"),vu=h("Trong tr\u01B0\u1EDDng h\u1EE3p n\xE0y, kh\xF4ng c\xF2n v\u1EA5n \u0111\u1EC1 g\xEC n\u1EEFa v\xE0 t\u1EADp l\u1EC7nh c\u1EE7a ch\xFAng ta s\u1EBD tinh ch\u1EC9nh m\u1ED9t m\xF4 h\xECnh s\u1EBD cho k\u1EBFt qu\u1EA3 h\u1EE3p l\xFD. Nh\u01B0ng ch\xFAng ta c\xF3 th\u1EC3 l\xE0m g\xEC khi qu\xE1 tr\xECnh hu\u1EA5n luy\u1EC7n di\u1EC5n ra m\xE0 kh\xF4ng c\xF3 b\u1EA5t k\u1EF3 l\u1ED7i n\xE0o, v\xE0 m\xF4 h\xECnh \u0111\u01B0\u1EE3c hu\u1EA5n luy\u1EC7n kh\xF4ng ho\u1EA1t \u0111\u1ED9ng t\u1ED1t ch\xFAt n\xE0o? \u0110\xF3 l\xE0 ph\u1EA7n kh\xF3 nh\u1EA5t c\u1EE7a h\u1ECDc m\xE1y v\xE0 ch\xFAng ta s\u1EBD ch\u1EC9 cho b\u1EA1n m\u1ED9t v\xE0i k\u1EF9 thu\u1EADt c\xF3 th\u1EC3 h\u1EEFu \xEDch."),Sl=o(),u(Gn.$$.fragment),Ol=o(),pn=l("h2"),Hn=l("a"),Xs=l("span"),u(de.$$.fragment),ku=o(),Js=l("span"),yu=h("Debugging silent errors during training"),Ul=o(),pa=l("p"),_u=h("What can we do to debug a training that completes without error but doesn\u2019t get good results? We\u2019ll give you some pointers here, but be aware that this kind of debugging is the hardest part of machine learning, and there is no magical answer."),Vl=o(),un=l("h3"),In=l("a"),Qs=l("span"),u(fe.$$.fragment),$u=o(),Zs=l("span"),wu=h("Ki\u1EC3m tra l\u1EA1i d\u1EEF li\u1EC7u c\u1EE7a b\u1EA1n (m\u1ED9t l\u1EA7n n\u1EEFa!)"),Bl=o(),ua=l("p"),ju=h("M\xF4 h\xECnh c\u1EE7a b\u1EA1n s\u1EBD ch\u1EC9 h\u1ECDc \u0111\u01B0\u1EE3c \u0111i\u1EC1u g\xEC \u0111\xF3 n\u1EBFu n\xF3 th\u1EF1c s\u1EF1 c\xF3 th\u1EC3 h\u1ECDc \u0111\u01B0\u1EE3c b\u1EA5t c\u1EE9 \u0111i\u1EC1u g\xEC t\u1EEB d\u1EEF li\u1EC7u c\u1EE7a b\u1EA1n. N\u1EBFu c\xF3 l\u1ED7i l\xE0m h\u1ECFng d\u1EEF li\u1EC7u ho\u1EB7c c\xE1c nh\xE3n \u0111\u01B0\u1EE3c g\xE1n ng\u1EABu nhi\xEAn, r\u1EA5t c\xF3 th\u1EC3 b\u1EA1n s\u1EBD kh\xF4ng hu\u1EA5n luy\u1EC7n \u0111\u01B0\u1EE3c m\xF4 h\xECnh n\xE0o v\u1EC1 t\u1EADp d\u1EEF li\u1EC7u c\u1EE7a m\xECnh. V\xEC v\u1EADy, h\xE3y lu\xF4n b\u1EAFt \u0111\u1EA7u b\u1EB1ng c\xE1ch ki\u1EC3m tra k\u1EF9 c\xE1c \u0111\u1EA7u v\xE0o v\xE0 nh\xE3n \u0111\xE3 \u0111\u01B0\u1EE3c gi\u1EA3i m\xE3 c\u1EE7a b\u1EA1n v\xE0 t\u1EF1 h\u1ECFi b\u1EA3n th\xE2n nh\u1EEFng c\xE2u h\u1ECFi sau:"),Ml=o(),G=l("ul"),nh=l("li"),Eu=h("D\u1EEF li\u1EC7u \u0111\u01B0\u1EE3c gi\u1EA3i m\xE3 c\xF3 d\u1EC5 hi\u1EC3u kh\xF4ng?"),qu=o(),th=l("li"),xu=h("B\u1EA1n c\xF3 \u0111\u1ED3ng \xFD v\u1EDBi c\xE1c nh\xE3n?"),Cu=o(),eh=l("li"),Tu=h("C\xF3 m\u1ED9t nh\xE3n n\xE0o ph\u1ED5 bi\u1EBFn h\u01A1n nh\u1EEFng nh\xE3n kh\xE1c kh\xF4ng?"),Pu=o(),ah=l("li"),Au=h("M\u1EA5t m\xE1t/Ch\u1EC9 s\u1ED1 s\u1EBD l\xE0 bao nhi\xEAu n\u1EBFu m\xF4 h\xECnh d\u1EF1 \u0111o\xE1n m\u1ED9t c\xE2u tr\u1EA3 l\u1EDDi ng\u1EABu nhi\xEAn/lu\xF4n l\xE0 m\u1ED9t c\xE2u tr\u1EA3 l\u1EDDi gi\u1ED1ng nhau?"),Ll=o(),u(Fn.$$.fragment),Gl=o(),ma=l("p"),Du=h("Sau khi xem x\xE9t d\u1EEF li\u1EC7u c\u1EE7a b\u1EA1n, h\xE3y xem qua m\u1ED9t s\u1ED1 d\u1EF1 \u0111o\xE1n c\u1EE7a m\xF4 h\xECnh v\xE0 gi\u1EA3i m\xE3 ch\xFAng. N\u1EBFu m\xF4 h\xECnh lu\xF4n d\u1EF1 \u0111o\xE1n c\xF9ng m\u1ED9t \u0111i\u1EC1u, c\xF3 th\u1EC3 l\xE0 do t\u1EADp d\u1EEF li\u1EC7u c\u1EE7a b\u1EA1n thi\xEAn v\u1EC1 m\u1ED9t lo\u1EA1i (\u0111\u1ED1i v\u1EDBi c\xE1c v\u1EA5n \u0111\u1EC1 ph\xE2n lo\u1EA1i); c\xE1c k\u1EF9 thu\u1EADt nh\u01B0 l\u1EA5y m\u1EABu qu\xE1 m\u1EE9c c\xE1c l\u1EDBp hi\u1EBFm c\xF3 th\u1EC3 h\u1EEFu \xEDch."),Hl=o(),ga=l("p"),zu=h("N\u1EBFu m\u1EA5t m\xE1t/ch\u1EC9 s\u1ED1 \u0111\xE1nh gi\xE1 b\u1EA1n nh\u1EADn \u0111\u01B0\u1EE3c tr\xEAn m\xF4 h\xECnh ban \u0111\u1EA7u c\u1EE7a m\xECnh r\u1EA5t kh\xE1c v\u1EDBi c\xE1i b\u1EA1n mong \u0111\u1EE3i cho c\xE1c d\u1EF1 \u0111o\xE1n ng\u1EABu nhi\xEAn, h\xE3y ki\u1EC3m tra k\u1EF9 c\xE1ch t\xEDnh to\xE1n t\u1ED5n th\u1EA5t ho\u1EB7c s\u1ED1 li\u1EC7u c\u1EE7a b\u1EA1n, v\xEC c\xF3 th\u1EC3 c\xF3 m\u1ED9t l\u1ED7i \u1EDF \u0111\xF3. N\u1EBFu b\u1EA1n \u0111ang s\u1EED d\u1EE5ng m\u1ED9t s\u1ED1 m\u1EA5t m\xE1t m\xE0 b\u1EA1n th\xEAm v\xE0o cu\u1ED1i, h\xE3y \u0111\u1EA3m b\u1EA3o r\u1EB1ng ch\xFAng c\xF3 c\xF9ng quy m\xF4."),Il=o(),da=l("p"),Nu=h("Khi b\u1EA1n ch\u1EAFc ch\u1EAFn d\u1EEF li\u1EC7u c\u1EE7a m\xECnh l\xE0 ho\xE0n h\u1EA3o, b\u1EA1n c\xF3 th\u1EC3 xem li\u1EC7u m\xF4 h\xECnh c\xF3 kh\u1EA3 n\u0103ng hu\u1EA5n luy\u1EC7n v\u1EC1 n\xF3 hay kh\xF4ng b\u1EB1ng m\u1ED9t b\xE0i ki\u1EC3m tra \u0111\u01A1n gi\u1EA3n."),Fl=o(),mn=l("h3"),Kn=l("a"),sh=l("span"),u(be.$$.fragment),Su=o(),hh=l("span"),Ou=h("H\u1ECDc k\u0129 m\xF4 h\xECnh c\u1EE7a b\u1EA1n trong m\u1ED9t l\xF4"),Kl=o(),fa=l("p"),Uu=h("Vi\u1EC7c h\u1ECDc qu\xE1 nhi\u1EC1u th\u01B0\u1EDDng l\xE0 \u0111i\u1EC1u ch\xFAng ta c\u1ED1 g\u1EAFng tr\xE1nh khi hu\u1EA5n luy\u1EC7n, v\xEC n\xF3 c\xF3 ngh\u0129a l\xE0 m\xF4 h\xECnh kh\xF4ng h\u1ECDc c\xE1ch nh\u1EADn ra c\xE1c \u0111\u1EB7c \u0111i\u1EC3m chung ta mu\u1ED1n m\xE0 thay v\xE0o \u0111\xF3 ch\u1EC9 l\xE0 ghi nh\u1EDB c\xE1c m\u1EABu hu\u1EA5n luy\u1EC7n. Tuy nhi\xEAn, c\u1ED1 g\u1EAFng hu\u1EA5n luy\u1EC7n m\xF4 h\xECnh c\u1EE7a b\u1EA1n l\u1EB7p \u0111i l\u1EB7p l\u1EA1i l\xE0 m\u1ED9t b\xE0i ki\u1EC3m tra t\u1ED1t \u0111\u1EC3 ki\u1EC3m tra xem v\u1EA5n \u0111\u1EC1 nh\u01B0 b\u1EA1n \u0111\xE3 \u0111\u1ECBnh h\xECnh c\xF3 th\u1EC3 \u0111\u01B0\u1EE3c gi\u1EA3i quy\u1EBFt b\u1EB1ng m\xF4 h\xECnh m\xE0 b\u1EA1n \u0111ang c\u1ED1 g\u1EAFng hu\u1EA5n luy\u1EC7n hay kh\xF4ng. N\xF3 c\u0169ng s\u1EBD gi\xFAp b\u1EA1n xem li\u1EC7u t\u1ED1c \u0111\u1ED9 h\u1ECDc ban \u0111\u1EA7u c\u1EE7a b\u1EA1n c\xF3 qu\xE1 cao hay kh\xF4ng."),Wl=o(),Wn=l("p"),Vu=h("Th\u1EF1c hi\u1EC7n \u0111i\u1EC1u n\xE0y khi b\u1EA1n \u0111\xE3 x\xE1c \u0111\u1ECBnh \u0111\u01B0\u1EE3c "),ih=l("code"),Bu=h("Trainer"),Mu=h(" c\u1EE7a m\xECnh th\u1EF1c s\u1EF1 d\u1EC5 d\xE0ng; ch\u1EC9 c\u1EA7n l\u1EA5y m\u1ED9t lo\u1EA1t d\u1EEF li\u1EC7u hu\u1EA5n luy\u1EC7n, sau \u0111\xF3 ch\u1EA1y m\u1ED9t v\xF2ng hu\u1EA5n luy\u1EC7n th\u1EE7 c\xF4ng nh\u1ECF ch\u1EC9 s\u1EED d\u1EE5ng l\xF4 \u0111\xF3 cho m\u1ED9t c\xE1i g\xEC \u0111\xF3 gi\u1ED1ng nh\u01B0 20 b\u01B0\u1EDBc:"),Rl=o(),u(ve.$$.fragment),Yl=o(),u(Rn.$$.fragment),Xl=o(),Yn=l("p"),Lu=h("M\xF4 h\xECnh ph\u1EA3i c\xF3 k\u1EBFt qu\u1EA3 tr\u1EA3 v\u1EC1 g\u1EA7n nh\u01B0 ho\xE0n h\u1EA3o tr\xEAn c\xF9ng m\u1ED9t "),lh=l("code"),Gu=h("l\xF4"),Hu=h(". H\xE3y t\xEDnh to\xE1n c\xE1c ch\u1EC9 s\u1ED1 tr\xEAn c\xE1c d\u1EF1 \u0111o\xE1n k\u1EBFt qu\u1EA3:"),Jl=o(),u(ke.$$.fragment),Ql=o(),u(ye.$$.fragment),Zl=o(),ba=l("p"),Iu=h("Ch\xEDnh x\xE1c 100%, \u0111\xE2y l\xE0 m\u1ED9t v\xED d\u1EE5 \u0111i\u1EC3n h\xECnh v\u1EC1 vi\u1EC7c overfitt(c\xF3 ngh\u0129a l\xE0 n\u1EBFu b\u1EA1n th\u1EED m\xF4 h\xECnh c\u1EE7a m\xECnh tr\xEAn b\u1EA5t k\u1EF3 c\xE2u n\xE0o kh\xE1c, r\u1EA5t c\xF3 th\u1EC3 n\xF3 s\u1EBD \u0111\u01B0a ra c\xE2u tr\u1EA3 l\u1EDDi sai)!"),nr=o(),va=l("p"),Fu=h("N\u1EBFu b\u1EA1n kh\xF4ng qu\u1EA3n l\xFD \u0111\u1EC3 m\xF4 h\xECnh c\u1EE7a m\xECnh c\xF3 \u0111\u01B0\u1EE3c k\u1EBFt qu\u1EA3 ho\xE0n h\u1EA3o nh\u01B0 th\u1EBF n\xE0y, \u0111i\u1EC1u \u0111\xF3 c\xF3 ngh\u0129a l\xE0 c\xF3 \u0111i\u1EC1u g\xEC \u0111\xF3 kh\xF4ng \u1ED5n trong c\xE1ch b\u1EA1n \u0111\u1ECBnh khung v\u1EA5n \u0111\u1EC1 ho\u1EB7c d\u1EEF li\u1EC7u c\u1EE7a m\xECnh, v\xEC v\u1EADy b\u1EA1n n\xEAn kh\u1EAFc ph\u1EE5c \u0111i\u1EC1u \u0111\xF3. Ch\u1EC9 khi b\u1EA1n v\u01B0\u1EE3t qua \u0111\u01B0\u1EE3c b\xE0i ki\u1EC3m tra overfit, b\u1EA1n m\u1EDBi c\xF3 th\u1EC3 ch\u1EAFc ch\u1EAFn r\u1EB1ng m\xF4 h\xECnh c\u1EE7a m\xECnh th\u1EF1c s\u1EF1 c\xF3 th\u1EC3 h\u1ECDc \u0111\u01B0\u1EE3c \u0111i\u1EC1u g\xEC \u0111\xF3."),tr=o(),u(Xn.$$.fragment),er=o(),gn=l("h3"),Jn=l("a"),rh=l("span"),u(_e.$$.fragment),Ku=o(),ch=l("span"),Wu=h("Kh\xF4ng \u0111i\u1EC1u ch\u1EC9nh b\u1EA5t c\u1EE9 th\u1EE9 g\xEC cho \u0111\u1EBFn khi b\u1EA1n c\xF3 m\xF4 h\xECnh c\u01A1 s\u1EDF \u0111\u1EA7u ti\xEAn"),ar=o(),Qn=l("p"),Ru=h("\u0110i\u1EC1u ch\u1EC9nh si\xEAu tham s\u1ED1 lu\xF4n \u0111\u01B0\u1EE3c nh\u1EA5n m\u1EA1nh l\xE0 ph\u1EA7n kh\xF3 nh\u1EA5t c\u1EE7a h\u1ECDc m\xE1y, nh\u01B0ng n\xF3 ch\u1EC9 l\xE0 b\u01B0\u1EDBc cu\u1ED1i c\xF9ng gi\xFAp b\u1EA1n hi\u1EC3u \u0111\u01B0\u1EE3c m\u1ED9t ch\xFAt v\u1EC1 ch\u1EC9 s\u1ED1 n\xE0y. H\u1EA7u h\u1EBFt th\u1EDDi gian, c\xE1c si\xEAu tham s\u1ED1 m\u1EB7c \u0111\u1ECBnh c\u1EE7a "),oh=l("code"),Yu=h("Trainer"),Xu=h(" s\u1EBD ho\u1EA1t \u0111\u1ED9ng t\u1ED1t \u0111\u1EC3 cung c\u1EA5p cho b\u1EA1n k\u1EBFt qu\u1EA3 t\u1ED1t, v\xEC v\u1EADy \u0111\u1EEBng kh\u1EDFi ch\u1EA1y t\xECm ki\u1EBFm si\xEAu tham s\u1ED1 t\u1ED1n th\u1EDDi gian v\xE0 t\u1ED1n k\xE9m cho \u0111\u1EBFn khi b\u1EA1n c\xF3 th\u1EE9 g\xEC \u0111\xF3 v\u01B0\u1EE3t qua m\xF4 h\xECnh c\u01A1 s\u1EDF m\xE0 b\u1EA1n c\xF3 tr\xEAn t\u1EADp d\u1EEF li\u1EC7u c\u1EE7a m\xECnh."),sr=o(),ka=l("p"),Ju=h("Khi b\u1EA1n \u0111\xE3 c\xF3 m\u1ED9t m\xF4 h\xECnh \u0111\u1EE7 t\u1ED1t, b\u1EA1n c\xF3 th\u1EC3 b\u1EAFt \u0111\u1EA7u \u0111i\u1EC1u ch\u1EC9nh m\u1ED9t ch\xFAt. \u0110\u1EEBng th\u1EED kh\u1EDFi ch\u1EA1y m\u1ED9t ngh\xECn l\u1EA7n ch\u1EA1y v\u1EDBi c\xE1c si\xEAu tham s\u1ED1 kh\xE1c nhau, nh\u01B0ng h\xE3y so s\xE1nh m\u1ED9t v\xE0i l\u1EA7n ch\u1EA1y v\u1EDBi c\xE1c gi\xE1 tr\u1ECB kh\xE1c nhau cho m\u1ED9t si\xEAu th\xF4ng s\u1ED1 \u0111\u1EC3 c\xF3 \u0111\u01B0\u1EE3c \xFD t\u01B0\u1EDFng v\u1EC1 gi\xE1 tr\u1ECB n\xE0o c\xF3 t\xE1c \u0111\u1ED9ng l\u1EDBn nh\u1EA5t."),hr=o(),ya=l("p"),Qu=h("N\u1EBFu b\u1EA1n \u0111ang \u0111i\u1EC1u ch\u1EC9nh ch\xEDnh m\xF4 h\xECnh, h\xE3y gi\u1EEF n\xF3 \u0111\u01A1n gi\u1EA3n v\xE0 \u0111\u1EEBng th\u1EED b\u1EA5t c\u1EE9 \u0111i\u1EC1u g\xEC m\xE0 b\u1EA1n kh\xF4ng th\u1EC3 bi\u1EC7n minh m\u1ED9t c\xE1ch h\u1EE3p l\xFD. Lu\xF4n \u0111\u1EA3m b\u1EA3o r\u1EB1ng b\u1EA1n quay l\u1EA1i ki\u1EC3m tra overfit \u0111\u1EC3 x\xE1c minh r\u1EB1ng thay \u0111\u1ED5i c\u1EE7a b\u1EA1n kh\xF4ng g\xE2y ra b\u1EA5t k\u1EF3 h\u1EADu qu\u1EA3 ngo\xE0i \xFD mu\u1ED1n n\xE0o."),ir=o(),dn=l("h3"),Zn=l("a"),ph=l("span"),u($e.$$.fragment),Zu=o(),uh=l("span"),nm=h("Y\xEAu c\u1EA7u gi\xFAp \u0111\u1EE1"),lr=o(),nt=l("p"),tm=h("Hy v\u1ECDng r\u1EB1ng b\u1EA1n s\u1EBD t\xECm th\u1EA5y m\u1ED9t s\u1ED1 l\u1EDDi khuy\xEAn trong ph\u1EA7n n\xE0y \u0111\u1EC3 gi\xFAp b\u1EA1n gi\u1EA3i quy\u1EBFt v\u1EA5n \u0111\u1EC1 c\u1EE7a m\xECnh, nh\u01B0ng n\u1EBFu kh\xF4ng ph\u1EA3i v\u1EADy, h\xE3y nh\u1EDB r\u1EB1ng b\u1EA1n lu\xF4n c\xF3 th\u1EC3 h\u1ECFi c\u1ED9ng \u0111\u1ED3ng tr\xEAn "),we=l("a"),em=h("di\u1EC5n \u0111\xE0n"),am=h("."),rr=o(),_a=l("p"),sm=h("D\u01B0\u1EDBi \u0111\xE2y l\xE0 m\u1ED9t s\u1ED1 t\xE0i li\u1EC7u b\u1ED5 sung c\xF3 th\u1EC3 h\u1EEFu \xEDch:"),cr=o(),H=l("ul"),$a=l("li"),je=l("a"),hm=h("\u201CReproducibility as a vehicle for engineering best practices\u201D"),im=h(" b\u1EDFi Joel Grus"),lm=o(),wa=l("li"),Ee=l("a"),rm=h("\u201CChecklist for debugging neural networks\u201D"),cm=h(" b\u1EDFi Cecelia Shao"),om=o(),ja=l("li"),qe=l("a"),pm=h("\u201CHow to unit test machine learning code\u201D"),um=h(" b\u1EDFi Chase Roberts"),mm=o(),Ea=l("li"),xe=l("a"),gm=h("\u201CA Recipe for Training Neural Networks\u201D"),dm=h(" b\u1EDFi Andrej Karpathy"),or=o(),qa=l("p"),fm=h("T\u1EA5t nhi\xEAn, kh\xF4ng ph\u1EA3i m\u1ECDi v\u1EA5n \u0111\u1EC1 b\u1EA1n g\u1EB7p ph\u1EA3i khi hu\u1EA5n luy\u1EC7n m\u1EA1ng th\u1EA7n kinh \u0111\u1EC1u l\xE0 l\u1ED7i c\u1EE7a ch\xEDnh b\u1EA1n! N\u1EBFu b\u1EA1n g\u1EB7p \u0111i\u1EC1u g\xEC \u0111\xF3 trong th\u01B0 vi\u1EC7n \u{1F917} Transformers ho\u1EB7c \u{1F917} Datasets c\xF3 v\u1EBB kh\xF4ng \u1ED5n, c\xF3 th\u1EC3 b\u1EA1n \u0111\xE3 g\u1EB7p l\u1ED7i. B\u1EA1n ch\u1EAFc ch\u1EAFn n\xEAn cho ch\xFAng t\xF4i bi\u1EBFt t\u1EA5t c\u1EA3 v\u1EC1 \u0111i\u1EC1u \u0111\xF3 v\xE0 trong ph\u1EA7n ti\u1EBFp theo, ch\xFAng t\xF4i s\u1EBD gi\u1EA3i th\xEDch ch\xEDnh x\xE1c c\xE1ch th\u1EF1c hi\u1EC7n \u0111i\u1EC1u \u0111\xF3."),this.h()},l(n){const a=pf('[data-svelte="svelte-1phssyn"]',document.head);v=r(a,"META",{name:!0,content:!0}),a.forEach(t),w=p(n),m(_.$$.fragment,n),$=p(n),q=r(n,"H1",{class:!0});var Ce=c(q);j=r(Ce,"A",{id:!0,class:!0,href:!0});var mh=c(j);E=r(mh,"SPAN",{});var gh=c(E);m(x.$$.fragment,gh),gh.forEach(t),mh.forEach(t),A=p(Ce),C=r(Ce,"SPAN",{});var dh=c(C);I=i(dh,"G\u1EE1 l\u1ED7i quy tr\xECnh hu\u1EA5n luy\u1EC7n"),dh.forEach(t),Ce.forEach(t),O=p(n),m(T.$$.fragment,n),it=p(n),U=r(n,"P",{});var fn=c(U);Ae=i(fn,"B\u1EA1n \u0111\xE3 vi\u1EBFt m\u1ED9t k\u1ECBch b\u1EA3n tuy\u1EC7t \u0111\u1EB9p \u0111\u1EC3 hu\u1EA5n luy\u1EC7n ho\u1EB7c tinh ch\u1EC9nh m\u1ED9t m\xF4 h\xECnh trong m\u1ED9t t\xE1c v\u1EE5 nh\u1EA5t \u0111\u1ECBnh, tu\xE2n th\u1EE7 m\u1ED9t c\xE1ch nghi\xEAm t\xFAc l\u1EDDi khuy\xEAn t\u1EEB "),De=r(fn,"A",{href:!0});var fh=c(De);Gr=i(fh,"Ch\u01B0\u01A1ng 7"),fh.forEach(t),Hr=i(fn,". Nh\u01B0ng khi b\u1EA1n kh\u1EDFi ch\u1EA1y l\u1EC7nh "),Sa=r(fn,"CODE",{});var bh=c(Sa);Ir=i(bh,"trainr.train()"),bh.forEach(t),Fr=i(fn,", m\u1ED9t \u0111i\u1EC1u kinh kh\u1EE7ng x\u1EA3y ra: b\u1EA1n g\u1EB7p l\u1ED7i \u{1F631}! Ho\u1EB7c t\u1EC7 h\u01A1n, m\u1ECDi th\u1EE9 d\u01B0\u1EDDng nh\u01B0 \u1ED5n v\xE0 qu\xE1 tr\xECnh hu\u1EA5n luy\u1EC7n ch\u1EA1y m\xE0 kh\xF4ng c\xF3 l\u1ED7i, nh\u01B0ng m\xF4 h\xECnh k\u1EBFt qu\u1EA3 l\xE0 t\u1ED3i t\u1EC7. Trong ph\u1EA7n n\xE0y, ch\xFAng t\xF4i s\u1EBD ch\u1EC9 cho b\u1EA1n nh\u1EEFng g\xEC b\u1EA1n c\xF3 th\u1EC3 l\xE0m \u0111\u1EC3 g\u1EE1 l\u1ED7i c\xE1c lo\u1EA1i v\u1EA5n \u0111\u1EC1 n\xE0y."),fn.forEach(t),vh=p(n),an=r(n,"H2",{class:!0});var Te=c(an);bn=r(Te,"A",{id:!0,class:!0,href:!0});var _m=c(bn);Oa=r(_m,"SPAN",{});var $m=c(Oa);m(lt.$$.fragment,$m),$m.forEach(t),_m.forEach(t),Kr=p(Te),Ua=r(Te,"SPAN",{});var wm=c(Ua);Wr=i(wm,"G\u1EE1 l\u1ED7i quy tr\xECnh hu\u1EA5n luy\u1EC7n"),wm.forEach(t),Te.forEach(t),kh=p(n),m(rt.$$.fragment,n),yh=p(n),F=r(n,"P",{});var xa=c(F);Rr=i(xa,"V\u1EA5n \u0111\u1EC1 khi b\u1EA1n g\u1EB7p l\u1ED7i trong "),Va=r(xa,"CODE",{});var jm=c(Va);Yr=i(jm,"trainr.train()"),jm.forEach(t),Xr=i(xa," c\xF3 th\u1EC3 \u0111\u1EBFn t\u1EEB nhi\u1EC1u ngu\u1ED3n, v\xEC "),Ba=r(xa,"CODE",{});var Em=c(Ba);Jr=i(Em,"Trainer"),Em.forEach(t),Qr=i(xa," th\u01B0\u1EDDng t\u1EADp h\u1EE3p r\u1EA5t nhi\u1EC1u th\u1EE9 l\u1EA1i v\u1EDBi nhau. N\xF3 chuy\u1EC3n \u0111\u1ED5i b\u1ED9 d\u1EEF li\u1EC7u th\xE0nh c\xE1c dataloader, do \u0111\xF3, v\u1EA5n \u0111\u1EC1 c\xF3 th\u1EC3 l\xE0 m\u1ED9t c\xE1i g\xEC \u0111\xF3 sai trong b\u1ED9 d\u1EEF li\u1EC7u c\u1EE7a b\u1EA1n ho\u1EB7c m\u1ED9t s\u1ED1 v\u1EA5n \u0111\u1EC1 khi c\u1ED1 g\u1EAFng k\u1EBFt h\u1EE3p h\xE0ng lo\u1EA1t c\xE1c ph\u1EA7n t\u1EED c\u1EE7a b\u1ED9 d\u1EEF li\u1EC7u v\u1EDBi nhau. Sau \u0111\xF3, n\xF3 l\u1EA5y m\u1ED9t lo\u1EA1t d\u1EEF li\u1EC7u v\xE0 \u0111\u01B0a n\xF3 v\xE0o m\xF4 h\xECnh, v\xEC v\u1EADy v\u1EA5n \u0111\u1EC1 c\xF3 th\u1EC3 n\u1EB1m \u1EDF m\xE3 m\xF4 h\xECnh. Sau \u0111\xF3, n\xF3 t\xEDnh to\xE1n c\xE1c \u0111\u1ED9 d\u1ED1c v\xE0 th\u1EF1c hi\u1EC7n b\u01B0\u1EDBc t\u1ED1i \u01B0u h\xF3a, v\xEC v\u1EADy v\u1EA5n \u0111\u1EC1 c\u0169ng c\xF3 th\u1EC3 n\u1EB1m trong tr\xECnh t\u1ED1i \u01B0u h\xF3a c\u1EE7a b\u1EA1n. V\xE0 ngay c\u1EA3 khi m\u1ECDi th\u1EE9 di\u1EC5n ra t\u1ED1t \u0111\u1EB9p cho qu\xE1 tr\xECnh hu\u1EA5n luy\u1EC7n, v\u1EABn c\xF3 th\u1EC3 x\u1EA3y ra s\u1EF1 c\u1ED1 trong qu\xE1 tr\xECnh \u0111\xE1nh gi\xE1 n\u1EBFu c\xF3 v\u1EA5n \u0111\u1EC1 v\u1EDBi ch\u1EC9 s\u1ED1 c\u1EE7a b\u1EA1n."),xa.forEach(t),_h=p(n),vn=r(n,"P",{});var ur=c(vn);Zr=i(ur,"C\xE1ch t\u1ED1t nh\u1EA5t \u0111\u1EC3 g\u1EE1 l\u1ED7i ph\xE1t sinh trong "),Ma=r(ur,"CODE",{});var qm=c(Ma);nc=i(qm,"trainr.train()"),qm.forEach(t),tc=i(ur," l\xE0 \u0111i qua to\xE0n pipeline n\xE0y theo c\xE1ch th\u1EE7 c\xF4ng \u0111\u1EC3 xem m\u1ECDi th\u1EE9 di\u1EC5n ra nh\u01B0 th\u1EBF n\xE0o. Sau \u0111\xF3, l\u1ED7i th\u01B0\u1EDDng r\u1EA5t d\u1EC5 gi\u1EA3i quy\u1EBFt."),ur.forEach(t),$h=p(n),kn=r(n,"P",{});var mr=c(kn);ec=i(mr,"\u0110\u1EC3 ch\u1EE9ng minh \u0111i\u1EC1u n\xE0y, ch\xFAng ta s\u1EBD s\u1EED d\u1EE5ng t\u1EADp l\u1EC7nh (c\u1ED1 g\u1EAFng) tinh ch\u1EC9nh m\xF4 h\xECnh DistilBERT tr\xEAn "),ct=r(mr,"A",{href:!0,rel:!0});var xm=c(ct);ac=i(xm,"t\u1EADp d\u1EEF li\u1EC7u MNLI"),xm.forEach(t),sc=i(mr,":"),mr.forEach(t),wh=p(n),m(ot.$$.fragment,n),jh=p(n),ze=r(n,"P",{});var Cm=c(ze);hc=i(Cm,"N\u1EBFu b\u1EA1n c\u1ED1 g\u1EAFng th\u1EF1c thi n\xF3, b\u1EA1n s\u1EBD g\u1EB7p ph\u1EA3i m\u1ED9t l\u1ED7i kh\xE1 kh\xF3 hi\u1EC3u:"),Cm.forEach(t),Eh=p(n),m(pt.$$.fragment,n),qh=p(n),sn=r(n,"H3",{class:!0});var gr=c(sn);yn=r(gr,"A",{id:!0,class:!0,href:!0});var Tm=c(yn);La=r(Tm,"SPAN",{});var Pm=c(La);m(ut.$$.fragment,Pm),Pm.forEach(t),Tm.forEach(t),ic=p(gr),Ga=r(gr,"SPAN",{});var Am=c(Ga);lc=i(Am,"Ki\u1EC3m tra d\u1EEF li\u1EC7u c\u1EE7a b\u1EA1n"),Am.forEach(t),gr.forEach(t),xh=p(n),_n=r(n,"P",{});var dr=c(_n);rc=i(dr,"\u0110i\u1EC1u n\xE0y kh\xF4ng c\u1EA7n ph\u1EA3i n\xF3i, nh\u01B0ng n\u1EBFu d\u1EEF li\u1EC7u c\u1EE7a b\u1EA1n b\u1ECB h\u1ECFng, "),Ha=r(dr,"CODE",{});var Dm=c(Ha);cc=i(Dm,"Trainer"),Dm.forEach(t),oc=i(dr," s\u1EBD kh\xF4ng th\u1EC3 t\u1EA1o ra c\xE1c l\xF4 ch\u1EE9 \u0111\u1EEBng n\xF3i \u0111\u1EBFn vi\u1EC7c hu\u1EA5n luy\u1EC7n m\xF4 h\xECnh c\u1EE7a b\u1EA1n. V\xEC v\u1EADy, \u0111i\u1EC1u \u0111\u1EA7u ti\xEAn, b\u1EA1n c\u1EA7n ph\u1EA3i xem x\xE9t nh\u1EEFng g\xEC b\xEAn trong b\u1ED9 hu\u1EA5n luy\u1EC7n c\u1EE7a b\u1EA1n."),dr.forEach(t),Ch=p(n),$n=r(n,"P",{});var fr=c($n);pc=i(fr,"\u0110\u1EC3 tr\xE1nh m\u1EA5t v\xF4 s\u1ED1 gi\u1EDD \u0111\u1EC3 c\u1ED1 g\u1EAFng s\u1EEDa m\u1ED9t c\xE1i g\xEC \u0111\xF3 kh\xF4ng ph\u1EA3i l\xE0 ngu\u1ED3n g\u1ED1c c\u1EE7a l\u1ED7i, ch\xFAng t\xF4i khuy\xEAn b\u1EA1n n\xEAn s\u1EED d\u1EE5ng "),Ia=r(fr,"CODE",{});var zm=c(Ia);uc=i(zm,"trainr.train_dataset"),zm.forEach(t),mc=i(fr," \u0111\u1EC3 ki\u1EC3m tra. V\xEC v\u1EADy, h\xE3y l\xE0m \u0111i\u1EC1u \u0111\xF3 \u1EDF \u0111\xE2y:"),fr.forEach(t),Th=p(n),m(mt.$$.fragment,n),Ph=p(n),m(gt.$$.fragment,n),Ah=p(n),K=r(n,"P",{});var Ca=c(K);gc=i(Ca,"B\u1EA1n c\xF3 nh\u1EADn th\u1EA5y \u0111i\u1EC1u g\xEC \u0111\xF3 sai kh\xF4ng? \u0110i\u1EC1u n\xE0y, c\xF9ng v\u1EDBi th\xF4ng b\xE1o l\u1ED7i v\u1EC1 vi\u1EC7c thi\u1EBFu "),Fa=r(Ca,"CODE",{});var Nm=c(Fa);dc=i(Nm,"input_ids"),Nm.forEach(t),fc=i(Ca,", s\u1EBD khi\u1EBFn b\u1EA1n nh\u1EADn ra \u0111\xF3 l\xE0 c\xE1c v\u0103n b\u1EA3n ch\u1EE9 kh\xF4ng ph\u1EA3i s\u1ED1 m\xE0 m\xF4 h\xECnh c\xF3 th\u1EC3 hi\u1EC3u \u0111\u01B0\u1EE3c. \u1EDE \u0111\xE2y, l\u1ED7i ban \u0111\u1EA7u r\u1EA5t d\u1EC5 g\xE2y hi\u1EC3u nh\u1EA7m b\u1EDFi v\xEC "),Ka=r(Ca,"CODE",{});var Sm=c(Ka);bc=i(Sm,"Trainer"),Sm.forEach(t),vc=i(Ca," t\u1EF1 \u0111\u1ED9ng lo\u1EA1i b\u1ECF c\xE1c c\u1ED9t kh\xF4ng kh\u1EDBp v\u1EDBi \u0111\u1EB7c tr\u01B0ng c\u1EE7a m\xF4 h\xECnh (ngh\u0129a l\xE0 c\xE1c tham s\u1ED1 m\xE0 m\xF4 h\xECnh mong \u0111\u1EE3i). \u0110i\u1EC1u \u0111\xF3 c\xF3 ngh\u0129a l\xE0 \u1EDF \u0111\xE2y, m\u1ECDi th\u1EE9 ngo\u1EA1i tr\u1EEB nh\xE3n \u0111\u1EC1u b\u1ECB lo\u1EA1i b\u1ECF. Do \u0111\xF3, kh\xF4ng c\xF3 v\u1EA5n \u0111\u1EC1 g\xEC v\u1EDBi vi\u1EC7c t\u1EA1o c\xE1c l\xF4 v\xE0 sau \u0111\xF3 g\u1EEDi ch\xFAng \u0111\u1EBFn m\xF4 h\xECnh, \u0111i\u1EC1u n\xE0y do \u0111\xF3 ph\xE0n n\xE0n r\u1EB1ng n\xF3 kh\xF4ng nh\u1EADn \u0111\u01B0\u1EE3c \u0111\u1EA7u v\xE0o th\xEDch h\u1EE3p."),Ca.forEach(t),Dh=p(n),D=r(n,"P",{});var Z=c(D);kc=i(Z,"T\u1EA1i sao d\u1EEF li\u1EC7u kh\xF4ng \u0111\u01B0\u1EE3c x\u1EED l\xFD? Ch\xFAng ta \u0111\xE3 s\u1EED d\u1EE5ng ph\u01B0\u01A1ng th\u1EE9c "),Wa=r(Z,"CODE",{});var Om=c(Wa);yc=i(Om,"Dataset.map()"),Om.forEach(t),_c=i(Z," tr\xEAn c\xE1c t\u1EADp d\u1EEF li\u1EC7u \u0111\u1EC3 \xE1p d\u1EE5ng tokenizer tr\xEAn m\u1ED7i m\u1EABu. Nh\u01B0ng n\u1EBFu b\u1EA1n xem k\u1EF9 m\xE3, b\u1EA1n s\u1EBD th\u1EA5y r\u1EB1ng ch\xFAng ta \u0111\xE3 m\u1EAFc sai l\u1EA7m khi chuy\u1EC3n c\xE1c b\u1ED9 hu\u1EA5n luy\u1EC7n v\xE0 ki\u1EC3m \u0111\u1ECBnh cho "),Ra=r(Z,"CODE",{});var Um=c(Ra);$c=i(Um,"Trainer"),Um.forEach(t),wc=i(Z,". Thay v\xEC s\u1EED d\u1EE5ng "),Ya=r(Z,"CODE",{});var Vm=c(Ya);jc=i(Vm,"tokenized_datasets"),Vm.forEach(t),Ec=i(Z," \u1EDF \u0111\xE2y, ch\xFAng ta \u0111\xE3 s\u1EED d\u1EE5ng "),Xa=r(Z,"CODE",{});var Bm=c(Xa);qc=i(Bm,"raw_datasets"),Bm.forEach(t),xc=i(Z," \u{1F926}. V\xEC v\u1EADy, h\xE3y c\xF9ng s\u1EEDa ch\u1EEFa \u0111i\u1EC1u n\xE0y!"),Z.forEach(t),zh=p(n),m(dt.$$.fragment,n),Nh=p(n),Ne=r(n,"P",{});var Mm=c(Ne);Cc=i(Mm,"M\xE3 m\u1EDBi n\xE0y b\xE2y gi\u1EDD s\u1EBD \u0111\u01B0a ra m\u1ED9t l\u1ED7i kh\xE1c (c\xF3 ti\u1EBFn tri\u1EC3n!):"),Mm.forEach(t),Sh=p(n),m(ft.$$.fragment,n),Oh=p(n),Se=r(n,"P",{});var Lm=c(Se);Tc=i(Lm,"Nh\xECn v\xE0o d\u1EA5u truy v\u1EBFt, ch\xFAng ta c\xF3 th\u1EC3 th\u1EA5y l\u1ED7i x\u1EA3y ra trong b\u01B0\u1EDBc \u0111\u1ED1i chi\u1EBFu d\u1EEF li\u1EC7u:"),Lm.forEach(t),Uh=p(n),m(bt.$$.fragment,n),Vh=p(n),Oe=r(n,"P",{});var Gm=c(Oe);Pc=i(Gm,"V\xEC v\u1EADy, ch\xFAng ta n\xEAn chuy\u1EC3n sang \u0111i\u1EC1u \u0111\xF3. Tuy nhi\xEAn, tr\u01B0\u1EDBc khi th\u1EF1c hi\u1EC7n, ch\xFAng ta h\xE3y ho\xE0n th\xE0nh vi\u1EC7c ki\u1EC3m tra d\u1EEF li\u1EC7u c\u1EE7a m\xECnh, \u0111\u1EC3 ch\u1EAFc ch\u1EAFn r\u1EB1ng n\xF3 ch\xEDnh x\xE1c 100%."),Gm.forEach(t),Bh=p(n),Ue=r(n,"P",{});var Hm=c(Ue);Ac=i(Hm,"M\u1ED9t \u0111i\u1EC1u b\u1EA1n lu\xF4n n\xEAn l\xE0m khi g\u1EE1 l\u1ED7i m\u1ED9t phi\xEAn hu\u1EA5n luy\u1EC7n l\xE0 xem x\xE9t c\xE1c \u0111\u1EA7u v\xE0o \u0111\u01B0\u1EE3c gi\u1EA3i m\xE3 c\u1EE7a m\xF4 h\xECnh c\u1EE7a b\u1EA1n. Ch\xFAng ta kh\xF4ng th\u1EC3 hi\u1EC3u \u0111\u01B0\u1EE3c nh\u1EEFng con s\u1ED1 m\xE0 ch\xFAng ta cung c\u1EA5p tr\u1EF1c ti\u1EBFp cho n\xF3, v\xEC v\u1EADy ch\xFAng ta n\xEAn xem nh\u1EEFng con s\u1ED1 \u0111\xF3 \u0111\u1EA1i di\u1EC7n cho \u0111i\u1EC1u g\xEC. V\xED d\u1EE5: trong th\u1ECB gi\xE1c m\xE1y t\xEDnh, \u0111i\u1EC1u \u0111\xF3 c\xF3 ngh\u0129a l\xE0 nh\xECn v\xE0o h\xECnh \u1EA3nh \u0111\u01B0\u1EE3c gi\u1EA3i m\xE3 c\u1EE7a c\xE1c pixel b\u1EA1n chuy\u1EC3n qua, trong l\u1EDDi n\xF3i, \u0111i\u1EC1u \u0111\xF3 c\xF3 ngh\u0129a l\xE0 nghe c\xE1c m\u1EABu \xE2m thanh \u0111\u01B0\u1EE3c gi\u1EA3i m\xE3 v\xE0 \u0111\u1ED1i v\u1EDBi v\xED d\u1EE5 NLP c\u1EE7a ch\xFAng ta \u1EDF \u0111\xE2y, \u0111i\u1EC1u \u0111\xF3 c\xF3 ngh\u0129a l\xE0 s\u1EED d\u1EE5ng tr\xECnh tokenizer \u0111\u1EC3 gi\u1EA3i m\xE3 \u0111\u1EA7u v\xE0o:"),Hm.forEach(t),Mh=p(n),m(vt.$$.fragment,n),Lh=p(n),m(kt.$$.fragment,n),Gh=p(n),Ve=r(n,"P",{});var Im=c(Ve);Dc=i(Im,"V\xEC v\u1EADy, \u0111i\u1EC1u \u0111\xF3 c\xF3 v\u1EBB ch\xEDnh x\xE1c. B\u1EA1n n\xEAn l\xE0m \u0111i\u1EC1u n\xE0y cho t\u1EA5t c\u1EA3 c\xE1c ph\xEDm trong \u0111\u1EA7u v\xE0o:"),Im.forEach(t),Hh=p(n),m(yt.$$.fragment,n),Ih=p(n),m(_t.$$.fragment,n),Fh=p(n),z=r(n,"P",{});var nn=c(z);zc=i(nn,"L\u01B0u \xFD r\u1EB1ng c\xE1c kh\xF3a kh\xF4ng t\u01B0\u01A1ng \u1EE9ng v\u1EDBi \u0111\u1EA7u v\xE0o \u0111\u01B0\u1EE3c m\xF4 h\xECnh ch\u1EA5p nh\u1EADn s\u1EBD t\u1EF1 \u0111\u1ED9ng b\u1ECB lo\u1EA1i b\u1ECF, v\xEC v\u1EADy \u1EDF \u0111\xE2y ch\xFAng t\xF4i s\u1EBD ch\u1EC9 gi\u1EEF l\u1EA1i "),Ja=r(nn,"CODE",{});var Fm=c(Ja);Nc=i(Fm,"input_ids"),Fm.forEach(t),Sc=i(nn,", "),Qa=r(nn,"CODE",{});var Km=c(Qa);Oc=i(Km,"attention_mask"),Km.forEach(t),Uc=i(nn,", v\xE0 "),Za=r(nn,"CODE",{});var Wm=c(Za);Vc=i(Wm,"label"),Wm.forEach(t),Bc=i(nn," (s\u1EBD \u0111\u01B0\u1EE3c \u0111\u1ED5i t\xEAn th\xE0nh "),ns=r(nn,"CODE",{});var Rm=c(ns);Mc=i(Rm,"labels"),Rm.forEach(t),Lc=i(nn,"). \u0110\u1EC3 ki\u1EC3m tra k\u1EF9 m\xF4 h\xECnh, b\u1EA1n c\xF3 th\u1EC3 in lo\u1EA1i m\xF4 h\xECnh c\u1EE7a m\xECnh, sau \u0111\xF3 ki\u1EC3m tra t\xE0i li\u1EC7u c\u1EE7a n\xF3:"),nn.forEach(t),Kh=p(n),m($t.$$.fragment,n),Wh=p(n),m(wt.$$.fragment,n),Rh=p(n),W=r(n,"P",{});var Ta=c(W);Gc=i(Ta,"V\xEC v\u1EADy, trong tr\u01B0\u1EDDng h\u1EE3p c\u1EE7a m\xECnh, ch\xFAng ta c\xF3 th\u1EC3 ki\u1EC3m tra c\xE1c tham s\u1ED1 \u0111\u01B0\u1EE3c ch\u1EA5p nh\u1EADn tr\xEAn "),jt=r(Ta,"A",{href:!0,rel:!0});var Ym=c(jt);Hc=i(Ym,"trang n\xE0y"),Ym.forEach(t),Ic=i(Ta,". "),ts=r(Ta,"CODE",{});var Xm=c(ts);Fc=i(Xm,"Trainer"),Xm.forEach(t),Kc=i(Ta," c\u0169ng s\u1EBD ghi l\u1EA1i c\xE1c c\u1ED9t m\xE0 n\xF3 \u0111ang lo\u1EA1i b\u1ECF."),Ta.forEach(t),Yh=p(n),wn=r(n,"P",{});var br=c(wn);Wc=i(br,"Ch\xFAng ta \u0111\xE3 ki\u1EC3m tra xem c\xE1c ID \u0111\u1EA7u v\xE0o c\xF3 ch\xEDnh x\xE1c hay kh\xF4ng b\u1EB1ng c\xE1ch gi\u1EA3i m\xE3 ch\xFAng. Ti\u1EBFp theo l\xE0 "),es=r(br,"CODE",{});var Jm=c(es);Rc=i(Jm,"attention_mask"),Jm.forEach(t),Yc=i(br,":"),br.forEach(t),Xh=p(n),m(Et.$$.fragment,n),Jh=p(n),m(qt.$$.fragment,n),Qh=p(n),Be=r(n,"P",{});var Qm=c(Be);Xc=i(Qm,"V\xEC ch\xFAng ta kh\xF4ng \xE1p d\u1EE5ng \u0111\u1EC7m trong qu\xE1 tr\xECnh ti\u1EC1n x\u1EED l\xFD c\u1EE7a m\xECnh, \u0111i\u1EC1u n\xE0y c\xF3 v\u1EBB ho\xE0n to\xE0n t\u1EF1 nhi\xEAn. \u0110\u1EC3 \u0111\u1EA3m b\u1EA3o kh\xF4ng c\xF3 v\u1EA5n \u0111\u1EC1 g\xEC v\u1EDBi attention mask \u0111\xF3, h\xE3y ki\u1EC3m tra xem n\xF3 c\xF3 c\xF9ng \u0111\u1ED9 d\xE0i v\u1EDBi ID \u0111\u1EA7u v\xE0o c\u1EE7a ch\xFAng ta kh\xF4ng:"),Qm.forEach(t),Zh=p(n),m(xt.$$.fragment,n),ni=p(n),m(Ct.$$.fragment,n),ti=p(n),Me=r(n,"P",{});var Zm=c(Me);Jc=i(Zm,"T\u1ED1t \u0111\u1EA5y! Cu\u1ED1i c\xF9ng, h\xE3y ki\u1EC3m tra nh\xE3n c\u1EE7a m\xECnh:"),Zm.forEach(t),ei=p(n),m(Tt.$$.fragment,n),ai=p(n),m(Pt.$$.fragment,n),si=p(n),R=r(n,"P",{});var Pa=c(R);Qc=i(Pa,"Gi\u1ED1ng nh\u01B0 c\xE1c ID \u0111\u1EA7u v\xE0o, \u0111\xE2y l\xE0 m\u1ED9t con s\u1ED1 kh\xF4ng th\u1EF1c s\u1EF1 c\xF3 \xFD ngh\u0129a. Nh\u01B0 ch\xFAng ta \u0111\xE3 th\u1EA5y tr\u01B0\u1EDBc \u0111\xE2y, \xE1nh x\u1EA1 gi\u1EEFa c\xE1c s\u1ED1 nguy\xEAn v\xE0 t\xEAn nh\xE3n \u0111\u01B0\u1EE3c l\u01B0u tr\u1EEF b\xEAn trong thu\u1ED9c t\xEDnh "),as=r(Pa,"CODE",{});var ng=c(as);Zc=i(ng,"names"),ng.forEach(t),no=i(Pa," c\u1EE7a "),ss=r(Pa,"EM",{});var tg=c(ss);to=i(tg,"\u0111\u1EB7c tr\u01B0ng"),tg.forEach(t),eo=i(Pa," t\u01B0\u01A1ng \u1EE9ng c\u1EE7a t\u1EADp d\u1EEF li\u1EC7u:"),Pa.forEach(t),hi=p(n),m(At.$$.fragment,n),ii=p(n),m(Dt.$$.fragment,n),li=p(n),Y=r(n,"P",{});var Aa=c(Y);ao=i(Aa,"V\xEC v\u1EADy, "),hs=r(Aa,"CODE",{});var eg=c(hs);so=i(eg,"1"),eg.forEach(t),ho=i(Aa," c\xF3 ngh\u0129a l\xE0 "),is=r(Aa,"CODE",{});var ag=c(is);io=i(ag,"neutral"),ag.forEach(t),lo=i(Aa,", c\xF3 ngh\u0129a l\xE0 hai c\xE2u ch\xFAng ta \u0111\xE3 th\u1EA5y \u1EDF tr\xEAn kh\xF4ng m\xE2u thu\u1EABn v\u1EDBi nhau v\xE0 c\xE2u \u0111\u1EA7u ti\xEAn kh\xF4ng bao h\xE0m c\xE2u th\u1EE9 hai. \u0110i\u1EC1u \u0111\xF3 c\xF3 v\u1EBB \u0111\xFAng!"),Aa.forEach(t),ri=p(n),Le=r(n,"P",{});var sg=c(Le);ro=i(sg,"Ch\xFAng ta kh\xF4ng c\xF3 token ID \u1EDF \u0111\xE2y, v\xEC DistilBERT kh\xF4ng mong \u0111\u1EE3i ch\xFAng; n\u1EBFu b\u1EA1n c\xF3 m\u1ED9t s\u1ED1 trong m\xF4 h\xECnh c\u1EE7a m\xECnh, b\u1EA1n c\u0169ng n\xEAn \u0111\u1EA3m b\u1EA3o r\u1EB1ng ch\xFAng kh\u1EDBp \u0111\xFAng v\u1EDBi v\u1ECB tr\xED c\u1EE7a c\xE2u \u0111\u1EA7u ti\xEAn v\xE0 c\xE2u th\u1EE9 hai trong \u0111\u1EA7u v\xE0o."),sg.forEach(t),ci=p(n),m(jn.$$.fragment,n),oi=p(n),Ge=r(n,"P",{});var hg=c(Ge);co=i(hg,"Ch\xFAng ta ch\u1EC9 th\u1EF1c hi\u1EC7n ki\u1EC3m tra t\u1EADp hu\u1EA5n luy\u1EC7n \u1EDF \u0111\xE2y, nh\u01B0ng t\u1EA5t nhi\xEAn b\u1EA1n n\xEAn ki\u1EC3m tra k\u1EF9 c\xE1c t\u1EADp ki\u1EC3m \u0111\u1ECBnh v\xE0 ki\u1EC3m tra theo c\xF9ng m\u1ED9t c\xE1ch."),hg.forEach(t),pi=p(n),He=r(n,"P",{});var ig=c(He);oo=i(ig,"B\xE2y gi\u1EDD ch\xFAng ta bi\u1EBFt b\u1ED9 d\u1EEF li\u1EC7u c\u1EE7a m\xECnh tr\xF4ng \u1ED5n, \u0111\xE3 \u0111\u1EBFn l\xFAc ki\u1EC3m tra b\u01B0\u1EDBc ti\u1EBFp theo c\u1EE7a quy tr\xECnh hu\u1EA5n luy\u1EC7n."),ig.forEach(t),ui=p(n),hn=r(n,"H3",{class:!0});var vr=c(hn);En=r(vr,"A",{id:!0,class:!0,href:!0});var lg=c(En);ls=r(lg,"SPAN",{});var rg=c(ls);m(zt.$$.fragment,rg),rg.forEach(t),lg.forEach(t),po=p(vr),rs=r(vr,"SPAN",{});var cg=c(rs);uo=i(cg,"T\u1EEB b\u1ED9 d\u1EEF li\u1EC7u th\xE0nh dataloader"),cg.forEach(t),vr.forEach(t),mi=p(n),N=r(n,"P",{});var tn=c(N);mo=i(tn,"\u0110i\u1EC1u ti\u1EBFp theo c\xF3 th\u1EC3 x\u1EA3y ra sai s\xF3t trong quy tr\xECnh hu\u1EA5n luy\u1EC7n l\xE0 khi "),cs=r(tn,"CODE",{});var og=c(cs);go=i(og,"Trainer"),og.forEach(t),fo=i(tn," c\u1ED1 g\u1EAFng t\u1EA1o c\xE1c l\xF4 t\u1EEB t\u1EADp hu\u1EA5n luy\u1EC7n ho\u1EB7c ki\u1EC3m \u0111\u1ECBnh. Khi b\u1EA1n ch\u1EAFc ch\u1EAFn r\u1EB1ng t\u1EADp d\u1EEF li\u1EC7u c\u1EE7a "),os=r(tn,"CODE",{});var pg=c(os);bo=i(pg,"Trainer"),pg.forEach(t),vo=i(tn," l\xE0 ch\xEDnh x\xE1c, b\u1EA1n c\xF3 th\u1EC3 th\u1EED t\u1EA1o m\u1ED9t lo\u1EA1t theo c\xE1ch th\u1EE7 c\xF4ng b\u1EB1ng c\xE1ch th\u1EF1c hi\u1EC7n nh\u01B0 sau (thay th\u1EBF "),ps=r(tn,"CODE",{});var ug=c(ps);ko=i(ug,"train"),ug.forEach(t),yo=i(tn," b\u1EB1ng "),us=r(tn,"CODE",{});var mg=c(us);_o=i(mg,"eval"),mg.forEach(t),$o=i(tn," cho dataloader ki\u1EC3m \u0111\u1ECBnh):"),tn.forEach(t),gi=p(n),m(Nt.$$.fragment,n),di=p(n),Ie=r(n,"P",{});var gg=c(Ie);wo=i(gg,"M\xE3 n\xE0y t\u1EA1o ra dataloader hu\u1EA5n luy\u1EC7n, sau \u0111\xF3 l\u1EB7p qua n\xF3, d\u1EEBng l\u1EA1i \u1EDF l\u1EA7n l\u1EB7p \u0111\u1EA7u ti\xEAn. N\u1EBFu m\xE3 th\u1EF1c thi m\xE0 kh\xF4ng c\xF3 l\u1ED7i, b\u1EA1n c\xF3 l\xF4 hu\u1EA5n luy\u1EC7n \u0111\u1EA7u ti\xEAn m\xE0 b\u1EA1n c\xF3 th\u1EC3 ki\u1EC3m tra v\xE0 n\u1EBFu m\xE3 l\u1ED7i x\u1EA3y ra, b\u1EA1n bi\u1EBFt ch\u1EAFc ch\u1EAFn v\u1EA5n \u0111\u1EC1 n\u1EB1m trong dataloader, nh\u01B0 tr\u01B0\u1EDDng h\u1EE3p \u1EDF \u0111\xE2y:"),gg.forEach(t),fi=p(n),m(St.$$.fragment,n),bi=p(n),X=r(n,"P",{});var Da=c(X);jo=i(Da,"Vi\u1EC7c ki\u1EC3m tra khung cu\u1ED1i c\xF9ng c\u1EE7a qu\xE1 tr\xECnh truy xu\u1EA5t s\u1EBD \u0111\u1EE7 \u0111\u1EC3 cung c\u1EA5p cho b\u1EA1n manh m\u1ED1i, nh\u01B0ng h\xE3y t\xECm hi\u1EC3u k\u1EF9 h\u01A1n m\u1ED9t ch\xFAt. H\u1EA7u h\u1EBFt c\xE1c v\u1EA5n \u0111\u1EC1 trong qu\xE1 tr\xECnh t\u1EA1o l\xF4 \u0111\u1EC1u ph\xE1t sinh do vi\u1EC7c \u0111\u1ED1i chi\u1EBFu c\xE1c v\xED d\u1EE5 th\xE0nh m\u1ED9t l\xF4 duy nh\u1EA5t, v\xEC v\u1EADy, \u0111i\u1EC1u \u0111\u1EA7u ti\xEAn c\u1EA7n ki\u1EC3m tra khi nghi ng\u1EDD l\xE0 "),ms=r(Da,"CODE",{});var dg=c(ms);Eo=i(dg,"collate_fn"),dg.forEach(t),qo=i(Da," m\xE0 "),gs=r(Da,"CODE",{});var fg=c(gs);xo=i(fg,"DataLoader"),fg.forEach(t),Co=i(Da," c\u1EE7a b\u1EA1n \u0111ang s\u1EED d\u1EE5ng:"),Da.forEach(t),vi=p(n),m(Ot.$$.fragment,n),ki=p(n),m(Ut.$$.fragment,n),yi=p(n),B=r(n,"P",{});var tt=c(B);To=i(tt,"V\xEC v\u1EADy, \u0111\xE2y l\xE0 "),ds=r(tt,"CODE",{});var bg=c(ds);Po=i(bg,"default_data_collator"),bg.forEach(t),Ao=i(tt,", nh\u01B0ng \u0111\xF3 kh\xF4ng ph\u1EA3i l\xE0 nh\u1EEFng g\xEC ch\xFAng ta mu\u1ED1n trong tr\u01B0\u1EDDng h\u1EE3p n\xE0y. Ch\xFAng ta mu\u1ED1n \u0111\u01B0a c\xE1c v\xED d\u1EE5 c\u1EE7a m\xECnh v\xE0o c\xE2u d\xE0i nh\u1EA5t trong l\xF4, \u0111\u01B0\u1EE3c th\u1EF1c hi\u1EC7n b\u1EDFi tr\xECnh \u0111\u1ED1i chi\u1EBFu "),fs=r(tt,"CODE",{});var vg=c(fs);Do=i(vg,"DataCollatorWithPadding"),vg.forEach(t),zo=i(tt,". V\xE0 tr\xECnh \u0111\u1ED1i chi\u1EBFu d\u1EEF li\u1EC7u n\xE0y \u0111\u01B0\u1EE3c cho l\xE0 \u0111\u01B0\u1EE3c s\u1EED d\u1EE5ng theo m\u1EB7c \u0111\u1ECBnh b\u1EDFi "),bs=r(tt,"CODE",{});var kg=c(bs);No=i(kg,"Trainer"),kg.forEach(t),So=i(tt,", v\u1EADy t\u1EA1i sao n\xF3 kh\xF4ng \u0111\u01B0\u1EE3c s\u1EED d\u1EE5ng \u1EDF \u0111\xE2y?"),tt.forEach(t),_i=p(n),M=r(n,"P",{});var et=c(M);Oo=i(et,"C\xE2u tr\u1EA3 l\u1EDDi l\xE0 v\xEC ch\xFAng ta \u0111\xE3 kh\xF4ng chuy\u1EC3n "),vs=r(et,"CODE",{});var yg=c(vs);Uo=i(yg,"tokenizer"),yg.forEach(t),Vo=i(et," cho "),ks=r(et,"CODE",{});var _g=c(ks);Bo=i(_g,"Trainer"),_g.forEach(t),Mo=i(et,", v\xEC v\u1EADy n\xF3 kh\xF4ng th\u1EC3 t\u1EA1o "),ys=r(et,"CODE",{});var $g=c(ys);Lo=i($g,"DataCollatorWithPadding"),$g.forEach(t),Go=i(et," m\xE0 ch\xFAng ta mu\u1ED1n. Trong th\u1EF1c t\u1EBF, b\u1EA1n \u0111\u1EEBng bao gi\u1EDD ng\u1EA7n ng\u1EA1i chuy\u1EC3n m\u1ED9t c\xE1ch r\xF5 r\xE0ng b\u1ED9 \u0111\u1ED1i chi\u1EBFu d\u1EEF li\u1EC7u m\xE0 b\u1EA1n mu\u1ED1n s\u1EED d\u1EE5ng, \u0111\u1EC3 \u0111\u1EA3m b\u1EA3o r\u1EB1ng b\u1EA1n tr\xE1nh \u0111\u01B0\u1EE3c nh\u1EEFng lo\u1EA1i l\u1ED7i n\xE0y. H\xE3y \u0111i\u1EC1u ch\u1EC9nh m\xE3 c\u1EE7a ch\xFAng ta \u0111\u1EC3 th\u1EF1c hi\u1EC7n ch\xEDnh x\xE1c \u0111i\u1EC1u \u0111\xF3:"),et.forEach(t),$i=p(n),m(Vt.$$.fragment,n),wi=p(n),Fe=r(n,"P",{});var wg=c(Fe);Ho=i(wg,"Tin t\u1ED1t? Ch\xFAng ta kh\xF4ng g\u1EB7p l\u1ED7i nh\u01B0 tr\u01B0\u1EDBc n\u1EEFa, \u0111\xF3 ch\u1EAFc ch\u1EAFn l\xE0 s\u1EF1 ti\u1EBFn b\u1ED9. C\xE1c tin x\u1EA5u? Thay v\xE0o \u0111\xF3, ch\xFAng ta nh\u1EADn \u0111\u01B0\u1EE3c m\u1ED9t l\u1ED7i CUDA kh\xE9t ti\u1EBFng:"),wg.forEach(t),ji=p(n),m(Bt.$$.fragment,n),Ei=p(n),Ke=r(n,"P",{});var jg=c(Ke);Io=i(jg,"\u0110i\u1EC1u n\xE0y th\u1EADt t\u1EC7 v\xEC l\u1ED7i CUDA n\xF3i chung r\u1EA5t kh\xF3 g\u1EE1 l\u1ED7i. Ch\xFAng ta s\u1EBD xem trong m\u1ED9t ph\xFAt n\u1EEFa c\xE1ch gi\u1EA3i quy\u1EBFt v\u1EA5n \u0111\u1EC1 n\xE0y, nh\u01B0ng tr\u01B0\u1EDBc ti\xEAn h\xE3y k\u1EBFt th\xFAc ph\xE2n t\xEDch c\u1EE7a ch\xFAng ta v\u1EC1 t\u1EA1o l\xF4."),jg.forEach(t),qi=p(n),We=r(n,"P",{});var Eg=c(We);Fo=i(Eg,"N\u1EBFu b\u1EA1n ch\u1EAFc ch\u1EAFn tr\xECnh \u0111\u1ED1i chi\u1EBFu d\u1EEF li\u1EC7u c\u1EE7a m\xECnh l\xE0 \u0111\xFAng, b\u1EA1n n\xEAn th\u1EED \xE1p d\u1EE5ng n\xF3 tr\xEAn m\u1ED9t v\xE0i m\u1EABu c\u1EE7a t\u1EADp d\u1EEF li\u1EC7u c\u1EE7a m\xECnh:"),Eg.forEach(t),xi=p(n),m(Mt.$$.fragment,n),Ci=p(n),S=r(n,"P",{});var en=c(S);Ko=i(en,"M\xE3 n\xE0y s\u1EBD kh\xF4ng th\xE0nh c\xF4ng v\xEC "),_s=r(en,"CODE",{});var qg=c(_s);Wo=i(qg,"train_dataset"),qg.forEach(t),Ro=i(en," ch\u1EE9a c\xE1c c\u1ED9t chu\u1ED7i m\xE0 "),$s=r(en,"CODE",{});var xg=c($s);Yo=i(xg,"Trainer"),xg.forEach(t),Xo=i(en," th\u01B0\u1EDDng lo\u1EA1i b\u1ECF. B\u1EA1n c\xF3 th\u1EC3 x\xF3a ch\xFAng theo c\xE1ch th\u1EE7 c\xF4ng ho\u1EB7c n\u1EBFu b\u1EA1n mu\u1ED1n sao ch\xE9p ch\xEDnh x\xE1c nh\u1EEFng g\xEC m\xE0 "),ws=r(en,"CODE",{});var Cg=c(ws);Jo=i(Cg,"Trainer"),Cg.forEach(t),Qo=i(en," \u0111ang l\xE0m \u1EDF h\u1EADu tr\u01B0\u1EDDng, b\u1EA1n c\xF3 th\u1EC3 g\u1ECDi ph\u01B0\u01A1ng th\u1EE9c ri\xEAng  "),js=r(en,"CODE",{});var Tg=c(js);Zo=i(Tg,"Trainer._remove_unused_columns()"),Tg.forEach(t),np=i(en," \u0111\u1EC3 th\u1EF1c hi\u1EC7n \u0111i\u1EC1u \u0111\xF3:"),en.forEach(t),Ti=p(n),m(Lt.$$.fragment,n),Pi=p(n),Re=r(n,"P",{});var Pg=c(Re);tp=i(Pg,"Sau \u0111\xF3, b\u1EA1n s\u1EBD c\xF3 th\u1EC3 g\u1EE1 l\u1ED7i theo c\xE1ch th\u1EE7 c\xF4ng nh\u1EEFng g\xEC x\u1EA3y ra b\xEAn trong b\u1ED9 \u0111\u1ED1i chi\u1EBFu d\u1EEF li\u1EC7u n\u1EBFu l\u1ED7i v\u1EABn ti\u1EBFp di\u1EC5n."),Pg.forEach(t),Ai=p(n),Ye=r(n,"P",{});var Ag=c(Ye);ep=i(Ag,"B\xE2y gi\u1EDD ch\xFAng ta \u0111\xE3 g\u1EE1 l\u1ED7i quy tr\xECnh t\u1EA1o l\xF4, \u0111\xE3 \u0111\u1EBFn l\xFAc chuy\u1EC3n qua m\xF4 h\xECnh!"),Ag.forEach(t),Di=p(n),ln=r(n,"H3",{class:!0});var kr=c(ln);qn=r(kr,"A",{id:!0,class:!0,href:!0});var Dg=c(qn);Es=r(Dg,"SPAN",{});var zg=c(Es);m(Gt.$$.fragment,zg),zg.forEach(t),Dg.forEach(t),ap=p(kr),qs=r(kr,"SPAN",{});var Ng=c(qs);sp=i(Ng,"Xem qua m\xF4 h\xECnh"),Ng.forEach(t),kr.forEach(t),zi=p(n),Xe=r(n,"P",{});var Sg=c(Xe);hp=i(Sg,"B\u1EA1n s\u1EBD c\xF3 th\u1EC3 nh\u1EADn \u0111\u01B0\u1EE3c m\u1ED9t l\xF4 b\u1EB1ng c\xE1ch th\u1EF1c hi\u1EC7n l\u1EC7nh sau:"),Sg.forEach(t),Ni=p(n),m(Ht.$$.fragment,n),Si=p(n),xn=r(n,"P",{});var yr=c(xn);ip=i(yr,"N\u1EBFu b\u1EA1n \u0111ang ch\u1EA1y m\xE3 n\xE0y trong notebook, b\u1EA1n c\xF3 th\u1EC3 g\u1EB7p l\u1ED7i CUDA t\u01B0\u01A1ng t\u1EF1 nh\u01B0 l\u1ED7i \u0111\xE3 th\u1EA5y tr\u01B0\u1EDBc \u0111\xF3, trong tr\u01B0\u1EDDng h\u1EE3p \u0111\xF3, b\u1EA1n c\u1EA7n kh\u1EDFi \u0111\u1ED9ng l\u1EA1i notebook c\u1EE7a m\xECnh v\xE0 th\u1EF1c hi\u1EC7n l\u1EA1i \u0111o\u1EA1n m\xE3 cu\u1ED1i c\xF9ng m\xE0 kh\xF4ng c\xF3 d\xF2ng "),xs=r(yr,"CODE",{});var Og=c(xs);lp=i(Og,"trainer.train()"),Og.forEach(t),rp=i(yr,". \u0110\xF3 l\xE0 \u0111i\u1EC1u kh\xF3 ch\u1ECBu th\u1EE9 hai v\u1EC1 l\u1ED7i CUDA: ch\xFAng ph\xE1 v\u1EE1 kernel c\u1EE7a b\u1EA1n m\u1ED9t c\xE1ch kh\xF4ng th\u1EC3 kh\u1EAFc ph\u1EE5c \u0111\u01B0\u1EE3c. \u0110i\u1EC1u kh\xF3 ch\u1ECBu nh\u1EA5t v\u1EC1 ch\xFAng l\xE0 th\u1EF1c t\u1EBF l\xE0 ch\xFAng r\u1EA5t kh\xF3 \u0111\u1EC3 g\u1EE1 l\u1ED7i."),yr.forEach(t),Oi=p(n),Je=r(n,"P",{});var Ug=c(Je);cp=i(Ug,"T\u1EA1i sao v\u1EADy? N\xF3 li\xEAn quan \u0111\u1EBFn c\xE1ch ho\u1EA1t \u0111\u1ED9ng c\u1EE7a GPU. Ch\xFAng c\u1EF1c k\u1EF3 hi\u1EC7u qu\u1EA3 trong vi\u1EC7c th\u1EF1c hi\u1EC7n song song nhi\u1EC1u thao t\xE1c, nh\u01B0ng h\u1EA1n ch\u1EBF l\xE0 khi m\u1ED9t trong c\xE1c l\u1EC7nh \u0111\xF3 d\u1EABn \u0111\u1EBFn l\u1ED7i, b\u1EA1n s\u1EBD kh\xF4ng bi\u1EBFt ngay l\u1EADp t\u1EE9c. Ch\u1EC9 khi ch\u01B0\u01A1ng tr\xECnh g\u1ECDi \u0111\u1ED3ng b\u1ED9 h\xF3a nhi\u1EC1u quy tr\xECnh tr\xEAn GPU th\xEC n\xF3 m\u1EDBi nh\u1EADn ra c\xF3 g\xEC \u0111\xF3 kh\xF4ng \u1ED5n, v\xEC v\u1EADy l\u1ED7i th\u1EF1c s\u1EF1 \u0111\u01B0\u1EE3c ph\xE1t sinh \u1EDF m\u1ED9t n\u01A1i kh\xF4ng li\xEAn quan g\xEC \u0111\u1EBFn nh\u1EEFng g\xEC \u0111\xE3 t\u1EA1o ra n\xF3. V\xED d\u1EE5, n\u1EBFu ch\xFAng ta xem l\u1EA1i l\u1EA7n truy xu\u1EA5t tr\u01B0\u1EDBc c\u1EE7a m\xECnh, l\u1ED7i \u0111\xE3 \u0111\u01B0\u1EE3c ph\xE1t sinh trong qu\xE1 tr\xECnh truy\u1EC1n ng\u01B0\u1EE3c, nh\u01B0ng ch\xFAng ta s\u1EBD th\u1EA5y trong m\u1ED9t ph\xFAt r\u1EB1ng n\xF3 th\u1EF1c s\u1EF1 b\u1EAFt ngu\u1ED3n t\u1EEB m\u1ED9t c\xE1i g\xEC \u0111\xF3 trong truy\u1EC1n th\u1EB3ng."),Ug.forEach(t),Ui=p(n),Qe=r(n,"P",{});var Vg=c(Qe);op=i(Vg,"V\u1EADy l\xE0m c\xE1ch n\xE0o \u0111\u1EC3 g\u1EE1 nh\u1EEFng l\u1ED7i \u0111\xF3? C\xE2u tr\u1EA3 l\u1EDDi r\u1EA5t d\u1EC5 d\xE0ng: ch\xFAng t\xF4i kh\xF4ng. Tr\u1EEB khi l\u1ED7i CUDA c\u1EE7a b\u1EA1n l\xE0 l\u1ED7i h\u1EBFt b\u1ED9 nh\u1EDB (c\xF3 ngh\u0129a l\xE0 kh\xF4ng c\xF3 \u0111\u1EE7 b\u1ED9 nh\u1EDB trong GPU c\u1EE7a b\u1EA1n), b\u1EA1n n\xEAn quay l\u1EA1i CPU \u0111\u1EC3 g\u1EE1 l\u1ED7i."),Vg.forEach(t),Vi=p(n),Cn=r(n,"P",{});var _r=c(Cn);pp=i(_r,"\u0110\u1EC3 th\u1EF1c hi\u1EC7n \u0111i\u1EC1u n\xE0y trong tr\u01B0\u1EDDng h\u1EE3p c\u1EE7a m\xECnh, ch\xFAng ta ch\u1EC9 c\u1EA7n \u0111\u1EB7t m\xF4 h\xECnh tr\u1EDF l\u1EA1i CPU v\xE0 g\u1ECDi n\xF3 v\xE0o l\xF4 c\u1EE7a m\xECnh - l\xF4 \u0111\u01B0\u1EE3c tr\u1EA3 v\u1EC1 b\u1EDFi "),Cs=r(_r,"CODE",{});var Bg=c(Cs);up=i(Bg,"DataLoader"),Bg.forEach(t),mp=i(_r," v\u1EABn ch\u01B0a \u0111\u01B0\u1EE3c chuy\u1EC3n \u0111\u1EBFn GPU:"),_r.forEach(t),Bi=p(n),m(It.$$.fragment,n),Mi=p(n),m(Ft.$$.fragment,n),Li=p(n),Tn=r(n,"P",{});var $r=c(Tn);gp=i($r,"V\xEC v\u1EADy, b\u1EE9c tranh ng\xE0y c\xE0ng r\xF5 r\xE0ng. Thay v\xEC g\u1EB7p l\u1ED7i CUDA, b\xE2y gi\u1EDD ch\xFAng ta c\xF3 "),Ts=r($r,"CODE",{});var Mg=c(Ts);dp=i(Mg,"IndexError"),Mg.forEach(t),fp=i($r," trong t\xEDnh to\xE1n m\u1EA5t m\xE1t (v\xEC v\u1EADy kh\xF4ng li\xEAn quan g\xEC \u0111\u1EBFn lan truy\u1EC1n ng\u01B0\u1EE3c, nh\u01B0 ta \u0111\xE3 n\xF3i tr\u01B0\u1EDBc \u0111\xF3). Ch\xEDnh x\xE1c h\u01A1n, ch\xFAng ta c\xF3 th\u1EC3 th\u1EA5y r\u1EB1ng nh\xE3n 2 t\u1EA1o ra l\u1ED7i, v\xEC v\u1EADy \u0111\xE2y l\xE0 th\u1EDDi \u0111i\u1EC3m r\u1EA5t t\u1ED1t \u0111\u1EC3 ki\u1EC3m tra s\u1ED1 l\u01B0\u1EE3ng nh\xE3n c\u1EE7a m\xF4 h\xECnh c\u1EE7a ta:"),$r.forEach(t),Gi=p(n),m(Kt.$$.fragment,n),Hi=p(n),m(Wt.$$.fragment,n),Ii=p(n),Ze=r(n,"P",{});var Lg=c(Ze);bp=i(Lg,"V\u1EDBi hai nh\xE3n, ch\u1EC9 c\xF3 0 v\xE0 1 \u0111\u01B0\u1EE3c ph\xE9p l\xE0m nh\xE3n, nh\u01B0ng theo th\xF4ng b\xE1o l\u1ED7i, ch\xFAng t\xF4i nh\u1EADn \u0111\u01B0\u1EE3c 2. Nh\u1EADn \u0111\u01B0\u1EE3c 2 th\u1EF1c ra l\xE0 b\xECnh th\u01B0\u1EDDng: n\u1EBFu ch\xFAng ta nh\u1EDB t\xEAn nh\xE3n m\xE0 ch\xFAng ta \u0111\xE3 tr\xEDch xu\u1EA5t tr\u01B0\u1EDBc \u0111\xF3, c\xF3 ba, v\xEC v\u1EADy ch\xFAng ta c\xF3 ch\u1EC9 s\u1ED1 0 , 1 v\xE0 2 trong t\u1EADp d\u1EEF li\u1EC7u c\u1EE7a m\xECnh. V\u1EA5n \u0111\u1EC1 l\xE0 ch\xFAng ta \u0111\xE3 kh\xF4ng n\xF3i \u0111i\u1EC1u \u0111\xF3 v\u1EDBi m\xF4 h\xECnh c\u1EE7a m\xECnh, m\xF4 h\xECnh n\xE0y l\u1EBD ra ph\u1EA3i \u0111\u01B0\u1EE3c t\u1EA1o v\u1EDBi ba nh\xE3n. V\xEC v\u1EADy, ch\xFAng ta h\xE3y kh\u1EAFc ph\u1EE5c \u0111i\u1EC1u \u0111\xF3!"),Lg.forEach(t),Fi=p(n),m(Rt.$$.fragment,n),Ki=p(n),Pn=r(n,"P",{});var wr=c(Pn);vp=i(wr,"Ch\xFAng ta ch\u01B0a bao g\u1ED3m d\xF2ng "),Ps=r(wr,"CODE",{});var Gg=c(Ps);kp=i(Gg,"trainer.train()"),Gg.forEach(t),yp=i(wr,", \u0111\u1EC3 d\xE0nh th\u1EDDi gian ki\u1EC3m tra xem m\u1ECDi th\u1EE9 c\xF3 \u1ED5n kh\xF4ng. N\u1EBFu ch\xFAng ta y\xEAu c\u1EA7u m\u1ED9t l\xF4 v\xE0 chuy\u1EC3n n\xF3 v\xE0o m\xF4 h\xECnh c\u1EE7a m\xECnh, n\xF3 hi\u1EC7n ho\u1EA1t \u0111\u1ED9ng m\xE0 kh\xF4ng c\xF3 l\u1ED7i!"),wr.forEach(t),Wi=p(n),m(Yt.$$.fragment,n),Ri=p(n),na=r(n,"P",{});var Hg=c(na);_p=i(Hg,"B\u01B0\u1EDBc ti\u1EBFp theo l\xE0 quay l\u1EA1i GPU v\xE0 ki\u1EC3m tra xem m\u1ECDi th\u1EE9 v\u1EABn ho\u1EA1t \u0111\u1ED9ng kh\xF4ng:"),Hg.forEach(t),Yi=p(n),m(Xt.$$.fragment,n),Xi=p(n),ta=r(n,"P",{});var Ig=c(ta);$p=i(Ig,"N\u1EBFu b\u1EA1n v\u1EABn g\u1EB7p l\u1ED7i, h\xE3y \u0111\u1EA3m b\u1EA3o r\u1EB1ng b\u1EA1n kh\u1EDFi \u0111\u1ED9ng l\u1EA1i notebook c\u1EE7a m\xECnh v\xE0 ch\u1EC9 th\u1EF1c thi phi\xEAn b\u1EA3n cu\u1ED1i c\xF9ng c\u1EE7a t\u1EADp l\u1EC7nh."),Ig.forEach(t),Ji=p(n),rn=r(n,"H3",{class:!0});var jr=c(rn);An=r(jr,"A",{id:!0,class:!0,href:!0});var Fg=c(An);As=r(Fg,"SPAN",{});var Kg=c(As);m(Jt.$$.fragment,Kg),Kg.forEach(t),Fg.forEach(t),wp=p(jr),Ds=r(jr,"SPAN",{});var Wg=c(Ds);jp=i(Wg,"Th\u1EF1c hi\u1EC7n m\u1ED9t b\u01B0\u1EDBc t\u1ED1i \u01B0u h\xF3a"),Wg.forEach(t),jr.forEach(t),Qi=p(n),ea=r(n,"P",{});var Rg=c(ea);Ep=i(Rg,"B\xE2y gi\u1EDD ta bi\u1EBFt r\u1EB1ng ch\xFAng ta c\xF3 th\u1EC3 x\xE2y d\u1EF1ng c\xE1c l\xF4 th\u1EF1c s\u1EF1 \u0111i qua m\xF4 h\xECnh, ch\xFAng ta \u0111\xE3 s\u1EB5n s\xE0ng cho b\u01B0\u1EDBc ti\u1EBFp theo c\u1EE7a quy tr\xECnh hu\u1EA5n luy\u1EC7n: t\xEDnh to\xE1n \u0111\u1ED9 d\u1ED1c v\xE0 th\u1EF1c hi\u1EC7n b\u01B0\u1EDBc t\u1ED1i \u01B0u h\xF3a."),Rg.forEach(t),Zi=p(n),Dn=r(n,"P",{});var Er=c(Dn);qp=i(Er,"Ph\u1EA7n \u0111\u1EA7u ti\xEAn ch\u1EC9 l\xE0 v\u1EA5n \u0111\u1EC1 g\u1ECDi ph\u01B0\u01A1ng th\u1EE9c "),zs=r(Er,"CODE",{});var Yg=c(zs);xp=i(Yg,"backward()"),Yg.forEach(t),Cp=i(Er," khi t\xEDnh m\u1EA5t m\xE1t:"),Er.forEach(t),nl=p(n),m(Qt.$$.fragment,n),tl=p(n),aa=r(n,"P",{});var Xg=c(aa);Tp=i(Xg,"R\u1EA5t hi\u1EBFm khi g\u1EB7p l\u1ED7i \u1EDF giai \u0111o\u1EA1n n\xE0y, nh\u01B0ng n\u1EBFu b\u1EA1n g\u1EB7p l\u1ED7i, h\xE3y \u0111\u1EA3m b\u1EA3o quay l\u1EA1i CPU \u0111\u1EC3 nh\u1EADn \u0111\u01B0\u1EE3c th\xF4ng b\xE1o l\u1ED7i h\u1EEFu \xEDch."),Xg.forEach(t),el=p(n),J=r(n,"P",{});var za=c(J);Pp=i(za,"To perform the optimization step, we just need to create the "),Ns=r(za,"CODE",{});var Jg=c(Ns);Ap=i(Jg,"optimizer"),Jg.forEach(t),Dp=i(za," and call its "),Ss=r(za,"CODE",{});var Qg=c(Ss);zp=i(Qg,"step()"),Qg.forEach(t),Np=i(za," method:"),za.forEach(t),al=p(n),m(Zt.$$.fragment,n),sl=p(n),zn=r(n,"P",{});var qr=c(zn);Sp=i(qr,"M\u1ED9t l\u1EA7n n\u1EEFa, n\u1EBFu b\u1EA1n \u0111ang s\u1EED d\u1EE5ng tr\xECnh t\u1ED1i \u01B0u h\xF3a m\u1EB7c \u0111\u1ECBnh trong "),Os=r(qr,"CODE",{});var Zg=c(Os);Op=i(Zg,"Trainer"),Zg.forEach(t),Up=i(qr,", b\u1EA1n s\u1EBD kh\xF4ng g\u1EB7p l\u1ED7i \u1EDF giai \u0111o\u1EA1n n\xE0y, nh\u01B0ng n\u1EBFu b\u1EA1n c\xF3 tr\xECnh t\u1ED1i \u01B0u h\xF3a t\xF9y ch\u1EC9nh, c\xF3 th\u1EC3 c\xF3 m\u1ED9t s\u1ED1 v\u1EA5n \u0111\u1EC1 c\u1EA7n g\u1EE1 l\u1ED7i \u1EDF \u0111\xE2y. \u0110\u1EEBng qu\xEAn quay l\u1EA1i CPU n\u1EBFu b\u1EA1n g\u1EB7p l\u1ED7i CUDA l\u1EA1 \u1EDF giai \u0111o\u1EA1n n\xE0y. N\xF3i v\u1EC1 l\u1ED7i CUDA, tr\u01B0\u1EDBc \u0111\xF3 ch\xFAng ta \u0111\xE3 \u0111\u1EC1 c\u1EADp \u0111\u1EBFn m\u1ED9t tr\u01B0\u1EDDng h\u1EE3p \u0111\u1EB7c bi\u1EC7t. B\xE2y gi\u1EDD ch\xFAng ta h\xE3y xem x\xE9t \u0111i\u1EC1u \u0111\xF3."),qr.forEach(t),hl=p(n),cn=r(n,"H3",{class:!0});var xr=c(cn);Nn=r(xr,"A",{id:!0,class:!0,href:!0});var nd=c(Nn);Us=r(nd,"SPAN",{});var td=c(Us);m(ne.$$.fragment,td),td.forEach(t),nd.forEach(t),Vp=p(xr),Vs=r(xr,"SPAN",{});var ed=c(Vs);Bp=i(ed,"X\u1EED l\xFD l\u1ED7i h\u1EBFt b\u1ED9 nh\u1EDB CUDA"),ed.forEach(t),xr.forEach(t),il=p(n),Sn=r(n,"P",{});var Cr=c(Sn);Mp=i(Cr,"B\u1EA5t c\u1EE9 khi n\xE0o b\u1EA1n nh\u1EADn \u0111\u01B0\u1EE3c th\xF4ng b\xE1o l\u1ED7i b\u1EAFt \u0111\u1EA7u b\u1EB1ng "),Bs=r(Cr,"CODE",{});var ad=c(Bs);Lp=i(ad,"RuntimeError: CUDA out of memory"),ad.forEach(t),Gp=i(Cr,", \u0111i\u1EC1u n\xE0y cho bi\u1EBFt b\u1EA1n \u0111\xE3 h\u1EBFt b\u1ED9 nh\u1EDB GPU. \u0110i\u1EC1u n\xE0y kh\xF4ng \u0111\u01B0\u1EE3c li\xEAn k\u1EBFt tr\u1EF1c ti\u1EBFp v\u1EDBi m\xE3 c\u1EE7a b\u1EA1n v\xE0 n\xF3 c\xF3 th\u1EC3 x\u1EA3y ra v\u1EDBi m\u1ED9t t\u1EADp l\u1EC7nh ch\u1EA1y ho\xE0n to\xE0n t\u1ED1t. L\u1ED7i n\xE0y c\xF3 ngh\u0129a l\xE0 b\u1EA1n \u0111\xE3 c\u1ED1 g\u1EAFng \u0111\u01B0a qu\xE1 nhi\u1EC1u th\u1EE9 v\xE0o b\u1ED9 nh\u1EDB trong c\u1EE7a GPU v\xE0 d\u1EABn \u0111\u1EBFn l\u1ED7i. Gi\u1ED1ng nh\u01B0 v\u1EDBi c\xE1c l\u1ED7i CUDA kh\xE1c, b\u1EA1n s\u1EBD c\u1EA7n kh\u1EDFi \u0111\u1ED9ng l\u1EA1i kernel c\u1EE7a m\xECnh \u0111\u1EC3 \u1EDF v\u1ECB tr\xED m\xE0 b\u1EA1n c\xF3 th\u1EC3 ch\u1EA1y l\u1EA1i qu\xE1 tr\xECnh hu\u1EA5n luy\u1EC7n c\u1EE7a m\xECnh."),Cr.forEach(t),ll=p(n),sa=r(n,"P",{});var sd=c(sa);Hp=i(sd,"\u0110\u1EC3 gi\u1EA3i quy\u1EBFt v\u1EA5n \u0111\u1EC1 n\xE0y, b\u1EA1n ch\u1EC9 c\u1EA7n s\u1EED d\u1EE5ng \xEDt dung l\u01B0\u1EE3ng GPU h\u01A1n - \u0111i\u1EC1u m\xE0 n\xF3i th\xEC d\u1EC5 h\u01A1n l\xE0m. Tr\u01B0\u1EDBc ti\xEAn, h\xE3y \u0111\u1EA3m b\u1EA3o r\u1EB1ng b\u1EA1n kh\xF4ng c\xF3 hai m\xF4 h\xECnh GPU tr\xEAn c\xF9ng m\u1ED9t l\xFAc (t\u1EA5t nhi\xEAn l\xE0 tr\u1EEB khi \u0111\xF3 l\xE0 y\xEAu c\u1EA7u cho v\u1EA5n \u0111\u1EC1 c\u1EE7a b\u1EA1n). Sau \u0111\xF3, b\u1EA1n c\xF3 th\u1EC3 n\xEAn gi\u1EA3m k\xEDch th\u01B0\u1EDBc l\xF4 c\u1EE7a m\xECnh, v\xEC n\xF3 \u1EA3nh h\u01B0\u1EDFng tr\u1EF1c ti\u1EBFp \u0111\u1EBFn k\xEDch th\u01B0\u1EDBc c\u1EE7a t\u1EA5t c\u1EA3 c\xE1c \u0111\u1EA7u ra trung gian c\u1EE7a m\xF4 h\xECnh v\xE0 \u0111\u1ED9 d\u1ED1c c\u1EE7a ch\xFAng. N\u1EBFu s\u1EF1 c\u1ED1 v\u1EABn ti\u1EBFp di\u1EC5n, h\xE3y xem x\xE9t s\u1EED d\u1EE5ng phi\xEAn b\u1EA3n m\xF4 h\xECnh nh\u1ECF h\u01A1n c\u1EE7a b\u1EA1n."),sd.forEach(t),rl=p(n),m(On.$$.fragment,n),cl=p(n),on=r(n,"H3",{class:!0});var Tr=c(on);Un=r(Tr,"A",{id:!0,class:!0,href:!0});var hd=c(Un);Ms=r(hd,"SPAN",{});var id=c(Ms);m(te.$$.fragment,id),id.forEach(t),hd.forEach(t),Ip=p(Tr),Ls=r(Tr,"SPAN",{});var ld=c(Ls);Fp=i(ld,"\u0110\xE1nh gi\xE1 m\xF4 h\xECnh"),ld.forEach(t),Tr.forEach(t),ol=p(n),Vn=r(n,"P",{});var Pr=c(Vn);Kp=i(Pr,"B\xE2y gi\u1EDD ch\xFAng t\xF4i \u0111\xE3 gi\u1EA3i quy\u1EBFt t\u1EA5t c\u1EA3 c\xE1c v\u1EA5n \u0111\u1EC1 v\u1EDBi m\xE3 c\u1EE7a m\xECnh, m\u1ECDi th\u1EE9 \u0111\u1EC1u ho\xE0n h\u1EA3o v\xE0 qu\xE1 tr\xECnh hu\u1EA5n luy\u1EC7n s\u1EBD di\u1EC5n ra su\xF4n s\u1EBB, ph\u1EA3i kh\xF4ng? Kh\xF4ng qu\xE1 nhanh! N\u1EBFu b\u1EA1n ch\u1EA1y l\u1EC7nh "),Gs=r(Pr,"CODE",{});var rd=c(Gs);Wp=i(rd,"trainer.train()"),rd.forEach(t),Rp=i(Pr,", l\xFAc \u0111\u1EA7u m\u1ECDi th\u1EE9 s\u1EBD \u1ED5n, nh\u01B0ng sau m\u1ED9t th\u1EDDi gian, b\u1EA1n s\u1EBD nh\u1EADn \u0111\u01B0\u1EE3c nh\u1EEFng \u0111i\u1EC1u sau:"),Pr.forEach(t),pl=p(n),m(ee.$$.fragment,n),ul=p(n),m(ae.$$.fragment,n),ml=p(n),ha=r(n,"P",{});var cd=c(ha);Yp=i(cd,"B\u1EA1n s\u1EBD nh\u1EADn ra l\u1ED7i n\xE0y xu\u1EA5t hi\u1EC7n trong giai \u0111o\u1EA1n ki\u1EC3m \u0111\u1ECBnh, v\xEC v\u1EADy \u0111\xE2y l\xE0 \u0111i\u1EC1u cu\u1ED1i c\xF9ng ch\xFAng t\xF4i s\u1EBD c\u1EA7n g\u1EE1 l\u1ED7i."),cd.forEach(t),gl=p(n),Bn=r(n,"P",{});var Ar=c(Bn);Xp=i(Ar,"B\u1EA1n c\xF3 th\u1EC3 ch\u1EA1y v\xF2ng l\u1EB7p ki\u1EC3m \u0111\u1ECBnh c\u1EE7a "),Hs=r(Ar,"CODE",{});var od=c(Hs);Jp=i(od,"Trainer"),od.forEach(t),Qp=i(Ar," m\u1ED9t c\xE1ch \u0111\u1ED9c l\u1EADp \u0111\u1EC3 h\xECnh th\xE0nh kh\xF3a hu\u1EA5n luy\u1EC7n nh\u01B0 sau:"),Ar.forEach(t),dl=p(n),m(se.$$.fragment,n),fl=p(n),m(he.$$.fragment,n),bl=p(n),m(Mn.$$.fragment,n),vl=p(n),ia=r(n,"P",{});var pd=c(ia);Zp=i(pd,"Tr\u01B0\u1EDBc khi c\u1ED1 g\u1EAFng g\u1EE1 l\u1ED7i m\u1ED9t v\u1EA5n \u0111\u1EC1 trong v\xF2ng ki\u1EC3m \u0111\u1ECBnh, tr\u01B0\u1EDBc ti\xEAn b\u1EA1n n\xEAn \u0111\u1EA3m b\u1EA3o r\u1EB1ng b\u1EA1n \u0111\xE3 xem x\xE9t d\u1EEF li\u1EC7u, c\xF3 th\u1EC3 t\u1EA1o m\u1ED9t l\xF4 \u0111\xFAng c\xE1ch v\xE0 c\xF3 th\u1EC3 ch\u1EA1y m\xF4 h\xECnh c\u1EE7a b\u1EA1n tr\xEAn \u0111\xF3. Ch\xFAng ta \u0111\xE3 ho\xE0n th\xE0nh t\u1EA5t c\u1EA3 c\xE1c b\u01B0\u1EDBc \u0111\xF3, v\xEC v\u1EADy m\xE3 sau c\xF3 th\u1EC3 \u0111\u01B0\u1EE3c th\u1EF1c thi m\xE0 kh\xF4ng c\xF3 l\u1ED7i:"),pd.forEach(t),kl=p(n),m(ie.$$.fragment,n),yl=p(n),la=r(n,"P",{});var ud=c(la);nu=i(ud,"L\u1ED7i xu\u1EA5t hi\u1EC7n sau \u0111\xF3, v\xE0o cu\u1ED1i giai \u0111o\u1EA1n \u0111\xE1nh gi\xE1 v\xE0 n\u1EBFu ch\xFAng ta xem l\u1EA1i b\u1EA3n ghi l\u1EA1i, ch\xFAng ta th\u1EA5y \u0111i\u1EC1u n\xE0y:"),ud.forEach(t),_l=p(n),m(le.$$.fragment,n),$l=p(n),Q=r(n,"P",{});var Na=c(Q);tu=i(Na,"\u0110i\u1EC1u n\xE0y cho ch\xFAng t\xF4i bi\u1EBFt r\u1EB1ng l\u1ED7i b\u1EAFt ngu\u1ED3n t\u1EEB m\xF4-\u0111un "),Is=r(Na,"CODE",{});var md=c(Is);eu=i(md,"datasets/metric.py"),md.forEach(t),au=i(Na," - v\xEC v\u1EADy \u0111\xE2y l\xE0 s\u1EF1 c\u1ED1 v\u1EDBi h\xE0m "),Fs=r(Na,"CODE",{});var gd=c(Fs);su=i(gd,"compute_metrics()"),gd.forEach(t),hu=i(Na," c\u1EE7a m\xECnh. N\xF3 c\u1EA7n m\u1ED9t b\u1ED9 d\u1EEF li\u1EC7u v\u1EDBi c\xE1c logits v\xE0 c\xE1c nh\xE3n d\u01B0\u1EDBi d\u1EA1ng m\u1EA3ng NumPy, v\xEC v\u1EADy ch\xFAng ta h\xE3y th\u1EED cung c\u1EA5p cho n\xF3 r\u1EB1ng:"),Na.forEach(t),wl=p(n),m(re.$$.fragment,n),jl=p(n),m(ce.$$.fragment,n),El=p(n),L=r(n,"P",{});var at=c(L);iu=i(at,"Ch\xFAng ta nh\u1EADn \u0111\u01B0\u1EE3c c\xF9ng m\u1ED9t l\u1ED7i, v\xEC v\u1EADy v\u1EA5n \u0111\u1EC1 ch\u1EAFc ch\u1EAFn n\u1EB1m \u1EDF h\xE0m \u0111\xF3. N\u1EBFu ch\xFAng ta nh\xECn l\u1EA1i m\xE3 c\u1EE7a n\xF3, ch\xFAng ta th\u1EA5y n\xF3 ch\u1EC9 chuy\u1EC3n ti\u1EBFp c\xE1c  "),Ks=r(at,"CODE",{});var dd=c(Ks);lu=i(dd,"predictions"),dd.forEach(t),ru=i(at," v\xE0 "),Ws=r(at,"CODE",{});var fd=c(Ws);cu=i(fd,"labels"),fd.forEach(t),ou=i(at,"  \u0111\u1EBFn "),Rs=r(at,"CODE",{});var bd=c(Rs);pu=i(bd,"metric.compute()"),bd.forEach(t),uu=i(at,". V\u1EADy c\xF3 v\u1EA5n \u0111\u1EC1 g\xEC v\u1EDBi ph\u01B0\u01A1ng ph\xE1p \u0111\xF3 kh\xF4ng? Kh\xF4ng h\u1EB3n v\u1EADy. Ch\xFAng ta h\xE3y xem nhanh c\xE1c h\xECnh d\u1EA1ng:"),at.forEach(t),ql=p(n),m(oe.$$.fragment,n),xl=p(n),m(pe.$$.fragment,n),Cl=p(n),Ln=r(n,"P",{});var Dr=c(Ln);mu=i(Dr,"C\xE1c d\u1EF1 \u0111o\xE1n c\u1EE7a ch\xFAng t\xF4i v\u1EABn l\xE0 logit, kh\xF4ng ph\u1EA3i d\u1EF1 \u0111o\xE1n th\u1EF1c t\u1EBF, \u0111\xF3 l\xE0 l\xFD do t\u1EA1i sao s\u1ED1 li\u1EC7u tr\u1EA3 v\u1EC1 l\u1ED7i (h\u01A1i t\u1ED1i ngh\u0129a) n\xE0y. Vi\u1EC7c s\u1EEDa ch\u1EEFa kh\xE1 d\u1EC5 d\xE0ng; ch\xFAng ta ch\u1EC9 c\u1EA7n th\xEAm m\u1ED9t argmax trong h\xE0m "),Ys=r(Dr,"CODE",{});var vd=c(Ys);gu=i(vd,"compute_metrics()"),vd.forEach(t),du=i(Dr,":"),Dr.forEach(t),Tl=p(n),m(ue.$$.fragment,n),Pl=p(n),m(me.$$.fragment,n),Al=p(n),ra=r(n,"P",{});var kd=c(ra);fu=i(kd,"B\xE2y gi\u1EDD l\u1ED7i c\u1EE7a ch\xFAng ta \u0111\xE3 \u0111\u01B0\u1EE3c s\u1EEDa ch\u1EEFa! \u0110\xE2y l\xE0 l\u1EA7n cu\u1ED1i c\xF9ng, v\xEC v\u1EADy k\u1ECBch b\u1EA3n c\u1EE7a ch\xFAng ta b\xE2y gi\u1EDD s\u1EBD \u0111\xE0o t\u1EA1o m\u1ED9t m\xF4 h\xECnh \u0111\xFAng c\xE1ch."),kd.forEach(t),Dl=p(n),ca=r(n,"P",{});var yd=c(ca);bu=i(yd,"\u0110\u1EC3 tham kh\u1EA3o, \u0111\xE2y l\xE0 t\u1EADp l\u1EC7nh ho\xE0n to\xE0n c\u1ED1 \u0111\u1ECBnh:"),yd.forEach(t),zl=p(n),m(ge.$$.fragment,n),Nl=p(n),oa=r(n,"P",{});var _d=c(oa);vu=i(_d,"Trong tr\u01B0\u1EDDng h\u1EE3p n\xE0y, kh\xF4ng c\xF2n v\u1EA5n \u0111\u1EC1 g\xEC n\u1EEFa v\xE0 t\u1EADp l\u1EC7nh c\u1EE7a ch\xFAng ta s\u1EBD tinh ch\u1EC9nh m\u1ED9t m\xF4 h\xECnh s\u1EBD cho k\u1EBFt qu\u1EA3 h\u1EE3p l\xFD. Nh\u01B0ng ch\xFAng ta c\xF3 th\u1EC3 l\xE0m g\xEC khi qu\xE1 tr\xECnh hu\u1EA5n luy\u1EC7n di\u1EC5n ra m\xE0 kh\xF4ng c\xF3 b\u1EA5t k\u1EF3 l\u1ED7i n\xE0o, v\xE0 m\xF4 h\xECnh \u0111\u01B0\u1EE3c hu\u1EA5n luy\u1EC7n kh\xF4ng ho\u1EA1t \u0111\u1ED9ng t\u1ED1t ch\xFAt n\xE0o? \u0110\xF3 l\xE0 ph\u1EA7n kh\xF3 nh\u1EA5t c\u1EE7a h\u1ECDc m\xE1y v\xE0 ch\xFAng ta s\u1EBD ch\u1EC9 cho b\u1EA1n m\u1ED9t v\xE0i k\u1EF9 thu\u1EADt c\xF3 th\u1EC3 h\u1EEFu \xEDch."),_d.forEach(t),Sl=p(n),m(Gn.$$.fragment,n),Ol=p(n),pn=r(n,"H2",{class:!0});var zr=c(pn);Hn=r(zr,"A",{id:!0,class:!0,href:!0});var $d=c(Hn);Xs=r($d,"SPAN",{});var wd=c(Xs);m(de.$$.fragment,wd),wd.forEach(t),$d.forEach(t),ku=p(zr),Js=r(zr,"SPAN",{});var jd=c(Js);yu=i(jd,"Debugging silent errors during training"),jd.forEach(t),zr.forEach(t),Ul=p(n),pa=r(n,"P",{});var Ed=c(pa);_u=i(Ed,"What can we do to debug a training that completes without error but doesn\u2019t get good results? We\u2019ll give you some pointers here, but be aware that this kind of debugging is the hardest part of machine learning, and there is no magical answer."),Ed.forEach(t),Vl=p(n),un=r(n,"H3",{class:!0});var Nr=c(un);In=r(Nr,"A",{id:!0,class:!0,href:!0});var qd=c(In);Qs=r(qd,"SPAN",{});var xd=c(Qs);m(fe.$$.fragment,xd),xd.forEach(t),qd.forEach(t),$u=p(Nr),Zs=r(Nr,"SPAN",{});var Cd=c(Zs);wu=i(Cd,"Ki\u1EC3m tra l\u1EA1i d\u1EEF li\u1EC7u c\u1EE7a b\u1EA1n (m\u1ED9t l\u1EA7n n\u1EEFa!)"),Cd.forEach(t),Nr.forEach(t),Bl=p(n),ua=r(n,"P",{});var Td=c(ua);ju=i(Td,"M\xF4 h\xECnh c\u1EE7a b\u1EA1n s\u1EBD ch\u1EC9 h\u1ECDc \u0111\u01B0\u1EE3c \u0111i\u1EC1u g\xEC \u0111\xF3 n\u1EBFu n\xF3 th\u1EF1c s\u1EF1 c\xF3 th\u1EC3 h\u1ECDc \u0111\u01B0\u1EE3c b\u1EA5t c\u1EE9 \u0111i\u1EC1u g\xEC t\u1EEB d\u1EEF li\u1EC7u c\u1EE7a b\u1EA1n. N\u1EBFu c\xF3 l\u1ED7i l\xE0m h\u1ECFng d\u1EEF li\u1EC7u ho\u1EB7c c\xE1c nh\xE3n \u0111\u01B0\u1EE3c g\xE1n ng\u1EABu nhi\xEAn, r\u1EA5t c\xF3 th\u1EC3 b\u1EA1n s\u1EBD kh\xF4ng hu\u1EA5n luy\u1EC7n \u0111\u01B0\u1EE3c m\xF4 h\xECnh n\xE0o v\u1EC1 t\u1EADp d\u1EEF li\u1EC7u c\u1EE7a m\xECnh. V\xEC v\u1EADy, h\xE3y lu\xF4n b\u1EAFt \u0111\u1EA7u b\u1EB1ng c\xE1ch ki\u1EC3m tra k\u1EF9 c\xE1c \u0111\u1EA7u v\xE0o v\xE0 nh\xE3n \u0111\xE3 \u0111\u01B0\u1EE3c gi\u1EA3i m\xE3 c\u1EE7a b\u1EA1n v\xE0 t\u1EF1 h\u1ECFi b\u1EA3n th\xE2n nh\u1EEFng c\xE2u h\u1ECFi sau:"),Td.forEach(t),Ml=p(n),G=r(n,"UL",{});var st=c(G);nh=r(st,"LI",{});var Pd=c(nh);Eu=i(Pd,"D\u1EEF li\u1EC7u \u0111\u01B0\u1EE3c gi\u1EA3i m\xE3 c\xF3 d\u1EC5 hi\u1EC3u kh\xF4ng?"),Pd.forEach(t),qu=p(st),th=r(st,"LI",{});var Ad=c(th);xu=i(Ad,"B\u1EA1n c\xF3 \u0111\u1ED3ng \xFD v\u1EDBi c\xE1c nh\xE3n?"),Ad.forEach(t),Cu=p(st),eh=r(st,"LI",{});var Dd=c(eh);Tu=i(Dd,"C\xF3 m\u1ED9t nh\xE3n n\xE0o ph\u1ED5 bi\u1EBFn h\u01A1n nh\u1EEFng nh\xE3n kh\xE1c kh\xF4ng?"),Dd.forEach(t),Pu=p(st),ah=r(st,"LI",{});var zd=c(ah);Au=i(zd,"M\u1EA5t m\xE1t/Ch\u1EC9 s\u1ED1 s\u1EBD l\xE0 bao nhi\xEAu n\u1EBFu m\xF4 h\xECnh d\u1EF1 \u0111o\xE1n m\u1ED9t c\xE2u tr\u1EA3 l\u1EDDi ng\u1EABu nhi\xEAn/lu\xF4n l\xE0 m\u1ED9t c\xE2u tr\u1EA3 l\u1EDDi gi\u1ED1ng nhau?"),zd.forEach(t),st.forEach(t),Ll=p(n),m(Fn.$$.fragment,n),Gl=p(n),ma=r(n,"P",{});var Nd=c(ma);Du=i(Nd,"Sau khi xem x\xE9t d\u1EEF li\u1EC7u c\u1EE7a b\u1EA1n, h\xE3y xem qua m\u1ED9t s\u1ED1 d\u1EF1 \u0111o\xE1n c\u1EE7a m\xF4 h\xECnh v\xE0 gi\u1EA3i m\xE3 ch\xFAng. N\u1EBFu m\xF4 h\xECnh lu\xF4n d\u1EF1 \u0111o\xE1n c\xF9ng m\u1ED9t \u0111i\u1EC1u, c\xF3 th\u1EC3 l\xE0 do t\u1EADp d\u1EEF li\u1EC7u c\u1EE7a b\u1EA1n thi\xEAn v\u1EC1 m\u1ED9t lo\u1EA1i (\u0111\u1ED1i v\u1EDBi c\xE1c v\u1EA5n \u0111\u1EC1 ph\xE2n lo\u1EA1i); c\xE1c k\u1EF9 thu\u1EADt nh\u01B0 l\u1EA5y m\u1EABu qu\xE1 m\u1EE9c c\xE1c l\u1EDBp hi\u1EBFm c\xF3 th\u1EC3 h\u1EEFu \xEDch."),Nd.forEach(t),Hl=p(n),ga=r(n,"P",{});var Sd=c(ga);zu=i(Sd,"N\u1EBFu m\u1EA5t m\xE1t/ch\u1EC9 s\u1ED1 \u0111\xE1nh gi\xE1 b\u1EA1n nh\u1EADn \u0111\u01B0\u1EE3c tr\xEAn m\xF4 h\xECnh ban \u0111\u1EA7u c\u1EE7a m\xECnh r\u1EA5t kh\xE1c v\u1EDBi c\xE1i b\u1EA1n mong \u0111\u1EE3i cho c\xE1c d\u1EF1 \u0111o\xE1n ng\u1EABu nhi\xEAn, h\xE3y ki\u1EC3m tra k\u1EF9 c\xE1ch t\xEDnh to\xE1n t\u1ED5n th\u1EA5t ho\u1EB7c s\u1ED1 li\u1EC7u c\u1EE7a b\u1EA1n, v\xEC c\xF3 th\u1EC3 c\xF3 m\u1ED9t l\u1ED7i \u1EDF \u0111\xF3. N\u1EBFu b\u1EA1n \u0111ang s\u1EED d\u1EE5ng m\u1ED9t s\u1ED1 m\u1EA5t m\xE1t m\xE0 b\u1EA1n th\xEAm v\xE0o cu\u1ED1i, h\xE3y \u0111\u1EA3m b\u1EA3o r\u1EB1ng ch\xFAng c\xF3 c\xF9ng quy m\xF4."),Sd.forEach(t),Il=p(n),da=r(n,"P",{});var Od=c(da);Nu=i(Od,"Khi b\u1EA1n ch\u1EAFc ch\u1EAFn d\u1EEF li\u1EC7u c\u1EE7a m\xECnh l\xE0 ho\xE0n h\u1EA3o, b\u1EA1n c\xF3 th\u1EC3 xem li\u1EC7u m\xF4 h\xECnh c\xF3 kh\u1EA3 n\u0103ng hu\u1EA5n luy\u1EC7n v\u1EC1 n\xF3 hay kh\xF4ng b\u1EB1ng m\u1ED9t b\xE0i ki\u1EC3m tra \u0111\u01A1n gi\u1EA3n."),Od.forEach(t),Fl=p(n),mn=r(n,"H3",{class:!0});var Sr=c(mn);Kn=r(Sr,"A",{id:!0,class:!0,href:!0});var Ud=c(Kn);sh=r(Ud,"SPAN",{});var Vd=c(sh);m(be.$$.fragment,Vd),Vd.forEach(t),Ud.forEach(t),Su=p(Sr),hh=r(Sr,"SPAN",{});var Bd=c(hh);Ou=i(Bd,"H\u1ECDc k\u0129 m\xF4 h\xECnh c\u1EE7a b\u1EA1n trong m\u1ED9t l\xF4"),Bd.forEach(t),Sr.forEach(t),Kl=p(n),fa=r(n,"P",{});var Md=c(fa);Uu=i(Md,"Vi\u1EC7c h\u1ECDc qu\xE1 nhi\u1EC1u th\u01B0\u1EDDng l\xE0 \u0111i\u1EC1u ch\xFAng ta c\u1ED1 g\u1EAFng tr\xE1nh khi hu\u1EA5n luy\u1EC7n, v\xEC n\xF3 c\xF3 ngh\u0129a l\xE0 m\xF4 h\xECnh kh\xF4ng h\u1ECDc c\xE1ch nh\u1EADn ra c\xE1c \u0111\u1EB7c \u0111i\u1EC3m chung ta mu\u1ED1n m\xE0 thay v\xE0o \u0111\xF3 ch\u1EC9 l\xE0 ghi nh\u1EDB c\xE1c m\u1EABu hu\u1EA5n luy\u1EC7n. Tuy nhi\xEAn, c\u1ED1 g\u1EAFng hu\u1EA5n luy\u1EC7n m\xF4 h\xECnh c\u1EE7a b\u1EA1n l\u1EB7p \u0111i l\u1EB7p l\u1EA1i l\xE0 m\u1ED9t b\xE0i ki\u1EC3m tra t\u1ED1t \u0111\u1EC3 ki\u1EC3m tra xem v\u1EA5n \u0111\u1EC1 nh\u01B0 b\u1EA1n \u0111\xE3 \u0111\u1ECBnh h\xECnh c\xF3 th\u1EC3 \u0111\u01B0\u1EE3c gi\u1EA3i quy\u1EBFt b\u1EB1ng m\xF4 h\xECnh m\xE0 b\u1EA1n \u0111ang c\u1ED1 g\u1EAFng hu\u1EA5n luy\u1EC7n hay kh\xF4ng. N\xF3 c\u0169ng s\u1EBD gi\xFAp b\u1EA1n xem li\u1EC7u t\u1ED1c \u0111\u1ED9 h\u1ECDc ban \u0111\u1EA7u c\u1EE7a b\u1EA1n c\xF3 qu\xE1 cao hay kh\xF4ng."),Md.forEach(t),Wl=p(n),Wn=r(n,"P",{});var Or=c(Wn);Vu=i(Or,"Th\u1EF1c hi\u1EC7n \u0111i\u1EC1u n\xE0y khi b\u1EA1n \u0111\xE3 x\xE1c \u0111\u1ECBnh \u0111\u01B0\u1EE3c "),ih=r(Or,"CODE",{});var Ld=c(ih);Bu=i(Ld,"Trainer"),Ld.forEach(t),Mu=i(Or," c\u1EE7a m\xECnh th\u1EF1c s\u1EF1 d\u1EC5 d\xE0ng; ch\u1EC9 c\u1EA7n l\u1EA5y m\u1ED9t lo\u1EA1t d\u1EEF li\u1EC7u hu\u1EA5n luy\u1EC7n, sau \u0111\xF3 ch\u1EA1y m\u1ED9t v\xF2ng hu\u1EA5n luy\u1EC7n th\u1EE7 c\xF4ng nh\u1ECF ch\u1EC9 s\u1EED d\u1EE5ng l\xF4 \u0111\xF3 cho m\u1ED9t c\xE1i g\xEC \u0111\xF3 gi\u1ED1ng nh\u01B0 20 b\u01B0\u1EDBc:"),Or.forEach(t),Rl=p(n),m(ve.$$.fragment,n),Yl=p(n),m(Rn.$$.fragment,n),Xl=p(n),Yn=r(n,"P",{});var Ur=c(Yn);Lu=i(Ur,"M\xF4 h\xECnh ph\u1EA3i c\xF3 k\u1EBFt qu\u1EA3 tr\u1EA3 v\u1EC1 g\u1EA7n nh\u01B0 ho\xE0n h\u1EA3o tr\xEAn c\xF9ng m\u1ED9t "),lh=r(Ur,"CODE",{});var Gd=c(lh);Gu=i(Gd,"l\xF4"),Gd.forEach(t),Hu=i(Ur,". H\xE3y t\xEDnh to\xE1n c\xE1c ch\u1EC9 s\u1ED1 tr\xEAn c\xE1c d\u1EF1 \u0111o\xE1n k\u1EBFt qu\u1EA3:"),Ur.forEach(t),Jl=p(n),m(ke.$$.fragment,n),Ql=p(n),m(ye.$$.fragment,n),Zl=p(n),ba=r(n,"P",{});var Hd=c(ba);Iu=i(Hd,"Ch\xEDnh x\xE1c 100%, \u0111\xE2y l\xE0 m\u1ED9t v\xED d\u1EE5 \u0111i\u1EC3n h\xECnh v\u1EC1 vi\u1EC7c overfitt(c\xF3 ngh\u0129a l\xE0 n\u1EBFu b\u1EA1n th\u1EED m\xF4 h\xECnh c\u1EE7a m\xECnh tr\xEAn b\u1EA5t k\u1EF3 c\xE2u n\xE0o kh\xE1c, r\u1EA5t c\xF3 th\u1EC3 n\xF3 s\u1EBD \u0111\u01B0a ra c\xE2u tr\u1EA3 l\u1EDDi sai)!"),Hd.forEach(t),nr=p(n),va=r(n,"P",{});var Id=c(va);Fu=i(Id,"N\u1EBFu b\u1EA1n kh\xF4ng qu\u1EA3n l\xFD \u0111\u1EC3 m\xF4 h\xECnh c\u1EE7a m\xECnh c\xF3 \u0111\u01B0\u1EE3c k\u1EBFt qu\u1EA3 ho\xE0n h\u1EA3o nh\u01B0 th\u1EBF n\xE0y, \u0111i\u1EC1u \u0111\xF3 c\xF3 ngh\u0129a l\xE0 c\xF3 \u0111i\u1EC1u g\xEC \u0111\xF3 kh\xF4ng \u1ED5n trong c\xE1ch b\u1EA1n \u0111\u1ECBnh khung v\u1EA5n \u0111\u1EC1 ho\u1EB7c d\u1EEF li\u1EC7u c\u1EE7a m\xECnh, v\xEC v\u1EADy b\u1EA1n n\xEAn kh\u1EAFc ph\u1EE5c \u0111i\u1EC1u \u0111\xF3. Ch\u1EC9 khi b\u1EA1n v\u01B0\u1EE3t qua \u0111\u01B0\u1EE3c b\xE0i ki\u1EC3m tra overfit, b\u1EA1n m\u1EDBi c\xF3 th\u1EC3 ch\u1EAFc ch\u1EAFn r\u1EB1ng m\xF4 h\xECnh c\u1EE7a m\xECnh th\u1EF1c s\u1EF1 c\xF3 th\u1EC3 h\u1ECDc \u0111\u01B0\u1EE3c \u0111i\u1EC1u g\xEC \u0111\xF3."),Id.forEach(t),tr=p(n),m(Xn.$$.fragment,n),er=p(n),gn=r(n,"H3",{class:!0});var Vr=c(gn);Jn=r(Vr,"A",{id:!0,class:!0,href:!0});var Fd=c(Jn);rh=r(Fd,"SPAN",{});var Kd=c(rh);m(_e.$$.fragment,Kd),Kd.forEach(t),Fd.forEach(t),Ku=p(Vr),ch=r(Vr,"SPAN",{});var Wd=c(ch);Wu=i(Wd,"Kh\xF4ng \u0111i\u1EC1u ch\u1EC9nh b\u1EA5t c\u1EE9 th\u1EE9 g\xEC cho \u0111\u1EBFn khi b\u1EA1n c\xF3 m\xF4 h\xECnh c\u01A1 s\u1EDF \u0111\u1EA7u ti\xEAn"),Wd.forEach(t),Vr.forEach(t),ar=p(n),Qn=r(n,"P",{});var Br=c(Qn);Ru=i(Br,"\u0110i\u1EC1u ch\u1EC9nh si\xEAu tham s\u1ED1 lu\xF4n \u0111\u01B0\u1EE3c nh\u1EA5n m\u1EA1nh l\xE0 ph\u1EA7n kh\xF3 nh\u1EA5t c\u1EE7a h\u1ECDc m\xE1y, nh\u01B0ng n\xF3 ch\u1EC9 l\xE0 b\u01B0\u1EDBc cu\u1ED1i c\xF9ng gi\xFAp b\u1EA1n hi\u1EC3u \u0111\u01B0\u1EE3c m\u1ED9t ch\xFAt v\u1EC1 ch\u1EC9 s\u1ED1 n\xE0y. H\u1EA7u h\u1EBFt th\u1EDDi gian, c\xE1c si\xEAu tham s\u1ED1 m\u1EB7c \u0111\u1ECBnh c\u1EE7a "),oh=r(Br,"CODE",{});var Rd=c(oh);Yu=i(Rd,"Trainer"),Rd.forEach(t),Xu=i(Br," s\u1EBD ho\u1EA1t \u0111\u1ED9ng t\u1ED1t \u0111\u1EC3 cung c\u1EA5p cho b\u1EA1n k\u1EBFt qu\u1EA3 t\u1ED1t, v\xEC v\u1EADy \u0111\u1EEBng kh\u1EDFi ch\u1EA1y t\xECm ki\u1EBFm si\xEAu tham s\u1ED1 t\u1ED1n th\u1EDDi gian v\xE0 t\u1ED1n k\xE9m cho \u0111\u1EBFn khi b\u1EA1n c\xF3 th\u1EE9 g\xEC \u0111\xF3 v\u01B0\u1EE3t qua m\xF4 h\xECnh c\u01A1 s\u1EDF m\xE0 b\u1EA1n c\xF3 tr\xEAn t\u1EADp d\u1EEF li\u1EC7u c\u1EE7a m\xECnh."),Br.forEach(t),sr=p(n),ka=r(n,"P",{});var Yd=c(ka);Ju=i(Yd,"Khi b\u1EA1n \u0111\xE3 c\xF3 m\u1ED9t m\xF4 h\xECnh \u0111\u1EE7 t\u1ED1t, b\u1EA1n c\xF3 th\u1EC3 b\u1EAFt \u0111\u1EA7u \u0111i\u1EC1u ch\u1EC9nh m\u1ED9t ch\xFAt. \u0110\u1EEBng th\u1EED kh\u1EDFi ch\u1EA1y m\u1ED9t ngh\xECn l\u1EA7n ch\u1EA1y v\u1EDBi c\xE1c si\xEAu tham s\u1ED1 kh\xE1c nhau, nh\u01B0ng h\xE3y so s\xE1nh m\u1ED9t v\xE0i l\u1EA7n ch\u1EA1y v\u1EDBi c\xE1c gi\xE1 tr\u1ECB kh\xE1c nhau cho m\u1ED9t si\xEAu th\xF4ng s\u1ED1 \u0111\u1EC3 c\xF3 \u0111\u01B0\u1EE3c \xFD t\u01B0\u1EDFng v\u1EC1 gi\xE1 tr\u1ECB n\xE0o c\xF3 t\xE1c \u0111\u1ED9ng l\u1EDBn nh\u1EA5t."),Yd.forEach(t),hr=p(n),ya=r(n,"P",{});var Xd=c(ya);Qu=i(Xd,"N\u1EBFu b\u1EA1n \u0111ang \u0111i\u1EC1u ch\u1EC9nh ch\xEDnh m\xF4 h\xECnh, h\xE3y gi\u1EEF n\xF3 \u0111\u01A1n gi\u1EA3n v\xE0 \u0111\u1EEBng th\u1EED b\u1EA5t c\u1EE9 \u0111i\u1EC1u g\xEC m\xE0 b\u1EA1n kh\xF4ng th\u1EC3 bi\u1EC7n minh m\u1ED9t c\xE1ch h\u1EE3p l\xFD. Lu\xF4n \u0111\u1EA3m b\u1EA3o r\u1EB1ng b\u1EA1n quay l\u1EA1i ki\u1EC3m tra overfit \u0111\u1EC3 x\xE1c minh r\u1EB1ng thay \u0111\u1ED5i c\u1EE7a b\u1EA1n kh\xF4ng g\xE2y ra b\u1EA5t k\u1EF3 h\u1EADu qu\u1EA3 ngo\xE0i \xFD mu\u1ED1n n\xE0o."),Xd.forEach(t),ir=p(n),dn=r(n,"H3",{class:!0});var Mr=c(dn);Zn=r(Mr,"A",{id:!0,class:!0,href:!0});var Jd=c(Zn);ph=r(Jd,"SPAN",{});var Qd=c(ph);m($e.$$.fragment,Qd),Qd.forEach(t),Jd.forEach(t),Zu=p(Mr),uh=r(Mr,"SPAN",{});var Zd=c(uh);nm=i(Zd,"Y\xEAu c\u1EA7u gi\xFAp \u0111\u1EE1"),Zd.forEach(t),Mr.forEach(t),lr=p(n),nt=r(n,"P",{});var Lr=c(nt);tm=i(Lr,"Hy v\u1ECDng r\u1EB1ng b\u1EA1n s\u1EBD t\xECm th\u1EA5y m\u1ED9t s\u1ED1 l\u1EDDi khuy\xEAn trong ph\u1EA7n n\xE0y \u0111\u1EC3 gi\xFAp b\u1EA1n gi\u1EA3i quy\u1EBFt v\u1EA5n \u0111\u1EC1 c\u1EE7a m\xECnh, nh\u01B0ng n\u1EBFu kh\xF4ng ph\u1EA3i v\u1EADy, h\xE3y nh\u1EDB r\u1EB1ng b\u1EA1n lu\xF4n c\xF3 th\u1EC3 h\u1ECFi c\u1ED9ng \u0111\u1ED3ng tr\xEAn "),we=r(Lr,"A",{href:!0,rel:!0});var nf=c(we);em=i(nf,"di\u1EC5n \u0111\xE0n"),nf.forEach(t),am=i(Lr,"."),Lr.forEach(t),rr=p(n),_a=r(n,"P",{});var tf=c(_a);sm=i(tf,"D\u01B0\u1EDBi \u0111\xE2y l\xE0 m\u1ED9t s\u1ED1 t\xE0i li\u1EC7u b\u1ED5 sung c\xF3 th\u1EC3 h\u1EEFu \xEDch:"),tf.forEach(t),cr=p(n),H=r(n,"UL",{});var ht=c(H);$a=r(ht,"LI",{});var bm=c($a);je=r(bm,"A",{href:!0,rel:!0});var ef=c(je);hm=i(ef,"\u201CReproducibility as a vehicle for engineering best practices\u201D"),ef.forEach(t),im=i(bm," b\u1EDFi Joel Grus"),bm.forEach(t),lm=p(ht),wa=r(ht,"LI",{});var vm=c(wa);Ee=r(vm,"A",{href:!0,rel:!0});var af=c(Ee);rm=i(af,"\u201CChecklist for debugging neural networks\u201D"),af.forEach(t),cm=i(vm," b\u1EDFi Cecelia Shao"),vm.forEach(t),om=p(ht),ja=r(ht,"LI",{});var km=c(ja);qe=r(km,"A",{href:!0,rel:!0});var sf=c(qe);pm=i(sf,"\u201CHow to unit test machine learning code\u201D"),sf.forEach(t),um=i(km," b\u1EDFi Chase Roberts"),km.forEach(t),mm=p(ht),Ea=r(ht,"LI",{});var ym=c(Ea);xe=r(ym,"A",{href:!0,rel:!0});var hf=c(xe);gm=i(hf,"\u201CA Recipe for Training Neural Networks\u201D"),hf.forEach(t),dm=i(ym," b\u1EDFi Andrej Karpathy"),ym.forEach(t),ht.forEach(t),or=p(n),qa=r(n,"P",{});var lf=c(qa);fm=i(lf,"T\u1EA5t nhi\xEAn, kh\xF4ng ph\u1EA3i m\u1ECDi v\u1EA5n \u0111\u1EC1 b\u1EA1n g\u1EB7p ph\u1EA3i khi hu\u1EA5n luy\u1EC7n m\u1EA1ng th\u1EA7n kinh \u0111\u1EC1u l\xE0 l\u1ED7i c\u1EE7a ch\xEDnh b\u1EA1n! N\u1EBFu b\u1EA1n g\u1EB7p \u0111i\u1EC1u g\xEC \u0111\xF3 trong th\u01B0 vi\u1EC7n \u{1F917} Transformers ho\u1EB7c \u{1F917} Datasets c\xF3 v\u1EBB kh\xF4ng \u1ED5n, c\xF3 th\u1EC3 b\u1EA1n \u0111\xE3 g\u1EB7p l\u1ED7i. B\u1EA1n ch\u1EAFc ch\u1EAFn n\xEAn cho ch\xFAng t\xF4i bi\u1EBFt t\u1EA5t c\u1EA3 v\u1EC1 \u0111i\u1EC1u \u0111\xF3 v\xE0 trong ph\u1EA7n ti\u1EBFp theo, ch\xFAng t\xF4i s\u1EBD gi\u1EA3i th\xEDch ch\xEDnh x\xE1c c\xE1ch th\u1EF1c hi\u1EC7n \u0111i\u1EC1u \u0111\xF3."),lf.forEach(t),this.h()},h(){k(v,"name","hf:doc:metadata"),k(v,"content",JSON.stringify(jf)),k(j,"id","g-li-quy-trnh-hun-luyn"),k(j,"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"),k(j,"href","#g-li-quy-trnh-hun-luyn"),k(q,"class","relative group"),k(De,"href","/course/chapter7"),k(bn,"id","g-li-quy-trnh-hun-luyn"),k(bn,"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"),k(bn,"href","#g-li-quy-trnh-hun-luyn"),k(an,"class","relative group"),k(ct,"href","https://huggingface.co/datasets/glue"),k(ct,"rel","nofollow"),k(yn,"id","kim-tra-d-liu-ca-bn"),k(yn,"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"),k(yn,"href","#kim-tra-d-liu-ca-bn"),k(sn,"class","relative group"),k(jt,"href","https://huggingface.co/transformers/model_doc/distilbert.html#distilbertforsequenceclassification"),k(jt,"rel","nofollow"),k(En,"id","t-b-d-liu-thnh-dataloader"),k(En,"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"),k(En,"href","#t-b-d-liu-thnh-dataloader"),k(hn,"class","relative group"),k(qn,"id","xem-qua-m-hnh"),k(qn,"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"),k(qn,"href","#xem-qua-m-hnh"),k(ln,"class","relative group"),k(An,"id","thc-hin-mt-bc-ti-u-ha"),k(An,"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"),k(An,"href","#thc-hin-mt-bc-ti-u-ha"),k(rn,"class","relative group"),k(Nn,"id","x-l-li-ht-b-nh-cuda"),k(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"),k(Nn,"href","#x-l-li-ht-b-nh-cuda"),k(cn,"class","relative group"),k(Un,"id","nh-gi-m-hnh"),k(Un,"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"),k(Un,"href","#nh-gi-m-hnh"),k(on,"class","relative group"),k(Hn,"id","debugging-silent-errors-during-training"),k(Hn,"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"),k(Hn,"href","#debugging-silent-errors-during-training"),k(pn,"class","relative group"),k(In,"id","kim-tra-li-d-liu-ca-bn-mt-ln-na"),k(In,"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"),k(In,"href","#kim-tra-li-d-liu-ca-bn-mt-ln-na"),k(un,"class","relative group"),k(Kn,"id","hc-k-m-hnh-ca-bn-trong-mt-l"),k(Kn,"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"),k(Kn,"href","#hc-k-m-hnh-ca-bn-trong-mt-l"),k(mn,"class","relative group"),k(Jn,"id","khng-iu-chnh-bt-c-th-g-cho-n-khi-bn-c-m-hnh-c-s-u-tin"),k(Jn,"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"),k(Jn,"href","#khng-iu-chnh-bt-c-th-g-cho-n-khi-bn-c-m-hnh-c-s-u-tin"),k(gn,"class","relative group"),k(Zn,"id","yu-cu-gip"),k(Zn,"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"),k(Zn,"href","#yu-cu-gip"),k(dn,"class","relative group"),k(we,"href","https://discuss.huggingface.co/"),k(we,"rel","nofollow"),k(je,"href","https://docs.google.com/presentation/d/1yHLPvPhUs2KGI5ZWo0sU-PKU3GimAk3iTsI38Z-B5Gw/edit#slide=id.p"),k(je,"rel","nofollow"),k(Ee,"href","https://towardsdatascience.com/checklist-for-debugging-neural-networks-d8b2a9434f21"),k(Ee,"rel","nofollow"),k(qe,"href","https://medium.com/@keeper6928/how-to-unit-test-machine-learning-code-57cf6fd81765"),k(qe,"rel","nofollow"),k(xe,"href","http://karpathy.github.io/2019/04/25/recipe/"),k(xe,"rel","nofollow")},m(n,a){e(document.head,v),s(n,w,a),g(_,n,a),s(n,$,a),s(n,q,a),e(q,j),e(j,E),g(x,E,null),e(q,A),e(q,C),e(C,I),s(n,O,a),g(T,n,a),s(n,it,a),s(n,U,a),e(U,Ae),e(U,De),e(De,Gr),e(U,Hr),e(U,Sa),e(Sa,Ir),e(U,Fr),s(n,vh,a),s(n,an,a),e(an,bn),e(bn,Oa),g(lt,Oa,null),e(an,Kr),e(an,Ua),e(Ua,Wr),s(n,kh,a),g(rt,n,a),s(n,yh,a),s(n,F,a),e(F,Rr),e(F,Va),e(Va,Yr),e(F,Xr),e(F,Ba),e(Ba,Jr),e(F,Qr),s(n,_h,a),s(n,vn,a),e(vn,Zr),e(vn,Ma),e(Ma,nc),e(vn,tc),s(n,$h,a),s(n,kn,a),e(kn,ec),e(kn,ct),e(ct,ac),e(kn,sc),s(n,wh,a),g(ot,n,a),s(n,jh,a),s(n,ze,a),e(ze,hc),s(n,Eh,a),g(pt,n,a),s(n,qh,a),s(n,sn,a),e(sn,yn),e(yn,La),g(ut,La,null),e(sn,ic),e(sn,Ga),e(Ga,lc),s(n,xh,a),s(n,_n,a),e(_n,rc),e(_n,Ha),e(Ha,cc),e(_n,oc),s(n,Ch,a),s(n,$n,a),e($n,pc),e($n,Ia),e(Ia,uc),e($n,mc),s(n,Th,a),g(mt,n,a),s(n,Ph,a),g(gt,n,a),s(n,Ah,a),s(n,K,a),e(K,gc),e(K,Fa),e(Fa,dc),e(K,fc),e(K,Ka),e(Ka,bc),e(K,vc),s(n,Dh,a),s(n,D,a),e(D,kc),e(D,Wa),e(Wa,yc),e(D,_c),e(D,Ra),e(Ra,$c),e(D,wc),e(D,Ya),e(Ya,jc),e(D,Ec),e(D,Xa),e(Xa,qc),e(D,xc),s(n,zh,a),g(dt,n,a),s(n,Nh,a),s(n,Ne,a),e(Ne,Cc),s(n,Sh,a),g(ft,n,a),s(n,Oh,a),s(n,Se,a),e(Se,Tc),s(n,Uh,a),g(bt,n,a),s(n,Vh,a),s(n,Oe,a),e(Oe,Pc),s(n,Bh,a),s(n,Ue,a),e(Ue,Ac),s(n,Mh,a),g(vt,n,a),s(n,Lh,a),g(kt,n,a),s(n,Gh,a),s(n,Ve,a),e(Ve,Dc),s(n,Hh,a),g(yt,n,a),s(n,Ih,a),g(_t,n,a),s(n,Fh,a),s(n,z,a),e(z,zc),e(z,Ja),e(Ja,Nc),e(z,Sc),e(z,Qa),e(Qa,Oc),e(z,Uc),e(z,Za),e(Za,Vc),e(z,Bc),e(z,ns),e(ns,Mc),e(z,Lc),s(n,Kh,a),g($t,n,a),s(n,Wh,a),g(wt,n,a),s(n,Rh,a),s(n,W,a),e(W,Gc),e(W,jt),e(jt,Hc),e(W,Ic),e(W,ts),e(ts,Fc),e(W,Kc),s(n,Yh,a),s(n,wn,a),e(wn,Wc),e(wn,es),e(es,Rc),e(wn,Yc),s(n,Xh,a),g(Et,n,a),s(n,Jh,a),g(qt,n,a),s(n,Qh,a),s(n,Be,a),e(Be,Xc),s(n,Zh,a),g(xt,n,a),s(n,ni,a),g(Ct,n,a),s(n,ti,a),s(n,Me,a),e(Me,Jc),s(n,ei,a),g(Tt,n,a),s(n,ai,a),g(Pt,n,a),s(n,si,a),s(n,R,a),e(R,Qc),e(R,as),e(as,Zc),e(R,no),e(R,ss),e(ss,to),e(R,eo),s(n,hi,a),g(At,n,a),s(n,ii,a),g(Dt,n,a),s(n,li,a),s(n,Y,a),e(Y,ao),e(Y,hs),e(hs,so),e(Y,ho),e(Y,is),e(is,io),e(Y,lo),s(n,ri,a),s(n,Le,a),e(Le,ro),s(n,ci,a),g(jn,n,a),s(n,oi,a),s(n,Ge,a),e(Ge,co),s(n,pi,a),s(n,He,a),e(He,oo),s(n,ui,a),s(n,hn,a),e(hn,En),e(En,ls),g(zt,ls,null),e(hn,po),e(hn,rs),e(rs,uo),s(n,mi,a),s(n,N,a),e(N,mo),e(N,cs),e(cs,go),e(N,fo),e(N,os),e(os,bo),e(N,vo),e(N,ps),e(ps,ko),e(N,yo),e(N,us),e(us,_o),e(N,$o),s(n,gi,a),g(Nt,n,a),s(n,di,a),s(n,Ie,a),e(Ie,wo),s(n,fi,a),g(St,n,a),s(n,bi,a),s(n,X,a),e(X,jo),e(X,ms),e(ms,Eo),e(X,qo),e(X,gs),e(gs,xo),e(X,Co),s(n,vi,a),g(Ot,n,a),s(n,ki,a),g(Ut,n,a),s(n,yi,a),s(n,B,a),e(B,To),e(B,ds),e(ds,Po),e(B,Ao),e(B,fs),e(fs,Do),e(B,zo),e(B,bs),e(bs,No),e(B,So),s(n,_i,a),s(n,M,a),e(M,Oo),e(M,vs),e(vs,Uo),e(M,Vo),e(M,ks),e(ks,Bo),e(M,Mo),e(M,ys),e(ys,Lo),e(M,Go),s(n,$i,a),g(Vt,n,a),s(n,wi,a),s(n,Fe,a),e(Fe,Ho),s(n,ji,a),g(Bt,n,a),s(n,Ei,a),s(n,Ke,a),e(Ke,Io),s(n,qi,a),s(n,We,a),e(We,Fo),s(n,xi,a),g(Mt,n,a),s(n,Ci,a),s(n,S,a),e(S,Ko),e(S,_s),e(_s,Wo),e(S,Ro),e(S,$s),e($s,Yo),e(S,Xo),e(S,ws),e(ws,Jo),e(S,Qo),e(S,js),e(js,Zo),e(S,np),s(n,Ti,a),g(Lt,n,a),s(n,Pi,a),s(n,Re,a),e(Re,tp),s(n,Ai,a),s(n,Ye,a),e(Ye,ep),s(n,Di,a),s(n,ln,a),e(ln,qn),e(qn,Es),g(Gt,Es,null),e(ln,ap),e(ln,qs),e(qs,sp),s(n,zi,a),s(n,Xe,a),e(Xe,hp),s(n,Ni,a),g(Ht,n,a),s(n,Si,a),s(n,xn,a),e(xn,ip),e(xn,xs),e(xs,lp),e(xn,rp),s(n,Oi,a),s(n,Je,a),e(Je,cp),s(n,Ui,a),s(n,Qe,a),e(Qe,op),s(n,Vi,a),s(n,Cn,a),e(Cn,pp),e(Cn,Cs),e(Cs,up),e(Cn,mp),s(n,Bi,a),g(It,n,a),s(n,Mi,a),g(Ft,n,a),s(n,Li,a),s(n,Tn,a),e(Tn,gp),e(Tn,Ts),e(Ts,dp),e(Tn,fp),s(n,Gi,a),g(Kt,n,a),s(n,Hi,a),g(Wt,n,a),s(n,Ii,a),s(n,Ze,a),e(Ze,bp),s(n,Fi,a),g(Rt,n,a),s(n,Ki,a),s(n,Pn,a),e(Pn,vp),e(Pn,Ps),e(Ps,kp),e(Pn,yp),s(n,Wi,a),g(Yt,n,a),s(n,Ri,a),s(n,na,a),e(na,_p),s(n,Yi,a),g(Xt,n,a),s(n,Xi,a),s(n,ta,a),e(ta,$p),s(n,Ji,a),s(n,rn,a),e(rn,An),e(An,As),g(Jt,As,null),e(rn,wp),e(rn,Ds),e(Ds,jp),s(n,Qi,a),s(n,ea,a),e(ea,Ep),s(n,Zi,a),s(n,Dn,a),e(Dn,qp),e(Dn,zs),e(zs,xp),e(Dn,Cp),s(n,nl,a),g(Qt,n,a),s(n,tl,a),s(n,aa,a),e(aa,Tp),s(n,el,a),s(n,J,a),e(J,Pp),e(J,Ns),e(Ns,Ap),e(J,Dp),e(J,Ss),e(Ss,zp),e(J,Np),s(n,al,a),g(Zt,n,a),s(n,sl,a),s(n,zn,a),e(zn,Sp),e(zn,Os),e(Os,Op),e(zn,Up),s(n,hl,a),s(n,cn,a),e(cn,Nn),e(Nn,Us),g(ne,Us,null),e(cn,Vp),e(cn,Vs),e(Vs,Bp),s(n,il,a),s(n,Sn,a),e(Sn,Mp),e(Sn,Bs),e(Bs,Lp),e(Sn,Gp),s(n,ll,a),s(n,sa,a),e(sa,Hp),s(n,rl,a),g(On,n,a),s(n,cl,a),s(n,on,a),e(on,Un),e(Un,Ms),g(te,Ms,null),e(on,Ip),e(on,Ls),e(Ls,Fp),s(n,ol,a),s(n,Vn,a),e(Vn,Kp),e(Vn,Gs),e(Gs,Wp),e(Vn,Rp),s(n,pl,a),g(ee,n,a),s(n,ul,a),g(ae,n,a),s(n,ml,a),s(n,ha,a),e(ha,Yp),s(n,gl,a),s(n,Bn,a),e(Bn,Xp),e(Bn,Hs),e(Hs,Jp),e(Bn,Qp),s(n,dl,a),g(se,n,a),s(n,fl,a),g(he,n,a),s(n,bl,a),g(Mn,n,a),s(n,vl,a),s(n,ia,a),e(ia,Zp),s(n,kl,a),g(ie,n,a),s(n,yl,a),s(n,la,a),e(la,nu),s(n,_l,a),g(le,n,a),s(n,$l,a),s(n,Q,a),e(Q,tu),e(Q,Is),e(Is,eu),e(Q,au),e(Q,Fs),e(Fs,su),e(Q,hu),s(n,wl,a),g(re,n,a),s(n,jl,a),g(ce,n,a),s(n,El,a),s(n,L,a),e(L,iu),e(L,Ks),e(Ks,lu),e(L,ru),e(L,Ws),e(Ws,cu),e(L,ou),e(L,Rs),e(Rs,pu),e(L,uu),s(n,ql,a),g(oe,n,a),s(n,xl,a),g(pe,n,a),s(n,Cl,a),s(n,Ln,a),e(Ln,mu),e(Ln,Ys),e(Ys,gu),e(Ln,du),s(n,Tl,a),g(ue,n,a),s(n,Pl,a),g(me,n,a),s(n,Al,a),s(n,ra,a),e(ra,fu),s(n,Dl,a),s(n,ca,a),e(ca,bu),s(n,zl,a),g(ge,n,a),s(n,Nl,a),s(n,oa,a),e(oa,vu),s(n,Sl,a),g(Gn,n,a),s(n,Ol,a),s(n,pn,a),e(pn,Hn),e(Hn,Xs),g(de,Xs,null),e(pn,ku),e(pn,Js),e(Js,yu),s(n,Ul,a),s(n,pa,a),e(pa,_u),s(n,Vl,a),s(n,un,a),e(un,In),e(In,Qs),g(fe,Qs,null),e(un,$u),e(un,Zs),e(Zs,wu),s(n,Bl,a),s(n,ua,a),e(ua,ju),s(n,Ml,a),s(n,G,a),e(G,nh),e(nh,Eu),e(G,qu),e(G,th),e(th,xu),e(G,Cu),e(G,eh),e(eh,Tu),e(G,Pu),e(G,ah),e(ah,Au),s(n,Ll,a),g(Fn,n,a),s(n,Gl,a),s(n,ma,a),e(ma,Du),s(n,Hl,a),s(n,ga,a),e(ga,zu),s(n,Il,a),s(n,da,a),e(da,Nu),s(n,Fl,a),s(n,mn,a),e(mn,Kn),e(Kn,sh),g(be,sh,null),e(mn,Su),e(mn,hh),e(hh,Ou),s(n,Kl,a),s(n,fa,a),e(fa,Uu),s(n,Wl,a),s(n,Wn,a),e(Wn,Vu),e(Wn,ih),e(ih,Bu),e(Wn,Mu),s(n,Rl,a),g(ve,n,a),s(n,Yl,a),g(Rn,n,a),s(n,Xl,a),s(n,Yn,a),e(Yn,Lu),e(Yn,lh),e(lh,Gu),e(Yn,Hu),s(n,Jl,a),g(ke,n,a),s(n,Ql,a),g(ye,n,a),s(n,Zl,a),s(n,ba,a),e(ba,Iu),s(n,nr,a),s(n,va,a),e(va,Fu),s(n,tr,a),g(Xn,n,a),s(n,er,a),s(n,gn,a),e(gn,Jn),e(Jn,rh),g(_e,rh,null),e(gn,Ku),e(gn,ch),e(ch,Wu),s(n,ar,a),s(n,Qn,a),e(Qn,Ru),e(Qn,oh),e(oh,Yu),e(Qn,Xu),s(n,sr,a),s(n,ka,a),e(ka,Ju),s(n,hr,a),s(n,ya,a),e(ya,Qu),s(n,ir,a),s(n,dn,a),e(dn,Zn),e(Zn,ph),g($e,ph,null),e(dn,Zu),e(dn,uh),e(uh,nm),s(n,lr,a),s(n,nt,a),e(nt,tm),e(nt,we),e(we,em),e(nt,am),s(n,rr,a),s(n,_a,a),e(_a,sm),s(n,cr,a),s(n,H,a),e(H,$a),e($a,je),e(je,hm),e($a,im),e(H,lm),e(H,wa),e(wa,Ee),e(Ee,rm),e(wa,cm),e(H,om),e(H,ja),e(ja,qe),e(qe,pm),e(ja,um),e(H,mm),e(H,Ea),e(Ea,xe),e(xe,gm),e(Ea,dm),s(n,or,a),s(n,qa,a),e(qa,fm),pr=!0},p(n,[a]){const Ce={};a&1&&(Ce.fw=n[0]),_.$set(Ce);const mh={};a&2&&(mh.$$scope={dirty:a,ctx:n}),jn.$set(mh);const gh={};a&2&&(gh.$$scope={dirty:a,ctx:n}),On.$set(gh);const dh={};a&2&&(dh.$$scope={dirty:a,ctx:n}),Mn.$set(dh);const fn={};a&2&&(fn.$$scope={dirty:a,ctx:n}),Gn.$set(fn);const fh={};a&2&&(fh.$$scope={dirty:a,ctx:n}),Fn.$set(fh);const bh={};a&2&&(bh.$$scope={dirty:a,ctx:n}),Rn.$set(bh);const Te={};a&2&&(Te.$$scope={dirty:a,ctx:n}),Xn.$set(Te)},i(n){pr||(d(_.$$.fragment,n),d(x.$$.fragment,n),d(T.$$.fragment,n),d(lt.$$.fragment,n),d(rt.$$.fragment,n),d(ot.$$.fragment,n),d(pt.$$.fragment,n),d(ut.$$.fragment,n),d(mt.$$.fragment,n),d(gt.$$.fragment,n),d(dt.$$.fragment,n),d(ft.$$.fragment,n),d(bt.$$.fragment,n),d(vt.$$.fragment,n),d(kt.$$.fragment,n),d(yt.$$.fragment,n),d(_t.$$.fragment,n),d($t.$$.fragment,n),d(wt.$$.fragment,n),d(Et.$$.fragment,n),d(qt.$$.fragment,n),d(xt.$$.fragment,n),d(Ct.$$.fragment,n),d(Tt.$$.fragment,n),d(Pt.$$.fragment,n),d(At.$$.fragment,n),d(Dt.$$.fragment,n),d(jn.$$.fragment,n),d(zt.$$.fragment,n),d(Nt.$$.fragment,n),d(St.$$.fragment,n),d(Ot.$$.fragment,n),d(Ut.$$.fragment,n),d(Vt.$$.fragment,n),d(Bt.$$.fragment,n),d(Mt.$$.fragment,n),d(Lt.$$.fragment,n),d(Gt.$$.fragment,n),d(Ht.$$.fragment,n),d(It.$$.fragment,n),d(Ft.$$.fragment,n),d(Kt.$$.fragment,n),d(Wt.$$.fragment,n),d(Rt.$$.fragment,n),d(Yt.$$.fragment,n),d(Xt.$$.fragment,n),d(Jt.$$.fragment,n),d(Qt.$$.fragment,n),d(Zt.$$.fragment,n),d(ne.$$.fragment,n),d(On.$$.fragment,n),d(te.$$.fragment,n),d(ee.$$.fragment,n),d(ae.$$.fragment,n),d(se.$$.fragment,n),d(he.$$.fragment,n),d(Mn.$$.fragment,n),d(ie.$$.fragment,n),d(le.$$.fragment,n),d(re.$$.fragment,n),d(ce.$$.fragment,n),d(oe.$$.fragment,n),d(pe.$$.fragment,n),d(ue.$$.fragment,n),d(me.$$.fragment,n),d(ge.$$.fragment,n),d(Gn.$$.fragment,n),d(de.$$.fragment,n),d(fe.$$.fragment,n),d(Fn.$$.fragment,n),d(be.$$.fragment,n),d(ve.$$.fragment,n),d(Rn.$$.fragment,n),d(ke.$$.fragment,n),d(ye.$$.fragment,n),d(Xn.$$.fragment,n),d(_e.$$.fragment,n),d($e.$$.fragment,n),pr=!0)},o(n){f(_.$$.fragment,n),f(x.$$.fragment,n),f(T.$$.fragment,n),f(lt.$$.fragment,n),f(rt.$$.fragment,n),f(ot.$$.fragment,n),f(pt.$$.fragment,n),f(ut.$$.fragment,n),f(mt.$$.fragment,n),f(gt.$$.fragment,n),f(dt.$$.fragment,n),f(ft.$$.fragment,n),f(bt.$$.fragment,n),f(vt.$$.fragment,n),f(kt.$$.fragment,n),f(yt.$$.fragment,n),f(_t.$$.fragment,n),f($t.$$.fragment,n),f(wt.$$.fragment,n),f(Et.$$.fragment,n),f(qt.$$.fragment,n),f(xt.$$.fragment,n),f(Ct.$$.fragment,n),f(Tt.$$.fragment,n),f(Pt.$$.fragment,n),f(At.$$.fragment,n),f(Dt.$$.fragment,n),f(jn.$$.fragment,n),f(zt.$$.fragment,n),f(Nt.$$.fragment,n),f(St.$$.fragment,n),f(Ot.$$.fragment,n),f(Ut.$$.fragment,n),f(Vt.$$.fragment,n),f(Bt.$$.fragment,n),f(Mt.$$.fragment,n),f(Lt.$$.fragment,n),f(Gt.$$.fragment,n),f(Ht.$$.fragment,n),f(It.$$.fragment,n),f(Ft.$$.fragment,n),f(Kt.$$.fragment,n),f(Wt.$$.fragment,n),f(Rt.$$.fragment,n),f(Yt.$$.fragment,n),f(Xt.$$.fragment,n),f(Jt.$$.fragment,n),f(Qt.$$.fragment,n),f(Zt.$$.fragment,n),f(ne.$$.fragment,n),f(On.$$.fragment,n),f(te.$$.fragment,n),f(ee.$$.fragment,n),f(ae.$$.fragment,n),f(se.$$.fragment,n),f(he.$$.fragment,n),f(Mn.$$.fragment,n),f(ie.$$.fragment,n),f(le.$$.fragment,n),f(re.$$.fragment,n),f(ce.$$.fragment,n),f(oe.$$.fragment,n),f(pe.$$.fragment,n),f(ue.$$.fragment,n),f(me.$$.fragment,n),f(ge.$$.fragment,n),f(Gn.$$.fragment,n),f(de.$$.fragment,n),f(fe.$$.fragment,n),f(Fn.$$.fragment,n),f(be.$$.fragment,n),f(ve.$$.fragment,n),f(Rn.$$.fragment,n),f(ke.$$.fragment,n),f(ye.$$.fragment,n),f(Xn.$$.fragment,n),f(_e.$$.fragment,n),f($e.$$.fragment,n),pr=!1},d(n){t(v),n&&t(w),b(_,n),n&&t($),n&&t(q),b(x),n&&t(O),b(T,n),n&&t(it),n&&t(U),n&&t(vh),n&&t(an),b(lt),n&&t(kh),b(rt,n),n&&t(yh),n&&t(F),n&&t(_h),n&&t(vn),n&&t($h),n&&t(kn),n&&t(wh),b(ot,n),n&&t(jh),n&&t(ze),n&&t(Eh),b(pt,n),n&&t(qh),n&&t(sn),b(ut),n&&t(xh),n&&t(_n),n&&t(Ch),n&&t($n),n&&t(Th),b(mt,n),n&&t(Ph),b(gt,n),n&&t(Ah),n&&t(K),n&&t(Dh),n&&t(D),n&&t(zh),b(dt,n),n&&t(Nh),n&&t(Ne),n&&t(Sh),b(ft,n),n&&t(Oh),n&&t(Se),n&&t(Uh),b(bt,n),n&&t(Vh),n&&t(Oe),n&&t(Bh),n&&t(Ue),n&&t(Mh),b(vt,n),n&&t(Lh),b(kt,n),n&&t(Gh),n&&t(Ve),n&&t(Hh),b(yt,n),n&&t(Ih),b(_t,n),n&&t(Fh),n&&t(z),n&&t(Kh),b($t,n),n&&t(Wh),b(wt,n),n&&t(Rh),n&&t(W),n&&t(Yh),n&&t(wn),n&&t(Xh),b(Et,n),n&&t(Jh),b(qt,n),n&&t(Qh),n&&t(Be),n&&t(Zh),b(xt,n),n&&t(ni),b(Ct,n),n&&t(ti),n&&t(Me),n&&t(ei),b(Tt,n),n&&t(ai),b(Pt,n),n&&t(si),n&&t(R),n&&t(hi),b(At,n),n&&t(ii),b(Dt,n),n&&t(li),n&&t(Y),n&&t(ri),n&&t(Le),n&&t(ci),b(jn,n),n&&t(oi),n&&t(Ge),n&&t(pi),n&&t(He),n&&t(ui),n&&t(hn),b(zt),n&&t(mi),n&&t(N),n&&t(gi),b(Nt,n),n&&t(di),n&&t(Ie),n&&t(fi),b(St,n),n&&t(bi),n&&t(X),n&&t(vi),b(Ot,n),n&&t(ki),b(Ut,n),n&&t(yi),n&&t(B),n&&t(_i),n&&t(M),n&&t($i),b(Vt,n),n&&t(wi),n&&t(Fe),n&&t(ji),b(Bt,n),n&&t(Ei),n&&t(Ke),n&&t(qi),n&&t(We),n&&t(xi),b(Mt,n),n&&t(Ci),n&&t(S),n&&t(Ti),b(Lt,n),n&&t(Pi),n&&t(Re),n&&t(Ai),n&&t(Ye),n&&t(Di),n&&t(ln),b(Gt),n&&t(zi),n&&t(Xe),n&&t(Ni),b(Ht,n),n&&t(Si),n&&t(xn),n&&t(Oi),n&&t(Je),n&&t(Ui),n&&t(Qe),n&&t(Vi),n&&t(Cn),n&&t(Bi),b(It,n),n&&t(Mi),b(Ft,n),n&&t(Li),n&&t(Tn),n&&t(Gi),b(Kt,n),n&&t(Hi),b(Wt,n),n&&t(Ii),n&&t(Ze),n&&t(Fi),b(Rt,n),n&&t(Ki),n&&t(Pn),n&&t(Wi),b(Yt,n),n&&t(Ri),n&&t(na),n&&t(Yi),b(Xt,n),n&&t(Xi),n&&t(ta),n&&t(Ji),n&&t(rn),b(Jt),n&&t(Qi),n&&t(ea),n&&t(Zi),n&&t(Dn),n&&t(nl),b(Qt,n),n&&t(tl),n&&t(aa),n&&t(el),n&&t(J),n&&t(al),b(Zt,n),n&&t(sl),n&&t(zn),n&&t(hl),n&&t(cn),b(ne),n&&t(il),n&&t(Sn),n&&t(ll),n&&t(sa),n&&t(rl),b(On,n),n&&t(cl),n&&t(on),b(te),n&&t(ol),n&&t(Vn),n&&t(pl),b(ee,n),n&&t(ul),b(ae,n),n&&t(ml),n&&t(ha),n&&t(gl),n&&t(Bn),n&&t(dl),b(se,n),n&&t(fl),b(he,n),n&&t(bl),b(Mn,n),n&&t(vl),n&&t(ia),n&&t(kl),b(ie,n),n&&t(yl),n&&t(la),n&&t(_l),b(le,n),n&&t($l),n&&t(Q),n&&t(wl),b(re,n),n&&t(jl),b(ce,n),n&&t(El),n&&t(L),n&&t(ql),b(oe,n),n&&t(xl),b(pe,n),n&&t(Cl),n&&t(Ln),n&&t(Tl),b(ue,n),n&&t(Pl),b(me,n),n&&t(Al),n&&t(ra),n&&t(Dl),n&&t(ca),n&&t(zl),b(ge,n),n&&t(Nl),n&&t(oa),n&&t(Sl),b(Gn,n),n&&t(Ol),n&&t(pn),b(de),n&&t(Ul),n&&t(pa),n&&t(Vl),n&&t(un),b(fe),n&&t(Bl),n&&t(ua),n&&t(Ml),n&&t(G),n&&t(Ll),b(Fn,n),n&&t(Gl),n&&t(ma),n&&t(Hl),n&&t(ga),n&&t(Il),n&&t(da),n&&t(Fl),n&&t(mn),b(be),n&&t(Kl),n&&t(fa),n&&t(Wl),n&&t(Wn),n&&t(Rl),b(ve,n),n&&t(Yl),b(Rn,n),n&&t(Xl),n&&t(Yn),n&&t(Jl),b(ke,n),n&&t(Ql),b(ye,n),n&&t(Zl),n&&t(ba),n&&t(nr),n&&t(va),n&&t(tr),b(Xn,n),n&&t(er),n&&t(gn),b(_e),n&&t(ar),n&&t(Qn),n&&t(sr),n&&t(ka),n&&t(hr),n&&t(ya),n&&t(ir),n&&t(dn),b($e),n&&t(lr),n&&t(nt),n&&t(rr),n&&t(_a),n&&t(cr),n&&t(H),n&&t(or),n&&t(qa)}}}const jf={local:"g-li-quy-trnh-hun-luyn",sections:[{local:"g-li-quy-trnh-hun-luyn",sections:[{local:"kim-tra-d-liu-ca-bn",title:"Ki\u1EC3m tra d\u1EEF li\u1EC7u c\u1EE7a b\u1EA1n"},{local:"t-b-d-liu-thnh-dataloader",title:"T\u1EEB b\u1ED9 d\u1EEF li\u1EC7u th\xE0nh dataloader"},{local:"xem-qua-m-hnh",title:"Xem qua m\xF4 h\xECnh"},{local:"thc-hin-mt-bc-ti-u-ha",title:"Th\u1EF1c hi\u1EC7n m\u1ED9t b\u01B0\u1EDBc t\u1ED1i \u01B0u h\xF3a"},{local:"x-l-li-ht-b-nh-cuda",title:"X\u1EED l\xFD l\u1ED7i h\u1EBFt b\u1ED9 nh\u1EDB CUDA"},{local:"nh-gi-m-hnh",title:"\u0110\xE1nh gi\xE1 m\xF4 h\xECnh"}],title:"G\u1EE1 l\u1ED7i quy tr\xECnh hu\u1EA5n luy\u1EC7n"},{local:"debugging-silent-errors-during-training",sections:[{local:"kim-tra-li-d-liu-ca-bn-mt-ln-na",title:"Ki\u1EC3m tra l\u1EA1i d\u1EEF li\u1EC7u c\u1EE7a b\u1EA1n (m\u1ED9t l\u1EA7n n\u1EEFa!)"},{local:"hc-k-m-hnh-ca-bn-trong-mt-l",title:"H\u1ECDc k\u0129 m\xF4 h\xECnh c\u1EE7a b\u1EA1n trong m\u1ED9t l\xF4"},{local:"khng-iu-chnh-bt-c-th-g-cho-n-khi-bn-c-m-hnh-c-s-u-tin",title:"Kh\xF4ng \u0111i\u1EC1u ch\u1EC9nh b\u1EA5t c\u1EE9 th\u1EE9 g\xEC cho \u0111\u1EBFn khi b\u1EA1n c\xF3 m\xF4 h\xECnh c\u01A1 s\u1EDF \u0111\u1EA7u ti\xEAn"},{local:"yu-cu-gip",title:"Y\xEAu c\u1EA7u gi\xFAp \u0111\u1EE1"}],title:"Debugging silent errors during training"}],title:"G\u1EE1 l\u1ED7i quy tr\xECnh hu\u1EA5n luy\u1EC7n"};function Ef(P,v,w){let _="pt";return uf(()=>{const $=new URLSearchParams(window.location.search);w(0,_=$.get("fw")||"pt")}),[_]}class zf extends rf{constructor(v){super();cf(this,v,Ef,wf,of,{})}}export{zf as default,jf as metadata};
