Datasets:
Add tokenizer docs
Browse files- tokenizer/PREPROCESSING.md +22 -0
- tokenizer/README.md +36 -0
tokenizer/PREPROCESSING.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Tokenizer Preprocessing
|
| 2 |
+
|
| 3 |
+
Tokenizer training should sample across files instead of consuming the first
|
| 4 |
+
large file only. Use round-robin sampling from checkpoint shards to avoid
|
| 5 |
+
language and domain skew.
|
| 6 |
+
|
| 7 |
+
## Keep
|
| 8 |
+
|
| 9 |
+
- Exact indentation.
|
| 10 |
+
- Blank lines.
|
| 11 |
+
- Comments and docstrings.
|
| 12 |
+
- Mixed Korean/English comments.
|
| 13 |
+
- Repository/file/language metadata when represented in text.
|
| 14 |
+
|
| 15 |
+
## Drop Or Quarantine
|
| 16 |
+
|
| 17 |
+
- Empty text.
|
| 18 |
+
- Null bytes.
|
| 19 |
+
- Obvious credentials, tokens, private keys, and secrets.
|
| 20 |
+
- Malformed JSONL.
|
| 21 |
+
- Extremely long records that exceed the active model context unless the loader
|
| 22 |
+
has deterministic chunking.
|
tokenizer/README.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Tokenizer
|
| 2 |
+
|
| 3 |
+
## Recommended Tokenizer
|
| 4 |
+
|
| 5 |
+
Use a byte-level BPE tokenizer with explicit FIM and metadata tokens. The
|
| 6 |
+
current local tokenizer uses Hugging Face `tokenizers` JSON format.
|
| 7 |
+
|
| 8 |
+
Required special tokens:
|
| 9 |
+
|
| 10 |
+
- `<|fim_prefix|>`
|
| 11 |
+
- `<|fim_suffix|>`
|
| 12 |
+
- `<|fim_middle|>`
|
| 13 |
+
- `<|fim_pad|>`
|
| 14 |
+
- `<|repo|>`
|
| 15 |
+
- `<|file|>`
|
| 16 |
+
- `<|lang|>`
|
| 17 |
+
- `<|endoftext|>`
|
| 18 |
+
- `<|pad|>`
|
| 19 |
+
|
| 20 |
+
## Usage Rules
|
| 21 |
+
|
| 22 |
+
- Encode with `add_special_tokens=False` when the record text already contains
|
| 23 |
+
FIM markers.
|
| 24 |
+
- Decode audits with `skip_special_tokens=False`.
|
| 25 |
+
- Preserve indentation, tabs, newlines, comments, and Korean text.
|
| 26 |
+
- Do not lowercase or normalize code whitespace.
|
| 27 |
+
- Append EOS between JSONL records during training.
|
| 28 |
+
|
| 29 |
+
## Quality Checks
|
| 30 |
+
|
| 31 |
+
Audit tokenizer quality with:
|
| 32 |
+
|
| 33 |
+
- Special tokens remain atomic.
|
| 34 |
+
- Round-trip decode has no byte loss.
|
| 35 |
+
- FIM markers remain visible in decoded samples.
|
| 36 |
+
- Code chars/token is stable across Python, Rust, C++, JavaScript, and Java.
|