import{S as Ws,i as Js,s as Xs,e as a,k as i,w as k,t as r,M as Ks,c as o,d as n,m as c,a as s,x as b,h as l,b as d,G as e,g as h,y as v,q as w,o as y,B as q,v as Vs,L as Rs}from"../../chunks/vendor-hf-doc-builder.js";import{D as Ce}from"../../chunks/Docstring-hf-doc-builder.js";import{C as En}from"../../chunks/CodeBlock-hf-doc-builder.js";import{I as Ze}from"../../chunks/IconCopyLink-hf-doc-builder.js";import{E as Us}from"../../chunks/ExampleCodeBlock-hf-doc-builder.js";function Ys(De){let g,x,_,u,E;return u=new En({props:{code:`from transformers import NllbTokenizer

tokenizer = NllbTokenizer.from_pretrained(
    "facebook/nllb-200-distilled-600M", src_lang="eng_Latn", tgt_lang="fra_Latn"
)
example_english_phrase = " UN Chief Says There Is No Military Solution in Syria"
expected_translation_french = "Le chef de l'ONU affirme qu'il n'y a pas de solution militaire en Syrie."
inputs = tokenizer(example_english_phrase, text_target=expected_translation_french, return_tensors="pt")`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> NllbTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = NllbTokenizer.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;facebook/nllb-200-distilled-600M&quot;</span>, src_lang=<span class="hljs-string">&quot;eng_Latn&quot;</span>, tgt_lang=<span class="hljs-string">&quot;fra_Latn&quot;</span>
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>example_english_phrase = <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>expected_translation_french = <span class="hljs-string">&quot;Le chef de l&#x27;ONU affirme qu&#x27;il n&#x27;y a pas de solution militaire en Syrie.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(example_english_phrase, text_target=expected_translation_french, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)`}}),{c(){g=a("p"),x=r("Examples:"),_=i(),k(u.$$.fragment)},l(f){g=o(f,"P",{});var z=s(g);x=l(z,"Examples:"),z.forEach(n),_=c(f),b(u.$$.fragment,f)},m(f,z){h(f,g,z),e(g,x),h(f,_,z),v(u,f,z),E=!0},p:Rs,i(f){E||(w(u.$$.fragment,f),E=!0)},o(f){y(u.$$.fragment,f),E=!1},d(f){f&&n(g),f&&n(_),q(u,f)}}}function Qs(De){let g,x,_,u,E;return u=new En({props:{code:`from transformers import NllbTokenizerFast

tokenizer = NllbTokenizerFast.from_pretrained(
    "facebook/nllb-200-distilled-600M", src_lang="eng_Latn", tgt_lang="fra_Latn"
)
example_english_phrase = " UN Chief Says There Is No Military Solution in Syria"
expected_translation_french = "Le chef de l'ONU affirme qu'il n'y a pas de solution militaire en Syrie."
inputs = tokenizer(example_english_phrase, text_target=expected_translation_french, return_tensors="pt")`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> NllbTokenizerFast

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = NllbTokenizerFast.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;facebook/nllb-200-distilled-600M&quot;</span>, src_lang=<span class="hljs-string">&quot;eng_Latn&quot;</span>, tgt_lang=<span class="hljs-string">&quot;fra_Latn&quot;</span>
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>example_english_phrase = <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>expected_translation_french = <span class="hljs-string">&quot;Le chef de l&#x27;ONU affirme qu&#x27;il n&#x27;y a pas de solution militaire en Syrie.&quot;</span>
<span class="hljs-meta">&gt;&gt;&gt; </span>inputs = tokenizer(example_english_phrase, text_target=expected_translation_french, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)`}}),{c(){g=a("p"),x=r("Examples:"),_=i(),k(u.$$.fragment)},l(f){g=o(f,"P",{});var z=s(g);x=l(z,"Examples:"),z.forEach(n),_=c(f),b(u.$$.fragment,f)},m(f,z){h(f,g,z),e(g,x),h(f,_,z),v(u,f,z),E=!0},p:Rs,i(f){E||(w(u.$$.fragment,f),E=!0)},o(f){y(u.$$.fragment,f),E=!1},d(f){f&&n(g),f&&n(_),q(u,f)}}}function Zs(De){let g,x,_,u,E,f,z,et,Nn,Gt,D,tt,xn,Ln,re,Sn,jn,Ht,B,J,nt,le,An,at,Pn,Ut,X,Fn,ie,Mn,Cn,Rt,Be,Dn,Wt,Oe,ot,Bn,Jt,Ie,On,Xt,A,In,ce,Gn,Hn,de,Un,Rn,Kt,O,K,st,pe,Wn,rt,Jn,Vt,P,Xn,lt,Kn,Vn,it,Yn,Qn,Yt,F,Zn,ct,ea,ta,he,na,aa,Qt,fe,Zt,I,V,dt,ue,oa,pt,sa,en,M,ra,ht,la,ia,ft,ca,da,tn,Ge,pa,nn,ge,an,G,Y,ut,me,ha,gt,fa,on,T,_e,ua,mt,ga,ma,j,_a,He,ka,ba,Ue,va,wa,ke,ya,qa,$a,H,za,_t,Ta,Ea,kt,Na,xa,La,Q,Sa,L,be,ja,ve,Aa,bt,Pa,Fa,Ma,we,ye,vt,Ca,Da,wt,Ba,Oa,qe,yt,Ia,Ga,qt,Ha,Ua,$t,Ra,sn,U,Z,zt,$e,Wa,Tt,Ja,rn,m,ze,Xa,R,Ka,Et,Va,Ya,Te,Qa,Za,eo,Ee,to,Re,no,ao,oo,W,so,Nt,ro,lo,xt,io,co,po,ee,ho,N,Ne,fo,Lt,uo,go,xe,mo,St,_o,ko,bo,Le,Se,jt,vo,wo,At,yo,qo,je,Pt,$o,zo,Ft,To,Eo,Mt,No,xo,te,Ae,Lo,Ct,So,jo,ne,Pe,Ao,Dt,Po,Fo,ae,Fe,Mo,Bt,Co,ln;return f=new Ze({}),le=new Ze({}),pe=new Ze({}),fe=new En({props:{code:`from transformers import AutoModelForSeq2SeqLM, AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained("facebook/nllb-200-distilled-600M")
model = AutoModelForSeq2SeqLM.from_pretrained("facebook/nllb-200-distilled-600M")

article = "UN Chief says there is no military solution in Syria"
inputs = tokenizer(article, return_tensors="pt")

translated_tokens = model.generate(
    **inputs, forced_bos_token_id=tokenizer.lang_code_to_id["fra_Latn"], max_length=30
)
tokenizer.batch_decode(translated_tokens, skip_special_tokens=True)[0]`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForSeq2SeqLM, AutoTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(<span class="hljs-string">&quot;facebook/nllb-200-distilled-600M&quot;</span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForSeq2SeqLM.from_pretrained(<span class="hljs-string">&quot;facebook/nllb-200-distilled-600M&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>article = <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>inputs = tokenizer(article, return_tensors=<span class="hljs-string">&quot;pt&quot;</span>)

<span class="hljs-meta">&gt;&gt;&gt; </span>translated_tokens = model.generate(
<span class="hljs-meta">... </span>    **inputs, forced_bos_token_id=tokenizer.lang_code_to_id[<span class="hljs-string">&quot;fra_Latn&quot;</span>], max_length=<span class="hljs-number">30</span>
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.batch_decode(translated_tokens, skip_special_tokens=<span class="hljs-literal">True</span>)[<span class="hljs-number">0</span>]
Le chef de l<span class="hljs-string">&#x27;ONU dit qu&#x27;</span>il n<span class="hljs-string">&#x27;y a pas de solution militaire en Syrie</span>`}}),ue=new Ze({}),ge=new En({props:{code:`from transformers import AutoModelForSeq2SeqLM, AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained(
    "facebook/nllb-200-distilled-600M", use_auth_token=True, src_lang="ron_Latn"
)
model = AutoModelForSeq2SeqLM.from_pretrained("facebook/nllb-200-distilled-600M", use_auth_token=True)

article = "\u015Eeful ONU spune c\u0103 nu exist\u0103 o solu\u0163ie militar\u0103 \xEEn Siria"
inputs = tokenizer(article, return_tensors="pt")

translated_tokens = model.generate(
    **inputs, forced_bos_token_id=tokenizer.lang_code_to_id["deu_Latn"], max_length=30
)
tokenizer.batch_decode(translated_tokens, skip_special_tokens=True)[0]`,highlighted:`<span class="hljs-meta">&gt;&gt;&gt; </span><span class="hljs-keyword">from</span> transformers <span class="hljs-keyword">import</span> AutoModelForSeq2SeqLM, AutoTokenizer

<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer = AutoTokenizer.from_pretrained(
<span class="hljs-meta">... </span>    <span class="hljs-string">&quot;facebook/nllb-200-distilled-600M&quot;</span>, use_auth_token=<span class="hljs-literal">True</span>, src_lang=<span class="hljs-string">&quot;ron_Latn&quot;</span>
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>model = AutoModelForSeq2SeqLM.from_pretrained(<span class="hljs-string">&quot;facebook/nllb-200-distilled-600M&quot;</span>, use_auth_token=<span class="hljs-literal">True</span>)

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

<span class="hljs-meta">&gt;&gt;&gt; </span>translated_tokens = model.generate(
<span class="hljs-meta">... </span>    **inputs, forced_bos_token_id=tokenizer.lang_code_to_id[<span class="hljs-string">&quot;deu_Latn&quot;</span>], max_length=<span class="hljs-number">30</span>
<span class="hljs-meta">... </span>)
<span class="hljs-meta">&gt;&gt;&gt; </span>tokenizer.batch_decode(translated_tokens, skip_special_tokens=<span class="hljs-literal">True</span>)[<span class="hljs-number">0</span>]
UN-Chef sagt, es gibt keine milit\xE4rische L\xF6sung <span class="hljs-keyword">in</span> Syrien`}}),me=new Ze({}),_e=new Ce({props:{name:"class transformers.NllbTokenizer",anchor:"transformers.NllbTokenizer",parameters:[{name:"vocab_file",val:""},{name:"bos_token",val:" = '<s>'"},{name:"eos_token",val:" = '</s>'"},{name:"sep_token",val:" = '</s>'"},{name:"cls_token",val:" = '<s>'"},{name:"unk_token",val:" = '<unk>'"},{name:"pad_token",val:" = '<pad>'"},{name:"mask_token",val:" = '<mask>'"},{name:"tokenizer_file",val:" = None"},{name:"src_lang",val:" = None"},{name:"tgt_lang",val:" = None"},{name:"sp_model_kwargs",val:": typing.Union[typing.Dict[str, typing.Any], NoneType] = None"},{name:"additional_special_tokens",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.NllbTokenizer.vocab_file",description:`<strong>vocab_file</strong> (<code>str</code>) &#x2014;
Path to the vocabulary file.`,name:"vocab_file"},{anchor:"transformers.NllbTokenizer.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.NllbTokenizer.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.</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 end of sequence.
The token used is the <code>sep_token</code>.</p>

					</div>`,name:"eos_token"},{anchor:"transformers.NllbTokenizer.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.NllbTokenizer.cls_token",description:`<strong>cls_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;s&gt;&quot;</code>) &#x2014;
The classifier token which is used when doing sequence classification (classification of the whole sequence
instead of per-token classification). It is the first token of the sequence when built with special tokens.`,name:"cls_token"},{anchor:"transformers.NllbTokenizer.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.NllbTokenizer.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.NllbTokenizer.mask_token",description:`<strong>mask_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;mask&gt;&quot;</code>) &#x2014;
The token used for masking values. This is the token used when training this model with masked language
modeling. This is the token which the model will try to predict.`,name:"mask_token"},{anchor:"transformers.NllbTokenizer.tokenizer_file",description:`<strong>tokenizer_file</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The path to a tokenizer file to use instead of the vocab file.`,name:"tokenizer_file"},{anchor:"transformers.NllbTokenizer.src_lang",description:`<strong>src_lang</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The language to use as source language for translation.`,name:"src_lang"},{anchor:"transformers.NllbTokenizer.tgt_lang",description:`<strong>tgt_lang</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The language to use as target language for translation.`,name:"tgt_lang"},{anchor:"transformers.NllbTokenizer.sp_model_kwargs",description:`<strong>sp_model_kwargs</strong> (<code>Dict[str, str]</code>) &#x2014;
Additional keyword arguments to pass to the model initialization.`,name:"sp_model_kwargs"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/nllb/tokenization_nllb.py#L49"}}),Q=new Us({props:{anchor:"transformers.NllbTokenizer.example",$$slots:{default:[Ys]},$$scope:{ctx:De}}}),be=new Ce({props:{name:"build_inputs_with_special_tokens",anchor:"transformers.NllbTokenizer.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.NllbTokenizer.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.NllbTokenizer.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/main/src/transformers/models/nllb/tokenization_nllb.py#L264",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>
`}}),$e=new Ze({}),ze=new Ce({props:{name:"class transformers.NllbTokenizerFast",anchor:"transformers.NllbTokenizerFast",parameters:[{name:"vocab_file",val:" = None"},{name:"tokenizer_file",val:" = None"},{name:"bos_token",val:" = '<s>'"},{name:"eos_token",val:" = '</s>'"},{name:"sep_token",val:" = '</s>'"},{name:"cls_token",val:" = '<s>'"},{name:"unk_token",val:" = '<unk>'"},{name:"pad_token",val:" = '<pad>'"},{name:"mask_token",val:" = '<mask>'"},{name:"src_lang",val:" = None"},{name:"tgt_lang",val:" = None"},{name:"additional_special_tokens",val:" = None"},{name:"**kwargs",val:""}],parametersDescription:[{anchor:"transformers.NllbTokenizerFast.vocab_file",description:`<strong>vocab_file</strong> (<code>str</code>) &#x2014;
Path to the vocabulary file.`,name:"vocab_file"},{anchor:"transformers.NllbTokenizerFast.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.NllbTokenizerFast.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.</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 end of sequence.
The token used is the <code>sep_token</code>.</p>

					</div>`,name:"eos_token"},{anchor:"transformers.NllbTokenizerFast.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.NllbTokenizerFast.cls_token",description:`<strong>cls_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;s&gt;&quot;</code>) &#x2014;
The classifier token which is used when doing sequence classification (classification of the whole sequence
instead of per-token classification). It is the first token of the sequence when built with special tokens.`,name:"cls_token"},{anchor:"transformers.NllbTokenizerFast.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.NllbTokenizerFast.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.NllbTokenizerFast.mask_token",description:`<strong>mask_token</strong> (<code>str</code>, <em>optional</em>, defaults to <code>&quot;&lt;mask&gt;&quot;</code>) &#x2014;
The token used for masking values. This is the token used when training this model with masked language
modeling. This is the token which the model will try to predict.`,name:"mask_token"},{anchor:"transformers.NllbTokenizerFast.tokenizer_file",description:`<strong>tokenizer_file</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The path to a tokenizer file to use instead of the vocab file.`,name:"tokenizer_file"},{anchor:"transformers.NllbTokenizerFast.src_lang",description:`<strong>src_lang</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The language to use as source language for translation.`,name:"src_lang"},{anchor:"transformers.NllbTokenizerFast.tgt_lang",description:`<strong>tgt_lang</strong> (<code>str</code>, <em>optional</em>) &#x2014;
The language to use as target language for translation.`,name:"tgt_lang"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/nllb/tokenization_nllb_fast.py#L61"}}),ee=new Us({props:{anchor:"transformers.NllbTokenizerFast.example",$$slots:{default:[Qs]},$$scope:{ctx:De}}}),Ne=new Ce({props:{name:"build_inputs_with_special_tokens",anchor:"transformers.NllbTokenizerFast.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.NllbTokenizerFast.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.NllbTokenizerFast.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/main/src/transformers/models/nllb/tokenization_nllb_fast.py#L205",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>
`}}),Ae=new Ce({props:{name:"create_token_type_ids_from_sequences",anchor:"transformers.NllbTokenizerFast.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.NllbTokenizerFast.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.NllbTokenizerFast.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"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/nllb/tokenization_nllb_fast.py#L234",returnDescription:`
<p>List of zeros.</p>
`,returnType:`
<p><code>List[int]</code></p>
`}}),Pe=new Ce({props:{name:"set_src_lang_special_tokens",anchor:"transformers.NllbTokenizerFast.set_src_lang_special_tokens",parameters:[{name:"src_lang",val:""}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/nllb/tokenization_nllb_fast.py#L289"}}),Fe=new Ce({props:{name:"set_tgt_lang_special_tokens",anchor:"transformers.NllbTokenizerFast.set_tgt_lang_special_tokens",parameters:[{name:"lang",val:": str"}],source:"https://github.com/huggingface/transformers/blob/main/src/transformers/models/nllb/tokenization_nllb_fast.py#L304"}}),{c(){g=a("meta"),x=i(),_=a("h1"),u=a("a"),E=a("span"),k(f.$$.fragment),z=i(),et=a("span"),Nn=r("NLLB"),Gt=i(),D=a("p"),tt=a("strong"),xn=r("DISCLAIMER:"),Ln=r(" If you see something strange, file a "),re=a("a"),Sn=r("Github Issue"),jn=r(` and assign
@LysandreJik`),Ht=i(),B=a("h2"),J=a("a"),nt=a("span"),k(le.$$.fragment),An=i(),at=a("span"),Pn=r("Overview of NLLB"),Ut=i(),X=a("p"),Fn=r("The NLLB model was presented in "),ie=a("a"),Mn=r("No Language Left Behind: Scaling Human-Centered Machine Translation"),Cn=r(` by Marta R. Costa-juss\xE0, James Cross, Onur \xC7elebi,
Maha Elbayad, Kenneth Heafield, Kevin Heffernan, Elahe Kalbassi, Janice Lam, Daniel Licht, Jean Maillard, Anna Sun, Skyler Wang, Guillaume Wenzek, Al Youngblood, Bapi Akula,
Loic Barrault, Gabriel Mejia Gonzalez, Prangthip Hansanti, John Hoffman, Semarley Jarrett, Kaushik Ram Sadagopan, Dirk Rowe, Shannon Spruit, Chau Tran, Pierre Andrews,
Necip Fazil Ayan, Shruti Bhosale, Sergey Edunov, Angela Fan, Cynthia Gao, Vedanuj Goswami, Francisco Guzm\xE1n, Philipp Koehn, Alexandre Mourachko, Christophe Ropers,
Safiyyah Saleem, Holger Schwenk, and Jeff Wang.`),Rt=i(),Be=a("p"),Dn=r("The abstract of the paper is the following:"),Wt=i(),Oe=a("p"),ot=a("em"),Bn=r(`Driven by the goal of eradicating language barriers on a global scale, machine translation has solidified itself as a key focus of artificial intelligence research today.
However, such efforts have coalesced around a small subset of languages, leaving behind the vast majority of mostly low-resource languages. What does it take to break the
200 language barrier while ensuring safe, high quality results, all while keeping ethical considerations in mind? In No Language Left Behind, we took on this challenge by
first contextualizing the need for low-resource language translation support through exploratory interviews with native speakers. Then, we created datasets and models aimed
at narrowing the performance gap between low and high-resource languages. More specifically, we developed a conditional compute model based on Sparsely Gated Mixture of
Experts that is trained on data obtained with novel and effective data mining techniques tailored for low-resource languages. We propose multiple architectural and training
improvements to counteract overfitting while training on thousands of tasks. Critically, we evaluated the performance of over 40,000 different translation directions using
a human-translated benchmark, Flores-200, and combined human evaluation with a novel toxicity benchmark covering all languages in Flores-200 to assess translation safety.
Our model achieves an improvement of 44% BLEU relative to the previous state-of-the-art, laying important groundwork towards realizing a universal translation system.`),Jt=i(),Ie=a("p"),On=r("This implementation contains the dense models available on release. Let us know via a GitHub issue if you would like to see the MoE models as well."),Xt=i(),A=a("p"),In=r("This model was contributed by "),ce=a("a"),Gn=r("Lysandre"),Hn=r(". The authors\u2019 code can be found "),de=a("a"),Un=r("here"),Rn=r("."),Kt=i(),O=a("h2"),K=a("a"),st=a("span"),k(pe.$$.fragment),Wn=i(),rt=a("span"),Jn=r("Generating with NLLB"),Vt=i(),P=a("p"),Xn=r("While generating the target text set the "),lt=a("code"),Kn=r("forced_bos_token_id"),Vn=r(` to the target language id. The following
example shows how to translate English to French using the `),it=a("em"),Yn=r("facebook/nllb-200-distilled-600M"),Qn=r(" model."),Yt=i(),F=a("p"),Zn=r("Note that we\u2019re using the BCP-47 code for French "),ct=a("code"),ea=r("fra_Latn"),ta=r(". See "),he=a("a"),na=r("here"),aa=r(`
for the list of all BCP-47 in the Flores 200 dataset.`),Qt=i(),k(fe.$$.fragment),Zt=i(),I=a("h3"),V=a("a"),dt=a("span"),k(ue.$$.fragment),oa=i(),pt=a("span"),sa=r("Generating from any other language than English"),en=i(),M=a("p"),ra=r("English ("),ht=a("code"),la=r("eng_Latn"),ia=r(`) is set as the default language from which to translate. In order to specify that you\u2019d like to translate from a different language,
you should specify the BCP-47 code in the `),ft=a("code"),ca=r("src_lang"),da=r(" keyword argument of the tokenizer initialization."),tn=i(),Ge=a("p"),pa=r("See example below for a translation from romanian to german:"),nn=i(),k(ge.$$.fragment),an=i(),G=a("h2"),Y=a("a"),ut=a("span"),k(me.$$.fragment),ha=i(),gt=a("span"),fa=r("NllbTokenizer"),on=i(),T=a("div"),k(_e.$$.fragment),ua=i(),mt=a("p"),ga=r("Construct an NLLB tokenizer."),ma=i(),j=a("p"),_a=r("Adapted from "),He=a("a"),ka=r("RobertaTokenizer"),ba=r(" and "),Ue=a("a"),va=r("XLNetTokenizer"),wa=r(`. Based on
`),ke=a("a"),ya=r("SentencePiece"),qa=r("."),$a=i(),H=a("p"),za=r("The tokenization method is "),_t=a("code"),Ta=r("<tokens> <eos> <language code>"),Ea=r(" for source language documents, and "),kt=a("code"),Na=r("<language code> <tokens> <eos>"),xa=r(" for target language documents."),La=i(),k(Q.$$.fragment),Sa=i(),L=a("div"),k(be.$$.fragment),ja=i(),ve=a("p"),Aa=r(`Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
adding special tokens. An NLLB sequence has the following format, where `),bt=a("code"),Pa=r("X"),Fa=r(" represents the sequence:"),Ma=i(),we=a("ul"),ye=a("li"),vt=a("code"),Ca=r("input_ids"),Da=r(" (for encoder) "),wt=a("code"),Ba=r("X [eos, src_lang_code]"),Oa=i(),qe=a("li"),yt=a("code"),Ia=r("decoder_input_ids"),Ga=r(": (for decoder) "),qt=a("code"),Ha=r("X [eos, tgt_lang_code]"),Ua=i(),$t=a("p"),Ra=r(`BOS is never used. Pairs of sequences are not the expected use case, but they will be handled without a
separator.`),sn=i(),U=a("h2"),Z=a("a"),zt=a("span"),k($e.$$.fragment),Wa=i(),Tt=a("span"),Ja=r("NllbTokenizerFast"),rn=i(),m=a("div"),k(ze.$$.fragment),Xa=i(),R=a("p"),Ka=r("Construct a \u201Cfast\u201D NLLB tokenizer (backed by HuggingFace\u2019s "),Et=a("em"),Va=r("tokenizers"),Ya=r(` library). Based on
`),Te=a("a"),Qa=r("BPE"),Za=r("."),eo=i(),Ee=a("p"),to=r("This tokenizer inherits from "),Re=a("a"),no=r("PreTrainedTokenizerFast"),ao=r(` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),oo=i(),W=a("p"),so=r("The tokenization method is "),Nt=a("code"),ro=r("<tokens> <eos> <language code>"),lo=r(" for source language documents, and "),xt=a("code"),io=r("<language code> <tokens> <eos>"),co=r(" for target language documents."),po=i(),k(ee.$$.fragment),ho=i(),N=a("div"),k(Ne.$$.fragment),fo=i(),Lt=a("p"),uo=r(`Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
adding special tokens. The special tokens depend on calling set_lang.`),go=i(),xe=a("p"),mo=r("An NLLB sequence has the following format, where "),St=a("code"),_o=r("X"),ko=r(" represents the sequence:"),bo=i(),Le=a("ul"),Se=a("li"),jt=a("code"),vo=r("input_ids"),wo=r(" (for encoder) "),At=a("code"),yo=r("X [eos, src_lang_code]"),qo=i(),je=a("li"),Pt=a("code"),$o=r("decoder_input_ids"),zo=r(": (for decoder) "),Ft=a("code"),To=r("X [eos, tgt_lang_code]"),Eo=i(),Mt=a("p"),No=r(`BOS is never used. Pairs of sequences are not the expected use case, but they will be handled without a
separator.`),xo=i(),te=a("div"),k(Ae.$$.fragment),Lo=i(),Ct=a("p"),So=r(`Create a mask from the two sequences passed to be used in a sequence-pair classification task. nllb does not
make use of token type ids, therefore a list of zeros is returned.`),jo=i(),ne=a("div"),k(Pe.$$.fragment),Ao=i(),Dt=a("p"),Po=r("Reset the special tokens to the source lang setting. No prefix and suffix=[eos, src_lang_code]."),Fo=i(),ae=a("div"),k(Fe.$$.fragment),Mo=i(),Bt=a("p"),Co=r("Reset the special tokens to the target language setting. No prefix and suffix=[eos, tgt_lang_code]."),this.h()},l(t){const p=Ks('[data-svelte="svelte-1phssyn"]',document.head);g=o(p,"META",{name:!0,content:!0}),p.forEach(n),x=c(t),_=o(t,"H1",{class:!0});var Me=s(_);u=o(Me,"A",{id:!0,class:!0,href:!0});var Ot=s(u);E=o(Ot,"SPAN",{});var Do=s(E);b(f.$$.fragment,Do),Do.forEach(n),Ot.forEach(n),z=c(Me),et=o(Me,"SPAN",{});var Bo=s(et);Nn=l(Bo,"NLLB"),Bo.forEach(n),Me.forEach(n),Gt=c(t),D=o(t,"P",{});var It=s(D);tt=o(It,"STRONG",{});var Oo=s(tt);xn=l(Oo,"DISCLAIMER:"),Oo.forEach(n),Ln=l(It," If you see something strange, file a "),re=o(It,"A",{href:!0,rel:!0});var Io=s(re);Sn=l(Io,"Github Issue"),Io.forEach(n),jn=l(It,` and assign
@LysandreJik`),It.forEach(n),Ht=c(t),B=o(t,"H2",{class:!0});var cn=s(B);J=o(cn,"A",{id:!0,class:!0,href:!0});var Go=s(J);nt=o(Go,"SPAN",{});var Ho=s(nt);b(le.$$.fragment,Ho),Ho.forEach(n),Go.forEach(n),An=c(cn),at=o(cn,"SPAN",{});var Uo=s(at);Pn=l(Uo,"Overview of NLLB"),Uo.forEach(n),cn.forEach(n),Ut=c(t),X=o(t,"P",{});var dn=s(X);Fn=l(dn,"The NLLB model was presented in "),ie=o(dn,"A",{href:!0,rel:!0});var Ro=s(ie);Mn=l(Ro,"No Language Left Behind: Scaling Human-Centered Machine Translation"),Ro.forEach(n),Cn=l(dn,` by Marta R. Costa-juss\xE0, James Cross, Onur \xC7elebi,
Maha Elbayad, Kenneth Heafield, Kevin Heffernan, Elahe Kalbassi, Janice Lam, Daniel Licht, Jean Maillard, Anna Sun, Skyler Wang, Guillaume Wenzek, Al Youngblood, Bapi Akula,
Loic Barrault, Gabriel Mejia Gonzalez, Prangthip Hansanti, John Hoffman, Semarley Jarrett, Kaushik Ram Sadagopan, Dirk Rowe, Shannon Spruit, Chau Tran, Pierre Andrews,
Necip Fazil Ayan, Shruti Bhosale, Sergey Edunov, Angela Fan, Cynthia Gao, Vedanuj Goswami, Francisco Guzm\xE1n, Philipp Koehn, Alexandre Mourachko, Christophe Ropers,
Safiyyah Saleem, Holger Schwenk, and Jeff Wang.`),dn.forEach(n),Rt=c(t),Be=o(t,"P",{});var Wo=s(Be);Dn=l(Wo,"The abstract of the paper is the following:"),Wo.forEach(n),Wt=c(t),Oe=o(t,"P",{});var Jo=s(Oe);ot=o(Jo,"EM",{});var Xo=s(ot);Bn=l(Xo,`Driven by the goal of eradicating language barriers on a global scale, machine translation has solidified itself as a key focus of artificial intelligence research today.
However, such efforts have coalesced around a small subset of languages, leaving behind the vast majority of mostly low-resource languages. What does it take to break the
200 language barrier while ensuring safe, high quality results, all while keeping ethical considerations in mind? In No Language Left Behind, we took on this challenge by
first contextualizing the need for low-resource language translation support through exploratory interviews with native speakers. Then, we created datasets and models aimed
at narrowing the performance gap between low and high-resource languages. More specifically, we developed a conditional compute model based on Sparsely Gated Mixture of
Experts that is trained on data obtained with novel and effective data mining techniques tailored for low-resource languages. We propose multiple architectural and training
improvements to counteract overfitting while training on thousands of tasks. Critically, we evaluated the performance of over 40,000 different translation directions using
a human-translated benchmark, Flores-200, and combined human evaluation with a novel toxicity benchmark covering all languages in Flores-200 to assess translation safety.
Our model achieves an improvement of 44% BLEU relative to the previous state-of-the-art, laying important groundwork towards realizing a universal translation system.`),Xo.forEach(n),Jo.forEach(n),Jt=c(t),Ie=o(t,"P",{});var Ko=s(Ie);On=l(Ko,"This implementation contains the dense models available on release. Let us know via a GitHub issue if you would like to see the MoE models as well."),Ko.forEach(n),Xt=c(t),A=o(t,"P",{});var We=s(A);In=l(We,"This model was contributed by "),ce=o(We,"A",{href:!0,rel:!0});var Vo=s(ce);Gn=l(Vo,"Lysandre"),Vo.forEach(n),Hn=l(We,". The authors\u2019 code can be found "),de=o(We,"A",{href:!0,rel:!0});var Yo=s(de);Un=l(Yo,"here"),Yo.forEach(n),Rn=l(We,"."),We.forEach(n),Kt=c(t),O=o(t,"H2",{class:!0});var pn=s(O);K=o(pn,"A",{id:!0,class:!0,href:!0});var Qo=s(K);st=o(Qo,"SPAN",{});var Zo=s(st);b(pe.$$.fragment,Zo),Zo.forEach(n),Qo.forEach(n),Wn=c(pn),rt=o(pn,"SPAN",{});var es=s(rt);Jn=l(es,"Generating with NLLB"),es.forEach(n),pn.forEach(n),Vt=c(t),P=o(t,"P",{});var Je=s(P);Xn=l(Je,"While generating the target text set the "),lt=o(Je,"CODE",{});var ts=s(lt);Kn=l(ts,"forced_bos_token_id"),ts.forEach(n),Vn=l(Je,` to the target language id. The following
example shows how to translate English to French using the `),it=o(Je,"EM",{});var ns=s(it);Yn=l(ns,"facebook/nllb-200-distilled-600M"),ns.forEach(n),Qn=l(Je," model."),Je.forEach(n),Yt=c(t),F=o(t,"P",{});var Xe=s(F);Zn=l(Xe,"Note that we\u2019re using the BCP-47 code for French "),ct=o(Xe,"CODE",{});var as=s(ct);ea=l(as,"fra_Latn"),as.forEach(n),ta=l(Xe,". See "),he=o(Xe,"A",{href:!0,rel:!0});var os=s(he);na=l(os,"here"),os.forEach(n),aa=l(Xe,`
for the list of all BCP-47 in the Flores 200 dataset.`),Xe.forEach(n),Qt=c(t),b(fe.$$.fragment,t),Zt=c(t),I=o(t,"H3",{class:!0});var hn=s(I);V=o(hn,"A",{id:!0,class:!0,href:!0});var ss=s(V);dt=o(ss,"SPAN",{});var rs=s(dt);b(ue.$$.fragment,rs),rs.forEach(n),ss.forEach(n),oa=c(hn),pt=o(hn,"SPAN",{});var ls=s(pt);sa=l(ls,"Generating from any other language than English"),ls.forEach(n),hn.forEach(n),en=c(t),M=o(t,"P",{});var Ke=s(M);ra=l(Ke,"English ("),ht=o(Ke,"CODE",{});var is=s(ht);la=l(is,"eng_Latn"),is.forEach(n),ia=l(Ke,`) is set as the default language from which to translate. In order to specify that you\u2019d like to translate from a different language,
you should specify the BCP-47 code in the `),ft=o(Ke,"CODE",{});var cs=s(ft);ca=l(cs,"src_lang"),cs.forEach(n),da=l(Ke," keyword argument of the tokenizer initialization."),Ke.forEach(n),tn=c(t),Ge=o(t,"P",{});var ds=s(Ge);pa=l(ds,"See example below for a translation from romanian to german:"),ds.forEach(n),nn=c(t),b(ge.$$.fragment,t),an=c(t),G=o(t,"H2",{class:!0});var fn=s(G);Y=o(fn,"A",{id:!0,class:!0,href:!0});var ps=s(Y);ut=o(ps,"SPAN",{});var hs=s(ut);b(me.$$.fragment,hs),hs.forEach(n),ps.forEach(n),ha=c(fn),gt=o(fn,"SPAN",{});var fs=s(gt);fa=l(fs,"NllbTokenizer"),fs.forEach(n),fn.forEach(n),on=c(t),T=o(t,"DIV",{class:!0});var S=s(T);b(_e.$$.fragment,S),ua=c(S),mt=o(S,"P",{});var us=s(mt);ga=l(us,"Construct an NLLB tokenizer."),us.forEach(n),ma=c(S),j=o(S,"P",{});var oe=s(j);_a=l(oe,"Adapted from "),He=o(oe,"A",{href:!0});var gs=s(He);ka=l(gs,"RobertaTokenizer"),gs.forEach(n),ba=l(oe," and "),Ue=o(oe,"A",{href:!0});var ms=s(Ue);va=l(ms,"XLNetTokenizer"),ms.forEach(n),wa=l(oe,`. Based on
`),ke=o(oe,"A",{href:!0,rel:!0});var _s=s(ke);ya=l(_s,"SentencePiece"),_s.forEach(n),qa=l(oe,"."),oe.forEach(n),$a=c(S),H=o(S,"P",{});var Ve=s(H);za=l(Ve,"The tokenization method is "),_t=o(Ve,"CODE",{});var ks=s(_t);Ta=l(ks,"<tokens> <eos> <language code>"),ks.forEach(n),Ea=l(Ve," for source language documents, and "),kt=o(Ve,"CODE",{});var bs=s(kt);Na=l(bs,"<language code> <tokens> <eos>"),bs.forEach(n),xa=l(Ve," for target language documents."),Ve.forEach(n),La=c(S),b(Q.$$.fragment,S),Sa=c(S),L=o(S,"DIV",{class:!0});var se=s(L);b(be.$$.fragment,se),ja=c(se),ve=o(se,"P",{});var un=s(ve);Aa=l(un,`Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
adding special tokens. An NLLB sequence has the following format, where `),bt=o(un,"CODE",{});var vs=s(bt);Pa=l(vs,"X"),vs.forEach(n),Fa=l(un," represents the sequence:"),un.forEach(n),Ma=c(se),we=o(se,"UL",{});var gn=s(we);ye=o(gn,"LI",{});var mn=s(ye);vt=o(mn,"CODE",{});var ws=s(vt);Ca=l(ws,"input_ids"),ws.forEach(n),Da=l(mn," (for encoder) "),wt=o(mn,"CODE",{});var ys=s(wt);Ba=l(ys,"X [eos, src_lang_code]"),ys.forEach(n),mn.forEach(n),Oa=c(gn),qe=o(gn,"LI",{});var _n=s(qe);yt=o(_n,"CODE",{});var qs=s(yt);Ia=l(qs,"decoder_input_ids"),qs.forEach(n),Ga=l(_n,": (for decoder) "),qt=o(_n,"CODE",{});var $s=s(qt);Ha=l($s,"X [eos, tgt_lang_code]"),$s.forEach(n),_n.forEach(n),gn.forEach(n),Ua=c(se),$t=o(se,"P",{});var zs=s($t);Ra=l(zs,`BOS is never used. Pairs of sequences are not the expected use case, but they will be handled without a
separator.`),zs.forEach(n),se.forEach(n),S.forEach(n),sn=c(t),U=o(t,"H2",{class:!0});var kn=s(U);Z=o(kn,"A",{id:!0,class:!0,href:!0});var Ts=s(Z);zt=o(Ts,"SPAN",{});var Es=s(zt);b($e.$$.fragment,Es),Es.forEach(n),Ts.forEach(n),Wa=c(kn),Tt=o(kn,"SPAN",{});var Ns=s(Tt);Ja=l(Ns,"NllbTokenizerFast"),Ns.forEach(n),kn.forEach(n),rn=c(t),m=o(t,"DIV",{class:!0});var $=s(m);b(ze.$$.fragment,$),Xa=c($),R=o($,"P",{});var Ye=s(R);Ka=l(Ye,"Construct a \u201Cfast\u201D NLLB tokenizer (backed by HuggingFace\u2019s "),Et=o(Ye,"EM",{});var xs=s(Et);Va=l(xs,"tokenizers"),xs.forEach(n),Ya=l(Ye,` library). Based on
`),Te=o(Ye,"A",{href:!0,rel:!0});var Ls=s(Te);Qa=l(Ls,"BPE"),Ls.forEach(n),Za=l(Ye,"."),Ye.forEach(n),eo=c($),Ee=o($,"P",{});var bn=s(Ee);to=l(bn,"This tokenizer inherits from "),Re=o(bn,"A",{href:!0});var Ss=s(Re);no=l(Ss,"PreTrainedTokenizerFast"),Ss.forEach(n),ao=l(bn,` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),bn.forEach(n),oo=c($),W=o($,"P",{});var Qe=s(W);so=l(Qe,"The tokenization method is "),Nt=o(Qe,"CODE",{});var js=s(Nt);ro=l(js,"<tokens> <eos> <language code>"),js.forEach(n),lo=l(Qe," for source language documents, and "),xt=o(Qe,"CODE",{});var As=s(xt);io=l(As,"<language code> <tokens> <eos>"),As.forEach(n),co=l(Qe," for target language documents."),Qe.forEach(n),po=c($),b(ee.$$.fragment,$),ho=c($),N=o($,"DIV",{class:!0});var C=s(N);b(Ne.$$.fragment,C),fo=c(C),Lt=o(C,"P",{});var Ps=s(Lt);uo=l(Ps,`Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
adding special tokens. The special tokens depend on calling set_lang.`),Ps.forEach(n),go=c(C),xe=o(C,"P",{});var vn=s(xe);mo=l(vn,"An NLLB sequence has the following format, where "),St=o(vn,"CODE",{});var Fs=s(St);_o=l(Fs,"X"),Fs.forEach(n),ko=l(vn," represents the sequence:"),vn.forEach(n),bo=c(C),Le=o(C,"UL",{});var wn=s(Le);Se=o(wn,"LI",{});var yn=s(Se);jt=o(yn,"CODE",{});var Ms=s(jt);vo=l(Ms,"input_ids"),Ms.forEach(n),wo=l(yn," (for encoder) "),At=o(yn,"CODE",{});var Cs=s(At);yo=l(Cs,"X [eos, src_lang_code]"),Cs.forEach(n),yn.forEach(n),qo=c(wn),je=o(wn,"LI",{});var qn=s(je);Pt=o(qn,"CODE",{});var Ds=s(Pt);$o=l(Ds,"decoder_input_ids"),Ds.forEach(n),zo=l(qn,": (for decoder) "),Ft=o(qn,"CODE",{});var Bs=s(Ft);To=l(Bs,"X [eos, tgt_lang_code]"),Bs.forEach(n),qn.forEach(n),wn.forEach(n),Eo=c(C),Mt=o(C,"P",{});var Os=s(Mt);No=l(Os,`BOS is never used. Pairs of sequences are not the expected use case, but they will be handled without a
separator.`),Os.forEach(n),C.forEach(n),xo=c($),te=o($,"DIV",{class:!0});var $n=s(te);b(Ae.$$.fragment,$n),Lo=c($n),Ct=o($n,"P",{});var Is=s(Ct);So=l(Is,`Create a mask from the two sequences passed to be used in a sequence-pair classification task. nllb does not
make use of token type ids, therefore a list of zeros is returned.`),Is.forEach(n),$n.forEach(n),jo=c($),ne=o($,"DIV",{class:!0});var zn=s(ne);b(Pe.$$.fragment,zn),Ao=c(zn),Dt=o(zn,"P",{});var Gs=s(Dt);Po=l(Gs,"Reset the special tokens to the source lang setting. No prefix and suffix=[eos, src_lang_code]."),Gs.forEach(n),zn.forEach(n),Fo=c($),ae=o($,"DIV",{class:!0});var Tn=s(ae);b(Fe.$$.fragment,Tn),Mo=c(Tn),Bt=o(Tn,"P",{});var Hs=s(Bt);Co=l(Hs,"Reset the special tokens to the target language setting. No prefix and suffix=[eos, tgt_lang_code]."),Hs.forEach(n),Tn.forEach(n),$.forEach(n),this.h()},h(){d(g,"name","hf:doc:metadata"),d(g,"content",JSON.stringify(er)),d(u,"id","nllb"),d(u,"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"),d(u,"href","#nllb"),d(_,"class","relative group"),d(re,"href","https://github.com/huggingface/transformers/issues/new?assignees=&labels=bug&template=bug-report.yml"),d(re,"rel","nofollow"),d(J,"id","overview-of-nllb"),d(J,"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"),d(J,"href","#overview-of-nllb"),d(B,"class","relative group"),d(ie,"href","https://arxiv.org/abs/2207.04672"),d(ie,"rel","nofollow"),d(ce,"href","https://huggingface.co/lysandre"),d(ce,"rel","nofollow"),d(de,"href","https://github.com/facebookresearch/fairseq/tree/nllb"),d(de,"rel","nofollow"),d(K,"id","generating-with-nllb"),d(K,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(K,"href","#generating-with-nllb"),d(O,"class","relative group"),d(he,"href","https://github.com/facebookresearch/flores/blob/main/flores200/README.md#languages-in-flores-200"),d(he,"rel","nofollow"),d(V,"id","generating-from-any-other-language-than-english"),d(V,"class","header-link block pr-1.5 text-lg no-hover:hidden with-hover:absolute with-hover:p-1.5 with-hover:opacity-0 with-hover:group-hover:opacity-100 with-hover:right-full"),d(V,"href","#generating-from-any-other-language-than-english"),d(I,"class","relative group"),d(Y,"id","transformers.NllbTokenizer"),d(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"),d(Y,"href","#transformers.NllbTokenizer"),d(G,"class","relative group"),d(He,"href","/docs/transformers/main/en/model_doc/roberta#transformers.RobertaTokenizer"),d(Ue,"href","/docs/transformers/main/en/model_doc/xlnet#transformers.XLNetTokenizer"),d(ke,"href","https://github.com/google/sentencepiece"),d(ke,"rel","nofollow"),d(L,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(T,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(Z,"id","transformers.NllbTokenizerFast"),d(Z,"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"),d(Z,"href","#transformers.NllbTokenizerFast"),d(U,"class","relative group"),d(Te,"href","https://huggingface.co/docs/tokenizers/python/latest/components.html?highlight=BPE#models"),d(Te,"rel","nofollow"),d(Re,"href","/docs/transformers/main/en/main_classes/tokenizer#transformers.PreTrainedTokenizerFast"),d(N,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(te,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ne,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(ae,"class","docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"),d(m,"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,g),h(t,x,p),h(t,_,p),e(_,u),e(u,E),v(f,E,null),e(_,z),e(_,et),e(et,Nn),h(t,Gt,p),h(t,D,p),e(D,tt),e(tt,xn),e(D,Ln),e(D,re),e(re,Sn),e(D,jn),h(t,Ht,p),h(t,B,p),e(B,J),e(J,nt),v(le,nt,null),e(B,An),e(B,at),e(at,Pn),h(t,Ut,p),h(t,X,p),e(X,Fn),e(X,ie),e(ie,Mn),e(X,Cn),h(t,Rt,p),h(t,Be,p),e(Be,Dn),h(t,Wt,p),h(t,Oe,p),e(Oe,ot),e(ot,Bn),h(t,Jt,p),h(t,Ie,p),e(Ie,On),h(t,Xt,p),h(t,A,p),e(A,In),e(A,ce),e(ce,Gn),e(A,Hn),e(A,de),e(de,Un),e(A,Rn),h(t,Kt,p),h(t,O,p),e(O,K),e(K,st),v(pe,st,null),e(O,Wn),e(O,rt),e(rt,Jn),h(t,Vt,p),h(t,P,p),e(P,Xn),e(P,lt),e(lt,Kn),e(P,Vn),e(P,it),e(it,Yn),e(P,Qn),h(t,Yt,p),h(t,F,p),e(F,Zn),e(F,ct),e(ct,ea),e(F,ta),e(F,he),e(he,na),e(F,aa),h(t,Qt,p),v(fe,t,p),h(t,Zt,p),h(t,I,p),e(I,V),e(V,dt),v(ue,dt,null),e(I,oa),e(I,pt),e(pt,sa),h(t,en,p),h(t,M,p),e(M,ra),e(M,ht),e(ht,la),e(M,ia),e(M,ft),e(ft,ca),e(M,da),h(t,tn,p),h(t,Ge,p),e(Ge,pa),h(t,nn,p),v(ge,t,p),h(t,an,p),h(t,G,p),e(G,Y),e(Y,ut),v(me,ut,null),e(G,ha),e(G,gt),e(gt,fa),h(t,on,p),h(t,T,p),v(_e,T,null),e(T,ua),e(T,mt),e(mt,ga),e(T,ma),e(T,j),e(j,_a),e(j,He),e(He,ka),e(j,ba),e(j,Ue),e(Ue,va),e(j,wa),e(j,ke),e(ke,ya),e(j,qa),e(T,$a),e(T,H),e(H,za),e(H,_t),e(_t,Ta),e(H,Ea),e(H,kt),e(kt,Na),e(H,xa),e(T,La),v(Q,T,null),e(T,Sa),e(T,L),v(be,L,null),e(L,ja),e(L,ve),e(ve,Aa),e(ve,bt),e(bt,Pa),e(ve,Fa),e(L,Ma),e(L,we),e(we,ye),e(ye,vt),e(vt,Ca),e(ye,Da),e(ye,wt),e(wt,Ba),e(we,Oa),e(we,qe),e(qe,yt),e(yt,Ia),e(qe,Ga),e(qe,qt),e(qt,Ha),e(L,Ua),e(L,$t),e($t,Ra),h(t,sn,p),h(t,U,p),e(U,Z),e(Z,zt),v($e,zt,null),e(U,Wa),e(U,Tt),e(Tt,Ja),h(t,rn,p),h(t,m,p),v(ze,m,null),e(m,Xa),e(m,R),e(R,Ka),e(R,Et),e(Et,Va),e(R,Ya),e(R,Te),e(Te,Qa),e(R,Za),e(m,eo),e(m,Ee),e(Ee,to),e(Ee,Re),e(Re,no),e(Ee,ao),e(m,oo),e(m,W),e(W,so),e(W,Nt),e(Nt,ro),e(W,lo),e(W,xt),e(xt,io),e(W,co),e(m,po),v(ee,m,null),e(m,ho),e(m,N),v(Ne,N,null),e(N,fo),e(N,Lt),e(Lt,uo),e(N,go),e(N,xe),e(xe,mo),e(xe,St),e(St,_o),e(xe,ko),e(N,bo),e(N,Le),e(Le,Se),e(Se,jt),e(jt,vo),e(Se,wo),e(Se,At),e(At,yo),e(Le,qo),e(Le,je),e(je,Pt),e(Pt,$o),e(je,zo),e(je,Ft),e(Ft,To),e(N,Eo),e(N,Mt),e(Mt,No),e(m,xo),e(m,te),v(Ae,te,null),e(te,Lo),e(te,Ct),e(Ct,So),e(m,jo),e(m,ne),v(Pe,ne,null),e(ne,Ao),e(ne,Dt),e(Dt,Po),e(m,Fo),e(m,ae),v(Fe,ae,null),e(ae,Mo),e(ae,Bt),e(Bt,Co),ln=!0},p(t,[p]){const Me={};p&2&&(Me.$$scope={dirty:p,ctx:t}),Q.$set(Me);const Ot={};p&2&&(Ot.$$scope={dirty:p,ctx:t}),ee.$set(Ot)},i(t){ln||(w(f.$$.fragment,t),w(le.$$.fragment,t),w(pe.$$.fragment,t),w(fe.$$.fragment,t),w(ue.$$.fragment,t),w(ge.$$.fragment,t),w(me.$$.fragment,t),w(_e.$$.fragment,t),w(Q.$$.fragment,t),w(be.$$.fragment,t),w($e.$$.fragment,t),w(ze.$$.fragment,t),w(ee.$$.fragment,t),w(Ne.$$.fragment,t),w(Ae.$$.fragment,t),w(Pe.$$.fragment,t),w(Fe.$$.fragment,t),ln=!0)},o(t){y(f.$$.fragment,t),y(le.$$.fragment,t),y(pe.$$.fragment,t),y(fe.$$.fragment,t),y(ue.$$.fragment,t),y(ge.$$.fragment,t),y(me.$$.fragment,t),y(_e.$$.fragment,t),y(Q.$$.fragment,t),y(be.$$.fragment,t),y($e.$$.fragment,t),y(ze.$$.fragment,t),y(ee.$$.fragment,t),y(Ne.$$.fragment,t),y(Ae.$$.fragment,t),y(Pe.$$.fragment,t),y(Fe.$$.fragment,t),ln=!1},d(t){n(g),t&&n(x),t&&n(_),q(f),t&&n(Gt),t&&n(D),t&&n(Ht),t&&n(B),q(le),t&&n(Ut),t&&n(X),t&&n(Rt),t&&n(Be),t&&n(Wt),t&&n(Oe),t&&n(Jt),t&&n(Ie),t&&n(Xt),t&&n(A),t&&n(Kt),t&&n(O),q(pe),t&&n(Vt),t&&n(P),t&&n(Yt),t&&n(F),t&&n(Qt),q(fe,t),t&&n(Zt),t&&n(I),q(ue),t&&n(en),t&&n(M),t&&n(tn),t&&n(Ge),t&&n(nn),q(ge,t),t&&n(an),t&&n(G),q(me),t&&n(on),t&&n(T),q(_e),q(Q),q(be),t&&n(sn),t&&n(U),q($e),t&&n(rn),t&&n(m),q(ze),q(ee),q(Ne),q(Ae),q(Pe),q(Fe)}}}const er={local:"nllb",sections:[{local:"overview-of-nllb",title:"Overview of NLLB"},{local:"generating-with-nllb",sections:[{local:"generating-from-any-other-language-than-english",title:"Generating from any other language than English"}],title:"Generating with NLLB"},{local:"transformers.NllbTokenizer",title:"NllbTokenizer"},{local:"transformers.NllbTokenizerFast",title:"NllbTokenizerFast"}],title:"NLLB"};function tr(De){return Vs(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class lr extends Ws{constructor(g){super();Js(this,g,tr,Zs,Xs,{})}}export{lr as default,er as metadata};
