TibetanCodexAITeam commited on
Commit
1d87586
·
verified ·
1 Parent(s): 2a989bd

Release OCR checkpoint-184000

Browse files
._sentencepiece.model DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:9624dfbd84676e99c6fc8cb4b73d15f619d757d51bfb2cff84af484a0c3b1061
3
- size 4096
 
 
 
 
._spiece.model DELETED
@@ -1,3 +0,0 @@
1
- version https://git-lfs.github.com/spec/v1
2
- oid sha256:9624dfbd84676e99c6fc8cb4b73d15f619d757d51bfb2cff84af484a0c3b1061
3
- size 4096
 
 
 
 
README.md CHANGED
@@ -1,88 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  # PechaBridgeOCR
2
 
3
- Tibetan OCR model (~200M parameters, DONUT / VisionEncoderDecoder architecture) fine-tuned on Tibetan pecha line images with PechaBridge.
4
 
5
- > **Important:** This model requires a custom BDRC-style grayscale preprocessing pipeline (adaptive binarization, background normalisation, aspect-preserving resize and padding). Using `AutoImageProcessor` directly will apply standard ImageNet normalisation and produce poor results. **Use PechaBridge's `batch-ocr` CLI** for correct end-to-end inference.
6
 
7
  ## Recommended usage — PechaBridge CLI
8
 
9
  ```bash
10
- # 1. Clone PechaBridge and install dependencies
11
  git clone https://github.com/CodexAITeam/PechaBridge.git && cd PechaBridge
12
  pip install -r requirements.txt
13
-
14
- # 2. Download this model (and the line segmentation model)
15
  python cli.py download-models
16
 
17
- # 3a. Run batch OCR on a folder of pecha page images
18
  python cli.py batch-ocr \
19
  --ocr-model models/ocr/PechaBridgeOCR \
20
  --line-model models/line_segmentation/PechaBridgeLineSegmentation.pt \
21
  --layout-engine yolo_line \
22
  --ocr-engine donut \
23
  --input-dir /path/to/pecha/images
24
-
25
- # 3b. Or use the BDRC layout engine (auto-downloads BDRC line models)
26
- python cli.py batch-ocr \
27
- --ocr-model models/ocr/PechaBridgeOCR \
28
- --layout-engine bdrc_line \
29
- --ocr-engine donut \
30
- --input-dir /path/to/pecha/images
31
-
32
- # 3c. Download + OCR a Staatsbibliothek zu Berlin pecha in one command
33
- python cli.py batch-ocr \
34
- --ppn 337138764X \
35
- --ocr-model models/ocr/PechaBridgeOCR \
36
- --layout-engine bdrc_line \
37
- --ocr-engine donut
38
  ```
39
 
40
- Each image produces a `.txt` transcript and an `*_overlay.jpg` with detected line boxes drawn on the source image.
41
 
42
  ## Advanced: standalone Python usage
43
 
44
- If you need to call the model directly from Python, you must apply the BDRC-style preprocessing manually before passing pixel values to the model. See `pechabridge/ocr/preprocess_bdrc.py` in the PechaBridge repository for the full preprocessing pipeline (`gray` pipeline was used for this checkpoint).
45
 
46
  ```python
47
- # Minimal example — BDRC gray preprocessing applied explicitly
48
  import torch
49
- from transformers import VisionEncoderDecoderModel, AutoTokenizer
50
- from pechabridge.ocr.preprocess_bdrc import (
51
- BDRCPreprocessConfig,
52
- preprocess_image_bdrc, # returns grayscale PIL Image (mode 'L')
53
- bdrc_image_to_normalized_tensor, # grayscale PIL → float32 HW in [-1, 1]
54
- )
55
  from PIL import Image
56
- import numpy as np
57
-
58
- model = VisionEncoderDecoderModel.from_pretrained("TibetanCodexAITeam/PechaBridgeOCR")
59
- tokenizer = AutoTokenizer.from_pretrained("TibetanCodexAITeam/PechaBridgeOCR")
60
-
61
- # 1. Load the line crop as RGB
 
 
62
  image = Image.open('line_crop.png').convert('RGB')
63
-
64
- # 2. Apply BDRC preprocessing:
65
- # - converts to grayscale (luma by default)
66
- # - optionally normalises background, binarises, pads/resizes
67
- # Returns a grayscale PIL Image (mode 'L')
68
- cfg = BDRCPreprocessConfig.ocr_line_defaults() # defaults used during training
69
- gray_pil = preprocess_image_bdrc(image, cfg)
70
-
71
- # 3. Normalise to float32 in [-1, 1] and build a 3-channel tensor
72
- # (model expects C=3; replicate the single gray channel)
73
- gray_hw = bdrc_image_to_normalized_tensor(image, cfg) # shape: (H, W), float32
74
- pixel_values = torch.tensor(gray_hw).unsqueeze(0).unsqueeze(0) # (1, 1, H, W)
75
- pixel_values = pixel_values.expand(-1, 3, -1, -1) # (1, 3, H, W)
76
-
77
- generated_ids = model.generate(pixel_values)
78
  text = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
 
79
  ```
80
 
81
  ## Model details
82
 
83
- - **Checkpoint**: `checkpoint-154000` (step 154000)
84
  - **Image preprocessing pipeline**: `gray`
85
- - **Repro bundle included**: yes — preprocessing config is in `repro/`
86
- - **Architecture**: Swin Transformer encoder (hidden_size=768, 12 layers) + BART decoder (d_model=1024, 12 layers), ~200M parameters total
 
87
  - **Training framework**: [PechaBridge](https://github.com/CodexAITeam/PechaBridge)
88
  - **Training data**: Tibetan pecha line images from OpenPecha and BDRC collections
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - bo
4
+ license: mit
5
+ library_name: transformers
6
+ pipeline_tag: image-to-text
7
+ base_model: microsoft/trocr-base-stage1
8
+ tags:
9
+ - ocr
10
+ - tibetan
11
+ - document-ai
12
+ - trocr
13
+ - vision-encoder-decoder
14
+ ---
15
+
16
  # PechaBridgeOCR
17
 
18
+ Tibetan line OCR model (323.24M parameters, VIT encoder + TROCR decoder in a VisionEncoderDecoder architecture) fine-tuned for traditional Tibetan pecha scans with PechaBridge.
19
 
20
+ > **Important:** This checkpoint expects PechaBridge's `gray` preprocessing followed by a fixed `256×1024` resize. The `gray` pipeline uses the minimum RGB channel as grayscale and does not binarize the image. Use the PechaBridge CLI for the supported end-to-end path; raw image input or a generic `AutoTokenizer` path will not reproduce the training pipeline.
21
 
22
  ## Recommended usage — PechaBridge CLI
23
 
24
  ```bash
 
25
  git clone https://github.com/CodexAITeam/PechaBridge.git && cd PechaBridge
26
  pip install -r requirements.txt
 
 
27
  python cli.py download-models
28
 
 
29
  python cli.py batch-ocr \
30
  --ocr-model models/ocr/PechaBridgeOCR \
31
  --line-model models/line_segmentation/PechaBridgeLineSegmentation.pt \
32
  --layout-engine yolo_line \
33
  --ocr-engine donut \
34
  --input-dir /path/to/pecha/images
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  ```
36
 
37
+ Each page image produces a `.txt` transcript and an `*_overlay.jpg` preview.
38
 
39
  ## Advanced: standalone Python usage
40
 
41
+ The tokenizer is backed by BoSentencePiece plus PechaBridge-specific special tokens. Load it with PechaBridge's adapter rather than `AutoTokenizer`.
42
 
43
  ```python
44
+ from pathlib import Path
45
  import torch
46
+ from huggingface_hub import snapshot_download
 
 
 
 
 
47
  from PIL import Image
48
+ from transformers import AutoImageProcessor, VisionEncoderDecoderModel
49
+ from pechabridge.ocr.preprocess_bdrc import BDRCPreprocessConfig, preprocess_image_bdrc
50
+ from pechabridge.ocr.sentencepiece_tokenizer_adapter import load_sentencepiece_tokenizer
51
+
52
+ model_dir = Path(snapshot_download("TibetanCodexAITeam/PechaBridgeOCR"))
53
+ model = VisionEncoderDecoderModel.from_pretrained(model_dir).eval()
54
+ image_processor = AutoImageProcessor.from_pretrained(model_dir, use_fast=False)
55
+ tokenizer = load_sentencepiece_tokenizer(model_dir)
56
  image = Image.open('line_crop.png').convert('RGB')
57
+ cfg = BDRCPreprocessConfig.vit_defaults()
58
+ cfg = BDRCPreprocessConfig.from_dict({
59
+ **cfg.to_dict(), 'binarize': False, 'gray_mode': 'min_rgb',
60
+ })
61
+ prepared = preprocess_image_bdrc(image=image, config=cfg).convert('RGB')
62
+ pixel_values = image_processor(images=prepared, return_tensors='pt').pixel_values
63
+ with torch.inference_mode():
64
+ generated_ids = model.generate(pixel_values)
 
 
 
 
 
 
 
65
  text = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
66
+ print(text)
67
  ```
68
 
69
  ## Model details
70
 
71
+ - **Checkpoint**: `checkpoint-184000` (step 184000)
72
  - **Image preprocessing pipeline**: `gray`
73
+ - **Input geometry**: fixed `256×1024` resize, RGB tensor normalized with mean/std `0.5`
74
+ - **Architecture**: VIT encoder + TROCR decoder, 323.24M parameters
75
+ - **Repro configuration included**: yes — preprocessing, generation, normalization, and metric definitions are in `repro/`
76
  - **Training framework**: [PechaBridge](https://github.com/CodexAITeam/PechaBridge)
77
  - **Training data**: Tibetan pecha line images from OpenPecha and BDRC collections
78
+
79
+ ## Evaluation
80
+
81
+ | Checkpoint | Internal validation CER | Valid samples |
82
+ |---|---:|---:|
83
+ | `checkpoint-184000` | 0.5751% | 241 |
84
+
85
+ CER is the global character edit distance divided by total normalized reference length. This is a training-time internal validation result, not an independent cross-collection benchmark.
86
+
87
+ ### External multi-source evaluation
88
+
89
+ On a separate 3,306-sample evaluation set, mean CER was **0.80%**. **1.63%** of samples exceeded 10% CER and **0.57%** exceeded 20% CER.
90
+
91
+ | Source dataset | Samples | Mean CER |
92
+ |---|---:|---:|
93
+ | OCR-Norbuketaka | 2,350 | 0.43% |
94
+ | OCR-Google_Books | 812 | 1.59% |
95
+ | OCR-Lhasakanjur | 118 | 1.92% |
96
+ | OCR-Drutsa | 14 | 3.54% |
97
+ | OCR-Betsug | 12 | 3.86% |
98
+
99
+ This externally supplied result summary was not independently reproduced from artifacts included in this release.
100
+
101
+ ## Intended use and limitations
102
+
103
+ - Intended for OCR of individual Tibetan pecha text-line crops.
104
+ - Page-level use requires a separate line-segmentation/layout stage.
105
+ - Performance may degrade on other scripts, modern book layouts, handwriting, severe blur, unusual scan colors, or collections not represented during training.
106
+ - Outputs should be reviewed before scholarly, archival, or other high-impact use.
107
+
108
+ ## License
109
+
110
+ MIT. See the PechaBridge repository for the project license.
config.json CHANGED
@@ -54,9 +54,9 @@
54
  "use_bfloat16": false,
55
  "use_cache": false,
56
  "use_learned_position_embeddings": false,
57
- "vocab_size": 20008
58
  },
59
- "decoder_start_token_id": 20005,
60
  "dtype": "float32",
61
  "encoder": {
62
  "_name_or_path": "",
@@ -78,7 +78,10 @@
78
  "0": "LABEL_0",
79
  "1": "LABEL_1"
80
  },
81
- "image_size": 384,
 
 
 
82
  "initializer_range": 0.02,
83
  "intermediate_size": 3072,
84
  "is_decoder": false,
@@ -111,12 +114,12 @@
111
  "torchscript": false,
112
  "use_bfloat16": false
113
  },
114
- "eos_token_id": 20006,
115
  "is_encoder_decoder": true,
116
  "model_type": "vision-encoder-decoder",
117
- "pad_token_id": 20000,
118
  "tie_word_embeddings": false,
119
- "transformers_version": "5.2.0",
120
  "use_cache": false,
121
- "vocab_size": 20008
122
  }
 
54
  "use_bfloat16": false,
55
  "use_cache": false,
56
  "use_learned_position_embeddings": false,
57
+ "vocab_size": 20007
58
  },
59
+ "decoder_start_token_id": 20004,
60
  "dtype": "float32",
61
  "encoder": {
62
  "_name_or_path": "",
 
78
  "0": "LABEL_0",
79
  "1": "LABEL_1"
80
  },
81
+ "image_size": [
82
+ 256,
83
+ 1024
84
+ ],
85
  "initializer_range": 0.02,
86
  "intermediate_size": 3072,
87
  "is_decoder": false,
 
114
  "torchscript": false,
115
  "use_bfloat16": false
116
  },
117
+ "eos_token_id": 20005,
118
  "is_encoder_decoder": true,
119
  "model_type": "vision-encoder-decoder",
120
+ "pad_token_id": 3,
121
  "tie_word_embeddings": false,
122
+ "transformers_version": "5.6.2",
123
  "use_cache": false,
124
+ "vocab_size": 20007
125
  }
generation_config.json CHANGED
@@ -4,23 +4,22 @@
4
  "assistant_lookbehind": 10,
5
  "bad_words_ids": [
6
  [
7
- 20005
8
  ]
9
  ],
10
  "bos_token_id": 0,
11
- "decoder_start_token_id": 20005,
12
  "diversity_penalty": 0.0,
13
  "do_sample": false,
14
  "early_stopping": false,
15
  "encoder_no_repeat_ngram_size": 0,
16
  "encoder_repetition_penalty": 1.0,
17
- "eos_token_id": 20006,
18
  "epsilon_cutoff": 0.0,
19
  "eta_cutoff": 0.0,
20
  "length_penalty": 1.0,
21
  "max_length": 160,
22
  "min_length": 0,
23
- "min_new_tokens": 0,
24
  "no_repeat_ngram_size": 3,
25
  "num_assistant_tokens": 20,
26
  "num_assistant_tokens_schedule": "constant",
@@ -28,18 +27,18 @@
28
  "num_beams": 1,
29
  "num_return_sequences": 1,
30
  "output_scores": false,
31
- "pad_token_id": 20000,
32
  "remove_invalid_values": false,
33
  "repetition_penalty": 1.15,
34
  "return_dict_in_generate": false,
35
  "suppress_tokens": [
36
- 20005
37
  ],
38
  "target_lookbehind": 10,
39
  "temperature": 1.0,
40
  "top_k": 50,
41
  "top_p": 1.0,
42
- "transformers_version": "5.2.0",
43
  "typical_p": 1.0,
44
  "use_cache": false
45
  }
 
4
  "assistant_lookbehind": 10,
5
  "bad_words_ids": [
6
  [
7
+ 20004
8
  ]
9
  ],
10
  "bos_token_id": 0,
11
+ "decoder_start_token_id": 20004,
12
  "diversity_penalty": 0.0,
13
  "do_sample": false,
14
  "early_stopping": false,
15
  "encoder_no_repeat_ngram_size": 0,
16
  "encoder_repetition_penalty": 1.0,
17
+ "eos_token_id": 20005,
18
  "epsilon_cutoff": 0.0,
19
  "eta_cutoff": 0.0,
20
  "length_penalty": 1.0,
21
  "max_length": 160,
22
  "min_length": 0,
 
23
  "no_repeat_ngram_size": 3,
24
  "num_assistant_tokens": 20,
25
  "num_assistant_tokens_schedule": "constant",
 
27
  "num_beams": 1,
28
  "num_return_sequences": 1,
29
  "output_scores": false,
30
+ "pad_token_id": 3,
31
  "remove_invalid_values": false,
32
  "repetition_penalty": 1.15,
33
  "return_dict_in_generate": false,
34
  "suppress_tokens": [
35
+ 20004
36
  ],
37
  "target_lookbehind": 10,
38
  "temperature": 1.0,
39
  "top_k": 50,
40
  "top_p": 1.0,
41
+ "transformers_version": "5.6.2",
42
  "typical_p": 1.0,
43
  "use_cache": false
44
  }
model.safetensors CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:76f918953adde7ddf91aa4268649db486df81448838b1b01a2d072f71c2cd8d6
3
- size 1291653280
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b876faf7dac748c9a9d953f9b2dfc6d32f7b9dc006bdd285d8c687524d233266
3
+ size 1293021344
preprocessor_config.json CHANGED
@@ -1,5 +1,4 @@
1
  {
2
- "data_format": "channels_first",
3
  "do_normalize": true,
4
  "do_pad": false,
5
  "do_rescale": true,
@@ -9,7 +8,7 @@
9
  0.5,
10
  0.5
11
  ],
12
- "image_processor_type": "ViTImageProcessorFast",
13
  "image_std": [
14
  0.5,
15
  0.5,
@@ -18,7 +17,7 @@
18
  "resample": 2,
19
  "rescale_factor": 0.00392156862745098,
20
  "size": {
21
- "height": 384,
22
- "width": 384
23
  }
24
  }
 
1
  {
 
2
  "do_normalize": true,
3
  "do_pad": false,
4
  "do_rescale": true,
 
8
  0.5,
9
  0.5
10
  ],
11
+ "image_processor_type": "ViTImageProcessor",
12
  "image_std": [
13
  0.5,
14
  0.5,
 
17
  "resample": 2,
18
  "rescale_factor": 0.00392156862745098,
19
  "size": {
20
+ "height": 256,
21
+ "width": 1024
22
  }
23
  }
repro/cer_step_154000.json DELETED
@@ -1,13 +0,0 @@
1
- {
2
- "step": 154000,
3
- "checkpoint_dir": "/home/ubuntu/data/PechaBridge/models/donut_full_gray_aug_restart/checkpoint-154000",
4
- "repro_cer": 0.027263326125787347,
5
- "repro_cer_percent": 2.7263326125787346,
6
- "repro_valid_n": 300,
7
- "repro_empty_ref_count": 0,
8
- "repro_empty_pred_count": 0,
9
- "repro_edit_sum": 1160,
10
- "repro_ref_len_sum": 42548,
11
- "repro_runtime": 41.041670083999634,
12
- "repro_world_size": 1
13
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
repro/generate_config.json CHANGED
@@ -1,11 +1,11 @@
1
  {
2
- "decoder_start_token_id": 20005,
3
  "bos_token_id": 0,
4
- "eos_token_id": 20006,
5
- "pad_token_id": 20000,
6
  "max_length": 160,
7
  "max_new_tokens": null,
8
- "min_new_tokens": 0,
9
  "num_beams": 1,
10
  "do_sample": false,
11
  "temperature": 1.0,
@@ -16,7 +16,7 @@
16
  "early_stopping": false,
17
  "bad_words_ids": [
18
  [
19
- 20005
20
  ]
21
  ],
22
  "forced_bos_token_id": null,
 
1
  {
2
+ "decoder_start_token_id": 20004,
3
  "bos_token_id": 0,
4
+ "eos_token_id": 20005,
5
+ "pad_token_id": 3,
6
  "max_length": 160,
7
  "max_new_tokens": null,
8
+ "min_new_tokens": null,
9
  "num_beams": 1,
10
  "do_sample": false,
11
  "temperature": 1.0,
 
16
  "early_stopping": false,
17
  "bad_words_ids": [
18
  [
19
+ 20004
20
  ]
21
  ],
22
  "forced_bos_token_id": null,
repro/image_preprocess.json CHANGED
@@ -2,10 +2,10 @@
2
  "pipeline": "gray",
3
  "color_space": "RGB",
4
  "channel_order": "channels_first",
5
- "processor_class": "ViTImageProcessorFast",
6
  "image_processor_config": {
7
- "data_format": "channels_first",
8
  "do_normalize": true,
 
9
  "do_rescale": true,
10
  "do_resize": true,
11
  "image_mean": [
@@ -13,7 +13,7 @@
13
  0.5,
14
  0.5
15
  ],
16
- "image_processor_type": "ViTImageProcessorFast",
17
  "image_std": [
18
  0.5,
19
  0.5,
@@ -22,14 +22,13 @@
22
  "resample": 2,
23
  "rescale_factor": 0.00392156862745098,
24
  "size": {
25
- "height": 384,
26
- "width": 384
27
- },
28
- "do_pad": false
29
  },
30
  "size": {
31
- "height": 384,
32
- "width": 384
33
  },
34
  "do_resize": true,
35
  "do_rescale": true,
 
2
  "pipeline": "gray",
3
  "color_space": "RGB",
4
  "channel_order": "channels_first",
5
+ "processor_class": "ViTImageProcessor",
6
  "image_processor_config": {
 
7
  "do_normalize": true,
8
+ "do_pad": false,
9
  "do_rescale": true,
10
  "do_resize": true,
11
  "image_mean": [
 
13
  0.5,
14
  0.5
15
  ],
16
+ "image_processor_type": "ViTImageProcessor",
17
  "image_std": [
18
  0.5,
19
  0.5,
 
22
  "resample": 2,
23
  "rescale_factor": 0.00392156862745098,
24
  "size": {
25
+ "height": 256,
26
+ "width": 1024
27
+ }
 
28
  },
29
  "size": {
30
+ "height": 256,
31
+ "width": 1024
32
  },
33
  "do_resize": true,
34
  "do_rescale": true,
sentencepiece.model CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:6032a003043e791f2e573a8cce72e512cd6027bef640dcb5457920cd67724fdc
3
- size 911556
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3f59e5bebc3be675fb79cb6598a2aff557ecfc40bdb86450780771542cba3f19
3
+ size 906758
spiece.model CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:6032a003043e791f2e573a8cce72e512cd6027bef640dcb5457920cd67724fdc
3
- size 911556
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3f59e5bebc3be675fb79cb6598a2aff557ecfc40bdb86450780771542cba3f19
3
+ size 906758
tokenizer.json DELETED
@@ -1,243 +0,0 @@
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": "<unk>",
18
- "single_word": false,
19
- "lstrip": false,
20
- "rstrip": false,
21
- "normalized": false,
22
- "special": true
23
- },
24
- {
25
- "id": 2,
26
- "content": "[CLS]",
27
- "single_word": false,
28
- "lstrip": false,
29
- "rstrip": false,
30
- "normalized": false,
31
- "special": true
32
- },
33
- {
34
- "id": 3,
35
- "content": "[SEP]",
36
- "single_word": false,
37
- "lstrip": false,
38
- "rstrip": false,
39
- "normalized": false,
40
- "special": true
41
- },
42
- {
43
- "id": 4,
44
- "content": "[MASK]",
45
- "single_word": false,
46
- "lstrip": false,
47
- "rstrip": false,
48
- "normalized": false,
49
- "special": true
50
- },
51
- {
52
- "id": 5,
53
- "content": "<s>",
54
- "single_word": false,
55
- "lstrip": false,
56
- "rstrip": false,
57
- "normalized": false,
58
- "special": true
59
- },
60
- {
61
- "id": 6,
62
- "content": "</s>",
63
- "single_word": false,
64
- "lstrip": false,
65
- "rstrip": false,
66
- "normalized": false,
67
- "special": true
68
- }
69
- ],
70
- "normalizer": {
71
- "type": "Sequence",
72
- "normalizers": [
73
- {
74
- "type": "Replace",
75
- "pattern": {
76
- "String": "``"
77
- },
78
- "content": "\""
79
- },
80
- {
81
- "type": "Replace",
82
- "pattern": {
83
- "String": "''"
84
- },
85
- "content": "\""
86
- },
87
- {
88
- "type": "NFKD"
89
- },
90
- {
91
- "type": "StripAccents"
92
- },
93
- {
94
- "type": "Lowercase"
95
- },
96
- {
97
- "type": "Replace",
98
- "pattern": {
99
- "Regex": " {2,}"
100
- },
101
- "content": " "
102
- },
103
- {
104
- "type": "NFKD"
105
- },
106
- {
107
- "type": "StripAccents"
108
- },
109
- {
110
- "type": "Lowercase"
111
- },
112
- {
113
- "type": "Replace",
114
- "pattern": {
115
- "Regex": " {2,}"
116
- },
117
- "content": " "
118
- }
119
- ]
120
- },
121
- "pre_tokenizer": {
122
- "type": "Sequence",
123
- "pretokenizers": [
124
- {
125
- "type": "WhitespaceSplit"
126
- },
127
- {
128
- "type": "Metaspace",
129
- "replacement": "▁",
130
- "prepend_scheme": "always",
131
- "split": true
132
- }
133
- ]
134
- },
135
- "post_processor": {
136
- "type": "TemplateProcessing",
137
- "single": [
138
- {
139
- "SpecialToken": {
140
- "id": "[CLS]",
141
- "type_id": 0
142
- }
143
- },
144
- {
145
- "Sequence": {
146
- "id": "A",
147
- "type_id": 0
148
- }
149
- },
150
- {
151
- "SpecialToken": {
152
- "id": "[SEP]",
153
- "type_id": 0
154
- }
155
- }
156
- ],
157
- "pair": [
158
- {
159
- "SpecialToken": {
160
- "id": "[CLS]",
161
- "type_id": 0
162
- }
163
- },
164
- {
165
- "Sequence": {
166
- "id": "A",
167
- "type_id": 0
168
- }
169
- },
170
- {
171
- "SpecialToken": {
172
- "id": "[SEP]",
173
- "type_id": 0
174
- }
175
- },
176
- {
177
- "Sequence": {
178
- "id": "B",
179
- "type_id": 1
180
- }
181
- },
182
- {
183
- "SpecialToken": {
184
- "id": "[SEP]",
185
- "type_id": 1
186
- }
187
- }
188
- ],
189
- "special_tokens": {
190
- "[CLS]": {
191
- "id": "[CLS]",
192
- "ids": [
193
- 2
194
- ],
195
- "tokens": [
196
- "[CLS]"
197
- ]
198
- },
199
- "[SEP]": {
200
- "id": "[SEP]",
201
- "ids": [
202
- 3
203
- ],
204
- "tokens": [
205
- "[SEP]"
206
- ]
207
- }
208
- }
209
- },
210
- "decoder": {
211
- "type": "Metaspace",
212
- "replacement": "▁",
213
- "prepend_scheme": "always",
214
- "split": true
215
- },
216
- "model": {
217
- "type": "Unigram",
218
- "unk_id": 1,
219
- "vocab": [
220
- [
221
- "<pad>",
222
- 0.0
223
- ],
224
- [
225
- "<unk>",
226
- 0.0
227
- ],
228
- [
229
- "[CLS]",
230
- 0.0
231
- ],
232
- [
233
- "[SEP]",
234
- 0.0
235
- ],
236
- [
237
- "[MASK]",
238
- 0.0
239
- ]
240
- ],
241
- "byte_fallback": false
242
- }
243
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tokenizer_config.json CHANGED
@@ -1,6 +1,6 @@
1
  {
2
  "tokenizer_class": "SentencePieceTokenizerAdapter",
3
- "source_tokenizer_dir": "/home/ubuntu/data/PechaBridge/ext/BoSentencePiece",
4
  "model_max_length": 1000000000000000019884624838656,
5
  "unk_token": "<unk>",
6
  "pad_token": "<pad>",
 
1
  {
2
  "tokenizer_class": "SentencePieceTokenizerAdapter",
3
+ "source_tokenizer_dir": "/home/nico/Code/PechaBridge/ext/BoSentencePiece",
4
  "model_max_length": 1000000000000000019884624838656,
5
  "unk_token": "<unk>",
6
  "pad_token": "<pad>",