import{S as Hr,i as Kr,s as en,e as l,k as d,w as u,t as i,M as an,c as t,d as o,m as c,a as s,x as f,h as r,b as p,G as a,g as m,y as g,L as on,q as h,o as b,B as M,v as ln}from"../chunks/vendor-hf-doc-builder.js";import{I as re}from"../chunks/IconCopyLink-hf-doc-builder.js";import{C as U}from"../chunks/CodeBlock-hf-doc-builder.js";import{D as tn}from"../chunks/DocNotebookDropdown-hf-doc-builder.js";function sn(Ti){let Z,fo,x,W,da,ne,Zl,ca,xl,go,me,ho,w,Xl,pa,Il,Cl,de,zl,Gl,bo,X,V,ua,ce,Rl,fa,Bl,Mo,Ze,Wl,vo,I,L,ga,pe,Vl,ha,Ll,Eo,xe,Nl,yo,v,Xe,ba,ql,Ol,Dl,Ie,Ma,Fl,Al,Pl,Ce,va,Ql,Yl,Sl,ze,Ea,Hl,Kl,et,Ge,ya,at,ot,lt,Re,_a,tt,st,it,Be,Ja,rt,nt,_o,_,mt,ka,dt,ct,Ta,pt,ut,Ua,ft,gt,Jo,N,ht,wa,bt,Mt,ko,ue,To,q,vt,$a,Et,yt,Uo,fe,wo,We,_t,$o,ge,jo,J,Jt,ja,kt,Tt,Za,Ut,wt,xa,$t,jt,Zo,he,xo,O,Zt,Xa,xt,Xt,Xo,be,Io,$,It,Me,Ct,zt,Ia,Gt,Rt,Co,C,D,Ca,ve,Bt,za,Wt,zo,Ve,Vt,Go,F,Le,Ga,Lt,Nt,qt,Ne,Ra,Ot,Dt,Ro,qe,Ft,Bo,z,A,Ba,Ee,At,Wa,Pt,Wo,Oe,Qt,Vo,P,De,Va,Yt,St,Ht,Fe,La,Kt,es,Lo,Ae,as,No,G,Q,Na,ye,os,qa,ls,qo,Pe,ts,Oo,Y,Qe,Oa,ss,is,rs,Ye,Da,ns,ms,Do,Se,ds,Fo,R,S,Fa,_e,cs,Aa,ps,Ao,He,us,Po,H,Ke,Pa,fs,gs,hs,ea,Qa,bs,Ms,Qo,K,vs,Ya,Es,ys,Yo,Je,So,aa,_s,Ho,ke,Ko,k,Js,Sa,ks,Ts,Ha,Us,ws,Ka,$s,js,el,Te,al,B,ee,eo,Ue,Zs,ao,xs,ol,oa,Xs,ll,E,la,oo,Is,Cs,zs,ta,lo,Gs,Rs,Bs,sa,to,Ws,Vs,Ls,ia,so,Ns,qs,Os,io,ro,Ds,tl,ae,Fs,no,As,Ps,sl,we,il,ra,Qs,rl,$e,nl,T,Ys,mo,Ss,Hs,co,Ks,ei,po,ai,oi,ml,je,dl,oe,li,uo,ti,si,cl;return ne=new re({}),me=new tn({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/pt/multilingual.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/pt/pytorch/multilingual.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/pt/tensorflow/multilingual.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/pt/multilingual.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/pt/pytorch/multilingual.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/pt/tensorflow/multilingual.ipynb"}]}}),ce=new re({}),pe=new re({}),ue=new U({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 U({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 U({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 U({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 U({props:{code:"b3V0cHV0cyUyMCUzRCUyMG1vZGVsKGlucHV0X2lkcyUyQyUyMGxhbmdzJTNEbGFuZ3Mp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(input_ids, langs=langs)'}}),ve=new re({}),Ee=new re({}),ye=new re({}),_e=new re({}),Je=new U({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 U({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>)'}}),Te=new U({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>`}}),Ue=new re({}),we=new U({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 U({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 U({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=l("meta"),fo=d(),x=l("h1"),W=l("a"),da=l("span"),u(ne.$$.fragment),Zl=d(),ca=l("span"),xl=i("Modelos multilingu\xEDsticos para infer\xEAncia"),go=d(),u(me.$$.fragment),ho=d(),w=l("p"),Xl=i(`Existem v\xE1rios modelos multilingu\xEDsticos no \u{1F917} Transformers e seus usos para infer\xEAncia diferem dos modelos monol\xEDngues.
No entanto, nem `),pa=l("em"),Il=i("todos"),Cl=i(` os usos dos modelos multil\xEDngues s\xE3o t\xE3o diferentes.
Alguns modelos, como o `),de=l("a"),zl=i("bert-base-multilingual-uncased"),Gl=i(`,
podem ser usados como se fossem monol\xEDngues. Este guia ir\xE1 te ajudar a usar modelos multil\xEDngues cujo uso difere
para o prop\xF3sito de infer\xEAncia.`),bo=d(),X=l("h2"),V=l("a"),ua=l("span"),u(ce.$$.fragment),Rl=d(),fa=l("span"),Bl=i("XLM"),Mo=d(),Ze=l("p"),Wl=i(`O XLM tem dez checkpoints diferentes dos quais apenas um \xE9 monol\xEDngue.
Os nove checkpoints restantes do modelo s\xE3o subdivididos em duas categorias:
checkpoints que usam de language embeddings e os que n\xE3o.`),vo=d(),I=l("h3"),L=l("a"),ga=l("span"),u(pe.$$.fragment),Vl=d(),ha=l("span"),Ll=i("XLM com language embeddings"),Eo=d(),xe=l("p"),Nl=i("Os seguintes modelos de XLM usam language embeddings para especificar a linguagem utilizada para a infer\xEAncia."),yo=d(),v=l("ul"),Xe=l("li"),ba=l("code"),ql=i("xlm-mlm-ende-1024"),Ol=i(" (Masked language modeling, English-German)"),Dl=d(),Ie=l("li"),Ma=l("code"),Fl=i("xlm-mlm-enfr-1024"),Al=i(" (Masked language modeling, English-French)"),Pl=d(),Ce=l("li"),va=l("code"),Ql=i("xlm-mlm-enro-1024"),Yl=i(" (Masked language modeling, English-Romanian)"),Sl=d(),ze=l("li"),Ea=l("code"),Hl=i("xlm-mlm-xnli15-1024"),Kl=i(" (Masked language modeling, XNLI languages)"),et=d(),Ge=l("li"),ya=l("code"),at=i("xlm-mlm-tlm-xnli15-1024"),ot=i(" (Masked language modeling + translation, XNLI languages)"),lt=d(),Re=l("li"),_a=l("code"),tt=i("xlm-clm-enfr-1024"),st=i(" (Causal language modeling, English-French)"),it=d(),Be=l("li"),Ja=l("code"),rt=i("xlm-clm-ende-1024"),nt=i(" (Causal language modeling, English-German)"),_o=d(),_=l("p"),mt=i("Os language embeddings s\xE3o representados por um tensor de mesma dimens\xE3o que os "),ka=l("code"),dt=i("input_ids"),ct=i(` passados ao modelo.
Os valores destes tensores dependem do idioma utilizado e se identificam pelos atributos `),Ta=l("code"),pt=i("lang2id"),ut=i(" e "),Ua=l("code"),ft=i("id2lang"),gt=i(" do tokenizador."),Jo=d(),N=l("p"),ht=i("Neste exemplo, carregamos o checkpoint "),wa=l("code"),bt=i("xlm-clm-enfr-1024"),Mt=i("(Causal language modeling, English-French):"),ko=d(),u(ue.$$.fragment),To=d(),q=l("p"),vt=i("O atributo "),$a=l("code"),Et=i("lang2id"),yt=i(" do tokenizador mostra os idiomas deste modelo e seus ids:"),Uo=d(),u(fe.$$.fragment),wo=d(),We=l("p"),_t=i("Em seguida, cria-se um input de exemplo:"),$o=d(),u(ge.$$.fragment),jo=d(),J=l("p"),Jt=i("Estabelece-se o id do idioma, por exemplo "),ja=l("code"),kt=i('"en"'),Tt=i(`, e utiliza-se o mesmo para definir a language embedding.
A language embedding \xE9 um tensor preenchido com `),Za=l("code"),Ut=i("0"),wt=i(`, que \xE9 o id de idioma para o ingl\xEAs.
Este tensor deve ser do mesmo tamanho que os `),xa=l("code"),$t=i("input_ids"),jt=i("."),Zo=d(),u(he.$$.fragment),xo=d(),O=l("p"),Zt=i("Agora voc\xEA pode passar os "),Xa=l("code"),xt=i("input_ids"),Xt=i(" e a language embedding ao modelo:"),Xo=d(),u(be.$$.fragment),Io=d(),$=l("p"),It=i("O script "),Me=l("a"),Ct=i("run_generation.py"),zt=i(" pode gerar um texto com language embeddings utilizando os checkpoints "),Ia=l("code"),Gt=i("xlm-clm"),Rt=i("."),Co=d(),C=l("h3"),D=l("a"),Ca=l("span"),u(ve.$$.fragment),Bt=d(),za=l("span"),Wt=i("XLM sem language embeddings"),zo=d(),Ve=l("p"),Vt=i("Os seguintes modelos XLM n\xE3o requerem o uso de language embeddings durante a infer\xEAncia:"),Go=d(),F=l("ul"),Le=l("li"),Ga=l("code"),Lt=i("xlm-mlm-17-1280"),Nt=i(" (Modelagem de linguagem com m\xE1scara, 17 idiomas)"),qt=d(),Ne=l("li"),Ra=l("code"),Ot=i("xlm-mlm-100-1280"),Dt=i(" (Modelagem de linguagem com m\xE1scara, 100 idiomas)"),Ro=d(),qe=l("p"),Ft=i("Estes modelos s\xE3o utilizados para representa\xE7\xF5es gen\xE9ricas de frase diferentemente dos checkpoints XLM anteriores."),Bo=d(),z=l("h2"),A=l("a"),Ba=l("span"),u(Ee.$$.fragment),At=d(),Wa=l("span"),Pt=i("BERT"),Wo=d(),Oe=l("p"),Qt=i("Os seguintes modelos do BERT podem ser utilizados para tarefas multilingu\xEDsticas:"),Vo=d(),P=l("ul"),De=l("li"),Va=l("code"),Yt=i("bert-base-multilingual-uncased"),St=i(" (Modelagem de linguagem com m\xE1scara + Previs\xE3o de frases, 102 idiomas)"),Ht=d(),Fe=l("li"),La=l("code"),Kt=i("bert-base-multilingual-cased"),es=i(" (Modelagem de linguagem com m\xE1scara + Previs\xE3o de frases, 104 idiomas)"),Lo=d(),Ae=l("p"),as=i(`Estes modelos n\xE3o requerem language embeddings durante a infer\xEAncia. Devem identificar a linguagem a partir
do contexto e realizar a infer\xEAncia em sequ\xEAncia.`),No=d(),G=l("h2"),Q=l("a"),Na=l("span"),u(ye.$$.fragment),os=d(),qa=l("span"),ls=i("XLM-RoBERTa"),qo=d(),Pe=l("p"),ts=i("Os seguintes modelos do XLM-RoBERTa podem ser utilizados para tarefas multilingu\xEDsticas:"),Oo=d(),Y=l("ul"),Qe=l("li"),Oa=l("code"),ss=i("xlm-roberta-base"),is=i(" (Modelagem de linguagem com m\xE1scara, 100 idiomas)"),rs=d(),Ye=l("li"),Da=l("code"),ns=i("xlm-roberta-large"),ms=i(" Modelagem de linguagem com m\xE1scara, 100 idiomas)"),Do=d(),Se=l("p"),ds=i(`O XLM-RoBERTa foi treinado com 2,5 TB de dados do CommonCrawl rec\xE9m-criados e testados em 100 idiomas.
Proporciona fortes vantagens sobre os modelos multilingu\xEDsticos publicados anteriormente como o mBERT e o XLM em tarefas
subsequentes como a classifica\xE7\xE3o, a rotulagem de sequ\xEAncias e \xE0 respostas a perguntas.`),Fo=d(),R=l("h2"),S=l("a"),Fa=l("span"),u(_e.$$.fragment),cs=d(),Aa=l("span"),ps=i("M2M100"),Ao=d(),He=l("p"),us=i("Os seguintes modelos de M2M100 podem ser utilizados para tradu\xE7\xF5es multilingu\xEDsticas:"),Po=d(),H=l("ul"),Ke=l("li"),Pa=l("code"),fs=i("facebook/m2m100_418M"),gs=i(" (Tradu\xE7\xE3o)"),hs=d(),ea=l("li"),Qa=l("code"),bs=i("facebook/m2m100_1.2B"),Ms=i(" (Tradu\xE7\xE3o)"),Qo=d(),K=l("p"),vs=i("Neste exemplo, o checkpoint "),Ya=l("code"),Es=i("facebook/m2m100_418M"),ys=i(` \xE9 carregado para traduzir do mandarim ao ingl\xEAs. \xC9 poss\xEDvel
estabelecer o idioma de origem no tokenizador:`),Yo=d(),u(Je.$$.fragment),So=d(),aa=l("p"),_s=i("Tokeniza\xE7\xE3o do texto:"),Ho=d(),u(ke.$$.fragment),Ko=d(),k=l("p"),Js=i(`O M2M100 for\xE7a o id do idioma de destino como o primeiro token gerado para traduzir ao idioma de destino.
\xC9 definido o `),Sa=l("code"),ks=i("forced_bos_token_id"),Ts=i(" como "),Ha=l("code"),Us=i("en"),ws=i(" no m\xE9todo "),Ka=l("code"),$s=i("generate"),js=i(" para traduzir ao ingl\xEAs."),el=d(),u(Te.$$.fragment),al=d(),B=l("h2"),ee=l("a"),eo=l("span"),u(Ue.$$.fragment),Zs=d(),ao=l("span"),xs=i("MBart"),ol=d(),oa=l("p"),Xs=i("Os seguintes modelos do MBart podem ser utilizados para tradu\xE7\xE3o multilingu\xEDstica:"),ll=d(),E=l("ul"),la=l("li"),oo=l("code"),Is=i("facebook/mbart-large-50-one-to-many-mmt"),Cs=i(" (Tradu\xE7\xE3o autom\xE1tica multilingu\xEDstica de um a v\xE1rios, 50 idiomas)"),zs=d(),ta=l("li"),lo=l("code"),Gs=i("facebook/mbart-large-50-many-to-many-mmt"),Rs=i(" (Tradu\xE7\xE3o autom\xE1tica multilingu\xEDstica de v\xE1rios a v\xE1rios, 50 idiomas)"),Bs=d(),sa=l("li"),to=l("code"),Ws=i("facebook/mbart-large-50-many-to-one-mmt"),Vs=i(" (Tradu\xE7\xE3o autom\xE1tica multilingu\xEDstica v\xE1rios a um, 50 idiomas)"),Ls=d(),ia=l("li"),so=l("code"),Ns=i("facebook/mbart-large-50"),qs=i(" (Tradu\xE7\xE3o multilingu\xEDstica, 50 idiomas)"),Os=d(),io=l("li"),ro=l("code"),Ds=i("facebook/mbart-large-cc25"),tl=d(),ae=l("p"),Fs=i("Neste exemplo, carrega-se o checkpoint "),no=l("code"),As=i("facebook/mbart-large-50-many-to-many-mmt"),Ps=i(` para traduzir do finland\xEAs ao ingl\xEAs.
Pode-se definir o idioma de origem no tokenizador:`),sl=d(),u(we.$$.fragment),il=d(),ra=l("p"),Qs=i("Tokenizando o texto:"),rl=d(),u($e.$$.fragment),nl=d(),T=l("p"),Ys=i(`O MBart for\xE7a o id do idioma de destino como o primeiro token gerado para traduzir ao idioma de destino.
\xC9 definido o `),mo=l("code"),Ss=i("forced_bos_token_id"),Hs=i(" como "),co=l("code"),Ks=i("en"),ei=i(" no m\xE9todo "),po=l("code"),ai=i("generate"),oi=i(" para traduzir ao ingl\xEAs."),ml=d(),u(je.$$.fragment),dl=d(),oe=l("p"),li=i("Se estiver usando o checkpoint "),uo=l("code"),ti=i("facebook/mbart-large-50-many-to-one-mmt"),si=i(` n\xE3o ser\xE1 necess\xE1rio for\xE7ar o id do idioma de destino
como sendo o primeiro token generado, caso contr\xE1rio a usagem \xE9 a mesma.`),this.h()},l(e){const n=an('[data-svelte="svelte-1phssyn"]',document.head);Z=t(n,"META",{name:!0,content:!0}),n.forEach(o),fo=c(e),x=t(e,"H1",{class:!0});var pl=s(x);W=t(pl,"A",{id:!0,class:!0,href:!0});var Ui=s(W);da=t(Ui,"SPAN",{});var wi=s(da);f(ne.$$.fragment,wi),wi.forEach(o),Ui.forEach(o),Zl=c(pl),ca=t(pl,"SPAN",{});var $i=s(ca);xl=r($i,"Modelos multilingu\xEDsticos para infer\xEAncia"),$i.forEach(o),pl.forEach(o),go=c(e),f(me.$$.fragment,e),ho=c(e),w=t(e,"P",{});var na=s(w);Xl=r(na,`Existem v\xE1rios modelos multilingu\xEDsticos no \u{1F917} Transformers e seus usos para infer\xEAncia diferem dos modelos monol\xEDngues.
No entanto, nem `),pa=t(na,"EM",{});var ji=s(pa);Il=r(ji,"todos"),ji.forEach(o),Cl=r(na,` os usos dos modelos multil\xEDngues s\xE3o t\xE3o diferentes.
Alguns modelos, como o `),de=t(na,"A",{href:!0,rel:!0});var Zi=s(de);zl=r(Zi,"bert-base-multilingual-uncased"),Zi.forEach(o),Gl=r(na,`,
podem ser usados como se fossem monol\xEDngues. Este guia ir\xE1 te ajudar a usar modelos multil\xEDngues cujo uso difere
para o prop\xF3sito de infer\xEAncia.`),na.forEach(o),bo=c(e),X=t(e,"H2",{class:!0});var ul=s(X);V=t(ul,"A",{id:!0,class:!0,href:!0});var xi=s(V);ua=t(xi,"SPAN",{});var Xi=s(ua);f(ce.$$.fragment,Xi),Xi.forEach(o),xi.forEach(o),Rl=c(ul),fa=t(ul,"SPAN",{});var Ii=s(fa);Bl=r(Ii,"XLM"),Ii.forEach(o),ul.forEach(o),Mo=c(e),Ze=t(e,"P",{});var Ci=s(Ze);Wl=r(Ci,`O XLM tem dez checkpoints diferentes dos quais apenas um \xE9 monol\xEDngue.
Os nove checkpoints restantes do modelo s\xE3o subdivididos em duas categorias:
checkpoints que usam de language embeddings e os que n\xE3o.`),Ci.forEach(o),vo=c(e),I=t(e,"H3",{class:!0});var fl=s(I);L=t(fl,"A",{id:!0,class:!0,href:!0});var zi=s(L);ga=t(zi,"SPAN",{});var Gi=s(ga);f(pe.$$.fragment,Gi),Gi.forEach(o),zi.forEach(o),Vl=c(fl),ha=t(fl,"SPAN",{});var Ri=s(ha);Ll=r(Ri,"XLM com language embeddings"),Ri.forEach(o),fl.forEach(o),Eo=c(e),xe=t(e,"P",{});var Bi=s(xe);Nl=r(Bi,"Os seguintes modelos de XLM usam language embeddings para especificar a linguagem utilizada para a infer\xEAncia."),Bi.forEach(o),yo=c(e),v=t(e,"UL",{});var y=s(v);Xe=t(y,"LI",{});var ii=s(Xe);ba=t(ii,"CODE",{});var Wi=s(ba);ql=r(Wi,"xlm-mlm-ende-1024"),Wi.forEach(o),Ol=r(ii," (Masked language modeling, English-German)"),ii.forEach(o),Dl=c(y),Ie=t(y,"LI",{});var ri=s(Ie);Ma=t(ri,"CODE",{});var Vi=s(Ma);Fl=r(Vi,"xlm-mlm-enfr-1024"),Vi.forEach(o),Al=r(ri," (Masked language modeling, English-French)"),ri.forEach(o),Pl=c(y),Ce=t(y,"LI",{});var ni=s(Ce);va=t(ni,"CODE",{});var Li=s(va);Ql=r(Li,"xlm-mlm-enro-1024"),Li.forEach(o),Yl=r(ni," (Masked language modeling, English-Romanian)"),ni.forEach(o),Sl=c(y),ze=t(y,"LI",{});var mi=s(ze);Ea=t(mi,"CODE",{});var Ni=s(Ea);Hl=r(Ni,"xlm-mlm-xnli15-1024"),Ni.forEach(o),Kl=r(mi," (Masked language modeling, XNLI languages)"),mi.forEach(o),et=c(y),Ge=t(y,"LI",{});var di=s(Ge);ya=t(di,"CODE",{});var qi=s(ya);at=r(qi,"xlm-mlm-tlm-xnli15-1024"),qi.forEach(o),ot=r(di," (Masked language modeling + translation, XNLI languages)"),di.forEach(o),lt=c(y),Re=t(y,"LI",{});var ci=s(Re);_a=t(ci,"CODE",{});var Oi=s(_a);tt=r(Oi,"xlm-clm-enfr-1024"),Oi.forEach(o),st=r(ci," (Causal language modeling, English-French)"),ci.forEach(o),it=c(y),Be=t(y,"LI",{});var pi=s(Be);Ja=t(pi,"CODE",{});var Di=s(Ja);rt=r(Di,"xlm-clm-ende-1024"),Di.forEach(o),nt=r(pi," (Causal language modeling, English-German)"),pi.forEach(o),y.forEach(o),_o=c(e),_=t(e,"P",{});var le=s(_);mt=r(le,"Os language embeddings s\xE3o representados por um tensor de mesma dimens\xE3o que os "),ka=t(le,"CODE",{});var Fi=s(ka);dt=r(Fi,"input_ids"),Fi.forEach(o),ct=r(le,` passados ao modelo.
Os valores destes tensores dependem do idioma utilizado e se identificam pelos atributos `),Ta=t(le,"CODE",{});var Ai=s(Ta);pt=r(Ai,"lang2id"),Ai.forEach(o),ut=r(le," e "),Ua=t(le,"CODE",{});var Pi=s(Ua);ft=r(Pi,"id2lang"),Pi.forEach(o),gt=r(le," do tokenizador."),le.forEach(o),Jo=c(e),N=t(e,"P",{});var gl=s(N);ht=r(gl,"Neste exemplo, carregamos o checkpoint "),wa=t(gl,"CODE",{});var Qi=s(wa);bt=r(Qi,"xlm-clm-enfr-1024"),Qi.forEach(o),Mt=r(gl,"(Causal language modeling, English-French):"),gl.forEach(o),ko=c(e),f(ue.$$.fragment,e),To=c(e),q=t(e,"P",{});var hl=s(q);vt=r(hl,"O atributo "),$a=t(hl,"CODE",{});var Yi=s($a);Et=r(Yi,"lang2id"),Yi.forEach(o),yt=r(hl," do tokenizador mostra os idiomas deste modelo e seus ids:"),hl.forEach(o),Uo=c(e),f(fe.$$.fragment,e),wo=c(e),We=t(e,"P",{});var Si=s(We);_t=r(Si,"Em seguida, cria-se um input de exemplo:"),Si.forEach(o),$o=c(e),f(ge.$$.fragment,e),jo=c(e),J=t(e,"P",{});var te=s(J);Jt=r(te,"Estabelece-se o id do idioma, por exemplo "),ja=t(te,"CODE",{});var Hi=s(ja);kt=r(Hi,'"en"'),Hi.forEach(o),Tt=r(te,`, e utiliza-se o mesmo para definir a language embedding.
A language embedding \xE9 um tensor preenchido com `),Za=t(te,"CODE",{});var Ki=s(Za);Ut=r(Ki,"0"),Ki.forEach(o),wt=r(te,`, que \xE9 o id de idioma para o ingl\xEAs.
Este tensor deve ser do mesmo tamanho que os `),xa=t(te,"CODE",{});var er=s(xa);$t=r(er,"input_ids"),er.forEach(o),jt=r(te,"."),te.forEach(o),Zo=c(e),f(he.$$.fragment,e),xo=c(e),O=t(e,"P",{});var bl=s(O);Zt=r(bl,"Agora voc\xEA pode passar os "),Xa=t(bl,"CODE",{});var ar=s(Xa);xt=r(ar,"input_ids"),ar.forEach(o),Xt=r(bl," e a language embedding ao modelo:"),bl.forEach(o),Xo=c(e),f(be.$$.fragment,e),Io=c(e),$=t(e,"P",{});var ma=s($);It=r(ma,"O script "),Me=t(ma,"A",{href:!0,rel:!0});var or=s(Me);Ct=r(or,"run_generation.py"),or.forEach(o),zt=r(ma," pode gerar um texto com language embeddings utilizando os checkpoints "),Ia=t(ma,"CODE",{});var lr=s(Ia);Gt=r(lr,"xlm-clm"),lr.forEach(o),Rt=r(ma,"."),ma.forEach(o),Co=c(e),C=t(e,"H3",{class:!0});var Ml=s(C);D=t(Ml,"A",{id:!0,class:!0,href:!0});var tr=s(D);Ca=t(tr,"SPAN",{});var sr=s(Ca);f(ve.$$.fragment,sr),sr.forEach(o),tr.forEach(o),Bt=c(Ml),za=t(Ml,"SPAN",{});var ir=s(za);Wt=r(ir,"XLM sem language embeddings"),ir.forEach(o),Ml.forEach(o),zo=c(e),Ve=t(e,"P",{});var rr=s(Ve);Vt=r(rr,"Os seguintes modelos XLM n\xE3o requerem o uso de language embeddings durante a infer\xEAncia:"),rr.forEach(o),Go=c(e),F=t(e,"UL",{});var vl=s(F);Le=t(vl,"LI",{});var ui=s(Le);Ga=t(ui,"CODE",{});var nr=s(Ga);Lt=r(nr,"xlm-mlm-17-1280"),nr.forEach(o),Nt=r(ui," (Modelagem de linguagem com m\xE1scara, 17 idiomas)"),ui.forEach(o),qt=c(vl),Ne=t(vl,"LI",{});var fi=s(Ne);Ra=t(fi,"CODE",{});var mr=s(Ra);Ot=r(mr,"xlm-mlm-100-1280"),mr.forEach(o),Dt=r(fi," (Modelagem de linguagem com m\xE1scara, 100 idiomas)"),fi.forEach(o),vl.forEach(o),Ro=c(e),qe=t(e,"P",{});var dr=s(qe);Ft=r(dr,"Estes modelos s\xE3o utilizados para representa\xE7\xF5es gen\xE9ricas de frase diferentemente dos checkpoints XLM anteriores."),dr.forEach(o),Bo=c(e),z=t(e,"H2",{class:!0});var El=s(z);A=t(El,"A",{id:!0,class:!0,href:!0});var cr=s(A);Ba=t(cr,"SPAN",{});var pr=s(Ba);f(Ee.$$.fragment,pr),pr.forEach(o),cr.forEach(o),At=c(El),Wa=t(El,"SPAN",{});var ur=s(Wa);Pt=r(ur,"BERT"),ur.forEach(o),El.forEach(o),Wo=c(e),Oe=t(e,"P",{});var fr=s(Oe);Qt=r(fr,"Os seguintes modelos do BERT podem ser utilizados para tarefas multilingu\xEDsticas:"),fr.forEach(o),Vo=c(e),P=t(e,"UL",{});var yl=s(P);De=t(yl,"LI",{});var gi=s(De);Va=t(gi,"CODE",{});var gr=s(Va);Yt=r(gr,"bert-base-multilingual-uncased"),gr.forEach(o),St=r(gi," (Modelagem de linguagem com m\xE1scara + Previs\xE3o de frases, 102 idiomas)"),gi.forEach(o),Ht=c(yl),Fe=t(yl,"LI",{});var hi=s(Fe);La=t(hi,"CODE",{});var hr=s(La);Kt=r(hr,"bert-base-multilingual-cased"),hr.forEach(o),es=r(hi," (Modelagem de linguagem com m\xE1scara + Previs\xE3o de frases, 104 idiomas)"),hi.forEach(o),yl.forEach(o),Lo=c(e),Ae=t(e,"P",{});var br=s(Ae);as=r(br,`Estes modelos n\xE3o requerem language embeddings durante a infer\xEAncia. Devem identificar a linguagem a partir
do contexto e realizar a infer\xEAncia em sequ\xEAncia.`),br.forEach(o),No=c(e),G=t(e,"H2",{class:!0});var _l=s(G);Q=t(_l,"A",{id:!0,class:!0,href:!0});var Mr=s(Q);Na=t(Mr,"SPAN",{});var vr=s(Na);f(ye.$$.fragment,vr),vr.forEach(o),Mr.forEach(o),os=c(_l),qa=t(_l,"SPAN",{});var Er=s(qa);ls=r(Er,"XLM-RoBERTa"),Er.forEach(o),_l.forEach(o),qo=c(e),Pe=t(e,"P",{});var yr=s(Pe);ts=r(yr,"Os seguintes modelos do XLM-RoBERTa podem ser utilizados para tarefas multilingu\xEDsticas:"),yr.forEach(o),Oo=c(e),Y=t(e,"UL",{});var Jl=s(Y);Qe=t(Jl,"LI",{});var bi=s(Qe);Oa=t(bi,"CODE",{});var _r=s(Oa);ss=r(_r,"xlm-roberta-base"),_r.forEach(o),is=r(bi," (Modelagem de linguagem com m\xE1scara, 100 idiomas)"),bi.forEach(o),rs=c(Jl),Ye=t(Jl,"LI",{});var Mi=s(Ye);Da=t(Mi,"CODE",{});var Jr=s(Da);ns=r(Jr,"xlm-roberta-large"),Jr.forEach(o),ms=r(Mi," Modelagem de linguagem com m\xE1scara, 100 idiomas)"),Mi.forEach(o),Jl.forEach(o),Do=c(e),Se=t(e,"P",{});var kr=s(Se);ds=r(kr,`O XLM-RoBERTa foi treinado com 2,5 TB de dados do CommonCrawl rec\xE9m-criados e testados em 100 idiomas.
Proporciona fortes vantagens sobre os modelos multilingu\xEDsticos publicados anteriormente como o mBERT e o XLM em tarefas
subsequentes como a classifica\xE7\xE3o, a rotulagem de sequ\xEAncias e \xE0 respostas a perguntas.`),kr.forEach(o),Fo=c(e),R=t(e,"H2",{class:!0});var kl=s(R);S=t(kl,"A",{id:!0,class:!0,href:!0});var Tr=s(S);Fa=t(Tr,"SPAN",{});var Ur=s(Fa);f(_e.$$.fragment,Ur),Ur.forEach(o),Tr.forEach(o),cs=c(kl),Aa=t(kl,"SPAN",{});var wr=s(Aa);ps=r(wr,"M2M100"),wr.forEach(o),kl.forEach(o),Ao=c(e),He=t(e,"P",{});var $r=s(He);us=r($r,"Os seguintes modelos de M2M100 podem ser utilizados para tradu\xE7\xF5es multilingu\xEDsticas:"),$r.forEach(o),Po=c(e),H=t(e,"UL",{});var Tl=s(H);Ke=t(Tl,"LI",{});var vi=s(Ke);Pa=t(vi,"CODE",{});var jr=s(Pa);fs=r(jr,"facebook/m2m100_418M"),jr.forEach(o),gs=r(vi," (Tradu\xE7\xE3o)"),vi.forEach(o),hs=c(Tl),ea=t(Tl,"LI",{});var Ei=s(ea);Qa=t(Ei,"CODE",{});var Zr=s(Qa);bs=r(Zr,"facebook/m2m100_1.2B"),Zr.forEach(o),Ms=r(Ei," (Tradu\xE7\xE3o)"),Ei.forEach(o),Tl.forEach(o),Qo=c(e),K=t(e,"P",{});var Ul=s(K);vs=r(Ul,"Neste exemplo, o checkpoint "),Ya=t(Ul,"CODE",{});var xr=s(Ya);Es=r(xr,"facebook/m2m100_418M"),xr.forEach(o),ys=r(Ul,` \xE9 carregado para traduzir do mandarim ao ingl\xEAs. \xC9 poss\xEDvel
estabelecer o idioma de origem no tokenizador:`),Ul.forEach(o),Yo=c(e),f(Je.$$.fragment,e),So=c(e),aa=t(e,"P",{});var Xr=s(aa);_s=r(Xr,"Tokeniza\xE7\xE3o do texto:"),Xr.forEach(o),Ho=c(e),f(ke.$$.fragment,e),Ko=c(e),k=t(e,"P",{});var se=s(k);Js=r(se,`O M2M100 for\xE7a o id do idioma de destino como o primeiro token gerado para traduzir ao idioma de destino.
\xC9 definido o `),Sa=t(se,"CODE",{});var Ir=s(Sa);ks=r(Ir,"forced_bos_token_id"),Ir.forEach(o),Ts=r(se," como "),Ha=t(se,"CODE",{});var Cr=s(Ha);Us=r(Cr,"en"),Cr.forEach(o),ws=r(se," no m\xE9todo "),Ka=t(se,"CODE",{});var zr=s(Ka);$s=r(zr,"generate"),zr.forEach(o),js=r(se," para traduzir ao ingl\xEAs."),se.forEach(o),el=c(e),f(Te.$$.fragment,e),al=c(e),B=t(e,"H2",{class:!0});var wl=s(B);ee=t(wl,"A",{id:!0,class:!0,href:!0});var Gr=s(ee);eo=t(Gr,"SPAN",{});var Rr=s(eo);f(Ue.$$.fragment,Rr),Rr.forEach(o),Gr.forEach(o),Zs=c(wl),ao=t(wl,"SPAN",{});var Br=s(ao);xs=r(Br,"MBart"),Br.forEach(o),wl.forEach(o),ol=c(e),oa=t(e,"P",{});var Wr=s(oa);Xs=r(Wr,"Os seguintes modelos do MBart podem ser utilizados para tradu\xE7\xE3o multilingu\xEDstica:"),Wr.forEach(o),ll=c(e),E=t(e,"UL",{});var j=s(E);la=t(j,"LI",{});var yi=s(la);oo=t(yi,"CODE",{});var Vr=s(oo);Is=r(Vr,"facebook/mbart-large-50-one-to-many-mmt"),Vr.forEach(o),Cs=r(yi," (Tradu\xE7\xE3o autom\xE1tica multilingu\xEDstica de um a v\xE1rios, 50 idiomas)"),yi.forEach(o),zs=c(j),ta=t(j,"LI",{});var _i=s(ta);lo=t(_i,"CODE",{});var Lr=s(lo);Gs=r(Lr,"facebook/mbart-large-50-many-to-many-mmt"),Lr.forEach(o),Rs=r(_i," (Tradu\xE7\xE3o autom\xE1tica multilingu\xEDstica de v\xE1rios a v\xE1rios, 50 idiomas)"),_i.forEach(o),Bs=c(j),sa=t(j,"LI",{});var Ji=s(sa);to=t(Ji,"CODE",{});var Nr=s(to);Ws=r(Nr,"facebook/mbart-large-50-many-to-one-mmt"),Nr.forEach(o),Vs=r(Ji," (Tradu\xE7\xE3o autom\xE1tica multilingu\xEDstica v\xE1rios a um, 50 idiomas)"),Ji.forEach(o),Ls=c(j),ia=t(j,"LI",{});var ki=s(ia);so=t(ki,"CODE",{});var qr=s(so);Ns=r(qr,"facebook/mbart-large-50"),qr.forEach(o),qs=r(ki," (Tradu\xE7\xE3o multilingu\xEDstica, 50 idiomas)"),ki.forEach(o),Os=c(j),io=t(j,"LI",{});var Or=s(io);ro=t(Or,"CODE",{});var Dr=s(ro);Ds=r(Dr,"facebook/mbart-large-cc25"),Dr.forEach(o),Or.forEach(o),j.forEach(o),tl=c(e),ae=t(e,"P",{});var $l=s(ae);Fs=r($l,"Neste exemplo, carrega-se o checkpoint "),no=t($l,"CODE",{});var Fr=s(no);As=r(Fr,"facebook/mbart-large-50-many-to-many-mmt"),Fr.forEach(o),Ps=r($l,` para traduzir do finland\xEAs ao ingl\xEAs.
Pode-se definir o idioma de origem no tokenizador:`),$l.forEach(o),sl=c(e),f(we.$$.fragment,e),il=c(e),ra=t(e,"P",{});var Ar=s(ra);Qs=r(Ar,"Tokenizando o texto:"),Ar.forEach(o),rl=c(e),f($e.$$.fragment,e),nl=c(e),T=t(e,"P",{});var ie=s(T);Ys=r(ie,`O MBart for\xE7a o id do idioma de destino como o primeiro token gerado para traduzir ao idioma de destino.
\xC9 definido o `),mo=t(ie,"CODE",{});var Pr=s(mo);Ss=r(Pr,"forced_bos_token_id"),Pr.forEach(o),Hs=r(ie," como "),co=t(ie,"CODE",{});var Qr=s(co);Ks=r(Qr,"en"),Qr.forEach(o),ei=r(ie," no m\xE9todo "),po=t(ie,"CODE",{});var Yr=s(po);ai=r(Yr,"generate"),Yr.forEach(o),oi=r(ie," para traduzir ao ingl\xEAs."),ie.forEach(o),ml=c(e),f(je.$$.fragment,e),dl=c(e),oe=t(e,"P",{});var jl=s(oe);li=r(jl,"Se estiver usando o checkpoint "),uo=t(jl,"CODE",{});var Sr=s(uo);ti=r(Sr,"facebook/mbart-large-50-many-to-one-mmt"),Sr.forEach(o),si=r(jl,` n\xE3o ser\xE1 necess\xE1rio for\xE7ar o id do idioma de destino
como sendo o primeiro token generado, caso contr\xE1rio a usagem \xE9 a mesma.`),jl.forEach(o),this.h()},h(){p(Z,"name","hf:doc:metadata"),p(Z,"content",JSON.stringify(rn)),p(W,"id","modelos-multilingusticos-para-inferncia"),p(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"),p(W,"href","#modelos-multilingusticos-para-inferncia"),p(x,"class","relative group"),p(de,"href","https://huggingface.co/bert-base-multilingual-uncased"),p(de,"rel","nofollow"),p(V,"id","xlm"),p(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"),p(V,"href","#xlm"),p(X,"class","relative group"),p(L,"id","xlm-com-language-embeddings"),p(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"),p(L,"href","#xlm-com-language-embeddings"),p(I,"class","relative group"),p(Me,"href","https://github.com/huggingface/transformers/tree/master/examples/pytorch/text-generation/run_generation.py"),p(Me,"rel","nofollow"),p(D,"id","xlm-sem-language-embeddings"),p(D,"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"),p(D,"href","#xlm-sem-language-embeddings"),p(C,"class","relative group"),p(A,"id","bert"),p(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"),p(A,"href","#bert"),p(z,"class","relative group"),p(Q,"id","xlmroberta"),p(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"),p(Q,"href","#xlmroberta"),p(G,"class","relative group"),p(S,"id","m2m100"),p(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"),p(S,"href","#m2m100"),p(R,"class","relative group"),p(ee,"id","mbart"),p(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"),p(ee,"href","#mbart"),p(B,"class","relative group")},m(e,n){a(document.head,Z),m(e,fo,n),m(e,x,n),a(x,W),a(W,da),g(ne,da,null),a(x,Zl),a(x,ca),a(ca,xl),m(e,go,n),g(me,e,n),m(e,ho,n),m(e,w,n),a(w,Xl),a(w,pa),a(pa,Il),a(w,Cl),a(w,de),a(de,zl),a(w,Gl),m(e,bo,n),m(e,X,n),a(X,V),a(V,ua),g(ce,ua,null),a(X,Rl),a(X,fa),a(fa,Bl),m(e,Mo,n),m(e,Ze,n),a(Ze,Wl),m(e,vo,n),m(e,I,n),a(I,L),a(L,ga),g(pe,ga,null),a(I,Vl),a(I,ha),a(ha,Ll),m(e,Eo,n),m(e,xe,n),a(xe,Nl),m(e,yo,n),m(e,v,n),a(v,Xe),a(Xe,ba),a(ba,ql),a(Xe,Ol),a(v,Dl),a(v,Ie),a(Ie,Ma),a(Ma,Fl),a(Ie,Al),a(v,Pl),a(v,Ce),a(Ce,va),a(va,Ql),a(Ce,Yl),a(v,Sl),a(v,ze),a(ze,Ea),a(Ea,Hl),a(ze,Kl),a(v,et),a(v,Ge),a(Ge,ya),a(ya,at),a(Ge,ot),a(v,lt),a(v,Re),a(Re,_a),a(_a,tt),a(Re,st),a(v,it),a(v,Be),a(Be,Ja),a(Ja,rt),a(Be,nt),m(e,_o,n),m(e,_,n),a(_,mt),a(_,ka),a(ka,dt),a(_,ct),a(_,Ta),a(Ta,pt),a(_,ut),a(_,Ua),a(Ua,ft),a(_,gt),m(e,Jo,n),m(e,N,n),a(N,ht),a(N,wa),a(wa,bt),a(N,Mt),m(e,ko,n),g(ue,e,n),m(e,To,n),m(e,q,n),a(q,vt),a(q,$a),a($a,Et),a(q,yt),m(e,Uo,n),g(fe,e,n),m(e,wo,n),m(e,We,n),a(We,_t),m(e,$o,n),g(ge,e,n),m(e,jo,n),m(e,J,n),a(J,Jt),a(J,ja),a(ja,kt),a(J,Tt),a(J,Za),a(Za,Ut),a(J,wt),a(J,xa),a(xa,$t),a(J,jt),m(e,Zo,n),g(he,e,n),m(e,xo,n),m(e,O,n),a(O,Zt),a(O,Xa),a(Xa,xt),a(O,Xt),m(e,Xo,n),g(be,e,n),m(e,Io,n),m(e,$,n),a($,It),a($,Me),a(Me,Ct),a($,zt),a($,Ia),a(Ia,Gt),a($,Rt),m(e,Co,n),m(e,C,n),a(C,D),a(D,Ca),g(ve,Ca,null),a(C,Bt),a(C,za),a(za,Wt),m(e,zo,n),m(e,Ve,n),a(Ve,Vt),m(e,Go,n),m(e,F,n),a(F,Le),a(Le,Ga),a(Ga,Lt),a(Le,Nt),a(F,qt),a(F,Ne),a(Ne,Ra),a(Ra,Ot),a(Ne,Dt),m(e,Ro,n),m(e,qe,n),a(qe,Ft),m(e,Bo,n),m(e,z,n),a(z,A),a(A,Ba),g(Ee,Ba,null),a(z,At),a(z,Wa),a(Wa,Pt),m(e,Wo,n),m(e,Oe,n),a(Oe,Qt),m(e,Vo,n),m(e,P,n),a(P,De),a(De,Va),a(Va,Yt),a(De,St),a(P,Ht),a(P,Fe),a(Fe,La),a(La,Kt),a(Fe,es),m(e,Lo,n),m(e,Ae,n),a(Ae,as),m(e,No,n),m(e,G,n),a(G,Q),a(Q,Na),g(ye,Na,null),a(G,os),a(G,qa),a(qa,ls),m(e,qo,n),m(e,Pe,n),a(Pe,ts),m(e,Oo,n),m(e,Y,n),a(Y,Qe),a(Qe,Oa),a(Oa,ss),a(Qe,is),a(Y,rs),a(Y,Ye),a(Ye,Da),a(Da,ns),a(Ye,ms),m(e,Do,n),m(e,Se,n),a(Se,ds),m(e,Fo,n),m(e,R,n),a(R,S),a(S,Fa),g(_e,Fa,null),a(R,cs),a(R,Aa),a(Aa,ps),m(e,Ao,n),m(e,He,n),a(He,us),m(e,Po,n),m(e,H,n),a(H,Ke),a(Ke,Pa),a(Pa,fs),a(Ke,gs),a(H,hs),a(H,ea),a(ea,Qa),a(Qa,bs),a(ea,Ms),m(e,Qo,n),m(e,K,n),a(K,vs),a(K,Ya),a(Ya,Es),a(K,ys),m(e,Yo,n),g(Je,e,n),m(e,So,n),m(e,aa,n),a(aa,_s),m(e,Ho,n),g(ke,e,n),m(e,Ko,n),m(e,k,n),a(k,Js),a(k,Sa),a(Sa,ks),a(k,Ts),a(k,Ha),a(Ha,Us),a(k,ws),a(k,Ka),a(Ka,$s),a(k,js),m(e,el,n),g(Te,e,n),m(e,al,n),m(e,B,n),a(B,ee),a(ee,eo),g(Ue,eo,null),a(B,Zs),a(B,ao),a(ao,xs),m(e,ol,n),m(e,oa,n),a(oa,Xs),m(e,ll,n),m(e,E,n),a(E,la),a(la,oo),a(oo,Is),a(la,Cs),a(E,zs),a(E,ta),a(ta,lo),a(lo,Gs),a(ta,Rs),a(E,Bs),a(E,sa),a(sa,to),a(to,Ws),a(sa,Vs),a(E,Ls),a(E,ia),a(ia,so),a(so,Ns),a(ia,qs),a(E,Os),a(E,io),a(io,ro),a(ro,Ds),m(e,tl,n),m(e,ae,n),a(ae,Fs),a(ae,no),a(no,As),a(ae,Ps),m(e,sl,n),g(we,e,n),m(e,il,n),m(e,ra,n),a(ra,Qs),m(e,rl,n),g($e,e,n),m(e,nl,n),m(e,T,n),a(T,Ys),a(T,mo),a(mo,Ss),a(T,Hs),a(T,co),a(co,Ks),a(T,ei),a(T,po),a(po,ai),a(T,oi),m(e,ml,n),g(je,e,n),m(e,dl,n),m(e,oe,n),a(oe,li),a(oe,uo),a(uo,ti),a(oe,si),cl=!0},p:on,i(e){cl||(h(ne.$$.fragment,e),h(me.$$.fragment,e),h(ce.$$.fragment,e),h(pe.$$.fragment,e),h(ue.$$.fragment,e),h(fe.$$.fragment,e),h(ge.$$.fragment,e),h(he.$$.fragment,e),h(be.$$.fragment,e),h(ve.$$.fragment,e),h(Ee.$$.fragment,e),h(ye.$$.fragment,e),h(_e.$$.fragment,e),h(Je.$$.fragment,e),h(ke.$$.fragment,e),h(Te.$$.fragment,e),h(Ue.$$.fragment,e),h(we.$$.fragment,e),h($e.$$.fragment,e),h(je.$$.fragment,e),cl=!0)},o(e){b(ne.$$.fragment,e),b(me.$$.fragment,e),b(ce.$$.fragment,e),b(pe.$$.fragment,e),b(ue.$$.fragment,e),b(fe.$$.fragment,e),b(ge.$$.fragment,e),b(he.$$.fragment,e),b(be.$$.fragment,e),b(ve.$$.fragment,e),b(Ee.$$.fragment,e),b(ye.$$.fragment,e),b(_e.$$.fragment,e),b(Je.$$.fragment,e),b(ke.$$.fragment,e),b(Te.$$.fragment,e),b(Ue.$$.fragment,e),b(we.$$.fragment,e),b($e.$$.fragment,e),b(je.$$.fragment,e),cl=!1},d(e){o(Z),e&&o(fo),e&&o(x),M(ne),e&&o(go),M(me,e),e&&o(ho),e&&o(w),e&&o(bo),e&&o(X),M(ce),e&&o(Mo),e&&o(Ze),e&&o(vo),e&&o(I),M(pe),e&&o(Eo),e&&o(xe),e&&o(yo),e&&o(v),e&&o(_o),e&&o(_),e&&o(Jo),e&&o(N),e&&o(ko),M(ue,e),e&&o(To),e&&o(q),e&&o(Uo),M(fe,e),e&&o(wo),e&&o(We),e&&o($o),M(ge,e),e&&o(jo),e&&o(J),e&&o(Zo),M(he,e),e&&o(xo),e&&o(O),e&&o(Xo),M(be,e),e&&o(Io),e&&o($),e&&o(Co),e&&o(C),M(ve),e&&o(zo),e&&o(Ve),e&&o(Go),e&&o(F),e&&o(Ro),e&&o(qe),e&&o(Bo),e&&o(z),M(Ee),e&&o(Wo),e&&o(Oe),e&&o(Vo),e&&o(P),e&&o(Lo),e&&o(Ae),e&&o(No),e&&o(G),M(ye),e&&o(qo),e&&o(Pe),e&&o(Oo),e&&o(Y),e&&o(Do),e&&o(Se),e&&o(Fo),e&&o(R),M(_e),e&&o(Ao),e&&o(He),e&&o(Po),e&&o(H),e&&o(Qo),e&&o(K),e&&o(Yo),M(Je,e),e&&o(So),e&&o(aa),e&&o(Ho),M(ke,e),e&&o(Ko),e&&o(k),e&&o(el),M(Te,e),e&&o(al),e&&o(B),M(Ue),e&&o(ol),e&&o(oa),e&&o(ll),e&&o(E),e&&o(tl),e&&o(ae),e&&o(sl),M(we,e),e&&o(il),e&&o(ra),e&&o(rl),M($e,e),e&&o(nl),e&&o(T),e&&o(ml),M(je,e),e&&o(dl),e&&o(oe)}}}const rn={local:"modelos-multilingusticos-para-inferncia",sections:[{local:"xlm",sections:[{local:"xlm-com-language-embeddings",title:"XLM com language embeddings"},{local:"xlm-sem-language-embeddings",title:"XLM sem language embeddings"}],title:"XLM"},{local:"bert",title:"BERT"},{local:"xlmroberta",title:"XLM-RoBERTa"},{local:"m2m100",title:"M2M100"},{local:"mbart",title:"MBart"}],title:"Modelos multilingu\xEDsticos para infer\xEAncia"};function nn(Ti){return ln(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class un extends Hr{constructor(Z){super();Kr(this,Z,nn,sn,en,{})}}export{un as default,rn as metadata};
