Download test_tokenizer.py from sage002/angstrom: direct link, hf CLI and curl.
- Browser
- Download file 418 Bytes
-
https://huggingface.co/sage002/angstrom/resolve/main/test_tokenizer.py
- Command line
-
hf download hf://sage002/angstrom/test_tokenizer.py
-
curl -L -o test_tokenizer.py https://huggingface.co/sage002/angstrom/resolve/main/test_tokenizer.py
418 Bytes
| import sys; sys.path.insert(0, '.') | |
| from angstrom_nano.tokenizer import AngstromNanoTokenizer | |
| tok = AngstromNanoTokenizer() | |
| text = "def hello(): return 42" | |
| ids = tok.encode(text) | |
| decoded = tok.decode(ids) | |
| print(f"Text: {text}") | |
| print(f"Tokens: {ids[:10]}... ({len(ids)} total)") | |
| print(f"Decoded: {decoded}") | |
| print(f"Match: {text == decoded}") | |
| tok.save('angstrom_nano/tokenizer_config.json') | |
| print("Tokenizer PASSED") | |