Publish Fractus CTE-Atom: Atomizer spans on the HF engine, vocab 266, from scratch.
d74aa69 verified Download tests/test_atom_tokenizer.py from thefinalboss/fractus-cte-atom: direct link, hf CLI and curl.
- Browser
- Download file 752 Bytes
-
https://huggingface.co/thefinalboss/fractus-cte-atom/resolve/main/tests/test_atom_tokenizer.py
- Command line
-
hf download hf://thefinalboss/fractus-cte-atom/tests/test_atom_tokenizer.py
-
curl -L -o test_atom_tokenizer.py https://huggingface.co/thefinalboss/fractus-cte-atom/resolve/main/tests/test_atom_tokenizer.py
752 Bytes
| """Round-trip and id-range lock for the Atom→Fractus adapter.""" | |
| import os | |
| import sys | |
| sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | |
| from fractus.atom_tokenizer import VOCAB_SIZE, AtomFractusTokenizer | |
| def test_roundtrip_french_and_code(): | |
| tok = AtomFractusTokenizer(max_span_bytes=32, pack_mode="linguistic") | |
| text = "Bonjour Philippe.\n2+2=4. def tick(): return h" | |
| ids = tok.encode(text) | |
| assert ids[0] == 257 and ids[-1] == 258 | |
| assert max(ids) < VOCAB_SIZE | |
| assert tok.decode(ids) == text | |
| def test_no_gpt2_range(): | |
| tok = AtomFractusTokenizer() | |
| ids = tok.encode("fractus") | |
| assert all(i < 266 for i in ids) | |
| assert any(i >= 259 for i in ids) # at least one boundary marker | |