import{s as I,n as J,o as Q}from"../chunks/scheduler.37c15a92.js";import{S as V,i as W,g as o,s as l,r as B,A as X,h as i,f as a,c as s,j as O,u as R,x as d,k as D,y as Z,a as n,v as S,d as q,t as N,w as U}from"../chunks/index.2bf4358c.js";import{Y as tt}from"../chunks/Youtube.1e50a667.js";import{C as et}from"../chunks/CourseFloatingBanner.9ff4c771.js";import{H as at,E as nt}from"../chunks/getInferenceSnippets.24b50994.js";function lt(Y){let r,v,x,w,m,C,f,T,p,P,u,j="编码器-解码器模型（也称为序列到序列模型）同时使用 Transformer 架构的编码器和解码器两个部分。在每个阶段，编码器的注意力层可以访问输入句子中的所有单词，而解码器的注意力层只能访问位于输入中将要预测单词前面的单词。",E,c,k='这些模型的预训练可以使用训练编码器或解码器模型的方式来完成，但通常会更加复杂。例如， <a href="https://huggingface.co/t5-base" rel="nofollow">T5</a> 通过用单个掩码特殊词替换随机文本范围（可能包含多个词）进行预训练，然后目标是预测被遮盖单词原始的文本。',M,$,F="序列到序列模型最适合于围绕根据给定输入生成新句子的任务，如摘要、翻译或生成性问答。",y,h,G="该系列模型的典型代表有：",H,_,K='<li><a href="https://huggingface.co/transformers/model_doc/bart" rel="nofollow">BART</a></li> <li><a href="https://huggingface.co/transformers/model_doc/mbart" rel="nofollow">mBART</a></li> <li><a href="https://huggingface.co/transformers/model_doc/marian" rel="nofollow">Marian</a></li> <li><a href="https://huggingface.co/transformers/model_doc/t5" rel="nofollow">T5</a></li>',L,g,A,b,z;return m=new at({props:{title:"编码器-解码器模型",local:"编码器-解码器模型",headingTag:"h1"}}),f=new et({props:{chapter:1,classNames:"absolute z-10 right-0 top-0"}}),p=new tt({props:{id:"0_4KEb08xrE"}}),g=new nt({props:{source:"https://github.com/huggingface/course/blob/main/chapters/zh-CN/chapter1/7.mdx"}}),{c(){r=o("meta"),v=l(),x=o("p"),w=l(),B(m.$$.fragment),C=l(),B(f.$$.fragment),T=l(),B(p.$$.fragment),P=l(),u=o("p"),u.textContent=j,E=l(),c=o("p"),c.innerHTML=k,M=l(),$=o("p"),$.textContent=F,y=l(),h=o("p"),h.textContent=G,H=l(),_=o("ul"),_.innerHTML=K,L=l(),B(g.$$.fragment),A=l(),b=o("p"),this.h()},l(t){const e=X("svelte-u9bgzb",document.head);r=i(e,"META",{name:!0,content:!0}),e.forEach(a),v=s(t),x=i(t,"P",{}),O(x).forEach(a),w=s(t),R(m.$$.fragment,t),C=s(t),R(f.$$.fragment,t),T=s(t),R(p.$$.fragment,t),P=s(t),u=i(t,"P",{"data-svelte-h":!0}),d(u)!=="svelte-1w1vxs9"&&(u.textContent=j),E=s(t),c=i(t,"P",{"data-svelte-h":!0}),d(c)!=="svelte-bopefu"&&(c.innerHTML=k),M=s(t),$=i(t,"P",{"data-svelte-h":!0}),d($)!=="svelte-1x73vbl"&&($.textContent=F),y=s(t),h=i(t,"P",{"data-svelte-h":!0}),d(h)!=="svelte-rgo3yq"&&(h.textContent=G),H=s(t),_=i(t,"UL",{"data-svelte-h":!0}),d(_)!=="svelte-1w8l38s"&&(_.innerHTML=K),L=s(t),R(g.$$.fragment,t),A=s(t),b=i(t,"P",{}),O(b).forEach(a),this.h()},h(){D(r,"name","hf:doc:metadata"),D(r,"content",st)},m(t,e){Z(document.head,r),n(t,v,e),n(t,x,e),n(t,w,e),S(m,t,e),n(t,C,e),S(f,t,e),n(t,T,e),S(p,t,e),n(t,P,e),n(t,u,e),n(t,E,e),n(t,c,e),n(t,M,e),n(t,$,e),n(t,y,e),n(t,h,e),n(t,H,e),n(t,_,e),n(t,L,e),S(g,t,e),n(t,A,e),n(t,b,e),z=!0},p:J,i(t){z||(q(m.$$.fragment,t),q(f.$$.fragment,t),q(p.$$.fragment,t),q(g.$$.fragment,t),z=!0)},o(t){N(m.$$.fragment,t),N(f.$$.fragment,t),N(p.$$.fragment,t),N(g.$$.fragment,t),z=!1},d(t){t&&(a(v),a(x),a(w),a(C),a(T),a(P),a(u),a(E),a(c),a(M),a($),a(y),a(h),a(H),a(_),a(L),a(A),a(b)),a(r),U(m,t),U(f,t),U(p,t),U(g,t)}}}const st='{"title":"编码器-解码器模型","local":"编码器-解码器模型","sections":[],"depth":1}';function rt(Y){return Q(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ut extends V{constructor(r){super(),W(this,r,rt,lt,I,{})}}export{ut as component};
