Download tokenizer.py from ArpeciousAI/FlowRes-1: direct link, hf CLI and curl.
- Browser
- Download file 215 Bytes
-
https://huggingface.co/ArpeciousAI/FlowRes-1/resolve/main/tokenizer.py
- Command line
-
hf download hf://ArpeciousAI/FlowRes-1/tokenizer.py
-
curl -L -o tokenizer.py https://huggingface.co/ArpeciousAI/FlowRes-1/resolve/main/tokenizer.py
215 Bytes
| import torch | |
| text = open("all_data.txt", "r", encoding="utf-8").read() | |
| tokens = [ord(c) % 256 for c in text] | |
| torch.save(torch.tensor(tokens, dtype=torch.long), "tokens.pt") | |
| print("Saved", len(tokens), "tokens") | |