import{S as Va,i as Qa,s as Xa,e as n,k as d,w as u,t as a,M as Ka,c as s,d as o,m as l,a as r,x as _,h as i,b as c,F as e,g as m,y as g,q as k,o as T,B as v}from"../../chunks/vendor-4833417e.js";import{T as Ha}from"../../chunks/Tip-fffd6df1.js";import{D as L}from"../../chunks/Docstring-4f315ed9.js";import{C as Xo}from"../../chunks/CodeBlock-6a3d1b46.js";import{I as ot}from"../../chunks/IconCopyLink-4b81c553.js";import"../../chunks/CopyButton-dacfbfaf.js";function Ya(ke){let p,q,f,y,P;return{c(){p=n("p"),q=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n("code"),y=a("Module"),P=a(`
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(M){p=s(M,"P",{});var w=r(p);q=i(w,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=s(w,"CODE",{});var A=r(f);y=i(A,"Module"),A.forEach(o),P=i(w,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),w.forEach(o)},m(M,w){m(M,p,w),e(p,q),e(p,f),e(f,y),e(p,P)},d(M){M&&o(p)}}}function Ja(ke){let p,q,f,y,P;return{c(){p=n("p"),q=a("Although the recipe for forward pass needs to be defined within this function, one should call the "),f=n("code"),y=a("Module"),P=a(`
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(M){p=s(M,"P",{});var w=r(p);q=i(w,"Although the recipe for forward pass needs to be defined within this function, one should call the "),f=s(w,"CODE",{});var A=r(f);y=i(A,"Module"),A.forEach(o),P=i(w,`
instance afterwards instead of this since the former takes care of running the pre and post processing steps while
the latter silently ignores them.`),w.forEach(o)},m(M,w){m(M,p,w),e(p,q),e(p,f),e(f,y),e(p,P)},d(M){M&&o(p)}}}function Za(ke){let p,q,f,y,P,M,w,A,Ko,fo,H,$t,Yo,Jo,Te,Zo,en,uo,V,re,zt,ve,tn,qt,on,_o,ae,nn,be,sn,rn,go,nt,an,ko,st,Et,dn,To,j,ln,ye,cn,hn,Me,mn,pn,vo,Q,ie,xt,we,fn,Ct,un,bo,rt,X,_n,at,gn,kn,it,Tn,vn,yo,K,de,Pt,Fe,bn,It,yn,Mo,F,Se,Mn,$e,wn,dt,Fn,Sn,$n,Y,zn,lt,qn,En,ct,xn,Cn,Pn,At,In,An,ze,Dn,le,qe,Nn,J,Ln,Dt,jn,On,Nt,Gn,Bn,wo,Z,ce,Lt,Ee,Wn,jt,Rn,Fo,b,xe,Un,Ot,Hn,Vn,D,Gt,Qn,Xn,Bt,Kn,Yn,N,Jn,Wt,Zn,es,Rt,ts,os,Ut,ns,ss,rs,Ce,as,Ht,is,ds,ls,Pe,cs,ht,hs,ms,ps,O,Ie,fs,Vt,us,_s,Ae,mt,gs,Qt,ks,Ts,pt,vs,Xt,bs,ys,he,De,Ms,Ne,ws,Kt,Fs,Ss,$s,E,Le,zs,Yt,qs,Es,je,xs,ee,Cs,Jt,Ps,Is,Zt,As,Ds,Ns,eo,Ls,js,ft,Oe,So,te,me,to,Ge,Os,oo,Gs,$o,$,Be,Bs,no,Ws,Rs,We,Us,ut,Hs,Vs,Qs,Re,Xs,Ue,Ks,Ys,Js,x,He,Zs,oe,er,_t,tr,or,so,nr,sr,rr,pe,ar,ro,ir,dr,Ve,zo,ne,fe,ao,Qe,lr,io,cr,qo,z,Xe,hr,lo,mr,pr,Ke,fr,gt,ur,_r,gr,Ye,kr,Je,Tr,vr,br,C,Ze,yr,se,Mr,kt,wr,Fr,co,Sr,$r,zr,ue,qr,ho,Er,xr,et,Eo;return M=new ot({}),ve=new ot({}),we=new ot({}),Fe=new ot({}),Se=new L({props:{name:"class transformers.FSMTConfig",anchor:"transformers.FSMTConfig",parameters:[{name:"langs",val:" = ['en', 'de']"},{name:"src_vocab_size",val:" = 42024"},{name:"tgt_vocab_size",val:" = 42024"},{name:"activation_function",val:" = 'relu'"},{name:"d_model",val:" = 1024"},{name:"max_length",val:" = 200"},{name:"max_position_embeddings",val:" = 1024"},{name:"encoder_ffn_dim",val:" = 4096"},{name:"encoder_layers",val:" = 12"},{name:"encoder_attention_heads",val:" = 16"},{name:"encoder_layerdrop",val:" = 0.0"},{name:"decoder_ffn_dim",val:" = 4096"},{name:"decoder_layers",val:" = 12"},{name:"decoder_attention_heads",val:" = 16"},{name:"decoder_layerdrop",val:" = 0.0"},{name:"attention_dropout",val:" = 0.0"},{name:"dropout",val:" = 0.1"},{name:"activation_dropout",val:" = 0.0"},{name:"init_std",val:" = 0.02"},{name:"decoder_start_token_id",val:" = 2"},{name:"is_encoder_decoder",val:" = True"},{name:"scale_embedding",val:" = True"},{name:"tie_word_embeddings",val:" = False"},{name:"num_beams",val:" = 5"},{name:"length_penalty",val:" = 1.0"},{name:"early_stopping",val:" = False"},{name:"use_cache",val:" = True"},{name:"pad_token_id",val:" = 1"},{name:"bos_token_id",val:" = 0"},{name:"eos_token_id",val:" = 2"},{name:"forced_eos_token_id",val:" = 2"},{name:"**common_kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/models/fsmt/configuration_fsmt.py#L41",parametersDescription:[{anchor:"transformers.FSMTConfig.langs",description:`<strong>langs</strong> (<code>List[str]</code>) &#x2014;
A list with source language and target_language (e.g., [&#x2018;en&#x2019;, &#x2018;ru&#x2019;]).`,name:"langs"},{anchor:"transformers.FSMTConfig.src_vocab_size",description:`<strong>src_vocab_size</strong> (<code>int</code>) &#x2014;
Vocabulary size of the encoder. Defines the number of different tokens that can be represented by the
<code>inputs_ids</code> passed to the forward method in the encoder.`,name:"src_vocab_size"},{anchor:"transformers.FSMTConfig.tgt_vocab_size",description:`<strong>tgt_vocab_size</strong> (<code>int</code>) &#x2014;
Vocabulary size of the decoder. Defines the number of different tokens that can be represented by the
<code>inputs_ids</code> passed to the forward method in the decoder.`,name:"tgt_vocab_size"},{anchor:"transformers.FSMTConfig.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.FSMTConfig.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.FSMTConfig.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.FSMTConfig.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.FSMTConfig.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.FSMTConfig.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.FSMTConfig.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.FSMTConfig.activation_function",description:`<strong>activation_function</strong> (<code>str</code> or <code>Callable</code>, <em>optional</em>, defaults to <code>&quot;relu&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.FSMTConfig.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.FSMTConfig.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.FSMTConfig.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.FSMTConfig.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.FSMTConfig.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.FSMTConfig.scale_embedding",description:`<strong>scale_embedding</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Scale embeddings by diving by sqrt(d_model).`,name:"scale_embedding"},{anchor:"transformers.FSMTConfig.bos_token_id",description:`<strong>bos_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 0) &#x2014;
Beginning of stream token id.`,name:"bos_token_id"},{anchor:"transformers.FSMTConfig.pad_token_id",description:`<strong>pad_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 1) &#x2014;
Padding token id.`,name:"pad_token_id"},{anchor:"transformers.FSMTConfig.eos_token_id",description:`<strong>eos_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014;
End of stream token id.`,name:"eos_token_id"},{anchor:"transformers.FSMTConfig.decoder_start_token_id",description:`<strong>decoder_start_token_id</strong> (<code>int</code>, <em>optional</em>) &#x2014;
This model starts decoding with <code>eos_token_id</code>
encoder_layerdrop &#x2014; (<code>float</code>, <em>optional</em>, defaults to 0.0):
Google &#x201C;layerdrop arxiv&#x201D;, as its not explainable in one line.
decoder_layerdrop &#x2014; (<code>float</code>, <em>optional</em>, defaults to 0.0):
Google &#x201C;layerdrop arxiv&#x201D;, as its not explainable in one line.`,name:"decoder_start_token_id"},{anchor:"transformers.FSMTConfig.is_encoder_decoder",description:`<strong>is_encoder_decoder</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#x2014;
Whether this is an encoder/decoder model.`,name:"is_encoder_decoder"},{anchor:"transformers.FSMTConfig.tie_word_embeddings",description:`<strong>tie_word_embeddings</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether to tie input and output embeddings.`,name:"tie_word_embeddings"},{anchor:"transformers.FSMTConfig.num_beams",description:`<strong>num_beams</strong> (<code>int</code>, <em>optional</em>, defaults to 5) &#x2014;
Number of beams for beam search that will be used by default in the <code>generate</code> method of the model. 1 means
no beam search.`,name:"num_beams"},{anchor:"transformers.FSMTConfig.length_penalty",description:`<strong>length_penalty</strong> (<code>float</code>, <em>optional</em>, defaults to 1) &#x2014;
Exponential penalty to the length that will be used by default in the <code>generate</code> method of the model.`,name:"length_penalty"},{anchor:"transformers.FSMTConfig.early_stopping",description:`<strong>early_stopping</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Flag that will be used by default in the <code>generate</code> method of the model. Whether to stop the beam search
when at least <code>num_beams</code> sentences are finished per batch or not.`,name:"early_stopping"},{anchor:"transformers.FSMTConfig.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"},{anchor:"transformers.FSMTConfig.forced_eos_token_id",description:`<strong>forced_eos_token_id</strong> (<code>int</code>, <em>optional</em>, defaults to 2) &#x2014;
The id of the token to force as the last generated token when <code>max_length</code> is reached. Usually set to
<code>eos_token_id</code>.`,name:"forced_eos_token_id"}]}}),ze=new Xo({props:{code:`from transformers import FSMTConfig, FSMTModel

config = FSMTConfig.from_pretrained("facebook/wmt19-en-ru")
model = FSMTModel(config)`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> FSMTConfig, FSMTModel

<span class="hljs-meta">&gt;&gt;&gt; </span>config = FSMTConfig.from_pretrained(<span class="hljs-string">&quot;facebook/wmt19-en-ru&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FSMTModel(config)`}}),qe=new L({props:{name:"to_dict",anchor:"transformers.FSMTConfig.to_dict",parameters:[],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/models/fsmt/configuration_fsmt.py#L209",returnDescription:`
<p>Dictionary of all the attributes that make up this configuration instance,</p>
`,returnType:`
<p><code>Dict[str, any]</code></p>
`}}),Ee=new ot({}),xe=new L({props:{name:"class transformers.FSMTTokenizer",anchor:"transformers.FSMTTokenizer",parameters:[{name:"langs",val:" = None"},{name:"src_vocab_file",val:" = None"},{name:"tgt_vocab_file",val:" = None"},{name:"merges_file",val:" = None"},{name:"do_lower_case",val:" = False"},{name:"unk_token",val:" = '<unk>'"},{name:"bos_token",val:" = '<s>'"},{name:"sep_token",val:" = '</s>'"},{name:"pad_token",val:" = '<pad>'"},{name:"**kwargs",val:""}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/models/fsmt/tokenization_fsmt.py#L137",parametersDescription:[{anchor:"transformers.FSMTTokenizer.langs",description:`<strong>langs</strong> (<code>List[str]</code>) &#x2014;
A list of two languages to translate from and to, for instance <code>[&quot;en&quot;, &quot;ru&quot;]</code>.`,name:"langs"},{anchor:"transformers.FSMTTokenizer.src_vocab_file",description:`<strong>src_vocab_file</strong> (<code>str</code>) &#x2014;
File containing the vocabulary for the source language.`,name:"src_vocab_file"},{anchor:"transformers.FSMTTokenizer.tgt_vocab_file",description:`<strong>tgt_vocab_file</strong> (<code>st</code>) &#x2014;
File containing the vocabulary for the target language.`,name:"tgt_vocab_file"},{anchor:"transformers.FSMTTokenizer.merges_file",description:`<strong>merges_file</strong> (<code>str</code>) &#x2014;
File containing the merges.`,name:"merges_file"},{anchor:"transformers.FSMTTokenizer.do_lower_case",description:`<strong>do_lower_case</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>False</code>) &#x2014;
Whether or not to lowercase the input when tokenizing.`,name:"do_lower_case"},{anchor:"transformers.FSMTTokenizer.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.FSMTTokenizer.bos_token",description:`<strong>bos_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;s&gt;&quot;</code>) &#x2014;
The beginning of sequence token that was used during pretraining. Can be used a sequence classifier token.</p>
<div class="course-tip  bg-gradient-to-br dark:bg-gradient-to-r before:border-green-500 dark:before:border-green-800 from-green-50 dark:from-gray-900 to-white dark:to-gray-950 border border-green-50 text-green-700 dark:text-gray-400">
						
<p>When building a sequence using special tokens, this is not the token that is used for the beginning of
sequence. The token used is the <code>cls_token</code>.</p>

					</div>`,name:"bos_token"},{anchor:"transformers.FSMTTokenizer.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.FSMTTokenizer.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"}]}}),Ie=new L({props:{name:"build_inputs_with_special_tokens",anchor:"transformers.FSMTTokenizer.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"}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/models/fsmt/tokenization_fsmt.py#L397",parametersDescription:[{anchor:"transformers.FSMTTokenizer.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.FSMTTokenizer.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"}],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>
`}}),De=new L({props:{name:"get_special_tokens_mask",anchor:"transformers.FSMTTokenizer.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"}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/models/fsmt/tokenization_fsmt.py#L423",parametersDescription:[{anchor:"transformers.FSMTTokenizer.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.FSMTTokenizer.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.FSMTTokenizer.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"}],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>
`}}),Le=new L({props:{name:"create_token_type_ids_from_sequences",anchor:"transformers.FSMTTokenizer.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"}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/models/fsmt/tokenization_fsmt.py#L451",parametersDescription:[{anchor:"transformers.FSMTTokenizer.create_token_type_ids_from_sequences.token_ids_0",description:`<strong>token_ids_0</strong> (<code>List[int]</code>) &#x2014;
List of IDs.`,name:"token_ids_0"},{anchor:"transformers.FSMTTokenizer.create_token_type_ids_from_sequences.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"}],returnDescription:`
<p>List of <a href="../glossary#token-type-ids">token type IDs</a> according to the given sequence(s).</p>
`,returnType:`
<p><code>List[int]</code></p>
`}}),je=new Xo({props:{code:`0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1
| first sequence    | second sequence |`,highlighted:`0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 0 </span>0<span class="hljs-number"> 1 </span>1<span class="hljs-number"> 1 </span>1<span class="hljs-number"> 1 </span>1<span class="hljs-number"> 1 </span>1 1
| first sequence    | second sequence |`}}),Oe=new L({props:{name:"save_vocabulary",anchor:"transformers.FSMTTokenizer.save_vocabulary",parameters:[{name:"save_directory",val:": str"},{name:"filename_prefix",val:": typing.Optional[str] = None"}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/models/fsmt/tokenization_fsmt.py#L484"}}),Ge=new ot({}),Be=new L({props:{name:"class transformers.FSMTModel",anchor:"transformers.FSMTModel",parameters:[{name:"config",val:": FSMTConfig"}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/models/fsmt/modeling_fsmt.py#L989",parametersDescription:[{anchor:"transformers.FSMTModel.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_15839/en/model_doc/fsmt#transformers.FSMTConfig">FSMTConfig</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/pr_15839/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}]}}),He=new L({props:{name:"forward",anchor:"transformers.FSMTModel.forward",parameters:[{name:"input_ids",val:""},{name:"attention_mask",val:" = None"},{name:"decoder_input_ids",val:" = None"},{name:"decoder_attention_mask",val:" = None"},{name:"head_mask",val:" = None"},{name:"decoder_head_mask",val:" = None"},{name:"cross_attn_head_mask",val:" = None"},{name:"encoder_outputs",val:": typing.Optional[typing.Tuple] = None"},{name:"past_key_values",val:" = None"},{name:"use_cache",val:" = None"},{name:"output_attentions",val:" = None"},{name:"output_hidden_states",val:" = None"},{name:"return_dict",val:" = None"}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/models/fsmt/modeling_fsmt.py#L1003",parametersDescription:[{anchor:"transformers.FSMTModel.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.</p>
<p>IIndices can be obtained using <code>FSTMTokenizer</code>. See <a href="/docs/transformers/pr_15839/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/pr_15839/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.FSMTModel.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.FSMTModel.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/pr_15839/en/model_doc/fsmt#transformers.FSMTTokenizer">FSMTTokenizer</a>. See <a href="/docs/transformers/pr_15839/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/pr_15839/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#decoder-input-ids">What are decoder input IDs?</a></p>
<p>FSMT 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.FSMTModel.forward.decoder_attention_mask",description:`<strong>decoder_attention_mask</strong> (<code>torch.BoolTensor</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.FSMTModel.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.FSMTModel.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.FSMTModel.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.FSMTModel.forward.encoder_outputs",description:`<strong>encoder_outputs</strong> (<code>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> 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.FSMTModel.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>Tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code> with each tuple having 4 tensors of shape <code>(batch_size, num_heads, sequence_length - 1, embed_size_per_head)</code>) &#x2014;
Contains precomputed key and value hidden-states of the attention blocks. Can be used to speed up decoding.
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>.`,name:"past_key_values"},{anchor:"transformers.FSMTModel.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#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.FSMTModel.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.FSMTModel.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.FSMTModel.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/pr_15839/en/main_classes/output#transformers.file_utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"}],returnDescription:`
<p>A <a
  href="/docs/transformers/pr_15839/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/pr_15839/en/model_doc/fsmt#transformers.FSMTConfig"
>FSMTConfig</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 + 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 + 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/pr_15839/en/main_classes/output#transformers.modeling_outputs.Seq2SeqModelOutput"
>transformers.modeling_outputs.Seq2SeqModelOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),pe=new Ha({props:{$$slots:{default:[Ya]},$$scope:{ctx:ke}}}),Ve=new Xo({props:{code:`from transformers import FSMTTokenizer, FSMTModel
import torch

tokenizer = FSMTTokenizer.from_pretrained("facebook/wmt19-ru-en")
model = FSMTModel.from_pretrained("facebook/wmt19-ru-en")

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> FSMTTokenizer, FSMTModel
<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">import</span> torch

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = FSMTTokenizer.from_pretrained(<span class="hljs-string">&quot;facebook/wmt19-ru-en&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FSMTModel.from_pretrained(<span class="hljs-string">&quot;facebook/wmt19-ru-en&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`}}),Qe=new ot({}),Xe=new L({props:{name:"class transformers.FSMTForConditionalGeneration",anchor:"transformers.FSMTForConditionalGeneration",parameters:[{name:"config",val:": FSMTConfig"}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/models/fsmt/modeling_fsmt.py#L1113",parametersDescription:[{anchor:"transformers.FSMTForConditionalGeneration.config",description:`<strong>config</strong> (<a href="/docs/transformers/pr_15839/en/model_doc/fsmt#transformers.FSMTConfig">FSMTConfig</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/pr_15839/en/main_classes/model#transformers.PreTrainedModel.from_pretrained">from_pretrained()</a> method to load the model weights.`,name:"config"}]}}),Ze=new L({props:{name:"forward",anchor:"transformers.FSMTForConditionalGeneration.forward",parameters:[{name:"input_ids",val:""},{name:"attention_mask",val:" = None"},{name:"decoder_input_ids",val:" = None"},{name:"decoder_attention_mask",val:" = None"},{name:"head_mask",val:" = None"},{name:"decoder_head_mask",val:" = None"},{name:"cross_attn_head_mask",val:" = None"},{name:"encoder_outputs",val:" = None"},{name:"past_key_values",val:" = None"},{name:"labels",val:" = None"},{name:"use_cache",val:" = None"},{name:"output_attentions",val:" = None"},{name:"output_hidden_states",val:" = None"},{name:"return_dict",val:" = None"}],source:"https://github.com/huggingface/transformers/blob/pr_15839/src/transformers/models/fsmt/modeling_fsmt.py#L1129",parametersDescription:[{anchor:"transformers.FSMTForConditionalGeneration.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.</p>
<p>IIndices can be obtained using <code>FSTMTokenizer</code>. See <a href="/docs/transformers/pr_15839/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/pr_15839/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#input-ids">What are input IDs?</a>`,name:"input_ids"},{anchor:"transformers.FSMTForConditionalGeneration.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.FSMTForConditionalGeneration.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/pr_15839/en/model_doc/fsmt#transformers.FSMTTokenizer">FSMTTokenizer</a>. See <a href="/docs/transformers/pr_15839/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.encode">PreTrainedTokenizer.encode()</a> and
<a href="/docs/transformers/pr_15839/en/internal/tokenization_utils#transformers.PreTrainedTokenizerBase.__call__">PreTrainedTokenizer.<strong>call</strong>()</a> for details.</p>
<p><a href="../glossary#decoder-input-ids">What are decoder input IDs?</a></p>
<p>FSMT 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.FSMTForConditionalGeneration.forward.decoder_attention_mask",description:`<strong>decoder_attention_mask</strong> (<code>torch.BoolTensor</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.FSMTForConditionalGeneration.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.FSMTForConditionalGeneration.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.FSMTForConditionalGeneration.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.FSMTForConditionalGeneration.forward.encoder_outputs",description:`<strong>encoder_outputs</strong> (<code>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> 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.FSMTForConditionalGeneration.forward.past_key_values",description:`<strong>past_key_values</strong> (<code>Tuple(torch.FloatTensor)</code> of length <code>config.n_layers</code> with each tuple having 4 tensors of shape <code>(batch_size, num_heads, sequence_length - 1, embed_size_per_head)</code>) &#x2014;
Contains precomputed key and value hidden-states of the attention blocks. Can be used to speed up decoding.
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>.`,name:"past_key_values"},{anchor:"transformers.FSMTForConditionalGeneration.forward.use_cache",description:`<strong>use_cache</strong> (<code>bool</code>, <em>optional</em>, defaults to <code>True</code>) &#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.FSMTForConditionalGeneration.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.FSMTForConditionalGeneration.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.FSMTForConditionalGeneration.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/pr_15839/en/main_classes/output#transformers.file_utils.ModelOutput">ModelOutput</a> instead of a plain tuple.`,name:"return_dict"},{anchor:"transformers.FSMTForConditionalGeneration.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"}],returnDescription:`
<p>A <a
  href="/docs/transformers/pr_15839/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/pr_15839/en/model_doc/fsmt#transformers.FSMTConfig"
>FSMTConfig</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 + 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 + 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/pr_15839/en/main_classes/output#transformers.modeling_outputs.Seq2SeqLMOutput"
>transformers.modeling_outputs.Seq2SeqLMOutput</a> or <code>tuple(torch.FloatTensor)</code></p>
`}}),ue=new Ha({props:{$$slots:{default:[Ja]},$$scope:{ctx:ke}}}),et=new Xo({props:{code:`from transformers import FSMTTokenizer, FSMTForConditionalGeneration

mname = "facebook/wmt19-ru-en"
model = FSMTForConditionalGeneration.from_pretrained(mname)
tokenizer = FSMTTokenizer.from_pretrained(mname)

src_text = "\u041C\u0430\u0448\u0438\u043D\u043D\u043E\u0435 \u043E\u0431\u0443\u0447\u0435\u043D\u0438\u0435 - \u044D\u0442\u043E \u0437\u0434\u043E\u0440\u043E\u0432\u043E, \u043D\u0435 \u0442\u0430\u043A \u043B\u0438?"
input_ids = tokenizer(src_text, return_tensors="pt").input_ids
outputs = model.generate(input_ids, num_beams=5, num_return_sequences=3)
tokenizer.decode(outputs[0], 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> FSMTTokenizer, FSMTForConditionalGeneration

<span class="hljs-meta">&gt;&gt;&gt; </span>mname = <span class="hljs-string">&quot;facebook/wmt19-ru-en&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>model = FSMTForConditionalGeneration.from_pretrained(mname)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = FSMTTokenizer.from_pretrained(mname)

<span class="hljs-meta">&gt;&gt;&gt; </span>src_text = <span class="hljs-string">&quot;\u041C\u0430\u0448\u0438\u043D\u043D\u043E\u0435 \u043E\u0431\u0443\u0447\u0435\u043D\u0438\u0435 - \u044D\u0442\u043E \u0437\u0434\u043E\u0440\u043E\u0432\u043E, \u043D\u0435 \u0442\u0430\u043A \u043B\u0438?&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>input_ids = tokenizer(src_text, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>).input_ids
<span class="hljs-meta">&gt;&gt;&gt; </span>outputs = model.generate(input_ids, num_beams=<span class="hljs-number">5</span>, num_return_sequences=<span class="hljs-number">3</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.decode(outputs[<span class="hljs-number">0</span>], skip_special_tokens=<span class="hljs-literal">True</span>)
<span class="hljs-string">&quot;Machine learning is great, isn&#x27;t it?&quot;</span>`}}),{c(){p=n("meta"),q=d(),f=n("h1"),y=n("a"),P=n("span"),u(M.$$.fragment),w=d(),A=n("span"),Ko=a("FSMT"),fo=d(),H=n("p"),$t=n("strong"),Yo=a("DISCLAIMER:"),Jo=a(" If you see something strange, file a "),Te=n("a"),Zo=a("Github Issue"),en=a(` and assign
@stas00.`),uo=d(),V=n("h2"),re=n("a"),zt=n("span"),u(ve.$$.fragment),tn=d(),qt=n("span"),on=a("Overview"),_o=d(),ae=n("p"),nn=a("FSMT (FairSeq MachineTranslation) models were introduced in "),be=n("a"),sn=a("Facebook FAIR\u2019s WMT19 News Translation Task Submission"),rn=a(" by Nathan Ng, Kyra Yee, Alexei Baevski, Myle Ott, Michael Auli, Sergey Edunov."),go=d(),nt=n("p"),an=a("The abstract of the paper is the following:"),ko=d(),st=n("p"),Et=n("em"),dn=a(`This paper describes Facebook FAIR\u2019s submission to the WMT19 shared news translation task. We participate in two
language pairs and four language directions, English <-> German and English <-> Russian. Following our submission from
last year, our baseline systems are large BPE-based transformer models trained with the Fairseq sequence modeling
toolkit which rely on sampled back-translations. This year we experiment with different bitext data filtering schemes,
as well as with adding filtered back-translated data. We also ensemble and fine-tune our models on domain-specific
data, then decode using noisy channel model reranking. Our submissions are ranked first in all four directions of the
human evaluation campaign. On En->De, our system significantly outperforms other systems as well as human translations.
This system improves upon our WMT\u201918 submission by 4.5 BLEU points.`),To=d(),j=n("p"),ln=a("This model was contributed by "),ye=n("a"),cn=a("stas"),hn=a(`. The original code can be found
`),Me=n("a"),mn=a("here"),pn=a("."),vo=d(),Q=n("h2"),ie=n("a"),xt=n("span"),u(we.$$.fragment),fn=d(),Ct=n("span"),un=a("Implementation Notes"),bo=d(),rt=n("ul"),X=n("li"),_n=a(`FSMT uses source and target vocabulary pairs that aren\u2019t combined into one. It doesn\u2019t share embeddings tokens
either. Its tokenizer is very similar to `),at=n("a"),gn=a("XLMTokenizer"),kn=a(` and the main model is derived from
`),it=n("a"),Tn=a("BartModel"),vn=a("."),yo=d(),K=n("h2"),de=n("a"),Pt=n("span"),u(Fe.$$.fragment),bn=d(),It=n("span"),yn=a("FSMTConfig"),Mo=d(),F=n("div"),u(Se.$$.fragment),Mn=d(),$e=n("p"),wn=a("This is the configuration class to store the configuration of a "),dt=n("a"),Fn=a("FSMTModel"),Sn=a(`. It is used to instantiate a FSMT
model according to the specified arguments, defining the model architecture.`),$n=d(),Y=n("p"),zn=a("Configuration objects inherit from "),lt=n("a"),qn=a("PretrainedConfig"),En=a(` and can be used to control the model outputs. Read the
documentation from `),ct=n("a"),xn=a("PretrainedConfig"),Cn=a(" for more information."),Pn=d(),At=n("p"),In=a("Examples:"),An=d(),u(ze.$$.fragment),Dn=d(),le=n("div"),u(qe.$$.fragment),Nn=d(),J=n("p"),Ln=a("Serializes this instance to a Python dictionary. Override the default "),Dt=n("em"),jn=a("to_dict()"),On=a(" from "),Nt=n("em"),Gn=a("PretrainedConfig"),Bn=a("."),wo=d(),Z=n("h2"),ce=n("a"),Lt=n("span"),u(Ee.$$.fragment),Wn=d(),jt=n("span"),Rn=a("FSMTTokenizer"),Fo=d(),b=n("div"),u(xe.$$.fragment),Un=d(),Ot=n("p"),Hn=a("Construct an FAIRSEQ Transformer tokenizer. Based on Byte-Pair Encoding. The tokenization process is the following:"),Vn=d(),D=n("ul"),Gt=n("li"),Qn=a("Moses preprocessing and tokenization."),Xn=d(),Bt=n("li"),Kn=a("Normalizing all inputs text."),Yn=d(),N=n("li"),Jn=a("The arguments "),Wt=n("code"),Zn=a("special_tokens"),es=a(" and the function "),Rt=n("code"),ts=a("set_special_tokens"),os=a(`, can be used to add additional symbols (like
\u201D`),Ut=n("strong"),ns=a("classify"),ss=a("\u201D) to a vocabulary."),rs=d(),Ce=n("li"),as=a("The argument "),Ht=n("code"),is=a("langs"),ds=a(" defines a pair of languages."),ls=d(),Pe=n("p"),cs=a("This tokenizer inherits from "),ht=n("a"),hs=a("PreTrainedTokenizer"),ms=a(` which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.`),ps=d(),O=n("div"),u(Ie.$$.fragment),fs=d(),Vt=n("p"),us=a(`Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
adding special tokens. A FAIRSEQ Transformer sequence has the following format:`),_s=d(),Ae=n("ul"),mt=n("li"),gs=a("single sequence: "),Qt=n("code"),ks=a("<s> X </s>"),Ts=d(),pt=n("li"),vs=a("pair of sequences: "),Xt=n("code"),bs=a("<s> A </s> B </s>"),ys=d(),he=n("div"),u(De.$$.fragment),Ms=d(),Ne=n("p"),ws=a(`Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
special tokens using the tokenizer `),Kt=n("code"),Fs=a("prepare_for_model"),Ss=a(" method."),$s=d(),E=n("div"),u(Le.$$.fragment),zs=d(),Yt=n("p"),qs=a(`Create a mask from the two sequences passed to be used in a sequence-pair classification task. A FAIRSEQ
Transformer sequence pair mask has the following format:`),Es=d(),u(je.$$.fragment),xs=d(),ee=n("p"),Cs=a("If "),Jt=n("code"),Ps=a("token_ids_1"),Is=a(" is "),Zt=n("code"),As=a("None"),Ds=a(", this method only returns the first portion of the mask (0s)."),Ns=d(),eo=n("p"),Ls=a(`Creates a mask from the two sequences passed to be used in a sequence-pair classification task. An
FAIRSEQ_TRANSFORMER sequence pair mask has the following format:`),js=d(),ft=n("div"),u(Oe.$$.fragment),So=d(),te=n("h2"),me=n("a"),to=n("span"),u(Ge.$$.fragment),Os=d(),oo=n("span"),Gs=a("FSMTModel"),$o=d(),$=n("div"),u(Be.$$.fragment),Bs=d(),no=n("p"),Ws=a("The bare FSMT Model outputting raw hidden-states without any specific head on top."),Rs=d(),We=n("p"),Us=a("This model inherits from "),ut=n("a"),Hs=a("PreTrainedModel"),Vs=a(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),Qs=d(),Re=n("p"),Xs=a("This model is also a PyTorch "),Ue=n("a"),Ks=a("torch.nn.Module"),Ys=a(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Js=d(),x=n("div"),u(He.$$.fragment),Zs=d(),oe=n("p"),er=a("The "),_t=n("a"),tr=a("FSMTModel"),or=a(" forward method, overrides the "),so=n("code"),nr=a("__call__"),sr=a(" special method."),rr=d(),u(pe.$$.fragment),ar=d(),ro=n("p"),ir=a("Example:"),dr=d(),u(Ve.$$.fragment),zo=d(),ne=n("h2"),fe=n("a"),ao=n("span"),u(Qe.$$.fragment),lr=d(),io=n("span"),cr=a("FSMTForConditionalGeneration"),qo=d(),z=n("div"),u(Xe.$$.fragment),hr=d(),lo=n("p"),mr=a("The FSMT Model with a language modeling head. Can be used for summarization."),pr=d(),Ke=n("p"),fr=a("This model inherits from "),gt=n("a"),ur=a("PreTrainedModel"),_r=a(`. Check the superclass documentation for the generic methods the
library implements for all its model (such as downloading or saving, resizing the input embeddings, pruning heads
etc.)`),gr=d(),Ye=n("p"),kr=a("This model is also a PyTorch "),Je=n("a"),Tr=a("torch.nn.Module"),vr=a(` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),br=d(),C=n("div"),u(Ze.$$.fragment),yr=d(),se=n("p"),Mr=a("The "),kt=n("a"),wr=a("FSMTForConditionalGeneration"),Fr=a(" forward method, overrides the "),co=n("code"),Sr=a("__call__"),$r=a(" special method."),zr=d(),u(ue.$$.fragment),qr=d(),ho=n("p"),Er=a("Translation example::"),xr=d(),u(et.$$.fragment),this.h()},l(t){const h=Ka('[data-svelte="svelte-1phssyn"]',document.head);p=s(h,"META",{name:!0,content:!0}),h.forEach(o),q=l(t),f=s(t,"H1",{class:!0});var tt=r(f);y=s(tt,"A",{id:!0,class:!0,href:!0});var mo=r(y);P=s(mo,"SPAN",{});var Ir=r(P);_(M.$$.fragment,Ir),Ir.forEach(o),mo.forEach(o),w=l(tt),A=s(tt,"SPAN",{});var Ar=r(A);Ko=i(Ar,"FSMT"),Ar.forEach(o),tt.forEach(o),fo=l(t),H=s(t,"P",{});var po=r(H);$t=s(po,"STRONG",{});var Dr=r($t);Yo=i(Dr,"DISCLAIMER:"),Dr.forEach(o),Jo=i(po," If you see something strange, file a "),Te=s(po,"A",{href:!0,rel:!0});var Nr=r(Te);Zo=i(Nr,"Github Issue"),Nr.forEach(o),en=i(po,` and assign
@stas00.`),po.forEach(o),uo=l(t),V=s(t,"H2",{class:!0});var xo=r(V);re=s(xo,"A",{id:!0,class:!0,href:!0});var Lr=r(re);zt=s(Lr,"SPAN",{});var jr=r(zt);_(ve.$$.fragment,jr),jr.forEach(o),Lr.forEach(o),tn=l(xo),qt=s(xo,"SPAN",{});var Or=r(qt);on=i(Or,"Overview"),Or.forEach(o),xo.forEach(o),_o=l(t),ae=s(t,"P",{});var Co=r(ae);nn=i(Co,"FSMT (FairSeq MachineTranslation) models were introduced in "),be=s(Co,"A",{href:!0,rel:!0});var Gr=r(be);sn=i(Gr,"Facebook FAIR\u2019s WMT19 News Translation Task Submission"),Gr.forEach(o),rn=i(Co," by Nathan Ng, Kyra Yee, Alexei Baevski, Myle Ott, Michael Auli, Sergey Edunov."),Co.forEach(o),go=l(t),nt=s(t,"P",{});var Br=r(nt);an=i(Br,"The abstract of the paper is the following:"),Br.forEach(o),ko=l(t),st=s(t,"P",{});var Wr=r(st);Et=s(Wr,"EM",{});var Rr=r(Et);dn=i(Rr,`This paper describes Facebook FAIR\u2019s submission to the WMT19 shared news translation task. We participate in two
language pairs and four language directions, English <-> German and English <-> Russian. Following our submission from
last year, our baseline systems are large BPE-based transformer models trained with the Fairseq sequence modeling
toolkit which rely on sampled back-translations. This year we experiment with different bitext data filtering schemes,
as well as with adding filtered back-translated data. We also ensemble and fine-tune our models on domain-specific
data, then decode using noisy channel model reranking. Our submissions are ranked first in all four directions of the
human evaluation campaign. On En->De, our system significantly outperforms other systems as well as human translations.
This system improves upon our WMT\u201918 submission by 4.5 BLEU points.`),Rr.forEach(o),Wr.forEach(o),To=l(t),j=s(t,"P",{});var Tt=r(j);ln=i(Tt,"This model was contributed by "),ye=s(Tt,"A",{href:!0,rel:!0});var Ur=r(ye);cn=i(Ur,"stas"),Ur.forEach(o),hn=i(Tt,`. The original code can be found
`),Me=s(Tt,"A",{href:!0,rel:!0});var Hr=r(Me);mn=i(Hr,"here"),Hr.forEach(o),pn=i(Tt,"."),Tt.forEach(o),vo=l(t),Q=s(t,"H2",{class:!0});var Po=r(Q);ie=s(Po,"A",{id:!0,class:!0,href:!0});var Vr=r(ie);xt=s(Vr,"SPAN",{});var Qr=r(xt);_(we.$$.fragment,Qr),Qr.forEach(o),Vr.forEach(o),fn=l(Po),Ct=s(Po,"SPAN",{});var Xr=r(Ct);un=i(Xr,"Implementation Notes"),Xr.forEach(o),Po.forEach(o),bo=l(t),rt=s(t,"UL",{});var Kr=r(rt);X=s(Kr,"LI",{});var vt=r(X);_n=i(vt,`FSMT uses source and target vocabulary pairs that aren\u2019t combined into one. It doesn\u2019t share embeddings tokens
either. Its tokenizer is very similar to `),at=s(vt,"A",{href:!0});var Yr=r(at);gn=i(Yr,"XLMTokenizer"),Yr.forEach(o),kn=i(vt,` and the main model is derived from
`),it=s(vt,"A",{href:!0});var Jr=r(it);Tn=i(Jr,"BartModel"),Jr.forEach(o),vn=i(vt,"."),vt.forEach(o),Kr.forEach(o),yo=l(t),K=s(t,"H2",{class:!0});var Io=r(K);de=s(Io,"A",{id:!0,class:!0,href:!0});var Zr=r(de);Pt=s(Zr,"SPAN",{});var ea=r(Pt);_(Fe.$$.fragment,ea),ea.forEach(o),Zr.forEach(o),bn=l(Io),It=s(Io,"SPAN",{});var ta=r(It);yn=i(ta,"FSMTConfig"),ta.forEach(o),Io.forEach(o),Mo=l(t),F=s(t,"DIV",{class:!0});var I=r(F);_(Se.$$.fragment,I),Mn=l(I),$e=s(I,"P",{});var Ao=r($e);wn=i(Ao,"This is the configuration class to store the configuration of a "),dt=s(Ao,"A",{href:!0});var oa=r(dt);Fn=i(oa,"FSMTModel"),oa.forEach(o),Sn=i(Ao,`. It is used to instantiate a FSMT
model according to the specified arguments, defining the model architecture.`),Ao.forEach(o),$n=l(I),Y=s(I,"P",{});var bt=r(Y);zn=i(bt,"Configuration objects inherit from "),lt=s(bt,"A",{href:!0});var na=r(lt);qn=i(na,"PretrainedConfig"),na.forEach(o),En=i(bt,` and can be used to control the model outputs. Read the
documentation from `),ct=s(bt,"A",{href:!0});var sa=r(ct);xn=i(sa,"PretrainedConfig"),sa.forEach(o),Cn=i(bt," for more information."),bt.forEach(o),Pn=l(I),At=s(I,"P",{});var ra=r(At);In=i(ra,"Examples:"),ra.forEach(o),An=l(I),_(ze.$$.fragment,I),Dn=l(I),le=s(I,"DIV",{class:!0});var Do=r(le);_(qe.$$.fragment,Do),Nn=l(Do),J=s(Do,"P",{});var yt=r(J);Ln=i(yt,"Serializes this instance to a Python dictionary. Override the default "),Dt=s(yt,"EM",{});var aa=r(Dt);jn=i(aa,"to_dict()"),aa.forEach(o),On=i(yt," from "),Nt=s(yt,"EM",{});var ia=r(Nt);Gn=i(ia,"PretrainedConfig"),ia.forEach(o),Bn=i(yt,"."),yt.forEach(o),Do.forEach(o),I.forEach(o),wo=l(t),Z=s(t,"H2",{class:!0});var No=r(Z);ce=s(No,"A",{id:!0,class:!0,href:!0});var da=r(ce);Lt=s(da,"SPAN",{});var la=r(Lt);_(Ee.$$.fragment,la),la.forEach(o),da.forEach(o),Wn=l(No),jt=s(No,"SPAN",{});var ca=r(jt);Rn=i(ca,"FSMTTokenizer"),ca.forEach(o),No.forEach(o),Fo=l(t),b=s(t,"DIV",{class:!0});var S=r(b);_(xe.$$.fragment,S),Un=l(S),Ot=s(S,"P",{});var ha=r(Ot);Hn=i(ha,"Construct an FAIRSEQ Transformer tokenizer. Based on Byte-Pair Encoding. The tokenization process is the following:"),ha.forEach(o),Vn=l(S),D=s(S,"UL",{});var _e=r(D);Gt=s(_e,"LI",{});var ma=r(Gt);Qn=i(ma,"Moses preprocessing and tokenization."),ma.forEach(o),Xn=l(_e),Bt=s(_e,"LI",{});var pa=r(Bt);Kn=i(pa,"Normalizing all inputs text."),pa.forEach(o),Yn=l(_e),N=s(_e,"LI",{});var ge=r(N);Jn=i(ge,"The arguments "),Wt=s(ge,"CODE",{});var fa=r(Wt);Zn=i(fa,"special_tokens"),fa.forEach(o),es=i(ge," and the function "),Rt=s(ge,"CODE",{});var ua=r(Rt);ts=i(ua,"set_special_tokens"),ua.forEach(o),os=i(ge,`, can be used to add additional symbols (like
\u201D`),Ut=s(ge,"STRONG",{});var _a=r(Ut);ns=i(_a,"classify"),_a.forEach(o),ss=i(ge,"\u201D) to a vocabulary."),ge.forEach(o),rs=l(_e),Ce=s(_e,"LI",{});var Lo=r(Ce);as=i(Lo,"The argument "),Ht=s(Lo,"CODE",{});var ga=r(Ht);is=i(ga,"langs"),ga.forEach(o),ds=i(Lo," defines a pair of languages."),Lo.forEach(o),_e.forEach(o),ls=l(S),Pe=s(S,"P",{});var jo=r(Pe);cs=i(jo,"This tokenizer inherits from "),ht=s(jo,"A",{href:!0});var ka=r(ht);hs=i(ka,"PreTrainedTokenizer"),ka.forEach(o),ms=i(jo,` which contains most of the main methods. Users should refer to
this superclass for more information regarding those methods.`),jo.forEach(o),ps=l(S),O=s(S,"DIV",{class:!0});var Mt=r(O);_(Ie.$$.fragment,Mt),fs=l(Mt),Vt=s(Mt,"P",{});var Ta=r(Vt);us=i(Ta,`Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
adding special tokens. A FAIRSEQ Transformer sequence has the following format:`),Ta.forEach(o),_s=l(Mt),Ae=s(Mt,"UL",{});var Oo=r(Ae);mt=s(Oo,"LI",{});var Cr=r(mt);gs=i(Cr,"single sequence: "),Qt=s(Cr,"CODE",{});var va=r(Qt);ks=i(va,"<s> X </s>"),va.forEach(o),Cr.forEach(o),Ts=l(Oo),pt=s(Oo,"LI",{});var Pr=r(pt);vs=i(Pr,"pair of sequences: "),Xt=s(Pr,"CODE",{});var ba=r(Xt);bs=i(ba,"<s> A </s> B </s>"),ba.forEach(o),Pr.forEach(o),Oo.forEach(o),Mt.forEach(o),ys=l(S),he=s(S,"DIV",{class:!0});var Go=r(he);_(De.$$.fragment,Go),Ms=l(Go),Ne=s(Go,"P",{});var Bo=r(Ne);ws=i(Bo,`Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
special tokens using the tokenizer `),Kt=s(Bo,"CODE",{});var ya=r(Kt);Fs=i(ya,"prepare_for_model"),ya.forEach(o),Ss=i(Bo," method."),Bo.forEach(o),Go.forEach(o),$s=l(S),E=s(S,"DIV",{class:!0});var G=r(E);_(Le.$$.fragment,G),zs=l(G),Yt=s(G,"P",{});var Ma=r(Yt);qs=i(Ma,`Create a mask from the two sequences passed to be used in a sequence-pair classification task. A FAIRSEQ
Transformer sequence pair mask has the following format:`),Ma.forEach(o),Es=l(G),_(je.$$.fragment,G),xs=l(G),ee=s(G,"P",{});var wt=r(ee);Cs=i(wt,"If "),Jt=s(wt,"CODE",{});var wa=r(Jt);Ps=i(wa,"token_ids_1"),wa.forEach(o),Is=i(wt," is "),Zt=s(wt,"CODE",{});var Fa=r(Zt);As=i(Fa,"None"),Fa.forEach(o),Ds=i(wt,", this method only returns the first portion of the mask (0s)."),wt.forEach(o),Ns=l(G),eo=s(G,"P",{});var Sa=r(eo);Ls=i(Sa,`Creates a mask from the two sequences passed to be used in a sequence-pair classification task. An
FAIRSEQ_TRANSFORMER sequence pair mask has the following format:`),Sa.forEach(o),G.forEach(o),js=l(S),ft=s(S,"DIV",{class:!0});var $a=r(ft);_(Oe.$$.fragment,$a),$a.forEach(o),S.forEach(o),So=l(t),te=s(t,"H2",{class:!0});var Wo=r(te);me=s(Wo,"A",{id:!0,class:!0,href:!0});var za=r(me);to=s(za,"SPAN",{});var qa=r(to);_(Ge.$$.fragment,qa),qa.forEach(o),za.forEach(o),Os=l(Wo),oo=s(Wo,"SPAN",{});var Ea=r(oo);Gs=i(Ea,"FSMTModel"),Ea.forEach(o),Wo.forEach(o),$o=l(t),$=s(t,"DIV",{class:!0});var B=r($);_(Be.$$.fragment,B),Bs=l(B),no=s(B,"P",{});var xa=r(no);Ws=i(xa,"The bare FSMT Model outputting raw hidden-states without any specific head on top."),xa.forEach(o),Rs=l(B),We=s(B,"P",{});var Ro=r(We);Us=i(Ro,"This model inherits from "),ut=s(Ro,"A",{href:!0});var Ca=r(ut);Hs=i(Ca,"PreTrainedModel"),Ca.forEach(o),Vs=i(Ro,`. 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.)`),Ro.forEach(o),Qs=l(B),Re=s(B,"P",{});var Uo=r(Re);Xs=i(Uo,"This model is also a PyTorch "),Ue=s(Uo,"A",{href:!0,rel:!0});var Pa=r(Ue);Ks=i(Pa,"torch.nn.Module"),Pa.forEach(o),Ys=i(Uo,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Uo.forEach(o),Js=l(B),x=s(B,"DIV",{class:!0});var W=r(x);_(He.$$.fragment,W),Zs=l(W),oe=s(W,"P",{});var Ft=r(oe);er=i(Ft,"The "),_t=s(Ft,"A",{href:!0});var Ia=r(_t);tr=i(Ia,"FSMTModel"),Ia.forEach(o),or=i(Ft," forward method, overrides the "),so=s(Ft,"CODE",{});var Aa=r(so);nr=i(Aa,"__call__"),Aa.forEach(o),sr=i(Ft," special method."),Ft.forEach(o),rr=l(W),_(pe.$$.fragment,W),ar=l(W),ro=s(W,"P",{});var Da=r(ro);ir=i(Da,"Example:"),Da.forEach(o),dr=l(W),_(Ve.$$.fragment,W),W.forEach(o),B.forEach(o),zo=l(t),ne=s(t,"H2",{class:!0});var Ho=r(ne);fe=s(Ho,"A",{id:!0,class:!0,href:!0});var Na=r(fe);ao=s(Na,"SPAN",{});var La=r(ao);_(Qe.$$.fragment,La),La.forEach(o),Na.forEach(o),lr=l(Ho),io=s(Ho,"SPAN",{});var ja=r(io);cr=i(ja,"FSMTForConditionalGeneration"),ja.forEach(o),Ho.forEach(o),qo=l(t),z=s(t,"DIV",{class:!0});var R=r(z);_(Xe.$$.fragment,R),hr=l(R),lo=s(R,"P",{});var Oa=r(lo);mr=i(Oa,"The FSMT Model with a language modeling head. Can be used for summarization."),Oa.forEach(o),pr=l(R),Ke=s(R,"P",{});var Vo=r(Ke);fr=i(Vo,"This model inherits from "),gt=s(Vo,"A",{href:!0});var Ga=r(gt);ur=i(Ga,"PreTrainedModel"),Ga.forEach(o),_r=i(Vo,`. 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.)`),Vo.forEach(o),gr=l(R),Ye=s(R,"P",{});var Qo=r(Ye);kr=i(Qo,"This model is also a PyTorch "),Je=s(Qo,"A",{href:!0,rel:!0});var Ba=r(Je);Tr=i(Ba,"torch.nn.Module"),Ba.forEach(o),vr=i(Qo,` subclass.
Use it as a regular PyTorch Module and refer to the PyTorch documentation for all matter related to general usage
and behavior.`),Qo.forEach(o),br=l(R),C=s(R,"DIV",{class:!0});var U=r(C);_(Ze.$$.fragment,U),yr=l(U),se=s(U,"P",{});var St=r(se);Mr=i(St,"The "),kt=s(St,"A",{href:!0});var Wa=r(kt);wr=i(Wa,"FSMTForConditionalGeneration"),Wa.forEach(o),Fr=i(St," forward method, overrides the "),co=s(St,"CODE",{});var Ra=r(co);Sr=i(Ra,"__call__"),Ra.forEach(o),$r=i(St," special method."),St.forEach(o),zr=l(U),_(ue.$$.fragment,U),qr=l(U),ho=s(U,"P",{});var Ua=r(ho);Er=i(Ua,"Translation example::"),Ua.forEach(o),xr=l(U),_(et.$$.fragment,U),U.forEach(o),R.forEach(o),this.h()},h(){c(p,"name","hf:doc:metadata"),c(p,"content",JSON.stringify(ei)),c(y,"id","fsmt"),c(y,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(y,"href","#fsmt"),c(f,"class","relative group"),c(Te,"href","https://github.com/huggingface/transformers/issues/new?assignees=&labels=&template=bug-report.md&title"),c(Te,"rel","nofollow"),c(re,"id","overview"),c(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"),c(re,"href","#overview"),c(V,"class","relative group"),c(be,"href","https://arxiv.org/abs/1907.06616"),c(be,"rel","nofollow"),c(ye,"href","https://huggingface.co/stas"),c(ye,"rel","nofollow"),c(Me,"href","https://github.com/pytorch/fairseq/tree/master/examples/wmt19"),c(Me,"rel","nofollow"),c(ie,"id","implementation-notes"),c(ie,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(ie,"href","#implementation-notes"),c(Q,"class","relative group"),c(at,"href","/docs/transformers/pr_15839/en/model_doc/xlm#transformers.XLMTokenizer"),c(it,"href","/docs/transformers/pr_15839/en/model_doc/bart#transformers.BartModel"),c(de,"id","transformers.FSMTConfig"),c(de,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(de,"href","#transformers.FSMTConfig"),c(K,"class","relative group"),c(dt,"href","/docs/transformers/pr_15839/en/model_doc/fsmt#transformers.FSMTModel"),c(lt,"href","/docs/transformers/pr_15839/en/main_classes/configuration#transformers.PretrainedConfig"),c(ct,"href","/docs/transformers/pr_15839/en/main_classes/configuration#transformers.PretrainedConfig"),c(le,"class","docstring"),c(F,"class","docstring"),c(ce,"id","transformers.FSMTTokenizer"),c(ce,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(ce,"href","#transformers.FSMTTokenizer"),c(Z,"class","relative group"),c(ht,"href","/docs/transformers/pr_15839/en/main_classes/tokenizer#transformers.PreTrainedTokenizer"),c(O,"class","docstring"),c(he,"class","docstring"),c(E,"class","docstring"),c(ft,"class","docstring"),c(b,"class","docstring"),c(me,"id","transformers.FSMTModel"),c(me,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(me,"href","#transformers.FSMTModel"),c(te,"class","relative group"),c(ut,"href","/docs/transformers/pr_15839/en/main_classes/model#transformers.PreTrainedModel"),c(Ue,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(Ue,"rel","nofollow"),c(_t,"href","/docs/transformers/pr_15839/en/model_doc/fsmt#transformers.FSMTModel"),c(x,"class","docstring"),c($,"class","docstring"),c(fe,"id","transformers.FSMTForConditionalGeneration"),c(fe,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),c(fe,"href","#transformers.FSMTForConditionalGeneration"),c(ne,"class","relative group"),c(gt,"href","/docs/transformers/pr_15839/en/main_classes/model#transformers.PreTrainedModel"),c(Je,"href","https://pytorch.org/docs/stable/nn.html#torch.nn.Module"),c(Je,"rel","nofollow"),c(kt,"href","/docs/transformers/pr_15839/en/model_doc/fsmt#transformers.FSMTForConditionalGeneration"),c(C,"class","docstring"),c(z,"class","docstring")},m(t,h){e(document.head,p),m(t,q,h),m(t,f,h),e(f,y),e(y,P),g(M,P,null),e(f,w),e(f,A),e(A,Ko),m(t,fo,h),m(t,H,h),e(H,$t),e($t,Yo),e(H,Jo),e(H,Te),e(Te,Zo),e(H,en),m(t,uo,h),m(t,V,h),e(V,re),e(re,zt),g(ve,zt,null),e(V,tn),e(V,qt),e(qt,on),m(t,_o,h),m(t,ae,h),e(ae,nn),e(ae,be),e(be,sn),e(ae,rn),m(t,go,h),m(t,nt,h),e(nt,an),m(t,ko,h),m(t,st,h),e(st,Et),e(Et,dn),m(t,To,h),m(t,j,h),e(j,ln),e(j,ye),e(ye,cn),e(j,hn),e(j,Me),e(Me,mn),e(j,pn),m(t,vo,h),m(t,Q,h),e(Q,ie),e(ie,xt),g(we,xt,null),e(Q,fn),e(Q,Ct),e(Ct,un),m(t,bo,h),m(t,rt,h),e(rt,X),e(X,_n),e(X,at),e(at,gn),e(X,kn),e(X,it),e(it,Tn),e(X,vn),m(t,yo,h),m(t,K,h),e(K,de),e(de,Pt),g(Fe,Pt,null),e(K,bn),e(K,It),e(It,yn),m(t,Mo,h),m(t,F,h),g(Se,F,null),e(F,Mn),e(F,$e),e($e,wn),e($e,dt),e(dt,Fn),e($e,Sn),e(F,$n),e(F,Y),e(Y,zn),e(Y,lt),e(lt,qn),e(Y,En),e(Y,ct),e(ct,xn),e(Y,Cn),e(F,Pn),e(F,At),e(At,In),e(F,An),g(ze,F,null),e(F,Dn),e(F,le),g(qe,le,null),e(le,Nn),e(le,J),e(J,Ln),e(J,Dt),e(Dt,jn),e(J,On),e(J,Nt),e(Nt,Gn),e(J,Bn),m(t,wo,h),m(t,Z,h),e(Z,ce),e(ce,Lt),g(Ee,Lt,null),e(Z,Wn),e(Z,jt),e(jt,Rn),m(t,Fo,h),m(t,b,h),g(xe,b,null),e(b,Un),e(b,Ot),e(Ot,Hn),e(b,Vn),e(b,D),e(D,Gt),e(Gt,Qn),e(D,Xn),e(D,Bt),e(Bt,Kn),e(D,Yn),e(D,N),e(N,Jn),e(N,Wt),e(Wt,Zn),e(N,es),e(N,Rt),e(Rt,ts),e(N,os),e(N,Ut),e(Ut,ns),e(N,ss),e(D,rs),e(D,Ce),e(Ce,as),e(Ce,Ht),e(Ht,is),e(Ce,ds),e(b,ls),e(b,Pe),e(Pe,cs),e(Pe,ht),e(ht,hs),e(Pe,ms),e(b,ps),e(b,O),g(Ie,O,null),e(O,fs),e(O,Vt),e(Vt,us),e(O,_s),e(O,Ae),e(Ae,mt),e(mt,gs),e(mt,Qt),e(Qt,ks),e(Ae,Ts),e(Ae,pt),e(pt,vs),e(pt,Xt),e(Xt,bs),e(b,ys),e(b,he),g(De,he,null),e(he,Ms),e(he,Ne),e(Ne,ws),e(Ne,Kt),e(Kt,Fs),e(Ne,Ss),e(b,$s),e(b,E),g(Le,E,null),e(E,zs),e(E,Yt),e(Yt,qs),e(E,Es),g(je,E,null),e(E,xs),e(E,ee),e(ee,Cs),e(ee,Jt),e(Jt,Ps),e(ee,Is),e(ee,Zt),e(Zt,As),e(ee,Ds),e(E,Ns),e(E,eo),e(eo,Ls),e(b,js),e(b,ft),g(Oe,ft,null),m(t,So,h),m(t,te,h),e(te,me),e(me,to),g(Ge,to,null),e(te,Os),e(te,oo),e(oo,Gs),m(t,$o,h),m(t,$,h),g(Be,$,null),e($,Bs),e($,no),e(no,Ws),e($,Rs),e($,We),e(We,Us),e(We,ut),e(ut,Hs),e(We,Vs),e($,Qs),e($,Re),e(Re,Xs),e(Re,Ue),e(Ue,Ks),e(Re,Ys),e($,Js),e($,x),g(He,x,null),e(x,Zs),e(x,oe),e(oe,er),e(oe,_t),e(_t,tr),e(oe,or),e(oe,so),e(so,nr),e(oe,sr),e(x,rr),g(pe,x,null),e(x,ar),e(x,ro),e(ro,ir),e(x,dr),g(Ve,x,null),m(t,zo,h),m(t,ne,h),e(ne,fe),e(fe,ao),g(Qe,ao,null),e(ne,lr),e(ne,io),e(io,cr),m(t,qo,h),m(t,z,h),g(Xe,z,null),e(z,hr),e(z,lo),e(lo,mr),e(z,pr),e(z,Ke),e(Ke,fr),e(Ke,gt),e(gt,ur),e(Ke,_r),e(z,gr),e(z,Ye),e(Ye,kr),e(Ye,Je),e(Je,Tr),e(Ye,vr),e(z,br),e(z,C),g(Ze,C,null),e(C,yr),e(C,se),e(se,Mr),e(se,kt),e(kt,wr),e(se,Fr),e(se,co),e(co,Sr),e(se,$r),e(C,zr),g(ue,C,null),e(C,qr),e(C,ho),e(ho,Er),e(C,xr),g(et,C,null),Eo=!0},p(t,[h]){const tt={};h&2&&(tt.$$scope={dirty:h,ctx:t}),pe.$set(tt);const mo={};h&2&&(mo.$$scope={dirty:h,ctx:t}),ue.$set(mo)},i(t){Eo||(k(M.$$.fragment,t),k(ve.$$.fragment,t),k(we.$$.fragment,t),k(Fe.$$.fragment,t),k(Se.$$.fragment,t),k(ze.$$.fragment,t),k(qe.$$.fragment,t),k(Ee.$$.fragment,t),k(xe.$$.fragment,t),k(Ie.$$.fragment,t),k(De.$$.fragment,t),k(Le.$$.fragment,t),k(je.$$.fragment,t),k(Oe.$$.fragment,t),k(Ge.$$.fragment,t),k(Be.$$.fragment,t),k(He.$$.fragment,t),k(pe.$$.fragment,t),k(Ve.$$.fragment,t),k(Qe.$$.fragment,t),k(Xe.$$.fragment,t),k(Ze.$$.fragment,t),k(ue.$$.fragment,t),k(et.$$.fragment,t),Eo=!0)},o(t){T(M.$$.fragment,t),T(ve.$$.fragment,t),T(we.$$.fragment,t),T(Fe.$$.fragment,t),T(Se.$$.fragment,t),T(ze.$$.fragment,t),T(qe.$$.fragment,t),T(Ee.$$.fragment,t),T(xe.$$.fragment,t),T(Ie.$$.fragment,t),T(De.$$.fragment,t),T(Le.$$.fragment,t),T(je.$$.fragment,t),T(Oe.$$.fragment,t),T(Ge.$$.fragment,t),T(Be.$$.fragment,t),T(He.$$.fragment,t),T(pe.$$.fragment,t),T(Ve.$$.fragment,t),T(Qe.$$.fragment,t),T(Xe.$$.fragment,t),T(Ze.$$.fragment,t),T(ue.$$.fragment,t),T(et.$$.fragment,t),Eo=!1},d(t){o(p),t&&o(q),t&&o(f),v(M),t&&o(fo),t&&o(H),t&&o(uo),t&&o(V),v(ve),t&&o(_o),t&&o(ae),t&&o(go),t&&o(nt),t&&o(ko),t&&o(st),t&&o(To),t&&o(j),t&&o(vo),t&&o(Q),v(we),t&&o(bo),t&&o(rt),t&&o(yo),t&&o(K),v(Fe),t&&o(Mo),t&&o(F),v(Se),v(ze),v(qe),t&&o(wo),t&&o(Z),v(Ee),t&&o(Fo),t&&o(b),v(xe),v(Ie),v(De),v(Le),v(je),v(Oe),t&&o(So),t&&o(te),v(Ge),t&&o($o),t&&o($),v(Be),v(He),v(pe),v(Ve),t&&o(zo),t&&o(ne),v(Qe),t&&o(qo),t&&o(z),v(Xe),v(Ze),v(ue),v(et)}}}const ei={local:"fsmt",sections:[{local:"overview",title:"Overview"},{local:"implementation-notes",title:"Implementation Notes"},{local:"transformers.FSMTConfig",title:"FSMTConfig"},{local:"transformers.FSMTTokenizer",title:"FSMTTokenizer"},{local:"transformers.FSMTModel",title:"FSMTModel"},{local:"transformers.FSMTForConditionalGeneration",title:"FSMTForConditionalGeneration"}],title:"FSMT"};function ti(ke,p,q){let{fw:f}=p;return ke.$$set=y=>{"fw"in y&&q(0,f=y.fw)},[f]}class di extends Va{constructor(p){super();Qa(this,p,ti,Za,Xa,{fw:0})}}export{di as default,ei as metadata};
