import{S as Ws,i as Js,s as Xs,e as o,k as i,w as k,t as r,M as Ks,c as a,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=o("p"),x=r("Examples:"),_=i(),k(u.$$.fragment)},l(f){g=a(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=o("p"),x=r("Examples:"),_=i(),k(u.$$.fragment)},l(f){g=a(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,ot,Pn,Ut,X,Fn,ie,Mn,Cn,Rt,Be,Dn,Wt,Oe,at,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,eo,to,he,no,oo,Qt,fe,Zt,I,V,dt,ue,ao,pt,so,en,M,ro,ht,lo,io,ft,co,po,tn,Ge,ho,nn,ge,on,G,Y,ut,me,fo,gt,uo,an,T,_e,go,mt,mo,_o,j,ko,He,bo,vo,Ue,wo,yo,ke,qo,$o,zo,H,To,_t,Eo,No,kt,xo,Lo,So,Q,jo,L,be,Ao,ve,Po,bt,Fo,Mo,Co,we,ye,vt,Do,Bo,wt,Oo,Io,qe,yt,Go,Ho,qt,Uo,Ro,$t,Wo,sn,U,Z,zt,$e,Jo,Tt,Xo,rn,m,ze,Ko,R,Vo,Et,Yo,Qo,Te,Zo,ea,ta,Ee,na,Re,oa,aa,sa,W,ra,Nt,la,ia,xt,ca,da,pa,ee,ha,N,Ne,fa,Lt,ua,ga,xe,ma,St,_a,ka,ba,Le,Se,jt,va,wa,At,ya,qa,je,Pt,$a,za,Ft,Ta,Ea,Mt,Na,xa,te,Ae,La,Ct,Sa,ja,ne,Pe,Aa,Dt,Pa,Fa,oe,Fe,Ma,Bt,Ca,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/vr_19907/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/vr_19907/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/vr_19907/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/vr_19907/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/vr_19907/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/vr_19907/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/vr_19907/src/transformers/models/nllb/tokenization_nllb_fast.py#L304"}}),{c(){g=o("meta"),x=i(),_=o("h1"),u=o("a"),E=o("span"),k(f.$$.fragment),z=i(),et=o("span"),Nn=r("NLLB"),Gt=i(),D=o("p"),tt=o("strong"),xn=r("DISCLAIMER:"),Ln=r(" If you see something strange, file a "),re=o("a"),Sn=r("Github Issue"),jn=r(` and assign
@LysandreJik`),Ht=i(),B=o("h2"),J=o("a"),nt=o("span"),k(le.$$.fragment),An=i(),ot=o("span"),Pn=r("Overview of NLLB"),Ut=i(),X=o("p"),Fn=r("The NLLB model was presented in "),ie=o("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=o("p"),Dn=r("The abstract of the paper is the following:"),Wt=i(),Oe=o("p"),at=o("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=o("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=o("p"),In=r("This model was contributed by "),ce=o("a"),Gn=r("Lysandre"),Hn=r(". The authors\u2019 code can be found "),de=o("a"),Un=r("here"),Rn=r("."),Kt=i(),O=o("h2"),K=o("a"),st=o("span"),k(pe.$$.fragment),Wn=i(),rt=o("span"),Jn=r("Generating with NLLB"),Vt=i(),P=o("p"),Xn=r("While generating the target text set the "),lt=o("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=o("em"),Yn=r("facebook/nllb-200-distilled-600M"),Qn=r(" model."),Yt=i(),F=o("p"),Zn=r("Note that we\u2019re using the BCP-47 code for French "),ct=o("code"),eo=r("fra_Latn"),to=r(". See "),he=o("a"),no=r("here"),oo=r(`
for the list of all BCP-47 in the Flores 200 dataset.`),Qt=i(),k(fe.$$.fragment),Zt=i(),I=o("h3"),V=o("a"),dt=o("span"),k(ue.$$.fragment),ao=i(),pt=o("span"),so=r("Generating from any other language than English"),en=i(),M=o("p"),ro=r("English ("),ht=o("code"),lo=r("eng_Latn"),io=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=o("code"),co=r("src_lang"),po=r(" keyword argument of the tokenizer initialization."),tn=i(),Ge=o("p"),ho=r("See example below for a translation from romanian to german:"),nn=i(),k(ge.$$.fragment),on=i(),G=o("h2"),Y=o("a"),ut=o("span"),k(me.$$.fragment),fo=i(),gt=o("span"),uo=r("NllbTokenizer"),an=i(),T=o("div"),k(_e.$$.fragment),go=i(),mt=o("p"),mo=r("Construct an NLLB tokenizer."),_o=i(),j=o("p"),ko=r("Adapted from "),He=o("a"),bo=r("RobertaTokenizer"),vo=r(" and "),Ue=o("a"),wo=r("XLNetTokenizer"),yo=r(`. Based on
`),ke=o("a"),qo=r("SentencePiece"),$o=r("."),zo=i(),H=o("p"),To=r("The tokenization method is "),_t=o("code"),Eo=r("<tokens> <eos> <language code>"),No=r(" for source language documents, and "),kt=o("code"),xo=r("<language code> <tokens> <eos>"),Lo=r(" for target language documents."),So=i(),k(Q.$$.fragment),jo=i(),L=o("div"),k(be.$$.fragment),Ao=i(),ve=o("p"),Po=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=o("code"),Fo=r("X"),Mo=r(" represents the sequence:"),Co=i(),we=o("ul"),ye=o("li"),vt=o("code"),Do=r("input_ids"),Bo=r(" (for encoder) "),wt=o("code"),Oo=r("X [eos, src_lang_code]"),Io=i(),qe=o("li"),yt=o("code"),Go=r("decoder_input_ids"),Ho=r(": (for decoder) "),qt=o("code"),Uo=r("X [eos, tgt_lang_code]"),Ro=i(),$t=o("p"),Wo=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=o("h2"),Z=o("a"),zt=o("span"),k($e.$$.fragment),Jo=i(),Tt=o("span"),Xo=r("NllbTokenizerFast"),rn=i(),m=o("div"),k(ze.$$.fragment),Ko=i(),R=o("p"),Vo=r("Construct a \u201Cfast\u201D NLLB tokenizer (backed by HuggingFace\u2019s "),Et=o("em"),Yo=r("tokenizers"),Qo=r(` library). Based on
`),Te=o("a"),Zo=r("BPE"),ea=r("."),ta=i(),Ee=o("p"),na=r("This tokenizer inherits from "),Re=o("a"),oa=r("PreTrainedTokenizerFast"),aa=r(` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),sa=i(),W=o("p"),ra=r("The tokenization method is "),Nt=o("code"),la=r("<tokens> <eos> <language code>"),ia=r(" for source language documents, and "),xt=o("code"),ca=r("<language code> <tokens> <eos>"),da=r(" for target language documents."),pa=i(),k(ee.$$.fragment),ha=i(),N=o("div"),k(Ne.$$.fragment),fa=i(),Lt=o("p"),ua=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.`),ga=i(),xe=o("p"),ma=r("An NLLB sequence has the following format, where "),St=o("code"),_a=r("X"),ka=r(" represents the sequence:"),ba=i(),Le=o("ul"),Se=o("li"),jt=o("code"),va=r("input_ids"),wa=r(" (for encoder) "),At=o("code"),ya=r("X [eos, src_lang_code]"),qa=i(),je=o("li"),Pt=o("code"),$a=r("decoder_input_ids"),za=r(": (for decoder) "),Ft=o("code"),Ta=r("X [eos, tgt_lang_code]"),Ea=i(),Mt=o("p"),Na=r(`BOS is never used. Pairs of sequences are not the expected use case, but they will be handled without a
separator.`),xa=i(),te=o("div"),k(Ae.$$.fragment),La=i(),Ct=o("p"),Sa=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.`),ja=i(),ne=o("div"),k(Pe.$$.fragment),Aa=i(),Dt=o("p"),Pa=r("Reset the special tokens to the source lang setting. No prefix and suffix=[eos, src_lang_code]."),Fa=i(),oe=o("div"),k(Fe.$$.fragment),Ma=i(),Bt=o("p"),Ca=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=a(p,"META",{name:!0,content:!0}),p.forEach(n),x=c(t),_=a(t,"H1",{class:!0});var Me=s(_);u=a(Me,"A",{id:!0,class:!0,href:!0});var Ot=s(u);E=a(Ot,"SPAN",{});var Da=s(E);b(f.$$.fragment,Da),Da.forEach(n),Ot.forEach(n),z=c(Me),et=a(Me,"SPAN",{});var Ba=s(et);Nn=l(Ba,"NLLB"),Ba.forEach(n),Me.forEach(n),Gt=c(t),D=a(t,"P",{});var It=s(D);tt=a(It,"STRONG",{});var Oa=s(tt);xn=l(Oa,"DISCLAIMER:"),Oa.forEach(n),Ln=l(It," If you see something strange, file a "),re=a(It,"A",{href:!0,rel:!0});var Ia=s(re);Sn=l(Ia,"Github Issue"),Ia.forEach(n),jn=l(It,` and assign
@LysandreJik`),It.forEach(n),Ht=c(t),B=a(t,"H2",{class:!0});var cn=s(B);J=a(cn,"A",{id:!0,class:!0,href:!0});var Ga=s(J);nt=a(Ga,"SPAN",{});var Ha=s(nt);b(le.$$.fragment,Ha),Ha.forEach(n),Ga.forEach(n),An=c(cn),ot=a(cn,"SPAN",{});var Ua=s(ot);Pn=l(Ua,"Overview of NLLB"),Ua.forEach(n),cn.forEach(n),Ut=c(t),X=a(t,"P",{});var dn=s(X);Fn=l(dn,"The NLLB model was presented in "),ie=a(dn,"A",{href:!0,rel:!0});var Ra=s(ie);Mn=l(Ra,"No Language Left Behind: Scaling Human-Centered Machine Translation"),Ra.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=a(t,"P",{});var Wa=s(Be);Dn=l(Wa,"The abstract of the paper is the following:"),Wa.forEach(n),Wt=c(t),Oe=a(t,"P",{});var Ja=s(Oe);at=a(Ja,"EM",{});var Xa=s(at);Bn=l(Xa,`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.`),Xa.forEach(n),Ja.forEach(n),Jt=c(t),Ie=a(t,"P",{});var Ka=s(Ie);On=l(Ka,"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."),Ka.forEach(n),Xt=c(t),A=a(t,"P",{});var We=s(A);In=l(We,"This model was contributed by "),ce=a(We,"A",{href:!0,rel:!0});var Va=s(ce);Gn=l(Va,"Lysandre"),Va.forEach(n),Hn=l(We,". The authors\u2019 code can be found "),de=a(We,"A",{href:!0,rel:!0});var Ya=s(de);Un=l(Ya,"here"),Ya.forEach(n),Rn=l(We,"."),We.forEach(n),Kt=c(t),O=a(t,"H2",{class:!0});var pn=s(O);K=a(pn,"A",{id:!0,class:!0,href:!0});var Qa=s(K);st=a(Qa,"SPAN",{});var Za=s(st);b(pe.$$.fragment,Za),Za.forEach(n),Qa.forEach(n),Wn=c(pn),rt=a(pn,"SPAN",{});var es=s(rt);Jn=l(es,"Generating with NLLB"),es.forEach(n),pn.forEach(n),Vt=c(t),P=a(t,"P",{});var Je=s(P);Xn=l(Je,"While generating the target text set the "),lt=a(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=a(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=a(t,"P",{});var Xe=s(F);Zn=l(Xe,"Note that we\u2019re using the BCP-47 code for French "),ct=a(Xe,"CODE",{});var os=s(ct);eo=l(os,"fra_Latn"),os.forEach(n),to=l(Xe,". See "),he=a(Xe,"A",{href:!0,rel:!0});var as=s(he);no=l(as,"here"),as.forEach(n),oo=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=a(t,"H3",{class:!0});var hn=s(I);V=a(hn,"A",{id:!0,class:!0,href:!0});var ss=s(V);dt=a(ss,"SPAN",{});var rs=s(dt);b(ue.$$.fragment,rs),rs.forEach(n),ss.forEach(n),ao=c(hn),pt=a(hn,"SPAN",{});var ls=s(pt);so=l(ls,"Generating from any other language than English"),ls.forEach(n),hn.forEach(n),en=c(t),M=a(t,"P",{});var Ke=s(M);ro=l(Ke,"English ("),ht=a(Ke,"CODE",{});var is=s(ht);lo=l(is,"eng_Latn"),is.forEach(n),io=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=a(Ke,"CODE",{});var cs=s(ft);co=l(cs,"src_lang"),cs.forEach(n),po=l(Ke," keyword argument of the tokenizer initialization."),Ke.forEach(n),tn=c(t),Ge=a(t,"P",{});var ds=s(Ge);ho=l(ds,"See example below for a translation from romanian to german:"),ds.forEach(n),nn=c(t),b(ge.$$.fragment,t),on=c(t),G=a(t,"H2",{class:!0});var fn=s(G);Y=a(fn,"A",{id:!0,class:!0,href:!0});var ps=s(Y);ut=a(ps,"SPAN",{});var hs=s(ut);b(me.$$.fragment,hs),hs.forEach(n),ps.forEach(n),fo=c(fn),gt=a(fn,"SPAN",{});var fs=s(gt);uo=l(fs,"NllbTokenizer"),fs.forEach(n),fn.forEach(n),an=c(t),T=a(t,"DIV",{class:!0});var S=s(T);b(_e.$$.fragment,S),go=c(S),mt=a(S,"P",{});var us=s(mt);mo=l(us,"Construct an NLLB tokenizer."),us.forEach(n),_o=c(S),j=a(S,"P",{});var ae=s(j);ko=l(ae,"Adapted from "),He=a(ae,"A",{href:!0});var gs=s(He);bo=l(gs,"RobertaTokenizer"),gs.forEach(n),vo=l(ae," and "),Ue=a(ae,"A",{href:!0});var ms=s(Ue);wo=l(ms,"XLNetTokenizer"),ms.forEach(n),yo=l(ae,`. Based on
`),ke=a(ae,"A",{href:!0,rel:!0});var _s=s(ke);qo=l(_s,"SentencePiece"),_s.forEach(n),$o=l(ae,"."),ae.forEach(n),zo=c(S),H=a(S,"P",{});var Ve=s(H);To=l(Ve,"The tokenization method is "),_t=a(Ve,"CODE",{});var ks=s(_t);Eo=l(ks,"<tokens> <eos> <language code>"),ks.forEach(n),No=l(Ve," for source language documents, and "),kt=a(Ve,"CODE",{});var bs=s(kt);xo=l(bs,"<language code> <tokens> <eos>"),bs.forEach(n),Lo=l(Ve," for target language documents."),Ve.forEach(n),So=c(S),b(Q.$$.fragment,S),jo=c(S),L=a(S,"DIV",{class:!0});var se=s(L);b(be.$$.fragment,se),Ao=c(se),ve=a(se,"P",{});var un=s(ve);Po=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=a(un,"CODE",{});var vs=s(bt);Fo=l(vs,"X"),vs.forEach(n),Mo=l(un," represents the sequence:"),un.forEach(n),Co=c(se),we=a(se,"UL",{});var gn=s(we);ye=a(gn,"LI",{});var mn=s(ye);vt=a(mn,"CODE",{});var ws=s(vt);Do=l(ws,"input_ids"),ws.forEach(n),Bo=l(mn," (for encoder) "),wt=a(mn,"CODE",{});var ys=s(wt);Oo=l(ys,"X [eos, src_lang_code]"),ys.forEach(n),mn.forEach(n),Io=c(gn),qe=a(gn,"LI",{});var _n=s(qe);yt=a(_n,"CODE",{});var qs=s(yt);Go=l(qs,"decoder_input_ids"),qs.forEach(n),Ho=l(_n,": (for decoder) "),qt=a(_n,"CODE",{});var $s=s(qt);Uo=l($s,"X [eos, tgt_lang_code]"),$s.forEach(n),_n.forEach(n),gn.forEach(n),Ro=c(se),$t=a(se,"P",{});var zs=s($t);Wo=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=a(t,"H2",{class:!0});var kn=s(U);Z=a(kn,"A",{id:!0,class:!0,href:!0});var Ts=s(Z);zt=a(Ts,"SPAN",{});var Es=s(zt);b($e.$$.fragment,Es),Es.forEach(n),Ts.forEach(n),Jo=c(kn),Tt=a(kn,"SPAN",{});var Ns=s(Tt);Xo=l(Ns,"NllbTokenizerFast"),Ns.forEach(n),kn.forEach(n),rn=c(t),m=a(t,"DIV",{class:!0});var $=s(m);b(ze.$$.fragment,$),Ko=c($),R=a($,"P",{});var Ye=s(R);Vo=l(Ye,"Construct a \u201Cfast\u201D NLLB tokenizer (backed by HuggingFace\u2019s "),Et=a(Ye,"EM",{});var xs=s(Et);Yo=l(xs,"tokenizers"),xs.forEach(n),Qo=l(Ye,` library). Based on
`),Te=a(Ye,"A",{href:!0,rel:!0});var Ls=s(Te);Zo=l(Ls,"BPE"),Ls.forEach(n),ea=l(Ye,"."),Ye.forEach(n),ta=c($),Ee=a($,"P",{});var bn=s(Ee);na=l(bn,"This tokenizer inherits from "),Re=a(bn,"A",{href:!0});var Ss=s(Re);oa=l(Ss,"PreTrainedTokenizerFast"),Ss.forEach(n),aa=l(bn,` which contains most of the main methods. Users should
refer to this superclass for more information regarding those methods.`),bn.forEach(n),sa=c($),W=a($,"P",{});var Qe=s(W);ra=l(Qe,"The tokenization method is "),Nt=a(Qe,"CODE",{});var js=s(Nt);la=l(js,"<tokens> <eos> <language code>"),js.forEach(n),ia=l(Qe," for source language documents, and "),xt=a(Qe,"CODE",{});var As=s(xt);ca=l(As,"<language code> <tokens> <eos>"),As.forEach(n),da=l(Qe," for target language documents."),Qe.forEach(n),pa=c($),b(ee.$$.fragment,$),ha=c($),N=a($,"DIV",{class:!0});var C=s(N);b(Ne.$$.fragment,C),fa=c(C),Lt=a(C,"P",{});var Ps=s(Lt);ua=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),ga=c(C),xe=a(C,"P",{});var vn=s(xe);ma=l(vn,"An NLLB sequence has the following format, where "),St=a(vn,"CODE",{});var Fs=s(St);_a=l(Fs,"X"),Fs.forEach(n),ka=l(vn," represents the sequence:"),vn.forEach(n),ba=c(C),Le=a(C,"UL",{});var wn=s(Le);Se=a(wn,"LI",{});var yn=s(Se);jt=a(yn,"CODE",{});var Ms=s(jt);va=l(Ms,"input_ids"),Ms.forEach(n),wa=l(yn," (for encoder) "),At=a(yn,"CODE",{});var Cs=s(At);ya=l(Cs,"X [eos, src_lang_code]"),Cs.forEach(n),yn.forEach(n),qa=c(wn),je=a(wn,"LI",{});var qn=s(je);Pt=a(qn,"CODE",{});var Ds=s(Pt);$a=l(Ds,"decoder_input_ids"),Ds.forEach(n),za=l(qn,": (for decoder) "),Ft=a(qn,"CODE",{});var Bs=s(Ft);Ta=l(Bs,"X [eos, tgt_lang_code]"),Bs.forEach(n),qn.forEach(n),wn.forEach(n),Ea=c(C),Mt=a(C,"P",{});var Os=s(Mt);Na=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),xa=c($),te=a($,"DIV",{class:!0});var $n=s(te);b(Ae.$$.fragment,$n),La=c($n),Ct=a($n,"P",{});var Is=s(Ct);Sa=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),ja=c($),ne=a($,"DIV",{class:!0});var zn=s(ne);b(Pe.$$.fragment,zn),Aa=c(zn),Dt=a(zn,"P",{});var Gs=s(Dt);Pa=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),Fa=c($),oe=a($,"DIV",{class:!0});var Tn=s(oe);b(Fe.$$.fragment,Tn),Ma=c(Tn),Bt=a(Tn,"P",{});var Hs=s(Bt);Ca=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/pr_19907/en/model_doc/roberta#transformers.RobertaTokenizer"),d(Ue,"href","/docs/transformers/pr_19907/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/pr_19907/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(oe,"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,ot),e(ot,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,at),e(at,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,eo),e(F,to),e(F,he),e(he,no),e(F,oo),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,ao),e(I,pt),e(pt,so),h(t,en,p),h(t,M,p),e(M,ro),e(M,ht),e(ht,lo),e(M,io),e(M,ft),e(ft,co),e(M,po),h(t,tn,p),h(t,Ge,p),e(Ge,ho),h(t,nn,p),v(ge,t,p),h(t,on,p),h(t,G,p),e(G,Y),e(Y,ut),v(me,ut,null),e(G,fo),e(G,gt),e(gt,uo),h(t,an,p),h(t,T,p),v(_e,T,null),e(T,go),e(T,mt),e(mt,mo),e(T,_o),e(T,j),e(j,ko),e(j,He),e(He,bo),e(j,vo),e(j,Ue),e(Ue,wo),e(j,yo),e(j,ke),e(ke,qo),e(j,$o),e(T,zo),e(T,H),e(H,To),e(H,_t),e(_t,Eo),e(H,No),e(H,kt),e(kt,xo),e(H,Lo),e(T,So),v(Q,T,null),e(T,jo),e(T,L),v(be,L,null),e(L,Ao),e(L,ve),e(ve,Po),e(ve,bt),e(bt,Fo),e(ve,Mo),e(L,Co),e(L,we),e(we,ye),e(ye,vt),e(vt,Do),e(ye,Bo),e(ye,wt),e(wt,Oo),e(we,Io),e(we,qe),e(qe,yt),e(yt,Go),e(qe,Ho),e(qe,qt),e(qt,Uo),e(L,Ro),e(L,$t),e($t,Wo),h(t,sn,p),h(t,U,p),e(U,Z),e(Z,zt),v($e,zt,null),e(U,Jo),e(U,Tt),e(Tt,Xo),h(t,rn,p),h(t,m,p),v(ze,m,null),e(m,Ko),e(m,R),e(R,Vo),e(R,Et),e(Et,Yo),e(R,Qo),e(R,Te),e(Te,Zo),e(R,ea),e(m,ta),e(m,Ee),e(Ee,na),e(Ee,Re),e(Re,oa),e(Ee,aa),e(m,sa),e(m,W),e(W,ra),e(W,Nt),e(Nt,la),e(W,ia),e(W,xt),e(xt,ca),e(W,da),e(m,pa),v(ee,m,null),e(m,ha),e(m,N),v(Ne,N,null),e(N,fa),e(N,Lt),e(Lt,ua),e(N,ga),e(N,xe),e(xe,ma),e(xe,St),e(St,_a),e(xe,ka),e(N,ba),e(N,Le),e(Le,Se),e(Se,jt),e(jt,va),e(Se,wa),e(Se,At),e(At,ya),e(Le,qa),e(Le,je),e(je,Pt),e(Pt,$a),e(je,za),e(je,Ft),e(Ft,Ta),e(N,Ea),e(N,Mt),e(Mt,Na),e(m,xa),e(m,te),v(Ae,te,null),e(te,La),e(te,Ct),e(Ct,Sa),e(m,ja),e(m,ne),v(Pe,ne,null),e(ne,Aa),e(ne,Dt),e(Dt,Pa),e(m,Fa),e(m,oe),v(Fe,oe,null),e(oe,Ma),e(oe,Bt),e(Bt,Ca),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(on),t&&n(G),q(me),t&&n(an),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};
