fMindstormer commited on
Commit
e833aa9
Β·
verified Β·
1 Parent(s): e7dea34

Tokenizer CPU

Browse files
README.md CHANGED
@@ -10,8 +10,10 @@ tags:
10
 
11
  # Tokenizer CPU
12
 
13
- A stock Hugging Face tokenizer that runs Brainfuck. It is a plain `tokenizer.json`, with no custom
14
- code and no model (no `trust_remote_code`). Every clock tick is one encode and one decode:
 
 
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}