import{S as Zi,i as er,s as tr,e as l,k as d,w as u,t as s,M as ar,c as n,d as a,m as g,a as o,x as h,h as i,b as f,G as t,g as m,y as c,L as lr,q as p,o as _,B as b,v as nr}from"../chunks/vendor-hf-doc-builder.js";import{I as ie}from"../chunks/IconCopyLink-hf-doc-builder.js";import{C as x}from"../chunks/CodeBlock-hf-doc-builder.js";import{D as or}from"../chunks/DocNotebookDropdown-hf-doc-builder.js";function sr(xs){let z,ua,q,A,dt,re,jl,gt,zl,ha,me,ca,T,ql,ft,Cl,Dl,de,Pl,Ol,pa,C,N,ut,ge,Xl,ht,Il,_a,ze,Sl,ba,D,B,ct,fe,Al,pt,Nl,ka,qe,Bl,va,k,Ce,_t,Rl,Fl,Hl,De,bt,Gl,Wl,Ul,Pe,kt,Yl,Jl,Kl,Oe,vt,Ql,Vl,Zl,Xe,Et,en,tn,an,Ie,$t,ln,nn,on,Se,wt,sn,rn,Ea,$,mn,Mt,dn,gn,yt,fn,un,xt,hn,cn,$a,R,pn,Tt,_n,bn,wa,ue,Ma,F,kn,Lt,vn,En,ya,he,xa,Ae,$n,Ta,ce,La,w,wn,jt,Mn,yn,zt,xn,Tn,qt,Ln,jn,ja,pe,za,H,zn,Ct,qn,Cn,qa,_e,Ca,L,Dn,be,Pn,On,Dt,Xn,In,Da,P,G,Pt,ke,Sn,Ot,An,Pa,Ne,Nn,Oa,W,Be,Xt,Bn,Rn,Fn,Re,It,Hn,Gn,Xa,Fe,Wn,Ia,O,U,St,ve,Un,At,Yn,Sa,He,Jn,Aa,Y,Ge,Nt,Kn,Qn,Vn,We,Bt,Zn,eo,Na,Ue,to,Ba,X,J,Rt,Ee,ao,Ft,lo,Ra,Ye,no,Fa,K,Je,Ht,oo,so,io,Ke,Gt,ro,mo,Ha,Qe,go,Ga,I,Q,Wt,$e,fo,Ut,uo,Wa,Ve,ho,Ua,V,Ze,Yt,co,po,_o,et,Jt,bo,ko,Ya,Z,vo,Kt,Eo,$o,Ja,we,Ka,tt,wo,Qa,Me,Va,M,Mo,Qt,yo,xo,Vt,To,Lo,Zt,jo,zo,Za,ye,el,S,ee,ea,xe,qo,ta,Co,tl,at,Do,al,v,lt,aa,Po,Oo,Xo,nt,la,Io,So,Ao,ot,na,No,Bo,Ro,st,oa,Fo,Ho,Go,sa,ia,Wo,ll,te,Uo,ra,Yo,Jo,nl,Te,ol,it,Ko,sl,Le,il,y,Qo,ma,Vo,Zo,da,es,ts,ga,as,ls,rl,je,ml,ae,ns,fa,os,ss,dl;return re=new ie({}),me=new or({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/en/multilingual.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/en/pytorch/multilingual.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/en/tensorflow/multilingual.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/en/multilingual.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/en/pytorch/multilingual.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/en/tensorflow/multilingual.ipynb"}]}}),ge=new ie({}),fe=new ie({}),ue=new x({props:{code:`import torch
from transformers import XLMTokenizer, XLMWithLMHeadModel

tokenizer = XLMTokenizer.from_pretrained("xlm-clm-enfr-1024")
model = XLMWithLMHeadModel.from_pretrained("xlm-clm-enfr-1024")`,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>)`}}),he=new x({props:{code:"print(tokenizer.lang2id)",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>}`}}),ce=new x({props:{code:'input_ids = torch.tensor([tokenizer.encode("Wikipedia was used to")])  # batch size of 1',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>'}}),pe=new x({props:{code:`language_id = tokenizer.lang2id["en"]  # 0
langs = torch.tensor([language_id] * input_ids.shape[1])  # torch.tensor([0, 0, 0, ..., 0])

# We reshape it to be of size (batch_size, sequence_length)
langs = langs.view(1, -1)  # is now of shape [1, sequence_length] (we have a batch size of 1)`,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>`}}),_e=new x({props:{code:"outputs = model(input_ids, langs=langs)",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(input_ids, langs=langs)'}}),ke=new ie({}),ve=new ie({}),Ee=new ie({}),$e=new ie({}),we=new x({props:{code:`from transformers import M2M100ForConditionalGeneration, M2M100Tokenizer

en_text = "Do not meddle in the affairs of wizards, for they are subtle and quick to anger."
chinese_text = "\u4E0D\u8981\u63D2\u624B\u5DEB\u5E2B\u7684\u4E8B\u52D9, \u56E0\u70BA\u4ED6\u5011\u662F\u5FAE\u5999\u7684, \u5F88\u5FEB\u5C31\u6703\u767C\u6012."

tokenizer = M2M100Tokenizer.from_pretrained("facebook/m2m100_418M", src_lang="zh")
model = M2M100ForConditionalGeneration.from_pretrained("facebook/m2m100_418M")`,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>)`}}),Me=new x({props:{code:'encoded_zh = tokenizer(chinese_text, return_tensors="pt")',highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>encoded_zh = tokenizer(chinese_text, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)'}}),ye=new x({props:{code:`generated_tokens = model.generate(**encoded_zh, forced_bos_token_id=tokenizer.get_lang_id("en"))
tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)`,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>`}}),xe=new ie({}),Te=new x({props:{code:`from transformers import AutoTokenizer, AutoModelForSeq2SeqLM

en_text = "Do not meddle in the affairs of wizards, for they are subtle and quick to anger."
fi_text = "\xC4l\xE4 sekaannu velhojen asioihin, sill\xE4 ne ovat hienovaraisia ja nopeasti vihaisia."

tokenizer = AutoTokenizer.from_pretrained("facebook/mbart-large-50-many-to-many-mmt", src_lang="fi_FI")
model = AutoModelForSeq2SeqLM.from_pretrained("facebook/mbart-large-50-many-to-many-mmt")`,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>)`}}),Le=new x({props:{code:'encoded_en = tokenizer(en_text, return_tensors="pt")',highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>encoded_en = tokenizer(en_text, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)'}}),je=new x({props:{code:`generated_tokens = model.generate(**encoded_en, forced_bos_token_id=tokenizer.lang_code_to_id("en_XX"))
tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)`,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=l("meta"),ua=d(),q=l("h1"),A=l("a"),dt=l("span"),u(re.$$.fragment),jl=d(),gt=l("span"),zl=s("Multilingual models for inference"),ha=d(),u(me.$$.fragment),ca=d(),T=l("p"),ql=s("There are several multilingual models in \u{1F917} Transformers, and their inference usage differs from monolingual models. Not "),ft=l("em"),Cl=s("all"),Dl=s(" multilingual model usage is different though. Some models, like "),de=l("a"),Pl=s("bert-base-multilingual-uncased"),Ol=s(", can be used just like a monolingual model. This guide will show you how to use multilingual models whose usage differs for inference."),pa=d(),C=l("h2"),N=l("a"),ut=l("span"),u(ge.$$.fragment),Xl=d(),ht=l("span"),Il=s("XLM"),_a=d(),ze=l("p"),Sl=s("XLM has ten different checkpoints, only one of which is monolingual. The nine remaining model checkpoints can be split into two categories: the checkpoints that use language embeddings and those that don\u2019t."),ba=d(),D=l("h3"),B=l("a"),ct=l("span"),u(fe.$$.fragment),Al=d(),pt=l("span"),Nl=s("XLM with language embeddings"),ka=d(),qe=l("p"),Bl=s("The following XLM models use language embeddings to specify the language used at inference:"),va=d(),k=l("ul"),Ce=l("li"),_t=l("code"),Rl=s("xlm-mlm-ende-1024"),Fl=s(" (Masked language modeling, English-German)"),Hl=d(),De=l("li"),bt=l("code"),Gl=s("xlm-mlm-enfr-1024"),Wl=s(" (Masked language modeling, English-French)"),Ul=d(),Pe=l("li"),kt=l("code"),Yl=s("xlm-mlm-enro-1024"),Jl=s(" (Masked language modeling, English-Romanian)"),Kl=d(),Oe=l("li"),vt=l("code"),Ql=s("xlm-mlm-xnli15-1024"),Vl=s(" (Masked language modeling, XNLI languages)"),Zl=d(),Xe=l("li"),Et=l("code"),en=s("xlm-mlm-tlm-xnli15-1024"),tn=s(" (Masked language modeling + translation, XNLI languages)"),an=d(),Ie=l("li"),$t=l("code"),ln=s("xlm-clm-enfr-1024"),nn=s(" (Causal language modeling, English-French)"),on=d(),Se=l("li"),wt=l("code"),sn=s("xlm-clm-ende-1024"),rn=s(" (Causal language modeling, English-German)"),Ea=d(),$=l("p"),mn=s("Language embeddings are represented as a tensor of the same shape as the "),Mt=l("code"),dn=s("input_ids"),gn=s(" passed to the model. The values in these tensors depend on the language used and are identified by the tokenizer\u2019s "),yt=l("code"),fn=s("lang2id"),un=s(" and "),xt=l("code"),hn=s("id2lang"),cn=s(" attributes."),$a=d(),R=l("p"),pn=s("In this example, load the "),Tt=l("code"),_n=s("xlm-clm-enfr-1024"),bn=s(" checkpoint (Causal language modeling, English-French):"),wa=d(),u(ue.$$.fragment),Ma=d(),F=l("p"),kn=s("The "),Lt=l("code"),vn=s("lang2id"),En=s(" attribute of the tokenizer displays this model\u2019s languages and their ids:"),ya=d(),u(he.$$.fragment),xa=d(),Ae=l("p"),$n=s("Next, create an example input:"),Ta=d(),u(ce.$$.fragment),La=d(),w=l("p"),wn=s("Set the language id as "),jt=l("code"),Mn=s('"en"'),yn=s(" and use it to define the language embedding. The language embedding is a tensor filled with "),zt=l("code"),xn=s("0"),Tn=s(" since that is the language id for English. This tensor should be the same size as "),qt=l("code"),Ln=s("input_ids"),jn=s("."),ja=d(),u(pe.$$.fragment),za=d(),H=l("p"),zn=s("Now you can pass the "),Ct=l("code"),qn=s("input_ids"),Cn=s(" and language embedding to the model:"),qa=d(),u(_e.$$.fragment),Ca=d(),L=l("p"),Dn=s("The "),be=l("a"),Pn=s("run_generation.py"),On=s(" script can generate text with language embeddings using the "),Dt=l("code"),Xn=s("xlm-clm"),In=s(" checkpoints."),Da=d(),P=l("h3"),G=l("a"),Pt=l("span"),u(ke.$$.fragment),Sn=d(),Ot=l("span"),An=s("XLM without language embeddings"),Pa=d(),Ne=l("p"),Nn=s("The following XLM models do not require language embeddings during inference:"),Oa=d(),W=l("ul"),Be=l("li"),Xt=l("code"),Bn=s("xlm-mlm-17-1280"),Rn=s(" (Masked language modeling, 17 languages)"),Fn=d(),Re=l("li"),It=l("code"),Hn=s("xlm-mlm-100-1280"),Gn=s(" (Masked language modeling, 100 languages)"),Xa=d(),Fe=l("p"),Wn=s("These models are used for generic sentence representations, unlike the previous XLM checkpoints."),Ia=d(),O=l("h2"),U=l("a"),St=l("span"),u(ve.$$.fragment),Un=d(),At=l("span"),Yn=s("BERT"),Sa=d(),He=l("p"),Jn=s("The following BERT models can be used for multilingual tasks:"),Aa=d(),Y=l("ul"),Ge=l("li"),Nt=l("code"),Kn=s("bert-base-multilingual-uncased"),Qn=s(" (Masked language modeling + Next sentence prediction, 102 languages)"),Vn=d(),We=l("li"),Bt=l("code"),Zn=s("bert-base-multilingual-cased"),eo=s(" (Masked language modeling + Next sentence prediction, 104 languages)"),Na=d(),Ue=l("p"),to=s(`These models do not require language embeddings during inference. They should identify the language from the
context and infer accordingly.`),Ba=d(),X=l("h2"),J=l("a"),Rt=l("span"),u(Ee.$$.fragment),ao=d(),Ft=l("span"),lo=s("XLM-RoBERTa"),Ra=d(),Ye=l("p"),no=s("The following XLM-RoBERTa models can be used for multilingual tasks:"),Fa=d(),K=l("ul"),Je=l("li"),Ht=l("code"),oo=s("xlm-roberta-base"),so=s(" (Masked language modeling, 100 languages)"),io=d(),Ke=l("li"),Gt=l("code"),ro=s("xlm-roberta-large"),mo=s(" (Masked language modeling, 100 languages)"),Ha=d(),Qe=l("p"),go=s("XLM-RoBERTa was trained on 2.5TB of newly created and cleaned CommonCrawl data in 100 languages. It provides strong gains over previously released multilingual models like mBERT or XLM on downstream tasks like classification, sequence labeling, and question answering."),Ga=d(),I=l("h2"),Q=l("a"),Wt=l("span"),u($e.$$.fragment),fo=d(),Ut=l("span"),uo=s("M2M100"),Wa=d(),Ve=l("p"),ho=s("The following M2M100 models can be used for multilingual translation:"),Ua=d(),V=l("ul"),Ze=l("li"),Yt=l("code"),co=s("facebook/m2m100_418M"),po=s(" (Translation)"),_o=d(),et=l("li"),Jt=l("code"),bo=s("facebook/m2m100_1.2B"),ko=s(" (Translation)"),Ya=d(),Z=l("p"),vo=s("In this example, load the "),Kt=l("code"),Eo=s("facebook/m2m100_418M"),$o=s(" checkpoint to translate from Chinese to English. You can set the source language in the tokenizer:"),Ja=d(),u(we.$$.fragment),Ka=d(),tt=l("p"),wo=s("Tokenize the text:"),Qa=d(),u(Me.$$.fragment),Va=d(),M=l("p"),Mo=s("M2M100 forces the target language id as the first generated token to translate to the target language. Set the "),Qt=l("code"),yo=s("forced_bos_token_id"),xo=s(" to "),Vt=l("code"),To=s("en"),Lo=s(" in the "),Zt=l("code"),jo=s("generate"),zo=s(" method to translate to English:"),Za=d(),u(ye.$$.fragment),el=d(),S=l("h2"),ee=l("a"),ea=l("span"),u(xe.$$.fragment),qo=d(),ta=l("span"),Co=s("MBart"),tl=d(),at=l("p"),Do=s("The following MBart models can be used for multilingual translation:"),al=d(),v=l("ul"),lt=l("li"),aa=l("code"),Po=s("facebook/mbart-large-50-one-to-many-mmt"),Oo=s(" (One-to-many multilingual machine translation, 50 languages)"),Xo=d(),nt=l("li"),la=l("code"),Io=s("facebook/mbart-large-50-many-to-many-mmt"),So=s(" (Many-to-many multilingual machine translation, 50 languages)"),Ao=d(),ot=l("li"),na=l("code"),No=s("facebook/mbart-large-50-many-to-one-mmt"),Bo=s(" (Many-to-one multilingual machine translation, 50 languages)"),Ro=d(),st=l("li"),oa=l("code"),Fo=s("facebook/mbart-large-50"),Ho=s(" (Multilingual translation, 50 languages)"),Go=d(),sa=l("li"),ia=l("code"),Wo=s("facebook/mbart-large-cc25"),ll=d(),te=l("p"),Uo=s("In this example, load the "),ra=l("code"),Yo=s("facebook/mbart-large-50-many-to-many-mmt"),Jo=s(" checkpoint to translate Finnish to English. You can set the source language in the tokenizer:"),nl=d(),u(Te.$$.fragment),ol=d(),it=l("p"),Ko=s("Tokenize the text:"),sl=d(),u(Le.$$.fragment),il=d(),y=l("p"),Qo=s("MBart forces the target language id as the first generated token to translate to the target language. Set the "),ma=l("code"),Vo=s("forced_bos_token_id"),Zo=s(" to "),da=l("code"),es=s("en"),ts=s(" in the "),ga=l("code"),as=s("generate"),ls=s(" method to translate to English:"),rl=d(),u(je.$$.fragment),ml=d(),ae=l("p"),ns=s("If you are using the "),fa=l("code"),os=s("facebook/mbart-large-50-many-to-one-mmt"),ss=s(" checkpoint, you don\u2019t need to force the target language id as the first generated token otherwise the usage is the same."),this.h()},l(e){const r=ar('[data-svelte="svelte-1phssyn"]',document.head);z=n(r,"META",{name:!0,content:!0}),r.forEach(a),ua=g(e),q=n(e,"H1",{class:!0});var gl=o(q);A=n(gl,"A",{id:!0,class:!0,href:!0});var Ts=o(A);dt=n(Ts,"SPAN",{});var Ls=o(dt);h(re.$$.fragment,Ls),Ls.forEach(a),Ts.forEach(a),jl=g(gl),gt=n(gl,"SPAN",{});var js=o(gt);zl=i(js,"Multilingual models for inference"),js.forEach(a),gl.forEach(a),ha=g(e),h(me.$$.fragment,e),ca=g(e),T=n(e,"P",{});var rt=o(T);ql=i(rt,"There are several multilingual models in \u{1F917} Transformers, and their inference usage differs from monolingual models. Not "),ft=n(rt,"EM",{});var zs=o(ft);Cl=i(zs,"all"),zs.forEach(a),Dl=i(rt," multilingual model usage is different though. Some models, like "),de=n(rt,"A",{href:!0,rel:!0});var qs=o(de);Pl=i(qs,"bert-base-multilingual-uncased"),qs.forEach(a),Ol=i(rt,", can be used just like a monolingual model. This guide will show you how to use multilingual models whose usage differs for inference."),rt.forEach(a),pa=g(e),C=n(e,"H2",{class:!0});var fl=o(C);N=n(fl,"A",{id:!0,class:!0,href:!0});var Cs=o(N);ut=n(Cs,"SPAN",{});var Ds=o(ut);h(ge.$$.fragment,Ds),Ds.forEach(a),Cs.forEach(a),Xl=g(fl),ht=n(fl,"SPAN",{});var Ps=o(ht);Il=i(Ps,"XLM"),Ps.forEach(a),fl.forEach(a),_a=g(e),ze=n(e,"P",{});var Os=o(ze);Sl=i(Os,"XLM has ten different checkpoints, only one of which is monolingual. The nine remaining model checkpoints can be split into two categories: the checkpoints that use language embeddings and those that don\u2019t."),Os.forEach(a),ba=g(e),D=n(e,"H3",{class:!0});var ul=o(D);B=n(ul,"A",{id:!0,class:!0,href:!0});var Xs=o(B);ct=n(Xs,"SPAN",{});var Is=o(ct);h(fe.$$.fragment,Is),Is.forEach(a),Xs.forEach(a),Al=g(ul),pt=n(ul,"SPAN",{});var Ss=o(pt);Nl=i(Ss,"XLM with language embeddings"),Ss.forEach(a),ul.forEach(a),ka=g(e),qe=n(e,"P",{});var As=o(qe);Bl=i(As,"The following XLM models use language embeddings to specify the language used at inference:"),As.forEach(a),va=g(e),k=n(e,"UL",{});var E=o(k);Ce=n(E,"LI",{});var is=o(Ce);_t=n(is,"CODE",{});var Ns=o(_t);Rl=i(Ns,"xlm-mlm-ende-1024"),Ns.forEach(a),Fl=i(is," (Masked language modeling, English-German)"),is.forEach(a),Hl=g(E),De=n(E,"LI",{});var rs=o(De);bt=n(rs,"CODE",{});var Bs=o(bt);Gl=i(Bs,"xlm-mlm-enfr-1024"),Bs.forEach(a),Wl=i(rs," (Masked language modeling, English-French)"),rs.forEach(a),Ul=g(E),Pe=n(E,"LI",{});var ms=o(Pe);kt=n(ms,"CODE",{});var Rs=o(kt);Yl=i(Rs,"xlm-mlm-enro-1024"),Rs.forEach(a),Jl=i(ms," (Masked language modeling, English-Romanian)"),ms.forEach(a),Kl=g(E),Oe=n(E,"LI",{});var ds=o(Oe);vt=n(ds,"CODE",{});var Fs=o(vt);Ql=i(Fs,"xlm-mlm-xnli15-1024"),Fs.forEach(a),Vl=i(ds," (Masked language modeling, XNLI languages)"),ds.forEach(a),Zl=g(E),Xe=n(E,"LI",{});var gs=o(Xe);Et=n(gs,"CODE",{});var Hs=o(Et);en=i(Hs,"xlm-mlm-tlm-xnli15-1024"),Hs.forEach(a),tn=i(gs," (Masked language modeling + translation, XNLI languages)"),gs.forEach(a),an=g(E),Ie=n(E,"LI",{});var fs=o(Ie);$t=n(fs,"CODE",{});var Gs=o($t);ln=i(Gs,"xlm-clm-enfr-1024"),Gs.forEach(a),nn=i(fs," (Causal language modeling, English-French)"),fs.forEach(a),on=g(E),Se=n(E,"LI",{});var us=o(Se);wt=n(us,"CODE",{});var Ws=o(wt);sn=i(Ws,"xlm-clm-ende-1024"),Ws.forEach(a),rn=i(us," (Causal language modeling, English-German)"),us.forEach(a),E.forEach(a),Ea=g(e),$=n(e,"P",{});var le=o($);mn=i(le,"Language embeddings are represented as a tensor of the same shape as the "),Mt=n(le,"CODE",{});var Us=o(Mt);dn=i(Us,"input_ids"),Us.forEach(a),gn=i(le," passed to the model. The values in these tensors depend on the language used and are identified by the tokenizer\u2019s "),yt=n(le,"CODE",{});var Ys=o(yt);fn=i(Ys,"lang2id"),Ys.forEach(a),un=i(le," and "),xt=n(le,"CODE",{});var Js=o(xt);hn=i(Js,"id2lang"),Js.forEach(a),cn=i(le," attributes."),le.forEach(a),$a=g(e),R=n(e,"P",{});var hl=o(R);pn=i(hl,"In this example, load the "),Tt=n(hl,"CODE",{});var Ks=o(Tt);_n=i(Ks,"xlm-clm-enfr-1024"),Ks.forEach(a),bn=i(hl," checkpoint (Causal language modeling, English-French):"),hl.forEach(a),wa=g(e),h(ue.$$.fragment,e),Ma=g(e),F=n(e,"P",{});var cl=o(F);kn=i(cl,"The "),Lt=n(cl,"CODE",{});var Qs=o(Lt);vn=i(Qs,"lang2id"),Qs.forEach(a),En=i(cl," attribute of the tokenizer displays this model\u2019s languages and their ids:"),cl.forEach(a),ya=g(e),h(he.$$.fragment,e),xa=g(e),Ae=n(e,"P",{});var Vs=o(Ae);$n=i(Vs,"Next, create an example input:"),Vs.forEach(a),Ta=g(e),h(ce.$$.fragment,e),La=g(e),w=n(e,"P",{});var ne=o(w);wn=i(ne,"Set the language id as "),jt=n(ne,"CODE",{});var Zs=o(jt);Mn=i(Zs,'"en"'),Zs.forEach(a),yn=i(ne," and use it to define the language embedding. The language embedding is a tensor filled with "),zt=n(ne,"CODE",{});var ei=o(zt);xn=i(ei,"0"),ei.forEach(a),Tn=i(ne," since that is the language id for English. This tensor should be the same size as "),qt=n(ne,"CODE",{});var ti=o(qt);Ln=i(ti,"input_ids"),ti.forEach(a),jn=i(ne,"."),ne.forEach(a),ja=g(e),h(pe.$$.fragment,e),za=g(e),H=n(e,"P",{});var pl=o(H);zn=i(pl,"Now you can pass the "),Ct=n(pl,"CODE",{});var ai=o(Ct);qn=i(ai,"input_ids"),ai.forEach(a),Cn=i(pl," and language embedding to the model:"),pl.forEach(a),qa=g(e),h(_e.$$.fragment,e),Ca=g(e),L=n(e,"P",{});var mt=o(L);Dn=i(mt,"The "),be=n(mt,"A",{href:!0,rel:!0});var li=o(be);Pn=i(li,"run_generation.py"),li.forEach(a),On=i(mt," script can generate text with language embeddings using the "),Dt=n(mt,"CODE",{});var ni=o(Dt);Xn=i(ni,"xlm-clm"),ni.forEach(a),In=i(mt," checkpoints."),mt.forEach(a),Da=g(e),P=n(e,"H3",{class:!0});var _l=o(P);G=n(_l,"A",{id:!0,class:!0,href:!0});var oi=o(G);Pt=n(oi,"SPAN",{});var si=o(Pt);h(ke.$$.fragment,si),si.forEach(a),oi.forEach(a),Sn=g(_l),Ot=n(_l,"SPAN",{});var ii=o(Ot);An=i(ii,"XLM without language embeddings"),ii.forEach(a),_l.forEach(a),Pa=g(e),Ne=n(e,"P",{});var ri=o(Ne);Nn=i(ri,"The following XLM models do not require language embeddings during inference:"),ri.forEach(a),Oa=g(e),W=n(e,"UL",{});var bl=o(W);Be=n(bl,"LI",{});var hs=o(Be);Xt=n(hs,"CODE",{});var mi=o(Xt);Bn=i(mi,"xlm-mlm-17-1280"),mi.forEach(a),Rn=i(hs," (Masked language modeling, 17 languages)"),hs.forEach(a),Fn=g(bl),Re=n(bl,"LI",{});var cs=o(Re);It=n(cs,"CODE",{});var di=o(It);Hn=i(di,"xlm-mlm-100-1280"),di.forEach(a),Gn=i(cs," (Masked language modeling, 100 languages)"),cs.forEach(a),bl.forEach(a),Xa=g(e),Fe=n(e,"P",{});var gi=o(Fe);Wn=i(gi,"These models are used for generic sentence representations, unlike the previous XLM checkpoints."),gi.forEach(a),Ia=g(e),O=n(e,"H2",{class:!0});var kl=o(O);U=n(kl,"A",{id:!0,class:!0,href:!0});var fi=o(U);St=n(fi,"SPAN",{});var ui=o(St);h(ve.$$.fragment,ui),ui.forEach(a),fi.forEach(a),Un=g(kl),At=n(kl,"SPAN",{});var hi=o(At);Yn=i(hi,"BERT"),hi.forEach(a),kl.forEach(a),Sa=g(e),He=n(e,"P",{});var ci=o(He);Jn=i(ci,"The following BERT models can be used for multilingual tasks:"),ci.forEach(a),Aa=g(e),Y=n(e,"UL",{});var vl=o(Y);Ge=n(vl,"LI",{});var ps=o(Ge);Nt=n(ps,"CODE",{});var pi=o(Nt);Kn=i(pi,"bert-base-multilingual-uncased"),pi.forEach(a),Qn=i(ps," (Masked language modeling + Next sentence prediction, 102 languages)"),ps.forEach(a),Vn=g(vl),We=n(vl,"LI",{});var _s=o(We);Bt=n(_s,"CODE",{});var _i=o(Bt);Zn=i(_i,"bert-base-multilingual-cased"),_i.forEach(a),eo=i(_s," (Masked language modeling + Next sentence prediction, 104 languages)"),_s.forEach(a),vl.forEach(a),Na=g(e),Ue=n(e,"P",{});var bi=o(Ue);to=i(bi,`These models do not require language embeddings during inference. They should identify the language from the
context and infer accordingly.`),bi.forEach(a),Ba=g(e),X=n(e,"H2",{class:!0});var El=o(X);J=n(El,"A",{id:!0,class:!0,href:!0});var ki=o(J);Rt=n(ki,"SPAN",{});var vi=o(Rt);h(Ee.$$.fragment,vi),vi.forEach(a),ki.forEach(a),ao=g(El),Ft=n(El,"SPAN",{});var Ei=o(Ft);lo=i(Ei,"XLM-RoBERTa"),Ei.forEach(a),El.forEach(a),Ra=g(e),Ye=n(e,"P",{});var $i=o(Ye);no=i($i,"The following XLM-RoBERTa models can be used for multilingual tasks:"),$i.forEach(a),Fa=g(e),K=n(e,"UL",{});var $l=o(K);Je=n($l,"LI",{});var bs=o(Je);Ht=n(bs,"CODE",{});var wi=o(Ht);oo=i(wi,"xlm-roberta-base"),wi.forEach(a),so=i(bs," (Masked language modeling, 100 languages)"),bs.forEach(a),io=g($l),Ke=n($l,"LI",{});var ks=o(Ke);Gt=n(ks,"CODE",{});var Mi=o(Gt);ro=i(Mi,"xlm-roberta-large"),Mi.forEach(a),mo=i(ks," (Masked language modeling, 100 languages)"),ks.forEach(a),$l.forEach(a),Ha=g(e),Qe=n(e,"P",{});var yi=o(Qe);go=i(yi,"XLM-RoBERTa was trained on 2.5TB of newly created and cleaned CommonCrawl data in 100 languages. It provides strong gains over previously released multilingual models like mBERT or XLM on downstream tasks like classification, sequence labeling, and question answering."),yi.forEach(a),Ga=g(e),I=n(e,"H2",{class:!0});var wl=o(I);Q=n(wl,"A",{id:!0,class:!0,href:!0});var xi=o(Q);Wt=n(xi,"SPAN",{});var Ti=o(Wt);h($e.$$.fragment,Ti),Ti.forEach(a),xi.forEach(a),fo=g(wl),Ut=n(wl,"SPAN",{});var Li=o(Ut);uo=i(Li,"M2M100"),Li.forEach(a),wl.forEach(a),Wa=g(e),Ve=n(e,"P",{});var ji=o(Ve);ho=i(ji,"The following M2M100 models can be used for multilingual translation:"),ji.forEach(a),Ua=g(e),V=n(e,"UL",{});var Ml=o(V);Ze=n(Ml,"LI",{});var vs=o(Ze);Yt=n(vs,"CODE",{});var zi=o(Yt);co=i(zi,"facebook/m2m100_418M"),zi.forEach(a),po=i(vs," (Translation)"),vs.forEach(a),_o=g(Ml),et=n(Ml,"LI",{});var Es=o(et);Jt=n(Es,"CODE",{});var qi=o(Jt);bo=i(qi,"facebook/m2m100_1.2B"),qi.forEach(a),ko=i(Es," (Translation)"),Es.forEach(a),Ml.forEach(a),Ya=g(e),Z=n(e,"P",{});var yl=o(Z);vo=i(yl,"In this example, load the "),Kt=n(yl,"CODE",{});var Ci=o(Kt);Eo=i(Ci,"facebook/m2m100_418M"),Ci.forEach(a),$o=i(yl," checkpoint to translate from Chinese to English. You can set the source language in the tokenizer:"),yl.forEach(a),Ja=g(e),h(we.$$.fragment,e),Ka=g(e),tt=n(e,"P",{});var Di=o(tt);wo=i(Di,"Tokenize the text:"),Di.forEach(a),Qa=g(e),h(Me.$$.fragment,e),Va=g(e),M=n(e,"P",{});var oe=o(M);Mo=i(oe,"M2M100 forces the target language id as the first generated token to translate to the target language. Set the "),Qt=n(oe,"CODE",{});var Pi=o(Qt);yo=i(Pi,"forced_bos_token_id"),Pi.forEach(a),xo=i(oe," to "),Vt=n(oe,"CODE",{});var Oi=o(Vt);To=i(Oi,"en"),Oi.forEach(a),Lo=i(oe," in the "),Zt=n(oe,"CODE",{});var Xi=o(Zt);jo=i(Xi,"generate"),Xi.forEach(a),zo=i(oe," method to translate to English:"),oe.forEach(a),Za=g(e),h(ye.$$.fragment,e),el=g(e),S=n(e,"H2",{class:!0});var xl=o(S);ee=n(xl,"A",{id:!0,class:!0,href:!0});var Ii=o(ee);ea=n(Ii,"SPAN",{});var Si=o(ea);h(xe.$$.fragment,Si),Si.forEach(a),Ii.forEach(a),qo=g(xl),ta=n(xl,"SPAN",{});var Ai=o(ta);Co=i(Ai,"MBart"),Ai.forEach(a),xl.forEach(a),tl=g(e),at=n(e,"P",{});var Ni=o(at);Do=i(Ni,"The following MBart models can be used for multilingual translation:"),Ni.forEach(a),al=g(e),v=n(e,"UL",{});var j=o(v);lt=n(j,"LI",{});var $s=o(lt);aa=n($s,"CODE",{});var Bi=o(aa);Po=i(Bi,"facebook/mbart-large-50-one-to-many-mmt"),Bi.forEach(a),Oo=i($s," (One-to-many multilingual machine translation, 50 languages)"),$s.forEach(a),Xo=g(j),nt=n(j,"LI",{});var ws=o(nt);la=n(ws,"CODE",{});var Ri=o(la);Io=i(Ri,"facebook/mbart-large-50-many-to-many-mmt"),Ri.forEach(a),So=i(ws," (Many-to-many multilingual machine translation, 50 languages)"),ws.forEach(a),Ao=g(j),ot=n(j,"LI",{});var Ms=o(ot);na=n(Ms,"CODE",{});var Fi=o(na);No=i(Fi,"facebook/mbart-large-50-many-to-one-mmt"),Fi.forEach(a),Bo=i(Ms," (Many-to-one multilingual machine translation, 50 languages)"),Ms.forEach(a),Ro=g(j),st=n(j,"LI",{});var ys=o(st);oa=n(ys,"CODE",{});var Hi=o(oa);Fo=i(Hi,"facebook/mbart-large-50"),Hi.forEach(a),Ho=i(ys," (Multilingual translation, 50 languages)"),ys.forEach(a),Go=g(j),sa=n(j,"LI",{});var Gi=o(sa);ia=n(Gi,"CODE",{});var Wi=o(ia);Wo=i(Wi,"facebook/mbart-large-cc25"),Wi.forEach(a),Gi.forEach(a),j.forEach(a),ll=g(e),te=n(e,"P",{});var Tl=o(te);Uo=i(Tl,"In this example, load the "),ra=n(Tl,"CODE",{});var Ui=o(ra);Yo=i(Ui,"facebook/mbart-large-50-many-to-many-mmt"),Ui.forEach(a),Jo=i(Tl," checkpoint to translate Finnish to English. You can set the source language in the tokenizer:"),Tl.forEach(a),nl=g(e),h(Te.$$.fragment,e),ol=g(e),it=n(e,"P",{});var Yi=o(it);Ko=i(Yi,"Tokenize the text:"),Yi.forEach(a),sl=g(e),h(Le.$$.fragment,e),il=g(e),y=n(e,"P",{});var se=o(y);Qo=i(se,"MBart forces the target language id as the first generated token to translate to the target language. Set the "),ma=n(se,"CODE",{});var Ji=o(ma);Vo=i(Ji,"forced_bos_token_id"),Ji.forEach(a),Zo=i(se," to "),da=n(se,"CODE",{});var Ki=o(da);es=i(Ki,"en"),Ki.forEach(a),ts=i(se," in the "),ga=n(se,"CODE",{});var Qi=o(ga);as=i(Qi,"generate"),Qi.forEach(a),ls=i(se," method to translate to English:"),se.forEach(a),rl=g(e),h(je.$$.fragment,e),ml=g(e),ae=n(e,"P",{});var Ll=o(ae);ns=i(Ll,"If you are using the "),fa=n(Ll,"CODE",{});var Vi=o(fa);os=i(Vi,"facebook/mbart-large-50-many-to-one-mmt"),Vi.forEach(a),ss=i(Ll," checkpoint, you don\u2019t need to force the target language id as the first generated token otherwise the usage is the same."),Ll.forEach(a),this.h()},h(){f(z,"name","hf:doc:metadata"),f(z,"content",JSON.stringify(ir)),f(A,"id","multilingual-models-for-inference"),f(A,"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"),f(A,"href","#multilingual-models-for-inference"),f(q,"class","relative group"),f(de,"href","https://huggingface.co/bert-base-multilingual-uncased"),f(de,"rel","nofollow"),f(N,"id","xlm"),f(N,"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"),f(N,"href","#xlm"),f(C,"class","relative group"),f(B,"id","xlm-with-language-embeddings"),f(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"),f(B,"href","#xlm-with-language-embeddings"),f(D,"class","relative group"),f(be,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/text-generation/run_generation.py"),f(be,"rel","nofollow"),f(G,"id","xlm-without-language-embeddings"),f(G,"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"),f(G,"href","#xlm-without-language-embeddings"),f(P,"class","relative group"),f(U,"id","bert"),f(U,"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"),f(U,"href","#bert"),f(O,"class","relative group"),f(J,"id","xlmroberta"),f(J,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),f(J,"href","#xlmroberta"),f(X,"class","relative group"),f(Q,"id","m2m100"),f(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"),f(Q,"href","#m2m100"),f(I,"class","relative group"),f(ee,"id","mbart"),f(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"),f(ee,"href","#mbart"),f(S,"class","relative group")},m(e,r){t(document.head,z),m(e,ua,r),m(e,q,r),t(q,A),t(A,dt),c(re,dt,null),t(q,jl),t(q,gt),t(gt,zl),m(e,ha,r),c(me,e,r),m(e,ca,r),m(e,T,r),t(T,ql),t(T,ft),t(ft,Cl),t(T,Dl),t(T,de),t(de,Pl),t(T,Ol),m(e,pa,r),m(e,C,r),t(C,N),t(N,ut),c(ge,ut,null),t(C,Xl),t(C,ht),t(ht,Il),m(e,_a,r),m(e,ze,r),t(ze,Sl),m(e,ba,r),m(e,D,r),t(D,B),t(B,ct),c(fe,ct,null),t(D,Al),t(D,pt),t(pt,Nl),m(e,ka,r),m(e,qe,r),t(qe,Bl),m(e,va,r),m(e,k,r),t(k,Ce),t(Ce,_t),t(_t,Rl),t(Ce,Fl),t(k,Hl),t(k,De),t(De,bt),t(bt,Gl),t(De,Wl),t(k,Ul),t(k,Pe),t(Pe,kt),t(kt,Yl),t(Pe,Jl),t(k,Kl),t(k,Oe),t(Oe,vt),t(vt,Ql),t(Oe,Vl),t(k,Zl),t(k,Xe),t(Xe,Et),t(Et,en),t(Xe,tn),t(k,an),t(k,Ie),t(Ie,$t),t($t,ln),t(Ie,nn),t(k,on),t(k,Se),t(Se,wt),t(wt,sn),t(Se,rn),m(e,Ea,r),m(e,$,r),t($,mn),t($,Mt),t(Mt,dn),t($,gn),t($,yt),t(yt,fn),t($,un),t($,xt),t(xt,hn),t($,cn),m(e,$a,r),m(e,R,r),t(R,pn),t(R,Tt),t(Tt,_n),t(R,bn),m(e,wa,r),c(ue,e,r),m(e,Ma,r),m(e,F,r),t(F,kn),t(F,Lt),t(Lt,vn),t(F,En),m(e,ya,r),c(he,e,r),m(e,xa,r),m(e,Ae,r),t(Ae,$n),m(e,Ta,r),c(ce,e,r),m(e,La,r),m(e,w,r),t(w,wn),t(w,jt),t(jt,Mn),t(w,yn),t(w,zt),t(zt,xn),t(w,Tn),t(w,qt),t(qt,Ln),t(w,jn),m(e,ja,r),c(pe,e,r),m(e,za,r),m(e,H,r),t(H,zn),t(H,Ct),t(Ct,qn),t(H,Cn),m(e,qa,r),c(_e,e,r),m(e,Ca,r),m(e,L,r),t(L,Dn),t(L,be),t(be,Pn),t(L,On),t(L,Dt),t(Dt,Xn),t(L,In),m(e,Da,r),m(e,P,r),t(P,G),t(G,Pt),c(ke,Pt,null),t(P,Sn),t(P,Ot),t(Ot,An),m(e,Pa,r),m(e,Ne,r),t(Ne,Nn),m(e,Oa,r),m(e,W,r),t(W,Be),t(Be,Xt),t(Xt,Bn),t(Be,Rn),t(W,Fn),t(W,Re),t(Re,It),t(It,Hn),t(Re,Gn),m(e,Xa,r),m(e,Fe,r),t(Fe,Wn),m(e,Ia,r),m(e,O,r),t(O,U),t(U,St),c(ve,St,null),t(O,Un),t(O,At),t(At,Yn),m(e,Sa,r),m(e,He,r),t(He,Jn),m(e,Aa,r),m(e,Y,r),t(Y,Ge),t(Ge,Nt),t(Nt,Kn),t(Ge,Qn),t(Y,Vn),t(Y,We),t(We,Bt),t(Bt,Zn),t(We,eo),m(e,Na,r),m(e,Ue,r),t(Ue,to),m(e,Ba,r),m(e,X,r),t(X,J),t(J,Rt),c(Ee,Rt,null),t(X,ao),t(X,Ft),t(Ft,lo),m(e,Ra,r),m(e,Ye,r),t(Ye,no),m(e,Fa,r),m(e,K,r),t(K,Je),t(Je,Ht),t(Ht,oo),t(Je,so),t(K,io),t(K,Ke),t(Ke,Gt),t(Gt,ro),t(Ke,mo),m(e,Ha,r),m(e,Qe,r),t(Qe,go),m(e,Ga,r),m(e,I,r),t(I,Q),t(Q,Wt),c($e,Wt,null),t(I,fo),t(I,Ut),t(Ut,uo),m(e,Wa,r),m(e,Ve,r),t(Ve,ho),m(e,Ua,r),m(e,V,r),t(V,Ze),t(Ze,Yt),t(Yt,co),t(Ze,po),t(V,_o),t(V,et),t(et,Jt),t(Jt,bo),t(et,ko),m(e,Ya,r),m(e,Z,r),t(Z,vo),t(Z,Kt),t(Kt,Eo),t(Z,$o),m(e,Ja,r),c(we,e,r),m(e,Ka,r),m(e,tt,r),t(tt,wo),m(e,Qa,r),c(Me,e,r),m(e,Va,r),m(e,M,r),t(M,Mo),t(M,Qt),t(Qt,yo),t(M,xo),t(M,Vt),t(Vt,To),t(M,Lo),t(M,Zt),t(Zt,jo),t(M,zo),m(e,Za,r),c(ye,e,r),m(e,el,r),m(e,S,r),t(S,ee),t(ee,ea),c(xe,ea,null),t(S,qo),t(S,ta),t(ta,Co),m(e,tl,r),m(e,at,r),t(at,Do),m(e,al,r),m(e,v,r),t(v,lt),t(lt,aa),t(aa,Po),t(lt,Oo),t(v,Xo),t(v,nt),t(nt,la),t(la,Io),t(nt,So),t(v,Ao),t(v,ot),t(ot,na),t(na,No),t(ot,Bo),t(v,Ro),t(v,st),t(st,oa),t(oa,Fo),t(st,Ho),t(v,Go),t(v,sa),t(sa,ia),t(ia,Wo),m(e,ll,r),m(e,te,r),t(te,Uo),t(te,ra),t(ra,Yo),t(te,Jo),m(e,nl,r),c(Te,e,r),m(e,ol,r),m(e,it,r),t(it,Ko),m(e,sl,r),c(Le,e,r),m(e,il,r),m(e,y,r),t(y,Qo),t(y,ma),t(ma,Vo),t(y,Zo),t(y,da),t(da,es),t(y,ts),t(y,ga),t(ga,as),t(y,ls),m(e,rl,r),c(je,e,r),m(e,ml,r),m(e,ae,r),t(ae,ns),t(ae,fa),t(fa,os),t(ae,ss),dl=!0},p:lr,i(e){dl||(p(re.$$.fragment,e),p(me.$$.fragment,e),p(ge.$$.fragment,e),p(fe.$$.fragment,e),p(ue.$$.fragment,e),p(he.$$.fragment,e),p(ce.$$.fragment,e),p(pe.$$.fragment,e),p(_e.$$.fragment,e),p(ke.$$.fragment,e),p(ve.$$.fragment,e),p(Ee.$$.fragment,e),p($e.$$.fragment,e),p(we.$$.fragment,e),p(Me.$$.fragment,e),p(ye.$$.fragment,e),p(xe.$$.fragment,e),p(Te.$$.fragment,e),p(Le.$$.fragment,e),p(je.$$.fragment,e),dl=!0)},o(e){_(re.$$.fragment,e),_(me.$$.fragment,e),_(ge.$$.fragment,e),_(fe.$$.fragment,e),_(ue.$$.fragment,e),_(he.$$.fragment,e),_(ce.$$.fragment,e),_(pe.$$.fragment,e),_(_e.$$.fragment,e),_(ke.$$.fragment,e),_(ve.$$.fragment,e),_(Ee.$$.fragment,e),_($e.$$.fragment,e),_(we.$$.fragment,e),_(Me.$$.fragment,e),_(ye.$$.fragment,e),_(xe.$$.fragment,e),_(Te.$$.fragment,e),_(Le.$$.fragment,e),_(je.$$.fragment,e),dl=!1},d(e){a(z),e&&a(ua),e&&a(q),b(re),e&&a(ha),b(me,e),e&&a(ca),e&&a(T),e&&a(pa),e&&a(C),b(ge),e&&a(_a),e&&a(ze),e&&a(ba),e&&a(D),b(fe),e&&a(ka),e&&a(qe),e&&a(va),e&&a(k),e&&a(Ea),e&&a($),e&&a($a),e&&a(R),e&&a(wa),b(ue,e),e&&a(Ma),e&&a(F),e&&a(ya),b(he,e),e&&a(xa),e&&a(Ae),e&&a(Ta),b(ce,e),e&&a(La),e&&a(w),e&&a(ja),b(pe,e),e&&a(za),e&&a(H),e&&a(qa),b(_e,e),e&&a(Ca),e&&a(L),e&&a(Da),e&&a(P),b(ke),e&&a(Pa),e&&a(Ne),e&&a(Oa),e&&a(W),e&&a(Xa),e&&a(Fe),e&&a(Ia),e&&a(O),b(ve),e&&a(Sa),e&&a(He),e&&a(Aa),e&&a(Y),e&&a(Na),e&&a(Ue),e&&a(Ba),e&&a(X),b(Ee),e&&a(Ra),e&&a(Ye),e&&a(Fa),e&&a(K),e&&a(Ha),e&&a(Qe),e&&a(Ga),e&&a(I),b($e),e&&a(Wa),e&&a(Ve),e&&a(Ua),e&&a(V),e&&a(Ya),e&&a(Z),e&&a(Ja),b(we,e),e&&a(Ka),e&&a(tt),e&&a(Qa),b(Me,e),e&&a(Va),e&&a(M),e&&a(Za),b(ye,e),e&&a(el),e&&a(S),b(xe),e&&a(tl),e&&a(at),e&&a(al),e&&a(v),e&&a(ll),e&&a(te),e&&a(nl),b(Te,e),e&&a(ol),e&&a(it),e&&a(sl),b(Le,e),e&&a(il),e&&a(y),e&&a(rl),b(je,e),e&&a(ml),e&&a(ae)}}}const ir={local:"multilingual-models-for-inference",sections:[{local:"xlm",sections:[{local:"xlm-with-language-embeddings",title:"XLM with language embeddings"},{local:"xlm-without-language-embeddings",title:"XLM without language embeddings"}],title:"XLM"},{local:"bert",title:"BERT"},{local:"xlmroberta",title:"XLM-RoBERTa"},{local:"m2m100",title:"M2M100"},{local:"mbart",title:"MBart"}],title:"Multilingual models for inference"};function rr(xs){return nr(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ur extends Zi{constructor(z){super();er(this,z,rr,sr,tr,{})}}export{ur as default,ir as metadata};
