--- language: - en license: apache-2.0 tags: - tokenizer - sentencepiece - bpe - code --- # NiftyOracle Tokenizer **A 50,000-piece SentencePiece BPE tokenizer for code and text, used by [CodeSymb-1B](https://huggingface.co/NiftyOracleAI/CodeSymb-1B-MI325X).** | Setting | Value | | --- | --- | | File | `niftyoracle_tokenizer.model` | | Algorithm | SentencePiece BPE | | Vocabulary | 50,000 pieces | | Normalization | `nmt_nfkc` | | Digits | Split into single digits (`2026` → `2` `0` `2` `6`) | | Byte fallback | Off | | Character coverage | 0.9999 | | Special IDs | `` 0 · `` 1 · `` 2 · `` 3 | ## Special tokens 27 user-defined symbols (IDs 4–30). Each is always encoded as a single token. | Group | Tokens (IDs) | | --- | --- | | Code structure | `` `` (4–5) · `` `` (6–7) · `` `` (8–9) | | Debugging | `` `` (10–11) · `` `` (12–13) · `` `` (14–15) | | Languages | `` 16 · `` 17 · `` 18 · `` 19 · `` 20 · `` 21 · `` 22 · `` 23 · `` 24 | | Retrieval | `` `` (25–26) · `` `` (27–28) | | Reasoning | `` `` (29–30) | ## Usage ```python from huggingface_hub import hf_hub_download import sentencepiece as spm path = hf_hub_download("NiftyOracleAI/niftyoracle-tokenizer", "niftyoracle_tokenizer.model") sp = spm.SentencePieceProcessor(model_file=path) print(sp.encode("def add(a, b): return a + b", out_type=str)) # ['▁def', '▁add', '(', 'a', ',', '▁b', '):', '▁return', '▁a', '▁+', '▁b'] ``` ## Known limitations - **Whitespace is not preserved.** The `nmt_nfkc` normalizer turns newlines, tabs and runs of spaces into a single space, so indentation-sensitive code (such as Python) does not round-trip. - **No byte fallback.** Characters outside the vocabulary (some emoji, rare scripts) become ``. ### Whitespace codec (used by CodeSymb-1B) CodeSymb-1B works around the whitespace limitation without changing this tokenizer. Seven pieces that never occurred in its training data are given fixed whitespace meanings; text between whitespace is still encoded by this tokenizer. | ID | Original piece | Meaning | | --- | --- | --- | | 46632 | `CHOPEL` | newline | | 46642 | `ETHFSx` | tab | | 46648 | `GENlep` | 1 space | | 42206 | `FakeNodeGroup` | 2 spaces | | 37796 | `JobTickStatus` | 4 spaces | | 42279 | `Repairprogress` | 8 spaces | | 42227 | `getyesterdaty` | 16 spaces | The codec (`ws_codec.py`) ships in the CodeSymb-1B repository, inside `backup/state_final.tgz`. A model trained with the codec must use it for both encoding and decoding. ## Used by - [NiftyOracleAI/CodeSymb-1B-MI325X](https://huggingface.co/NiftyOracleAI/CodeSymb-1B-MI325X): a 1.18B-parameter code model trained from scratch on 8× AMD Instinct MI325X. Built by Dev Malkar, NiftyOracle AI. Questions: open a discussion in the Community tab.