import{S as ti,i as ni,s as ai,e as n,k as h,w as y,t as s,M as ri,c as a,d as t,m as p,a as r,x as v,h as l,b as i,G as e,g as u,y as M,q as w,o as T,B as k,v as si,L as zs}from"../../chunks/vendor-hf-doc-builder.js";import{T as xs}from"../../chunks/Tip-hf-doc-builder.js";import{D as V}from"../../chunks/Docstring-hf-doc-builder.js";import{C as St}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as W}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Cs}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function li(C){let m,N,_,g,b;return g=new St({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyME5sbGJNb2VNb2RlbCUyQyUyME5sbGJNb2VDb25maWclMEElMEElMjMlMjBJbml0aWFsaXppbmclMjBhJTIwTmxsYk1vZSUyMGZhY2Vib29rJTJGbmxsYi1tb2UtNTRiJTIwc3R5bGUlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyME5sbGJNb2VDb25maWcoKSUwQSUwQSUyMyUyMEluaXRpYWxpemluZyUyMGElMjBtb2RlbCUyMGZyb20lMjB0aGUlMjBmYWNlYm9vayUyRm5sbGItbW9lLTU0YiUyMHN0eWxlJTIwY29uZmlndXJhdGlvbiUwQW1vZGVsJTIwJTNEJTIwTmxsYk1vZU1vZGVsKGNvbmZpZ3VyYXRpb24pJTBBJTBBJTIzJTIwQWNjZXNzaW5nJTIwdGhlJTIwbW9kZWwlMjBjb25maWd1cmF0aW9uJTBBY29uZmlndXJhdGlvbiUyMCUzRCUyMG1vZGVsLmNvbmZpZw==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> NllbMoeModel, NllbMoeConfig

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a NllbMoe facebook/nllb-moe-54b style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = NllbMoeConfig()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model from the facebook/nllb-moe-54b style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = NllbMoeModel(configuration)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Accessing the model configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = model.config`}}),{c(){m=n("p"),N=s("Example:"),_=h(),y(g.$$.fragment)},l(c){m=a(c,"P",{});var f=r(m);N=l(f,"Example:"),f.forEach(t),_=p(c),v(g.$$.fragment,c)},m(c,f){u(c,m,f),e(m,N),u(c,_,f),M(g,c,f),b=!0},p:zs,i(c){b||(w(g.$$.fragment,c),b=!0)},o(c){T(g.$$.fragment,c),b=!1},d(c){c&&t(m),c&&t(_),k(g,c)}}}function ii(C){let m,N,_,g,b;return{c(){m=n("p"),N=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=n("code"),g=s("Module"),b=s(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(c){m=a(c,"P",{});var f=r(m);N=l(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a(f,"CODE",{});var z=r(_);g=l(z,"Module"),z.forEach(t),b=l(f,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),f.forEach(t)},m(c,f){u(c,m,f),e(m,N),e(m,_),e(_,g),e(m,b)},d(c){c&&t(m)}}}function di(C){let m,N,_,g,b;return{c(){m=n("p"),N=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=n("code"),g=s("Module"),b=s(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(c){m=a(c,"P",{});var f=r(m);N=l(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a(f,"CODE",{});var z=r(_);g=l(z,"Module"),z.forEach(t),b=l(f,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),f.forEach(t)},m(c,f){u(c,m,f),e(m,N),e(m,_),e(_,g),e(m,b)},d(c){c&&t(m)}}}function ci(C){let m,N,_,g,b;return g=new St({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBObGxiTW9lTW9kZWwlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJoZi1pbnRlcm5hbC10ZXN0aW5nJTJGcmFuZG9tLW5sbGItbW9lLTItZXhwZXJ0cyUyMiklMEFtb2RlbCUyMCUzRCUyMFN3aXRjaFRyYW5zZm9ybWVyc01vZGVsLmZyb21fcHJldHJhaW5lZCglMjJoZi1pbnRlcm5hbC10ZXN0aW5nJTJGcmFuZG9tLW5sbGItbW9lLTItZXhwZXJ0cyUyMiklMEElMEFpbnB1dF9pZHMlMjAlM0QlMjB0b2tlbml6ZXIoJTBBJTIwJTIwJTIwJTIwJTIyU3R1ZGllcyUyMGhhdmUlMjBiZWVuJTIwc2hvd24lMjB0aGF0JTIwb3duaW5nJTIwYSUyMGRvZyUyMGlzJTIwZ29vZCUyMGZvciUyMHlvdSUyMiUyQyUyMHJldHVybl90ZW5zb3JzJTNEJTIycHQlMjIlMEEpLmlucHV0X2lkcyUyMCUyMCUyMyUyMEJhdGNoJTIwc2l6ZSUyMDElMEFkZWNvZGVyX2lucHV0X2lkcyUyMCUzRCUyMHRva2VuaXplciglMjJTdHVkaWVzJTIwc2hvdyUyMHRoYXQlMjIlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKS5pbnB1dF9pZHMlMjAlMjAlMjMlMjBCYXRjaCUyMHNpemUlMjAxJTBBJTBBJTIzJTIwcHJlcHJvY2VzcyUzQSUyMFByZXBlbmQlMjBkZWNvZGVyX2lucHV0X2lkcyUyMHdpdGglMjBzdGFydCUyMHRva2VuJTIwd2hpY2glMjBpcyUyMHBhZCUyMHRva2VuJTIwZm9yJTIwTmxsYk1vZU1vZGVsJTBBZGVjb2Rlcl9pbnB1dF9pZHMlMjAlM0QlMjBtb2RlbC5fc2hpZnRfcmlnaHQoZGVjb2Rlcl9pbnB1dF9pZHMpJTBBJTBBJTIzJTIwZm9yd2FyZCUyMHBhc3MlMEFvdXRwdXRzJTIwJTNEJTIwbW9kZWwoaW5wdXRfaWRzJTNEaW5wdXRfaWRzJTJDJTIwZGVjb2Rlcl9pbnB1dF9pZHMlM0RkZWNvZGVyX2lucHV0X2lkcyklMEFsYXN0X2hpZGRlbl9zdGF0ZXMlMjAlM0QlMjBvdXRwdXRzLmxhc3RfaGlkZGVuX3N0YXRl",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, NllbMoeModel

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;hf-internal-testing/random-nllb-moe-2-experts&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = SwitchTransformersModel.from_pretrained(<span class="hljs-string">&quot;hf-internal-testing/random-nllb-moe-2-experts&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>input_ids = tokenizer(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;Studies have been shown that owning a dog is good for you&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>
<span class="hljs-meta">... </span>).input_ids  <span class="hljs-comment"># Batch size 1</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>decoder_input_ids = tokenizer(<span class="hljs-string">&quot;Studies show that&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).input_ids  <span class="hljs-comment"># Batch size 1</span>

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># preprocess: Prepend decoder_input_ids with start token which is pad token for NllbMoeModel</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>decoder_input_ids = model._shift_right(decoder_input_ids)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># forward pass</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(input_ids=input_ids, decoder_input_ids=decoder_input_ids)
<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_states = outputs.last_hidden_state`}}),{c(){m=n("p"),N=s("Example:"),_=h(),y(g.$$.fragment)},l(c){m=a(c,"P",{});var f=r(m);N=l(f,"Example:"),f.forEach(t),_=p(c),v(g.$$.fragment,c)},m(c,f){u(c,m,f),e(m,N),u(c,_,f),M(g,c,f),b=!0},p:zs,i(c){b||(w(g.$$.fragment,c),b=!0)},o(c){T(g.$$.fragment,c),b=!1},d(c){c&&t(m),c&&t(_),k(g,c)}}}function hi(C){let m,N,_,g,b;return{c(){m=n("p"),N=s("Although the recipe for forward pass needs to be defined within this function, one should call the "),_=n("code"),g=s("Module"),b=s(`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`)},l(c){m=a(c,"P",{});var f=r(m);N=l(f,"Although the recipe for forward pass needs to be defined within this function, one should call the "),_=a(f,"CODE",{});var z=r(_);g=l(z,"Module"),z.forEach(t),b=l(f,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),f.forEach(t)},m(c,f){u(c,m,f),e(m,N),e(m,_),e(_,g),e(m,b)},d(c){c&&t(m)}}}function pi(C){let m,N,_,g,b;return g=new St({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Ub2tlbml6ZXIlMkMlMjBObGxiTW9lRm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uJTBBJTBBbW9kZWwlMjAlM0QlMjBObGxiTW9lRm9yQ29uZGl0aW9uYWxHZW5lcmF0aW9uLmZyb21fcHJldHJhaW5lZCglMjJmYWNlYm9vayUyRm5sbGItbW9lLTU0YiUyMiklMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJmYWNlYm9vayUyRm5sbGItbW9lLTU0YiUyMiklMEElMEF0ZXh0X3RvX3RyYW5zbGF0ZSUyMCUzRCUyMCUyMkxpZmUlMjBpcyUyMGxpa2UlMjBhJTIwYm94JTIwb2YlMjBjaG9jb2xhdGVzJTIyJTBBbW9kZWxfaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKHRleHRfdG9fdHJhbnNsYXRlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMEElMjMlMjB0cmFuc2xhdGUlMjB0byUyMEZyZW5jaCUwQWdlbl90b2tlbnMlMjAlM0QlMjBtb2RlbC5nZW5lcmF0ZSgqKm1vZGVsX2lucHV0cyUyQyUyMGZvcmNlZF9ib3NfdG9rZW5faWQlM0R0b2tlbml6ZXIuZ2V0X2xhbmdfaWQoJTIyZW5nX0xhdG4lMjIpKSUwQXByaW50KHRva2VuaXplci5iYXRjaF9kZWNvZGUoZ2VuX3Rva2VucyUyQyUyMHNraXBfc3BlY2lhbF90b2tlbnMlM0RUcnVlKSk=",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, NllbMoeForConditionalGeneration

<span class="hljs-meta">&gt;&gt;&gt; </span>model = NllbMoeForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;facebook/nllb-moe-54b&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;facebook/nllb-moe-54b&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>text_to_translate = <span class="hljs-string">&quot;Life is like a box of chocolates&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model_inputs = tokenizer(text_to_translate, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># translate to French</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>gen_tokens = model.generate(**model_inputs, forced_bos_token_id=tokenizer.get_lang_id(<span class="hljs-string">&quot;eng_Latn&quot;</span>))
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-built_in">print</span>(tokenizer.batch_decode(gen_tokens, skip_special_tokens=<span class="hljs-literal">True</span>))`}}),{c(){m=n("p"),N=s("Translation example:"),_=h(),y(g.$$.fragment)},l(c){m=a(c,"P",{});var f=r(m);N=l(f,"Translation example:"),f.forEach(t),_=p(c),v(g.$$.fragment,c)},m(c,f){u(c,m,f),e(m,N),u(c,_,f),M(g,c,f),b=!0},p:zs,i(c){b||(w(g.$$.fragment,c),b=!0)},o(c){T(g.$$.fragment,c),b=!1},d(c){c&&t(m),c&&t(_),k(g,c)}}}function ui(C){let m,N,_,g,b,c,f,z,Ln,At,X,de,Ao,Ue,Wn,Po,In,Pt,ce,Rn,Ge,Sn,An,Vt,bo,Pn,Xt,yo,Vo,Vn,Ht,vo,Xn,Dt,I,Xo,Hn,Dn,Ho,On,Yn,Do,Qn,Ot,R,Kn,Ze,ea,oa,qe,ta,na,Yt,H,he,Oo,Be,aa,Yo,ra,Qt,D,pe,Qo,Le,sa,Ko,la,Kt,S,ia,et,da,ca,ot,ha,pa,en,A,ua,tt,ma,fa,We,ga,_a,on,Ie,tn,O,ue,nt,Re,ba,at,ya,nn,P,va,rt,Ma,wa,st,Ta,ka,an,Mo,Na,rn,Se,sn,Y,me,lt,Ae,$a,it,Ea,ln,fe,dt,wo,xa,Ca,ct,To,za,dn,Q,ge,ht,Pe,ja,pt,Ja,cn,J,Ve,Fa,K,Ua,ko,Ga,Za,Xe,qa,Ba,La,ee,Wa,No,Ia,Ra,$o,Sa,Aa,Pa,_e,hn,oe,be,ut,He,Va,mt,Xa,pn,$,De,Ha,ft,Da,Oa,Oe,Ya,gt,Qa,Ka,er,_t,or,tr,ye,Ye,nr,te,ar,bt,rr,sr,yt,lr,ir,dr,ve,Qe,cr,vt,hr,un,ne,Me,Mt,Ke,pr,wt,ur,mn,L,eo,mr,Tt,fr,gr,G,oo,_r,to,br,kt,yr,vr,Mr,E,wr,Nt,Tr,kr,$t,Nr,$r,Et,Er,xr,xt,Cr,zr,Ct,jr,Jr,zt,Fr,Ur,Gr,jt,Zr,fn,ae,we,Jt,no,qr,Ft,Br,gn,F,ao,Lr,ro,Wr,Eo,Ir,Rr,Sr,so,Ar,lo,Pr,Vr,Xr,x,io,Hr,re,Dr,xo,Or,Yr,Ut,Qr,Kr,es,Te,os,se,ts,Co,ns,as,Gt,rs,ss,ls,ke,is,Ne,_n,le,$e,Zt,co,ds,qt,cs,bn,U,ho,hs,po,ps,zo,us,ms,fs,uo,gs,mo,_s,bs,ys,Z,fo,vs,ie,Ms,jo,ws,Ts,Bt,ks,Ns,$s,Ee,Es,xe,yn;return c=new W({}),Ue=new W({}),Be=new W({}),Le=new W({}),Ie=new St({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvclNlcTJTZXFMTSUyQyUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJmYWNlYm9vayUyRm5sbGItbW9lLTU0YiUyMiklMEFtb2RlbCUyMCUzRCUyMEF1dG9Nb2RlbEZvclNlcTJTZXFMTS5mcm9tX3ByZXRyYWluZWQoJTIyZmFjZWJvb2slMkZubGxiLW1vZS01NGIlMjIpJTBBJTBBYXJ0aWNsZSUyMCUzRCUyMCUyMlByZXZpb3VzbHklMkMlMjBSaW5nJ3MlMjBDRU8lMkMlMjBKYW1pZSUyMFNpbWlub2ZmJTJDJTIwcmVtYXJrZWQlMjB0aGUlMjBjb21wYW55JTIwc3RhcnRlZCUyMHdoZW4lMjBoaXMlMjBkb29yYmVsbCUyMHdhc24ndCUyMGF1ZGlibGUlMjBmcm9tJTIwaGlzJTIwc2hvcCUyMGluJTIwaGlzJTIwZ2FyYWdlLiUyMiUwQWlucHV0cyUyMCUzRCUyMHRva2VuaXplcihhcnRpY2xlJTJDJTIwcmV0dXJuX3RlbnNvcnMlM0QlMjJwdCUyMiklMEElMEF0cmFuc2xhdGVkX3Rva2VucyUyMCUzRCUyMG1vZGVsLmdlbmVyYXRlKCUwQSUyMCUyMCUyMCUyMCoqaW5wdXRzJTJDJTIwZm9yY2VkX2Jvc190b2tlbl9pZCUzRHRva2VuaXplci5sYW5nX2NvZGVfdG9faWQlNUIlMjJmcmFfTGF0biUyMiU1RCUyQyUyMG1heF9sZW5ndGglM0Q1MCUwQSklMEF0b2tlbml6ZXIuYmF0Y2hfZGVjb2RlKHRyYW5zbGF0ZWRfdG9rZW5zJTJDJTIwc2tpcF9zcGVjaWFsX3Rva2VucyUzRFRydWUpJTVCMCU1RA==",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForSeq2SeqLM, AutoTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;facebook/nllb-moe-54b&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForSeq2SeqLM.from_pretrained(<span class="hljs-string">&quot;facebook/nllb-moe-54b&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>article = <span class="hljs-string">&quot;Previously, Ring&#x27;s CEO, Jamie Siminoff, remarked the company started when his doorbell wasn&#x27;t audible from his shop in his garage.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(article, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>translated_tokens = model.generate(
<span class="hljs-meta">... </span>    **inputs, forced_bos_token_id=tokenizer.lang_code_to_id[<span class="hljs-string">&quot;fra_Latn&quot;</span>], max_length=<span class="hljs-number">50</span>
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.batch_decode(translated_tokens, skip_special_tokens=<span class="hljs-literal">True</span>)[<span class="hljs-number">0</span>]
<span class="hljs-string">&quot;Auparavant, le PDG de Ring, Jamie Siminoff, a fait remarquer que la soci\xE9t\xE9 avait commenc\xE9 lorsque sa sonnette n&#x27;\xE9tait pas audible depuis son magasin dans son garage.&quot;</span>`}}),Re=new W({}),Se=new St({props:{code:"ZnJvbSUyMHRyYW5zZm9ybWVycyUyMGltcG9ydCUyMEF1dG9Nb2RlbEZvclNlcTJTZXFMTSUyQyUyMEF1dG9Ub2tlbml6ZXIlMEElMEF0b2tlbml6ZXIlMjAlM0QlMjBBdXRvVG9rZW5pemVyLmZyb21fcHJldHJhaW5lZCglMjJmYWNlYm9vayUyRm5sbGItbW9lLTU0YiUyMiUyQyUyMHNyY19sYW5nJTNEJTIycm9uX0xhdG4lMjIpJTBBbW9kZWwlMjAlM0QlMjBBdXRvTW9kZWxGb3JTZXEyU2VxTE0uZnJvbV9wcmV0cmFpbmVkKCUyMmZhY2Vib29rJTJGbmxsYi1tb2UtNTRiJTIyKSUwQSUwQWFydGljbGUlMjAlM0QlMjAlMjIlQzUlOUVlZnVsJTIwT05VJTIwc3B1bmUlMjBjJUM0JTgzJTIwbnUlMjBleGlzdCVDNCU4MyUyMG8lMjBzb2x1JUM1JUEzaWUlMjBtaWxpdGFyJUM0JTgzJTIwJUMzJUFFbiUyMFNpcmlhJTIyJTBBaW5wdXRzJTIwJTNEJTIwdG9rZW5pemVyKGFydGljbGUlMkMlMjByZXR1cm5fdGVuc29ycyUzRCUyMnB0JTIyKSUwQSUwQXRyYW5zbGF0ZWRfdG9rZW5zJTIwJTNEJTIwbW9kZWwuZ2VuZXJhdGUoJTBBJTIwJTIwJTIwJTIwKippbnB1dHMlMkMlMjBmb3JjZWRfYm9zX3Rva2VuX2lkJTNEdG9rZW5pemVyLmxhbmdfY29kZV90b19pZCU1QiUyMmRldV9MYXRuJTIyJTVEJTJDJTIwbWF4X2xlbmd0aCUzRDMwJTBBKSUwQXRva2VuaXplci5iYXRjaF9kZWNvZGUodHJhbnNsYXRlZF90b2tlbnMlMkMlMjBza2lwX3NwZWNpYWxfdG9rZW5zJTNEVHJ1ZSklNUIwJTVE",highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForSeq2SeqLM, AutoTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;facebook/nllb-moe-54b&quot;</span>, src_lang=<span class="hljs-string">&quot;ron_Latn&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForSeq2SeqLM.from_pretrained(<span class="hljs-string">&quot;facebook/nllb-moe-54b&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>article = <span class="hljs-string">&quot;\u015Eeful ONU spune c\u0103 nu exist\u0103 o solu\u0163ie militar\u0103 \xEEn Siria&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(article, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>translated_tokens = model.generate(
<span class="hljs-meta">... </span>    **inputs, forced_bos_token_id=tokenizer.lang_code_to_id[<span class="hljs-string">&quot;deu_Latn&quot;</span>], max_length=<span class="hljs-number">30</span>
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.batch_decode(translated_tokens, skip_special_tokens=<span class="hljs-literal">True</span>)[<span class="hljs-number">0</span>]`}}),Ae=new W({}),Pe=new W({}),Ve=new V({props:{name:"class transformers.NllbMoeConfig",anchor:"transformers.NllbMoeConfig",parameters:[{name:"vocab_size",val:" = 128112"},{name:"max_position_embeddings",val:" = 1024"},{name:"encoder_layers",val:" = 12"},{name:"encoder_ffn_dim",val:" = 4096"},{name:"encoder_attention_heads",val:" = 16"},{name:"decoder_layers",val:" = 12"},{name:"decoder_ffn_dim",val:" = 4096"},{name:"decoder_attention_heads",val:" = 16"},{name:"encoder_layerdrop",val:" = 0.05"},{name:"decoder_layerdrop",val:" = 0.05"},{name:"use_cache",val:" = True"},{name:"is_encoder_decoder",val:" = True"},{name:"activation_function",val:" = 'relu'"},{name:"d_model",val:" = 1024"},{name:"dropout",val:" = 0.1"},{name:"attention_dropout",val:" = 0.1"},{name:"activation_dropout",val:" = 0.0"},{name:"init_std",val:" = 0.02"},{name:"decoder_start_token_id",val:" = 2"},{name:"scale_embedding",val:" = True"},{name:"router_bias",val:" = False"},{name:"router_dtype",val:" = 'float32'"},{name:"router_ignore_padding_tokens",val:" = False"},{name:"num_experts",val:" = 128"},{name:"expert_capacity",val:" = 64"},{name:"encoder_sparse_step",val:" = 4"},{name:"decoder_sparse_step",val:" = 4"},{name:"router_z_loss_coef",val:" = 0.001"},{name:"router_aux_loss_coef",val:" = 0.001"},{name:"second_expert_policy",val:" = 'all'"},{name:"normalize_router_prob_before_dropping",val:" = False"},{name:"batch_prioritized_routing",val:" = False"},{name:"moe_eval_capacity_token_fraction",val:" = 1.0"},{name:"moe_token_dropout",val:" = 0.2"},{name:"pad_token_id",val:" = 1"},{name:"bos_token_id",val:" = 0"},{name:"eos_token_id",val:" = 2"},{name:"output_router_logits",val:" = False"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.NllbMoeConfig.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 50265) &#x2014;
Vocabulary size of the NllbMoe model. Defines the number of different tokens that can be represented by the
<code>inputs_ids</code> passed when calling <a href="/docs/transformers/v4.32.0/en/model_doc/nllb-moe#transformers.NllbMoeModel">NllbMoeModel</a> or`,name:"vocab_size"},{anchor:"transformers.NllbMoeConfig.d_model",description:`<strong>d_model</strong> (<code>int</code>, <em>optional</em>, defaults to 1024) &#x2014;
Dimensionality of the layers and the pooler layer.`,name:"d_model"},{anchor:"transformers.NllbMoeConfig.encoder_layers",description:`<strong>encoder_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of encoder layers.`,name:"encoder_layers"},{anchor:"transformers.NllbMoeConfig.decoder_layers",description:`<strong>decoder_layers</strong> (<code>int</code>, <em>optional</em>, defaults to 12) &#x2014;
Number of decoder layers.`,name:"decoder_layers"},{anchor:"transformers.NllbMoeConfig.encoder_attention_heads",description:`<strong>encoder_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 16) &#x2014;
Number of attention heads for each attention layer in the Transformer encoder.`,name:"encoder_attention_heads"},{anchor:"transformers.NllbMoeConfig.decoder_attention_heads",description:`<strong>decoder_attention_heads</strong> (<code>int</code>, <em>optional</em>, defaults to 16) &#x2014;
Number of attention heads for each attention layer in the Transformer decoder.`,name:"decoder_attention_heads"},{anchor:"transformers.NllbMoeConfig.decoder_ffn_dim",description:`<strong>decoder_ffn_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 4096) &#x2014;
Dimensionality of the &#x201C;intermediate&#x201D; (often named feed-forward) layer in decoder.`,name:"decoder_ffn_dim"},{anchor:"transformers.NllbMoeConfig.encoder_ffn_dim",description:`<strong>encoder_ffn_dim</strong> (<code>int</code>, <em>optional</em>, defaults to 4096) &#x2014;
Dimensionality of the &#x201C;intermediate&#x201D; (often named feed-forward) layer in encoder.`,name:"encoder_ffn_dim"},{anchor:"transformers.NllbMoeConfig.activation_function",description:`<strong>activation_function</strong> (<code>str</code> or <code>function</code>, <em>optional</em>, defaults to <code>&quot;gelu&quot;</code>) &#x2014;
The non-linear activation function (function or string) in the encoder and pooler. If string, <code>&quot;gelu&quot;</code>,
<code>&quot;relu&quot;</code>, <code>&quot;silu&quot;</code> and <code>&quot;gelu_new&quot;</code> are supported.`,name:"activation_function"},{anchor:"transformers.NllbMoeConfig.dropout",description:`<strong>dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.1) &#x2014;
The dropout probability for all fully connected layers in the embeddings, encoder, and pooler.`,name:"dropout"},{anchor:"transformers.NllbMoeConfig.attention_dropout",description:`<strong>attention_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio for the attention probabilities.`,name:"attention_dropout"},{anchor:"transformers.NllbMoeConfig.activation_dropout",description:`<strong>activation_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio for activations inside the fully connected layer.`,name:"activation_dropout"},{anchor:"transformers.NllbMoeConfig.classifier_dropout",description:`<strong>classifier_dropout</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The dropout ratio for classifier.`,name:"classifier_dropout"},{anchor:"transformers.NllbMoeConfig.max_position_embeddings",description:`<strong>max_position_embeddings</strong> (<code>int</code>, <em>optional</em>, defaults to 1024) &#x2014;
The maximum sequence length that this model might ever be used with. Typically set this to something large
just in case (e.g., 512 or 1024 or 2048).`,name:"max_position_embeddings"},{anchor:"transformers.NllbMoeConfig.init_std",description:`<strong>init_std</strong> (<code>float</code>, <em>optional</em>, defaults to 0.02) &#x2014;
The standard deviation of the truncated_normal_initializer for initializing all weight matrices.`,name:"init_std"},{anchor:"transformers.NllbMoeConfig.encoder_layerdrop",description:`<strong>encoder_layerdrop</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The LayerDrop probability for the encoder. See the [LayerDrop paper](see <a href="https://arxiv.org/abs/1909.11556" rel="nofollow">https://arxiv.org/abs/1909.11556</a>)
for more details.`,name:"encoder_layerdrop"},{anchor:"transformers.NllbMoeConfig.decoder_layerdrop",description:`<strong>decoder_layerdrop</strong> (<code>float</code>, <em>optional</em>, defaults to 0.0) &#x2014;
The LayerDrop probability for the decoder. See the [LayerDrop paper](see <a href="https://arxiv.org/abs/1909.11556" rel="nofollow">https://arxiv.org/abs/1909.11556</a>)
for more details.`,name:"decoder_layerdrop"},{anchor:"transformers.NllbMoeConfig.second_expert_policy",description:`<strong>second_expert_policy</strong> ( <code>str</code>, <em>optional</em>, default to <code>&quot;all&quot;</code>) &#x2014;
The policy used for the sampling the probability of being sampled to a second expert for each token.`,name:"second_expert_policy"},{anchor:"transformers.NllbMoeConfig.normalize_router_prob_before_dropping",description:`<strong>normalize_router_prob_before_dropping</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to normalize the router probabilities before applying a mask based on the experts capacity
(capacity dropping).`,name:"normalize_router_prob_before_dropping"},{anchor:"transformers.NllbMoeConfig.batch_prioritized_routing",description:`<strong>batch_prioritized_routing</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not to orders the tokens by their router probabilities before capacity dropping. This means that
the tokens that have the highest probabilities will be routed before other tokens that might be further in
the sequence.`,name:"batch_prioritized_routing"},{anchor:"transformers.NllbMoeConfig.moe_eval_capacity_token_fraction",description:`<strong>moe_eval_capacity_token_fraction</strong> (<code>float</code>, <em>optional</em>, defaults to 1.0) &#x2014;
Fraction of tokens as capacity during validation, if set to negative, uses the same as training. Should be
in range: (0.0, 1.0].`,name:"moe_eval_capacity_token_fraction"},{anchor:"transformers.NllbMoeConfig.num_experts",description:`<strong>num_experts</strong> (<code>int</code>, <em>optional</em>, defaults to 128) &#x2014;
Number of experts for each NllbMoeSparseMlp layer.`,name:"num_experts"},{anchor:"transformers.NllbMoeConfig.expert_capacity",description:`<strong>expert_capacity</strong> (<code>int</code>, <em>optional</em>, defaults to 64) &#x2014;
Number of tokens that can be stored in each expert.`,name:"expert_capacity"},{anchor:"transformers.NllbMoeConfig.encoder_sparse_step",description:`<strong>encoder_sparse_step</strong> (<code>int</code>, <em>optional</em>, defaults to 4) &#x2014;
Frequency of the sparse layers in the encoder. 4 means that one out of 4 layers will be sparse.`,name:"encoder_sparse_step"},{anchor:"transformers.NllbMoeConfig.decoder_sparse_step",description:`<strong>decoder_sparse_step</strong> (<code>int</code>, <em>optional</em>, defaults to 4) &#x2014;
Frequency of the sparse layers in the decoder. 4 means that one out of 4 layers will be sparse.`,name:"decoder_sparse_step"},{anchor:"transformers.NllbMoeConfig.router_dtype",description:`<strong>router_dtype</strong> (<code>str</code>, <em>optional</em>, default to <code>&quot;float32&quot;</code>) &#x2014;
The <code>dtype</code> used for the routers. It is preferable to keep the <code>dtype</code> to <code>&quot;float32&quot;</code> as specified in the
<em>selective precision</em> discussion in <a href="https://arxiv.org/abs/2101.03961" rel="nofollow">the paper</a>.`,name:"router_dtype"},{anchor:"transformers.NllbMoeConfig.router_ignore_padding_tokens",description:`<strong>router_ignore_padding_tokens</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to ignore padding tokens when routing. if <code>False</code>, the padding tokens are not routed to any
experts.`,name:"router_ignore_padding_tokens"},{anchor:"transformers.NllbMoeConfig.router_bias",description:`<strong>router_bias</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not the classifier of the router should have a bias.`,name:"router_bias"},{anchor:"transformers.NllbMoeConfig.moe_token_dropout",description:`<strong>moe_token_dropout</strong> (<code>float</code>, <em>optional</em>, defualt ot 0.2) &#x2014;
Masking rate for MoE expert output masking (EOM), which is implemented via a Dropout2d on the expert
outputs.`,name:"moe_token_dropout"},{anchor:"transformers.NllbMoeConfig.output_router_logits",description:`<strong>output_router_logits</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to return the router logits. Only set to <code>True</code> to get the auxiliary loss when training.`,name:"output_router_logits"},{anchor:"transformers.NllbMoeConfig.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether or not the model should return the last key/values attentions (not used by all models).`,name:"use_cache"}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/models/nllb_moe/configuration_nllb_moe.py#L27"}}),_e=new Cs({props:{anchor:"transformers.NllbMoeConfig.example",$$slots:{default:[li]},$$scope:{ctx:C}}}),He=new W({}),De=new V({props:{name:"class transformers.NllbMoeTop2Router",anchor:"transformers.NllbMoeTop2Router",parameters:[{name:"config",val:": NllbMoeConfig"}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/models/nllb_moe/modeling_nllb_moe.py#L250"}}),Ye=new V({props:{name:"route_tokens",anchor:"transformers.NllbMoeTop2Router.route_tokens",parameters:[{name:"router_logits",val:": Tensor"},{name:"input_dtype",val:": dtype = torch.float32"},{name:"padding_mask",val:": typing.Optional[torch.LongTensor] = None"}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/models/nllb_moe/modeling_nllb_moe.py#L291"}}),Qe=new V({props:{name:"forward",anchor:"transformers.NllbMoeTop2Router.forward",parameters:[{name:"hidden_states",val:": Tensor"},{name:"padding_mask",val:": typing.Optional[torch.LongTensor] = None"}],parametersDescription:[{anchor:"transformers.NllbMoeTop2Router.forward.hidden_states",description:`<strong>hidden_states</strong> (<code>torch.Tensor</code>) &#x2014;
(batch_size, sequence_length, hidden_dim) from which router probabilities are computed.`,name:"hidden_states"}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/models/nllb_moe/modeling_nllb_moe.py#L376",returnDescription:`
<p>Index tensor of shape [batch_size, sequence_length] corresponding to the expert selected for each token
using the top1 probabilities of the router.
router_probabilities (<code>torch.Tensor</code> of shape (batch_size, sequence_length, nump_experts)):
Tensor of shape (batch_size, sequence_length, num_experts) corresponding to the probabilities for each
token and expert. Used for routing tokens to experts.
router_logits (<code>torch.Tensor</code> of shape (batch_size, sequence_length))):
Logits tensor of shape (batch_size, sequence_length, num_experts) corresponding to raw router logits.
This is used later for computing router z-loss.</p>
`,returnType:`
<p>top_1_mask (<code>torch.Tensor</code> of shape (batch_size, sequence_length))</p>
`}}),Ke=new W({}),eo=new V({props:{name:"class transformers.NllbMoeSparseMLP",anchor:"transformers.NllbMoeSparseMLP",parameters:[{name:"config",val:": NllbMoeConfig"},{name:"ffn_dim",val:": int"},{name:"expert_class",val:": Module = <class 'transformers.models.nllb_moe.modeling_nllb_moe.NllbMoeDenseActDense'>"}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/models/nllb_moe/modeling_nllb_moe.py#L427"}}),oo=new V({props:{name:"forward",anchor:"transformers.NllbMoeSparseMLP.forward",parameters:[{name:"hidden_states",val:": Tensor"},{name:"padding_mask",val:": typing.Optional[torch.Tensor] = False"}],parametersDescription:[{anchor:"transformers.NllbMoeSparseMLP.forward.hidden_states",description:`<strong>hidden_states</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_dim)</code>) &#x2014;
The hidden states`,name:"hidden_states"},{anchor:"transformers.NllbMoeSparseMLP.forward.padding_mask",description:`<strong>padding_mask</strong> (<code>torch.Tensor</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Attention mask. Can be in the causal form or not.`,name:"padding_mask"}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/models/nllb_moe/modeling_nllb_moe.py#L443",returnDescription:`
<p>Updated hidden states
router_logits (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length, num_experts)</code>):
Needed for computing the loss</p>
`,returnType:`
<p>hidden_states (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length, hidden_dim)</code>)</p>
`}}),no=new W({}),ao=new V({props:{name:"class transformers.NllbMoeModel",anchor:"transformers.NllbMoeModel",parameters:[{name:"config",val:": NllbMoeConfig"}],parametersDescription:[{anchor:"transformers.NllbMoeModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.32.0/en/model_doc/nllb-moe#transformers.NllbMoeConfig">NllbMoeConfig</a>) &#x2014;
Model configuration class with all the parameters of the model. Initializing with a config file does not
load the weights associated with the model, only the configuration. Check out the
<a href="/docs/transformers/v4.32.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/models/nllb_moe/modeling_nllb_moe.py#L1508"}}),io=new V({props:{name:"forward",anchor:"transformers.NllbMoeModel.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"decoder_input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"decoder_attention_mask",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"decoder_head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"cross_attn_head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"encoder_outputs",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = None"},{name:"past_key_values",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"decoder_inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"output_router_logits",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.NllbMoeModel.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide
it.`,name:"input_ids"}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/models/nllb_moe/modeling_nllb_moe.py#L1537",returnDescription:`
<p>A <code>transformers.modeling_outputs.Seq2SeqMoEModelOutput</code> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.32.0/en/model_doc/nllb-moe#transformers.NllbMoeConfig"
>NllbMoeConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>) \u2014 Sequence of hidden-states at the output of the last layer of the decoder of the model.</p>
<p>If <code>past_key_values</code> is used only the last hidden-state of the sequences of shape <code>(batch_size, 1, hidden_size)</code> is output.</p>
</li>
<li>
<p><strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) \u2014 Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of shape
<code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>) and 2 additional tensors of shape
<code>(batch_size, num_heads, encoder_sequence_length, embed_size_per_head)</code>.</p>
<p>Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
blocks) that can be used (see <code>past_key_values</code> input) to speed up sequential decoding.</p>
</li>
<li>
<p><strong>decoder_hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the decoder at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>decoder_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights of the decoder, after the attention softmax, used to compute the weighted average in the
self-attention heads.</p>
</li>
<li>
<p><strong>decoder_router_logits</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_router_logits=True</code> is passed or when <code>config.add_router_probs=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, sequence_length, num_experts)</code>.</p>
<p>Router logits of the decoder model, useful to compute the auxiliary loss for Mixture of Experts models.</p>
</li>
<li>
<p><strong>cross_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights of the decoder\u2019s cross-attention layer, after the attention softmax, used to compute the
weighted average in the cross-attention heads.</p>
</li>
<li>
<p><strong>encoder_last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) \u2014 Sequence of hidden-states at the output of the last layer of the encoder of the model.</p>
</li>
<li>
<p><strong>encoder_hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the encoder at the output of each layer plus the optional initial embedding outputs.</p>
</li>
<li>
<p><strong>encoder_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights of the encoder, after the attention softmax, used to compute the weighted average in the
self-attention heads.</p>
</li>
<li>
<p><strong>encoder_router_logits</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_router_logits=True</code> is passed or when <code>config.add_router_probs=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, sequence_length, num_experts)</code>.</p>
<p>Router logits of the encoder model, useful to compute the auxiliary loss and the z_loss for the sparse
modules.</p>
</li>
</ul>
`,returnType:`
<p><code>transformers.modeling_outputs.Seq2SeqMoEModelOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Te=new xs({props:{$$slots:{default:[ii]},$$scope:{ctx:C}}}),ke=new xs({props:{$$slots:{default:[di]},$$scope:{ctx:C}}}),Ne=new Cs({props:{anchor:"transformers.NllbMoeModel.forward.example",$$slots:{default:[ci]},$$scope:{ctx:C}}}),co=new W({}),ho=new V({props:{name:"class transformers.NllbMoeForConditionalGeneration",anchor:"transformers.NllbMoeForConditionalGeneration",parameters:[{name:"config",val:": NllbMoeConfig"}],parametersDescription:[{anchor:"transformers.NllbMoeForConditionalGeneration.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.32.0/en/model_doc/nllb-moe#transformers.NllbMoeConfig">NllbMoeConfig</a>) &#x2014;
Model configuration class with all the parameters of the model. Initializing with a config file does not
load the weights associated with the model, only the configuration. Check out the
<a href="/docs/transformers/v4.32.0/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/models/nllb_moe/modeling_nllb_moe.py#L1640"}}),fo=new V({props:{name:"forward",anchor:"transformers.NllbMoeForConditionalGeneration.forward",parameters:[{name:"input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"attention_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"decoder_input_ids",val:": typing.Optional[torch.LongTensor] = None"},{name:"decoder_attention_mask",val:": typing.Optional[torch.LongTensor] = None"},{name:"head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"decoder_head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"cross_attn_head_mask",val:": typing.Optional[torch.Tensor] = None"},{name:"encoder_outputs",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = None"},{name:"past_key_values",val:": typing.Optional[typing.Tuple[typing.Tuple[torch.FloatTensor]]] = None"},{name:"inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"decoder_inputs_embeds",val:": typing.Optional[torch.FloatTensor] = None"},{name:"labels",val:": typing.Optional[torch.LongTensor] = None"},{name:"use_cache",val:": typing.Optional[bool] = None"},{name:"output_attentions",val:": typing.Optional[bool] = None"},{name:"output_hidden_states",val:": typing.Optional[bool] = None"},{name:"output_router_logits",val:": typing.Optional[bool] = None"},{name:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.NllbMoeForConditionalGeneration.forward.input_ids",description:`<strong>input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>) &#x2014;
Indices of input sequence tokens in the vocabulary. Padding will be ignored by default should you provide
it.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.32.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.32.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.32.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.NllbMoeForConditionalGeneration.forward.attention_mask",description:`<strong>attention_mask</strong> (<code>torch.Tensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Mask to avoid performing attention on padding token indices. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 for tokens that are <strong>not masked</strong>,</li>
<li>0 for tokens that are <strong>masked</strong>.</li>
</ul>
<p><a href="../glossary#attention-mask">What are attention masks?</a>`,name:"attention_mask"},{anchor:"transformers.NllbMoeForConditionalGeneration.forward.decoder_input_ids",description:`<strong>decoder_input_ids</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, target_sequence_length)</code>, <em>optional</em>) &#x2014;
Indices of decoder input sequence tokens in the vocabulary.</p>
<p>Indices can be obtained using <a href="/docs/transformers/v4.32.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.32.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.32.0/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#decoder-input-ids">What are decoder input IDs?</a></p>
<p>NllbMoe uses the <code>eos_token_id</code> as the starting token for <code>decoder_input_ids</code> generation. If
<code>past_key_values</code> is used, optionally only the last <code>decoder_input_ids</code> have to be input (see
<code>past_key_values</code>).`,name:"decoder_input_ids"},{anchor:"transformers.NllbMoeForConditionalGeneration.forward.decoder_attention_mask",description:`<strong>decoder_attention_mask</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, target_sequence_length)</code>, <em>optional</em>) &#x2014;
Default behavior: generate a tensor that ignores pad tokens in <code>decoder_input_ids</code>. Causal mask will also
be used by default.`,name:"decoder_attention_mask"},{anchor:"transformers.NllbMoeForConditionalGeneration.forward.head_mask",description:`<strong>head_mask</strong> (<code>torch.Tensor</code> of shape <code>(encoder_layers, encoder_attention_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the attention modules in the encoder. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"head_mask"},{anchor:"transformers.NllbMoeForConditionalGeneration.forward.decoder_head_mask",description:`<strong>decoder_head_mask</strong> (<code>torch.Tensor</code> of shape <code>(decoder_layers, decoder_attention_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the attention modules in the decoder. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"decoder_head_mask"},{anchor:"transformers.NllbMoeForConditionalGeneration.forward.cross_attn_head_mask",description:`<strong>cross_attn_head_mask</strong> (<code>torch.Tensor</code> of shape <code>(decoder_layers, decoder_attention_heads)</code>, <em>optional</em>) &#x2014;
Mask to nullify selected heads of the cross-attention modules in the decoder. Mask values selected in <code>[0, 1]</code>:</p>
<ul>
<li>1 indicates the head is <strong>not masked</strong>,</li>
<li>0 indicates the head is <strong>masked</strong>.</li>
</ul>`,name:"cross_attn_head_mask"},{anchor:"transformers.NllbMoeForConditionalGeneration.forward.encoder_outputs",description:`<strong>encoder_outputs</strong> (<code>tuple(tuple(torch.FloatTensor)</code>, <em>optional</em>) &#x2014;
Tuple consists of (<code>last_hidden_state</code>, <em>optional</em>: <code>hidden_states</code>, <em>optional</em>: <code>attentions</code>)
<code>last_hidden_state</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) is a sequence of
hidden-states at the output of the last layer of the encoder. Used in the cross-attention of the decoder.`,name:"encoder_outputs"},{anchor:"transformers.NllbMoeForConditionalGeneration.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) &#x2014;
Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of shape
<code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>) and 2 additional tensors of shape
<code>(batch_size, num_heads, encoder_sequence_length, embed_size_per_head)</code>.</p>
<p>Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
blocks) that can be used (see <code>past_key_values</code> input) to speed up sequential decoding.</p>
<p>If <code>past_key_values</code> are used, the user can optionally input only the last <code>decoder_input_ids</code> (those that
don&#x2019;t have their past key value states given to this model) of shape <code>(batch_size, 1)</code> instead of all
<code>decoder_input_ids</code> of shape <code>(batch_size, sequence_length)</code>. inputs_embeds (<code>torch.FloatTensor</code> of shape
<code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>): Optionally, instead of passing <code>input_ids</code> you
can choose to directly pass an embedded representation. This is useful if you want more control over how to
convert <code>input_ids</code> indices into associated vectors than the model&#x2019;s internal embedding lookup matrix.`,name:"past_key_values"},{anchor:"transformers.NllbMoeForConditionalGeneration.forward.decoder_inputs_embeds",description:`<strong>decoder_inputs_embeds</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, target_sequence_length, hidden_size)</code>, <em>optional</em>) &#x2014;
Optionally, instead of passing <code>decoder_input_ids</code> you can choose to directly pass an embedded
representation. If <code>past_key_values</code> is used, optionally only the last <code>decoder_inputs_embeds</code> have to be
input (see <code>past_key_values</code>). This is useful if you want more control over how to convert
<code>decoder_input_ids</code> indices into associated vectors than the model&#x2019;s internal embedding lookup matrix.</p>
<p>If <code>decoder_input_ids</code> and <code>decoder_inputs_embeds</code> are both unset, <code>decoder_inputs_embeds</code> takes the value
of <code>inputs_embeds</code>.`,name:"decoder_inputs_embeds"},{anchor:"transformers.NllbMoeForConditionalGeneration.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
If set to <code>True</code>, <code>past_key_values</code> key value states are returned and can be used to speed up decoding (see
<code>past_key_values</code>).`,name:"use_cache"},{anchor:"transformers.NllbMoeForConditionalGeneration.forward.output_attentions",description:`<strong>output_attentions</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the attentions tensors of all attention layers. See <code>attentions</code> under returned
tensors for more detail.`,name:"output_attentions"},{anchor:"transformers.NllbMoeForConditionalGeneration.forward.output_hidden_states",description:`<strong>output_hidden_states</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the hidden states of all layers. See <code>hidden_states</code> under returned tensors for
more detail.`,name:"output_hidden_states"},{anchor:"transformers.NllbMoeForConditionalGeneration.forward.output_router_logits",description:`<strong>output_router_logits</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return the logits of all the routers. They are useful for computing the router loss, and
should not be returned during inference.`,name:"output_router_logits"},{anchor:"transformers.NllbMoeForConditionalGeneration.forward.return_dict",description:`<strong>return_dict</strong> (<code>bool</code>, <em>optional</em>) &#x2014;
Whether or not to return a <a href="/docs/transformers/v4.32.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.NllbMoeForConditionalGeneration.forward.labels",description:`<strong>labels</strong> (<code>torch.LongTensor</code> of shape <code>(batch_size, sequence_length)</code>, <em>optional</em>) &#x2014;
Labels for computing the masked language modeling loss. Indices should either be in <code>[0, ..., config.vocab_size]</code> or -100 (see <code>input_ids</code> docstring). Tokens with indices set to <code>-100</code> are ignored
(masked), the loss is only computed for the tokens with labels in <code>[0, ..., config.vocab_size]</code>.`,name:"labels"}],source:"https://github.com/huggingface/transformers/blob/v4.32.0/src/transformers/models/nllb_moe/modeling_nllb_moe.py#L1666",returnDescription:`
<p>A <code>transformers.modeling_outputs.Seq2SeqMoEOutput</code> or a tuple of
<code>torch.FloatTensor</code> (if <code>return_dict=False</code> is passed or when <code>config.return_dict=False</code>) comprising various
elements depending on the configuration (<a
  href="/docs/transformers/v4.32.0/en/model_doc/nllb-moe#transformers.NllbMoeConfig"
>NllbMoeConfig</a>) and inputs.</p>
<ul>
<li>
<p><strong>loss</strong> (<code>torch.FloatTensor</code> of shape <code>(1,)</code>, <em>optional</em>, returned when <code>labels</code> is provided) \u2014 Language modeling loss.</p>
</li>
<li>
<p><strong>logits</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, config.vocab_size)</code>) \u2014 Prediction scores of the language modeling head (scores for each vocabulary token before SoftMax).</p>
</li>
<li>
<p><strong>past_key_values</strong> (<code>tuple(tuple(torch.FloatTensor))</code>, <em>optional</em>, returned when <code>use_cache=True</code> is passed or when <code>config.use_cache=True</code>) \u2014 Tuple of <code>tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code>, with each tuple having 2 tensors of shape
<code>(batch_size, num_heads, sequence_length, embed_size_per_head)</code>) and 2 additional tensors of shape
<code>(batch_size, num_heads, encoder_sequence_length, embed_size_per_head)</code>.</p>
<p>Contains pre-computed hidden-states (key and values in the self-attention blocks and in the cross-attention
blocks) that can be used (see <code>past_key_values</code> input) to speed up sequential decoding.</p>
</li>
<li>
<p><strong>decoder_hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the decoder at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>decoder_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights of the decoder, after the attention softmax, used to compute the weighted average in the
self-attention heads.</p>
</li>
<li>
<p><strong>decoder_router_logits</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_router_logits=True</code> is passed or when <code>config.add_router_probs=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, sequence_length, num_experts)</code>.</p>
<p>Router logits of the decoder model, useful to compute the auxiliary loss for Mixture of Experts models.</p>
</li>
<li>
<p><strong>cross_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights of the decoder\u2019s cross-attention layer, after the attention softmax, used to compute the
weighted average in the cross-attention heads.</p>
</li>
<li>
<p><strong>encoder_last_hidden_state</strong> (<code>torch.FloatTensor</code> of shape <code>(batch_size, sequence_length, hidden_size)</code>, <em>optional</em>) \u2014 Sequence of hidden-states at the output of the last layer of the encoder of the model.</p>
</li>
<li>
<p><strong>encoder_hidden_states</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_hidden_states=True</code> is passed or when <code>config.output_hidden_states=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for the output of the embeddings, if the model has an embedding layer, +
one for the output of each layer) of shape <code>(batch_size, sequence_length, hidden_size)</code>.</p>
<p>Hidden-states of the encoder at the output of each layer plus the initial embedding outputs.</p>
</li>
<li>
<p><strong>encoder_attentions</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_attentions=True</code> is passed or when <code>config.output_attentions=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, num_heads, sequence_length, sequence_length)</code>.</p>
<p>Attentions weights of the encoder, after the attention softmax, used to compute the weighted average in the
self-attention heads.</p>
</li>
<li>
<p><strong>encoder_router_logits</strong> (<code>tuple(torch.FloatTensor)</code>, <em>optional</em>, returned when <code>output_router_logits=True</code> is passed or when <code>config.add_router_probs=True</code>) \u2014 Tuple of <code>torch.FloatTensor</code> (one for each layer) of shape <code>(batch_size, sequence_length, num_experts)</code>.</p>
<p>Router logits of the encoder model, useful to compute the auxiliary loss and z_loss for Mixture of Experts
models.</p>
</li>
</ul>
`,returnType:`
<p><code>transformers.modeling_outputs.Seq2SeqMoEOutput</code> or <code>tuple(torch.FloatTensor)</code></p>
`}}),Ee=new xs({props:{$$slots:{default:[hi]},$$scope:{ctx:C}}}),xe=new Cs({props:{anchor:"transformers.NllbMoeForConditionalGeneration.forward.example",$$slots:{default:[pi]},$$scope:{ctx:C}}}),{c(){m=n("meta"),N=h(),_=n("h1"),g=n("a"),b=n("span"),y(c.$$.fragment),f=h(),z=n("span"),Ln=s("NLLB-MOE"),At=h(),X=n("h2"),de=n("a"),Ao=n("span"),y(Ue.$$.fragment),Wn=h(),Po=n("span"),In=s("Overview"),Pt=h(),ce=n("p"),Rn=s("The NLLB model was presented in "),Ge=n("a"),Sn=s("No Language Left Behind: Scaling Human-Centered Machine Translation"),An=s(` by Marta R. Costa-juss\xE0, James Cross, Onur \xC7elebi,
Maha Elbayad, Kenneth Heafield, Kevin Heffernan, Elahe Kalbassi, Janice Lam, Daniel Licht, Jean Maillard, Anna Sun, Skyler Wang, Guillaume Wenzek, Al Youngblood, Bapi Akula,
Loic Barrault, Gabriel Mejia Gonzalez, Prangthip Hansanti, John Hoffman, Semarley Jarrett, Kaushik Ram Sadagopan, Dirk Rowe, Shannon Spruit, Chau Tran, Pierre Andrews,
Necip Fazil Ayan, Shruti Bhosale, Sergey Edunov, Angela Fan, Cynthia Gao, Vedanuj Goswami, Francisco Guzm\xE1n, Philipp Koehn, Alexandre Mourachko, Christophe Ropers,
Safiyyah Saleem, Holger Schwenk, and Jeff Wang.`),Vt=h(),bo=n("p"),Pn=s("The abstract of the paper is the following:"),Xt=h(),yo=n("p"),Vo=n("em"),Vn=s(`Driven by the goal of eradicating language barriers on a global scale, machine translation has solidified itself as a key focus of artificial intelligence research today.
However, such efforts have coalesced around a small subset of languages, leaving behind the vast majority of mostly low-resource languages. What does it take to break the
200 language barrier while ensuring safe, high quality results, all while keeping ethical considerations in mind? In No Language Left Behind, we took on this challenge by
first contextualizing the need for low-resource language translation support through exploratory interviews with native speakers. Then, we created datasets and models aimed
at narrowing the performance gap between low and high-resource languages. More specifically, we developed a conditional compute model based on Sparsely Gated Mixture of
Experts that is trained on data obtained with novel and effective data mining techniques tailored for low-resource languages. We propose multiple architectural and training
improvements to counteract overfitting while training on thousands of tasks. Critically, we evaluated the performance of over 40,000 different translation directions using
a human-translated benchmark, Flores-200, and combined human evaluation with a novel toxicity benchmark covering all languages in Flores-200 to assess translation safety.
Our model achieves an improvement of 44% BLEU relative to the previous state-of-the-art, laying important groundwork towards realizing a universal translation system.`),Ht=h(),vo=n("p"),Xn=s("Tips:"),Dt=h(),I=n("ul"),Xo=n("li"),Hn=s("M2M100ForConditionalGeneration is the base model for both NLLB and NLLB MoE"),Dn=h(),Ho=n("li"),On=s("The NLLB-MoE is very similar to the NLLB model, but it\u2019s feed forward layer is based on the implementation of SwitchTransformers."),Yn=h(),Do=n("li"),Qn=s("The tokenizer is the same as the NLLB models."),Ot=h(),R=n("p"),Kn=s("This model was contributed by "),Ze=n("a"),ea=s("Arthur Zucker"),oa=s(`.
The original code can be found `),qe=n("a"),ta=s("here"),na=s("."),Yt=h(),H=n("h2"),he=n("a"),Oo=n("span"),y(Be.$$.fragment),aa=h(),Yo=n("span"),ra=s("Implementation differences with SwitchTransformers"),Qt=s("\n\nThe biggest difference is the way the tokens are routed. NLLB-MoE uses a `top-2-gate` which means that for each input, only the top two experts are selected based on the \nhighest predicted probabilities from the gating network, and the remaining experts are ignored. In `SwitchTransformers`, only the top-1 probabilities are computed, \nwhich means that tokens have less probability of being forwarded. Moreover, if a token is not routed to any expert, `SwitchTransformers` still adds its unmodified hidden \nstates (kind of like a residual connection) while they are masked in `NLLB`'s top-2 routing mechanism.\n"),D=n("h2"),pe=n("a"),Qo=n("span"),y(Le.$$.fragment),sa=h(),Ko=n("span"),la=s("Generating with NLLB-MoE"),Kt=s(`

The avalable checkpoints requires around 350GB of storage. Make sure to use \`accelerate\` if you do not have enough RAM on your machine.
`),S=n("p"),ia=s("While generating the target text set the "),et=n("code"),da=s("forced_bos_token_id"),ca=s(` to the target language id. The following
example shows how to translate English to French using the `),ot=n("em"),ha=s("facebook/nllb-200-distilled-600M"),pa=s(" model."),en=h(),A=n("p"),ua=s("Note that we\u2019re using the BCP-47 code for French "),tt=n("code"),ma=s("fra_Latn"),fa=s(". See "),We=n("a"),ga=s("here"),_a=s(`
for the list of all BCP-47 in the Flores 200 dataset.`),on=h(),y(Ie.$$.fragment),tn=h(),O=n("h3"),ue=n("a"),nt=n("span"),y(Re.$$.fragment),ba=h(),at=n("span"),ya=s("Generating from any other language than English"),nn=h(),P=n("p"),va=s("English ("),rt=n("code"),Ma=s("eng_Latn"),wa=s(`) is set as the default language from which to translate. In order to specify that you\u2019d like to translate from a different language,
you should specify the BCP-47 code in the `),st=n("code"),Ta=s("src_lang"),ka=s(" keyword argument of the tokenizer initialization."),an=h(),Mo=n("p"),Na=s("See example below for a translation from romanian to german:"),rn=h(),y(Se.$$.fragment),sn=h(),Y=n("h2"),me=n("a"),lt=n("span"),y(Ae.$$.fragment),$a=h(),it=n("span"),Ea=s("Documentation resources"),ln=h(),fe=n("ul"),dt=n("li"),wo=n("a"),xa=s("Translation task guide"),Ca=h(),ct=n("li"),To=n("a"),za=s("Summarization task guide"),dn=h(),Q=n("h2"),ge=n("a"),ht=n("span"),y(Pe.$$.fragment),ja=h(),pt=n("span"),Ja=s("NllbMoeConfig"),cn=h(),J=n("div"),y(Ve.$$.fragment),Fa=h(),K=n("p"),Ua=s("This is the configuration class to store the configuration of a "),ko=n("a"),Ga=s("NllbMoeModel"),Za=s(`. It is used to instantiate an
NLLB-MoE model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a similar configuration to that of the NLLB-MoE
`),Xe=n("a"),qa=s("facebook/nllb-moe-54b"),Ba=s(" architecture."),La=h(),ee=n("p"),Wa=s("Configuration objects inherit from "),No=n("a"),Ia=s("PretrainedConfig"),Ra=s(` and can be used to control the model outputs. Read the
documentation from `),$o=n("a"),Sa=s("PretrainedConfig"),Aa=s(" for more information."),Pa=h(),y(_e.$$.fragment),hn=h(),oe=n("h2"),be=n("a"),ut=n("span"),y(He.$$.fragment),Va=h(),mt=n("span"),Xa=s("NllbMoeTop2Router"),pn=h(),$=n("div"),y(De.$$.fragment),Ha=h(),ft=n("p"),Da=s("Router using tokens choose top-2 experts assignment."),Oa=h(),Oe=n("p"),Ya=s(`This router uses the same mechanism as in NLLB-MoE from the fairseq repository. Items are sorted by router_probs
and then routed to their choice of expert until the expert\u2019s expert_capacity is reached. `),gt=n("strong"),Qa=s(`There is no guarantee
that each token is processed by an expert`),Ka=s(", or that each expert receives at least one token."),er=h(),_t=n("p"),or=s("The router combining weights are also returned to make sure that the states that are not updated will be masked."),tr=h(),ye=n("div"),y(Ye.$$.fragment),nr=h(),te=n("p"),ar=s("Computes the "),bt=n("code"),rr=s("dispatch_mask"),sr=s(" and the "),yt=n("code"),lr=s("dispatch_weights"),ir=s(` for each experts. The masks are adapted to the expert
capacity.`),dr=h(),ve=n("div"),y(Qe.$$.fragment),cr=h(),vt=n("p"),hr=s(`The hidden states are reshaped to simplify the computation of the router probabilities (combining weights for
each experts.)`),un=h(),ne=n("h2"),Me=n("a"),Mt=n("span"),y(Ke.$$.fragment),pr=h(),wt=n("span"),ur=s("NllbMoeSparseMLP"),mn=h(),L=n("div"),y(eo.$$.fragment),mr=h(),Tt=n("p"),fr=s("Implementation of the NLLB-MoE sparse MLP module."),gr=h(),G=n("div"),y(oo.$$.fragment),_r=h(),to=n("p"),br=s("The goal of this forward pass is to have the same number of operation as the equivalent "),kt=n("code"),yr=s("NllbMoeDenseActDense"),vr=s(`
(mlp) layer. This means that all of the hidden states should be processed at most twice ( since we are using a
top_2 gating mecanism). This means that we keep the complexity to O(batch_size x sequence_length x hidden_dim)
instead of O(num_experts x batch_size x sequence_length x hidden_dim).`),Mr=h(),E=n("p"),wr=s("1- Get the "),Nt=n("code"),Tr=s("router_probs"),kr=s(" from the "),$t=n("code"),Nr=s("router"),$r=s(". The shape of the "),Et=n("code"),Er=s("router_mask"),xr=s(" is "),xt=n("code"),Cr=s("(batch_size X sequence_length, num_expert)"),zr=s(" and corresponds to the boolean version of the "),Ct=n("code"),jr=s("router_probs"),Jr=s(`. The inputs are masked using the
`),zt=n("code"),Fr=s("router_mask"),Ur=s("."),Gr=h(),jt=n("p"),Zr=s(`2- Dispatch the hidden_states to its associated experts. The router probabilities are used to weight the
contribution of each experts when updating the masked hidden states.`),fn=h(),ae=n("h2"),we=n("a"),Jt=n("span"),y(no.$$.fragment),qr=h(),Ft=n("span"),Br=s("NllbMoeModel"),gn=h(),F=n("div"),y(ao.$$.fragment),Lr=h(),ro=n("p"),Wr=s(`The bare NllbMoe Model outputting raw hidden-states without any specific head on top.
This model inherits from `),Eo=n("a"),Ir=s("PreTrainedModel"),Rr=s(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Sr=h(),so=n("p"),Ar=s("This model is also a PyTorch "),lo=n("a"),Pr=s("torch.nn.Module"),Vr=s(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Xr=h(),x=n("div"),y(io.$$.fragment),Hr=h(),re=n("p"),Dr=s("The "),xo=n("a"),Or=s("NllbMoeModel"),Yr=s(" forward method, overrides the "),Ut=n("code"),Qr=s("__call__"),Kr=s(" special method."),es=h(),y(Te.$$.fragment),os=h(),se=n("p"),ts=s("The "),Co=n("a"),ns=s("NllbMoeModel"),as=s(" forward method, overrides the "),Gt=n("code"),rs=s("__call__"),ss=s(" special method."),ls=h(),y(ke.$$.fragment),is=h(),y(Ne.$$.fragment),_n=h(),le=n("h2"),$e=n("a"),Zt=n("span"),y(co.$$.fragment),ds=h(),qt=n("span"),cs=s("NllbMoeForConditionalGeneration"),bn=h(),U=n("div"),y(ho.$$.fragment),hs=h(),po=n("p"),ps=s(`The NllbMoe Model with a language modeling head. Can be used for summarization.
This model inherits from `),zo=n("a"),us=s("PreTrainedModel"),ms=s(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),fs=h(),uo=n("p"),gs=s("This model is also a PyTorch "),mo=n("a"),_s=s("torch.nn.Module"),bs=s(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),ys=h(),Z=n("div"),y(fo.$$.fragment),vs=h(),ie=n("p"),Ms=s("The "),jo=n("a"),ws=s("NllbMoeForConditionalGeneration"),Ts=s(" forward method, overrides the "),Bt=n("code"),ks=s("__call__"),Ns=s(" special method."),$s=h(),y(Ee.$$.fragment),Es=h(),y(xe.$$.fragment),this.h()},l(o){const d=ri('[data-svelte="svelte-1phssyn"]',document.head);m=a(d,"META",{name:!0,content:!0}),d.forEach(t),N=p(o),_=a(o,"H1",{class:!0});var go=r(_);g=a(go,"A",{id:!0,class:!0,href:!0});var Lt=r(g);b=a(Lt,"SPAN",{});var Wt=r(b);v(c.$$.fragment,Wt),Wt.forEach(t),Lt.forEach(t),f=p(go),z=a(go,"SPAN",{});var It=r(z);Ln=l(It,"NLLB-MOE"),It.forEach(t),go.forEach(t),At=p(o),X=a(o,"H2",{class:!0});var _o=r(X);de=a(_o,"A",{id:!0,class:!0,href:!0});var Rt=r(de);Ao=a(Rt,"SPAN",{});var js=r(Ao);v(Ue.$$.fragment,js),js.forEach(t),Rt.forEach(t),Wn=p(_o),Po=a(_o,"SPAN",{});var Js=r(Po);In=l(Js,"Overview"),Js.forEach(t),_o.forEach(t),Pt=p(o),ce=a(o,"P",{});var vn=r(ce);Rn=l(vn,"The NLLB model was presented in "),Ge=a(vn,"A",{href:!0,rel:!0});var Fs=r(Ge);Sn=l(Fs,"No Language Left Behind: Scaling Human-Centered Machine Translation"),Fs.forEach(t),An=l(vn,` by Marta R. Costa-juss\xE0, James Cross, Onur \xC7elebi,
Maha Elbayad, Kenneth Heafield, Kevin Heffernan, Elahe Kalbassi, Janice Lam, Daniel Licht, Jean Maillard, Anna Sun, Skyler Wang, Guillaume Wenzek, Al Youngblood, Bapi Akula,
Loic Barrault, Gabriel Mejia Gonzalez, Prangthip Hansanti, John Hoffman, Semarley Jarrett, Kaushik Ram Sadagopan, Dirk Rowe, Shannon Spruit, Chau Tran, Pierre Andrews,
Necip Fazil Ayan, Shruti Bhosale, Sergey Edunov, Angela Fan, Cynthia Gao, Vedanuj Goswami, Francisco Guzm\xE1n, Philipp Koehn, Alexandre Mourachko, Christophe Ropers,
Safiyyah Saleem, Holger Schwenk, and Jeff Wang.`),vn.forEach(t),Vt=p(o),bo=a(o,"P",{});var Us=r(bo);Pn=l(Us,"The abstract of the paper is the following:"),Us.forEach(t),Xt=p(o),yo=a(o,"P",{});var Gs=r(yo);Vo=a(Gs,"EM",{});var Zs=r(Vo);Vn=l(Zs,`Driven by the goal of eradicating language barriers on a global scale, machine translation has solidified itself as a key focus of artificial intelligence research today.
However, such efforts have coalesced around a small subset of languages, leaving behind the vast majority of mostly low-resource languages. What does it take to break the
200 language barrier while ensuring safe, high quality results, all while keeping ethical considerations in mind? In No Language Left Behind, we took on this challenge by
first contextualizing the need for low-resource language translation support through exploratory interviews with native speakers. Then, we created datasets and models aimed
at narrowing the performance gap between low and high-resource languages. More specifically, we developed a conditional compute model based on Sparsely Gated Mixture of
Experts that is trained on data obtained with novel and effective data mining techniques tailored for low-resource languages. We propose multiple architectural and training
improvements to counteract overfitting while training on thousands of tasks. Critically, we evaluated the performance of over 40,000 different translation directions using
a human-translated benchmark, Flores-200, and combined human evaluation with a novel toxicity benchmark covering all languages in Flores-200 to assess translation safety.
Our model achieves an improvement of 44% BLEU relative to the previous state-of-the-art, laying important groundwork towards realizing a universal translation system.`),Zs.forEach(t),Gs.forEach(t),Ht=p(o),vo=a(o,"P",{});var qs=r(vo);Xn=l(qs,"Tips:"),qs.forEach(t),Dt=p(o),I=a(o,"UL",{});var Jo=r(I);Xo=a(Jo,"LI",{});var Bs=r(Xo);Hn=l(Bs,"M2M100ForConditionalGeneration is the base model for both NLLB and NLLB MoE"),Bs.forEach(t),Dn=p(Jo),Ho=a(Jo,"LI",{});var Ls=r(Ho);On=l(Ls,"The NLLB-MoE is very similar to the NLLB model, but it\u2019s feed forward layer is based on the implementation of SwitchTransformers."),Ls.forEach(t),Yn=p(Jo),Do=a(Jo,"LI",{});var Ws=r(Do);Qn=l(Ws,"The tokenizer is the same as the NLLB models."),Ws.forEach(t),Jo.forEach(t),Ot=p(o),R=a(o,"P",{});var Fo=r(R);Kn=l(Fo,"This model was contributed by "),Ze=a(Fo,"A",{href:!0,rel:!0});var Is=r(Ze);ea=l(Is,"Arthur Zucker"),Is.forEach(t),oa=l(Fo,`.
The original code can be found `),qe=a(Fo,"A",{href:!0,rel:!0});var Rs=r(qe);ta=l(Rs,"here"),Rs.forEach(t),na=l(Fo,"."),Fo.forEach(t),Yt=p(o),H=a(o,"H2",{class:!0});var Mn=r(H);he=a(Mn,"A",{id:!0,class:!0,href:!0});var Ss=r(he);Oo=a(Ss,"SPAN",{});var As=r(Oo);v(Be.$$.fragment,As),As.forEach(t),Ss.forEach(t),aa=p(Mn),Yo=a(Mn,"SPAN",{});var Ps=r(Yo);ra=l(Ps,"Implementation differences with SwitchTransformers"),Ps.forEach(t),Mn.forEach(t),Qt=l(o,"\n\nThe biggest difference is the way the tokens are routed. NLLB-MoE uses a `top-2-gate` which means that for each input, only the top two experts are selected based on the \nhighest predicted probabilities from the gating network, and the remaining experts are ignored. In `SwitchTransformers`, only the top-1 probabilities are computed, \nwhich means that tokens have less probability of being forwarded. Moreover, if a token is not routed to any expert, `SwitchTransformers` still adds its unmodified hidden \nstates (kind of like a residual connection) while they are masked in `NLLB`'s top-2 routing mechanism.\n"),D=a(o,"H2",{class:!0});var wn=r(D);pe=a(wn,"A",{id:!0,class:!0,href:!0});var Vs=r(pe);Qo=a(Vs,"SPAN",{});var Xs=r(Qo);v(Le.$$.fragment,Xs),Xs.forEach(t),Vs.forEach(t),sa=p(wn),Ko=a(wn,"SPAN",{});var Hs=r(Ko);la=l(Hs,"Generating with NLLB-MoE"),Hs.forEach(t),wn.forEach(t),Kt=l(o,`

The avalable checkpoints requires around 350GB of storage. Make sure to use \`accelerate\` if you do not have enough RAM on your machine.
`),S=a(o,"P",{});var Uo=r(S);ia=l(Uo,"While generating the target text set the "),et=a(Uo,"CODE",{});var Ds=r(et);da=l(Ds,"forced_bos_token_id"),Ds.forEach(t),ca=l(Uo,` to the target language id. The following
example shows how to translate English to French using the `),ot=a(Uo,"EM",{});var Os=r(ot);ha=l(Os,"facebook/nllb-200-distilled-600M"),Os.forEach(t),pa=l(Uo," model."),Uo.forEach(t),en=p(o),A=a(o,"P",{});var Go=r(A);ua=l(Go,"Note that we\u2019re using the BCP-47 code for French "),tt=a(Go,"CODE",{});var Ys=r(tt);ma=l(Ys,"fra_Latn"),Ys.forEach(t),fa=l(Go,". See "),We=a(Go,"A",{href:!0,rel:!0});var Qs=r(We);ga=l(Qs,"here"),Qs.forEach(t),_a=l(Go,`
for the list of all BCP-47 in the Flores 200 dataset.`),Go.forEach(t),on=p(o),v(Ie.$$.fragment,o),tn=p(o),O=a(o,"H3",{class:!0});var Tn=r(O);ue=a(Tn,"A",{id:!0,class:!0,href:!0});var Ks=r(ue);nt=a(Ks,"SPAN",{});var el=r(nt);v(Re.$$.fragment,el),el.forEach(t),Ks.forEach(t),ba=p(Tn),at=a(Tn,"SPAN",{});var ol=r(at);ya=l(ol,"Generating from any other language than English"),ol.forEach(t),Tn.forEach(t),nn=p(o),P=a(o,"P",{});var Zo=r(P);va=l(Zo,"English ("),rt=a(Zo,"CODE",{});var tl=r(rt);Ma=l(tl,"eng_Latn"),tl.forEach(t),wa=l(Zo,`) is set as the default language from which to translate. In order to specify that you\u2019d like to translate from a different language,
you should specify the BCP-47 code in the `),st=a(Zo,"CODE",{});var nl=r(st);Ta=l(nl,"src_lang"),nl.forEach(t),ka=l(Zo," keyword argument of the tokenizer initialization."),Zo.forEach(t),an=p(o),Mo=a(o,"P",{});var al=r(Mo);Na=l(al,"See example below for a translation from romanian to german:"),al.forEach(t),rn=p(o),v(Se.$$.fragment,o),sn=p(o),Y=a(o,"H2",{class:!0});var kn=r(Y);me=a(kn,"A",{id:!0,class:!0,href:!0});var rl=r(me);lt=a(rl,"SPAN",{});var sl=r(lt);v(Ae.$$.fragment,sl),sl.forEach(t),rl.forEach(t),$a=p(kn),it=a(kn,"SPAN",{});var ll=r(it);Ea=l(ll,"Documentation resources"),ll.forEach(t),kn.forEach(t),ln=p(o),fe=a(o,"UL",{});var Nn=r(fe);dt=a(Nn,"LI",{});var il=r(dt);wo=a(il,"A",{href:!0});var dl=r(wo);xa=l(dl,"Translation task guide"),dl.forEach(t),il.forEach(t),Ca=p(Nn),ct=a(Nn,"LI",{});var cl=r(ct);To=a(cl,"A",{href:!0});var hl=r(To);za=l(hl,"Summarization task guide"),hl.forEach(t),cl.forEach(t),Nn.forEach(t),dn=p(o),Q=a(o,"H2",{class:!0});var $n=r(Q);ge=a($n,"A",{id:!0,class:!0,href:!0});var pl=r(ge);ht=a(pl,"SPAN",{});var ul=r(ht);v(Pe.$$.fragment,ul),ul.forEach(t),pl.forEach(t),ja=p($n),pt=a($n,"SPAN",{});var ml=r(pt);Ja=l(ml,"NllbMoeConfig"),ml.forEach(t),$n.forEach(t),cn=p(o),J=a(o,"DIV",{class:!0});var Ce=r(J);v(Ve.$$.fragment,Ce),Fa=p(Ce),K=a(Ce,"P",{});var qo=r(K);Ua=l(qo,"This is the configuration class to store the configuration of a "),ko=a(qo,"A",{href:!0});var fl=r(ko);Ga=l(fl,"NllbMoeModel"),fl.forEach(t),Za=l(qo,`. It is used to instantiate an
NLLB-MoE model according to the specified arguments, defining the model architecture. Instantiating a configuration
with the defaults will yield a similar configuration to that of the NLLB-MoE
`),Xe=a(qo,"A",{href:!0,rel:!0});var gl=r(Xe);qa=l(gl,"facebook/nllb-moe-54b"),gl.forEach(t),Ba=l(qo," architecture."),qo.forEach(t),La=p(Ce),ee=a(Ce,"P",{});var Bo=r(ee);Wa=l(Bo,"Configuration objects inherit from "),No=a(Bo,"A",{href:!0});var _l=r(No);Ia=l(_l,"PretrainedConfig"),_l.forEach(t),Ra=l(Bo,` and can be used to control the model outputs. Read the
documentation from `),$o=a(Bo,"A",{href:!0});var bl=r($o);Sa=l(bl,"PretrainedConfig"),bl.forEach(t),Aa=l(Bo," for more information."),Bo.forEach(t),Pa=p(Ce),v(_e.$$.fragment,Ce),Ce.forEach(t),hn=p(o),oe=a(o,"H2",{class:!0});var En=r(oe);be=a(En,"A",{id:!0,class:!0,href:!0});var yl=r(be);ut=a(yl,"SPAN",{});var vl=r(ut);v(He.$$.fragment,vl),vl.forEach(t),yl.forEach(t),Va=p(En),mt=a(En,"SPAN",{});var Ml=r(mt);Xa=l(Ml,"NllbMoeTop2Router"),Ml.forEach(t),En.forEach(t),pn=p(o),$=a(o,"DIV",{class:!0});var q=r($);v(De.$$.fragment,q),Ha=p(q),ft=a(q,"P",{});var wl=r(ft);Da=l(wl,"Router using tokens choose top-2 experts assignment."),wl.forEach(t),Oa=p(q),Oe=a(q,"P",{});var xn=r(Oe);Ya=l(xn,`This router uses the same mechanism as in NLLB-MoE from the fairseq repository. Items are sorted by router_probs
and then routed to their choice of expert until the expert\u2019s expert_capacity is reached. `),gt=a(xn,"STRONG",{});var Tl=r(gt);Qa=l(Tl,`There is no guarantee
that each token is processed by an expert`),Tl.forEach(t),Ka=l(xn,", or that each expert receives at least one token."),xn.forEach(t),er=p(q),_t=a(q,"P",{});var kl=r(_t);or=l(kl,"The router combining weights are also returned to make sure that the states that are not updated will be masked."),kl.forEach(t),tr=p(q),ye=a(q,"DIV",{class:!0});var Cn=r(ye);v(Ye.$$.fragment,Cn),nr=p(Cn),te=a(Cn,"P",{});var Lo=r(te);ar=l(Lo,"Computes the "),bt=a(Lo,"CODE",{});var Nl=r(bt);rr=l(Nl,"dispatch_mask"),Nl.forEach(t),sr=l(Lo," and the "),yt=a(Lo,"CODE",{});var $l=r(yt);lr=l($l,"dispatch_weights"),$l.forEach(t),ir=l(Lo,` for each experts. The masks are adapted to the expert
capacity.`),Lo.forEach(t),Cn.forEach(t),dr=p(q),ve=a(q,"DIV",{class:!0});var zn=r(ve);v(Qe.$$.fragment,zn),cr=p(zn),vt=a(zn,"P",{});var El=r(vt);hr=l(El,`The hidden states are reshaped to simplify the computation of the router probabilities (combining weights for
each experts.)`),El.forEach(t),zn.forEach(t),q.forEach(t),un=p(o),ne=a(o,"H2",{class:!0});var jn=r(ne);Me=a(jn,"A",{id:!0,class:!0,href:!0});var xl=r(Me);Mt=a(xl,"SPAN",{});var Cl=r(Mt);v(Ke.$$.fragment,Cl),Cl.forEach(t),xl.forEach(t),pr=p(jn),wt=a(jn,"SPAN",{});var zl=r(wt);ur=l(zl,"NllbMoeSparseMLP"),zl.forEach(t),jn.forEach(t),mn=p(o),L=a(o,"DIV",{class:!0});var Wo=r(L);v(eo.$$.fragment,Wo),mr=p(Wo),Tt=a(Wo,"P",{});var jl=r(Tt);fr=l(jl,"Implementation of the NLLB-MoE sparse MLP module."),jl.forEach(t),gr=p(Wo),G=a(Wo,"DIV",{class:!0});var ze=r(G);v(oo.$$.fragment,ze),_r=p(ze),to=a(ze,"P",{});var Jn=r(to);br=l(Jn,"The goal of this forward pass is to have the same number of operation as the equivalent "),kt=a(Jn,"CODE",{});var Jl=r(kt);yr=l(Jl,"NllbMoeDenseActDense"),Jl.forEach(t),vr=l(Jn,`
(mlp) layer. This means that all of the hidden states should be processed at most twice ( since we are using a
top_2 gating mecanism). This means that we keep the complexity to O(batch_size x sequence_length x hidden_dim)
instead of O(num_experts x batch_size x sequence_length x hidden_dim).`),Jn.forEach(t),Mr=p(ze),E=a(ze,"P",{});var j=r(E);wr=l(j,"1- Get the "),Nt=a(j,"CODE",{});var Fl=r(Nt);Tr=l(Fl,"router_probs"),Fl.forEach(t),kr=l(j," from the "),$t=a(j,"CODE",{});var Ul=r($t);Nr=l(Ul,"router"),Ul.forEach(t),$r=l(j,". The shape of the "),Et=a(j,"CODE",{});var Gl=r(Et);Er=l(Gl,"router_mask"),Gl.forEach(t),xr=l(j," is "),xt=a(j,"CODE",{});var Zl=r(xt);Cr=l(Zl,"(batch_size X sequence_length, num_expert)"),Zl.forEach(t),zr=l(j," and corresponds to the boolean version of the "),Ct=a(j,"CODE",{});var ql=r(Ct);jr=l(ql,"router_probs"),ql.forEach(t),Jr=l(j,`. The inputs are masked using the
`),zt=a(j,"CODE",{});var Bl=r(zt);Fr=l(Bl,"router_mask"),Bl.forEach(t),Ur=l(j,"."),j.forEach(t),Gr=p(ze),jt=a(ze,"P",{});var Ll=r(jt);Zr=l(Ll,`2- Dispatch the hidden_states to its associated experts. The router probabilities are used to weight the
contribution of each experts when updating the masked hidden states.`),Ll.forEach(t),ze.forEach(t),Wo.forEach(t),fn=p(o),ae=a(o,"H2",{class:!0});var Fn=r(ae);we=a(Fn,"A",{id:!0,class:!0,href:!0});var Wl=r(we);Jt=a(Wl,"SPAN",{});var Il=r(Jt);v(no.$$.fragment,Il),Il.forEach(t),Wl.forEach(t),qr=p(Fn),Ft=a(Fn,"SPAN",{});var Rl=r(Ft);Br=l(Rl,"NllbMoeModel"),Rl.forEach(t),Fn.forEach(t),gn=p(o),F=a(o,"DIV",{class:!0});var je=r(F);v(ao.$$.fragment,je),Lr=p(je),ro=a(je,"P",{});var Un=r(ro);Wr=l(Un,`The bare NllbMoe Model outputting raw hidden-states without any specific head on top.
This model inherits from `),Eo=a(Un,"A",{href:!0});var Sl=r(Eo);Ir=l(Sl,"PreTrainedModel"),Sl.forEach(t),Rr=l(Un,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Un.forEach(t),Sr=p(je),so=a(je,"P",{});var Gn=r(so);Ar=l(Gn,"This model is also a PyTorch "),lo=a(Gn,"A",{href:!0,rel:!0});var Al=r(lo);Pr=l(Al,"torch.nn.Module"),Al.forEach(t),Vr=l(Gn,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Gn.forEach(t),Xr=p(je),x=a(je,"DIV",{class:!0});var B=r(x);v(io.$$.fragment,B),Hr=p(B),re=a(B,"P",{});var Io=r(re);Dr=l(Io,"The "),xo=a(Io,"A",{href:!0});var Pl=r(xo);Or=l(Pl,"NllbMoeModel"),Pl.forEach(t),Yr=l(Io," forward method, overrides the "),Ut=a(Io,"CODE",{});var Vl=r(Ut);Qr=l(Vl,"__call__"),Vl.forEach(t),Kr=l(Io," special method."),Io.forEach(t),es=p(B),v(Te.$$.fragment,B),os=p(B),se=a(B,"P",{});var Ro=r(se);ts=l(Ro,"The "),Co=a(Ro,"A",{href:!0});var Xl=r(Co);ns=l(Xl,"NllbMoeModel"),Xl.forEach(t),as=l(Ro," forward method, overrides the "),Gt=a(Ro,"CODE",{});var Hl=r(Gt);rs=l(Hl,"__call__"),Hl.forEach(t),ss=l(Ro," special method."),Ro.forEach(t),ls=p(B),v(ke.$$.fragment,B),is=p(B),v(Ne.$$.fragment,B),B.forEach(t),je.forEach(t),_n=p(o),le=a(o,"H2",{class:!0});var Zn=r(le);$e=a(Zn,"A",{id:!0,class:!0,href:!0});var Dl=r($e);Zt=a(Dl,"SPAN",{});var Ol=r(Zt);v(co.$$.fragment,Ol),Ol.forEach(t),Dl.forEach(t),ds=p(Zn),qt=a(Zn,"SPAN",{});var Yl=r(qt);cs=l(Yl,"NllbMoeForConditionalGeneration"),Yl.forEach(t),Zn.forEach(t),bn=p(o),U=a(o,"DIV",{class:!0});var Je=r(U);v(ho.$$.fragment,Je),hs=p(Je),po=a(Je,"P",{});var qn=r(po);ps=l(qn,`The NllbMoe Model with a language modeling head. Can be used for summarization.
This model inherits from `),zo=a(qn,"A",{href:!0});var Ql=r(zo);us=l(Ql,"PreTrainedModel"),Ql.forEach(t),ms=l(qn,`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),qn.forEach(t),fs=p(Je),uo=a(Je,"P",{});var Bn=r(uo);gs=l(Bn,"This model is also a PyTorch "),mo=a(Bn,"A",{href:!0,rel:!0});var Kl=r(mo);_s=l(Kl,"torch.nn.Module"),Kl.forEach(t),bs=l(Bn,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Bn.forEach(t),ys=p(Je),Z=a(Je,"DIV",{class:!0});var Fe=r(Z);v(fo.$$.fragment,Fe),vs=p(Fe),ie=a(Fe,"P",{});var So=r(ie);Ms=l(So,"The "),jo=a(So,"A",{href:!0});var ei=r(jo);ws=l(ei,"NllbMoeForConditionalGeneration"),ei.forEach(t),Ts=l(So," forward method, overrides the "),Bt=a(So,"CODE",{});var oi=r(Bt);ks=l(oi,"__call__"),oi.forEach(t),Ns=l(So," special method."),So.forEach(t),$s=p(Fe),v(Ee.$$.fragment,Fe),Es=p(Fe),v(xe.$$.fragment,Fe),Fe.forEach(t),Je.forEach(t),this.h()},h(){i(m,"name","hf:doc:metadata"),i(m,"content",JSON.stringify(mi)),i(g,"id","nllbmoe"),i(g,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),i(g,"href","#nllbmoe"),i(_,"class","relative group"),i(de,"id","overview"),i(de,"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"),i(de,"href","#overview"),i(X,"class","relative group"),i(Ge,"href","https://arxiv.org/abs/2207.04672"),i(Ge,"rel","nofollow"),i(Ze,"href","https://huggingface.co/ArtZucker"),i(Ze,"rel","nofollow"),i(qe,"href","https://github.com/facebookresearch/fairseq"),i(qe,"rel","nofollow"),i(he,"id","implementation-differences-with-switchtransformers"),i(he,"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"),i(he,"href","#implementation-differences-with-switchtransformers"),i(H,"class","relative group"),i(pe,"id","generating-with-nllbmoe"),i(pe,"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"),i(pe,"href","#generating-with-nllbmoe"),i(D,"class","relative group"),i(We,"href","https://github.com/facebookresearch/flores/blob/main/flores200/README.md#languages-in-flores-200"),i(We,"rel","nofollow"),i(ue,"id","generating-from-any-other-language-than-english"),i(ue,"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"),i(ue,"href","#generating-from-any-other-language-than-english"),i(O,"class","relative group"),i(me,"id","documentation-resources"),i(me,"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"),i(me,"href","#documentation-resources"),i(Y,"class","relative group"),i(wo,"href","../tasks/translation"),i(To,"href","../tasks/summarization"),i(ge,"id","transformers.NllbMoeConfig"),i(ge,"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"),i(ge,"href","#transformers.NllbMoeConfig"),i(Q,"class","relative group"),i(ko,"href","/docs/transformers/v4.32.0/en/model_doc/nllb-moe#transformers.NllbMoeModel"),i(Xe,"href","https://huggingface.co/facebook/nllb-moe-54b"),i(Xe,"rel","nofollow"),i(No,"href","/docs/transformers/v4.32.0/en/main_classes/configuration#transformers.PretrainedConfig"),i($o,"href","/docs/transformers/v4.32.0/en/main_classes/configuration#transformers.PretrainedConfig"),i(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(be,"id","transformers.NllbMoeTop2Router"),i(be,"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"),i(be,"href","#transformers.NllbMoeTop2Router"),i(oe,"class","relative group"),i(ye,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(ve,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(Me,"id","transformers.NllbMoeSparseMLP"),i(Me,"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"),i(Me,"href","#transformers.NllbMoeSparseMLP"),i(ne,"class","relative group"),i(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(we,"id","transformers.NllbMoeModel"),i(we,"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"),i(we,"href","#transformers.NllbMoeModel"),i(ae,"class","relative group"),i(Eo,"href","/docs/transformers/v4.32.0/en/main_classes/model#transformers.PreTrainedModel"),i(lo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),i(lo,"rel","nofollow"),i(xo,"href","/docs/transformers/v4.32.0/en/model_doc/nllb-moe#transformers.NllbMoeModel"),i(Co,"href","/docs/transformers/v4.32.0/en/model_doc/nllb-moe#transformers.NllbMoeModel"),i(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i($e,"id","transformers.NllbMoeForConditionalGeneration"),i($e,"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"),i($e,"href","#transformers.NllbMoeForConditionalGeneration"),i(le,"class","relative group"),i(zo,"href","/docs/transformers/v4.32.0/en/main_classes/model#transformers.PreTrainedModel"),i(mo,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),i(mo,"rel","nofollow"),i(jo,"href","/docs/transformers/v4.32.0/en/model_doc/nllb-moe#transformers.NllbMoeForConditionalGeneration"),i(Z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),i(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(o,d){e(document.head,m),u(o,N,d),u(o,_,d),e(_,g),e(g,b),M(c,b,null),e(_,f),e(_,z),e(z,Ln),u(o,At,d),u(o,X,d),e(X,de),e(de,Ao),M(Ue,Ao,null),e(X,Wn),e(X,Po),e(Po,In),u(o,Pt,d),u(o,ce,d),e(ce,Rn),e(ce,Ge),e(Ge,Sn),e(ce,An),u(o,Vt,d),u(o,bo,d),e(bo,Pn),u(o,Xt,d),u(o,yo,d),e(yo,Vo),e(Vo,Vn),u(o,Ht,d),u(o,vo,d),e(vo,Xn),u(o,Dt,d),u(o,I,d),e(I,Xo),e(Xo,Hn),e(I,Dn),e(I,Ho),e(Ho,On),e(I,Yn),e(I,Do),e(Do,Qn),u(o,Ot,d),u(o,R,d),e(R,Kn),e(R,Ze),e(Ze,ea),e(R,oa),e(R,qe),e(qe,ta),e(R,na),u(o,Yt,d),u(o,H,d),e(H,he),e(he,Oo),M(Be,Oo,null),e(H,aa),e(H,Yo),e(Yo,ra),u(o,Qt,d),u(o,D,d),e(D,pe),e(pe,Qo),M(Le,Qo,null),e(D,sa),e(D,Ko),e(Ko,la),u(o,Kt,d),u(o,S,d),e(S,ia),e(S,et),e(et,da),e(S,ca),e(S,ot),e(ot,ha),e(S,pa),u(o,en,d),u(o,A,d),e(A,ua),e(A,tt),e(tt,ma),e(A,fa),e(A,We),e(We,ga),e(A,_a),u(o,on,d),M(Ie,o,d),u(o,tn,d),u(o,O,d),e(O,ue),e(ue,nt),M(Re,nt,null),e(O,ba),e(O,at),e(at,ya),u(o,nn,d),u(o,P,d),e(P,va),e(P,rt),e(rt,Ma),e(P,wa),e(P,st),e(st,Ta),e(P,ka),u(o,an,d),u(o,Mo,d),e(Mo,Na),u(o,rn,d),M(Se,o,d),u(o,sn,d),u(o,Y,d),e(Y,me),e(me,lt),M(Ae,lt,null),e(Y,$a),e(Y,it),e(it,Ea),u(o,ln,d),u(o,fe,d),e(fe,dt),e(dt,wo),e(wo,xa),e(fe,Ca),e(fe,ct),e(ct,To),e(To,za),u(o,dn,d),u(o,Q,d),e(Q,ge),e(ge,ht),M(Pe,ht,null),e(Q,ja),e(Q,pt),e(pt,Ja),u(o,cn,d),u(o,J,d),M(Ve,J,null),e(J,Fa),e(J,K),e(K,Ua),e(K,ko),e(ko,Ga),e(K,Za),e(K,Xe),e(Xe,qa),e(K,Ba),e(J,La),e(J,ee),e(ee,Wa),e(ee,No),e(No,Ia),e(ee,Ra),e(ee,$o),e($o,Sa),e(ee,Aa),e(J,Pa),M(_e,J,null),u(o,hn,d),u(o,oe,d),e(oe,be),e(be,ut),M(He,ut,null),e(oe,Va),e(oe,mt),e(mt,Xa),u(o,pn,d),u(o,$,d),M(De,$,null),e($,Ha),e($,ft),e(ft,Da),e($,Oa),e($,Oe),e(Oe,Ya),e(Oe,gt),e(gt,Qa),e(Oe,Ka),e($,er),e($,_t),e(_t,or),e($,tr),e($,ye),M(Ye,ye,null),e(ye,nr),e(ye,te),e(te,ar),e(te,bt),e(bt,rr),e(te,sr),e(te,yt),e(yt,lr),e(te,ir),e($,dr),e($,ve),M(Qe,ve,null),e(ve,cr),e(ve,vt),e(vt,hr),u(o,un,d),u(o,ne,d),e(ne,Me),e(Me,Mt),M(Ke,Mt,null),e(ne,pr),e(ne,wt),e(wt,ur),u(o,mn,d),u(o,L,d),M(eo,L,null),e(L,mr),e(L,Tt),e(Tt,fr),e(L,gr),e(L,G),M(oo,G,null),e(G,_r),e(G,to),e(to,br),e(to,kt),e(kt,yr),e(to,vr),e(G,Mr),e(G,E),e(E,wr),e(E,Nt),e(Nt,Tr),e(E,kr),e(E,$t),e($t,Nr),e(E,$r),e(E,Et),e(Et,Er),e(E,xr),e(E,xt),e(xt,Cr),e(E,zr),e(E,Ct),e(Ct,jr),e(E,Jr),e(E,zt),e(zt,Fr),e(E,Ur),e(G,Gr),e(G,jt),e(jt,Zr),u(o,fn,d),u(o,ae,d),e(ae,we),e(we,Jt),M(no,Jt,null),e(ae,qr),e(ae,Ft),e(Ft,Br),u(o,gn,d),u(o,F,d),M(ao,F,null),e(F,Lr),e(F,ro),e(ro,Wr),e(ro,Eo),e(Eo,Ir),e(ro,Rr),e(F,Sr),e(F,so),e(so,Ar),e(so,lo),e(lo,Pr),e(so,Vr),e(F,Xr),e(F,x),M(io,x,null),e(x,Hr),e(x,re),e(re,Dr),e(re,xo),e(xo,Or),e(re,Yr),e(re,Ut),e(Ut,Qr),e(re,Kr),e(x,es),M(Te,x,null),e(x,os),e(x,se),e(se,ts),e(se,Co),e(Co,ns),e(se,as),e(se,Gt),e(Gt,rs),e(se,ss),e(x,ls),M(ke,x,null),e(x,is),M(Ne,x,null),u(o,_n,d),u(o,le,d),e(le,$e),e($e,Zt),M(co,Zt,null),e(le,ds),e(le,qt),e(qt,cs),u(o,bn,d),u(o,U,d),M(ho,U,null),e(U,hs),e(U,po),e(po,ps),e(po,zo),e(zo,us),e(po,ms),e(U,fs),e(U,uo),e(uo,gs),e(uo,mo),e(mo,_s),e(uo,bs),e(U,ys),e(U,Z),M(fo,Z,null),e(Z,vs),e(Z,ie),e(ie,Ms),e(ie,jo),e(jo,ws),e(ie,Ts),e(ie,Bt),e(Bt,ks),e(ie,Ns),e(Z,$s),M(Ee,Z,null),e(Z,Es),M(xe,Z,null),yn=!0},p(o,[d]){const go={};d&2&&(go.$$scope={dirty:d,ctx:o}),_e.$set(go);const Lt={};d&2&&(Lt.$$scope={dirty:d,ctx:o}),Te.$set(Lt);const Wt={};d&2&&(Wt.$$scope={dirty:d,ctx:o}),ke.$set(Wt);const It={};d&2&&(It.$$scope={dirty:d,ctx:o}),Ne.$set(It);const _o={};d&2&&(_o.$$scope={dirty:d,ctx:o}),Ee.$set(_o);const Rt={};d&2&&(Rt.$$scope={dirty:d,ctx:o}),xe.$set(Rt)},i(o){yn||(w(c.$$.fragment,o),w(Ue.$$.fragment,o),w(Be.$$.fragment,o),w(Le.$$.fragment,o),w(Ie.$$.fragment,o),w(Re.$$.fragment,o),w(Se.$$.fragment,o),w(Ae.$$.fragment,o),w(Pe.$$.fragment,o),w(Ve.$$.fragment,o),w(_e.$$.fragment,o),w(He.$$.fragment,o),w(De.$$.fragment,o),w(Ye.$$.fragment,o),w(Qe.$$.fragment,o),w(Ke.$$.fragment,o),w(eo.$$.fragment,o),w(oo.$$.fragment,o),w(no.$$.fragment,o),w(ao.$$.fragment,o),w(io.$$.fragment,o),w(Te.$$.fragment,o),w(ke.$$.fragment,o),w(Ne.$$.fragment,o),w(co.$$.fragment,o),w(ho.$$.fragment,o),w(fo.$$.fragment,o),w(Ee.$$.fragment,o),w(xe.$$.fragment,o),yn=!0)},o(o){T(c.$$.fragment,o),T(Ue.$$.fragment,o),T(Be.$$.fragment,o),T(Le.$$.fragment,o),T(Ie.$$.fragment,o),T(Re.$$.fragment,o),T(Se.$$.fragment,o),T(Ae.$$.fragment,o),T(Pe.$$.fragment,o),T(Ve.$$.fragment,o),T(_e.$$.fragment,o),T(He.$$.fragment,o),T(De.$$.fragment,o),T(Ye.$$.fragment,o),T(Qe.$$.fragment,o),T(Ke.$$.fragment,o),T(eo.$$.fragment,o),T(oo.$$.fragment,o),T(no.$$.fragment,o),T(ao.$$.fragment,o),T(io.$$.fragment,o),T(Te.$$.fragment,o),T(ke.$$.fragment,o),T(Ne.$$.fragment,o),T(co.$$.fragment,o),T(ho.$$.fragment,o),T(fo.$$.fragment,o),T(Ee.$$.fragment,o),T(xe.$$.fragment,o),yn=!1},d(o){t(m),o&&t(N),o&&t(_),k(c),o&&t(At),o&&t(X),k(Ue),o&&t(Pt),o&&t(ce),o&&t(Vt),o&&t(bo),o&&t(Xt),o&&t(yo),o&&t(Ht),o&&t(vo),o&&t(Dt),o&&t(I),o&&t(Ot),o&&t(R),o&&t(Yt),o&&t(H),k(Be),o&&t(Qt),o&&t(D),k(Le),o&&t(Kt),o&&t(S),o&&t(en),o&&t(A),o&&t(on),k(Ie,o),o&&t(tn),o&&t(O),k(Re),o&&t(nn),o&&t(P),o&&t(an),o&&t(Mo),o&&t(rn),k(Se,o),o&&t(sn),o&&t(Y),k(Ae),o&&t(ln),o&&t(fe),o&&t(dn),o&&t(Q),k(Pe),o&&t(cn),o&&t(J),k(Ve),k(_e),o&&t(hn),o&&t(oe),k(He),o&&t(pn),o&&t($),k(De),k(Ye),k(Qe),o&&t(un),o&&t(ne),k(Ke),o&&t(mn),o&&t(L),k(eo),k(oo),o&&t(fn),o&&t(ae),k(no),o&&t(gn),o&&t(F),k(ao),k(io),k(Te),k(ke),k(Ne),o&&t(_n),o&&t(le),k(co),o&&t(bn),o&&t(U),k(ho),k(fo),k(Ee),k(xe)}}}const mi={local:"nllbmoe",sections:[{local:"overview",title:"Overview"},{local:"implementation-differences-with-switchtransformers",title:"Implementation differences with SwitchTransformers"},{local:"generating-with-nllbmoe",sections:[{local:"generating-from-any-other-language-than-english",title:"Generating from any other language than English"}],title:"Generating with NLLB-MoE"},{local:"documentation-resources",title:"Documentation resources"},{local:"transformers.NllbMoeConfig",title:"NllbMoeConfig"},{local:"transformers.NllbMoeTop2Router",title:"NllbMoeTop2Router"},{local:"transformers.NllbMoeSparseMLP",title:"NllbMoeSparseMLP"},{local:"transformers.NllbMoeModel",title:"NllbMoeModel"},{local:"transformers.NllbMoeForConditionalGeneration",title:"NllbMoeForConditionalGeneration"}],title:"NLLB-MOE"};function fi(C){return si(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class wi extends ti{constructor(m){super();ni(this,m,fi,ui,ai,{})}}export{wi as default,mi as metadata};
