import{S as mi,i as ui,s as fi,e as n,k as c,w as M,t as r,M as _i,c as s,d as o,m as h,a,x as v,h as i,b as l,G as e,g as u,y as b,q as y,o as T,B as w,v as gi,L as kn}from"../../chunks/vendor-hf-doc-builder.js";import{T as pi}from"../../chunks/Tip-hf-doc-builder.js";import{D as W}from"../../chunks/Docstring-hf-doc-builder.js";import{C as jt}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as we}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as gn}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function ki(E){let m,$,g,f,k;return f=new jt({props:{code:`from transformers import M2M100Config, M2M100Model

# Initializing a M2M100 facebook/m2m100_418M style configuration
configuration = M2M100Config()

# Initializing a model (with random weights) from the facebook/m2m100_418M style configuration
model = M2M100Model(configuration)

# Accessing the model configuration
configuration = model.config`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> M2M100Config, M2M100Model

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a M2M100 facebook/m2m100_418M style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>configuration = M2M100Config()

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># Initializing a model (with random weights) from the facebook/m2m100_418M style configuration</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = M2M100Model(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"),$=r("Example:"),g=c(),M(f.$$.fragment)},l(d){m=s(d,"P",{});var _=a(m);$=i(_,"Example:"),_.forEach(o),g=h(d),v(f.$$.fragment,d)},m(d,_){u(d,m,_),e(m,$),u(d,g,_),b(f,d,_),k=!0},p:kn,i(d){k||(y(f.$$.fragment,d),k=!0)},o(d){T(f.$$.fragment,d),k=!1},d(d){d&&o(m),d&&o(g),w(f,d)}}}function Mi(E){let m,$,g,f,k;return f=new jt({props:{code:`from transformers import M2M100ForConditionalGeneration, M2M100Tokenizer

model = M2M100ForConditionalGeneration.from_pretrained("facebook/m2m100_418M")
tokenizer = M2M100Tokenizer.from_pretrained("facebook/m2m100_418M", src_lang="en", tgt_lang="ro")
src_text = " UN Chief Says There Is No Military Solution in Syria"
tgt_text = "\u015Eeful ONU declar\u0103 c\u0103 nu exist\u0103 o solu\u0163ie militar\u0103 \xEEn Siria"
model_inputs = tokenizer(src_text, text_target=tgt_text, return_tensors="pt")
outputs = model(**model_inputs)  # should work`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> M2M100ForConditionalGeneration, M2M100Tokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>model = M2M100ForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;facebook/m2m100_418M&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = M2M100Tokenizer.from_pretrained(<span class="hljs-string">&quot;facebook/m2m100_418M&quot;</span>, src_lang=<span class="hljs-string">&quot;en&quot;</span>, tgt_lang=<span class="hljs-string">&quot;ro&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>src_text = <span class="hljs-string">&quot; UN Chief Says There Is No Military Solution in Syria&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>tgt_text = <span class="hljs-string">&quot;\u015Eeful ONU declar\u0103 c\u0103 nu exist\u0103 o solu\u0163ie militar\u0103 \xEEn Siria&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model_inputs = tokenizer(src_text, text_target=tgt_text, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**model_inputs)  <span class="hljs-comment"># should work</span>`}}),{c(){m=n("p"),$=r("Examples:"),g=c(),M(f.$$.fragment)},l(d){m=s(d,"P",{});var _=a(m);$=i(_,"Examples:"),_.forEach(o),g=h(d),v(f.$$.fragment,d)},m(d,_){u(d,m,_),e(m,$),u(d,g,_),b(f,d,_),k=!0},p:kn,i(d){k||(y(f.$$.fragment,d),k=!0)},o(d){T(f.$$.fragment,d),k=!1},d(d){d&&o(m),d&&o(g),w(f,d)}}}function vi(E){let m,$,g,f,k;return{c(){m=n("p"),$=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n("code"),f=r("Module"),k=r(`
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(d){m=s(d,"P",{});var _=a(m);$=i(_,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(_,"CODE",{});var I=a(g);f=i(I,"Module"),I.forEach(o),k=i(_,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),_.forEach(o)},m(d,_){u(d,m,_),e(m,$),e(m,g),e(g,f),e(m,k)},d(d){d&&o(m)}}}function bi(E){let m,$,g,f,k;return f=new jt({props:{code:`from transformers import AutoTokenizer, M2M100Model
import torch

tokenizer = AutoTokenizer.from_pretrained("facebook/m2m100_418M")
model = M2M100Model.from_pretrained("facebook/m2m100_418M")

inputs = tokenizer("Hello, my dog is cute", return_tensors="pt")
outputs = model(**inputs)

last_hidden_states = outputs.last_hidden_state`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, M2M100Model
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;facebook/m2m100_418M&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = M2M100Model.from_pretrained(<span class="hljs-string">&quot;facebook/m2m100_418M&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(<span class="hljs-string">&quot;Hello, my dog is cute&quot;</span>, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model(**inputs)

<span class="hljs-meta">&gt;&gt;&gt; </span>last_hidden_states = outputs.last_hidden_state`}}),{c(){m=n("p"),$=r("Example:"),g=c(),M(f.$$.fragment)},l(d){m=s(d,"P",{});var _=a(m);$=i(_,"Example:"),_.forEach(o),g=h(d),v(f.$$.fragment,d)},m(d,_){u(d,m,_),e(m,$),u(d,g,_),b(f,d,_),k=!0},p:kn,i(d){k||(y(f.$$.fragment,d),k=!0)},o(d){T(f.$$.fragment,d),k=!1},d(d){d&&o(m),d&&o(g),w(f,d)}}}function yi(E){let m,$,g,f,k;return{c(){m=n("p"),$=r("Although the recipe for forward pass needs to be defined within this function, one should call the "),g=n("code"),f=r("Module"),k=r(`
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(d){m=s(d,"P",{});var _=a(m);$=i(_,"Although the recipe for forward pass needs to be defined within this function, one should call the "),g=s(_,"CODE",{});var I=a(g);f=i(I,"Module"),I.forEach(o),k=i(_,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),_.forEach(o)},m(d,_){u(d,m,_),e(m,$),e(m,g),e(g,f),e(m,k)},d(d){d&&o(m)}}}function Ti(E){let m,$,g,f,k;return f=new jt({props:{code:`from transformers import AutoTokenizer, M2M100ForConditionalGeneration

model = M2M100ForConditionalGeneration.from_pretrained("facebook/m2m100_418M")
tokenizer = AutoTokenizer.from_pretrained("facebook/m2m100_418M")

text_to_translate = "Life is like a box of chocolates"
model_inputs = tokenizer(text_to_translate, return_tensors="pt")

# translate to French
gen_tokens = model.generate(**model_inputs, forced_bos_token_id=tokenizer.get_lang_id("fr"))
print(tokenizer.batch_decode(gen_tokens, skip_special_tokens=True))`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoTokenizer, M2M100ForConditionalGeneration

<span class="hljs-meta">&gt;&gt;&gt; </span>model = M2M100ForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;facebook/m2m100_418M&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;facebook/m2m100_418M&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;fr&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"),$=r("Translation example:"),g=c(),M(f.$$.fragment)},l(d){m=s(d,"P",{});var _=a(m);$=i(_,"Translation example:"),_.forEach(o),g=h(d),v(f.$$.fragment,d)},m(d,_){u(d,m,_),e(m,$),u(d,g,_),b(f,d,_),k=!0},p:kn,i(d){k||(y(f.$$.fragment,d),k=!0)},o(d){T(f.$$.fragment,d),k=!1},d(d){d&&o(m),d&&o(g),w(f,d)}}}function wi(E){let m,$,g,f,k,d,_,I,Mn,$o,B,ee,At,$e,vn,Ot,bn,zo,te,yn,ze,Tn,wn,qo,ct,$n,xo,ht,St,zn,Eo,oe,qn,qe,xn,En,Co,H,ne,Lt,xe,Cn,Dt,Fn,Fo,A,Pn,It,jn,An,Nt,On,Sn,Gt,Ln,Dn,Po,C,In,pt,Nn,Gn,Wt,Wn,Bn,Bt,Hn,Un,Ht,Vn,Xn,jo,mt,Ut,Rn,Ao,Ee,Oo,ut,Ce,Vt,Jn,Kn,x,Zn,Xt,Qn,Yn,Rt,es,ts,Jt,os,ns,Kt,ss,as,Zt,rs,is,So,Fe,Lo,U,se,Qt,Pe,ds,Yt,ls,Do,ae,eo,ft,cs,hs,to,_t,ps,Io,V,re,oo,je,ms,no,us,No,F,Ae,fs,X,_s,gt,gs,ks,Oe,Ms,vs,bs,R,ys,kt,Ts,ws,Mt,$s,zs,qs,ie,Go,J,de,so,Se,xs,ao,Es,Wo,z,Le,Cs,De,Fs,Ie,Ps,js,As,Ne,Os,vt,Ss,Ls,Ds,le,Is,O,Ge,Ns,We,Gs,ro,Ws,Bs,Hs,Be,He,io,Us,Vs,lo,Xs,Rs,Ue,co,Js,Ks,ho,Zs,Qs,po,Ys,ea,ce,Ve,ta,Xe,oa,mo,na,sa,aa,N,Re,ra,bt,ia,yt,da,la,uo,ca,ha,Tt,Je,Bo,K,he,fo,Ke,pa,_o,ma,Ho,P,Ze,ua,Qe,fa,wt,_a,ga,ka,Ye,Ma,et,va,ba,ya,S,tt,Ta,Z,wa,$t,$a,za,go,qa,xa,Ea,pe,Ca,me,Uo,Q,ue,ko,ot,Fa,Mo,Pa,Vo,j,nt,ja,st,Aa,zt,Oa,Sa,La,at,Da,rt,Ia,Na,Ga,L,it,Wa,Y,Ba,qt,Ha,Ua,vo,Va,Xa,Ra,fe,Ja,_e,Xo;return d=new we({}),$e=new we({}),xe=new we({}),Ee=new jt({props:{code:`from transformers import M2M100Config, M2M100ForConditionalGeneration, M2M100Tokenizer

model = M2M100ForConditionalGeneration.from_pretrained("facebook/m2m100_418M")
tokenizer = M2M100Tokenizer.from_pretrained("facebook/m2m100_418M", src_lang="en", tgt_lang="fr")

src_text = "Life is like a box of chocolates."
tgt_text = "La vie est comme une bo\xEEte de chocolat."

model_inputs = tokenizer(src_text, text_target=tgt_text, return_tensors="pt")

loss = model(**model_inputs).loss  # forward pass`,highlighted:`<span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> M2M100Config, M2M100ForConditionalGeneration, M2M100Tokenizer

model = M2M100ForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;facebook/m2m100_418M&quot;</span>)
tokenizer = M2M100Tokenizer.from_pretrained(<span class="hljs-string">&quot;facebook/m2m100_418M&quot;</span>, src_lang=<span class="hljs-string">&quot;en&quot;</span>, tgt_lang=<span class="hljs-string">&quot;fr&quot;</span>)

src_text = <span class="hljs-string">&quot;Life is like a box of chocolates.&quot;</span>
tgt_text = <span class="hljs-string">&quot;La vie est comme une bo\xEEte de chocolat.&quot;</span>

model_inputs = tokenizer(src_text, text_target=tgt_text, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

loss = model(**model_inputs).loss  <span class="hljs-comment"># forward pass</span>`}}),Fe=new jt({props:{code:`from transformers import M2M100ForConditionalGeneration, M2M100Tokenizer

hi_text = "\u091C\u0940\u0935\u0928 \u090F\u0915 \u091A\u0949\u0915\u0932\u0947\u091F \u092C\u0949\u0915\u094D\u0938 \u0915\u0940 \u0924\u0930\u0939 \u0939\u0948\u0964"
chinese_text = "\u751F\u6D3B\u5C31\u50CF\u4E00\u76D2\u5DE7\u514B\u529B\u3002"

model = M2M100ForConditionalGeneration.from_pretrained("facebook/m2m100_418M")
tokenizer = M2M100Tokenizer.from_pretrained("facebook/m2m100_418M")

# translate Hindi to French
tokenizer.src_lang = "hi"
encoded_hi = tokenizer(hi_text, return_tensors="pt")
generated_tokens = model.generate(**encoded_hi, forced_bos_token_id=tokenizer.get_lang_id("fr"))
tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)

# translate Chinese to English
tokenizer.src_lang = "zh"
encoded_zh = tokenizer(chinese_text, return_tensors="pt")
generated_tokens = model.generate(**encoded_zh, forced_bos_token_id=tokenizer.get_lang_id("en"))
tokenizer.batch_decode(generated_tokens, skip_special_tokens=True)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> M2M100ForConditionalGeneration, M2M100Tokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>hi_text = <span class="hljs-string">&quot;\u091C\u0940\u0935\u0928 \u090F\u0915 \u091A\u0949\u0915\u0932\u0947\u091F \u092C\u0949\u0915\u094D\u0938 \u0915\u0940 \u0924\u0930\u0939 \u0939\u0948\u0964&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>chinese_text = <span class="hljs-string">&quot;\u751F\u6D3B\u5C31\u50CF\u4E00\u76D2\u5DE7\u514B\u529B\u3002&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span>model = M2M100ForConditionalGeneration.from_pretrained(<span class="hljs-string">&quot;facebook/m2m100_418M&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = M2M100Tokenizer.from_pretrained(<span class="hljs-string">&quot;facebook/m2m100_418M&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># translate Hindi to French</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.src_lang = <span class="hljs-string">&quot;hi&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>encoded_hi = tokenizer(hi_text, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>generated_tokens = model.generate(**encoded_hi, forced_bos_token_id=tokenizer.get_lang_id(<span class="hljs-string">&quot;fr&quot;</span>))
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.batch_decode(generated_tokens, skip_special_tokens=<span class="hljs-literal">True</span>)
<span class="hljs-string">&quot;La vie est comme une bo\xEEte de chocolat.&quot;</span>

<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-comment"># translate Chinese to English</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.src_lang = <span class="hljs-string">&quot;zh&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>encoded_zh = tokenizer(chinese_text, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>generated_tokens = model.generate(**encoded_zh, forced_bos_token_id=tokenizer.get_lang_id(<span class="hljs-string">&quot;en&quot;</span>))
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.batch_decode(generated_tokens, skip_special_tokens=<span class="hljs-literal">True</span>)
<span class="hljs-string">&quot;Life is like a box of chocolate.&quot;</span>`}}),Pe=new we({}),je=new we({}),Ae=new W({props:{name:"class transformers.M2M100Config",anchor:"transformers.M2M100Config",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:"pad_token_id",val:" = 1"},{name:"bos_token_id",val:" = 0"},{name:"eos_token_id",val:" = 2"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.M2M100Config.vocab_size",description:`<strong>vocab_size</strong> (<code>int</code>, <em>optional</em>, defaults to 50265) &#x2014;
Vocabulary size of the M2M100 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.29.0/en/model_doc/m2m_100#transformers.M2M100Model">M2M100Model</a> or`,name:"vocab_size"},{anchor:"transformers.M2M100Config.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.M2M100Config.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.M2M100Config.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.M2M100Config.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.M2M100Config.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.M2M100Config.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.M2M100Config.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 decoder.`,name:"encoder_ffn_dim"},{anchor:"transformers.M2M100Config.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.M2M100Config.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.M2M100Config.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.M2M100Config.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.M2M100Config.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.M2M100Config.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.M2M100Config.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.M2M100Config.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.M2M100Config.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.M2M100Config.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.29.0/src/transformers/models/m2m_100/configuration_m2m_100.py#L34"}}),ie=new gn({props:{anchor:"transformers.M2M100Config.example",$$slots:{default:[ki]},$$scope:{ctx:E}}}),Se=new we({}),Le=new W({props:{name:"class transformers.M2M100Tokenizer",anchor:"transformers.M2M100Tokenizer",parameters:[{name:"vocab_file",val:""},{name:"spm_file",val:""},{name:"src_lang",val:" = None"},{name:"tgt_lang",val:" = None"},{name:"bos_token",val:" = '<s>'"},{name:"eos_token",val:" = '</s>'"},{name:"sep_token",val:" = '</s>'"},{name:"pad_token",val:" = '<pad>'"},{name:"unk_token",val:" = '<unk>'"},{name:"language_codes",val:" = 'm2m100'"},{name:"sp_model_kwargs",val:": typing.Union[typing.Dict[str, typing.Any], NoneType] = None"},{name:"num_madeup_words",val:" = 8"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.M2M100Tokenizer.vocab_file",description:`<strong>vocab_file</strong> (<code>str</code>) &#x2014;
Path to the vocabulary file.`,name:"vocab_file"},{anchor:"transformers.M2M100Tokenizer.spm_file",description:`<strong>spm_file</strong> (<code>str</code>) &#x2014;
Path to <a href="https://github.com/google/sentencepiece" rel="nofollow">SentencePiece</a> file (generally has a .spm extension) that
contains the vocabulary.`,name:"spm_file"},{anchor:"transformers.M2M100Tokenizer.src_lang",description:`<strong>src_lang</strong> (<code>str</code>, <em>optional</em>) &#x2014;
A string representing the source language.`,name:"src_lang"},{anchor:"transformers.M2M100Tokenizer.tgt_lang",description:`<strong>tgt_lang</strong> (<code>str</code>, <em>optional</em>) &#x2014;
A string representing the target language.`,name:"tgt_lang"},{anchor:"transformers.M2M100Tokenizer.eos_token",description:`<strong>eos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;/s&gt;&quot;</code>) &#x2014;
The end of sequence token.`,name:"eos_token"},{anchor:"transformers.M2M100Tokenizer.sep_token",description:`<strong>sep_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;/s&gt;&quot;</code>) &#x2014;
The separator token, which is used when building a sequence from multiple sequences, e.g. two sequences for
sequence classification or for a text and a question for question answering. It is also used as the last
token of a sequence built with special tokens.`,name:"sep_token"},{anchor:"transformers.M2M100Tokenizer.unk_token",description:`<strong>unk_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;unk&gt;&quot;</code>) &#x2014;
The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this
token instead.`,name:"unk_token"},{anchor:"transformers.M2M100Tokenizer.pad_token",description:`<strong>pad_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;pad&gt;&quot;</code>) &#x2014;
The token used for padding, for example when batching sequences of different lengths.`,name:"pad_token"},{anchor:"transformers.M2M100Tokenizer.language_codes",description:`<strong>language_codes</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;m2m100&quot;</code>) &#x2014;
What language codes to use. Should be one of <code>&quot;m2m100&quot;</code> or <code>&quot;wmt21&quot;</code>.`,name:"language_codes"},{anchor:"transformers.M2M100Tokenizer.sp_model_kwargs",description:`<strong>sp_model_kwargs</strong> (<code>dict</code>, <em>optional</em>) &#x2014;
Will be passed to the <code>SentencePieceProcessor.__init__()</code> method. The <a href="https://github.com/google/sentencepiece/tree/master/python" rel="nofollow">Python wrapper for
SentencePiece</a> can be used, among other things,
to set:</p>
<ul>
<li>
<p><code>enable_sampling</code>: Enable subword regularization.</p>
</li>
<li>
<p><code>nbest_size</code>: Sampling parameters for unigram. Invalid for BPE-Dropout.</p>
<ul>
<li><code>nbest_size = {0,1}</code>: No sampling is performed.</li>
<li><code>nbest_size &gt; 1</code>: samples from the nbest_size results.</li>
<li><code>nbest_size &lt; 0</code>: assuming that nbest_size is infinite and samples from the all hypothesis (lattice)
using forward-filtering-and-backward-sampling algorithm.</li>
</ul>
</li>
<li>
<p><code>alpha</code>: Smoothing parameter for unigram sampling, and dropout probability of merge operations for
BPE-dropout.</p>
</li>
</ul>`,name:"sp_model_kwargs"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/m2m_100/tokenization_m2m_100.py#L64"}}),le=new gn({props:{anchor:"transformers.M2M100Tokenizer.example",$$slots:{default:[Mi]},$$scope:{ctx:E}}}),Ge=new W({props:{name:"build_inputs_with_special_tokens",anchor:"transformers.M2M100Tokenizer.build_inputs_with_special_tokens",parameters:[{name:"token_ids_0",val:": typing.List[int]"},{name:"token_ids_1",val:": typing.Optional[typing.List[int]] = None"}],parametersDescription:[{anchor:"transformers.M2M100Tokenizer.build_inputs_with_special_tokens.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014;
List of IDs to which the special tokens will be added.`,name:"token_ids_0"},{anchor:"transformers.M2M100Tokenizer.build_inputs_with_special_tokens.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Optional second list of IDs for sequence pairs.`,name:"token_ids_1"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/m2m_100/tokenization_m2m_100.py#L266",returnDescription:`
<p>List of <a href="../glossary#input-ids">input IDs</a> with the appropriate special tokens.</p>
`,returnType:`
<p><code>List[int]</code></p>
`}}),Ve=new W({props:{name:"get_special_tokens_mask",anchor:"transformers.M2M100Tokenizer.get_special_tokens_mask",parameters:[{name:"token_ids_0",val:": typing.List[int]"},{name:"token_ids_1",val:": typing.Optional[typing.List[int]] = None"},{name:"already_has_special_tokens",val:": bool = False"}],parametersDescription:[{anchor:"transformers.M2M100Tokenizer.get_special_tokens_mask.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014;
List of IDs.`,name:"token_ids_0"},{anchor:"transformers.M2M100Tokenizer.get_special_tokens_mask.token_ids_1",description:`<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014;
Optional second list of IDs for sequence pairs.`,name:"token_ids_1"},{anchor:"transformers.M2M100Tokenizer.get_special_tokens_mask.already_has_special_tokens",description:`<strong>already_has_special_tokens</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not the token list is already formatted with special tokens for the model.`,name:"already_has_special_tokens"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/m2m_100/tokenization_m2m_100.py#L236",returnDescription:`
<p>A list of integers in the range [0, 1]: 1 for a special token, 0 for a sequence token.</p>
`,returnType:`
<p><code>List[int]</code></p>
`}}),Re=new W({props:{name:"create_token_type_ids_from_sequences",anchor:"transformers.M2M100Tokenizer.create_token_type_ids_from_sequences",parameters:[{name:"token_ids_0",val:": typing.List[int]"},{name:"token_ids_1",val:": typing.Optional[typing.List[int]] = None"}],parametersDescription:[{anchor:"transformers.M2M100Tokenizer.create_token_type_ids_from_sequences.token_ids_0",description:"<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014; The first tokenized sequence.",name:"token_ids_0"},{anchor:"transformers.M2M100Tokenizer.create_token_type_ids_from_sequences.token_ids_1",description:"<strong>token_ids_1</strong> (<code>List[int]</code>, <em>optional</em>) &#x2014; The second tokenized sequence.",name:"token_ids_1"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/tokenization_utils_base.py#L3047",returnDescription:`
<p>The token type ids.</p>
`,returnType:`
<p><code>List[int]</code></p>
`}}),Je=new W({props:{name:"save_vocabulary",anchor:"transformers.M2M100Tokenizer.save_vocabulary",parameters:[{name:"save_directory",val:": str"},{name:"filename_prefix",val:": typing.Optional[str] = None"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/m2m_100/tokenization_m2m_100.py#L312"}}),Ke=new we({}),Ze=new W({props:{name:"class transformers.M2M100Model",anchor:"transformers.M2M100Model",parameters:[{name:"config",val:": M2M100Config"}],parametersDescription:[{anchor:"transformers.M2M100Model.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.29.0/en/model_doc/m2m_100#transformers.M2M100Config">M2M100Config</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.29.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.29.0/src/transformers/models/m2m_100/modeling_m2m_100.py#L1140"}}),tt=new W({props:{name:"forward",anchor:"transformers.M2M100Model.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:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.M2M100Model.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.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__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.M2M100Model.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.M2M100Model.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.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#decoder-input-ids">What are decoder input IDs?</a></p>
<p>M2M100 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.M2M100Model.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.M2M100Model.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.M2M100Model.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.M2M100Model.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.M2M100Model.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.M2M100Model.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.M2M100Model.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.M2M100Model.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.M2M100Model.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.M2M100Model.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.M2M100Model.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.29.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],source:"https://github.com/huggingface/transformers/blob/v4.29.0/src/transformers/models/m2m_100/modeling_m2m_100.py#L1176",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.modeling_outputs.Seq2SeqModelOutput"
>transformers.modeling_outputs.Seq2SeqModelOutput</a> 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.29.0/en/model_doc/m2m_100#transformers.M2M100Config"
>M2M100Config</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>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>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.modeling_outputs.Seq2SeqModelOutput"
>transformers.modeling_outputs.Seq2SeqModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),pe=new pi({props:{$$slots:{default:[vi]},$$scope:{ctx:E}}}),me=new gn({props:{anchor:"transformers.M2M100Model.forward.example",$$slots:{default:[bi]},$$scope:{ctx:E}}}),ot=new we({}),nt=new W({props:{name:"class transformers.M2M100ForConditionalGeneration",anchor:"transformers.M2M100ForConditionalGeneration",parameters:[{name:"config",val:": M2M100Config"}],parametersDescription:[{anchor:"transformers.M2M100ForConditionalGeneration.config",description:`<strong>config</strong> (<a href="/docs/transformers/v4.29.0/en/model_doc/m2m_100#transformers.M2M100Config">M2M100Config</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.29.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.29.0/src/transformers/models/m2m_100/modeling_m2m_100.py#L1259"}}),it=new W({props:{name:"forward",anchor:"transformers.M2M100ForConditionalGeneration.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:"return_dict",val:": typing.Optional[bool] = None"}],parametersDescription:[{anchor:"transformers.M2M100ForConditionalGeneration.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.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__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.M2M100ForConditionalGeneration.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.M2M100ForConditionalGeneration.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.29.0/en/model_doc/auto#transformers.AutoTokenizer">AutoTokenizer</a>. See <a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#decoder-input-ids">What are decoder input IDs?</a></p>
<p>M2M100 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.M2M100ForConditionalGeneration.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.M2M100ForConditionalGeneration.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.M2M100ForConditionalGeneration.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.M2M100ForConditionalGeneration.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.M2M100ForConditionalGeneration.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.M2M100ForConditionalGeneration.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.M2M100ForConditionalGeneration.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.M2M100ForConditionalGeneration.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.M2M100ForConditionalGeneration.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.M2M100ForConditionalGeneration.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.M2M100ForConditionalGeneration.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.29.0/en/main_classes/output#transformers.utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.M2M100ForConditionalGeneration.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.29.0/src/transformers/models/m2m_100/modeling_m2m_100.py#L1297",returnDescription:`
<p>A <a
  href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.modeling_outputs.Seq2SeqLMOutput"
>transformers.modeling_outputs.Seq2SeqLMOutput</a> 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.29.0/en/model_doc/m2m_100#transformers.M2M100Config"
>M2M100Config</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>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>
</ul>
`,returnType:`
<p><a
  href="/docs/transformers/v4.29.0/en/main_classes/output#transformers.modeling_outputs.Seq2SeqLMOutput"
>transformers.modeling_outputs.Seq2SeqLMOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),fe=new pi({props:{$$slots:{default:[yi]},$$scope:{ctx:E}}}),_e=new gn({props:{anchor:"transformers.M2M100ForConditionalGeneration.forward.example",$$slots:{default:[Ti]},$$scope:{ctx:E}}}),{c(){m=n("meta"),$=c(),g=n("h1"),f=n("a"),k=n("span"),M(d.$$.fragment),_=c(),I=n("span"),Mn=r("M2M100"),$o=c(),B=n("h2"),ee=n("a"),At=n("span"),M($e.$$.fragment),vn=c(),Ot=n("span"),bn=r("Overview"),zo=c(),te=n("p"),yn=r("The M2M100 model was proposed in "),ze=n("a"),Tn=r("Beyond English-Centric Multilingual Machine Translation"),wn=r(` by Angela Fan, Shruti Bhosale, Holger Schwenk, Zhiyi Ma, Ahmed El-Kishky,
Siddharth Goyal, Mandeep Baines, Onur Celebi, Guillaume Wenzek, Vishrav Chaudhary, Naman Goyal, Tom Birch, Vitaliy
Liptchinsky, Sergey Edunov, Edouard Grave, Michael Auli, Armand Joulin.`),qo=c(),ct=n("p"),$n=r("The abstract from the paper is the following:"),xo=c(),ht=n("p"),St=n("em"),zn=r(`Existing work in translation demonstrated the potential of massively multilingual machine translation by training a
single model able to translate between any pair of languages. However, much of this work is English-Centric by training
only on data which was translated from or to English. While this is supported by large sources of training data, it
does not reflect translation needs worldwide. In this work, we create a true Many-to-Many multilingual translation
model that can translate directly between any pair of 100 languages. We build and open source a training dataset that
covers thousands of language directions with supervised data, created through large-scale mining. Then, we explore how
to effectively increase model capacity through a combination of dense scaling and language-specific sparse parameters
to create high quality models. Our focus on non-English-Centric models brings gains of more than 10 BLEU when directly
translating between non-English directions while performing competitively to the best single systems of WMT. We
open-source our scripts so that others may reproduce the data, evaluation, and final M2M-100 model.`),Eo=c(),oe=n("p"),qn=r("This model was contributed by "),qe=n("a"),xn=r("valhalla"),En=r("."),Co=c(),H=n("h3"),ne=n("a"),Lt=n("span"),M(xe.$$.fragment),Cn=c(),Dt=n("span"),Fn=r("Training and Generation"),Fo=c(),A=n("p"),Pn=r(`M2M100 is a multilingual encoder-decoder (seq-to-seq) model primarily intended for translation tasks. As the model is
multilingual it expects the sequences in a certain format: A special language id token is used as prefix in both the
source and target text. The source text format is `),It=n("code"),jn=r("[lang_code] X [eos]"),An=r(", where "),Nt=n("code"),On=r("lang_code"),Sn=r(` is source language
id for source text and target language id for target text, with `),Gt=n("code"),Ln=r("X"),Dn=r(" being the source or target text."),Po=c(),C=n("p"),In=r("The "),pt=n("a"),Nn=r("M2M100Tokenizer"),Gn=r(" depends on "),Wt=n("code"),Wn=r("sentencepiece"),Bn=r(` so be sure to install it before running the
examples. To install `),Bt=n("code"),Hn=r("sentencepiece"),Un=r(" run "),Ht=n("code"),Vn=r("pip install sentencepiece"),Xn=r("."),jo=c(),mt=n("ul"),Ut=n("li"),Rn=r("Supervised Training"),Ao=c(),M(Ee.$$.fragment),Oo=c(),ut=n("ul"),Ce=n("li"),Vt=n("p"),Jn=r("Generation"),Kn=c(),x=n("p"),Zn=r("M2M100 uses the "),Xt=n("code"),Qn=r("eos_token_id"),Yn=r(" as the "),Rt=n("code"),es=r("decoder_start_token_id"),ts=r(` for generation with the target language id
being forced as the first generated token. To force the target language id as the first generated token, pass the
`),Jt=n("em"),os=r("forced_bos_token_id"),ns=r(" parameter to the "),Kt=n("em"),ss=r("generate"),as=r(` method. The following example shows how to translate between
Hindi to French and Chinese to English using the `),Zt=n("em"),rs=r("facebook/m2m100_418M"),is=r(" checkpoint."),So=c(),M(Fe.$$.fragment),Lo=c(),U=n("h2"),se=n("a"),Qt=n("span"),M(Pe.$$.fragment),ds=c(),Yt=n("span"),ls=r("Documentation resources"),Do=c(),ae=n("ul"),eo=n("li"),ft=n("a"),cs=r("Translation task guide"),hs=c(),to=n("li"),_t=n("a"),ps=r("Summarization task guide"),Io=c(),V=n("h2"),re=n("a"),oo=n("span"),M(je.$$.fragment),ms=c(),no=n("span"),us=r("M2M100Config"),No=c(),F=n("div"),M(Ae.$$.fragment),fs=c(),X=n("p"),_s=r("This is the configuration class to store the configuration of a "),gt=n("a"),gs=r("M2M100Model"),ks=r(`. It is used to instantiate an
M2M100 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 M2M100
`),Oe=n("a"),Ms=r("facebook/m2m100_418M"),vs=r(" architecture."),bs=c(),R=n("p"),ys=r("Configuration objects inherit from "),kt=n("a"),Ts=r("PretrainedConfig"),ws=r(` and can be used to control the model outputs. Read the
documentation from `),Mt=n("a"),$s=r("PretrainedConfig"),zs=r(" for more information."),qs=c(),M(ie.$$.fragment),Go=c(),J=n("h2"),de=n("a"),so=n("span"),M(Se.$$.fragment),xs=c(),ao=n("span"),Es=r("M2M100Tokenizer"),Wo=c(),z=n("div"),M(Le.$$.fragment),Cs=c(),De=n("p"),Fs=r("Construct an M2M100 tokenizer. Based on "),Ie=n("a"),Ps=r("SentencePiece"),js=r("."),As=c(),Ne=n("p"),Os=r("This tokenizer inherits from "),vt=n("a"),Ss=r("PreTrainedTokenizer"),Ls=r(` which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.`),Ds=c(),M(le.$$.fragment),Is=c(),O=n("div"),M(Ge.$$.fragment),Ns=c(),We=n("p"),Gs=r(`Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
adding special tokens. An MBART sequence has the following format, where `),ro=n("code"),Ws=r("X"),Bs=r(" represents the sequence:"),Hs=c(),Be=n("ul"),He=n("li"),io=n("code"),Us=r("input_ids"),Vs=r(" (for encoder) "),lo=n("code"),Xs=r("X [eos, src_lang_code]"),Rs=c(),Ue=n("li"),co=n("code"),Js=r("decoder_input_ids"),Ks=r(": (for decoder) "),ho=n("code"),Zs=r("X [eos, tgt_lang_code]"),Qs=c(),po=n("p"),Ys=r(`BOS is never used. Pairs of sequences are not the expected use case, but they will be handled without a
separator.`),ea=c(),ce=n("div"),M(Ve.$$.fragment),ta=c(),Xe=n("p"),oa=r(`Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
special tokens using the tokenizer `),mo=n("code"),na=r("prepare_for_model"),sa=r(" method."),aa=c(),N=n("div"),M(Re.$$.fragment),ra=c(),bt=n("p"),ia=r("Create the token type IDs corresponding to the sequences passed. "),yt=n("a"),da=r(`What are token type
IDs?`),la=c(),uo=n("p"),ca=r("Should be overridden in a subclass if the model has a special way of building those."),ha=c(),Tt=n("div"),M(Je.$$.fragment),Bo=c(),K=n("h2"),he=n("a"),fo=n("span"),M(Ke.$$.fragment),pa=c(),_o=n("span"),ma=r("M2M100Model"),Ho=c(),P=n("div"),M(Ze.$$.fragment),ua=c(),Qe=n("p"),fa=r(`The bare M2M100 Model outputting raw hidden-states without any specific head on top.
This model inherits from `),wt=n("a"),_a=r("PreTrainedModel"),ga=r(`. 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.)`),ka=c(),Ye=n("p"),Ma=r("This model is also a PyTorch "),et=n("a"),va=r("torch.nn.Module"),ba=r(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),ya=c(),S=n("div"),M(tt.$$.fragment),Ta=c(),Z=n("p"),wa=r("The "),$t=n("a"),$a=r("M2M100Model"),za=r(" forward method, overrides the "),go=n("code"),qa=r("__call__"),xa=r(" special method."),Ea=c(),M(pe.$$.fragment),Ca=c(),M(me.$$.fragment),Uo=c(),Q=n("h2"),ue=n("a"),ko=n("span"),M(ot.$$.fragment),Fa=c(),Mo=n("span"),Pa=r("M2M100ForConditionalGeneration"),Vo=c(),j=n("div"),M(nt.$$.fragment),ja=c(),st=n("p"),Aa=r(`The M2M100 Model with a language modeling head. Can be used for summarization.
This model inherits from `),zt=n("a"),Oa=r("PreTrainedModel"),Sa=r(`. 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.)`),La=c(),at=n("p"),Da=r("This model is also a PyTorch "),rt=n("a"),Ia=r("torch.nn.Module"),Na=r(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Ga=c(),L=n("div"),M(it.$$.fragment),Wa=c(),Y=n("p"),Ba=r("The "),qt=n("a"),Ha=r("M2M100ForConditionalGeneration"),Ua=r(" forward method, overrides the "),vo=n("code"),Va=r("__call__"),Xa=r(" special method."),Ra=c(),M(fe.$$.fragment),Ja=c(),M(_e.$$.fragment),this.h()},l(t){const p=_i('[data-svelte="svelte-1phssyn"]',document.head);m=s(p,"META",{name:!0,content:!0}),p.forEach(o),$=h(t),g=s(t,"H1",{class:!0});var dt=a(g);f=s(dt,"A",{id:!0,class:!0,href:!0});var bo=a(f);k=s(bo,"SPAN",{});var yo=a(k);v(d.$$.fragment,yo),yo.forEach(o),bo.forEach(o),_=h(dt),I=s(dt,"SPAN",{});var To=a(I);Mn=i(To,"M2M100"),To.forEach(o),dt.forEach(o),$o=h(t),B=s(t,"H2",{class:!0});var lt=a(B);ee=s(lt,"A",{id:!0,class:!0,href:!0});var wo=a(ee);At=s(wo,"SPAN",{});var Za=a(At);v($e.$$.fragment,Za),Za.forEach(o),wo.forEach(o),vn=h(lt),Ot=s(lt,"SPAN",{});var Qa=a(Ot);bn=i(Qa,"Overview"),Qa.forEach(o),lt.forEach(o),zo=h(t),te=s(t,"P",{});var Ro=a(te);yn=i(Ro,"The M2M100 model was proposed in "),ze=s(Ro,"A",{href:!0,rel:!0});var Ya=a(ze);Tn=i(Ya,"Beyond English-Centric Multilingual Machine Translation"),Ya.forEach(o),wn=i(Ro,` by Angela Fan, Shruti Bhosale, Holger Schwenk, Zhiyi Ma, Ahmed El-Kishky,
Siddharth Goyal, Mandeep Baines, Onur Celebi, Guillaume Wenzek, Vishrav Chaudhary, Naman Goyal, Tom Birch, Vitaliy
Liptchinsky, Sergey Edunov, Edouard Grave, Michael Auli, Armand Joulin.`),Ro.forEach(o),qo=h(t),ct=s(t,"P",{});var er=a(ct);$n=i(er,"The abstract from the paper is the following:"),er.forEach(o),xo=h(t),ht=s(t,"P",{});var tr=a(ht);St=s(tr,"EM",{});var or=a(St);zn=i(or,`Existing work in translation demonstrated the potential of massively multilingual machine translation by training a
single model able to translate between any pair of languages. However, much of this work is English-Centric by training
only on data which was translated from or to English. While this is supported by large sources of training data, it
does not reflect translation needs worldwide. In this work, we create a true Many-to-Many multilingual translation
model that can translate directly between any pair of 100 languages. We build and open source a training dataset that
covers thousands of language directions with supervised data, created through large-scale mining. Then, we explore how
to effectively increase model capacity through a combination of dense scaling and language-specific sparse parameters
to create high quality models. Our focus on non-English-Centric models brings gains of more than 10 BLEU when directly
translating between non-English directions while performing competitively to the best single systems of WMT. We
open-source our scripts so that others may reproduce the data, evaluation, and final M2M-100 model.`),or.forEach(o),tr.forEach(o),Eo=h(t),oe=s(t,"P",{});var Jo=a(oe);qn=i(Jo,"This model was contributed by "),qe=s(Jo,"A",{href:!0,rel:!0});var nr=a(qe);xn=i(nr,"valhalla"),nr.forEach(o),En=i(Jo,"."),Jo.forEach(o),Co=h(t),H=s(t,"H3",{class:!0});var Ko=a(H);ne=s(Ko,"A",{id:!0,class:!0,href:!0});var sr=a(ne);Lt=s(sr,"SPAN",{});var ar=a(Lt);v(xe.$$.fragment,ar),ar.forEach(o),sr.forEach(o),Cn=h(Ko),Dt=s(Ko,"SPAN",{});var rr=a(Dt);Fn=i(rr,"Training and Generation"),rr.forEach(o),Ko.forEach(o),Fo=h(t),A=s(t,"P",{});var ge=a(A);Pn=i(ge,`M2M100 is a multilingual encoder-decoder (seq-to-seq) model primarily intended for translation tasks. As the model is
multilingual it expects the sequences in a certain format: A special language id token is used as prefix in both the
source and target text. The source text format is `),It=s(ge,"CODE",{});var ir=a(It);jn=i(ir,"[lang_code] X [eos]"),ir.forEach(o),An=i(ge,", where "),Nt=s(ge,"CODE",{});var dr=a(Nt);On=i(dr,"lang_code"),dr.forEach(o),Sn=i(ge,` is source language
id for source text and target language id for target text, with `),Gt=s(ge,"CODE",{});var lr=a(Gt);Ln=i(lr,"X"),lr.forEach(o),Dn=i(ge," being the source or target text."),ge.forEach(o),Po=h(t),C=s(t,"P",{});var G=a(C);In=i(G,"The "),pt=s(G,"A",{href:!0});var cr=a(pt);Nn=i(cr,"M2M100Tokenizer"),cr.forEach(o),Gn=i(G," depends on "),Wt=s(G,"CODE",{});var hr=a(Wt);Wn=i(hr,"sentencepiece"),hr.forEach(o),Bn=i(G,` so be sure to install it before running the
examples. To install `),Bt=s(G,"CODE",{});var pr=a(Bt);Hn=i(pr,"sentencepiece"),pr.forEach(o),Un=i(G," run "),Ht=s(G,"CODE",{});var mr=a(Ht);Vn=i(mr,"pip install sentencepiece"),mr.forEach(o),Xn=i(G,"."),G.forEach(o),jo=h(t),mt=s(t,"UL",{});var ur=a(mt);Ut=s(ur,"LI",{});var fr=a(Ut);Rn=i(fr,"Supervised Training"),fr.forEach(o),ur.forEach(o),Ao=h(t),v(Ee.$$.fragment,t),Oo=h(t),ut=s(t,"UL",{});var _r=a(ut);Ce=s(_r,"LI",{});var Zo=a(Ce);Vt=s(Zo,"P",{});var gr=a(Vt);Jn=i(gr,"Generation"),gr.forEach(o),Kn=h(Zo),x=s(Zo,"P",{});var D=a(x);Zn=i(D,"M2M100 uses the "),Xt=s(D,"CODE",{});var kr=a(Xt);Qn=i(kr,"eos_token_id"),kr.forEach(o),Yn=i(D," as the "),Rt=s(D,"CODE",{});var Mr=a(Rt);es=i(Mr,"decoder_start_token_id"),Mr.forEach(o),ts=i(D,` for generation with the target language id
being forced as the first generated token. To force the target language id as the first generated token, pass the
`),Jt=s(D,"EM",{});var vr=a(Jt);os=i(vr,"forced_bos_token_id"),vr.forEach(o),ns=i(D," parameter to the "),Kt=s(D,"EM",{});var br=a(Kt);ss=i(br,"generate"),br.forEach(o),as=i(D,` method. The following example shows how to translate between
Hindi to French and Chinese to English using the `),Zt=s(D,"EM",{});var yr=a(Zt);rs=i(yr,"facebook/m2m100_418M"),yr.forEach(o),is=i(D," checkpoint."),D.forEach(o),Zo.forEach(o),_r.forEach(o),So=h(t),v(Fe.$$.fragment,t),Lo=h(t),U=s(t,"H2",{class:!0});var Qo=a(U);se=s(Qo,"A",{id:!0,class:!0,href:!0});var Tr=a(se);Qt=s(Tr,"SPAN",{});var wr=a(Qt);v(Pe.$$.fragment,wr),wr.forEach(o),Tr.forEach(o),ds=h(Qo),Yt=s(Qo,"SPAN",{});var $r=a(Yt);ls=i($r,"Documentation resources"),$r.forEach(o),Qo.forEach(o),Do=h(t),ae=s(t,"UL",{});var Yo=a(ae);eo=s(Yo,"LI",{});var zr=a(eo);ft=s(zr,"A",{href:!0});var qr=a(ft);cs=i(qr,"Translation task guide"),qr.forEach(o),zr.forEach(o),hs=h(Yo),to=s(Yo,"LI",{});var xr=a(to);_t=s(xr,"A",{href:!0});var Er=a(_t);ps=i(Er,"Summarization task guide"),Er.forEach(o),xr.forEach(o),Yo.forEach(o),Io=h(t),V=s(t,"H2",{class:!0});var en=a(V);re=s(en,"A",{id:!0,class:!0,href:!0});var Cr=a(re);oo=s(Cr,"SPAN",{});var Fr=a(oo);v(je.$$.fragment,Fr),Fr.forEach(o),Cr.forEach(o),ms=h(en),no=s(en,"SPAN",{});var Pr=a(no);us=i(Pr,"M2M100Config"),Pr.forEach(o),en.forEach(o),No=h(t),F=s(t,"DIV",{class:!0});var ke=a(F);v(Ae.$$.fragment,ke),fs=h(ke),X=s(ke,"P",{});var xt=a(X);_s=i(xt,"This is the configuration class to store the configuration of a "),gt=s(xt,"A",{href:!0});var jr=a(gt);gs=i(jr,"M2M100Model"),jr.forEach(o),ks=i(xt,`. It is used to instantiate an
M2M100 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 M2M100
`),Oe=s(xt,"A",{href:!0,rel:!0});var Ar=a(Oe);Ms=i(Ar,"facebook/m2m100_418M"),Ar.forEach(o),vs=i(xt," architecture."),xt.forEach(o),bs=h(ke),R=s(ke,"P",{});var Et=a(R);ys=i(Et,"Configuration objects inherit from "),kt=s(Et,"A",{href:!0});var Or=a(kt);Ts=i(Or,"PretrainedConfig"),Or.forEach(o),ws=i(Et,` and can be used to control the model outputs. Read the
documentation from `),Mt=s(Et,"A",{href:!0});var Sr=a(Mt);$s=i(Sr,"PretrainedConfig"),Sr.forEach(o),zs=i(Et," for more information."),Et.forEach(o),qs=h(ke),v(ie.$$.fragment,ke),ke.forEach(o),Go=h(t),J=s(t,"H2",{class:!0});var tn=a(J);de=s(tn,"A",{id:!0,class:!0,href:!0});var Lr=a(de);so=s(Lr,"SPAN",{});var Dr=a(so);v(Se.$$.fragment,Dr),Dr.forEach(o),Lr.forEach(o),xs=h(tn),ao=s(tn,"SPAN",{});var Ir=a(ao);Es=i(Ir,"M2M100Tokenizer"),Ir.forEach(o),tn.forEach(o),Wo=h(t),z=s(t,"DIV",{class:!0});var q=a(z);v(Le.$$.fragment,q),Cs=h(q),De=s(q,"P",{});var on=a(De);Fs=i(on,"Construct an M2M100 tokenizer. Based on "),Ie=s(on,"A",{href:!0,rel:!0});var Nr=a(Ie);Ps=i(Nr,"SentencePiece"),Nr.forEach(o),js=i(on,"."),on.forEach(o),As=h(q),Ne=s(q,"P",{});var nn=a(Ne);Os=i(nn,"This tokenizer inherits from "),vt=s(nn,"A",{href:!0});var Gr=a(vt);Ss=i(Gr,"PreTrainedTokenizer"),Gr.forEach(o),Ls=i(nn,` which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.`),nn.forEach(o),Ds=h(q),v(le.$$.fragment,q),Is=h(q),O=s(q,"DIV",{class:!0});var Me=a(O);v(Ge.$$.fragment,Me),Ns=h(Me),We=s(Me,"P",{});var sn=a(We);Gs=i(sn,`Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
adding special tokens. An MBART sequence has the following format, where `),ro=s(sn,"CODE",{});var Wr=a(ro);Ws=i(Wr,"X"),Wr.forEach(o),Bs=i(sn," represents the sequence:"),sn.forEach(o),Hs=h(Me),Be=s(Me,"UL",{});var an=a(Be);He=s(an,"LI",{});var rn=a(He);io=s(rn,"CODE",{});var Br=a(io);Us=i(Br,"input_ids"),Br.forEach(o),Vs=i(rn," (for encoder) "),lo=s(rn,"CODE",{});var Hr=a(lo);Xs=i(Hr,"X [eos, src_lang_code]"),Hr.forEach(o),rn.forEach(o),Rs=h(an),Ue=s(an,"LI",{});var dn=a(Ue);co=s(dn,"CODE",{});var Ur=a(co);Js=i(Ur,"decoder_input_ids"),Ur.forEach(o),Ks=i(dn,": (for decoder) "),ho=s(dn,"CODE",{});var Vr=a(ho);Zs=i(Vr,"X [eos, tgt_lang_code]"),Vr.forEach(o),dn.forEach(o),an.forEach(o),Qs=h(Me),po=s(Me,"P",{});var Xr=a(po);Ys=i(Xr,`BOS is never used. Pairs of sequences are not the expected use case, but they will be handled without a
separator.`),Xr.forEach(o),Me.forEach(o),ea=h(q),ce=s(q,"DIV",{class:!0});var ln=a(ce);v(Ve.$$.fragment,ln),ta=h(ln),Xe=s(ln,"P",{});var cn=a(Xe);oa=i(cn,`Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
special tokens using the tokenizer `),mo=s(cn,"CODE",{});var Rr=a(mo);na=i(Rr,"prepare_for_model"),Rr.forEach(o),sa=i(cn," method."),cn.forEach(o),ln.forEach(o),aa=h(q),N=s(q,"DIV",{class:!0});var Ct=a(N);v(Re.$$.fragment,Ct),ra=h(Ct),bt=s(Ct,"P",{});var Ka=a(bt);ia=i(Ka,"Create the token type IDs corresponding to the sequences passed. "),yt=s(Ka,"A",{href:!0});var Jr=a(yt);da=i(Jr,`What are token type
IDs?`),Jr.forEach(o),Ka.forEach(o),la=h(Ct),uo=s(Ct,"P",{});var Kr=a(uo);ca=i(Kr,"Should be overridden in a subclass if the model has a special way of building those."),Kr.forEach(o),Ct.forEach(o),ha=h(q),Tt=s(q,"DIV",{class:!0});var Zr=a(Tt);v(Je.$$.fragment,Zr),Zr.forEach(o),q.forEach(o),Bo=h(t),K=s(t,"H2",{class:!0});var hn=a(K);he=s(hn,"A",{id:!0,class:!0,href:!0});var Qr=a(he);fo=s(Qr,"SPAN",{});var Yr=a(fo);v(Ke.$$.fragment,Yr),Yr.forEach(o),Qr.forEach(o),pa=h(hn),_o=s(hn,"SPAN",{});var ei=a(_o);ma=i(ei,"M2M100Model"),ei.forEach(o),hn.forEach(o),Ho=h(t),P=s(t,"DIV",{class:!0});var ve=a(P);v(Ze.$$.fragment,ve),ua=h(ve),Qe=s(ve,"P",{});var pn=a(Qe);fa=i(pn,`The bare M2M100 Model outputting raw hidden-states without any specific head on top.
This model inherits from `),wt=s(pn,"A",{href:!0});var ti=a(wt);_a=i(ti,"PreTrainedModel"),ti.forEach(o),ga=i(pn,`. 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.)`),pn.forEach(o),ka=h(ve),Ye=s(ve,"P",{});var mn=a(Ye);Ma=i(mn,"This model is also a PyTorch "),et=s(mn,"A",{href:!0,rel:!0});var oi=a(et);va=i(oi,"torch.nn.Module"),oi.forEach(o),ba=i(mn,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),mn.forEach(o),ya=h(ve),S=s(ve,"DIV",{class:!0});var be=a(S);v(tt.$$.fragment,be),Ta=h(be),Z=s(be,"P",{});var Ft=a(Z);wa=i(Ft,"The "),$t=s(Ft,"A",{href:!0});var ni=a($t);$a=i(ni,"M2M100Model"),ni.forEach(o),za=i(Ft," forward method, overrides the "),go=s(Ft,"CODE",{});var si=a(go);qa=i(si,"__call__"),si.forEach(o),xa=i(Ft," special method."),Ft.forEach(o),Ea=h(be),v(pe.$$.fragment,be),Ca=h(be),v(me.$$.fragment,be),be.forEach(o),ve.forEach(o),Uo=h(t),Q=s(t,"H2",{class:!0});var un=a(Q);ue=s(un,"A",{id:!0,class:!0,href:!0});var ai=a(ue);ko=s(ai,"SPAN",{});var ri=a(ko);v(ot.$$.fragment,ri),ri.forEach(o),ai.forEach(o),Fa=h(un),Mo=s(un,"SPAN",{});var ii=a(Mo);Pa=i(ii,"M2M100ForConditionalGeneration"),ii.forEach(o),un.forEach(o),Vo=h(t),j=s(t,"DIV",{class:!0});var ye=a(j);v(nt.$$.fragment,ye),ja=h(ye),st=s(ye,"P",{});var fn=a(st);Aa=i(fn,`The M2M100 Model with a language modeling head. Can be used for summarization.
This model inherits from `),zt=s(fn,"A",{href:!0});var di=a(zt);Oa=i(di,"PreTrainedModel"),di.forEach(o),Sa=i(fn,`. 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.)`),fn.forEach(o),La=h(ye),at=s(ye,"P",{});var _n=a(at);Da=i(_n,"This model is also a PyTorch "),rt=s(_n,"A",{href:!0,rel:!0});var li=a(rt);Ia=i(li,"torch.nn.Module"),li.forEach(o),Na=i(_n,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),_n.forEach(o),Ga=h(ye),L=s(ye,"DIV",{class:!0});var Te=a(L);v(it.$$.fragment,Te),Wa=h(Te),Y=s(Te,"P",{});var Pt=a(Y);Ba=i(Pt,"The "),qt=s(Pt,"A",{href:!0});var ci=a(qt);Ha=i(ci,"M2M100ForConditionalGeneration"),ci.forEach(o),Ua=i(Pt," forward method, overrides the "),vo=s(Pt,"CODE",{});var hi=a(vo);Va=i(hi,"__call__"),hi.forEach(o),Xa=i(Pt," special method."),Pt.forEach(o),Ra=h(Te),v(fe.$$.fragment,Te),Ja=h(Te),v(_e.$$.fragment,Te),Te.forEach(o),ye.forEach(o),this.h()},h(){l(m,"name","hf:doc:metadata"),l(m,"content",JSON.stringify($i)),l(f,"id","m2m100"),l(f,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(f,"href","#m2m100"),l(g,"class","relative group"),l(ee,"id","overview"),l(ee,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),l(ee,"href","#overview"),l(B,"class","relative group"),l(ze,"href","https://arxiv.org/abs/2010.11125"),l(ze,"rel","nofollow"),l(qe,"href","https://huggingface.co/valhalla"),l(qe,"rel","nofollow"),l(ne,"id","training-and-generation"),l(ne,"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"),l(ne,"href","#training-and-generation"),l(H,"class","relative group"),l(pt,"href","/docs/transformers/v4.29.0/en/model_doc/m2m_100#transformers.M2M100Tokenizer"),l(se,"id","documentation-resources"),l(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"),l(se,"href","#documentation-resources"),l(U,"class","relative group"),l(ft,"href","../tasks/translation"),l(_t,"href","../tasks/summarization"),l(re,"id","transformers.M2M100Config"),l(re,"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"),l(re,"href","#transformers.M2M100Config"),l(V,"class","relative group"),l(gt,"href","/docs/transformers/v4.29.0/en/model_doc/m2m_100#transformers.M2M100Model"),l(Oe,"href","https://huggingface.co/facebook/m2m100_418M"),l(Oe,"rel","nofollow"),l(kt,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig"),l(Mt,"href","/docs/transformers/v4.29.0/en/main_classes/configuration#transformers.PretrainedConfig"),l(F,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(de,"id","transformers.M2M100Tokenizer"),l(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"),l(de,"href","#transformers.M2M100Tokenizer"),l(J,"class","relative group"),l(Ie,"href","https://github.com/google/sentencepiece"),l(Ie,"rel","nofollow"),l(vt,"href","/docs/transformers/v4.29.0/en/main_classes/tokenizer#transformers.PreTrainedTokenizer"),l(O,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(ce,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(yt,"href","../glossary#token-type-ids"),l(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(Tt,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(z,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(he,"id","transformers.M2M100Model"),l(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"),l(he,"href","#transformers.M2M100Model"),l(K,"class","relative group"),l(wt,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.PreTrainedModel"),l(et,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(et,"rel","nofollow"),l($t,"href","/docs/transformers/v4.29.0/en/model_doc/m2m_100#transformers.M2M100Model"),l(S,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(P,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(ue,"id","transformers.M2M100ForConditionalGeneration"),l(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"),l(ue,"href","#transformers.M2M100ForConditionalGeneration"),l(Q,"class","relative group"),l(zt,"href","/docs/transformers/v4.29.0/en/main_classes/model#transformers.PreTrainedModel"),l(rt,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),l(rt,"rel","nofollow"),l(qt,"href","/docs/transformers/v4.29.0/en/model_doc/m2m_100#transformers.M2M100ForConditionalGeneration"),l(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),l(j,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8")},m(t,p){e(document.head,m),u(t,$,p),u(t,g,p),e(g,f),e(f,k),b(d,k,null),e(g,_),e(g,I),e(I,Mn),u(t,$o,p),u(t,B,p),e(B,ee),e(ee,At),b($e,At,null),e(B,vn),e(B,Ot),e(Ot,bn),u(t,zo,p),u(t,te,p),e(te,yn),e(te,ze),e(ze,Tn),e(te,wn),u(t,qo,p),u(t,ct,p),e(ct,$n),u(t,xo,p),u(t,ht,p),e(ht,St),e(St,zn),u(t,Eo,p),u(t,oe,p),e(oe,qn),e(oe,qe),e(qe,xn),e(oe,En),u(t,Co,p),u(t,H,p),e(H,ne),e(ne,Lt),b(xe,Lt,null),e(H,Cn),e(H,Dt),e(Dt,Fn),u(t,Fo,p),u(t,A,p),e(A,Pn),e(A,It),e(It,jn),e(A,An),e(A,Nt),e(Nt,On),e(A,Sn),e(A,Gt),e(Gt,Ln),e(A,Dn),u(t,Po,p),u(t,C,p),e(C,In),e(C,pt),e(pt,Nn),e(C,Gn),e(C,Wt),e(Wt,Wn),e(C,Bn),e(C,Bt),e(Bt,Hn),e(C,Un),e(C,Ht),e(Ht,Vn),e(C,Xn),u(t,jo,p),u(t,mt,p),e(mt,Ut),e(Ut,Rn),u(t,Ao,p),b(Ee,t,p),u(t,Oo,p),u(t,ut,p),e(ut,Ce),e(Ce,Vt),e(Vt,Jn),e(Ce,Kn),e(Ce,x),e(x,Zn),e(x,Xt),e(Xt,Qn),e(x,Yn),e(x,Rt),e(Rt,es),e(x,ts),e(x,Jt),e(Jt,os),e(x,ns),e(x,Kt),e(Kt,ss),e(x,as),e(x,Zt),e(Zt,rs),e(x,is),u(t,So,p),b(Fe,t,p),u(t,Lo,p),u(t,U,p),e(U,se),e(se,Qt),b(Pe,Qt,null),e(U,ds),e(U,Yt),e(Yt,ls),u(t,Do,p),u(t,ae,p),e(ae,eo),e(eo,ft),e(ft,cs),e(ae,hs),e(ae,to),e(to,_t),e(_t,ps),u(t,Io,p),u(t,V,p),e(V,re),e(re,oo),b(je,oo,null),e(V,ms),e(V,no),e(no,us),u(t,No,p),u(t,F,p),b(Ae,F,null),e(F,fs),e(F,X),e(X,_s),e(X,gt),e(gt,gs),e(X,ks),e(X,Oe),e(Oe,Ms),e(X,vs),e(F,bs),e(F,R),e(R,ys),e(R,kt),e(kt,Ts),e(R,ws),e(R,Mt),e(Mt,$s),e(R,zs),e(F,qs),b(ie,F,null),u(t,Go,p),u(t,J,p),e(J,de),e(de,so),b(Se,so,null),e(J,xs),e(J,ao),e(ao,Es),u(t,Wo,p),u(t,z,p),b(Le,z,null),e(z,Cs),e(z,De),e(De,Fs),e(De,Ie),e(Ie,Ps),e(De,js),e(z,As),e(z,Ne),e(Ne,Os),e(Ne,vt),e(vt,Ss),e(Ne,Ls),e(z,Ds),b(le,z,null),e(z,Is),e(z,O),b(Ge,O,null),e(O,Ns),e(O,We),e(We,Gs),e(We,ro),e(ro,Ws),e(We,Bs),e(O,Hs),e(O,Be),e(Be,He),e(He,io),e(io,Us),e(He,Vs),e(He,lo),e(lo,Xs),e(Be,Rs),e(Be,Ue),e(Ue,co),e(co,Js),e(Ue,Ks),e(Ue,ho),e(ho,Zs),e(O,Qs),e(O,po),e(po,Ys),e(z,ea),e(z,ce),b(Ve,ce,null),e(ce,ta),e(ce,Xe),e(Xe,oa),e(Xe,mo),e(mo,na),e(Xe,sa),e(z,aa),e(z,N),b(Re,N,null),e(N,ra),e(N,bt),e(bt,ia),e(bt,yt),e(yt,da),e(N,la),e(N,uo),e(uo,ca),e(z,ha),e(z,Tt),b(Je,Tt,null),u(t,Bo,p),u(t,K,p),e(K,he),e(he,fo),b(Ke,fo,null),e(K,pa),e(K,_o),e(_o,ma),u(t,Ho,p),u(t,P,p),b(Ze,P,null),e(P,ua),e(P,Qe),e(Qe,fa),e(Qe,wt),e(wt,_a),e(Qe,ga),e(P,ka),e(P,Ye),e(Ye,Ma),e(Ye,et),e(et,va),e(Ye,ba),e(P,ya),e(P,S),b(tt,S,null),e(S,Ta),e(S,Z),e(Z,wa),e(Z,$t),e($t,$a),e(Z,za),e(Z,go),e(go,qa),e(Z,xa),e(S,Ea),b(pe,S,null),e(S,Ca),b(me,S,null),u(t,Uo,p),u(t,Q,p),e(Q,ue),e(ue,ko),b(ot,ko,null),e(Q,Fa),e(Q,Mo),e(Mo,Pa),u(t,Vo,p),u(t,j,p),b(nt,j,null),e(j,ja),e(j,st),e(st,Aa),e(st,zt),e(zt,Oa),e(st,Sa),e(j,La),e(j,at),e(at,Da),e(at,rt),e(rt,Ia),e(at,Na),e(j,Ga),e(j,L),b(it,L,null),e(L,Wa),e(L,Y),e(Y,Ba),e(Y,qt),e(qt,Ha),e(Y,Ua),e(Y,vo),e(vo,Va),e(Y,Xa),e(L,Ra),b(fe,L,null),e(L,Ja),b(_e,L,null),Xo=!0},p(t,[p]){const dt={};p&2&&(dt.$$scope={dirty:p,ctx:t}),ie.$set(dt);const bo={};p&2&&(bo.$$scope={dirty:p,ctx:t}),le.$set(bo);const yo={};p&2&&(yo.$$scope={dirty:p,ctx:t}),pe.$set(yo);const To={};p&2&&(To.$$scope={dirty:p,ctx:t}),me.$set(To);const lt={};p&2&&(lt.$$scope={dirty:p,ctx:t}),fe.$set(lt);const wo={};p&2&&(wo.$$scope={dirty:p,ctx:t}),_e.$set(wo)},i(t){Xo||(y(d.$$.fragment,t),y($e.$$.fragment,t),y(xe.$$.fragment,t),y(Ee.$$.fragment,t),y(Fe.$$.fragment,t),y(Pe.$$.fragment,t),y(je.$$.fragment,t),y(Ae.$$.fragment,t),y(ie.$$.fragment,t),y(Se.$$.fragment,t),y(Le.$$.fragment,t),y(le.$$.fragment,t),y(Ge.$$.fragment,t),y(Ve.$$.fragment,t),y(Re.$$.fragment,t),y(Je.$$.fragment,t),y(Ke.$$.fragment,t),y(Ze.$$.fragment,t),y(tt.$$.fragment,t),y(pe.$$.fragment,t),y(me.$$.fragment,t),y(ot.$$.fragment,t),y(nt.$$.fragment,t),y(it.$$.fragment,t),y(fe.$$.fragment,t),y(_e.$$.fragment,t),Xo=!0)},o(t){T(d.$$.fragment,t),T($e.$$.fragment,t),T(xe.$$.fragment,t),T(Ee.$$.fragment,t),T(Fe.$$.fragment,t),T(Pe.$$.fragment,t),T(je.$$.fragment,t),T(Ae.$$.fragment,t),T(ie.$$.fragment,t),T(Se.$$.fragment,t),T(Le.$$.fragment,t),T(le.$$.fragment,t),T(Ge.$$.fragment,t),T(Ve.$$.fragment,t),T(Re.$$.fragment,t),T(Je.$$.fragment,t),T(Ke.$$.fragment,t),T(Ze.$$.fragment,t),T(tt.$$.fragment,t),T(pe.$$.fragment,t),T(me.$$.fragment,t),T(ot.$$.fragment,t),T(nt.$$.fragment,t),T(it.$$.fragment,t),T(fe.$$.fragment,t),T(_e.$$.fragment,t),Xo=!1},d(t){o(m),t&&o($),t&&o(g),w(d),t&&o($o),t&&o(B),w($e),t&&o(zo),t&&o(te),t&&o(qo),t&&o(ct),t&&o(xo),t&&o(ht),t&&o(Eo),t&&o(oe),t&&o(Co),t&&o(H),w(xe),t&&o(Fo),t&&o(A),t&&o(Po),t&&o(C),t&&o(jo),t&&o(mt),t&&o(Ao),w(Ee,t),t&&o(Oo),t&&o(ut),t&&o(So),w(Fe,t),t&&o(Lo),t&&o(U),w(Pe),t&&o(Do),t&&o(ae),t&&o(Io),t&&o(V),w(je),t&&o(No),t&&o(F),w(Ae),w(ie),t&&o(Go),t&&o(J),w(Se),t&&o(Wo),t&&o(z),w(Le),w(le),w(Ge),w(Ve),w(Re),w(Je),t&&o(Bo),t&&o(K),w(Ke),t&&o(Ho),t&&o(P),w(Ze),w(tt),w(pe),w(me),t&&o(Uo),t&&o(Q),w(ot),t&&o(Vo),t&&o(j),w(nt),w(it),w(fe),w(_e)}}}const $i={local:"m2m100",sections:[{local:"overview",sections:[{local:"training-and-generation",title:"Training and Generation"}],title:"Overview"},{local:"documentation-resources",title:"Documentation resources"},{local:"transformers.M2M100Config",title:"M2M100Config"},{local:"transformers.M2M100Tokenizer",title:"M2M100Tokenizer"},{local:"transformers.M2M100Model",title:"M2M100Model"},{local:"transformers.M2M100ForConditionalGeneration",title:"M2M100ForConditionalGeneration"}],title:"M2M100"};function zi(E){return gi(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class ji extends mi{constructor(m){super();ui(this,m,zi,wi,fi,{})}}export{ji as default,$i as metadata};
