import{S as Ki,i as er,s as lr,e as t,k as m,w as p,t as n,M as ar,c as o,d as a,m as c,a as s,x as f,h as i,b as u,G as l,g as d,y as g,L as tr,q as h,o as b,B as M,v as or}from"../chunks/vendor-hf-doc-builder.js";import{I as ie}from"../chunks/IconCopyLink-hf-doc-builder.js";import{C as T}from"../chunks/CodeBlock-hf-doc-builder.js";import{D as sr}from"../chunks/DocNotebookDropdown-hf-doc-builder.js";function nr(Tn){let Z,pa,X,B,ml,re,$t,cl,Zt,fa,de,ga,w,Xt,ul,It,Ct,me,xt,zt,ha,I,W,pl,ce,Gt,fl,Lt,ba,Ze,Rt,Ma,C,V,gl,ue,Bt,hl,Wt,Ea,Xe,Vt,ya,E,Ie,bl,qt,Dt,Nt,Ce,Ml,Ft,At,Qt,xe,El,Pt,St,Yt,ze,yl,Ot,Ht,Kt,Ge,vl,eo,lo,ao,Le,_l,to,oo,so,Re,Jl,no,io,va,_,ro,kl,mo,co,Ul,uo,po,Tl,fo,go,_a,q,ho,wl,bo,Mo,Ja,pe,ka,D,Eo,jl,yo,vo,Ua,fe,Ta,Be,_o,wa,ge,ja,J,Jo,$l,ko,Uo,Zl,To,wo,Xl,jo,$o,$a,he,Za,N,Zo,Il,Xo,Io,Xa,be,Ia,j,Co,Me,xo,zo,Cl,Go,Lo,Ca,x,F,xl,Ee,Ro,zl,Bo,xa,We,Wo,za,A,Ve,Gl,Vo,qo,Do,qe,Ll,No,Fo,Ga,De,Ao,La,z,Q,Rl,ye,Qo,Bl,Po,Ra,Ne,So,Ba,P,Fe,Wl,Yo,Oo,Ho,Ae,Vl,Ko,es,Wa,Qe,ls,Va,G,S,ql,ve,as,Dl,ts,qa,Pe,os,Da,Y,Se,Nl,ss,ns,is,Ye,Fl,rs,ds,Na,Oe,ms,Fa,L,O,Al,_e,cs,Ql,us,Aa,He,ps,Qa,H,Ke,Pl,fs,gs,hs,el,Sl,bs,Ms,Pa,K,Es,Yl,ys,vs,Sa,Je,Ya,ll,_s,Oa,ke,Ha,k,Js,Ol,ks,Us,Hl,Ts,ws,Kl,js,$s,Ka,Ue,et,R,ee,ea,Te,Zs,la,Xs,lt,al,Is,at,y,tl,aa,Cs,xs,zs,ol,ta,Gs,Ls,Rs,sl,oa,Bs,Ws,Vs,nl,sa,qs,Ds,Ns,na,ia,Fs,tt,le,As,ra,Qs,Ps,ot,we,st,il,Ss,nt,je,it,U,Ys,da,Os,Hs,ma,Ks,en,ca,ln,an,rt,$e,dt,ae,tn,ua,on,sn,mt;return re=new ie({}),de=new sr({props:{classNames:"absolute z-10 right-0 top-0",options:[{label:"Mixed",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/es/multilingual.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/es/pytorch/multilingual.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/es/tensorflow/multilingual.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/es/multilingual.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/es/pytorch/multilingual.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/es/tensorflow/multilingual.ipynb"}]}}),ce=new ie({}),ue=new ie({}),pe=new T({props:{code:"aW1wb3J0JTIwdG9yY2glMEFmcm9tJTIwdHJhbnNmb3JtZXJzJTIwaW1wb3J0JTIwWExNVG9rZW5pemVyJTJDJTIwWExNV2l0aExNSGVhZE1vZGVsJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwWExNVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJ4bG0tY2xtLWVuZnItMTAyNCUyMiklMEFtb2RlbCUyMCUzRCUyMFhMTVdpdGhMTUhlYWRNb2RlbC5mcm9tX3ByZXRyYWluZWQoJTIyeGxtLWNsbS1lbmZyLTEwMjQlMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> XLMTokenizer, XLMWithLMHeadModel

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = XLMTokenizer.from_pretrained(<span class="hljs-string">&quot;xlm-clm-enfr-1024&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = XLMWithLMHeadModel.from_pretrained(<span class="hljs-string">&quot;xlm-clm-enfr-1024&quot;</span>)`}}),fe=new T({props:{code:"cHJpbnQodG9rZW5pemVyLmxhbmcyaWQp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(tokenizer.lang2id)
{<span class="hljs-string">&#x27;en&#x27;</span>: <span class="hljs-number">0</span>, <span class="hljs-string">&#x27;fr&#x27;</span>: <span class="hljs-number">1</span>}`}}),ge=new T({props:{code:"aW5wdXRfaWRzJTIwJTNEJTIwdG9yY2gudGVuc29yKCU1QnRva2VuaXplci5lbmNvZGUoJTIyV2lraXBlZGlhJTIwd2FzJTIwdXNlZCUyMHRvJTIyKSU1RCklMjAlMjAlMjMlMjBiYXRjaCUyMHNpemUlMjBvZiUyMDE=",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>input_ids = torch.tensor([tokenizer.encode(<span class="hljs-string">&quot;Wikipedia was used to&quot;</span>)])  <span class="hljs-comment"># batch size of 1</span>'}}),he=new T({props:{code:"bGFuZ3VhZ2VfaWQlMjAlM0QlMjB0b2tlbml6ZXIubGFuZzJpZCU1QiUyMmVuJTIyJTVEJTIwJTIwJTIzJTIwMCUwQWxhbmdzJTIwJTNEJTIwdG9yY2gudGVuc29yKCU1Qmxhbmd1YWdlX2lkJTVEJTIwKiUyMGlucHV0X2lkcy5zaGFwZSU1QjElNUQpJTIwJTIwJTIzJTIwdG9yY2gudGVuc29yKCU1QjAlMkMlMjAwJTJDJTIwMCUyQyUyMC4uLiUyQyUyMDAlNUQpJTBBJTBBJTIzJTIwV2UlMjByZXNoYXBlJTIwaXQlMjB0byUyMGJlJTIwb2YlMjBzaXplJTIwKGJhdGNoX3NpemUlMkMlMjBzZXF1ZW5jZV9sZW5ndGgpJTBBbGFuZ3MlMjAlM0QlMjBsYW5ncy52aWV3KDElMkMlMjAtMSklMjAlMjAlMjMlMjBpcyUyMG5vdyUyMG9mJTIwc2hhcGUlMjAlNUIxJTJDJTIwc2VxdWVuY2VfbGVuZ3RoJTVEJTIwKHdlJTIwaGF2ZSUyMGElMjBiYXRjaCUyMHNpemUlMjBvZiUyMDEp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>language_id = tokenizer.lang2id[<span class="hljs-string">&quot;en&quot;</span>]  <span class="hljs-comment"># 0</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>langs = torch.tensor([language_id] * input_ids.shape[<span class="hljs-number">1</span>])  <span class="hljs-comment"># torch.tensor([0, 0, 0, ..., 0])</span>

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># We reshape it to be of size (batch_size, sequence_length)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>langs = langs.view(<span class="hljs-number">1</span>, -<span class="hljs-number">1</span>)  <span class="hljs-comment"># is now of shape [1, sequence_length] (we have a batch size of 1)</span>`}}),be=new T({props:{code:"b3V0cHV0cyUyMCUzRCUyMG1vZGVsKGlucHV0X2lkcyUyQyUyMGxhbmdzJTNEbGFuZ3Mp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(input_ids, langs=langs)'}}),Ee=new ie({}),ye=new ie({}),ve=new ie({}),_e=new ie({}),Je=new T({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyME0yTTEwMEZvckNvbmRpdGlvbmFsR2VuZXJhdGlvbiUyQyUyME0yTTEwMFRva2VuaXplciUwQSUwQWVuX3RleHQlMjAlM0QlMjAlMjJEbyUyMG5vdCUyMG1lZGRsZSUyMGluJTIwdGhlJTIwYWZmYWlycyUyMG9mJTIwd2l6YXJkcyUyQyUyMGZvciUyMHRoZXklMjBhcmUlMjBzdWJ0bGUlMjBhbmQlMjBxdWljayUyMHRvJTIwYW5nZXIuJTIyJTBBY2hpbmVzZV90ZXh0JTIwJTNEJTIwJTIyJUU0JUI4JThEJUU4JUE2JTgxJUU2JThGJTkyJUU2JTg5JThCJUU1JUI3JUFCJUU1JUI4JUFCJUU3JTlBJTg0JUU0JUJBJThCJUU1JThCJTk5JTJDJTIwJUU1JTlCJUEwJUU3JTgyJUJBJUU0JUJCJTk2JUU1JTgwJTkxJUU2JTk4JUFGJUU1JUJFJUFFJUU1JUE2JTk5JUU3JTlBJTg0JTJDJTIwJUU1JUJFJTg4JUU1JUJGJUFCJUU1JUIwJUIxJUU2JTlDJTgzJUU3JTk5JUJDJUU2JTgwJTkyLiUyMiUwQSUwQXRva2VuaXplciUyMCUzRCUyME0yTTEwMFRva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyZmFjZWJvb2slMkZtMm0xMDBfNDE4TSUyMiUyQyUyMHNyY19sYW5nJTNEJTIyemglMjIpJTBBbW9kZWwlMjAlM0QlMjBNMk0xMDBGb3JDb25kaXRpb25hbEdlbmVyYXRpb24uZnJvbV9wcmV0cmFpbmVkKCUyMmZhY2Vib29rJTJGbTJtMTAwXzQxOE0lMjIp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> M2M100ForConditionalGeneration, M2M100Tokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>en_text = <span class="hljs-string">&quot;Do not meddle in the affairs of wizards, for they are subtle and quick to anger.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>chinese_text = <span class="hljs-string">&quot;\u4E0D\u8981\u63D2\u624B\u5DEB\u5E2B\u7684\u4E8B\u52D9, \u56E0\u70BA\u4ED6\u5011\u662F\u5FAE\u5999\u7684, \u5F88\u5FEB\u5C31\u6703\u767C\u6012.&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = M2M100Tokenizer.from_pretrained(<span class="hljs-string">&quot;facebook/m2m100_418M&quot;</span>, src_lang=<span class="hljs-string">&quot;zh&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = M2M100ForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;facebook/m2m100_418M&quot;</span>)`}}),ke=new T({props:{code:"ZW5jb2RlZF96aCUyMCUzRCUyMHRva2VuaXplcihjaGluZXNlX3RleHQlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKQ==",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>encoded_zh = tokenizer(chinese_text, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)'}}),Ue=new T({props:{code:"Z2VuZXJhdGVkX3Rva2VucyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKCoqZW5jb2RlZF96aCUyQyUyMGZvcmNlZF9ib3NfdG9rZW5faWQlM0R0b2tlbml6ZXIuZ2V0X2xhbmdfaWQoJTIyZW4lMjIpKSUwQXRva2VuaXplci5iYXRjaF9kZWNvZGUoZ2VuZXJhdGVkX3Rva2VucyUyQyUyMHNraXBfc3BlY2lhbF90b2tlbnMlM0RUcnVlKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>generated_tokens = model.generate(**encoded_zh, forced_bos_token_id=tokenizer.get_lang_id(<span class="hljs-string">&quot;en&quot;</span>))
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.batch_decode(generated_tokens, skip_special_tokens=<span class="hljs-literal">True</span>)
<span class="hljs-string">&#x27;Do not interfere with the matters of the witches, because they are delicate and will soon be angry.&#x27;</span>`}}),Te=new ie({}),we=new T({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBBdXRvTW9kZWxGb3JTZXEyU2VxTE0lMEElMEFlbl90ZXh0JTIwJTNEJTIwJTIyRG8lMjBub3QlMjBtZWRkbGUlMjBpbiUyMHRoZSUyMGFmZmFpcnMlMjBvZiUyMHdpemFyZHMlMkMlMjBmb3IlMjB0aGV5JTIwYXJlJTIwc3VidGxlJTIwYW5kJTIwcXVpY2slMjB0byUyMGFuZ2VyLiUyMiUwQWZpX3RleHQlMjAlM0QlMjAlMjIlQzMlODRsJUMzJUE0JTIwc2VrYWFubnUlMjB2ZWxob2plbiUyMGFzaW9paGluJTJDJTIwc2lsbCVDMyVBNCUyMG5lJTIwb3ZhdCUyMGhpZW5vdmFyYWlzaWElMjBqYSUyMG5vcGVhc3RpJTIwdmloYWlzaWEuJTIyJTBBJTBBdG9rZW5pemVyJTIwJTNEJTIwQXV0b1Rva2VuaXplci5mcm9tX3ByZXRyYWluZWQoJTIyZmFjZWJvb2slMkZtYmFydC1sYXJnZS01MC1tYW55LXRvLW1hbnktbW10JTIyJTJDJTIwc3JjX2xhbmclM0QlMjJmaV9GSSUyMiklMEFtb2RlbCUyMCUzRCUyMEF1dG9Nb2RlbEZvclNlcTJTZXFMTS5mcm9tX3ByZXRyYWluZWQoJTIyZmFjZWJvb2slMkZtYmFydC1sYXJnZS01MC1tYW55LXRvLW1hbnktbW10JTIyKQ==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, AutoModelForSeq2SeqLM

<span class="hljs-meta">&gt;&gt;&gt; </span>en_text = <span class="hljs-string">&quot;Do not meddle in the affairs of wizards, for they are subtle and quick to anger.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>fi_text = <span class="hljs-string">&quot;\xC4l\xE4 sekaannu velhojen asioihin, sill\xE4 ne ovat hienovaraisia ja nopeasti vihaisia.&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;facebook/mbart-large-50-many-to-many-mmt&quot;</span>, src_lang=<span class="hljs-string">&quot;fi_FI&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForSeq2SeqLM.from_pretrained(<span class="hljs-string">&quot;facebook/mbart-large-50-many-to-many-mmt&quot;</span>)`}}),je=new T({props:{code:"ZW5jb2RlZF9lbiUyMCUzRCUyMHRva2VuaXplcihlbl90ZXh0JTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMik=",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>encoded_en = tokenizer(en_text, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)'}}),$e=new T({props:{code:"Z2VuZXJhdGVkX3Rva2VucyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKCoqZW5jb2RlZF9lbiUyQyUyMGZvcmNlZF9ib3NfdG9rZW5faWQlM0R0b2tlbml6ZXIubGFuZ19jb2RlX3RvX2lkKCUyMmVuX1hYJTIyKSklMEF0b2tlbml6ZXIuYmF0Y2hfZGVjb2RlKGdlbmVyYXRlZF90b2tlbnMlMkMlMjBza2lwX3NwZWNpYWxfdG9rZW5zJTNEVHJ1ZSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>generated_tokens = model.generate(**encoded_en, forced_bos_token_id=tokenizer.lang_code_to_id(<span class="hljs-string">&quot;en_XX&quot;</span>))
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.batch_decode(generated_tokens, skip_special_tokens=<span class="hljs-literal">True</span>)
<span class="hljs-string">&quot;Don&#x27;t interfere with the wizard&#x27;s affairs, because they are subtle, will soon get angry.&quot;</span>`}}),{c(){Z=t("meta"),pa=m(),X=t("h1"),B=t("a"),ml=t("span"),p(re.$$.fragment),$t=m(),cl=t("span"),Zt=n("Modelos multiling\xFCes para inferencia"),fa=m(),p(de.$$.fragment),ga=m(),w=t("p"),Xt=n("Existen varios modelos multiling\xFCes en \u{1F917} Transformers y su uso para inferencia difiere de los modelos monoling\xFCes. Sin embargo, no "),ul=t("em"),It=n("todos"),Ct=n(" los usos de los modelos multiling\xFCes son diferentes. Algunos modelos, como "),me=t("a"),xt=n("bert-base-multilingual-uncased"),zt=n(", pueden utilizarse igual que un modelo monoling\xFCe. Esta gu\xEDa te ense\xF1ar\xE1 c\xF3mo utilizar modelos multiling\xFCes cuyo uso difiere en la inferencia."),ha=m(),I=t("h2"),W=t("a"),pl=t("span"),p(ce.$$.fragment),Gt=m(),fl=t("span"),Lt=n("XLM"),ba=m(),Ze=t("p"),Rt=n("XLM tiene diez checkpoints diferentes de los cuales solo uno es monoling\xFCe. Los nueve checkpoints restantes del modelo pueden dividirse en dos categor\xEDas: los checkpoints que utilizan language embeddings y los que no."),Ma=m(),C=t("h3"),V=t("a"),gl=t("span"),p(ue.$$.fragment),Bt=m(),hl=t("span"),Wt=n("XLM con language embeddings"),Ea=m(),Xe=t("p"),Vt=n("Los siguientes modelos XLM usan language embeddings para especificar el lenguaje utilizado en la inferencia:"),ya=m(),E=t("ul"),Ie=t("li"),bl=t("code"),qt=n("xlm-mlm-ende-1024"),Dt=n(" (Masked language modeling, English-German)"),Nt=m(),Ce=t("li"),Ml=t("code"),Ft=n("xlm-mlm-enfr-1024"),At=n(" (Masked language modeling, English-French)"),Qt=m(),xe=t("li"),El=t("code"),Pt=n("xlm-mlm-enro-1024"),St=n(" (Masked language modeling, English-Romanian)"),Yt=m(),ze=t("li"),yl=t("code"),Ot=n("xlm-mlm-xnli15-1024"),Ht=n(" (Masked language modeling, XNLI languages)"),Kt=m(),Ge=t("li"),vl=t("code"),eo=n("xlm-mlm-tlm-xnli15-1024"),lo=n(" (Masked language modeling + translation, XNLI languages)"),ao=m(),Le=t("li"),_l=t("code"),to=n("xlm-clm-enfr-1024"),oo=n(" (Causal language modeling, English-French)"),so=m(),Re=t("li"),Jl=t("code"),no=n("xlm-clm-ende-1024"),io=n(" (Causal language modeling, English-German)"),va=m(),_=t("p"),ro=n("Los language embeddings son representados como un tensor de la mismas dimensiones que los "),kl=t("code"),mo=n("input_ids"),co=n(" pasados al modelo. Los valores de estos tensores dependen del idioma utilizado y se identifican mediante los atributos "),Ul=t("code"),uo=n("lang2id"),po=n(" y "),Tl=t("code"),fo=n("id2lang"),go=n(" del tokenizador."),_a=m(),q=t("p"),ho=n("En este ejemplo, carga el checkpoint "),wl=t("code"),bo=n("xlm-clm-enfr-1024"),Mo=n(" (Causal language modeling, English-French):"),Ja=m(),p(pe.$$.fragment),ka=m(),D=t("p"),Eo=n("El atributo "),jl=t("code"),yo=n("lang2id"),vo=n(" del tokenizador muestra los idiomas de este modelo y sus ids:"),Ua=m(),p(fe.$$.fragment),Ta=m(),Be=t("p"),_o=n("A continuaci\xF3n, crea un input de ejemplo:"),wa=m(),p(ge.$$.fragment),ja=m(),J=t("p"),Jo=n("Establece el id del idioma, por ejemplo "),$l=t("code"),ko=n('"en"'),Uo=n(", y util\xEDzalo para definir el language embedding. El language embedding es un tensor lleno de "),Zl=t("code"),To=n("0"),wo=n(" ya que es el id del idioma para ingl\xE9s. Este tensor debe ser del mismo tama\xF1o que "),Xl=t("code"),jo=n("input_ids"),$o=n("."),$a=m(),p(he.$$.fragment),Za=m(),N=t("p"),Zo=n("Ahora puedes pasar los "),Il=t("code"),Xo=n("input_ids"),Io=n(" y el language embedding al modelo:"),Xa=m(),p(be.$$.fragment),Ia=m(),j=t("p"),Co=n("El script "),Me=t("a"),xo=n("run_generation.py"),zo=n(" puede generar texto con language embeddings utilizando los checkpoints "),Cl=t("code"),Go=n("xlm-clm"),Lo=n("."),Ca=m(),x=t("h3"),F=t("a"),xl=t("span"),p(Ee.$$.fragment),Ro=m(),zl=t("span"),Bo=n("XLM sin language embeddings"),xa=m(),We=t("p"),Wo=n("Los siguientes modelos XLM no requieren language embeddings durante la inferencia:"),za=m(),A=t("ul"),Ve=t("li"),Gl=t("code"),Vo=n("xlm-mlm-17-1280"),qo=n(" (modelado de lenguaje enmascarado, 17 idiomas)"),Do=m(),qe=t("li"),Ll=t("code"),No=n("xlm-mlm-100-1280"),Fo=n(" (modelado de lenguaje enmascarado, 100 idiomas)"),Ga=m(),De=t("p"),Ao=n("Estos modelos se utilizan para representaciones gen\xE9ricas de frases a diferencia de los anteriores checkpoints XLM."),La=m(),z=t("h2"),Q=t("a"),Rl=t("span"),p(ye.$$.fragment),Qo=m(),Bl=t("span"),Po=n("BERT"),Ra=m(),Ne=t("p"),So=n("Los siguientes modelos de BERT pueden utilizarse para tareas multiling\xFCes:"),Ba=m(),P=t("ul"),Fe=t("li"),Wl=t("code"),Yo=n("bert-base-multilingual-uncased"),Oo=n(" (modelado de lenguaje enmascarado + predicci\xF3n de la siguiente oraci\xF3n, 102 idiomas)"),Ho=m(),Ae=t("li"),Vl=t("code"),Ko=n("bert-base-multilingual-cased"),es=n(" (modelado de lenguaje enmascarado + predicci\xF3n de la siguiente oraci\xF3n, 104 idiomas)"),Wa=m(),Qe=t("p"),ls=n(`Estos modelos no requieren language embeddings durante la inferencia. Deben identificar la lengua a partir del
contexto e inferir en consecuencia.`),Va=m(),G=t("h2"),S=t("a"),ql=t("span"),p(ve.$$.fragment),as=m(),Dl=t("span"),ts=n("XLM-RoBERTa"),qa=m(),Pe=t("p"),os=n("Los siguientes modelos de XLM-RoBERTa pueden utilizarse para tareas multiling\xFCes:"),Da=m(),Y=t("ul"),Se=t("li"),Nl=t("code"),ss=n("xlm-roberta-base"),ns=n(" (modelado de lenguaje enmascarado, 100 idiomas)"),is=m(),Ye=t("li"),Fl=t("code"),rs=n("xlm-roberta-large"),ds=n(" (Modelado de lenguaje enmascarado, 100 idiomas)"),Na=m(),Oe=t("p"),ms=n("XLM-RoBERTa se entren\xF3 con 2,5 TB de datos CommonCrawl reci\xE9n creados y depurados en 100 idiomas. Proporciona fuertes ventajas sobre los modelos multiling\xFCes publicados anteriormente como mBERT o XLM en tareas posteriores como la clasificaci\xF3n, el etiquetado de secuencias y la respuesta a preguntas."),Fa=m(),L=t("h2"),O=t("a"),Al=t("span"),p(_e.$$.fragment),cs=m(),Ql=t("span"),us=n("M2M100"),Aa=m(),He=t("p"),ps=n("Los siguientes modelos de M2M100 pueden utilizarse para traducci\xF3n multiling\xFCe:"),Qa=m(),H=t("ul"),Ke=t("li"),Pl=t("code"),fs=n("facebook/m2m100_418M"),gs=n(" (traducci\xF3n)"),hs=m(),el=t("li"),Sl=t("code"),bs=n("facebook/m2m100_1.2B"),Ms=n(" (traducci\xF3n)"),Pa=m(),K=t("p"),Es=n("En este ejemplo, carga el checkpoint "),Yl=t("code"),ys=n("facebook/m2m100_418M"),vs=n(" para traducir del chino al ingl\xE9s. Puedes establecer el idioma de origen en el tokenizador:"),Sa=m(),p(Je.$$.fragment),Ya=m(),ll=t("p"),_s=n("Tokeniza el texto:"),Oa=m(),p(ke.$$.fragment),Ha=m(),k=t("p"),Js=n("M2M100 fuerza el id del idioma de destino como el primer token generado para traducir al idioma de destino.. Establece el "),Ol=t("code"),ks=n("forced_bos_token_id"),Us=n(" a "),Hl=t("code"),Ts=n("en"),ws=n(" en el m\xE9todo "),Kl=t("code"),js=n("generate"),$s=n(" para traducir al ingl\xE9s:"),Ka=m(),p(Ue.$$.fragment),et=m(),R=t("h2"),ee=t("a"),ea=t("span"),p(Te.$$.fragment),Zs=m(),la=t("span"),Xs=n("MBart"),lt=m(),al=t("p"),Is=n("Los siguientes modelos de MBart pueden utilizarse para traducci\xF3n multiling\xFCe:"),at=m(),y=t("ul"),tl=t("li"),aa=t("code"),Cs=n("facebook/mbart-large-50-one-to-many-mmt"),xs=n(" (traducci\xF3n autom\xE1tica multiling\xFCe de uno a muchos, 50 idiomas)"),zs=m(),ol=t("li"),ta=t("code"),Gs=n("facebook/mbart-large-50-many-to-many-mmt"),Ls=n(" (traducci\xF3n autom\xE1tica multiling\xFCe de muchos a muchos, 50 idiomas)"),Rs=m(),sl=t("li"),oa=t("code"),Bs=n("facebook/mbart-large-50-many-to-one-mmt"),Ws=n(" (traducci\xF3n autom\xE1tica multiling\xFCe muchos a uno, 50 idiomas)"),Vs=m(),nl=t("li"),sa=t("code"),qs=n("facebook/mbart-large-50"),Ds=n(" (traducci\xF3n multiling\xFCe, 50 idiomas)"),Ns=m(),na=t("li"),ia=t("code"),Fs=n("facebook/mbart-large-cc25"),tt=m(),le=t("p"),As=n("En este ejemplo, carga el checkpoint "),ra=t("code"),Qs=n("facebook/mbart-large-50-many-to-many-mmt"),Ps=n(" para traducir del finland\xE9s al ingl\xE9s. Puedes establecer el idioma de origen en el tokenizador:"),ot=m(),p(we.$$.fragment),st=m(),il=t("p"),Ss=n("Tokeniza el texto:"),nt=m(),p(je.$$.fragment),it=m(),U=t("p"),Ys=n("MBart fuerza el id del idioma de destino como el primer token generado para traducirlo. Establece el "),da=t("code"),Os=n("forced_bos_token_id"),Hs=n(" a "),ma=t("code"),Ks=n("en"),en=n(" en el m\xE9todo "),ca=t("code"),ln=n("generate"),an=n(" para traducir al ingl\xE9s:"),rt=m(),p($e.$$.fragment),dt=m(),ae=t("p"),tn=n("Si est\xE1s usando el checkpoint "),ua=t("code"),on=n("facebook/mbart-large-50-many-to-one-mmt"),sn=n(" no necesitas forzar el id del idioma de destino como el primer token generado, de lo contrario el uso es el mismo."),this.h()},l(e){const r=ar('[data-svelte="svelte-1phssyn"]',document.head);Z=o(r,"META",{name:!0,content:!0}),r.forEach(a),pa=c(e),X=o(e,"H1",{class:!0});var ct=s(X);B=o(ct,"A",{id:!0,class:!0,href:!0});var wn=s(B);ml=o(wn,"SPAN",{});var jn=s(ml);f(re.$$.fragment,jn),jn.forEach(a),wn.forEach(a),$t=c(ct),cl=o(ct,"SPAN",{});var $n=s(cl);Zt=i($n,"Modelos multiling\xFCes para inferencia"),$n.forEach(a),ct.forEach(a),fa=c(e),f(de.$$.fragment,e),ga=c(e),w=o(e,"P",{});var rl=s(w);Xt=i(rl,"Existen varios modelos multiling\xFCes en \u{1F917} Transformers y su uso para inferencia difiere de los modelos monoling\xFCes. Sin embargo, no "),ul=o(rl,"EM",{});var Zn=s(ul);It=i(Zn,"todos"),Zn.forEach(a),Ct=i(rl," los usos de los modelos multiling\xFCes son diferentes. Algunos modelos, como "),me=o(rl,"A",{href:!0,rel:!0});var Xn=s(me);xt=i(Xn,"bert-base-multilingual-uncased"),Xn.forEach(a),zt=i(rl,", pueden utilizarse igual que un modelo monoling\xFCe. Esta gu\xEDa te ense\xF1ar\xE1 c\xF3mo utilizar modelos multiling\xFCes cuyo uso difiere en la inferencia."),rl.forEach(a),ha=c(e),I=o(e,"H2",{class:!0});var ut=s(I);W=o(ut,"A",{id:!0,class:!0,href:!0});var In=s(W);pl=o(In,"SPAN",{});var Cn=s(pl);f(ce.$$.fragment,Cn),Cn.forEach(a),In.forEach(a),Gt=c(ut),fl=o(ut,"SPAN",{});var xn=s(fl);Lt=i(xn,"XLM"),xn.forEach(a),ut.forEach(a),ba=c(e),Ze=o(e,"P",{});var zn=s(Ze);Rt=i(zn,"XLM tiene diez checkpoints diferentes de los cuales solo uno es monoling\xFCe. Los nueve checkpoints restantes del modelo pueden dividirse en dos categor\xEDas: los checkpoints que utilizan language embeddings y los que no."),zn.forEach(a),Ma=c(e),C=o(e,"H3",{class:!0});var pt=s(C);V=o(pt,"A",{id:!0,class:!0,href:!0});var Gn=s(V);gl=o(Gn,"SPAN",{});var Ln=s(gl);f(ue.$$.fragment,Ln),Ln.forEach(a),Gn.forEach(a),Bt=c(pt),hl=o(pt,"SPAN",{});var Rn=s(hl);Wt=i(Rn,"XLM con language embeddings"),Rn.forEach(a),pt.forEach(a),Ea=c(e),Xe=o(e,"P",{});var Bn=s(Xe);Vt=i(Bn,"Los siguientes modelos XLM usan language embeddings para especificar el lenguaje utilizado en la inferencia:"),Bn.forEach(a),ya=c(e),E=o(e,"UL",{});var v=s(E);Ie=o(v,"LI",{});var nn=s(Ie);bl=o(nn,"CODE",{});var Wn=s(bl);qt=i(Wn,"xlm-mlm-ende-1024"),Wn.forEach(a),Dt=i(nn," (Masked language modeling, English-German)"),nn.forEach(a),Nt=c(v),Ce=o(v,"LI",{});var rn=s(Ce);Ml=o(rn,"CODE",{});var Vn=s(Ml);Ft=i(Vn,"xlm-mlm-enfr-1024"),Vn.forEach(a),At=i(rn," (Masked language modeling, English-French)"),rn.forEach(a),Qt=c(v),xe=o(v,"LI",{});var dn=s(xe);El=o(dn,"CODE",{});var qn=s(El);Pt=i(qn,"xlm-mlm-enro-1024"),qn.forEach(a),St=i(dn," (Masked language modeling, English-Romanian)"),dn.forEach(a),Yt=c(v),ze=o(v,"LI",{});var mn=s(ze);yl=o(mn,"CODE",{});var Dn=s(yl);Ot=i(Dn,"xlm-mlm-xnli15-1024"),Dn.forEach(a),Ht=i(mn," (Masked language modeling, XNLI languages)"),mn.forEach(a),Kt=c(v),Ge=o(v,"LI",{});var cn=s(Ge);vl=o(cn,"CODE",{});var Nn=s(vl);eo=i(Nn,"xlm-mlm-tlm-xnli15-1024"),Nn.forEach(a),lo=i(cn," (Masked language modeling + translation, XNLI languages)"),cn.forEach(a),ao=c(v),Le=o(v,"LI",{});var un=s(Le);_l=o(un,"CODE",{});var Fn=s(_l);to=i(Fn,"xlm-clm-enfr-1024"),Fn.forEach(a),oo=i(un," (Causal language modeling, English-French)"),un.forEach(a),so=c(v),Re=o(v,"LI",{});var pn=s(Re);Jl=o(pn,"CODE",{});var An=s(Jl);no=i(An,"xlm-clm-ende-1024"),An.forEach(a),io=i(pn," (Causal language modeling, English-German)"),pn.forEach(a),v.forEach(a),va=c(e),_=o(e,"P",{});var te=s(_);ro=i(te,"Los language embeddings son representados como un tensor de la mismas dimensiones que los "),kl=o(te,"CODE",{});var Qn=s(kl);mo=i(Qn,"input_ids"),Qn.forEach(a),co=i(te," pasados al modelo. Los valores de estos tensores dependen del idioma utilizado y se identifican mediante los atributos "),Ul=o(te,"CODE",{});var Pn=s(Ul);uo=i(Pn,"lang2id"),Pn.forEach(a),po=i(te," y "),Tl=o(te,"CODE",{});var Sn=s(Tl);fo=i(Sn,"id2lang"),Sn.forEach(a),go=i(te," del tokenizador."),te.forEach(a),_a=c(e),q=o(e,"P",{});var ft=s(q);ho=i(ft,"En este ejemplo, carga el checkpoint "),wl=o(ft,"CODE",{});var Yn=s(wl);bo=i(Yn,"xlm-clm-enfr-1024"),Yn.forEach(a),Mo=i(ft," (Causal language modeling, English-French):"),ft.forEach(a),Ja=c(e),f(pe.$$.fragment,e),ka=c(e),D=o(e,"P",{});var gt=s(D);Eo=i(gt,"El atributo "),jl=o(gt,"CODE",{});var On=s(jl);yo=i(On,"lang2id"),On.forEach(a),vo=i(gt," del tokenizador muestra los idiomas de este modelo y sus ids:"),gt.forEach(a),Ua=c(e),f(fe.$$.fragment,e),Ta=c(e),Be=o(e,"P",{});var Hn=s(Be);_o=i(Hn,"A continuaci\xF3n, crea un input de ejemplo:"),Hn.forEach(a),wa=c(e),f(ge.$$.fragment,e),ja=c(e),J=o(e,"P",{});var oe=s(J);Jo=i(oe,"Establece el id del idioma, por ejemplo "),$l=o(oe,"CODE",{});var Kn=s($l);ko=i(Kn,'"en"'),Kn.forEach(a),Uo=i(oe,", y util\xEDzalo para definir el language embedding. El language embedding es un tensor lleno de "),Zl=o(oe,"CODE",{});var ei=s(Zl);To=i(ei,"0"),ei.forEach(a),wo=i(oe," ya que es el id del idioma para ingl\xE9s. Este tensor debe ser del mismo tama\xF1o que "),Xl=o(oe,"CODE",{});var li=s(Xl);jo=i(li,"input_ids"),li.forEach(a),$o=i(oe,"."),oe.forEach(a),$a=c(e),f(he.$$.fragment,e),Za=c(e),N=o(e,"P",{});var ht=s(N);Zo=i(ht,"Ahora puedes pasar los "),Il=o(ht,"CODE",{});var ai=s(Il);Xo=i(ai,"input_ids"),ai.forEach(a),Io=i(ht," y el language embedding al modelo:"),ht.forEach(a),Xa=c(e),f(be.$$.fragment,e),Ia=c(e),j=o(e,"P",{});var dl=s(j);Co=i(dl,"El script "),Me=o(dl,"A",{href:!0,rel:!0});var ti=s(Me);xo=i(ti,"run_generation.py"),ti.forEach(a),zo=i(dl," puede generar texto con language embeddings utilizando los checkpoints "),Cl=o(dl,"CODE",{});var oi=s(Cl);Go=i(oi,"xlm-clm"),oi.forEach(a),Lo=i(dl,"."),dl.forEach(a),Ca=c(e),x=o(e,"H3",{class:!0});var bt=s(x);F=o(bt,"A",{id:!0,class:!0,href:!0});var si=s(F);xl=o(si,"SPAN",{});var ni=s(xl);f(Ee.$$.fragment,ni),ni.forEach(a),si.forEach(a),Ro=c(bt),zl=o(bt,"SPAN",{});var ii=s(zl);Bo=i(ii,"XLM sin language embeddings"),ii.forEach(a),bt.forEach(a),xa=c(e),We=o(e,"P",{});var ri=s(We);Wo=i(ri,"Los siguientes modelos XLM no requieren language embeddings durante la inferencia:"),ri.forEach(a),za=c(e),A=o(e,"UL",{});var Mt=s(A);Ve=o(Mt,"LI",{});var fn=s(Ve);Gl=o(fn,"CODE",{});var di=s(Gl);Vo=i(di,"xlm-mlm-17-1280"),di.forEach(a),qo=i(fn," (modelado de lenguaje enmascarado, 17 idiomas)"),fn.forEach(a),Do=c(Mt),qe=o(Mt,"LI",{});var gn=s(qe);Ll=o(gn,"CODE",{});var mi=s(Ll);No=i(mi,"xlm-mlm-100-1280"),mi.forEach(a),Fo=i(gn," (modelado de lenguaje enmascarado, 100 idiomas)"),gn.forEach(a),Mt.forEach(a),Ga=c(e),De=o(e,"P",{});var ci=s(De);Ao=i(ci,"Estos modelos se utilizan para representaciones gen\xE9ricas de frases a diferencia de los anteriores checkpoints XLM."),ci.forEach(a),La=c(e),z=o(e,"H2",{class:!0});var Et=s(z);Q=o(Et,"A",{id:!0,class:!0,href:!0});var ui=s(Q);Rl=o(ui,"SPAN",{});var pi=s(Rl);f(ye.$$.fragment,pi),pi.forEach(a),ui.forEach(a),Qo=c(Et),Bl=o(Et,"SPAN",{});var fi=s(Bl);Po=i(fi,"BERT"),fi.forEach(a),Et.forEach(a),Ra=c(e),Ne=o(e,"P",{});var gi=s(Ne);So=i(gi,"Los siguientes modelos de BERT pueden utilizarse para tareas multiling\xFCes:"),gi.forEach(a),Ba=c(e),P=o(e,"UL",{});var yt=s(P);Fe=o(yt,"LI",{});var hn=s(Fe);Wl=o(hn,"CODE",{});var hi=s(Wl);Yo=i(hi,"bert-base-multilingual-uncased"),hi.forEach(a),Oo=i(hn," (modelado de lenguaje enmascarado + predicci\xF3n de la siguiente oraci\xF3n, 102 idiomas)"),hn.forEach(a),Ho=c(yt),Ae=o(yt,"LI",{});var bn=s(Ae);Vl=o(bn,"CODE",{});var bi=s(Vl);Ko=i(bi,"bert-base-multilingual-cased"),bi.forEach(a),es=i(bn," (modelado de lenguaje enmascarado + predicci\xF3n de la siguiente oraci\xF3n, 104 idiomas)"),bn.forEach(a),yt.forEach(a),Wa=c(e),Qe=o(e,"P",{});var Mi=s(Qe);ls=i(Mi,`Estos modelos no requieren language embeddings durante la inferencia. Deben identificar la lengua a partir del
contexto e inferir en consecuencia.`),Mi.forEach(a),Va=c(e),G=o(e,"H2",{class:!0});var vt=s(G);S=o(vt,"A",{id:!0,class:!0,href:!0});var Ei=s(S);ql=o(Ei,"SPAN",{});var yi=s(ql);f(ve.$$.fragment,yi),yi.forEach(a),Ei.forEach(a),as=c(vt),Dl=o(vt,"SPAN",{});var vi=s(Dl);ts=i(vi,"XLM-RoBERTa"),vi.forEach(a),vt.forEach(a),qa=c(e),Pe=o(e,"P",{});var _i=s(Pe);os=i(_i,"Los siguientes modelos de XLM-RoBERTa pueden utilizarse para tareas multiling\xFCes:"),_i.forEach(a),Da=c(e),Y=o(e,"UL",{});var _t=s(Y);Se=o(_t,"LI",{});var Mn=s(Se);Nl=o(Mn,"CODE",{});var Ji=s(Nl);ss=i(Ji,"xlm-roberta-base"),Ji.forEach(a),ns=i(Mn," (modelado de lenguaje enmascarado, 100 idiomas)"),Mn.forEach(a),is=c(_t),Ye=o(_t,"LI",{});var En=s(Ye);Fl=o(En,"CODE",{});var ki=s(Fl);rs=i(ki,"xlm-roberta-large"),ki.forEach(a),ds=i(En," (Modelado de lenguaje enmascarado, 100 idiomas)"),En.forEach(a),_t.forEach(a),Na=c(e),Oe=o(e,"P",{});var Ui=s(Oe);ms=i(Ui,"XLM-RoBERTa se entren\xF3 con 2,5 TB de datos CommonCrawl reci\xE9n creados y depurados en 100 idiomas. Proporciona fuertes ventajas sobre los modelos multiling\xFCes publicados anteriormente como mBERT o XLM en tareas posteriores como la clasificaci\xF3n, el etiquetado de secuencias y la respuesta a preguntas."),Ui.forEach(a),Fa=c(e),L=o(e,"H2",{class:!0});var Jt=s(L);O=o(Jt,"A",{id:!0,class:!0,href:!0});var Ti=s(O);Al=o(Ti,"SPAN",{});var wi=s(Al);f(_e.$$.fragment,wi),wi.forEach(a),Ti.forEach(a),cs=c(Jt),Ql=o(Jt,"SPAN",{});var ji=s(Ql);us=i(ji,"M2M100"),ji.forEach(a),Jt.forEach(a),Aa=c(e),He=o(e,"P",{});var $i=s(He);ps=i($i,"Los siguientes modelos de M2M100 pueden utilizarse para traducci\xF3n multiling\xFCe:"),$i.forEach(a),Qa=c(e),H=o(e,"UL",{});var kt=s(H);Ke=o(kt,"LI",{});var yn=s(Ke);Pl=o(yn,"CODE",{});var Zi=s(Pl);fs=i(Zi,"facebook/m2m100_418M"),Zi.forEach(a),gs=i(yn," (traducci\xF3n)"),yn.forEach(a),hs=c(kt),el=o(kt,"LI",{});var vn=s(el);Sl=o(vn,"CODE",{});var Xi=s(Sl);bs=i(Xi,"facebook/m2m100_1.2B"),Xi.forEach(a),Ms=i(vn," (traducci\xF3n)"),vn.forEach(a),kt.forEach(a),Pa=c(e),K=o(e,"P",{});var Ut=s(K);Es=i(Ut,"En este ejemplo, carga el checkpoint "),Yl=o(Ut,"CODE",{});var Ii=s(Yl);ys=i(Ii,"facebook/m2m100_418M"),Ii.forEach(a),vs=i(Ut," para traducir del chino al ingl\xE9s. Puedes establecer el idioma de origen en el tokenizador:"),Ut.forEach(a),Sa=c(e),f(Je.$$.fragment,e),Ya=c(e),ll=o(e,"P",{});var Ci=s(ll);_s=i(Ci,"Tokeniza el texto:"),Ci.forEach(a),Oa=c(e),f(ke.$$.fragment,e),Ha=c(e),k=o(e,"P",{});var se=s(k);Js=i(se,"M2M100 fuerza el id del idioma de destino como el primer token generado para traducir al idioma de destino.. Establece el "),Ol=o(se,"CODE",{});var xi=s(Ol);ks=i(xi,"forced_bos_token_id"),xi.forEach(a),Us=i(se," a "),Hl=o(se,"CODE",{});var zi=s(Hl);Ts=i(zi,"en"),zi.forEach(a),ws=i(se," en el m\xE9todo "),Kl=o(se,"CODE",{});var Gi=s(Kl);js=i(Gi,"generate"),Gi.forEach(a),$s=i(se," para traducir al ingl\xE9s:"),se.forEach(a),Ka=c(e),f(Ue.$$.fragment,e),et=c(e),R=o(e,"H2",{class:!0});var Tt=s(R);ee=o(Tt,"A",{id:!0,class:!0,href:!0});var Li=s(ee);ea=o(Li,"SPAN",{});var Ri=s(ea);f(Te.$$.fragment,Ri),Ri.forEach(a),Li.forEach(a),Zs=c(Tt),la=o(Tt,"SPAN",{});var Bi=s(la);Xs=i(Bi,"MBart"),Bi.forEach(a),Tt.forEach(a),lt=c(e),al=o(e,"P",{});var Wi=s(al);Is=i(Wi,"Los siguientes modelos de MBart pueden utilizarse para traducci\xF3n multiling\xFCe:"),Wi.forEach(a),at=c(e),y=o(e,"UL",{});var $=s(y);tl=o($,"LI",{});var _n=s(tl);aa=o(_n,"CODE",{});var Vi=s(aa);Cs=i(Vi,"facebook/mbart-large-50-one-to-many-mmt"),Vi.forEach(a),xs=i(_n," (traducci\xF3n autom\xE1tica multiling\xFCe de uno a muchos, 50 idiomas)"),_n.forEach(a),zs=c($),ol=o($,"LI",{});var Jn=s(ol);ta=o(Jn,"CODE",{});var qi=s(ta);Gs=i(qi,"facebook/mbart-large-50-many-to-many-mmt"),qi.forEach(a),Ls=i(Jn," (traducci\xF3n autom\xE1tica multiling\xFCe de muchos a muchos, 50 idiomas)"),Jn.forEach(a),Rs=c($),sl=o($,"LI",{});var kn=s(sl);oa=o(kn,"CODE",{});var Di=s(oa);Bs=i(Di,"facebook/mbart-large-50-many-to-one-mmt"),Di.forEach(a),Ws=i(kn," (traducci\xF3n autom\xE1tica multiling\xFCe muchos a uno, 50 idiomas)"),kn.forEach(a),Vs=c($),nl=o($,"LI",{});var Un=s(nl);sa=o(Un,"CODE",{});var Ni=s(sa);qs=i(Ni,"facebook/mbart-large-50"),Ni.forEach(a),Ds=i(Un," (traducci\xF3n multiling\xFCe, 50 idiomas)"),Un.forEach(a),Ns=c($),na=o($,"LI",{});var Fi=s(na);ia=o(Fi,"CODE",{});var Ai=s(ia);Fs=i(Ai,"facebook/mbart-large-cc25"),Ai.forEach(a),Fi.forEach(a),$.forEach(a),tt=c(e),le=o(e,"P",{});var wt=s(le);As=i(wt,"En este ejemplo, carga el checkpoint "),ra=o(wt,"CODE",{});var Qi=s(ra);Qs=i(Qi,"facebook/mbart-large-50-many-to-many-mmt"),Qi.forEach(a),Ps=i(wt," para traducir del finland\xE9s al ingl\xE9s. Puedes establecer el idioma de origen en el tokenizador:"),wt.forEach(a),ot=c(e),f(we.$$.fragment,e),st=c(e),il=o(e,"P",{});var Pi=s(il);Ss=i(Pi,"Tokeniza el texto:"),Pi.forEach(a),nt=c(e),f(je.$$.fragment,e),it=c(e),U=o(e,"P",{});var ne=s(U);Ys=i(ne,"MBart fuerza el id del idioma de destino como el primer token generado para traducirlo. Establece el "),da=o(ne,"CODE",{});var Si=s(da);Os=i(Si,"forced_bos_token_id"),Si.forEach(a),Hs=i(ne," a "),ma=o(ne,"CODE",{});var Yi=s(ma);Ks=i(Yi,"en"),Yi.forEach(a),en=i(ne," en el m\xE9todo "),ca=o(ne,"CODE",{});var Oi=s(ca);ln=i(Oi,"generate"),Oi.forEach(a),an=i(ne," para traducir al ingl\xE9s:"),ne.forEach(a),rt=c(e),f($e.$$.fragment,e),dt=c(e),ae=o(e,"P",{});var jt=s(ae);tn=i(jt,"Si est\xE1s usando el checkpoint "),ua=o(jt,"CODE",{});var Hi=s(ua);on=i(Hi,"facebook/mbart-large-50-many-to-one-mmt"),Hi.forEach(a),sn=i(jt," no necesitas forzar el id del idioma de destino como el primer token generado, de lo contrario el uso es el mismo."),jt.forEach(a),this.h()},h(){u(Z,"name","hf:doc:metadata"),u(Z,"content",JSON.stringify(ir)),u(B,"id","modelos-multilinges-para-inferencia"),u(B,"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"),u(B,"href","#modelos-multilinges-para-inferencia"),u(X,"class","relative group"),u(me,"href","https://huggingface.co/bert-base-multilingual-uncased"),u(me,"rel","nofollow"),u(W,"id","xlm"),u(W,"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"),u(W,"href","#xlm"),u(I,"class","relative group"),u(V,"id","xlm-con-language-embeddings"),u(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"),u(V,"href","#xlm-con-language-embeddings"),u(C,"class","relative group"),u(Me,"href","https://github.com/huggingface/transformers/tree/master/examples/pytorch/text-generation/run_generation.py"),u(Me,"rel","nofollow"),u(F,"id","xlm-sin-language-embeddings"),u(F,"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"),u(F,"href","#xlm-sin-language-embeddings"),u(x,"class","relative group"),u(Q,"id","bert"),u(Q,"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"),u(Q,"href","#bert"),u(z,"class","relative group"),u(S,"id","xlmroberta"),u(S,"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"),u(S,"href","#xlmroberta"),u(G,"class","relative group"),u(O,"id","m2m100"),u(O,"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"),u(O,"href","#m2m100"),u(L,"class","relative group"),u(ee,"id","mbart"),u(ee,"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"),u(ee,"href","#mbart"),u(R,"class","relative group")},m(e,r){l(document.head,Z),d(e,pa,r),d(e,X,r),l(X,B),l(B,ml),g(re,ml,null),l(X,$t),l(X,cl),l(cl,Zt),d(e,fa,r),g(de,e,r),d(e,ga,r),d(e,w,r),l(w,Xt),l(w,ul),l(ul,It),l(w,Ct),l(w,me),l(me,xt),l(w,zt),d(e,ha,r),d(e,I,r),l(I,W),l(W,pl),g(ce,pl,null),l(I,Gt),l(I,fl),l(fl,Lt),d(e,ba,r),d(e,Ze,r),l(Ze,Rt),d(e,Ma,r),d(e,C,r),l(C,V),l(V,gl),g(ue,gl,null),l(C,Bt),l(C,hl),l(hl,Wt),d(e,Ea,r),d(e,Xe,r),l(Xe,Vt),d(e,ya,r),d(e,E,r),l(E,Ie),l(Ie,bl),l(bl,qt),l(Ie,Dt),l(E,Nt),l(E,Ce),l(Ce,Ml),l(Ml,Ft),l(Ce,At),l(E,Qt),l(E,xe),l(xe,El),l(El,Pt),l(xe,St),l(E,Yt),l(E,ze),l(ze,yl),l(yl,Ot),l(ze,Ht),l(E,Kt),l(E,Ge),l(Ge,vl),l(vl,eo),l(Ge,lo),l(E,ao),l(E,Le),l(Le,_l),l(_l,to),l(Le,oo),l(E,so),l(E,Re),l(Re,Jl),l(Jl,no),l(Re,io),d(e,va,r),d(e,_,r),l(_,ro),l(_,kl),l(kl,mo),l(_,co),l(_,Ul),l(Ul,uo),l(_,po),l(_,Tl),l(Tl,fo),l(_,go),d(e,_a,r),d(e,q,r),l(q,ho),l(q,wl),l(wl,bo),l(q,Mo),d(e,Ja,r),g(pe,e,r),d(e,ka,r),d(e,D,r),l(D,Eo),l(D,jl),l(jl,yo),l(D,vo),d(e,Ua,r),g(fe,e,r),d(e,Ta,r),d(e,Be,r),l(Be,_o),d(e,wa,r),g(ge,e,r),d(e,ja,r),d(e,J,r),l(J,Jo),l(J,$l),l($l,ko),l(J,Uo),l(J,Zl),l(Zl,To),l(J,wo),l(J,Xl),l(Xl,jo),l(J,$o),d(e,$a,r),g(he,e,r),d(e,Za,r),d(e,N,r),l(N,Zo),l(N,Il),l(Il,Xo),l(N,Io),d(e,Xa,r),g(be,e,r),d(e,Ia,r),d(e,j,r),l(j,Co),l(j,Me),l(Me,xo),l(j,zo),l(j,Cl),l(Cl,Go),l(j,Lo),d(e,Ca,r),d(e,x,r),l(x,F),l(F,xl),g(Ee,xl,null),l(x,Ro),l(x,zl),l(zl,Bo),d(e,xa,r),d(e,We,r),l(We,Wo),d(e,za,r),d(e,A,r),l(A,Ve),l(Ve,Gl),l(Gl,Vo),l(Ve,qo),l(A,Do),l(A,qe),l(qe,Ll),l(Ll,No),l(qe,Fo),d(e,Ga,r),d(e,De,r),l(De,Ao),d(e,La,r),d(e,z,r),l(z,Q),l(Q,Rl),g(ye,Rl,null),l(z,Qo),l(z,Bl),l(Bl,Po),d(e,Ra,r),d(e,Ne,r),l(Ne,So),d(e,Ba,r),d(e,P,r),l(P,Fe),l(Fe,Wl),l(Wl,Yo),l(Fe,Oo),l(P,Ho),l(P,Ae),l(Ae,Vl),l(Vl,Ko),l(Ae,es),d(e,Wa,r),d(e,Qe,r),l(Qe,ls),d(e,Va,r),d(e,G,r),l(G,S),l(S,ql),g(ve,ql,null),l(G,as),l(G,Dl),l(Dl,ts),d(e,qa,r),d(e,Pe,r),l(Pe,os),d(e,Da,r),d(e,Y,r),l(Y,Se),l(Se,Nl),l(Nl,ss),l(Se,ns),l(Y,is),l(Y,Ye),l(Ye,Fl),l(Fl,rs),l(Ye,ds),d(e,Na,r),d(e,Oe,r),l(Oe,ms),d(e,Fa,r),d(e,L,r),l(L,O),l(O,Al),g(_e,Al,null),l(L,cs),l(L,Ql),l(Ql,us),d(e,Aa,r),d(e,He,r),l(He,ps),d(e,Qa,r),d(e,H,r),l(H,Ke),l(Ke,Pl),l(Pl,fs),l(Ke,gs),l(H,hs),l(H,el),l(el,Sl),l(Sl,bs),l(el,Ms),d(e,Pa,r),d(e,K,r),l(K,Es),l(K,Yl),l(Yl,ys),l(K,vs),d(e,Sa,r),g(Je,e,r),d(e,Ya,r),d(e,ll,r),l(ll,_s),d(e,Oa,r),g(ke,e,r),d(e,Ha,r),d(e,k,r),l(k,Js),l(k,Ol),l(Ol,ks),l(k,Us),l(k,Hl),l(Hl,Ts),l(k,ws),l(k,Kl),l(Kl,js),l(k,$s),d(e,Ka,r),g(Ue,e,r),d(e,et,r),d(e,R,r),l(R,ee),l(ee,ea),g(Te,ea,null),l(R,Zs),l(R,la),l(la,Xs),d(e,lt,r),d(e,al,r),l(al,Is),d(e,at,r),d(e,y,r),l(y,tl),l(tl,aa),l(aa,Cs),l(tl,xs),l(y,zs),l(y,ol),l(ol,ta),l(ta,Gs),l(ol,Ls),l(y,Rs),l(y,sl),l(sl,oa),l(oa,Bs),l(sl,Ws),l(y,Vs),l(y,nl),l(nl,sa),l(sa,qs),l(nl,Ds),l(y,Ns),l(y,na),l(na,ia),l(ia,Fs),d(e,tt,r),d(e,le,r),l(le,As),l(le,ra),l(ra,Qs),l(le,Ps),d(e,ot,r),g(we,e,r),d(e,st,r),d(e,il,r),l(il,Ss),d(e,nt,r),g(je,e,r),d(e,it,r),d(e,U,r),l(U,Ys),l(U,da),l(da,Os),l(U,Hs),l(U,ma),l(ma,Ks),l(U,en),l(U,ca),l(ca,ln),l(U,an),d(e,rt,r),g($e,e,r),d(e,dt,r),d(e,ae,r),l(ae,tn),l(ae,ua),l(ua,on),l(ae,sn),mt=!0},p:tr,i(e){mt||(h(re.$$.fragment,e),h(de.$$.fragment,e),h(ce.$$.fragment,e),h(ue.$$.fragment,e),h(pe.$$.fragment,e),h(fe.$$.fragment,e),h(ge.$$.fragment,e),h(he.$$.fragment,e),h(be.$$.fragment,e),h(Ee.$$.fragment,e),h(ye.$$.fragment,e),h(ve.$$.fragment,e),h(_e.$$.fragment,e),h(Je.$$.fragment,e),h(ke.$$.fragment,e),h(Ue.$$.fragment,e),h(Te.$$.fragment,e),h(we.$$.fragment,e),h(je.$$.fragment,e),h($e.$$.fragment,e),mt=!0)},o(e){b(re.$$.fragment,e),b(de.$$.fragment,e),b(ce.$$.fragment,e),b(ue.$$.fragment,e),b(pe.$$.fragment,e),b(fe.$$.fragment,e),b(ge.$$.fragment,e),b(he.$$.fragment,e),b(be.$$.fragment,e),b(Ee.$$.fragment,e),b(ye.$$.fragment,e),b(ve.$$.fragment,e),b(_e.$$.fragment,e),b(Je.$$.fragment,e),b(ke.$$.fragment,e),b(Ue.$$.fragment,e),b(Te.$$.fragment,e),b(we.$$.fragment,e),b(je.$$.fragment,e),b($e.$$.fragment,e),mt=!1},d(e){a(Z),e&&a(pa),e&&a(X),M(re),e&&a(fa),M(de,e),e&&a(ga),e&&a(w),e&&a(ha),e&&a(I),M(ce),e&&a(ba),e&&a(Ze),e&&a(Ma),e&&a(C),M(ue),e&&a(Ea),e&&a(Xe),e&&a(ya),e&&a(E),e&&a(va),e&&a(_),e&&a(_a),e&&a(q),e&&a(Ja),M(pe,e),e&&a(ka),e&&a(D),e&&a(Ua),M(fe,e),e&&a(Ta),e&&a(Be),e&&a(wa),M(ge,e),e&&a(ja),e&&a(J),e&&a($a),M(he,e),e&&a(Za),e&&a(N),e&&a(Xa),M(be,e),e&&a(Ia),e&&a(j),e&&a(Ca),e&&a(x),M(Ee),e&&a(xa),e&&a(We),e&&a(za),e&&a(A),e&&a(Ga),e&&a(De),e&&a(La),e&&a(z),M(ye),e&&a(Ra),e&&a(Ne),e&&a(Ba),e&&a(P),e&&a(Wa),e&&a(Qe),e&&a(Va),e&&a(G),M(ve),e&&a(qa),e&&a(Pe),e&&a(Da),e&&a(Y),e&&a(Na),e&&a(Oe),e&&a(Fa),e&&a(L),M(_e),e&&a(Aa),e&&a(He),e&&a(Qa),e&&a(H),e&&a(Pa),e&&a(K),e&&a(Sa),M(Je,e),e&&a(Ya),e&&a(ll),e&&a(Oa),M(ke,e),e&&a(Ha),e&&a(k),e&&a(Ka),M(Ue,e),e&&a(et),e&&a(R),M(Te),e&&a(lt),e&&a(al),e&&a(at),e&&a(y),e&&a(tt),e&&a(le),e&&a(ot),M(we,e),e&&a(st),e&&a(il),e&&a(nt),M(je,e),e&&a(it),e&&a(U),e&&a(rt),M($e,e),e&&a(dt),e&&a(ae)}}}const ir={local:"modelos-multilinges-para-inferencia",sections:[{local:"xlm",sections:[{local:"xlm-con-language-embeddings",title:"XLM con language embeddings"},{local:"xlm-sin-language-embeddings",title:"XLM sin language embeddings"}],title:"XLM"},{local:"bert",title:"BERT"},{local:"xlmroberta",title:"XLM-RoBERTa"},{local:"m2m100",title:"M2M100"},{local:"mbart",title:"MBart"}],title:"Modelos multiling\xFCes para inferencia"};function rr(Tn){return or(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class pr extends Ki{constructor(Z){super();er(this,Z,rr,nr,lr,{})}}export{pr as default,ir as metadata};
