import{S as Kn,i as er,s as lr,e as a,k as u,w as c,t as s,M as tr,c as o,d as t,m as d,a as i,x as g,h as n,b as p,G as l,g as m,y as f,L as ar,q as h,o as b,B as M,v as or}from"../chunks/vendor-hf-doc-builder.js";import{I as ne}from"../chunks/IconCopyLink-hf-doc-builder.js";import{C as T}from"../chunks/CodeBlock-hf-doc-builder.js";import{D as ir}from"../chunks/DocNotebookDropdown-hf-doc-builder.js";function sr(ks){let I,ct,j,W,ul,re,$a,dl,Ia,gt,me,ft,U,ja,pl,Za,Xa,ue,Ca,xa,ht,Z,L,cl,de,Ra,gl,Ga,bt,Ie,Ba,Mt,X,V,fl,pe,Wa,hl,La,vt,je,Va,yt,v,Ze,bl,Na,qa,Da,Xe,Ml,Fa,Qa,Aa,Ce,vl,Pa,Ya,Sa,xe,yl,Oa,Ha,Ka,Re,El,eo,lo,to,Ge,_l,ao,oo,io,Be,Jl,so,no,Et,_,ro,zl,mo,uo,kl,po,co,Tl,go,fo,_t,N,ho,Ul,bo,Mo,Jt,ce,zt,q,vo,wl,yo,Eo,kt,ge,Tt,We,_o,Ut,fe,wt,J,Jo,$l,zo,ko,Il,To,Uo,jl,wo,$o,$t,he,It,D,Io,Zl,jo,Zo,jt,be,Zt,w,Xo,Me,Co,xo,Xl,Ro,Go,Xt,C,F,Cl,ve,Bo,xl,Wo,Ct,Le,Lo,xt,Q,Ve,Rl,Vo,No,qo,Ne,Gl,Do,Fo,Rt,qe,Qo,Gt,x,A,Bl,ye,Ao,Wl,Po,Bt,De,Yo,Wt,P,Fe,Ll,So,Oo,Ho,Qe,Vl,Ko,ei,Lt,Ae,li,Vt,R,Y,Nl,Ee,ti,ql,ai,Nt,Pe,oi,qt,S,Ye,Dl,ii,si,ni,Se,Fl,ri,mi,Dt,Oe,ui,Ft,G,O,Ql,_e,di,Al,pi,Qt,He,ci,At,H,Ke,Pl,gi,fi,hi,el,Yl,bi,Mi,Pt,K,vi,Sl,yi,Ei,Yt,Je,St,ll,_i,Ot,ze,Ht,z,Ji,Ol,zi,ki,Hl,Ti,Ui,Kl,wi,$i,Kt,ke,ea,B,ee,et,Te,Ii,lt,ji,la,tl,Zi,ta,y,al,tt,Xi,Ci,xi,ol,at,Ri,Gi,Bi,il,ot,Wi,Li,Vi,sl,it,Ni,qi,Di,st,nt,Fi,aa,le,Qi,rt,Ai,Pi,oa,Ue,ia,nl,Yi,sa,we,na,k,Si,mt,Oi,Hi,ut,Ki,es,dt,ls,ts,ra,$e,ma,te,as,pt,os,is,ua;return re=new ne({}),me=new ir({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/it/multilingual.ipynb"},{label:"PyTorch",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/it/pytorch/multilingual.ipynb"},{label:"TensorFlow",value:"https://colab.research.google.com/github/huggingface/notebooks/blob/main/transformers_doc/it/tensorflow/multilingual.ipynb"},{label:"Mixed",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/it/multilingual.ipynb"},{label:"PyTorch",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/it/pytorch/multilingual.ipynb"},{label:"TensorFlow",value:"https://studiolab.sagemaker.aws/import/github/huggingface/notebooks/blob/main/transformers_doc/it/tensorflow/multilingual.ipynb"}]}}),de=new ne({}),pe=new ne({}),ce=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>)`}}),ge=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>}`}}),fe=new T({props:{code:"aW5wdXRfaWRzJTIwJTNEJTIwdG9yY2gudGVuc29yKCU1QnRva2VuaXplci5lbmNvZGUoJTIyV2lraXBlZGlhJTIwd2FzJTIwdXNlZCUyMHRvJTIyKSU1RCklMjAlMjAlMjMlMjBiYXRjaCUyMHNpemUlMjBvZiUyMDE=",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>input_ids = torch.tensor([tokenizer.encode(<span class="hljs-string">&quot;Wikipedia was used to&quot;</span>)])  <span class="hljs-comment"># batch size of 1</span>'}}),he=new T({props:{code:"bGFuZ3VhZ2VfaWQlMjAlM0QlMjB0b2tlbml6ZXIubGFuZzJpZCU1QiUyMmVuJTIyJTVEJTIwJTIwJTIzJTIwMCUwQWxhbmdzJTIwJTNEJTIwdG9yY2gudGVuc29yKCU1Qmxhbmd1YWdlX2lkJTVEJTIwKiUyMGlucHV0X2lkcy5zaGFwZSU1QjElNUQpJTIwJTIwJTIzJTIwdG9yY2gudGVuc29yKCU1QjAlMkMlMjAwJTJDJTIwMCUyQyUyMC4uLiUyQyUyMDAlNUQpJTBBJTBBJTIzJTIwV2UlMjByZXNoYXBlJTIwaXQlMjB0byUyMGJlJTIwb2YlMjBzaXplJTIwKGJhdGNoX3NpemUlMkMlMjBzZXF1ZW5jZV9sZW5ndGgpJTBBbGFuZ3MlMjAlM0QlMjBsYW5ncy52aWV3KDElMkMlMjAtMSklMjAlMjAlMjMlMjBpcyUyMG5vdyUyMG9mJTIwc2hhcGUlMjAlNUIxJTJDJTIwc2VxdWVuY2VfbGVuZ3RoJTVEJTIwKHdlJTIwaGF2ZSUyMGElMjBiYXRjaCUyMHNpemUlMjBvZiUyMDEp",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>language_id = tokenizer.lang2id[<span class="hljs-string">&quot;en&quot;</span>]  <span class="hljs-comment"># 0</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>langs = torch.tensor([language_id] * input_ids.shape[<span class="hljs-number">1</span>])  <span class="hljs-comment"># torch.tensor([0, 0, 0, ..., 0])</span>

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># We reshape it to be of size (batch_size, sequence_length)</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>langs = langs.view(<span class="hljs-number">1</span>, -<span class="hljs-number">1</span>)  <span class="hljs-comment"># is now of shape [1, sequence_length] (we have a batch size of 1)</span>`}}),be=new T({props:{code:"b3V0cHV0cyUyMCUzRCUyMG1vZGVsKGlucHV0X2lkcyUyQyUyMGxhbmdzJTNEbGFuZ3Mp",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(input_ids, langs=langs)'}}),ve=new ne({}),ye=new ne({}),Ee=new ne({}),_e=new ne({}),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>)`}}),ze=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>)'}}),ke=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 ne({}),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>)`}}),we=new T({props:{code:"ZW5jb2RlZF9lbiUyMCUzRCUyMHRva2VuaXplcihlbl90ZXh0JTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMik=",highlighted:'<span class="hljs-meta">&gt;&gt;&gt; </span>encoded_en = tokenizer(en_text, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)'}}),$e=new T({props:{code:"Z2VuZXJhdGVkX3Rva2VucyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKCoqZW5jb2RlZF9lbiUyQyUyMGZvcmNlZF9ib3NfdG9rZW5faWQlM0R0b2tlbml6ZXIubGFuZ19jb2RlX3RvX2lkKCUyMmVuX1hYJTIyKSklMEF0b2tlbml6ZXIuYmF0Y2hfZGVjb2RlKGdlbmVyYXRlZF90b2tlbnMlMkMlMjBza2lwX3NwZWNpYWxfdG9rZW5zJTNEVHJ1ZSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span>generated_tokens = model.generate(**encoded_en, forced_bos_token_id=tokenizer.lang_code_to_id(<span class="hljs-string">&quot;en_XX&quot;</span>))
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.batch_decode(generated_tokens, skip_special_tokens=<span class="hljs-literal">True</span>)
<span class="hljs-string">&quot;Don&#x27;t interfere with the wizard&#x27;s affairs, because they are subtle, will soon get angry.&quot;</span>`}}),{c(){I=a("meta"),ct=u(),j=a("h1"),W=a("a"),ul=a("span"),c(re.$$.fragment),$a=u(),dl=a("span"),Ia=s("Modelli multilingue per l'inferenza"),gt=u(),c(me.$$.fragment),ft=u(),U=a("p"),ja=s("Ci sono diversi modelli multilingue in \u{1F917} Transformers, e il loro utilizzo per l\u2019inferenza differisce da quello dei modelli monolingua. Non "),pl=a("em"),Za=s("tutti"),Xa=s(" gli utilizzi dei modelli multilingue sono per\xF2 diversi. Alcuni modelli, come "),ue=a("a"),Ca=s("bert-base-multilingual-uncased"),xa=s(", possono essere usati come un modello monolingua. Questa guida ti mostrer\xE0 come utilizzare modelli multilingue che utilizzano un modo diverso per fare l\u2019inferenza."),ht=u(),Z=a("h2"),L=a("a"),cl=a("span"),c(de.$$.fragment),Ra=u(),gl=a("span"),Ga=s("XLM"),bt=u(),Ie=a("p"),Ba=s("XLM ha dieci diversi checkpoint, di cui solo uno \xE8 monolingua. I nove checkpoint rimanenti possono essere suddivisi in due categorie: i checkpoint che utilizzano i language embeddings e quelli che non li utilizzano."),Mt=u(),X=a("h3"),V=a("a"),fl=a("span"),c(pe.$$.fragment),Wa=u(),hl=a("span"),La=s("XLM con language embeddings"),vt=u(),je=a("p"),Va=s("I seguenti modelli XLM utilizzano gli embeddings linguistici per specificare la lingua utilizzata per l\u2019inferenza:"),yt=u(),v=a("ul"),Ze=a("li"),bl=a("code"),Na=s("xlm-mlm-ende-1024"),qa=s(" (Modellazione mascherata del linguaggio (Masked language modeling, in inglese), Inglese-Tedesco)"),Da=u(),Xe=a("li"),Ml=a("code"),Fa=s("xlm-mlm-enfr-1024"),Qa=s(" (Modellazione mascherata del linguaggio, Inglese-Francese)"),Aa=u(),Ce=a("li"),vl=a("code"),Pa=s("xlm-mlm-enro-1024"),Ya=s(" (Modellazione mascherata del linguaggio, Inglese-Rumeno)"),Sa=u(),xe=a("li"),yl=a("code"),Oa=s("xlm-mlm-xnli15-1024"),Ha=s(" (Modellazione mascherata del linguaggio, lingue XNLI)"),Ka=u(),Re=a("li"),El=a("code"),eo=s("xlm-mlm-tlm-xnli15-1024"),lo=s(" (Modellazione mascherata del linguaggio + traduzione, lingue XNLI)"),to=u(),Ge=a("li"),_l=a("code"),ao=s("xlm-clm-enfr-1024"),oo=s(" (Modellazione causale del linguaggio, Inglese-Francese)"),io=u(),Be=a("li"),Jl=a("code"),so=s("xlm-clm-ende-1024"),no=s(" (Modellazione causale del linguaggio, Inglese-Tedesco)"),Et=u(),_=a("p"),ro=s("Gli embeddings linguistici sono rappresentati come un tensore delle stesse dimensioni dell\u2019 "),zl=a("code"),mo=s("input_ids"),uo=s(" passato al modello. I valori in questi tensori dipendono dal linguaggio usato e sono identificati dagli attributi "),kl=a("code"),po=s("lang2id"),co=s(" e "),Tl=a("code"),go=s("id2lang"),fo=s(" del tokenizer."),_t=u(),N=a("p"),ho=s("In questo esempio, carica il checkpoint "),Ul=a("code"),bo=s("xlm-clm-enfr-1024"),Mo=s(" (Modellazione causale del linguaggio, Inglese-Francese):"),Jt=u(),c(ce.$$.fragment),zt=u(),q=a("p"),vo=s("L\u2019attributo "),wl=a("code"),yo=s("lang2id"),Eo=s(" del tokenizer mostra il linguaggio del modello e il suo ids:"),kt=u(),c(ge.$$.fragment),Tt=u(),We=a("p"),_o=s("Poi, crea un esempio di input:"),Ut=u(),c(fe.$$.fragment),wt=u(),J=a("p"),Jo=s("Imposta l\u2019id del linguaggio a "),$l=a("code"),zo=s('"en"'),ko=s(" e usalo per definire il language embedding. Il language embedding \xE8 un tensore riempito con "),Il=a("code"),To=s("0"),Uo=s(" perch\xE9 questo \xE8 il language id per l\u2019inglese. Questo tensore dovrebbe avere la stessa dimensione di "),jl=a("code"),wo=s("input_ids"),$o=s("."),$t=u(),c(he.$$.fragment),It=u(),D=a("p"),Io=s("Adesso puoi inserire "),Zl=a("code"),jo=s("input_ids"),Zo=s(" e language embedding nel modello:"),jt=u(),c(be.$$.fragment),Zt=u(),w=a("p"),Xo=s("Lo script "),Me=a("a"),Co=s("run_generation.py"),xo=s(" pu\xF2 generare testo tramite i language embeddings usando i checkpoints "),Xl=a("code"),Ro=s("xlm-clm"),Go=s("."),Xt=u(),C=a("h3"),F=a("a"),Cl=a("span"),c(ve.$$.fragment),Bo=u(),xl=a("span"),Wo=s("XLM senza language embeddings"),Ct=u(),Le=a("p"),Lo=s("I seguenti modelli XLM non richiedono l\u2019utilizzo dei language embeddings per fare inferenza:"),xt=u(),Q=a("ul"),Ve=a("li"),Rl=a("code"),Vo=s("xlm-mlm-17-1280"),No=s(" (Modellazione mascherata del linguaggio, 17 lingue)"),qo=u(),Ne=a("li"),Gl=a("code"),Do=s("xlm-mlm-100-1280"),Fo=s(" (Modellazione mascherata del linguaggio, 100 lingue)"),Rt=u(),qe=a("p"),Qo=s("Questi modelli sono utilizzati per rappresentazioni generiche di frasi, a differenza dei precedenti checkpoints XML."),Gt=u(),x=a("h2"),A=a("a"),Bl=a("span"),c(ye.$$.fragment),Ao=u(),Wl=a("span"),Po=s("BERT"),Bt=u(),De=a("p"),Yo=s("Il seguente modello BERT pu\xF2 essere usato per compiti multilingue:"),Wt=u(),P=a("ul"),Fe=a("li"),Ll=a("code"),So=s("bert-base-multilingual-uncased"),Oo=s(" (Modellazione mascherata del linguaggio + Previsione della prossima frase, 102 lingue)"),Ho=u(),Qe=a("li"),Vl=a("code"),Ko=s("bert-base-multilingual-cased"),ei=s(" (Modellazione mascherata del linguaggio + Previsione della prossima frase, 104 lingue)"),Lt=u(),Ae=a("p"),li=s("Questi modelli non richiedono language embeddings per fare inferenza. Riescono ad identificare il linguaggio dal contesto e inferire di conseguenza."),Vt=u(),R=a("h2"),Y=a("a"),Nl=a("span"),c(Ee.$$.fragment),ti=u(),ql=a("span"),ai=s("XLM-RoBERTa"),Nt=u(),Pe=a("p"),oi=s("Il seguente modello XLM-RoBERTa pu\xF2 essere usato per compiti multilingue:"),qt=u(),S=a("ul"),Ye=a("li"),Dl=a("code"),ii=s("xlm-roberta-base"),si=s(" (Modellazione mascherata del linguaggio, 100 lingue)"),ni=u(),Se=a("li"),Fl=a("code"),ri=s("xlm-roberta-large"),mi=s(" (Modellazione mascherata del linguaggio, 100 lingue)"),Dt=u(),Oe=a("p"),ui=s("XLM-RoBERTa \xE8 stato addestrato su 2.5TB di dati CommonCrawl appena creati e puliti in 100 lingue. Offre notevoli vantaggi rispetto ai modelli multilingue rilasciati in precedenza, come mBERT o XLM, in compiti come la classificazione, l\u2019etichettatura delle sequenze e la risposta alle domande."),Ft=u(),G=a("h2"),O=a("a"),Ql=a("span"),c(_e.$$.fragment),di=u(),Al=a("span"),pi=s("M2M100"),Qt=u(),He=a("p"),ci=s("Il seguente modello M2M100 pu\xF2 essere usato per compiti multilingue:"),At=u(),H=a("ul"),Ke=a("li"),Pl=a("code"),gi=s("facebook/m2m100_418M"),fi=s(" (Traduzione)"),hi=u(),el=a("li"),Yl=a("code"),bi=s("facebook/m2m100_1.2B"),Mi=s(" (Traduzione)"),Pt=u(),K=a("p"),vi=s("In questo esempio, carica il checkpoint "),Sl=a("code"),yi=s("facebook/m2m100_418M"),Ei=s("  per tradurre dal cinese all\u2019inglese. Puoi impostare la lingua di partenza nel tokenizer:"),Yt=u(),c(Je.$$.fragment),St=u(),ll=a("p"),_i=s("Applica il tokenizer al testo:"),Ot=u(),c(ze.$$.fragment),Ht=u(),z=a("p"),Ji=s("M2M100 forza l\u2019id della lingua obiettivo come primo token generato per tradurre nella lingua obiettivo. Imposta il parametro "),Ol=a("code"),zi=s("forced_bos_token_id"),ki=s(" a "),Hl=a("code"),Ti=s("en"),Ui=s(" nel metodo "),Kl=a("code"),wi=s("generate"),$i=s(" per tradurre in inglese:"),Kt=u(),c(ke.$$.fragment),ea=u(),B=a("h2"),ee=a("a"),et=a("span"),c(Te.$$.fragment),Ii=u(),lt=a("span"),ji=s("MBart"),la=u(),tl=a("p"),Zi=s("Il seguente modello MBart pu\xF2 essere usato per compiti multilingue:"),ta=u(),y=a("ul"),al=a("li"),tt=a("code"),Xi=s("facebook/mbart-large-50-one-to-many-mmt"),Ci=s(" (Traduzione automatica multilingue uno-a-molti, 50 lingue)"),xi=u(),ol=a("li"),at=a("code"),Ri=s("facebook/mbart-large-50-many-to-many-mmt"),Gi=s(" (Traduzione automatica multilingue molti-a-molti, 50 lingue)"),Bi=u(),il=a("li"),ot=a("code"),Wi=s("facebook/mbart-large-50-many-to-one-mmt"),Li=s(" (Traduzione automatica multilingue molti-a-uno, 50 lingue)"),Vi=u(),sl=a("li"),it=a("code"),Ni=s("facebook/mbart-large-50"),qi=s(" (Traduzione multilingue, 50 lingue)"),Di=u(),st=a("li"),nt=a("code"),Fi=s("facebook/mbart-large-cc25"),aa=u(),le=a("p"),Qi=s("In questo esempio, carica il checkpoint "),rt=a("code"),Ai=s("facebook/mbart-large-50-many-to-many-mmt"),Pi=s(" per tradurre dal finlandese all\u2019inglese. Puoi impostare la lingua di partenza nel tokenizer:"),oa=u(),c(Ue.$$.fragment),ia=u(),nl=a("p"),Yi=s("Applica il tokenizer sul testo:"),sa=u(),c(we.$$.fragment),na=u(),k=a("p"),Si=s("MBart forza l\u2019id della lingua obiettivo come primo token generato per tradurre nella lingua obiettivo. Imposta il parametro "),mt=a("code"),Oi=s("forced_bos_token_id"),Hi=s(" a "),ut=a("code"),Ki=s("en"),es=s(" nel metodo "),dt=a("code"),ls=s("generate"),ts=s(" per tradurre in inglese:"),ra=u(),c($e.$$.fragment),ma=u(),te=a("p"),as=s("Se stai usando il checkpoint "),pt=a("code"),os=s("facebook/mbart-large-50-many-to-one-mmt"),is=s(", non hai bisogno di forzare l\u2019id della lingua obiettivo come primo token generato altrimenti l\u2019uso \xE8 lo stesso."),this.h()},l(e){const r=tr('[data-svelte="svelte-1phssyn"]',document.head);I=o(r,"META",{name:!0,content:!0}),r.forEach(t),ct=d(e),j=o(e,"H1",{class:!0});var da=i(j);W=o(da,"A",{id:!0,class:!0,href:!0});var Ts=i(W);ul=o(Ts,"SPAN",{});var Us=i(ul);g(re.$$.fragment,Us),Us.forEach(t),Ts.forEach(t),$a=d(da),dl=o(da,"SPAN",{});var ws=i(dl);Ia=n(ws,"Modelli multilingue per l'inferenza"),ws.forEach(t),da.forEach(t),gt=d(e),g(me.$$.fragment,e),ft=d(e),U=o(e,"P",{});var rl=i(U);ja=n(rl,"Ci sono diversi modelli multilingue in \u{1F917} Transformers, e il loro utilizzo per l\u2019inferenza differisce da quello dei modelli monolingua. Non "),pl=o(rl,"EM",{});var $s=i(pl);Za=n($s,"tutti"),$s.forEach(t),Xa=n(rl," gli utilizzi dei modelli multilingue sono per\xF2 diversi. Alcuni modelli, come "),ue=o(rl,"A",{href:!0,rel:!0});var Is=i(ue);Ca=n(Is,"bert-base-multilingual-uncased"),Is.forEach(t),xa=n(rl,", possono essere usati come un modello monolingua. Questa guida ti mostrer\xE0 come utilizzare modelli multilingue che utilizzano un modo diverso per fare l\u2019inferenza."),rl.forEach(t),ht=d(e),Z=o(e,"H2",{class:!0});var pa=i(Z);L=o(pa,"A",{id:!0,class:!0,href:!0});var js=i(L);cl=o(js,"SPAN",{});var Zs=i(cl);g(de.$$.fragment,Zs),Zs.forEach(t),js.forEach(t),Ra=d(pa),gl=o(pa,"SPAN",{});var Xs=i(gl);Ga=n(Xs,"XLM"),Xs.forEach(t),pa.forEach(t),bt=d(e),Ie=o(e,"P",{});var Cs=i(Ie);Ba=n(Cs,"XLM ha dieci diversi checkpoint, di cui solo uno \xE8 monolingua. I nove checkpoint rimanenti possono essere suddivisi in due categorie: i checkpoint che utilizzano i language embeddings e quelli che non li utilizzano."),Cs.forEach(t),Mt=d(e),X=o(e,"H3",{class:!0});var ca=i(X);V=o(ca,"A",{id:!0,class:!0,href:!0});var xs=i(V);fl=o(xs,"SPAN",{});var Rs=i(fl);g(pe.$$.fragment,Rs),Rs.forEach(t),xs.forEach(t),Wa=d(ca),hl=o(ca,"SPAN",{});var Gs=i(hl);La=n(Gs,"XLM con language embeddings"),Gs.forEach(t),ca.forEach(t),vt=d(e),je=o(e,"P",{});var Bs=i(je);Va=n(Bs,"I seguenti modelli XLM utilizzano gli embeddings linguistici per specificare la lingua utilizzata per l\u2019inferenza:"),Bs.forEach(t),yt=d(e),v=o(e,"UL",{});var E=i(v);Ze=o(E,"LI",{});var ss=i(Ze);bl=o(ss,"CODE",{});var Ws=i(bl);Na=n(Ws,"xlm-mlm-ende-1024"),Ws.forEach(t),qa=n(ss," (Modellazione mascherata del linguaggio (Masked language modeling, in inglese), Inglese-Tedesco)"),ss.forEach(t),Da=d(E),Xe=o(E,"LI",{});var ns=i(Xe);Ml=o(ns,"CODE",{});var Ls=i(Ml);Fa=n(Ls,"xlm-mlm-enfr-1024"),Ls.forEach(t),Qa=n(ns," (Modellazione mascherata del linguaggio, Inglese-Francese)"),ns.forEach(t),Aa=d(E),Ce=o(E,"LI",{});var rs=i(Ce);vl=o(rs,"CODE",{});var Vs=i(vl);Pa=n(Vs,"xlm-mlm-enro-1024"),Vs.forEach(t),Ya=n(rs," (Modellazione mascherata del linguaggio, Inglese-Rumeno)"),rs.forEach(t),Sa=d(E),xe=o(E,"LI",{});var ms=i(xe);yl=o(ms,"CODE",{});var Ns=i(yl);Oa=n(Ns,"xlm-mlm-xnli15-1024"),Ns.forEach(t),Ha=n(ms," (Modellazione mascherata del linguaggio, lingue XNLI)"),ms.forEach(t),Ka=d(E),Re=o(E,"LI",{});var us=i(Re);El=o(us,"CODE",{});var qs=i(El);eo=n(qs,"xlm-mlm-tlm-xnli15-1024"),qs.forEach(t),lo=n(us," (Modellazione mascherata del linguaggio + traduzione, lingue XNLI)"),us.forEach(t),to=d(E),Ge=o(E,"LI",{});var ds=i(Ge);_l=o(ds,"CODE",{});var Ds=i(_l);ao=n(Ds,"xlm-clm-enfr-1024"),Ds.forEach(t),oo=n(ds," (Modellazione causale del linguaggio, Inglese-Francese)"),ds.forEach(t),io=d(E),Be=o(E,"LI",{});var ps=i(Be);Jl=o(ps,"CODE",{});var Fs=i(Jl);so=n(Fs,"xlm-clm-ende-1024"),Fs.forEach(t),no=n(ps," (Modellazione causale del linguaggio, Inglese-Tedesco)"),ps.forEach(t),E.forEach(t),Et=d(e),_=o(e,"P",{});var ae=i(_);ro=n(ae,"Gli embeddings linguistici sono rappresentati come un tensore delle stesse dimensioni dell\u2019 "),zl=o(ae,"CODE",{});var Qs=i(zl);mo=n(Qs,"input_ids"),Qs.forEach(t),uo=n(ae," passato al modello. I valori in questi tensori dipendono dal linguaggio usato e sono identificati dagli attributi "),kl=o(ae,"CODE",{});var As=i(kl);po=n(As,"lang2id"),As.forEach(t),co=n(ae," e "),Tl=o(ae,"CODE",{});var Ps=i(Tl);go=n(Ps,"id2lang"),Ps.forEach(t),fo=n(ae," del tokenizer."),ae.forEach(t),_t=d(e),N=o(e,"P",{});var ga=i(N);ho=n(ga,"In questo esempio, carica il checkpoint "),Ul=o(ga,"CODE",{});var Ys=i(Ul);bo=n(Ys,"xlm-clm-enfr-1024"),Ys.forEach(t),Mo=n(ga," (Modellazione causale del linguaggio, Inglese-Francese):"),ga.forEach(t),Jt=d(e),g(ce.$$.fragment,e),zt=d(e),q=o(e,"P",{});var fa=i(q);vo=n(fa,"L\u2019attributo "),wl=o(fa,"CODE",{});var Ss=i(wl);yo=n(Ss,"lang2id"),Ss.forEach(t),Eo=n(fa," del tokenizer mostra il linguaggio del modello e il suo ids:"),fa.forEach(t),kt=d(e),g(ge.$$.fragment,e),Tt=d(e),We=o(e,"P",{});var Os=i(We);_o=n(Os,"Poi, crea un esempio di input:"),Os.forEach(t),Ut=d(e),g(fe.$$.fragment,e),wt=d(e),J=o(e,"P",{});var oe=i(J);Jo=n(oe,"Imposta l\u2019id del linguaggio a "),$l=o(oe,"CODE",{});var Hs=i($l);zo=n(Hs,'"en"'),Hs.forEach(t),ko=n(oe," e usalo per definire il language embedding. Il language embedding \xE8 un tensore riempito con "),Il=o(oe,"CODE",{});var Ks=i(Il);To=n(Ks,"0"),Ks.forEach(t),Uo=n(oe," perch\xE9 questo \xE8 il language id per l\u2019inglese. Questo tensore dovrebbe avere la stessa dimensione di "),jl=o(oe,"CODE",{});var en=i(jl);wo=n(en,"input_ids"),en.forEach(t),$o=n(oe,"."),oe.forEach(t),$t=d(e),g(he.$$.fragment,e),It=d(e),D=o(e,"P",{});var ha=i(D);Io=n(ha,"Adesso puoi inserire "),Zl=o(ha,"CODE",{});var ln=i(Zl);jo=n(ln,"input_ids"),ln.forEach(t),Zo=n(ha," e language embedding nel modello:"),ha.forEach(t),jt=d(e),g(be.$$.fragment,e),Zt=d(e),w=o(e,"P",{});var ml=i(w);Xo=n(ml,"Lo script "),Me=o(ml,"A",{href:!0,rel:!0});var tn=i(Me);Co=n(tn,"run_generation.py"),tn.forEach(t),xo=n(ml," pu\xF2 generare testo tramite i language embeddings usando i checkpoints "),Xl=o(ml,"CODE",{});var an=i(Xl);Ro=n(an,"xlm-clm"),an.forEach(t),Go=n(ml,"."),ml.forEach(t),Xt=d(e),C=o(e,"H3",{class:!0});var ba=i(C);F=o(ba,"A",{id:!0,class:!0,href:!0});var on=i(F);Cl=o(on,"SPAN",{});var sn=i(Cl);g(ve.$$.fragment,sn),sn.forEach(t),on.forEach(t),Bo=d(ba),xl=o(ba,"SPAN",{});var nn=i(xl);Wo=n(nn,"XLM senza language embeddings"),nn.forEach(t),ba.forEach(t),Ct=d(e),Le=o(e,"P",{});var rn=i(Le);Lo=n(rn,"I seguenti modelli XLM non richiedono l\u2019utilizzo dei language embeddings per fare inferenza:"),rn.forEach(t),xt=d(e),Q=o(e,"UL",{});var Ma=i(Q);Ve=o(Ma,"LI",{});var cs=i(Ve);Rl=o(cs,"CODE",{});var mn=i(Rl);Vo=n(mn,"xlm-mlm-17-1280"),mn.forEach(t),No=n(cs," (Modellazione mascherata del linguaggio, 17 lingue)"),cs.forEach(t),qo=d(Ma),Ne=o(Ma,"LI",{});var gs=i(Ne);Gl=o(gs,"CODE",{});var un=i(Gl);Do=n(un,"xlm-mlm-100-1280"),un.forEach(t),Fo=n(gs," (Modellazione mascherata del linguaggio, 100 lingue)"),gs.forEach(t),Ma.forEach(t),Rt=d(e),qe=o(e,"P",{});var dn=i(qe);Qo=n(dn,"Questi modelli sono utilizzati per rappresentazioni generiche di frasi, a differenza dei precedenti checkpoints XML."),dn.forEach(t),Gt=d(e),x=o(e,"H2",{class:!0});var va=i(x);A=o(va,"A",{id:!0,class:!0,href:!0});var pn=i(A);Bl=o(pn,"SPAN",{});var cn=i(Bl);g(ye.$$.fragment,cn),cn.forEach(t),pn.forEach(t),Ao=d(va),Wl=o(va,"SPAN",{});var gn=i(Wl);Po=n(gn,"BERT"),gn.forEach(t),va.forEach(t),Bt=d(e),De=o(e,"P",{});var fn=i(De);Yo=n(fn,"Il seguente modello BERT pu\xF2 essere usato per compiti multilingue:"),fn.forEach(t),Wt=d(e),P=o(e,"UL",{});var ya=i(P);Fe=o(ya,"LI",{});var fs=i(Fe);Ll=o(fs,"CODE",{});var hn=i(Ll);So=n(hn,"bert-base-multilingual-uncased"),hn.forEach(t),Oo=n(fs," (Modellazione mascherata del linguaggio + Previsione della prossima frase, 102 lingue)"),fs.forEach(t),Ho=d(ya),Qe=o(ya,"LI",{});var hs=i(Qe);Vl=o(hs,"CODE",{});var bn=i(Vl);Ko=n(bn,"bert-base-multilingual-cased"),bn.forEach(t),ei=n(hs," (Modellazione mascherata del linguaggio + Previsione della prossima frase, 104 lingue)"),hs.forEach(t),ya.forEach(t),Lt=d(e),Ae=o(e,"P",{});var Mn=i(Ae);li=n(Mn,"Questi modelli non richiedono language embeddings per fare inferenza. Riescono ad identificare il linguaggio dal contesto e inferire di conseguenza."),Mn.forEach(t),Vt=d(e),R=o(e,"H2",{class:!0});var Ea=i(R);Y=o(Ea,"A",{id:!0,class:!0,href:!0});var vn=i(Y);Nl=o(vn,"SPAN",{});var yn=i(Nl);g(Ee.$$.fragment,yn),yn.forEach(t),vn.forEach(t),ti=d(Ea),ql=o(Ea,"SPAN",{});var En=i(ql);ai=n(En,"XLM-RoBERTa"),En.forEach(t),Ea.forEach(t),Nt=d(e),Pe=o(e,"P",{});var _n=i(Pe);oi=n(_n,"Il seguente modello XLM-RoBERTa pu\xF2 essere usato per compiti multilingue:"),_n.forEach(t),qt=d(e),S=o(e,"UL",{});var _a=i(S);Ye=o(_a,"LI",{});var bs=i(Ye);Dl=o(bs,"CODE",{});var Jn=i(Dl);ii=n(Jn,"xlm-roberta-base"),Jn.forEach(t),si=n(bs," (Modellazione mascherata del linguaggio, 100 lingue)"),bs.forEach(t),ni=d(_a),Se=o(_a,"LI",{});var Ms=i(Se);Fl=o(Ms,"CODE",{});var zn=i(Fl);ri=n(zn,"xlm-roberta-large"),zn.forEach(t),mi=n(Ms," (Modellazione mascherata del linguaggio, 100 lingue)"),Ms.forEach(t),_a.forEach(t),Dt=d(e),Oe=o(e,"P",{});var kn=i(Oe);ui=n(kn,"XLM-RoBERTa \xE8 stato addestrato su 2.5TB di dati CommonCrawl appena creati e puliti in 100 lingue. Offre notevoli vantaggi rispetto ai modelli multilingue rilasciati in precedenza, come mBERT o XLM, in compiti come la classificazione, l\u2019etichettatura delle sequenze e la risposta alle domande."),kn.forEach(t),Ft=d(e),G=o(e,"H2",{class:!0});var Ja=i(G);O=o(Ja,"A",{id:!0,class:!0,href:!0});var Tn=i(O);Ql=o(Tn,"SPAN",{});var Un=i(Ql);g(_e.$$.fragment,Un),Un.forEach(t),Tn.forEach(t),di=d(Ja),Al=o(Ja,"SPAN",{});var wn=i(Al);pi=n(wn,"M2M100"),wn.forEach(t),Ja.forEach(t),Qt=d(e),He=o(e,"P",{});var $n=i(He);ci=n($n,"Il seguente modello M2M100 pu\xF2 essere usato per compiti multilingue:"),$n.forEach(t),At=d(e),H=o(e,"UL",{});var za=i(H);Ke=o(za,"LI",{});var vs=i(Ke);Pl=o(vs,"CODE",{});var In=i(Pl);gi=n(In,"facebook/m2m100_418M"),In.forEach(t),fi=n(vs," (Traduzione)"),vs.forEach(t),hi=d(za),el=o(za,"LI",{});var ys=i(el);Yl=o(ys,"CODE",{});var jn=i(Yl);bi=n(jn,"facebook/m2m100_1.2B"),jn.forEach(t),Mi=n(ys," (Traduzione)"),ys.forEach(t),za.forEach(t),Pt=d(e),K=o(e,"P",{});var ka=i(K);vi=n(ka,"In questo esempio, carica il checkpoint "),Sl=o(ka,"CODE",{});var Zn=i(Sl);yi=n(Zn,"facebook/m2m100_418M"),Zn.forEach(t),Ei=n(ka,"  per tradurre dal cinese all\u2019inglese. Puoi impostare la lingua di partenza nel tokenizer:"),ka.forEach(t),Yt=d(e),g(Je.$$.fragment,e),St=d(e),ll=o(e,"P",{});var Xn=i(ll);_i=n(Xn,"Applica il tokenizer al testo:"),Xn.forEach(t),Ot=d(e),g(ze.$$.fragment,e),Ht=d(e),z=o(e,"P",{});var ie=i(z);Ji=n(ie,"M2M100 forza l\u2019id della lingua obiettivo come primo token generato per tradurre nella lingua obiettivo. Imposta il parametro "),Ol=o(ie,"CODE",{});var Cn=i(Ol);zi=n(Cn,"forced_bos_token_id"),Cn.forEach(t),ki=n(ie," a "),Hl=o(ie,"CODE",{});var xn=i(Hl);Ti=n(xn,"en"),xn.forEach(t),Ui=n(ie," nel metodo "),Kl=o(ie,"CODE",{});var Rn=i(Kl);wi=n(Rn,"generate"),Rn.forEach(t),$i=n(ie," per tradurre in inglese:"),ie.forEach(t),Kt=d(e),g(ke.$$.fragment,e),ea=d(e),B=o(e,"H2",{class:!0});var Ta=i(B);ee=o(Ta,"A",{id:!0,class:!0,href:!0});var Gn=i(ee);et=o(Gn,"SPAN",{});var Bn=i(et);g(Te.$$.fragment,Bn),Bn.forEach(t),Gn.forEach(t),Ii=d(Ta),lt=o(Ta,"SPAN",{});var Wn=i(lt);ji=n(Wn,"MBart"),Wn.forEach(t),Ta.forEach(t),la=d(e),tl=o(e,"P",{});var Ln=i(tl);Zi=n(Ln,"Il seguente modello MBart pu\xF2 essere usato per compiti multilingue:"),Ln.forEach(t),ta=d(e),y=o(e,"UL",{});var $=i(y);al=o($,"LI",{});var Es=i(al);tt=o(Es,"CODE",{});var Vn=i(tt);Xi=n(Vn,"facebook/mbart-large-50-one-to-many-mmt"),Vn.forEach(t),Ci=n(Es," (Traduzione automatica multilingue uno-a-molti, 50 lingue)"),Es.forEach(t),xi=d($),ol=o($,"LI",{});var _s=i(ol);at=o(_s,"CODE",{});var Nn=i(at);Ri=n(Nn,"facebook/mbart-large-50-many-to-many-mmt"),Nn.forEach(t),Gi=n(_s," (Traduzione automatica multilingue molti-a-molti, 50 lingue)"),_s.forEach(t),Bi=d($),il=o($,"LI",{});var Js=i(il);ot=o(Js,"CODE",{});var qn=i(ot);Wi=n(qn,"facebook/mbart-large-50-many-to-one-mmt"),qn.forEach(t),Li=n(Js," (Traduzione automatica multilingue molti-a-uno, 50 lingue)"),Js.forEach(t),Vi=d($),sl=o($,"LI",{});var zs=i(sl);it=o(zs,"CODE",{});var Dn=i(it);Ni=n(Dn,"facebook/mbart-large-50"),Dn.forEach(t),qi=n(zs," (Traduzione multilingue, 50 lingue)"),zs.forEach(t),Di=d($),st=o($,"LI",{});var Fn=i(st);nt=o(Fn,"CODE",{});var Qn=i(nt);Fi=n(Qn,"facebook/mbart-large-cc25"),Qn.forEach(t),Fn.forEach(t),$.forEach(t),aa=d(e),le=o(e,"P",{});var Ua=i(le);Qi=n(Ua,"In questo esempio, carica il checkpoint "),rt=o(Ua,"CODE",{});var An=i(rt);Ai=n(An,"facebook/mbart-large-50-many-to-many-mmt"),An.forEach(t),Pi=n(Ua," per tradurre dal finlandese all\u2019inglese. Puoi impostare la lingua di partenza nel tokenizer:"),Ua.forEach(t),oa=d(e),g(Ue.$$.fragment,e),ia=d(e),nl=o(e,"P",{});var Pn=i(nl);Yi=n(Pn,"Applica il tokenizer sul testo:"),Pn.forEach(t),sa=d(e),g(we.$$.fragment,e),na=d(e),k=o(e,"P",{});var se=i(k);Si=n(se,"MBart forza l\u2019id della lingua obiettivo come primo token generato per tradurre nella lingua obiettivo. Imposta il parametro "),mt=o(se,"CODE",{});var Yn=i(mt);Oi=n(Yn,"forced_bos_token_id"),Yn.forEach(t),Hi=n(se," a "),ut=o(se,"CODE",{});var Sn=i(ut);Ki=n(Sn,"en"),Sn.forEach(t),es=n(se," nel metodo "),dt=o(se,"CODE",{});var On=i(dt);ls=n(On,"generate"),On.forEach(t),ts=n(se," per tradurre in inglese:"),se.forEach(t),ra=d(e),g($e.$$.fragment,e),ma=d(e),te=o(e,"P",{});var wa=i(te);as=n(wa,"Se stai usando il checkpoint "),pt=o(wa,"CODE",{});var Hn=i(pt);os=n(Hn,"facebook/mbart-large-50-many-to-one-mmt"),Hn.forEach(t),is=n(wa,", non hai bisogno di forzare l\u2019id della lingua obiettivo come primo token generato altrimenti l\u2019uso \xE8 lo stesso."),wa.forEach(t),this.h()},h(){p(I,"name","hf:doc:metadata"),p(I,"content",JSON.stringify(nr)),p(W,"id","modelli-multilingue-per-linferenza"),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","#modelli-multilingue-per-linferenza"),p(j,"class","relative group"),p(ue,"href","https://huggingface.co/bert-base-multilingual-uncased"),p(ue,"rel","nofollow"),p(L,"id","xlm"),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"),p(Z,"class","relative group"),p(V,"id","xlm-con-language-embeddings"),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-con-language-embeddings"),p(X,"class","relative group"),p(Me,"href","https://github.com/huggingface/transformers/tree/main/examples/pytorch/text-generation/run_generation.py"),p(Me,"rel","nofollow"),p(F,"id","xlm-senza-language-embeddings"),p(F,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),p(F,"href","#xlm-senza-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(x,"class","relative group"),p(Y,"id","xlmroberta"),p(Y,"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(Y,"href","#xlmroberta"),p(R,"class","relative group"),p(O,"id","m2m100"),p(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"),p(O,"href","#m2m100"),p(G,"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,r){l(document.head,I),m(e,ct,r),m(e,j,r),l(j,W),l(W,ul),f(re,ul,null),l(j,$a),l(j,dl),l(dl,Ia),m(e,gt,r),f(me,e,r),m(e,ft,r),m(e,U,r),l(U,ja),l(U,pl),l(pl,Za),l(U,Xa),l(U,ue),l(ue,Ca),l(U,xa),m(e,ht,r),m(e,Z,r),l(Z,L),l(L,cl),f(de,cl,null),l(Z,Ra),l(Z,gl),l(gl,Ga),m(e,bt,r),m(e,Ie,r),l(Ie,Ba),m(e,Mt,r),m(e,X,r),l(X,V),l(V,fl),f(pe,fl,null),l(X,Wa),l(X,hl),l(hl,La),m(e,vt,r),m(e,je,r),l(je,Va),m(e,yt,r),m(e,v,r),l(v,Ze),l(Ze,bl),l(bl,Na),l(Ze,qa),l(v,Da),l(v,Xe),l(Xe,Ml),l(Ml,Fa),l(Xe,Qa),l(v,Aa),l(v,Ce),l(Ce,vl),l(vl,Pa),l(Ce,Ya),l(v,Sa),l(v,xe),l(xe,yl),l(yl,Oa),l(xe,Ha),l(v,Ka),l(v,Re),l(Re,El),l(El,eo),l(Re,lo),l(v,to),l(v,Ge),l(Ge,_l),l(_l,ao),l(Ge,oo),l(v,io),l(v,Be),l(Be,Jl),l(Jl,so),l(Be,no),m(e,Et,r),m(e,_,r),l(_,ro),l(_,zl),l(zl,mo),l(_,uo),l(_,kl),l(kl,po),l(_,co),l(_,Tl),l(Tl,go),l(_,fo),m(e,_t,r),m(e,N,r),l(N,ho),l(N,Ul),l(Ul,bo),l(N,Mo),m(e,Jt,r),f(ce,e,r),m(e,zt,r),m(e,q,r),l(q,vo),l(q,wl),l(wl,yo),l(q,Eo),m(e,kt,r),f(ge,e,r),m(e,Tt,r),m(e,We,r),l(We,_o),m(e,Ut,r),f(fe,e,r),m(e,wt,r),m(e,J,r),l(J,Jo),l(J,$l),l($l,zo),l(J,ko),l(J,Il),l(Il,To),l(J,Uo),l(J,jl),l(jl,wo),l(J,$o),m(e,$t,r),f(he,e,r),m(e,It,r),m(e,D,r),l(D,Io),l(D,Zl),l(Zl,jo),l(D,Zo),m(e,jt,r),f(be,e,r),m(e,Zt,r),m(e,w,r),l(w,Xo),l(w,Me),l(Me,Co),l(w,xo),l(w,Xl),l(Xl,Ro),l(w,Go),m(e,Xt,r),m(e,C,r),l(C,F),l(F,Cl),f(ve,Cl,null),l(C,Bo),l(C,xl),l(xl,Wo),m(e,Ct,r),m(e,Le,r),l(Le,Lo),m(e,xt,r),m(e,Q,r),l(Q,Ve),l(Ve,Rl),l(Rl,Vo),l(Ve,No),l(Q,qo),l(Q,Ne),l(Ne,Gl),l(Gl,Do),l(Ne,Fo),m(e,Rt,r),m(e,qe,r),l(qe,Qo),m(e,Gt,r),m(e,x,r),l(x,A),l(A,Bl),f(ye,Bl,null),l(x,Ao),l(x,Wl),l(Wl,Po),m(e,Bt,r),m(e,De,r),l(De,Yo),m(e,Wt,r),m(e,P,r),l(P,Fe),l(Fe,Ll),l(Ll,So),l(Fe,Oo),l(P,Ho),l(P,Qe),l(Qe,Vl),l(Vl,Ko),l(Qe,ei),m(e,Lt,r),m(e,Ae,r),l(Ae,li),m(e,Vt,r),m(e,R,r),l(R,Y),l(Y,Nl),f(Ee,Nl,null),l(R,ti),l(R,ql),l(ql,ai),m(e,Nt,r),m(e,Pe,r),l(Pe,oi),m(e,qt,r),m(e,S,r),l(S,Ye),l(Ye,Dl),l(Dl,ii),l(Ye,si),l(S,ni),l(S,Se),l(Se,Fl),l(Fl,ri),l(Se,mi),m(e,Dt,r),m(e,Oe,r),l(Oe,ui),m(e,Ft,r),m(e,G,r),l(G,O),l(O,Ql),f(_e,Ql,null),l(G,di),l(G,Al),l(Al,pi),m(e,Qt,r),m(e,He,r),l(He,ci),m(e,At,r),m(e,H,r),l(H,Ke),l(Ke,Pl),l(Pl,gi),l(Ke,fi),l(H,hi),l(H,el),l(el,Yl),l(Yl,bi),l(el,Mi),m(e,Pt,r),m(e,K,r),l(K,vi),l(K,Sl),l(Sl,yi),l(K,Ei),m(e,Yt,r),f(Je,e,r),m(e,St,r),m(e,ll,r),l(ll,_i),m(e,Ot,r),f(ze,e,r),m(e,Ht,r),m(e,z,r),l(z,Ji),l(z,Ol),l(Ol,zi),l(z,ki),l(z,Hl),l(Hl,Ti),l(z,Ui),l(z,Kl),l(Kl,wi),l(z,$i),m(e,Kt,r),f(ke,e,r),m(e,ea,r),m(e,B,r),l(B,ee),l(ee,et),f(Te,et,null),l(B,Ii),l(B,lt),l(lt,ji),m(e,la,r),m(e,tl,r),l(tl,Zi),m(e,ta,r),m(e,y,r),l(y,al),l(al,tt),l(tt,Xi),l(al,Ci),l(y,xi),l(y,ol),l(ol,at),l(at,Ri),l(ol,Gi),l(y,Bi),l(y,il),l(il,ot),l(ot,Wi),l(il,Li),l(y,Vi),l(y,sl),l(sl,it),l(it,Ni),l(sl,qi),l(y,Di),l(y,st),l(st,nt),l(nt,Fi),m(e,aa,r),m(e,le,r),l(le,Qi),l(le,rt),l(rt,Ai),l(le,Pi),m(e,oa,r),f(Ue,e,r),m(e,ia,r),m(e,nl,r),l(nl,Yi),m(e,sa,r),f(we,e,r),m(e,na,r),m(e,k,r),l(k,Si),l(k,mt),l(mt,Oi),l(k,Hi),l(k,ut),l(ut,Ki),l(k,es),l(k,dt),l(dt,ls),l(k,ts),m(e,ra,r),f($e,e,r),m(e,ma,r),m(e,te,r),l(te,as),l(te,pt),l(pt,os),l(te,is),ua=!0},p:ar,i(e){ua||(h(re.$$.fragment,e),h(me.$$.fragment,e),h(de.$$.fragment,e),h(pe.$$.fragment,e),h(ce.$$.fragment,e),h(ge.$$.fragment,e),h(fe.$$.fragment,e),h(he.$$.fragment,e),h(be.$$.fragment,e),h(ve.$$.fragment,e),h(ye.$$.fragment,e),h(Ee.$$.fragment,e),h(_e.$$.fragment,e),h(Je.$$.fragment,e),h(ze.$$.fragment,e),h(ke.$$.fragment,e),h(Te.$$.fragment,e),h(Ue.$$.fragment,e),h(we.$$.fragment,e),h($e.$$.fragment,e),ua=!0)},o(e){b(re.$$.fragment,e),b(me.$$.fragment,e),b(de.$$.fragment,e),b(pe.$$.fragment,e),b(ce.$$.fragment,e),b(ge.$$.fragment,e),b(fe.$$.fragment,e),b(he.$$.fragment,e),b(be.$$.fragment,e),b(ve.$$.fragment,e),b(ye.$$.fragment,e),b(Ee.$$.fragment,e),b(_e.$$.fragment,e),b(Je.$$.fragment,e),b(ze.$$.fragment,e),b(ke.$$.fragment,e),b(Te.$$.fragment,e),b(Ue.$$.fragment,e),b(we.$$.fragment,e),b($e.$$.fragment,e),ua=!1},d(e){t(I),e&&t(ct),e&&t(j),M(re),e&&t(gt),M(me,e),e&&t(ft),e&&t(U),e&&t(ht),e&&t(Z),M(de),e&&t(bt),e&&t(Ie),e&&t(Mt),e&&t(X),M(pe),e&&t(vt),e&&t(je),e&&t(yt),e&&t(v),e&&t(Et),e&&t(_),e&&t(_t),e&&t(N),e&&t(Jt),M(ce,e),e&&t(zt),e&&t(q),e&&t(kt),M(ge,e),e&&t(Tt),e&&t(We),e&&t(Ut),M(fe,e),e&&t(wt),e&&t(J),e&&t($t),M(he,e),e&&t(It),e&&t(D),e&&t(jt),M(be,e),e&&t(Zt),e&&t(w),e&&t(Xt),e&&t(C),M(ve),e&&t(Ct),e&&t(Le),e&&t(xt),e&&t(Q),e&&t(Rt),e&&t(qe),e&&t(Gt),e&&t(x),M(ye),e&&t(Bt),e&&t(De),e&&t(Wt),e&&t(P),e&&t(Lt),e&&t(Ae),e&&t(Vt),e&&t(R),M(Ee),e&&t(Nt),e&&t(Pe),e&&t(qt),e&&t(S),e&&t(Dt),e&&t(Oe),e&&t(Ft),e&&t(G),M(_e),e&&t(Qt),e&&t(He),e&&t(At),e&&t(H),e&&t(Pt),e&&t(K),e&&t(Yt),M(Je,e),e&&t(St),e&&t(ll),e&&t(Ot),M(ze,e),e&&t(Ht),e&&t(z),e&&t(Kt),M(ke,e),e&&t(ea),e&&t(B),M(Te),e&&t(la),e&&t(tl),e&&t(ta),e&&t(y),e&&t(aa),e&&t(le),e&&t(oa),M(Ue,e),e&&t(ia),e&&t(nl),e&&t(sa),M(we,e),e&&t(na),e&&t(k),e&&t(ra),M($e,e),e&&t(ma),e&&t(te)}}}const nr={local:"modelli-multilingue-per-linferenza",sections:[{local:"xlm",sections:[{local:"xlm-con-language-embeddings",title:"XLM con language embeddings"},{local:"xlm-senza-language-embeddings",title:"XLM senza language embeddings"}],title:"XLM"},{local:"bert",title:"BERT"},{local:"xlmroberta",title:"XLM-RoBERTa"},{local:"m2m100",title:"M2M100"},{local:"mbart",title:"MBart"}],title:"Modelli multilingue per l'inferenza"};function rr(ks){return or(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class cr extends Kn{constructor(I){super();er(this,I,rr,sr,lr,{})}}export{cr as default,nr as metadata};
