Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -13,12 +13,15 @@ datasets:
|
|
| 13 |
|
| 14 |
# EthioBBPE Tokenizer
|
| 15 |
|
| 16 |
-
This is a production-ready Byte-Level BPE tokenizer
|
| 17 |
|
| 18 |
## Features
|
| 19 |
- **Byte-Level**: Handles any Unicode character without <UNK>.
|
| 20 |
-
- **
|
| 21 |
-
- **Checkpointing**: Built-in safety checkpoints
|
|
|
|
|
|
|
|
|
|
| 22 |
|
| 23 |
## Usage
|
| 24 |
|
|
@@ -26,7 +29,7 @@ This is a production-ready Byte-Level BPE tokenizer trained for robust text proc
|
|
| 26 |
```python
|
| 27 |
from transformers import AutoTokenizer
|
| 28 |
|
| 29 |
-
tokenizer = AutoTokenizer.from_pretrained("
|
| 30 |
```
|
| 31 |
|
| 32 |
### Tokenizers Library
|
|
@@ -36,28 +39,59 @@ from tokenizers import Tokenizer
|
|
| 36 |
tokenizer = Tokenizer.from_file("tokenizer.json")
|
| 37 |
```
|
| 38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
## Training Configuration
|
| 40 |
```json
|
| 41 |
{
|
| 42 |
-
"vocab_size":
|
| 43 |
"min_frequency": 2,
|
| 44 |
"show_progress": true,
|
| 45 |
"special_tokens": [
|
| 46 |
-
"
|
| 47 |
-
"
|
| 48 |
-
"
|
| 49 |
-
"
|
| 50 |
-
"
|
| 51 |
],
|
| 52 |
"lowercase": false,
|
| 53 |
"dropout": null,
|
| 54 |
"data_dir": "./data",
|
| 55 |
"model_save_dir": "models",
|
| 56 |
-
"model_name": "
|
| 57 |
"use_checkpoint": true,
|
| 58 |
"checkpoint_dir": "./models/checkpoints",
|
| 59 |
"save_compressed": true,
|
|
|
|
|
|
|
| 60 |
"checkpoint_steps": null,
|
| 61 |
-
"num_threads": -1
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
}
|
| 63 |
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
|
| 14 |
# EthioBBPE Tokenizer
|
| 15 |
|
| 16 |
+
This is a production-ready Byte-Level BPE tokenizer with advanced features for deployment.
|
| 17 |
|
| 18 |
## Features
|
| 19 |
- **Byte-Level**: Handles any Unicode character without <UNK>.
|
| 20 |
+
- **Multi-format Compression**: Supports gzip, bz2, and lzma compression.
|
| 21 |
+
- **Checkpointing**: Built-in safety checkpoints with metadata tracking.
|
| 22 |
+
- **Quantization**: Optional 8-bit/4-bit quantization for efficient deployment.
|
| 23 |
+
- **Training Metrics**: Comprehensive metrics tracking and logging.
|
| 24 |
+
- **Automatic Backup**: Checkpoint rotation to manage disk space.
|
| 25 |
|
| 26 |
## Usage
|
| 27 |
|
|
|
|
| 29 |
```python
|
| 30 |
from transformers import AutoTokenizer
|
| 31 |
|
| 32 |
+
tokenizer = AutoTokenizer.from_pretrained("EthioBBPE_AmharicBible")
|
| 33 |
```
|
| 34 |
|
| 35 |
### Tokenizers Library
|
|
|
|
| 39 |
tokenizer = Tokenizer.from_file("tokenizer.json")
|
| 40 |
```
|
| 41 |
|
| 42 |
+
### Loading Compressed Vocab
|
| 43 |
+
```python
|
| 44 |
+
import gzip
|
| 45 |
+
import json
|
| 46 |
+
|
| 47 |
+
# Load compressed vocabulary
|
| 48 |
+
with gzip.open("vocab.json.gz", 'rt', encoding='utf-8') as f:
|
| 49 |
+
vocab = json.load(f)
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
## Training Configuration
|
| 53 |
```json
|
| 54 |
{
|
| 55 |
+
"vocab_size": 16000,
|
| 56 |
"min_frequency": 2,
|
| 57 |
"show_progress": true,
|
| 58 |
"special_tokens": [
|
| 59 |
+
"<pad>",
|
| 60 |
+
"<unk>",
|
| 61 |
+
"<s>",
|
| 62 |
+
"</s>",
|
| 63 |
+
"<mask>"
|
| 64 |
],
|
| 65 |
"lowercase": false,
|
| 66 |
"dropout": null,
|
| 67 |
"data_dir": "./data",
|
| 68 |
"model_save_dir": "models",
|
| 69 |
+
"model_name": "EthioBBPE_AmharicBible",
|
| 70 |
"use_checkpoint": true,
|
| 71 |
"checkpoint_dir": "./models/checkpoints",
|
| 72 |
"save_compressed": true,
|
| 73 |
+
"compression_format": "gzip",
|
| 74 |
+
"compression_level": 9,
|
| 75 |
"checkpoint_steps": null,
|
| 76 |
+
"num_threads": -1,
|
| 77 |
+
"enable_backup": true,
|
| 78 |
+
"max_checkpoints": 5,
|
| 79 |
+
"enable_quantization": true,
|
| 80 |
+
"quantization_bits": 8
|
| 81 |
}
|
| 82 |
```
|
| 83 |
+
|
| 84 |
+
## Model Files
|
| 85 |
+
- `tokenizer.json`: Standard tokenizer file (required)
|
| 86 |
+
- `vocab.json.gz`: Compressed vocabulary (optional, smaller size)
|
| 87 |
+
- `config.json`: Training configuration
|
| 88 |
+
- `training_metrics.json`: Training statistics
|
| 89 |
+
- `special_tokens_map.json`: Special tokens mapping
|
| 90 |
+
- `README.md`: This file
|
| 91 |
+
|
| 92 |
+
## Checkpoints
|
| 93 |
+
Checkpoints are saved in the `models/checkpoints` directory with metadata including:
|
| 94 |
+
- Checkpoint ID and timestamp
|
| 95 |
+
- Vocabulary size
|
| 96 |
+
- SHA256 checksum for integrity verification
|
| 97 |
+
- Training metrics at checkpoint time
|