import{S as Iu,i as Fu,s as Gu,e as p,k as f,w as u,t as l,M as Mu,c as i,d as s,m as c,x as d,a as o,h as n,b as w,G as a,g as r,y as _,q as $,o as h,B as b,v as Wu}from"../../chunks/vendor-hf-doc-builder.js";import{T as Xs}from"../../chunks/Tip-hf-doc-builder.js";import{Y as Nu}from"../../chunks/Youtube-hf-doc-builder.js";import{I as Lu}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{C as k}from"../../chunks/CodeBlock-hf-doc-builder.js";import{D as Ru}from"../../chunks/DocNotebookDropdown-hf-doc-builder.js";import{F as Hu}from"../../chunks/FrameworkSwitchCourse-hf-doc-builder.js";function Bu(T){let m,E,j,v,g;return{c(){m=p("p"),E=l("\u270F\uFE0F "),j=p("strong"),v=l("\u8F6E\u5230\u4F60\u4E86\uFF01"),g=l(" \u68C0\u67E5\u8BAD\u7EC3\u6570\u636E\u96C6\u7684\u7B2C\u4E8C\u4E2A\u5143\u7D20\u662F\u5426\u6B63\u786E\u3002")},l(q){m=i(q,"P",{});var P=o(m);E=n(P,"\u270F\uFE0F "),j=i(P,"STRONG",{});var C=o(j);v=n(C,"\u8F6E\u5230\u4F60\u4E86\uFF01"),C.forEach(s),g=n(P," \u68C0\u67E5\u8BAD\u7EC3\u6570\u636E\u96C6\u7684\u7B2C\u4E8C\u4E2A\u5143\u7D20\u662F\u5426\u6B63\u786E\u3002"),P.forEach(s)},m(q,P){r(q,m,P),a(m,E),a(m,j),a(j,v),a(m,g)},d(q){q&&s(m)}}}function Vu(T){let m,E;return{c(){m=p("p"),E=l("\u5728\u8BFE\u7A0B\u7684\u4E0B\u4E00\u90E8\u5206\u4E2D\uFF0C\u6211\u4EEC\u5C06\u4ECB\u7ECD\u66F4\u5148\u8FDB\u7684\u6280\u672F\uFF0C\u8FD9\u4E9B\u6280\u672F\u53EF\u4EE5\u5E2E\u52A9\u60A8\u51CF\u5C11\u5185\u5B58\u5360\u7528\u5E76\u8BA9\u60A8\u5FAE\u8C03\u6700\u5927\u7684\u6A21\u578B\u3002")},l(j){m=i(j,"P",{});var v=o(m);E=n(v,"\u5728\u8BFE\u7A0B\u7684\u4E0B\u4E00\u90E8\u5206\u4E2D\uFF0C\u6211\u4EEC\u5C06\u4ECB\u7ECD\u66F4\u5148\u8FDB\u7684\u6280\u672F\uFF0C\u8FD9\u4E9B\u6280\u672F\u53EF\u4EE5\u5E2E\u52A9\u60A8\u51CF\u5C11\u5185\u5B58\u5360\u7528\u5E76\u8BA9\u60A8\u5FAE\u8C03\u6700\u5927\u7684\u6A21\u578B\u3002"),v.forEach(s)},m(j,v){r(j,m,v),a(m,E)},d(j){j&&s(m)}}}function Ku(T){let m,E,j,v,g,q,P,C;return{c(){m=p("p"),E=l("\u{1F4A1} \u60A8\u5E94\u8BE5\u59CB\u7EC8\u786E\u4FDD\u5728\u542F\u52A8 "),j=p("code"),v=l("trainer.train()"),g=l(" \u4E4B\u524D "),q=p("code"),P=l("trainer.evaluate()"),C=l("\u662F\u53EF\u4EE5\u8FD0\u884C\u7684\uFF0C\u4EE5\u907F\u514D\u5728\u9047\u5230\u9519\u8BEF\u4E4B\u524D\u6D6A\u8D39\u5927\u91CF\u8BA1\u7B97\u8D44\u6E90\u3002")},l(z){m=i(z,"P",{});var y=o(m);E=n(y,"\u{1F4A1} \u60A8\u5E94\u8BE5\u59CB\u7EC8\u786E\u4FDD\u5728\u542F\u52A8 "),j=i(y,"CODE",{});var M=o(j);v=n(M,"trainer.train()"),M.forEach(s),g=n(y," \u4E4B\u524D "),q=i(y,"CODE",{});var D=o(q);P=n(D,"trainer.evaluate()"),D.forEach(s),C=n(y,"\u662F\u53EF\u4EE5\u8FD0\u884C\u7684\uFF0C\u4EE5\u907F\u514D\u5728\u9047\u5230\u9519\u8BEF\u4E4B\u524D\u6D6A\u8D39\u5927\u91CF\u8BA1\u7B97\u8D44\u6E90\u3002"),y.forEach(s)},m(z,y){r(z,m,y),a(m,E),a(m,j),a(j,v),a(m,g),a(m,q),a(q,P),a(m,C)},d(z){z&&s(m)}}}function Yu(T){let m,E,j,v,g,q,P,C,z,y,M;return{c(){m=p("p"),E=l("\u{1F4A1} \u5982\u679C\u60A8\u4F7F\u7528\u624B\u52A8\u8BAD\u7EC3\u5FAA\u73AF\uFF0C\u5219\u76F8\u540C\u7684\u6B65\u9AA4\u4E5F\u9002\u7528\u4E8E\u8C03\u8BD5\u8BAD\u7EC3\u7BA1\u9053\uFF0C\u800C\u4E14\u66F4\u5BB9\u6613\u5C06\u5B83\u4EEC\u5206\u5F00\u3002 \u4F46\u662F\uFF0C\u8BF7\u786E\u4FDD\u60A8\u6CA1\u6709\u5FD8\u8BB0\u6B63\u786E\u4F4D\u7F6E\u7684 "),j=p("code"),v=l("model.eval()"),g=l(" \u6216 "),q=p("code"),P=l("model.train()"),C=l("\uFF0C\u6216\u8005\u6BCF\u4E2A\u6B65\u9AA4\u4E2D\u7684 "),z=p("code"),y=l("zero_grad()"),M=l("\uFF01")},l(D){m=i(D,"P",{});var A=o(m);E=n(A,"\u{1F4A1} \u5982\u679C\u60A8\u4F7F\u7528\u624B\u52A8\u8BAD\u7EC3\u5FAA\u73AF\uFF0C\u5219\u76F8\u540C\u7684\u6B65\u9AA4\u4E5F\u9002\u7528\u4E8E\u8C03\u8BD5\u8BAD\u7EC3\u7BA1\u9053\uFF0C\u800C\u4E14\u66F4\u5BB9\u6613\u5C06\u5B83\u4EEC\u5206\u5F00\u3002 \u4F46\u662F\uFF0C\u8BF7\u786E\u4FDD\u60A8\u6CA1\u6709\u5FD8\u8BB0\u6B63\u786E\u4F4D\u7F6E\u7684 "),j=i(A,"CODE",{});var et=o(j);v=n(et,"model.eval()"),et.forEach(s),g=n(A," \u6216 "),q=i(A,"CODE",{});var se=o(q);P=n(se,"model.train()"),se.forEach(s),C=n(A,"\uFF0C\u6216\u8005\u6BCF\u4E2A\u6B65\u9AA4\u4E2D\u7684 "),z=i(A,"CODE",{});var st=o(z);y=n(st,"zero_grad()"),st.forEach(s),M=n(A,"\uFF01"),A.forEach(s)},m(D,A){r(D,m,A),a(m,E),a(m,j),a(j,v),a(m,g),a(m,q),a(q,P),a(m,C),a(m,z),a(z,y),a(m,M)},d(D){D&&s(m)}}}function Ju(T){let m,E;return{c(){m=p("p"),E=l("\u26A0\uFE0F \u5982\u679C\u60A8\u6B63\u5728\u8FDB\u884C\u5206\u5E03\u5F0F\u8BAD\u7EC3\uFF0C\u8BF7\u5728\u6BCF\u4E2A\u8FC7\u7A0B\u4E2D\u6253\u5370\u6570\u636E\u96C6\u7684\u6837\u672C\uFF0C\u5E76\u4E09\u6B21\u68C0\u67E5\u60A8\u662F\u5426\u5F97\u5230\u76F8\u540C\u7684\u7ED3\u679C\u3002 \u4E00\u4E2A\u5E38\u89C1\u7684\u9519\u8BEF\u662F\u5728\u6570\u636E\u521B\u5EFA\u4E2D\u6709\u4E00\u4E9B\u968F\u673A\u6027\u6765\u6E90\uFF0C\u8FD9\u4F7F\u5F97\u6BCF\u4E2A\u8FDB\u7A0B\u90FD\u6709\u4E0D\u540C\u7248\u672C\u7684\u6570\u636E\u96C6\u3002")},l(j){m=i(j,"P",{});var v=o(m);E=n(v,"\u26A0\uFE0F \u5982\u679C\u60A8\u6B63\u5728\u8FDB\u884C\u5206\u5E03\u5F0F\u8BAD\u7EC3\uFF0C\u8BF7\u5728\u6BCF\u4E2A\u8FC7\u7A0B\u4E2D\u6253\u5370\u6570\u636E\u96C6\u7684\u6837\u672C\uFF0C\u5E76\u4E09\u6B21\u68C0\u67E5\u60A8\u662F\u5426\u5F97\u5230\u76F8\u540C\u7684\u7ED3\u679C\u3002 \u4E00\u4E2A\u5E38\u89C1\u7684\u9519\u8BEF\u662F\u5728\u6570\u636E\u521B\u5EFA\u4E2D\u6709\u4E00\u4E9B\u968F\u673A\u6027\u6765\u6E90\uFF0C\u8FD9\u4F7F\u5F97\u6BCF\u4E2A\u8FDB\u7A0B\u90FD\u6709\u4E0D\u540C\u7248\u672C\u7684\u6570\u636E\u96C6\u3002"),v.forEach(s)},m(j,v){r(j,m,v),a(m,E)},d(j){j&&s(m)}}}function Zu(T){let m,E;return{c(){m=p("p"),E=l("\u{1F4A1} \u5982\u679C\u60A8\u7684\u8BAD\u7EC3\u6570\u636E\u4E0D\u5E73\u8861\uFF0C\u8BF7\u786E\u4FDD\u6784\u5EFA\u4E00\u6279\u5305\u542B\u6240\u6709\u6807\u7B7E\u7684\u8BAD\u7EC3\u6570\u636E\u3002")},l(j){m=i(j,"P",{});var v=o(m);E=n(v,"\u{1F4A1} \u5982\u679C\u60A8\u7684\u8BAD\u7EC3\u6570\u636E\u4E0D\u5E73\u8861\uFF0C\u8BF7\u786E\u4FDD\u6784\u5EFA\u4E00\u6279\u5305\u542B\u6240\u6709\u6807\u7B7E\u7684\u8BAD\u7EC3\u6570\u636E\u3002"),v.forEach(s)},m(j,v){r(j,m,v),a(m,E)},d(j){j&&s(m)}}}function Qu(T){let m,E;return{c(){m=p("p"),E=l("\u26A0\uFE0F \u5728\u6B64\u6D4B\u8BD5\u4E4B\u540E\uFF0C\u60A8\u5C06\u4E0D\u5F97\u4E0D\u91CD\u65B0\u521B\u5EFA\u60A8\u7684\u6A21\u578B\u548C\u201CTrainer\u201D\uFF0C\u56E0\u4E3A\u83B7\u5F97\u7684\u6A21\u578B\u53EF\u80FD\u65E0\u6CD5\u5728\u60A8\u7684\u5B8C\u6574\u6570\u636E\u96C6\u4E0A\u6062\u590D\u548C\u5B66\u4E60\u6709\u7528\u7684\u4E1C\u897F\u3002")},l(j){m=i(j,"P",{});var v=o(m);E=n(v,"\u26A0\uFE0F \u5728\u6B64\u6D4B\u8BD5\u4E4B\u540E\uFF0C\u60A8\u5C06\u4E0D\u5F97\u4E0D\u91CD\u65B0\u521B\u5EFA\u60A8\u7684\u6A21\u578B\u548C\u201CTrainer\u201D\uFF0C\u56E0\u4E3A\u83B7\u5F97\u7684\u6A21\u578B\u53EF\u80FD\u65E0\u6CD5\u5728\u60A8\u7684\u5B8C\u6574\u6570\u636E\u96C6\u4E0A\u6062\u590D\u548C\u5B66\u4E60\u6709\u7528\u7684\u4E1C\u897F\u3002"),v.forEach(s)},m(j,v){r(j,m,v),a(m,E)},d(j){j&&s(m)}}}function Xu(T){let m,E,j,v,g,q,P,C,z,y,M,D,A,et,se,st,gp,dr,Ae,Pp,_r,xe,$r,W,Cp,ia,Tp,zp,oa,Dp,Ap,hr,te,xp,fa,Up,Op,br,ae,Sp,Ue,Lp,Ip,kr,Oe,jr,tt,Fp,vr,Se,wr,Le,Gp,Er,at,Mp,yr,re,Wp,ca,Np,Rp,qr,Ie,gr,Fe,Pr,N,Hp,ma,Bp,Vp,ua,Kp,Yp,Cr,O,Jp,da,Zp,Qp,_a,Xp,ei,$a,si,ti,Tr,Ge,zr,rt,ai,Dr,Me,Ar,lt,ri,xr,We,Ur,nt,li,Or,pt,ni,Sr,Ne,Lr,Re,Ir,it,pi,Fr,He,Gr,Be,Mr,x,ii,ha,oi,fi,ba,ci,mi,ka,ui,di,ja,_i,$i,Wr,Ve,Nr,Ke,Rr,R,hi,Ye,bi,ki,va,ji,vi,Hr,le,wi,wa,Ei,yi,Br,Je,Vr,Ze,Kr,ot,qi,Yr,Qe,Jr,Xe,Zr,ft,gi,Qr,es,Xr,ss,el,H,Pi,Ea,Ci,Ti,ya,zi,Di,sl,ts,tl,as,al,B,Ai,qa,xi,Ui,ga,Oi,Si,rl,ct,Li,ll,ne,nl,mt,Ii,pl,ut,Fi,il,Z,pe,Pa,rs,Gi,Ca,Mi,ol,S,Wi,Ta,Ni,Ri,za,Hi,Bi,Da,Vi,Ki,fl,ls,cl,dt,Yi,ml,ns,ul,_t,Ji,dl,ps,_l,is,$l,L,Zi,Aa,Qi,Xi,xa,eo,so,Ua,to,ao,hl,I,ro,Oa,lo,no,Sa,po,io,La,oo,fo,bl,os,kl,$t,co,jl,fs,vl,ht,mo,wl,bt,uo,El,cs,yl,U,_o,Ia,$o,ho,Fa,bo,ko,Ga,jo,vo,Ma,wo,Eo,ql,ms,gl,kt,yo,Pl,jt,qo,Cl,us,go,Tl,vt,Po,zl,ds,Dl,ie,Co,Wa,To,zo,Al,wt,Do,xl,Et,Ao,Ul,yt,xo,Ol,_s,Sl,$s,Ll,qt,Uo,Il,hs,Fl,bs,Gl,gt,Oo,Ml,ks,Wl,oe,So,Na,Lo,Io,Nl,js,Rl,Pt,Fo,Hl,vs,Bl,Ct,Go,Vl,ws,Mo,Kl,Tt,Wo,Yl,fe,No,Ra,Ro,Ho,Jl,Es,Zl,zt,Bo,Ql,V,Vo,Ha,Ko,Yo,Ba,Jo,Zo,Xl,ys,en,ce,Qo,Va,Xo,ef,sn,Q,me,Ka,qs,sf,Ya,tf,tn,ue,af,Ja,rf,lf,an,Dt,nf,rn,de,ln,gs,pf,nn,_e,of,Za,ff,cf,pn,Ps,on,Cs,fn,At,mf,cn,$e,uf,Qa,df,_f,mn,Ts,un,zs,dn,he,_n,xt,$f,$n,Ds,hn,Ut,hf,bn,As,kn,K,bf,Xa,kf,jf,er,vf,wf,jn,xs,vn,Us,wn,Ot,Ef,En,Os,yn,Ss,qn,be,yf,sr,qf,gf,gn,Ls,Pn,Is,Cn,St,Pf,Tn,Lt,Cf,zn,Fs,Dn,It,Tf,An,ke,xn,Gs,zf,Un,Ft,Df,On,Ms,Af,Sn,Gt,xf,Ln,F,tr,Uf,Of,ar,Sf,Lf,rr,If,Ff,lr,Gf,In,je,Fn,Mt,Mf,Gn,Wt,Wf,Mn,Nt,Nf,Wn,Ws,Rf,Nn,Rt,Hf,Rn,ve,Bf,nr,Vf,Kf,Hn,Ns,Bn,we,Vn,Ht,Yf,Kn,Rs,Yn,Hs,Jn,Bt,Jf,Zn,Vt,Zf,Qn,Ee,Xn,Bs,Qf,ep,ye,Xf,pr,ec,sc,sp,Kt,tc,tp,Yt,ac,ap,Vs,rc,rp,qe,lc,Ks,nc,pc,lp,Jt,ic,np,G,Zt,Ys,oc,fc,cc,Qt,Js,mc,uc,dc,Xt,Zs,_c,$c,hc,ea,Qs,bc,kc,pp,sa,jc,ip;return j=new Hu({props:{fw:T[0]}}),C=new Ru({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/chapter8/section4_pt.ipynb"},{label:"Aws Studio",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/master/course/chapter8/section4_pt.ipynb"}]}}),xe=new Nu({props:{id:"L-WSwUWde1U"}}),Oe=new k({props:{code:`from datasets import load_dataset, load_metric
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 = load_metric("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, load_metric
<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 = load_metric(<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()`}}),Se=new k({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>'}}),Ie=new k({props:{code:"trainer.train_dataset[0]",highlighted:'trainer.train_dataset[<span class="hljs-number">0</span>]'}}),Fe=new k({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>}`}}),Ge=new k({props:{code:`from datasets import load_dataset, load_metric
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 = load_metric("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, load_metric
<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 = load_metric(<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()`}}),Me=new k({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>'}}),We=new k({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`}}),Ne=new k({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>])'}}),Re=new k({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>'}}),He=new k({props:{code:"trainer.train_dataset[0].keys()",highlighted:'trainer.train_dataset[<span class="hljs-number">0</span>].keys()'}}),Be=new k({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>])'}}),Ve=new k({props:{code:"type(trainer.model)",highlighted:'<span class="hljs-built_in">type</span>(trainer.model)'}}),Ke=new k({props:{code:"transformers.models.distilbert.modeling_distilbert.DistilBertForSequenceClassification",highlighted:"transformers.models.distilbert.modeling_distilbert.DistilBertForSequenceClassification"}}),Je=new k({props:{code:'tokenizer.decode(trainer.train_dataset[0]["attention_mask"])',highlighted:'tokenizer.decode(trainer.train_dataset[<span class="hljs-number">0</span>][<span class="hljs-string">&quot;attention_mask&quot;</span>])'}}),Ze=new k({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>]'}}),Qe=new k({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>]
)`}}),Xe=new k({props:{code:"True",highlighted:'<span class="hljs-literal">True</span>'}}),es=new k({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>]'}}),ss=new k({props:{code:"1",highlighted:'<span class="hljs-number">1</span>'}}),ts=new k({props:{code:'trainer.train_dataset.features["label"].names',highlighted:'trainer.train_dataset.features[<span class="hljs-string">&quot;label&quot;</span>].names'}}),as=new k({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>]'}}),ne=new Xs({props:{$$slots:{default:[Bu]},$$scope:{ctx:T}}}),rs=new Lu({}),ls=new k({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>`}}),ns=new k({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>)`}}),ps=new k({props:{code:`data_collator = trainer.get_train_dataloader().collate_fn
data_collator`,highlighted:`data_collator = trainer.get_train_dataloader().collate_fn
data_collator`}}),is=new k({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;'}}),os=new k({props:{code:`from datasets import load_dataset, load_metric
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 = load_metric("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, load_metric
<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 = load_metric(<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()`}}),fs=new k({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)`"}}),cs=new k({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>)])`}}),ms=new k({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>)])`}}),ds=new k({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>`}}),_s=new k({props:{code:"outputs = trainer.model.cpu()(**batch)",highlighted:"outputs = trainer.model.cpu()(**batch)"}}),$s=new k({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.`}}),hs=new k({props:{code:"trainer.model.config.num_labels",highlighted:"trainer.model.config.num_labels"}}),bs=new k({props:{code:"2",highlighted:'<span class="hljs-number">2</span>'}}),ks=new k({props:{code:`from datasets import load_dataset, load_metric
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 = load_metric("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, load_metric
<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 = load_metric(<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,
)`}}),js=new k({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)`}}),vs=new k({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)`}}),Es=new k({props:{code:`loss = outputs.loss
loss.backward()`,highlighted:`loss = outputs.loss
loss.backward()`}}),ys=new k({props:{code:`trainer.create_optimizer()
trainer.optimizer.step()`,highlighted:`trainer.create_optimizer()
trainer.optimizer.step()`}}),qs=new Lu({}),de=new Xs({props:{$$slots:{default:[Vu]},$$scope:{ctx:T}}}),Ps=new k({props:{code:`# This will take a long time and error out, so you shouldn't run this cell
trainer.train()`,highlighted:`<span class="hljs-comment"># This will take a long time and error out, so you shouldn&#x27;t run this cell</span>
trainer.train()`}}),Cs=new k({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'}}),Ts=new k({props:{code:"trainer.evaluate()",highlighted:"trainer.evaluate()"}}),zs=new k({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'}}),he=new Xs({props:{$$slots:{default:[Ku]},$$scope:{ctx:T}}}),Ds=new k({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)`}}),As=new k({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>`}}),xs=new k({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))`}}),Us=new k({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'}}),Os=new k({props:{code:"predictions.shape, labels.shape",highlighted:"predictions.shape, labels.shape"}}),Ss=new k({props:{code:"((8, 3), (8,))",highlighted:'((<span class="hljs-number">8</span>, <span class="hljs-number">3</span>), (<span class="hljs-number">8</span>,))'}}),Ls=new k({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))`}}),Is=new k({props:{code:"{'accuracy': 0.625}",highlighted:'{<span class="hljs-string">&#x27;accuracy&#x27;</span>: <span class="hljs-number">0.625</span>}'}}),Fs=new k({props:{code:`import numpy as np
from datasets import load_dataset, load_metric
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 = load_metric("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, load_metric
<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 = load_metric(<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()`}}),ke=new Xs({props:{$$slots:{default:[Yu]},$$scope:{ctx:T}}}),je=new Xs({props:{warning:!0,$$slots:{default:[Ju]},$$scope:{ctx:T}}}),Ns=new k({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()`}}),we=new Xs({props:{$$slots:{default:[Zu]},$$scope:{ctx:T}}}),Rs=new k({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()))`}}),Hs=new k({props:{code:"{'accuracy': 1.0}",highlighted:'{<span class="hljs-string">&#x27;accuracy&#x27;</span>: <span class="hljs-number">1.0</span>}'}}),Ee=new Xs({props:{warning:!0,$$slots:{default:[Qu]},$$scope:{ctx:T}}}),{c(){m=p("meta"),E=f(),u(j.$$.fragment),v=f(),g=p("h1"),q=l("\u8C03\u8BD5\u8BAD\u7EC3\u7BA1\u9053"),P=f(),u(C.$$.fragment),z=f(),y=p("p"),M=l("\u4F60\u5DF2\u7ECF\u7F16\u5199\u4E86\u4E00\u4E2A\u6F02\u4EAE\u7684\u811A\u672C\u6765\u8BAD\u7EC3\u6216\u5FAE\u8C03\u7ED9\u5B9A\u4EFB\u52A1\u7684\u6A21\u578B\uFF0C\u5C3D\u804C\u5C3D\u8D23\u5730\u9075\u5FAA "),D=p("a"),A=l("Chapter 7"),et=l(" \u4E2D\u7684\u5EFA\u8BAE\u3002 \u4F46\u662F\u5F53\u4F60\u542F\u52A8\u547D\u4EE4 "),se=p("code"),st=l("trainer.train()"),gp=l(" \u65F6\uFF0C\u53EF\u6015\u7684\u4E8B\u60C5\u53D1\u751F\u4E86\uFF1A\u4F60\u5F97\u5230\u4E00\u4E2A\u9519\u8BEF\u{1F631}\uFF01 \u6216\u8005\u66F4\u7CDF\u7CD5\u7684\u662F\uFF0C\u4E00\u5207\u4F3C\u4E4E\u90FD\u5F88\u597D\uFF0C\u8BAD\u7EC3\u8FD0\u884C\u6CA1\u6709\u9519\u8BEF\uFF0C\u4F46\u751F\u6210\u7684\u6A21\u578B\u5F88\u7CDF\u7CD5\u3002 \u5728\u672C\u8282\u4E2D\uFF0C\u6211\u4EEC\u5C06\u5411\u60A8\u5C55\u793A\u5982\u4F55\u8C03\u8BD5\u6B64\u7C7B\u95EE\u9898\u3002"),dr=f(),Ae=p("h2"),Pp=l("\u8C03\u8BD5\u8BAD\u7EC3\u7BA1\u9053"),_r=f(),u(xe.$$.fragment),$r=f(),W=p("p"),Cp=l("\u5F53\u60A8\u5728 "),ia=p("code"),Tp=l("trainer.train()"),zp=l(" \u4E2D\u9047\u5230\u9519\u8BEF\u65F6\uFF0C\u5B83\u53EF\u80FD\u6765\u81EA\u591A\u4E2A\u6765\u6E90\uFF0C\u56E0\u4E3A "),oa=p("code"),Dp=l("Trainer"),Ap=l(" \u901A\u5E38\u4F1A\u5C06\u5F88\u591A\u4E1C\u897F\u653E\u5728\u4E00\u8D77\u7EC4\u5408\u8FD0\u884C\u3002 \u5B83\u5C06datasets\u8F6C\u6362\u4E3Adataloaders\uFF0C\u56E0\u6B64\u95EE\u9898\u53EF\u80FD\u51FA\u5728datasets\u4E2D\uFF0C\u6216\u8005\u5728\u5C1D\u8BD5\u5C06datasets\u7684\u5143\u7D20\u4E00\u8D77\u6279\u5904\u7406\u65F6\u51FA\u73B0\u95EE\u9898\u3002 \u7136\u540E\u5B83\u9700\u8981\u51C6\u5907\u4E00\u6279\u6570\u636E\u5E76\u5C06\u5176\u63D0\u4F9B\u7ED9\u6A21\u578B\uFF0C\u56E0\u6B64\u95EE\u9898\u53EF\u80FD\u51FA\u5728\u6A21\u578B\u4EE3\u7801\u4E2D\u3002 \u4E4B\u540E\uFF0C\u5B83\u4F1A\u8BA1\u7B97\u68AF\u5EA6\u5E76\u6267\u884C\u4F18\u5316\u5668\uFF0C\u56E0\u6B64\u95EE\u9898\u4E5F\u53EF\u80FD\u51FA\u5728\u60A8\u7684\u4F18\u5316\u5668\u4E2D\u3002 \u5373\u4F7F\u8BAD\u7EC3\u4E00\u5207\u987A\u5229\uFF0C\u5982\u679C\u60A8\u7684\u8BC4\u4F30\u6307\u6807\u6709\u95EE\u9898\uFF0C\u8BC4\u4F30\u671F\u95F4\u4ECD\u7136\u53EF\u80FD\u51FA\u73B0\u95EE\u9898\u3002"),hr=f(),te=p("p"),xp=l("\u8C03\u8BD5 "),fa=p("code"),Up=l("trainer.train()"),Op=l(" \u4E2D\u51FA\u73B0\u7684\u9519\u8BEF\u7684\u6700\u4F73\u65B9\u6CD5\u662F\u624B\u52A8\u68C0\u67E5\u6574\u4E2A\u7BA1\u9053\uFF0C\u770B\u770B\u54EA\u91CC\u51FA\u4E86\u95EE\u9898\u3002 \u9519\u8BEF\u901A\u5E38\u5F88\u5BB9\u6613\u89E3\u51B3\u3002"),br=f(),ae=p("p"),Sp=l("\u4E3A\u4E86\u8BC1\u660E\u8FD9\u4E00\u70B9\uFF0C\u6211\u4EEC\u5C06\u4F7F\u7528\u4EE5\u4E0B\u811A\u672C\uFF08\u5C1D\u8BD5\uFF09\u5728 "),Ue=p("a"),Lp=l("MNLI \u6570\u636E\u96C6"),Ip=l("\u4E0A\u5FAE\u8C03 DistilBERT \u6A21\u578B\uFF1A"),kr=f(),u(Oe.$$.fragment),jr=f(),tt=p("p"),Fp=l("\u5982\u679C\u4F60\u5C1D\u8BD5\u6267\u884C\u5B83\uFF0C\u4F60\u4F1A\u9047\u5230\u4E00\u4E2A\u76F8\u5F53\u795E\u79D8\u7684\u9519\u8BEF\uFF1A"),vr=f(),u(Se.$$.fragment),wr=f(),Le=p("h3"),Gp=l("\u68C0\u67E5\u6570\u636E"),Er=f(),at=p("p"),Mp=l("\u8FD9\u662F\u4E0D\u8A00\u800C\u55BB\u7684\uFF0C\u5982\u679C\u4F60\u7684\u6570\u636E\u88AB\u7834\u574F\uFF0C\u201CTrainer\u201D\u5C06\u65E0\u6CD5\u5F62\u6210\u6279\u6B21\uFF0C\u66F4\u4E0D\u7528\u8BF4\u8BAD\u7EC3\u4F60\u7684\u6A21\u578B\u4E86\u3002 \u6240\u4EE5\u9996\u5148\uFF0C\u4F60\u9700\u8981\u770B\u770B\u4F60\u7684\u8BAD\u7EC3\u96C6\u4E2D\u6709\u4EC0\u4E48\u3002"),yr=f(),re=p("p"),Wp=l("\u4E3A\u4E86\u907F\u514D\u82B1\u8D39\u65E0\u6570\u5C0F\u65F6\u8BD5\u56FE\u68C0\u67E5\u548C\u4FEE\u590D\u4E0D\u662F\u9519\u8BEF\u6765\u6E90\u7684\u4E1C\u897F\uFF0C\u6211\u4EEC\u5EFA\u8BAE\u60A8\u4F7F\u7528 "),ca=p("code"),Np=l("trainer.train_dataset"),Rp=l(" \u8FDB\u884C\u68C0\u67E5\u3002 \u6240\u4EE5\u8BA9\u6211\u4EEC\u5728\u8FD9\u91CC\u8FD9\u6837\u505A\uFF1A"),qr=f(),u(Ie.$$.fragment),gr=f(),u(Fe.$$.fragment),Pr=f(),N=p("p"),Hp=l("\u4F60\u6CE8\u610F\u5230\u6709\u4EC0\u4E48\u4E0D\u5BF9\u5417\uFF1F \u4E0E\u7F3A\u5C11\u6709\u5173 "),ma=p("code"),Bp=l("input_ids"),Vp=l(" \u7684\u9519\u8BEF\u6D88\u606F\u76F8\u7ED3\u5408\uFF0C\u5E94\u8BE5\u8BA9\u60A8\u610F\u8BC6\u5230\u6570\u636E\u96C6\u91CC\u662F\u6587\u672C\uFF0C\u800C\u4E0D\u662F\u6A21\u578B\u53EF\u4EE5\u7406\u89E3\u7684\u6570\u5B57\u3002 \u5728\u8FD9\u4E2A\u4F8B\u5B50\uFF0C\u8F93\u51FA\u7684\u539F\u59CB\u9519\u8BEF\u4FE1\u606F\u975E\u5E38\u5177\u6709\u8BEF\u5BFC\u6027\uFF0C\u56E0\u4E3A "),ua=p("code"),Kp=l("Trainer"),Yp=l(" \u4F1A\u81EA\u52A8\u5220\u9664\u4E0E\u6A21\u578B\u7B7E\u540D\u4E0D\u5339\u914D\u7684\u5217\uFF08\u5373\u6A21\u578B\u9884\u671F\u7684\u53C2\u6570\uFF09\u3002 \u8FD9\u610F\u5473\u7740\u5728\u8FD9\u91CC\uFF0C\u9664\u4E86\u6807\u7B7E\u4E4B\u5916\u7684\u6240\u6709\u4E1C\u897F\u90FD\u88AB\u4E22\u5F03\u4E86\u3002 \u56E0\u6B64\uFF0C\u521B\u5EFA\u6279\u6B21\u7136\u540E\u5C06\u5B83\u4EEC\u53D1\u9001\u5230\u6A21\u578B\u6CA1\u6709\u95EE\u9898\uFF0C\u800C\u6A21\u578B\u53C8\u62B1\u6028\u5B83\u6CA1\u6709\u6536\u5230\u6B63\u786E\u7684\u8F93\u5165\u3002"),Cr=f(),O=p("p"),Jp=l("\u4E3A\u4EC0\u4E48\u6CA1\u6709\u5904\u7406\u6570\u636E\u751F\u6210\u6807\u8BB0\u5462\uFF1F \u6211\u4EEC\u786E\u5B9E\u5728\u6570\u636E\u96C6\u4E0A\u4F7F\u7528\u4E86\u201CDataset.map()\u201D\u65B9\u6CD5\u6765\u5BF9\u6BCF\u4E2A\u6837\u672C\u5E94\u7528\u6807\u8BB0\u5668\u3002 \u4F46\u662F\u5982\u679C\u4F60\u4ED4\u7EC6\u770B\u4EE3\u7801\uFF0C\u4F60\u4F1A\u53D1\u73B0\u6211\u4EEC\u5728\u5C06\u8BAD\u7EC3\u548C\u8BC4\u4F30\u96C6\u4F20\u9012\u7ED9"),da=p("code"),Zp=l("Trainer"),Qp=l("\u65F6\u72AF\u4E86\u4E00\u4E2A\u9519\u8BEF\u3002 \u6211\u4EEC\u5728\u8FD9\u91CC\u6CA1\u6709\u4F7F\u7528 "),_a=p("code"),Xp=l("tokenized_datasets"),ei=l("\uFF0C\u800C\u662F\u4F7F\u7528\u4E86 "),$a=p("code"),si=l("raw_datasets"),ti=l(" \u{1F926}\u3002 \u6240\u4EE5\u8BA9\u6211\u4EEC\u89E3\u51B3\u8FD9\u4E2A\u95EE\u9898\uFF01"),Tr=f(),u(Ge.$$.fragment),zr=f(),rt=p("p"),ai=l("\u8FD9\u4E2A\u65B0\u4EE3\u7801\u73B0\u5728\u4F1A\u7ED9\u51FA\u4E00\u4E2A\u4E0D\u540C\u7684\u9519\u8BEF\uFF1A"),Dr=f(),u(Me.$$.fragment),Ar=f(),lt=p("p"),ri=l("\u67E5\u770Btraceback\uFF0C\u6211\u4EEC\u53EF\u4EE5\u770B\u5230\u9519\u8BEF\u53D1\u751F\u5728\u6570\u636E\u6574\u7406\u6B65\u9AA4\u4E2D\uFF1A"),xr=f(),u(We.$$.fragment),Ur=f(),nt=p("p"),li=l("\u6240\u4EE5\uFF0C\u6211\u4EEC\u5E94\u8BE5\u53BB\u7814\u7A76\u4E00\u4E0B\u90A3\u4E2A\u3002 \u7136\u800C\uFF0C\u5728\u6211\u4EEC\u8FD9\u6837\u505A\u4E4B\u524D\uFF0C\u8BA9\u6211\u4EEC\u5B8C\u6210\u68C0\u67E5\u6211\u4EEC\u7684\u6570\u636E\uFF0C \u5148\u786E\u5B9A\u5B83100%\u662F\u6B63\u786E\u7684\u3002"),Or=f(),pt=p("p"),ni=l("\u5728\u8C03\u8BD5\u8BFE\u7A0B\u7684\u5185\u5BB9\u65F6\uFF0C\u60A8\u5E94\u8BE5\u59CB\u7EC8\u505A\u7684\u4E00\u4EF6\u4E8B\u662F\u67E5\u770B\u6A21\u578B\u7684\u89E3\u7801\u8F93\u5165\u3002 \u6211\u4EEC\u65E0\u6CD5\u7406\u89E3\u76F4\u63A5\u63D0\u4F9B\u7ED9\u5B83\u7684\u6570\u5B57\uFF0C\u6240\u4EE5\u6211\u4EEC\u5E94\u8BE5\u770B\u770B\u8FD9\u4E9B\u6570\u5B57\u4EE3\u8868\u4EC0\u4E48\u3002 \u4F8B\u5982\uFF0C\u5728\u8BA1\u7B97\u673A\u89C6\u89C9\u4E2D\uFF0C\u8FD9\u610F\u5473\u7740\u67E5\u770B\u60A8\u4F20\u9012\u7684\u56FE\u7247\u50CF\u7D20\u7684\u89E3\u7801\uFF0C\u5728\u8BED\u97F3\u4E2D\u610F\u5473\u7740\u89E3\u7801\u540E\u7684\u97F3\u9891\u6837\u672C\uFF0C\u5BF9\u4E8E\u6211\u4EEC\u7684 NLP \u793A\u4F8B\uFF0C\u8FD9\u610F\u5473\u7740\u4F7F\u7528\u6211\u4EEC\u7684\u6807\u8BB0\u5668\u89E3\u7801\u7684\u8F93\u5165\uFF1A"),Sr=f(),u(Ne.$$.fragment),Lr=f(),u(Re.$$.fragment),Ir=f(),it=p("p"),pi=l("\u6240\u4EE5\u8FD9\u4F3C\u4E4E\u662F\u6B63\u786E\u7684\u3002 \u60A8\u5E94\u8BE5\u5BF9\u8F93\u5165\u4E2D\u7684\u6240\u6709\u952E\u6267\u884C\u6B64\u64CD\u4F5C\uFF1A"),Fr=f(),u(He.$$.fragment),Gr=f(),u(Be.$$.fragment),Mr=f(),x=p("p"),ii=l("\u8BF7\u6CE8\u610F\uFF0C\u4E0E\u6A21\u578B\u63A5\u53D7\u7684\u8F93\u5165\u4E0D\u5BF9\u5E94\u7684\u952E\u5C06\u88AB\u81EA\u52A8\u4E22\u5F03\uFF0C\u56E0\u6B64\u8FD9\u91CC\u6211\u4EEC\u5C06\u4EC5\u4FDD\u7559 "),ha=p("code"),oi=l("input_ids"),fi=l("\u3001"),ba=p("code"),ci=l("attention_mask"),mi=l(" \u548C "),ka=p("code"),ui=l("label"),di=l("\uFF08\u5C06\u91CD\u547D\u540D\u4E3A "),ja=p("code"),_i=l("labels"),$i=l("\uFF09\u3002 \u8981\u4ED4\u7EC6\u68C0\u67E5\u6A21\u578B\u8F93\u5165\u7684\u5217\uFF0C\u60A8\u53EF\u4EE5\u6253\u5370\u6A21\u578B\u7684\u7C7B\uFF0C\u7136\u540E\u67E5\u770B\u5176\u6587\u6863\uFF1A"),Wr=f(),u(Ve.$$.fragment),Nr=f(),u(Ke.$$.fragment),Rr=f(),R=p("p"),hi=l("\u6240\u4EE5\u5728\u6211\u4EEC\u7684\u4F8B\u5B50\u4E2D\uFF0C\u6211\u4EEC\u5728"),Ye=p("a"),bi=l("\u5728\u8FD9\u4E2A\u9875\u9762"),ki=l("\u53EF\u4EE5\u68C0\u67E5\u4E0A\u63A5\u53D7\u7684\u53C2\u6570\u3002 "),va=p("code"),ji=l("Trainer"),vi=l(" \u4E5F\u4F1A\u8BB0\u5F55\u5B83\u4E22\u5F03\u7684\u5217\u3002"),Hr=f(),le=p("p"),wi=l("\u6211\u4EEC\u901A\u8FC7\u89E3\u7801\u68C0\u67E5\u4E86\u8F93\u5165 ID \u662F\u5426\u6B63\u786E\u3002 \u63A5\u4E0B\u6765\u662F\u68C0\u67E5 "),wa=p("code"),Ei=l("attention_mask"),yi=l("\uFF1A"),Br=f(),u(Je.$$.fragment),Vr=f(),u(Ze.$$.fragment),Kr=f(),ot=p("p"),qi=l("\u7531\u4E8E\u6211\u4EEC\u6CA1\u6709\u5728\u9884\u5904\u7406\u4E2D\u5E94\u7528\u586B\u5145\uFF0C\u8FD9\u770B\u8D77\u6765\u975E\u5E38\u81EA\u7136\u3002 \u4E3A\u786E\u4FDD\u8BE5\u6CE8\u610F\u63A9\u7801\u6CA1\u6709\u95EE\u9898\uFF0C\u8BA9\u6211\u4EEC\u68C0\u67E5\u5B83\u4E0E\u8F93\u5165 ID \u7684\u957F\u5EA6\u662F\u5426\u76F8\u540C\uFF1A"),Yr=f(),u(Qe.$$.fragment),Jr=f(),u(Xe.$$.fragment),Zr=f(),ft=p("p"),gi=l("\u90A3\u633A\u597D\u7684\uFF01 \u6700\u540E\uFF0C\u8BA9\u6211\u4EEC\u68C0\u67E5\u4E00\u4E0B\u6211\u4EEC\u7684\u6807\u7B7E\uFF1A"),Qr=f(),u(es.$$.fragment),Xr=f(),u(ss.$$.fragment),el=f(),H=p("p"),Pi=l("\u4E0E\u8F93\u5165 ID \u4E00\u6837\uFF0C\u8FD9\u662F\u4E00\u4E2A\u672C\u8EAB\u5E76\u6CA1\u6709\u771F\u6B63\u610F\u4E49\u7684\u6570\u5B57\u3002 \u6B63\u5982\u6211\u4EEC\u4E4B\u524D\u770B\u5230\u7684\uFF0C\u6574\u6570\u548C\u6807\u7B7E\u540D\u79F0\u4E4B\u95F4\u7684\u6620\u5C04\u5B58\u50A8\u5728\u6570\u636E\u96C6\u76F8\u5E94 "),Ea=p("em"),Ci=l("feature"),Ti=l(" \u7684 "),ya=p("code"),zi=l("names"),Di=l(" \u5C5E\u6027\u4E2D\uFF1A"),sl=f(),u(ts.$$.fragment),tl=f(),u(as.$$.fragment),al=f(),B=p("p"),Ai=l("\u6240\u4EE5"),qa=p("code"),xi=l("1"),Ui=l("\u8868\u793A"),ga=p("code"),Oi=l("neutral"),Si=l("\uFF0C\u8868\u793A\u6211\u4EEC\u4E0A\u9762\u770B\u5230\u7684\u4E24\u53E5\u8BDD\u5E76\u4E0D\u77DB\u76FE\uFF0C\u4E5F\u6CA1\u6709\u5305\u542B\u5173\u7CFB\u3002 \u8FD9\u4F3C\u4E4E\u662F\u6B63\u786E\u7684\uFF01"),rl=f(),ct=p("p"),Li=l("\u6211\u4EEC\u8FD9\u91CC\u6CA1\u6709\u4EE4\u724C\u7C7B\u578B ID\uFF0C\u56E0\u4E3A DistilBERT \u4E0D\u9700\u8981\u5B83\u4EEC\uFF1B \u5982\u679C\u60A8\u7684\u6A21\u578B\u4E2D\u6709\u4E00\u4E9B\uFF0C\u60A8\u8FD8\u5E94\u8BE5\u786E\u4FDD\u5B83\u4EEC\u6B63\u786E\u5339\u914D\u8F93\u5165\u4E2D\u7B2C\u4E00\u53E5\u548C\u7B2C\u4E8C\u53E5\u7684\u4F4D\u7F6E\u3002"),ll=f(),u(ne.$$.fragment),nl=f(),mt=p("p"),Ii=l("\u6211\u4EEC\u5728\u8FD9\u91CC\u53EA\u5BF9\u8BAD\u7EC3\u96C6\u8FDB\u884C\u68C0\u67E5\uFF0C\u4F46\u60A8\u5F53\u7136\u5E94\u8BE5\u4EE5\u540C\u6837\u7684\u65B9\u5F0F\u4ED4\u7EC6\u68C0\u67E5\u9A8C\u8BC1\u96C6\u548C\u6D4B\u8BD5\u96C6\u3002"),pl=f(),ut=p("p"),Fi=l("\u73B0\u5728\u6211\u4EEC\u77E5\u9053\u6211\u4EEC\u7684\u6570\u636E\u96C6\u770B\u8D77\u6765\u4E0D\u9519\uFF0C\u662F\u65F6\u5019\u68C0\u67E5\u8BAD\u7EC3\u7BA1\u9053\u7684\u4E0B\u4E00\u6B65\u4E86\u3002"),il=f(),Z=p("h3"),pe=p("a"),Pa=p("span"),u(rs.$$.fragment),Gi=f(),Ca=p("span"),Mi=l("\u4ECE datasets \u5230 dataloaders"),ol=f(),S=p("p"),Wi=l("\u8BAD\u7EC3\u7BA1\u9053\u4E2D\u53EF\u80FD\u51FA\u9519\u7684\u4E0B\u4E00\u4EF6\u4E8B\u662F\u5F53\u201CTrainer\u201D\u5C1D\u8BD5\u4ECE\u8BAD\u7EC3\u6216\u9A8C\u8BC1\u96C6\u5F62\u6210\u6279\u6B21\u65F6\u3002 \u4E00\u65E6\u4F60\u786E\u5B9A "),Ta=p("code"),Ni=l("Trainer"),Ri=l(" \u7684\u6570\u636E\u96C6\u662F\u6B63\u786E\u7684\uFF0C\u4F60\u53EF\u4EE5\u5C1D\u8BD5\u901A\u8FC7\u6267\u884C\u4EE5\u4E0B\u64CD\u4F5C\u624B\u52A8\u5F62\u6210\u4E00\u4E2A\u6279\u6B21\uFF08\u53EF\u4EE5\u5C06 "),za=p("code"),Hi=l("train"),Bi=l(" \u66FF\u6362\u4E3A "),Da=p("code"),Vi=l("eval"),Ki=l(" \u7528\u4E8E\u9A8C\u8BC1\u6570\u636E\u52A0\u8F7D\u5668\uFF09\uFF1A"),fl=f(),u(ls.$$.fragment),cl=f(),dt=p("p"),Yi=l("\u6B64\u4EE3\u7801\u521B\u5EFA\u8BAD\u7EC3\u6570\u636E\u52A0\u8F7D\u5668\uFF0C\u7136\u540E\u5BF9\u5176\u8FDB\u884C\u8FED\u4EE3\uFF0C\u5728\u7B2C\u4E00\u6B21\u8FED\u4EE3\u65F6\u505C\u6B62\u3002 \u5982\u679C\u4EE3\u7801\u6267\u884C\u6CA1\u6709\u9519\u8BEF\uFF0C\u90A3\u4E48\u60A8\u5C31\u6709\u4E86\u53EF\u4EE5\u68C0\u67E5\u7684\u7B2C\u4E00\u4E2A\u8BAD\u7EC3\u6279\u6B21\uFF0C\u5982\u679C\u4EE3\u7801\u51FA\u9519\uFF0C\u60A8\u53EF\u4EE5\u786E\u5B9A\u95EE\u9898\u51FA\u5728\u6570\u636E\u52A0\u8F7D\u5668\u4E2D\uFF0C\u5982\u4E0B\u6240\u793A\uFF1A"),ml=f(),u(ns.$$.fragment),ul=f(),_t=p("p"),Ji=l("\u68C0\u67E5trackback\u7684\u6700\u540E\u4E00\u4E2A\u5806\u6808\u7684\u8F93\u51FA\u5E94\u8BE5\u8DB3\u4EE5\u7ED9\u4F60\u4E00\u4E2A\u7EBF\u7D22\uFF0C\u4F46\u8BA9\u6211\u4EEC\u505A\u66F4\u591A\u7684\u6316\u6398\u3002 \u6279\u5904\u7406\u521B\u5EFA\u8FC7\u7A0B\u4E2D\u7684\u5927\u591A\u6570\u95EE\u9898\u662F\u7531\u4E8E\u5C06\u793A\u4F8B\u6574\u7406\u5230\u5355\u4E2A\u6279\u5904\u7406\u4E2D\u800C\u51FA\u73B0\u7684\uFF0C\u56E0\u6B64\u5728\u6709\u7591\u95EE\u65F6\u9996\u5148\u8981\u68C0\u67E5\u7684\u662F\u60A8\u7684 DataLoader \u6B63\u5728\u4F7F\u7528\u4EC0\u4E48 collate_fn\uFF1A"),dl=f(),u(ps.$$.fragment),_l=f(),u(is.$$.fragment),$l=f(),L=p("p"),Zi=l("\u6240\u4EE5\uFF0C\u76EE\u524D\u4F7F\u7528\u7684\u662F "),Aa=p("code"),Qi=l("default_data_collator"),Xi=l("\uFF0C\u4F46\u8FD9\u4E0D\u662F\u6211\u4EEC\u5728\u8FD9\u79CD\u60C5\u51B5\u4E0B\u60F3\u8981\u7684\u3002 \u6211\u4EEC\u5E0C\u671B\u5C06\u793A\u4F8B\u586B\u5145\u5230\u6279\u5904\u7406\u4E2D\u6700\u957F\u7684\u53E5\u5B50\uFF0C\u8FD9\u662F\u7531 "),xa=p("code"),eo=l("DataCollatorWithPadding"),so=l(" \u6574\u7406\u5668\u5B8C\u6210\u7684\u3002 \u800C\u8FD9\u4E2A\u6570\u636E\u6536\u96C6\u5668\u5E94\u8BE5\u662F\u9ED8\u8BA4\u88AB "),Ua=p("code"),to=l("Trainer"),ao=l(" \u4F7F\u7528\u7684\uFF0C\u4E3A\u4EC0\u4E48\u8FD9\u91CC\u6CA1\u6709\u4F7F\u7528\u5462\uFF1F"),hl=f(),I=p("p"),ro=l("\u7B54\u6848\u662F\u56E0\u4E3A\u6211\u4EEC\u6CA1\u6709\u5C06 "),Oa=p("code"),lo=l("tokenizer"),no=l(" \u4F20\u9012\u7ED9 "),Sa=p("code"),po=l("Trainer"),io=l("\uFF0C\u6240\u4EE5\u5B83\u65E0\u6CD5\u521B\u5EFA\u6211\u4EEC\u60F3\u8981\u7684 "),La=p("code"),oo=l("DataCollatorWithPadding"),fo=l("\u3002 \u5728\u5B9E\u8DF5\u4E2D\uFF0C\u60A8\u5E94\u8BE5\u660E\u786E\u5730\u4F20\u9012\u60A8\u60F3\u8981\u4F7F\u7528\u7684\u6570\u636E\u6574\u7406\u5668\uFF0C\u4EE5\u786E\u4FDD\u907F\u514D\u8FD9\u4E9B\u7C7B\u578B\u7684\u9519\u8BEF\u3002 \u8BA9\u6211\u4EEC\u8C03\u6574\u6211\u4EEC\u7684\u4EE3\u7801\u6765\u505A\u5230\u8FD9\u4E00\u70B9\uFF1A"),bl=f(),u(os.$$.fragment),kl=f(),$t=p("p"),co=l("\u597D\u6D88\u606F\uFF1F \u6211\u4EEC\u6CA1\u6709\u5F97\u5230\u4E0E\u4EE5\u524D\u76F8\u540C\u7684\u9519\u8BEF\uFF0C\u8FD9\u7EDD\u5BF9\u662F\u8FDB\u6B65\u3002 \u574F\u6D88\u606F\uFF1F \u6211\u4EEC\u5F97\u5230\u4E86\u4E00\u4E2A\u81ED\u540D\u662D\u8457\u7684 CUDA \u9519\u8BEF\uFF1A"),jl=f(),u(fs.$$.fragment),vl=f(),ht=p("p"),mo=l("\u8FD9\u5F88\u7CDF\u7CD5\uFF0C\u56E0\u4E3A CUDA \u9519\u8BEF\u901A\u5E38\u5F88\u96BE\u8C03\u8BD5\u3002 \u6211\u4EEC\u7A0D\u540E\u4F1A\u770B\u5230\u5982\u4F55\u89E3\u51B3\u8FD9\u4E2A\u95EE\u9898\uFF0C\u4F46\u9996\u5148\u8BA9\u6211\u4EEC\u5B8C\u6210\u5BF9\u6279\u5904\u7406\u521B\u5EFA\u7684\u5206\u6790\u3002"),wl=f(),bt=p("p"),uo=l("\u5982\u679C\u60A8\u786E\u5B9A\u60A8\u7684\u6570\u636E\u6574\u7406\u5668\u662F\u6B63\u786E\u7684\uFF0C\u5219\u5E94\u5C1D\u8BD5\u5C06\u5176\u5E94\u7528\u4E8E\u6570\u636E\u96C6\u7684\u51E0\u4E2A\u6837\u672C\uFF1A"),El=f(),u(cs.$$.fragment),yl=f(),U=p("p"),_o=l("\u6B64\u4EE3\u7801\u5C06\u5931\u8D25\uFF0C\u56E0\u4E3A "),Ia=p("code"),$o=l("train_dataset"),ho=l(" \u5305\u542B\u5B57\u7B26\u4E32\u5217\uFF0C"),Fa=p("code"),bo=l("Trainer"),ko=l(" \u901A\u5E38\u4F1A\u5220\u9664\u8FD9\u4E9B\u5217\u3002 \u60A8\u53EF\u4EE5\u624B\u52A8\u5220\u9664\u5B83\u4EEC\uFF0C\u6216\u8005\u5982\u679C\u60A8\u60F3\u51C6\u786E\u5730\u4FEE\u6539 "),Ga=p("code"),jo=l("Trainer"),vo=l(" \u5728\u5E55\u540E\u6240\u505A\u7684\u4E8B\u60C5\uFF0C\u60A8\u53EF\u4EE5\u8C03\u7528\u79C1\u6709\u7684 "),Ma=p("code"),wo=l("Trainer._remove_unused_columns()"),Eo=l(" \u65B9\u6CD5\u6765\u6267\u884C\u6B64\u64CD\u4F5C\uFF1A"),ql=f(),u(ms.$$.fragment),gl=f(),kt=p("p"),yo=l("\u5982\u679C\u9519\u8BEF\u4ECD\u7136\u5B58\u5728\uFF0C\u60A8\u5E94\u8BE5\u80FD\u591F\u624B\u52A8\u8C03\u8BD5\u6570\u636E\u6574\u7406\u5668\u5185\u90E8\u4EE5\u786E\u5B9A\u5177\u4F53\u7684\u95EE\u9898\u3002"),Pl=f(),jt=p("p"),qo=l("\u73B0\u5728\u6211\u4EEC\u5DF2\u7ECF\u8C03\u8BD5\u4E86\u6279\u5904\u7406\u521B\u5EFA\u8FC7\u7A0B\uFF0C\u662F\u65F6\u5019\u5C06\u6570\u636E\u4F20\u9012\u7ED9\u6A21\u578B\u4E86\uFF01"),Cl=f(),us=p("h3"),go=l("\u68C0\u67E5\u6A21\u578B"),Tl=f(),vt=p("p"),Po=l("\u60A8\u5E94\u8BE5\u80FD\u591F\u901A\u8FC7\u6267\u884C\u4EE5\u4E0B\u547D\u4EE4\u6765\u83B7\u5F97\u4E00\u4E2A\u6279\u6B21\u7684\u6570\u636E\uFF1A"),zl=f(),u(ds.$$.fragment),Dl=f(),ie=p("p"),Co=l("\u5982\u679C\u60A8\u5728notebook\u4E2D\u8FD0\u884C\u6B64\u4EE3\u7801\uFF0C\u60A8\u53EF\u80FD\u4F1A\u6536\u5230\u4E0E\u6211\u4EEC\u4E4B\u524D\u770B\u5230\u7684\u7C7B\u4F3C\u7684 CUDA \u9519\u8BEF\uFF0C\u5728\u8FD9\u79CD\u60C5\u51B5\u4E0B\uFF0C\u60A8\u9700\u8981\u91CD\u65B0\u542F\u52A8notebook\u5E76\u91CD\u65B0\u6267\u884C\u6700\u540E\u4E00\u4E2A\u7247\u6BB5\uFF0C\u800C\u4E0D\u8FD0\u884C "),Wa=p("code"),To=l("trainer.train()"),zo=l(" \u884C.\u8FD9\u662F\u5173\u4E8E CUDA \u9519\u8BEF\u7684\u7B2C\u4E8C\u4E2A\u6700\u70E6\u4EBA\u7684\u4E8B\u60C5\uFF1A\u5B83\u4EEC\u4F1A\u7834\u574F\u60A8\u7684Cuda\u5185\u6838\uFF0C\u800C\u4E14\u65E0\u6CD5\u6062\u590D\u3002\u5B83\u4EEC\u6700\u70E6\u4EBA\u7684\u4E8B\u60C5\u662F\u5B83\u4EEC\u5F88\u96BE\u8C03\u8BD5\u3002"),Al=f(),wt=p("p"),Do=l("\u8FD9\u662F\u4E3A\u4EC0\u4E48\uFF1F\u5B83\u4E0E GPU \u7684\u5DE5\u4F5C\u65B9\u5F0F\u6709\u5173\u3002\u5B83\u4EEC\u5728\u5E76\u884C\u6267\u884C\u5927\u91CF\u64CD\u4F5C\u65B9\u9762\u975E\u5E38\u6709\u6548\uFF0C\u4F46\u7F3A\u70B9\u662F\u5F53\u5176\u4E2D\u4E00\u6761\u6307\u4EE4\u5BFC\u81F4\u9519\u8BEF\u65F6\uFF0C\u60A8\u4E0D\u4F1A\u7ACB\u5373\u77E5\u9053\u3002\u53EA\u6709\u5F53\u7A0B\u5E8F\u5728 GPU \u4E0A\u8C03\u7528\u591A\u4E2A\u8FDB\u7A0B\u7684\u540C\u6B65\u5904\u7406\u65F6\uFF0C\u5B83\u624D\u4F1A\u610F\u8BC6\u5230\u51FA\u73B0\u95EE\u9898\uFF0C\u56E0\u6B64\u9519\u8BEF\u5B9E\u9645\u4E0A\u662F\u5728\u4E0E\u521B\u5EFA\u5B83\u7684\u539F\u56E0\u65E0\u5173\u7684\u5730\u65B9\u5F15\u53D1\u7684\u3002\u4F8B\u5982\uFF0C\u5982\u679C\u6211\u4EEC\u67E5\u770B\u4E4B\u524D\u7684trackback\uFF0C\u9519\u8BEF\u662F\u5728\u5411\u540E\u4F20\u9012\u671F\u95F4\u5F15\u53D1\u7684\uFF0C\u4F46\u6211\u4EEC\u4F1A\u5728\u4E00\u5206\u949F\u5185\u770B\u5230\u5B83\u5B9E\u9645\u4E0A\u6E90\u4E8E\u5411\u524D\u4F20\u9012\u4E2D\u7684\u67D0\u4E9B\u4E1C\u897F\u3002"),xl=f(),Et=p("p"),Ao=l("\u90A3\u4E48\u6211\u4EEC\u5982\u4F55\u8C03\u8BD5\u8FD9\u4E9B\u9519\u8BEF\u5462\uFF1F\u7B54\u6848\u5F88\u7B80\u5355\uFF1A\u6211\u4EEC\u6CA1\u6709\u3002\u9664\u975E\u60A8\u7684 CUDA \u9519\u8BEF\u662F\u5185\u5B58\u4E0D\u8DB3\u9519\u8BEF\uFF08\u8FD9\u610F\u5473\u7740\u60A8\u7684 GPU \u4E2D\u6CA1\u6709\u8DB3\u591F\u7684\u5185\u5B58\uFF09\uFF0C\u5426\u5219\u60A8\u5E94\u8BE5\u59CB\u7EC8\u8FD4\u56DE CPU \u8FDB\u884C\u8C03\u8BD5\u3002"),Ul=f(),yt=p("p"),xo=l("\u4E3A\u6B64\uFF0C\u6211\u4EEC\u53EA\u9700\u5C06\u6A21\u578B\u653E\u56DE CPU \u4E0A\u5E76\u5728\u6211\u4EEC\u7684\u4E00\u6279\u6570\u636E\u4E2D\u8C03\u7528\u5B83\u2014\u2014\u201CDataLoader\u201D\u8FD4\u56DE\u7684\u90A3\u6279\u6570\u636E\u5C1A\u672A\u79FB\u52A8\u5230 GPU\uFF1A"),Ol=f(),u(_s.$$.fragment),Sl=f(),u($s.$$.fragment),Ll=f(),qt=p("p"),Uo=l("\u6240\u4EE5\uFF0C\u601D\u8DEF\u8D8A\u6765\u8D8A\u6E05\u6670\u4E86\u3002 \u6211\u4EEC\u73B0\u5728\u5728\u635F\u5931\u8BA1\u7B97\u4E2D\u6CA1\u6709\u51FA\u73B0 CUDA \u9519\u8BEF\uFF0C\u800C\u662F\u6709\u4E00\u4E2A\u201CIndexError\u201D\uFF08\u56E0\u6B64\u4E0E\u6211\u4EEC\u4E4B\u524D\u6240\u8BF4\u7684\u53CD\u5411\u4F20\u64AD\u65E0\u5173\uFF09\u3002 \u66F4\u51C6\u786E\u5730\u8BF4\uFF0C\u6211\u4EEC\u53EF\u4EE5\u770B\u5230\u662FTarget 2 \u9020\u6210\u4E86\u9519\u8BEF\uFF0C\u6240\u4EE5\u8FD9\u662F\u68C0\u67E5\u6A21\u578B\u6807\u7B7E\u6570\u91CF\u7684\u597D\u65F6\u673A\uFF1A"),Il=f(),u(hs.$$.fragment),Fl=f(),u(bs.$$.fragment),Gl=f(),gt=p("p"),Oo=l("\u6709\u4E24\u4E2A\u6807\u7B7E\uFF0C\u53EA\u5141\u8BB8 0 \u548C 1 \u4F5C\u4E3A\u76EE\u6807\uFF0C\u4F46\u662F\u6839\u636E\u9519\u8BEF\u4FE1\u606F\u6211\u4EEC\u5F97\u5230\u4E00\u4E2A 2\u3002\u5F97\u5230\u4E00\u4E2A 2 \u5B9E\u9645\u4E0A\u662F\u6B63\u5E38\u7684\uFF1A\u5982\u679C\u6211\u4EEC\u8BB0\u5F97\u6211\u4EEC\u4E4B\u524D\u63D0\u53D6\u7684\u6807\u7B7E\u540D\u79F0\uFF0C\u6709\u4E09\u4E2A\uFF0C\u6240\u4EE5\u6211\u4EEC\u6709\u7D22\u5F15 0 , 1 \u548C 2 \u5728\u6211\u4EEC\u7684\u6570\u636E\u96C6\u4E2D\u3002 \u95EE\u9898\u662F\u6211\u4EEC\u6CA1\u6709\u544A\u8BC9\u6211\u4EEC\u7684\u6A21\u578B\uFF0C\u5B83\u5E94\u8BE5\u521B\u5EFA\u4E09\u4E2A\u6807\u7B7E\u3002 \u6240\u4EE5\u8BA9\u6211\u4EEC\u89E3\u51B3\u8FD9\u4E2A\u95EE\u9898\uFF01"),Ml=f(),u(ks.$$.fragment),Wl=f(),oe=p("p"),So=l("\u6211\u4EEC\u8FD8\u6CA1\u6709\u5305\u542B "),Na=p("code"),Lo=l("trainer.train()"),Io=l(" \u884C\uFF0C\u4EE5\u4FBF\u82B1\u65F6\u95F4\u68C0\u67E5\u4E00\u5207\u662F\u5426\u6B63\u5E38\u3002 \u5982\u679C\u6211\u4EEC\u8BF7\u6C42\u4E00\u4E2A\u6279\u6B21\u7684\u6570\u636E\u5E76\u5C06\u5176\u4F20\u9012\u7ED9\u6211\u4EEC\u7684\u6A21\u578B\uFF0C\u5B83\u73B0\u5728\u53EF\u4EE5\u6B63\u5E38\u5DE5\u4F5C\u4E86\uFF01"),Nl=f(),u(js.$$.fragment),Rl=f(),Pt=p("p"),Fo=l("\u4E0B\u4E00\u6B65\u662F\u56DE\u5230 GPU \u5E76\u68C0\u67E5\u4E00\u5207\u662F\u5426\u4ECD\u7136\u6709\u6548\uFF1A"),Hl=f(),u(vs.$$.fragment),Bl=f(),Ct=p("p"),Go=l("\u5982\u679C\u4ECD\u7136\u51FA\u73B0\u9519\u8BEF\uFF0C\u8BF7\u786E\u4FDD\u91CD\u65B0\u542F\u52A8notebook\u5E76\u4EC5\u6267\u884C\u811A\u672C\u7684\u6700\u540E\u4E00\u4E2A\u7248\u672C\u3002"),Vl=f(),ws=p("h3"),Mo=l("\u6267\u884C\u4E00\u4E2A\u4F18\u5316\u5668\u6B65\u9AA4"),Kl=f(),Tt=p("p"),Wo=l("\u73B0\u5728\u6211\u4EEC\u77E5\u9053\u6211\u4EEC\u53EF\u4EE5\u6784\u5EFA\u5B9E\u9645\u901A\u8FC7\u6A21\u578B\u68C0\u67E5\u7684\u6210\u6279\u6B21\u7684\u6570\u636E\uFF0C\u6211\u4EEC\u5DF2\u7ECF\u4E3A\u8BAD\u7EC3\u7BA1\u9053\u7684\u4E0B\u4E00\u6B65\u505A\u597D\u51C6\u5907\uFF1A\u8BA1\u7B97\u68AF\u5EA6\u5E76\u6267\u884C\u4F18\u5316\u6B65\u9AA4\u3002"),Yl=f(),fe=p("p"),No=l("\u7B2C\u4E00\u90E8\u5206\u53EA\u662F\u5728 loss \u4E0A\u8C03\u7528 "),Ra=p("code"),Ro=l("backward()"),Ho=l(" \u65B9\u6CD5\uFF1A"),Jl=f(),u(Es.$$.fragment),Zl=f(),zt=p("p"),Bo=l("\u5728\u8FD9\u4E2A\u9636\u6BB5\u5F88\u5C11\u51FA\u73B0\u9519\u8BEF\uFF0C\u4F46\u5982\u679C\u786E\u5B9E\u51FA\u73B0\u9519\u8BEF\uFF0C\u8BF7\u8FD4\u56DE CPU \u4EE5\u83B7\u53D6\u6709\u7528\u7684\u9519\u8BEF\u6D88\u606F\u3002"),Ql=f(),V=p("p"),Vo=l("\u8981\u6267\u884C\u4F18\u5316\u6B65\u9AA4\uFF0C\u6211\u4EEC\u53EA\u9700\u8981\u521B\u5EFA "),Ha=p("code"),Ko=l("optimizer"),Yo=l(" \u5E76\u8C03\u7528\u5B83\u7684 "),Ba=p("code"),Jo=l("step()"),Zo=l(" \u65B9\u6CD5\uFF1A"),Xl=f(),u(ys.$$.fragment),en=f(),ce=p("p"),Qo=l("\u540C\u6837\uFF0C\u5982\u679C\u60A8\u5728 "),Va=p("code"),Xo=l("Trainer"),ef=l(" \u4E2D\u4F7F\u7528\u9ED8\u8BA4\u4F18\u5316\u5668\uFF0C\u5219\u5728\u6B64\u9636\u6BB5\u60A8\u4E0D\u5E94\u8BE5\u6536\u5230\u9519\u8BEF\uFF0C\u4F46\u5982\u679C\u60A8\u6709\u81EA\u5B9A\u4E49\u4F18\u5316\u5668\uFF0C\u5219\u53EF\u80FD\u4F1A\u51FA\u73B0\u4E00\u4E9B\u95EE\u9898\u9700\u8981\u5728\u8FD9\u91CC\u8C03\u8BD5\u3002 \u5982\u679C\u60A8\u5728\u6B64\u9636\u6BB5\u9047\u5230\u5947\u602A\u7684 CUDA \u9519\u8BEF\uFF0C\u8BF7\u4E0D\u8981\u5FD8\u8BB0\u8FD4\u56DE CPU\u3002 \u8BF4\u5230 CUDA \u9519\u8BEF\uFF0C\u524D\u9762\u6211\u4EEC\u63D0\u5230\u4E86\u4E00\u4E2A\u7279\u6B8A\u60C5\u51B5\u3002 \u73B0\u5728\u8BA9\u6211\u4EEC\u6765\u770B\u770B\u3002"),sn=f(),Q=p("h3"),me=p("a"),Ka=p("span"),u(qs.$$.fragment),sf=f(),Ya=p("span"),tf=l("\u5904\u7406 CUDA out-of-memory\u9519\u8BEF"),tn=f(),ue=p("p"),af=l("\u6BCF\u5F53\u60A8\u6536\u5230\u4EE5"),Ja=p("code"),rf=l("RuntimeError: CUDA out of memory"),lf=l("\u5F00\u5934\u7684\u9519\u8BEF\u6D88\u606F\u65F6\uFF0C\u8FD9\u8868\u660E\u60A8\u7684 GPU \u5185\u5B58\u4E0D\u8DB3\u3002 \u8FD9\u4E0E\u60A8\u7684\u4EE3\u7801\u6CA1\u6709\u76F4\u63A5\u5173\u8054\uFF0C\u5E76\u4E14\u5B83\u53EF\u80FD\u53D1\u751F\u5728\u8FD0\u884C\u826F\u597D\u7684\u4EE3\u7801\u4E2D\u3002 \u6B64\u9519\u8BEF\u610F\u5473\u7740\u60A8\u8BD5\u56FE\u5728 GPU \u7684\u5185\u90E8\u5B58\u50A8\u5668\u4E2D\u653E\u5165\u592A\u591A\u4E1C\u897F\uFF0C\u8FD9\u5BFC\u81F4\u4E86\u9519\u8BEF\u3002 \u4E0E\u5176\u4ED6 CUDA \u9519\u8BEF\u4E00\u6837\uFF0C\u60A8\u9700\u8981\u91CD\u65B0\u542F\u52A8\u5185\u6838\u624D\u80FD\u518D\u6B21\u8FD0\u884C\u8BAD\u7EC3\u3002"),an=f(),Dt=p("p"),nf=l("\u8981\u89E3\u51B3\u8FD9\u4E2A\u95EE\u9898\uFF0C\u60A8\u53EA\u9700\u8981\u4F7F\u7528\u66F4\u5C11\u7684 GPU \u7A7A\u95F4\u2014\u2014\u8FD9\u5F80\u5F80\u8BF4\u8D77\u6765\u5BB9\u6613\u505A\u8D77\u6765\u96BE\u3002 \u9996\u5148\uFF0C\u786E\u4FDD\u60A8\u6CA1\u6709\u540C\u65F6\u5728 GPU \u4E0A\u8FD0\u884C\u4E24\u4E2A\u6A21\u578B\uFF08\u5F53\u7136\uFF0C\u9664\u975E\u60A8\u7684\u95EE\u9898\u9700\u8981\u8FD9\u6837\u505A\uFF09\u3002 \u7136\u540E\uFF0C\u60A8\u53EF\u80FD\u5E94\u8BE5\u51CF\u5C11batch\u7684\u5927\u5C0F\uFF0C\u56E0\u4E3A\u5B83\u76F4\u63A5\u5F71\u54CD\u6A21\u578B\u7684\u6240\u6709\u4E2D\u95F4\u8F93\u51FA\u7684\u5927\u5C0F\u53CA\u5176\u68AF\u5EA6\u3002 \u5982\u679C\u95EE\u9898\u4ECD\u7136\u5B58\u5728\uFF0C\u8BF7\u8003\u8651\u4F7F\u7528\u8F83\u5C0F\u7248\u672C\u7684\u6A21\u578B\u3002"),rn=f(),u(de.$$.fragment),ln=f(),gs=p("h3"),pf=l("\u8BC4\u4F30\u6A21\u578B"),nn=f(),_e=p("p"),of=l("\u73B0\u5728\u6211\u4EEC\u5DF2\u7ECF\u89E3\u51B3\u4E86\u4EE3\u7801\u7684\u6240\u6709\u95EE\u9898\uFF0C\u4E00\u5207\u90FD\u5F88\u5B8C\u7F8E\uFF0C\u8BAD\u7EC3\u5E94\u8BE5\u53EF\u4EE5\u987A\u5229\u8FDB\u884C\uFF0C\u5BF9\u5427\uFF1F \u6CA1\u90A3\u4E48\u5FEB\uFF01 \u5982\u679C\u4F60\u8FD0\u884C "),Za=p("code"),ff=l("trainer.train()"),cf=l(" \u547D\u4EE4\uFF0C\u4E00\u5F00\u59CB\u4E00\u5207\u770B\u8D77\u6765\u90FD\u4E0D\u9519\uFF0C\u4F46\u8FC7\u4E00\u4F1A\u513F\u4F60\u4F1A\u5F97\u5230\u4EE5\u4E0B\u4FE1\u606F\uFF1A"),pn=f(),u(Ps.$$.fragment),on=f(),u(Cs.$$.fragment),fn=f(),At=p("p"),mf=l("\u60A8\u5C06\u610F\u8BC6\u5230\u6B64\u9519\u8BEF\u51FA\u73B0\u5728\u8BC4\u4F30\u9636\u6BB5\uFF0C\u56E0\u6B64\u8FD9\u662F\u6211\u4EEC\u9700\u8981\u8C03\u8BD5\u7684\u6700\u540E\u4E00\u4EF6\u4E8B\u3002"),cn=f(),$e=p("p"),uf=l("\u60A8\u53EF\u4EE5\u50CF\u8FD9\u6837\u5728\u8BAD\u7EC3\u4E2D\u72EC\u7ACB\u8FD0\u884C"),Qa=p("code"),df=l("Trainer"),_f=l("\u7684\u8BC4\u4F30\u5FAA\u73AF\uFF1A"),mn=f(),u(Ts.$$.fragment),un=f(),u(zs.$$.fragment),dn=f(),u(he.$$.fragment),_n=f(),xt=p("p"),$f=l("\u5728\u5C1D\u8BD5\u8C03\u8BD5\u8BC4\u4F30\u5FAA\u73AF\u4E2D\u7684\u95EE\u9898\u4E4B\u524D\uFF0C\u60A8\u5E94\u8BE5\u9996\u5148\u786E\u4FDD\u60A8\u5DF2\u7ECF\u67E5\u770B\u4E86\u6570\u636E\uFF0C\u80FD\u591F\u6B63\u786E\u5730\u5F62\u6210\u6279\u5904\u7406\uFF0C\u5E76\u4E14\u53EF\u4EE5\u5728\u5176\u4E0A\u8FD0\u884C\u60A8\u7684\u6A21\u578B\u3002 \u6211\u4EEC\u5DF2\u7ECF\u5B8C\u6210\u4E86\u6240\u6709\u8FD9\u4E9B\u6B65\u9AA4\uFF0C\u56E0\u6B64\u53EF\u4EE5\u6267\u884C\u4EE5\u4E0B\u4EE3\u7801\u800C\u4E0D\u4F1A\u51FA\u9519\uFF1A"),$n=f(),u(Ds.$$.fragment),hn=f(),Ut=p("p"),hf=l("\u7A0D\u7B49\u4E00\u4F1A\u513F\uFF0C\u9519\u8BEF\u51FA\u73B0\uFF0C\u5728\u8BC4\u4F30\u9636\u6BB5\u7ED3\u675F\u65F6\uFF0C\u5982\u679C\u6211\u4EEC\u67E5\u770Btrackback\uFF0C\u6211\u4EEC\u4F1A\u770B\u5230\uFF1A"),bn=f(),u(As.$$.fragment),kn=f(),K=p("p"),bf=l("\u8FD9\u544A\u8BC9\u6211\u4EEC\u9519\u8BEF\u6E90\u81EA "),Xa=p("code"),kf=l("datasets/metric.py"),jf=l(" \u6A21\u5757\u2014\u2014\u6240\u4EE5\u8FD9\u662F\u6211\u4EEC\u7684 "),er=p("code"),vf=l("compute_metrics()"),wf=l(" \u51FD\u6570\u7684\u95EE\u9898\u3002 \u5B83\u9700\u8981\u4E00\u4E2A\u5E26\u6709 logits \u548C\u6807\u7B7E\u7684\u5143\u7EC4\u4F5C\u4E3A NumPy \u6570\u7EC4\uFF0C\u6240\u4EE5\u8BA9\u6211\u4EEC\u5C1D\u8BD5\u8F93\u5165\u5B83\uFF1A"),jn=f(),u(xs.$$.fragment),vn=f(),u(Us.$$.fragment),wn=f(),Ot=p("p"),Ef=l("\u6211\u4EEC\u5F97\u5230\u540C\u6837\u7684\u9519\u8BEF\uFF0C\u6240\u4EE5\u95EE\u9898\u80AF\u5B9A\u51FA\u5728\u90A3\u4E2A\u51FD\u6570\u4E0A\u3002 \u5982\u679C\u6211\u4EEC\u56DE\u987E\u5B83\u7684\u4EE3\u7801\uFF0C\u6211\u4EEC\u4F1A\u53D1\u73B0\u5B83\u53EA\u662F\u5C06\u201C\u9884\u6D4B\u201D\u548C\u201C\u771F\u5B9E\u7684\u6807\u7B7E\u201D\u8F6C\u53D1\u5230\u201Cmetric.compute()\u201D\u3002 \u90A3\u4E48\u8FD9\u79CD\u65B9\u6CD5\u6709\u95EE\u9898\u5417\uFF1F \u5E76\u4E0D\u771F\u5730\u3002 \u8BA9\u6211\u4EEC\u5FEB\u901F\u6D4F\u89C8\u4E00\u4E0B\u5F62\u72B6\uFF1A"),En=f(),u(Os.$$.fragment),yn=f(),u(Ss.$$.fragment),qn=f(),be=p("p"),yf=l("\u6211\u4EEC\u7684\u9884\u6D4B\u4ECD\u7136\u662F logits\uFF0C\u800C\u4E0D\u662F\u5B9E\u9645\u7684\u9884\u6D4B\uFF0C\u8FD9\u5C31\u662Fmetrics\u8FD4\u56DE\u8FD9\u4E2A\uFF08\u6709\u70B9\u6A21\u7CCA\uFF09\u9519\u8BEF\u7684\u539F\u56E0\u3002 \u4FEE\u590D\u5F88\u7B80\u5355\uFF1B \u6211\u4EEC\u53EA\u9700\u8981\u5728 "),sr=p("code"),qf=l("compute_metrics()"),gf=l(" \u51FD\u6570\u4E2D\u6DFB\u52A0\u4E00\u4E2A argmax\uFF1A"),gn=f(),u(Ls.$$.fragment),Pn=f(),u(Is.$$.fragment),Cn=f(),St=p("p"),Pf=l("\u73B0\u5728\u6211\u4EEC\u7684\u9519\u8BEF\u5DF2\u4FEE\u590D\uFF01 \u8FD9\u662F\u6700\u540E\u4E00\u4E2A\uFF0C\u6240\u4EE5\u6211\u4EEC\u7684\u811A\u672C\u73B0\u5728\u5C06\u6B63\u786E\u8BAD\u7EC3\u6A21\u578B\u3002"),Tn=f(),Lt=p("p"),Cf=l("\u4F5C\u4E3A\u53C2\u8003\uFF0C\u8FD9\u91CC\u662F\u5B8C\u5168\u4FEE\u6B63\u597D\u7684\u811A\u672C\uFF1A"),zn=f(),u(Fs.$$.fragment),Dn=f(),It=p("p"),Tf=l("\u5728\u8FD9\u79CD\u60C5\u51B5\u4E0B\uFF0C\u5982\u679C\u6CA1\u6709\u66F4\u591A\u9519\u8BEF\uFF0C\u6211\u4EEC\u7684\u811A\u672C\u5C06\u5FAE\u8C03\u4E00\u4E2A\u5E94\u8BE5\u7ED9\u51FA\u5408\u7406\u7ED3\u679C\u7684\u6A21\u578B\u3002 \u4F46\u662F\uFF0C\u5982\u679C\u8BAD\u7EC3\u6CA1\u6709\u4EFB\u4F55\u9519\u8BEF\uFF0C\u800C\u8BAD\u7EC3\u51FA\u6765\u7684\u6A21\u578B\u6839\u672C\u8868\u73B0\u4E0D\u4F73\uFF0C\u6211\u4EEC\u8BE5\u600E\u4E48\u529E\uFF1F \u8FD9\u662F\u673A\u5668\u5B66\u4E60\u4E2D\u6700\u96BE\u7684\u90E8\u5206\uFF0C\u6211\u4EEC\u5C06\u5411\u60A8\u5C55\u793A\u4E00\u4E9B\u53EF\u4EE5\u63D0\u4F9B\u5E2E\u52A9\u7684\u6280\u672F\u3002"),An=f(),u(ke.$$.fragment),xn=f(),Gs=p("h2"),zf=l("\u5728\u8BAD\u7EC3\u671F\u95F4\u8C03\u8BD5\u9759\u9ED8\uFF08\u6CA1\u6709\u4EFB\u4F55\u9519\u8BEF\u63D0\u793A\uFF09\u9519\u8BEF"),Un=f(),Ft=p("p"),Df=l("\u6211\u4EEC\u53EF\u4EE5\u505A\u4E9B\u4EC0\u4E48\u6765\u8C03\u8BD5\u4E00\u4E2A\u6CA1\u6709\u9519\u8BEF\u5730\u5B8C\u6210\u4F46\u6CA1\u6709\u5F97\u5230\u597D\u7684\u7ED3\u679C\u7684\u8BAD\u7EC3\uFF1F \u6211\u4EEC\u4F1A\u5728\u8FD9\u91CC\u7ED9\u4F60\u4E00\u4E9B\u63D0\u793A\uFF0C\u4F46\u8BF7\u6CE8\u610F\uFF0C\u8FD9\u79CD\u8C03\u8BD5\u662F\u673A\u5668\u5B66\u4E60\u4E2D\u6700\u96BE\u7684\u90E8\u5206\uFF0C\u5E76\u4E14\u6CA1\u6709\u795E\u5947\u7684\u7B54\u6848\u3002"),On=f(),Ms=p("h3"),Af=l("\u68C0\u67E5\u60A8\u7684\u6570\u636E\uFF08\u518D\u6B21\uFF01\uFF09"),Sn=f(),Gt=p("p"),xf=l("\u53EA\u6709\u5728\u7406\u8BBA\u4E0A\u53EF\u4EE5\u4ECE\u60A8\u7684\u6570\u636E\u4E2D\u5B66\u5230\u4EFB\u4F55\u4E1C\u897F\u65F6\uFF0C\u60A8\u7684\u6A21\u578B\u624D\u4F1A\u5B66\u5230\u4E00\u4E9B\u4E1C\u897F\u3002 \u5982\u679C\u5B58\u5728\u635F\u574F\u6570\u636E\u7684\u9519\u8BEF\u6216\u6807\u7B7E\u662F\u968F\u673A\u5C5E\u6027\u7684\uFF0C\u90A3\u4E48\u60A8\u5F88\u53EF\u80FD\u4E0D\u4F1A\u5728\u6570\u636E\u96C6\u4E0A\u83B7\u5F97\u4EFB\u4F55\u77E5\u8BC6\u3002 \u56E0\u6B64\uFF0C\u59CB\u7EC8\u9996\u5148\u4ED4\u7EC6\u68C0\u67E5\u60A8\u7684\u89E3\u7801\u8F93\u5165\u548C\u6807\u7B7E\uFF0C\u7136\u540E\u95EE\u81EA\u5DF1\u4EE5\u4E0B\u95EE\u9898\uFF1A"),Ln=f(),F=p("ul"),tr=p("li"),Uf=l("\u89E3\u7801\u540E\u7684\u6570\u636E\u662F\u5426\u53EF\u4EE5\u7406\u89E3\uFF1F"),Of=f(),ar=p("li"),Sf=l("\u4F60\u8BA4\u540C\u8FD9\u4E9B\u6807\u7B7E\u5417\uFF1F"),Lf=f(),rr=p("li"),If=l("\u6709\u6CA1\u6709\u4E00\u4E2A\u6807\u7B7E\u6BD4\u5176\u4ED6\u6807\u7B7E\u66F4\u5E38\u89C1\uFF1F"),Ff=f(),lr=p("li"),Gf=l("\u5982\u679C\u6A21\u578B\u9884\u6D4B\u968F\u673A\u7684\u7B54\u6848/\u603B\u662F\u76F8\u540C\u7684\u7B54\u6848\uFF0C\u90A3\u4E48loss/\u8BC4\u4F30\u6307\u6807\u5E94\u8BE5\u662F\u591A\u5C11\uFF1F"),In=f(),u(je.$$.fragment),Fn=f(),Mt=p("p"),Mf=l("\u67E5\u770B\u60A8\u7684\u6570\u636E\u540E\uFF0C\u67E5\u770B\u6A21\u578B\u7684\u4E00\u4E9B\u9884\u6D4B\u5E76\u5BF9\u5176\u8FDB\u884C\u89E3\u7801\u3002 \u5982\u679C\u6A21\u578B\u603B\u662F\u9884\u6D4B\u540C\u6837\u7684\u4E8B\u60C5\uFF0C\u90A3\u53EF\u80FD\u662F\u56E0\u4E3A\u4F60\u7684\u6570\u636E\u96C6\u504F\u5411\u4E00\u4E2A\u7C7B\u522B\uFF08\u9488\u5BF9\u5206\u7C7B\u95EE\u9898\uFF09\uFF1B \u8FC7\u91C7\u6837\u7A00\u6709\u7C7B\u7B49\u6280\u672F\u53EF\u80FD\u4F1A\u6709\u6240\u5E2E\u52A9\u3002"),Gn=f(),Wt=p("p"),Wf=l("\u5982\u679C\u60A8\u5728\u521D\u59CB\u6A21\u578B\u4E0A\u83B7\u5F97\u7684loss/\u8BC4\u4F30\u6307\u6807\u4E0E\u60A8\u671F\u671B\u7684\u968F\u673A\u9884\u6D4B\u7684loss/\u8BC4\u4F30\u6307\u6807\u975E\u5E38\u4E0D\u540C\uFF0C\u8BF7\u4ED4\u7EC6\u68C0\u67E5\u60A8\u7684loss\u6216\u8BC4\u4F30\u6307\u6807\u7684\u8BA1\u7B97\u65B9\u5F0F\uFF0C\u56E0\u4E3A\u90A3\u91CC\u53EF\u80FD\u5B58\u5728\u9519\u8BEF\u3002 \u5982\u679C\u60A8\u4F7F\u7528\u6700\u540E\u6DFB\u52A0\u7684\u591A\u4E2Aloss\uFF0C\u8BF7\u786E\u4FDD\u5B83\u4EEC\u5177\u6709\u76F8\u540C\u7684\u89C4\u6A21\u3002"),Mn=f(),Nt=p("p"),Nf=l("\u5F53\u60A8\u786E\u5B9A\u60A8\u7684\u6570\u636E\u662F\u5B8C\u7F8E\u7684\u65F6\uFF0C\u60A8\u53EF\u4EE5\u901A\u8FC7\u4E00\u4E2A\u7B80\u5355\u7684\u6D4B\u8BD5\u6765\u67E5\u770B\u6A21\u578B\u662F\u5426\u80FD\u591F\u5BF9\u5176\u8FDB\u884C\u8BAD\u7EC3\u3002"),Wn=f(),Ws=p("h3"),Rf=l("\u5728\u4E00\u6279\u4E0A\u8FC7\u5EA6\u62DF\u5408\u4F60\u7684\u6A21\u578B"),Nn=f(),Rt=p("p"),Hf=l("\u8FC7\u5EA6\u62DF\u5408\u901A\u5E38\u662F\u6211\u4EEC\u5728\u8BAD\u7EC3\u65F6\u5C3D\u91CF\u907F\u514D\u7684\u4E8B\u60C5\uFF0C\u56E0\u4E3A\u8FD9\u610F\u5473\u7740\u6A21\u578B\u6CA1\u6709\u5B66\u4E60\u8BC6\u522B\u6211\u4EEC\u60F3\u8981\u7684\u4E00\u822C\u7279\u5F81\uFF0C\u800C\u53EA\u662F\u8BB0\u4F4F\u4E86\u8BAD\u7EC3\u6837\u672C\u3002 \u5728\u8FD9\u79CD\u60C5\u51B5\u4E0B\uFF0C\u4E00\u904D\u53C8\u4E00\u904D\u5730\u5C1D\u8BD5\u5728\u4E00\u4E2A\u6279\u6B21\u4E0A\u8BAD\u7EC3\u60A8\u7684\u6A21\u578B\u662F\u4E00\u4E2A\u5F88\u597D\u7684\u6D4B\u8BD5\uFF0C\u53EF\u4EE5\u68C0\u67E5\u60A8\u7684\u95EE\u9898\u662F\u5426\u53EF\u4EE5\u901A\u8FC7\u60A8\u5C1D\u8BD5\u8BAD\u7EC3\u7684\u6A21\u578B\u6765\u89E3\u51B3\u3002 \u5B83\u8FD8\u5C06\u5E2E\u52A9\u60A8\u67E5\u770B\u60A8\u7684\u521D\u59CB\u5B66\u4E60\u7387\u662F\u5426\u592A\u9AD8\u3002"),Rn=f(),ve=p("p"),Bf=l("\u4E00\u65E6\u4F60\u5B9A\u4E49\u4E86\u4F60\u7684 "),nr=p("code"),Vf=l("Trainer"),Kf=l(" \u4E4B\u540E\uFF0C\u8FD9\u6837\u505A\u771F\u7684\u5F88\u5BB9\u6613\uFF1B \u53EA\u9700\u83B7\u53D6\u4E00\u6279\u8BAD\u7EC3\u6570\u636E\uFF0C\u7136\u540E\u4EC5\u4F7F\u7528\u8BE5\u6279\u6B21\u8FD0\u884C\u4E00\u4E2A\u5C0F\u578B\u624B\u52A8\u8BAD\u7EC3\u5FAA\u73AF\uFF0C\u5927\u7EA6 20 \u6B65\uFF1A"),Hn=f(),u(Ns.$$.fragment),Bn=f(),u(we.$$.fragment),Vn=f(),Ht=p("p"),Yf=l("\u751F\u6210\u7684\u6A21\u578B\u5728\u4E00\u4E2A\u201C\u6279\u6B21\u201D\u4E0A\u5E94\u8BE5\u6709\u63A5\u8FD1\u5B8C\u7F8E\u7684\u7ED3\u679C\u3002 \u8BA9\u6211\u4EEC\u8BA1\u7B97\u7ED3\u679C\u9884\u6D4B\u7684\u6307\u6807\uFF1A"),Kn=f(),u(Rs.$$.fragment),Yn=f(),u(Hs.$$.fragment),Jn=f(),Bt=p("p"),Jf=l("100% \u51C6\u786E\u7387\uFF0C\u73B0\u5728\u8FD9\u662F\u4E00\u4E2A\u5F88\u597D\u7684\u8FC7\u62DF\u5408\u793A\u4F8B\uFF08\u8FD9\u610F\u5473\u7740\u5982\u679C\u4F60\u5728\u4EFB\u4F55\u5176\u4ED6\u53E5\u5B50\u4E0A\u5C1D\u8BD5\u4F60\u7684\u6A21\u578B\uFF0C\u5B83\u5F88\u53EF\u80FD\u4F1A\u7ED9\u4F60\u4E00\u4E2A\u9519\u8BEF\u7684\u7B54\u6848\uFF09\uFF01"),Zn=f(),Vt=p("p"),Zf=l("\u5982\u679C\u4F60\u6CA1\u6709\u8BBE\u6CD5\u8BA9\u4F60\u7684\u6A21\u578B\u83B7\u5F97\u8FD9\u6837\u7684\u5B8C\u7F8E\u7ED3\u679C\uFF0C\u8FD9\u610F\u5473\u7740\u4F60\u6784\u5EFA\u95EE\u9898\u6216\u6570\u636E\u7684\u65B9\u5F0F\u6709\u95EE\u9898\uFF0C\u6240\u4EE5\u4F60\u5E94\u8BE5\u4FEE\u590D\u5B83\u3002 \u53EA\u6709\u5F53\u4F60\u53EF\u4EE5\u901A\u8FC7\u8FC7\u62DF\u5408\u6D4B\u8BD5\u65F6\uFF0C\u4F60\u624D\u80FD\u786E\u5B9A\u4F60\u7684\u6A21\u578B\u5B9E\u9645\u4E0A\u53EF\u4EE5\u5B66\u5230\u4E00\u4E9B\u4E1C\u897F\u3002"),Qn=f(),u(Ee.$$.fragment),Xn=f(),Bs=p("h3"),Qf=l("\u5728\u4F60\u6709\u7B2C\u4E00\u4E2A\u57FA\u7EBF\u4E4B\u524D\u4E0D\u8981\u8C03\u6574\u4EFB\u4F55\u4E1C\u897F"),ep=f(),ye=p("p"),Xf=l("\u8D85\u53C2\u6570\u8C03\u4F18\u603B\u662F\u88AB\u5F3A\u8C03\u4E3A\u673A\u5668\u5B66\u4E60\u4E2D\u6700\u96BE\u7684\u90E8\u5206\uFF0C\u4F46\u8FD9\u53EA\u662F\u5E2E\u52A9\u60A8\u5728\u6307\u6807\u4E0A\u6709\u6240\u6536\u83B7\u7684\u6700\u540E\u4E00\u6B65\u3002 \u5927\u591A\u6570\u60C5\u51B5\u4E0B\uFF0C"),pr=p("code"),ec=l("Trainer"),sc=l(" \u7684\u9ED8\u8BA4\u8D85\u53C2\u6570\u53EF\u4EE5\u5F88\u597D\u5730\u4E3A\u60A8\u63D0\u4F9B\u826F\u597D\u7684\u7ED3\u679C\uFF0C\u56E0\u6B64\u5728\u60A8\u83B7\u5F97\u8D85\u51FA\u6570\u636E\u96C6\u57FA\u7EBF\u7684\u4E1C\u897F\u4E4B\u524D\uFF0C\u4E0D\u8981\u5F00\u59CB\u8FDB\u884C\u8017\u65F6\u4E14\u6602\u8D35\u7684\u8D85\u53C2\u6570\u641C\u7D22 ."),sp=f(),Kt=p("p"),tc=l("\u4E00\u65E6\u4F60\u6709\u4E00\u4E2A\u8DB3\u591F\u597D\u7684\u6A21\u578B\uFF0C\u4F60\u5C31\u53EF\u4EE5\u5F00\u59CB\u7A0D\u5FAE\u8C03\u6574\u4E00\u4E0B\u3002 \u4E0D\u8981\u5C1D\u8BD5\u4F7F\u7528\u4E0D\u540C\u7684\u8D85\u53C2\u6570\u542F\u52A8\u4E00\u5343\u6B21\u8FD0\u884C\uFF0C\u800C\u662F\u6BD4\u8F83\u4E00\u4E2A\u8D85\u53C2\u6570\u7684\u4E0D\u540C\u503C\u7684\u51E0\u6B21\u8FD0\u884C\uFF0C\u4EE5\u4E86\u89E3\u54EA\u4E2A\u5F71\u54CD\u6700\u5927\u3002"),tp=f(),Yt=p("p"),ac=l("\u5982\u679C\u60A8\u6B63\u5728\u8C03\u6574\u6A21\u578B\u672C\u8EAB\uFF0C\u4E0D\u8981\u5C1D\u8BD5\u4EFB\u4F55\u60A8\u65E0\u6CD5\u5408\u7406\u8BC1\u660E\u7684\u4E8B\u60C5\u3002 \u59CB\u7EC8\u786E\u4FDD\u60A8\u8FD4\u56DE\u8FC7\u62DF\u5408\u6D4B\u8BD5\u4EE5\u9A8C\u8BC1\u60A8\u7684\u66F4\u6539\u6CA1\u6709\u4EA7\u751F\u4EFB\u4F55\u610F\u5916\u540E\u679C\u3002"),ap=f(),Vs=p("h3"),rc=l("\u8BF7\u6C42\u5E2E\u5FD9"),rp=f(),qe=p("p"),lc=l("\u5E0C\u671B\u60A8\u4F1A\u5728\u672C\u8282\u4E2D\u627E\u5230\u4E00\u4E9B\u53EF\u4EE5\u5E2E\u52A9\u60A8\u89E3\u51B3\u95EE\u9898\u7684\u5EFA\u8BAE\uFF0C\u4F46\u5982\u679C\u4E0D\u662F\u8FD9\u6837\uFF0C\u8BF7\u8BB0\u4F4F\u60A8\u53EF\u4EE5\u968F\u65F6\u5728 "),Ks=p("a"),nc=l("\u8BBA\u575B"),pc=l(" \u4E0A\u5411\u793E\u533A\u63D0\u95EE\u3002"),lp=f(),Jt=p("p"),ic=l("\u4EE5\u4E0B\u662F\u4E00\u4E9B\u53EF\u80FD\u6709\u7528\u7684\u989D\u5916\u8D44\u6E90\uFF1A"),np=f(),G=p("ul"),Zt=p("li"),Ys=p("a"),oc=l("\u201C\u4F5C\u4E3A\u5DE5\u7A0B\u6700\u4F73\u5B9E\u8DF5\u5DE5\u5177\u7684\u518D\u73B0\u6027\u201D"),fc=l("\uFF0C\u4F5C\u8005\uFF1AJoel Grus"),cc=f(),Qt=p("li"),Js=p("a"),mc=l("\u201C\u795E\u7ECF\u7F51\u7EDC\u8C03\u8BD5\u6E05\u5355\u201D"),uc=l(" \u4F5C\u8005\uFF1ACecelia Shao"),dc=f(),Xt=p("li"),Zs=p("a"),_c=l("\u201C\u5982\u4F55\u5BF9\u673A\u5668\u5B66\u4E60\u4EE3\u7801\u8FDB\u884C\u5355\u5143\u6D4B\u8BD5\u201D"),$c=l(" by Chase Roberts"),hc=f(),ea=p("li"),Qs=p("a"),bc=l("\u201C\u8BAD\u7EC3\u795E\u7ECF\u7F51\u7EDC\u7684\u79D8\u8BC0\u201D"),kc=l("\u4F5C\u8005\uFF1AAndrej Karpathy"),pp=f(),sa=p("p"),jc=l("\u5F53\u7136\uFF0C\u5E76\u4E0D\u662F\u4F60\u5728\u8BAD\u7EC3\u795E\u7ECF\u7F51\u7EDC\u65F6\u9047\u5230\u7684\u6BCF\u4E00\u4E2A\u95EE\u9898\u90FD\u662F\u4F60\u81EA\u5DF1\u7684\u9519\uFF01 \u5982\u679C\u60A8\u5728 \u{1F917} Transformers \u6216 \u{1F917} Datasets \u5E93\u4E2D\u9047\u5230\u770B\u8D77\u6765\u4E0D\u6B63\u786E\u7684\u5185\u5BB9\uFF0C\u60A8\u53EF\u80FD\u9047\u5230\u4E86\u9519\u8BEF\u3002 \u4F60\u5E94\u8BE5\u544A\u8BC9\u6211\u4EEC\u8FD9\u4E00\u5207\uFF0C\u5728\u4E0B\u4E00\u8282\u4E2D\uFF0C\u6211\u4EEC\u5C06\u51C6\u786E\u89E3\u91CA\u5982\u4F55\u505A\u5230\u8FD9\u4E00\u70B9\u3002"),this.h()},l(e){const t=Mu('[data-svelte="svelte-1phssyn"]',document.head);m=i(t,"META",{name:!0,content:!0}),t.forEach(s),E=c(e),d(j.$$.fragment,e),v=c(e),g=i(e,"H1",{id:!0});var ir=o(g);q=n(ir,"\u8C03\u8BD5\u8BAD\u7EC3\u7BA1\u9053"),ir.forEach(s),P=c(e),d(C.$$.fragment,e),z=c(e),y=i(e,"P",{});var X=o(y);M=n(X,"\u4F60\u5DF2\u7ECF\u7F16\u5199\u4E86\u4E00\u4E2A\u6F02\u4EAE\u7684\u811A\u672C\u6765\u8BAD\u7EC3\u6216\u5FAE\u8C03\u7ED9\u5B9A\u4EFB\u52A1\u7684\u6A21\u578B\uFF0C\u5C3D\u804C\u5C3D\u8D23\u5730\u9075\u5FAA "),D=i(X,"A",{href:!0});var or=o(D);A=n(or,"Chapter 7"),or.forEach(s),et=n(X," \u4E2D\u7684\u5EFA\u8BAE\u3002 \u4F46\u662F\u5F53\u4F60\u542F\u52A8\u547D\u4EE4 "),se=i(X,"CODE",{});var fr=o(se);st=n(fr,"trainer.train()"),fr.forEach(s),gp=n(X," \u65F6\uFF0C\u53EF\u6015\u7684\u4E8B\u60C5\u53D1\u751F\u4E86\uFF1A\u4F60\u5F97\u5230\u4E00\u4E2A\u9519\u8BEF\u{1F631}\uFF01 \u6216\u8005\u66F4\u7CDF\u7CD5\u7684\u662F\uFF0C\u4E00\u5207\u4F3C\u4E4E\u90FD\u5F88\u597D\uFF0C\u8BAD\u7EC3\u8FD0\u884C\u6CA1\u6709\u9519\u8BEF\uFF0C\u4F46\u751F\u6210\u7684\u6A21\u578B\u5F88\u7CDF\u7CD5\u3002 \u5728\u672C\u8282\u4E2D\uFF0C\u6211\u4EEC\u5C06\u5411\u60A8\u5C55\u793A\u5982\u4F55\u8C03\u8BD5\u6B64\u7C7B\u95EE\u9898\u3002"),X.forEach(s),dr=c(e),Ae=i(e,"H2",{id:!0});var cr=o(Ae);Pp=n(cr,"\u8C03\u8BD5\u8BAD\u7EC3\u7BA1\u9053"),cr.forEach(s),_r=c(e),d(xe.$$.fragment,e),$r=c(e),W=i(e,"P",{});var ee=o(W);Cp=n(ee,"\u5F53\u60A8\u5728 "),ia=i(ee,"CODE",{});var mr=o(ia);Tp=n(mr,"trainer.train()"),mr.forEach(s),zp=n(ee," \u4E2D\u9047\u5230\u9519\u8BEF\u65F6\uFF0C\u5B83\u53EF\u80FD\u6765\u81EA\u591A\u4E2A\u6765\u6E90\uFF0C\u56E0\u4E3A "),oa=i(ee,"CODE",{});var ur=o(oa);Dp=n(ur,"Trainer"),ur.forEach(s),Ap=n(ee," \u901A\u5E38\u4F1A\u5C06\u5F88\u591A\u4E1C\u897F\u653E\u5728\u4E00\u8D77\u7EC4\u5408\u8FD0\u884C\u3002 \u5B83\u5C06datasets\u8F6C\u6362\u4E3Adataloaders\uFF0C\u56E0\u6B64\u95EE\u9898\u53EF\u80FD\u51FA\u5728datasets\u4E2D\uFF0C\u6216\u8005\u5728\u5C1D\u8BD5\u5C06datasets\u7684\u5143\u7D20\u4E00\u8D77\u6279\u5904\u7406\u65F6\u51FA\u73B0\u95EE\u9898\u3002 \u7136\u540E\u5B83\u9700\u8981\u51C6\u5907\u4E00\u6279\u6570\u636E\u5E76\u5C06\u5176\u63D0\u4F9B\u7ED9\u6A21\u578B\uFF0C\u56E0\u6B64\u95EE\u9898\u53EF\u80FD\u51FA\u5728\u6A21\u578B\u4EE3\u7801\u4E2D\u3002 \u4E4B\u540E\uFF0C\u5B83\u4F1A\u8BA1\u7B97\u68AF\u5EA6\u5E76\u6267\u884C\u4F18\u5316\u5668\uFF0C\u56E0\u6B64\u95EE\u9898\u4E5F\u53EF\u80FD\u51FA\u5728\u60A8\u7684\u4F18\u5316\u5668\u4E2D\u3002 \u5373\u4F7F\u8BAD\u7EC3\u4E00\u5207\u987A\u5229\uFF0C\u5982\u679C\u60A8\u7684\u8BC4\u4F30\u6307\u6807\u6709\u95EE\u9898\uFF0C\u8BC4\u4F30\u671F\u95F4\u4ECD\u7136\u53EF\u80FD\u51FA\u73B0\u95EE\u9898\u3002"),ee.forEach(s),hr=c(e),te=i(e,"P",{});var op=o(te);xp=n(op,"\u8C03\u8BD5 "),fa=i(op,"CODE",{});var qc=o(fa);Up=n(qc,"trainer.train()"),qc.forEach(s),Op=n(op," \u4E2D\u51FA\u73B0\u7684\u9519\u8BEF\u7684\u6700\u4F73\u65B9\u6CD5\u662F\u624B\u52A8\u68C0\u67E5\u6574\u4E2A\u7BA1\u9053\uFF0C\u770B\u770B\u54EA\u91CC\u51FA\u4E86\u95EE\u9898\u3002 \u9519\u8BEF\u901A\u5E38\u5F88\u5BB9\u6613\u89E3\u51B3\u3002"),op.forEach(s),br=c(e),ae=i(e,"P",{});var fp=o(ae);Sp=n(fp,"\u4E3A\u4E86\u8BC1\u660E\u8FD9\u4E00\u70B9\uFF0C\u6211\u4EEC\u5C06\u4F7F\u7528\u4EE5\u4E0B\u811A\u672C\uFF08\u5C1D\u8BD5\uFF09\u5728 "),Ue=i(fp,"A",{href:!0,rel:!0});var gc=o(Ue);Lp=n(gc,"MNLI \u6570\u636E\u96C6"),gc.forEach(s),Ip=n(fp,"\u4E0A\u5FAE\u8C03 DistilBERT \u6A21\u578B\uFF1A"),fp.forEach(s),kr=c(e),d(Oe.$$.fragment,e),jr=c(e),tt=i(e,"P",{});var Pc=o(tt);Fp=n(Pc,"\u5982\u679C\u4F60\u5C1D\u8BD5\u6267\u884C\u5B83\uFF0C\u4F60\u4F1A\u9047\u5230\u4E00\u4E2A\u76F8\u5F53\u795E\u79D8\u7684\u9519\u8BEF\uFF1A"),Pc.forEach(s),vr=c(e),d(Se.$$.fragment,e),wr=c(e),Le=i(e,"H3",{id:!0});var Cc=o(Le);Gp=n(Cc,"\u68C0\u67E5\u6570\u636E"),Cc.forEach(s),Er=c(e),at=i(e,"P",{});var Tc=o(at);Mp=n(Tc,"\u8FD9\u662F\u4E0D\u8A00\u800C\u55BB\u7684\uFF0C\u5982\u679C\u4F60\u7684\u6570\u636E\u88AB\u7834\u574F\uFF0C\u201CTrainer\u201D\u5C06\u65E0\u6CD5\u5F62\u6210\u6279\u6B21\uFF0C\u66F4\u4E0D\u7528\u8BF4\u8BAD\u7EC3\u4F60\u7684\u6A21\u578B\u4E86\u3002 \u6240\u4EE5\u9996\u5148\uFF0C\u4F60\u9700\u8981\u770B\u770B\u4F60\u7684\u8BAD\u7EC3\u96C6\u4E2D\u6709\u4EC0\u4E48\u3002"),Tc.forEach(s),yr=c(e),re=i(e,"P",{});var cp=o(re);Wp=n(cp,"\u4E3A\u4E86\u907F\u514D\u82B1\u8D39\u65E0\u6570\u5C0F\u65F6\u8BD5\u56FE\u68C0\u67E5\u548C\u4FEE\u590D\u4E0D\u662F\u9519\u8BEF\u6765\u6E90\u7684\u4E1C\u897F\uFF0C\u6211\u4EEC\u5EFA\u8BAE\u60A8\u4F7F\u7528 "),ca=i(cp,"CODE",{});var zc=o(ca);Np=n(zc,"trainer.train_dataset"),zc.forEach(s),Rp=n(cp," \u8FDB\u884C\u68C0\u67E5\u3002 \u6240\u4EE5\u8BA9\u6211\u4EEC\u5728\u8FD9\u91CC\u8FD9\u6837\u505A\uFF1A"),cp.forEach(s),qr=c(e),d(Ie.$$.fragment,e),gr=c(e),d(Fe.$$.fragment,e),Pr=c(e),N=i(e,"P",{});var ta=o(N);Hp=n(ta,"\u4F60\u6CE8\u610F\u5230\u6709\u4EC0\u4E48\u4E0D\u5BF9\u5417\uFF1F \u4E0E\u7F3A\u5C11\u6709\u5173 "),ma=i(ta,"CODE",{});var Dc=o(ma);Bp=n(Dc,"input_ids"),Dc.forEach(s),Vp=n(ta," \u7684\u9519\u8BEF\u6D88\u606F\u76F8\u7ED3\u5408\uFF0C\u5E94\u8BE5\u8BA9\u60A8\u610F\u8BC6\u5230\u6570\u636E\u96C6\u91CC\u662F\u6587\u672C\uFF0C\u800C\u4E0D\u662F\u6A21\u578B\u53EF\u4EE5\u7406\u89E3\u7684\u6570\u5B57\u3002 \u5728\u8FD9\u4E2A\u4F8B\u5B50\uFF0C\u8F93\u51FA\u7684\u539F\u59CB\u9519\u8BEF\u4FE1\u606F\u975E\u5E38\u5177\u6709\u8BEF\u5BFC\u6027\uFF0C\u56E0\u4E3A "),ua=i(ta,"CODE",{});var Ac=o(ua);Kp=n(Ac,"Trainer"),Ac.forEach(s),Yp=n(ta," \u4F1A\u81EA\u52A8\u5220\u9664\u4E0E\u6A21\u578B\u7B7E\u540D\u4E0D\u5339\u914D\u7684\u5217\uFF08\u5373\u6A21\u578B\u9884\u671F\u7684\u53C2\u6570\uFF09\u3002 \u8FD9\u610F\u5473\u7740\u5728\u8FD9\u91CC\uFF0C\u9664\u4E86\u6807\u7B7E\u4E4B\u5916\u7684\u6240\u6709\u4E1C\u897F\u90FD\u88AB\u4E22\u5F03\u4E86\u3002 \u56E0\u6B64\uFF0C\u521B\u5EFA\u6279\u6B21\u7136\u540E\u5C06\u5B83\u4EEC\u53D1\u9001\u5230\u6A21\u578B\u6CA1\u6709\u95EE\u9898\uFF0C\u800C\u6A21\u578B\u53C8\u62B1\u6028\u5B83\u6CA1\u6709\u6536\u5230\u6B63\u786E\u7684\u8F93\u5165\u3002"),ta.forEach(s),Cr=c(e),O=i(e,"P",{});var ge=o(O);Jp=n(ge,"\u4E3A\u4EC0\u4E48\u6CA1\u6709\u5904\u7406\u6570\u636E\u751F\u6210\u6807\u8BB0\u5462\uFF1F \u6211\u4EEC\u786E\u5B9E\u5728\u6570\u636E\u96C6\u4E0A\u4F7F\u7528\u4E86\u201CDataset.map()\u201D\u65B9\u6CD5\u6765\u5BF9\u6BCF\u4E2A\u6837\u672C\u5E94\u7528\u6807\u8BB0\u5668\u3002 \u4F46\u662F\u5982\u679C\u4F60\u4ED4\u7EC6\u770B\u4EE3\u7801\uFF0C\u4F60\u4F1A\u53D1\u73B0\u6211\u4EEC\u5728\u5C06\u8BAD\u7EC3\u548C\u8BC4\u4F30\u96C6\u4F20\u9012\u7ED9"),da=i(ge,"CODE",{});var xc=o(da);Zp=n(xc,"Trainer"),xc.forEach(s),Qp=n(ge,"\u65F6\u72AF\u4E86\u4E00\u4E2A\u9519\u8BEF\u3002 \u6211\u4EEC\u5728\u8FD9\u91CC\u6CA1\u6709\u4F7F\u7528 "),_a=i(ge,"CODE",{});var Uc=o(_a);Xp=n(Uc,"tokenized_datasets"),Uc.forEach(s),ei=n(ge,"\uFF0C\u800C\u662F\u4F7F\u7528\u4E86 "),$a=i(ge,"CODE",{});var Oc=o($a);si=n(Oc,"raw_datasets"),Oc.forEach(s),ti=n(ge," \u{1F926}\u3002 \u6240\u4EE5\u8BA9\u6211\u4EEC\u89E3\u51B3\u8FD9\u4E2A\u95EE\u9898\uFF01"),ge.forEach(s),Tr=c(e),d(Ge.$$.fragment,e),zr=c(e),rt=i(e,"P",{});var Sc=o(rt);ai=n(Sc,"\u8FD9\u4E2A\u65B0\u4EE3\u7801\u73B0\u5728\u4F1A\u7ED9\u51FA\u4E00\u4E2A\u4E0D\u540C\u7684\u9519\u8BEF\uFF1A"),Sc.forEach(s),Dr=c(e),d(Me.$$.fragment,e),Ar=c(e),lt=i(e,"P",{});var Lc=o(lt);ri=n(Lc,"\u67E5\u770Btraceback\uFF0C\u6211\u4EEC\u53EF\u4EE5\u770B\u5230\u9519\u8BEF\u53D1\u751F\u5728\u6570\u636E\u6574\u7406\u6B65\u9AA4\u4E2D\uFF1A"),Lc.forEach(s),xr=c(e),d(We.$$.fragment,e),Ur=c(e),nt=i(e,"P",{});var Ic=o(nt);li=n(Ic,"\u6240\u4EE5\uFF0C\u6211\u4EEC\u5E94\u8BE5\u53BB\u7814\u7A76\u4E00\u4E0B\u90A3\u4E2A\u3002 \u7136\u800C\uFF0C\u5728\u6211\u4EEC\u8FD9\u6837\u505A\u4E4B\u524D\uFF0C\u8BA9\u6211\u4EEC\u5B8C\u6210\u68C0\u67E5\u6211\u4EEC\u7684\u6570\u636E\uFF0C \u5148\u786E\u5B9A\u5B83100%\u662F\u6B63\u786E\u7684\u3002"),Ic.forEach(s),Or=c(e),pt=i(e,"P",{});var Fc=o(pt);ni=n(Fc,"\u5728\u8C03\u8BD5\u8BFE\u7A0B\u7684\u5185\u5BB9\u65F6\uFF0C\u60A8\u5E94\u8BE5\u59CB\u7EC8\u505A\u7684\u4E00\u4EF6\u4E8B\u662F\u67E5\u770B\u6A21\u578B\u7684\u89E3\u7801\u8F93\u5165\u3002 \u6211\u4EEC\u65E0\u6CD5\u7406\u89E3\u76F4\u63A5\u63D0\u4F9B\u7ED9\u5B83\u7684\u6570\u5B57\uFF0C\u6240\u4EE5\u6211\u4EEC\u5E94\u8BE5\u770B\u770B\u8FD9\u4E9B\u6570\u5B57\u4EE3\u8868\u4EC0\u4E48\u3002 \u4F8B\u5982\uFF0C\u5728\u8BA1\u7B97\u673A\u89C6\u89C9\u4E2D\uFF0C\u8FD9\u610F\u5473\u7740\u67E5\u770B\u60A8\u4F20\u9012\u7684\u56FE\u7247\u50CF\u7D20\u7684\u89E3\u7801\uFF0C\u5728\u8BED\u97F3\u4E2D\u610F\u5473\u7740\u89E3\u7801\u540E\u7684\u97F3\u9891\u6837\u672C\uFF0C\u5BF9\u4E8E\u6211\u4EEC\u7684 NLP \u793A\u4F8B\uFF0C\u8FD9\u610F\u5473\u7740\u4F7F\u7528\u6211\u4EEC\u7684\u6807\u8BB0\u5668\u89E3\u7801\u7684\u8F93\u5165\uFF1A"),Fc.forEach(s),Sr=c(e),d(Ne.$$.fragment,e),Lr=c(e),d(Re.$$.fragment,e),Ir=c(e),it=i(e,"P",{});var Gc=o(it);pi=n(Gc,"\u6240\u4EE5\u8FD9\u4F3C\u4E4E\u662F\u6B63\u786E\u7684\u3002 \u60A8\u5E94\u8BE5\u5BF9\u8F93\u5165\u4E2D\u7684\u6240\u6709\u952E\u6267\u884C\u6B64\u64CD\u4F5C\uFF1A"),Gc.forEach(s),Fr=c(e),d(He.$$.fragment,e),Gr=c(e),d(Be.$$.fragment,e),Mr=c(e),x=i(e,"P",{});var Y=o(x);ii=n(Y,"\u8BF7\u6CE8\u610F\uFF0C\u4E0E\u6A21\u578B\u63A5\u53D7\u7684\u8F93\u5165\u4E0D\u5BF9\u5E94\u7684\u952E\u5C06\u88AB\u81EA\u52A8\u4E22\u5F03\uFF0C\u56E0\u6B64\u8FD9\u91CC\u6211\u4EEC\u5C06\u4EC5\u4FDD\u7559 "),ha=i(Y,"CODE",{});var Mc=o(ha);oi=n(Mc,"input_ids"),Mc.forEach(s),fi=n(Y,"\u3001"),ba=i(Y,"CODE",{});var Wc=o(ba);ci=n(Wc,"attention_mask"),Wc.forEach(s),mi=n(Y," \u548C "),ka=i(Y,"CODE",{});var Nc=o(ka);ui=n(Nc,"label"),Nc.forEach(s),di=n(Y,"\uFF08\u5C06\u91CD\u547D\u540D\u4E3A "),ja=i(Y,"CODE",{});var Rc=o(ja);_i=n(Rc,"labels"),Rc.forEach(s),$i=n(Y,"\uFF09\u3002 \u8981\u4ED4\u7EC6\u68C0\u67E5\u6A21\u578B\u8F93\u5165\u7684\u5217\uFF0C\u60A8\u53EF\u4EE5\u6253\u5370\u6A21\u578B\u7684\u7C7B\uFF0C\u7136\u540E\u67E5\u770B\u5176\u6587\u6863\uFF1A"),Y.forEach(s),Wr=c(e),d(Ve.$$.fragment,e),Nr=c(e),d(Ke.$$.fragment,e),Rr=c(e),R=i(e,"P",{});var aa=o(R);hi=n(aa,"\u6240\u4EE5\u5728\u6211\u4EEC\u7684\u4F8B\u5B50\u4E2D\uFF0C\u6211\u4EEC\u5728"),Ye=i(aa,"A",{href:!0,rel:!0});var Hc=o(Ye);bi=n(Hc,"\u5728\u8FD9\u4E2A\u9875\u9762"),Hc.forEach(s),ki=n(aa,"\u53EF\u4EE5\u68C0\u67E5\u4E0A\u63A5\u53D7\u7684\u53C2\u6570\u3002 "),va=i(aa,"CODE",{});var Bc=o(va);ji=n(Bc,"Trainer"),Bc.forEach(s),vi=n(aa," \u4E5F\u4F1A\u8BB0\u5F55\u5B83\u4E22\u5F03\u7684\u5217\u3002"),aa.forEach(s),Hr=c(e),le=i(e,"P",{});var mp=o(le);wi=n(mp,"\u6211\u4EEC\u901A\u8FC7\u89E3\u7801\u68C0\u67E5\u4E86\u8F93\u5165 ID \u662F\u5426\u6B63\u786E\u3002 \u63A5\u4E0B\u6765\u662F\u68C0\u67E5 "),wa=i(mp,"CODE",{});var Vc=o(wa);Ei=n(Vc,"attention_mask"),Vc.forEach(s),yi=n(mp,"\uFF1A"),mp.forEach(s),Br=c(e),d(Je.$$.fragment,e),Vr=c(e),d(Ze.$$.fragment,e),Kr=c(e),ot=i(e,"P",{});var Kc=o(ot);qi=n(Kc,"\u7531\u4E8E\u6211\u4EEC\u6CA1\u6709\u5728\u9884\u5904\u7406\u4E2D\u5E94\u7528\u586B\u5145\uFF0C\u8FD9\u770B\u8D77\u6765\u975E\u5E38\u81EA\u7136\u3002 \u4E3A\u786E\u4FDD\u8BE5\u6CE8\u610F\u63A9\u7801\u6CA1\u6709\u95EE\u9898\uFF0C\u8BA9\u6211\u4EEC\u68C0\u67E5\u5B83\u4E0E\u8F93\u5165 ID \u7684\u957F\u5EA6\u662F\u5426\u76F8\u540C\uFF1A"),Kc.forEach(s),Yr=c(e),d(Qe.$$.fragment,e),Jr=c(e),d(Xe.$$.fragment,e),Zr=c(e),ft=i(e,"P",{});var Yc=o(ft);gi=n(Yc,"\u90A3\u633A\u597D\u7684\uFF01 \u6700\u540E\uFF0C\u8BA9\u6211\u4EEC\u68C0\u67E5\u4E00\u4E0B\u6211\u4EEC\u7684\u6807\u7B7E\uFF1A"),Yc.forEach(s),Qr=c(e),d(es.$$.fragment,e),Xr=c(e),d(ss.$$.fragment,e),el=c(e),H=i(e,"P",{});var ra=o(H);Pi=n(ra,"\u4E0E\u8F93\u5165 ID \u4E00\u6837\uFF0C\u8FD9\u662F\u4E00\u4E2A\u672C\u8EAB\u5E76\u6CA1\u6709\u771F\u6B63\u610F\u4E49\u7684\u6570\u5B57\u3002 \u6B63\u5982\u6211\u4EEC\u4E4B\u524D\u770B\u5230\u7684\uFF0C\u6574\u6570\u548C\u6807\u7B7E\u540D\u79F0\u4E4B\u95F4\u7684\u6620\u5C04\u5B58\u50A8\u5728\u6570\u636E\u96C6\u76F8\u5E94 "),Ea=i(ra,"EM",{});var Jc=o(Ea);Ci=n(Jc,"feature"),Jc.forEach(s),Ti=n(ra," \u7684 "),ya=i(ra,"CODE",{});var Zc=o(ya);zi=n(Zc,"names"),Zc.forEach(s),Di=n(ra," \u5C5E\u6027\u4E2D\uFF1A"),ra.forEach(s),sl=c(e),d(ts.$$.fragment,e),tl=c(e),d(as.$$.fragment,e),al=c(e),B=i(e,"P",{});var la=o(B);Ai=n(la,"\u6240\u4EE5"),qa=i(la,"CODE",{});var Qc=o(qa);xi=n(Qc,"1"),Qc.forEach(s),Ui=n(la,"\u8868\u793A"),ga=i(la,"CODE",{});var Xc=o(ga);Oi=n(Xc,"neutral"),Xc.forEach(s),Si=n(la,"\uFF0C\u8868\u793A\u6211\u4EEC\u4E0A\u9762\u770B\u5230\u7684\u4E24\u53E5\u8BDD\u5E76\u4E0D\u77DB\u76FE\uFF0C\u4E5F\u6CA1\u6709\u5305\u542B\u5173\u7CFB\u3002 \u8FD9\u4F3C\u4E4E\u662F\u6B63\u786E\u7684\uFF01"),la.forEach(s),rl=c(e),ct=i(e,"P",{});var em=o(ct);Li=n(em,"\u6211\u4EEC\u8FD9\u91CC\u6CA1\u6709\u4EE4\u724C\u7C7B\u578B ID\uFF0C\u56E0\u4E3A DistilBERT \u4E0D\u9700\u8981\u5B83\u4EEC\uFF1B \u5982\u679C\u60A8\u7684\u6A21\u578B\u4E2D\u6709\u4E00\u4E9B\uFF0C\u60A8\u8FD8\u5E94\u8BE5\u786E\u4FDD\u5B83\u4EEC\u6B63\u786E\u5339\u914D\u8F93\u5165\u4E2D\u7B2C\u4E00\u53E5\u548C\u7B2C\u4E8C\u53E5\u7684\u4F4D\u7F6E\u3002"),em.forEach(s),ll=c(e),d(ne.$$.fragment,e),nl=c(e),mt=i(e,"P",{});var sm=o(mt);Ii=n(sm,"\u6211\u4EEC\u5728\u8FD9\u91CC\u53EA\u5BF9\u8BAD\u7EC3\u96C6\u8FDB\u884C\u68C0\u67E5\uFF0C\u4F46\u60A8\u5F53\u7136\u5E94\u8BE5\u4EE5\u540C\u6837\u7684\u65B9\u5F0F\u4ED4\u7EC6\u68C0\u67E5\u9A8C\u8BC1\u96C6\u548C\u6D4B\u8BD5\u96C6\u3002"),sm.forEach(s),pl=c(e),ut=i(e,"P",{});var tm=o(ut);Fi=n(tm,"\u73B0\u5728\u6211\u4EEC\u77E5\u9053\u6211\u4EEC\u7684\u6570\u636E\u96C6\u770B\u8D77\u6765\u4E0D\u9519\uFF0C\u662F\u65F6\u5019\u68C0\u67E5\u8BAD\u7EC3\u7BA1\u9053\u7684\u4E0B\u4E00\u6B65\u4E86\u3002"),tm.forEach(s),il=c(e),Z=i(e,"H3",{class:!0});var up=o(Z);pe=i(up,"A",{id:!0,class:!0,href:!0});var am=o(pe);Pa=i(am,"SPAN",{});var rm=o(Pa);d(rs.$$.fragment,rm),rm.forEach(s),am.forEach(s),Gi=c(up),Ca=i(up,"SPAN",{});var lm=o(Ca);Mi=n(lm,"\u4ECE datasets \u5230 dataloaders"),lm.forEach(s),up.forEach(s),ol=c(e),S=i(e,"P",{});var Pe=o(S);Wi=n(Pe,"\u8BAD\u7EC3\u7BA1\u9053\u4E2D\u53EF\u80FD\u51FA\u9519\u7684\u4E0B\u4E00\u4EF6\u4E8B\u662F\u5F53\u201CTrainer\u201D\u5C1D\u8BD5\u4ECE\u8BAD\u7EC3\u6216\u9A8C\u8BC1\u96C6\u5F62\u6210\u6279\u6B21\u65F6\u3002 \u4E00\u65E6\u4F60\u786E\u5B9A "),Ta=i(Pe,"CODE",{});var nm=o(Ta);Ni=n(nm,"Trainer"),nm.forEach(s),Ri=n(Pe," \u7684\u6570\u636E\u96C6\u662F\u6B63\u786E\u7684\uFF0C\u4F60\u53EF\u4EE5\u5C1D\u8BD5\u901A\u8FC7\u6267\u884C\u4EE5\u4E0B\u64CD\u4F5C\u624B\u52A8\u5F62\u6210\u4E00\u4E2A\u6279\u6B21\uFF08\u53EF\u4EE5\u5C06 "),za=i(Pe,"CODE",{});var pm=o(za);Hi=n(pm,"train"),pm.forEach(s),Bi=n(Pe," \u66FF\u6362\u4E3A "),Da=i(Pe,"CODE",{});var im=o(Da);Vi=n(im,"eval"),im.forEach(s),Ki=n(Pe," \u7528\u4E8E\u9A8C\u8BC1\u6570\u636E\u52A0\u8F7D\u5668\uFF09\uFF1A"),Pe.forEach(s),fl=c(e),d(ls.$$.fragment,e),cl=c(e),dt=i(e,"P",{});var om=o(dt);Yi=n(om,"\u6B64\u4EE3\u7801\u521B\u5EFA\u8BAD\u7EC3\u6570\u636E\u52A0\u8F7D\u5668\uFF0C\u7136\u540E\u5BF9\u5176\u8FDB\u884C\u8FED\u4EE3\uFF0C\u5728\u7B2C\u4E00\u6B21\u8FED\u4EE3\u65F6\u505C\u6B62\u3002 \u5982\u679C\u4EE3\u7801\u6267\u884C\u6CA1\u6709\u9519\u8BEF\uFF0C\u90A3\u4E48\u60A8\u5C31\u6709\u4E86\u53EF\u4EE5\u68C0\u67E5\u7684\u7B2C\u4E00\u4E2A\u8BAD\u7EC3\u6279\u6B21\uFF0C\u5982\u679C\u4EE3\u7801\u51FA\u9519\uFF0C\u60A8\u53EF\u4EE5\u786E\u5B9A\u95EE\u9898\u51FA\u5728\u6570\u636E\u52A0\u8F7D\u5668\u4E2D\uFF0C\u5982\u4E0B\u6240\u793A\uFF1A"),om.forEach(s),ml=c(e),d(ns.$$.fragment,e),ul=c(e),_t=i(e,"P",{});var fm=o(_t);Ji=n(fm,"\u68C0\u67E5trackback\u7684\u6700\u540E\u4E00\u4E2A\u5806\u6808\u7684\u8F93\u51FA\u5E94\u8BE5\u8DB3\u4EE5\u7ED9\u4F60\u4E00\u4E2A\u7EBF\u7D22\uFF0C\u4F46\u8BA9\u6211\u4EEC\u505A\u66F4\u591A\u7684\u6316\u6398\u3002 \u6279\u5904\u7406\u521B\u5EFA\u8FC7\u7A0B\u4E2D\u7684\u5927\u591A\u6570\u95EE\u9898\u662F\u7531\u4E8E\u5C06\u793A\u4F8B\u6574\u7406\u5230\u5355\u4E2A\u6279\u5904\u7406\u4E2D\u800C\u51FA\u73B0\u7684\uFF0C\u56E0\u6B64\u5728\u6709\u7591\u95EE\u65F6\u9996\u5148\u8981\u68C0\u67E5\u7684\u662F\u60A8\u7684 DataLoader \u6B63\u5728\u4F7F\u7528\u4EC0\u4E48 collate_fn\uFF1A"),fm.forEach(s),dl=c(e),d(ps.$$.fragment,e),_l=c(e),d(is.$$.fragment,e),$l=c(e),L=i(e,"P",{});var Ce=o(L);Zi=n(Ce,"\u6240\u4EE5\uFF0C\u76EE\u524D\u4F7F\u7528\u7684\u662F "),Aa=i(Ce,"CODE",{});var cm=o(Aa);Qi=n(cm,"default_data_collator"),cm.forEach(s),Xi=n(Ce,"\uFF0C\u4F46\u8FD9\u4E0D\u662F\u6211\u4EEC\u5728\u8FD9\u79CD\u60C5\u51B5\u4E0B\u60F3\u8981\u7684\u3002 \u6211\u4EEC\u5E0C\u671B\u5C06\u793A\u4F8B\u586B\u5145\u5230\u6279\u5904\u7406\u4E2D\u6700\u957F\u7684\u53E5\u5B50\uFF0C\u8FD9\u662F\u7531 "),xa=i(Ce,"CODE",{});var mm=o(xa);eo=n(mm,"DataCollatorWithPadding"),mm.forEach(s),so=n(Ce," \u6574\u7406\u5668\u5B8C\u6210\u7684\u3002 \u800C\u8FD9\u4E2A\u6570\u636E\u6536\u96C6\u5668\u5E94\u8BE5\u662F\u9ED8\u8BA4\u88AB "),Ua=i(Ce,"CODE",{});var um=o(Ua);to=n(um,"Trainer"),um.forEach(s),ao=n(Ce," \u4F7F\u7528\u7684\uFF0C\u4E3A\u4EC0\u4E48\u8FD9\u91CC\u6CA1\u6709\u4F7F\u7528\u5462\uFF1F"),Ce.forEach(s),hl=c(e),I=i(e,"P",{});var Te=o(I);ro=n(Te,"\u7B54\u6848\u662F\u56E0\u4E3A\u6211\u4EEC\u6CA1\u6709\u5C06 "),Oa=i(Te,"CODE",{});var dm=o(Oa);lo=n(dm,"tokenizer"),dm.forEach(s),no=n(Te," \u4F20\u9012\u7ED9 "),Sa=i(Te,"CODE",{});var _m=o(Sa);po=n(_m,"Trainer"),_m.forEach(s),io=n(Te,"\uFF0C\u6240\u4EE5\u5B83\u65E0\u6CD5\u521B\u5EFA\u6211\u4EEC\u60F3\u8981\u7684 "),La=i(Te,"CODE",{});var $m=o(La);oo=n($m,"DataCollatorWithPadding"),$m.forEach(s),fo=n(Te,"\u3002 \u5728\u5B9E\u8DF5\u4E2D\uFF0C\u60A8\u5E94\u8BE5\u660E\u786E\u5730\u4F20\u9012\u60A8\u60F3\u8981\u4F7F\u7528\u7684\u6570\u636E\u6574\u7406\u5668\uFF0C\u4EE5\u786E\u4FDD\u907F\u514D\u8FD9\u4E9B\u7C7B\u578B\u7684\u9519\u8BEF\u3002 \u8BA9\u6211\u4EEC\u8C03\u6574\u6211\u4EEC\u7684\u4EE3\u7801\u6765\u505A\u5230\u8FD9\u4E00\u70B9\uFF1A"),Te.forEach(s),bl=c(e),d(os.$$.fragment,e),kl=c(e),$t=i(e,"P",{});var hm=o($t);co=n(hm,"\u597D\u6D88\u606F\uFF1F \u6211\u4EEC\u6CA1\u6709\u5F97\u5230\u4E0E\u4EE5\u524D\u76F8\u540C\u7684\u9519\u8BEF\uFF0C\u8FD9\u7EDD\u5BF9\u662F\u8FDB\u6B65\u3002 \u574F\u6D88\u606F\uFF1F \u6211\u4EEC\u5F97\u5230\u4E86\u4E00\u4E2A\u81ED\u540D\u662D\u8457\u7684 CUDA \u9519\u8BEF\uFF1A"),hm.forEach(s),jl=c(e),d(fs.$$.fragment,e),vl=c(e),ht=i(e,"P",{});var bm=o(ht);mo=n(bm,"\u8FD9\u5F88\u7CDF\u7CD5\uFF0C\u56E0\u4E3A CUDA \u9519\u8BEF\u901A\u5E38\u5F88\u96BE\u8C03\u8BD5\u3002 \u6211\u4EEC\u7A0D\u540E\u4F1A\u770B\u5230\u5982\u4F55\u89E3\u51B3\u8FD9\u4E2A\u95EE\u9898\uFF0C\u4F46\u9996\u5148\u8BA9\u6211\u4EEC\u5B8C\u6210\u5BF9\u6279\u5904\u7406\u521B\u5EFA\u7684\u5206\u6790\u3002"),bm.forEach(s),wl=c(e),bt=i(e,"P",{});var km=o(bt);uo=n(km,"\u5982\u679C\u60A8\u786E\u5B9A\u60A8\u7684\u6570\u636E\u6574\u7406\u5668\u662F\u6B63\u786E\u7684\uFF0C\u5219\u5E94\u5C1D\u8BD5\u5C06\u5176\u5E94\u7528\u4E8E\u6570\u636E\u96C6\u7684\u51E0\u4E2A\u6837\u672C\uFF1A"),km.forEach(s),El=c(e),d(cs.$$.fragment,e),yl=c(e),U=i(e,"P",{});var J=o(U);_o=n(J,"\u6B64\u4EE3\u7801\u5C06\u5931\u8D25\uFF0C\u56E0\u4E3A "),Ia=i(J,"CODE",{});var jm=o(Ia);$o=n(jm,"train_dataset"),jm.forEach(s),ho=n(J," \u5305\u542B\u5B57\u7B26\u4E32\u5217\uFF0C"),Fa=i(J,"CODE",{});var vm=o(Fa);bo=n(vm,"Trainer"),vm.forEach(s),ko=n(J," \u901A\u5E38\u4F1A\u5220\u9664\u8FD9\u4E9B\u5217\u3002 \u60A8\u53EF\u4EE5\u624B\u52A8\u5220\u9664\u5B83\u4EEC\uFF0C\u6216\u8005\u5982\u679C\u60A8\u60F3\u51C6\u786E\u5730\u4FEE\u6539 "),Ga=i(J,"CODE",{});var wm=o(Ga);jo=n(wm,"Trainer"),wm.forEach(s),vo=n(J," \u5728\u5E55\u540E\u6240\u505A\u7684\u4E8B\u60C5\uFF0C\u60A8\u53EF\u4EE5\u8C03\u7528\u79C1\u6709\u7684 "),Ma=i(J,"CODE",{});var Em=o(Ma);wo=n(Em,"Trainer._remove_unused_columns()"),Em.forEach(s),Eo=n(J," \u65B9\u6CD5\u6765\u6267\u884C\u6B64\u64CD\u4F5C\uFF1A"),J.forEach(s),ql=c(e),d(ms.$$.fragment,e),gl=c(e),kt=i(e,"P",{});var ym=o(kt);yo=n(ym,"\u5982\u679C\u9519\u8BEF\u4ECD\u7136\u5B58\u5728\uFF0C\u60A8\u5E94\u8BE5\u80FD\u591F\u624B\u52A8\u8C03\u8BD5\u6570\u636E\u6574\u7406\u5668\u5185\u90E8\u4EE5\u786E\u5B9A\u5177\u4F53\u7684\u95EE\u9898\u3002"),ym.forEach(s),Pl=c(e),jt=i(e,"P",{});var qm=o(jt);qo=n(qm,"\u73B0\u5728\u6211\u4EEC\u5DF2\u7ECF\u8C03\u8BD5\u4E86\u6279\u5904\u7406\u521B\u5EFA\u8FC7\u7A0B\uFF0C\u662F\u65F6\u5019\u5C06\u6570\u636E\u4F20\u9012\u7ED9\u6A21\u578B\u4E86\uFF01"),qm.forEach(s),Cl=c(e),us=i(e,"H3",{id:!0});var gm=o(us);go=n(gm,"\u68C0\u67E5\u6A21\u578B"),gm.forEach(s),Tl=c(e),vt=i(e,"P",{});var Pm=o(vt);Po=n(Pm,"\u60A8\u5E94\u8BE5\u80FD\u591F\u901A\u8FC7\u6267\u884C\u4EE5\u4E0B\u547D\u4EE4\u6765\u83B7\u5F97\u4E00\u4E2A\u6279\u6B21\u7684\u6570\u636E\uFF1A"),Pm.forEach(s),zl=c(e),d(ds.$$.fragment,e),Dl=c(e),ie=i(e,"P",{});var dp=o(ie);Co=n(dp,"\u5982\u679C\u60A8\u5728notebook\u4E2D\u8FD0\u884C\u6B64\u4EE3\u7801\uFF0C\u60A8\u53EF\u80FD\u4F1A\u6536\u5230\u4E0E\u6211\u4EEC\u4E4B\u524D\u770B\u5230\u7684\u7C7B\u4F3C\u7684 CUDA \u9519\u8BEF\uFF0C\u5728\u8FD9\u79CD\u60C5\u51B5\u4E0B\uFF0C\u60A8\u9700\u8981\u91CD\u65B0\u542F\u52A8notebook\u5E76\u91CD\u65B0\u6267\u884C\u6700\u540E\u4E00\u4E2A\u7247\u6BB5\uFF0C\u800C\u4E0D\u8FD0\u884C "),Wa=i(dp,"CODE",{});var Cm=o(Wa);To=n(Cm,"trainer.train()"),Cm.forEach(s),zo=n(dp," \u884C.\u8FD9\u662F\u5173\u4E8E CUDA \u9519\u8BEF\u7684\u7B2C\u4E8C\u4E2A\u6700\u70E6\u4EBA\u7684\u4E8B\u60C5\uFF1A\u5B83\u4EEC\u4F1A\u7834\u574F\u60A8\u7684Cuda\u5185\u6838\uFF0C\u800C\u4E14\u65E0\u6CD5\u6062\u590D\u3002\u5B83\u4EEC\u6700\u70E6\u4EBA\u7684\u4E8B\u60C5\u662F\u5B83\u4EEC\u5F88\u96BE\u8C03\u8BD5\u3002"),dp.forEach(s),Al=c(e),wt=i(e,"P",{});var Tm=o(wt);Do=n(Tm,"\u8FD9\u662F\u4E3A\u4EC0\u4E48\uFF1F\u5B83\u4E0E GPU \u7684\u5DE5\u4F5C\u65B9\u5F0F\u6709\u5173\u3002\u5B83\u4EEC\u5728\u5E76\u884C\u6267\u884C\u5927\u91CF\u64CD\u4F5C\u65B9\u9762\u975E\u5E38\u6709\u6548\uFF0C\u4F46\u7F3A\u70B9\u662F\u5F53\u5176\u4E2D\u4E00\u6761\u6307\u4EE4\u5BFC\u81F4\u9519\u8BEF\u65F6\uFF0C\u60A8\u4E0D\u4F1A\u7ACB\u5373\u77E5\u9053\u3002\u53EA\u6709\u5F53\u7A0B\u5E8F\u5728 GPU \u4E0A\u8C03\u7528\u591A\u4E2A\u8FDB\u7A0B\u7684\u540C\u6B65\u5904\u7406\u65F6\uFF0C\u5B83\u624D\u4F1A\u610F\u8BC6\u5230\u51FA\u73B0\u95EE\u9898\uFF0C\u56E0\u6B64\u9519\u8BEF\u5B9E\u9645\u4E0A\u662F\u5728\u4E0E\u521B\u5EFA\u5B83\u7684\u539F\u56E0\u65E0\u5173\u7684\u5730\u65B9\u5F15\u53D1\u7684\u3002\u4F8B\u5982\uFF0C\u5982\u679C\u6211\u4EEC\u67E5\u770B\u4E4B\u524D\u7684trackback\uFF0C\u9519\u8BEF\u662F\u5728\u5411\u540E\u4F20\u9012\u671F\u95F4\u5F15\u53D1\u7684\uFF0C\u4F46\u6211\u4EEC\u4F1A\u5728\u4E00\u5206\u949F\u5185\u770B\u5230\u5B83\u5B9E\u9645\u4E0A\u6E90\u4E8E\u5411\u524D\u4F20\u9012\u4E2D\u7684\u67D0\u4E9B\u4E1C\u897F\u3002"),Tm.forEach(s),xl=c(e),Et=i(e,"P",{});var zm=o(Et);Ao=n(zm,"\u90A3\u4E48\u6211\u4EEC\u5982\u4F55\u8C03\u8BD5\u8FD9\u4E9B\u9519\u8BEF\u5462\uFF1F\u7B54\u6848\u5F88\u7B80\u5355\uFF1A\u6211\u4EEC\u6CA1\u6709\u3002\u9664\u975E\u60A8\u7684 CUDA \u9519\u8BEF\u662F\u5185\u5B58\u4E0D\u8DB3\u9519\u8BEF\uFF08\u8FD9\u610F\u5473\u7740\u60A8\u7684 GPU \u4E2D\u6CA1\u6709\u8DB3\u591F\u7684\u5185\u5B58\uFF09\uFF0C\u5426\u5219\u60A8\u5E94\u8BE5\u59CB\u7EC8\u8FD4\u56DE CPU \u8FDB\u884C\u8C03\u8BD5\u3002"),zm.forEach(s),Ul=c(e),yt=i(e,"P",{});var Dm=o(yt);xo=n(Dm,"\u4E3A\u6B64\uFF0C\u6211\u4EEC\u53EA\u9700\u5C06\u6A21\u578B\u653E\u56DE CPU \u4E0A\u5E76\u5728\u6211\u4EEC\u7684\u4E00\u6279\u6570\u636E\u4E2D\u8C03\u7528\u5B83\u2014\u2014\u201CDataLoader\u201D\u8FD4\u56DE\u7684\u90A3\u6279\u6570\u636E\u5C1A\u672A\u79FB\u52A8\u5230 GPU\uFF1A"),Dm.forEach(s),Ol=c(e),d(_s.$$.fragment,e),Sl=c(e),d($s.$$.fragment,e),Ll=c(e),qt=i(e,"P",{});var Am=o(qt);Uo=n(Am,"\u6240\u4EE5\uFF0C\u601D\u8DEF\u8D8A\u6765\u8D8A\u6E05\u6670\u4E86\u3002 \u6211\u4EEC\u73B0\u5728\u5728\u635F\u5931\u8BA1\u7B97\u4E2D\u6CA1\u6709\u51FA\u73B0 CUDA \u9519\u8BEF\uFF0C\u800C\u662F\u6709\u4E00\u4E2A\u201CIndexError\u201D\uFF08\u56E0\u6B64\u4E0E\u6211\u4EEC\u4E4B\u524D\u6240\u8BF4\u7684\u53CD\u5411\u4F20\u64AD\u65E0\u5173\uFF09\u3002 \u66F4\u51C6\u786E\u5730\u8BF4\uFF0C\u6211\u4EEC\u53EF\u4EE5\u770B\u5230\u662FTarget 2 \u9020\u6210\u4E86\u9519\u8BEF\uFF0C\u6240\u4EE5\u8FD9\u662F\u68C0\u67E5\u6A21\u578B\u6807\u7B7E\u6570\u91CF\u7684\u597D\u65F6\u673A\uFF1A"),Am.forEach(s),Il=c(e),d(hs.$$.fragment,e),Fl=c(e),d(bs.$$.fragment,e),Gl=c(e),gt=i(e,"P",{});var xm=o(gt);Oo=n(xm,"\u6709\u4E24\u4E2A\u6807\u7B7E\uFF0C\u53EA\u5141\u8BB8 0 \u548C 1 \u4F5C\u4E3A\u76EE\u6807\uFF0C\u4F46\u662F\u6839\u636E\u9519\u8BEF\u4FE1\u606F\u6211\u4EEC\u5F97\u5230\u4E00\u4E2A 2\u3002\u5F97\u5230\u4E00\u4E2A 2 \u5B9E\u9645\u4E0A\u662F\u6B63\u5E38\u7684\uFF1A\u5982\u679C\u6211\u4EEC\u8BB0\u5F97\u6211\u4EEC\u4E4B\u524D\u63D0\u53D6\u7684\u6807\u7B7E\u540D\u79F0\uFF0C\u6709\u4E09\u4E2A\uFF0C\u6240\u4EE5\u6211\u4EEC\u6709\u7D22\u5F15 0 , 1 \u548C 2 \u5728\u6211\u4EEC\u7684\u6570\u636E\u96C6\u4E2D\u3002 \u95EE\u9898\u662F\u6211\u4EEC\u6CA1\u6709\u544A\u8BC9\u6211\u4EEC\u7684\u6A21\u578B\uFF0C\u5B83\u5E94\u8BE5\u521B\u5EFA\u4E09\u4E2A\u6807\u7B7E\u3002 \u6240\u4EE5\u8BA9\u6211\u4EEC\u89E3\u51B3\u8FD9\u4E2A\u95EE\u9898\uFF01"),xm.forEach(s),Ml=c(e),d(ks.$$.fragment,e),Wl=c(e),oe=i(e,"P",{});var _p=o(oe);So=n(_p,"\u6211\u4EEC\u8FD8\u6CA1\u6709\u5305\u542B "),Na=i(_p,"CODE",{});var Um=o(Na);Lo=n(Um,"trainer.train()"),Um.forEach(s),Io=n(_p," \u884C\uFF0C\u4EE5\u4FBF\u82B1\u65F6\u95F4\u68C0\u67E5\u4E00\u5207\u662F\u5426\u6B63\u5E38\u3002 \u5982\u679C\u6211\u4EEC\u8BF7\u6C42\u4E00\u4E2A\u6279\u6B21\u7684\u6570\u636E\u5E76\u5C06\u5176\u4F20\u9012\u7ED9\u6211\u4EEC\u7684\u6A21\u578B\uFF0C\u5B83\u73B0\u5728\u53EF\u4EE5\u6B63\u5E38\u5DE5\u4F5C\u4E86\uFF01"),_p.forEach(s),Nl=c(e),d(js.$$.fragment,e),Rl=c(e),Pt=i(e,"P",{});var Om=o(Pt);Fo=n(Om,"\u4E0B\u4E00\u6B65\u662F\u56DE\u5230 GPU \u5E76\u68C0\u67E5\u4E00\u5207\u662F\u5426\u4ECD\u7136\u6709\u6548\uFF1A"),Om.forEach(s),Hl=c(e),d(vs.$$.fragment,e),Bl=c(e),Ct=i(e,"P",{});var Sm=o(Ct);Go=n(Sm,"\u5982\u679C\u4ECD\u7136\u51FA\u73B0\u9519\u8BEF\uFF0C\u8BF7\u786E\u4FDD\u91CD\u65B0\u542F\u52A8notebook\u5E76\u4EC5\u6267\u884C\u811A\u672C\u7684\u6700\u540E\u4E00\u4E2A\u7248\u672C\u3002"),Sm.forEach(s),Vl=c(e),ws=i(e,"H3",{id:!0});var Lm=o(ws);Mo=n(Lm,"\u6267\u884C\u4E00\u4E2A\u4F18\u5316\u5668\u6B65\u9AA4"),Lm.forEach(s),Kl=c(e),Tt=i(e,"P",{});var Im=o(Tt);Wo=n(Im,"\u73B0\u5728\u6211\u4EEC\u77E5\u9053\u6211\u4EEC\u53EF\u4EE5\u6784\u5EFA\u5B9E\u9645\u901A\u8FC7\u6A21\u578B\u68C0\u67E5\u7684\u6210\u6279\u6B21\u7684\u6570\u636E\uFF0C\u6211\u4EEC\u5DF2\u7ECF\u4E3A\u8BAD\u7EC3\u7BA1\u9053\u7684\u4E0B\u4E00\u6B65\u505A\u597D\u51C6\u5907\uFF1A\u8BA1\u7B97\u68AF\u5EA6\u5E76\u6267\u884C\u4F18\u5316\u6B65\u9AA4\u3002"),Im.forEach(s),Yl=c(e),fe=i(e,"P",{});var $p=o(fe);No=n($p,"\u7B2C\u4E00\u90E8\u5206\u53EA\u662F\u5728 loss \u4E0A\u8C03\u7528 "),Ra=i($p,"CODE",{});var Fm=o(Ra);Ro=n(Fm,"backward()"),Fm.forEach(s),Ho=n($p," \u65B9\u6CD5\uFF1A"),$p.forEach(s),Jl=c(e),d(Es.$$.fragment,e),Zl=c(e),zt=i(e,"P",{});var Gm=o(zt);Bo=n(Gm,"\u5728\u8FD9\u4E2A\u9636\u6BB5\u5F88\u5C11\u51FA\u73B0\u9519\u8BEF\uFF0C\u4F46\u5982\u679C\u786E\u5B9E\u51FA\u73B0\u9519\u8BEF\uFF0C\u8BF7\u8FD4\u56DE CPU \u4EE5\u83B7\u53D6\u6709\u7528\u7684\u9519\u8BEF\u6D88\u606F\u3002"),Gm.forEach(s),Ql=c(e),V=i(e,"P",{});var na=o(V);Vo=n(na,"\u8981\u6267\u884C\u4F18\u5316\u6B65\u9AA4\uFF0C\u6211\u4EEC\u53EA\u9700\u8981\u521B\u5EFA "),Ha=i(na,"CODE",{});var Mm=o(Ha);Ko=n(Mm,"optimizer"),Mm.forEach(s),Yo=n(na," \u5E76\u8C03\u7528\u5B83\u7684 "),Ba=i(na,"CODE",{});var Wm=o(Ba);Jo=n(Wm,"step()"),Wm.forEach(s),Zo=n(na," \u65B9\u6CD5\uFF1A"),na.forEach(s),Xl=c(e),d(ys.$$.fragment,e),en=c(e),ce=i(e,"P",{});var hp=o(ce);Qo=n(hp,"\u540C\u6837\uFF0C\u5982\u679C\u60A8\u5728 "),Va=i(hp,"CODE",{});var Nm=o(Va);Xo=n(Nm,"Trainer"),Nm.forEach(s),ef=n(hp," \u4E2D\u4F7F\u7528\u9ED8\u8BA4\u4F18\u5316\u5668\uFF0C\u5219\u5728\u6B64\u9636\u6BB5\u60A8\u4E0D\u5E94\u8BE5\u6536\u5230\u9519\u8BEF\uFF0C\u4F46\u5982\u679C\u60A8\u6709\u81EA\u5B9A\u4E49\u4F18\u5316\u5668\uFF0C\u5219\u53EF\u80FD\u4F1A\u51FA\u73B0\u4E00\u4E9B\u95EE\u9898\u9700\u8981\u5728\u8FD9\u91CC\u8C03\u8BD5\u3002 \u5982\u679C\u60A8\u5728\u6B64\u9636\u6BB5\u9047\u5230\u5947\u602A\u7684 CUDA \u9519\u8BEF\uFF0C\u8BF7\u4E0D\u8981\u5FD8\u8BB0\u8FD4\u56DE CPU\u3002 \u8BF4\u5230 CUDA \u9519\u8BEF\uFF0C\u524D\u9762\u6211\u4EEC\u63D0\u5230\u4E86\u4E00\u4E2A\u7279\u6B8A\u60C5\u51B5\u3002 \u73B0\u5728\u8BA9\u6211\u4EEC\u6765\u770B\u770B\u3002"),hp.forEach(s),sn=c(e),Q=i(e,"H3",{class:!0});var bp=o(Q);me=i(bp,"A",{id:!0,class:!0,href:!0});var Rm=o(me);Ka=i(Rm,"SPAN",{});var Hm=o(Ka);d(qs.$$.fragment,Hm),Hm.forEach(s),Rm.forEach(s),sf=c(bp),Ya=i(bp,"SPAN",{});var Bm=o(Ya);tf=n(Bm,"\u5904\u7406 CUDA out-of-memory\u9519\u8BEF"),Bm.forEach(s),bp.forEach(s),tn=c(e),ue=i(e,"P",{});var kp=o(ue);af=n(kp,"\u6BCF\u5F53\u60A8\u6536\u5230\u4EE5"),Ja=i(kp,"CODE",{});var Vm=o(Ja);rf=n(Vm,"RuntimeError: CUDA out of memory"),Vm.forEach(s),lf=n(kp,"\u5F00\u5934\u7684\u9519\u8BEF\u6D88\u606F\u65F6\uFF0C\u8FD9\u8868\u660E\u60A8\u7684 GPU \u5185\u5B58\u4E0D\u8DB3\u3002 \u8FD9\u4E0E\u60A8\u7684\u4EE3\u7801\u6CA1\u6709\u76F4\u63A5\u5173\u8054\uFF0C\u5E76\u4E14\u5B83\u53EF\u80FD\u53D1\u751F\u5728\u8FD0\u884C\u826F\u597D\u7684\u4EE3\u7801\u4E2D\u3002 \u6B64\u9519\u8BEF\u610F\u5473\u7740\u60A8\u8BD5\u56FE\u5728 GPU \u7684\u5185\u90E8\u5B58\u50A8\u5668\u4E2D\u653E\u5165\u592A\u591A\u4E1C\u897F\uFF0C\u8FD9\u5BFC\u81F4\u4E86\u9519\u8BEF\u3002 \u4E0E\u5176\u4ED6 CUDA \u9519\u8BEF\u4E00\u6837\uFF0C\u60A8\u9700\u8981\u91CD\u65B0\u542F\u52A8\u5185\u6838\u624D\u80FD\u518D\u6B21\u8FD0\u884C\u8BAD\u7EC3\u3002"),kp.forEach(s),an=c(e),Dt=i(e,"P",{});var Km=o(Dt);nf=n(Km,"\u8981\u89E3\u51B3\u8FD9\u4E2A\u95EE\u9898\uFF0C\u60A8\u53EA\u9700\u8981\u4F7F\u7528\u66F4\u5C11\u7684 GPU \u7A7A\u95F4\u2014\u2014\u8FD9\u5F80\u5F80\u8BF4\u8D77\u6765\u5BB9\u6613\u505A\u8D77\u6765\u96BE\u3002 \u9996\u5148\uFF0C\u786E\u4FDD\u60A8\u6CA1\u6709\u540C\u65F6\u5728 GPU \u4E0A\u8FD0\u884C\u4E24\u4E2A\u6A21\u578B\uFF08\u5F53\u7136\uFF0C\u9664\u975E\u60A8\u7684\u95EE\u9898\u9700\u8981\u8FD9\u6837\u505A\uFF09\u3002 \u7136\u540E\uFF0C\u60A8\u53EF\u80FD\u5E94\u8BE5\u51CF\u5C11batch\u7684\u5927\u5C0F\uFF0C\u56E0\u4E3A\u5B83\u76F4\u63A5\u5F71\u54CD\u6A21\u578B\u7684\u6240\u6709\u4E2D\u95F4\u8F93\u51FA\u7684\u5927\u5C0F\u53CA\u5176\u68AF\u5EA6\u3002 \u5982\u679C\u95EE\u9898\u4ECD\u7136\u5B58\u5728\uFF0C\u8BF7\u8003\u8651\u4F7F\u7528\u8F83\u5C0F\u7248\u672C\u7684\u6A21\u578B\u3002"),Km.forEach(s),rn=c(e),d(de.$$.fragment,e),ln=c(e),gs=i(e,"H3",{id:!0});var Ym=o(gs);pf=n(Ym,"\u8BC4\u4F30\u6A21\u578B"),Ym.forEach(s),nn=c(e),_e=i(e,"P",{});var jp=o(_e);of=n(jp,"\u73B0\u5728\u6211\u4EEC\u5DF2\u7ECF\u89E3\u51B3\u4E86\u4EE3\u7801\u7684\u6240\u6709\u95EE\u9898\uFF0C\u4E00\u5207\u90FD\u5F88\u5B8C\u7F8E\uFF0C\u8BAD\u7EC3\u5E94\u8BE5\u53EF\u4EE5\u987A\u5229\u8FDB\u884C\uFF0C\u5BF9\u5427\uFF1F \u6CA1\u90A3\u4E48\u5FEB\uFF01 \u5982\u679C\u4F60\u8FD0\u884C "),Za=i(jp,"CODE",{});var Jm=o(Za);ff=n(Jm,"trainer.train()"),Jm.forEach(s),cf=n(jp," \u547D\u4EE4\uFF0C\u4E00\u5F00\u59CB\u4E00\u5207\u770B\u8D77\u6765\u90FD\u4E0D\u9519\uFF0C\u4F46\u8FC7\u4E00\u4F1A\u513F\u4F60\u4F1A\u5F97\u5230\u4EE5\u4E0B\u4FE1\u606F\uFF1A"),jp.forEach(s),pn=c(e),d(Ps.$$.fragment,e),on=c(e),d(Cs.$$.fragment,e),fn=c(e),At=i(e,"P",{});var Zm=o(At);mf=n(Zm,"\u60A8\u5C06\u610F\u8BC6\u5230\u6B64\u9519\u8BEF\u51FA\u73B0\u5728\u8BC4\u4F30\u9636\u6BB5\uFF0C\u56E0\u6B64\u8FD9\u662F\u6211\u4EEC\u9700\u8981\u8C03\u8BD5\u7684\u6700\u540E\u4E00\u4EF6\u4E8B\u3002"),Zm.forEach(s),cn=c(e),$e=i(e,"P",{});var vp=o($e);uf=n(vp,"\u60A8\u53EF\u4EE5\u50CF\u8FD9\u6837\u5728\u8BAD\u7EC3\u4E2D\u72EC\u7ACB\u8FD0\u884C"),Qa=i(vp,"CODE",{});var Qm=o(Qa);df=n(Qm,"Trainer"),Qm.forEach(s),_f=n(vp,"\u7684\u8BC4\u4F30\u5FAA\u73AF\uFF1A"),vp.forEach(s),mn=c(e),d(Ts.$$.fragment,e),un=c(e),d(zs.$$.fragment,e),dn=c(e),d(he.$$.fragment,e),_n=c(e),xt=i(e,"P",{});var Xm=o(xt);$f=n(Xm,"\u5728\u5C1D\u8BD5\u8C03\u8BD5\u8BC4\u4F30\u5FAA\u73AF\u4E2D\u7684\u95EE\u9898\u4E4B\u524D\uFF0C\u60A8\u5E94\u8BE5\u9996\u5148\u786E\u4FDD\u60A8\u5DF2\u7ECF\u67E5\u770B\u4E86\u6570\u636E\uFF0C\u80FD\u591F\u6B63\u786E\u5730\u5F62\u6210\u6279\u5904\u7406\uFF0C\u5E76\u4E14\u53EF\u4EE5\u5728\u5176\u4E0A\u8FD0\u884C\u60A8\u7684\u6A21\u578B\u3002 \u6211\u4EEC\u5DF2\u7ECF\u5B8C\u6210\u4E86\u6240\u6709\u8FD9\u4E9B\u6B65\u9AA4\uFF0C\u56E0\u6B64\u53EF\u4EE5\u6267\u884C\u4EE5\u4E0B\u4EE3\u7801\u800C\u4E0D\u4F1A\u51FA\u9519\uFF1A"),Xm.forEach(s),$n=c(e),d(Ds.$$.fragment,e),hn=c(e),Ut=i(e,"P",{});var eu=o(Ut);hf=n(eu,"\u7A0D\u7B49\u4E00\u4F1A\u513F\uFF0C\u9519\u8BEF\u51FA\u73B0\uFF0C\u5728\u8BC4\u4F30\u9636\u6BB5\u7ED3\u675F\u65F6\uFF0C\u5982\u679C\u6211\u4EEC\u67E5\u770Btrackback\uFF0C\u6211\u4EEC\u4F1A\u770B\u5230\uFF1A"),eu.forEach(s),bn=c(e),d(As.$$.fragment,e),kn=c(e),K=i(e,"P",{});var pa=o(K);bf=n(pa,"\u8FD9\u544A\u8BC9\u6211\u4EEC\u9519\u8BEF\u6E90\u81EA "),Xa=i(pa,"CODE",{});var su=o(Xa);kf=n(su,"datasets/metric.py"),su.forEach(s),jf=n(pa," \u6A21\u5757\u2014\u2014\u6240\u4EE5\u8FD9\u662F\u6211\u4EEC\u7684 "),er=i(pa,"CODE",{});var tu=o(er);vf=n(tu,"compute_metrics()"),tu.forEach(s),wf=n(pa," \u51FD\u6570\u7684\u95EE\u9898\u3002 \u5B83\u9700\u8981\u4E00\u4E2A\u5E26\u6709 logits \u548C\u6807\u7B7E\u7684\u5143\u7EC4\u4F5C\u4E3A NumPy \u6570\u7EC4\uFF0C\u6240\u4EE5\u8BA9\u6211\u4EEC\u5C1D\u8BD5\u8F93\u5165\u5B83\uFF1A"),pa.forEach(s),jn=c(e),d(xs.$$.fragment,e),vn=c(e),d(Us.$$.fragment,e),wn=c(e),Ot=i(e,"P",{});var au=o(Ot);Ef=n(au,"\u6211\u4EEC\u5F97\u5230\u540C\u6837\u7684\u9519\u8BEF\uFF0C\u6240\u4EE5\u95EE\u9898\u80AF\u5B9A\u51FA\u5728\u90A3\u4E2A\u51FD\u6570\u4E0A\u3002 \u5982\u679C\u6211\u4EEC\u56DE\u987E\u5B83\u7684\u4EE3\u7801\uFF0C\u6211\u4EEC\u4F1A\u53D1\u73B0\u5B83\u53EA\u662F\u5C06\u201C\u9884\u6D4B\u201D\u548C\u201C\u771F\u5B9E\u7684\u6807\u7B7E\u201D\u8F6C\u53D1\u5230\u201Cmetric.compute()\u201D\u3002 \u90A3\u4E48\u8FD9\u79CD\u65B9\u6CD5\u6709\u95EE\u9898\u5417\uFF1F \u5E76\u4E0D\u771F\u5730\u3002 \u8BA9\u6211\u4EEC\u5FEB\u901F\u6D4F\u89C8\u4E00\u4E0B\u5F62\u72B6\uFF1A"),au.forEach(s),En=c(e),d(Os.$$.fragment,e),yn=c(e),d(Ss.$$.fragment,e),qn=c(e),be=i(e,"P",{});var wp=o(be);yf=n(wp,"\u6211\u4EEC\u7684\u9884\u6D4B\u4ECD\u7136\u662F logits\uFF0C\u800C\u4E0D\u662F\u5B9E\u9645\u7684\u9884\u6D4B\uFF0C\u8FD9\u5C31\u662Fmetrics\u8FD4\u56DE\u8FD9\u4E2A\uFF08\u6709\u70B9\u6A21\u7CCA\uFF09\u9519\u8BEF\u7684\u539F\u56E0\u3002 \u4FEE\u590D\u5F88\u7B80\u5355\uFF1B \u6211\u4EEC\u53EA\u9700\u8981\u5728 "),sr=i(wp,"CODE",{});var ru=o(sr);qf=n(ru,"compute_metrics()"),ru.forEach(s),gf=n(wp," \u51FD\u6570\u4E2D\u6DFB\u52A0\u4E00\u4E2A argmax\uFF1A"),wp.forEach(s),gn=c(e),d(Ls.$$.fragment,e),Pn=c(e),d(Is.$$.fragment,e),Cn=c(e),St=i(e,"P",{});var lu=o(St);Pf=n(lu,"\u73B0\u5728\u6211\u4EEC\u7684\u9519\u8BEF\u5DF2\u4FEE\u590D\uFF01 \u8FD9\u662F\u6700\u540E\u4E00\u4E2A\uFF0C\u6240\u4EE5\u6211\u4EEC\u7684\u811A\u672C\u73B0\u5728\u5C06\u6B63\u786E\u8BAD\u7EC3\u6A21\u578B\u3002"),lu.forEach(s),Tn=c(e),Lt=i(e,"P",{});var nu=o(Lt);Cf=n(nu,"\u4F5C\u4E3A\u53C2\u8003\uFF0C\u8FD9\u91CC\u662F\u5B8C\u5168\u4FEE\u6B63\u597D\u7684\u811A\u672C\uFF1A"),nu.forEach(s),zn=c(e),d(Fs.$$.fragment,e),Dn=c(e),It=i(e,"P",{});var pu=o(It);Tf=n(pu,"\u5728\u8FD9\u79CD\u60C5\u51B5\u4E0B\uFF0C\u5982\u679C\u6CA1\u6709\u66F4\u591A\u9519\u8BEF\uFF0C\u6211\u4EEC\u7684\u811A\u672C\u5C06\u5FAE\u8C03\u4E00\u4E2A\u5E94\u8BE5\u7ED9\u51FA\u5408\u7406\u7ED3\u679C\u7684\u6A21\u578B\u3002 \u4F46\u662F\uFF0C\u5982\u679C\u8BAD\u7EC3\u6CA1\u6709\u4EFB\u4F55\u9519\u8BEF\uFF0C\u800C\u8BAD\u7EC3\u51FA\u6765\u7684\u6A21\u578B\u6839\u672C\u8868\u73B0\u4E0D\u4F73\uFF0C\u6211\u4EEC\u8BE5\u600E\u4E48\u529E\uFF1F \u8FD9\u662F\u673A\u5668\u5B66\u4E60\u4E2D\u6700\u96BE\u7684\u90E8\u5206\uFF0C\u6211\u4EEC\u5C06\u5411\u60A8\u5C55\u793A\u4E00\u4E9B\u53EF\u4EE5\u63D0\u4F9B\u5E2E\u52A9\u7684\u6280\u672F\u3002"),pu.forEach(s),An=c(e),d(ke.$$.fragment,e),xn=c(e),Gs=i(e,"H2",{id:!0});var iu=o(Gs);zf=n(iu,"\u5728\u8BAD\u7EC3\u671F\u95F4\u8C03\u8BD5\u9759\u9ED8\uFF08\u6CA1\u6709\u4EFB\u4F55\u9519\u8BEF\u63D0\u793A\uFF09\u9519\u8BEF"),iu.forEach(s),Un=c(e),Ft=i(e,"P",{});var ou=o(Ft);Df=n(ou,"\u6211\u4EEC\u53EF\u4EE5\u505A\u4E9B\u4EC0\u4E48\u6765\u8C03\u8BD5\u4E00\u4E2A\u6CA1\u6709\u9519\u8BEF\u5730\u5B8C\u6210\u4F46\u6CA1\u6709\u5F97\u5230\u597D\u7684\u7ED3\u679C\u7684\u8BAD\u7EC3\uFF1F \u6211\u4EEC\u4F1A\u5728\u8FD9\u91CC\u7ED9\u4F60\u4E00\u4E9B\u63D0\u793A\uFF0C\u4F46\u8BF7\u6CE8\u610F\uFF0C\u8FD9\u79CD\u8C03\u8BD5\u662F\u673A\u5668\u5B66\u4E60\u4E2D\u6700\u96BE\u7684\u90E8\u5206\uFF0C\u5E76\u4E14\u6CA1\u6709\u795E\u5947\u7684\u7B54\u6848\u3002"),ou.forEach(s),On=c(e),Ms=i(e,"H3",{id:!0});var fu=o(Ms);Af=n(fu,"\u68C0\u67E5\u60A8\u7684\u6570\u636E\uFF08\u518D\u6B21\uFF01\uFF09"),fu.forEach(s),Sn=c(e),Gt=i(e,"P",{});var cu=o(Gt);xf=n(cu,"\u53EA\u6709\u5728\u7406\u8BBA\u4E0A\u53EF\u4EE5\u4ECE\u60A8\u7684\u6570\u636E\u4E2D\u5B66\u5230\u4EFB\u4F55\u4E1C\u897F\u65F6\uFF0C\u60A8\u7684\u6A21\u578B\u624D\u4F1A\u5B66\u5230\u4E00\u4E9B\u4E1C\u897F\u3002 \u5982\u679C\u5B58\u5728\u635F\u574F\u6570\u636E\u7684\u9519\u8BEF\u6216\u6807\u7B7E\u662F\u968F\u673A\u5C5E\u6027\u7684\uFF0C\u90A3\u4E48\u60A8\u5F88\u53EF\u80FD\u4E0D\u4F1A\u5728\u6570\u636E\u96C6\u4E0A\u83B7\u5F97\u4EFB\u4F55\u77E5\u8BC6\u3002 \u56E0\u6B64\uFF0C\u59CB\u7EC8\u9996\u5148\u4ED4\u7EC6\u68C0\u67E5\u60A8\u7684\u89E3\u7801\u8F93\u5165\u548C\u6807\u7B7E\uFF0C\u7136\u540E\u95EE\u81EA\u5DF1\u4EE5\u4E0B\u95EE\u9898\uFF1A"),cu.forEach(s),Ln=c(e),F=i(e,"UL",{});var ze=o(F);tr=i(ze,"LI",{});var mu=o(tr);Uf=n(mu,"\u89E3\u7801\u540E\u7684\u6570\u636E\u662F\u5426\u53EF\u4EE5\u7406\u89E3\uFF1F"),mu.forEach(s),Of=c(ze),ar=i(ze,"LI",{});var uu=o(ar);Sf=n(uu,"\u4F60\u8BA4\u540C\u8FD9\u4E9B\u6807\u7B7E\u5417\uFF1F"),uu.forEach(s),Lf=c(ze),rr=i(ze,"LI",{});var du=o(rr);If=n(du,"\u6709\u6CA1\u6709\u4E00\u4E2A\u6807\u7B7E\u6BD4\u5176\u4ED6\u6807\u7B7E\u66F4\u5E38\u89C1\uFF1F"),du.forEach(s),Ff=c(ze),lr=i(ze,"LI",{});var _u=o(lr);Gf=n(_u,"\u5982\u679C\u6A21\u578B\u9884\u6D4B\u968F\u673A\u7684\u7B54\u6848/\u603B\u662F\u76F8\u540C\u7684\u7B54\u6848\uFF0C\u90A3\u4E48loss/\u8BC4\u4F30\u6307\u6807\u5E94\u8BE5\u662F\u591A\u5C11\uFF1F"),_u.forEach(s),ze.forEach(s),In=c(e),d(je.$$.fragment,e),Fn=c(e),Mt=i(e,"P",{});var $u=o(Mt);Mf=n($u,"\u67E5\u770B\u60A8\u7684\u6570\u636E\u540E\uFF0C\u67E5\u770B\u6A21\u578B\u7684\u4E00\u4E9B\u9884\u6D4B\u5E76\u5BF9\u5176\u8FDB\u884C\u89E3\u7801\u3002 \u5982\u679C\u6A21\u578B\u603B\u662F\u9884\u6D4B\u540C\u6837\u7684\u4E8B\u60C5\uFF0C\u90A3\u53EF\u80FD\u662F\u56E0\u4E3A\u4F60\u7684\u6570\u636E\u96C6\u504F\u5411\u4E00\u4E2A\u7C7B\u522B\uFF08\u9488\u5BF9\u5206\u7C7B\u95EE\u9898\uFF09\uFF1B \u8FC7\u91C7\u6837\u7A00\u6709\u7C7B\u7B49\u6280\u672F\u53EF\u80FD\u4F1A\u6709\u6240\u5E2E\u52A9\u3002"),$u.forEach(s),Gn=c(e),Wt=i(e,"P",{});var hu=o(Wt);Wf=n(hu,"\u5982\u679C\u60A8\u5728\u521D\u59CB\u6A21\u578B\u4E0A\u83B7\u5F97\u7684loss/\u8BC4\u4F30\u6307\u6807\u4E0E\u60A8\u671F\u671B\u7684\u968F\u673A\u9884\u6D4B\u7684loss/\u8BC4\u4F30\u6307\u6807\u975E\u5E38\u4E0D\u540C\uFF0C\u8BF7\u4ED4\u7EC6\u68C0\u67E5\u60A8\u7684loss\u6216\u8BC4\u4F30\u6307\u6807\u7684\u8BA1\u7B97\u65B9\u5F0F\uFF0C\u56E0\u4E3A\u90A3\u91CC\u53EF\u80FD\u5B58\u5728\u9519\u8BEF\u3002 \u5982\u679C\u60A8\u4F7F\u7528\u6700\u540E\u6DFB\u52A0\u7684\u591A\u4E2Aloss\uFF0C\u8BF7\u786E\u4FDD\u5B83\u4EEC\u5177\u6709\u76F8\u540C\u7684\u89C4\u6A21\u3002"),hu.forEach(s),Mn=c(e),Nt=i(e,"P",{});var bu=o(Nt);Nf=n(bu,"\u5F53\u60A8\u786E\u5B9A\u60A8\u7684\u6570\u636E\u662F\u5B8C\u7F8E\u7684\u65F6\uFF0C\u60A8\u53EF\u4EE5\u901A\u8FC7\u4E00\u4E2A\u7B80\u5355\u7684\u6D4B\u8BD5\u6765\u67E5\u770B\u6A21\u578B\u662F\u5426\u80FD\u591F\u5BF9\u5176\u8FDB\u884C\u8BAD\u7EC3\u3002"),bu.forEach(s),Wn=c(e),Ws=i(e,"H3",{id:!0});var ku=o(Ws);Rf=n(ku,"\u5728\u4E00\u6279\u4E0A\u8FC7\u5EA6\u62DF\u5408\u4F60\u7684\u6A21\u578B"),ku.forEach(s),Nn=c(e),Rt=i(e,"P",{});var ju=o(Rt);Hf=n(ju,"\u8FC7\u5EA6\u62DF\u5408\u901A\u5E38\u662F\u6211\u4EEC\u5728\u8BAD\u7EC3\u65F6\u5C3D\u91CF\u907F\u514D\u7684\u4E8B\u60C5\uFF0C\u56E0\u4E3A\u8FD9\u610F\u5473\u7740\u6A21\u578B\u6CA1\u6709\u5B66\u4E60\u8BC6\u522B\u6211\u4EEC\u60F3\u8981\u7684\u4E00\u822C\u7279\u5F81\uFF0C\u800C\u53EA\u662F\u8BB0\u4F4F\u4E86\u8BAD\u7EC3\u6837\u672C\u3002 \u5728\u8FD9\u79CD\u60C5\u51B5\u4E0B\uFF0C\u4E00\u904D\u53C8\u4E00\u904D\u5730\u5C1D\u8BD5\u5728\u4E00\u4E2A\u6279\u6B21\u4E0A\u8BAD\u7EC3\u60A8\u7684\u6A21\u578B\u662F\u4E00\u4E2A\u5F88\u597D\u7684\u6D4B\u8BD5\uFF0C\u53EF\u4EE5\u68C0\u67E5\u60A8\u7684\u95EE\u9898\u662F\u5426\u53EF\u4EE5\u901A\u8FC7\u60A8\u5C1D\u8BD5\u8BAD\u7EC3\u7684\u6A21\u578B\u6765\u89E3\u51B3\u3002 \u5B83\u8FD8\u5C06\u5E2E\u52A9\u60A8\u67E5\u770B\u60A8\u7684\u521D\u59CB\u5B66\u4E60\u7387\u662F\u5426\u592A\u9AD8\u3002"),ju.forEach(s),Rn=c(e),ve=i(e,"P",{});var Ep=o(ve);Bf=n(Ep,"\u4E00\u65E6\u4F60\u5B9A\u4E49\u4E86\u4F60\u7684 "),nr=i(Ep,"CODE",{});var vu=o(nr);Vf=n(vu,"Trainer"),vu.forEach(s),Kf=n(Ep," \u4E4B\u540E\uFF0C\u8FD9\u6837\u505A\u771F\u7684\u5F88\u5BB9\u6613\uFF1B \u53EA\u9700\u83B7\u53D6\u4E00\u6279\u8BAD\u7EC3\u6570\u636E\uFF0C\u7136\u540E\u4EC5\u4F7F\u7528\u8BE5\u6279\u6B21\u8FD0\u884C\u4E00\u4E2A\u5C0F\u578B\u624B\u52A8\u8BAD\u7EC3\u5FAA\u73AF\uFF0C\u5927\u7EA6 20 \u6B65\uFF1A"),Ep.forEach(s),Hn=c(e),d(Ns.$$.fragment,e),Bn=c(e),d(we.$$.fragment,e),Vn=c(e),Ht=i(e,"P",{});var wu=o(Ht);Yf=n(wu,"\u751F\u6210\u7684\u6A21\u578B\u5728\u4E00\u4E2A\u201C\u6279\u6B21\u201D\u4E0A\u5E94\u8BE5\u6709\u63A5\u8FD1\u5B8C\u7F8E\u7684\u7ED3\u679C\u3002 \u8BA9\u6211\u4EEC\u8BA1\u7B97\u7ED3\u679C\u9884\u6D4B\u7684\u6307\u6807\uFF1A"),wu.forEach(s),Kn=c(e),d(Rs.$$.fragment,e),Yn=c(e),d(Hs.$$.fragment,e),Jn=c(e),Bt=i(e,"P",{});var Eu=o(Bt);Jf=n(Eu,"100% \u51C6\u786E\u7387\uFF0C\u73B0\u5728\u8FD9\u662F\u4E00\u4E2A\u5F88\u597D\u7684\u8FC7\u62DF\u5408\u793A\u4F8B\uFF08\u8FD9\u610F\u5473\u7740\u5982\u679C\u4F60\u5728\u4EFB\u4F55\u5176\u4ED6\u53E5\u5B50\u4E0A\u5C1D\u8BD5\u4F60\u7684\u6A21\u578B\uFF0C\u5B83\u5F88\u53EF\u80FD\u4F1A\u7ED9\u4F60\u4E00\u4E2A\u9519\u8BEF\u7684\u7B54\u6848\uFF09\uFF01"),Eu.forEach(s),Zn=c(e),Vt=i(e,"P",{});var yu=o(Vt);Zf=n(yu,"\u5982\u679C\u4F60\u6CA1\u6709\u8BBE\u6CD5\u8BA9\u4F60\u7684\u6A21\u578B\u83B7\u5F97\u8FD9\u6837\u7684\u5B8C\u7F8E\u7ED3\u679C\uFF0C\u8FD9\u610F\u5473\u7740\u4F60\u6784\u5EFA\u95EE\u9898\u6216\u6570\u636E\u7684\u65B9\u5F0F\u6709\u95EE\u9898\uFF0C\u6240\u4EE5\u4F60\u5E94\u8BE5\u4FEE\u590D\u5B83\u3002 \u53EA\u6709\u5F53\u4F60\u53EF\u4EE5\u901A\u8FC7\u8FC7\u62DF\u5408\u6D4B\u8BD5\u65F6\uFF0C\u4F60\u624D\u80FD\u786E\u5B9A\u4F60\u7684\u6A21\u578B\u5B9E\u9645\u4E0A\u53EF\u4EE5\u5B66\u5230\u4E00\u4E9B\u4E1C\u897F\u3002"),yu.forEach(s),Qn=c(e),d(Ee.$$.fragment,e),Xn=c(e),Bs=i(e,"H3",{id:!0});var qu=o(Bs);Qf=n(qu,"\u5728\u4F60\u6709\u7B2C\u4E00\u4E2A\u57FA\u7EBF\u4E4B\u524D\u4E0D\u8981\u8C03\u6574\u4EFB\u4F55\u4E1C\u897F"),qu.forEach(s),ep=c(e),ye=i(e,"P",{});var yp=o(ye);Xf=n(yp,"\u8D85\u53C2\u6570\u8C03\u4F18\u603B\u662F\u88AB\u5F3A\u8C03\u4E3A\u673A\u5668\u5B66\u4E60\u4E2D\u6700\u96BE\u7684\u90E8\u5206\uFF0C\u4F46\u8FD9\u53EA\u662F\u5E2E\u52A9\u60A8\u5728\u6307\u6807\u4E0A\u6709\u6240\u6536\u83B7\u7684\u6700\u540E\u4E00\u6B65\u3002 \u5927\u591A\u6570\u60C5\u51B5\u4E0B\uFF0C"),pr=i(yp,"CODE",{});var gu=o(pr);ec=n(gu,"Trainer"),gu.forEach(s),sc=n(yp," \u7684\u9ED8\u8BA4\u8D85\u53C2\u6570\u53EF\u4EE5\u5F88\u597D\u5730\u4E3A\u60A8\u63D0\u4F9B\u826F\u597D\u7684\u7ED3\u679C\uFF0C\u56E0\u6B64\u5728\u60A8\u83B7\u5F97\u8D85\u51FA\u6570\u636E\u96C6\u57FA\u7EBF\u7684\u4E1C\u897F\u4E4B\u524D\uFF0C\u4E0D\u8981\u5F00\u59CB\u8FDB\u884C\u8017\u65F6\u4E14\u6602\u8D35\u7684\u8D85\u53C2\u6570\u641C\u7D22 ."),yp.forEach(s),sp=c(e),Kt=i(e,"P",{});var Pu=o(Kt);tc=n(Pu,"\u4E00\u65E6\u4F60\u6709\u4E00\u4E2A\u8DB3\u591F\u597D\u7684\u6A21\u578B\uFF0C\u4F60\u5C31\u53EF\u4EE5\u5F00\u59CB\u7A0D\u5FAE\u8C03\u6574\u4E00\u4E0B\u3002 \u4E0D\u8981\u5C1D\u8BD5\u4F7F\u7528\u4E0D\u540C\u7684\u8D85\u53C2\u6570\u542F\u52A8\u4E00\u5343\u6B21\u8FD0\u884C\uFF0C\u800C\u662F\u6BD4\u8F83\u4E00\u4E2A\u8D85\u53C2\u6570\u7684\u4E0D\u540C\u503C\u7684\u51E0\u6B21\u8FD0\u884C\uFF0C\u4EE5\u4E86\u89E3\u54EA\u4E2A\u5F71\u54CD\u6700\u5927\u3002"),Pu.forEach(s),tp=c(e),Yt=i(e,"P",{});var Cu=o(Yt);ac=n(Cu,"\u5982\u679C\u60A8\u6B63\u5728\u8C03\u6574\u6A21\u578B\u672C\u8EAB\uFF0C\u4E0D\u8981\u5C1D\u8BD5\u4EFB\u4F55\u60A8\u65E0\u6CD5\u5408\u7406\u8BC1\u660E\u7684\u4E8B\u60C5\u3002 \u59CB\u7EC8\u786E\u4FDD\u60A8\u8FD4\u56DE\u8FC7\u62DF\u5408\u6D4B\u8BD5\u4EE5\u9A8C\u8BC1\u60A8\u7684\u66F4\u6539\u6CA1\u6709\u4EA7\u751F\u4EFB\u4F55\u610F\u5916\u540E\u679C\u3002"),Cu.forEach(s),ap=c(e),Vs=i(e,"H3",{id:!0});var Tu=o(Vs);rc=n(Tu,"\u8BF7\u6C42\u5E2E\u5FD9"),Tu.forEach(s),rp=c(e),qe=i(e,"P",{});var qp=o(qe);lc=n(qp,"\u5E0C\u671B\u60A8\u4F1A\u5728\u672C\u8282\u4E2D\u627E\u5230\u4E00\u4E9B\u53EF\u4EE5\u5E2E\u52A9\u60A8\u89E3\u51B3\u95EE\u9898\u7684\u5EFA\u8BAE\uFF0C\u4F46\u5982\u679C\u4E0D\u662F\u8FD9\u6837\uFF0C\u8BF7\u8BB0\u4F4F\u60A8\u53EF\u4EE5\u968F\u65F6\u5728 "),Ks=i(qp,"A",{href:!0,rel:!0});var zu=o(Ks);nc=n(zu,"\u8BBA\u575B"),zu.forEach(s),pc=n(qp," \u4E0A\u5411\u793E\u533A\u63D0\u95EE\u3002"),qp.forEach(s),lp=c(e),Jt=i(e,"P",{});var Du=o(Jt);ic=n(Du,"\u4EE5\u4E0B\u662F\u4E00\u4E9B\u53EF\u80FD\u6709\u7528\u7684\u989D\u5916\u8D44\u6E90\uFF1A"),Du.forEach(s),np=c(e),G=i(e,"UL",{});var De=o(G);Zt=i(De,"LI",{});var vc=o(Zt);Ys=i(vc,"A",{href:!0,rel:!0});var Au=o(Ys);oc=n(Au,"\u201C\u4F5C\u4E3A\u5DE5\u7A0B\u6700\u4F73\u5B9E\u8DF5\u5DE5\u5177\u7684\u518D\u73B0\u6027\u201D"),Au.forEach(s),fc=n(vc,"\uFF0C\u4F5C\u8005\uFF1AJoel Grus"),vc.forEach(s),cc=c(De),Qt=i(De,"LI",{});var wc=o(Qt);Js=i(wc,"A",{href:!0,rel:!0});var xu=o(Js);mc=n(xu,"\u201C\u795E\u7ECF\u7F51\u7EDC\u8C03\u8BD5\u6E05\u5355\u201D"),xu.forEach(s),uc=n(wc," \u4F5C\u8005\uFF1ACecelia Shao"),wc.forEach(s),dc=c(De),Xt=i(De,"LI",{});var Ec=o(Xt);Zs=i(Ec,"A",{href:!0,rel:!0});var Uu=o(Zs);_c=n(Uu,"\u201C\u5982\u4F55\u5BF9\u673A\u5668\u5B66\u4E60\u4EE3\u7801\u8FDB\u884C\u5355\u5143\u6D4B\u8BD5\u201D"),Uu.forEach(s),$c=n(Ec," by Chase Roberts"),Ec.forEach(s),hc=c(De),ea=i(De,"LI",{});var yc=o(ea);Qs=i(yc,"A",{href:!0,rel:!0});var Ou=o(Qs);bc=n(Ou,"\u201C\u8BAD\u7EC3\u795E\u7ECF\u7F51\u7EDC\u7684\u79D8\u8BC0\u201D"),Ou.forEach(s),kc=n(yc,"\u4F5C\u8005\uFF1AAndrej Karpathy"),yc.forEach(s),De.forEach(s),pp=c(e),sa=i(e,"P",{});var Su=o(sa);jc=n(Su,"\u5F53\u7136\uFF0C\u5E76\u4E0D\u662F\u4F60\u5728\u8BAD\u7EC3\u795E\u7ECF\u7F51\u7EDC\u65F6\u9047\u5230\u7684\u6BCF\u4E00\u4E2A\u95EE\u9898\u90FD\u662F\u4F60\u81EA\u5DF1\u7684\u9519\uFF01 \u5982\u679C\u60A8\u5728 \u{1F917} Transformers \u6216 \u{1F917} Datasets \u5E93\u4E2D\u9047\u5230\u770B\u8D77\u6765\u4E0D\u6B63\u786E\u7684\u5185\u5BB9\uFF0C\u60A8\u53EF\u80FD\u9047\u5230\u4E86\u9519\u8BEF\u3002 \u4F60\u5E94\u8BE5\u544A\u8BC9\u6211\u4EEC\u8FD9\u4E00\u5207\uFF0C\u5728\u4E0B\u4E00\u8282\u4E2D\uFF0C\u6211\u4EEC\u5C06\u51C6\u786E\u89E3\u91CA\u5982\u4F55\u505A\u5230\u8FD9\u4E00\u70B9\u3002"),Su.forEach(s),this.h()},h(){w(m,"name","hf:doc:metadata"),w(m,"content",JSON.stringify(ed)),w(g,"id",""),w(D,"href","/course/chapter7"),w(Ae,"id",""),w(Ue,"href","https://huggingface.co/datasets/glue"),w(Ue,"rel","nofollow"),w(Le,"id",""),w(Ye,"href","https://huggingface.co/transformers/model_doc/distilbert.html#distilbertforsequenceclassification"),w(Ye,"rel","nofollow"),w(pe,"id","datasets-dataloaders"),w(pe,"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"),w(pe,"href","#datasets-dataloaders"),w(Z,"class","relative group"),w(us,"id",""),w(ws,"id",""),w(me,"id","cuda-outofmemory"),w(me,"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"),w(me,"href","#cuda-outofmemory"),w(Q,"class","relative group"),w(gs,"id",""),w(Gs,"id",""),w(Ms,"id",""),w(Ws,"id",""),w(Bs,"id",""),w(Vs,"id",""),w(Ks,"href","https://discuss.huggingface.co/"),w(Ks,"rel","nofollow"),w(Ys,"href","https://docs.google.com/presentation/d/1yHLPvPhUs2KGI5ZWo0sU-PKU3GimAk3iTsI38Z-B5Gw/edit#slide=id.p"),w(Ys,"rel","nofollow"),w(Js,"href","https://towardsdatascience.com/checklist-for-debugging-neural-networks-d8b2a9434f21"),w(Js,"rel","nofollow"),w(Zs,"href","https://medium.com/@keeper6928/how-to-unit-test-machine-learning-code-57cf6fd81765"),w(Zs,"rel","nofollow"),w(Qs,"href","http://karpathy.github.io/2019/04/25/recipe/"),w(Qs,"rel","nofollow")},m(e,t){a(document.head,m),r(e,E,t),_(j,e,t),r(e,v,t),r(e,g,t),a(g,q),r(e,P,t),_(C,e,t),r(e,z,t),r(e,y,t),a(y,M),a(y,D),a(D,A),a(y,et),a(y,se),a(se,st),a(y,gp),r(e,dr,t),r(e,Ae,t),a(Ae,Pp),r(e,_r,t),_(xe,e,t),r(e,$r,t),r(e,W,t),a(W,Cp),a(W,ia),a(ia,Tp),a(W,zp),a(W,oa),a(oa,Dp),a(W,Ap),r(e,hr,t),r(e,te,t),a(te,xp),a(te,fa),a(fa,Up),a(te,Op),r(e,br,t),r(e,ae,t),a(ae,Sp),a(ae,Ue),a(Ue,Lp),a(ae,Ip),r(e,kr,t),_(Oe,e,t),r(e,jr,t),r(e,tt,t),a(tt,Fp),r(e,vr,t),_(Se,e,t),r(e,wr,t),r(e,Le,t),a(Le,Gp),r(e,Er,t),r(e,at,t),a(at,Mp),r(e,yr,t),r(e,re,t),a(re,Wp),a(re,ca),a(ca,Np),a(re,Rp),r(e,qr,t),_(Ie,e,t),r(e,gr,t),_(Fe,e,t),r(e,Pr,t),r(e,N,t),a(N,Hp),a(N,ma),a(ma,Bp),a(N,Vp),a(N,ua),a(ua,Kp),a(N,Yp),r(e,Cr,t),r(e,O,t),a(O,Jp),a(O,da),a(da,Zp),a(O,Qp),a(O,_a),a(_a,Xp),a(O,ei),a(O,$a),a($a,si),a(O,ti),r(e,Tr,t),_(Ge,e,t),r(e,zr,t),r(e,rt,t),a(rt,ai),r(e,Dr,t),_(Me,e,t),r(e,Ar,t),r(e,lt,t),a(lt,ri),r(e,xr,t),_(We,e,t),r(e,Ur,t),r(e,nt,t),a(nt,li),r(e,Or,t),r(e,pt,t),a(pt,ni),r(e,Sr,t),_(Ne,e,t),r(e,Lr,t),_(Re,e,t),r(e,Ir,t),r(e,it,t),a(it,pi),r(e,Fr,t),_(He,e,t),r(e,Gr,t),_(Be,e,t),r(e,Mr,t),r(e,x,t),a(x,ii),a(x,ha),a(ha,oi),a(x,fi),a(x,ba),a(ba,ci),a(x,mi),a(x,ka),a(ka,ui),a(x,di),a(x,ja),a(ja,_i),a(x,$i),r(e,Wr,t),_(Ve,e,t),r(e,Nr,t),_(Ke,e,t),r(e,Rr,t),r(e,R,t),a(R,hi),a(R,Ye),a(Ye,bi),a(R,ki),a(R,va),a(va,ji),a(R,vi),r(e,Hr,t),r(e,le,t),a(le,wi),a(le,wa),a(wa,Ei),a(le,yi),r(e,Br,t),_(Je,e,t),r(e,Vr,t),_(Ze,e,t),r(e,Kr,t),r(e,ot,t),a(ot,qi),r(e,Yr,t),_(Qe,e,t),r(e,Jr,t),_(Xe,e,t),r(e,Zr,t),r(e,ft,t),a(ft,gi),r(e,Qr,t),_(es,e,t),r(e,Xr,t),_(ss,e,t),r(e,el,t),r(e,H,t),a(H,Pi),a(H,Ea),a(Ea,Ci),a(H,Ti),a(H,ya),a(ya,zi),a(H,Di),r(e,sl,t),_(ts,e,t),r(e,tl,t),_(as,e,t),r(e,al,t),r(e,B,t),a(B,Ai),a(B,qa),a(qa,xi),a(B,Ui),a(B,ga),a(ga,Oi),a(B,Si),r(e,rl,t),r(e,ct,t),a(ct,Li),r(e,ll,t),_(ne,e,t),r(e,nl,t),r(e,mt,t),a(mt,Ii),r(e,pl,t),r(e,ut,t),a(ut,Fi),r(e,il,t),r(e,Z,t),a(Z,pe),a(pe,Pa),_(rs,Pa,null),a(Z,Gi),a(Z,Ca),a(Ca,Mi),r(e,ol,t),r(e,S,t),a(S,Wi),a(S,Ta),a(Ta,Ni),a(S,Ri),a(S,za),a(za,Hi),a(S,Bi),a(S,Da),a(Da,Vi),a(S,Ki),r(e,fl,t),_(ls,e,t),r(e,cl,t),r(e,dt,t),a(dt,Yi),r(e,ml,t),_(ns,e,t),r(e,ul,t),r(e,_t,t),a(_t,Ji),r(e,dl,t),_(ps,e,t),r(e,_l,t),_(is,e,t),r(e,$l,t),r(e,L,t),a(L,Zi),a(L,Aa),a(Aa,Qi),a(L,Xi),a(L,xa),a(xa,eo),a(L,so),a(L,Ua),a(Ua,to),a(L,ao),r(e,hl,t),r(e,I,t),a(I,ro),a(I,Oa),a(Oa,lo),a(I,no),a(I,Sa),a(Sa,po),a(I,io),a(I,La),a(La,oo),a(I,fo),r(e,bl,t),_(os,e,t),r(e,kl,t),r(e,$t,t),a($t,co),r(e,jl,t),_(fs,e,t),r(e,vl,t),r(e,ht,t),a(ht,mo),r(e,wl,t),r(e,bt,t),a(bt,uo),r(e,El,t),_(cs,e,t),r(e,yl,t),r(e,U,t),a(U,_o),a(U,Ia),a(Ia,$o),a(U,ho),a(U,Fa),a(Fa,bo),a(U,ko),a(U,Ga),a(Ga,jo),a(U,vo),a(U,Ma),a(Ma,wo),a(U,Eo),r(e,ql,t),_(ms,e,t),r(e,gl,t),r(e,kt,t),a(kt,yo),r(e,Pl,t),r(e,jt,t),a(jt,qo),r(e,Cl,t),r(e,us,t),a(us,go),r(e,Tl,t),r(e,vt,t),a(vt,Po),r(e,zl,t),_(ds,e,t),r(e,Dl,t),r(e,ie,t),a(ie,Co),a(ie,Wa),a(Wa,To),a(ie,zo),r(e,Al,t),r(e,wt,t),a(wt,Do),r(e,xl,t),r(e,Et,t),a(Et,Ao),r(e,Ul,t),r(e,yt,t),a(yt,xo),r(e,Ol,t),_(_s,e,t),r(e,Sl,t),_($s,e,t),r(e,Ll,t),r(e,qt,t),a(qt,Uo),r(e,Il,t),_(hs,e,t),r(e,Fl,t),_(bs,e,t),r(e,Gl,t),r(e,gt,t),a(gt,Oo),r(e,Ml,t),_(ks,e,t),r(e,Wl,t),r(e,oe,t),a(oe,So),a(oe,Na),a(Na,Lo),a(oe,Io),r(e,Nl,t),_(js,e,t),r(e,Rl,t),r(e,Pt,t),a(Pt,Fo),r(e,Hl,t),_(vs,e,t),r(e,Bl,t),r(e,Ct,t),a(Ct,Go),r(e,Vl,t),r(e,ws,t),a(ws,Mo),r(e,Kl,t),r(e,Tt,t),a(Tt,Wo),r(e,Yl,t),r(e,fe,t),a(fe,No),a(fe,Ra),a(Ra,Ro),a(fe,Ho),r(e,Jl,t),_(Es,e,t),r(e,Zl,t),r(e,zt,t),a(zt,Bo),r(e,Ql,t),r(e,V,t),a(V,Vo),a(V,Ha),a(Ha,Ko),a(V,Yo),a(V,Ba),a(Ba,Jo),a(V,Zo),r(e,Xl,t),_(ys,e,t),r(e,en,t),r(e,ce,t),a(ce,Qo),a(ce,Va),a(Va,Xo),a(ce,ef),r(e,sn,t),r(e,Q,t),a(Q,me),a(me,Ka),_(qs,Ka,null),a(Q,sf),a(Q,Ya),a(Ya,tf),r(e,tn,t),r(e,ue,t),a(ue,af),a(ue,Ja),a(Ja,rf),a(ue,lf),r(e,an,t),r(e,Dt,t),a(Dt,nf),r(e,rn,t),_(de,e,t),r(e,ln,t),r(e,gs,t),a(gs,pf),r(e,nn,t),r(e,_e,t),a(_e,of),a(_e,Za),a(Za,ff),a(_e,cf),r(e,pn,t),_(Ps,e,t),r(e,on,t),_(Cs,e,t),r(e,fn,t),r(e,At,t),a(At,mf),r(e,cn,t),r(e,$e,t),a($e,uf),a($e,Qa),a(Qa,df),a($e,_f),r(e,mn,t),_(Ts,e,t),r(e,un,t),_(zs,e,t),r(e,dn,t),_(he,e,t),r(e,_n,t),r(e,xt,t),a(xt,$f),r(e,$n,t),_(Ds,e,t),r(e,hn,t),r(e,Ut,t),a(Ut,hf),r(e,bn,t),_(As,e,t),r(e,kn,t),r(e,K,t),a(K,bf),a(K,Xa),a(Xa,kf),a(K,jf),a(K,er),a(er,vf),a(K,wf),r(e,jn,t),_(xs,e,t),r(e,vn,t),_(Us,e,t),r(e,wn,t),r(e,Ot,t),a(Ot,Ef),r(e,En,t),_(Os,e,t),r(e,yn,t),_(Ss,e,t),r(e,qn,t),r(e,be,t),a(be,yf),a(be,sr),a(sr,qf),a(be,gf),r(e,gn,t),_(Ls,e,t),r(e,Pn,t),_(Is,e,t),r(e,Cn,t),r(e,St,t),a(St,Pf),r(e,Tn,t),r(e,Lt,t),a(Lt,Cf),r(e,zn,t),_(Fs,e,t),r(e,Dn,t),r(e,It,t),a(It,Tf),r(e,An,t),_(ke,e,t),r(e,xn,t),r(e,Gs,t),a(Gs,zf),r(e,Un,t),r(e,Ft,t),a(Ft,Df),r(e,On,t),r(e,Ms,t),a(Ms,Af),r(e,Sn,t),r(e,Gt,t),a(Gt,xf),r(e,Ln,t),r(e,F,t),a(F,tr),a(tr,Uf),a(F,Of),a(F,ar),a(ar,Sf),a(F,Lf),a(F,rr),a(rr,If),a(F,Ff),a(F,lr),a(lr,Gf),r(e,In,t),_(je,e,t),r(e,Fn,t),r(e,Mt,t),a(Mt,Mf),r(e,Gn,t),r(e,Wt,t),a(Wt,Wf),r(e,Mn,t),r(e,Nt,t),a(Nt,Nf),r(e,Wn,t),r(e,Ws,t),a(Ws,Rf),r(e,Nn,t),r(e,Rt,t),a(Rt,Hf),r(e,Rn,t),r(e,ve,t),a(ve,Bf),a(ve,nr),a(nr,Vf),a(ve,Kf),r(e,Hn,t),_(Ns,e,t),r(e,Bn,t),_(we,e,t),r(e,Vn,t),r(e,Ht,t),a(Ht,Yf),r(e,Kn,t),_(Rs,e,t),r(e,Yn,t),_(Hs,e,t),r(e,Jn,t),r(e,Bt,t),a(Bt,Jf),r(e,Zn,t),r(e,Vt,t),a(Vt,Zf),r(e,Qn,t),_(Ee,e,t),r(e,Xn,t),r(e,Bs,t),a(Bs,Qf),r(e,ep,t),r(e,ye,t),a(ye,Xf),a(ye,pr),a(pr,ec),a(ye,sc),r(e,sp,t),r(e,Kt,t),a(Kt,tc),r(e,tp,t),r(e,Yt,t),a(Yt,ac),r(e,ap,t),r(e,Vs,t),a(Vs,rc),r(e,rp,t),r(e,qe,t),a(qe,lc),a(qe,Ks),a(Ks,nc),a(qe,pc),r(e,lp,t),r(e,Jt,t),a(Jt,ic),r(e,np,t),r(e,G,t),a(G,Zt),a(Zt,Ys),a(Ys,oc),a(Zt,fc),a(G,cc),a(G,Qt),a(Qt,Js),a(Js,mc),a(Qt,uc),a(G,dc),a(G,Xt),a(Xt,Zs),a(Zs,_c),a(Xt,$c),a(G,hc),a(G,ea),a(ea,Qs),a(Qs,bc),a(ea,kc),r(e,pp,t),r(e,sa,t),a(sa,jc),ip=!0},p(e,[t]){const ir={};t&1&&(ir.fw=e[0]),j.$set(ir);const X={};t&2&&(X.$$scope={dirty:t,ctx:e}),ne.$set(X);const or={};t&2&&(or.$$scope={dirty:t,ctx:e}),de.$set(or);const fr={};t&2&&(fr.$$scope={dirty:t,ctx:e}),he.$set(fr);const cr={};t&2&&(cr.$$scope={dirty:t,ctx:e}),ke.$set(cr);const ee={};t&2&&(ee.$$scope={dirty:t,ctx:e}),je.$set(ee);const mr={};t&2&&(mr.$$scope={dirty:t,ctx:e}),we.$set(mr);const ur={};t&2&&(ur.$$scope={dirty:t,ctx:e}),Ee.$set(ur)},i(e){ip||($(j.$$.fragment,e),$(C.$$.fragment,e),$(xe.$$.fragment,e),$(Oe.$$.fragment,e),$(Se.$$.fragment,e),$(Ie.$$.fragment,e),$(Fe.$$.fragment,e),$(Ge.$$.fragment,e),$(Me.$$.fragment,e),$(We.$$.fragment,e),$(Ne.$$.fragment,e),$(Re.$$.fragment,e),$(He.$$.fragment,e),$(Be.$$.fragment,e),$(Ve.$$.fragment,e),$(Ke.$$.fragment,e),$(Je.$$.fragment,e),$(Ze.$$.fragment,e),$(Qe.$$.fragment,e),$(Xe.$$.fragment,e),$(es.$$.fragment,e),$(ss.$$.fragment,e),$(ts.$$.fragment,e),$(as.$$.fragment,e),$(ne.$$.fragment,e),$(rs.$$.fragment,e),$(ls.$$.fragment,e),$(ns.$$.fragment,e),$(ps.$$.fragment,e),$(is.$$.fragment,e),$(os.$$.fragment,e),$(fs.$$.fragment,e),$(cs.$$.fragment,e),$(ms.$$.fragment,e),$(ds.$$.fragment,e),$(_s.$$.fragment,e),$($s.$$.fragment,e),$(hs.$$.fragment,e),$(bs.$$.fragment,e),$(ks.$$.fragment,e),$(js.$$.fragment,e),$(vs.$$.fragment,e),$(Es.$$.fragment,e),$(ys.$$.fragment,e),$(qs.$$.fragment,e),$(de.$$.fragment,e),$(Ps.$$.fragment,e),$(Cs.$$.fragment,e),$(Ts.$$.fragment,e),$(zs.$$.fragment,e),$(he.$$.fragment,e),$(Ds.$$.fragment,e),$(As.$$.fragment,e),$(xs.$$.fragment,e),$(Us.$$.fragment,e),$(Os.$$.fragment,e),$(Ss.$$.fragment,e),$(Ls.$$.fragment,e),$(Is.$$.fragment,e),$(Fs.$$.fragment,e),$(ke.$$.fragment,e),$(je.$$.fragment,e),$(Ns.$$.fragment,e),$(we.$$.fragment,e),$(Rs.$$.fragment,e),$(Hs.$$.fragment,e),$(Ee.$$.fragment,e),ip=!0)},o(e){h(j.$$.fragment,e),h(C.$$.fragment,e),h(xe.$$.fragment,e),h(Oe.$$.fragment,e),h(Se.$$.fragment,e),h(Ie.$$.fragment,e),h(Fe.$$.fragment,e),h(Ge.$$.fragment,e),h(Me.$$.fragment,e),h(We.$$.fragment,e),h(Ne.$$.fragment,e),h(Re.$$.fragment,e),h(He.$$.fragment,e),h(Be.$$.fragment,e),h(Ve.$$.fragment,e),h(Ke.$$.fragment,e),h(Je.$$.fragment,e),h(Ze.$$.fragment,e),h(Qe.$$.fragment,e),h(Xe.$$.fragment,e),h(es.$$.fragment,e),h(ss.$$.fragment,e),h(ts.$$.fragment,e),h(as.$$.fragment,e),h(ne.$$.fragment,e),h(rs.$$.fragment,e),h(ls.$$.fragment,e),h(ns.$$.fragment,e),h(ps.$$.fragment,e),h(is.$$.fragment,e),h(os.$$.fragment,e),h(fs.$$.fragment,e),h(cs.$$.fragment,e),h(ms.$$.fragment,e),h(ds.$$.fragment,e),h(_s.$$.fragment,e),h($s.$$.fragment,e),h(hs.$$.fragment,e),h(bs.$$.fragment,e),h(ks.$$.fragment,e),h(js.$$.fragment,e),h(vs.$$.fragment,e),h(Es.$$.fragment,e),h(ys.$$.fragment,e),h(qs.$$.fragment,e),h(de.$$.fragment,e),h(Ps.$$.fragment,e),h(Cs.$$.fragment,e),h(Ts.$$.fragment,e),h(zs.$$.fragment,e),h(he.$$.fragment,e),h(Ds.$$.fragment,e),h(As.$$.fragment,e),h(xs.$$.fragment,e),h(Us.$$.fragment,e),h(Os.$$.fragment,e),h(Ss.$$.fragment,e),h(Ls.$$.fragment,e),h(Is.$$.fragment,e),h(Fs.$$.fragment,e),h(ke.$$.fragment,e),h(je.$$.fragment,e),h(Ns.$$.fragment,e),h(we.$$.fragment,e),h(Rs.$$.fragment,e),h(Hs.$$.fragment,e),h(Ee.$$.fragment,e),ip=!1},d(e){s(m),e&&s(E),b(j,e),e&&s(v),e&&s(g),e&&s(P),b(C,e),e&&s(z),e&&s(y),e&&s(dr),e&&s(Ae),e&&s(_r),b(xe,e),e&&s($r),e&&s(W),e&&s(hr),e&&s(te),e&&s(br),e&&s(ae),e&&s(kr),b(Oe,e),e&&s(jr),e&&s(tt),e&&s(vr),b(Se,e),e&&s(wr),e&&s(Le),e&&s(Er),e&&s(at),e&&s(yr),e&&s(re),e&&s(qr),b(Ie,e),e&&s(gr),b(Fe,e),e&&s(Pr),e&&s(N),e&&s(Cr),e&&s(O),e&&s(Tr),b(Ge,e),e&&s(zr),e&&s(rt),e&&s(Dr),b(Me,e),e&&s(Ar),e&&s(lt),e&&s(xr),b(We,e),e&&s(Ur),e&&s(nt),e&&s(Or),e&&s(pt),e&&s(Sr),b(Ne,e),e&&s(Lr),b(Re,e),e&&s(Ir),e&&s(it),e&&s(Fr),b(He,e),e&&s(Gr),b(Be,e),e&&s(Mr),e&&s(x),e&&s(Wr),b(Ve,e),e&&s(Nr),b(Ke,e),e&&s(Rr),e&&s(R),e&&s(Hr),e&&s(le),e&&s(Br),b(Je,e),e&&s(Vr),b(Ze,e),e&&s(Kr),e&&s(ot),e&&s(Yr),b(Qe,e),e&&s(Jr),b(Xe,e),e&&s(Zr),e&&s(ft),e&&s(Qr),b(es,e),e&&s(Xr),b(ss,e),e&&s(el),e&&s(H),e&&s(sl),b(ts,e),e&&s(tl),b(as,e),e&&s(al),e&&s(B),e&&s(rl),e&&s(ct),e&&s(ll),b(ne,e),e&&s(nl),e&&s(mt),e&&s(pl),e&&s(ut),e&&s(il),e&&s(Z),b(rs),e&&s(ol),e&&s(S),e&&s(fl),b(ls,e),e&&s(cl),e&&s(dt),e&&s(ml),b(ns,e),e&&s(ul),e&&s(_t),e&&s(dl),b(ps,e),e&&s(_l),b(is,e),e&&s($l),e&&s(L),e&&s(hl),e&&s(I),e&&s(bl),b(os,e),e&&s(kl),e&&s($t),e&&s(jl),b(fs,e),e&&s(vl),e&&s(ht),e&&s(wl),e&&s(bt),e&&s(El),b(cs,e),e&&s(yl),e&&s(U),e&&s(ql),b(ms,e),e&&s(gl),e&&s(kt),e&&s(Pl),e&&s(jt),e&&s(Cl),e&&s(us),e&&s(Tl),e&&s(vt),e&&s(zl),b(ds,e),e&&s(Dl),e&&s(ie),e&&s(Al),e&&s(wt),e&&s(xl),e&&s(Et),e&&s(Ul),e&&s(yt),e&&s(Ol),b(_s,e),e&&s(Sl),b($s,e),e&&s(Ll),e&&s(qt),e&&s(Il),b(hs,e),e&&s(Fl),b(bs,e),e&&s(Gl),e&&s(gt),e&&s(Ml),b(ks,e),e&&s(Wl),e&&s(oe),e&&s(Nl),b(js,e),e&&s(Rl),e&&s(Pt),e&&s(Hl),b(vs,e),e&&s(Bl),e&&s(Ct),e&&s(Vl),e&&s(ws),e&&s(Kl),e&&s(Tt),e&&s(Yl),e&&s(fe),e&&s(Jl),b(Es,e),e&&s(Zl),e&&s(zt),e&&s(Ql),e&&s(V),e&&s(Xl),b(ys,e),e&&s(en),e&&s(ce),e&&s(sn),e&&s(Q),b(qs),e&&s(tn),e&&s(ue),e&&s(an),e&&s(Dt),e&&s(rn),b(de,e),e&&s(ln),e&&s(gs),e&&s(nn),e&&s(_e),e&&s(pn),b(Ps,e),e&&s(on),b(Cs,e),e&&s(fn),e&&s(At),e&&s(cn),e&&s($e),e&&s(mn),b(Ts,e),e&&s(un),b(zs,e),e&&s(dn),b(he,e),e&&s(_n),e&&s(xt),e&&s($n),b(Ds,e),e&&s(hn),e&&s(Ut),e&&s(bn),b(As,e),e&&s(kn),e&&s(K),e&&s(jn),b(xs,e),e&&s(vn),b(Us,e),e&&s(wn),e&&s(Ot),e&&s(En),b(Os,e),e&&s(yn),b(Ss,e),e&&s(qn),e&&s(be),e&&s(gn),b(Ls,e),e&&s(Pn),b(Is,e),e&&s(Cn),e&&s(St),e&&s(Tn),e&&s(Lt),e&&s(zn),b(Fs,e),e&&s(Dn),e&&s(It),e&&s(An),b(ke,e),e&&s(xn),e&&s(Gs),e&&s(Un),e&&s(Ft),e&&s(On),e&&s(Ms),e&&s(Sn),e&&s(Gt),e&&s(Ln),e&&s(F),e&&s(In),b(je,e),e&&s(Fn),e&&s(Mt),e&&s(Gn),e&&s(Wt),e&&s(Mn),e&&s(Nt),e&&s(Wn),e&&s(Ws),e&&s(Nn),e&&s(Rt),e&&s(Rn),e&&s(ve),e&&s(Hn),b(Ns,e),e&&s(Bn),b(we,e),e&&s(Vn),e&&s(Ht),e&&s(Kn),b(Rs,e),e&&s(Yn),b(Hs,e),e&&s(Jn),e&&s(Bt),e&&s(Zn),e&&s(Vt),e&&s(Qn),b(Ee,e),e&&s(Xn),e&&s(Bs),e&&s(ep),e&&s(ye),e&&s(sp),e&&s(Kt),e&&s(tp),e&&s(Yt),e&&s(ap),e&&s(Vs),e&&s(rp),e&&s(qe),e&&s(lp),e&&s(Jt),e&&s(np),e&&s(G),e&&s(pp),e&&s(sa)}}}const ed={local:"",sections:[{local:"",sections:[{local:"",title:"\u68C0\u67E5\u6570\u636E"},{local:"datasets-dataloaders",title:"\u4ECE datasets \u5230 dataloaders"},{local:"",title:"\u68C0\u67E5\u6A21\u578B"},{local:"",title:"\u6267\u884C\u4E00\u4E2A\u4F18\u5316\u5668\u6B65\u9AA4"},{local:"cuda-outofmemory",title:"\u5904\u7406 CUDA out-of-memory\u9519\u8BEF"},{local:"",title:"\u8BC4\u4F30\u6A21\u578B"}],title:"\u8C03\u8BD5\u8BAD\u7EC3\u7BA1\u9053"},{local:"",sections:[{local:"",title:"\u68C0\u67E5\u60A8\u7684\u6570\u636E\uFF08\u518D\u6B21\uFF01\uFF09"},{local:"",title:"\u5728\u4E00\u6279\u4E0A\u8FC7\u5EA6\u62DF\u5408\u4F60\u7684\u6A21\u578B"},{local:"",title:"\u5728\u4F60\u6709\u7B2C\u4E00\u4E2A\u57FA\u7EBF\u4E4B\u524D\u4E0D\u8981\u8C03\u6574\u4EFB\u4F55\u4E1C\u897F"},{local:"",title:"\u8BF7\u6C42\u5E2E\u5FD9"}],title:"\u5728\u8BAD\u7EC3\u671F\u95F4\u8C03\u8BD5\u9759\u9ED8\uFF08\u6CA1\u6709\u4EFB\u4F55\u9519\u8BEF\u63D0\u793A\uFF09\u9519\u8BEF"}],title:"\u8C03\u8BD5\u8BAD\u7EC3\u7BA1\u9053"};function sd(T,m,E){let j="pt";return Wu(()=>{const v=new URLSearchParams(window.location.search);E(0,j=v.get("fw")||"pt")}),[j]}class od extends Iu{constructor(m){super();Fu(this,m,sd,Xu,Gu,{})}}export{od as default,ed as metadata};
