Instructions to use fMindstormer/tokcpu with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use fMindstormer/tokcpu with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("fMindstormer/tokcpu", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Tokenizer CPU
Browse files- README.md +10 -2
- increment/start.txt +1 -0
- increment/tokenizer.json +1 -0
- increment/tokenizer_config.json +1 -0
README.md
CHANGED
|
@@ -10,8 +10,10 @@ tags:
|
|
| 10 |
|
| 11 |
# Tokenizer CPU
|
| 12 |
|
| 13 |
-
A stock Hugging Face tokenizer that
|
| 14 |
-
|
|
|
|
|
|
|
| 15 |
|
| 16 |
```python
|
| 17 |
from huggingface_hub import hf_hub_download
|
|
@@ -44,12 +46,18 @@ changing.
|
|
| 44 |
|
| 45 |
The full explanation, the compiler and the tests are on GitHub: https://github.com/fMindstormer/tokcpu
|
| 46 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
## What's in this repo
|
| 48 |
|
| 49 |
| Folder | Machine | Merge rules |
|
| 50 |
|---|---|---:|
|
| 51 |
| (root) | universal Brainfuck interpreter: runs any program written on the tape | 17,210 |
|
| 52 |
| `hello`, `alphabet`, `grid`, `jumps` | one Brainfuck program compiled into each tokenizer | 24,173 β 38,265 |
|
|
|
|
| 53 |
| `4-state-busy-beaver` | the 4-state busy beaver: halts after 107 ticks with 13 ones | 24 |
|
| 54 |
| `binary-counter` | counts in binary forever | 7 |
|
| 55 |
| `sort` | a block cellular automaton: every two-letter block of the tape is rewritten in one tick, sorting it | 704 |
|
|
|
|
| 10 |
|
| 11 |
# Tokenizer CPU
|
| 12 |
|
| 13 |
+
A stock Hugging Face tokenizer that executes programs. Its merge rules select a machine transition;
|
| 14 |
+
decoding writes the next state. Repeating encode and decode runs the computation, without a neural
|
| 15 |
+
network. It is a plain `tokenizer.json`, with no custom code (no `trust_remote_code`). Every clock tick
|
| 16 |
+
is one encode and one decode:
|
| 17 |
|
| 18 |
```python
|
| 19 |
from huggingface_hub import hf_hub_download
|
|
|
|
| 46 |
|
| 47 |
The full explanation, the compiler and the tests are on GitHub: https://github.com/fMindstormer/tokcpu
|
| 48 |
|
| 49 |
+
Tag `v1.0` of this repo holds the same tokenizer files as the
|
| 50 |
+
[v1.0 release](https://github.com/fMindstormer/tokcpu/releases/tag/v1.0) on GitHub, which adds a
|
| 51 |
+
minimal runner, the expected results, checksums, and a reproduction of a tokenizer disagreement between
|
| 52 |
+
Python and JavaScript.
|
| 53 |
+
|
| 54 |
## What's in this repo
|
| 55 |
|
| 56 |
| Folder | Machine | Merge rules |
|
| 57 |
|---|---|---:|
|
| 58 |
| (root) | universal Brainfuck interpreter: runs any program written on the tape | 17,210 |
|
| 59 |
| `hello`, `alphabet`, `grid`, `jumps` | one Brainfuck program compiled into each tokenizer | 24,173 β 38,265 |
|
| 60 |
+
| `increment` | adds one to a binary number: `start.txt` holds 1011, which becomes 1100 after 8 ticks | 16 |
|
| 61 |
| `4-state-busy-beaver` | the 4-state busy beaver: halts after 107 ticks with 13 ones | 24 |
|
| 62 |
| `binary-counter` | counts in binary forever | 7 |
|
| 63 |
| `sort` | a block cellular automaton: every two-letter block of the tape is rewritten in one tick, sorting it | 704 |
|
increment/start.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
β’β1011β£
|
increment/tokenizer.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"version":"1.0","truncation":null,"padding":null,"added_tokens":[{"id":27,"content":"0βξ","single_word":false,"lstrip":false,"rstrip":false,"normalized":false,"special":false},{"id":28,"content":"1βΈξ","single_word":false,"lstrip":false,"rstrip":false,"normalized":false,"special":false},{"id":29,"content":"1βξ","single_word":false,"lstrip":false,"rstrip":false,"normalized":false,"special":false},{"id":30,"content":"β·0ξ","single_word":false,"lstrip":false,"rstrip":false,"normalized":false,"special":false},{"id":31,"content":"β·_ξ","single_word":false,"lstrip":false,"rstrip":false,"normalized":false,"special":false},{"id":32,"content":"1βΈξ","single_word":false,"lstrip":false,"rstrip":false,"normalized":false,"special":false},{"id":33,"content":"β’β·_ξ","single_word":false,"lstrip":false,"rstrip":false,"normalized":false,"special":false},{"id":34,"content":"β’1βΈξ","single_word":false,"lstrip":false,"rstrip":false,"normalized":false,"special":false},{"id":35,"content":"0βξ","single_word":false,"lstrip":false,"rstrip":false,"normalized":false,"special":false},{"id":36,"content":"1βξ","single_word":false,"lstrip":false,"rstrip":false,"normalized":false,"special":false},{"id":37,"content":"β·_ξ","single_word":false,"lstrip":false,"rstrip":false,"normalized":false,"special":false},{"id":38,"content":"β·_β£ξ","single_word":false,"lstrip":false,"rstrip":false,"normalized":false,"special":false},{"id":39,"content":"β1ξ","single_word":false,"lstrip":false,"rstrip":false,"normalized":false,"special":false},{"id":40,"content":"β·0ξ","single_word":false,"lstrip":false,"rstrip":false,"normalized":false,"special":false},{"id":41,"content":"β1ξ","single_word":false,"lstrip":false,"rstrip":false,"normalized":false,"special":false},{"id":42,"content":"β1β£ξ","single_word":false,"lstrip":false,"rstrip":false,"normalized":false,"special":false}],"normalizer":null,"pre_tokenizer":null,"post_processor":null,"decoder":{"type":"Sequence","decoders":[{"type":"Replace","pattern":{"Regex":"[ξ-ξΏ]"},"content":""},{"type":"Fuse"}]},"model":{"type":"BPE","dropout":null,"unk_token":null,"continuing_subword_prefix":null,"end_of_word_suffix":null,"fuse_unk":false,"byte_fallback":false,"ignore_merges":false,"vocab":{"0":0,"1":1,"_":2,"β’":3,"β£":4,"βΆ":5,"β·":6,"βΈ":7,"β":8,"β":9,"β":10,"0βΆ":27,"0β·":28,"1βΆ":29,"1β·":30,"_βΆ":31,"_β·":32,"β’βΆ":33,"β’β·":34,"β0":35,"β1":36,"β_":37,"ββ£":38,"β0":39,"β1":40,"β_":41,"ββ£":42},"merges":[["0","βΆ"],["0","β·"],["1","βΆ"],["1","β·"],["_","βΆ"],["_","β·"],["β’","βΆ"],["β’","β·"],["β","0"],["β","1"],["β","_"],["β","β£"],["β","0"],["β","1"],["β","_"],["β","β£"]]}}
|
increment/tokenizer_config.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"tokenizer_class": "PreTrainedTokenizerFast", "clean_up_tokenization_spaces": false, "model_max_length": 1000000000}
|