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