mengsay commited on
Commit
0bfb5f4
·
verified ·
1 Parent(s): 73c7c04

Model folders in the transformers format (Blenderbot classes, tokenizer, generation config)

Browse files
Files changed (6) hide show
  1. README.md +40 -3
  2. config.json +492 -0
  3. generation_config.json +10 -0
  4. model.safetensors +3 -0
  5. tokenizer.json +606 -0
  6. tokenizer_config.json +15 -0
README.md CHANGED
@@ -2,7 +2,7 @@
2
  license: apache-2.0
3
  language:
4
  - km
5
- library_name: onnx
6
  pipeline_tag: text2text-generation
7
  tags:
8
  - transliteration
@@ -12,6 +12,7 @@ tags:
12
  - character-level
13
  - onnx
14
  - int8
 
15
  - keyboard
16
  - on-device
17
  base_model: samdei/samdei-type-pretrained
@@ -50,13 +51,13 @@ Samdei Type Mini converts romanized Khmer, as people type it in chat, into Khmer
50
  | `knhom jong tov phsar` | ខ្ញុំចង់ទៅផ្សារ |
51
  | `ot mean wifi te` | អត់មាន wifi ទេ |
52
 
53
- It is a 7.1M-parameter character-level Transformer encoder-decoder. It ships as int8 ONNX (7.0 MiB), with a 1.2 MiB word bigram LM that reranks its candidates. Mini is meant for on-device use, such as a phone keyboard that offers Khmer-script candidates as the user types.
54
 
55
  Samdei (សំដី, "what you say") is our team, and Samdei Type is the converter. The family has three models:
56
 
57
  | Model | Parameters | Released as | Samdei Type Bench CER / exact |
58
  |---|---|---|---|
59
- | **Samdei Type Mini** (this repo) | 7.1M | int8 ONNX + pruned word LM | 0.058 / 24% |
60
  | Samdei Type Base | 18.2M | PyTorch + int8 ONNX + LMs + channel model: [`samdei/samdei-type-base`](https://huggingface.co/samdei/samdei-type-base) | 0.052 / 30% |
61
  | Samdei Type Prime | 18.2M | not released | 0.027 / 61% |
62
 
@@ -69,6 +70,11 @@ Paper: *Samdei Type: Separating What Is Written from How It Is Spelled for Roman
69
  ## Files
70
 
71
  ```
 
 
 
 
 
72
  onnx/encoder_kv.int8.onnx 5.0 MiB input characters -> cross-attention K/V of every decoder layer
73
  onnx/decoder_step.int8.onnx 2.0 MiB one decoder step with a self-attention KV cache
74
  onnx/vocab.json vocabularies and graph shapes (layers, heads, head_dim, bos, eos, max_src_len)
@@ -128,6 +134,35 @@ print(convert("knhom jong tov phsar")) # ខ្ញុំចង់ទៅផ្
128
  - `rkhmer/onnx_infer.py` is a reference implementation in plain numpy (no torch) to port from.
129
  - The cached decoder reproduces full re-decoding exactly. Int8 quantization does not change CER on Dev-Sentences with beam 5 and no LMs (0.010 in fp32 and in int8).
130
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
  ## Model
132
 
133
  | | Samdei Type Mini |
@@ -140,6 +175,8 @@ print(convert("knhom jong tov phsar")) # ខ្ញុំចង់ទៅផ្
140
  | Vocabulary | 215 input symbols (Latin letters, digits, punctuation, space), 228 output symbols (Khmer code points, space, copied characters), including special tokens |
141
  | int8 ONNX | 7.0 MiB as released (7.6 MiB in the paper, with the exporter's debug metadata) |
142
 
 
 
143
  ## Training
144
 
145
  Mini was trained in three stages. Each stage started from the best checkpoint of the stage before and replayed its data.
 
2
  license: apache-2.0
3
  language:
4
  - km
5
+ library_name: transformers
6
  pipeline_tag: text2text-generation
7
  tags:
8
  - transliteration
 
12
  - character-level
13
  - onnx
14
  - int8
15
+ - safetensors
16
  - keyboard
17
  - on-device
18
  base_model: samdei/samdei-type-pretrained
 
51
  | `knhom jong tov phsar` | ខ្ញុំចង់ទៅផ្សារ |
52
  | `ot mean wifi te` | អត់មាន wifi ទេ |
53
 
54
+ It is a 7.1M-parameter character-level Transformer encoder-decoder. It ships as int8 ONNX (7.0 MiB), with a 1.2 MiB word bigram LM that reranks its candidates, and as fp32 weights that load with transformers. Mini is meant for on-device use, such as a phone keyboard that offers Khmer-script candidates as the user types.
55
 
56
  Samdei (សំដី, "what you say") is our team, and Samdei Type is the converter. The family has three models:
57
 
58
  | Model | Parameters | Released as | Samdei Type Bench CER / exact |
59
  |---|---|---|---|
60
+ | **Samdei Type Mini** (this repo) | 7.1M | int8 ONNX + pruned word LM + PyTorch | 0.058 / 24% |
61
  | Samdei Type Base | 18.2M | PyTorch + int8 ONNX + LMs + channel model: [`samdei/samdei-type-base`](https://huggingface.co/samdei/samdei-type-base) | 0.052 / 30% |
62
  | Samdei Type Prime | 18.2M | not released | 0.027 / 61% |
63
 
 
70
  ## Files
71
 
72
  ```
73
+ config.json configuration and vocabularies (transformers format)
74
+ generation_config.json beam search, k = 5
75
+ model.safetensors 28.4 MiB weights (fp32), for transformers, fine-tuning or the PyTorch reranker
76
+ tokenizer.json character tokenizer
77
+ tokenizer_config.json its settings
78
  onnx/encoder_kv.int8.onnx 5.0 MiB input characters -> cross-attention K/V of every decoder layer
79
  onnx/decoder_step.int8.onnx 2.0 MiB one decoder step with a self-attention KV cache
80
  onnx/vocab.json vocabularies and graph shapes (layers, heads, head_dim, bos, eos, max_src_len)
 
134
  - `rkhmer/onnx_infer.py` is a reference implementation in plain numpy (no torch) to port from.
135
  - The cached decoder reproduces full re-decoding exactly. Int8 quantization does not change CER on Dev-Sentences with beam 5 and no LMs (0.010 in fp32 and in int8).
136
 
137
+ **transformers, without rkhmer.** The fp32 weights at the repo root run with `transformers` and `torch` alone (`pip install transformers torch`; see Model). This is beam search with k = 5 and no reranking: 0.072 CER / 17% exact on Samdei Type Bench, against 0.058 / 24% with the word LM above.
138
+
139
+ ```python
140
+ from transformers import AutoModelForSeq2SeqLM, AutoTokenizer
141
+
142
+ repo = "samdei/samdei-type-mini"
143
+ tok = AutoTokenizer.from_pretrained(repo)
144
+ model = AutoModelForSeq2SeqLM.from_pretrained(repo)
145
+
146
+ def pieces(text: str, max_words: int = 8) -> list[str]:
147
+ """At most max_words words per piece, with a break after punctuation, as in the paper."""
148
+ out, cur = [], []
149
+ for w in text.split():
150
+ cur.append(w)
151
+ if len(cur) == max_words or w[-1] in ",.;:?!។":
152
+ out.append(" ".join(cur))
153
+ cur = []
154
+ if cur:
155
+ out.append(" ".join(cur))
156
+ return out or [text]
157
+
158
+ def convert(text: str) -> str:
159
+ batch = tok(pieces(text), padding=True, truncation=True, return_tensors="pt")
160
+ out = model.generate(**batch) # beam search, k = 5 (generation_config.json)
161
+ return " ".join(tok.batch_decode(out, skip_special_tokens=True))
162
+
163
+ print(convert("knhom jong tov phsar")) # ខ្ញុំចង់ទៅផ្សារ
164
+ ```
165
+
166
  ## Model
167
 
168
  | | Samdei Type Mini |
 
175
  | Vocabulary | 215 input symbols (Latin letters, digits, punctuation, space), 228 output symbols (Khmer code points, space, copied characters), including special tokens |
176
  | int8 ONNX | 7.0 MiB as released (7.6 MiB in the paper, with the exporter's debug metadata) |
177
 
178
+ **transformers format.** The model folders load with `AutoModelForSeq2SeqLM` and `AutoTokenizer` and need no custom code. They use transformers' Blenderbot classes only because the architecture is the same (a pre-LN encoder-decoder with scaled embeddings, learned positions from 0 and no embedding LayerNorm). The model has nothing else in common with BlenderBot. Blenderbot has one vocabulary for both sides, so the tokenizer stacks the two: ids 0–227 are the output symbols and the input symbols follow. The output layer gives input ids a fixed logit of −10⁴, so they are never generated. For the same reason transformers reports 7.43M parameters: the stacked embedding tables and the output layer carry rows that are never used. `rkhmer` reads the same files and maps them back to its own layout.
179
+
180
  ## Training
181
 
182
  Mini was trained in three stages. Each stage started from the best checkpoint of the stage before and replayed its data.
config.json ADDED
@@ -0,0 +1,492 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "BlenderbotForConditionalGeneration"
4
+ ],
5
+ "model_type": "blenderbot",
6
+ "vocab_size": 443,
7
+ "d_model": 256,
8
+ "encoder_layers": 6,
9
+ "decoder_layers": 2,
10
+ "encoder_attention_heads": 4,
11
+ "decoder_attention_heads": 4,
12
+ "encoder_ffn_dim": 1024,
13
+ "decoder_ffn_dim": 1024,
14
+ "activation_function": "gelu",
15
+ "max_position_embeddings": 256,
16
+ "scale_embedding": true,
17
+ "dropout": 0.1,
18
+ "attention_dropout": 0.1,
19
+ "activation_dropout": 0.1,
20
+ "encoder_layerdrop": 0.0,
21
+ "decoder_layerdrop": 0.0,
22
+ "init_std": 0.02,
23
+ "pad_token_id": 0,
24
+ "bos_token_id": 1,
25
+ "eos_token_id": 2,
26
+ "decoder_start_token_id": 1,
27
+ "forced_eos_token_id": null,
28
+ "encoder_no_repeat_ngram_size": 0,
29
+ "is_encoder_decoder": true,
30
+ "tie_word_embeddings": false,
31
+ "use_cache": true,
32
+ "torch_dtype": "float32",
33
+ "samdei_type": {
34
+ "format_version": 2,
35
+ "special_tokens": [
36
+ "<pad>",
37
+ "<s>",
38
+ "</s>",
39
+ "<unk>"
40
+ ],
41
+ "source_special_tokens": [
42
+ "<src_pad>",
43
+ "<src_s>",
44
+ "</src>",
45
+ "<src_unk>"
46
+ ],
47
+ "source_offset": 228,
48
+ "source": [
49
+ " ",
50
+ "!",
51
+ "\"",
52
+ "#",
53
+ "$",
54
+ "%",
55
+ "&",
56
+ "'",
57
+ "(",
58
+ ")",
59
+ "*",
60
+ "+",
61
+ ",",
62
+ "-",
63
+ ".",
64
+ "/",
65
+ "0",
66
+ "1",
67
+ "2",
68
+ "3",
69
+ "4",
70
+ "5",
71
+ "6",
72
+ "7",
73
+ "8",
74
+ "9",
75
+ ":",
76
+ ";",
77
+ "<",
78
+ "=",
79
+ ">",
80
+ "?",
81
+ "@",
82
+ "A",
83
+ "B",
84
+ "C",
85
+ "D",
86
+ "E",
87
+ "F",
88
+ "G",
89
+ "H",
90
+ "I",
91
+ "J",
92
+ "K",
93
+ "L",
94
+ "M",
95
+ "N",
96
+ "O",
97
+ "P",
98
+ "Q",
99
+ "R",
100
+ "S",
101
+ "T",
102
+ "U",
103
+ "V",
104
+ "W",
105
+ "X",
106
+ "Y",
107
+ "Z",
108
+ "[",
109
+ "]",
110
+ "^",
111
+ "_",
112
+ "a",
113
+ "b",
114
+ "c",
115
+ "d",
116
+ "e",
117
+ "f",
118
+ "g",
119
+ "h",
120
+ "i",
121
+ "j",
122
+ "k",
123
+ "l",
124
+ "m",
125
+ "n",
126
+ "o",
127
+ "p",
128
+ "q",
129
+ "r",
130
+ "s",
131
+ "t",
132
+ "u",
133
+ "v",
134
+ "w",
135
+ "x",
136
+ "y",
137
+ "z",
138
+ "|",
139
+ "~",
140
+ "¡",
141
+ "«",
142
+ "®",
143
+ "°",
144
+ "·",
145
+ "»",
146
+ "×",
147
+ "á",
148
+ "ç",
149
+ "è",
150
+ "é",
151
+ "í",
152
+ "ǔ",
153
+ "ɓ",
154
+ "ə",
155
+ "ก",
156
+ "ท",
157
+ "น",
158
+ "ภ",
159
+ "ย",
160
+ "ร",
161
+ "ษ",
162
+ "า",
163
+ "ิ",
164
+ "เ",
165
+ "ไ",
166
+ "๒",
167
+ "๕",
168
+ "ລ",
169
+ "ວ",
170
+ "ສ",
171
+ "າ",
172
+ "ក",
173
+ "ខ",
174
+ "គ",
175
+ "ឃ",
176
+ "ង",
177
+ "ច",
178
+ "ឆ",
179
+ "ជ",
180
+ "ឈ",
181
+ "ញ",
182
+ "ដ",
183
+ "ឋ",
184
+ "ឌ",
185
+ "ណ",
186
+ "ត",
187
+ "ថ",
188
+ "ទ",
189
+ "ធ",
190
+ "ន",
191
+ "ប",
192
+ "ផ",
193
+ "ព",
194
+ "ភ",
195
+ "ម",
196
+ "យ",
197
+ "រ",
198
+ "ល",
199
+ "វ",
200
+ "ស",
201
+ "ហ",
202
+ "ឡ",
203
+ "អ",
204
+ "ឧ",
205
+ "ឫ",
206
+ "ឬ",
207
+ "ឯ",
208
+ "ឲ",
209
+ "ា",
210
+ "ិ",
211
+ "ី",
212
+ "ឹ",
213
+ "ឺ",
214
+ "ុ",
215
+ "ូ",
216
+ "ួ",
217
+ "ើ",
218
+ "ឿ",
219
+ "ៀ",
220
+ "េ",
221
+ "ែ",
222
+ "ៃ",
223
+ "ោ",
224
+ "ៅ",
225
+ "ំ",
226
+ "ះ",
227
+ "ៈ",
228
+ "៉",
229
+ "៊",
230
+ "់",
231
+ "៌",
232
+ "៍",
233
+ "៏",
234
+ "័",
235
+ "្",
236
+ "។",
237
+ "៕",
238
+ "៖",
239
+ "ៗ",
240
+ "៘",
241
+ "៛",
242
+ "‑",
243
+ "–",
244
+ "—",
245
+ "‘",
246
+ "’",
247
+ "“",
248
+ "”",
249
+ "•",
250
+ "…",
251
+ "‹",
252
+ "›",
253
+ "→",
254
+ "−",
255
+ "●",
256
+ "�",
257
+ "😀",
258
+ "😛",
259
+ "🙂"
260
+ ],
261
+ "target": [
262
+ " ",
263
+ "!",
264
+ "\"",
265
+ "#",
266
+ "$",
267
+ "%",
268
+ "&",
269
+ "'",
270
+ "(",
271
+ ")",
272
+ "*",
273
+ "+",
274
+ ",",
275
+ "-",
276
+ ".",
277
+ "/",
278
+ "0",
279
+ "1",
280
+ "2",
281
+ "3",
282
+ "4",
283
+ "5",
284
+ "6",
285
+ "7",
286
+ "8",
287
+ "9",
288
+ ":",
289
+ ";",
290
+ "<",
291
+ "=",
292
+ ">",
293
+ "?",
294
+ "@",
295
+ "A",
296
+ "B",
297
+ "C",
298
+ "D",
299
+ "E",
300
+ "F",
301
+ "G",
302
+ "H",
303
+ "I",
304
+ "J",
305
+ "K",
306
+ "L",
307
+ "M",
308
+ "N",
309
+ "O",
310
+ "P",
311
+ "Q",
312
+ "R",
313
+ "S",
314
+ "T",
315
+ "U",
316
+ "V",
317
+ "W",
318
+ "X",
319
+ "Y",
320
+ "Z",
321
+ "[",
322
+ "]",
323
+ "^",
324
+ "_",
325
+ "a",
326
+ "b",
327
+ "c",
328
+ "d",
329
+ "e",
330
+ "f",
331
+ "g",
332
+ "h",
333
+ "i",
334
+ "j",
335
+ "k",
336
+ "l",
337
+ "m",
338
+ "n",
339
+ "o",
340
+ "p",
341
+ "q",
342
+ "r",
343
+ "s",
344
+ "t",
345
+ "u",
346
+ "v",
347
+ "w",
348
+ "x",
349
+ "y",
350
+ "z",
351
+ "|",
352
+ "~",
353
+ "¡",
354
+ "«",
355
+ "®",
356
+ "°",
357
+ "·",
358
+ "»",
359
+ "×",
360
+ "à",
361
+ "á",
362
+ "ç",
363
+ "è",
364
+ "é",
365
+ "í",
366
+ "ǔ",
367
+ "ก",
368
+ "ท",
369
+ "น",
370
+ "ภ",
371
+ "ย",
372
+ "ร",
373
+ "ษ",
374
+ "า",
375
+ "ิ",
376
+ "เ",
377
+ "ไ",
378
+ "๒",
379
+ "๕",
380
+ "ລ",
381
+ "ວ",
382
+ "ສ",
383
+ "າ",
384
+ "ក",
385
+ "ខ",
386
+ "គ",
387
+ "ឃ",
388
+ "ង",
389
+ "ច",
390
+ "ឆ",
391
+ "ជ",
392
+ "ឈ",
393
+ "ញ",
394
+ "ដ",
395
+ "ឋ",
396
+ "ឌ",
397
+ "ឍ",
398
+ "ណ",
399
+ "ត",
400
+ "ថ",
401
+ "ទ",
402
+ "ធ",
403
+ "ន",
404
+ "ប",
405
+ "ផ",
406
+ "ព",
407
+ "ភ",
408
+ "ម",
409
+ "យ",
410
+ "រ",
411
+ "ល",
412
+ "វ",
413
+ "ឝ",
414
+ "ឞ",
415
+ "ស",
416
+ "ហ",
417
+ "ឡ",
418
+ "អ",
419
+ "ឥ",
420
+ "ឦ",
421
+ "ឧ",
422
+ "ឩ",
423
+ "ឪ",
424
+ "ឫ",
425
+ "ឬ",
426
+ "ឭ",
427
+ "ឮ",
428
+ "ឯ",
429
+ "ឰ",
430
+ "ឱ",
431
+ "ឲ",
432
+ "ឳ",
433
+ "ា",
434
+ "ិ",
435
+ "ី",
436
+ "ឹ",
437
+ "ឺ",
438
+ "ុ",
439
+ "ូ",
440
+ "ួ",
441
+ "ើ",
442
+ "ឿ",
443
+ "ៀ",
444
+ "េ",
445
+ "ែ",
446
+ "ៃ",
447
+ "ោ",
448
+ "ៅ",
449
+ "ំ",
450
+ "ះ",
451
+ "ៈ",
452
+ "៉",
453
+ "៊",
454
+ "់",
455
+ "៌",
456
+ "៍",
457
+ "៎",
458
+ "៏",
459
+ "័",
460
+ "៑",
461
+ "្",
462
+ "។",
463
+ "៕",
464
+ "៖",
465
+ "ៗ",
466
+ "៘",
467
+ "៛",
468
+ "‑",
469
+ "–",
470
+ "—",
471
+ "‘",
472
+ "’",
473
+ "“",
474
+ "”",
475
+ "•",
476
+ "…",
477
+ "‹",
478
+ "›",
479
+ "→",
480
+ "−",
481
+ "●",
482
+ "�",
483
+ "😀",
484
+ "😛",
485
+ "🙂"
486
+ ],
487
+ "max_input_chars": 249,
488
+ "training": {
489
+ "step": 2500
490
+ }
491
+ }
492
+ }
generation_config.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "decoder_start_token_id": 1,
3
+ "bos_token_id": 1,
4
+ "eos_token_id": 2,
5
+ "pad_token_id": 0,
6
+ "forced_eos_token_id": null,
7
+ "num_beams": 5,
8
+ "max_length": 201,
9
+ "length_penalty": 1.0
10
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:826e2199a39d69b4e0a079d0296351813e8cd5f1dd4bbcdbda804dadd87ca583
3
+ size 29744172
tokenizer.json ADDED
@@ -0,0 +1,606 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "version": "1.0",
3
+ "truncation": null,
4
+ "padding": null,
5
+ "added_tokens": [
6
+ {
7
+ "id": 0,
8
+ "content": "<pad>",
9
+ "single_word": false,
10
+ "lstrip": false,
11
+ "rstrip": false,
12
+ "normalized": false,
13
+ "special": true
14
+ },
15
+ {
16
+ "id": 1,
17
+ "content": "<s>",
18
+ "single_word": false,
19
+ "lstrip": false,
20
+ "rstrip": false,
21
+ "normalized": false,
22
+ "special": true
23
+ },
24
+ {
25
+ "id": 2,
26
+ "content": "</s>",
27
+ "single_word": false,
28
+ "lstrip": false,
29
+ "rstrip": false,
30
+ "normalized": false,
31
+ "special": true
32
+ },
33
+ {
34
+ "id": 3,
35
+ "content": "<unk>",
36
+ "single_word": false,
37
+ "lstrip": false,
38
+ "rstrip": false,
39
+ "normalized": false,
40
+ "special": true
41
+ },
42
+ {
43
+ "id": 228,
44
+ "content": "<src_pad>",
45
+ "single_word": false,
46
+ "lstrip": false,
47
+ "rstrip": false,
48
+ "normalized": false,
49
+ "special": true
50
+ },
51
+ {
52
+ "id": 229,
53
+ "content": "<src_s>",
54
+ "single_word": false,
55
+ "lstrip": false,
56
+ "rstrip": false,
57
+ "normalized": false,
58
+ "special": true
59
+ },
60
+ {
61
+ "id": 230,
62
+ "content": "</src>",
63
+ "single_word": false,
64
+ "lstrip": false,
65
+ "rstrip": false,
66
+ "normalized": false,
67
+ "special": true
68
+ },
69
+ {
70
+ "id": 231,
71
+ "content": "<src_unk>",
72
+ "single_word": false,
73
+ "lstrip": false,
74
+ "rstrip": false,
75
+ "normalized": false,
76
+ "special": true
77
+ }
78
+ ],
79
+ "normalizer": null,
80
+ "pre_tokenizer": {
81
+ "type": "Split",
82
+ "pattern": {
83
+ "Regex": "[\\s\\S]"
84
+ },
85
+ "behavior": "Isolated",
86
+ "invert": false
87
+ },
88
+ "post_processor": {
89
+ "type": "TemplateProcessing",
90
+ "single": [
91
+ {
92
+ "Sequence": {
93
+ "id": "A",
94
+ "type_id": 0
95
+ }
96
+ },
97
+ {
98
+ "SpecialToken": {
99
+ "id": "</src>",
100
+ "type_id": 0
101
+ }
102
+ }
103
+ ],
104
+ "pair": [
105
+ {
106
+ "Sequence": {
107
+ "id": "A",
108
+ "type_id": 0
109
+ }
110
+ },
111
+ {
112
+ "SpecialToken": {
113
+ "id": "</src>",
114
+ "type_id": 0
115
+ }
116
+ },
117
+ {
118
+ "Sequence": {
119
+ "id": "B",
120
+ "type_id": 1
121
+ }
122
+ },
123
+ {
124
+ "SpecialToken": {
125
+ "id": "</src>",
126
+ "type_id": 1
127
+ }
128
+ }
129
+ ],
130
+ "special_tokens": {
131
+ "</src>": {
132
+ "id": "</src>",
133
+ "ids": [
134
+ 230
135
+ ],
136
+ "tokens": [
137
+ "</src>"
138
+ ]
139
+ }
140
+ }
141
+ },
142
+ "decoder": {
143
+ "type": "Sequence",
144
+ "decoders": [
145
+ {
146
+ "type": "Replace",
147
+ "pattern": {
148
+ "String": ""
149
+ },
150
+ "content": ""
151
+ },
152
+ {
153
+ "type": "Fuse"
154
+ }
155
+ ]
156
+ },
157
+ "model": {
158
+ "type": "WordLevel",
159
+ "vocab": {
160
+ "<pad>": 0,
161
+ "<s>": 1,
162
+ "</s>": 2,
163
+ "<unk>": 3,
164
+ " ": 4,
165
+ "!": 5,
166
+ "\"": 6,
167
+ "#": 7,
168
+ "$": 8,
169
+ "%": 9,
170
+ "&": 10,
171
+ "'": 11,
172
+ "(": 12,
173
+ ")": 13,
174
+ "*": 14,
175
+ "+": 15,
176
+ ",": 16,
177
+ "-": 17,
178
+ ".": 18,
179
+ "/": 19,
180
+ "0": 20,
181
+ "1": 21,
182
+ "2": 22,
183
+ "3": 23,
184
+ "4": 24,
185
+ "5": 25,
186
+ "6": 26,
187
+ "7": 27,
188
+ "8": 28,
189
+ "9": 29,
190
+ ":": 30,
191
+ ";": 31,
192
+ "<": 32,
193
+ "=": 33,
194
+ ">": 34,
195
+ "?": 35,
196
+ "@": 36,
197
+ "A": 37,
198
+ "B": 38,
199
+ "C": 39,
200
+ "D": 40,
201
+ "E": 41,
202
+ "F": 42,
203
+ "G": 43,
204
+ "H": 44,
205
+ "I": 45,
206
+ "J": 46,
207
+ "K": 47,
208
+ "L": 48,
209
+ "M": 49,
210
+ "N": 50,
211
+ "O": 51,
212
+ "P": 52,
213
+ "Q": 53,
214
+ "R": 54,
215
+ "S": 55,
216
+ "T": 56,
217
+ "U": 57,
218
+ "V": 58,
219
+ "W": 59,
220
+ "X": 60,
221
+ "Y": 61,
222
+ "Z": 62,
223
+ "[": 63,
224
+ "]": 64,
225
+ "^": 65,
226
+ "_": 66,
227
+ "a": 67,
228
+ "b": 68,
229
+ "c": 69,
230
+ "d": 70,
231
+ "e": 71,
232
+ "f": 72,
233
+ "g": 73,
234
+ "h": 74,
235
+ "i": 75,
236
+ "j": 76,
237
+ "k": 77,
238
+ "l": 78,
239
+ "m": 79,
240
+ "n": 80,
241
+ "o": 81,
242
+ "p": 82,
243
+ "q": 83,
244
+ "r": 84,
245
+ "s": 85,
246
+ "t": 86,
247
+ "u": 87,
248
+ "v": 88,
249
+ "w": 89,
250
+ "x": 90,
251
+ "y": 91,
252
+ "z": 92,
253
+ "|": 93,
254
+ "~": 94,
255
+ "¡": 95,
256
+ "«": 96,
257
+ "®": 97,
258
+ "°": 98,
259
+ "·": 99,
260
+ "»": 100,
261
+ "×": 101,
262
+ "à": 102,
263
+ "á": 103,
264
+ "ç": 104,
265
+ "è": 105,
266
+ "é": 106,
267
+ "í": 107,
268
+ "ǔ": 108,
269
+ "ก": 109,
270
+ "ท": 110,
271
+ "น": 111,
272
+ "ภ": 112,
273
+ "ย": 113,
274
+ "ร": 114,
275
+ "ษ": 115,
276
+ "า": 116,
277
+ "ิ": 117,
278
+ "เ": 118,
279
+ "ไ": 119,
280
+ "๒": 120,
281
+ "๕": 121,
282
+ "ລ": 122,
283
+ "ວ": 123,
284
+ "ສ": 124,
285
+ "າ": 125,
286
+ "ក": 126,
287
+ "ខ": 127,
288
+ "គ": 128,
289
+ "ឃ": 129,
290
+ "ង": 130,
291
+ "ច": 131,
292
+ "ឆ": 132,
293
+ "ជ": 133,
294
+ "ឈ": 134,
295
+ "ញ": 135,
296
+ "ដ": 136,
297
+ "ឋ": 137,
298
+ "ឌ": 138,
299
+ "ឍ": 139,
300
+ "ណ": 140,
301
+ "ត": 141,
302
+ "ថ": 142,
303
+ "ទ": 143,
304
+ "ធ": 144,
305
+ "ន": 145,
306
+ "ប": 146,
307
+ "ផ": 147,
308
+ "ព": 148,
309
+ "ភ": 149,
310
+ "ម": 150,
311
+ "យ": 151,
312
+ "រ": 152,
313
+ "ល": 153,
314
+ "វ": 154,
315
+ "ឝ": 155,
316
+ "ឞ": 156,
317
+ "ស": 157,
318
+ "ហ": 158,
319
+ "ឡ": 159,
320
+ "អ": 160,
321
+ "ឥ": 161,
322
+ "ឦ": 162,
323
+ "ឧ": 163,
324
+ "ឩ": 164,
325
+ "ឪ": 165,
326
+ "ឫ": 166,
327
+ "ឬ": 167,
328
+ "ឭ": 168,
329
+ "ឮ": 169,
330
+ "ឯ": 170,
331
+ "ឰ": 171,
332
+ "ឱ": 172,
333
+ "ឲ": 173,
334
+ "ឳ": 174,
335
+ "ា": 175,
336
+ "ិ": 176,
337
+ "ី": 177,
338
+ "ឹ": 178,
339
+ "ឺ": 179,
340
+ "ុ": 180,
341
+ "ូ": 181,
342
+ "ួ": 182,
343
+ "ើ": 183,
344
+ "ឿ": 184,
345
+ "ៀ": 185,
346
+ "េ": 186,
347
+ "ែ": 187,
348
+ "ៃ": 188,
349
+ "ោ": 189,
350
+ "ៅ": 190,
351
+ "ំ": 191,
352
+ "ះ": 192,
353
+ "ៈ": 193,
354
+ "៉": 194,
355
+ "៊": 195,
356
+ "់": 196,
357
+ "៌": 197,
358
+ "៍": 198,
359
+ "៎": 199,
360
+ "៏": 200,
361
+ "័": 201,
362
+ "៑": 202,
363
+ "្": 203,
364
+ "។": 204,
365
+ "៕": 205,
366
+ "៖": 206,
367
+ "ៗ": 207,
368
+ "៘": 208,
369
+ "៛": 209,
370
+ "‑": 210,
371
+ "–": 211,
372
+ "—": 212,
373
+ "‘": 213,
374
+ "’": 214,
375
+ "“": 215,
376
+ "”": 216,
377
+ "•": 217,
378
+ "…": 218,
379
+ "‹": 219,
380
+ "›": 220,
381
+ "→": 221,
382
+ "−": 222,
383
+ "●": 223,
384
+ "�": 224,
385
+ "😀": 225,
386
+ "😛": 226,
387
+ "🙂": 227,
388
+ "<src_pad>": 228,
389
+ "<src_s>": 229,
390
+ "</src>": 230,
391
+ "<src_unk>": 231,
392
+ " ": 232,
393
+ "!": 233,
394
+ "\"": 234,
395
+ "#": 235,
396
+ "$": 236,
397
+ "%": 237,
398
+ "&": 238,
399
+ "'": 239,
400
+ "(": 240,
401
+ ")": 241,
402
+ "*": 242,
403
+ "+": 243,
404
+ ",": 244,
405
+ "-": 245,
406
+ ".": 246,
407
+ "/": 247,
408
+ "0": 248,
409
+ "1": 249,
410
+ "2": 250,
411
+ "3": 251,
412
+ "4": 252,
413
+ "5": 253,
414
+ "6": 254,
415
+ "7": 255,
416
+ "8": 256,
417
+ "9": 257,
418
+ ":": 258,
419
+ ";": 259,
420
+ "<": 260,
421
+ "=": 261,
422
+ ">": 262,
423
+ "?": 263,
424
+ "@": 264,
425
+ "A": 265,
426
+ "B": 266,
427
+ "C": 267,
428
+ "D": 268,
429
+ "E": 269,
430
+ "F": 270,
431
+ "G": 271,
432
+ "H": 272,
433
+ "I": 273,
434
+ "J": 274,
435
+ "K": 275,
436
+ "L": 276,
437
+ "M": 277,
438
+ "N": 278,
439
+ "O": 279,
440
+ "P": 280,
441
+ "Q": 281,
442
+ "R": 282,
443
+ "S": 283,
444
+ "T": 284,
445
+ "U": 285,
446
+ "V": 286,
447
+ "W": 287,
448
+ "X": 288,
449
+ "Y": 289,
450
+ "Z": 290,
451
+ "[": 291,
452
+ "]": 292,
453
+ "^": 293,
454
+ "_": 294,
455
+ "a": 295,
456
+ "b": 296,
457
+ "c": 297,
458
+ "d": 298,
459
+ "e": 299,
460
+ "f": 300,
461
+ "g": 301,
462
+ "h": 302,
463
+ "i": 303,
464
+ "j": 304,
465
+ "k": 305,
466
+ "l": 306,
467
+ "m": 307,
468
+ "n": 308,
469
+ "o": 309,
470
+ "p": 310,
471
+ "q": 311,
472
+ "r": 312,
473
+ "s": 313,
474
+ "t": 314,
475
+ "u": 315,
476
+ "v": 316,
477
+ "w": 317,
478
+ "x": 318,
479
+ "y": 319,
480
+ "z": 320,
481
+ "|": 321,
482
+ "~": 322,
483
+ "¡": 323,
484
+ "«": 324,
485
+ "®": 325,
486
+ "°": 326,
487
+ "·": 327,
488
+ "»": 328,
489
+ "×": 329,
490
+ "á": 330,
491
+ "ç": 331,
492
+ "è": 332,
493
+ "é": 333,
494
+ "í": 334,
495
+ "ǔ": 335,
496
+ "ɓ": 336,
497
+ "ə": 337,
498
+ "ก": 338,
499
+ "ท": 339,
500
+ "น": 340,
501
+ "ภ": 341,
502
+ "ย": 342,
503
+ "ร": 343,
504
+ "ษ": 344,
505
+ "า": 345,
506
+ "ิ": 346,
507
+ "เ": 347,
508
+ "ไ": 348,
509
+ "๒": 349,
510
+ "๕": 350,
511
+ "ລ": 351,
512
+ "ວ": 352,
513
+ "ສ": 353,
514
+ "າ": 354,
515
+ "ក": 355,
516
+ "ខ": 356,
517
+ "គ": 357,
518
+ "ឃ": 358,
519
+ "ង": 359,
520
+ "ច": 360,
521
+ "ឆ": 361,
522
+ "ជ": 362,
523
+ "ឈ": 363,
524
+ "ញ": 364,
525
+ "ដ": 365,
526
+ "ឋ": 366,
527
+ "ឌ": 367,
528
+ "ណ": 368,
529
+ "ត": 369,
530
+ "ថ": 370,
531
+ "ទ": 371,
532
+ "ធ": 372,
533
+ "ន": 373,
534
+ "ប": 374,
535
+ "ផ": 375,
536
+ "ព": 376,
537
+ "ភ": 377,
538
+ "ម": 378,
539
+ "យ": 379,
540
+ "រ": 380,
541
+ "ល": 381,
542
+ "វ": 382,
543
+ "ស": 383,
544
+ "ហ": 384,
545
+ "ឡ": 385,
546
+ "អ": 386,
547
+ "ឧ": 387,
548
+ "ឫ": 388,
549
+ "ឬ": 389,
550
+ "ឯ": 390,
551
+ "ឲ": 391,
552
+ "ា": 392,
553
+ "ិ": 393,
554
+ "ី": 394,
555
+ "ឹ": 395,
556
+ "ឺ": 396,
557
+ "ុ": 397,
558
+ "ូ": 398,
559
+ "ួ": 399,
560
+ "ើ": 400,
561
+ "ឿ": 401,
562
+ "ៀ": 402,
563
+ "េ": 403,
564
+ "ែ": 404,
565
+ "ៃ": 405,
566
+ "ោ": 406,
567
+ "ៅ": 407,
568
+ "ំ": 408,
569
+ "ះ": 409,
570
+ "ៈ": 410,
571
+ "៉": 411,
572
+ "៊": 412,
573
+ "់": 413,
574
+ "៌": 414,
575
+ "៍": 415,
576
+ "៏": 416,
577
+ "័": 417,
578
+ "្": 418,
579
+ "។": 419,
580
+ "៕": 420,
581
+ "៖": 421,
582
+ "ៗ": 422,
583
+ "៘": 423,
584
+ "៛": 424,
585
+ "‑": 425,
586
+ "–": 426,
587
+ "—": 427,
588
+ "‘": 428,
589
+ "’": 429,
590
+ "“": 430,
591
+ "”": 431,
592
+ "•": 432,
593
+ "…": 433,
594
+ "‹": 434,
595
+ "›": 435,
596
+ "→": 436,
597
+ "−": 437,
598
+ "●": 438,
599
+ "�": 439,
600
+ "😀": 440,
601
+ "😛": 441,
602
+ "🙂": 442
603
+ },
604
+ "unk_token": "<src_unk>"
605
+ }
606
+ }
tokenizer_config.json ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "tokenizer_class": "PreTrainedTokenizerFast",
3
+ "model_max_length": 250,
4
+ "padding_side": "right",
5
+ "truncation_side": "right",
6
+ "clean_up_tokenization_spaces": false,
7
+ "bos_token": "<s>",
8
+ "eos_token": "</s>",
9
+ "pad_token": "<pad>",
10
+ "unk_token": "<src_unk>",
11
+ "model_input_names": [
12
+ "input_ids",
13
+ "attention_mask"
14
+ ]
15
+ }