BLCK-B commited on
Commit
27ab09e
1 Parent(s): 35af297

Upload 9 files

Browse files
added_tokens.json ADDED
@@ -0,0 +1,102 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "__af__": 128004,
3
+ "__am__": 128005,
4
+ "__ar__": 128006,
5
+ "__ast__": 128007,
6
+ "__az__": 128008,
7
+ "__ba__": 128009,
8
+ "__be__": 128010,
9
+ "__bg__": 128011,
10
+ "__bn__": 128012,
11
+ "__br__": 128013,
12
+ "__bs__": 128014,
13
+ "__ca__": 128015,
14
+ "__ceb__": 128016,
15
+ "__cs__": 128017,
16
+ "__cy__": 128018,
17
+ "__da__": 128019,
18
+ "__de__": 128020,
19
+ "__el__": 128021,
20
+ "__en__": 128022,
21
+ "__es__": 128023,
22
+ "__et__": 128024,
23
+ "__fa__": 128025,
24
+ "__ff__": 128026,
25
+ "__fi__": 128027,
26
+ "__fr__": 128028,
27
+ "__fy__": 128029,
28
+ "__ga__": 128030,
29
+ "__gd__": 128031,
30
+ "__gl__": 128032,
31
+ "__gu__": 128033,
32
+ "__ha__": 128034,
33
+ "__he__": 128035,
34
+ "__hi__": 128036,
35
+ "__hr__": 128037,
36
+ "__ht__": 128038,
37
+ "__hu__": 128039,
38
+ "__hy__": 128040,
39
+ "__id__": 128041,
40
+ "__ig__": 128042,
41
+ "__ilo__": 128043,
42
+ "__is__": 128044,
43
+ "__it__": 128045,
44
+ "__ja__": 128046,
45
+ "__jv__": 128047,
46
+ "__ka__": 128048,
47
+ "__kk__": 128049,
48
+ "__km__": 128050,
49
+ "__kn__": 128051,
50
+ "__ko__": 128052,
51
+ "__lb__": 128053,
52
+ "__lg__": 128054,
53
+ "__ln__": 128055,
54
+ "__lo__": 128056,
55
+ "__lt__": 128057,
56
+ "__lv__": 128058,
57
+ "__mg__": 128059,
58
+ "__mk__": 128060,
59
+ "__ml__": 128061,
60
+ "__mn__": 128062,
61
+ "__mr__": 128063,
62
+ "__ms__": 128064,
63
+ "__my__": 128065,
64
+ "__ne__": 128066,
65
+ "__nl__": 128067,
66
+ "__no__": 128068,
67
+ "__ns__": 128069,
68
+ "__oc__": 128070,
69
+ "__or__": 128071,
70
+ "__pa__": 128072,
71
+ "__pl__": 128073,
72
+ "__ps__": 128074,
73
+ "__pt__": 128075,
74
+ "__ro__": 128076,
75
+ "__ru__": 128077,
76
+ "__sd__": 128078,
77
+ "__si__": 128079,
78
+ "__sk__": 128080,
79
+ "__sl__": 128081,
80
+ "__so__": 128082,
81
+ "__sq__": 128083,
82
+ "__sr__": 128084,
83
+ "__ss__": 128085,
84
+ "__su__": 128086,
85
+ "__sv__": 128087,
86
+ "__sw__": 128088,
87
+ "__ta__": 128089,
88
+ "__th__": 128090,
89
+ "__tl__": 128091,
90
+ "__tn__": 128092,
91
+ "__tr__": 128093,
92
+ "__uk__": 128094,
93
+ "__ur__": 128095,
94
+ "__uz__": 128096,
95
+ "__vi__": 128097,
96
+ "__wo__": 128098,
97
+ "__xh__": 128099,
98
+ "__yi__": 128100,
99
+ "__yo__": 128101,
100
+ "__zh__": 128102,
101
+ "__zu__": 128103
102
+ }
config.json ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_name_or_path": "small100",
3
+ "activation_dropout": 0.0,
4
+ "activation_function": "relu",
5
+ "architectures": [
6
+ "M2M100ForConditionalGeneration"
7
+ ],
8
+ "attention_dropout": 0.1,
9
+ "bos_token_id": 0,
10
+ "d_model": 1024,
11
+ "decoder_attention_heads": 16,
12
+ "decoder_ffn_dim": 4096,
13
+ "decoder_layerdrop": 0.0,
14
+ "decoder_layers": 3,
15
+ "decoder_start_token_id": 2,
16
+ "dropout": 0.1,
17
+ "encoder_attention_heads": 16,
18
+ "encoder_ffn_dim": 4096,
19
+ "encoder_layerdrop": 0.0,
20
+ "encoder_layers": 12,
21
+ "eos_token_id": 2,
22
+ "init_std": 0.02,
23
+ "is_encoder_decoder": true,
24
+ "max_length": 256,
25
+ "max_position_embeddings": 1024,
26
+ "model_type": "m2m_100",
27
+ "num_beams": 5,
28
+ "num_hidden_layers": 12,
29
+ "pad_token_id": 1,
30
+ "quantization_config": {
31
+ "_load_in_4bit": true,
32
+ "_load_in_8bit": false,
33
+ "bnb_4bit_compute_dtype": "float32",
34
+ "bnb_4bit_quant_storage": "uint8",
35
+ "bnb_4bit_quant_type": "fp4",
36
+ "bnb_4bit_use_double_quant": false,
37
+ "llm_int8_enable_fp32_cpu_offload": false,
38
+ "llm_int8_has_fp16_weight": false,
39
+ "llm_int8_skip_modules": null,
40
+ "llm_int8_threshold": 6.0,
41
+ "load_in_4bit": true,
42
+ "load_in_8bit": false,
43
+ "quant_method": "bitsandbytes"
44
+ },
45
+ "scale_embedding": true,
46
+ "torch_dtype": "float32",
47
+ "transformers_version": "4.44.2",
48
+ "use_cache": true,
49
+ "vocab_size": 128112
50
+ }
generation_config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_from_model_config": true,
3
+ "bos_token_id": 0,
4
+ "decoder_start_token_id": 2,
5
+ "eos_token_id": 2,
6
+ "max_length": 256,
7
+ "num_beams": 5,
8
+ "pad_token_id": 1,
9
+ "transformers_version": "4.44.2"
10
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cac0443a7e8fbe7c208628242ebb25f380f0118e28fbbecf7c351e00a44e2b14
3
+ size 638966214
sentencepiece.bpe.model ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d8f7c76ed2a5e0822be39f0a4f95a55eb19c78f4593ce609e2edbc2aea4d380a
3
+ size 2423393
special_tokens_map.json ADDED
@@ -0,0 +1,109 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "additional_special_tokens": [
3
+ "__af__",
4
+ "__am__",
5
+ "__ar__",
6
+ "__ast__",
7
+ "__az__",
8
+ "__ba__",
9
+ "__be__",
10
+ "__bg__",
11
+ "__bn__",
12
+ "__br__",
13
+ "__bs__",
14
+ "__ca__",
15
+ "__ceb__",
16
+ "__cs__",
17
+ "__cy__",
18
+ "__da__",
19
+ "__de__",
20
+ "__el__",
21
+ "__en__",
22
+ "__es__",
23
+ "__et__",
24
+ "__fa__",
25
+ "__ff__",
26
+ "__fi__",
27
+ "__fr__",
28
+ "__fy__",
29
+ "__ga__",
30
+ "__gd__",
31
+ "__gl__",
32
+ "__gu__",
33
+ "__ha__",
34
+ "__he__",
35
+ "__hi__",
36
+ "__hr__",
37
+ "__ht__",
38
+ "__hu__",
39
+ "__hy__",
40
+ "__id__",
41
+ "__ig__",
42
+ "__ilo__",
43
+ "__is__",
44
+ "__it__",
45
+ "__ja__",
46
+ "__jv__",
47
+ "__ka__",
48
+ "__kk__",
49
+ "__km__",
50
+ "__kn__",
51
+ "__ko__",
52
+ "__lb__",
53
+ "__lg__",
54
+ "__ln__",
55
+ "__lo__",
56
+ "__lt__",
57
+ "__lv__",
58
+ "__mg__",
59
+ "__mk__",
60
+ "__ml__",
61
+ "__mn__",
62
+ "__mr__",
63
+ "__ms__",
64
+ "__my__",
65
+ "__ne__",
66
+ "__nl__",
67
+ "__no__",
68
+ "__ns__",
69
+ "__oc__",
70
+ "__or__",
71
+ "__pa__",
72
+ "__pl__",
73
+ "__ps__",
74
+ "__pt__",
75
+ "__ro__",
76
+ "__ru__",
77
+ "__sd__",
78
+ "__si__",
79
+ "__sk__",
80
+ "__sl__",
81
+ "__so__",
82
+ "__sq__",
83
+ "__sr__",
84
+ "__ss__",
85
+ "__su__",
86
+ "__sv__",
87
+ "__sw__",
88
+ "__ta__",
89
+ "__th__",
90
+ "__tl__",
91
+ "__tn__",
92
+ "__tr__",
93
+ "__uk__",
94
+ "__ur__",
95
+ "__uz__",
96
+ "__vi__",
97
+ "__wo__",
98
+ "__xh__",
99
+ "__yi__",
100
+ "__yo__",
101
+ "__zh__",
102
+ "__zu__"
103
+ ],
104
+ "bos_token": "<s>",
105
+ "eos_token": "</s>",
106
+ "pad_token": "<pad>",
107
+ "sep_token": "</s>",
108
+ "unk_token": "<unk>"
109
+ }
tokenization_small100.py ADDED
@@ -0,0 +1,371 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (c) 2022 Idiap Research Institute, http://www.idiap.ch/
2
+ # Written by Alireza Mohammadshahi <alireza.mohammadshahi@idiap.ch>
3
+ # This is a modified version of https://github.com/huggingface/transformers/blob/main/src/transformers/models/m2m_100/tokenization_m2m_100.py
4
+ # which owns by Fariseq Authors and The HuggingFace Inc. team.
5
+ #
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ """Tokenization classes for SMALL100."""
19
+ import json
20
+ import os
21
+ from pathlib import Path
22
+ from shutil import copyfile
23
+ from typing import Any, Dict, List, Optional, Tuple, Union
24
+
25
+ import sentencepiece
26
+
27
+ from transformers.tokenization_utils import BatchEncoding, PreTrainedTokenizer
28
+ from transformers.utils import logging
29
+
30
+ logger = logging.get_logger(__name__)
31
+
32
+ SPIECE_UNDERLINE = "▁"
33
+
34
+ VOCAB_FILES_NAMES = {
35
+ "vocab_file": "vocab.json",
36
+ "spm_file": "sentencepiece.bpe.model",
37
+ "tokenizer_config_file": "tokenizer_config.json",
38
+ }
39
+
40
+ PRETRAINED_VOCAB_FILES_MAP = {
41
+ "vocab_file": {
42
+ "alirezamsh/small100": "https://huggingface.co/alirezamsh/small100/resolve/main/vocab.json",
43
+ },
44
+ "spm_file": {
45
+ "alirezamsh/small100": "https://huggingface.co/alirezamsh/small100/resolve/main/sentencepiece.bpe.model",
46
+ },
47
+ "tokenizer_config_file": {
48
+ "alirezamsh/small100": "https://huggingface.co/alirezamsh/small100/resolve/main/tokenizer_config.json",
49
+ },
50
+ }
51
+
52
+ PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES = {
53
+ "alirezamsh/small100": 1024,
54
+ }
55
+
56
+ # fmt: off
57
+ FAIRSEQ_LANGUAGE_CODES = {
58
+ "m2m100": ["af", "am", "ar", "ast", "az", "ba", "be", "bg", "bn", "br", "bs", "ca", "ceb", "cs", "cy", "da", "de",
59
+ "el", "en", "es", "et", "fa", "ff", "fi", "fr", "fy", "ga", "gd", "gl", "gu", "ha", "he", "hi", "hr",
60
+ "ht", "hu", "hy", "id", "ig", "ilo", "is", "it", "ja", "jv", "ka", "kk", "km", "kn", "ko", "lb", "lg",
61
+ "ln", "lo", "lt", "lv", "mg", "mk", "ml", "mn", "mr", "ms", "my", "ne", "nl", "no", "ns", "oc", "or",
62
+ "pa", "pl", "ps", "pt", "ro", "ru", "sd", "si", "sk", "sl", "so", "sq", "sr", "ss", "su", "sv", "sw",
63
+ "ta", "th", "tl", "tn", "tr", "uk", "ur", "uz", "vi", "wo", "xh", "yi", "yo", "zh", "zu"]
64
+ }
65
+
66
+
67
+ # fmt: on
68
+
69
+
70
+ class M2M100Tokenizer(PreTrainedTokenizer):
71
+ """
72
+ Construct an SMALL100 tokenizer. Based on [SentencePiece](https://github.com/google/sentencepiece).
73
+ This tokenizer inherits from [`PreTrainedTokenizer`] which contains most of the main methods. Users should refer to
74
+ this superclass for more information regarding those methods.
75
+ Args:
76
+ vocab_file (`str`):
77
+ Path to the vocabulary file.
78
+ spm_file (`str`):
79
+ Path to [SentencePiece](https://github.com/google/sentencepiece) file (generally has a .spm extension) that
80
+ contains the vocabulary.
81
+ tgt_lang (`str`, *optional*):
82
+ A string representing the target language.
83
+ eos_token (`str`, *optional*, defaults to `"</s>"`):
84
+ The end of sequence token.
85
+ sep_token (`str`, *optional*, defaults to `"</s>"`):
86
+ The separator token, which is used when building a sequence from multiple sequences, e.g. two sequences for
87
+ sequence classification or for a text and a question for question answering. It is also used as the last
88
+ token of a sequence built with special tokens.
89
+ unk_token (`str`, *optional*, defaults to `"<unk>"`):
90
+ The unknown token. A token that is not in the vocabulary cannot be converted to an ID and is set to be this
91
+ token instead.
92
+ pad_token (`str`, *optional*, defaults to `"<pad>"`):
93
+ The token used for padding, for example when batching sequences of different lengths.
94
+ language_codes (`str`, *optional*):
95
+ What language codes to use. Should be `"m2m100"`.
96
+ sp_model_kwargs (`dict`, *optional*):
97
+ Will be passed to the `SentencePieceProcessor.__init__()` method. The [Python wrapper for
98
+ SentencePiece](https://github.com/google/sentencepiece/tree/master/python) can be used, among other things,
99
+ to set:
100
+ - `enable_sampling`: Enable subword regularization.
101
+ - `nbest_size`: Sampling parameters for unigram. Invalid for BPE-Dropout.
102
+ - `nbest_size = {0,1}`: No sampling is performed.
103
+ - `nbest_size > 1`: samples from the nbest_size results.
104
+ - `nbest_size < 0`: assuming that nbest_size is infinite and samples from the all hypothesis (lattice)
105
+ using forward-filtering-and-backward-sampling algorithm.
106
+ - `alpha`: Smoothing parameter for unigram sampling, and dropout probability of merge operations for
107
+ BPE-dropout.
108
+ Examples:
109
+ ```python
110
+ >>> from tokenization_small100 import M2M100Tokenizer
111
+ >>> tokenizer = M2M100Tokenizer.from_pretrained("alirezamsh/small100", tgt_lang="ro")
112
+ >>> src_text = " UN Chief Says There Is No Military Solution in Syria"
113
+ >>> tgt_text = "Şeful ONU declară că nu există o soluţie militară în Siria"
114
+ >>> model_inputs = tokenizer(src_text, text_target=tgt_text, return_tensors="pt")
115
+ >>> model(**model_inputs) # should work
116
+ ```"""
117
+
118
+ vocab_files_names = VOCAB_FILES_NAMES
119
+ max_model_input_sizes = PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
120
+ pretrained_vocab_files_map = PRETRAINED_VOCAB_FILES_MAP
121
+ model_input_names = ["input_ids", "attention_mask"]
122
+
123
+ prefix_tokens: List[int] = []
124
+ suffix_tokens: List[int] = []
125
+
126
+ def __init__(
127
+ self,
128
+ vocab_file,
129
+ spm_file,
130
+ tgt_lang=None,
131
+ bos_token="<s>",
132
+ eos_token="</s>",
133
+ sep_token="</s>",
134
+ pad_token="<pad>",
135
+ unk_token="<unk>",
136
+ language_codes="m2m100",
137
+ sp_model_kwargs: Optional[Dict[str, Any]] = None,
138
+ num_madeup_words=8,
139
+ **kwargs,
140
+ ) -> None:
141
+ self.sp_model_kwargs = {} if sp_model_kwargs is None else sp_model_kwargs
142
+
143
+ self.language_codes = language_codes
144
+ fairseq_language_code = FAIRSEQ_LANGUAGE_CODES[language_codes]
145
+ self.lang_code_to_token = {lang_code: f"__{lang_code}__" for lang_code in fairseq_language_code}
146
+
147
+ kwargs["additional_special_tokens"] = kwargs.get("additional_special_tokens", [])
148
+ kwargs["additional_special_tokens"] += [
149
+ self.get_lang_token(lang_code)
150
+ for lang_code in fairseq_language_code
151
+ if self.get_lang_token(lang_code) not in kwargs["additional_special_tokens"]
152
+ ]
153
+
154
+ self.vocab_file = vocab_file
155
+ self.encoder = load_json(vocab_file)
156
+ self.decoder = {v: k for k, v in self.encoder.items()}
157
+ self.spm_file = spm_file
158
+ self.sp_model = load_spm(spm_file, self.sp_model_kwargs)
159
+
160
+ self.encoder_size = len(self.encoder)
161
+
162
+ self.lang_token_to_id = {
163
+ self.get_lang_token(lang_code): self.encoder_size + i for i, lang_code in enumerate(fairseq_language_code)
164
+ }
165
+ self.lang_code_to_id = {lang_code: self.encoder_size + i for i, lang_code in enumerate(fairseq_language_code)}
166
+ self.id_to_lang_token = {v: k for k, v in self.lang_token_to_id.items()}
167
+
168
+ self._tgt_lang = tgt_lang if tgt_lang is not None else "en"
169
+ self.cur_lang_id = self.get_lang_id(self._tgt_lang)
170
+ self.num_madeup_words = num_madeup_words
171
+
172
+ super().__init__(
173
+ tgt_lang=tgt_lang,
174
+ bos_token=bos_token,
175
+ eos_token=eos_token,
176
+ sep_token=sep_token,
177
+ unk_token=unk_token,
178
+ pad_token=pad_token,
179
+ language_codes=language_codes,
180
+ sp_model_kwargs=self.sp_model_kwargs,
181
+ num_madeup_words=num_madeup_words,
182
+ **kwargs,
183
+ )
184
+
185
+ self.set_lang_special_tokens(self._tgt_lang)
186
+
187
+ @property
188
+ def vocab_size(self) -> int:
189
+ return len(self.encoder) + len(self.lang_token_to_id) + self.num_madeup_words
190
+
191
+ @property
192
+ def tgt_lang(self) -> str:
193
+ return self._tgt_lang
194
+
195
+ @tgt_lang.setter
196
+ def tgt_lang(self, new_tgt_lang: str) -> None:
197
+ self._tgt_lang = new_tgt_lang
198
+ self.set_lang_special_tokens(self._tgt_lang)
199
+
200
+ def _tokenize(self, text: str) -> List[str]:
201
+ return self.sp_model.encode(text, out_type=str)
202
+
203
+ def _convert_token_to_id(self, token):
204
+ if token in self.lang_token_to_id:
205
+ return self.lang_token_to_id[token]
206
+ return self.encoder.get(token, self.encoder[self.unk_token])
207
+
208
+ def _convert_id_to_token(self, index: int) -> str:
209
+ """Converts an index (integer) in a token (str) using the decoder."""
210
+ if index in self.id_to_lang_token:
211
+ return self.id_to_lang_token[index]
212
+ return self.decoder.get(index, self.unk_token)
213
+
214
+ def convert_tokens_to_string(self, tokens: List[str]) -> str:
215
+ """Converts a sequence of tokens (strings for sub-words) in a single string."""
216
+ return self.sp_model.decode(tokens)
217
+
218
+ def get_special_tokens_mask(
219
+ self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None,
220
+ already_has_special_tokens: bool = False
221
+ ) -> List[int]:
222
+ """
223
+ Retrieve sequence ids from a token list that has no special tokens added. This method is called when adding
224
+ special tokens using the tokenizer `prepare_for_model` method.
225
+ Args:
226
+ token_ids_0 (`List[int]`):
227
+ List of IDs.
228
+ token_ids_1 (`List[int]`, *optional*):
229
+ Optional second list of IDs for sequence pairs.
230
+ already_has_special_tokens (`bool`, *optional*, defaults to `False`):
231
+ Whether or not the token list is already formatted with special tokens for the model.
232
+ Returns:
233
+ `List[int]`: A list of integers in the range [0, 1]: 1 for a special token, 0 for a sequence token.
234
+ """
235
+
236
+ if already_has_special_tokens:
237
+ return super().get_special_tokens_mask(
238
+ token_ids_0=token_ids_0, token_ids_1=token_ids_1, already_has_special_tokens=True
239
+ )
240
+
241
+ prefix_ones = [1] * len(self.prefix_tokens)
242
+ suffix_ones = [1] * len(self.suffix_tokens)
243
+ if token_ids_1 is None:
244
+ return prefix_ones + ([0] * len(token_ids_0)) + suffix_ones
245
+ return prefix_ones + ([0] * len(token_ids_0)) + ([0] * len(token_ids_1)) + suffix_ones
246
+
247
+ def build_inputs_with_special_tokens(
248
+ self, token_ids_0: List[int], token_ids_1: Optional[List[int]] = None
249
+ ) -> List[int]:
250
+ """
251
+ Build model inputs from a sequence or a pair of sequence for sequence classification tasks by concatenating and
252
+ adding special tokens. An MBART sequence has the following format, where `X` represents the sequence:
253
+ - `input_ids` (for encoder) `X [eos, src_lang_code]`
254
+ - `decoder_input_ids`: (for decoder) `X [eos, tgt_lang_code]`
255
+ BOS is never used. Pairs of sequences are not the expected use case, but they will be handled without a
256
+ separator.
257
+ Args:
258
+ token_ids_0 (`List[int]`):
259
+ List of IDs to which the special tokens will be added.
260
+ token_ids_1 (`List[int]`, *optional*):
261
+ Optional second list of IDs for sequence pairs.
262
+ Returns:
263
+ `List[int]`: List of [input IDs](../glossary#input-ids) with the appropriate special tokens.
264
+ """
265
+ if token_ids_1 is None:
266
+ if self.prefix_tokens is None:
267
+ return token_ids_0 + self.suffix_tokens
268
+ else:
269
+ return self.prefix_tokens + token_ids_0 + self.suffix_tokens
270
+ # We don't expect to process pairs, but leave the pair logic for API consistency
271
+ if self.prefix_tokens is None:
272
+ return token_ids_0 + token_ids_1 + self.suffix_tokens
273
+ else:
274
+ return self.prefix_tokens + token_ids_0 + token_ids_1 + self.suffix_tokens
275
+
276
+ def get_vocab(self) -> Dict:
277
+ vocab = {self.convert_ids_to_tokens(i): i for i in range(self.vocab_size)}
278
+ vocab.update(self.added_tokens_encoder)
279
+ return vocab
280
+
281
+ def __getstate__(self) -> Dict:
282
+ state = self.__dict__.copy()
283
+ state["sp_model"] = None
284
+ return state
285
+
286
+ def __setstate__(self, d: Dict) -> None:
287
+ self.__dict__ = d
288
+
289
+ # for backward compatibility
290
+ if not hasattr(self, "sp_model_kwargs"):
291
+ self.sp_model_kwargs = {}
292
+
293
+ self.sp_model = load_spm(self.spm_file, self.sp_model_kwargs)
294
+
295
+ def save_vocabulary(self, save_directory: str, filename_prefix: Optional[str] = None) -> Tuple[str]:
296
+ save_dir = Path(save_directory)
297
+ if not save_dir.is_dir():
298
+ raise OSError(f"{save_directory} should be a directory")
299
+ vocab_save_path = save_dir / (
300
+ (filename_prefix + "-" if filename_prefix else "") + self.vocab_files_names["vocab_file"]
301
+ )
302
+ spm_save_path = save_dir / (
303
+ (filename_prefix + "-" if filename_prefix else "") + self.vocab_files_names["spm_file"]
304
+ )
305
+
306
+ save_json(self.encoder, vocab_save_path)
307
+
308
+ if os.path.abspath(self.spm_file) != os.path.abspath(spm_save_path) and os.path.isfile(self.spm_file):
309
+ copyfile(self.spm_file, spm_save_path)
310
+ elif not os.path.isfile(self.spm_file):
311
+ with open(spm_save_path, "wb") as fi:
312
+ content_spiece_model = self.sp_model.serialized_model_proto()
313
+ fi.write(content_spiece_model)
314
+
315
+ return (str(vocab_save_path), str(spm_save_path))
316
+
317
+ def prepare_seq2seq_batch(
318
+ self,
319
+ src_texts: List[str],
320
+ tgt_texts: Optional[List[str]] = None,
321
+ tgt_lang: str = "ro",
322
+ **kwargs,
323
+ ) -> BatchEncoding:
324
+ self.tgt_lang = tgt_lang
325
+ self.set_lang_special_tokens(self.tgt_lang)
326
+ return super().prepare_seq2seq_batch(src_texts, tgt_texts, **kwargs)
327
+
328
+ def _build_translation_inputs(self, raw_inputs, tgt_lang: Optional[str], **extra_kwargs):
329
+ """Used by translation pipeline, to prepare inputs for the generate function"""
330
+ if tgt_lang is None:
331
+ raise ValueError("Translation requires a `tgt_lang` for this model")
332
+ self.tgt_lang = tgt_lang
333
+ inputs = self(raw_inputs, add_special_tokens=True, **extra_kwargs)
334
+ return inputs
335
+
336
+ def _switch_to_input_mode(self):
337
+ self.set_lang_special_tokens(self.tgt_lang)
338
+
339
+ def _switch_to_target_mode(self):
340
+ self.prefix_tokens = None
341
+ self.suffix_tokens = [self.eos_token_id]
342
+
343
+ def set_lang_special_tokens(self, src_lang: str) -> None:
344
+ """Reset the special tokens to the tgt lang setting. No prefix and suffix=[eos, tgt_lang_code]."""
345
+ lang_token = self.get_lang_token(src_lang)
346
+ self.cur_lang_id = self.lang_token_to_id[lang_token]
347
+ self.prefix_tokens = [self.cur_lang_id]
348
+ self.suffix_tokens = [self.eos_token_id]
349
+
350
+ def get_lang_token(self, lang: str) -> str:
351
+ return self.lang_code_to_token[lang]
352
+
353
+ def get_lang_id(self, lang: str) -> int:
354
+ lang_token = self.get_lang_token(lang)
355
+ return self.lang_token_to_id[lang_token]
356
+
357
+
358
+ def load_spm(path: str, sp_model_kwargs: Dict[str, Any]) -> sentencepiece.SentencePieceProcessor:
359
+ spm = sentencepiece.SentencePieceProcessor(**sp_model_kwargs)
360
+ spm.Load(str(path))
361
+ return spm
362
+
363
+
364
+ def load_json(path: str) -> Union[Dict, List]:
365
+ with open(path, "r") as f:
366
+ return json.load(f)
367
+
368
+
369
+ def save_json(data, path: str) -> None:
370
+ with open(path, "w") as f:
371
+ json.dump(data, f, indent=2)
tokenizer_config.json ADDED
@@ -0,0 +1,951 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "added_tokens_decoder": {
3
+ "0": {
4
+ "content": "<s>",
5
+ "lstrip": false,
6
+ "normalized": false,
7
+ "rstrip": false,
8
+ "single_word": false,
9
+ "special": true
10
+ },
11
+ "1": {
12
+ "content": "<pad>",
13
+ "lstrip": false,
14
+ "normalized": false,
15
+ "rstrip": false,
16
+ "single_word": false,
17
+ "special": true
18
+ },
19
+ "2": {
20
+ "content": "</s>",
21
+ "lstrip": false,
22
+ "normalized": false,
23
+ "rstrip": false,
24
+ "single_word": false,
25
+ "special": true
26
+ },
27
+ "3": {
28
+ "content": "<unk>",
29
+ "lstrip": false,
30
+ "normalized": false,
31
+ "rstrip": false,
32
+ "single_word": false,
33
+ "special": true
34
+ },
35
+ "128004": {
36
+ "content": "__af__",
37
+ "lstrip": false,
38
+ "normalized": false,
39
+ "rstrip": false,
40
+ "single_word": false,
41
+ "special": true
42
+ },
43
+ "128005": {
44
+ "content": "__am__",
45
+ "lstrip": false,
46
+ "normalized": false,
47
+ "rstrip": false,
48
+ "single_word": false,
49
+ "special": true
50
+ },
51
+ "128006": {
52
+ "content": "__ar__",
53
+ "lstrip": false,
54
+ "normalized": false,
55
+ "rstrip": false,
56
+ "single_word": false,
57
+ "special": true
58
+ },
59
+ "128007": {
60
+ "content": "__ast__",
61
+ "lstrip": false,
62
+ "normalized": false,
63
+ "rstrip": false,
64
+ "single_word": false,
65
+ "special": true
66
+ },
67
+ "128008": {
68
+ "content": "__az__",
69
+ "lstrip": false,
70
+ "normalized": false,
71
+ "rstrip": false,
72
+ "single_word": false,
73
+ "special": true
74
+ },
75
+ "128009": {
76
+ "content": "__ba__",
77
+ "lstrip": false,
78
+ "normalized": false,
79
+ "rstrip": false,
80
+ "single_word": false,
81
+ "special": true
82
+ },
83
+ "128010": {
84
+ "content": "__be__",
85
+ "lstrip": false,
86
+ "normalized": false,
87
+ "rstrip": false,
88
+ "single_word": false,
89
+ "special": true
90
+ },
91
+ "128011": {
92
+ "content": "__bg__",
93
+ "lstrip": false,
94
+ "normalized": false,
95
+ "rstrip": false,
96
+ "single_word": false,
97
+ "special": true
98
+ },
99
+ "128012": {
100
+ "content": "__bn__",
101
+ "lstrip": false,
102
+ "normalized": false,
103
+ "rstrip": false,
104
+ "single_word": false,
105
+ "special": true
106
+ },
107
+ "128013": {
108
+ "content": "__br__",
109
+ "lstrip": false,
110
+ "normalized": false,
111
+ "rstrip": false,
112
+ "single_word": false,
113
+ "special": true
114
+ },
115
+ "128014": {
116
+ "content": "__bs__",
117
+ "lstrip": false,
118
+ "normalized": false,
119
+ "rstrip": false,
120
+ "single_word": false,
121
+ "special": true
122
+ },
123
+ "128015": {
124
+ "content": "__ca__",
125
+ "lstrip": false,
126
+ "normalized": false,
127
+ "rstrip": false,
128
+ "single_word": false,
129
+ "special": true
130
+ },
131
+ "128016": {
132
+ "content": "__ceb__",
133
+ "lstrip": false,
134
+ "normalized": false,
135
+ "rstrip": false,
136
+ "single_word": false,
137
+ "special": true
138
+ },
139
+ "128017": {
140
+ "content": "__cs__",
141
+ "lstrip": false,
142
+ "normalized": false,
143
+ "rstrip": false,
144
+ "single_word": false,
145
+ "special": true
146
+ },
147
+ "128018": {
148
+ "content": "__cy__",
149
+ "lstrip": false,
150
+ "normalized": false,
151
+ "rstrip": false,
152
+ "single_word": false,
153
+ "special": true
154
+ },
155
+ "128019": {
156
+ "content": "__da__",
157
+ "lstrip": false,
158
+ "normalized": false,
159
+ "rstrip": false,
160
+ "single_word": false,
161
+ "special": true
162
+ },
163
+ "128020": {
164
+ "content": "__de__",
165
+ "lstrip": false,
166
+ "normalized": false,
167
+ "rstrip": false,
168
+ "single_word": false,
169
+ "special": true
170
+ },
171
+ "128021": {
172
+ "content": "__el__",
173
+ "lstrip": false,
174
+ "normalized": false,
175
+ "rstrip": false,
176
+ "single_word": false,
177
+ "special": true
178
+ },
179
+ "128022": {
180
+ "content": "__en__",
181
+ "lstrip": false,
182
+ "normalized": false,
183
+ "rstrip": false,
184
+ "single_word": false,
185
+ "special": true
186
+ },
187
+ "128023": {
188
+ "content": "__es__",
189
+ "lstrip": false,
190
+ "normalized": false,
191
+ "rstrip": false,
192
+ "single_word": false,
193
+ "special": true
194
+ },
195
+ "128024": {
196
+ "content": "__et__",
197
+ "lstrip": false,
198
+ "normalized": false,
199
+ "rstrip": false,
200
+ "single_word": false,
201
+ "special": true
202
+ },
203
+ "128025": {
204
+ "content": "__fa__",
205
+ "lstrip": false,
206
+ "normalized": false,
207
+ "rstrip": false,
208
+ "single_word": false,
209
+ "special": true
210
+ },
211
+ "128026": {
212
+ "content": "__ff__",
213
+ "lstrip": false,
214
+ "normalized": false,
215
+ "rstrip": false,
216
+ "single_word": false,
217
+ "special": true
218
+ },
219
+ "128027": {
220
+ "content": "__fi__",
221
+ "lstrip": false,
222
+ "normalized": false,
223
+ "rstrip": false,
224
+ "single_word": false,
225
+ "special": true
226
+ },
227
+ "128028": {
228
+ "content": "__fr__",
229
+ "lstrip": false,
230
+ "normalized": false,
231
+ "rstrip": false,
232
+ "single_word": false,
233
+ "special": true
234
+ },
235
+ "128029": {
236
+ "content": "__fy__",
237
+ "lstrip": false,
238
+ "normalized": false,
239
+ "rstrip": false,
240
+ "single_word": false,
241
+ "special": true
242
+ },
243
+ "128030": {
244
+ "content": "__ga__",
245
+ "lstrip": false,
246
+ "normalized": false,
247
+ "rstrip": false,
248
+ "single_word": false,
249
+ "special": true
250
+ },
251
+ "128031": {
252
+ "content": "__gd__",
253
+ "lstrip": false,
254
+ "normalized": false,
255
+ "rstrip": false,
256
+ "single_word": false,
257
+ "special": true
258
+ },
259
+ "128032": {
260
+ "content": "__gl__",
261
+ "lstrip": false,
262
+ "normalized": false,
263
+ "rstrip": false,
264
+ "single_word": false,
265
+ "special": true
266
+ },
267
+ "128033": {
268
+ "content": "__gu__",
269
+ "lstrip": false,
270
+ "normalized": false,
271
+ "rstrip": false,
272
+ "single_word": false,
273
+ "special": true
274
+ },
275
+ "128034": {
276
+ "content": "__ha__",
277
+ "lstrip": false,
278
+ "normalized": false,
279
+ "rstrip": false,
280
+ "single_word": false,
281
+ "special": true
282
+ },
283
+ "128035": {
284
+ "content": "__he__",
285
+ "lstrip": false,
286
+ "normalized": false,
287
+ "rstrip": false,
288
+ "single_word": false,
289
+ "special": true
290
+ },
291
+ "128036": {
292
+ "content": "__hi__",
293
+ "lstrip": false,
294
+ "normalized": false,
295
+ "rstrip": false,
296
+ "single_word": false,
297
+ "special": true
298
+ },
299
+ "128037": {
300
+ "content": "__hr__",
301
+ "lstrip": false,
302
+ "normalized": false,
303
+ "rstrip": false,
304
+ "single_word": false,
305
+ "special": true
306
+ },
307
+ "128038": {
308
+ "content": "__ht__",
309
+ "lstrip": false,
310
+ "normalized": false,
311
+ "rstrip": false,
312
+ "single_word": false,
313
+ "special": true
314
+ },
315
+ "128039": {
316
+ "content": "__hu__",
317
+ "lstrip": false,
318
+ "normalized": false,
319
+ "rstrip": false,
320
+ "single_word": false,
321
+ "special": true
322
+ },
323
+ "128040": {
324
+ "content": "__hy__",
325
+ "lstrip": false,
326
+ "normalized": false,
327
+ "rstrip": false,
328
+ "single_word": false,
329
+ "special": true
330
+ },
331
+ "128041": {
332
+ "content": "__id__",
333
+ "lstrip": false,
334
+ "normalized": false,
335
+ "rstrip": false,
336
+ "single_word": false,
337
+ "special": true
338
+ },
339
+ "128042": {
340
+ "content": "__ig__",
341
+ "lstrip": false,
342
+ "normalized": false,
343
+ "rstrip": false,
344
+ "single_word": false,
345
+ "special": true
346
+ },
347
+ "128043": {
348
+ "content": "__ilo__",
349
+ "lstrip": false,
350
+ "normalized": false,
351
+ "rstrip": false,
352
+ "single_word": false,
353
+ "special": true
354
+ },
355
+ "128044": {
356
+ "content": "__is__",
357
+ "lstrip": false,
358
+ "normalized": false,
359
+ "rstrip": false,
360
+ "single_word": false,
361
+ "special": true
362
+ },
363
+ "128045": {
364
+ "content": "__it__",
365
+ "lstrip": false,
366
+ "normalized": false,
367
+ "rstrip": false,
368
+ "single_word": false,
369
+ "special": true
370
+ },
371
+ "128046": {
372
+ "content": "__ja__",
373
+ "lstrip": false,
374
+ "normalized": false,
375
+ "rstrip": false,
376
+ "single_word": false,
377
+ "special": true
378
+ },
379
+ "128047": {
380
+ "content": "__jv__",
381
+ "lstrip": false,
382
+ "normalized": false,
383
+ "rstrip": false,
384
+ "single_word": false,
385
+ "special": true
386
+ },
387
+ "128048": {
388
+ "content": "__ka__",
389
+ "lstrip": false,
390
+ "normalized": false,
391
+ "rstrip": false,
392
+ "single_word": false,
393
+ "special": true
394
+ },
395
+ "128049": {
396
+ "content": "__kk__",
397
+ "lstrip": false,
398
+ "normalized": false,
399
+ "rstrip": false,
400
+ "single_word": false,
401
+ "special": true
402
+ },
403
+ "128050": {
404
+ "content": "__km__",
405
+ "lstrip": false,
406
+ "normalized": false,
407
+ "rstrip": false,
408
+ "single_word": false,
409
+ "special": true
410
+ },
411
+ "128051": {
412
+ "content": "__kn__",
413
+ "lstrip": false,
414
+ "normalized": false,
415
+ "rstrip": false,
416
+ "single_word": false,
417
+ "special": true
418
+ },
419
+ "128052": {
420
+ "content": "__ko__",
421
+ "lstrip": false,
422
+ "normalized": false,
423
+ "rstrip": false,
424
+ "single_word": false,
425
+ "special": true
426
+ },
427
+ "128053": {
428
+ "content": "__lb__",
429
+ "lstrip": false,
430
+ "normalized": false,
431
+ "rstrip": false,
432
+ "single_word": false,
433
+ "special": true
434
+ },
435
+ "128054": {
436
+ "content": "__lg__",
437
+ "lstrip": false,
438
+ "normalized": false,
439
+ "rstrip": false,
440
+ "single_word": false,
441
+ "special": true
442
+ },
443
+ "128055": {
444
+ "content": "__ln__",
445
+ "lstrip": false,
446
+ "normalized": false,
447
+ "rstrip": false,
448
+ "single_word": false,
449
+ "special": true
450
+ },
451
+ "128056": {
452
+ "content": "__lo__",
453
+ "lstrip": false,
454
+ "normalized": false,
455
+ "rstrip": false,
456
+ "single_word": false,
457
+ "special": true
458
+ },
459
+ "128057": {
460
+ "content": "__lt__",
461
+ "lstrip": false,
462
+ "normalized": false,
463
+ "rstrip": false,
464
+ "single_word": false,
465
+ "special": true
466
+ },
467
+ "128058": {
468
+ "content": "__lv__",
469
+ "lstrip": false,
470
+ "normalized": false,
471
+ "rstrip": false,
472
+ "single_word": false,
473
+ "special": true
474
+ },
475
+ "128059": {
476
+ "content": "__mg__",
477
+ "lstrip": false,
478
+ "normalized": false,
479
+ "rstrip": false,
480
+ "single_word": false,
481
+ "special": true
482
+ },
483
+ "128060": {
484
+ "content": "__mk__",
485
+ "lstrip": false,
486
+ "normalized": false,
487
+ "rstrip": false,
488
+ "single_word": false,
489
+ "special": true
490
+ },
491
+ "128061": {
492
+ "content": "__ml__",
493
+ "lstrip": false,
494
+ "normalized": false,
495
+ "rstrip": false,
496
+ "single_word": false,
497
+ "special": true
498
+ },
499
+ "128062": {
500
+ "content": "__mn__",
501
+ "lstrip": false,
502
+ "normalized": false,
503
+ "rstrip": false,
504
+ "single_word": false,
505
+ "special": true
506
+ },
507
+ "128063": {
508
+ "content": "__mr__",
509
+ "lstrip": false,
510
+ "normalized": false,
511
+ "rstrip": false,
512
+ "single_word": false,
513
+ "special": true
514
+ },
515
+ "128064": {
516
+ "content": "__ms__",
517
+ "lstrip": false,
518
+ "normalized": false,
519
+ "rstrip": false,
520
+ "single_word": false,
521
+ "special": true
522
+ },
523
+ "128065": {
524
+ "content": "__my__",
525
+ "lstrip": false,
526
+ "normalized": false,
527
+ "rstrip": false,
528
+ "single_word": false,
529
+ "special": true
530
+ },
531
+ "128066": {
532
+ "content": "__ne__",
533
+ "lstrip": false,
534
+ "normalized": false,
535
+ "rstrip": false,
536
+ "single_word": false,
537
+ "special": true
538
+ },
539
+ "128067": {
540
+ "content": "__nl__",
541
+ "lstrip": false,
542
+ "normalized": false,
543
+ "rstrip": false,
544
+ "single_word": false,
545
+ "special": true
546
+ },
547
+ "128068": {
548
+ "content": "__no__",
549
+ "lstrip": false,
550
+ "normalized": false,
551
+ "rstrip": false,
552
+ "single_word": false,
553
+ "special": true
554
+ },
555
+ "128069": {
556
+ "content": "__ns__",
557
+ "lstrip": false,
558
+ "normalized": false,
559
+ "rstrip": false,
560
+ "single_word": false,
561
+ "special": true
562
+ },
563
+ "128070": {
564
+ "content": "__oc__",
565
+ "lstrip": false,
566
+ "normalized": false,
567
+ "rstrip": false,
568
+ "single_word": false,
569
+ "special": true
570
+ },
571
+ "128071": {
572
+ "content": "__or__",
573
+ "lstrip": false,
574
+ "normalized": false,
575
+ "rstrip": false,
576
+ "single_word": false,
577
+ "special": true
578
+ },
579
+ "128072": {
580
+ "content": "__pa__",
581
+ "lstrip": false,
582
+ "normalized": false,
583
+ "rstrip": false,
584
+ "single_word": false,
585
+ "special": true
586
+ },
587
+ "128073": {
588
+ "content": "__pl__",
589
+ "lstrip": false,
590
+ "normalized": false,
591
+ "rstrip": false,
592
+ "single_word": false,
593
+ "special": true
594
+ },
595
+ "128074": {
596
+ "content": "__ps__",
597
+ "lstrip": false,
598
+ "normalized": false,
599
+ "rstrip": false,
600
+ "single_word": false,
601
+ "special": true
602
+ },
603
+ "128075": {
604
+ "content": "__pt__",
605
+ "lstrip": false,
606
+ "normalized": false,
607
+ "rstrip": false,
608
+ "single_word": false,
609
+ "special": true
610
+ },
611
+ "128076": {
612
+ "content": "__ro__",
613
+ "lstrip": false,
614
+ "normalized": false,
615
+ "rstrip": false,
616
+ "single_word": false,
617
+ "special": true
618
+ },
619
+ "128077": {
620
+ "content": "__ru__",
621
+ "lstrip": false,
622
+ "normalized": false,
623
+ "rstrip": false,
624
+ "single_word": false,
625
+ "special": true
626
+ },
627
+ "128078": {
628
+ "content": "__sd__",
629
+ "lstrip": false,
630
+ "normalized": false,
631
+ "rstrip": false,
632
+ "single_word": false,
633
+ "special": true
634
+ },
635
+ "128079": {
636
+ "content": "__si__",
637
+ "lstrip": false,
638
+ "normalized": false,
639
+ "rstrip": false,
640
+ "single_word": false,
641
+ "special": true
642
+ },
643
+ "128080": {
644
+ "content": "__sk__",
645
+ "lstrip": false,
646
+ "normalized": false,
647
+ "rstrip": false,
648
+ "single_word": false,
649
+ "special": true
650
+ },
651
+ "128081": {
652
+ "content": "__sl__",
653
+ "lstrip": false,
654
+ "normalized": false,
655
+ "rstrip": false,
656
+ "single_word": false,
657
+ "special": true
658
+ },
659
+ "128082": {
660
+ "content": "__so__",
661
+ "lstrip": false,
662
+ "normalized": false,
663
+ "rstrip": false,
664
+ "single_word": false,
665
+ "special": true
666
+ },
667
+ "128083": {
668
+ "content": "__sq__",
669
+ "lstrip": false,
670
+ "normalized": false,
671
+ "rstrip": false,
672
+ "single_word": false,
673
+ "special": true
674
+ },
675
+ "128084": {
676
+ "content": "__sr__",
677
+ "lstrip": false,
678
+ "normalized": false,
679
+ "rstrip": false,
680
+ "single_word": false,
681
+ "special": true
682
+ },
683
+ "128085": {
684
+ "content": "__ss__",
685
+ "lstrip": false,
686
+ "normalized": false,
687
+ "rstrip": false,
688
+ "single_word": false,
689
+ "special": true
690
+ },
691
+ "128086": {
692
+ "content": "__su__",
693
+ "lstrip": false,
694
+ "normalized": false,
695
+ "rstrip": false,
696
+ "single_word": false,
697
+ "special": true
698
+ },
699
+ "128087": {
700
+ "content": "__sv__",
701
+ "lstrip": false,
702
+ "normalized": false,
703
+ "rstrip": false,
704
+ "single_word": false,
705
+ "special": true
706
+ },
707
+ "128088": {
708
+ "content": "__sw__",
709
+ "lstrip": false,
710
+ "normalized": false,
711
+ "rstrip": false,
712
+ "single_word": false,
713
+ "special": true
714
+ },
715
+ "128089": {
716
+ "content": "__ta__",
717
+ "lstrip": false,
718
+ "normalized": false,
719
+ "rstrip": false,
720
+ "single_word": false,
721
+ "special": true
722
+ },
723
+ "128090": {
724
+ "content": "__th__",
725
+ "lstrip": false,
726
+ "normalized": false,
727
+ "rstrip": false,
728
+ "single_word": false,
729
+ "special": true
730
+ },
731
+ "128091": {
732
+ "content": "__tl__",
733
+ "lstrip": false,
734
+ "normalized": false,
735
+ "rstrip": false,
736
+ "single_word": false,
737
+ "special": true
738
+ },
739
+ "128092": {
740
+ "content": "__tn__",
741
+ "lstrip": false,
742
+ "normalized": false,
743
+ "rstrip": false,
744
+ "single_word": false,
745
+ "special": true
746
+ },
747
+ "128093": {
748
+ "content": "__tr__",
749
+ "lstrip": false,
750
+ "normalized": false,
751
+ "rstrip": false,
752
+ "single_word": false,
753
+ "special": true
754
+ },
755
+ "128094": {
756
+ "content": "__uk__",
757
+ "lstrip": false,
758
+ "normalized": false,
759
+ "rstrip": false,
760
+ "single_word": false,
761
+ "special": true
762
+ },
763
+ "128095": {
764
+ "content": "__ur__",
765
+ "lstrip": false,
766
+ "normalized": false,
767
+ "rstrip": false,
768
+ "single_word": false,
769
+ "special": true
770
+ },
771
+ "128096": {
772
+ "content": "__uz__",
773
+ "lstrip": false,
774
+ "normalized": false,
775
+ "rstrip": false,
776
+ "single_word": false,
777
+ "special": true
778
+ },
779
+ "128097": {
780
+ "content": "__vi__",
781
+ "lstrip": false,
782
+ "normalized": false,
783
+ "rstrip": false,
784
+ "single_word": false,
785
+ "special": true
786
+ },
787
+ "128098": {
788
+ "content": "__wo__",
789
+ "lstrip": false,
790
+ "normalized": false,
791
+ "rstrip": false,
792
+ "single_word": false,
793
+ "special": true
794
+ },
795
+ "128099": {
796
+ "content": "__xh__",
797
+ "lstrip": false,
798
+ "normalized": false,
799
+ "rstrip": false,
800
+ "single_word": false,
801
+ "special": true
802
+ },
803
+ "128100": {
804
+ "content": "__yi__",
805
+ "lstrip": false,
806
+ "normalized": false,
807
+ "rstrip": false,
808
+ "single_word": false,
809
+ "special": true
810
+ },
811
+ "128101": {
812
+ "content": "__yo__",
813
+ "lstrip": false,
814
+ "normalized": false,
815
+ "rstrip": false,
816
+ "single_word": false,
817
+ "special": true
818
+ },
819
+ "128102": {
820
+ "content": "__zh__",
821
+ "lstrip": false,
822
+ "normalized": false,
823
+ "rstrip": false,
824
+ "single_word": false,
825
+ "special": true
826
+ },
827
+ "128103": {
828
+ "content": "__zu__",
829
+ "lstrip": false,
830
+ "normalized": false,
831
+ "rstrip": false,
832
+ "single_word": false,
833
+ "special": true
834
+ }
835
+ },
836
+ "additional_special_tokens": [
837
+ "__af__",
838
+ "__am__",
839
+ "__ar__",
840
+ "__ast__",
841
+ "__az__",
842
+ "__ba__",
843
+ "__be__",
844
+ "__bg__",
845
+ "__bn__",
846
+ "__br__",
847
+ "__bs__",
848
+ "__ca__",
849
+ "__ceb__",
850
+ "__cs__",
851
+ "__cy__",
852
+ "__da__",
853
+ "__de__",
854
+ "__el__",
855
+ "__en__",
856
+ "__es__",
857
+ "__et__",
858
+ "__fa__",
859
+ "__ff__",
860
+ "__fi__",
861
+ "__fr__",
862
+ "__fy__",
863
+ "__ga__",
864
+ "__gd__",
865
+ "__gl__",
866
+ "__gu__",
867
+ "__ha__",
868
+ "__he__",
869
+ "__hi__",
870
+ "__hr__",
871
+ "__ht__",
872
+ "__hu__",
873
+ "__hy__",
874
+ "__id__",
875
+ "__ig__",
876
+ "__ilo__",
877
+ "__is__",
878
+ "__it__",
879
+ "__ja__",
880
+ "__jv__",
881
+ "__ka__",
882
+ "__kk__",
883
+ "__km__",
884
+ "__kn__",
885
+ "__ko__",
886
+ "__lb__",
887
+ "__lg__",
888
+ "__ln__",
889
+ "__lo__",
890
+ "__lt__",
891
+ "__lv__",
892
+ "__mg__",
893
+ "__mk__",
894
+ "__ml__",
895
+ "__mn__",
896
+ "__mr__",
897
+ "__ms__",
898
+ "__my__",
899
+ "__ne__",
900
+ "__nl__",
901
+ "__no__",
902
+ "__ns__",
903
+ "__oc__",
904
+ "__or__",
905
+ "__pa__",
906
+ "__pl__",
907
+ "__ps__",
908
+ "__pt__",
909
+ "__ro__",
910
+ "__ru__",
911
+ "__sd__",
912
+ "__si__",
913
+ "__sk__",
914
+ "__sl__",
915
+ "__so__",
916
+ "__sq__",
917
+ "__sr__",
918
+ "__ss__",
919
+ "__su__",
920
+ "__sv__",
921
+ "__sw__",
922
+ "__ta__",
923
+ "__th__",
924
+ "__tl__",
925
+ "__tn__",
926
+ "__tr__",
927
+ "__uk__",
928
+ "__ur__",
929
+ "__uz__",
930
+ "__vi__",
931
+ "__wo__",
932
+ "__xh__",
933
+ "__yi__",
934
+ "__yo__",
935
+ "__zh__",
936
+ "__zu__"
937
+ ],
938
+ "bos_token": "<s>",
939
+ "clean_up_tokenization_spaces": true,
940
+ "eos_token": "</s>",
941
+ "language_codes": "m2m100",
942
+ "model_max_length": 1024,
943
+ "num_madeup_words": 8,
944
+ "pad_token": "<pad>",
945
+ "sep_token": "</s>",
946
+ "sp_model_kwargs": {},
947
+ "src_lang": "en",
948
+ "tgt_lang": null,
949
+ "tokenizer_class": "M2M100Tokenizer",
950
+ "unk_token": "<unk>"
951
+ }
vocab.json ADDED
The diff for this file is too large to render. See raw diff