diff options
| author | Jonas Knobloch <jonas.knobloch@t-online.de> | 2026-09-11 18:38:02 +0200 |
|---|---|---|
| committer | Jonas Knobloch <jonas.knobloch@t-online.de> | 2026-09-11 18:38:02 +0200 |
| commit | 330c6387962b197c5ca7a8051d4864feaecc0f25 (patch) | |
| tree | f13c82306ab432de6a610b1006d7cc10373dc7f6 /tokenizer/bpe/special.go | |
| parent | 6e6a94b12d6d43c1ce4b8e587742627af6d86a43 (diff) | |
WIP
Diffstat (limited to 'tokenizer/bpe/special.go')
| -rw-r--r-- | tokenizer/bpe/special.go | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tokenizer/bpe/special.go b/tokenizer/bpe/special.go new file mode 100644 index 0000000..405199f --- /dev/null +++ b/tokenizer/bpe/special.go @@ -0,0 +1,18 @@ +package bpe + +// Add helper to ensure special token +// wip-special-tokens + +func EnsureSpecialToken(t *Tokenizer, token string) int { + vocab := Vocab(t) + + for i, v := range vocab { + if v == token { + return i + } + } + + AddToken(t, token) + + return len(vocab) - 1 +} |
