import{s as ja,o as za,n as jt}from"../chunks/scheduler.9bc65507.js";import{S as Ja,i as Ua,g as n,s as r,u as g,m as Na,A as Fa,h as a,f as t,c as l,j as u,v as _,y as p,n as Ca,k as c,o,a as i,w as b,d as v,t as y,x as M}from"../chunks/index.78c82d43.js";import{T as Mn}from"../chunks/Tip.87d55b76.js";import{D as q}from"../chunks/Docstring.4e7352e2.js";import{C as Pt}from"../chunks/CodeBlock.73e038be.js";import{I as L}from"../chunks/IconCopyLink.bedaa44d.js";import{E as Tn}from"../chunks/ExampleCodeBlock.872b014d.js";function Za(N){let d,w="Example:",m,f,T;return f=new Pt({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`,wrap:!1}}),{c(){d=n("p"),d.textContent=w,m=r(),g(f.$$.fragment)},l(h){d=a(h,"P",{"data-svelte-h":!0}),p(d)!=="svelte-11lpom8"&&(d.textContent=w),m=l(h),_(f.$$.fragment,h)},m(h,k){i(h,d,k),i(h,m,k),b(f,h,k),T=!0},p:jt,i(h){T||(v(f.$$.fragment,h),T=!0)},o(h){y(f.$$.fragment,h),T=!1},d(h){h&&(t(d),t(m)),M(f,h)}}}function Ga(N){let d,w=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){d=n("p"),d.innerHTML=w},l(m){d=a(m,"P",{"data-svelte-h":!0}),p(d)!=="svelte-fincs2"&&(d.innerHTML=w)},m(m,f){i(m,d,f)},p:jt,d(m){m&&t(d)}}}function La(N){let d,w=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){d=n("p"),d.innerHTML=w},l(m){d=a(m,"P",{"data-svelte-h":!0}),p(d)!=="svelte-fincs2"&&(d.innerHTML=w)},m(m,f){i(m,d,f)},p:jt,d(m){m&&t(d)}}}function qa(N){let d,w="Example:",m,f,T;return f=new Pt({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`,wrap:!1}}),{c(){d=n("p"),d.textContent=w,m=r(),g(f.$$.fragment)},l(h){d=a(h,"P",{"data-svelte-h":!0}),p(d)!=="svelte-11lpom8"&&(d.textContent=w),m=l(h),_(f.$$.fragment,h)},m(h,k){i(h,d,k),i(h,m,k),b(f,h,k),T=!0},p:jt,i(h){T||(v(f.$$.fragment,h),T=!0)},o(h){y(f.$$.fragment,h),T=!1},d(h){h&&(t(d),t(m)),M(f,h)}}}function Wa(N){let d,w=`Although the recipe for forward pass needs to be defined within this function, one should call the <code>Module</code>
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`;return{c(){d=n("p"),d.innerHTML=w},l(m){d=a(m,"P",{"data-svelte-h":!0}),p(d)!=="svelte-fincs2"&&(d.innerHTML=w)},m(m,f){i(m,d,f)},p:jt,d(m){m&&t(d)}}}function Ea(N){let d,w="Translation example:",m,f,T;return f=new Pt({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>))`,wrap:!1}}),{c(){d=n("p"),d.textContent=w,m=r(),g(f.$$.fragment)},l(h){d=a(h,"P",{"data-svelte-h":!0}),p(d)!=="svelte-g2jatv"&&(d.textContent=w),m=l(h),_(f.$$.fragment,h)},m(h,k){i(h,d,k),i(h,m,k),b(f,h,k),T=!0},p:jt,i(h){T||(v(f.$$.fragment,h),T=!0)},o(h){y(f.$$.fragment,h),T=!1},d(h){h&&(t(d),t(m)),M(f,h)}}}function Ba(N){let d,w,m,f,T,h,k,_e,Zo,Ke,wn="NLLB-MOE",Vt,W,A,zt,be,Go,et,kn="Overview",Xt,ve,xn=`The NLLB model was presented in <a href="https://arxiv.org/abs/2207.04672" rel="nofollow">No Language Left Behind: Scaling Human-Centered Machine Translation</a> by Marta R. Costa-jussà, James Cross, Onur Çelebi,
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án, Philipp Koehn, Alexandre Mourachko, Christophe Ropers,
Safiyyah Saleem, Holger Schwenk, and Jeff Wang.`,At,ye,$n="The abstract of the paper is the following:",Yt,Me,Nn=`<em>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.</em>`,Dt,Te,Cn="Tips:",Ot,we,jn="<li>M2M100ForConditionalGeneration is the base model for both NLLB and NLLB MoE</li> <li>The NLLB-MoE is very similar to the NLLB model, but it’s feed forward layer is based on the implementation of SwitchTransformers.</li> <li>The tokenizer is the same as the NLLB models.</li>",Qt,ke,zn=`This model was contributed by <a href="https://huggingface.co/ArtZucker" rel="nofollow">Arthur Zucker</a>.
The original code can be found <a href="https://github.com/facebookresearch/fairseq" rel="nofollow">here</a>.`,Kt,E,Y,Jt,xe,Lo,tt,Jn="Implementation differences with SwitchTransformers",eo,B,D,Ut,$e,qo,ot,Un="Generating with NLLB-MoE",to,Ne,Fn=`While generating the target text set the <code>forced_bos_token_id</code> to the target language id. The following
example shows how to translate English to French using the <em>facebook/nllb-200-distilled-600M</em> model.`,oo,Ce,Zn=`Note that we’re using the BCP-47 code for French <code>fra_Latn</code>. See <a href="https://github.com/facebookresearch/flores/blob/main/flores200/README.md#languages-in-flores-200" rel="nofollow">here</a>
for the list of all BCP-47 in the Flores 200 dataset.`,no,je,ao,R,O,Ft,ze,Wo,nt,Gn="Generating from any other language than English",so,Je,Ln=`English (<code>eng_Latn</code>) is set as the default language from which to translate. In order to specify that you’d like to translate from a different language,
you should specify the BCP-47 code in the <code>src_lang</code> keyword argument of the tokenizer initialization.`,ro,Ue,qn="See example below for a translation from romanian to german:",lo,Fe,io,I,Q,Zt,Ze,Eo,at,Wn="Documentation resources",co,Ge,En='<li><a href="../tasks/translation">Translation task guide</a></li> <li><a href="../tasks/summarization">Summarization task guide</a></li>',ho,H,K,Gt,Le,Bo,st,Bn="NllbMoeConfig",po,C,qe,Ro,rt,Rn=`This is the configuration class to store the configuration of a <a href="/docs/transformers/v4.34.0/en/model_doc/nllb-moe#transformers.NllbMoeModel">NllbMoeModel</a>. 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
<a href="https://huggingface.co/facebook/nllb-moe-54b" rel="nofollow">facebook/nllb-moe-54b</a> architecture.`,Io,lt,In=`Configuration objects inherit from <a href="/docs/transformers/v4.34.0/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> and can be used to control the model outputs. Read the
documentation from <a href="/docs/transformers/v4.34.0/en/main_classes/configuration#transformers.PretrainedConfig">PretrainedConfig</a> for more information.`,Ho,ee,uo,S,te,Lt,We,So,it,Hn="NllbMoeTop2Router",mo,x,Ee,Po,dt,Sn="Router using tokens choose top-2 experts assignment.",Vo,ct,Pn=`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’s expert_capacity is reached. <strong>There is no guarantee
that each token is processed by an expert</strong>, or that each expert receives at least one token.`,Xo,ht,Vn="The router combining weights are also returned to make sure that the states that are not updated will be masked.",Ao,oe,Be,Yo,pt,Xn=`Computes the <code>dispatch_mask</code> and the <code>dispatch_weights</code> for each experts. The masks are adapted to the expert
capacity.`,Do,ne,Re,Oo,ut,An=`The hidden states are reshaped to simplify the computation of the router probabilities (combining weights for
each experts.)`,fo,P,ae,qt,Ie,Qo,mt,Yn="NllbMoeSparseMLP",go,G,He,Ko,ft,Dn="Implementation of the NLLB-MoE sparse MLP module.",en,J,Se,tn,gt,On=`The goal of this forward pass is to have the same number of operation as the equivalent <code>NllbMoeDenseActDense</code>
(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).`,on,_t,Qn=`1- Get the <code>router_probs</code> from the <code>router</code>. The shape of the <code>router_mask</code> is <code>(batch_size X sequence_length, num_expert)</code> and corresponds to the boolean version of the <code>router_probs</code>. The inputs are masked using the
<code>router_mask</code>.`,nn,bt,Kn=`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.`,_o,V,se,Wt,Pe,an,vt,ea="NllbMoeModel",bo,j,Ve,sn,yt,ta=`The bare NllbMoe Model outputting raw hidden-states without any specific head on top.
This model inherits from <a href="/docs/transformers/v4.34.0/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. 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.)`,rn,Mt,oa=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`,ln,$,Xe,dn,Tt,na='The <a href="/docs/transformers/v4.34.0/en/model_doc/nllb-moe#transformers.NllbMoeModel">NllbMoeModel</a> forward method, overrides the <code>__call__</code> special method.',cn,re,hn,wt,aa='The <a href="/docs/transformers/v4.34.0/en/model_doc/nllb-moe#transformers.NllbMoeModel">NllbMoeModel</a> forward method, overrides the <code>__call__</code> special method.',pn,le,un,ie,vo,X,de,Et,Ae,mn,kt,sa="NllbMoeForConditionalGeneration",yo,z,Ye,fn,xt,ra=`The NllbMoe Model with a language modeling head. Can be used for summarization.
This model inherits from <a href="/docs/transformers/v4.34.0/en/main_classes/model#transformers.PreTrainedModel">PreTrainedModel</a>. 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.)`,gn,$t,la=`This model is also a PyTorch <a href="https://pytorch.org/docs/stable/nn.html#torch.nn.Module" rel="nofollow">torch.nn.Module</a> subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`,_n,U,De,bn,Nt,ia='The <a href="/docs/transformers/v4.34.0/en/model_doc/nllb-moe#transformers.NllbMoeForConditionalGeneration">NllbMoeForConditionalGeneration</a> forward method, overrides the <code>__call__</code> special method.',vn,ce,yn,he,Mo,Bt,To;return _e=new L({}),be=new L({}),xe=new L({}),$e=new L({}),je=new Pt({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été avait commencé lorsque sa sonnette n&#x27;était pas audible depuis son magasin dans son garage.&quot;</span>`,wrap:!1}}),ze=new L({}),Fe=new Pt({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;Şeful ONU spune că nu există o soluţie militară în 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>]`,wrap:!1}}),Ze=new L({}),Le=new L({}),qe=new q({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.34.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.34.0/src/transformers/models/nllb_moe/configuration_nllb_moe.py#L27"}}),ee=new Tn({props:{anchor:"transformers.NllbMoeConfig.example",$$slots:{default:[Za]},$$scope:{ctx:N}}}),We=new L({}),Ee=new q({props:{name:"class transformers.NllbMoeTop2Router",anchor:"transformers.NllbMoeTop2Router",parameters:[{name:"config",val:": NllbMoeConfig"}],source:"https://github.com/huggingface/transformers/blob/v4.34.0/src/transformers/models/nllb_moe/modeling_nllb_moe.py#L250"}}),Be=new q({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.34.0/src/transformers/models/nllb_moe/modeling_nllb_moe.py#L291"}}),Re=new q({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.34.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>
`}}),Ie=new L({}),He=new q({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.34.0/src/transformers/models/nllb_moe/modeling_nllb_moe.py#L427"}}),Se=new q({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.34.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>
`}}),Pe=new L({}),Ve=new q({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.34.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.34.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.34.0/src/transformers/models/nllb_moe/modeling_nllb_moe.py#L1508"}}),Xe=new q({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.34.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.34.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>) — 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>) — 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>) — 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>) — 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>) — 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>) — 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’s 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>) — 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>) — 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>) — 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>) — 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>
`}}),re=new Mn({props:{$$slots:{default:[Ga]},$$scope:{ctx:N}}}),le=new Mn({props:{$$slots:{default:[La]},$$scope:{ctx:N}}}),ie=new Tn({props:{anchor:"transformers.NllbMoeModel.forward.example",$$slots:{default:[qa]},$$scope:{ctx:N}}}),Ae=new L({}),Ye=new q({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.34.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.34.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.34.0/src/transformers/models/nllb_moe/modeling_nllb_moe.py#L1640"}}),De=new q({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.34.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.34.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.34.0/en/model_doc/vits#transformers.VitsTokenizer.__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.34.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.34.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.34.0/en/model_doc/vits#transformers.VitsTokenizer.__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.34.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.34.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.34.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) — 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>) — 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>) — 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>) — 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>) — 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>) — 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>) — 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’s 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>) — 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>) — 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>) — 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>) — 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>
`}}),ce=new Mn({props:{$$slots:{default:[Wa]},$$scope:{ctx:N}}}),he=new Tn({props:{anchor:"transformers.NllbMoeForConditionalGeneration.forward.example",$$slots:{default:[Ea]},$$scope:{ctx:N}}}),{c(){d=n("meta"),w=r(),m=n("p"),f=r(),T=n("h1"),h=n("a"),k=n("span"),g(_e.$$.fragment),Zo=r(),Ke=n("span"),Ke.textContent=wn,Vt=r(),W=n("h2"),A=n("a"),zt=n("span"),g(be.$$.fragment),Go=r(),et=n("span"),et.textContent=kn,Xt=r(),ve=n("p"),ve.innerHTML=xn,At=r(),ye=n("p"),ye.textContent=$n,Yt=r(),Me=n("p"),Me.innerHTML=Nn,Dt=r(),Te=n("p"),Te.textContent=Cn,Ot=r(),we=n("ul"),we.innerHTML=jn,Qt=r(),ke=n("p"),ke.innerHTML=zn,Kt=r(),E=n("h2"),Y=n("a"),Jt=n("span"),g(xe.$$.fragment),Lo=r(),tt=n("span"),tt.textContent=Jn,eo=Na("\n\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"),B=n("h2"),D=n("a"),Ut=n("span"),g($e.$$.fragment),qo=r(),ot=n("span"),ot.textContent=Un,to=Na(`


The avalable checkpoints requires around 350GB of storage. Make sure to use \`accelerate\` if you do not have enough RAM on your machine.
`),Ne=n("p"),Ne.innerHTML=Fn,oo=r(),Ce=n("p"),Ce.innerHTML=Zn,no=r(),g(je.$$.fragment),ao=r(),R=n("h3"),O=n("a"),Ft=n("span"),g(ze.$$.fragment),Wo=r(),nt=n("span"),nt.textContent=Gn,so=r(),Je=n("p"),Je.innerHTML=Ln,ro=r(),Ue=n("p"),Ue.textContent=qn,lo=r(),g(Fe.$$.fragment),io=r(),I=n("h2"),Q=n("a"),Zt=n("span"),g(Ze.$$.fragment),Eo=r(),at=n("span"),at.textContent=Wn,co=r(),Ge=n("ul"),Ge.innerHTML=En,ho=r(),H=n("h2"),K=n("a"),Gt=n("span"),g(Le.$$.fragment),Bo=r(),st=n("span"),st.textContent=Bn,po=r(),C=n("div"),g(qe.$$.fragment),Ro=r(),rt=n("p"),rt.innerHTML=Rn,Io=r(),lt=n("p"),lt.innerHTML=In,Ho=r(),g(ee.$$.fragment),uo=r(),S=n("h2"),te=n("a"),Lt=n("span"),g(We.$$.fragment),So=r(),it=n("span"),it.textContent=Hn,mo=r(),x=n("div"),g(Ee.$$.fragment),Po=r(),dt=n("p"),dt.textContent=Sn,Vo=r(),ct=n("p"),ct.innerHTML=Pn,Xo=r(),ht=n("p"),ht.textContent=Vn,Ao=r(),oe=n("div"),g(Be.$$.fragment),Yo=r(),pt=n("p"),pt.innerHTML=Xn,Do=r(),ne=n("div"),g(Re.$$.fragment),Oo=r(),ut=n("p"),ut.textContent=An,fo=r(),P=n("h2"),ae=n("a"),qt=n("span"),g(Ie.$$.fragment),Qo=r(),mt=n("span"),mt.textContent=Yn,go=r(),G=n("div"),g(He.$$.fragment),Ko=r(),ft=n("p"),ft.textContent=Dn,en=r(),J=n("div"),g(Se.$$.fragment),tn=r(),gt=n("p"),gt.innerHTML=On,on=r(),_t=n("p"),_t.innerHTML=Qn,nn=r(),bt=n("p"),bt.textContent=Kn,_o=r(),V=n("h2"),se=n("a"),Wt=n("span"),g(Pe.$$.fragment),an=r(),vt=n("span"),vt.textContent=ea,bo=r(),j=n("div"),g(Ve.$$.fragment),sn=r(),yt=n("p"),yt.innerHTML=ta,rn=r(),Mt=n("p"),Mt.innerHTML=oa,ln=r(),$=n("div"),g(Xe.$$.fragment),dn=r(),Tt=n("p"),Tt.innerHTML=na,cn=r(),g(re.$$.fragment),hn=r(),wt=n("p"),wt.innerHTML=aa,pn=r(),g(le.$$.fragment),un=r(),g(ie.$$.fragment),vo=r(),X=n("h2"),de=n("a"),Et=n("span"),g(Ae.$$.fragment),mn=r(),kt=n("span"),kt.textContent=sa,yo=r(),z=n("div"),g(Ye.$$.fragment),fn=r(),xt=n("p"),xt.innerHTML=ra,gn=r(),$t=n("p"),$t.innerHTML=la,_n=r(),U=n("div"),g(De.$$.fragment),bn=r(),Nt=n("p"),Nt.innerHTML=ia,vn=r(),g(ce.$$.fragment),yn=r(),g(he.$$.fragment),Mo=r(),Bt=n("p"),this.h()},l(e){const s=Fa("svelte-1phssyn",document.head);d=a(s,"META",{name:!0,content:!0}),s.forEach(t),w=l(e),m=a(e,"P",{}),u(m).forEach(t),f=l(e),T=a(e,"H1",{class:!0});var Oe=u(T);h=a(Oe,"A",{id:!0,class:!0,href:!0});var Rt=u(h);k=a(Rt,"SPAN",{});var It=u(k);_(_e.$$.fragment,It),It.forEach(t),Rt.forEach(t),Zo=l(Oe),Ke=a(Oe,"SPAN",{"data-svelte-h":!0}),p(Ke)!=="svelte-1gv2wnn"&&(Ke.textContent=wn),Oe.forEach(t),Vt=l(e),W=a(e,"H2",{class:!0});var Qe=u(W);A=a(Qe,"A",{id:!0,class:!0,href:!0});var Ht=u(A);zt=a(Ht,"SPAN",{});var St=u(zt);_(be.$$.fragment,St),St.forEach(t),Ht.forEach(t),Go=l(Qe),et=a(Qe,"SPAN",{"data-svelte-h":!0}),p(et)!=="svelte-1jsw1pg"&&(et.textContent=kn),Qe.forEach(t),Xt=l(e),ve=a(e,"P",{"data-svelte-h":!0}),p(ve)!=="svelte-12x4cpm"&&(ve.innerHTML=xn),At=l(e),ye=a(e,"P",{"data-svelte-h":!0}),p(ye)!=="svelte-wu27l3"&&(ye.textContent=$n),Yt=l(e),Me=a(e,"P",{"data-svelte-h":!0}),p(Me)!=="svelte-1j7uypk"&&(Me.innerHTML=Nn),Dt=l(e),Te=a(e,"P",{"data-svelte-h":!0}),p(Te)!=="svelte-axv494"&&(Te.textContent=Cn),Ot=l(e),we=a(e,"UL",{"data-svelte-h":!0}),p(we)!=="svelte-1d7jqov"&&(we.innerHTML=jn),Qt=l(e),ke=a(e,"P",{"data-svelte-h":!0}),p(ke)!=="svelte-1kcuzpy"&&(ke.innerHTML=zn),Kt=l(e),E=a(e,"H2",{class:!0});var wo=u(E);Y=a(wo,"A",{id:!0,class:!0,href:!0});var da=u(Y);Jt=a(da,"SPAN",{});var ca=u(Jt);_(xe.$$.fragment,ca),ca.forEach(t),da.forEach(t),Lo=l(wo),tt=a(wo,"SPAN",{"data-svelte-h":!0}),p(tt)!=="svelte-cvm3xf"&&(tt.textContent=Jn),wo.forEach(t),eo=Ca(e,"\n\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"),B=a(e,"H2",{class:!0});var ko=u(B);D=a(ko,"A",{id:!0,class:!0,href:!0});var ha=u(D);Ut=a(ha,"SPAN",{});var pa=u(Ut);_($e.$$.fragment,pa),pa.forEach(t),ha.forEach(t),qo=l(ko),ot=a(ko,"SPAN",{"data-svelte-h":!0}),p(ot)!=="svelte-1bkwvu3"&&(ot.textContent=Un),ko.forEach(t),to=Ca(e,`


The avalable checkpoints requires around 350GB of storage. Make sure to use \`accelerate\` if you do not have enough RAM on your machine.
`),Ne=a(e,"P",{"data-svelte-h":!0}),p(Ne)!=="svelte-gz9jek"&&(Ne.innerHTML=Fn),oo=l(e),Ce=a(e,"P",{"data-svelte-h":!0}),p(Ce)!=="svelte-c2ujwv"&&(Ce.innerHTML=Zn),no=l(e),_(je.$$.fragment,e),ao=l(e),R=a(e,"H3",{class:!0});var xo=u(R);O=a(xo,"A",{id:!0,class:!0,href:!0});var ua=u(O);Ft=a(ua,"SPAN",{});var ma=u(Ft);_(ze.$$.fragment,ma),ma.forEach(t),ua.forEach(t),Wo=l(xo),nt=a(xo,"SPAN",{"data-svelte-h":!0}),p(nt)!=="svelte-1pd6l2"&&(nt.textContent=Gn),xo.forEach(t),so=l(e),Je=a(e,"P",{"data-svelte-h":!0}),p(Je)!=="svelte-ets0jr"&&(Je.innerHTML=Ln),ro=l(e),Ue=a(e,"P",{"data-svelte-h":!0}),p(Ue)!=="svelte-14hvt1f"&&(Ue.textContent=qn),lo=l(e),_(Fe.$$.fragment,e),io=l(e),I=a(e,"H2",{class:!0});var $o=u(I);Q=a($o,"A",{id:!0,class:!0,href:!0});var fa=u(Q);Zt=a(fa,"SPAN",{});var ga=u(Zt);_(Ze.$$.fragment,ga),ga.forEach(t),fa.forEach(t),Eo=l($o),at=a($o,"SPAN",{"data-svelte-h":!0}),p(at)!=="svelte-n3f0j0"&&(at.textContent=Wn),$o.forEach(t),co=l(e),Ge=a(e,"UL",{"data-svelte-h":!0}),p(Ge)!=="svelte-6ej6p2"&&(Ge.innerHTML=En),ho=l(e),H=a(e,"H2",{class:!0});var No=u(H);K=a(No,"A",{id:!0,class:!0,href:!0});var _a=u(K);Gt=a(_a,"SPAN",{});var ba=u(Gt);_(Le.$$.fragment,ba),ba.forEach(t),_a.forEach(t),Bo=l(No),st=a(No,"SPAN",{"data-svelte-h":!0}),p(st)!=="svelte-3e2sqa"&&(st.textContent=Bn),No.forEach(t),po=l(e),C=a(e,"DIV",{class:!0});var pe=u(C);_(qe.$$.fragment,pe),Ro=l(pe),rt=a(pe,"P",{"data-svelte-h":!0}),p(rt)!=="svelte-zi7zwj"&&(rt.innerHTML=Rn),Io=l(pe),lt=a(pe,"P",{"data-svelte-h":!0}),p(lt)!=="svelte-10kqkkl"&&(lt.innerHTML=In),Ho=l(pe),_(ee.$$.fragment,pe),pe.forEach(t),uo=l(e),S=a(e,"H2",{class:!0});var Co=u(S);te=a(Co,"A",{id:!0,class:!0,href:!0});var va=u(te);Lt=a(va,"SPAN",{});var ya=u(Lt);_(We.$$.fragment,ya),ya.forEach(t),va.forEach(t),So=l(Co),it=a(Co,"SPAN",{"data-svelte-h":!0}),p(it)!=="svelte-1i2rgpa"&&(it.textContent=Hn),Co.forEach(t),mo=l(e),x=a(e,"DIV",{class:!0});var F=u(x);_(Ee.$$.fragment,F),Po=l(F),dt=a(F,"P",{"data-svelte-h":!0}),p(dt)!=="svelte-1j1lh5i"&&(dt.textContent=Sn),Vo=l(F),ct=a(F,"P",{"data-svelte-h":!0}),p(ct)!=="svelte-ov8d9x"&&(ct.innerHTML=Pn),Xo=l(F),ht=a(F,"P",{"data-svelte-h":!0}),p(ht)!=="svelte-1wf6mr8"&&(ht.textContent=Vn),Ao=l(F),oe=a(F,"DIV",{class:!0});var jo=u(oe);_(Be.$$.fragment,jo),Yo=l(jo),pt=a(jo,"P",{"data-svelte-h":!0}),p(pt)!=="svelte-xjs57s"&&(pt.innerHTML=Xn),jo.forEach(t),Do=l(F),ne=a(F,"DIV",{class:!0});var zo=u(ne);_(Re.$$.fragment,zo),Oo=l(zo),ut=a(zo,"P",{"data-svelte-h":!0}),p(ut)!=="svelte-19860ws"&&(ut.textContent=An),zo.forEach(t),F.forEach(t),fo=l(e),P=a(e,"H2",{class:!0});var Jo=u(P);ae=a(Jo,"A",{id:!0,class:!0,href:!0});var Ma=u(ae);qt=a(Ma,"SPAN",{});var Ta=u(qt);_(Ie.$$.fragment,Ta),Ta.forEach(t),Ma.forEach(t),Qo=l(Jo),mt=a(Jo,"SPAN",{"data-svelte-h":!0}),p(mt)!=="svelte-1fzxvav"&&(mt.textContent=Yn),Jo.forEach(t),go=l(e),G=a(e,"DIV",{class:!0});var Ct=u(G);_(He.$$.fragment,Ct),Ko=l(Ct),ft=a(Ct,"P",{"data-svelte-h":!0}),p(ft)!=="svelte-35dv9n"&&(ft.textContent=Dn),en=l(Ct),J=a(Ct,"DIV",{class:!0});var ue=u(J);_(Se.$$.fragment,ue),tn=l(ue),gt=a(ue,"P",{"data-svelte-h":!0}),p(gt)!=="svelte-znv5vs"&&(gt.innerHTML=On),on=l(ue),_t=a(ue,"P",{"data-svelte-h":!0}),p(_t)!=="svelte-bpke9a"&&(_t.innerHTML=Qn),nn=l(ue),bt=a(ue,"P",{"data-svelte-h":!0}),p(bt)!=="svelte-t4vd7i"&&(bt.textContent=Kn),ue.forEach(t),Ct.forEach(t),_o=l(e),V=a(e,"H2",{class:!0});var Uo=u(V);se=a(Uo,"A",{id:!0,class:!0,href:!0});var wa=u(se);Wt=a(wa,"SPAN",{});var ka=u(Wt);_(Pe.$$.fragment,ka),ka.forEach(t),wa.forEach(t),an=l(Uo),vt=a(Uo,"SPAN",{"data-svelte-h":!0}),p(vt)!=="svelte-t0hlgt"&&(vt.textContent=ea),Uo.forEach(t),bo=l(e),j=a(e,"DIV",{class:!0});var me=u(j);_(Ve.$$.fragment,me),sn=l(me),yt=a(me,"P",{"data-svelte-h":!0}),p(yt)!=="svelte-1medwep"&&(yt.innerHTML=ta),rn=l(me),Mt=a(me,"P",{"data-svelte-h":!0}),p(Mt)!=="svelte-hswkmf"&&(Mt.innerHTML=oa),ln=l(me),$=a(me,"DIV",{class:!0});var Z=u($);_(Xe.$$.fragment,Z),dn=l(Z),Tt=a(Z,"P",{"data-svelte-h":!0}),p(Tt)!=="svelte-1a6a7nj"&&(Tt.innerHTML=na),cn=l(Z),_(re.$$.fragment,Z),hn=l(Z),wt=a(Z,"P",{"data-svelte-h":!0}),p(wt)!=="svelte-1a6a7nj"&&(wt.innerHTML=aa),pn=l(Z),_(le.$$.fragment,Z),un=l(Z),_(ie.$$.fragment,Z),Z.forEach(t),me.forEach(t),vo=l(e),X=a(e,"H2",{class:!0});var Fo=u(X);de=a(Fo,"A",{id:!0,class:!0,href:!0});var xa=u(de);Et=a(xa,"SPAN",{});var $a=u(Et);_(Ae.$$.fragment,$a),$a.forEach(t),xa.forEach(t),mn=l(Fo),kt=a(Fo,"SPAN",{"data-svelte-h":!0}),p(kt)!=="svelte-1bjd0cn"&&(kt.textContent=sa),Fo.forEach(t),yo=l(e),z=a(e,"DIV",{class:!0});var fe=u(z);_(Ye.$$.fragment,fe),fn=l(fe),xt=a(fe,"P",{"data-svelte-h":!0}),p(xt)!=="svelte-1ybckzf"&&(xt.innerHTML=ra),gn=l(fe),$t=a(fe,"P",{"data-svelte-h":!0}),p($t)!=="svelte-hswkmf"&&($t.innerHTML=la),_n=l(fe),U=a(fe,"DIV",{class:!0});var ge=u(U);_(De.$$.fragment,ge),bn=l(ge),Nt=a(ge,"P",{"data-svelte-h":!0}),p(Nt)!=="svelte-1lp2iif"&&(Nt.innerHTML=ia),vn=l(ge),_(ce.$$.fragment,ge),yn=l(ge),_(he.$$.fragment,ge),ge.forEach(t),fe.forEach(t),Mo=l(e),Bt=a(e,"P",{}),u(Bt).forEach(t),this.h()},h(){c(d,"name","hf:doc:metadata"),c(d,"content",JSON.stringify(Ra)),c(h,"id","nllbmoe"),c(h,"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"),c(h,"href","#nllbmoe"),c(T,"class","relative group"),c(A,"id","overview"),c(A,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(A,"href","#overview"),c(W,"class","relative group"),c(Y,"id","implementation-differences-with-switchtransformers"),c(Y,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(Y,"href","#implementation-differences-with-switchtransformers"),c(E,"class","relative group"),c(D,"id","generating-with-nllbmoe"),c(D,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(D,"href","#generating-with-nllbmoe"),c(B,"class","relative group"),c(O,"id","generating-from-any-other-language-than-english"),c(O,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(O,"href","#generating-from-any-other-language-than-english"),c(R,"class","relative group"),c(Q,"id","documentation-resources"),c(Q,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(Q,"href","#documentation-resources"),c(I,"class","relative group"),c(K,"id","transformers.NllbMoeConfig"),c(K,"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"),c(K,"href","#transformers.NllbMoeConfig"),c(H,"class","relative group"),c(C,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(te,"id","transformers.NllbMoeTop2Router"),c(te,"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"),c(te,"href","#transformers.NllbMoeTop2Router"),c(S,"class","relative group"),c(oe,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(ne,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(x,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(ae,"id","transformers.NllbMoeSparseMLP"),c(ae,"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"),c(ae,"href","#transformers.NllbMoeSparseMLP"),c(P,"class","relative group"),c(J,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(G,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(se,"id","transformers.NllbMoeModel"),c(se,"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"),c(se,"href","#transformers.NllbMoeModel"),c(V,"class","relative group"),c($,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(de,"id","transformers.NllbMoeForConditionalGeneration"),c(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"),c(de,"href","#transformers.NllbMoeForConditionalGeneration"),c(X,"class","relative group"),c(U,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),c(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(e,s){o(document.head,d),i(e,w,s),i(e,m,s),i(e,f,s),i(e,T,s),o(T,h),o(h,k),b(_e,k,null),o(T,Zo),o(T,Ke),i(e,Vt,s),i(e,W,s),o(W,A),o(A,zt),b(be,zt,null),o(W,Go),o(W,et),i(e,Xt,s),i(e,ve,s),i(e,At,s),i(e,ye,s),i(e,Yt,s),i(e,Me,s),i(e,Dt,s),i(e,Te,s),i(e,Ot,s),i(e,we,s),i(e,Qt,s),i(e,ke,s),i(e,Kt,s),i(e,E,s),o(E,Y),o(Y,Jt),b(xe,Jt,null),o(E,Lo),o(E,tt),i(e,eo,s),i(e,B,s),o(B,D),o(D,Ut),b($e,Ut,null),o(B,qo),o(B,ot),i(e,to,s),i(e,Ne,s),i(e,oo,s),i(e,Ce,s),i(e,no,s),b(je,e,s),i(e,ao,s),i(e,R,s),o(R,O),o(O,Ft),b(ze,Ft,null),o(R,Wo),o(R,nt),i(e,so,s),i(e,Je,s),i(e,ro,s),i(e,Ue,s),i(e,lo,s),b(Fe,e,s),i(e,io,s),i(e,I,s),o(I,Q),o(Q,Zt),b(Ze,Zt,null),o(I,Eo),o(I,at),i(e,co,s),i(e,Ge,s),i(e,ho,s),i(e,H,s),o(H,K),o(K,Gt),b(Le,Gt,null),o(H,Bo),o(H,st),i(e,po,s),i(e,C,s),b(qe,C,null),o(C,Ro),o(C,rt),o(C,Io),o(C,lt),o(C,Ho),b(ee,C,null),i(e,uo,s),i(e,S,s),o(S,te),o(te,Lt),b(We,Lt,null),o(S,So),o(S,it),i(e,mo,s),i(e,x,s),b(Ee,x,null),o(x,Po),o(x,dt),o(x,Vo),o(x,ct),o(x,Xo),o(x,ht),o(x,Ao),o(x,oe),b(Be,oe,null),o(oe,Yo),o(oe,pt),o(x,Do),o(x,ne),b(Re,ne,null),o(ne,Oo),o(ne,ut),i(e,fo,s),i(e,P,s),o(P,ae),o(ae,qt),b(Ie,qt,null),o(P,Qo),o(P,mt),i(e,go,s),i(e,G,s),b(He,G,null),o(G,Ko),o(G,ft),o(G,en),o(G,J),b(Se,J,null),o(J,tn),o(J,gt),o(J,on),o(J,_t),o(J,nn),o(J,bt),i(e,_o,s),i(e,V,s),o(V,se),o(se,Wt),b(Pe,Wt,null),o(V,an),o(V,vt),i(e,bo,s),i(e,j,s),b(Ve,j,null),o(j,sn),o(j,yt),o(j,rn),o(j,Mt),o(j,ln),o(j,$),b(Xe,$,null),o($,dn),o($,Tt),o($,cn),b(re,$,null),o($,hn),o($,wt),o($,pn),b(le,$,null),o($,un),b(ie,$,null),i(e,vo,s),i(e,X,s),o(X,de),o(de,Et),b(Ae,Et,null),o(X,mn),o(X,kt),i(e,yo,s),i(e,z,s),b(Ye,z,null),o(z,fn),o(z,xt),o(z,gn),o(z,$t),o(z,_n),o(z,U),b(De,U,null),o(U,bn),o(U,Nt),o(U,vn),b(ce,U,null),o(U,yn),b(he,U,null),i(e,Mo,s),i(e,Bt,s),To=!0},p(e,[s]){const Oe={};s&2&&(Oe.$$scope={dirty:s,ctx:e}),ee.$set(Oe);const Rt={};s&2&&(Rt.$$scope={dirty:s,ctx:e}),re.$set(Rt);const It={};s&2&&(It.$$scope={dirty:s,ctx:e}),le.$set(It);const Qe={};s&2&&(Qe.$$scope={dirty:s,ctx:e}),ie.$set(Qe);const Ht={};s&2&&(Ht.$$scope={dirty:s,ctx:e}),ce.$set(Ht);const St={};s&2&&(St.$$scope={dirty:s,ctx:e}),he.$set(St)},i(e){To||(v(_e.$$.fragment,e),v(be.$$.fragment,e),v(xe.$$.fragment,e),v($e.$$.fragment,e),v(je.$$.fragment,e),v(ze.$$.fragment,e),v(Fe.$$.fragment,e),v(Ze.$$.fragment,e),v(Le.$$.fragment,e),v(qe.$$.fragment,e),v(ee.$$.fragment,e),v(We.$$.fragment,e),v(Ee.$$.fragment,e),v(Be.$$.fragment,e),v(Re.$$.fragment,e),v(Ie.$$.fragment,e),v(He.$$.fragment,e),v(Se.$$.fragment,e),v(Pe.$$.fragment,e),v(Ve.$$.fragment,e),v(Xe.$$.fragment,e),v(re.$$.fragment,e),v(le.$$.fragment,e),v(ie.$$.fragment,e),v(Ae.$$.fragment,e),v(Ye.$$.fragment,e),v(De.$$.fragment,e),v(ce.$$.fragment,e),v(he.$$.fragment,e),To=!0)},o(e){y(_e.$$.fragment,e),y(be.$$.fragment,e),y(xe.$$.fragment,e),y($e.$$.fragment,e),y(je.$$.fragment,e),y(ze.$$.fragment,e),y(Fe.$$.fragment,e),y(Ze.$$.fragment,e),y(Le.$$.fragment,e),y(qe.$$.fragment,e),y(ee.$$.fragment,e),y(We.$$.fragment,e),y(Ee.$$.fragment,e),y(Be.$$.fragment,e),y(Re.$$.fragment,e),y(Ie.$$.fragment,e),y(He.$$.fragment,e),y(Se.$$.fragment,e),y(Pe.$$.fragment,e),y(Ve.$$.fragment,e),y(Xe.$$.fragment,e),y(re.$$.fragment,e),y(le.$$.fragment,e),y(ie.$$.fragment,e),y(Ae.$$.fragment,e),y(Ye.$$.fragment,e),y(De.$$.fragment,e),y(ce.$$.fragment,e),y(he.$$.fragment,e),To=!1},d(e){e&&(t(w),t(m),t(f),t(T),t(Vt),t(W),t(Xt),t(ve),t(At),t(ye),t(Yt),t(Me),t(Dt),t(Te),t(Ot),t(we),t(Qt),t(ke),t(Kt),t(E),t(eo),t(B),t(to),t(Ne),t(oo),t(Ce),t(no),t(ao),t(R),t(so),t(Je),t(ro),t(Ue),t(lo),t(io),t(I),t(co),t(Ge),t(ho),t(H),t(po),t(C),t(uo),t(S),t(mo),t(x),t(fo),t(P),t(go),t(G),t(_o),t(V),t(bo),t(j),t(vo),t(X),t(yo),t(z),t(Mo),t(Bt)),t(d),M(_e),M(be),M(xe),M($e),M(je,e),M(ze),M(Fe,e),M(Ze),M(Le),M(qe),M(ee),M(We),M(Ee),M(Be),M(Re),M(Ie),M(He),M(Se),M(Pe),M(Ve),M(Xe),M(re),M(le),M(ie),M(Ae),M(Ye),M(De),M(ce),M(he)}}}const Ra={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 Ia(N){return za(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class Da extends Ja{constructor(d){super(),Ua(this,d,Ia,Ba,ja,{})}}export{Da as component};
