Commit 93152e0
committed
fix(ux): read vocab_size from active tokenizer, not hardcoded 65536
Previous patch wired vocab_size=65536 (cppmega default) into
BrickContextPanel's dims block — but the architect can swap
tokenizers via the Tokenizer Playground or the train-tokenizer
picker, so embedding_table parameter counts went stale for GPT-2 /
SmolLM / Llama-3-tiktoken / fim-only fixtures.
Fix: new useTokenizerVocab(rpc, source) hook calls
tokenizer.encode_visualize with a tiny probe text on tokenizer
change, reads capabilities.vocab_size out of the response, caches by
source path so toggling back-and-forth doesn't refetch.
App.tsx wires the hook to trainTokenizerPath and passes the resolved
size into BrickContextPanel — falling back to 65536 only when no
tokenizer is loaded yet. Drop a Llama-3 tokenizer (vocab=128256), the
embedding_table now reports 128256 × H params, not 65536 × H.1 parent b962324 commit 93152e0
2 files changed
Lines changed: 58 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| |||
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| 51 | + | |
| 52 | + | |
50 | 53 | | |
51 | 54 | | |
52 | 55 | | |
| |||
264 | 267 | | |
265 | 268 | | |
266 | 269 | | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
267 | 275 | | |
268 | 276 | | |
269 | 277 | | |
| |||
1542 | 1550 | | |
1543 | 1551 | | |
1544 | 1552 | | |
| 1553 | + | |
| 1554 | + | |
1545 | 1555 | | |
1546 | 1556 | | |
1547 | 1557 | | |
| |||
1908 | 1918 | | |
1909 | 1919 | | |
1910 | 1920 | | |
1911 | | - | |
| 1921 | + | |
1912 | 1922 | | |
1913 | 1923 | | |
1914 | 1924 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
0 commit comments