import{S as dd,i as _d,s as gd,e as n,t,k as c,w as $,c as r,a as p,h as l,d as a,m as u,x as k,b,g as o,G as e,y as w,q as d,o as _,B as y,U as pd,M as bd,V as id,N as or,p as pr,v as jd,n as ir}from"../../chunks/vendor-hf-doc-builder.js";import{T as Pt}from"../../chunks/Tip-hf-doc-builder.js";import{Y as Du}from"../../chunks/Youtube-hf-doc-builder.js";import{I as ui}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{C as q}from"../../chunks/CodeBlock-hf-doc-builder.js";import{D as ud}from"../../chunks/DocNotebookDropdown-hf-doc-builder.js";import{F as vd}from"../../chunks/FrameworkSwitchCourse-hf-doc-builder.js";function $d(K){let h,v;return h=new ud({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/chapter7/section5_tf.ipynb"},{label:"Aws Studio",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/master/course/chapter7/section5_tf.ipynb"}]}}),{c(){$(h.$$.fragment)},l(f){k(h.$$.fragment,f)},m(f,E){w(h,f,E),v=!0},i(f){v||(d(h.$$.fragment,f),v=!0)},o(f){_(h.$$.fragment,f),v=!1},d(f){y(h,f)}}}function kd(K){let h,v;return h=new ud({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/chapter7/section5_pt.ipynb"},{label:"Aws Studio",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/master/course/chapter7/section5_pt.ipynb"}]}}),{c(){$(h.$$.fragment)},l(f){k(h.$$.fragment,f)},m(f,E){w(h,f,E),v=!0},i(f){v||(d(h.$$.fragment,f),v=!0)},o(f){_(h.$$.fragment,f),v=!1},d(f){y(h,f)}}}function wd(K){let h,v,f,E,O,x,S,R,P,C,N;return{c(){h=n("p"),v=t("\u270F\uFE0F "),f=n("strong"),E=t("\u8BD5\u8BD5\u770B\uFF01"),O=t(" \u66F4\u6539 "),x=n("code"),S=t("Dataset.shuffle()"),R=t(" \u547D\u4EE4\u4E2D\u7684\u968F\u673A\u79CD\u5B50\u4EE5\u63A2\u7D22\u8BED\u6599\u5E93\u4E2D\u7684\u5176\u4ED6\u8BC4\u8BBA\u3002 \u5982\u679C\u60A8\u662F\u8BF4\u897F\u73ED\u7259\u8BED\u7684\u4EBA\uFF0C\u8BF7\u67E5\u770B "),P=n("code"),C=t("spanish_dataset"),N=t(" \u4E2D\u7684\u4E00\u4E9B\u8BC4\u8BBA\uFF0C\u770B\u770B\u6807\u9898\u662F\u5426\u4E5F\u50CF\u5408\u7406\u7684\u6458\u8981\u3002")},l(D){h=r(D,"P",{});var I=p(h);v=l(I,"\u270F\uFE0F "),f=r(I,"STRONG",{});var U=p(f);E=l(U,"\u8BD5\u8BD5\u770B\uFF01"),U.forEach(a),O=l(I," \u66F4\u6539 "),x=r(I,"CODE",{});var J=p(x);S=l(J,"Dataset.shuffle()"),J.forEach(a),R=l(I," \u547D\u4EE4\u4E2D\u7684\u968F\u673A\u79CD\u5B50\u4EE5\u63A2\u7D22\u8BED\u6599\u5E93\u4E2D\u7684\u5176\u4ED6\u8BC4\u8BBA\u3002 \u5982\u679C\u60A8\u662F\u8BF4\u897F\u73ED\u7259\u8BED\u7684\u4EBA\uFF0C\u8BF7\u67E5\u770B "),P=r(I,"CODE",{});var M=p(P);C=l(M,"spanish_dataset"),M.forEach(a),N=l(I," \u4E2D\u7684\u4E00\u4E9B\u8BC4\u8BBA\uFF0C\u770B\u770B\u6807\u9898\u662F\u5426\u4E5F\u50CF\u5408\u7406\u7684\u6458\u8981\u3002"),I.forEach(a)},m(D,I){o(D,h,I),e(h,v),e(h,f),e(f,E),e(h,O),e(h,x),e(x,S),e(h,R),e(h,P),e(P,C),e(h,N)},d(D){D&&a(h)}}}function yd(K){let h,v,f,E,O;return{c(){h=n("p"),v=t("\u270F\uFE0F "),f=n("strong"),E=t("\u8BD5\u8BD5\u770B\uFF01"),O=t(" \u5B8C\u6210\u672C\u8282\u540E\uFF0C\u901A\u8FC7\u4F7F\u7528\u76F8\u540C\u7684\u6280\u672F\u5BF9 mBART \u8FDB\u884C\u5FAE\u8C03\uFF0C\u770B\u770B mT5 \u4E0E mBART \u76F8\u6BD4\u6709\u591A\u597D\u3002 \u5BF9\u4E8E\u5956\u52B1\u79EF\u5206\uFF0C\u60A8\u8FD8\u53EF\u4EE5\u5C1D\u8BD5\u4EC5\u5728\u82F1\u6587\u8BC4\u8BBA\u4E0A\u5FAE\u8C03 T5\u3002 \u7531\u4E8E T5 \u9700\u8981\u4E00\u4E2A\u7279\u6B8A\u7684\u524D\u7F00\u63D0\u793A\uFF0C\u56E0\u6B64\u60A8\u9700\u8981\u5728\u4E0B\u9762\u7684\u9884\u5904\u7406\u6B65\u9AA4\u4E2D\u5C06\u201Csummarize:\u201D\u6DFB\u52A0\u5230\u8F93\u5165\u793A\u4F8B\u4E2D\u3002")},l(x){h=r(x,"P",{});var S=p(h);v=l(S,"\u270F\uFE0F "),f=r(S,"STRONG",{});var R=p(f);E=l(R,"\u8BD5\u8BD5\u770B\uFF01"),R.forEach(a),O=l(S," \u5B8C\u6210\u672C\u8282\u540E\uFF0C\u901A\u8FC7\u4F7F\u7528\u76F8\u540C\u7684\u6280\u672F\u5BF9 mBART \u8FDB\u884C\u5FAE\u8C03\uFF0C\u770B\u770B mT5 \u4E0E mBART \u76F8\u6BD4\u6709\u591A\u597D\u3002 \u5BF9\u4E8E\u5956\u52B1\u79EF\u5206\uFF0C\u60A8\u8FD8\u53EF\u4EE5\u5C1D\u8BD5\u4EC5\u5728\u82F1\u6587\u8BC4\u8BBA\u4E0A\u5FAE\u8C03 T5\u3002 \u7531\u4E8E T5 \u9700\u8981\u4E00\u4E2A\u7279\u6B8A\u7684\u524D\u7F00\u63D0\u793A\uFF0C\u56E0\u6B64\u60A8\u9700\u8981\u5728\u4E0B\u9762\u7684\u9884\u5904\u7406\u6B65\u9AA4\u4E2D\u5C06\u201Csummarize:\u201D\u6DFB\u52A0\u5230\u8F93\u5165\u793A\u4F8B\u4E2D\u3002"),S.forEach(a)},m(x,S){o(x,h,S),e(h,v),e(h,f),e(f,E),e(h,O)},d(x){x&&a(h)}}}function Ed(K){let h,v;return{c(){h=n("p"),v=t("\u{1F4A1}\u5728 NLP \u9879\u76EE\u7684\u65E9\u671F\u9636\u6BB5\uFF0C\u4E00\u4E2A\u597D\u7684\u505A\u6CD5\u662F\u5728\u5C0F\u6837\u672C\u6570\u636E\u4E0A\u8BAD\u7EC3\u4E00\u7C7B\u201C\u5C0F\u201D\u6A21\u578B\u3002\u8FD9\u4F7F\u60A8\u53EF\u4EE5\u66F4\u5FEB\u5730\u8C03\u8BD5\u548C\u8FED\u4EE3\u7AEF\u5230\u7AEF\u5DE5\u4F5C\u6D41\u3002\u4E00\u65E6\u60A8\u5BF9\u7ED3\u679C\u5145\u6EE1\u4FE1\u5FC3\uFF0C\u60A8\u59CB\u7EC8\u53EF\u4EE5\u901A\u8FC7\u7B80\u5355\u5730\u66F4\u6539\u6A21\u578B\u68C0\u67E5\u70B9\u6765\u5728\u5927\u89C4\u6A21\u6570\u636E\u4E0A\u8BAD\u7EC3\u6A21\u578B\uFF01")},l(f){h=r(f,"P",{});var E=p(h);v=l(E,"\u{1F4A1}\u5728 NLP \u9879\u76EE\u7684\u65E9\u671F\u9636\u6BB5\uFF0C\u4E00\u4E2A\u597D\u7684\u505A\u6CD5\u662F\u5728\u5C0F\u6837\u672C\u6570\u636E\u4E0A\u8BAD\u7EC3\u4E00\u7C7B\u201C\u5C0F\u201D\u6A21\u578B\u3002\u8FD9\u4F7F\u60A8\u53EF\u4EE5\u66F4\u5FEB\u5730\u8C03\u8BD5\u548C\u8FED\u4EE3\u7AEF\u5230\u7AEF\u5DE5\u4F5C\u6D41\u3002\u4E00\u65E6\u60A8\u5BF9\u7ED3\u679C\u5145\u6EE1\u4FE1\u5FC3\uFF0C\u60A8\u59CB\u7EC8\u53EF\u4EE5\u901A\u8FC7\u7B80\u5355\u5730\u66F4\u6539\u6A21\u578B\u68C0\u67E5\u70B9\u6765\u5728\u5927\u89C4\u6A21\u6570\u636E\u4E0A\u8BAD\u7EC3\u6A21\u578B\uFF01"),E.forEach(a)},m(f,E){o(f,h,E),e(h,v)},d(f){f&&a(h)}}}function xd(K){let h,v,f,E,O,x,S,R,P,C,N;return{c(){h=n("p"),v=t("\u{1F4A1} \u4F60\u53EF\u80FD\u5DF2\u7ECF\u6CE8\u610F\u5230\u6211\u4EEC\u5728\u4E0A\u9762\u7684 "),f=n("code"),E=t("Dataset.map()"),O=t(" \u51FD\u6570\u4E2D\u4F7F\u7528\u4E86 "),x=n("code"),S=t("batched=True"),R=t("\u3002 \u8FD9\u4F1A\u4EE5 1,000 \u4E2A\uFF08\u9ED8\u8BA4\uFF09\u4E3A\u5355\u4F4D\u5BF9\u793A\u4F8B\u8FDB\u884C\u7F16\u7801\uFF0C\u5E76\u5141\u8BB8\u60A8\u5229\u7528 \u{1F917} Transformers \u4E2D\u5FEB\u901F\u6807\u8BB0\u5668\u7684\u591A\u7EBF\u7A0B\u529F\u80FD\u3002 \u5728\u53EF\u80FD\u7684\u60C5\u51B5\u4E0B\uFF0C\u5C1D\u8BD5\u4F7F\u7528 "),P=n("code"),C=t("batched=True"),N=t(" \u6765\u52A0\u901F\u60A8\u7684\u9884\u5904\u7406\uFF01")},l(D){h=r(D,"P",{});var I=p(h);v=l(I,"\u{1F4A1} \u4F60\u53EF\u80FD\u5DF2\u7ECF\u6CE8\u610F\u5230\u6211\u4EEC\u5728\u4E0A\u9762\u7684 "),f=r(I,"CODE",{});var U=p(f);E=l(U,"Dataset.map()"),U.forEach(a),O=l(I," \u51FD\u6570\u4E2D\u4F7F\u7528\u4E86 "),x=r(I,"CODE",{});var J=p(x);S=l(J,"batched=True"),J.forEach(a),R=l(I,"\u3002 \u8FD9\u4F1A\u4EE5 1,000 \u4E2A\uFF08\u9ED8\u8BA4\uFF09\u4E3A\u5355\u4F4D\u5BF9\u793A\u4F8B\u8FDB\u884C\u7F16\u7801\uFF0C\u5E76\u5141\u8BB8\u60A8\u5229\u7528 \u{1F917} Transformers \u4E2D\u5FEB\u901F\u6807\u8BB0\u5668\u7684\u591A\u7EBF\u7A0B\u529F\u80FD\u3002 \u5728\u53EF\u80FD\u7684\u60C5\u51B5\u4E0B\uFF0C\u5C1D\u8BD5\u4F7F\u7528 "),P=r(I,"CODE",{});var M=p(P);C=l(M,"batched=True"),M.forEach(a),N=l(I," \u6765\u52A0\u901F\u60A8\u7684\u9884\u5904\u7406\uFF01"),I.forEach(a)},m(D,I){o(D,h,I),e(h,v),e(h,f),e(f,E),e(h,O),e(h,x),e(x,S),e(h,R),e(h,P),e(P,C),e(h,N)},d(D){D&&a(h)}}}function Td(K){let h,v,f,E,O;return{c(){h=n("p"),v=t("\u{1F64B} \u5982\u679C\u8FD9\u662F\u60A8\u7B2C\u4E00\u6B21\u542C\u8BF4\u7CBE\u786E\u7387\u548C\u53EC\u56DE\u7387\uFF0C\u8BF7\u4E0D\u8981\u62C5\u5FC3\u2014\u2014\u6211\u4EEC\u5C06\u4E00\u8D77\u901A\u8FC7\u4E00\u4E9B\u660E\u786E\u7684\u793A\u4F8B\u6765\u8BF4\u660E\u4E00\u5207\u3002 \u8FD9\u4E9B\u6307\u6807\u901A\u5E38\u5728\u5206\u7C7B\u4EFB\u52A1\u4E2D\u9047\u5230\uFF0C\u56E0\u6B64\u5982\u679C\u60A8\u60F3\u4E86\u89E3\u5728\u8BE5\u4E0A\u4E0B\u6587\u4E2D\u5982\u4F55\u5B9A\u4E49\u7CBE\u786E\u5EA6\u548C\u53EC\u56DE\u7387\uFF0C\u6211\u4EEC\u5EFA\u8BAE\u67E5\u770B scikit-learn [\u6307\u5357]("),f=n("a"),E=t("https://scikit-learn.org/stable"),O=t(" /auto_examples/model_selection/plot_precision_recall.html\uFF09\u3002"),this.h()},l(x){h=r(x,"P",{});var S=p(h);v=l(S,"\u{1F64B} \u5982\u679C\u8FD9\u662F\u60A8\u7B2C\u4E00\u6B21\u542C\u8BF4\u7CBE\u786E\u7387\u548C\u53EC\u56DE\u7387\uFF0C\u8BF7\u4E0D\u8981\u62C5\u5FC3\u2014\u2014\u6211\u4EEC\u5C06\u4E00\u8D77\u901A\u8FC7\u4E00\u4E9B\u660E\u786E\u7684\u793A\u4F8B\u6765\u8BF4\u660E\u4E00\u5207\u3002 \u8FD9\u4E9B\u6307\u6807\u901A\u5E38\u5728\u5206\u7C7B\u4EFB\u52A1\u4E2D\u9047\u5230\uFF0C\u56E0\u6B64\u5982\u679C\u60A8\u60F3\u4E86\u89E3\u5728\u8BE5\u4E0A\u4E0B\u6587\u4E2D\u5982\u4F55\u5B9A\u4E49\u7CBE\u786E\u5EA6\u548C\u53EC\u56DE\u7387\uFF0C\u6211\u4EEC\u5EFA\u8BAE\u67E5\u770B scikit-learn [\u6307\u5357]("),f=r(S,"A",{href:!0,rel:!0});var R=p(f);E=l(R,"https://scikit-learn.org/stable"),R.forEach(a),O=l(S," /auto_examples/model_selection/plot_precision_recall.html\uFF09\u3002"),S.forEach(a),this.h()},h(){b(f,"href","https://scikit-learn.org/stable"),b(f,"rel","nofollow")},m(x,S){o(x,h,S),e(h,v),e(h,f),e(f,E),e(h,O)},d(x){x&&a(h)}}}function qd(K){let h,v,f,E,O;return{c(){h=n("p"),v=t("\u270F\uFE0F "),f=n("strong"),E=t("\u8BD5\u8BD5\u770B\uFF01"),O=t(" \u521B\u5EFA\u60A8\u81EA\u5DF1\u7684\u751F\u6210\u548C\u53C2\u8003\u6458\u8981\u793A\u4F8B\uFF0C\u5E76\u67E5\u770B\u751F\u6210\u7684 ROUGE \u5206\u6570\u662F\u5426\u4E0E\u57FA\u4E8E\u7CBE\u786E\u5EA6\u548C\u53EC\u56DE\u7387\u516C\u5F0F\u7684\u624B\u52A8\u8BA1\u7B97\u4E00\u81F4\u3002 \u5BF9\u4E8E\u9644\u52A0\u5206\uFF0C\u5C06\u6587\u672C\u62C6\u5206\u4E3A\u4E8C\u5143\u7EC4\u5E76\u6BD4\u8F83\u201Crouge2\u201D\u6307\u6807\u7684\u7CBE\u5EA6\u548C\u53EC\u56DE\u7387\u3002")},l(x){h=r(x,"P",{});var S=p(h);v=l(S,"\u270F\uFE0F "),f=r(S,"STRONG",{});var R=p(f);E=l(R,"\u8BD5\u8BD5\u770B\uFF01"),R.forEach(a),O=l(S," \u521B\u5EFA\u60A8\u81EA\u5DF1\u7684\u751F\u6210\u548C\u53C2\u8003\u6458\u8981\u793A\u4F8B\uFF0C\u5E76\u67E5\u770B\u751F\u6210\u7684 ROUGE \u5206\u6570\u662F\u5426\u4E0E\u57FA\u4E8E\u7CBE\u786E\u5EA6\u548C\u53EC\u56DE\u7387\u516C\u5F0F\u7684\u624B\u52A8\u8BA1\u7B97\u4E00\u81F4\u3002 \u5BF9\u4E8E\u9644\u52A0\u5206\uFF0C\u5C06\u6587\u672C\u62C6\u5206\u4E3A\u4E8C\u5143\u7EC4\u5E76\u6BD4\u8F83\u201Crouge2\u201D\u6307\u6807\u7684\u7CBE\u5EA6\u548C\u53EC\u56DE\u7387\u3002"),S.forEach(a)},m(x,S){o(x,h,S),e(h,v),e(h,f),e(f,E),e(h,O)},d(x){x&&a(h)}}}function Sd(K){let h,v,f,E,O,x,S,R,P,C,N,D,I,U,J,M,B,H,Q;return E=new ui({}),H=new q({props:{code:`from transformers import TFAutoModelForSeq2SeqLM

model = TFAutoModelForSeq2SeqLM.from_pretrained(model_checkpoint)`,highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> TFAutoModelForSeq2SeqLM

model = TFAutoModelForSeq2SeqLM.from_pretrained(model_checkpoint)`}}),{c(){h=n("h2"),v=n("a"),f=n("span"),$(E.$$.fragment),O=c(),x=n("span"),S=t("\u4F7F\u7528 "),R=n("code"),P=t("Keras"),C=t(" API\u5FAE\u8C03mT5"),N=c(),D=n("p"),I=t("\u5FAE\u8C03\u6A21\u578B\u4EE5\u8FDB\u884C\u63D0\u53D6\u6458\u8981\u4E0E\u6211\u4EEC\u5728\u672C\u7AE0\u4E2D\u4ECB\u7ECD\u7684\u5176\u4ED6\u4EFB\u52A1\u975E\u5E38\u76F8\u4F3C\u3002 \u6211\u4EEC\u9700\u8981\u505A\u7684\u7B2C\u4E00\u4EF6\u4E8B\u662F\u4ECE"),U=n("code"),J=t("mt5-small"),M=t("\u68C0\u67E5\u70B9\u52A0\u8F7D\u9884\u8BAD\u7EC3\u6A21\u578B\u3002 \u7531\u4E8E\u6458\u8981\u63D0\u53D6\u662F\u4E00\u4E2A\u5E8F\u5217\u5230\u5E8F\u5217\u7684\u4EFB\u52A1\uFF0C\u6211\u4EEC\u53EF\u4EE5\u4F7F\u7528 AutoModelForSeq2SeqLM \u7C7B\u52A0\u8F7D\u6A21\u578B\uFF0C\u8BE5\u7C7B\u4F1A\u81EA\u52A8\u4E0B\u8F7D\u5E76\u7F13\u5B58\u6743\u91CD\uFF1A"),B=c(),$(H.$$.fragment),this.h()},l(z){h=r(z,"H2",{class:!0});var G=p(h);v=r(G,"A",{id:!0,class:!0,href:!0});var os=p(v);f=r(os,"SPAN",{});var ss=p(f);k(E.$$.fragment,ss),ss.forEach(a),os.forEach(a),O=u(G),x=r(G,"SPAN",{});var Z=p(x);S=l(Z,"\u4F7F\u7528 "),R=r(Z,"CODE",{});var W=p(R);P=l(W,"Keras"),W.forEach(a),C=l(Z," API\u5FAE\u8C03mT5"),Z.forEach(a),G.forEach(a),N=u(z),D=r(z,"P",{});var X=p(D);I=l(X,"\u5FAE\u8C03\u6A21\u578B\u4EE5\u8FDB\u884C\u63D0\u53D6\u6458\u8981\u4E0E\u6211\u4EEC\u5728\u672C\u7AE0\u4E2D\u4ECB\u7ECD\u7684\u5176\u4ED6\u4EFB\u52A1\u975E\u5E38\u76F8\u4F3C\u3002 \u6211\u4EEC\u9700\u8981\u505A\u7684\u7B2C\u4E00\u4EF6\u4E8B\u662F\u4ECE"),U=r(X,"CODE",{});var ls=p(U);J=l(ls,"mt5-small"),ls.forEach(a),M=l(X,"\u68C0\u67E5\u70B9\u52A0\u8F7D\u9884\u8BAD\u7EC3\u6A21\u578B\u3002 \u7531\u4E8E\u6458\u8981\u63D0\u53D6\u662F\u4E00\u4E2A\u5E8F\u5217\u5230\u5E8F\u5217\u7684\u4EFB\u52A1\uFF0C\u6211\u4EEC\u53EF\u4EE5\u4F7F\u7528 AutoModelForSeq2SeqLM \u7C7B\u52A0\u8F7D\u6A21\u578B\uFF0C\u8BE5\u7C7B\u4F1A\u81EA\u52A8\u4E0B\u8F7D\u5E76\u7F13\u5B58\u6743\u91CD\uFF1A"),X.forEach(a),B=u(z),k(H.$$.fragment,z),this.h()},h(){b(v,"id","keras-apimt5"),b(v,"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"),b(v,"href","#keras-apimt5"),b(h,"class","relative group")},m(z,G){o(z,h,G),e(h,v),e(v,f),w(E,f,null),e(h,O),e(h,x),e(x,S),e(x,R),e(R,P),e(x,C),o(z,N,G),o(z,D,G),e(D,I),e(D,U),e(U,J),e(D,M),o(z,B,G),w(H,z,G),Q=!0},i(z){Q||(d(E.$$.fragment,z),d(H.$$.fragment,z),Q=!0)},o(z){_(E.$$.fragment,z),_(H.$$.fragment,z),Q=!1},d(z){z&&a(h),y(E),z&&a(N),z&&a(D),z&&a(B),y(H,z)}}}function zd(K){let h,v,f,E,O,x,S,R,P,C,N,D,I,U,J,M,B,H,Q;return E=new ui({}),H=new q({props:{code:`from transformers import AutoModelForSeq2SeqLM

model = AutoModelForSeq2SeqLM.from_pretrained(model_checkpoint)`,highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForSeq2SeqLM

model = AutoModelForSeq2SeqLM.from_pretrained(model_checkpoint)`}}),{c(){h=n("h2"),v=n("a"),f=n("span"),$(E.$$.fragment),O=c(),x=n("span"),S=t("\u4F7F\u7528 "),R=n("code"),P=t("Trainer"),C=t(" API\u5FAE\u8C03mT5"),N=c(),D=n("p"),I=t("\u5FAE\u8C03\u6A21\u578B\u4EE5\u8FDB\u884C\u63D0\u53D6\u6458\u8981\u4E0E\u6211\u4EEC\u5728\u672C\u7AE0\u4E2D\u4ECB\u7ECD\u7684\u5176\u4ED6\u4EFB\u52A1\u975E\u5E38\u76F8\u4F3C\u3002 \u6211\u4EEC\u9700\u8981\u505A\u7684\u7B2C\u4E00\u4EF6\u4E8B\u662F\u4ECE"),U=n("code"),J=t("mt5-small"),M=t("\u68C0\u67E5\u70B9\u52A0\u8F7D\u9884\u8BAD\u7EC3\u6A21\u578B\u3002 \u7531\u4E8E\u6458\u8981\u63D0\u53D6\u662F\u4E00\u4E2A\u5E8F\u5217\u5230\u5E8F\u5217\u7684\u4EFB\u52A1\uFF0C\u6211\u4EEC\u53EF\u4EE5\u4F7F\u7528 AutoModelForSeq2SeqLM \u7C7B\u52A0\u8F7D\u6A21\u578B\uFF0C\u8BE5\u7C7B\u4F1A\u81EA\u52A8\u4E0B\u8F7D\u5E76\u7F13\u5B58\u6743\u91CD\uFF1A"),B=c(),$(H.$$.fragment),this.h()},l(z){h=r(z,"H2",{class:!0});var G=p(h);v=r(G,"A",{id:!0,class:!0,href:!0});var os=p(v);f=r(os,"SPAN",{});var ss=p(f);k(E.$$.fragment,ss),ss.forEach(a),os.forEach(a),O=u(G),x=r(G,"SPAN",{});var Z=p(x);S=l(Z,"\u4F7F\u7528 "),R=r(Z,"CODE",{});var W=p(R);P=l(W,"Trainer"),W.forEach(a),C=l(Z," API\u5FAE\u8C03mT5"),Z.forEach(a),G.forEach(a),N=u(z),D=r(z,"P",{});var X=p(D);I=l(X,"\u5FAE\u8C03\u6A21\u578B\u4EE5\u8FDB\u884C\u63D0\u53D6\u6458\u8981\u4E0E\u6211\u4EEC\u5728\u672C\u7AE0\u4E2D\u4ECB\u7ECD\u7684\u5176\u4ED6\u4EFB\u52A1\u975E\u5E38\u76F8\u4F3C\u3002 \u6211\u4EEC\u9700\u8981\u505A\u7684\u7B2C\u4E00\u4EF6\u4E8B\u662F\u4ECE"),U=r(X,"CODE",{});var ls=p(U);J=l(ls,"mt5-small"),ls.forEach(a),M=l(X,"\u68C0\u67E5\u70B9\u52A0\u8F7D\u9884\u8BAD\u7EC3\u6A21\u578B\u3002 \u7531\u4E8E\u6458\u8981\u63D0\u53D6\u662F\u4E00\u4E2A\u5E8F\u5217\u5230\u5E8F\u5217\u7684\u4EFB\u52A1\uFF0C\u6211\u4EEC\u53EF\u4EE5\u4F7F\u7528 AutoModelForSeq2SeqLM \u7C7B\u52A0\u8F7D\u6A21\u578B\uFF0C\u8BE5\u7C7B\u4F1A\u81EA\u52A8\u4E0B\u8F7D\u5E76\u7F13\u5B58\u6743\u91CD\uFF1A"),X.forEach(a),B=u(z),k(H.$$.fragment,z),this.h()},h(){b(v,"id","trainer-apimt5"),b(v,"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"),b(v,"href","#trainer-apimt5"),b(h,"class","relative group")},m(z,G){o(z,h,G),e(h,v),e(v,f),w(E,f,null),e(h,O),e(h,x),e(x,S),e(x,R),e(R,P),e(x,C),o(z,N,G),o(z,D,G),e(D,I),e(D,U),e(U,J),e(D,M),o(z,B,G),w(H,z,G),Q=!0},i(z){Q||(d(E.$$.fragment,z),d(H.$$.fragment,z),Q=!0)},o(z){_(E.$$.fragment,z),_(H.$$.fragment,z),Q=!1},d(z){z&&a(h),y(E),z&&a(N),z&&a(D),z&&a(B),y(H,z)}}}function Dd(K){let h,v,f,E,O;return{c(){h=n("p"),v=t("\u{1F4A1} If you\u2019re wondering why you don\u2019t see any warnings about fine-tuning the model on a downstream task, that\u2019s because for sequence-to-sequence tasks we keep all the weights of the network. Compare this to our text classification model in "),f=n("a"),E=t("Chapter 3"),O=t(`, where the head of the pretrained model was replaced with a randomly initialized network.
\u{1F4A1} \u5982\u679C\u60A8\u60F3\u77E5\u9053\u4E3A\u4EC0\u4E48\u5728\u4E0B\u6E38\u4EFB\u52A1\u4E2D\u6CA1\u6709\u770B\u5230\u4EFB\u4F55\u5173\u4E8E\u5FAE\u8C03\u6A21\u578B\u7684\u8B66\u544A\uFF0C\u90A3\u662F\u56E0\u4E3A\u5BF9\u4E8E\u5E8F\u5217\u5230\u5E8F\u5217\u7684\u4EFB\u52A1\uFF0C\u6211\u4EEC\u4FDD\u7559\u4E86\u7F51\u7EDC\u7684\u6240\u6709\u6743\u91CD\u3002\u4E0E\u6211\u4EEC\u5728[\u7B2C\u4E09\u7AE0] (/course/chapter3)\u4E2D\u7684\u6587\u672C\u5206\u7C7B\u6A21\u578B\u8FDB\u884C\u6BD4\u8F83\uFF0C\u6587\u672C\u5206\u7C7B\u6A21\u578B\u9884\u8BAD\u7EC3\u6A21\u578B\u7684\u5934\u90E8\u88AB\u968F\u673A\u521D\u59CB\u5316\u7684\u7F51\u7EDC\u66FF\u6362\u3002`),this.h()},l(x){h=r(x,"P",{});var S=p(h);v=l(S,"\u{1F4A1} If you\u2019re wondering why you don\u2019t see any warnings about fine-tuning the model on a downstream task, that\u2019s because for sequence-to-sequence tasks we keep all the weights of the network. Compare this to our text classification model in "),f=r(S,"A",{href:!0});var R=p(f);E=l(R,"Chapter 3"),R.forEach(a),O=l(S,`, where the head of the pretrained model was replaced with a randomly initialized network.
\u{1F4A1} \u5982\u679C\u60A8\u60F3\u77E5\u9053\u4E3A\u4EC0\u4E48\u5728\u4E0B\u6E38\u4EFB\u52A1\u4E2D\u6CA1\u6709\u770B\u5230\u4EFB\u4F55\u5173\u4E8E\u5FAE\u8C03\u6A21\u578B\u7684\u8B66\u544A\uFF0C\u90A3\u662F\u56E0\u4E3A\u5BF9\u4E8E\u5E8F\u5217\u5230\u5E8F\u5217\u7684\u4EFB\u52A1\uFF0C\u6211\u4EEC\u4FDD\u7559\u4E86\u7F51\u7EDC\u7684\u6240\u6709\u6743\u91CD\u3002\u4E0E\u6211\u4EEC\u5728[\u7B2C\u4E09\u7AE0] (/course/chapter3)\u4E2D\u7684\u6587\u672C\u5206\u7C7B\u6A21\u578B\u8FDB\u884C\u6BD4\u8F83\uFF0C\u6587\u672C\u5206\u7C7B\u6A21\u578B\u9884\u8BAD\u7EC3\u6A21\u578B\u7684\u5934\u90E8\u88AB\u968F\u673A\u521D\u59CB\u5316\u7684\u7F51\u7EDC\u66FF\u6362\u3002`),S.forEach(a),this.h()},h(){b(f,"href","/course/chapter3")},m(x,S){o(x,h,S),e(h,v),e(h,f),e(f,E),e(h,O)},d(x){x&&a(h)}}}function md(K){let h,v,f,E,O,x,S,R,P,C,N,D,I,U,J,M,B,H,Q,z,G,os,ss,Z,W,X,ls,V,$s,js,ps,vs,Y,cs,ys,es,ns,rs,is,j,F,Ts,as,us,ms,g,A,qs,hs,Ys,Es,_s,Cs,Js,fs,Xs,Ss,ee,Us,he,Qs,Le,fe,Zs,se,de,zs,As;return C=new q({props:{code:`from transformers import Seq2SeqTrainingArguments

batch_size = 8
num_train_epochs = 8
# Show the training loss with every epoch
logging_steps = len(tokenized_datasets["train"]) // batch_size
model_name = model_checkpoint.split("/")[-1]

args = Seq2SeqTrainingArguments(
    output_dir=f"{model_name}-finetuned-amazon-en-es",
    evaluation_strategy="epoch",
    learning_rate=5.6e-5,
    per_device_train_batch_size=batch_size,
    per_device_eval_batch_size=batch_size,
    weight_decay=0.01,
    save_total_limit=3,
    num_train_epochs=num_train_epochs,
    predict_with_generate=True,
    logging_steps=logging_steps,
    push_to_hub=True,
)`,highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Seq2SeqTrainingArguments

batch_size = <span class="hljs-number">8</span>
num_train_epochs = <span class="hljs-number">8</span>
<span class="hljs-comment"># Show the training loss with every epoch</span>
logging_steps = <span class="hljs-built_in">len</span>(tokenized_datasets[<span class="hljs-string">&quot;train&quot;</span>]) // batch_size
model_name = model_checkpoint.split(<span class="hljs-string">&quot;/&quot;</span>)[-<span class="hljs-number">1</span>]

args = Seq2SeqTrainingArguments(
    output_dir=<span class="hljs-string">f&quot;<span class="hljs-subst">{model_name}</span>-finetuned-amazon-en-es&quot;</span>,
    evaluation_strategy=<span class="hljs-string">&quot;epoch&quot;</span>,
    learning_rate=<span class="hljs-number">5.6e-5</span>,
    per_device_train_batch_size=batch_size,
    per_device_eval_batch_size=batch_size,
    weight_decay=<span class="hljs-number">0.01</span>,
    save_total_limit=<span class="hljs-number">3</span>,
    num_train_epochs=num_train_epochs,
    predict_with_generate=<span class="hljs-literal">True</span>,
    logging_steps=logging_steps,
    push_to_hub=<span class="hljs-literal">True</span>,
)`}}),zs=new q({props:{code:`import numpy as np


def compute_metrics(eval_pred):
    predictions, labels = eval_pred
    # Decode generated summaries into text
    decoded_preds = tokenizer.batch_decode(predictions, skip_special_tokens=True)
    # Replace -100 in the labels as we can't decode them
    labels = np.where(labels != -100, labels, tokenizer.pad_token_id)
    # Decode reference summaries into text
    decoded_labels = tokenizer.batch_decode(labels, skip_special_tokens=True)
    # ROUGE expects a newline after each sentence
    decoded_preds = ["\\n".join(sent_tokenize(pred.strip())) for pred in decoded_preds]
    decoded_labels = ["\\n".join(sent_tokenize(label.strip())) for label in decoded_labels]
    # Compute ROUGE scores
    result = rouge_score.compute(
        predictions=decoded_preds, references=decoded_labels, use_stemmer=True
    )
    # Extract the median scores
    result = {key: value.mid.fmeasure * 100 for key, value in result.items()}
    return {k: round(v, 4) for k, v in result.items()}`,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
    <span class="hljs-comment"># Decode generated summaries into text</span>
    decoded_preds = tokenizer.batch_decode(predictions, skip_special_tokens=<span class="hljs-literal">True</span>)
    <span class="hljs-comment"># Replace -100 in the labels as we can&#x27;t decode them</span>
    labels = np.where(labels != -<span class="hljs-number">100</span>, labels, tokenizer.pad_token_id)
    <span class="hljs-comment"># Decode reference summaries into text</span>
    decoded_labels = tokenizer.batch_decode(labels, skip_special_tokens=<span class="hljs-literal">True</span>)
    <span class="hljs-comment"># ROUGE expects a newline after each sentence</span>
    decoded_preds = [<span class="hljs-string">&quot;\\n&quot;</span>.join(sent_tokenize(pred.strip())) <span class="hljs-keyword">for</span> pred <span class="hljs-keyword">in</span> decoded_preds]
    decoded_labels = [<span class="hljs-string">&quot;\\n&quot;</span>.join(sent_tokenize(label.strip())) <span class="hljs-keyword">for</span> label <span class="hljs-keyword">in</span> decoded_labels]
    <span class="hljs-comment"># Compute ROUGE scores</span>
    result = rouge_score.compute(
        predictions=decoded_preds, references=decoded_labels, use_stemmer=<span class="hljs-literal">True</span>
    )
    <span class="hljs-comment"># Extract the median scores</span>
    result = {key: value.mid.fmeasure * <span class="hljs-number">100</span> <span class="hljs-keyword">for</span> key, value <span class="hljs-keyword">in</span> result.items()}
    <span class="hljs-keyword">return</span> {k: <span class="hljs-built_in">round</span>(v, <span class="hljs-number">4</span>) <span class="hljs-keyword">for</span> k, v <span class="hljs-keyword">in</span> result.items()}`}}),{c(){h=n("p"),v=t("\u6211\u4EEC\u9700\u8981\u751F\u6210\u6458\u8981\u4EE5\u4FBF\u5728\u8BAD\u7EC3\u671F\u95F4\u8BA1\u7B97 ROUGE \u5206\u6570\u3002\u5E78\u8FD0\u7684\u662F\uFF0C\u{1F917} Transformers \u63D0\u4F9B\u4E86\u4E13\u7528\u7684 "),f=n("code"),E=t("Seq2SeqTrainingArguments"),O=t(" \u548C "),x=n("code"),S=t("Seq2SeqTrainer"),R=t(" \u7C7B\uFF0C\u53EF\u4EE5\u81EA\u52A8\u4E3A\u6211\u4EEC\u5B8C\u6210\u8FD9\u9879\u5DE5\u4F5C\uFF01 \u4E3A\u4E86\u4E86\u89E3\u5B83\u662F\u5982\u4F55\u5DE5\u4F5C\u7684\uFF0C\u8BA9\u6211\u4EEC\u9996\u5148\u4E3A\u6211\u4EEC\u7684\u5B9E\u9A8C\u5B9A\u4E49\u8D85\u53C2\u6570\u548C\u5176\u4ED6\u53C2\u6570\uFF1A"),P=c(),$(C.$$.fragment),N=c(),D=n("p"),I=t("\u5728\u8FD9\u91CC\uFF0C "),U=n("strong"),J=t("predict_with_generate"),M=t(" \u53C2\u6570\u5DF2\u8BBE\u7F6E\u4E3ATrue\u8868\u660E\u6211\u4EEC\u5E94\u8BE5\u5728\u8BC4\u4F30\u671F\u95F4\u751F\u6210\u6458\u8981\uFF0C\u4EE5\u4FBF\u6211\u4EEC\u53EF\u4EE5\u8BA1\u7B97\u6BCF\u4E2A\u65F6\u671F\u7684 ROUGE \u5206\u6570\u3002\u6B63\u5982\u5728"),B=n("a"),H=t("\u7B2C\u4E00\u7AE0"),Q=t("\u6240\u8BA8\u8BBA\u7684\uFF0C\u89E3\u7801\u5668\u901A\u8FC7\u9010\u4E2A\u9884\u6D4B\u4EE4\u724C\u6765\u6267\u884C\u63A8\u7406\uFF0C\u8FD9\u662F\u7531\u6A21\u578B\u7684 "),z=n("strong"),G=t("generate()"),os=t(" \u65B9\u6CD5\u5B9E\u73B0\u7684\u3002\u8BBE\u7F6E "),ss=n("strong"),Z=t("predict_with_generate=True"),W=t(" \u544A\u8BC9 "),X=n("strong"),ls=t("Seq2SeqTrainer"),V=t(" \u4F7F\u7528\u8BE5\u65B9\u6CD5\u8FDB\u884C\u8BC4\u4F30\u3002\u6211\u4EEC\u8FD8\u8C03\u6574\u4E86\u4E00\u4E9B\u9ED8\u8BA4\u7684\u8D85\u53C2\u6570\uFF0C\u4F8B\u5982\u5B66\u4E60\u7387\u3001epoch\u6570\u548C\u6743\u91CD\u8870\u51CF\uFF0C\u5E76\u4E14\u6211\u4EEC\u8BBE\u7F6E\u4E86 "),$s=n("strong"),js=t("save_total_limit"),ps=t(" \u8BAD\u7EC3\u671F\u95F4\u6700\u591A\u53EA\u4FDD\u5B58 3 \u4E2A\u68C0\u67E5\u70B9\u7684\u9009\u9879\u2014\u2014\u8FD9\u662F\u56E0\u4E3A\u5373\u4F7F\u662F mT5 \u7684\u201Csmall\u201D\u7248\u672C\u4E5F\u4F7F\u7528\u5927\u7EA6 1 GB \u7684\u786C\u76D8\u7A7A\u95F4\uFF0C\u6211\u4EEC\u53EF\u4EE5\u901A\u8FC7\u9650\u5236\u6211\u4EEC\u4FDD\u5B58\u7684\u526F\u672C\u6570\u91CF\u6765\u8282\u7701\u4E00\u70B9\u7A7A\u95F4\u3002"),vs=c(),Y=n("p"),cs=n("code"),ys=t("push_to_hub=True"),es=t(" \u53C2\u6570\u5C06\u5141\u8BB8\u6211\u4EEC\u5728\u8BAD\u7EC3\u540E\u5C06\u6A21\u578B\u63A8\u9001\u5230 Hub\uFF1B \u60A8\u5C06\u5728"),ns=n("code"),rs=t("output_dir"),is=t("\u5B9A\u4E49\u7684\u4F4D\u7F6E\u4E2D\u7684\u7528\u6237\u914D\u7F6E\u6587\u4EF6\u4E0B\u627E\u5230\u5B58\u50A8\u5E93\u3002 \u8BF7\u6CE8\u610F\uFF0C\u60A8\u53EF\u4EE5\u4F7F\u7528 "),j=n("code"),F=t("hub_model_id"),Ts=t(" \u53C2\u6570\u6307\u5B9A\u8981\u63A8\u9001\u5230\u7684\u5B58\u50A8\u5E93\u7684\u540D\u79F0\uFF08\u7279\u522B\u662F\u5F53\u60A8\u60F3\u8981\u63A8\u9001\u5230\u7EC4\u7EC7\u65F6\uFF0C\u60A8\u5FC5\u987B\u4F7F\u7528\u6B64\u53C2\u6570\uFF09\u3002 \u4F8B\u5982\uFF0C\u5F53\u6211\u4EEC\u5C06\u6A21\u578B\u63A8\u9001\u5230 "),as=n("a"),us=n("code"),ms=t("huggingface-course"),g=t(" \u7EC4\u7EC7"),A=t(" \u65F6\uFF0C\u6211\u4EEC\u6DFB\u52A0\u4E86"),qs=n("code"),hs=t('hub_model_id="huggingface-course/mt5-finetuned-amazon-en-es"'),Ys=t(" \u5230 "),Es=n("code"),_s=t("Seq2SeqTrainingArguments"),Cs=t("\u3002"),Js=c(),fs=n("p"),Xs=t("\u6211\u4EEC\u9700\u8981\u505A\u7684\u4E0B\u4E00\u4EF6\u4E8B\u662F\u4E3A\u8BAD\u7EC3\u5668\u63D0\u4F9B\u4E00\u4E2A\u201Ccompute_metrics()\u201D\u51FD\u6570\uFF0C\u4EE5\u4FBF\u6211\u4EEC\u53EF\u4EE5\u5728\u8BAD\u7EC3\u671F\u95F4\u8BC4\u4F30\u6211\u4EEC\u7684\u6A21\u578B\u3002 \u603B\u7ED3\u8D77\u6765\uFF0C\u8FD9\u6BD4\u7B80\u5355\u5730\u5728\u6A21\u578B\u7684\u9884\u6D4B\u4E0A\u8C03\u7528 "),Ss=n("code"),ee=t("rouge_score.compute()"),Us=t(" \u66F4\u590D\u6742\u4E00\u4E9B\uFF0C\u56E0\u4E3A\u6211\u4EEC\u9700\u8981\u5728\u8BA1\u7B97 ROUGE \u5206\u6570\u4E4B\u524D\u5C06\u8F93\u51FA\u548C\u6807\u7B7E\u89E3\u7801\u4E3A\u6587\u672C\u3002 \u4E0B\u9762\u7684\u51FD\u6570\u6B63\u662F\u8FD9\u6837\u505A\u7684\uFF0C\u5E76\u4E14\u8FD8\u5229\u7528 "),he=n("code"),Qs=t("nltk"),Le=t(" \u4E2D\u7684 "),fe=n("code"),Zs=t("sent_tokenize()"),se=t(" \u51FD\u6570\u6765\u7528\u6362\u884C\u7B26\u5206\u9694\u6458\u8981\u8BED\u53E5\uFF1A"),de=c(),$(zs.$$.fragment),this.h()},l(L){h=r(L,"P",{});var ts=p(h);v=l(ts,"\u6211\u4EEC\u9700\u8981\u751F\u6210\u6458\u8981\u4EE5\u4FBF\u5728\u8BAD\u7EC3\u671F\u95F4\u8BA1\u7B97 ROUGE \u5206\u6570\u3002\u5E78\u8FD0\u7684\u662F\uFF0C\u{1F917} Transformers \u63D0\u4F9B\u4E86\u4E13\u7528\u7684 "),f=r(ts,"CODE",{});var we=p(f);E=l(we,"Seq2SeqTrainingArguments"),we.forEach(a),O=l(ts," \u548C "),x=r(ts,"CODE",{});var ks=p(x);S=l(ks,"Seq2SeqTrainer"),ks.forEach(a),R=l(ts," \u7C7B\uFF0C\u53EF\u4EE5\u81EA\u52A8\u4E3A\u6211\u4EEC\u5B8C\u6210\u8FD9\u9879\u5DE5\u4F5C\uFF01 \u4E3A\u4E86\u4E86\u89E3\u5B83\u662F\u5982\u4F55\u5DE5\u4F5C\u7684\uFF0C\u8BA9\u6211\u4EEC\u9996\u5148\u4E3A\u6211\u4EEC\u7684\u5B9E\u9A8C\u5B9A\u4E49\u8D85\u53C2\u6570\u548C\u5176\u4ED6\u53C2\u6570\uFF1A"),ts.forEach(a),P=u(L),k(C.$$.fragment,L),N=u(L),D=r(L,"P",{});var ds=p(D);I=l(ds,"\u5728\u8FD9\u91CC\uFF0C "),U=r(ds,"STRONG",{});var Ls=p(U);J=l(Ls,"predict_with_generate"),Ls.forEach(a),M=l(ds," \u53C2\u6570\u5DF2\u8BBE\u7F6E\u4E3ATrue\u8868\u660E\u6211\u4EEC\u5E94\u8BE5\u5728\u8BC4\u4F30\u671F\u95F4\u751F\u6210\u6458\u8981\uFF0C\u4EE5\u4FBF\u6211\u4EEC\u53EF\u4EE5\u8BA1\u7B97\u6BCF\u4E2A\u65F6\u671F\u7684 ROUGE \u5206\u6570\u3002\u6B63\u5982\u5728"),B=r(ds,"A",{href:!0});var ta=p(B);H=l(ta,"\u7B2C\u4E00\u7AE0"),ta.forEach(a),Q=l(ds,"\u6240\u8BA8\u8BBA\u7684\uFF0C\u89E3\u7801\u5668\u901A\u8FC7\u9010\u4E2A\u9884\u6D4B\u4EE4\u724C\u6765\u6267\u884C\u63A8\u7406\uFF0C\u8FD9\u662F\u7531\u6A21\u578B\u7684 "),z=r(ds,"STRONG",{});var ae=p(z);G=l(ae,"generate()"),ae.forEach(a),os=l(ds," \u65B9\u6CD5\u5B9E\u73B0\u7684\u3002\u8BBE\u7F6E "),ss=r(ds,"STRONG",{});var la=p(ss);Z=l(la,"predict_with_generate=True"),la.forEach(a),W=l(ds," \u544A\u8BC9 "),X=r(ds,"STRONG",{});var na=p(X);ls=l(na,"Seq2SeqTrainer"),na.forEach(a),V=l(ds," \u4F7F\u7528\u8BE5\u65B9\u6CD5\u8FDB\u884C\u8BC4\u4F30\u3002\u6211\u4EEC\u8FD8\u8C03\u6574\u4E86\u4E00\u4E9B\u9ED8\u8BA4\u7684\u8D85\u53C2\u6570\uFF0C\u4F8B\u5982\u5B66\u4E60\u7387\u3001epoch\u6570\u548C\u6743\u91CD\u8870\u51CF\uFF0C\u5E76\u4E14\u6211\u4EEC\u8BBE\u7F6E\u4E86 "),$s=r(ds,"STRONG",{});var te=p($s);js=l(te,"save_total_limit"),te.forEach(a),ps=l(ds," \u8BAD\u7EC3\u671F\u95F4\u6700\u591A\u53EA\u4FDD\u5B58 3 \u4E2A\u68C0\u67E5\u70B9\u7684\u9009\u9879\u2014\u2014\u8FD9\u662F\u56E0\u4E3A\u5373\u4F7F\u662F mT5 \u7684\u201Csmall\u201D\u7248\u672C\u4E5F\u4F7F\u7528\u5927\u7EA6 1 GB \u7684\u786C\u76D8\u7A7A\u95F4\uFF0C\u6211\u4EEC\u53EF\u4EE5\u901A\u8FC7\u9650\u5236\u6211\u4EEC\u4FDD\u5B58\u7684\u526F\u672C\u6570\u91CF\u6765\u8282\u7701\u4E00\u70B9\u7A7A\u95F4\u3002"),ds.forEach(a),vs=u(L),Y=r(L,"P",{});var xs=p(Y);cs=r(xs,"CODE",{});var Ie=p(cs);ys=l(Ie,"push_to_hub=True"),Ie.forEach(a),es=l(xs," \u53C2\u6570\u5C06\u5141\u8BB8\u6211\u4EEC\u5728\u8BAD\u7EC3\u540E\u5C06\u6A21\u578B\u63A8\u9001\u5230 Hub\uFF1B \u60A8\u5C06\u5728"),ns=r(xs,"CODE",{});var le=p(ns);rs=l(le,"output_dir"),le.forEach(a),is=l(xs,"\u5B9A\u4E49\u7684\u4F4D\u7F6E\u4E2D\u7684\u7528\u6237\u914D\u7F6E\u6587\u4EF6\u4E0B\u627E\u5230\u5B58\u50A8\u5E93\u3002 \u8BF7\u6CE8\u610F\uFF0C\u60A8\u53EF\u4EE5\u4F7F\u7528 "),j=r(xs,"CODE",{});var ne=p(j);F=l(ne,"hub_model_id"),ne.forEach(a),Ts=l(xs," \u53C2\u6570\u6307\u5B9A\u8981\u63A8\u9001\u5230\u7684\u5B58\u50A8\u5E93\u7684\u540D\u79F0\uFF08\u7279\u522B\u662F\u5F53\u60A8\u60F3\u8981\u63A8\u9001\u5230\u7EC4\u7EC7\u65F6\uFF0C\u60A8\u5FC5\u987B\u4F7F\u7528\u6B64\u53C2\u6570\uFF09\u3002 \u4F8B\u5982\uFF0C\u5F53\u6211\u4EEC\u5C06\u6A21\u578B\u63A8\u9001\u5230 "),as=r(xs,"A",{href:!0,rel:!0});var _e=p(as);us=r(_e,"CODE",{});var Os=p(us);ms=l(Os,"huggingface-course"),Os.forEach(a),g=l(_e," \u7EC4\u7EC7"),_e.forEach(a),A=l(xs," \u65F6\uFF0C\u6211\u4EEC\u6DFB\u52A0\u4E86"),qs=r(xs,"CODE",{});var ye=p(qs);hs=l(ye,'hub_model_id="huggingface-course/mt5-finetuned-amazon-en-es"'),ye.forEach(a),Ys=l(xs," \u5230 "),Es=r(xs,"CODE",{});var gs=p(Es);_s=l(gs,"Seq2SeqTrainingArguments"),gs.forEach(a),Cs=l(xs,"\u3002"),xs.forEach(a),Js=u(L),fs=r(L,"P",{});var Hs=p(fs);Xs=l(Hs,"\u6211\u4EEC\u9700\u8981\u505A\u7684\u4E0B\u4E00\u4EF6\u4E8B\u662F\u4E3A\u8BAD\u7EC3\u5668\u63D0\u4F9B\u4E00\u4E2A\u201Ccompute_metrics()\u201D\u51FD\u6570\uFF0C\u4EE5\u4FBF\u6211\u4EEC\u53EF\u4EE5\u5728\u8BAD\u7EC3\u671F\u95F4\u8BC4\u4F30\u6211\u4EEC\u7684\u6A21\u578B\u3002 \u603B\u7ED3\u8D77\u6765\uFF0C\u8FD9\u6BD4\u7B80\u5355\u5730\u5728\u6A21\u578B\u7684\u9884\u6D4B\u4E0A\u8C03\u7528 "),Ss=r(Hs,"CODE",{});var ge=p(Ss);ee=l(ge,"rouge_score.compute()"),ge.forEach(a),Us=l(Hs," \u66F4\u590D\u6742\u4E00\u4E9B\uFF0C\u56E0\u4E3A\u6211\u4EEC\u9700\u8981\u5728\u8BA1\u7B97 ROUGE \u5206\u6570\u4E4B\u524D\u5C06\u8F93\u51FA\u548C\u6807\u7B7E\u89E3\u7801\u4E3A\u6587\u672C\u3002 \u4E0B\u9762\u7684\u51FD\u6570\u6B63\u662F\u8FD9\u6837\u505A\u7684\uFF0C\u5E76\u4E14\u8FD8\u5229\u7528 "),he=r(Hs,"CODE",{});var re=p(he);Qs=l(re,"nltk"),re.forEach(a),Le=l(Hs," \u4E2D\u7684 "),fe=r(Hs,"CODE",{});var Ne=p(fe);Zs=l(Ne,"sent_tokenize()"),Ne.forEach(a),se=l(Hs," \u51FD\u6570\u6765\u7528\u6362\u884C\u7B26\u5206\u9694\u6458\u8981\u8BED\u53E5\uFF1A"),Hs.forEach(a),de=u(L),k(zs.$$.fragment,L),this.h()},h(){b(B,"href","/course/chapter1"),b(as,"href","https://huggingface.co/huggingface-course"),b(as,"rel","nofollow")},m(L,ts){o(L,h,ts),e(h,v),e(h,f),e(f,E),e(h,O),e(h,x),e(x,S),e(h,R),o(L,P,ts),w(C,L,ts),o(L,N,ts),o(L,D,ts),e(D,I),e(D,U),e(U,J),e(D,M),e(D,B),e(B,H),e(D,Q),e(D,z),e(z,G),e(D,os),e(D,ss),e(ss,Z),e(D,W),e(D,X),e(X,ls),e(D,V),e(D,$s),e($s,js),e(D,ps),o(L,vs,ts),o(L,Y,ts),e(Y,cs),e(cs,ys),e(Y,es),e(Y,ns),e(ns,rs),e(Y,is),e(Y,j),e(j,F),e(Y,Ts),e(Y,as),e(as,us),e(us,ms),e(as,g),e(Y,A),e(Y,qs),e(qs,hs),e(Y,Ys),e(Y,Es),e(Es,_s),e(Y,Cs),o(L,Js,ts),o(L,fs,ts),e(fs,Xs),e(fs,Ss),e(Ss,ee),e(fs,Us),e(fs,he),e(he,Qs),e(fs,Le),e(fs,fe),e(fe,Zs),e(fs,se),o(L,de,ts),w(zs,L,ts),As=!0},i(L){As||(d(C.$$.fragment,L),d(zs.$$.fragment,L),As=!0)},o(L){_(C.$$.fragment,L),_(zs.$$.fragment,L),As=!1},d(L){L&&a(h),L&&a(P),y(C,L),L&&a(N),L&&a(D),L&&a(vs),L&&a(Y),L&&a(Js),L&&a(fs),L&&a(de),y(zs,L)}}}function Rd(K){let h,v;return h=new q({props:{code:`from transformers import DataCollatorForSeq2Seq

data_collator = DataCollatorForSeq2Seq(tokenizer, model=model, return_tensors="tf")`,highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DataCollatorForSeq2Seq

data_collator = DataCollatorForSeq2Seq(tokenizer, model=model, return_tensors=<span class="hljs-string">&quot;tf&quot;</span>)`}}),{c(){$(h.$$.fragment)},l(f){k(h.$$.fragment,f)},m(f,E){w(h,f,E),v=!0},i(f){v||(d(h.$$.fragment,f),v=!0)},o(f){_(h.$$.fragment,f),v=!1},d(f){y(h,f)}}}function Od(K){let h,v;return h=new q({props:{code:`from transformers import DataCollatorForSeq2Seq

data_collator = DataCollatorForSeq2Seq(tokenizer, model=model)`,highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> DataCollatorForSeq2Seq

data_collator = DataCollatorForSeq2Seq(tokenizer, model=model)`}}),{c(){$(h.$$.fragment)},l(f){k(h.$$.fragment,f)},m(f,E){w(h,f,E),v=!0},i(f){v||(d(h.$$.fragment,f),v=!0)},o(f){_(h.$$.fragment,f),v=!1},d(f){y(h,f)}}}function Pd(K){let h,v,f,E,O,x,S,R,P,C,N,D,I,U,J,M,B,H,Q,z,G,os,ss,Z,W,X,ls,V,$s,js,ps,vs,Y,cs,ys,es,ns,rs,is;return C=new q({props:{code:`tf_train_dataset = tokenized_datasets["train"].to_tf_dataset(
    columns=["input_ids", "attention_mask", "labels"],
    collate_fn=data_collator,
    shuffle=True,
    batch_size=8,
)
tf_eval_dataset = tokenized_datasets["validation"].to_tf_dataset(
    columns=["input_ids", "attention_mask", "labels"],
    collate_fn=data_collator,
    shuffle=False,
    batch_size=8,
)`,highlighted:`tf_train_dataset = tokenized_datasets[<span class="hljs-string">&quot;train&quot;</span>].to_tf_dataset(
    columns=[<span class="hljs-string">&quot;input_ids&quot;</span>, <span class="hljs-string">&quot;attention_mask&quot;</span>, <span class="hljs-string">&quot;labels&quot;</span>],
    collate_fn=data_collator,
    shuffle=<span class="hljs-literal">True</span>,
    batch_size=<span class="hljs-number">8</span>,
)
tf_eval_dataset = tokenized_datasets[<span class="hljs-string">&quot;validation&quot;</span>].to_tf_dataset(
    columns=[<span class="hljs-string">&quot;input_ids&quot;</span>, <span class="hljs-string">&quot;attention_mask&quot;</span>, <span class="hljs-string">&quot;labels&quot;</span>],
    collate_fn=data_collator,
    shuffle=<span class="hljs-literal">False</span>,
    batch_size=<span class="hljs-number">8</span>,
)`}}),J=new q({props:{code:`from transformers import create_optimizer
import tensorflow as tf

# The number of training steps is the number of samples in the dataset, divided by the batch size then multiplied
# by the total number of epochs. Note that the tf_train_dataset here is a batched tf.data.Dataset,
# not the original Hugging Face Dataset, so its len() is already num_samples // batch_size.
num_train_epochs = 8
num_train_steps = len(tf_train_dataset) * num_train_epochs
model_name = model_checkpoint.split("/")[-1]

optimizer, schedule = create_optimizer(
    init_lr=5.6e-5,
    num_warmup_steps=0,
    num_train_steps=num_train_steps,
    weight_decay_rate=0.01,
)

model.compile(optimizer=optimizer)

# Train in mixed-precision float16
tf.keras.mixed_precision.set_global_policy("mixed_float16")`,highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> create_optimizer
<span class="hljs-keyword">import</span> tensorflow <span class="hljs-keyword">as</span> tf

<span class="hljs-comment"># The number of training steps is the number of samples in the dataset, divided by the batch size then multiplied</span>
<span class="hljs-comment"># by the total number of epochs. Note that the tf_train_dataset here is a batched tf.data.Dataset,</span>
<span class="hljs-comment"># not the original Hugging Face Dataset, so its len() is already num_samples // batch_size.</span>
num_train_epochs = <span class="hljs-number">8</span>
num_train_steps = <span class="hljs-built_in">len</span>(tf_train_dataset) * num_train_epochs
model_name = model_checkpoint.split(<span class="hljs-string">&quot;/&quot;</span>)[-<span class="hljs-number">1</span>]

optimizer, schedule = create_optimizer(
    init_lr=<span class="hljs-number">5.6e-5</span>,
    num_warmup_steps=<span class="hljs-number">0</span>,
    num_train_steps=num_train_steps,
    weight_decay_rate=<span class="hljs-number">0.01</span>,
)

model.<span class="hljs-built_in">compile</span>(optimizer=optimizer)

<span class="hljs-comment"># Train in mixed-precision float16</span>
tf.keras.mixed_precision.set_global_policy(<span class="hljs-string">&quot;mixed_float16&quot;</span>)`}}),ss=new q({props:{code:`from transformers.keras_callbacks import PushToHubCallback

callback = PushToHubCallback(
    output_dir=f"{model_name}-finetuned-amazon-en-es", tokenizer=tokenizer
)

model.fit(
    tf_train_dataset, validation_data=tf_eval_dataset, callbacks=[callback], epochs=8
)`,highlighted:`<span class="hljs-keyword">from</span> transformers.keras_callbacks <span class="hljs-keyword">import</span> PushToHubCallback

callback = PushToHubCallback(
    output_dir=<span class="hljs-string">f&quot;<span class="hljs-subst">{model_name}</span>-finetuned-amazon-en-es&quot;</span>, tokenizer=tokenizer
)

model.fit(
    tf_train_dataset, validation_data=tf_eval_dataset, callbacks=[callback], epochs=<span class="hljs-number">8</span>
)`}}),ps=new q({props:{code:`from tqdm import tqdm
import numpy as np

all_preds = []
all_labels = []
for batch in tqdm(tf_eval_dataset):
    predictions = model.generate(**batch)
    decoded_preds = tokenizer.batch_decode(predictions, skip_special_tokens=True)
    labels = batch["labels"].numpy()
    labels = np.where(labels != -100, labels, tokenizer.pad_token_id)
    decoded_labels = tokenizer.batch_decode(labels, skip_special_tokens=True)
    decoded_preds = ["\\n".join(sent_tokenize(pred.strip())) for pred in decoded_preds]
    decoded_labels = ["\\n".join(sent_tokenize(label.strip())) for label in decoded_labels]
    all_preds.extend(decoded_preds)
    all_labels.extend(decoded_labels)`,highlighted:`<span class="hljs-keyword">from</span> tqdm <span class="hljs-keyword">import</span> tqdm
<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np

all_preds = []
all_labels = []
<span class="hljs-keyword">for</span> batch <span class="hljs-keyword">in</span> tqdm(tf_eval_dataset):
    predictions = model.generate(**batch)
    decoded_preds = tokenizer.batch_decode(predictions, skip_special_tokens=<span class="hljs-literal">True</span>)
    labels = batch[<span class="hljs-string">&quot;labels&quot;</span>].numpy()
    labels = np.where(labels != -<span class="hljs-number">100</span>, labels, tokenizer.pad_token_id)
    decoded_labels = tokenizer.batch_decode(labels, skip_special_tokens=<span class="hljs-literal">True</span>)
    decoded_preds = [<span class="hljs-string">&quot;\\n&quot;</span>.join(sent_tokenize(pred.strip())) <span class="hljs-keyword">for</span> pred <span class="hljs-keyword">in</span> decoded_preds]
    decoded_labels = [<span class="hljs-string">&quot;\\n&quot;</span>.join(sent_tokenize(label.strip())) <span class="hljs-keyword">for</span> label <span class="hljs-keyword">in</span> decoded_labels]
    all_preds.extend(decoded_preds)
    all_labels.extend(decoded_labels)`}}),es=new q({props:{code:`result = rouge_score.compute(
    predictions=decoded_preds, references=decoded_labels, use_stemmer=True
)
result = {key: value.mid.fmeasure * 100 for key, value in result.items()}
{k: round(v, 4) for k, v in result.items()}`,highlighted:`result = rouge_score.compute(
    predictions=decoded_preds, references=decoded_labels, use_stemmer=<span class="hljs-literal">True</span>
)
result = {key: value.mid.fmeasure * <span class="hljs-number">100</span> <span class="hljs-keyword">for</span> key, value <span class="hljs-keyword">in</span> result.items()}
{k: <span class="hljs-built_in">round</span>(v, <span class="hljs-number">4</span>) <span class="hljs-keyword">for</span> k, v <span class="hljs-keyword">in</span> result.items()}`}}),rs=new q({props:{code:"{'rouge1': 31.4815, 'rouge2': 25.4386, 'rougeL': 31.4815, 'rougeLsum': 31.4815}",highlighted:'{&#x27;rouge1&#x27;: <span class="hljs-number">31.4815</span>, &#x27;rouge2&#x27;: <span class="hljs-number">25.4386</span>, &#x27;rougeL&#x27;: <span class="hljs-number">31.4815</span>, &#x27;rougeLsum&#x27;: <span class="hljs-number">31.4815</span>}'}}),{c(){h=n("p"),v=t("\u6211\u4EEC\u51E0\u4E4E\u51C6\u5907\u597D\u8BAD\u7EC3\u4E86\uFF01 \u6211\u4EEC\u53EA\u9700\u8981\u4F7F\u7528\u6211\u4EEC\u4E0A\u9762\u5B9A\u4E49\u7684\u6570\u636E\u6574\u7406\u5668\u5C06\u6211\u4EEC\u7684\u6570\u636E\u96C6\u8F6C\u6362\u4E3A tf.data.Dataset \uFF0C\u7136\u540E "),f=n("code"),E=t("compile()"),O=t(" \u548C "),x=n("code"),S=t("fit()"),R=t(" \u6A21\u578B\u3002 \u9996\u5148\uFF0C\u8F6C\u6362\u6570\u636E\u96C6\uFF1A"),P=c(),$(C.$$.fragment),N=c(),D=n("p"),I=t("\u73B0\u5728\uFF0C\u6211\u4EEC\u5B9A\u4E49\u8BAD\u7EC3\u8D85\u53C2\u6570\u5E76\u7F16\u8BD1\uFF1A"),U=c(),$(J.$$.fragment),M=c(),B=n("p"),H=t("\u6700\u540E\uFF0C\u6211\u4EEC\u62DF\u5408\u6A21\u578B\u3002 \u6211\u4EEC\u5728\u6BCF\u4E2A epoch \u4E4B\u540E\u4F7F\u7528"),Q=n("code"),z=t("PushToHubCallback"),G=t("\u5C06\u6A21\u578B\u4FDD\u5B58\u5230 Hub\uFF0C\u8FD9\u5C06\u5141\u8BB8\u6211\u4EEC\u7A0D\u540E\u4F7F\u7528\u5B83\u8FDB\u884C\u63A8\u7406\uFF1A"),os=c(),$(ss.$$.fragment),Z=c(),W=n("p"),X=t("\u6211\u4EEC\u5728\u8BAD\u7EC3\u671F\u95F4\u8F93\u51FA\u4E86\u4E00\u4E9Bloss\uFF0C\u4F46\u5B9E\u9645\u4E0A\u6211\u4EEC\u5E0C\u671B\u770B\u5230\u6211\u4EEC\u4E4B\u524D\u8BA1\u7B97\u7684 ROUGE \u6307\u6807\u3002 \u8981\u83B7\u5F97\u8FD9\u4E9B\u6307\u6807\uFF0C\u6211\u4EEC\u9700\u8981\u4ECE\u6A21\u578B\u751F\u6210\u8F93\u51FA\u5E76\u5C06\u5B83\u4EEC\u8F6C\u6362\u4E3A\u5B57\u7B26\u4E32\u3002 \u8BA9\u6211\u4EEC\u4E3A ROUGE \u6307\u6807\u6784\u5EFA\u4E00\u4E9B\u6807\u7B7E\u548C\u9884\u6D4B\u5217\u8868\u4EE5\u8FDB\u884C\u6BD4\u8F83\uFF08\u8BF7\u6CE8\u610F\uFF0C\u5982\u679C\u60A8\u5728\u672C\u8282\u4E2D\u9047\u5230import\u7684\u9519\u8BEF\uFF0C\u60A8\u53EF\u80FD\u9700\u8981"),ls=n("code"),V=t("!pip install tqdm"),$s=t("\uFF09\uFF1A"),js=c(),$(ps.$$.fragment),vs=c(),Y=n("p"),cs=t("\u4E00\u65E6\u6211\u4EEC\u6709\u4E86\u6807\u7B7E\u548C\u9884\u6D4B\u5B57\u7B26\u4E32\u5217\u8868\uFF0C\u8BA1\u7B97 ROUGE \u5206\u6570\u5C31\u5F88\u5BB9\u6613\u4E86\uFF1A"),ys=c(),$(es.$$.fragment),ns=c(),$(rs.$$.fragment)},l(j){h=r(j,"P",{});var F=p(h);v=l(F,"\u6211\u4EEC\u51E0\u4E4E\u51C6\u5907\u597D\u8BAD\u7EC3\u4E86\uFF01 \u6211\u4EEC\u53EA\u9700\u8981\u4F7F\u7528\u6211\u4EEC\u4E0A\u9762\u5B9A\u4E49\u7684\u6570\u636E\u6574\u7406\u5668\u5C06\u6211\u4EEC\u7684\u6570\u636E\u96C6\u8F6C\u6362\u4E3A tf.data.Dataset \uFF0C\u7136\u540E "),f=r(F,"CODE",{});var Ts=p(f);E=l(Ts,"compile()"),Ts.forEach(a),O=l(F," \u548C "),x=r(F,"CODE",{});var as=p(x);S=l(as,"fit()"),as.forEach(a),R=l(F," \u6A21\u578B\u3002 \u9996\u5148\uFF0C\u8F6C\u6362\u6570\u636E\u96C6\uFF1A"),F.forEach(a),P=u(j),k(C.$$.fragment,j),N=u(j),D=r(j,"P",{});var us=p(D);I=l(us,"\u73B0\u5728\uFF0C\u6211\u4EEC\u5B9A\u4E49\u8BAD\u7EC3\u8D85\u53C2\u6570\u5E76\u7F16\u8BD1\uFF1A"),us.forEach(a),U=u(j),k(J.$$.fragment,j),M=u(j),B=r(j,"P",{});var ms=p(B);H=l(ms,"\u6700\u540E\uFF0C\u6211\u4EEC\u62DF\u5408\u6A21\u578B\u3002 \u6211\u4EEC\u5728\u6BCF\u4E2A epoch \u4E4B\u540E\u4F7F\u7528"),Q=r(ms,"CODE",{});var g=p(Q);z=l(g,"PushToHubCallback"),g.forEach(a),G=l(ms,"\u5C06\u6A21\u578B\u4FDD\u5B58\u5230 Hub\uFF0C\u8FD9\u5C06\u5141\u8BB8\u6211\u4EEC\u7A0D\u540E\u4F7F\u7528\u5B83\u8FDB\u884C\u63A8\u7406\uFF1A"),ms.forEach(a),os=u(j),k(ss.$$.fragment,j),Z=u(j),W=r(j,"P",{});var A=p(W);X=l(A,"\u6211\u4EEC\u5728\u8BAD\u7EC3\u671F\u95F4\u8F93\u51FA\u4E86\u4E00\u4E9Bloss\uFF0C\u4F46\u5B9E\u9645\u4E0A\u6211\u4EEC\u5E0C\u671B\u770B\u5230\u6211\u4EEC\u4E4B\u524D\u8BA1\u7B97\u7684 ROUGE \u6307\u6807\u3002 \u8981\u83B7\u5F97\u8FD9\u4E9B\u6307\u6807\uFF0C\u6211\u4EEC\u9700\u8981\u4ECE\u6A21\u578B\u751F\u6210\u8F93\u51FA\u5E76\u5C06\u5B83\u4EEC\u8F6C\u6362\u4E3A\u5B57\u7B26\u4E32\u3002 \u8BA9\u6211\u4EEC\u4E3A ROUGE \u6307\u6807\u6784\u5EFA\u4E00\u4E9B\u6807\u7B7E\u548C\u9884\u6D4B\u5217\u8868\u4EE5\u8FDB\u884C\u6BD4\u8F83\uFF08\u8BF7\u6CE8\u610F\uFF0C\u5982\u679C\u60A8\u5728\u672C\u8282\u4E2D\u9047\u5230import\u7684\u9519\u8BEF\uFF0C\u60A8\u53EF\u80FD\u9700\u8981"),ls=r(A,"CODE",{});var qs=p(ls);V=l(qs,"!pip install tqdm"),qs.forEach(a),$s=l(A,"\uFF09\uFF1A"),A.forEach(a),js=u(j),k(ps.$$.fragment,j),vs=u(j),Y=r(j,"P",{});var hs=p(Y);cs=l(hs,"\u4E00\u65E6\u6211\u4EEC\u6709\u4E86\u6807\u7B7E\u548C\u9884\u6D4B\u5B57\u7B26\u4E32\u5217\u8868\uFF0C\u8BA1\u7B97 ROUGE \u5206\u6570\u5C31\u5F88\u5BB9\u6613\u4E86\uFF1A"),hs.forEach(a),ys=u(j),k(es.$$.fragment,j),ns=u(j),k(rs.$$.fragment,j)},m(j,F){o(j,h,F),e(h,v),e(h,f),e(f,E),e(h,O),e(h,x),e(x,S),e(h,R),o(j,P,F),w(C,j,F),o(j,N,F),o(j,D,F),e(D,I),o(j,U,F),w(J,j,F),o(j,M,F),o(j,B,F),e(B,H),e(B,Q),e(Q,z),e(B,G),o(j,os,F),w(ss,j,F),o(j,Z,F),o(j,W,F),e(W,X),e(W,ls),e(ls,V),e(W,$s),o(j,js,F),w(ps,j,F),o(j,vs,F),o(j,Y,F),e(Y,cs),o(j,ys,F),w(es,j,F),o(j,ns,F),w(rs,j,F),is=!0},i(j){is||(d(C.$$.fragment,j),d(J.$$.fragment,j),d(ss.$$.fragment,j),d(ps.$$.fragment,j),d(es.$$.fragment,j),d(rs.$$.fragment,j),is=!0)},o(j){_(C.$$.fragment,j),_(J.$$.fragment,j),_(ss.$$.fragment,j),_(ps.$$.fragment,j),_(es.$$.fragment,j),_(rs.$$.fragment,j),is=!1},d(j){j&&a(h),j&&a(P),y(C,j),j&&a(N),j&&a(D),j&&a(U),y(J,j),j&&a(M),j&&a(B),j&&a(os),y(ss,j),j&&a(Z),j&&a(W),j&&a(js),y(ps,j),j&&a(vs),j&&a(Y),j&&a(ys),y(es,j),j&&a(ns),y(rs,j)}}}function Gd(K){let h,v,f,E,O,x,S,R,P,C,N,D,I,U,J,M,B,H,Q,z,G,os,ss,Z,W,X,ls,V,$s,js,ps,vs,Y,cs,ys,es,ns,rs,is,j,F,Ts,as,us,ms;return E=new q({props:{code:`from transformers import Seq2SeqTrainer

trainer = Seq2SeqTrainer(
    model,
    args,
    train_dataset=tokenized_datasets["train"],
    eval_dataset=tokenized_datasets["validation"],
    data_collator=data_collator,
    tokenizer=tokenizer,
    compute_metrics=compute_metrics,
)`,highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> Seq2SeqTrainer

trainer = Seq2SeqTrainer(
    model,
    args,
    train_dataset=tokenized_datasets[<span class="hljs-string">&quot;train&quot;</span>],
    eval_dataset=tokenized_datasets[<span class="hljs-string">&quot;validation&quot;</span>],
    data_collator=data_collator,
    tokenizer=tokenizer,
    compute_metrics=compute_metrics,
)`}}),P=new q({props:{code:"trainer.train()",highlighted:"trainer.train()"}}),B=new q({props:{code:"trainer.evaluate()",highlighted:"trainer.evaluate()"}}),Q=new q({props:{code:`{'eval_loss': 3.028524398803711,
 'eval_rouge1': 16.9728,
 'eval_rouge2': 8.2969,
 'eval_rougeL': 16.8366,
 'eval_rougeLsum': 16.851,
 'eval_gen_len': 10.1597,
 'eval_runtime': 6.1054,
 'eval_samples_per_second': 38.982,
 'eval_steps_per_second': 4.914}`,highlighted:`{<span class="hljs-string">&#x27;eval_loss&#x27;</span>: <span class="hljs-number">3.028524398803711</span>,
 <span class="hljs-string">&#x27;eval_rouge1&#x27;</span>: <span class="hljs-number">16.9728</span>,
 <span class="hljs-string">&#x27;eval_rouge2&#x27;</span>: <span class="hljs-number">8.2969</span>,
 <span class="hljs-string">&#x27;eval_rougeL&#x27;</span>: <span class="hljs-number">16.8366</span>,
 <span class="hljs-string">&#x27;eval_rougeLsum&#x27;</span>: <span class="hljs-number">16.851</span>,
 <span class="hljs-string">&#x27;eval_gen_len&#x27;</span>: <span class="hljs-number">10.1597</span>,
 <span class="hljs-string">&#x27;eval_runtime&#x27;</span>: <span class="hljs-number">6.1054</span>,
 <span class="hljs-string">&#x27;eval_samples_per_second&#x27;</span>: <span class="hljs-number">38.982</span>,
 <span class="hljs-string">&#x27;eval_steps_per_second&#x27;</span>: <span class="hljs-number">4.914</span>}`}}),Z=new q({props:{code:'trainer.push_to_hub(commit_message="Training complete", tags="summarization")',highlighted:'trainer.push_to_hub(<span class="hljs-attribute">commit_message</span>=<span class="hljs-string">&quot;Training complete&quot;</span>, <span class="hljs-attribute">tags</span>=<span class="hljs-string">&quot;summarization&quot;</span>)'}}),X=new q({props:{code:"'https://huggingface.co/huggingface-course/mt5-finetuned-amazon-en-es/commit/aa0536b829b28e73e1e4b94b8a5aacec420d40e0'",highlighted:'<span class="hljs-string">&#x27;https://huggingface.co/huggingface-course/mt5-finetuned-amazon-en-es/commit/aa0536b829b28e73e1e4b94b8a5aacec420d40e0&#x27;</span>'}}),{c(){h=n("p"),v=t("\u6211\u4EEC\u7EC8\u4E8E\u62E5\u6709\u4E86\u8BAD\u7EC3\u6240\u9700\u7684\u6240\u6709\u7684\u524D\u671F\u51C6\u5907\uFF01\u6211\u4EEC\u73B0\u5728\u53EA\u9700\u8981\u4F7F\u7528\u6807\u51C6\u53C2\u6570\u5B9E\u4F8B\u5316\u8BAD\u7EC3\u5668\uFF1A"),f=c(),$(E.$$.fragment),O=c(),x=n("p"),S=t("\u5E76\u542F\u52A8\u6211\u4EEC\u7684\u8BAD\u7EC3\uFF1A"),R=c(),$(P.$$.fragment),C=c(),N=n("p"),D=t("\u5728\u8BAD\u7EC3\u671F\u95F4\uFF0C\u60A8\u5E94\u8BE5\u4F1A\u770B\u5230\u8BAD\u7EC3\u635F\u5931\u51CF\u5C11\u5E76\u4E14 ROUGE \u5206\u6570\u968F\u7740\u6BCF\u4E2A epoch \u589E\u52A0\u3002\u8BAD\u7EC3\u5B8C\u6210\u540E\uFF0C\u60A8\u53EF\u4EE5\u901A\u8FC7\u8FD0\u884C"),I=n("strong"),U=t("Trainer.evaluate()"),J=t(" \u67E5\u770B\u6700\u7EC8\u7684 ROUGE \u5206\u6570 \uFF1A"),M=c(),$(B.$$.fragment),H=c(),$(Q.$$.fragment),z=c(),G=n("p"),os=t("\u4ECE\u5206\u6570\u4E2D\u6211\u4EEC\u53EF\u4EE5\u770B\u5230\uFF0C\u6211\u4EEC\u7684\u6A21\u578B\u8F7B\u677E\u8D85\u8FC7\u4E86\u6211\u4EEC\u7684lead-3 baseline\u2014\u2014\u5F88\u597D\uFF01\u6700\u540E\u8981\u505A\u7684\u662F\u5C06\u6A21\u578B\u6743\u91CD\u63A8\u9001\u5230 Hub\uFF0C\u5982\u4E0B\u6240\u793A\uFF1A"),ss=c(),$(Z.$$.fragment),W=c(),$(X.$$.fragment),ls=c(),V=n("p"),$s=t("\u8FD9\u4F1A\u5C06\u68C0\u67E5\u70B9\u548C\u914D\u7F6E\u6587\u4EF6\u4FDD\u5B58\u5230 "),js=n("strong"),ps=t("output_dir"),vs=t(" , \u5728\u5C06\u6240\u6709\u6587\u4EF6\u4E0A\u4F20\u5230\u96C6\u7EBF\u5668\u4E4B\u524D\u3002\u901A\u8FC7\u6307\u5B9A "),Y=n("strong"),cs=t("tags"),ys=t(" \u53C2\u6570\uFF0C\u6211\u4EEC\u8FD8\u786E\u4FDD\u96C6\u7EBF\u5668\u4E0A\u7684\u5C0F\u90E8\u4EF6\u5C06\u662F\u4E00\u4E2A\u7528\u4E8E\u6C47\u603B\u7BA1\u9053\u7684\u5C0F\u90E8\u4EF6\uFF0C\u800C\u4E0D\u662F\u4E0E mT5 \u67B6\u6784\u5173\u8054\u7684\u9ED8\u8BA4\u6587\u672C\u751F\u6210\u5C0F\u90E8\u4EF6\uFF08\u6709\u5173\u6A21\u578B\u6807\u7B7E\u7684\u66F4\u591A\u4FE1\u606F\uFF0C\u8BF7\u53C2\u9605"),es=n("a"),ns=t("\u{1F917} Hub \u6587\u6863"),rs=t("\uFF09\u3002\u8F93\u51FA\u6765\u81EA "),is=n("strong"),j=t("trainer.push_to_hub()"),F=t(" \u662F Git \u63D0\u4EA4\u54C8\u5E0C\u7684 URL\uFF0C\u56E0\u6B64\u60A8\u53EF\u4EE5\u8F7B\u677E\u67E5\u770B\u5BF9\u6A21\u578B\u5B58\u50A8\u5E93\u6240\u505A\u7684\u66F4\u6539\uFF01"),Ts=c(),as=n("p"),us=t("\u5728\u7ED3\u675F\u672C\u8282\u4E4B\u524D\uFF0C\u8BA9\u6211\u4EEC\u770B\u4E00\u4E0B\u5982\u4F55\u4F7F\u7528 \u{1F917} Accelerate \u63D0\u4F9B\u7684\u5E95\u5C42API\u5BF9 mT5 \u8FDB\u884C\u5FAE\u8C03\u3002"),this.h()},l(g){h=r(g,"P",{});var A=p(h);v=l(A,"\u6211\u4EEC\u7EC8\u4E8E\u62E5\u6709\u4E86\u8BAD\u7EC3\u6240\u9700\u7684\u6240\u6709\u7684\u524D\u671F\u51C6\u5907\uFF01\u6211\u4EEC\u73B0\u5728\u53EA\u9700\u8981\u4F7F\u7528\u6807\u51C6\u53C2\u6570\u5B9E\u4F8B\u5316\u8BAD\u7EC3\u5668\uFF1A"),A.forEach(a),f=u(g),k(E.$$.fragment,g),O=u(g),x=r(g,"P",{});var qs=p(x);S=l(qs,"\u5E76\u542F\u52A8\u6211\u4EEC\u7684\u8BAD\u7EC3\uFF1A"),qs.forEach(a),R=u(g),k(P.$$.fragment,g),C=u(g),N=r(g,"P",{});var hs=p(N);D=l(hs,"\u5728\u8BAD\u7EC3\u671F\u95F4\uFF0C\u60A8\u5E94\u8BE5\u4F1A\u770B\u5230\u8BAD\u7EC3\u635F\u5931\u51CF\u5C11\u5E76\u4E14 ROUGE \u5206\u6570\u968F\u7740\u6BCF\u4E2A epoch \u589E\u52A0\u3002\u8BAD\u7EC3\u5B8C\u6210\u540E\uFF0C\u60A8\u53EF\u4EE5\u901A\u8FC7\u8FD0\u884C"),I=r(hs,"STRONG",{});var Ys=p(I);U=l(Ys,"Trainer.evaluate()"),Ys.forEach(a),J=l(hs," \u67E5\u770B\u6700\u7EC8\u7684 ROUGE \u5206\u6570 \uFF1A"),hs.forEach(a),M=u(g),k(B.$$.fragment,g),H=u(g),k(Q.$$.fragment,g),z=u(g),G=r(g,"P",{});var Es=p(G);os=l(Es,"\u4ECE\u5206\u6570\u4E2D\u6211\u4EEC\u53EF\u4EE5\u770B\u5230\uFF0C\u6211\u4EEC\u7684\u6A21\u578B\u8F7B\u677E\u8D85\u8FC7\u4E86\u6211\u4EEC\u7684lead-3 baseline\u2014\u2014\u5F88\u597D\uFF01\u6700\u540E\u8981\u505A\u7684\u662F\u5C06\u6A21\u578B\u6743\u91CD\u63A8\u9001\u5230 Hub\uFF0C\u5982\u4E0B\u6240\u793A\uFF1A"),Es.forEach(a),ss=u(g),k(Z.$$.fragment,g),W=u(g),k(X.$$.fragment,g),ls=u(g),V=r(g,"P",{});var _s=p(V);$s=l(_s,"\u8FD9\u4F1A\u5C06\u68C0\u67E5\u70B9\u548C\u914D\u7F6E\u6587\u4EF6\u4FDD\u5B58\u5230 "),js=r(_s,"STRONG",{});var Cs=p(js);ps=l(Cs,"output_dir"),Cs.forEach(a),vs=l(_s," , \u5728\u5C06\u6240\u6709\u6587\u4EF6\u4E0A\u4F20\u5230\u96C6\u7EBF\u5668\u4E4B\u524D\u3002\u901A\u8FC7\u6307\u5B9A "),Y=r(_s,"STRONG",{});var Js=p(Y);cs=l(Js,"tags"),Js.forEach(a),ys=l(_s," \u53C2\u6570\uFF0C\u6211\u4EEC\u8FD8\u786E\u4FDD\u96C6\u7EBF\u5668\u4E0A\u7684\u5C0F\u90E8\u4EF6\u5C06\u662F\u4E00\u4E2A\u7528\u4E8E\u6C47\u603B\u7BA1\u9053\u7684\u5C0F\u90E8\u4EF6\uFF0C\u800C\u4E0D\u662F\u4E0E mT5 \u67B6\u6784\u5173\u8054\u7684\u9ED8\u8BA4\u6587\u672C\u751F\u6210\u5C0F\u90E8\u4EF6\uFF08\u6709\u5173\u6A21\u578B\u6807\u7B7E\u7684\u66F4\u591A\u4FE1\u606F\uFF0C\u8BF7\u53C2\u9605"),es=r(_s,"A",{href:!0,rel:!0});var fs=p(es);ns=l(fs,"\u{1F917} Hub \u6587\u6863"),fs.forEach(a),rs=l(_s,"\uFF09\u3002\u8F93\u51FA\u6765\u81EA "),is=r(_s,"STRONG",{});var Xs=p(is);j=l(Xs,"trainer.push_to_hub()"),Xs.forEach(a),F=l(_s," \u662F Git \u63D0\u4EA4\u54C8\u5E0C\u7684 URL\uFF0C\u56E0\u6B64\u60A8\u53EF\u4EE5\u8F7B\u677E\u67E5\u770B\u5BF9\u6A21\u578B\u5B58\u50A8\u5E93\u6240\u505A\u7684\u66F4\u6539\uFF01"),_s.forEach(a),Ts=u(g),as=r(g,"P",{});var Ss=p(as);us=l(Ss,"\u5728\u7ED3\u675F\u672C\u8282\u4E4B\u524D\uFF0C\u8BA9\u6211\u4EEC\u770B\u4E00\u4E0B\u5982\u4F55\u4F7F\u7528 \u{1F917} Accelerate \u63D0\u4F9B\u7684\u5E95\u5C42API\u5BF9 mT5 \u8FDB\u884C\u5FAE\u8C03\u3002"),Ss.forEach(a),this.h()},h(){b(es,"href","https://huggingface.co/docs/hub/main#how-is-a-models-type-of-inference-api-and-widget-determined"),b(es,"rel","nofollow")},m(g,A){o(g,h,A),e(h,v),o(g,f,A),w(E,g,A),o(g,O,A),o(g,x,A),e(x,S),o(g,R,A),w(P,g,A),o(g,C,A),o(g,N,A),e(N,D),e(N,I),e(I,U),e(N,J),o(g,M,A),w(B,g,A),o(g,H,A),w(Q,g,A),o(g,z,A),o(g,G,A),e(G,os),o(g,ss,A),w(Z,g,A),o(g,W,A),w(X,g,A),o(g,ls,A),o(g,V,A),e(V,$s),e(V,js),e(js,ps),e(V,vs),e(V,Y),e(Y,cs),e(V,ys),e(V,es),e(es,ns),e(V,rs),e(V,is),e(is,j),e(V,F),o(g,Ts,A),o(g,as,A),e(as,us),ms=!0},i(g){ms||(d(E.$$.fragment,g),d(P.$$.fragment,g),d(B.$$.fragment,g),d(Q.$$.fragment,g),d(Z.$$.fragment,g),d(X.$$.fragment,g),ms=!0)},o(g){_(E.$$.fragment,g),_(P.$$.fragment,g),_(B.$$.fragment,g),_(Q.$$.fragment,g),_(Z.$$.fragment,g),_(X.$$.fragment,g),ms=!1},d(g){g&&a(h),g&&a(f),y(E,g),g&&a(O),g&&a(x),g&&a(R),y(P,g),g&&a(C),g&&a(N),g&&a(M),y(B,g),g&&a(H),y(Q,g),g&&a(z),g&&a(G),g&&a(ss),y(Z,g),g&&a(W),y(X,g),g&&a(ls),g&&a(V),g&&a(Ts),g&&a(as)}}}function cd(K){let h,v,f,E,O,x,S,R,P,C,N,D,I,U,J,M,B,H,Q,z,G,os,ss,Z,W,X,ls,V,$s,js,ps,vs,Y,cs,ys,es,ns,rs,is,j,F,Ts,as,us,ms,g,A,qs,hs,Ys,Es,_s,Cs,Js,fs,Xs,Ss,ee,Us,he,Qs,Le,fe,Zs,se,de,zs,As,L,ts,we,ks,ds,Ls,ta,ae,la,na,te,xs,Ie,le,ne,_e,Os,ye,gs,Hs,ge,re,Ne,Fs,Gt,Ea,ra,At,xa,Ta,Lt,et,Ce,Ue,qa,bs,at,be,tt,oa,Sa,lt,He,pa,Ee,It,Fe,Nt,Ct,ia,Me,Ut,za,oe,nt,Be,Ms,xe,We,ma,Ke,rt,Bs,Da,Ra,Ht,Oa,Pa,Ft,je,Ga,Aa,Mt,ot,ve,pt,Ve,La,$e,Bt,Ia,Is,Te,ca,it,pe,Vl,Na;return E=new ui({}),es=new q({props:{code:'tokenized_datasets.set_format("torch")',highlighted:'tokenized_datasets.set_format(<span class="hljs-string">&quot;torch&quot;</span>)'}}),us=new q({props:{code:"model = AutoModelForSeq2SeqLM.from_pretrained(model_checkpoint)",highlighted:"model = AutoModelForSeq2SeqLM.from_pretrained(model_checkpoint)"}}),hs=new q({props:{code:`from torch.utils.data import DataLoader

batch_size = 8
train_dataloader = DataLoader(
    tokenized_datasets["train"],
    shuffle=True,
    collate_fn=data_collator,
    batch_size=batch_size,
)
eval_dataloader = DataLoader(
    tokenized_datasets["validation"], collate_fn=data_collator, batch_size=batch_size
)`,highlighted:`<span class="hljs-keyword">from</span> torch.utils.data <span class="hljs-keyword">import</span> DataLoader

batch_size = <span class="hljs-number">8</span>
train_dataloader = DataLoader(
    tokenized_datasets[<span class="hljs-string">&quot;train&quot;</span>],
    shuffle=<span class="hljs-literal">True</span>,
    collate_fn=data_collator,
    batch_size=batch_size,
)
eval_dataloader = DataLoader(
    tokenized_datasets[<span class="hljs-string">&quot;validation&quot;</span>], collate_fn=data_collator, batch_size=batch_size
)`}}),Ss=new q({props:{code:`from torch.optim import AdamW

optimizer = AdamW(model.parameters(), lr=2e-5)`,highlighted:`<span class="hljs-keyword">from</span> torch.optim <span class="hljs-keyword">import</span> AdamW

optimizer = AdamW(model.parameters(), lr=<span class="hljs-number">2e-5</span>)`}}),se=new q({props:{code:`from accelerate import Accelerator

accelerator = Accelerator()
model, optimizer, train_dataloader, eval_dataloader = accelerator.prepare(
    model, optimizer, train_dataloader, eval_dataloader
)`,highlighted:`<span class="hljs-keyword">from</span> accelerate <span class="hljs-keyword">import</span> Accelerator

accelerator = Accelerator()
model, optimizer, train_dataloader, eval_dataloader = accelerator.prepare(
    model, optimizer, train_dataloader, eval_dataloader
)`}}),zs=new Pt({props:{$$slots:{default:[Ad]},$$scope:{ctx:K}}}),Os=new q({props:{code:`from transformers import get_scheduler

num_train_epochs = 10
num_update_steps_per_epoch = len(train_dataloader)
num_training_steps = num_train_epochs * num_update_steps_per_epoch

lr_scheduler = get_scheduler(
    "linear",
    optimizer=optimizer,
    num_warmup_steps=0,
    num_training_steps=num_training_steps,
)`,highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> get_scheduler

num_train_epochs = <span class="hljs-number">10</span>
num_update_steps_per_epoch = <span class="hljs-built_in">len</span>(train_dataloader)
num_training_steps = num_train_epochs * num_update_steps_per_epoch

lr_scheduler = get_scheduler(
    <span class="hljs-string">&quot;linear&quot;</span>,
    optimizer=optimizer,
    num_warmup_steps=<span class="hljs-number">0</span>,
    num_training_steps=num_training_steps,
)`}}),re=new q({props:{code:`def postprocess_text(preds, labels):
    preds = [pred.strip() for pred in preds]
    labels = [label.strip() for label in labels]

    # ROUGE expects a newline after each sentence
    preds = ["\\n".join(nltk.sent_tokenize(pred)) for pred in preds]
    labels = ["\\n".join(nltk.sent_tokenize(label)) for label in labels]

    return preds, labels`,highlighted:`<span class="hljs-keyword">def</span> <span class="hljs-title function_">postprocess_text</span>(<span class="hljs-params">preds, labels</span>):
    preds = [pred.strip() <span class="hljs-keyword">for</span> pred <span class="hljs-keyword">in</span> preds]
    labels = [label.strip() <span class="hljs-keyword">for</span> label <span class="hljs-keyword">in</span> labels]

    <span class="hljs-comment"># ROUGE expects a newline after each sentence</span>
    preds = [<span class="hljs-string">&quot;\\n&quot;</span>.join(nltk.sent_tokenize(pred)) <span class="hljs-keyword">for</span> pred <span class="hljs-keyword">in</span> preds]
    labels = [<span class="hljs-string">&quot;\\n&quot;</span>.join(nltk.sent_tokenize(label)) <span class="hljs-keyword">for</span> label <span class="hljs-keyword">in</span> labels]

    <span class="hljs-keyword">return</span> preds, labels`}}),bs=new q({props:{code:`from huggingface_hub import get_full_repo_name

model_name = "test-bert-finetuned-squad-accelerate"
repo_name = get_full_repo_name(model_name)
repo_name`,highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> get_full_repo_name

model_name = <span class="hljs-string">&quot;test-bert-finetuned-squad-accelerate&quot;</span>
repo_name = get_full_repo_name(model_name)
repo_name`}}),be=new q({props:{code:"'lewtun/mt5-finetuned-amazon-en-es-accelerate'",highlighted:'<span class="hljs-string">&#x27;lewtun/mt5-finetuned-amazon-en-es-accelerate&#x27;</span>'}}),He=new q({props:{code:`from huggingface_hub import Repository

output_dir = "results-mt5-finetuned-squad-accelerate"
repo = Repository(output_dir, clone_from=repo_name)`,highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> Repository

output_dir = <span class="hljs-string">&quot;results-mt5-finetuned-squad-accelerate&quot;</span>
repo = Repository(output_dir, clone_from=repo_name)`}}),Is=new q({props:{code:`from tqdm.auto import tqdm
import torch
import numpy as np

progress_bar = tqdm(range(num_training_steps))

for epoch in range(num_train_epochs):
    # Training
    model.train()
    for step, batch in enumerate(train_dataloader):
        outputs = model(**batch)
        loss = outputs.loss
        accelerator.backward(loss)

        optimizer.step()
        lr_scheduler.step()
        optimizer.zero_grad()
        progress_bar.update(1)

    # Evaluation
    model.eval()
    for step, batch in enumerate(eval_dataloader):
        with torch.no_grad():
            generated_tokens = accelerator.unwrap_model(model).generate(
                batch["input_ids"],
                attention_mask=batch["attention_mask"],
            )

            generated_tokens = accelerator.pad_across_processes(
                generated_tokens, dim=1, pad_index=tokenizer.pad_token_id
            )
            labels = batch["labels"]

            # If we did not pad to max length, we need to pad the labels too
            labels = accelerator.pad_across_processes(
                batch["labels"], dim=1, pad_index=tokenizer.pad_token_id
            )

            generated_tokens = accelerator.gather(generated_tokens).cpu().numpy()
            labels = accelerator.gather(labels).cpu().numpy()

            # Replace -100 in the labels as we can't decode them
            labels = np.where(labels != -100, labels, tokenizer.pad_token_id)
            if isinstance(generated_tokens, tuple):
                generated_tokens = generated_tokens[0]
            decoded_preds = tokenizer.batch_decode(
                generated_tokens, skip_special_tokens=True
            )
            decoded_labels = tokenizer.batch_decode(labels, skip_special_tokens=True)

            decoded_preds, decoded_labels = postprocess_text(
                decoded_preds, decoded_labels
            )

            rouge_score.add_batch(predictions=decoded_preds, references=decoded_labels)

    # Compute metrics
    result = rouge_score.compute()
    # Extract the median ROUGE scores
    result = {key: value.mid.fmeasure * 100 for key, value in result.items()}
    result = {k: round(v, 4) for k, v in result.items()}
    print(f"Epoch {epoch}:", result)

    # Save and upload
    accelerator.wait_for_everyone()
    unwrapped_model = accelerator.unwrap_model(model)
    unwrapped_model.save_pretrained(output_dir, save_function=accelerator.save)
    if accelerator.is_main_process:
        tokenizer.save_pretrained(output_dir)
        repo.push_to_hub(
            commit_message=f"Training in progress epoch {epoch}", blocking=False
        )`,highlighted:`<span class="hljs-keyword">from</span> tqdm.auto <span class="hljs-keyword">import</span> tqdm
<span class="hljs-keyword">import</span> torch
<span class="hljs-keyword">import</span> numpy <span class="hljs-keyword">as</span> np

progress_bar = tqdm(<span class="hljs-built_in">range</span>(num_training_steps))

<span class="hljs-keyword">for</span> epoch <span class="hljs-keyword">in</span> <span class="hljs-built_in">range</span>(num_train_epochs):
    <span class="hljs-comment"># Training</span>
    model.train()
    <span class="hljs-keyword">for</span> step, batch <span class="hljs-keyword">in</span> <span class="hljs-built_in">enumerate</span>(train_dataloader):
        outputs = model(**batch)
        loss = outputs.loss
        accelerator.backward(loss)

        optimizer.step()
        lr_scheduler.step()
        optimizer.zero_grad()
        progress_bar.update(<span class="hljs-number">1</span>)

    <span class="hljs-comment"># Evaluation</span>
    model.<span class="hljs-built_in">eval</span>()
    <span class="hljs-keyword">for</span> step, batch <span class="hljs-keyword">in</span> <span class="hljs-built_in">enumerate</span>(eval_dataloader):
        <span class="hljs-keyword">with</span> torch.no_grad():
            generated_tokens = accelerator.unwrap_model(model).generate(
                batch[<span class="hljs-string">&quot;input_ids&quot;</span>],
                attention_mask=batch[<span class="hljs-string">&quot;attention_mask&quot;</span>],
            )

            generated_tokens = accelerator.pad_across_processes(
                generated_tokens, dim=<span class="hljs-number">1</span>, pad_index=tokenizer.pad_token_id
            )
            labels = batch[<span class="hljs-string">&quot;labels&quot;</span>]

            <span class="hljs-comment"># If we did not pad to max length, we need to pad the labels too</span>
            labels = accelerator.pad_across_processes(
                batch[<span class="hljs-string">&quot;labels&quot;</span>], dim=<span class="hljs-number">1</span>, pad_index=tokenizer.pad_token_id
            )

            generated_tokens = accelerator.gather(generated_tokens).cpu().numpy()
            labels = accelerator.gather(labels).cpu().numpy()

            <span class="hljs-comment"># Replace -100 in the labels as we can&#x27;t decode them</span>
            labels = np.where(labels != -<span class="hljs-number">100</span>, labels, tokenizer.pad_token_id)
            <span class="hljs-keyword">if</span> <span class="hljs-built_in">isinstance</span>(generated_tokens, <span class="hljs-built_in">tuple</span>):
                generated_tokens = generated_tokens[<span class="hljs-number">0</span>]
            decoded_preds = tokenizer.batch_decode(
                generated_tokens, skip_special_tokens=<span class="hljs-literal">True</span>
            )
            decoded_labels = tokenizer.batch_decode(labels, skip_special_tokens=<span class="hljs-literal">True</span>)

            decoded_preds, decoded_labels = postprocess_text(
                decoded_preds, decoded_labels
            )

            rouge_score.add_batch(predictions=decoded_preds, references=decoded_labels)

    <span class="hljs-comment"># Compute metrics</span>
    result = rouge_score.compute()
    <span class="hljs-comment"># Extract the median ROUGE scores</span>
    result = {key: value.mid.fmeasure * <span class="hljs-number">100</span> <span class="hljs-keyword">for</span> key, value <span class="hljs-keyword">in</span> result.items()}
    result = {k: <span class="hljs-built_in">round</span>(v, <span class="hljs-number">4</span>) <span class="hljs-keyword">for</span> k, v <span class="hljs-keyword">in</span> result.items()}
    <span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;Epoch <span class="hljs-subst">{epoch}</span>:&quot;</span>, result)

    <span class="hljs-comment"># Save and upload</span>
    accelerator.wait_for_everyone()
    unwrapped_model = accelerator.unwrap_model(model)
    unwrapped_model.save_pretrained(output_dir, save_function=accelerator.save)
    <span class="hljs-keyword">if</span> accelerator.is_main_process:
        tokenizer.save_pretrained(output_dir)
        repo.push_to_hub(
            commit_message=<span class="hljs-string">f&quot;Training in progress epoch <span class="hljs-subst">{epoch}</span>&quot;</span>, blocking=<span class="hljs-literal">False</span>
        )`}}),ca=new q({props:{code:`Epoch 0: {'rouge1': 5.6351, 'rouge2': 1.1625, 'rougeL': 5.4866, 'rougeLsum': 5.5005}
Epoch 1: {'rouge1': 9.8646, 'rouge2': 3.4106, 'rougeL': 9.9439, 'rougeLsum': 9.9306}
Epoch 2: {'rouge1': 11.0872, 'rouge2': 3.3273, 'rougeL': 11.0508, 'rougeLsum': 10.9468}
Epoch 3: {'rouge1': 11.8587, 'rouge2': 4.8167, 'rougeL': 11.7986, 'rougeLsum': 11.7518}
Epoch 4: {'rouge1': 12.9842, 'rouge2': 5.5887, 'rougeL': 12.7546, 'rougeLsum': 12.7029}
Epoch 5: {'rouge1': 13.4628, 'rouge2': 6.4598, 'rougeL': 13.312, 'rougeLsum': 13.2913}
Epoch 6: {'rouge1': 12.9131, 'rouge2': 5.8914, 'rougeL': 12.6896, 'rougeLsum': 12.5701}
Epoch 7: {'rouge1': 13.3079, 'rouge2': 6.2994, 'rougeL': 13.1536, 'rougeLsum': 13.1194}
Epoch 8: {'rouge1': 13.96, 'rouge2': 6.5998, 'rougeL': 13.9123, 'rougeLsum': 13.7744}
Epoch 9: {'rouge1': 14.1192, 'rouge2': 7.0059, 'rougeL': 14.1172, 'rougeLsum': 13.9509}`,highlighted:`Epoch <span class="hljs-number">0</span>: {<span class="hljs-string">&#x27;rouge1&#x27;</span>: <span class="hljs-number">5.6351</span>, <span class="hljs-string">&#x27;rouge2&#x27;</span>: <span class="hljs-number">1.1625</span>, <span class="hljs-string">&#x27;rougeL&#x27;</span>: <span class="hljs-number">5.4866</span>, <span class="hljs-string">&#x27;rougeLsum&#x27;</span>: <span class="hljs-number">5.5005</span>}
Epoch <span class="hljs-number">1</span>: {<span class="hljs-string">&#x27;rouge1&#x27;</span>: <span class="hljs-number">9.8646</span>, <span class="hljs-string">&#x27;rouge2&#x27;</span>: <span class="hljs-number">3.4106</span>, <span class="hljs-string">&#x27;rougeL&#x27;</span>: <span class="hljs-number">9.9439</span>, <span class="hljs-string">&#x27;rougeLsum&#x27;</span>: <span class="hljs-number">9.9306</span>}
Epoch <span class="hljs-number">2</span>: {<span class="hljs-string">&#x27;rouge1&#x27;</span>: <span class="hljs-number">11.0872</span>, <span class="hljs-string">&#x27;rouge2&#x27;</span>: <span class="hljs-number">3.3273</span>, <span class="hljs-string">&#x27;rougeL&#x27;</span>: <span class="hljs-number">11.0508</span>, <span class="hljs-string">&#x27;rougeLsum&#x27;</span>: <span class="hljs-number">10.9468</span>}
Epoch <span class="hljs-number">3</span>: {<span class="hljs-string">&#x27;rouge1&#x27;</span>: <span class="hljs-number">11.8587</span>, <span class="hljs-string">&#x27;rouge2&#x27;</span>: <span class="hljs-number">4.8167</span>, <span class="hljs-string">&#x27;rougeL&#x27;</span>: <span class="hljs-number">11.7986</span>, <span class="hljs-string">&#x27;rougeLsum&#x27;</span>: <span class="hljs-number">11.7518</span>}
Epoch <span class="hljs-number">4</span>: {<span class="hljs-string">&#x27;rouge1&#x27;</span>: <span class="hljs-number">12.9842</span>, <span class="hljs-string">&#x27;rouge2&#x27;</span>: <span class="hljs-number">5.5887</span>, <span class="hljs-string">&#x27;rougeL&#x27;</span>: <span class="hljs-number">12.7546</span>, <span class="hljs-string">&#x27;rougeLsum&#x27;</span>: <span class="hljs-number">12.7029</span>}
Epoch <span class="hljs-number">5</span>: {<span class="hljs-string">&#x27;rouge1&#x27;</span>: <span class="hljs-number">13.4628</span>, <span class="hljs-string">&#x27;rouge2&#x27;</span>: <span class="hljs-number">6.4598</span>, <span class="hljs-string">&#x27;rougeL&#x27;</span>: <span class="hljs-number">13.312</span>, <span class="hljs-string">&#x27;rougeLsum&#x27;</span>: <span class="hljs-number">13.2913</span>}
Epoch <span class="hljs-number">6</span>: {<span class="hljs-string">&#x27;rouge1&#x27;</span>: <span class="hljs-number">12.9131</span>, <span class="hljs-string">&#x27;rouge2&#x27;</span>: <span class="hljs-number">5.8914</span>, <span class="hljs-string">&#x27;rougeL&#x27;</span>: <span class="hljs-number">12.6896</span>, <span class="hljs-string">&#x27;rougeLsum&#x27;</span>: <span class="hljs-number">12.5701</span>}
Epoch <span class="hljs-number">7</span>: {<span class="hljs-string">&#x27;rouge1&#x27;</span>: <span class="hljs-number">13.3079</span>, <span class="hljs-string">&#x27;rouge2&#x27;</span>: <span class="hljs-number">6.2994</span>, <span class="hljs-string">&#x27;rougeL&#x27;</span>: <span class="hljs-number">13.1536</span>, <span class="hljs-string">&#x27;rougeLsum&#x27;</span>: <span class="hljs-number">13.1194</span>}
Epoch <span class="hljs-number">8</span>: {<span class="hljs-string">&#x27;rouge1&#x27;</span>: <span class="hljs-number">13.96</span>, <span class="hljs-string">&#x27;rouge2&#x27;</span>: <span class="hljs-number">6.5998</span>, <span class="hljs-string">&#x27;rougeL&#x27;</span>: <span class="hljs-number">13.9123</span>, <span class="hljs-string">&#x27;rougeLsum&#x27;</span>: <span class="hljs-number">13.7744</span>}
Epoch <span class="hljs-number">9</span>: {<span class="hljs-string">&#x27;rouge1&#x27;</span>: <span class="hljs-number">14.1192</span>, <span class="hljs-string">&#x27;rouge2&#x27;</span>: <span class="hljs-number">7.0059</span>, <span class="hljs-string">&#x27;rougeL&#x27;</span>: <span class="hljs-number">14.1172</span>, <span class="hljs-string">&#x27;rougeLsum&#x27;</span>: <span class="hljs-number">13.9509</span>}`}}),{c(){h=n("h2"),v=n("a"),f=n("span"),$(E.$$.fragment),O=c(),x=n("span"),S=t("\u4F7F\u7528 \u{1F917} Accelerate \u5FAE\u8C03 mT5"),R=c(),P=n("p"),C=t("\u4F7F\u7528 \u{1F917} Accelerate \u5FAE\u8C03\u6211\u4EEC\u7684\u6A21\u578B\u4E0E\u6211\u4EEC\u5728 "),N=n("a"),D=t("Chapter 3"),I=t(" \u4E2D\u9047\u5230\u7684\u6587\u672C\u5206\u7C7B\u793A\u4F8B\u975E\u5E38\u76F8\u4F3C\u3002 \u4E3B\u8981\u533A\u522B\u5728\u4E8E\u9700\u8981\u5728\u8BAD\u7EC3\u671F\u95F4\u663E\u5F0F\u751F\u6210\u6458\u8981\u5E76\u5B9A\u4E49\u6211\u4EEC\u5982\u4F55\u8BA1\u7B97 ROUGE \u5206\u6570\uFF08\u56DE\u60F3\u4E00\u4E0B\uFF0C"),U=n("code"),J=t("Seq2SeqTrainer"),M=t(" \u4E3A\u6211\u4EEC\u751F\u6210\u4E86\u6458\u8981\uFF09\u3002 \u8BA9\u6211\u4EEC\u770B\u770B\u6211\u4EEC\u5982\u4F55\u5728 \u{1F917} Accelerate \u4E2D\u5B9E\u73B0\u8FD9\u4E24\u4E2A\u8981\u6C42\uFF01"),B=c(),H=n("h3"),Q=t("\u4E3A\u8BAD\u7EC3\u505A\u597D\u4E00\u5207\u51C6\u5907"),z=c(),G=n("p"),os=t("The first thing we need to do is create a "),ss=n("code"),Z=t("DataLoader"),W=t(" for each of our splits. Since the PyTorch dataloaders expect batches of tensors, we need to set the format to "),X=n("code"),ls=t('"torch"'),V=t(` in our datasets:
\u6211\u4EEC\u9700\u8981\u505A\u7684\u7B2C\u4E00\u4EF6\u4E8B\u662F\u4E3A\u6BCF\u4E2A\u6570\u636E\u96C6\u7684\u6BCF\u4E00\u4E2A\u62C6\u5206\u521B\u5EFA\u4E00\u4E2A`),$s=n("code"),js=t("DataLoader"),ps=t("\u3002 \u7531\u4E8E PyTorch \u6570\u636E\u52A0\u8F7D\u5668\u9700\u8981\u6210\u6279\u7684\u5F20\u91CF\uFF0C\u6211\u4EEC\u9700\u8981\u5728\u6570\u636E\u96C6\u4E2D\u5C06\u683C\u5F0F\u8BBE\u7F6E\u4E3A"),vs=n("code"),Y=t("torch"),cs=t("\uFF1A"),ys=c(),$(es.$$.fragment),ns=c(),rs=n("p"),is=t("\u73B0\u5728\u6211\u4EEC\u5DF2\u7ECF\u6709\u4E86\u4EC5\u7531\u5F20\u91CF\u7EC4\u6210\u7684\u6570\u636E\u96C6\uFF0C\u63A5\u4E0B\u6765\u8981\u505A\u7684\u662F\u518D\u6B21\u5B9E\u4F8B\u5316"),j=n("code"),F=t("DataCollatorForSeq2Seq"),Ts=t("\u3002 \u4E3A\u6B64\uFF0C\u6211\u4EEC\u9700\u8981\u63D0\u4F9B\u6A21\u578B\u5FAE\u8C03\u524D\u7684\u7248\u672C\uFF0C\u6240\u4EE5\u8BA9\u6211\u4EEC\u4ECE\u7F13\u5B58\u4E2D\u518D\u6B21\u52A0\u8F7D\u5B83\uFF1A"),as=c(),$(us.$$.fragment),ms=c(),g=n("p"),A=t("\u7136\u540E\u6211\u4EEC\u53EF\u4EE5\u5B9E\u4F8B\u5316\u6570\u636E\u6574\u7406\u5668\u5E76\u4F7F\u7528\u5B83\u6765\u5B9A\u4E49\u6211\u4EEC\u7684\u6570\u636E\u52A0\u8F7D\u5668\uFF1A"),qs=c(),$(hs.$$.fragment),Ys=c(),Es=n("p"),_s=t("\u63A5\u4E0B\u6765\u8981\u505A\u7684\u662F\u5B9A\u4E49\u6211\u4EEC\u60F3\u8981\u4F7F\u7528\u7684\u4F18\u5316\u5668\u3002\u4E0E\u6211\u4EEC\u7684\u5176\u4ED6\u793A\u4F8B\u4E00\u6837\uFF0C\u6211\u4EEC\u5C06\u4F7F\u7528 "),Cs=n("strong"),Js=t("AdamW"),fs=t(" \uFF0C\u8FD9\u9002\u7528\u4E8E\u5927\u591A\u6570\u95EE\u9898\uFF1A"),Xs=c(),$(Ss.$$.fragment),ee=c(),Us=n("p"),he=t("\u6700\u540E\uFF0C\u6211\u4EEC\u5C06\u6A21\u578B\u3001\u4F18\u5316\u5668\u548C\u6570\u636E\u52A0\u8F7D\u5668\u63D0\u4F9B\u7ED9 "),Qs=n("strong"),Le=t("accelerator.prepare()"),fe=t(" \u65B9\u6CD5\uFF1A"),Zs=c(),$(se.$$.fragment),de=c(),$(zs.$$.fragment),As=c(),L=n("p"),ts=t("\u73B0\u5728\u6211\u4EEC\u5DF2\u7ECF\u51C6\u5907\u597D\u4E86\u6211\u4EEC\u7D22\u8981\u7528\u7684\u5BF9\u8C61\uFF0C\u8FD8\u6709\u4E09\u4EF6\u4E8B\u8981\u505A\uFF1A"),we=c(),ks=n("ul"),ds=n("li"),Ls=t("\u5B9A\u4E49\u5B66\u4E60\u7387\u8C03\u5EA6\u8BA1\u5212\u3002"),ta=c(),ae=n("li"),la=t("\u5B9E\u73B0\u4E00\u4E2A\u529F\u80FD\u6765\u5BF9\u6458\u8981\u8FDB\u884C\u540E\u7EED\u5904\u7406\u4EE5\u8FDB\u884C\u8BC4\u4F30\u3002"),na=c(),te=n("li"),xs=t("\u5728 Hub \u4E0A\u521B\u5EFA\u4E00\u4E2A\u5B58\u50A8\u5E93\uFF0C\u6211\u4EEC\u53EF\u4EE5\u5C06\u6A21\u578B\u63A8\u9001\u5230\u8BE5\u5B58\u50A8\u5E93\u3002"),Ie=c(),le=n("p"),ne=t("\u5BF9\u4E8E\u5B66\u4E60\u7387\u8C03\u5EA6\uFF0C\u6211\u4EEC\u5C06\u4F7F\u7528\u524D\u51E0\u8282\u4E2D\u7684\u6807\u51C6\u7EBF\u6027\u8870\u51CF\uFF1A"),_e=c(),$(Os.$$.fragment),ye=c(),gs=n("p"),Hs=t("\u5BF9\u4E8E\u540E\u7EED\u5904\u7406\uFF0C\u6211\u4EEC\u9700\u8981\u4E00\u4E2A\u51FD\u6570\uFF0C\u5C06\u751F\u6210\u7684\u6458\u8981\u62C6\u5206\u4E3A\u7531\u6362\u884C\u7B26\u5206\u9694\u7684\u53E5\u5B50\u3002 \u8FD9\u662F ROUGE \u6307\u6807\u6240\u671F\u671B\u7684\u683C\u5F0F\uFF0C\u6211\u4EEC\u53EF\u4EE5\u4F7F\u7528\u4EE5\u4E0B\u4EE3\u7801\u7247\u6BB5\u6765\u5B9E\u73B0\uFF1A"),ge=c(),$(re.$$.fragment),Ne=c(),Fs=n("p"),Gt=t("\u5982\u679C\u4F60\u8FD8\u8BB0\u5F97\u6211\u4EEC\u662F\u5982\u4F55\u5B9A\u4E49 "),Ea=n("code"),ra=t("Seq2SeqTrainer"),At=t(" \u7684 "),xa=n("code"),Ta=t("compute_metrics()"),Lt=t(" \u51FD\u6570\u7684\uFF0C\u8FD9\u5BF9\u4F60\u6765\u8BF4\u5E94\u8BE5\u5F88\u719F\u6089\u3002"),et=c(),Ce=n("p"),Ue=t("\u6700\u540E\uFF0C\u6211\u4EEC\u9700\u8981\u5728 Hugging Face Hub \u4E0A\u521B\u5EFA\u4E00\u4E2A\u6A21\u578B\u5B58\u50A8\u5E93\u3002 \u4E3A\u6B64\uFF0C\u6211\u4EEC\u53EF\u4EE5\u4F7F\u7528\u{1F917} Hub \u5E93\u7684get_full_repo_name\u3002 \u6211\u4EEC\u53EA\u9700\u8981\u4E3A\u6211\u4EEC\u7684\u5B58\u50A8\u5E93\u5B9A\u4E49\u4E00\u4E2A\u540D\u79F0\uFF0C\u8BE5\u5E93\u6709\u4E00\u4E2A\u975E\u5E38\u597D\u7528\u7684\u51FD\u6570\u53EF\u4EE5\u5C06\u5B58\u50A8\u5E93 ID \u4E0E\u7528\u6237\u914D\u7F6E\u6587\u4EF6\u7ED3\u5408\u8D77\u6765\uFF1A"),qa=c(),$(bs.$$.fragment),at=c(),$(be.$$.fragment),tt=c(),oa=n("p"),Sa=t("\u73B0\u5728\u6211\u4EEC\u53EF\u4EE5\u4F7F\u7528\u8FD9\u4E2A\u5B58\u50A8\u5E93\u540D\u79F0\u5C06\u672C\u5730\u7248\u672C\u514B\u9686\u5230\u6211\u4EEC\u7684\u7ED3\u679C\u76EE\u5F55\u4E2D\uFF0C\u8BE5\u76EE\u5F55\u5C06\u5B58\u50A8\u8BAD\u7EC3\u7684\u6A21\u578B\uFF1A"),lt=c(),$(He.$$.fragment),pa=c(),Ee=n("p"),It=t("\u8FD9\u5C06\u5141\u8BB8\u6211\u4EEC\u5728\u8BAD\u7EC3\u671F\u95F4\u901A\u8FC7\u8C03\u7528 "),Fe=n("code"),Nt=t("repo.push_to_hub()"),Ct=t(" \u65B9\u6CD5\u5C06\u6A21\u578B\u63A8\u9001\u5230 Hub\uFF01 \u73B0\u5728\u8BA9\u6211\u4EEC\u901A\u8FC7\u5199\u51FA\u5B8C\u6574\u7684\u8BAD\u7EC3\u5FAA\u73AF\u6765\u7ED3\u675F\u6211\u4EEC\u7684\u5206\u6790\u3002"),ia=c(),Me=n("h3"),Ut=t("\u8BAD\u7EC3\u5FAA\u73AF"),za=c(),oe=n("p"),nt=t("\u6587\u672C\u6458\u8981\u7684\u8BAD\u7EC3\u5FAA\u73AF\u4E0E\u6211\u4EEC\u9047\u5230\u7684\u5176\u4ED6 \u{1F917} Accelerate \u793A\u4F8B\u975E\u5E38\u76F8\u4F3C\uFF0C\u5927\u81F4\u5206\u4E3A\u56DB\u4E2A\u4E3B\u8981\u6B65\u9AA4\uFF1A\u8FD9"),Be=c(),Ms=n("ol"),xe=n("li"),We=t("\u901A\u8FC7\u5728\u6BCF\u4E2Aepoch \u8FED\u4EE3 "),ma=n("code"),Ke=t("train_dataloader"),rt=t(" \u4E2D\u7684\u6240\u6709\u793A\u4F8B\u6765\u8BAD\u7EC3\u6A21\u578B\u3002"),Bs=c(),Da=n("li"),Ra=t("\u5728\u6BCF\u4E2A epoch \u7ED3\u675F\u65F6\u751F\u6210\u6A21\u578B\u6458\u8981\uFF0C\u9996\u5148\u751F\u6210\u6807\u8BB0\uFF0C\u7136\u540E\u5C06\u5B83\u4EEC\uFF08\u548C\u53C2\u8003\u6458\u8981\uFF09\u89E3\u7801\u4E3A\u6587\u672C\u3002"),Ht=c(),Oa=n("li"),Pa=t("\u4F7F\u7528\u6211\u4EEC\u4E4B\u524D\u770B\u5230\u7684\u76F8\u540C\u6280\u672F\u8BA1\u7B97 ROUGE \u5206\u6570\u3002"),Ft=c(),je=n("li"),Ga=t("\u4FDD\u5B58\u68C0\u67E5\u70B9\u5E76\u5C06\u6240\u6709\u5185\u5BB9\u63A8\u9001\u5230 Hub\u3002 \u5728\u8FD9\u91CC\uFF0C\u6211\u4EEC\u4F9D\u8D56 "),Aa=n("code"),Mt=t("Repository"),ot=t(" \u5BF9\u8C61\u7684\u5DE7\u5999\u7684 "),ve=n("code"),pt=t("blocking=False"),Ve=t(" \u53C2\u6570\uFF0C\u4EE5\u4FBF\u6211\u4EEC\u53EF\u4EE5\u5728\u6BCF\u4E2A epoch \u5F02\u6B65\u5730\u4E0A\u4F20\u68C0\u67E5\u70B9\u3002 \u8FD9\u4F7F\u6211\u4EEC\u80FD\u591F\u7EE7\u7EED\u8BAD\u7EC3\uFF0C\u800C\u4E0D\u5FC5\u7B49\u5F85\u4E0E GB \u5927\u5C0F\u7684\u6A21\u578B\u6162\u547C\u547C\u7684\u4E0A\u4F20\uFF01"),La=c(),$e=n("p"),Bt=t("\u8FD9\u4E9B\u6B65\u9AA4\u53EF\u4EE5\u5728\u4EE5\u4E0B\u4EE3\u7801\u5757\u4E2D\u770B\u5230\uFF1A"),Ia=c(),$(Is.$$.fragment),Te=c(),$(ca.$$.fragment),it=c(),pe=n("p"),Vl=t("\u5C31\u662F\u8FD9\u6837\uFF01 \u8FD0\u884C\u6B64\u7A0B\u5E8F\u540E\uFF0C\u60A8\u5C06\u83B7\u5F97\u4E0E\u6211\u4EEC\u4F7F\u7528\u201CTrainer\u201D\u83B7\u5F97\u7684\u6A21\u578B\u548C\u7ED3\u679C\u975E\u5E38\u76F8\u4F3C\u7684\u6A21\u578B\u548C\u7ED3\u679C\u3002"),this.h()},l(m){h=r(m,"H2",{class:!0});var T=p(h);v=r(T,"A",{id:!0,class:!0,href:!0});var mt=p(v);f=r(mt,"SPAN",{});var Yl=p(f);k(E.$$.fragment,Yl),Yl.forEach(a),mt.forEach(a),O=u(T),x=r(T,"SPAN",{});var Jl=p(x);S=l(Jl,"\u4F7F\u7528 \u{1F917} Accelerate \u5FAE\u8C03 mT5"),Jl.forEach(a),T.forEach(a),R=u(m),P=r(m,"P",{});var Ye=p(P);C=l(Ye,"\u4F7F\u7528 \u{1F917} Accelerate \u5FAE\u8C03\u6211\u4EEC\u7684\u6A21\u578B\u4E0E\u6211\u4EEC\u5728 "),N=r(Ye,"A",{href:!0});var ua=p(N);D=l(ua,"Chapter 3"),ua.forEach(a),I=l(Ye," \u4E2D\u9047\u5230\u7684\u6587\u672C\u5206\u7C7B\u793A\u4F8B\u975E\u5E38\u76F8\u4F3C\u3002 \u4E3B\u8981\u533A\u522B\u5728\u4E8E\u9700\u8981\u5728\u8BAD\u7EC3\u671F\u95F4\u663E\u5F0F\u751F\u6210\u6458\u8981\u5E76\u5B9A\u4E49\u6211\u4EEC\u5982\u4F55\u8BA1\u7B97 ROUGE \u5206\u6570\uFF08\u56DE\u60F3\u4E00\u4E0B\uFF0C"),U=r(Ye,"CODE",{});var Wt=p(U);J=l(Wt,"Seq2SeqTrainer"),Wt.forEach(a),M=l(Ye," \u4E3A\u6211\u4EEC\u751F\u6210\u4E86\u6458\u8981\uFF09\u3002 \u8BA9\u6211\u4EEC\u770B\u770B\u6211\u4EEC\u5982\u4F55\u5728 \u{1F917} Accelerate \u4E2D\u5B9E\u73B0\u8FD9\u4E24\u4E2A\u8981\u6C42\uFF01"),Ye.forEach(a),B=u(m),H=r(m,"H3",{id:!0});var Ca=p(H);Q=l(Ca,"\u4E3A\u8BAD\u7EC3\u505A\u597D\u4E00\u5207\u51C6\u5907"),Ca.forEach(a),z=u(m),G=r(m,"P",{});var ie=p(G);os=l(ie,"The first thing we need to do is create a "),ss=r(ie,"CODE",{});var Kt=p(ss);Z=l(Kt,"DataLoader"),Kt.forEach(a),W=l(ie," for each of our splits. Since the PyTorch dataloaders expect batches of tensors, we need to set the format to "),X=r(ie,"CODE",{});var ha=p(X);ls=l(ha,'"torch"'),ha.forEach(a),V=l(ie,` in our datasets:
\u6211\u4EEC\u9700\u8981\u505A\u7684\u7B2C\u4E00\u4EF6\u4E8B\u662F\u4E3A\u6BCF\u4E2A\u6570\u636E\u96C6\u7684\u6BCF\u4E00\u4E2A\u62C6\u5206\u521B\u5EFA\u4E00\u4E2A`),$s=r(ie,"CODE",{});var Xl=p($s);js=l(Xl,"DataLoader"),Xl.forEach(a),ps=l(ie,"\u3002 \u7531\u4E8E PyTorch \u6570\u636E\u52A0\u8F7D\u5668\u9700\u8981\u6210\u6279\u7684\u5F20\u91CF\uFF0C\u6211\u4EEC\u9700\u8981\u5728\u6570\u636E\u96C6\u4E2D\u5C06\u683C\u5F0F\u8BBE\u7F6E\u4E3A"),vs=r(ie,"CODE",{});var Vt=p(vs);Y=l(Vt,"torch"),Vt.forEach(a),cs=l(ie,"\uFF1A"),ie.forEach(a),ys=u(m),k(es.$$.fragment,m),ns=u(m),rs=r(m,"P",{});var ke=p(rs);is=l(ke,"\u73B0\u5728\u6211\u4EEC\u5DF2\u7ECF\u6709\u4E86\u4EC5\u7531\u5F20\u91CF\u7EC4\u6210\u7684\u6570\u636E\u96C6\uFF0C\u63A5\u4E0B\u6765\u8981\u505A\u7684\u662F\u518D\u6B21\u5B9E\u4F8B\u5316"),j=r(ke,"CODE",{});var Ql=p(j);F=l(Ql,"DataCollatorForSeq2Seq"),Ql.forEach(a),Ts=l(ke,"\u3002 \u4E3A\u6B64\uFF0C\u6211\u4EEC\u9700\u8981\u63D0\u4F9B\u6A21\u578B\u5FAE\u8C03\u524D\u7684\u7248\u672C\uFF0C\u6240\u4EE5\u8BA9\u6211\u4EEC\u4ECE\u7F13\u5B58\u4E2D\u518D\u6B21\u52A0\u8F7D\u5B83\uFF1A"),ke.forEach(a),as=u(m),k(us.$$.fragment,m),ms=u(m),g=r(m,"P",{});var Ua=p(g);A=l(Ua,"\u7136\u540E\u6211\u4EEC\u53EF\u4EE5\u5B9E\u4F8B\u5316\u6570\u636E\u6574\u7406\u5668\u5E76\u4F7F\u7528\u5B83\u6765\u5B9A\u4E49\u6211\u4EEC\u7684\u6570\u636E\u52A0\u8F7D\u5668\uFF1A"),Ua.forEach(a),qs=u(m),k(hs.$$.fragment,m),Ys=u(m),Es=r(m,"P",{});var ct=p(Es);_s=l(ct,"\u63A5\u4E0B\u6765\u8981\u505A\u7684\u662F\u5B9A\u4E49\u6211\u4EEC\u60F3\u8981\u4F7F\u7528\u7684\u4F18\u5316\u5668\u3002\u4E0E\u6211\u4EEC\u7684\u5176\u4ED6\u793A\u4F8B\u4E00\u6837\uFF0C\u6211\u4EEC\u5C06\u4F7F\u7528 "),Cs=r(ct,"STRONG",{});var Zl=p(Cs);Js=l(Zl,"AdamW"),Zl.forEach(a),fs=l(ct," \uFF0C\u8FD9\u9002\u7528\u4E8E\u5927\u591A\u6570\u95EE\u9898\uFF1A"),ct.forEach(a),Xs=u(m),k(Ss.$$.fragment,m),ee=u(m),Us=r(m,"P",{});var Ha=p(Us);he=l(Ha,"\u6700\u540E\uFF0C\u6211\u4EEC\u5C06\u6A21\u578B\u3001\u4F18\u5316\u5668\u548C\u6570\u636E\u52A0\u8F7D\u5668\u63D0\u4F9B\u7ED9 "),Qs=r(Ha,"STRONG",{});var Je=p(Qs);Le=l(Je,"accelerator.prepare()"),Je.forEach(a),fe=l(Ha," \u65B9\u6CD5\uFF1A"),Ha.forEach(a),Zs=u(m),k(se.$$.fragment,m),de=u(m),k(zs.$$.fragment,m),As=u(m),L=r(m,"P",{});var ut=p(L);ts=l(ut,"\u73B0\u5728\u6211\u4EEC\u5DF2\u7ECF\u51C6\u5907\u597D\u4E86\u6211\u4EEC\u7D22\u8981\u7528\u7684\u5BF9\u8C61\uFF0C\u8FD8\u6709\u4E09\u4EF6\u4E8B\u8981\u505A\uFF1A"),ut.forEach(a),we=u(m),ks=r(m,"UL",{});var Ws=p(ks);ds=r(Ws,"LI",{});var Fa=p(ds);Ls=l(Fa,"\u5B9A\u4E49\u5B66\u4E60\u7387\u8C03\u5EA6\u8BA1\u5212\u3002"),Fa.forEach(a),ta=u(Ws),ae=r(Ws,"LI",{});var sn=p(ae);la=l(sn,"\u5B9E\u73B0\u4E00\u4E2A\u529F\u80FD\u6765\u5BF9\u6458\u8981\u8FDB\u884C\u540E\u7EED\u5904\u7406\u4EE5\u8FDB\u884C\u8BC4\u4F30\u3002"),sn.forEach(a),na=u(Ws),te=r(Ws,"LI",{});var en=p(te);xs=l(en,"\u5728 Hub \u4E0A\u521B\u5EFA\u4E00\u4E2A\u5B58\u50A8\u5E93\uFF0C\u6211\u4EEC\u53EF\u4EE5\u5C06\u6A21\u578B\u63A8\u9001\u5230\u8BE5\u5B58\u50A8\u5E93\u3002"),en.forEach(a),Ws.forEach(a),Ie=u(m),le=r(m,"P",{});var ht=p(le);ne=l(ht,"\u5BF9\u4E8E\u5B66\u4E60\u7387\u8C03\u5EA6\uFF0C\u6211\u4EEC\u5C06\u4F7F\u7528\u524D\u51E0\u8282\u4E2D\u7684\u6807\u51C6\u7EBF\u6027\u8870\u51CF\uFF1A"),ht.forEach(a),_e=u(m),k(Os.$$.fragment,m),ye=u(m),gs=r(m,"P",{});var an=p(gs);Hs=l(an,"\u5BF9\u4E8E\u540E\u7EED\u5904\u7406\uFF0C\u6211\u4EEC\u9700\u8981\u4E00\u4E2A\u51FD\u6570\uFF0C\u5C06\u751F\u6210\u7684\u6458\u8981\u62C6\u5206\u4E3A\u7531\u6362\u884C\u7B26\u5206\u9694\u7684\u53E5\u5B50\u3002 \u8FD9\u662F ROUGE \u6307\u6807\u6240\u671F\u671B\u7684\u683C\u5F0F\uFF0C\u6211\u4EEC\u53EF\u4EE5\u4F7F\u7528\u4EE5\u4E0B\u4EE3\u7801\u7247\u6BB5\u6765\u5B9E\u73B0\uFF1A"),an.forEach(a),ge=u(m),k(re.$$.fragment,m),Ne=u(m),Fs=r(m,"P",{});var fa=p(Fs);Gt=l(fa,"\u5982\u679C\u4F60\u8FD8\u8BB0\u5F97\u6211\u4EEC\u662F\u5982\u4F55\u5B9A\u4E49 "),Ea=r(fa,"CODE",{});var Ma=p(Ea);ra=l(Ma,"Seq2SeqTrainer"),Ma.forEach(a),At=l(fa," \u7684 "),xa=r(fa,"CODE",{});var tn=p(xa);Ta=l(tn,"compute_metrics()"),tn.forEach(a),Lt=l(fa," \u51FD\u6570\u7684\uFF0C\u8FD9\u5BF9\u4F60\u6765\u8BF4\u5E94\u8BE5\u5F88\u719F\u6089\u3002"),fa.forEach(a),et=u(m),Ce=r(m,"P",{});var ln=p(Ce);Ue=l(ln,"\u6700\u540E\uFF0C\u6211\u4EEC\u9700\u8981\u5728 Hugging Face Hub \u4E0A\u521B\u5EFA\u4E00\u4E2A\u6A21\u578B\u5B58\u50A8\u5E93\u3002 \u4E3A\u6B64\uFF0C\u6211\u4EEC\u53EF\u4EE5\u4F7F\u7528\u{1F917} Hub \u5E93\u7684get_full_repo_name\u3002 \u6211\u4EEC\u53EA\u9700\u8981\u4E3A\u6211\u4EEC\u7684\u5B58\u50A8\u5E93\u5B9A\u4E49\u4E00\u4E2A\u540D\u79F0\uFF0C\u8BE5\u5E93\u6709\u4E00\u4E2A\u975E\u5E38\u597D\u7528\u7684\u51FD\u6570\u53EF\u4EE5\u5C06\u5B58\u50A8\u5E93 ID \u4E0E\u7528\u6237\u914D\u7F6E\u6587\u4EF6\u7ED3\u5408\u8D77\u6765\uFF1A"),ln.forEach(a),qa=u(m),k(bs.$$.fragment,m),at=u(m),k(be.$$.fragment,m),tt=u(m),oa=r(m,"P",{});var Ps=p(oa);Sa=l(Ps,"\u73B0\u5728\u6211\u4EEC\u53EF\u4EE5\u4F7F\u7528\u8FD9\u4E2A\u5B58\u50A8\u5E93\u540D\u79F0\u5C06\u672C\u5730\u7248\u672C\u514B\u9686\u5230\u6211\u4EEC\u7684\u7ED3\u679C\u76EE\u5F55\u4E2D\uFF0C\u8BE5\u76EE\u5F55\u5C06\u5B58\u50A8\u8BAD\u7EC3\u7684\u6A21\u578B\uFF1A"),Ps.forEach(a),lt=u(m),k(He.$$.fragment,m),pa=u(m),Ee=r(m,"P",{});var me=p(Ee);It=l(me,"\u8FD9\u5C06\u5141\u8BB8\u6211\u4EEC\u5728\u8BAD\u7EC3\u671F\u95F4\u901A\u8FC7\u8C03\u7528 "),Fe=r(me,"CODE",{});var Ba=p(Fe);Nt=l(Ba,"repo.push_to_hub()"),Ba.forEach(a),Ct=l(me," \u65B9\u6CD5\u5C06\u6A21\u578B\u63A8\u9001\u5230 Hub\uFF01 \u73B0\u5728\u8BA9\u6211\u4EEC\u901A\u8FC7\u5199\u51FA\u5B8C\u6574\u7684\u8BAD\u7EC3\u5FAA\u73AF\u6765\u7ED3\u675F\u6211\u4EEC\u7684\u5206\u6790\u3002"),me.forEach(a),ia=u(m),Me=r(m,"H3",{id:!0});var da=p(Me);Ut=l(da,"\u8BAD\u7EC3\u5FAA\u73AF"),da.forEach(a),za=u(m),oe=r(m,"P",{});var nn=p(oe);nt=l(nn,"\u6587\u672C\u6458\u8981\u7684\u8BAD\u7EC3\u5FAA\u73AF\u4E0E\u6211\u4EEC\u9047\u5230\u7684\u5176\u4ED6 \u{1F917} Accelerate \u793A\u4F8B\u975E\u5E38\u76F8\u4F3C\uFF0C\u5927\u81F4\u5206\u4E3A\u56DB\u4E2A\u4E3B\u8981\u6B65\u9AA4\uFF1A\u8FD9"),nn.forEach(a),Be=u(m),Ms=r(m,"OL",{});var qe=p(Ms);xe=r(qe,"LI",{});var _a=p(xe);We=l(_a,"\u901A\u8FC7\u5728\u6BCF\u4E2Aepoch \u8FED\u4EE3 "),ma=r(_a,"CODE",{});var rn=p(ma);Ke=l(rn,"train_dataloader"),rn.forEach(a),rt=l(_a," \u4E2D\u7684\u6240\u6709\u793A\u4F8B\u6765\u8BAD\u7EC3\u6A21\u578B\u3002"),_a.forEach(a),Bs=u(qe),Da=r(qe,"LI",{});var on=p(Da);Ra=l(on,"\u5728\u6BCF\u4E2A epoch \u7ED3\u675F\u65F6\u751F\u6210\u6A21\u578B\u6458\u8981\uFF0C\u9996\u5148\u751F\u6210\u6807\u8BB0\uFF0C\u7136\u540E\u5C06\u5B83\u4EEC\uFF08\u548C\u53C2\u8003\u6458\u8981\uFF09\u89E3\u7801\u4E3A\u6587\u672C\u3002"),on.forEach(a),Ht=u(qe),Oa=r(qe,"LI",{});var Wa=p(Oa);Pa=l(Wa,"\u4F7F\u7528\u6211\u4EEC\u4E4B\u524D\u770B\u5230\u7684\u76F8\u540C\u6280\u672F\u8BA1\u7B97 ROUGE \u5206\u6570\u3002"),Wa.forEach(a),Ft=u(qe),je=r(qe,"LI",{});var ga=p(je);Ga=l(ga,"\u4FDD\u5B58\u68C0\u67E5\u70B9\u5E76\u5C06\u6240\u6709\u5185\u5BB9\u63A8\u9001\u5230 Hub\u3002 \u5728\u8FD9\u91CC\uFF0C\u6211\u4EEC\u4F9D\u8D56 "),Aa=r(ga,"CODE",{});var pn=p(Aa);Mt=l(pn,"Repository"),pn.forEach(a),ot=l(ga," \u5BF9\u8C61\u7684\u5DE7\u5999\u7684 "),ve=r(ga,"CODE",{});var Se=p(ve);pt=l(Se,"blocking=False"),Se.forEach(a),Ve=l(ga," \u53C2\u6570\uFF0C\u4EE5\u4FBF\u6211\u4EEC\u53EF\u4EE5\u5728\u6BCF\u4E2A epoch \u5F02\u6B65\u5730\u4E0A\u4F20\u68C0\u67E5\u70B9\u3002 \u8FD9\u4F7F\u6211\u4EEC\u80FD\u591F\u7EE7\u7EED\u8BAD\u7EC3\uFF0C\u800C\u4E0D\u5FC5\u7B49\u5F85\u4E0E GB \u5927\u5C0F\u7684\u6A21\u578B\u6162\u547C\u547C\u7684\u4E0A\u4F20\uFF01"),ga.forEach(a),qe.forEach(a),La=u(m),$e=r(m,"P",{});var Ka=p($e);Bt=l(Ka,"\u8FD9\u4E9B\u6B65\u9AA4\u53EF\u4EE5\u5728\u4EE5\u4E0B\u4EE3\u7801\u5757\u4E2D\u770B\u5230\uFF1A"),Ka.forEach(a),Ia=u(m),k(Is.$$.fragment,m),Te=u(m),k(ca.$$.fragment,m),it=u(m),pe=r(m,"P",{});var ba=p(pe);Vl=l(ba,"\u5C31\u662F\u8FD9\u6837\uFF01 \u8FD0\u884C\u6B64\u7A0B\u5E8F\u540E\uFF0C\u60A8\u5C06\u83B7\u5F97\u4E0E\u6211\u4EEC\u4F7F\u7528\u201CTrainer\u201D\u83B7\u5F97\u7684\u6A21\u578B\u548C\u7ED3\u679C\u975E\u5E38\u76F8\u4F3C\u7684\u6A21\u578B\u548C\u7ED3\u679C\u3002"),ba.forEach(a),this.h()},h(){b(v,"id","accelerate-mt5"),b(v,"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"),b(v,"href","#accelerate-mt5"),b(h,"class","relative group"),b(N,"href","/course/chapter3"),b(H,"id",""),b(Me,"id","")},m(m,T){o(m,h,T),e(h,v),e(v,f),w(E,f,null),e(h,O),e(h,x),e(x,S),o(m,R,T),o(m,P,T),e(P,C),e(P,N),e(N,D),e(P,I),e(P,U),e(U,J),e(P,M),o(m,B,T),o(m,H,T),e(H,Q),o(m,z,T),o(m,G,T),e(G,os),e(G,ss),e(ss,Z),e(G,W),e(G,X),e(X,ls),e(G,V),e(G,$s),e($s,js),e(G,ps),e(G,vs),e(vs,Y),e(G,cs),o(m,ys,T),w(es,m,T),o(m,ns,T),o(m,rs,T),e(rs,is),e(rs,j),e(j,F),e(rs,Ts),o(m,as,T),w(us,m,T),o(m,ms,T),o(m,g,T),e(g,A),o(m,qs,T),w(hs,m,T),o(m,Ys,T),o(m,Es,T),e(Es,_s),e(Es,Cs),e(Cs,Js),e(Es,fs),o(m,Xs,T),w(Ss,m,T),o(m,ee,T),o(m,Us,T),e(Us,he),e(Us,Qs),e(Qs,Le),e(Us,fe),o(m,Zs,T),w(se,m,T),o(m,de,T),w(zs,m,T),o(m,As,T),o(m,L,T),e(L,ts),o(m,we,T),o(m,ks,T),e(ks,ds),e(ds,Ls),e(ks,ta),e(ks,ae),e(ae,la),e(ks,na),e(ks,te),e(te,xs),o(m,Ie,T),o(m,le,T),e(le,ne),o(m,_e,T),w(Os,m,T),o(m,ye,T),o(m,gs,T),e(gs,Hs),o(m,ge,T),w(re,m,T),o(m,Ne,T),o(m,Fs,T),e(Fs,Gt),e(Fs,Ea),e(Ea,ra),e(Fs,At),e(Fs,xa),e(xa,Ta),e(Fs,Lt),o(m,et,T),o(m,Ce,T),e(Ce,Ue),o(m,qa,T),w(bs,m,T),o(m,at,T),w(be,m,T),o(m,tt,T),o(m,oa,T),e(oa,Sa),o(m,lt,T),w(He,m,T),o(m,pa,T),o(m,Ee,T),e(Ee,It),e(Ee,Fe),e(Fe,Nt),e(Ee,Ct),o(m,ia,T),o(m,Me,T),e(Me,Ut),o(m,za,T),o(m,oe,T),e(oe,nt),o(m,Be,T),o(m,Ms,T),e(Ms,xe),e(xe,We),e(xe,ma),e(ma,Ke),e(xe,rt),e(Ms,Bs),e(Ms,Da),e(Da,Ra),e(Ms,Ht),e(Ms,Oa),e(Oa,Pa),e(Ms,Ft),e(Ms,je),e(je,Ga),e(je,Aa),e(Aa,Mt),e(je,ot),e(je,ve),e(ve,pt),e(je,Ve),o(m,La,T),o(m,$e,T),e($e,Bt),o(m,Ia,T),w(Is,m,T),o(m,Te,T),w(ca,m,T),o(m,it,T),o(m,pe,T),e(pe,Vl),Na=!0},i(m){Na||(d(E.$$.fragment,m),d(es.$$.fragment,m),d(us.$$.fragment,m),d(hs.$$.fragment,m),d(Ss.$$.fragment,m),d(se.$$.fragment,m),d(zs.$$.fragment,m),d(Os.$$.fragment,m),d(re.$$.fragment,m),d(bs.$$.fragment,m),d(be.$$.fragment,m),d(He.$$.fragment,m),d(Is.$$.fragment,m),d(ca.$$.fragment,m),Na=!0)},o(m){_(E.$$.fragment,m),_(es.$$.fragment,m),_(us.$$.fragment,m),_(hs.$$.fragment,m),_(Ss.$$.fragment,m),_(se.$$.fragment,m),_(zs.$$.fragment,m),_(Os.$$.fragment,m),_(re.$$.fragment,m),_(bs.$$.fragment,m),_(be.$$.fragment,m),_(He.$$.fragment,m),_(Is.$$.fragment,m),_(ca.$$.fragment,m),Na=!1},d(m){m&&a(h),y(E),m&&a(R),m&&a(P),m&&a(B),m&&a(H),m&&a(z),m&&a(G),m&&a(ys),y(es,m),m&&a(ns),m&&a(rs),m&&a(as),y(us,m),m&&a(ms),m&&a(g),m&&a(qs),y(hs,m),m&&a(Ys),m&&a(Es),m&&a(Xs),y(Ss,m),m&&a(ee),m&&a(Us),m&&a(Zs),y(se,m),m&&a(de),y(zs,m),m&&a(As),m&&a(L),m&&a(we),m&&a(ks),m&&a(Ie),m&&a(le),m&&a(_e),y(Os,m),m&&a(ye),m&&a(gs),m&&a(ge),y(re,m),m&&a(Ne),m&&a(Fs),m&&a(et),m&&a(Ce),m&&a(qa),y(bs,m),m&&a(at),y(be,m),m&&a(tt),m&&a(oa),m&&a(lt),y(He,m),m&&a(pa),m&&a(Ee),m&&a(ia),m&&a(Me),m&&a(za),m&&a(oe),m&&a(Be),m&&a(Ms),m&&a(La),m&&a($e),m&&a(Ia),y(Is,m),m&&a(Te),y(ca,m),m&&a(it),m&&a(pe)}}}function Ad(K){let h,v,f,E,O;return{c(){h=n("p"),v=t("\u{1F6A8}\u5982\u679C\u60A8\u5728 TPU \u4E0A\u8FDB\u884C\u8BAD\u7EC3\uFF0C\u5219\u9700\u8981\u5C06\u4E0A\u8FF0\u6240\u6709\u4EE3\u7801\u79FB\u52A8\u5230\u4E13\u95E8\u7684\u8BAD\u7EC3\u51FD\u6570\u4E2D\u3002\u6709\u5173\u8BE6\u7EC6\u4FE1\u606F\uFF0C\u8BF7\u53C2\u9605"),f=n("a"),E=t("\u7B2C\u4E09\u7AE0"),O=t("\u3002"),this.h()},l(x){h=r(x,"P",{});var S=p(h);v=l(S,"\u{1F6A8}\u5982\u679C\u60A8\u5728 TPU \u4E0A\u8FDB\u884C\u8BAD\u7EC3\uFF0C\u5219\u9700\u8981\u5C06\u4E0A\u8FF0\u6240\u6709\u4EE3\u7801\u79FB\u52A8\u5230\u4E13\u95E8\u7684\u8BAD\u7EC3\u51FD\u6570\u4E2D\u3002\u6709\u5173\u8BE6\u7EC6\u4FE1\u606F\uFF0C\u8BF7\u53C2\u9605"),f=r(S,"A",{href:!0});var R=p(f);E=l(R,"\u7B2C\u4E09\u7AE0"),R.forEach(a),O=l(S,"\u3002"),S.forEach(a),this.h()},h(){b(f,"href","/course/chapter3")},m(x,S){o(x,h,S),e(h,v),e(h,f),e(f,E),e(h,O)},d(x){x&&a(h)}}}function Ld(K){let h,v,f,E,O,x,S,R,P,C,N,D,I,U,J,M,B,H,Q,z,G,os,ss,Z,W,X,ls,V,$s,js,ps,vs,Y,cs,ys,es,ns,rs,is,j,F,Ts,as,us,ms,g,A,qs,hs,Ys,Es,_s,Cs,Js,fs,Xs,Ss,ee,Us,he,Qs,Le,fe,Zs,se,de,zs,As,L,ts,we,ks,ds,Ls,ta,ae,la,na,te,xs,Ie,le,ne,_e,Os,ye,gs,Hs,ge,re,Ne,Fs,Gt,Ea,ra,At,xa,Ta,Lt,et,Ce,Ue,qa,bs,at,be,tt,oa,Sa,lt,He,pa,Ee,It,Fe,Nt,Ct,ia,Me,Ut,za,oe,nt,Be,Ms,xe,We,ma,Ke,rt,Bs,Da,Ra,Ht,Oa,Pa,Ft,je,Ga,Aa,Mt,ot,ve,pt,Ve,La,$e,Bt,Ia,Is,Te,ca,it,pe,Vl,Na,m,T,mt,Yl,Jl,Ye,ua,Wt,Ca,ie,Kt,ha,Xl,Vt,ke,Ql,Ua,ct,Zl,Ha,Je,ut,Ws,Fa,sn,en,ht,an,fa,Ma,tn,ln,Ps,me,Ba,da,nn,qe,_a,rn,on,Wa,ga,pn,Se,Ka,ba,hi,fi,mr,di,_i,mn,gi,bi,Va,cn,Yt,ji,vi,Jt,$i,cr,ki,wi,yi,un,Ei,xi,Ya,hn,Xt,Ti,qi,ur,Si,zi,fn,Di,Ri,Ja,dn,Qt,Oi,Pi,hr,Gi,Ai,_n,Li,Ii,Xa,gn,Zt,Ni,Ci,fr,Ui,Hi,bn,Fi,fo,jn,Mi,_o,ft,Bi,dr,Wi,Ki,go,Qa,sl,Ru,Vi,el,Ou,bo,vn,Yi,jo,dt,vo,al,Ji,$o,tl,ko,_t,Xi,_r,Qi,Zi,wo,ll,yo,gt,Eo,$n,sm,xo,nl,To,rl,qo,ce,em,kn,am,tm,gr,lm,nm,br,rm,om,jr,pm,im,So,ol,zo,pl,Do,ze,mm,vr,cm,um,$r,hm,fm,wn,dm,_m,Ro,bt,gm,kr,bm,jm,Oo,il,Po,ue,vm,wr,$m,km,yr,wm,ym,Er,Em,xm,xr,Tm,qm,Go,ja,Sm,Tr,zm,Dm,qr,Rm,Om,Ao,ml,Lo,yn,Pm,Io,jt,No,cl,Gm,Co,ul,Uo,En,Am,Ho,vt,Lm,hl,Im,Nm,Fo,fl,Mo,va,Cm,Sr,Um,Hm,zr,Fm,Mm,Bo,$t,Wo,dl,Bm,Ko,hd='<span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><mrow><mi mathvariant="normal">R</mi><mi mathvariant="normal">e</mi><mi mathvariant="normal">c</mi><mi mathvariant="normal">a</mi><mi mathvariant="normal">l</mi><mi mathvariant="normal">l</mi></mrow><mo>=</mo><mfrac><mrow><mi mathvariant="normal">N</mi><mi mathvariant="normal">u</mi><mi mathvariant="normal">m</mi><mi mathvariant="normal">b</mi><mi mathvariant="normal">e</mi><mi mathvariant="normal">r</mi><mtext>\u2009</mtext><mi mathvariant="normal">o</mi><mi mathvariant="normal">f</mi><mtext>\u2009</mtext><mi mathvariant="normal">o</mi><mi mathvariant="normal">v</mi><mi mathvariant="normal">e</mi><mi mathvariant="normal">r</mi><mi mathvariant="normal">l</mi><mi mathvariant="normal">a</mi><mi mathvariant="normal">p</mi><mi mathvariant="normal">p</mi><mi mathvariant="normal">i</mi><mi mathvariant="normal">n</mi><mi mathvariant="normal">g</mi><mtext>\u2009</mtext><mi mathvariant="normal">w</mi><mi mathvariant="normal">o</mi><mi mathvariant="normal">r</mi><mi mathvariant="normal">d</mi><mi mathvariant="normal">s</mi></mrow><mrow><mi mathvariant="normal">T</mi><mi mathvariant="normal">o</mi><mi mathvariant="normal">t</mi><mi mathvariant="normal">a</mi><mi mathvariant="normal">l</mi><mtext>\u2009</mtext><mi mathvariant="normal">n</mi><mi mathvariant="normal">u</mi><mi mathvariant="normal">m</mi><mi mathvariant="normal">b</mi><mi mathvariant="normal">e</mi><mi mathvariant="normal">r</mi><mtext>\u2009</mtext><mi mathvariant="normal">o</mi><mi mathvariant="normal">f</mi><mtext>\u2009</mtext><mi mathvariant="normal">w</mi><mi mathvariant="normal">o</mi><mi mathvariant="normal">r</mi><mi mathvariant="normal">d</mi><mi mathvariant="normal">s</mi><mtext>\u2009</mtext><mi mathvariant="normal">i</mi><mi mathvariant="normal">n</mi><mtext>\u2009</mtext><mi mathvariant="normal">r</mi><mi mathvariant="normal">e</mi><mi mathvariant="normal">f</mi><mi mathvariant="normal">e</mi><mi mathvariant="normal">r</mi><mi mathvariant="normal">e</mi><mi mathvariant="normal">n</mi><mi mathvariant="normal">c</mi><mi mathvariant="normal">e</mi><mtext>\u2009</mtext><mi mathvariant="normal">s</mi><mi mathvariant="normal">u</mi><mi mathvariant="normal">m</mi><mi mathvariant="normal">m</mi><mi mathvariant="normal">a</mi><mi mathvariant="normal">r</mi><mi mathvariant="normal">y</mi></mrow></mfrac></mrow><annotation encoding="application/x-tex"> \\mathrm{Recall} = \\frac{\\mathrm{Number\\,of\\,overlapping\\, words}}{\\mathrm{Total\\, number\\, of\\, words\\, in\\, reference\\, summary}} </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6944em;"></span><span class="mord"><span class="mord mathrm">Recall</span></span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:2.2519em;vertical-align:-0.8804em;"></span><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.3714em;"><span style="top:-2.314em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord"><span class="mord mathrm">Total</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathrm">number</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathrm" style="margin-right:0.07778em;">of</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathrm">words</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathrm">in</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathrm">reference</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathrm" style="margin-right:0.01389em;">summary</span></span></span></span><span style="top:-3.23em;"><span class="pstrut" style="height:3em;"></span><span class="frac-line" style="border-bottom-width:0.04em;"></span></span><span style="top:-3.677em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord"><span class="mord mathrm">Number</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathrm" style="margin-right:0.07778em;">of</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathrm" style="margin-right:0.01389em;">overlapping</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathrm">words</span></span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.8804em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span></span></span></span></span>',Vo,_l,Wm,Yo,fd='<span class="katex-display"><span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><mrow><mi mathvariant="normal">P</mi><mi mathvariant="normal">r</mi><mi mathvariant="normal">e</mi><mi mathvariant="normal">c</mi><mi mathvariant="normal">i</mi><mi mathvariant="normal">s</mi><mi mathvariant="normal">i</mi><mi mathvariant="normal">o</mi><mi mathvariant="normal">n</mi></mrow><mo>=</mo><mfrac><mrow><mi mathvariant="normal">N</mi><mi mathvariant="normal">u</mi><mi mathvariant="normal">m</mi><mi mathvariant="normal">b</mi><mi mathvariant="normal">e</mi><mi mathvariant="normal">r</mi><mtext>\u2009</mtext><mi mathvariant="normal">o</mi><mi mathvariant="normal">f</mi><mtext>\u2009</mtext><mi mathvariant="normal">o</mi><mi mathvariant="normal">v</mi><mi mathvariant="normal">e</mi><mi mathvariant="normal">r</mi><mi mathvariant="normal">l</mi><mi mathvariant="normal">a</mi><mi mathvariant="normal">p</mi><mi mathvariant="normal">p</mi><mi mathvariant="normal">i</mi><mi mathvariant="normal">n</mi><mi mathvariant="normal">g</mi><mtext>\u2009</mtext><mi mathvariant="normal">w</mi><mi mathvariant="normal">o</mi><mi mathvariant="normal">r</mi><mi mathvariant="normal">d</mi><mi mathvariant="normal">s</mi></mrow><mrow><mi mathvariant="normal">T</mi><mi mathvariant="normal">o</mi><mi mathvariant="normal">t</mi><mi mathvariant="normal">a</mi><mi mathvariant="normal">l</mi><mtext>\u2009</mtext><mi mathvariant="normal">n</mi><mi mathvariant="normal">u</mi><mi mathvariant="normal">m</mi><mi mathvariant="normal">b</mi><mi mathvariant="normal">e</mi><mi mathvariant="normal">r</mi><mtext>\u2009</mtext><mi mathvariant="normal">o</mi><mi mathvariant="normal">f</mi><mtext>\u2009</mtext><mi mathvariant="normal">w</mi><mi mathvariant="normal">o</mi><mi mathvariant="normal">r</mi><mi mathvariant="normal">d</mi><mi mathvariant="normal">s</mi><mtext>\u2009</mtext><mi mathvariant="normal">i</mi><mi mathvariant="normal">n</mi><mtext>\u2009</mtext><mi mathvariant="normal">g</mi><mi mathvariant="normal">e</mi><mi mathvariant="normal">n</mi><mi mathvariant="normal">e</mi><mi mathvariant="normal">r</mi><mi mathvariant="normal">a</mi><mi mathvariant="normal">t</mi><mi mathvariant="normal">e</mi><mi mathvariant="normal">d</mi><mtext>\u2009</mtext><mi mathvariant="normal">s</mi><mi mathvariant="normal">u</mi><mi mathvariant="normal">m</mi><mi mathvariant="normal">m</mi><mi mathvariant="normal">a</mi><mi mathvariant="normal">r</mi><mi mathvariant="normal">y</mi></mrow></mfrac></mrow><annotation encoding="application/x-tex"> \\mathrm{Precision} = \\frac{\\mathrm{Number\\,of\\,overlapping\\, words}}{\\mathrm{Total\\, number\\, of\\, words\\, in\\, generated\\, summary}} </annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:0.6833em;"></span><span class="mord"><span class="mord mathrm">Precision</span></span><span class="mspace" style="margin-right:0.2778em;"></span><span class="mrel">=</span><span class="mspace" style="margin-right:0.2778em;"></span></span><span class="base"><span class="strut" style="height:2.2519em;vertical-align:-0.8804em;"></span><span class="mord"><span class="mopen nulldelimiter"></span><span class="mfrac"><span class="vlist-t vlist-t2"><span class="vlist-r"><span class="vlist" style="height:1.3714em;"><span style="top:-2.314em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord"><span class="mord mathrm">Total</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathrm">number</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathrm" style="margin-right:0.07778em;">of</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathrm">words</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathrm">in</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathrm">generated</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathrm" style="margin-right:0.01389em;">summary</span></span></span></span><span style="top:-3.23em;"><span class="pstrut" style="height:3em;"></span><span class="frac-line" style="border-bottom-width:0.04em;"></span></span><span style="top:-3.677em;"><span class="pstrut" style="height:3em;"></span><span class="mord"><span class="mord"><span class="mord mathrm">Number</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathrm" style="margin-right:0.07778em;">of</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathrm" style="margin-right:0.01389em;">overlapping</span><span class="mspace" style="margin-right:0.1667em;"></span><span class="mord mathrm">words</span></span></span></span></span><span class="vlist-s">\u200B</span></span><span class="vlist-r"><span class="vlist" style="height:0.8804em;"><span></span></span></span></span></span><span class="mclose nulldelimiter"></span></span></span></span></span></span>',Jo,kt,Km,Dr,Vm,Ym,Xo,gl,Qo,xn,Jm,Zo,bl,sp,wt,Xm,Rr,Qm,Zm,ep,jl,ap,vl,tp,Ks,sc,Or,ec,ac,Pr,tc,lc,Gr,nc,rc,Ar,oc,pc,Lr,ic,mc,lp,$l,np,kl,rp,Vs,cc,Ir,uc,hc,Nr,fc,dc,Cr,_c,gc,Ur,bc,jc,Hr,vc,$c,op,yt,pp,Tn,kc,ip,Za,Et,Fr,wl,wc,Mr,yc,mp,De,Ec,Br,xc,Tc,Wr,qc,Sc,Kr,zc,Dc,cp,yl,up,qn,Rc,hp,El,fp,xt,Oc,Vr,Pc,Gc,dp,xl,_p,Tl,gp,Sn,Ac,bp,ql,jp,zn,Lc,vp,Sl,$p,zl,kp,Tt,Ic,Yr,Nc,Cc,wp,Xe,Qe,Dn,qt,yp,Rn,Uc,Ep,Dl,xp,On,Hc,Tp,Rl,qp,Pn,St,Fc,Gn,Mc,Bc,Sp,Re,Wc,Jr,Kc,Vc,Xr,Yc,Jc,Qr,Xc,Qc,zp,Ze,sa,An,Ln,Zc,Dp,Ol,Rp,$a,su,Zr,eu,au,so,tu,lu,Op,Pl,Pp,Gl,Gp,ws,nu,eo,ru,ou,ao,pu,iu,to,mu,cu,lo,uu,hu,no,fu,du,ro,_u,gu,oo,bu,ju,po,vu,$u,Ap,ea,aa,In,Nn,Al,ku,Lp,Cn,wu,Ip,Ll,Np,Un,yu,Cp,Il,Up,Hn,Eu,Hp,Nl,Fp,Cl,Mp,Fn,xu,Bp,Ul,Wp,Hl,Kp,Mn,Tu,Vp,Bn,qu,Yp;f=new vd({props:{fw:K[0]}});const Pu=[kd,$d],Fl=[];function Gu(s,i){return s[0]==="pt"?0:1}R=Gu(K),P=Fl[R]=Pu[R](K),U=new Du({props:{id:"yHnr5Dk2zCI"}}),as=new q({props:{code:`from datasets import load_dataset

spanish_dataset = load_dataset("amazon_reviews_multi", "es")
english_dataset = load_dataset("amazon_reviews_multi", "en")
english_dataset`,highlighted:`<span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_dataset

spanish_dataset = load_dataset(<span class="hljs-string">&quot;amazon_reviews_multi&quot;</span>, <span class="hljs-string">&quot;es&quot;</span>)
english_dataset = load_dataset(<span class="hljs-string">&quot;amazon_reviews_multi&quot;</span>, <span class="hljs-string">&quot;en&quot;</span>)
english_dataset`}}),ms=new q({props:{code:`DatasetDict({
    train: Dataset({
        features: ['review_id', 'product_id', 'reviewer_id', 'stars', 'review_body', 'review_title', 'language', 'product_category'],
        num_rows: 200000
    })
    validation: Dataset({
        features: ['review_id', 'product_id', 'reviewer_id', 'stars', 'review_body', 'review_title', 'language', 'product_category'],
        num_rows: 5000
    })
    test: Dataset({
        features: ['review_id', 'product_id', 'reviewer_id', 'stars', 'review_body', 'review_title', 'language', 'product_category'],
        num_rows: 5000
    })
})`,highlighted:`DatasetDict({
    train: Dataset({
        features: [<span class="hljs-string">&#x27;review_id&#x27;</span>, <span class="hljs-string">&#x27;product_id&#x27;</span>, <span class="hljs-string">&#x27;reviewer_id&#x27;</span>, <span class="hljs-string">&#x27;stars&#x27;</span>, <span class="hljs-string">&#x27;review_body&#x27;</span>, <span class="hljs-string">&#x27;review_title&#x27;</span>, <span class="hljs-string">&#x27;language&#x27;</span>, <span class="hljs-string">&#x27;product_category&#x27;</span>],
        num_rows: <span class="hljs-number">200000</span>
    })
    validation: Dataset({
        features: [<span class="hljs-string">&#x27;review_id&#x27;</span>, <span class="hljs-string">&#x27;product_id&#x27;</span>, <span class="hljs-string">&#x27;reviewer_id&#x27;</span>, <span class="hljs-string">&#x27;stars&#x27;</span>, <span class="hljs-string">&#x27;review_body&#x27;</span>, <span class="hljs-string">&#x27;review_title&#x27;</span>, <span class="hljs-string">&#x27;language&#x27;</span>, <span class="hljs-string">&#x27;product_category&#x27;</span>],
        num_rows: <span class="hljs-number">5000</span>
    })
    test: Dataset({
        features: [<span class="hljs-string">&#x27;review_id&#x27;</span>, <span class="hljs-string">&#x27;product_id&#x27;</span>, <span class="hljs-string">&#x27;reviewer_id&#x27;</span>, <span class="hljs-string">&#x27;stars&#x27;</span>, <span class="hljs-string">&#x27;review_body&#x27;</span>, <span class="hljs-string">&#x27;review_title&#x27;</span>, <span class="hljs-string">&#x27;language&#x27;</span>, <span class="hljs-string">&#x27;product_category&#x27;</span>],
        num_rows: <span class="hljs-number">5000</span>
    })
})`}}),As=new q({props:{code:`def show_samples(dataset, num_samples=3, seed=42):
    sample = dataset["train"].shuffle(seed=seed).select(range(num_samples))
    for example in sample:
        print(f"\\n'>> Title: {example['review_title']}'")
        print(f"'>> Review: {example['review_body']}'")


show_samples(english_dataset)`,highlighted:`<span class="hljs-keyword">def</span> <span class="hljs-title function_">show_samples</span>(<span class="hljs-params">dataset, num_samples=<span class="hljs-number">3</span>, seed=<span class="hljs-number">42</span></span>):
    sample = dataset[<span class="hljs-string">&quot;train&quot;</span>].shuffle(seed=seed).select(<span class="hljs-built_in">range</span>(num_samples))
    <span class="hljs-keyword">for</span> example <span class="hljs-keyword">in</span> sample:
        <span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;\\n&#x27;&gt;&gt; Title: <span class="hljs-subst">{example[<span class="hljs-string">&#x27;review_title&#x27;</span>]}</span>&#x27;&quot;</span>)
        <span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;&#x27;&gt;&gt; Review: <span class="hljs-subst">{example[<span class="hljs-string">&#x27;review_body&#x27;</span>]}</span>&#x27;&quot;</span>)


show_samples(english_dataset)`}}),ts=new q({props:{code:`'>> Title: Worked in front position, not rear'
'>> Review: 3 stars because these are not rear brakes as stated in the item description. At least the mount adapter only worked on the front fork of the bike that I got it for.'

'>> Title: meh'
'>> Review: Does it\u2019s job and it\u2019s gorgeous but mine is falling apart, I had to basically put it together again with hot glue'

'>> Title: Can\\'t beat these for the money'
'>> Review: Bought this for handling miscellaneous aircraft parts and hanger "stuff" that I needed to organize; it really fit the bill. The unit arrived quickly, was well packaged and arrived intact (always a good sign). There are five wall mounts-- three on the top and two on the bottom. I wanted to mount it on the wall, so all I had to do was to remove the top two layers of plastic drawers, as well as the bottom corner drawers, place it when I wanted and mark it; I then used some of the new plastic screw in wall anchors (the 50 pound variety) and it easily mounted to the wall. Some have remarked that they wanted dividers for the drawers, and that they made those. Good idea. My application was that I needed something that I can see the contents at about eye level, so I wanted the fuller-sized drawers. I also like that these are the new plastic that doesn\\'t get brittle and split like my older plastic drawers did. I like the all-plastic construction. It\\'s heavy duty enough to hold metal parts, but being made of plastic it\\'s not as heavy as a metal frame, so you can easily mount it to the wall and still load it up with heavy stuff, or light stuff. No problem there. For the money, you can\\'t beat it. Best one of these I\\'ve bought to date-- and I\\'ve been using some version of these for over forty years.'`,highlighted:`<span class="hljs-string">&#x27;&gt;&gt; Title: Worked in front position, not rear&#x27;</span>
<span class="hljs-string">&#x27;&gt;&gt; Review: 3 stars because these are not rear brakes as stated in the item description. At least the mount adapter only worked on the front fork of the bike that I got it for.&#x27;</span>

<span class="hljs-string">&#x27;&gt;&gt; Title: meh&#x27;</span>
<span class="hljs-string">&#x27;&gt;&gt; Review: Does it\u2019s job and it\u2019s gorgeous but mine is falling apart, I had to basically put it together again with hot glue&#x27;</span>

<span class="hljs-string">&#x27;&gt;&gt; Title: Can\\&#x27;t beat these for the money&#x27;</span>
<span class="hljs-string">&#x27;&gt;&gt; Review: Bought this for handling miscellaneous aircraft parts and hanger &quot;stuff&quot; that I needed to organize; it really fit the bill. The unit arrived quickly, was well packaged and arrived intact (always a good sign). There are five wall mounts-- three on the top and two on the bottom. I wanted to mount it on the wall, so all I had to do was to remove the top two layers of plastic drawers, as well as the bottom corner drawers, place it when I wanted and mark it; I then used some of the new plastic screw in wall anchors (the 50 pound variety) and it easily mounted to the wall. Some have remarked that they wanted dividers for the drawers, and that they made those. Good idea. My application was that I needed something that I can see the contents at about eye level, so I wanted the fuller-sized drawers. I also like that these are the new plastic that doesn\\&#x27;t get brittle and split like my older plastic drawers did. I like the all-plastic construction. It\\&#x27;s heavy duty enough to hold metal parts, but being made of plastic it\\&#x27;s not as heavy as a metal frame, so you can easily mount it to the wall and still load it up with heavy stuff, or light stuff. No problem there. For the money, you can\\&#x27;t beat it. Best one of these I\\&#x27;ve bought to date-- and I\\&#x27;ve been using some version of these for over forty years.&#x27;</span>`}}),ks=new Pt({props:{$$slots:{default:[wd]},$$scope:{ctx:K}}}),ne=new q({props:{code:`english_dataset.set_format("pandas")
english_df = english_dataset["train"][:]
# Show counts for top 20 products
english_df["product_category"].value_counts()[:20]`,highlighted:`english_dataset.set_format(<span class="hljs-string">&quot;pandas&quot;</span>)
english_df = english_dataset[<span class="hljs-string">&quot;train&quot;</span>][:]
<span class="hljs-comment"># Show counts for top 20 products</span>
english_df[<span class="hljs-string">&quot;product_category&quot;</span>].value_counts()[:<span class="hljs-number">20</span>]`}}),Os=new q({props:{code:`home                      17679
apparel                   15951
wireless                  15717
other                     13418
beauty                    12091
drugstore                 11730
kitchen                   10382
toy                        8745
sports                     8277
automotive                 7506
lawn_and_garden            7327
home_improvement           7136
pet_products               7082
digital_ebook_purchase     6749
pc                         6401
electronics                6186
office_product             5521
shoes                      5197
grocery                    4730
book                       3756
Name: product_category, dtype: int64`,highlighted:`home                      <span class="hljs-number">17679</span>
apparel                   <span class="hljs-number">15951</span>
wireless                  <span class="hljs-number">15717</span>
other                     <span class="hljs-number">13418</span>
beauty                    <span class="hljs-number">12091</span>
drugstore                 <span class="hljs-number">11730</span>
kitchen                   <span class="hljs-number">10382</span>
toy                        <span class="hljs-number">8745</span>
sports                     <span class="hljs-number">8277</span>
automotive                 <span class="hljs-number">7506</span>
lawn_and_garden            <span class="hljs-number">7327</span>
home_improvement           <span class="hljs-number">7136</span>
pet_products               <span class="hljs-number">7082</span>
digital_ebook_purchase     <span class="hljs-number">6749</span>
pc                         <span class="hljs-number">6401</span>
electronics                <span class="hljs-number">6186</span>
office_product             <span class="hljs-number">5521</span>
shoes                      <span class="hljs-number">5197</span>
grocery                    <span class="hljs-number">4730</span>
book                       <span class="hljs-number">3756</span>
Name: product_category, dtype: int64`}}),Ue=new q({props:{code:`def filter_books(example):
    return (
        example["product_category"] == "book"
        or example["product_category"] == "digital_ebook_purchase"
    )`,highlighted:`<span class="hljs-keyword">def</span> <span class="hljs-title function_">filter_books</span>(<span class="hljs-params">example</span>):
    <span class="hljs-keyword">return</span> (
        example[<span class="hljs-string">&quot;product_category&quot;</span>] == <span class="hljs-string">&quot;book&quot;</span>
        <span class="hljs-keyword">or</span> example[<span class="hljs-string">&quot;product_category&quot;</span>] == <span class="hljs-string">&quot;digital_ebook_purchase&quot;</span>
    )`}}),oe=new q({props:{code:"english_dataset.reset_format()",highlighted:"english_dataset.reset_format()"}}),We=new q({props:{code:`spanish_books = spanish_dataset.filter(filter_books)
english_books = english_dataset.filter(filter_books)
show_samples(english_books)`,highlighted:`spanish_books = spanish_dataset.<span class="hljs-built_in">filter</span>(filter_books)
english_books = english_dataset.<span class="hljs-built_in">filter</span>(filter_books)
show_samples(english_books)`}}),Ke=new q({props:{code:`'>> Title: I\\'m dissapointed.'
'>> Review: I guess I had higher expectations for this book from the reviews. I really thought I\\'d at least like it. The plot idea was great. I loved Ash but, it just didnt go anywhere. Most of the book was about their radio show and talking to callers. I wanted the author to dig deeper so we could really get to know the characters. All we know about Grace is that she is attractive looking, Latino and is kind of a brat. I\\'m dissapointed.'

'>> Title: Good art, good price, poor design'
'>> Review: I had gotten the DC Vintage calendar the past two years, but it was on backorder forever this year and I saw they had shrunk the dimensions for no good reason. This one has good art choices but the design has the fold going through the picture, so it\\'s less aesthetically pleasing, especially if you want to keep a picture to hang. For the price, a good calendar'

'>> Title: Helpful'
'>> Review: Nearly all the tips useful and. I consider myself an intermediate to advanced user of OneNote. I would highly recommend.'`,highlighted:`<span class="hljs-string">&#x27;&gt;&gt; Title: I\\&#x27;m dissapointed.&#x27;</span>
<span class="hljs-string">&#x27;&gt;&gt; Review: I guess I had higher expectations for this book from the reviews. I really thought I\\&#x27;d at least like it. The plot idea was great. I loved Ash but, it just didnt go anywhere. Most of the book was about their radio show and talking to callers. I wanted the author to dig deeper so we could really get to know the characters. All we know about Grace is that she is attractive looking, Latino and is kind of a brat. I\\&#x27;m dissapointed.&#x27;</span>

<span class="hljs-string">&#x27;&gt;&gt; Title: Good art, good price, poor design&#x27;</span>
<span class="hljs-string">&#x27;&gt;&gt; Review: I had gotten the DC Vintage calendar the past two years, but it was on backorder forever this year and I saw they had shrunk the dimensions for no good reason. This one has good art choices but the design has the fold going through the picture, so it\\&#x27;s less aesthetically pleasing, especially if you want to keep a picture to hang. For the price, a good calendar&#x27;</span>

<span class="hljs-string">&#x27;&gt;&gt; Title: Helpful&#x27;</span>
<span class="hljs-string">&#x27;&gt;&gt; Review: Nearly all the tips useful and. I consider myself an intermediate to advanced user of OneNote. I would highly recommend.&#x27;</span>`}}),ve=new q({props:{code:`from datasets import concatenate_datasets, DatasetDict

books_dataset = DatasetDict()

for split in english_books.keys():
    books_dataset[split] = concatenate_datasets(
        [english_books[split], spanish_books[split]]
    )
    books_dataset[split] = books_dataset[split].shuffle(seed=42)

# Peek at a few examples
show_samples(books_dataset)`,highlighted:`<span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> concatenate_datasets, DatasetDict

books_dataset = DatasetDict()

<span class="hljs-keyword">for</span> split <span class="hljs-keyword">in</span> english_books.keys():
    books_dataset[split] = concatenate_datasets(
        [english_books[split], spanish_books[split]]
    )
    books_dataset[split] = books_dataset[split].shuffle(seed=<span class="hljs-number">42</span>)

<span class="hljs-comment"># Peek at a few examples</span>
show_samples(books_dataset)`}}),Ve=new q({props:{code:`'>> Title: Easy to follow!!!!'
'>> Review: I loved The dash diet weight loss Solution. Never hungry. I would recommend this diet. Also the menus are well rounded. Try it. Has lots of the information need thanks.'

'>> Title: PARCIALMENTE DA\xD1ADO'
'>> Review: Me lleg\xF3 el d\xEDa que tocaba, junto a otros libros que ped\xED, pero la caja lleg\xF3 en mal estado lo cual da\xF1\xF3 las esquinas de los libros porque ven\xEDan sin protecci\xF3n (forro).'

'>> Title: no lo he podido descargar'
'>> Review: igual que el anterior'`,highlighted:`<span class="hljs-string">&#x27;&gt;&gt; Title: Easy to follow!!!!&#x27;</span>
<span class="hljs-string">&#x27;&gt;&gt; Review: I loved The dash diet weight loss Solution. Never hungry. I would recommend this diet. Also the menus are well rounded. Try it. Has lots of the information need thanks.&#x27;</span>

<span class="hljs-string">&#x27;&gt;&gt; Title: PARCIALMENTE DA\xD1ADO&#x27;</span>
<span class="hljs-string">&#x27;&gt;&gt; Review: Me lleg\xF3 el d\xEDa que tocaba, junto a otros libros que ped\xED, pero la caja lleg\xF3 en mal estado lo cual da\xF1\xF3 las esquinas de los libros porque ven\xEDan sin protecci\xF3n (forro).&#x27;</span>

<span class="hljs-string">&#x27;&gt;&gt; Title: no lo he podido descargar&#x27;</span>
<span class="hljs-string">&#x27;&gt;&gt; Review: igual que el anterior&#x27;</span>`}}),ua=new q({props:{code:'books_dataset = books_dataset.filter(lambda x: len(x["review_title"].split()) > 2)',highlighted:'books_dataset = books_dataset.<span class="hljs-built_in">filter</span>(<span class="hljs-keyword">lambda</span> x: <span class="hljs-built_in">len</span>(x[<span class="hljs-string">&quot;review_title&quot;</span>].split()) &gt; <span class="hljs-number">2</span>)'}}),dt=new Pt({props:{$$slots:{default:[yd]},$$scope:{ctx:K}}}),tl=new Du({props:{id:"1m7BerpSq8A"}}),ll=new q({props:{code:`from transformers import AutoTokenizer

model_checkpoint = "google/mt5-small"
tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)`,highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer

model_checkpoint = <span class="hljs-string">&quot;google/mt5-small&quot;</span>
tokenizer = AutoTokenizer.from_pretrained(model_checkpoint)`}}),gt=new Pt({props:{$$slots:{default:[Ed]},$$scope:{ctx:K}}}),nl=new q({props:{code:`inputs = tokenizer("I loved reading the Hunger Games!")
inputs`,highlighted:`inputs = tokenizer(<span class="hljs-string">&quot;I loved reading the Hunger Games!&quot;</span>)
inputs`}}),rl=new q({props:{code:"{'input_ids': [336, 259, 28387, 11807, 287, 62893, 295, 12507, 1], 'attention_mask': [1, 1, 1, 1, 1, 1, 1, 1, 1]}",highlighted:'{<span class="hljs-string">&#x27;input_ids&#x27;</span>: [<span class="hljs-number">336</span>, <span class="hljs-number">259</span>, <span class="hljs-number">28387</span>, <span class="hljs-number">11807</span>, <span class="hljs-number">287</span>, <span class="hljs-number">62893</span>, <span class="hljs-number">295</span>, <span class="hljs-number">12507</span>, <span class="hljs-number">1</span>], <span class="hljs-string">&#x27;attention_mask&#x27;</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>]}'}}),ol=new q({props:{code:"tokenizer.convert_ids_to_tokens(inputs.input_ids)",highlighted:"tokenizer.convert_ids_to_tokens(inputs.input_ids)"}}),pl=new q({props:{code:"['\u2581I', '\u2581', 'loved', '\u2581reading', '\u2581the', '\u2581Hung', 'er', '\u2581Games', '</s>']",highlighted:'[<span class="hljs-string">&#x27;\u2581I&#x27;</span>, <span class="hljs-string">&#x27;\u2581&#x27;</span>, <span class="hljs-string">&#x27;loved&#x27;</span>, <span class="hljs-string">&#x27;\u2581reading&#x27;</span>, <span class="hljs-string">&#x27;\u2581the&#x27;</span>, <span class="hljs-string">&#x27;\u2581Hung&#x27;</span>, <span class="hljs-string">&#x27;er&#x27;</span>, <span class="hljs-string">&#x27;\u2581Games&#x27;</span>, <span class="hljs-string">&#x27;&lt;/s&gt;&#x27;</span>]'}}),il=new q({props:{code:`max_input_length = 512
max_target_length = 30


def preprocess_function(examples):
    model_inputs = tokenizer(
        examples["review_body"], max_length=max_input_length, truncation=True
    )
    # Set up the tokenizer for targets
    with tokenizer.as_target_tokenizer():
        labels = tokenizer(
            examples["review_title"], max_length=max_target_length, truncation=True
        )

    model_inputs["labels"] = labels["input_ids"]
    return model_inputs`,highlighted:`max_input_length = <span class="hljs-number">512</span>
max_target_length = <span class="hljs-number">30</span>


<span class="hljs-keyword">def</span> <span class="hljs-title function_">preprocess_function</span>(<span class="hljs-params">examples</span>):
    model_inputs = tokenizer(
        examples[<span class="hljs-string">&quot;review_body&quot;</span>], max_length=max_input_length, truncation=<span class="hljs-literal">True</span>
    )
    <span class="hljs-comment"># Set up the tokenizer for targets</span>
    <span class="hljs-keyword">with</span> tokenizer.as_target_tokenizer():
        labels = tokenizer(
            examples[<span class="hljs-string">&quot;review_title&quot;</span>], max_length=max_target_length, truncation=<span class="hljs-literal">True</span>
        )

    model_inputs[<span class="hljs-string">&quot;labels&quot;</span>] = labels[<span class="hljs-string">&quot;input_ids&quot;</span>]
    <span class="hljs-keyword">return</span> model_inputs`}}),ml=new q({props:{code:"tokenized_datasets = books_dataset.map(preprocess_function, batched=True)",highlighted:'tokenized_datasets = books_dataset.<span class="hljs-built_in">map</span>(preprocess_function, batched=<span class="hljs-literal">True</span>)'}}),jt=new Pt({props:{$$slots:{default:[xd]},$$scope:{ctx:K}}}),ul=new Du({props:{id:"TMshhnrEXlg"}}),fl=new q({props:{code:`generated_summary = "I absolutely loved reading the Hunger Games"
reference_summary = "I loved reading the Hunger Games"`,highlighted:`generated_summary = <span class="hljs-string">&quot;I absolutely loved reading the Hunger Games&quot;</span>
reference_summary = <span class="hljs-string">&quot;I loved reading the Hunger Games&quot;</span>`}}),$t=new Pt({props:{$$slots:{default:[Td]},$$scope:{ctx:K}}}),gl=new q({props:{code:"!pip install rouge_score",highlighted:"!pip install rouge_score"}}),bl=new q({props:{code:`from datasets import load_metric

rouge_score = load_metric("rouge")`,highlighted:`<span class="hljs-keyword">from</span> datasets <span class="hljs-keyword">import</span> load_metric

rouge_score = load_metric(<span class="hljs-string">&quot;rouge&quot;</span>)`}}),jl=new q({props:{code:`scores = rouge_score.compute(
    predictions=[generated_summary], references=[reference_summary]
)
scores`,highlighted:`scores = rouge_score.compute(
    predictions=[generated_summary], references=[reference_summary]
)
scores`}}),vl=new q({props:{code:`{'rouge1': AggregateScore(low=Score(precision=0.86, recall=1.0, fmeasure=0.92), mid=Score(precision=0.86, recall=1.0, fmeasure=0.92), high=Score(precision=0.86, recall=1.0, fmeasure=0.92)),
 'rouge2': AggregateScore(low=Score(precision=0.67, recall=0.8, fmeasure=0.73), mid=Score(precision=0.67, recall=0.8, fmeasure=0.73), high=Score(precision=0.67, recall=0.8, fmeasure=0.73)),
 'rougeL': AggregateScore(low=Score(precision=0.86, recall=1.0, fmeasure=0.92), mid=Score(precision=0.86, recall=1.0, fmeasure=0.92), high=Score(precision=0.86, recall=1.0, fmeasure=0.92)),
 'rougeLsum': AggregateScore(low=Score(precision=0.86, recall=1.0, fmeasure=0.92), mid=Score(precision=0.86, recall=1.0, fmeasure=0.92), high=Score(precision=0.86, recall=1.0, fmeasure=0.92))}`,highlighted:`{<span class="hljs-string">&#x27;rouge1&#x27;</span>: AggregateScore(low=Score(precision=<span class="hljs-number">0.86</span>, recall=<span class="hljs-number">1.0</span>, fmeasure=<span class="hljs-number">0.92</span>), mid=Score(precision=<span class="hljs-number">0.86</span>, recall=<span class="hljs-number">1.0</span>, fmeasure=<span class="hljs-number">0.92</span>), high=Score(precision=<span class="hljs-number">0.86</span>, recall=<span class="hljs-number">1.0</span>, fmeasure=<span class="hljs-number">0.92</span>)),
 <span class="hljs-string">&#x27;rouge2&#x27;</span>: AggregateScore(low=Score(precision=<span class="hljs-number">0.67</span>, recall=<span class="hljs-number">0.8</span>, fmeasure=<span class="hljs-number">0.73</span>), mid=Score(precision=<span class="hljs-number">0.67</span>, recall=<span class="hljs-number">0.8</span>, fmeasure=<span class="hljs-number">0.73</span>), high=Score(precision=<span class="hljs-number">0.67</span>, recall=<span class="hljs-number">0.8</span>, fmeasure=<span class="hljs-number">0.73</span>)),
 <span class="hljs-string">&#x27;rougeL&#x27;</span>: AggregateScore(low=Score(precision=<span class="hljs-number">0.86</span>, recall=<span class="hljs-number">1.0</span>, fmeasure=<span class="hljs-number">0.92</span>), mid=Score(precision=<span class="hljs-number">0.86</span>, recall=<span class="hljs-number">1.0</span>, fmeasure=<span class="hljs-number">0.92</span>), high=Score(precision=<span class="hljs-number">0.86</span>, recall=<span class="hljs-number">1.0</span>, fmeasure=<span class="hljs-number">0.92</span>)),
 <span class="hljs-string">&#x27;rougeLsum&#x27;</span>: AggregateScore(low=Score(precision=<span class="hljs-number">0.86</span>, recall=<span class="hljs-number">1.0</span>, fmeasure=<span class="hljs-number">0.92</span>), mid=Score(precision=<span class="hljs-number">0.86</span>, recall=<span class="hljs-number">1.0</span>, fmeasure=<span class="hljs-number">0.92</span>), high=Score(precision=<span class="hljs-number">0.86</span>, recall=<span class="hljs-number">1.0</span>, fmeasure=<span class="hljs-number">0.92</span>))}`}}),$l=new q({props:{code:'scores["rouge1"].mid',highlighted:'scores[<span class="hljs-string">&quot;rouge1&quot;</span>].mid'}}),kl=new q({props:{code:"Score(precision=0.86, recall=1.0, fmeasure=0.92)",highlighted:'Score(precision=<span class="hljs-number">0.86</span>, recall=<span class="hljs-number">1.0</span>, fmeasure=<span class="hljs-number">0.92</span>)'}}),yt=new Pt({props:{$$slots:{default:[qd]},$$scope:{ctx:K}}}),wl=new ui({}),yl=new q({props:{code:"!pip install nltk",highlighted:"!pip install nltk"}}),El=new q({props:{code:`import nltk

nltk.download("punkt")`,highlighted:`<span class="hljs-keyword">import</span> nltk

nltk.download(<span class="hljs-string">&quot;punkt&quot;</span>)`}}),xl=new q({props:{code:`from nltk.tokenize import sent_tokenize


def three_sentence_summary(text):
    return "\\n".join(sent_tokenize(text)[:3])


print(three_sentence_summary(books_dataset["train"][1]["review_body"]))`,highlighted:`<span class="hljs-keyword">from</span> nltk.tokenize <span class="hljs-keyword">import</span> sent_tokenize


<span class="hljs-keyword">def</span> <span class="hljs-title function_">three_sentence_summary</span>(<span class="hljs-params">text</span>):
    <span class="hljs-keyword">return</span> <span class="hljs-string">&quot;\\n&quot;</span>.join(sent_tokenize(text)[:<span class="hljs-number">3</span>])


<span class="hljs-built_in">print</span>(three_sentence_summary(books_dataset[<span class="hljs-string">&quot;train&quot;</span>][<span class="hljs-number">1</span>][<span class="hljs-string">&quot;review_body&quot;</span>]))`}}),Tl=new q({props:{code:`'I grew up reading Koontz, and years ago, I stopped,convinced i had "outgrown" him.'
'Still,when a friend was looking for something suspenseful too read, I suggested Koontz.'
'She found Strangers.'`,highlighted:`<span class="hljs-string">&#x27;I grew up reading Koontz, and years ago, I stopped,convinced i had &quot;outgrown&quot; him.&#x27;</span>
<span class="hljs-string">&#x27;Still,when a friend was looking for something suspenseful too read, I suggested Koontz.&#x27;</span>
<span class="hljs-string">&#x27;She found Strangers.&#x27;</span>`}}),ql=new q({props:{code:`def evaluate_baseline(dataset, metric):
    summaries = [three_sentence_summary(text) for text in dataset["review_body"]]
    return metric.compute(predictions=summaries, references=dataset["review_title"])`,highlighted:`<span class="hljs-keyword">def</span> <span class="hljs-title function_">evaluate_baseline</span>(<span class="hljs-params">dataset, metric</span>):
    summaries = [three_sentence_summary(text) <span class="hljs-keyword">for</span> text <span class="hljs-keyword">in</span> dataset[<span class="hljs-string">&quot;review_body&quot;</span>]]
    <span class="hljs-keyword">return</span> metric.compute(predictions=summaries, references=dataset[<span class="hljs-string">&quot;review_title&quot;</span>])`}}),Sl=new q({props:{code:`import pandas as pd

score = evaluate_baseline(books_dataset["validation"], rouge_score)
rouge_names = ["rouge1", "rouge2", "rougeL", "rougeLsum"]
rouge_dict = dict((rn, round(score[rn].mid.fmeasure * 100, 2)) for rn in rouge_names)
rouge_dict`,highlighted:`<span class="hljs-keyword">import</span> pandas <span class="hljs-keyword">as</span> pd

score = evaluate_baseline(books_dataset[<span class="hljs-string">&quot;validation&quot;</span>], rouge_score)
rouge_names = [<span class="hljs-string">&quot;rouge1&quot;</span>, <span class="hljs-string">&quot;rouge2&quot;</span>, <span class="hljs-string">&quot;rougeL&quot;</span>, <span class="hljs-string">&quot;rougeLsum&quot;</span>]
rouge_dict = <span class="hljs-built_in">dict</span>((rn, <span class="hljs-built_in">round</span>(score[rn].mid.fmeasure * <span class="hljs-number">100</span>, <span class="hljs-number">2</span>)) <span class="hljs-keyword">for</span> rn <span class="hljs-keyword">in</span> rouge_names)
rouge_dict`}}),zl=new q({props:{code:"{'rouge1': 16.74, 'rouge2': 8.83, 'rougeL': 15.6, 'rougeLsum': 15.96}",highlighted:'{<span class="hljs-string">&#x27;rouge1&#x27;</span>: <span class="hljs-number">16.74</span>, <span class="hljs-string">&#x27;rouge2&#x27;</span>: <span class="hljs-number">8.83</span>, <span class="hljs-string">&#x27;rougeL&#x27;</span>: <span class="hljs-number">15.6</span>, <span class="hljs-string">&#x27;rougeLsum&#x27;</span>: <span class="hljs-number">15.96</span>}'}});const Au=[zd,Sd],Ml=[];function Lu(s,i){return s[0]==="pt"?0:1}Xe=Lu(K),Qe=Ml[Xe]=Au[Xe](K),qt=new Pt({props:{$$slots:{default:[Dd]},$$scope:{ctx:K}}}),Dl=new q({props:{code:`from huggingface_hub import notebook_login

notebook_login()`,highlighted:`<span class="hljs-keyword">from</span> huggingface_hub <span class="hljs-keyword">import</span> notebook_login

notebook_login()`}}),Rl=new q({props:{code:"huggingface-cli login",highlighted:'huggingface-<span class="hljs-keyword">cli</span> login'}});let Ds=K[0]==="pt"&&md();const Iu=[Od,Rd],Bl=[];function Nu(s,i){return s[0]==="pt"?0:1}Ze=Nu(K),sa=Bl[Ze]=Iu[Ze](K),Ol=new q({props:{code:`tokenized_datasets = tokenized_datasets.remove_columns(
    books_dataset["train"].column_names
)`,highlighted:`tokenized_datasets = tokenized_datasets.remove_columns(
    books_dataset[<span class="hljs-string">&quot;train&quot;</span>].column_names
)`}}),Pl=new q({props:{code:`features = [tokenized_datasets["train"][i] for i in range(2)]
data_collator(features)`,highlighted:`features = [tokenized_datasets[<span class="hljs-string">&quot;train&quot;</span>][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">2</span>)]
data_collator(features)`}}),Gl=new q({props:{code:`{'attention_mask': tensor([[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0],
        [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, 1, 1, 1, 1, 1, 1, 1]]), 'input_ids': tensor([[  1494,    259,   8622,    390,    259,    262,   2316,   3435,    955,
            772,    281,    772,   1617,    263,    305,  14701,    260,   1385,
           3031,    259,  24146,    332,   1037,    259,  43906,    305,    336,
            260,      1,      0,      0,      0,      0,      0,      0],
        [   259,  27531,  13483,    259,   7505,    260, 112240,  15192,    305,
          53198,    276,    259,  74060,    263,    260,    459,  25640,    776,
           2119,    336,    259,   2220,    259,  18896,    288,   4906,    288,
           1037,   3931,    260,   7083, 101476,   1143,    260,      1]]), 'labels': tensor([[ 7483,   259,  2364, 15695,     1,  -100],
        [  259, 27531, 13483,   259,  7505,     1]]), 'decoder_input_ids': tensor([[    0,  7483,   259,  2364, 15695,     1],
        [    0,   259, 27531, 13483,   259,  7505]])}`,highlighted:`{<span class="hljs-string">&#x27;attention_mask&#x27;</span>: tensor([[<span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>,
         <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">1</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>, <span class="hljs-number">0</span>],
        [<span class="hljs-number">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>, <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-string">&#x27;input_ids&#x27;</span>: tensor([[  <span class="hljs-number">1494</span>,    <span class="hljs-number">259</span>,   <span class="hljs-number">8622</span>,    <span class="hljs-number">390</span>,    <span class="hljs-number">259</span>,    <span class="hljs-number">262</span>,   <span class="hljs-number">2316</span>,   <span class="hljs-number">3435</span>,    <span class="hljs-number">955</span>,
            <span class="hljs-number">772</span>,    <span class="hljs-number">281</span>,    <span class="hljs-number">772</span>,   <span class="hljs-number">1617</span>,    <span class="hljs-number">263</span>,    <span class="hljs-number">305</span>,  <span class="hljs-number">14701</span>,    <span class="hljs-number">260</span>,   <span class="hljs-number">1385</span>,
           <span class="hljs-number">3031</span>,    <span class="hljs-number">259</span>,  <span class="hljs-number">24146</span>,    <span class="hljs-number">332</span>,   <span class="hljs-number">1037</span>,    <span class="hljs-number">259</span>,  <span class="hljs-number">43906</span>,    <span class="hljs-number">305</span>,    <span class="hljs-number">336</span>,
            <span class="hljs-number">260</span>,      <span class="hljs-number">1</span>,      <span class="hljs-number">0</span>,      <span class="hljs-number">0</span>,      <span class="hljs-number">0</span>,      <span class="hljs-number">0</span>,      <span class="hljs-number">0</span>,      <span class="hljs-number">0</span>],
        [   <span class="hljs-number">259</span>,  <span class="hljs-number">27531</span>,  <span class="hljs-number">13483</span>,    <span class="hljs-number">259</span>,   <span class="hljs-number">7505</span>,    <span class="hljs-number">260</span>, <span class="hljs-number">112240</span>,  <span class="hljs-number">15192</span>,    <span class="hljs-number">305</span>,
          <span class="hljs-number">53198</span>,    <span class="hljs-number">276</span>,    <span class="hljs-number">259</span>,  <span class="hljs-number">74060</span>,    <span class="hljs-number">263</span>,    <span class="hljs-number">260</span>,    <span class="hljs-number">459</span>,  <span class="hljs-number">25640</span>,    <span class="hljs-number">776</span>,
           <span class="hljs-number">2119</span>,    <span class="hljs-number">336</span>,    <span class="hljs-number">259</span>,   <span class="hljs-number">2220</span>,    <span class="hljs-number">259</span>,  <span class="hljs-number">18896</span>,    <span class="hljs-number">288</span>,   <span class="hljs-number">4906</span>,    <span class="hljs-number">288</span>,
           <span class="hljs-number">1037</span>,   <span class="hljs-number">3931</span>,    <span class="hljs-number">260</span>,   <span class="hljs-number">7083</span>, <span class="hljs-number">101476</span>,   <span class="hljs-number">1143</span>,    <span class="hljs-number">260</span>,      <span class="hljs-number">1</span>]]), <span class="hljs-string">&#x27;labels&#x27;</span>: tensor([[ <span class="hljs-number">7483</span>,   <span class="hljs-number">259</span>,  <span class="hljs-number">2364</span>, <span class="hljs-number">15695</span>,     <span class="hljs-number">1</span>,  -<span class="hljs-number">100</span>],
        [  <span class="hljs-number">259</span>, <span class="hljs-number">27531</span>, <span class="hljs-number">13483</span>,   <span class="hljs-number">259</span>,  <span class="hljs-number">7505</span>,     <span class="hljs-number">1</span>]]), <span class="hljs-string">&#x27;decoder_input_ids&#x27;</span>: tensor([[    <span class="hljs-number">0</span>,  <span class="hljs-number">7483</span>,   <span class="hljs-number">259</span>,  <span class="hljs-number">2364</span>, <span class="hljs-number">15695</span>,     <span class="hljs-number">1</span>],
        [    <span class="hljs-number">0</span>,   <span class="hljs-number">259</span>, <span class="hljs-number">27531</span>, <span class="hljs-number">13483</span>,   <span class="hljs-number">259</span>,  <span class="hljs-number">7505</span>]])}`}});const Cu=[Gd,Pd],Wl=[];function Uu(s,i){return s[0]==="pt"?0:1}ea=Uu(K),aa=Wl[ea]=Cu[ea](K);let Rs=K[0]==="pt"&&cd(K);return Ll=new q({props:{code:`from transformers import pipeline

hub_model_id = "huggingface-course/mt5-small-finetuned-amazon-en-es"
summarizer = pipeline("summarization", model=hub_model_id)`,highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> pipeline

hub_model_id = <span class="hljs-string">&quot;huggingface-course/mt5-small-finetuned-amazon-en-es&quot;</span>
summarizer = pipeline(<span class="hljs-string">&quot;summarization&quot;</span>, model=hub_model_id)`}}),Il=new q({props:{code:`def print_summary(idx):
    review = books_dataset["test"][idx]["review_body"]
    title = books_dataset["test"][idx]["review_title"]
    summary = summarizer(books_dataset["test"][idx]["review_body"])[0]["summary_text"]
    print(f"'>>> Review: {review}'")
    print(f"\\n'>>> Title: {title}'")
    print(f"\\n'>>> Summary: {summary}'")`,highlighted:`<span class="hljs-keyword">def</span> <span class="hljs-title function_">print_summary</span>(<span class="hljs-params">idx</span>):
    review = books_dataset[<span class="hljs-string">&quot;test&quot;</span>][idx][<span class="hljs-string">&quot;review_body&quot;</span>]
    title = books_dataset[<span class="hljs-string">&quot;test&quot;</span>][idx][<span class="hljs-string">&quot;review_title&quot;</span>]
    summary = summarizer(books_dataset[<span class="hljs-string">&quot;test&quot;</span>][idx][<span class="hljs-string">&quot;review_body&quot;</span>])[<span class="hljs-number">0</span>][<span class="hljs-string">&quot;summary_text&quot;</span>]
    <span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;&#x27;&gt;&gt;&gt; Review: <span class="hljs-subst">{review}</span>&#x27;&quot;</span>)
    <span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;\\n&#x27;&gt;&gt;&gt; Title: <span class="hljs-subst">{title}</span>&#x27;&quot;</span>)
    <span class="hljs-built_in">print</span>(<span class="hljs-string">f&quot;\\n&#x27;&gt;&gt;&gt; Summary: <span class="hljs-subst">{summary}</span>&#x27;&quot;</span>)`}}),Nl=new q({props:{code:"print_summary(100)",highlighted:'print_summary(<span class="hljs-number">100</span>)'}}),Cl=new q({props:{code:`'>>> Review: Nothing special at all about this product... the book is too small and stiff and hard to write in. The huge sticker on the back doesn\u2019t come off and looks super tacky. I would not purchase this again. I could have just bought a journal from the dollar store and it would be basically the same thing. It\u2019s also really expensive for what it is.'

'>>> Title: Not impressed at all... buy something else'

'>>> Summary: Nothing special at all about this product'`,highlighted:`<span class="hljs-string">&#x27;&gt;&gt;&gt; Review: Nothing special at all about this product... the book is too small and stiff and hard to write in. The huge sticker on the back doesn\u2019t come off and looks super tacky. I would not purchase this again. I could have just bought a journal from the dollar store and it would be basically the same thing. It\u2019s also really expensive for what it is.&#x27;</span>

<span class="hljs-string">&#x27;&gt;&gt;&gt; Title: Not impressed at all... buy something else&#x27;</span>

<span class="hljs-string">&#x27;&gt;&gt;&gt; Summary: Nothing special at all about this product&#x27;</span>`}}),Ul=new q({props:{code:"print_summary(0)",highlighted:'print_summary(<span class="hljs-number">0</span>)'}}),Hl=new q({props:{code:`'>>> Review: Es una trilogia que se hace muy facil de leer. Me ha gustado, no me esperaba el final para nada'

'>>> Title: Buena literatura para adolescentes'

'>>> Summary: Muy facil de leer'`,highlighted:`<span class="hljs-string">&#x27;&gt;&gt;&gt; Review: Es una trilogia que se hace muy facil de leer. Me ha gustado, no me esperaba el final para nada&#x27;</span>

<span class="hljs-string">&#x27;&gt;&gt;&gt; Title: Buena literatura para adolescentes&#x27;</span>

<span class="hljs-string">&#x27;&gt;&gt;&gt; Summary: Muy facil de leer&#x27;</span>`}}),{c(){h=n("meta"),v=c(),$(f.$$.fragment),E=c(),O=n("h1"),x=t("\u63D0\u53D6\u6587\u672C\u6458\u8981"),S=c(),P.c(),C=c(),N=n("p"),D=t("\u5728\u672C\u8282\u4E2D\uFF0C\u6211\u4EEC\u5C06\u770B\u770B\u5982\u4F55\u4F7F\u7528 Transformer \u6A21\u578B\u5C06\u957F\u6587\u6863\u538B\u7F29\u4E3A\u6458\u8981\uFF0C\u8FD9\u9879\u4EFB\u52A1\u79F0\u4E3A\u6587\u672C\u6458\u8981.\u8FD9\u662F\u6700\u5177\u6311\u6218\u6027\u7684 NLP \u4EFB\u52A1\u4E4B\u4E00\uFF0C\u56E0\u4E3A\u5B83\u9700\u8981\u4E00\u7CFB\u5217\u80FD\u529B\uFF0C\u4F8B\u5982\u7406\u89E3\u957F\u7BC7\u6587\u7AE0\u548C\u751F\u6210\u80FD\u591F\u6355\u6349\u6587\u6863\u4E2D\u4E3B\u8981\u4E3B\u9898\u7684\u8FDE\u8D2F\u6587\u672C\u3002\u4F46\u662F\uFF0C\u5982\u679C\u505A\u5F97\u597D\uFF0C\u6587\u672C\u6458\u8981\u662F\u4E00\u79CD\u5F3A\u5927\u7684\u5DE5\u5177\uFF0C\u53EF\u4EE5\u51CF\u8F7B\u9886\u57DF\u4E13\u5BB6\u8BE6\u7EC6\u9605\u8BFB\u957F\u6587\u6863\u7684\u8D1F\u62C5\uFF0C\u4ECE\u800C\u52A0\u5FEB\u5404\u79CD\u4E1A\u52A1\u6D41\u7A0B\u3002"),I=c(),$(U.$$.fragment),J=c(),M=n("p"),B=t("\u5C3D\u7BA1\u5728"),H=n("a"),Q=t("Hugging Face Hub"),z=t("\u4E0A\u5DF2\u7ECF\u5B58\u5728\u5404\u79CD\u5FAE\u8C03\u6A21\u578B\u7528\u4E8E\u6587\u672C\u6458\u8981\uFF0C\u51E0\u4E4E\u6240\u6709\u8FD9\u4E9B\u90FD\u53EA\u9002\u7528\u4E8E\u82F1\u6587\u6587\u6863\u3002\u56E0\u6B64\uFF0C\u4E3A\u4E86\u5728\u672C\u8282\u4E2D\u6DFB\u52A0\u4E00\u4E9B\u53D8\u5316\uFF0C\u6211\u4EEC\u5C06\u4E3A\u82F1\u8BED\u548C\u897F\u73ED\u7259\u8BED\u8BAD\u7EC3\u4E00\u4E2A\u53CC\u8BED\u6A21\u578B\u3002\u5728\u672C\u8282\u7ED3\u675F\u65F6\uFF0C\u60A8\u5C06\u6709\u4E00\u4E2A\u53EF\u4EE5\u603B\u7ED3\u5BA2\u6237\u8BC4\u8BBA\u7684"),G=n("a"),os=t("\u6A21\u578B"),ss=t("\u3002"),Z=c(),W=n("iframe"),ls=c(),V=n("iframe"),js=c(),ps=n("p"),vs=t("\u5982\u4E0B\u6240\u793A\uFF1A\u6B63\u5982\u6211\u4EEC\u5C06\u770B\u5230\u7684\uFF0C\u8FD9\u4E9B\u6458\u8981\u5F88\u7B80\u6D01\uFF0C\u56E0\u4E3A\u5B83\u4EEC\u662F\u4ECE\u5BA2\u6237\u5728\u4EA7\u54C1\u8BC4\u8BBA\u4E2D\u63D0\u4F9B\u7684\u6807\u9898\u4E2D\u5B66\u5230\u7684\u3002\u8BA9\u6211\u4EEC\u9996\u5148\u4E3A\u8FD9\u9879\u4EFB\u52A1\u51C6\u5907\u4E00\u4E2A\u5408\u9002\u7684\u53CC\u8BED\u8BED\u6599\u5E93\u3002"),Y=c(),cs=n("h2"),ys=t("\u51C6\u5907\u591A\u8BED\u8A00\u8BED\u6599\u5E93"),es=c(),ns=n("p"),rs=t("\u6211\u4EEC\u5C06\u4F7F\u7528"),is=n("a"),j=t("\u591A\u8BED\u8A00\u4E9A\u9A6C\u900A\u8BC4\u8BBA\u8BED\u6599\u5E93"),F=t("\u521B\u5EFA\u6211\u4EEC\u7684\u53CC\u8BED\u6458\u8981\u5668\u3002\u8BE5\u8BED\u6599\u5E93\u7531\u516D\u79CD\u8BED\u8A00\u7684\u4E9A\u9A6C\u900A\u4EA7\u54C1\u8BC4\u8BBA\u7EC4\u6210\uFF0C\u901A\u5E38\u7528\u4E8E\u5BF9\u591A\u8BED\u8A00\u5206\u7C7B\u5668\u8FDB\u884C\u57FA\u51C6\u6D4B\u8BD5\u3002\u7136\u800C\uFF0C\u7531\u4E8E\u6BCF\u6761\u8BC4\u8BBA\u90FD\u9644\u6709\u4E00\u4E2A\u7B80\u77ED\u7684\u6807\u9898\uFF0C\u6211\u4EEC\u53EF\u4EE5\u4F7F\u7528\u6807\u9898\u4F5C\u4E3A\u6211\u4EEC\u6A21\u578B\u5B66\u4E60\u7684\u76EE\u6807\u6458\u8981\uFF01\u9996\u5148\uFF0C\u8BA9\u6211\u4EEC\u4ECE Hugging Face Hub \u4E0B\u8F7D\u82F1\u8BED\u548C\u897F\u73ED\u7259\u8BED\u5B50\u96C6\uFF1A"),Ts=c(),$(as.$$.fragment),us=c(),$(ms.$$.fragment),g=c(),A=n("p"),qs=t("\u5982\u60A8\u6240\u89C1\uFF0C\u5BF9\u4E8E\u6BCF\u79CD\u8BED\u8A00\uFF0C\u90FD\u6709 200,000 \u6761\u8BC4\u8BBA "),hs=n("strong"),Ys=t("train"),Es=t(" \u62C6\u5206\uFF0C\u6BCF\u4E2A\u8BC4\u8BBA\u6709 5,000 \u6761\u8BC4\u8BBA "),_s=n("strong"),Cs=t("validation"),Js=t(" \u548C "),fs=n("strong"),Xs=t("test"),Ss=t(" \u5206\u88C2\u3002\u6211\u4EEC\u611F\u5174\u8DA3\u7684\u8BC4\u8BBA\u4FE1\u606F\u5305\u542B\u5728 "),ee=n("strong"),Us=t("review_body"),he=t(" \u548C "),Qs=n("strong"),Le=t("review_title"),fe=t(" \u5217\u3002\u8BA9\u6211\u4EEC\u901A\u8FC7\u521B\u5EFA\u4E00\u4E2A\u7B80\u5355\u7684\u51FD\u6570\u6765\u67E5\u770B\u4E00\u4E9B\u793A\u4F8B\uFF0C\u8BE5\u51FD\u6570\u4F7F\u7528\u6211\u4EEC\u5728"),Zs=n("a"),se=t("\u7B2C\u4E94\u7AE0"),de=t("\u5B66\u5230\u8FC7\uFF1A"),zs=c(),$(As.$$.fragment),L=c(),$(ts.$$.fragment),we=c(),$(ks.$$.fragment),ds=c(),Ls=n("p"),ta=t("\u6B64\u793A\u4F8B\u663E\u793A\u4E86\u4EBA\u4EEC\u901A\u5E38\u5728\u7F51\u4E0A\u627E\u5230\u7684\u8BC4\u8BBA\u7684\u591A\u6837\u6027\uFF0C\u4ECE\u6B63\u9762\u5230\u8D1F\u9762\uFF08\u4EE5\u53CA\u4ECB\u4E8E\u4E24\u8005\u4E4B\u95F4\u7684\u6240\u6709\u5185\u5BB9\uFF01\uFF09\u3002\u5C3D\u7BA1\u6807\u9898\u4E3A\u201Cmeh\u201D\u7684\u793A\u4F8B\u4FE1\u606F\u91CF\u4E0D\u5927\uFF0C\u4F46\u5176\u4ED6\u6807\u9898\u770B\u8D77\u6765\u50CF\u662F\u5BF9\u8BC4\u8BBA\u672C\u8EAB\u7684\u4F53\u9762\u603B\u7ED3\u3002\u5728\u5355\u4E2A GPU \u4E0A\u8BAD\u7EC3\u6240\u6709 400,000 \u6761\u8BC4\u8BBA\u7684\u6458\u8981\u6A21\u578B\u5C06\u82B1\u8D39\u592A\u957F\u65F6\u95F4\uFF0C\u56E0\u6B64\u6211\u4EEC\u5C06\u4E13\u6CE8\u4E8E\u4E3A\u5355\u4E2A\u4EA7\u54C1\u9886\u57DF\u751F\u6210\u6458\u8981\u3002\u4E3A\u4E86\u4E86\u89E3\u6211\u4EEC\u53EF\u4EE5\u9009\u62E9\u54EA\u4E9B\u57DF\uFF0C\u8BA9\u6211\u4EEC\u5C06 "),ae=n("strong"),la=t("english_dataset"),na=t(" \u8F6C\u6362\u5230 "),te=n("strong"),xs=t("pandas.DataFrame"),Ie=t(" \u5E76\u8BA1\u7B97\u6BCF\u4E2A\u4EA7\u54C1\u7C7B\u522B\u7684\u8BC4\u8BBA\u6570\u91CF\uFF1A"),le=c(),$(ne.$$.fragment),_e=c(),$(Os.$$.fragment),ye=c(),gs=n("p"),Hs=t("\u82F1\u8BED\u6570\u636E\u96C6\u4E2D\u6700\u53D7\u6B22\u8FCE\u7684\u4EA7\u54C1\u662F\u5BB6\u5C45\u7528\u54C1\u3001\u670D\u88C5\u548C\u65E0\u7EBF\u7535\u5B50\u4EA7\u54C1\u3002\u4E0D\u8FC7\uFF0C\u4E3A\u4E86\u575A\u6301\u4E9A\u9A6C\u900A\u7684\u4E3B\u9898\uFF0C\u8BA9\u6211\u4EEC\u4E13\u6CE8\u4E8E\u603B\u7ED3\u4E66\u7C4D\u7684\u8BC4\u8BBA\u2014\u2014\u6BD5\u7ADF\uFF0C\u8FD9\u662F\u4E9A\u9A6C\u900A\u8FD9\u5BB6\u516C\u53F8\u6210\u7ACB\u7684\u57FA\u7840\uFF01\u6211\u4EEC\u53EF\u4EE5\u770B\u5230\u4E24\u4E2A\u7B26\u5408\u8981\u6C42\u7684\u4EA7\u54C1\u7C7B\u522B\uFF08 "),ge=n("strong"),re=t("book"),Ne=t(" \u548C "),Fs=n("strong"),Gt=t("digital_ebook_purchase"),Ea=t(" )\uFF0C\u6240\u4EE5\u8BA9\u6211\u4EEC\u4E3A\u8FD9\u4E9B\u4EA7\u54C1\u8FC7\u6EE4\u4E24\u79CD\u8BED\u8A00\u7684\u6570\u636E\u96C6\u3002\u6B63\u5982\u6211\u4EEC\u5728"),ra=n("a"),At=t("\u7B2C\u4E94\u7AE0"),xa=t("\u5B66\u5230\u7684\uFF0C \u8FD9 "),Ta=n("strong"),Lt=t("Dataset.filter()"),et=t(" \u51FD\u6570\u5141\u8BB8\u6211\u4EEC\u975E\u5E38\u6709\u6548\u5730\u5BF9\u6570\u636E\u96C6\u8FDB\u884C\u5207\u7247\uFF0C\u56E0\u6B64\u6211\u4EEC\u53EF\u4EE5\u5B9A\u4E49\u4E00\u4E2A\u7B80\u5355\u7684\u51FD\u6570\u6765\u6267\u884C\u6B64\u64CD\u4F5C\uFF1A"),Ce=c(),$(Ue.$$.fragment),qa=c(),bs=n("p"),at=t("\u73B0\u5728\uFF0C\u5F53\u6211\u4EEC\u5C06\u6B64\u51FD\u6570\u5E94\u7528\u4E8E "),be=n("strong"),tt=t("english_dataset"),oa=t(" \u548C "),Sa=n("strong"),lt=t("spanish_dataset"),He=t(" \uFF0C\u7ED3\u679C\u5C06\u53EA\u5305\u542B\u6D89\u53CA\u4E66\u7C4D\u7C7B\u522B\u7684\u90A3\u4E9B\u884C\u3002\u5728\u5E94\u7528\u8FC7\u6EE4\u5668\u4E4B\u524D\uFF0C\u8BA9\u6211\u4EEC\u5C06"),pa=n("strong"),Ee=t("english_dataset"),It=t("\u7684\u683C\u5F0F\u4ECE "),Fe=n("strong"),Nt=t("pandas"),Ct=t(" \u5207\u6362\u56DE\u5230 "),ia=n("strong"),Me=t("arrow"),Ut=t(" \uFF1A"),za=c(),$(oe.$$.fragment),nt=c(),Be=n("p"),Ms=t("\u7136\u540E\u6211\u4EEC\u53EF\u4EE5\u5E94\u7528\u8FC7\u6EE4\u5668\u529F\u80FD\uFF0C\u4F5C\u4E3A\u5065\u5168\u6027\u68C0\u67E5\uFF0C\u8BA9\u6211\u4EEC\u68C0\u67E5\u8BC4\u8BBA\u6837\u672C\uFF0C\u770B\u770B\u5B83\u4EEC\u662F\u5426\u786E\u5B9E\u4E0E\u4E66\u7C4D\u6709\u5173\uFF1A"),xe=c(),$(We.$$.fragment),ma=c(),$(Ke.$$.fragment),rt=c(),Bs=n("p"),Da=t("\u597D\u7684\uFF0C\u6211\u4EEC\u53EF\u4EE5\u770B\u5230\u8BC4\u8BBA\u5E76\u4E0D\u662F\u4E25\u683C\u610F\u4E49\u4E0A\u7684\u4E66\u7C4D\uFF0C\u53EF\u80FD\u662F\u6307\u65E5\u5386\u548C OneNote \u7B49\u7535\u5B50\u5E94\u7528\u7A0B\u5E8F\u7B49\u5185\u5BB9\u3002\u5C3D\u7BA1\u5982\u6B64\uFF0C\u8BE5\u9886\u57DF\u4F3C\u4E4E\u9002\u5408\u8BAD\u7EC3\u6458\u8981\u6A21\u578B\u3002\u5728\u6211\u4EEC\u67E5\u770B\u9002\u5408\u6B64\u4EFB\u52A1\u7684\u5404\u79CD\u6A21\u578B\u4E4B\u524D\uFF0C\u6211\u4EEC\u8FD8\u6709\u6700\u540E\u4E00\u70B9\u6570\u636E\u51C6\u5907\u8981\u505A\uFF1A\u5C06\u82F1\u8BED\u548C\u897F\u73ED\u7259\u8BED\u8BC4\u8BBA\u5408\u5E76\u4E3A\u4E00\u4E2A "),Ra=n("strong"),Ht=t("DatasetDict"),Oa=t(" \u76EE\u7684\u3002 \u{1F917} Datasets \u63D0\u4F9B\u4E86\u4E00\u4E2A\u65B9\u4FBF\u7684 "),Pa=n("strong"),Ft=t("concatenate_datasets()"),je=t(" \u51FD\u6570\uFF08\u987E\u540D\u601D\u4E49\uFF09\u5408\u5E76 "),Ga=n("strong"),Aa=t("Dataset"),Mt=t(" \u5BF9\u8C61\u3002\u56E0\u6B64\uFF0C\u4E3A\u4E86\u521B\u5EFA\u6211\u4EEC\u7684\u53CC\u8BED\u6570\u636E\u96C6\uFF0C\u6211\u4EEC\u5C06\u904D\u5386\u6BCF\u4E2A\u62C6\u5206\uFF0C\u8FDE\u63A5\u8BE5\u62C6\u5206\u7684\u6570\u636E\u96C6\uFF0C\u5E76\u6253\u4E71\u7ED3\u679C\u4EE5\u786E\u4FDD\u6211\u4EEC\u7684\u6A21\u578B\u4E0D\u4F1A\u8FC7\u5EA6\u62DF\u5408\u5355\u4E00\u8BED\u8A00\uFF1A"),ot=c(),$(ve.$$.fragment),pt=c(),$(Ve.$$.fragment),La=c(),$e=n("p"),Bt=t("\u8FD9\u5F53\u7136\u770B\u8D77\u6765\u50CF\u662F\u82F1\u8BED\u548C\u897F\u73ED\u7259\u8BED\u8BC4\u8BBA\u7684\u6DF7\u5408\uFF01\u73B0\u5728\u6211\u4EEC\u6709\u4E86\u4E00\u4E2A\u8BAD\u7EC3\u8BED\u6599\u5E93\uFF0C\u6700\u540E\u8981\u68C0\u67E5\u7684\u4E00\u4EF6\u4E8B\u662F\u8BC4\u8BBA\u4E2D\u5355\u8BCD\u7684\u5206\u5E03\u53CA\u5176\u6807\u9898\u3002\u8FD9\u5BF9\u4E8E\u6458\u8981\u4EFB\u52A1\u5C24\u5176\u91CD\u8981\uFF0C\u5176\u4E2D\u6570\u636E\u4E2D\u7684\u7B80\u77ED\u53C2\u8003\u6458\u8981\u4F1A\u4F7F\u6A21\u578B\u504F\u5411\u4E8E\u4EC5\u5728\u751F\u6210\u7684\u6458\u8981\u4E2D\u8F93\u51FA\u4E00\u4E24\u4E2A\u5355\u8BCD\u3002\u4E0B\u9762\u7684\u56FE\u663E\u793A\u4E86\u5355\u8BCD\u5206\u5E03\uFF0C\u6211\u4EEC\u53EF\u4EE5\u770B\u5230\u6709\u4E9B\u6807\u9898\u4E25\u91CD\u504F\u5411\u4E8E 1-2 \u4E2A\u5355\u8BCD\uFF1A"),Ia=c(),Is=n("div"),Te=n("img"),it=c(),pe=n("img"),Na=c(),m=n("p"),T=t("\u4E3A\u4E86\u89E3\u51B3\u8FD9\u4E2A\u95EE\u9898\uFF0C\u6211\u4EEC\u5C06\u8FC7\u6EE4\u6389\u6807\u9898\u975E\u5E38\u77ED\u7684\u793A\u4F8B\uFF0C\u4EE5\u4FBF\u6211\u4EEC\u7684\u6A21\u578B\u53EF\u4EE5\u751F\u6210\u66F4\u6709\u8DA3\u7684\u6458\u8981\u3002\u7531\u4E8E\u6211\u4EEC\u6B63\u5728\u5904\u7406\u82F1\u6587\u548C\u897F\u73ED\u7259\u6587\u6587\u672C\uFF0C\u56E0\u6B64\u6211\u4EEC\u53EF\u4EE5\u4F7F\u7528\u7C97\u7565\u7684\u542F\u53D1\u5F0F\u65B9\u6CD5\u5728\u7A7A\u767D\u5904\u62C6\u5206\u6807\u9898\uFF0C\u7136\u540E\u4F7F\u7528\u6211\u4EEC\u53EF\u4FE1\u8D56\u7684 "),mt=n("strong"),Yl=t("Dataset.filter()"),Jl=t(" \u65B9\u6CD5\u5982\u4E0B\uFF1A"),Ye=c(),$(ua.$$.fragment),Wt=c(),Ca=n("p"),ie=t("\u73B0\u5728\u6211\u4EEC\u5DF2\u7ECF\u51C6\u5907\u597D\u4E86\u6211\u4EEC\u7684\u8BED\u6599\u5E93\uFF0C\u8BA9\u6211\u4EEC\u6765\u770B\u770B\u4E00\u4E9B\u53EF\u4EE5\u5BF9\u5176\u8FDB\u884C\u5FAE\u8C03\u7684\u53EF\u80FD\u7684 Transformer \u6A21\u578B\uFF01"),Kt=c(),ha=n("h2"),Xl=t("\u6587\u672C\u6458\u8981\u6A21\u578B"),Vt=c(),ke=n("p"),Ql=t("\u5982\u679C\u4F60\u4ED4\u7EC6\u60F3\u60F3\uFF0C\u6587\u672C\u6458\u8981\u662F\u4E00\u79CD\u7C7B\u4F3C\u4E8E\u673A\u5668\u7FFB\u8BD1\u7684\u4EFB\u52A1\uFF1A\u6211\u4EEC\u6709\u4E00\u4E2A\u50CF\u8BC4\u8BBA\u8FD9\u6837\u7684\u6587\u672C\u6B63\u6587\uFF0C\u6211\u4EEC\u5E0C\u671B\u5C06\u5176\u201C\u7FFB\u8BD1\u201D\u6210\u4E00\u4E2A\u8F83\u77ED\u7684\u7248\u672C\uFF0C\u4EE5\u6355\u6349\u8F93\u5165\u7684\u663E\u7740\u7279\u5F81\u3002\u56E0\u6B64\uFF0C\u5927\u591A\u6570\u7528\u4E8E\u6587\u672C\u6458\u8981\u7684 Transformer \u6A21\u578B\u91C7\u7528\u4E86\u6211\u4EEC\u5728"),Ua=n("a"),ct=t("\u7B2C\u4E00\u7AE0"),Zl=t("\u9047\u5230\u7684\u7F16\u7801\u5668-\u89E3\u7801\u5668\u67B6\u6784\u3002\u5C3D\u7BA1\u6709\u4E00\u4E9B\u4F8B\u5916\uFF0C\u4F8B\u5982 GPT \u7CFB\u5217\u6A21\u578B\uFF0C\u5B83\u4EEC\u5728few-shot\uFF08\u5C11\u91CF\u5FAE\u8C03\uFF09\u4E4B\u540E\u4E5F\u53EF\u4EE5\u63D0\u53D6\u6458\u8981\u3002\u4E0B\u8868\u5217\u51FA\u4E86\u4E00\u4E9B\u6D41\u884C\u7684\u9884\u8BAD\u7EC3\u6A21\u578B\uFF0C\u53EF\u4EE5\u5BF9\u5176\u8FDB\u884C\u5FAE\u8C03\u4EE5\u8FDB\u884C\u6C47\u603B\u3002"),Ha=c(),Je=n("table"),ut=n("thead"),Ws=n("tr"),Fa=n("th"),sn=t("Transformer \u6A21\u578B"),en=c(),ht=n("th"),an=t("\u63CF\u8FF0"),fa=c(),Ma=n("th"),tn=t("\u591A\u79CD\u8BED\u8A00?"),ln=c(),Ps=n("tbody"),me=n("tr"),Ba=n("td"),da=n("a"),nn=t("GPT-2"),qe=c(),_a=n("td"),rn=t("\u867D\u7136\u8BAD\u7EC3\u4E3A\u81EA\u56DE\u5F52\u8BED\u8A00\u6A21\u578B\uFF0C\u4F46\u60A8\u53EF\u4EE5\u901A\u8FC7\u5728\u8F93\u5165\u6587\u672C\u672B\u5C3E\u9644\u52A0\u201CTL;DR\u201D\u6765\u4F7F GPT-2 \u751F\u6210\u6458\u8981\u3002"),on=c(),Wa=n("td"),ga=t("\u274C"),pn=c(),Se=n("tr"),Ka=n("td"),ba=n("a"),hi=t("PEGASUS"),fi=c(),mr=n("td"),di=t("\u5728\u9884\u8BAD\u7EC3\u662F\u7684\u76EE\u6807\u662F\u6765\u9884\u6D4B\u591A\u53E5\u5B50\u6587\u672C\u4E2D\u7684\u5C4F\u853D\u53E5\u5B50\u3002 \u8FD9\u4E2A\u9884\u8BAD\u7EC3\u76EE\u6807\u6BD4\u666E\u901A\u8BED\u8A00\u5EFA\u6A21\u66F4\u63A5\u8FD1\u6587\u672C\u6458\u8981\uFF0C\u5E76\u4E14\u5728\u6D41\u884C\u7684\u57FA\u51C6\u6D4B\u8BD5\u4E2D\u5F97\u5206\u5F88\u9AD8\u3002"),_i=c(),mn=n("td"),gi=t("\u274C"),bi=c(),Va=n("tr"),cn=n("td"),Yt=n("a"),ji=t("T5"),vi=c(),Jt=n("td"),$i=t("\u901A\u7528\u7684 Transformer \u67B6\u6784\uFF0C\u5728\u6587\u672C\u5230\u6587\u672C\u7684\u6846\u67B6\u4E2D\u5236\u5B9A\u6240\u6709\u4EFB\u52A1\uFF1B \u4F8B\u5982\uFF0C\u6A21\u578B\u6587\u672C\u6458\u8981\u7684\u8F93\u5165\u683C\u5F0F\u662F"),cr=n("code"),ki=t("summarize: ARTICLE"),wi=t("\u3002"),yi=c(),un=n("td"),Ei=t("\u274C"),xi=c(),Ya=n("tr"),hn=n("td"),Xt=n("a"),Ti=t("mT5"),qi=c(),ur=n("td"),Si=t("T5 \u7684\u591A\u8BED\u8A00\u7248\u672C\uFF0C\u5728\u591A\u8BED\u8A00 Common Crawl \u8BED\u6599\u5E93 (mC4) \u4E0A\u8FDB\u884C\u9884\u8BAD\u7EC3\uFF0C\u6DB5\u76D6 101 \u79CD\u8BED\u8A00\u3002"),zi=c(),fn=n("td"),Di=t("\u2705"),Ri=c(),Ja=n("tr"),dn=n("td"),Qt=n("a"),Oi=t("BART"),Pi=c(),hr=n("td"),Gi=t("\u4E00\u79CD\u65B0\u9896\u7684 Transformer \u67B6\u6784\uFF0C\u5176\u4E2D\u5305\u542B\u7ECF\u8FC7\u8BAD\u7EC3\u7684\u7F16\u7801\u5668\u548C\u89E3\u7801\u5668\u5806\u6808\uFF0C\u4EE5\u91CD\u5EFA\u88AB\u7834\u574F\u7684\u8F93\u5165\uFF0C\u7ED3\u5408\u4E86 BERT \u548C GPT-2 \u7684\u9884\u8BAD\u7EC3\u65B9\u6848\u3002"),Ai=c(),_n=n("td"),Li=t("\u274C"),Ii=c(),Xa=n("tr"),gn=n("td"),Zt=n("a"),Ni=t("mBART-50"),Ci=c(),fr=n("td"),Ui=t("BART \u7684\u591A\u8BED\u8A00\u7248\u672C\uFF0C\u9884\u8BAD\u7EC3\u4E86 50 \u79CD\u8BED\u8A00\u3002"),Hi=c(),bn=n("td"),Fi=t("\u2705"),fo=c(),jn=n("p"),Mi=t("\u4ECE\u6B64\u8868\u4E2D\u53EF\u4EE5\u770B\u51FA\uFF0C\u5927\u591A\u6570\u7528\u4E8E\u6458\u8981\u7684 Transformer \u6A21\u578B\uFF08\u4EE5\u53CA\u5927\u591A\u6570 NLP \u4EFB\u52A1\uFF09\u90FD\u662F\u5355\u8BED\u7684\u3002\u5982\u679C\u60A8\u7684\u4EFB\u52A1\u662F\u4F7F\u7528\u201C\u6709\u5927\u91CF\u8BED\u6599\u5E93\u201D\u7684\u8BED\u8A00\uFF08\u5982\u82F1\u8BED\u6216\u5FB7\u8BED\uFF09\uFF0C\u8FD9\u5F88\u597D\uFF0C\u4F46\u5BF9\u4E8E\u4E16\u754C\u5404\u5730\u6B63\u5728\u4F7F\u7528\u7684\u6570\u5343\u79CD\u5176\u4ED6\u8BED\u8A00\uFF0C\u5219\u4E0D\u7136\u3002\u5E78\u8FD0\u7684\u662F\uFF0C\u6709\u4E00\u7C7B\u591A\u8BED\u8A00 Transformer \u6A21\u578B\uFF0C\u5982 mT5 \u548C mBART\uFF0C\u53EF\u4EE5\u89E3\u51B3\u95EE\u9898\u3002\u8FD9\u4E9B\u6A21\u578B\u662F\u4F7F\u7528\u8BED\u8A00\u5EFA\u6A21\u8FDB\u884C\u9884\u8BAD\u7EC3\u7684\uFF0C\u4F46\u6709\u4E00\u70B9\u4E0D\u540C\uFF1A\u5B83\u4EEC\u4E0D\u662F\u5728\u4E00\u79CD\u8BED\u8A00\u7684\u8BED\u6599\u5E93\u4E0A\u8BAD\u7EC3\uFF0C\u800C\u662F\u540C\u65F6\u5728 50 \u591A\u79CD\u8BED\u8A00\u7684\u6587\u672C\u4E0A\u8FDB\u884C\u8054\u5408\u8BAD\u7EC3\uFF01"),_o=c(),ft=n("p"),Bi=t("\u6211\u4EEC\u5C06\u4F7F\u7528 mT5\uFF0C\u8FD9\u662F\u4E00\u79CD\u57FA\u4E8E T5 \u7684\u6709\u8DA3\u67B6\u6784\uFF0C\u5728\u6587\u672C\u5230\u6587\u672C\u6846\u67B6\u4E2D\u8FDB\u884C\u4E86\u9884\u8BAD\u7EC3\u3002\u5728 T5 \u4E2D\uFF0C\u6BCF\u4E2A NLP \u4EFB\u52A1\u90FD\u662F\u6839\u636E\u63D0\u793A\u524D\u7F00\u6765\u5236\u5B9A\u7684\uFF0C\u4F8B\u5982 "),dr=n("strong"),Wi=t("summarize:"),Ki=t(" \u8FD9\u4F7F\u6A21\u578B\u4F7F\u751F\u6210\u7684\u6587\u672C\u9002\u5E94\u63D0\u793A\u3002\u5982\u4E0B\u56FE\u6240\u793A\uFF0C\u8FD9\u8BA9 T5 \u53D8\u5F97\u975E\u5E38\u901A\u7528\uFF0C\u56E0\u4E3A\u4F60\u53EF\u4EE5\u7528\u4E00\u4E2A\u6A21\u578B\u89E3\u51B3\u5F88\u591A\u4EFB\u52A1\uFF01"),go=c(),Qa=n("div"),sl=n("img"),Vi=c(),el=n("img"),bo=c(),vn=n("p"),Yi=t("mT5 \u4E0D\u4F7F\u7528\u524D\u7F00\uFF0C\u4F46\u5177\u6709 T5 \u7684\u5927\u90E8\u5206\u529F\u80FD\uFF0C\u5E76\u4E14\u5177\u6709\u591A\u8BED\u8A00\u7684\u4F18\u52BF\u3002\u73B0\u5728\u6211\u4EEC\u5DF2\u7ECF\u9009\u62E9\u4E86\u4E00\u4E2A\u6A21\u578B\uFF0C\u8BA9\u6211\u4EEC\u6765\u770B\u770B\u51C6\u5907\u6211\u4EEC\u7684\u8BAD\u7EC3\u6570\u636E\u3002"),jo=c(),$(dt.$$.fragment),vo=c(),al=n("h2"),Ji=t("\u9884\u5904\u7406\u6570\u636E"),$o=c(),$(tl.$$.fragment),ko=c(),_t=n("p"),Xi=t("\u6211\u4EEC\u7684\u4E0B\u4E00\u4E2A\u4EFB\u52A1\u662F\u5BF9\u6211\u4EEC\u7684\u8BC4\u8BBA\u53CA\u5176\u6807\u9898\u8FDB\u884C\u6807\u8BB0\u548C\u7F16\u7801\u3002\u50CF\u5F80\u5E38\u4E00\u6837\uFF0C\u6211\u4EEC\u9996\u5148\u52A0\u8F7D\u4E0E\u9884\u8BAD\u7EC3\u6A21\u578B\u68C0\u67E5\u70B9\u76F8\u5173\u7684\u6807\u8BB0\u5668\u3002\u6211\u4EEC\u5C06\u4F7F\u7528 "),_r=n("strong"),Qi=t("mt5-small"),Zi=t(" \u4F5C\u4E3A\u6211\u4EEC\u7684\u68C0\u67E5\u70B9\uFF0C\u4EE5\u4FBF\u6211\u4EEC\u53EF\u4EE5\u5728\u5408\u7406\u7684\u65F6\u95F4\u5185\u5FAE\u8C03\u6A21\u578B\uFF1A"),wo=c(),$(ll.$$.fragment),yo=c(),$(gt.$$.fragment),Eo=c(),$n=n("p"),sm=t("\u8BA9\u6211\u4EEC\u5728\u4E00\u4E2A\u5C0F\u4F8B\u5B50\u4E0A\u6D4B\u8BD5 mT5 \u6807\u8BB0\u5668\uFF1A"),xo=c(),$(nl.$$.fragment),To=c(),$(rl.$$.fragment),qo=c(),ce=n("p"),em=t("\u5728\u8FD9\u91CC\u6211\u4EEC\u53EF\u4EE5\u770B\u5230\u6211\u4EEC\u5728"),kn=n("a"),am=t("\u7B2C\u4E09\u7AE0"),tm=t("\u7B2C\u4E00\u6B21\u5FAE\u8C03\u5B9E\u9A8C\u4E2D\u9047\u5230\u7684\u719F\u6089\u7684 "),gr=n("strong"),lm=t("input_ids"),nm=t(" \u548C "),br=n("strong"),rm=t("attention_mask"),om=t(" .\u8BA9\u6211\u4EEC\u7528\u5206\u8BCD\u5668\u89E3\u7801\u8FD9\u4E9B\u8F93\u5165 ID \uFF0C\u53EF\u4EE5"),jr=n("strong"),pm=t("convert_ids_to_tokens()"),im=t(" \u51FD\u6570\u6765\u67E5\u770B\u6211\u4EEC\u6B63\u5728\u5904\u7406\u4EC0\u4E48\u6837\u7684\u6807\u8BB0\u5668\uFF1A"),So=c(),$(ol.$$.fragment),zo=c(),$(pl.$$.fragment),Do=c(),ze=n("p"),mm=t("\u7279\u6B8A\u7684 Unicode \u5B57\u7B26 "),vr=n("code"),cm=t("\u2581"),um=t(" \u548C\u5E8F\u5217\u7ED3\u675F\u6807\u8BB0 "),$r=n("code"),hm=t("</s>"),fm=t(" \u8868\u660E\u6211\u4EEC\u6B63\u5728\u5904\u7406 SentencePiece \u5206\u8BCD\u5668\uFF0C\u5B83\u57FA\u4E8E\u5728"),wn=n("a"),dm=t("\u7B2C\u516D\u7AE0"),_m=t("\u4E2D\u8BA8\u8BBA\u7684Unigram\u5206\u8BCD\u7B97\u6CD5. Unigram \u5BF9\u591A\u8BED\u8A00\u8BED\u6599\u5E93\u7279\u522B\u6709\u7528\uFF0C\u56E0\u4E3A\u5B83\u5141\u8BB8 SentencePiece \u4E0D\u77E5\u9053\u91CD\u97F3\u3001\u6807\u70B9\u7B26\u53F7\u4EE5\u53CA\u8BB8\u591A\u8BED\u8A00\uFF08\u5982\u65E5\u8BED\uFF09\u6CA1\u6709\u7A7A\u683C\u5B57\u7B26\u3002"),Ro=c(),bt=n("p"),gm=t("\u4E3A\u4E86\u6807\u8BB0\u6211\u4EEC\u7684\u8BED\u6599\u5E93\uFF0C\u6211\u4EEC\u5FC5\u987B\u5904\u7406\u4E0E\u6458\u8981\u76F8\u5173\u7684\u7EC6\u8282\uFF1A\u56E0\u4E3A\u6211\u4EEC\u7684\u6807\u7B7E\u4E5F\u662F\u6587\u672C\uFF0C\u5B83\u4EEC\u53EF\u80FD\u4F1A\u8D85\u8FC7\u6A21\u578B\u7684\u6700\u5927\u4E0A\u4E0B\u6587\u5927\u5C0F\u3002\u8FD9\u610F\u5473\u7740\u6211\u4EEC\u9700\u8981\u5BF9\u8BC4\u8BBA\u53CA\u5176\u6807\u9898\u8FDB\u884C\u622A\u65AD\uFF0C\u4EE5\u786E\u4FDD\u6211\u4EEC\u4E0D\u4F1A\u5C06\u8FC7\u957F\u7684\u8F93\u5165\u4F20\u9012\u7ED9\u6211\u4EEC\u7684\u6A21\u578B\u3002 \u{1F917} Transformers \u4E2D\u7684\u5206\u8BCD\u5668\u63D0\u4F9B\u4E86\u4E00\u4E2A\u6F02\u4EAE\u7684 "),kr=n("strong"),bm=t("as_target_tokenizer()"),jm=t(" \u51FD\u6570\uFF0C\u5B83\u5141\u8BB8\u60A8\u5E76\u884C\u5206\u8BCD\u5E76\u6807\u8BB0\u6807\u7B7E\u7684\u51FD\u6570\u3002\u8FD9\u901A\u5E38\u662F\u4F7F\u7528\u9884\u5904\u7406\u51FD\u6570\u5185\u7684\u4E0A\u4E0B\u6587\u7BA1\u7406\u5668\u5B8C\u6210\u7684\uFF0C\u8BE5\u51FD\u6570\u9996\u5148\u5BF9\u8F93\u5165\u8FDB\u884C\u7F16\u7801\uFF0C\u7136\u540E\u5C06\u6807\u7B7E\u7F16\u7801\u4E3A\u5355\u72EC\u7684\u5217\u3002\u4EE5\u4E0B\u662F mT5 \u7684\u6B64\u51FD\u6570\u7684\u793A\u4F8B\uFF1A"),Oo=c(),$(il.$$.fragment),Po=c(),ue=n("p"),vm=t("\u8BA9\u6211\u4EEC\u901A\u8FC7\u8FD9\u6BB5\u4EE3\u7801\u6765\u4E86\u89E3\u53D1\u751F\u4E86\u4EC0\u4E48\u3002\u6211\u4EEC\u505A\u7684\u7B2C\u4E00\u4EF6\u4E8B\u662F\u5B9A\u4E49\u503C "),wr=n("strong"),$m=t("max_input_length"),km=t(" \u548C "),yr=n("strong"),wm=t("max_target_length"),ym=t(" \uFF0C\u5B83\u4E3A\u6211\u4EEC\u7684\u8BC4\u8BBA\u548C\u6807\u9898\u7684\u957F\u5EA6\u8BBE\u7F6E\u4E86\u4E0A\u9650\u3002\u7531\u4E8E\u8BC4\u8BBA\u6B63\u6587\u901A\u5E38\u6BD4\u6807\u9898\u5927\u5F97\u591A\uFF0C\u6211\u4EEC\u76F8\u5E94\u5730\u8C03\u6574\u4E86\u8FD9\u4E9B\u503C\u3002\u7136\u540E\uFF0C\u5728 "),Er=n("strong"),Em=t("preprocess_function()"),xm=t(" \u6211\u4EEC\u53EF\u4EE5\u770B\u5230\u8BC4\u8BBA\u9996\u5148\u88AB\u6807\u8BB0\u5316\uFF0C\u7136\u540E\u662F\u6807\u9898\u5728 "),xr=n("strong"),Tm=t("as_target_tokenizer()"),qm=t(" \u51FD\u6570\u91CC\u4E5F\u505A\u4E86\u76F8\u540C\u7684\u5904\u7406."),Go=c(),ja=n("p"),Sm=t("\u6709\u4E86 "),Tr=n("code"),zm=t("preprocess_function()"),Dm=t("\uFF0C\u6211\u4EEC\u5728\u6574\u4E2A\u8BFE\u7A0B\u4E2D\u5E7F\u6CDB\u4F7F\u7528\u7684\u65B9\u4FBF\u7684 "),qr=n("code"),Rm=t("Dataset.map()"),Om=t(" \u51FD\u6570\u6765\u6807\u8BB0\u6574\u4E2A\u8BED\u6599\u5E93\u662F\u4E00\u4EF6\u7B80\u5355\u7684\u4E8B\u60C5\uFF1A"),Ao=c(),$(ml.$$.fragment),Lo=c(),yn=n("p"),Pm=t("\u65E2\u7136\u8BED\u6599\u5E93\u5DF2\u7ECF\u9884\u5904\u7406\u5B8C\u6BD5\uFF0C\u6211\u4EEC\u6765\u770B\u770B\u4E00\u4E9B\u5E38\u7528\u7684\u6458\u8981\u6307\u6807\u3002\u6B63\u5982\u6211\u4EEC\u5C06\u770B\u5230\u7684\uFF0C\u5728\u8861\u91CF\u673A\u5668\u751F\u6210\u7684\u6587\u672C\u7684\u8D28\u91CF\u65B9\u9762\u6CA1\u6709\u7075\u4E39\u5999\u836F\u3002"),Io=c(),$(jt.$$.fragment),No=c(),cl=n("h2"),Gm=t("\u6587\u672C\u6458\u8981\u7684\u6307\u6807"),Co=c(),$(ul.$$.fragment),Uo=c(),En=n("p"),Am=t("\u4E0E\u6211\u4EEC\u5728\u672C\u8BFE\u7A0B\u4E2D\u6DB5\u76D6\u7684\u5927\u591A\u6570\u5176\u4ED6\u4EFB\u52A1\u76F8\u6BD4\uFF0C\u8861\u91CF\u6587\u672C\u751F\u6210\u4EFB\u52A1\uFF08\u5982\u6458\u8981\u6216\u7FFB\u8BD1\uFF09\u7684\u6027\u80FD\u5E76\u4E0D\u90A3\u4E48\u7B80\u5355\u3002\u4F8B\u5982\uFF0C\u5BF9\u4E8E\u201C\u6211\u559C\u6B22\u9605\u8BFB\u9965\u997F\u6E38\u620F\u201D\u8FD9\u6837\u7684\u8BC4\u8BBA\uFF0C\u6709\u591A\u4E2A\u6709\u6548\u6458\u8981\uFF0C\u4F8B\u5982\u201C\u6211\u559C\u6B22\u9965\u997F\u6E38\u620F\u201D\u6216\u201C\u9965\u997F\u6E38\u620F\u662F\u4E00\u672C\u597D\u4E66\u201D\u3002\u663E\u7136\uFF0C\u5728\u751F\u6210\u7684\u6458\u8981\u548C\u6807\u7B7E\u4E4B\u95F4\u5E94\u7528\u67D0\u79CD\u7CBE\u786E\u5339\u914D\u5E76\u4E0D\u662F\u4E00\u4E2A\u597D\u7684\u89E3\u51B3\u65B9\u6848\u2014\u2014\u5373\u4F7F\u662F\u4EBA\u7C7B\u5728\u8FD9\u6837\u7684\u6307\u6807\u4E0B\u4E5F\u4F1A\u8868\u73B0\u4E0D\u4F73\uFF0C\u56E0\u4E3A\u6211\u4EEC\u90FD\u6709\u81EA\u5DF1\u7684\u5199\u4F5C\u98CE\u683C\u3002"),Ho=c(),vt=n("p"),Lm=t("\u603B\u800C\u8A00\u4E4B\uFF0C\u6700\u5E38\u7528\u7684\u6307\u6807\u4E4B\u4E00\u662F"),hl=n("a"),Im=t("ROUGE \u5206\u6570"),Nm=t("\uFF08Recall-Oriented Understudy for Gisting Evaluation \u7684\u7F29\u5199\uFF09\u3002\u8BE5\u6307\u6807\u80CC\u540E\u7684\u57FA\u672C\u601D\u60F3\u662F\u5C06\u751F\u6210\u7684\u6458\u8981\u4E0E\u4E00\u7EC4\u901A\u5E38\u7531\u4EBA\u7C7B\u521B\u5EFA\u7684\u53C2\u8003\u6458\u8981\u8FDB\u884C\u6BD4\u8F83\u3002\u4E3A\u4E86\u66F4\u7CBE\u786E\uFF0C\u5047\u8BBE\u6211\u4EEC\u8981\u6BD4\u8F83\u4EE5\u4E0B\u4E24\u4E2A\u6458\u8981\uFF1A"),Fo=c(),$(fl.$$.fragment),Mo=c(),va=n("p"),Cm=t("\u6BD4\u8F83\u5B83\u4EEC\u7684\u4E00\u79CD\u65B9\u6CD5\u662F\u8BA1\u7B97\u91CD\u53E0\u5355\u8BCD\u7684\u6570\u91CF\uFF0C\u5728\u8FD9\u79CD\u60C5\u51B5\u4E0B\u4E3A 6\u3002\u4F46\u662F\uFF0C\u8FD9\u6709\u70B9\u7C97\u7CD9\uFF0C\u56E0\u6B64 ROUGE \u662F\u57FA\u4E8E\u8BA1\u7B97\u8BA1\u7B97\u91CD\u53E0\u7684 "),Sr=n("em"),Um=t("precision"),Hm=t(" \u548C "),zr=n("em"),Fm=t("recall"),Mm=t(" \u5206\u6570\u3002\u3002"),Bo=c(),$($t.$$.fragment),Wo=c(),dl=n("p"),Bm=t(`\u5BF9\u4E8E ROUGE\uFF0Crecall \u8861\u91CF\u751F\u6210\u7684\u53C2\u8003\u6458\u8981\u5305\u542B\u4E86\u591A\u5C11\u53C2\u8003\u6458\u8981\u3002\u5982\u679C\u6211\u4EEC\u53EA\u662F\u6BD4\u8F83\u5355\u8BCD\uFF0Crecall\u53EF\u4EE5\u6839\u636E\u4EE5\u4E0B\u516C\u5F0F\u8BA1\u7B97\uFF1A
`),Ko=new pd,Vo=c(),_l=n("p"),Wm=t(`\u5BF9\u4E8E\u6211\u4EEC\u4E0A\u9762\u7684\u7B80\u5355\u4F8B\u5B50\uFF0C\u8FD9\u4E2A\u516C\u5F0F\u7ED9\u51FA\u4E86 6/6 = 1 \u7684\u5B8C\u7F8E\u53EC\u56DE\u7387\uFF1B\u5373\uFF0C\u53C2\u8003\u6458\u8981\u4E2D\u7684\u6240\u6709\u5355\u8BCD\u90FD\u5DF2\u7531\u6A21\u578B\u751F\u6210\u3002\u8FD9\u542C\u8D77\u6765\u53EF\u80FD\u5F88\u68D2\uFF0C\u4F46\u60F3\u8C61\u4E00\u4E0B\uFF0C\u5982\u679C\u6211\u4EEC\u751F\u6210\u7684\u6458\u8981\u662F\u201C\u6211\u771F\u7684\u5F88\u559C\u6B22\u6574\u665A\u9605\u8BFB\u9965\u997F\u6E38\u620F\u201D\u3002\u8FD9\u4E5F\u5C06\u6709\u5B8C\u7F8E\u7684recall\uFF0C\u4F46\u53EF\u4EE5\u8BF4\u662F\u4E00\u4E2A\u66F4\u7CDF\u7CD5\u7684\u603B\u7ED3\uFF0C\u56E0\u4E3A\u5B83\u5F88\u5197\u957F\u3002\u4E3A\u4E86\u5904\u7406\u8FD9\u4E9B\u573A\u666F\uFF0C\u6211\u4EEC\u8FD8\u8BA1\u7B97\u4E86pecision\uFF0C\u5B83\u5728 ROUGE \u4E0A\u4E0B\u6587\u4E2D\u8861\u91CF\u751F\u6210\u7684\u6458\u8981\u4E2D\u6709\u591A\u5C11\u662F\u76F8\u5173\u7684\uFF1A
`),Yo=new pd,Jo=c(),kt=n("p"),Km=t("\u5C06\u6B64\u5E94\u7528\u5230\u6211\u4EEC\u7684\u8BE6\u7EC6\u6458\u8981\u4E2D\u4F1A\u5F97\u5230 6/10 = 0.6 \u7684\u7CBE\u5EA6\uFF0C\u8FD9\u6BD4\u6211\u4EEC\u8F83\u77ED\u7684\u6458\u8981\u83B7\u5F97\u7684 6/7 = 0.86 \u7684\u7CBE\u5EA6\u8981\u5DEE\u5F97\u591A\u3002\u5728\u5B9E\u8DF5\u4E2D\uFF0C\u901A\u5E38\u8BA1\u7B97\u7CBE\u5EA6\u548C\u53EC\u56DE\u7387\uFF0C\u7136\u540E\u62A5\u544A F1-score\uFF08\u7CBE\u5EA6\u548C\u53EC\u56DE\u7387\u7684\u8C03\u548C\u5E73\u5747\u503C\uFF09\u3002\u6211\u4EEC\u53EF\u4EE5\u5728 \u{1F917} Datasets \u4E2D\u901A\u8FC7\u5B89\u88C5 "),Dr=n("strong"),Vm=t("rouge_score"),Ym=t(" \u5305\u6765\u8BA1\u7B97\u4ED6\u4EEC\uFF1A"),Xo=c(),$(gl.$$.fragment),Qo=c(),xn=n("p"),Jm=t("\u7136\u540E\u6309\u5982\u4E0B\u65B9\u5F0F\u52A0\u8F7D ROUGE \u6307\u6807\uFF1A"),Zo=c(),$(bl.$$.fragment),sp=c(),wt=n("p"),Xm=t("\u7136\u540E\u6211\u4EEC\u53EF\u4EE5\u4F7F\u7528 "),Rr=n("strong"),Qm=t("rouge_score.compute()"),Zm=t(" \u4E00\u6B21\u6027\u8BA1\u7B97\u6240\u6709\u6307\u6807\u7684\u51FD\u6570\uFF1A"),ep=c(),$(jl.$$.fragment),ap=c(),$(vl.$$.fragment),tp=c(),Ks=n("p"),sc=t("\u54C7\uFF0C\u90A3\u4E2A\u8F93\u51FA\u4E2D\u6709\u5F88\u591A\u4FE1\u606F\u2014\u2014\u8FD9\u90FD\u662F\u4EC0\u4E48\u610F\u601D\uFF1F\u9996\u5148\uFF0C\u{1F917} Datasets\u5B9E\u9645\u4E0A\u8BA1\u7B97\u4E86\u7CBE\u5EA6\u3001\u53EC\u56DE\u7387\u548C F1 \u5206\u6570\u7684\u7F6E\u4FE1\u533A\u95F4\uFF1B\u8FD9\u4E9B\u662F\u4F60\u53EF\u4EE5\u5728\u8FD9\u91CC\u770B\u5230\u7684 "),Or=n("strong"),ec=t("low"),ac=t(" , "),Pr=n("strong"),tc=t("mid"),lc=t(" \uFF0C \u548C "),Gr=n("strong"),nc=t("high"),rc=t(" \u5C5E\u6027\u3002\u6B64\u5916\uFF0C\u{1F917} Datasets\u5728\u6BD4\u8F83\u751F\u6210\u6458\u8981\u548C\u53C2\u8003\u6458\u8981\u65F6\uFF0C\u4F1A\u6839\u636E\u4E0D\u540C\u7C7B\u578B\u7684\u6587\u672C\u7C92\u5EA6\u8BA1\u7B97\u5404\u79CD ROUGE \u5206\u6570\u3002\u8FD9 "),Ar=n("strong"),oc=t("rouge1"),pc=t(" \u53D8\u4F53\u662F\u4E00\u5143\u7EC4\u7684\u91CD\u53E0\u2014\u2014\u8FD9\u53EA\u662F\u8868\u8FBE\u5355\u8BCD\u91CD\u53E0\u7684\u4E00\u79CD\u5947\u7279\u65B9\u5F0F\uFF0C\u8FD9\u6B63\u662F\u6211\u4EEC\u4E0A\u9762\u8BA8\u8BBA\u7684\u5EA6\u91CF\u6807\u51C6\u3002\u4E3A\u4E86\u9A8C\u8BC1\u8FD9\u4E00\u70B9\uFF0C\u8BA9\u6211\u4EEC\u8F93\u51FA "),Lr=n("strong"),ic=t("mid"),mc=t(" \u7684\u6570\u503C\uFF1A"),lp=c(),$($l.$$.fragment),np=c(),$(kl.$$.fragment),rp=c(),Vs=n("p"),cc=t("\u592A\u597D\u4E86\uFF0C\u51C6\u786E\u7387\u548C\u53EC\u56DE\u7387\u5339\u914D\u4E86\uFF01\u90A3\u4E48\u5176\u4ED6\u7684 ROUGE \u5206\u6570\u5462\uFF1F "),Ir=n("strong"),uc=t("rouge2"),hc=t(" \u6D4B\u91CF\u4E8C\u5143\u7EC4\u4E4B\u95F4\u7684\u91CD\u53E0\uFF08\u60F3\u60F3\u5355\u8BCD\u5BF9\u7684\u91CD\u53E0\uFF09\uFF0C\u800C "),Nr=n("strong"),fc=t("rougeL"),dc=t(" \u548C "),Cr=n("strong"),_c=t("rougeLsum"),gc=t(" \u901A\u8FC7\u5728\u751F\u6210\u7684\u548C\u53C2\u8003\u6458\u8981\u4E2D\u67E5\u627E\u6700\u957F\u7684\u516C\u5171\u5B50\u4E32\u6765\u6D4B\u91CF\u6700\u957F\u7684\u5355\u8BCD\u5339\u914D\u5E8F\u5217\u3002\u4E2D\u7684\u201C\u603B\u548C\u201D "),Ur=n("strong"),bc=t("rougeLsum"),jc=t(" \u6307\u7684\u662F\u8FD9\u4E2A\u6307\u6807\u662F\u5728\u6574\u4E2A\u6458\u8981\u4E0A\u8BA1\u7B97\u7684\uFF0C\u800C "),Hr=n("strong"),vc=t("rougeL"),$c=t(" \u8BA1\u7B97\u4E3A\u5355\u4E2A\u53E5\u5B50\u7684\u5E73\u5747\u503C\u3002"),op=c(),$(yt.$$.fragment),pp=c(),Tn=n("p"),kc=t("\u6211\u4EEC\u5C06\u4F7F\u7528\u8FD9\u4E9B ROUGE \u5206\u6570\u6765\u8DDF\u8E2A\u6211\u4EEC\u6A21\u578B\u7684\u6027\u80FD\uFF0C\u4F46\u5728\u6B64\u4E4B\u524D\uFF0C\u8BA9\u6211\u4EEC\u505A\u6BCF\u4E2A\u4F18\u79C0\u7684 NLP \u4ECE\u4E1A\u8005\u90FD\u5E94\u8BE5\u505A\u7684\u4E8B\u60C5\uFF1A\u521B\u5EFA\u4E00\u4E2A\u5F3A\u5927\u800C\u7B80\u5355\u7684baseline\uFF01"),ip=c(),Za=n("h3"),Et=n("a"),Fr=n("span"),$(wl.$$.fragment),wc=c(),Mr=n("span"),yc=t("\u521B\u5EFA\u5F3A\u5927\u7684baseline"),mp=c(),De=n("p"),Ec=t("\u6587\u672C\u6458\u8981\u7684\u4E00\u4E2A\u5E38\u89C1\u57FA\u7EBF\u662F\u7B80\u5355\u5730\u53D6\u4E00\u7BC7\u6587\u7AE0\u7684\u524D\u4E09\u4E2A\u53E5\u5B50\uFF0C\u901A\u5E38\u79F0\u4E3A "),Br=n("em"),xc=t("lead-3"),Tc=t(" \u57FA\u7EBF\u3002 \u6211\u4EEC\u53EF\u4EE5\u4F7F\u7528\u53E5\u53F7(\u82F1\u6587\u4F7F\u7528.)\u6765\u8DDF\u8E2A\u53E5\u5B50\u8FB9\u754C\uFF0C\u4F46\u8FD9\u5728\u201DU.S.\u201D or \u201CU.N.\u201D\u4E4B\u7C7B\u7684\u9996\u5B57\u6BCD\u7F29\u7565\u8BCD\u4E0A\u4F1A\u5931\u8D25\u3002\u6240\u4EE5\u6211\u4EEC\u5C06\u4F7F\u7528 "),Wr=n("code"),qc=t("nltk"),Sc=t(" \u5E93\uFF0C\u5B83\u5305\u542B\u4E00\u4E2A\u66F4\u597D\u7684\u7B97\u6CD5\u6765\u5904\u7406\u8FD9\u4E9B\u60C5\u51B5\u3002 \u60A8\u53EF\u4EE5\u4F7F\u7528 "),Kr=n("code"),zc=t("pip"),Dc=t(" \u5B89\u88C5\u8F6F\u4EF6\u5305\uFF0C\u5982\u4E0B\u6240\u793A\uFF1A"),cp=c(),$(yl.$$.fragment),up=c(),qn=n("p"),Rc=t("\u7136\u540E\u4E0B\u8F7D\u6807\u70B9\u89C4\u5219\uFF1A"),hp=c(),$(El.$$.fragment),fp=c(),xt=n("p"),Oc=t("\u63A5\u4E0B\u6765\uFF0C\u6211\u4EEC\u4ECE "),Vr=n("code"),Pc=t("nltk"),Gc=t(" \u5BFC\u5165\u53E5\u5B50\u6807\u8BB0\u5668\u5E76\u521B\u5EFA\u4E00\u4E2A\u7B80\u5355\u7684\u51FD\u6570\u6765\u63D0\u53D6\u8BC4\u8BBA\u4E2D\u7684\u524D\u4E09\u4E2A\u53E5\u5B50\u3002 \u6587\u672C\u6458\u8981\u7684\u7EA6\u5B9A\u662F\u7528\u6362\u884C\u7B26\u5206\u9694\u6BCF\u4E2A\u6458\u8981\uFF0C\u56E0\u6B64\u6211\u4EEC\u4E5F\u5C06\u5176\u5305\u542B\u5728\u5185\u5E76\u5728\u8BAD\u7EC3\u793A\u4F8B\u4E0A\u5BF9\u5176\u8FDB\u884C\u6D4B\u8BD5\uFF1A"),dp=c(),$(xl.$$.fragment),_p=c(),$(Tl.$$.fragment),gp=c(),Sn=n("p"),Ac=t("\u8FD9\u4F3C\u4E4E\u6709\u6548\uFF0C\u6240\u4EE5\u8BA9\u6211\u4EEC\u73B0\u5728\u5B9E\u73B0\u4E00\u4E2A\u51FD\u6570\uFF0C\u4ECE\u6570\u636E\u96C6\u4E2D\u63D0\u53D6\u8FD9\u4E9B\u201C\u6458\u8981\u201D\u5E76\u8BA1\u7B97baseline\u7684 ROUGE \u5206\u6570\uFF1A"),bp=c(),$(ql.$$.fragment),jp=c(),zn=n("p"),Lc=t("\u7136\u540E\u6211\u4EEC\u53EF\u4EE5\u4F7F\u7528\u8FD9\u4E2A\u51FD\u6570\u6765\u8BA1\u7B97\u9A8C\u8BC1\u96C6\u4E0A\u7684 ROUGE \u5206\u6570\uFF0C\u5E76\u4F7F\u7528 Pandas \u5BF9\u5B83\u4EEC\u8FDB\u884C\u4E00\u4E9B\u7F8E\u5316\uFF1A"),vp=c(),$(Sl.$$.fragment),$p=c(),$(zl.$$.fragment),kp=c(),Tt=n("p"),Ic=t("\u6211\u4EEC\u53EF\u4EE5\u770B\u5230"),Yr=n("code"),Nc=t("rouge2"),Cc=t("\u7684\u5206\u6570\u660E\u663E\u4F4E\u4E8E\u5176\u4ED6\uFF1B \u8FD9\u53EF\u80FD\u53CD\u6620\u4E86\u8FD9\u6837\u4E00\u4E2A\u4E8B\u5B9E\uFF0C\u5373\u8BC4\u8BBA\u6807\u9898\u901A\u5E38\u5F88\u7B80\u6D01\uFF0C\u56E0\u6B64lead-3 baseline\u8FC7\u4E8E\u5197\u957F\u3002 \u73B0\u5728\u6211\u4EEC\u6709\u4E86\u4E00\u4E2A\u5F88\u597D\u7684\u57FA\u51C6\uFF0C\u8BA9\u6211\u4EEC\u5C06\u6CE8\u610F\u529B\u8F6C\u5411\u5FAE\u8C03 mT5\uFF01"),wp=c(),Qe.c(),Dn=c(),$(qt.$$.fragment),yp=c(),Rn=n("p"),Uc=t("\u6211\u4EEC\u9700\u8981\u505A\u7684\u4E0B\u4E00\u4EF6\u4E8B\u662F\u767B\u5F55 Hugging Face Hub\u3002\u5982\u679C\u60A8\u5728notebook\u4E2D\u8FD0\u884C\u6B64\u4EE3\u7801\uFF0C\u5219\u53EF\u4EE5\u4F7F\u7528\u4EE5\u4E0B\u5B9E\u7528\u7A0B\u5E8F\u51FD\u6570\u6267\u884C\u6B64\u64CD\u4F5C\uFF1A"),Ep=c(),$(Dl.$$.fragment),xp=c(),On=n("p"),Hc=t("\u8FD9\u5C06\u663E\u793A\u4E00\u4E2A\u5C0F\u90E8\u4EF6\uFF0C\u60A8\u53EF\u4EE5\u5728\u5176\u4E2D\u8F93\u5165\u60A8\u7684\u51ED\u636E\u3002\u6216\u8005\uFF0C\u60A8\u53EF\u4EE5\u5728\u7EC8\u7AEF\u4E2D\u8FD0\u884C\u6B64\u547D\u4EE4\u5E76\u5728\u90A3\u91CC\u767B\u5F55\uFF1A"),Tp=c(),$(Rl.$$.fragment),qp=c(),Ds&&Ds.c(),Pn=c(),St=n("p"),Fc=t("\u63A5\u4E0B\u6765\uFF0C\u6211\u4EEC\u9700\u8981\u4E3A\u6211\u4EEC\u7684\u5E8F\u5217\u5230\u5E8F\u5217\u4EFB\u52A1\u5B9A\u4E49\u4E00\u4E2A\u6570\u636E\u6574\u7406\u5668\u3002\u7531\u4E8E mT5 \u662F\u4E00\u4E2A\u7F16\u7801\u5668-\u89E3\u7801\u5668 Transformer \u6A21\u578B\uFF0C\u51C6\u5907\u6211\u4EEC\u7684\u6279\u6B21\u7684\u4E00\u4E2A\u5FAE\u5999\u4E4B\u5904\u662F\uFF0C\u5728\u89E3\u7801\u8FC7\u7A0B\u4E2D\uFF0C\u6211\u4EEC\u9700\u8981\u5C06\u6807\u7B7E\u5411\u53F3\u79FB\u52A8\u4E00\u4E2A\u3002 \u8FD9\u662F\u4E3A\u4E86\u786E\u4FDD\u89E3\u7801\u5668\u53EA\u770B\u5230\u4E4B\u524D\u7684\u771F\u5B9E\u7684\u6807\u7B7E\uFF0C\u800C\u4E0D\u662F\u5F53\u524D\u6216\u672A\u6765\u7684\u6807\u7B7E\uFF0C\u8FD9\u5BF9\u4E8E\u6A21\u578B\u6765\u8BF4\u5F88\u5BB9\u6613\u8BB0\u5FC6\u3002 \u8FD9\u7C7B\u4F3C\u4E8E\u5728 "),Gn=n("a"),Mc=t("\u56E0\u679C\u8BED\u8A00\u5EFA\u6A21"),Bc=t(" \u7B49\u4EFB\u52A1\u4E2D\u5982\u4F55\u5C06\u63A9\u853D\u7684\u81EA\u6211\u6CE8\u610F\u5E94\u7528\u4E8E\u8F93\u5165\u3002"),Sp=c(),Re=n("p"),Wc=t("\u5E78\u8FD0\u7684\u662F\uFF0C\u{1F917} Transformers \u63D0\u4F9B\u4E86\u4E00\u4E2A "),Jr=n("code"),Kc=t("DataCollatorForSeq2Seq"),Vc=t(" \u6574\u7406\u5668\uFF0C\u5B83\u5C06\u4E3A\u6211\u4EEC\u52A8\u6001\u586B\u5145\u8F93\u5165\u548C\u6807\u7B7E\u3002 \u8981\u5B9E\u4F8B\u5316\u8FD9\u4E2A\u6536\u96C6\u5668\uFF0C\u6211\u4EEC\u53EA\u9700\u8981\u63D0\u4F9B "),Xr=n("code"),Yc=t("tokenizer"),Jc=t(" \u548C "),Qr=n("code"),Xc=t("model"),Qc=t("\uFF1A"),zp=c(),sa.c(),An=c(),Ln=n("p"),Zc=t("\u8BA9\u6211\u4EEC\u770B\u770B\u8FD9\u4E2A\u6574\u7406\u5668\u5728\u8F93\u5165\u4E00\u5C0F\u6279\u793A\u4F8B\u65F6\u4F1A\u4EA7\u751F\u4EC0\u4E48\u3002 \u9996\u5148\uFF0C\u6211\u4EEC\u9700\u8981\u5220\u9664\u5E26\u6709\u5B57\u7B26\u4E32\u7684\u5217\uFF0C\u56E0\u4E3A\u6574\u7406\u5668\u4E0D\u77E5\u9053\u5982\u4F55\u586B\u5145\u8FD9\u4E9B\u5143\u7D20\uFF1A"),Dp=c(),$(Ol.$$.fragment),Rp=c(),$a=n("p"),su=t("\u7531\u4E8E collator \u9700\u8981\u4E00\u4E2A "),Zr=n("code"),eu=t("dict"),au=t(" \u7684\u5217\u8868\uFF0C\u5176\u4E2D\u6BCF\u4E2A "),so=n("code"),tu=t("dict"),lu=t(" \u4EE3\u8868\u6570\u636E\u96C6\u4E2D\u7684\u4E00\u4E2A\u793A\u4F8B\uFF0C\u6211\u4EEC\u8FD8\u9700\u8981\u5728\u5C06\u6570\u636E\u4F20\u9012\u7ED9 data collator \u4E4B\u524D\u5C06\u6570\u636E\u6574\u7406\u6210\u9884\u671F\u7684\u683C\u5F0F\uFF1A"),Op=c(),$(Pl.$$.fragment),Pp=c(),$(Gl.$$.fragment),Gp=c(),ws=n("p"),nu=t("\u8FD9\u91CC\u8981\u6CE8\u610F\u7684\u4E3B\u8981\u662F\u7B2C\u4E00\u4E2A\u4F8B\u5B50\u6BD4\u7B2C\u4E8C\u4E2A\u4F8B\u5B50\u8981\u957F\uFF0C\u6240\u4EE5\u7B2C\u4E8C\u4E2A\u4F8B\u5B50\u7684 "),eo=n("code"),ru=t("input_ids"),ou=t(" \u548C "),ao=n("code"),pu=t("attention_mask"),iu=t(" \u5DF2\u7ECF\u5728\u53F3\u4FA7\u586B\u5145\u4E86\u4E00\u4E2A "),to=n("code"),mu=t("[PAD]"),cu=t(" \u6807\u8BB0\uFF08\u5176 ID \u662F "),lo=n("code"),uu=t("0"),hu=t("\uFF09\u3002 \u7C7B\u4F3C\u5730\uFF0C\u6211\u4EEC\u53EF\u4EE5\u770B\u5230 "),no=n("code"),fu=t("labels"),du=t(" \u5DF2\u7528 "),ro=n("code"),_u=t("-100"),gu=t(" \u586B\u5145\uFF0C\u4EE5\u786E\u4FDD\u586B\u5145\u6807\u8BB0\u88AB\u635F\u5931\u51FD\u6570\u5FFD\u7565\u3002 \u6700\u540E\uFF0C\u6211\u4EEC\u53EF\u4EE5\u770B\u5230\u4E00\u4E2A\u65B0\u7684 "),oo=n("code"),bu=t("decoder_input_ids"),ju=t("\uFF0C\u5B83\u901A\u8FC7\u5728\u7B2C\u4E00\u4E2A\u6761\u76EE\u4E2D\u63D2\u5165 "),po=n("code"),vu=t("[PAD]"),$u=t(" \u6807\u8BB0\u5C06\u6807\u7B7E\u5411\u53F3\u79FB\u52A8\u3002"),Ap=c(),aa.c(),In=c(),Rs&&Rs.c(),Nn=c(),Al=n("h2"),ku=t("\u4F7F\u7528\u60A8\u5FAE\u8C03\u7684\u6A21\u578B"),Lp=c(),Cn=n("p"),wu=t("\u5C06\u6A21\u578B\u63A8\u9001\u5230 Hub \u540E\uFF0C\u60A8\u53EF\u4EE5\u901A\u8FC7\u63A8\u7406\u5C0F\u90E8\u4EF6\u6216\u201C\u7BA1\u9053\u201D\u5BF9\u8C61\u6765\u4F7F\u7528\u5B83\uFF0C\u5982\u4E0B\u6240\u793A\uFF1A"),Ip=c(),$(Ll.$$.fragment),Np=c(),Un=n("p"),yu=t("\u6211\u4EEC\u53EF\u4EE5\u5C06\u6D4B\u8BD5\u96C6\u4E2D\u7684\u4E00\u4E9B\u793A\u4F8B\uFF08\u6A21\u578B\u8FD8\u6CA1\u6709\u770B\u5230\uFF09\u63D0\u4F9B\u7ED9\u6211\u4EEC\u7684\u7BA1\u9053\uFF0C\u4EE5\u4E86\u89E3\u751F\u6210\u6458\u8981\u7684\u8D28\u91CF\u3002 \u9996\u5148\u8BA9\u6211\u4EEC\u5B9E\u73B0\u4E00\u4E2A\u7B80\u5355\u7684\u51FD\u6570\u6765\u4E00\u8D77\u663E\u793A\u8BC4\u8BBA\u3001\u6807\u9898\u548C\u751F\u6210\u7684\u6458\u8981\uFF1A"),Cp=c(),$(Il.$$.fragment),Up=c(),Hn=n("p"),Eu=t("\u8BA9\u6211\u4EEC\u770B\u4E00\u4E0B\u6211\u4EEC\u5F97\u5230\u7684\u4E00\u4E2A\u82F1\u6587\u4F8B\u5B50\uFF1A"),Hp=c(),$(Nl.$$.fragment),Fp=c(),$(Cl.$$.fragment),Mp=c(),Fn=n("p"),xu=t("\u8FD9\u8FD8\u4E0D\u9519\uFF01 \u6211\u4EEC\u53EF\u4EE5\u770B\u5230\uFF0C\u6211\u4EEC\u7684\u6A21\u578B\u5B9E\u9645\u4E0A\u5DF2\u7ECF\u80FD\u591F\u901A\u8FC7\u589E\u52A0\u90E8\u5206\u65B0\u8BCD\u6765\u6267\u884C\u62BD\u8C61\u6458\u8981\u3002 \u4E5F\u8BB8\u6211\u4EEC\u6A21\u578B\u6700\u9177\u7684\u65B9\u9762\u662F\u5B83\u662F\u53CC\u8BED\u7684\uFF0C\u6240\u4EE5\u6211\u4EEC\u8FD8\u53EF\u4EE5\u751F\u6210\u897F\u73ED\u7259\u8BED\u8BC4\u8BBA\u7684\u6458\u8981\uFF1A"),Bp=c(),$(Ul.$$.fragment),Wp=c(),$(Hl.$$.fragment),Kp=c(),Mn=n("p"),Tu=t("\u6458\u8981\u7FFB\u8BD1\u6210\u4E86\u82F1\u6587\u7684\u201C\u975E\u5E38\u5BB9\u6613\u9605\u8BFB\u201D\uFF0C\u5728\u8FD9\u79CD\u60C5\u51B5\u4E0B\uFF0C\u6211\u4EEC\u53EF\u4EE5\u770B\u5230\u5B83\u662F\u76F4\u63A5\u4ECE\u8BC4\u8BBA\u4E2D\u63D0\u53D6\u7684\u3002 \u8FD9\u663E\u793A\u4E86 mT5 \u6A21\u578B\u7684\u591A\u529F\u80FD\u6027\uFF0C\u5E76\u8BA9\u60A8\u4F53\u9A8C\u4E86\u5904\u7406\u591A\u8BED\u8A00\u8BED\u6599\u5E93\u7684\u611F\u89C9\uFF01"),Vp=c(),Bn=n("p"),qu=t("\u63A5\u4E0B\u6765\uFF0C\u6211\u4EEC\u5C06\u628A\u6CE8\u610F\u529B\u8F6C\u5411\u7A0D\u5FAE\u590D\u6742\u7684\u4EFB\u52A1\uFF1A\u4ECE\u5934\u5F00\u59CB\u8BAD\u7EC3\u8BED\u8A00\u6A21\u578B\u3002"),this.h()},l(s){const i=bd('[data-svelte="svelte-1phssyn"]',document.head);h=r(i,"META",{name:!0,content:!0}),i.forEach(a),v=u(s),k(f.$$.fragment,s),E=u(s),O=r(s,"H1",{id:!0});var io=p(O);x=l(io,"\u63D0\u53D6\u6587\u672C\u6458\u8981"),io.forEach(a),S=u(s),P.l(s),C=u(s),N=r(s,"P",{});var Wn=p(N);D=l(Wn,"\u5728\u672C\u8282\u4E2D\uFF0C\u6211\u4EEC\u5C06\u770B\u770B\u5982\u4F55\u4F7F\u7528 Transformer \u6A21\u578B\u5C06\u957F\u6587\u6863\u538B\u7F29\u4E3A\u6458\u8981\uFF0C\u8FD9\u9879\u4EFB\u52A1\u79F0\u4E3A\u6587\u672C\u6458\u8981.\u8FD9\u662F\u6700\u5177\u6311\u6218\u6027\u7684 NLP \u4EFB\u52A1\u4E4B\u4E00\uFF0C\u56E0\u4E3A\u5B83\u9700\u8981\u4E00\u7CFB\u5217\u80FD\u529B\uFF0C\u4F8B\u5982\u7406\u89E3\u957F\u7BC7\u6587\u7AE0\u548C\u751F\u6210\u80FD\u591F\u6355\u6349\u6587\u6863\u4E2D\u4E3B\u8981\u4E3B\u9898\u7684\u8FDE\u8D2F\u6587\u672C\u3002\u4F46\u662F\uFF0C\u5982\u679C\u505A\u5F97\u597D\uFF0C\u6587\u672C\u6458\u8981\u662F\u4E00\u79CD\u5F3A\u5927\u7684\u5DE5\u5177\uFF0C\u53EF\u4EE5\u51CF\u8F7B\u9886\u57DF\u4E13\u5BB6\u8BE6\u7EC6\u9605\u8BFB\u957F\u6587\u6863\u7684\u8D1F\u62C5\uFF0C\u4ECE\u800C\u52A0\u5FEB\u5404\u79CD\u4E1A\u52A1\u6D41\u7A0B\u3002"),Wn.forEach(a),I=u(s),k(U.$$.fragment,s),J=u(s),M=r(s,"P",{});var st=p(M);B=l(st,"\u5C3D\u7BA1\u5728"),H=r(st,"A",{href:!0,rel:!0});var mo=p(H);Q=l(mo,"Hugging Face Hub"),mo.forEach(a),z=l(st,"\u4E0A\u5DF2\u7ECF\u5B58\u5728\u5404\u79CD\u5FAE\u8C03\u6A21\u578B\u7528\u4E8E\u6587\u672C\u6458\u8981\uFF0C\u51E0\u4E4E\u6240\u6709\u8FD9\u4E9B\u90FD\u53EA\u9002\u7528\u4E8E\u82F1\u6587\u6587\u6863\u3002\u56E0\u6B64\uFF0C\u4E3A\u4E86\u5728\u672C\u8282\u4E2D\u6DFB\u52A0\u4E00\u4E9B\u53D8\u5316\uFF0C\u6211\u4EEC\u5C06\u4E3A\u82F1\u8BED\u548C\u897F\u73ED\u7259\u8BED\u8BAD\u7EC3\u4E00\u4E2A\u53CC\u8BED\u6A21\u578B\u3002\u5728\u672C\u8282\u7ED3\u675F\u65F6\uFF0C\u60A8\u5C06\u6709\u4E00\u4E2A\u53EF\u4EE5\u603B\u7ED3\u5BA2\u6237\u8BC4\u8BBA\u7684"),G=r(st,"A",{href:!0,rel:!0});var co=p(G);os=l(co,"\u6A21\u578B"),co.forEach(a),ss=l(st,"\u3002"),st.forEach(a),Z=u(s),W=r(s,"IFRAME",{src:!0,frameborder:!0,height:!0,title:!0,class:!0,allow:!0,sandbox:!0}),p(W).forEach(a),ls=u(s),V=r(s,"IFRAME",{src:!0,frameborder:!0,height:!0,title:!0,class:!0,allow:!0,sandbox:!0}),p(V).forEach(a),js=u(s),ps=r(s,"P",{});var uo=p(ps);vs=l(uo,"\u5982\u4E0B\u6240\u793A\uFF1A\u6B63\u5982\u6211\u4EEC\u5C06\u770B\u5230\u7684\uFF0C\u8FD9\u4E9B\u6458\u8981\u5F88\u7B80\u6D01\uFF0C\u56E0\u4E3A\u5B83\u4EEC\u662F\u4ECE\u5BA2\u6237\u5728\u4EA7\u54C1\u8BC4\u8BBA\u4E2D\u63D0\u4F9B\u7684\u6807\u9898\u4E2D\u5B66\u5230\u7684\u3002\u8BA9\u6211\u4EEC\u9996\u5148\u4E3A\u8FD9\u9879\u4EFB\u52A1\u51C6\u5907\u4E00\u4E2A\u5408\u9002\u7684\u53CC\u8BED\u8BED\u6599\u5E93\u3002"),uo.forEach(a),Y=u(s),cs=r(s,"H2",{id:!0});var ho=p(cs);ys=l(ho,"\u51C6\u5907\u591A\u8BED\u8A00\u8BED\u6599\u5E93"),ho.forEach(a),es=u(s),ns=r(s,"P",{});var Kl=p(ns);rs=l(Kl,"\u6211\u4EEC\u5C06\u4F7F\u7528"),is=r(Kl,"A",{href:!0,rel:!0});var Kn=p(is);j=l(Kn,"\u591A\u8BED\u8A00\u4E9A\u9A6C\u900A\u8BC4\u8BBA\u8BED\u6599\u5E93"),Kn.forEach(a),F=l(Kl,"\u521B\u5EFA\u6211\u4EEC\u7684\u53CC\u8BED\u6458\u8981\u5668\u3002\u8BE5\u8BED\u6599\u5E93\u7531\u516D\u79CD\u8BED\u8A00\u7684\u4E9A\u9A6C\u900A\u4EA7\u54C1\u8BC4\u8BBA\u7EC4\u6210\uFF0C\u901A\u5E38\u7528\u4E8E\u5BF9\u591A\u8BED\u8A00\u5206\u7C7B\u5668\u8FDB\u884C\u57FA\u51C6\u6D4B\u8BD5\u3002\u7136\u800C\uFF0C\u7531\u4E8E\u6BCF\u6761\u8BC4\u8BBA\u90FD\u9644\u6709\u4E00\u4E2A\u7B80\u77ED\u7684\u6807\u9898\uFF0C\u6211\u4EEC\u53EF\u4EE5\u4F7F\u7528\u6807\u9898\u4F5C\u4E3A\u6211\u4EEC\u6A21\u578B\u5B66\u4E60\u7684\u76EE\u6807\u6458\u8981\uFF01\u9996\u5148\uFF0C\u8BA9\u6211\u4EEC\u4ECE Hugging Face Hub \u4E0B\u8F7D\u82F1\u8BED\u548C\u897F\u73ED\u7259\u8BED\u5B50\u96C6\uFF1A"),Kl.forEach(a),Ts=u(s),k(as.$$.fragment,s),us=u(s),k(ms.$$.fragment,s),g=u(s),A=r(s,"P",{});var Ns=p(A);qs=l(Ns,"\u5982\u60A8\u6240\u89C1\uFF0C\u5BF9\u4E8E\u6BCF\u79CD\u8BED\u8A00\uFF0C\u90FD\u6709 200,000 \u6761\u8BC4\u8BBA "),hs=r(Ns,"STRONG",{});var Vn=p(hs);Ys=l(Vn,"train"),Vn.forEach(a),Es=l(Ns," \u62C6\u5206\uFF0C\u6BCF\u4E2A\u8BC4\u8BBA\u6709 5,000 \u6761\u8BC4\u8BBA "),_s=r(Ns,"STRONG",{});var Yn=p(_s);Cs=l(Yn,"validation"),Yn.forEach(a),Js=l(Ns," \u548C "),fs=r(Ns,"STRONG",{});var Hu=p(fs);Xs=l(Hu,"test"),Hu.forEach(a),Ss=l(Ns," \u5206\u88C2\u3002\u6211\u4EEC\u611F\u5174\u8DA3\u7684\u8BC4\u8BBA\u4FE1\u606F\u5305\u542B\u5728 "),ee=r(Ns,"STRONG",{});var Fu=p(ee);Us=l(Fu,"review_body"),Fu.forEach(a),he=l(Ns," \u548C "),Qs=r(Ns,"STRONG",{});var Mu=p(Qs);Le=l(Mu,"review_title"),Mu.forEach(a),fe=l(Ns," \u5217\u3002\u8BA9\u6211\u4EEC\u901A\u8FC7\u521B\u5EFA\u4E00\u4E2A\u7B80\u5355\u7684\u51FD\u6570\u6765\u67E5\u770B\u4E00\u4E9B\u793A\u4F8B\uFF0C\u8BE5\u51FD\u6570\u4F7F\u7528\u6211\u4EEC\u5728"),Zs=r(Ns,"A",{href:!0});var Bu=p(Zs);se=l(Bu,"\u7B2C\u4E94\u7AE0"),Bu.forEach(a),de=l(Ns,"\u5B66\u5230\u8FC7\uFF1A"),Ns.forEach(a),zs=u(s),k(As.$$.fragment,s),L=u(s),k(ts.$$.fragment,s),we=u(s),k(ks.$$.fragment,s),ds=u(s),Ls=r(s,"P",{});var Jn=p(Ls);ta=l(Jn,"\u6B64\u793A\u4F8B\u663E\u793A\u4E86\u4EBA\u4EEC\u901A\u5E38\u5728\u7F51\u4E0A\u627E\u5230\u7684\u8BC4\u8BBA\u7684\u591A\u6837\u6027\uFF0C\u4ECE\u6B63\u9762\u5230\u8D1F\u9762\uFF08\u4EE5\u53CA\u4ECB\u4E8E\u4E24\u8005\u4E4B\u95F4\u7684\u6240\u6709\u5185\u5BB9\uFF01\uFF09\u3002\u5C3D\u7BA1\u6807\u9898\u4E3A\u201Cmeh\u201D\u7684\u793A\u4F8B\u4FE1\u606F\u91CF\u4E0D\u5927\uFF0C\u4F46\u5176\u4ED6\u6807\u9898\u770B\u8D77\u6765\u50CF\u662F\u5BF9\u8BC4\u8BBA\u672C\u8EAB\u7684\u4F53\u9762\u603B\u7ED3\u3002\u5728\u5355\u4E2A GPU \u4E0A\u8BAD\u7EC3\u6240\u6709 400,000 \u6761\u8BC4\u8BBA\u7684\u6458\u8981\u6A21\u578B\u5C06\u82B1\u8D39\u592A\u957F\u65F6\u95F4\uFF0C\u56E0\u6B64\u6211\u4EEC\u5C06\u4E13\u6CE8\u4E8E\u4E3A\u5355\u4E2A\u4EA7\u54C1\u9886\u57DF\u751F\u6210\u6458\u8981\u3002\u4E3A\u4E86\u4E86\u89E3\u6211\u4EEC\u53EF\u4EE5\u9009\u62E9\u54EA\u4E9B\u57DF\uFF0C\u8BA9\u6211\u4EEC\u5C06 "),ae=r(Jn,"STRONG",{});var Wu=p(ae);la=l(Wu,"english_dataset"),Wu.forEach(a),na=l(Jn," \u8F6C\u6362\u5230 "),te=r(Jn,"STRONG",{});var Ku=p(te);xs=l(Ku,"pandas.DataFrame"),Ku.forEach(a),Ie=l(Jn," \u5E76\u8BA1\u7B97\u6BCF\u4E2A\u4EA7\u54C1\u7C7B\u522B\u7684\u8BC4\u8BBA\u6570\u91CF\uFF1A"),Jn.forEach(a),le=u(s),k(ne.$$.fragment,s),_e=u(s),k(Os.$$.fragment,s),ye=u(s),gs=r(s,"P",{});var ka=p(gs);Hs=l(ka,"\u82F1\u8BED\u6570\u636E\u96C6\u4E2D\u6700\u53D7\u6B22\u8FCE\u7684\u4EA7\u54C1\u662F\u5BB6\u5C45\u7528\u54C1\u3001\u670D\u88C5\u548C\u65E0\u7EBF\u7535\u5B50\u4EA7\u54C1\u3002\u4E0D\u8FC7\uFF0C\u4E3A\u4E86\u575A\u6301\u4E9A\u9A6C\u900A\u7684\u4E3B\u9898\uFF0C\u8BA9\u6211\u4EEC\u4E13\u6CE8\u4E8E\u603B\u7ED3\u4E66\u7C4D\u7684\u8BC4\u8BBA\u2014\u2014\u6BD5\u7ADF\uFF0C\u8FD9\u662F\u4E9A\u9A6C\u900A\u8FD9\u5BB6\u516C\u53F8\u6210\u7ACB\u7684\u57FA\u7840\uFF01\u6211\u4EEC\u53EF\u4EE5\u770B\u5230\u4E24\u4E2A\u7B26\u5408\u8981\u6C42\u7684\u4EA7\u54C1\u7C7B\u522B\uFF08 "),ge=r(ka,"STRONG",{});var Vu=p(ge);re=l(Vu,"book"),Vu.forEach(a),Ne=l(ka," \u548C "),Fs=r(ka,"STRONG",{});var Yu=p(Fs);Gt=l(Yu,"digital_ebook_purchase"),Yu.forEach(a),Ea=l(ka," )\uFF0C\u6240\u4EE5\u8BA9\u6211\u4EEC\u4E3A\u8FD9\u4E9B\u4EA7\u54C1\u8FC7\u6EE4\u4E24\u79CD\u8BED\u8A00\u7684\u6570\u636E\u96C6\u3002\u6B63\u5982\u6211\u4EEC\u5728"),ra=r(ka,"A",{href:!0});var Ju=p(ra);At=l(Ju,"\u7B2C\u4E94\u7AE0"),Ju.forEach(a),xa=l(ka,"\u5B66\u5230\u7684\uFF0C \u8FD9 "),Ta=r(ka,"STRONG",{});var Xu=p(Ta);Lt=l(Xu,"Dataset.filter()"),Xu.forEach(a),et=l(ka," \u51FD\u6570\u5141\u8BB8\u6211\u4EEC\u975E\u5E38\u6709\u6548\u5730\u5BF9\u6570\u636E\u96C6\u8FDB\u884C\u5207\u7247\uFF0C\u56E0\u6B64\u6211\u4EEC\u53EF\u4EE5\u5B9A\u4E49\u4E00\u4E2A\u7B80\u5355\u7684\u51FD\u6570\u6765\u6267\u884C\u6B64\u64CD\u4F5C\uFF1A"),ka.forEach(a),Ce=u(s),k(Ue.$$.fragment,s),qa=u(s),bs=r(s,"P",{});var Oe=p(bs);at=l(Oe,"\u73B0\u5728\uFF0C\u5F53\u6211\u4EEC\u5C06\u6B64\u51FD\u6570\u5E94\u7528\u4E8E "),be=r(Oe,"STRONG",{});var Qu=p(be);tt=l(Qu,"english_dataset"),Qu.forEach(a),oa=l(Oe," \u548C "),Sa=r(Oe,"STRONG",{});var Zu=p(Sa);lt=l(Zu,"spanish_dataset"),Zu.forEach(a),He=l(Oe," \uFF0C\u7ED3\u679C\u5C06\u53EA\u5305\u542B\u6D89\u53CA\u4E66\u7C4D\u7C7B\u522B\u7684\u90A3\u4E9B\u884C\u3002\u5728\u5E94\u7528\u8FC7\u6EE4\u5668\u4E4B\u524D\uFF0C\u8BA9\u6211\u4EEC\u5C06"),pa=r(Oe,"STRONG",{});var sh=p(pa);Ee=l(sh,"english_dataset"),sh.forEach(a),It=l(Oe,"\u7684\u683C\u5F0F\u4ECE "),Fe=r(Oe,"STRONG",{});var eh=p(Fe);Nt=l(eh,"pandas"),eh.forEach(a),Ct=l(Oe," \u5207\u6362\u56DE\u5230 "),ia=r(Oe,"STRONG",{});var ah=p(ia);Me=l(ah,"arrow"),ah.forEach(a),Ut=l(Oe," \uFF1A"),Oe.forEach(a),za=u(s),k(oe.$$.fragment,s),nt=u(s),Be=r(s,"P",{});var th=p(Be);Ms=l(th,"\u7136\u540E\u6211\u4EEC\u53EF\u4EE5\u5E94\u7528\u8FC7\u6EE4\u5668\u529F\u80FD\uFF0C\u4F5C\u4E3A\u5065\u5168\u6027\u68C0\u67E5\uFF0C\u8BA9\u6211\u4EEC\u68C0\u67E5\u8BC4\u8BBA\u6837\u672C\uFF0C\u770B\u770B\u5B83\u4EEC\u662F\u5426\u786E\u5B9E\u4E0E\u4E66\u7C4D\u6709\u5173\uFF1A"),th.forEach(a),xe=u(s),k(We.$$.fragment,s),ma=u(s),k(Ke.$$.fragment,s),rt=u(s),Bs=r(s,"P",{});var zt=p(Bs);Da=l(zt,"\u597D\u7684\uFF0C\u6211\u4EEC\u53EF\u4EE5\u770B\u5230\u8BC4\u8BBA\u5E76\u4E0D\u662F\u4E25\u683C\u610F\u4E49\u4E0A\u7684\u4E66\u7C4D\uFF0C\u53EF\u80FD\u662F\u6307\u65E5\u5386\u548C OneNote \u7B49\u7535\u5B50\u5E94\u7528\u7A0B\u5E8F\u7B49\u5185\u5BB9\u3002\u5C3D\u7BA1\u5982\u6B64\uFF0C\u8BE5\u9886\u57DF\u4F3C\u4E4E\u9002\u5408\u8BAD\u7EC3\u6458\u8981\u6A21\u578B\u3002\u5728\u6211\u4EEC\u67E5\u770B\u9002\u5408\u6B64\u4EFB\u52A1\u7684\u5404\u79CD\u6A21\u578B\u4E4B\u524D\uFF0C\u6211\u4EEC\u8FD8\u6709\u6700\u540E\u4E00\u70B9\u6570\u636E\u51C6\u5907\u8981\u505A\uFF1A\u5C06\u82F1\u8BED\u548C\u897F\u73ED\u7259\u8BED\u8BC4\u8BBA\u5408\u5E76\u4E3A\u4E00\u4E2A "),Ra=r(zt,"STRONG",{});var lh=p(Ra);Ht=l(lh,"DatasetDict"),lh.forEach(a),Oa=l(zt," \u76EE\u7684\u3002 \u{1F917} Datasets \u63D0\u4F9B\u4E86\u4E00\u4E2A\u65B9\u4FBF\u7684 "),Pa=r(zt,"STRONG",{});var nh=p(Pa);Ft=l(nh,"concatenate_datasets()"),nh.forEach(a),je=l(zt," \u51FD\u6570\uFF08\u987E\u540D\u601D\u4E49\uFF09\u5408\u5E76 "),Ga=r(zt,"STRONG",{});var rh=p(Ga);Aa=l(rh,"Dataset"),rh.forEach(a),Mt=l(zt," \u5BF9\u8C61\u3002\u56E0\u6B64\uFF0C\u4E3A\u4E86\u521B\u5EFA\u6211\u4EEC\u7684\u53CC\u8BED\u6570\u636E\u96C6\uFF0C\u6211\u4EEC\u5C06\u904D\u5386\u6BCF\u4E2A\u62C6\u5206\uFF0C\u8FDE\u63A5\u8BE5\u62C6\u5206\u7684\u6570\u636E\u96C6\uFF0C\u5E76\u6253\u4E71\u7ED3\u679C\u4EE5\u786E\u4FDD\u6211\u4EEC\u7684\u6A21\u578B\u4E0D\u4F1A\u8FC7\u5EA6\u62DF\u5408\u5355\u4E00\u8BED\u8A00\uFF1A"),zt.forEach(a),ot=u(s),k(ve.$$.fragment,s),pt=u(s),k(Ve.$$.fragment,s),La=u(s),$e=r(s,"P",{});var oh=p($e);Bt=l(oh,"\u8FD9\u5F53\u7136\u770B\u8D77\u6765\u50CF\u662F\u82F1\u8BED\u548C\u897F\u73ED\u7259\u8BED\u8BC4\u8BBA\u7684\u6DF7\u5408\uFF01\u73B0\u5728\u6211\u4EEC\u6709\u4E86\u4E00\u4E2A\u8BAD\u7EC3\u8BED\u6599\u5E93\uFF0C\u6700\u540E\u8981\u68C0\u67E5\u7684\u4E00\u4EF6\u4E8B\u662F\u8BC4\u8BBA\u4E2D\u5355\u8BCD\u7684\u5206\u5E03\u53CA\u5176\u6807\u9898\u3002\u8FD9\u5BF9\u4E8E\u6458\u8981\u4EFB\u52A1\u5C24\u5176\u91CD\u8981\uFF0C\u5176\u4E2D\u6570\u636E\u4E2D\u7684\u7B80\u77ED\u53C2\u8003\u6458\u8981\u4F1A\u4F7F\u6A21\u578B\u504F\u5411\u4E8E\u4EC5\u5728\u751F\u6210\u7684\u6458\u8981\u4E2D\u8F93\u51FA\u4E00\u4E24\u4E2A\u5355\u8BCD\u3002\u4E0B\u9762\u7684\u56FE\u663E\u793A\u4E86\u5355\u8BCD\u5206\u5E03\uFF0C\u6211\u4EEC\u53EF\u4EE5\u770B\u5230\u6709\u4E9B\u6807\u9898\u4E25\u91CD\u504F\u5411\u4E8E 1-2 \u4E2A\u5355\u8BCD\uFF1A"),oh.forEach(a),Ia=u(s),Is=r(s,"DIV",{class:!0});var Jp=p(Is);Te=r(Jp,"IMG",{class:!0,src:!0,alt:!0}),it=u(Jp),pe=r(Jp,"IMG",{class:!0,src:!0,alt:!0}),Jp.forEach(a),Na=u(s),m=r(s,"P",{});var Xp=p(m);T=l(Xp,"\u4E3A\u4E86\u89E3\u51B3\u8FD9\u4E2A\u95EE\u9898\uFF0C\u6211\u4EEC\u5C06\u8FC7\u6EE4\u6389\u6807\u9898\u975E\u5E38\u77ED\u7684\u793A\u4F8B\uFF0C\u4EE5\u4FBF\u6211\u4EEC\u7684\u6A21\u578B\u53EF\u4EE5\u751F\u6210\u66F4\u6709\u8DA3\u7684\u6458\u8981\u3002\u7531\u4E8E\u6211\u4EEC\u6B63\u5728\u5904\u7406\u82F1\u6587\u548C\u897F\u73ED\u7259\u6587\u6587\u672C\uFF0C\u56E0\u6B64\u6211\u4EEC\u53EF\u4EE5\u4F7F\u7528\u7C97\u7565\u7684\u542F\u53D1\u5F0F\u65B9\u6CD5\u5728\u7A7A\u767D\u5904\u62C6\u5206\u6807\u9898\uFF0C\u7136\u540E\u4F7F\u7528\u6211\u4EEC\u53EF\u4FE1\u8D56\u7684 "),mt=r(Xp,"STRONG",{});var ph=p(mt);Yl=l(ph,"Dataset.filter()"),ph.forEach(a),Jl=l(Xp," \u65B9\u6CD5\u5982\u4E0B\uFF1A"),Xp.forEach(a),Ye=u(s),k(ua.$$.fragment,s),Wt=u(s),Ca=r(s,"P",{});var ih=p(Ca);ie=l(ih,"\u73B0\u5728\u6211\u4EEC\u5DF2\u7ECF\u51C6\u5907\u597D\u4E86\u6211\u4EEC\u7684\u8BED\u6599\u5E93\uFF0C\u8BA9\u6211\u4EEC\u6765\u770B\u770B\u4E00\u4E9B\u53EF\u4EE5\u5BF9\u5176\u8FDB\u884C\u5FAE\u8C03\u7684\u53EF\u80FD\u7684 Transformer \u6A21\u578B\uFF01"),ih.forEach(a),Kt=u(s),ha=r(s,"H2",{id:!0});var mh=p(ha);Xl=l(mh,"\u6587\u672C\u6458\u8981\u6A21\u578B"),mh.forEach(a),Vt=u(s),ke=r(s,"P",{});var Qp=p(ke);Ql=l(Qp,"\u5982\u679C\u4F60\u4ED4\u7EC6\u60F3\u60F3\uFF0C\u6587\u672C\u6458\u8981\u662F\u4E00\u79CD\u7C7B\u4F3C\u4E8E\u673A\u5668\u7FFB\u8BD1\u7684\u4EFB\u52A1\uFF1A\u6211\u4EEC\u6709\u4E00\u4E2A\u50CF\u8BC4\u8BBA\u8FD9\u6837\u7684\u6587\u672C\u6B63\u6587\uFF0C\u6211\u4EEC\u5E0C\u671B\u5C06\u5176\u201C\u7FFB\u8BD1\u201D\u6210\u4E00\u4E2A\u8F83\u77ED\u7684\u7248\u672C\uFF0C\u4EE5\u6355\u6349\u8F93\u5165\u7684\u663E\u7740\u7279\u5F81\u3002\u56E0\u6B64\uFF0C\u5927\u591A\u6570\u7528\u4E8E\u6587\u672C\u6458\u8981\u7684 Transformer \u6A21\u578B\u91C7\u7528\u4E86\u6211\u4EEC\u5728"),Ua=r(Qp,"A",{href:!0});var ch=p(Ua);ct=l(ch,"\u7B2C\u4E00\u7AE0"),ch.forEach(a),Zl=l(Qp,"\u9047\u5230\u7684\u7F16\u7801\u5668-\u89E3\u7801\u5668\u67B6\u6784\u3002\u5C3D\u7BA1\u6709\u4E00\u4E9B\u4F8B\u5916\uFF0C\u4F8B\u5982 GPT \u7CFB\u5217\u6A21\u578B\uFF0C\u5B83\u4EEC\u5728few-shot\uFF08\u5C11\u91CF\u5FAE\u8C03\uFF09\u4E4B\u540E\u4E5F\u53EF\u4EE5\u63D0\u53D6\u6458\u8981\u3002\u4E0B\u8868\u5217\u51FA\u4E86\u4E00\u4E9B\u6D41\u884C\u7684\u9884\u8BAD\u7EC3\u6A21\u578B\uFF0C\u53EF\u4EE5\u5BF9\u5176\u8FDB\u884C\u5FAE\u8C03\u4EE5\u8FDB\u884C\u6C47\u603B\u3002"),Qp.forEach(a),Ha=u(s),Je=r(s,"TABLE",{});var Zp=p(Je);ut=r(Zp,"THEAD",{});var uh=p(ut);Ws=r(uh,"TR",{});var Xn=p(Ws);Fa=r(Xn,"TH",{align:!0});var hh=p(Fa);sn=l(hh,"Transformer \u6A21\u578B"),hh.forEach(a),en=u(Xn),ht=r(Xn,"TH",{});var fh=p(ht);an=l(fh,"\u63CF\u8FF0"),fh.forEach(a),fa=u(Xn),Ma=r(Xn,"TH",{align:!0});var dh=p(Ma);tn=l(dh,"\u591A\u79CD\u8BED\u8A00?"),dh.forEach(a),Xn.forEach(a),uh.forEach(a),ln=u(Zp),Ps=r(Zp,"TBODY",{});var Pe=p(Ps);me=r(Pe,"TR",{});var Qn=p(me);Ba=r(Qn,"TD",{align:!0});var _h=p(Ba);da=r(_h,"A",{href:!0,rel:!0});var gh=p(da);nn=l(gh,"GPT-2"),gh.forEach(a),_h.forEach(a),qe=u(Qn),_a=r(Qn,"TD",{});var bh=p(_a);rn=l(bh,"\u867D\u7136\u8BAD\u7EC3\u4E3A\u81EA\u56DE\u5F52\u8BED\u8A00\u6A21\u578B\uFF0C\u4F46\u60A8\u53EF\u4EE5\u901A\u8FC7\u5728\u8F93\u5165\u6587\u672C\u672B\u5C3E\u9644\u52A0\u201CTL;DR\u201D\u6765\u4F7F GPT-2 \u751F\u6210\u6458\u8981\u3002"),bh.forEach(a),on=u(Qn),Wa=r(Qn,"TD",{align:!0});var jh=p(Wa);ga=l(jh,"\u274C"),jh.forEach(a),Qn.forEach(a),pn=u(Pe),Se=r(Pe,"TR",{});var Zn=p(Se);Ka=r(Zn,"TD",{align:!0});var vh=p(Ka);ba=r(vh,"A",{href:!0,rel:!0});var $h=p(ba);hi=l($h,"PEGASUS"),$h.forEach(a),vh.forEach(a),fi=u(Zn),mr=r(Zn,"TD",{});var kh=p(mr);di=l(kh,"\u5728\u9884\u8BAD\u7EC3\u662F\u7684\u76EE\u6807\u662F\u6765\u9884\u6D4B\u591A\u53E5\u5B50\u6587\u672C\u4E2D\u7684\u5C4F\u853D\u53E5\u5B50\u3002 \u8FD9\u4E2A\u9884\u8BAD\u7EC3\u76EE\u6807\u6BD4\u666E\u901A\u8BED\u8A00\u5EFA\u6A21\u66F4\u63A5\u8FD1\u6587\u672C\u6458\u8981\uFF0C\u5E76\u4E14\u5728\u6D41\u884C\u7684\u57FA\u51C6\u6D4B\u8BD5\u4E2D\u5F97\u5206\u5F88\u9AD8\u3002"),kh.forEach(a),_i=u(Zn),mn=r(Zn,"TD",{align:!0});var wh=p(mn);gi=l(wh,"\u274C"),wh.forEach(a),Zn.forEach(a),bi=u(Pe),Va=r(Pe,"TR",{});var sr=p(Va);cn=r(sr,"TD",{align:!0});var yh=p(cn);Yt=r(yh,"A",{href:!0,rel:!0});var Eh=p(Yt);ji=l(Eh,"T5"),Eh.forEach(a),yh.forEach(a),vi=u(sr),Jt=r(sr,"TD",{});var si=p(Jt);$i=l(si,"\u901A\u7528\u7684 Transformer \u67B6\u6784\uFF0C\u5728\u6587\u672C\u5230\u6587\u672C\u7684\u6846\u67B6\u4E2D\u5236\u5B9A\u6240\u6709\u4EFB\u52A1\uFF1B \u4F8B\u5982\uFF0C\u6A21\u578B\u6587\u672C\u6458\u8981\u7684\u8F93\u5165\u683C\u5F0F\u662F"),cr=r(si,"CODE",{});var xh=p(cr);ki=l(xh,"summarize: ARTICLE"),xh.forEach(a),wi=l(si,"\u3002"),si.forEach(a),yi=u(sr),un=r(sr,"TD",{align:!0});var Th=p(un);Ei=l(Th,"\u274C"),Th.forEach(a),sr.forEach(a),xi=u(Pe),Ya=r(Pe,"TR",{});var er=p(Ya);hn=r(er,"TD",{align:!0});var qh=p(hn);Xt=r(qh,"A",{href:!0,rel:!0});var Sh=p(Xt);Ti=l(Sh,"mT5"),Sh.forEach(a),qh.forEach(a),qi=u(er),ur=r(er,"TD",{});var zh=p(ur);Si=l(zh,"T5 \u7684\u591A\u8BED\u8A00\u7248\u672C\uFF0C\u5728\u591A\u8BED\u8A00 Common Crawl \u8BED\u6599\u5E93 (mC4) \u4E0A\u8FDB\u884C\u9884\u8BAD\u7EC3\uFF0C\u6DB5\u76D6 101 \u79CD\u8BED\u8A00\u3002"),zh.forEach(a),zi=u(er),fn=r(er,"TD",{align:!0});var Dh=p(fn);Di=l(Dh,"\u2705"),Dh.forEach(a),er.forEach(a),Ri=u(Pe),Ja=r(Pe,"TR",{});var ar=p(Ja);dn=r(ar,"TD",{align:!0});var Rh=p(dn);Qt=r(Rh,"A",{href:!0,rel:!0});var Oh=p(Qt);Oi=l(Oh,"BART"),Oh.forEach(a),Rh.forEach(a),Pi=u(ar),hr=r(ar,"TD",{});var Ph=p(hr);Gi=l(Ph,"\u4E00\u79CD\u65B0\u9896\u7684 Transformer \u67B6\u6784\uFF0C\u5176\u4E2D\u5305\u542B\u7ECF\u8FC7\u8BAD\u7EC3\u7684\u7F16\u7801\u5668\u548C\u89E3\u7801\u5668\u5806\u6808\uFF0C\u4EE5\u91CD\u5EFA\u88AB\u7834\u574F\u7684\u8F93\u5165\uFF0C\u7ED3\u5408\u4E86 BERT \u548C GPT-2 \u7684\u9884\u8BAD\u7EC3\u65B9\u6848\u3002"),Ph.forEach(a),Ai=u(ar),_n=r(ar,"TD",{align:!0});var Gh=p(_n);Li=l(Gh,"\u274C"),Gh.forEach(a),ar.forEach(a),Ii=u(Pe),Xa=r(Pe,"TR",{});var tr=p(Xa);gn=r(tr,"TD",{align:!0});var Ah=p(gn);Zt=r(Ah,"A",{href:!0,rel:!0});var Lh=p(Zt);Ni=l(Lh,"mBART-50"),Lh.forEach(a),Ah.forEach(a),Ci=u(tr),fr=r(tr,"TD",{});var Ih=p(fr);Ui=l(Ih,"BART \u7684\u591A\u8BED\u8A00\u7248\u672C\uFF0C\u9884\u8BAD\u7EC3\u4E86 50 \u79CD\u8BED\u8A00\u3002"),Ih.forEach(a),Hi=u(tr),bn=r(tr,"TD",{align:!0});var Nh=p(bn);Fi=l(Nh,"\u2705"),Nh.forEach(a),tr.forEach(a),Pe.forEach(a),Zp.forEach(a),fo=u(s),jn=r(s,"P",{});var Ch=p(jn);Mi=l(Ch,"\u4ECE\u6B64\u8868\u4E2D\u53EF\u4EE5\u770B\u51FA\uFF0C\u5927\u591A\u6570\u7528\u4E8E\u6458\u8981\u7684 Transformer \u6A21\u578B\uFF08\u4EE5\u53CA\u5927\u591A\u6570 NLP \u4EFB\u52A1\uFF09\u90FD\u662F\u5355\u8BED\u7684\u3002\u5982\u679C\u60A8\u7684\u4EFB\u52A1\u662F\u4F7F\u7528\u201C\u6709\u5927\u91CF\u8BED\u6599\u5E93\u201D\u7684\u8BED\u8A00\uFF08\u5982\u82F1\u8BED\u6216\u5FB7\u8BED\uFF09\uFF0C\u8FD9\u5F88\u597D\uFF0C\u4F46\u5BF9\u4E8E\u4E16\u754C\u5404\u5730\u6B63\u5728\u4F7F\u7528\u7684\u6570\u5343\u79CD\u5176\u4ED6\u8BED\u8A00\uFF0C\u5219\u4E0D\u7136\u3002\u5E78\u8FD0\u7684\u662F\uFF0C\u6709\u4E00\u7C7B\u591A\u8BED\u8A00 Transformer \u6A21\u578B\uFF0C\u5982 mT5 \u548C mBART\uFF0C\u53EF\u4EE5\u89E3\u51B3\u95EE\u9898\u3002\u8FD9\u4E9B\u6A21\u578B\u662F\u4F7F\u7528\u8BED\u8A00\u5EFA\u6A21\u8FDB\u884C\u9884\u8BAD\u7EC3\u7684\uFF0C\u4F46\u6709\u4E00\u70B9\u4E0D\u540C\uFF1A\u5B83\u4EEC\u4E0D\u662F\u5728\u4E00\u79CD\u8BED\u8A00\u7684\u8BED\u6599\u5E93\u4E0A\u8BAD\u7EC3\uFF0C\u800C\u662F\u540C\u65F6\u5728 50 \u591A\u79CD\u8BED\u8A00\u7684\u6587\u672C\u4E0A\u8FDB\u884C\u8054\u5408\u8BAD\u7EC3\uFF01"),Ch.forEach(a),_o=u(s),ft=r(s,"P",{});var ei=p(ft);Bi=l(ei,"\u6211\u4EEC\u5C06\u4F7F\u7528 mT5\uFF0C\u8FD9\u662F\u4E00\u79CD\u57FA\u4E8E T5 \u7684\u6709\u8DA3\u67B6\u6784\uFF0C\u5728\u6587\u672C\u5230\u6587\u672C\u6846\u67B6\u4E2D\u8FDB\u884C\u4E86\u9884\u8BAD\u7EC3\u3002\u5728 T5 \u4E2D\uFF0C\u6BCF\u4E2A NLP \u4EFB\u52A1\u90FD\u662F\u6839\u636E\u63D0\u793A\u524D\u7F00\u6765\u5236\u5B9A\u7684\uFF0C\u4F8B\u5982 "),dr=r(ei,"STRONG",{});var Uh=p(dr);Wi=l(Uh,"summarize:"),Uh.forEach(a),Ki=l(ei," \u8FD9\u4F7F\u6A21\u578B\u4F7F\u751F\u6210\u7684\u6587\u672C\u9002\u5E94\u63D0\u793A\u3002\u5982\u4E0B\u56FE\u6240\u793A\uFF0C\u8FD9\u8BA9 T5 \u53D8\u5F97\u975E\u5E38\u901A\u7528\uFF0C\u56E0\u4E3A\u4F60\u53EF\u4EE5\u7528\u4E00\u4E2A\u6A21\u578B\u89E3\u51B3\u5F88\u591A\u4EFB\u52A1\uFF01"),ei.forEach(a),go=u(s),Qa=r(s,"DIV",{class:!0});var ai=p(Qa);sl=r(ai,"IMG",{class:!0,src:!0,alt:!0}),Vi=u(ai),el=r(ai,"IMG",{class:!0,src:!0,alt:!0}),ai.forEach(a),bo=u(s),vn=r(s,"P",{});var Hh=p(vn);Yi=l(Hh,"mT5 \u4E0D\u4F7F\u7528\u524D\u7F00\uFF0C\u4F46\u5177\u6709 T5 \u7684\u5927\u90E8\u5206\u529F\u80FD\uFF0C\u5E76\u4E14\u5177\u6709\u591A\u8BED\u8A00\u7684\u4F18\u52BF\u3002\u73B0\u5728\u6211\u4EEC\u5DF2\u7ECF\u9009\u62E9\u4E86\u4E00\u4E2A\u6A21\u578B\uFF0C\u8BA9\u6211\u4EEC\u6765\u770B\u770B\u51C6\u5907\u6211\u4EEC\u7684\u8BAD\u7EC3\u6570\u636E\u3002"),Hh.forEach(a),jo=u(s),k(dt.$$.fragment,s),vo=u(s),al=r(s,"H2",{id:!0});var Fh=p(al);Ji=l(Fh,"\u9884\u5904\u7406\u6570\u636E"),Fh.forEach(a),$o=u(s),k(tl.$$.fragment,s),ko=u(s),_t=r(s,"P",{});var ti=p(_t);Xi=l(ti,"\u6211\u4EEC\u7684\u4E0B\u4E00\u4E2A\u4EFB\u52A1\u662F\u5BF9\u6211\u4EEC\u7684\u8BC4\u8BBA\u53CA\u5176\u6807\u9898\u8FDB\u884C\u6807\u8BB0\u548C\u7F16\u7801\u3002\u50CF\u5F80\u5E38\u4E00\u6837\uFF0C\u6211\u4EEC\u9996\u5148\u52A0\u8F7D\u4E0E\u9884\u8BAD\u7EC3\u6A21\u578B\u68C0\u67E5\u70B9\u76F8\u5173\u7684\u6807\u8BB0\u5668\u3002\u6211\u4EEC\u5C06\u4F7F\u7528 "),_r=r(ti,"STRONG",{});var Mh=p(_r);Qi=l(Mh,"mt5-small"),Mh.forEach(a),Zi=l(ti," \u4F5C\u4E3A\u6211\u4EEC\u7684\u68C0\u67E5\u70B9\uFF0C\u4EE5\u4FBF\u6211\u4EEC\u53EF\u4EE5\u5728\u5408\u7406\u7684\u65F6\u95F4\u5185\u5FAE\u8C03\u6A21\u578B\uFF1A"),ti.forEach(a),wo=u(s),k(ll.$$.fragment,s),yo=u(s),k(gt.$$.fragment,s),Eo=u(s),$n=r(s,"P",{});var Bh=p($n);sm=l(Bh,"\u8BA9\u6211\u4EEC\u5728\u4E00\u4E2A\u5C0F\u4F8B\u5B50\u4E0A\u6D4B\u8BD5 mT5 \u6807\u8BB0\u5668\uFF1A"),Bh.forEach(a),xo=u(s),k(nl.$$.fragment,s),To=u(s),k(rl.$$.fragment,s),qo=u(s),ce=r(s,"P",{});var wa=p(ce);em=l(wa,"\u5728\u8FD9\u91CC\u6211\u4EEC\u53EF\u4EE5\u770B\u5230\u6211\u4EEC\u5728"),kn=r(wa,"A",{href:!0});var Wh=p(kn);am=l(Wh,"\u7B2C\u4E09\u7AE0"),Wh.forEach(a),tm=l(wa,"\u7B2C\u4E00\u6B21\u5FAE\u8C03\u5B9E\u9A8C\u4E2D\u9047\u5230\u7684\u719F\u6089\u7684 "),gr=r(wa,"STRONG",{});var Kh=p(gr);lm=l(Kh,"input_ids"),Kh.forEach(a),nm=l(wa," \u548C "),br=r(wa,"STRONG",{});var Vh=p(br);rm=l(Vh,"attention_mask"),Vh.forEach(a),om=l(wa," .\u8BA9\u6211\u4EEC\u7528\u5206\u8BCD\u5668\u89E3\u7801\u8FD9\u4E9B\u8F93\u5165 ID \uFF0C\u53EF\u4EE5"),jr=r(wa,"STRONG",{});var Yh=p(jr);pm=l(Yh,"convert_ids_to_tokens()"),Yh.forEach(a),im=l(wa," \u51FD\u6570\u6765\u67E5\u770B\u6211\u4EEC\u6B63\u5728\u5904\u7406\u4EC0\u4E48\u6837\u7684\u6807\u8BB0\u5668\uFF1A"),wa.forEach(a),So=u(s),k(ol.$$.fragment,s),zo=u(s),k(pl.$$.fragment,s),Do=u(s),ze=r(s,"P",{});var Dt=p(ze);mm=l(Dt,"\u7279\u6B8A\u7684 Unicode \u5B57\u7B26 "),vr=r(Dt,"CODE",{});var Jh=p(vr);cm=l(Jh,"\u2581"),Jh.forEach(a),um=l(Dt," \u548C\u5E8F\u5217\u7ED3\u675F\u6807\u8BB0 "),$r=r(Dt,"CODE",{});var Xh=p($r);hm=l(Xh,"</s>"),Xh.forEach(a),fm=l(Dt," \u8868\u660E\u6211\u4EEC\u6B63\u5728\u5904\u7406 SentencePiece \u5206\u8BCD\u5668\uFF0C\u5B83\u57FA\u4E8E\u5728"),wn=r(Dt,"A",{href:!0});var Qh=p(wn);dm=l(Qh,"\u7B2C\u516D\u7AE0"),Qh.forEach(a),_m=l(Dt,"\u4E2D\u8BA8\u8BBA\u7684Unigram\u5206\u8BCD\u7B97\u6CD5. Unigram \u5BF9\u591A\u8BED\u8A00\u8BED\u6599\u5E93\u7279\u522B\u6709\u7528\uFF0C\u56E0\u4E3A\u5B83\u5141\u8BB8 SentencePiece \u4E0D\u77E5\u9053\u91CD\u97F3\u3001\u6807\u70B9\u7B26\u53F7\u4EE5\u53CA\u8BB8\u591A\u8BED\u8A00\uFF08\u5982\u65E5\u8BED\uFF09\u6CA1\u6709\u7A7A\u683C\u5B57\u7B26\u3002"),Dt.forEach(a),Ro=u(s),bt=r(s,"P",{});var li=p(bt);gm=l(li,"\u4E3A\u4E86\u6807\u8BB0\u6211\u4EEC\u7684\u8BED\u6599\u5E93\uFF0C\u6211\u4EEC\u5FC5\u987B\u5904\u7406\u4E0E\u6458\u8981\u76F8\u5173\u7684\u7EC6\u8282\uFF1A\u56E0\u4E3A\u6211\u4EEC\u7684\u6807\u7B7E\u4E5F\u662F\u6587\u672C\uFF0C\u5B83\u4EEC\u53EF\u80FD\u4F1A\u8D85\u8FC7\u6A21\u578B\u7684\u6700\u5927\u4E0A\u4E0B\u6587\u5927\u5C0F\u3002\u8FD9\u610F\u5473\u7740\u6211\u4EEC\u9700\u8981\u5BF9\u8BC4\u8BBA\u53CA\u5176\u6807\u9898\u8FDB\u884C\u622A\u65AD\uFF0C\u4EE5\u786E\u4FDD\u6211\u4EEC\u4E0D\u4F1A\u5C06\u8FC7\u957F\u7684\u8F93\u5165\u4F20\u9012\u7ED9\u6211\u4EEC\u7684\u6A21\u578B\u3002 \u{1F917} Transformers \u4E2D\u7684\u5206\u8BCD\u5668\u63D0\u4F9B\u4E86\u4E00\u4E2A\u6F02\u4EAE\u7684 "),kr=r(li,"STRONG",{});var Zh=p(kr);bm=l(Zh,"as_target_tokenizer()"),Zh.forEach(a),jm=l(li," \u51FD\u6570\uFF0C\u5B83\u5141\u8BB8\u60A8\u5E76\u884C\u5206\u8BCD\u5E76\u6807\u8BB0\u6807\u7B7E\u7684\u51FD\u6570\u3002\u8FD9\u901A\u5E38\u662F\u4F7F\u7528\u9884\u5904\u7406\u51FD\u6570\u5185\u7684\u4E0A\u4E0B\u6587\u7BA1\u7406\u5668\u5B8C\u6210\u7684\uFF0C\u8BE5\u51FD\u6570\u9996\u5148\u5BF9\u8F93\u5165\u8FDB\u884C\u7F16\u7801\uFF0C\u7136\u540E\u5C06\u6807\u7B7E\u7F16\u7801\u4E3A\u5355\u72EC\u7684\u5217\u3002\u4EE5\u4E0B\u662F mT5 \u7684\u6B64\u51FD\u6570\u7684\u793A\u4F8B\uFF1A"),li.forEach(a),Oo=u(s),k(il.$$.fragment,s),Po=u(s),ue=r(s,"P",{});var ya=p(ue);vm=l(ya,"\u8BA9\u6211\u4EEC\u901A\u8FC7\u8FD9\u6BB5\u4EE3\u7801\u6765\u4E86\u89E3\u53D1\u751F\u4E86\u4EC0\u4E48\u3002\u6211\u4EEC\u505A\u7684\u7B2C\u4E00\u4EF6\u4E8B\u662F\u5B9A\u4E49\u503C "),wr=r(ya,"STRONG",{});var sf=p(wr);$m=l(sf,"max_input_length"),sf.forEach(a),km=l(ya," \u548C "),yr=r(ya,"STRONG",{});var ef=p(yr);wm=l(ef,"max_target_length"),ef.forEach(a),ym=l(ya," \uFF0C\u5B83\u4E3A\u6211\u4EEC\u7684\u8BC4\u8BBA\u548C\u6807\u9898\u7684\u957F\u5EA6\u8BBE\u7F6E\u4E86\u4E0A\u9650\u3002\u7531\u4E8E\u8BC4\u8BBA\u6B63\u6587\u901A\u5E38\u6BD4\u6807\u9898\u5927\u5F97\u591A\uFF0C\u6211\u4EEC\u76F8\u5E94\u5730\u8C03\u6574\u4E86\u8FD9\u4E9B\u503C\u3002\u7136\u540E\uFF0C\u5728 "),Er=r(ya,"STRONG",{});var af=p(Er);Em=l(af,"preprocess_function()"),af.forEach(a),xm=l(ya," \u6211\u4EEC\u53EF\u4EE5\u770B\u5230\u8BC4\u8BBA\u9996\u5148\u88AB\u6807\u8BB0\u5316\uFF0C\u7136\u540E\u662F\u6807\u9898\u5728 "),xr=r(ya,"STRONG",{});var tf=p(xr);Tm=l(tf,"as_target_tokenizer()"),tf.forEach(a),qm=l(ya," \u51FD\u6570\u91CC\u4E5F\u505A\u4E86\u76F8\u540C\u7684\u5904\u7406."),ya.forEach(a),Go=u(s),ja=r(s,"P",{});var lr=p(ja);Sm=l(lr,"\u6709\u4E86 "),Tr=r(lr,"CODE",{});var lf=p(Tr);zm=l(lf,"preprocess_function()"),lf.forEach(a),Dm=l(lr,"\uFF0C\u6211\u4EEC\u5728\u6574\u4E2A\u8BFE\u7A0B\u4E2D\u5E7F\u6CDB\u4F7F\u7528\u7684\u65B9\u4FBF\u7684 "),qr=r(lr,"CODE",{});var nf=p(qr);Rm=l(nf,"Dataset.map()"),nf.forEach(a),Om=l(lr," \u51FD\u6570\u6765\u6807\u8BB0\u6574\u4E2A\u8BED\u6599\u5E93\u662F\u4E00\u4EF6\u7B80\u5355\u7684\u4E8B\u60C5\uFF1A"),lr.forEach(a),Ao=u(s),k(ml.$$.fragment,s),Lo=u(s),yn=r(s,"P",{});var rf=p(yn);Pm=l(rf,"\u65E2\u7136\u8BED\u6599\u5E93\u5DF2\u7ECF\u9884\u5904\u7406\u5B8C\u6BD5\uFF0C\u6211\u4EEC\u6765\u770B\u770B\u4E00\u4E9B\u5E38\u7528\u7684\u6458\u8981\u6307\u6807\u3002\u6B63\u5982\u6211\u4EEC\u5C06\u770B\u5230\u7684\uFF0C\u5728\u8861\u91CF\u673A\u5668\u751F\u6210\u7684\u6587\u672C\u7684\u8D28\u91CF\u65B9\u9762\u6CA1\u6709\u7075\u4E39\u5999\u836F\u3002"),rf.forEach(a),Io=u(s),k(jt.$$.fragment,s),No=u(s),cl=r(s,"H2",{id:!0});var of=p(cl);Gm=l(of,"\u6587\u672C\u6458\u8981\u7684\u6307\u6807"),of.forEach(a),Co=u(s),k(ul.$$.fragment,s),Uo=u(s),En=r(s,"P",{});var pf=p(En);Am=l(pf,"\u4E0E\u6211\u4EEC\u5728\u672C\u8BFE\u7A0B\u4E2D\u6DB5\u76D6\u7684\u5927\u591A\u6570\u5176\u4ED6\u4EFB\u52A1\u76F8\u6BD4\uFF0C\u8861\u91CF\u6587\u672C\u751F\u6210\u4EFB\u52A1\uFF08\u5982\u6458\u8981\u6216\u7FFB\u8BD1\uFF09\u7684\u6027\u80FD\u5E76\u4E0D\u90A3\u4E48\u7B80\u5355\u3002\u4F8B\u5982\uFF0C\u5BF9\u4E8E\u201C\u6211\u559C\u6B22\u9605\u8BFB\u9965\u997F\u6E38\u620F\u201D\u8FD9\u6837\u7684\u8BC4\u8BBA\uFF0C\u6709\u591A\u4E2A\u6709\u6548\u6458\u8981\uFF0C\u4F8B\u5982\u201C\u6211\u559C\u6B22\u9965\u997F\u6E38\u620F\u201D\u6216\u201C\u9965\u997F\u6E38\u620F\u662F\u4E00\u672C\u597D\u4E66\u201D\u3002\u663E\u7136\uFF0C\u5728\u751F\u6210\u7684\u6458\u8981\u548C\u6807\u7B7E\u4E4B\u95F4\u5E94\u7528\u67D0\u79CD\u7CBE\u786E\u5339\u914D\u5E76\u4E0D\u662F\u4E00\u4E2A\u597D\u7684\u89E3\u51B3\u65B9\u6848\u2014\u2014\u5373\u4F7F\u662F\u4EBA\u7C7B\u5728\u8FD9\u6837\u7684\u6307\u6807\u4E0B\u4E5F\u4F1A\u8868\u73B0\u4E0D\u4F73\uFF0C\u56E0\u4E3A\u6211\u4EEC\u90FD\u6709\u81EA\u5DF1\u7684\u5199\u4F5C\u98CE\u683C\u3002"),pf.forEach(a),Ho=u(s),vt=r(s,"P",{});var ni=p(vt);Lm=l(ni,"\u603B\u800C\u8A00\u4E4B\uFF0C\u6700\u5E38\u7528\u7684\u6307\u6807\u4E4B\u4E00\u662F"),hl=r(ni,"A",{href:!0,rel:!0});var mf=p(hl);Im=l(mf,"ROUGE \u5206\u6570"),mf.forEach(a),Nm=l(ni,"\uFF08Recall-Oriented Understudy for Gisting Evaluation \u7684\u7F29\u5199\uFF09\u3002\u8BE5\u6307\u6807\u80CC\u540E\u7684\u57FA\u672C\u601D\u60F3\u662F\u5C06\u751F\u6210\u7684\u6458\u8981\u4E0E\u4E00\u7EC4\u901A\u5E38\u7531\u4EBA\u7C7B\u521B\u5EFA\u7684\u53C2\u8003\u6458\u8981\u8FDB\u884C\u6BD4\u8F83\u3002\u4E3A\u4E86\u66F4\u7CBE\u786E\uFF0C\u5047\u8BBE\u6211\u4EEC\u8981\u6BD4\u8F83\u4EE5\u4E0B\u4E24\u4E2A\u6458\u8981\uFF1A"),ni.forEach(a),Fo=u(s),k(fl.$$.fragment,s),Mo=u(s),va=r(s,"P",{});var nr=p(va);Cm=l(nr,"\u6BD4\u8F83\u5B83\u4EEC\u7684\u4E00\u79CD\u65B9\u6CD5\u662F\u8BA1\u7B97\u91CD\u53E0\u5355\u8BCD\u7684\u6570\u91CF\uFF0C\u5728\u8FD9\u79CD\u60C5\u51B5\u4E0B\u4E3A 6\u3002\u4F46\u662F\uFF0C\u8FD9\u6709\u70B9\u7C97\u7CD9\uFF0C\u56E0\u6B64 ROUGE \u662F\u57FA\u4E8E\u8BA1\u7B97\u8BA1\u7B97\u91CD\u53E0\u7684 "),Sr=r(nr,"EM",{});var cf=p(Sr);Um=l(cf,"precision"),cf.forEach(a),Hm=l(nr," \u548C "),zr=r(nr,"EM",{});var uf=p(zr);Fm=l(uf,"recall"),uf.forEach(a),Mm=l(nr," \u5206\u6570\u3002\u3002"),nr.forEach(a),Bo=u(s),k($t.$$.fragment,s),Wo=u(s),dl=r(s,"P",{});var Su=p(dl);Bm=l(Su,`\u5BF9\u4E8E ROUGE\uFF0Crecall \u8861\u91CF\u751F\u6210\u7684\u53C2\u8003\u6458\u8981\u5305\u542B\u4E86\u591A\u5C11\u53C2\u8003\u6458\u8981\u3002\u5982\u679C\u6211\u4EEC\u53EA\u662F\u6BD4\u8F83\u5355\u8BCD\uFF0Crecall\u53EF\u4EE5\u6839\u636E\u4EE5\u4E0B\u516C\u5F0F\u8BA1\u7B97\uFF1A
`),Ko=id(Su),Su.forEach(a),Vo=u(s),_l=r(s,"P",{});var zu=p(_l);Wm=l(zu,`\u5BF9\u4E8E\u6211\u4EEC\u4E0A\u9762\u7684\u7B80\u5355\u4F8B\u5B50\uFF0C\u8FD9\u4E2A\u516C\u5F0F\u7ED9\u51FA\u4E86 6/6 = 1 \u7684\u5B8C\u7F8E\u53EC\u56DE\u7387\uFF1B\u5373\uFF0C\u53C2\u8003\u6458\u8981\u4E2D\u7684\u6240\u6709\u5355\u8BCD\u90FD\u5DF2\u7531\u6A21\u578B\u751F\u6210\u3002\u8FD9\u542C\u8D77\u6765\u53EF\u80FD\u5F88\u68D2\uFF0C\u4F46\u60F3\u8C61\u4E00\u4E0B\uFF0C\u5982\u679C\u6211\u4EEC\u751F\u6210\u7684\u6458\u8981\u662F\u201C\u6211\u771F\u7684\u5F88\u559C\u6B22\u6574\u665A\u9605\u8BFB\u9965\u997F\u6E38\u620F\u201D\u3002\u8FD9\u4E5F\u5C06\u6709\u5B8C\u7F8E\u7684recall\uFF0C\u4F46\u53EF\u4EE5\u8BF4\u662F\u4E00\u4E2A\u66F4\u7CDF\u7CD5\u7684\u603B\u7ED3\uFF0C\u56E0\u4E3A\u5B83\u5F88\u5197\u957F\u3002\u4E3A\u4E86\u5904\u7406\u8FD9\u4E9B\u573A\u666F\uFF0C\u6211\u4EEC\u8FD8\u8BA1\u7B97\u4E86pecision\uFF0C\u5B83\u5728 ROUGE \u4E0A\u4E0B\u6587\u4E2D\u8861\u91CF\u751F\u6210\u7684\u6458\u8981\u4E2D\u6709\u591A\u5C11\u662F\u76F8\u5173\u7684\uFF1A
`),Yo=id(zu),zu.forEach(a),Jo=u(s),kt=r(s,"P",{});var ri=p(kt);Km=l(ri,"\u5C06\u6B64\u5E94\u7528\u5230\u6211\u4EEC\u7684\u8BE6\u7EC6\u6458\u8981\u4E2D\u4F1A\u5F97\u5230 6/10 = 0.6 \u7684\u7CBE\u5EA6\uFF0C\u8FD9\u6BD4\u6211\u4EEC\u8F83\u77ED\u7684\u6458\u8981\u83B7\u5F97\u7684 6/7 = 0.86 \u7684\u7CBE\u5EA6\u8981\u5DEE\u5F97\u591A\u3002\u5728\u5B9E\u8DF5\u4E2D\uFF0C\u901A\u5E38\u8BA1\u7B97\u7CBE\u5EA6\u548C\u53EC\u56DE\u7387\uFF0C\u7136\u540E\u62A5\u544A F1-score\uFF08\u7CBE\u5EA6\u548C\u53EC\u56DE\u7387\u7684\u8C03\u548C\u5E73\u5747\u503C\uFF09\u3002\u6211\u4EEC\u53EF\u4EE5\u5728 \u{1F917} Datasets \u4E2D\u901A\u8FC7\u5B89\u88C5 "),Dr=r(ri,"STRONG",{});var hf=p(Dr);Vm=l(hf,"rouge_score"),hf.forEach(a),Ym=l(ri," \u5305\u6765\u8BA1\u7B97\u4ED6\u4EEC\uFF1A"),ri.forEach(a),Xo=u(s),k(gl.$$.fragment,s),Qo=u(s),xn=r(s,"P",{});var ff=p(xn);Jm=l(ff,"\u7136\u540E\u6309\u5982\u4E0B\u65B9\u5F0F\u52A0\u8F7D ROUGE \u6307\u6807\uFF1A"),ff.forEach(a),Zo=u(s),k(bl.$$.fragment,s),sp=u(s),wt=r(s,"P",{});var oi=p(wt);Xm=l(oi,"\u7136\u540E\u6211\u4EEC\u53EF\u4EE5\u4F7F\u7528 "),Rr=r(oi,"STRONG",{});var df=p(Rr);Qm=l(df,"rouge_score.compute()"),df.forEach(a),Zm=l(oi," \u4E00\u6B21\u6027\u8BA1\u7B97\u6240\u6709\u6307\u6807\u7684\u51FD\u6570\uFF1A"),oi.forEach(a),ep=u(s),k(jl.$$.fragment,s),ap=u(s),k(vl.$$.fragment,s),tp=u(s),Ks=r(s,"P",{});var Ge=p(Ks);sc=l(Ge,"\u54C7\uFF0C\u90A3\u4E2A\u8F93\u51FA\u4E2D\u6709\u5F88\u591A\u4FE1\u606F\u2014\u2014\u8FD9\u90FD\u662F\u4EC0\u4E48\u610F\u601D\uFF1F\u9996\u5148\uFF0C\u{1F917} Datasets\u5B9E\u9645\u4E0A\u8BA1\u7B97\u4E86\u7CBE\u5EA6\u3001\u53EC\u56DE\u7387\u548C F1 \u5206\u6570\u7684\u7F6E\u4FE1\u533A\u95F4\uFF1B\u8FD9\u4E9B\u662F\u4F60\u53EF\u4EE5\u5728\u8FD9\u91CC\u770B\u5230\u7684 "),Or=r(Ge,"STRONG",{});var _f=p(Or);ec=l(_f,"low"),_f.forEach(a),ac=l(Ge," , "),Pr=r(Ge,"STRONG",{});var gf=p(Pr);tc=l(gf,"mid"),gf.forEach(a),lc=l(Ge," \uFF0C \u548C "),Gr=r(Ge,"STRONG",{});var bf=p(Gr);nc=l(bf,"high"),bf.forEach(a),rc=l(Ge," \u5C5E\u6027\u3002\u6B64\u5916\uFF0C\u{1F917} Datasets\u5728\u6BD4\u8F83\u751F\u6210\u6458\u8981\u548C\u53C2\u8003\u6458\u8981\u65F6\uFF0C\u4F1A\u6839\u636E\u4E0D\u540C\u7C7B\u578B\u7684\u6587\u672C\u7C92\u5EA6\u8BA1\u7B97\u5404\u79CD ROUGE \u5206\u6570\u3002\u8FD9 "),Ar=r(Ge,"STRONG",{});var jf=p(Ar);oc=l(jf,"rouge1"),jf.forEach(a),pc=l(Ge," \u53D8\u4F53\u662F\u4E00\u5143\u7EC4\u7684\u91CD\u53E0\u2014\u2014\u8FD9\u53EA\u662F\u8868\u8FBE\u5355\u8BCD\u91CD\u53E0\u7684\u4E00\u79CD\u5947\u7279\u65B9\u5F0F\uFF0C\u8FD9\u6B63\u662F\u6211\u4EEC\u4E0A\u9762\u8BA8\u8BBA\u7684\u5EA6\u91CF\u6807\u51C6\u3002\u4E3A\u4E86\u9A8C\u8BC1\u8FD9\u4E00\u70B9\uFF0C\u8BA9\u6211\u4EEC\u8F93\u51FA "),Lr=r(Ge,"STRONG",{});var vf=p(Lr);ic=l(vf,"mid"),vf.forEach(a),mc=l(Ge," \u7684\u6570\u503C\uFF1A"),Ge.forEach(a),lp=u(s),k($l.$$.fragment,s),np=u(s),k(kl.$$.fragment,s),rp=u(s),Vs=r(s,"P",{});var Ae=p(Vs);cc=l(Ae,"\u592A\u597D\u4E86\uFF0C\u51C6\u786E\u7387\u548C\u53EC\u56DE\u7387\u5339\u914D\u4E86\uFF01\u90A3\u4E48\u5176\u4ED6\u7684 ROUGE \u5206\u6570\u5462\uFF1F "),Ir=r(Ae,"STRONG",{});var $f=p(Ir);uc=l($f,"rouge2"),$f.forEach(a),hc=l(Ae," \u6D4B\u91CF\u4E8C\u5143\u7EC4\u4E4B\u95F4\u7684\u91CD\u53E0\uFF08\u60F3\u60F3\u5355\u8BCD\u5BF9\u7684\u91CD\u53E0\uFF09\uFF0C\u800C "),Nr=r(Ae,"STRONG",{});var kf=p(Nr);fc=l(kf,"rougeL"),kf.forEach(a),dc=l(Ae," \u548C "),Cr=r(Ae,"STRONG",{});var wf=p(Cr);_c=l(wf,"rougeLsum"),wf.forEach(a),gc=l(Ae," \u901A\u8FC7\u5728\u751F\u6210\u7684\u548C\u53C2\u8003\u6458\u8981\u4E2D\u67E5\u627E\u6700\u957F\u7684\u516C\u5171\u5B50\u4E32\u6765\u6D4B\u91CF\u6700\u957F\u7684\u5355\u8BCD\u5339\u914D\u5E8F\u5217\u3002\u4E2D\u7684\u201C\u603B\u548C\u201D "),Ur=r(Ae,"STRONG",{});var yf=p(Ur);bc=l(yf,"rougeLsum"),yf.forEach(a),jc=l(Ae," \u6307\u7684\u662F\u8FD9\u4E2A\u6307\u6807\u662F\u5728\u6574\u4E2A\u6458\u8981\u4E0A\u8BA1\u7B97\u7684\uFF0C\u800C "),Hr=r(Ae,"STRONG",{});var Ef=p(Hr);vc=l(Ef,"rougeL"),Ef.forEach(a),$c=l(Ae," \u8BA1\u7B97\u4E3A\u5355\u4E2A\u53E5\u5B50\u7684\u5E73\u5747\u503C\u3002"),Ae.forEach(a),op=u(s),k(yt.$$.fragment,s),pp=u(s),Tn=r(s,"P",{});var xf=p(Tn);kc=l(xf,"\u6211\u4EEC\u5C06\u4F7F\u7528\u8FD9\u4E9B ROUGE \u5206\u6570\u6765\u8DDF\u8E2A\u6211\u4EEC\u6A21\u578B\u7684\u6027\u80FD\uFF0C\u4F46\u5728\u6B64\u4E4B\u524D\uFF0C\u8BA9\u6211\u4EEC\u505A\u6BCF\u4E2A\u4F18\u79C0\u7684 NLP \u4ECE\u4E1A\u8005\u90FD\u5E94\u8BE5\u505A\u7684\u4E8B\u60C5\uFF1A\u521B\u5EFA\u4E00\u4E2A\u5F3A\u5927\u800C\u7B80\u5355\u7684baseline\uFF01"),xf.forEach(a),ip=u(s),Za=r(s,"H3",{class:!0});var pi=p(Za);Et=r(pi,"A",{id:!0,class:!0,href:!0});var Tf=p(Et);Fr=r(Tf,"SPAN",{});var qf=p(Fr);k(wl.$$.fragment,qf),qf.forEach(a),Tf.forEach(a),wc=u(pi),Mr=r(pi,"SPAN",{});var Sf=p(Mr);yc=l(Sf,"\u521B\u5EFA\u5F3A\u5927\u7684baseline"),Sf.forEach(a),pi.forEach(a),mp=u(s),De=r(s,"P",{});var Rt=p(De);Ec=l(Rt,"\u6587\u672C\u6458\u8981\u7684\u4E00\u4E2A\u5E38\u89C1\u57FA\u7EBF\u662F\u7B80\u5355\u5730\u53D6\u4E00\u7BC7\u6587\u7AE0\u7684\u524D\u4E09\u4E2A\u53E5\u5B50\uFF0C\u901A\u5E38\u79F0\u4E3A "),Br=r(Rt,"EM",{});var zf=p(Br);xc=l(zf,"lead-3"),zf.forEach(a),Tc=l(Rt," \u57FA\u7EBF\u3002 \u6211\u4EEC\u53EF\u4EE5\u4F7F\u7528\u53E5\u53F7(\u82F1\u6587\u4F7F\u7528.)\u6765\u8DDF\u8E2A\u53E5\u5B50\u8FB9\u754C\uFF0C\u4F46\u8FD9\u5728\u201DU.S.\u201D or \u201CU.N.\u201D\u4E4B\u7C7B\u7684\u9996\u5B57\u6BCD\u7F29\u7565\u8BCD\u4E0A\u4F1A\u5931\u8D25\u3002\u6240\u4EE5\u6211\u4EEC\u5C06\u4F7F\u7528 "),Wr=r(Rt,"CODE",{});var Df=p(Wr);qc=l(Df,"nltk"),Df.forEach(a),Sc=l(Rt," \u5E93\uFF0C\u5B83\u5305\u542B\u4E00\u4E2A\u66F4\u597D\u7684\u7B97\u6CD5\u6765\u5904\u7406\u8FD9\u4E9B\u60C5\u51B5\u3002 \u60A8\u53EF\u4EE5\u4F7F\u7528 "),Kr=r(Rt,"CODE",{});var Rf=p(Kr);zc=l(Rf,"pip"),Rf.forEach(a),Dc=l(Rt," \u5B89\u88C5\u8F6F\u4EF6\u5305\uFF0C\u5982\u4E0B\u6240\u793A\uFF1A"),Rt.forEach(a),cp=u(s),k(yl.$$.fragment,s),up=u(s),qn=r(s,"P",{});var Of=p(qn);Rc=l(Of,"\u7136\u540E\u4E0B\u8F7D\u6807\u70B9\u89C4\u5219\uFF1A"),Of.forEach(a),hp=u(s),k(El.$$.fragment,s),fp=u(s),xt=r(s,"P",{});var ii=p(xt);Oc=l(ii,"\u63A5\u4E0B\u6765\uFF0C\u6211\u4EEC\u4ECE "),Vr=r(ii,"CODE",{});var Pf=p(Vr);Pc=l(Pf,"nltk"),Pf.forEach(a),Gc=l(ii," \u5BFC\u5165\u53E5\u5B50\u6807\u8BB0\u5668\u5E76\u521B\u5EFA\u4E00\u4E2A\u7B80\u5355\u7684\u51FD\u6570\u6765\u63D0\u53D6\u8BC4\u8BBA\u4E2D\u7684\u524D\u4E09\u4E2A\u53E5\u5B50\u3002 \u6587\u672C\u6458\u8981\u7684\u7EA6\u5B9A\u662F\u7528\u6362\u884C\u7B26\u5206\u9694\u6BCF\u4E2A\u6458\u8981\uFF0C\u56E0\u6B64\u6211\u4EEC\u4E5F\u5C06\u5176\u5305\u542B\u5728\u5185\u5E76\u5728\u8BAD\u7EC3\u793A\u4F8B\u4E0A\u5BF9\u5176\u8FDB\u884C\u6D4B\u8BD5\uFF1A"),ii.forEach(a),dp=u(s),k(xl.$$.fragment,s),_p=u(s),k(Tl.$$.fragment,s),gp=u(s),Sn=r(s,"P",{});var Gf=p(Sn);Ac=l(Gf,"\u8FD9\u4F3C\u4E4E\u6709\u6548\uFF0C\u6240\u4EE5\u8BA9\u6211\u4EEC\u73B0\u5728\u5B9E\u73B0\u4E00\u4E2A\u51FD\u6570\uFF0C\u4ECE\u6570\u636E\u96C6\u4E2D\u63D0\u53D6\u8FD9\u4E9B\u201C\u6458\u8981\u201D\u5E76\u8BA1\u7B97baseline\u7684 ROUGE \u5206\u6570\uFF1A"),Gf.forEach(a),bp=u(s),k(ql.$$.fragment,s),jp=u(s),zn=r(s,"P",{});var Af=p(zn);Lc=l(Af,"\u7136\u540E\u6211\u4EEC\u53EF\u4EE5\u4F7F\u7528\u8FD9\u4E2A\u51FD\u6570\u6765\u8BA1\u7B97\u9A8C\u8BC1\u96C6\u4E0A\u7684 ROUGE \u5206\u6570\uFF0C\u5E76\u4F7F\u7528 Pandas \u5BF9\u5B83\u4EEC\u8FDB\u884C\u4E00\u4E9B\u7F8E\u5316\uFF1A"),Af.forEach(a),vp=u(s),k(Sl.$$.fragment,s),$p=u(s),k(zl.$$.fragment,s),kp=u(s),Tt=r(s,"P",{});var mi=p(Tt);Ic=l(mi,"\u6211\u4EEC\u53EF\u4EE5\u770B\u5230"),Yr=r(mi,"CODE",{});var Lf=p(Yr);Nc=l(Lf,"rouge2"),Lf.forEach(a),Cc=l(mi,"\u7684\u5206\u6570\u660E\u663E\u4F4E\u4E8E\u5176\u4ED6\uFF1B \u8FD9\u53EF\u80FD\u53CD\u6620\u4E86\u8FD9\u6837\u4E00\u4E2A\u4E8B\u5B9E\uFF0C\u5373\u8BC4\u8BBA\u6807\u9898\u901A\u5E38\u5F88\u7B80\u6D01\uFF0C\u56E0\u6B64lead-3 baseline\u8FC7\u4E8E\u5197\u957F\u3002 \u73B0\u5728\u6211\u4EEC\u6709\u4E86\u4E00\u4E2A\u5F88\u597D\u7684\u57FA\u51C6\uFF0C\u8BA9\u6211\u4EEC\u5C06\u6CE8\u610F\u529B\u8F6C\u5411\u5FAE\u8C03 mT5\uFF01"),mi.forEach(a),wp=u(s),Qe.l(s),Dn=u(s),k(qt.$$.fragment,s),yp=u(s),Rn=r(s,"P",{});var If=p(Rn);Uc=l(If,"\u6211\u4EEC\u9700\u8981\u505A\u7684\u4E0B\u4E00\u4EF6\u4E8B\u662F\u767B\u5F55 Hugging Face Hub\u3002\u5982\u679C\u60A8\u5728notebook\u4E2D\u8FD0\u884C\u6B64\u4EE3\u7801\uFF0C\u5219\u53EF\u4EE5\u4F7F\u7528\u4EE5\u4E0B\u5B9E\u7528\u7A0B\u5E8F\u51FD\u6570\u6267\u884C\u6B64\u64CD\u4F5C\uFF1A"),If.forEach(a),Ep=u(s),k(Dl.$$.fragment,s),xp=u(s),On=r(s,"P",{});var Nf=p(On);Hc=l(Nf,"\u8FD9\u5C06\u663E\u793A\u4E00\u4E2A\u5C0F\u90E8\u4EF6\uFF0C\u60A8\u53EF\u4EE5\u5728\u5176\u4E2D\u8F93\u5165\u60A8\u7684\u51ED\u636E\u3002\u6216\u8005\uFF0C\u60A8\u53EF\u4EE5\u5728\u7EC8\u7AEF\u4E2D\u8FD0\u884C\u6B64\u547D\u4EE4\u5E76\u5728\u90A3\u91CC\u767B\u5F55\uFF1A"),Nf.forEach(a),Tp=u(s),k(Rl.$$.fragment,s),qp=u(s),Ds&&Ds.l(s),Pn=u(s),St=r(s,"P",{});var ci=p(St);Fc=l(ci,"\u63A5\u4E0B\u6765\uFF0C\u6211\u4EEC\u9700\u8981\u4E3A\u6211\u4EEC\u7684\u5E8F\u5217\u5230\u5E8F\u5217\u4EFB\u52A1\u5B9A\u4E49\u4E00\u4E2A\u6570\u636E\u6574\u7406\u5668\u3002\u7531\u4E8E mT5 \u662F\u4E00\u4E2A\u7F16\u7801\u5668-\u89E3\u7801\u5668 Transformer \u6A21\u578B\uFF0C\u51C6\u5907\u6211\u4EEC\u7684\u6279\u6B21\u7684\u4E00\u4E2A\u5FAE\u5999\u4E4B\u5904\u662F\uFF0C\u5728\u89E3\u7801\u8FC7\u7A0B\u4E2D\uFF0C\u6211\u4EEC\u9700\u8981\u5C06\u6807\u7B7E\u5411\u53F3\u79FB\u52A8\u4E00\u4E2A\u3002 \u8FD9\u662F\u4E3A\u4E86\u786E\u4FDD\u89E3\u7801\u5668\u53EA\u770B\u5230\u4E4B\u524D\u7684\u771F\u5B9E\u7684\u6807\u7B7E\uFF0C\u800C\u4E0D\u662F\u5F53\u524D\u6216\u672A\u6765\u7684\u6807\u7B7E\uFF0C\u8FD9\u5BF9\u4E8E\u6A21\u578B\u6765\u8BF4\u5F88\u5BB9\u6613\u8BB0\u5FC6\u3002 \u8FD9\u7C7B\u4F3C\u4E8E\u5728 "),Gn=r(ci,"A",{href:!0});var Cf=p(Gn);Mc=l(Cf,"\u56E0\u679C\u8BED\u8A00\u5EFA\u6A21"),Cf.forEach(a),Bc=l(ci," \u7B49\u4EFB\u52A1\u4E2D\u5982\u4F55\u5C06\u63A9\u853D\u7684\u81EA\u6211\u6CE8\u610F\u5E94\u7528\u4E8E\u8F93\u5165\u3002"),ci.forEach(a),Sp=u(s),Re=r(s,"P",{});var Ot=p(Re);Wc=l(Ot,"\u5E78\u8FD0\u7684\u662F\uFF0C\u{1F917} Transformers \u63D0\u4F9B\u4E86\u4E00\u4E2A "),Jr=r(Ot,"CODE",{});var Uf=p(Jr);Kc=l(Uf,"DataCollatorForSeq2Seq"),Uf.forEach(a),Vc=l(Ot," \u6574\u7406\u5668\uFF0C\u5B83\u5C06\u4E3A\u6211\u4EEC\u52A8\u6001\u586B\u5145\u8F93\u5165\u548C\u6807\u7B7E\u3002 \u8981\u5B9E\u4F8B\u5316\u8FD9\u4E2A\u6536\u96C6\u5668\uFF0C\u6211\u4EEC\u53EA\u9700\u8981\u63D0\u4F9B "),Xr=r(Ot,"CODE",{});var Hf=p(Xr);Yc=l(Hf,"tokenizer"),Hf.forEach(a),Jc=l(Ot," \u548C "),Qr=r(Ot,"CODE",{});var Ff=p(Qr);Xc=l(Ff,"model"),Ff.forEach(a),Qc=l(Ot,"\uFF1A"),Ot.forEach(a),zp=u(s),sa.l(s),An=u(s),Ln=r(s,"P",{});var Mf=p(Ln);Zc=l(Mf,"\u8BA9\u6211\u4EEC\u770B\u770B\u8FD9\u4E2A\u6574\u7406\u5668\u5728\u8F93\u5165\u4E00\u5C0F\u6279\u793A\u4F8B\u65F6\u4F1A\u4EA7\u751F\u4EC0\u4E48\u3002 \u9996\u5148\uFF0C\u6211\u4EEC\u9700\u8981\u5220\u9664\u5E26\u6709\u5B57\u7B26\u4E32\u7684\u5217\uFF0C\u56E0\u4E3A\u6574\u7406\u5668\u4E0D\u77E5\u9053\u5982\u4F55\u586B\u5145\u8FD9\u4E9B\u5143\u7D20\uFF1A"),Mf.forEach(a),Dp=u(s),k(Ol.$$.fragment,s),Rp=u(s),$a=r(s,"P",{});var rr=p($a);su=l(rr,"\u7531\u4E8E collator \u9700\u8981\u4E00\u4E2A "),Zr=r(rr,"CODE",{});var Bf=p(Zr);eu=l(Bf,"dict"),Bf.forEach(a),au=l(rr," \u7684\u5217\u8868\uFF0C\u5176\u4E2D\u6BCF\u4E2A "),so=r(rr,"CODE",{});var Wf=p(so);tu=l(Wf,"dict"),Wf.forEach(a),lu=l(rr," \u4EE3\u8868\u6570\u636E\u96C6\u4E2D\u7684\u4E00\u4E2A\u793A\u4F8B\uFF0C\u6211\u4EEC\u8FD8\u9700\u8981\u5728\u5C06\u6570\u636E\u4F20\u9012\u7ED9 data collator \u4E4B\u524D\u5C06\u6570\u636E\u6574\u7406\u6210\u9884\u671F\u7684\u683C\u5F0F\uFF1A"),rr.forEach(a),Op=u(s),k(Pl.$$.fragment,s),Pp=u(s),k(Gl.$$.fragment,s),Gp=u(s),ws=r(s,"P",{});var Gs=p(ws);nu=l(Gs,"\u8FD9\u91CC\u8981\u6CE8\u610F\u7684\u4E3B\u8981\u662F\u7B2C\u4E00\u4E2A\u4F8B\u5B50\u6BD4\u7B2C\u4E8C\u4E2A\u4F8B\u5B50\u8981\u957F\uFF0C\u6240\u4EE5\u7B2C\u4E8C\u4E2A\u4F8B\u5B50\u7684 "),eo=r(Gs,"CODE",{});var Kf=p(eo);ru=l(Kf,"input_ids"),Kf.forEach(a),ou=l(Gs," \u548C "),ao=r(Gs,"CODE",{});var Vf=p(ao);pu=l(Vf,"attention_mask"),Vf.forEach(a),iu=l(Gs," \u5DF2\u7ECF\u5728\u53F3\u4FA7\u586B\u5145\u4E86\u4E00\u4E2A "),to=r(Gs,"CODE",{});var Yf=p(to);mu=l(Yf,"[PAD]"),Yf.forEach(a),cu=l(Gs," \u6807\u8BB0\uFF08\u5176 ID \u662F "),lo=r(Gs,"CODE",{});var Jf=p(lo);uu=l(Jf,"0"),Jf.forEach(a),hu=l(Gs,"\uFF09\u3002 \u7C7B\u4F3C\u5730\uFF0C\u6211\u4EEC\u53EF\u4EE5\u770B\u5230 "),no=r(Gs,"CODE",{});var Xf=p(no);fu=l(Xf,"labels"),Xf.forEach(a),du=l(Gs," \u5DF2\u7528 "),ro=r(Gs,"CODE",{});var Qf=p(ro);_u=l(Qf,"-100"),Qf.forEach(a),gu=l(Gs," \u586B\u5145\uFF0C\u4EE5\u786E\u4FDD\u586B\u5145\u6807\u8BB0\u88AB\u635F\u5931\u51FD\u6570\u5FFD\u7565\u3002 \u6700\u540E\uFF0C\u6211\u4EEC\u53EF\u4EE5\u770B\u5230\u4E00\u4E2A\u65B0\u7684 "),oo=r(Gs,"CODE",{});var Zf=p(oo);bu=l(Zf,"decoder_input_ids"),Zf.forEach(a),ju=l(Gs,"\uFF0C\u5B83\u901A\u8FC7\u5728\u7B2C\u4E00\u4E2A\u6761\u76EE\u4E2D\u63D2\u5165 "),po=r(Gs,"CODE",{});var sd=p(po);vu=l(sd,"[PAD]"),sd.forEach(a),$u=l(Gs," \u6807\u8BB0\u5C06\u6807\u7B7E\u5411\u53F3\u79FB\u52A8\u3002"),Gs.forEach(a),Ap=u(s),aa.l(s),In=u(s),Rs&&Rs.l(s),Nn=u(s),Al=r(s,"H2",{id:!0});var ed=p(Al);ku=l(ed,"\u4F7F\u7528\u60A8\u5FAE\u8C03\u7684\u6A21\u578B"),ed.forEach(a),Lp=u(s),Cn=r(s,"P",{});var ad=p(Cn);wu=l(ad,"\u5C06\u6A21\u578B\u63A8\u9001\u5230 Hub \u540E\uFF0C\u60A8\u53EF\u4EE5\u901A\u8FC7\u63A8\u7406\u5C0F\u90E8\u4EF6\u6216\u201C\u7BA1\u9053\u201D\u5BF9\u8C61\u6765\u4F7F\u7528\u5B83\uFF0C\u5982\u4E0B\u6240\u793A\uFF1A"),ad.forEach(a),Ip=u(s),k(Ll.$$.fragment,s),Np=u(s),Un=r(s,"P",{});var td=p(Un);yu=l(td,"\u6211\u4EEC\u53EF\u4EE5\u5C06\u6D4B\u8BD5\u96C6\u4E2D\u7684\u4E00\u4E9B\u793A\u4F8B\uFF08\u6A21\u578B\u8FD8\u6CA1\u6709\u770B\u5230\uFF09\u63D0\u4F9B\u7ED9\u6211\u4EEC\u7684\u7BA1\u9053\uFF0C\u4EE5\u4E86\u89E3\u751F\u6210\u6458\u8981\u7684\u8D28\u91CF\u3002 \u9996\u5148\u8BA9\u6211\u4EEC\u5B9E\u73B0\u4E00\u4E2A\u7B80\u5355\u7684\u51FD\u6570\u6765\u4E00\u8D77\u663E\u793A\u8BC4\u8BBA\u3001\u6807\u9898\u548C\u751F\u6210\u7684\u6458\u8981\uFF1A"),td.forEach(a),Cp=u(s),k(Il.$$.fragment,s),Up=u(s),Hn=r(s,"P",{});var ld=p(Hn);Eu=l(ld,"\u8BA9\u6211\u4EEC\u770B\u4E00\u4E0B\u6211\u4EEC\u5F97\u5230\u7684\u4E00\u4E2A\u82F1\u6587\u4F8B\u5B50\uFF1A"),ld.forEach(a),Hp=u(s),k(Nl.$$.fragment,s),Fp=u(s),k(Cl.$$.fragment,s),Mp=u(s),Fn=r(s,"P",{});var nd=p(Fn);xu=l(nd,"\u8FD9\u8FD8\u4E0D\u9519\uFF01 \u6211\u4EEC\u53EF\u4EE5\u770B\u5230\uFF0C\u6211\u4EEC\u7684\u6A21\u578B\u5B9E\u9645\u4E0A\u5DF2\u7ECF\u80FD\u591F\u901A\u8FC7\u589E\u52A0\u90E8\u5206\u65B0\u8BCD\u6765\u6267\u884C\u62BD\u8C61\u6458\u8981\u3002 \u4E5F\u8BB8\u6211\u4EEC\u6A21\u578B\u6700\u9177\u7684\u65B9\u9762\u662F\u5B83\u662F\u53CC\u8BED\u7684\uFF0C\u6240\u4EE5\u6211\u4EEC\u8FD8\u53EF\u4EE5\u751F\u6210\u897F\u73ED\u7259\u8BED\u8BC4\u8BBA\u7684\u6458\u8981\uFF1A"),nd.forEach(a),Bp=u(s),k(Ul.$$.fragment,s),Wp=u(s),k(Hl.$$.fragment,s),Kp=u(s),Mn=r(s,"P",{});var rd=p(Mn);Tu=l(rd,"\u6458\u8981\u7FFB\u8BD1\u6210\u4E86\u82F1\u6587\u7684\u201C\u975E\u5E38\u5BB9\u6613\u9605\u8BFB\u201D\uFF0C\u5728\u8FD9\u79CD\u60C5\u51B5\u4E0B\uFF0C\u6211\u4EEC\u53EF\u4EE5\u770B\u5230\u5B83\u662F\u76F4\u63A5\u4ECE\u8BC4\u8BBA\u4E2D\u63D0\u53D6\u7684\u3002 \u8FD9\u663E\u793A\u4E86 mT5 \u6A21\u578B\u7684\u591A\u529F\u80FD\u6027\uFF0C\u5E76\u8BA9\u60A8\u4F53\u9A8C\u4E86\u5904\u7406\u591A\u8BED\u8A00\u8BED\u6599\u5E93\u7684\u611F\u89C9\uFF01"),rd.forEach(a),Vp=u(s),Bn=r(s,"P",{});var od=p(Bn);qu=l(od,"\u63A5\u4E0B\u6765\uFF0C\u6211\u4EEC\u5C06\u628A\u6CE8\u610F\u529B\u8F6C\u5411\u7A0D\u5FAE\u590D\u6742\u7684\u4EFB\u52A1\uFF1A\u4ECE\u5934\u5F00\u59CB\u8BAD\u7EC3\u8BED\u8A00\u6A21\u578B\u3002"),od.forEach(a),this.h()},h(){b(h,"name","hf:doc:metadata"),b(h,"content",JSON.stringify(Id)),b(O,"id",""),b(H,"href","https://huggingface.co/models?pipeline_tag=summarization=downloads"),b(H,"rel","nofollow"),b(G,"href","https://huggingface.co/huggingface-course/mt5-small-finetuned-amazon-en-es"),b(G,"rel","nofollow"),or(W.src,X="https://hf.space/gradioiframe/course-demos/mt5-small-finetuned-amazon-en-es/+")||b(W,"src",X),b(W,"frameborder","0"),b(W,"height","400"),b(W,"title","Gradio app"),b(W,"class","block dark:hidden container p-0 flex-grow space-iframe"),b(W,"allow","accelerometer; ambient-light-sensor; autoplay; battery; camera; document-domain; encrypted-media; fullscreen; geolocation; gyroscope; layout-animations; legacy-image-formats; magnetometer; microphone; midi; oversized-images; payment; picture-in-picture; publickey-credentials-get; sync-xhr; usb; vr ; wake-lock; xr-spatial-tracking"),b(W,"sandbox","allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-downloads"),or(V.src,$s="https://hf.space/gradioiframe/course-demos/mt5-small-finetuned-amazon-en-es-darkmode/+")||b(V,"src",$s),b(V,"frameborder","0"),b(V,"height","400"),b(V,"title","Gradio app"),b(V,"class","hidden dark:block container p-0 flex-grow space-iframe"),b(V,"allow","accelerometer; ambient-light-sensor; autoplay; battery; camera; document-domain; encrypted-media; fullscreen; geolocation; gyroscope; layout-animations; legacy-image-formats; magnetometer; microphone; midi; oversized-images; payment; picture-in-picture; publickey-credentials-get; sync-xhr; usb; vr ; wake-lock; xr-spatial-tracking"),b(V,"sandbox","allow-forms allow-modals allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-downloads"),b(cs,"id",""),b(is,"href","https://huggingface.co/datasets/amazon_reviews_multi"),b(is,"rel","nofollow"),b(Zs,"href","/course/chapter5"),b(ra,"href","/course/chapter5"),b(Te,"class","block dark:hidden"),or(Te.src,ca="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter7/review-lengths.svg")||b(Te,"src",ca),b(Te,"alt","Word count distributions for the review titles and texts."),b(pe,"class","hidden dark:block"),or(pe.src,Vl="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter7/review-lengths-dark.svg")||b(pe,"src",Vl),b(pe,"alt","Word count distributions for the review titles and texts."),b(Is,"class","flex justify-center"),b(ha,"id",""),b(Ua,"href","/course/chapter1"),b(Fa,"align","center"),b(Ma,"align","center"),b(da,"href","https://huggingface.co/gpt2-xl"),b(da,"rel","nofollow"),b(Ba,"align","center"),b(Wa,"align","center"),b(ba,"href","https://huggingface.co/google/pegasus-large"),b(ba,"rel","nofollow"),b(Ka,"align","center"),b(mn,"align","center"),b(Yt,"href","https://huggingface.co/t5-base"),b(Yt,"rel","nofollow"),b(cn,"align","center"),b(un,"align","center"),b(Xt,"href","https://huggingface.co/google/mt5-base"),b(Xt,"rel","nofollow"),b(hn,"align","center"),b(fn,"align","center"),b(Qt,"href","https://huggingface.co/facebook/bart-base"),b(Qt,"rel","nofollow"),b(dn,"align","center"),b(_n,"align","center"),b(Zt,"href","https://huggingface.co/facebook/mbart-large-50"),b(Zt,"rel","nofollow"),b(gn,"align","center"),b(bn,"align","center"),b(sl,"class","block dark:hidden"),or(sl.src,Ru="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter7/t5.svg")||b(sl,"src",Ru),b(sl,"alt","Different tasks performed by the T5 architecture."),b(el,"class","hidden dark:block"),or(el.src,Ou="https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/en/chapter7/t5-dark.svg")||b(el,"src",Ou),b(el,"alt","Different tasks performed by the T5 architecture."),b(Qa,"class","flex justify-center"),b(al,"id",""),b(kn,"href","/course/chapter3"),b(wn,"href","/course/chapter6"),b(cl,"id",""),b(hl,"href","https://en.wikipedia.org/wiki/ROUGE_(metric)"),b(hl,"rel","nofollow"),Ko.a=null,Yo.a=null,b(Et,"id","baseline"),b(Et,"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"),b(Et,"href","#baseline"),b(Za,"class","relative group"),b(Gn,"href","/course/chapter7/6"),b(Al,"id","")},m(s,i){e(document.head,h),o(s,v,i),w(f,s,i),o(s,E,i),o(s,O,i),e(O,x),o(s,S,i),Fl[R].m(s,i),o(s,C,i),o(s,N,i),e(N,D),o(s,I,i),w(U,s,i),o(s,J,i),o(s,M,i),e(M,B),e(M,H),e(H,Q),e(M,z),e(M,G),e(G,os),e(M,ss),o(s,Z,i),o(s,W,i),o(s,ls,i),o(s,V,i),o(s,js,i),o(s,ps,i),e(ps,vs),o(s,Y,i),o(s,cs,i),e(cs,ys),o(s,es,i),o(s,ns,i),e(ns,rs),e(ns,is),e(is,j),e(ns,F),o(s,Ts,i),w(as,s,i),o(s,us,i),w(ms,s,i),o(s,g,i),o(s,A,i),e(A,qs),e(A,hs),e(hs,Ys),e(A,Es),e(A,_s),e(_s,Cs),e(A,Js),e(A,fs),e(fs,Xs),e(A,Ss),e(A,ee),e(ee,Us),e(A,he),e(A,Qs),e(Qs,Le),e(A,fe),e(A,Zs),e(Zs,se),e(A,de),o(s,zs,i),w(As,s,i),o(s,L,i),w(ts,s,i),o(s,we,i),w(ks,s,i),o(s,ds,i),o(s,Ls,i),e(Ls,ta),e(Ls,ae),e(ae,la),e(Ls,na),e(Ls,te),e(te,xs),e(Ls,Ie),o(s,le,i),w(ne,s,i),o(s,_e,i),w(Os,s,i),o(s,ye,i),o(s,gs,i),e(gs,Hs),e(gs,ge),e(ge,re),e(gs,Ne),e(gs,Fs),e(Fs,Gt),e(gs,Ea),e(gs,ra),e(ra,At),e(gs,xa),e(gs,Ta),e(Ta,Lt),e(gs,et),o(s,Ce,i),w(Ue,s,i),o(s,qa,i),o(s,bs,i),e(bs,at),e(bs,be),e(be,tt),e(bs,oa),e(bs,Sa),e(Sa,lt),e(bs,He),e(bs,pa),e(pa,Ee),e(bs,It),e(bs,Fe),e(Fe,Nt),e(bs,Ct),e(bs,ia),e(ia,Me),e(bs,Ut),o(s,za,i),w(oe,s,i),o(s,nt,i),o(s,Be,i),e(Be,Ms),o(s,xe,i),w(We,s,i),o(s,ma,i),w(Ke,s,i),o(s,rt,i),o(s,Bs,i),e(Bs,Da),e(Bs,Ra),e(Ra,Ht),e(Bs,Oa),e(Bs,Pa),e(Pa,Ft),e(Bs,je),e(Bs,Ga),e(Ga,Aa),e(Bs,Mt),o(s,ot,i),w(ve,s,i),o(s,pt,i),w(Ve,s,i),o(s,La,i),o(s,$e,i),e($e,Bt),o(s,Ia,i),o(s,Is,i),e(Is,Te),e(Is,it),e(Is,pe),o(s,Na,i),o(s,m,i),e(m,T),e(m,mt),e(mt,Yl),e(m,Jl),o(s,Ye,i),w(ua,s,i),o(s,Wt,i),o(s,Ca,i),e(Ca,ie),o(s,Kt,i),o(s,ha,i),e(ha,Xl),o(s,Vt,i),o(s,ke,i),e(ke,Ql),e(ke,Ua),e(Ua,ct),e(ke,Zl),o(s,Ha,i),o(s,Je,i),e(Je,ut),e(ut,Ws),e(Ws,Fa),e(Fa,sn),e(Ws,en),e(Ws,ht),e(ht,an),e(Ws,fa),e(Ws,Ma),e(Ma,tn),e(Je,ln),e(Je,Ps),e(Ps,me),e(me,Ba),e(Ba,da),e(da,nn),e(me,qe),e(me,_a),e(_a,rn),e(me,on),e(me,Wa),e(Wa,ga),e(Ps,pn),e(Ps,Se),e(Se,Ka),e(Ka,ba),e(ba,hi),e(Se,fi),e(Se,mr),e(mr,di),e(Se,_i),e(Se,mn),e(mn,gi),e(Ps,bi),e(Ps,Va),e(Va,cn),e(cn,Yt),e(Yt,ji),e(Va,vi),e(Va,Jt),e(Jt,$i),e(Jt,cr),e(cr,ki),e(Jt,wi),e(Va,yi),e(Va,un),e(un,Ei),e(Ps,xi),e(Ps,Ya),e(Ya,hn),e(hn,Xt),e(Xt,Ti),e(Ya,qi),e(Ya,ur),e(ur,Si),e(Ya,zi),e(Ya,fn),e(fn,Di),e(Ps,Ri),e(Ps,Ja),e(Ja,dn),e(dn,Qt),e(Qt,Oi),e(Ja,Pi),e(Ja,hr),e(hr,Gi),e(Ja,Ai),e(Ja,_n),e(_n,Li),e(Ps,Ii),e(Ps,Xa),e(Xa,gn),e(gn,Zt),e(Zt,Ni),e(Xa,Ci),e(Xa,fr),e(fr,Ui),e(Xa,Hi),e(Xa,bn),e(bn,Fi),o(s,fo,i),o(s,jn,i),e(jn,Mi),o(s,_o,i),o(s,ft,i),e(ft,Bi),e(ft,dr),e(dr,Wi),e(ft,Ki),o(s,go,i),o(s,Qa,i),e(Qa,sl),e(Qa,Vi),e(Qa,el),o(s,bo,i),o(s,vn,i),e(vn,Yi),o(s,jo,i),w(dt,s,i),o(s,vo,i),o(s,al,i),e(al,Ji),o(s,$o,i),w(tl,s,i),o(s,ko,i),o(s,_t,i),e(_t,Xi),e(_t,_r),e(_r,Qi),e(_t,Zi),o(s,wo,i),w(ll,s,i),o(s,yo,i),w(gt,s,i),o(s,Eo,i),o(s,$n,i),e($n,sm),o(s,xo,i),w(nl,s,i),o(s,To,i),w(rl,s,i),o(s,qo,i),o(s,ce,i),e(ce,em),e(ce,kn),e(kn,am),e(ce,tm),e(ce,gr),e(gr,lm),e(ce,nm),e(ce,br),e(br,rm),e(ce,om),e(ce,jr),e(jr,pm),e(ce,im),o(s,So,i),w(ol,s,i),o(s,zo,i),w(pl,s,i),o(s,Do,i),o(s,ze,i),e(ze,mm),e(ze,vr),e(vr,cm),e(ze,um),e(ze,$r),e($r,hm),e(ze,fm),e(ze,wn),e(wn,dm),e(ze,_m),o(s,Ro,i),o(s,bt,i),e(bt,gm),e(bt,kr),e(kr,bm),e(bt,jm),o(s,Oo,i),w(il,s,i),o(s,Po,i),o(s,ue,i),e(ue,vm),e(ue,wr),e(wr,$m),e(ue,km),e(ue,yr),e(yr,wm),e(ue,ym),e(ue,Er),e(Er,Em),e(ue,xm),e(ue,xr),e(xr,Tm),e(ue,qm),o(s,Go,i),o(s,ja,i),e(ja,Sm),e(ja,Tr),e(Tr,zm),e(ja,Dm),e(ja,qr),e(qr,Rm),e(ja,Om),o(s,Ao,i),w(ml,s,i),o(s,Lo,i),o(s,yn,i),e(yn,Pm),o(s,Io,i),w(jt,s,i),o(s,No,i),o(s,cl,i),e(cl,Gm),o(s,Co,i),w(ul,s,i),o(s,Uo,i),o(s,En,i),e(En,Am),o(s,Ho,i),o(s,vt,i),e(vt,Lm),e(vt,hl),e(hl,Im),e(vt,Nm),o(s,Fo,i),w(fl,s,i),o(s,Mo,i),o(s,va,i),e(va,Cm),e(va,Sr),e(Sr,Um),e(va,Hm),e(va,zr),e(zr,Fm),e(va,Mm),o(s,Bo,i),w($t,s,i),o(s,Wo,i),o(s,dl,i),e(dl,Bm),Ko.m(hd,dl),o(s,Vo,i),o(s,_l,i),e(_l,Wm),Yo.m(fd,_l),o(s,Jo,i),o(s,kt,i),e(kt,Km),e(kt,Dr),e(Dr,Vm),e(kt,Ym),o(s,Xo,i),w(gl,s,i),o(s,Qo,i),o(s,xn,i),e(xn,Jm),o(s,Zo,i),w(bl,s,i),o(s,sp,i),o(s,wt,i),e(wt,Xm),e(wt,Rr),e(Rr,Qm),e(wt,Zm),o(s,ep,i),w(jl,s,i),o(s,ap,i),w(vl,s,i),o(s,tp,i),o(s,Ks,i),e(Ks,sc),e(Ks,Or),e(Or,ec),e(Ks,ac),e(Ks,Pr),e(Pr,tc),e(Ks,lc),e(Ks,Gr),e(Gr,nc),e(Ks,rc),e(Ks,Ar),e(Ar,oc),e(Ks,pc),e(Ks,Lr),e(Lr,ic),e(Ks,mc),o(s,lp,i),w($l,s,i),o(s,np,i),w(kl,s,i),o(s,rp,i),o(s,Vs,i),e(Vs,cc),e(Vs,Ir),e(Ir,uc),e(Vs,hc),e(Vs,Nr),e(Nr,fc),e(Vs,dc),e(Vs,Cr),e(Cr,_c),e(Vs,gc),e(Vs,Ur),e(Ur,bc),e(Vs,jc),e(Vs,Hr),e(Hr,vc),e(Vs,$c),o(s,op,i),w(yt,s,i),o(s,pp,i),o(s,Tn,i),e(Tn,kc),o(s,ip,i),o(s,Za,i),e(Za,Et),e(Et,Fr),w(wl,Fr,null),e(Za,wc),e(Za,Mr),e(Mr,yc),o(s,mp,i),o(s,De,i),e(De,Ec),e(De,Br),e(Br,xc),e(De,Tc),e(De,Wr),e(Wr,qc),e(De,Sc),e(De,Kr),e(Kr,zc),e(De,Dc),o(s,cp,i),w(yl,s,i),o(s,up,i),o(s,qn,i),e(qn,Rc),o(s,hp,i),w(El,s,i),o(s,fp,i),o(s,xt,i),e(xt,Oc),e(xt,Vr),e(Vr,Pc),e(xt,Gc),o(s,dp,i),w(xl,s,i),o(s,_p,i),w(Tl,s,i),o(s,gp,i),o(s,Sn,i),e(Sn,Ac),o(s,bp,i),w(ql,s,i),o(s,jp,i),o(s,zn,i),e(zn,Lc),o(s,vp,i),w(Sl,s,i),o(s,$p,i),w(zl,s,i),o(s,kp,i),o(s,Tt,i),e(Tt,Ic),e(Tt,Yr),e(Yr,Nc),e(Tt,Cc),o(s,wp,i),Ml[Xe].m(s,i),o(s,Dn,i),w(qt,s,i),o(s,yp,i),o(s,Rn,i),e(Rn,Uc),o(s,Ep,i),w(Dl,s,i),o(s,xp,i),o(s,On,i),e(On,Hc),o(s,Tp,i),w(Rl,s,i),o(s,qp,i),Ds&&Ds.m(s,i),o(s,Pn,i),o(s,St,i),e(St,Fc),e(St,Gn),e(Gn,Mc),e(St,Bc),o(s,Sp,i),o(s,Re,i),e(Re,Wc),e(Re,Jr),e(Jr,Kc),e(Re,Vc),e(Re,Xr),e(Xr,Yc),e(Re,Jc),e(Re,Qr),e(Qr,Xc),e(Re,Qc),o(s,zp,i),Bl[Ze].m(s,i),o(s,An,i),o(s,Ln,i),e(Ln,Zc),o(s,Dp,i),w(Ol,s,i),o(s,Rp,i),o(s,$a,i),e($a,su),e($a,Zr),e(Zr,eu),e($a,au),e($a,so),e(so,tu),e($a,lu),o(s,Op,i),w(Pl,s,i),o(s,Pp,i),w(Gl,s,i),o(s,Gp,i),o(s,ws,i),e(ws,nu),e(ws,eo),e(eo,ru),e(ws,ou),e(ws,ao),e(ao,pu),e(ws,iu),e(ws,to),e(to,mu),e(ws,cu),e(ws,lo),e(lo,uu),e(ws,hu),e(ws,no),e(no,fu),e(ws,du),e(ws,ro),e(ro,_u),e(ws,gu),e(ws,oo),e(oo,bu),e(ws,ju),e(ws,po),e(po,vu),e(ws,$u),o(s,Ap,i),Wl[ea].m(s,i),o(s,In,i),Rs&&Rs.m(s,i),o(s,Nn,i),o(s,Al,i),e(Al,ku),o(s,Lp,i),o(s,Cn,i),e(Cn,wu),o(s,Ip,i),w(Ll,s,i),o(s,Np,i),o(s,Un,i),e(Un,yu),o(s,Cp,i),w(Il,s,i),o(s,Up,i),o(s,Hn,i),e(Hn,Eu),o(s,Hp,i),w(Nl,s,i),o(s,Fp,i),w(Cl,s,i),o(s,Mp,i),o(s,Fn,i),e(Fn,xu),o(s,Bp,i),w(Ul,s,i),o(s,Wp,i),w(Hl,s,i),o(s,Kp,i),o(s,Mn,i),e(Mn,Tu),o(s,Vp,i),o(s,Bn,i),e(Bn,qu),Yp=!0},p(s,[i]){const io={};i&1&&(io.fw=s[0]),f.$set(io);let Wn=R;R=Gu(s),R!==Wn&&(ir(),_(Fl[Wn],1,1,()=>{Fl[Wn]=null}),pr(),P=Fl[R],P||(P=Fl[R]=Pu[R](s),P.c()),d(P,1),P.m(C.parentNode,C));const st={};i&2&&(st.$$scope={dirty:i,ctx:s}),ks.$set(st);const mo={};i&2&&(mo.$$scope={dirty:i,ctx:s}),dt.$set(mo);const co={};i&2&&(co.$$scope={dirty:i,ctx:s}),gt.$set(co);const uo={};i&2&&(uo.$$scope={dirty:i,ctx:s}),jt.$set(uo);const ho={};i&2&&(ho.$$scope={dirty:i,ctx:s}),$t.$set(ho);const Kl={};i&2&&(Kl.$$scope={dirty:i,ctx:s}),yt.$set(Kl);let Kn=Xe;Xe=Lu(s),Xe!==Kn&&(ir(),_(Ml[Kn],1,1,()=>{Ml[Kn]=null}),pr(),Qe=Ml[Xe],Qe||(Qe=Ml[Xe]=Au[Xe](s),Qe.c()),d(Qe,1),Qe.m(Dn.parentNode,Dn));const Ns={};i&2&&(Ns.$$scope={dirty:i,ctx:s}),qt.$set(Ns),s[0]==="pt"?Ds?i&1&&d(Ds,1):(Ds=md(),Ds.c(),d(Ds,1),Ds.m(Pn.parentNode,Pn)):Ds&&(ir(),_(Ds,1,1,()=>{Ds=null}),pr());let Vn=Ze;Ze=Nu(s),Ze!==Vn&&(ir(),_(Bl[Vn],1,1,()=>{Bl[Vn]=null}),pr(),sa=Bl[Ze],sa||(sa=Bl[Ze]=Iu[Ze](s),sa.c()),d(sa,1),sa.m(An.parentNode,An));let Yn=ea;ea=Uu(s),ea!==Yn&&(ir(),_(Wl[Yn],1,1,()=>{Wl[Yn]=null}),pr(),aa=Wl[ea],aa||(aa=Wl[ea]=Cu[ea](s),aa.c()),d(aa,1),aa.m(In.parentNode,In)),s[0]==="pt"?Rs?i&1&&d(Rs,1):(Rs=cd(s),Rs.c(),d(Rs,1),Rs.m(Nn.parentNode,Nn)):Rs&&(ir(),_(Rs,1,1,()=>{Rs=null}),pr())},i(s){Yp||(d(f.$$.fragment,s),d(P),d(U.$$.fragment,s),d(as.$$.fragment,s),d(ms.$$.fragment,s),d(As.$$.fragment,s),d(ts.$$.fragment,s),d(ks.$$.fragment,s),d(ne.$$.fragment,s),d(Os.$$.fragment,s),d(Ue.$$.fragment,s),d(oe.$$.fragment,s),d(We.$$.fragment,s),d(Ke.$$.fragment,s),d(ve.$$.fragment,s),d(Ve.$$.fragment,s),d(ua.$$.fragment,s),d(dt.$$.fragment,s),d(tl.$$.fragment,s),d(ll.$$.fragment,s),d(gt.$$.fragment,s),d(nl.$$.fragment,s),d(rl.$$.fragment,s),d(ol.$$.fragment,s),d(pl.$$.fragment,s),d(il.$$.fragment,s),d(ml.$$.fragment,s),d(jt.$$.fragment,s),d(ul.$$.fragment,s),d(fl.$$.fragment,s),d($t.$$.fragment,s),d(gl.$$.fragment,s),d(bl.$$.fragment,s),d(jl.$$.fragment,s),d(vl.$$.fragment,s),d($l.$$.fragment,s),d(kl.$$.fragment,s),d(yt.$$.fragment,s),d(wl.$$.fragment,s),d(yl.$$.fragment,s),d(El.$$.fragment,s),d(xl.$$.fragment,s),d(Tl.$$.fragment,s),d(ql.$$.fragment,s),d(Sl.$$.fragment,s),d(zl.$$.fragment,s),d(Qe),d(qt.$$.fragment,s),d(Dl.$$.fragment,s),d(Rl.$$.fragment,s),d(Ds),d(sa),d(Ol.$$.fragment,s),d(Pl.$$.fragment,s),d(Gl.$$.fragment,s),d(aa),d(Rs),d(Ll.$$.fragment,s),d(Il.$$.fragment,s),d(Nl.$$.fragment,s),d(Cl.$$.fragment,s),d(Ul.$$.fragment,s),d(Hl.$$.fragment,s),Yp=!0)},o(s){_(f.$$.fragment,s),_(P),_(U.$$.fragment,s),_(as.$$.fragment,s),_(ms.$$.fragment,s),_(As.$$.fragment,s),_(ts.$$.fragment,s),_(ks.$$.fragment,s),_(ne.$$.fragment,s),_(Os.$$.fragment,s),_(Ue.$$.fragment,s),_(oe.$$.fragment,s),_(We.$$.fragment,s),_(Ke.$$.fragment,s),_(ve.$$.fragment,s),_(Ve.$$.fragment,s),_(ua.$$.fragment,s),_(dt.$$.fragment,s),_(tl.$$.fragment,s),_(ll.$$.fragment,s),_(gt.$$.fragment,s),_(nl.$$.fragment,s),_(rl.$$.fragment,s),_(ol.$$.fragment,s),_(pl.$$.fragment,s),_(il.$$.fragment,s),_(ml.$$.fragment,s),_(jt.$$.fragment,s),_(ul.$$.fragment,s),_(fl.$$.fragment,s),_($t.$$.fragment,s),_(gl.$$.fragment,s),_(bl.$$.fragment,s),_(jl.$$.fragment,s),_(vl.$$.fragment,s),_($l.$$.fragment,s),_(kl.$$.fragment,s),_(yt.$$.fragment,s),_(wl.$$.fragment,s),_(yl.$$.fragment,s),_(El.$$.fragment,s),_(xl.$$.fragment,s),_(Tl.$$.fragment,s),_(ql.$$.fragment,s),_(Sl.$$.fragment,s),_(zl.$$.fragment,s),_(Qe),_(qt.$$.fragment,s),_(Dl.$$.fragment,s),_(Rl.$$.fragment,s),_(Ds),_(sa),_(Ol.$$.fragment,s),_(Pl.$$.fragment,s),_(Gl.$$.fragment,s),_(aa),_(Rs),_(Ll.$$.fragment,s),_(Il.$$.fragment,s),_(Nl.$$.fragment,s),_(Cl.$$.fragment,s),_(Ul.$$.fragment,s),_(Hl.$$.fragment,s),Yp=!1},d(s){a(h),s&&a(v),y(f,s),s&&a(E),s&&a(O),s&&a(S),Fl[R].d(s),s&&a(C),s&&a(N),s&&a(I),y(U,s),s&&a(J),s&&a(M),s&&a(Z),s&&a(W),s&&a(ls),s&&a(V),s&&a(js),s&&a(ps),s&&a(Y),s&&a(cs),s&&a(es),s&&a(ns),s&&a(Ts),y(as,s),s&&a(us),y(ms,s),s&&a(g),s&&a(A),s&&a(zs),y(As,s),s&&a(L),y(ts,s),s&&a(we),y(ks,s),s&&a(ds),s&&a(Ls),s&&a(le),y(ne,s),s&&a(_e),y(Os,s),s&&a(ye),s&&a(gs),s&&a(Ce),y(Ue,s),s&&a(qa),s&&a(bs),s&&a(za),y(oe,s),s&&a(nt),s&&a(Be),s&&a(xe),y(We,s),s&&a(ma),y(Ke,s),s&&a(rt),s&&a(Bs),s&&a(ot),y(ve,s),s&&a(pt),y(Ve,s),s&&a(La),s&&a($e),s&&a(Ia),s&&a(Is),s&&a(Na),s&&a(m),s&&a(Ye),y(ua,s),s&&a(Wt),s&&a(Ca),s&&a(Kt),s&&a(ha),s&&a(Vt),s&&a(ke),s&&a(Ha),s&&a(Je),s&&a(fo),s&&a(jn),s&&a(_o),s&&a(ft),s&&a(go),s&&a(Qa),s&&a(bo),s&&a(vn),s&&a(jo),y(dt,s),s&&a(vo),s&&a(al),s&&a($o),y(tl,s),s&&a(ko),s&&a(_t),s&&a(wo),y(ll,s),s&&a(yo),y(gt,s),s&&a(Eo),s&&a($n),s&&a(xo),y(nl,s),s&&a(To),y(rl,s),s&&a(qo),s&&a(ce),s&&a(So),y(ol,s),s&&a(zo),y(pl,s),s&&a(Do),s&&a(ze),s&&a(Ro),s&&a(bt),s&&a(Oo),y(il,s),s&&a(Po),s&&a(ue),s&&a(Go),s&&a(ja),s&&a(Ao),y(ml,s),s&&a(Lo),s&&a(yn),s&&a(Io),y(jt,s),s&&a(No),s&&a(cl),s&&a(Co),y(ul,s),s&&a(Uo),s&&a(En),s&&a(Ho),s&&a(vt),s&&a(Fo),y(fl,s),s&&a(Mo),s&&a(va),s&&a(Bo),y($t,s),s&&a(Wo),s&&a(dl),s&&a(Vo),s&&a(_l),s&&a(Jo),s&&a(kt),s&&a(Xo),y(gl,s),s&&a(Qo),s&&a(xn),s&&a(Zo),y(bl,s),s&&a(sp),s&&a(wt),s&&a(ep),y(jl,s),s&&a(ap),y(vl,s),s&&a(tp),s&&a(Ks),s&&a(lp),y($l,s),s&&a(np),y(kl,s),s&&a(rp),s&&a(Vs),s&&a(op),y(yt,s),s&&a(pp),s&&a(Tn),s&&a(ip),s&&a(Za),y(wl),s&&a(mp),s&&a(De),s&&a(cp),y(yl,s),s&&a(up),s&&a(qn),s&&a(hp),y(El,s),s&&a(fp),s&&a(xt),s&&a(dp),y(xl,s),s&&a(_p),y(Tl,s),s&&a(gp),s&&a(Sn),s&&a(bp),y(ql,s),s&&a(jp),s&&a(zn),s&&a(vp),y(Sl,s),s&&a($p),y(zl,s),s&&a(kp),s&&a(Tt),s&&a(wp),Ml[Xe].d(s),s&&a(Dn),y(qt,s),s&&a(yp),s&&a(Rn),s&&a(Ep),y(Dl,s),s&&a(xp),s&&a(On),s&&a(Tp),y(Rl,s),s&&a(qp),Ds&&Ds.d(s),s&&a(Pn),s&&a(St),s&&a(Sp),s&&a(Re),s&&a(zp),Bl[Ze].d(s),s&&a(An),s&&a(Ln),s&&a(Dp),y(Ol,s),s&&a(Rp),s&&a($a),s&&a(Op),y(Pl,s),s&&a(Pp),y(Gl,s),s&&a(Gp),s&&a(ws),s&&a(Ap),Wl[ea].d(s),s&&a(In),Rs&&Rs.d(s),s&&a(Nn),s&&a(Al),s&&a(Lp),s&&a(Cn),s&&a(Ip),y(Ll,s),s&&a(Np),s&&a(Un),s&&a(Cp),y(Il,s),s&&a(Up),s&&a(Hn),s&&a(Hp),y(Nl,s),s&&a(Fp),y(Cl,s),s&&a(Mp),s&&a(Fn),s&&a(Bp),y(Ul,s),s&&a(Wp),y(Hl,s),s&&a(Kp),s&&a(Mn),s&&a(Vp),s&&a(Bn)}}}const Id={local:"",sections:[{local:"",title:"\u51C6\u5907\u591A\u8BED\u8A00\u8BED\u6599\u5E93"},{local:"",title:"\u6587\u672C\u6458\u8981\u6A21\u578B"},{local:"",title:"\u9884\u5904\u7406\u6570\u636E"},{local:"",sections:[{local:"baseline",title:"\u521B\u5EFA\u5F3A\u5927\u7684baseline"}],title:"\u6587\u672C\u6458\u8981\u7684\u6307\u6807"},{local:"trainer-apimt5",title:"\u4F7F\u7528 `Trainer` API\u5FAE\u8C03mT5 "},{local:"keras-apimt5",title:"\u4F7F\u7528 `Keras` API\u5FAE\u8C03mT5 "},{local:"accelerate-mt5",sections:[{local:"",title:"\u4E3A\u8BAD\u7EC3\u505A\u597D\u4E00\u5207\u51C6\u5907"},{local:"",title:"\u8BAD\u7EC3\u5FAA\u73AF"}],title:"\u4F7F\u7528 \u{1F917} Accelerate \u5FAE\u8C03 mT5"},{local:"",title:"\u4F7F\u7528\u60A8\u5FAE\u8C03\u7684\u6A21\u578B"}],title:"\u63D0\u53D6\u6587\u672C\u6458\u8981"};function Nd(K,h,v){let f="pt";return jd(()=>{const E=new URLSearchParams(window.location.search);v(0,f=E.get("fw")||"pt")}),[f]}class Kd extends dd{constructor(h){super();_d(this,h,Nd,Ld,gd,{})}}export{Kd as default,Id as metadata};
