[Lane 2 · kotlin-core] tokenizer.json parity — match non-special added_tokens atomically and count them in vocabSize
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
Read the added-token loop in QwenByteLevelBpeTokenizer.kt and TokenizerFactory.kt, then inspect the related tests in TokenizerFactoryDispatchTest.kt. Add a synthetic case where a non-special token would otherwise split, and check that it encodes atomically and vocabSize includes its id. Run ./gradlew :skainet-io:skainet-io-core:jvmTest; done means the test passes and the changelog records the vocabSize change.
索引モデルが issue の本文から書いたものです。
説明
Sub-issue of #1321 (HF tokenizer.json parity for BPE encoders).
Lane: 2 · Kotlin core
Skill needed: Kotlin. Helpful to have read how tokenizers matches added tokens (one page of docs, linked below). No tensor knowledge.
Size: s (a few hours)
Blocked by: nothing (independent of the merges lane; both touch the same file, so rebase once)
What to do
- Read how the reference matches added tokens: every entry of
added_tokensis matched atomically, before pre-tokenization, regardless ofspecial. Thespecialflag only decides whether the token is dropped bydecode(skip_special_tokens=True). See theAddedVocabularysection of thetokenizersdocs: https://huggingface.co/docs/tokenizers/api/added-tokens - In QwenByteLevelBpeTokenizer.kt#L257-L267 the loop skips entries with
"special": false. Register all entries in the atomic-match map. Keep a separateSet<Int>of the ids that are marked special so a later change can implementskip_special_tokens; nothing else needs that set today. - Make the same change in TokenizerFactory.kt#L155-L169 for the Unigram path (
wrapSentencePieceWithSpecialsFromJson). - Added tokens may have ids above
model.vocab(ModernBERT:[UNK]=50280 … and the whitespace runs up to 50367). Extend thetokensarray sovocabSizeequals the referenceget_vocab_size(with_added_tokens=True)— 50368 for ModernBERT instead of today's 50280 — and sodecodecan return their text. - Tests, in
TokenizerFactoryDispatchTest.kt: a synthetic file with onespecial: falseadded token whose content would otherwise BPE-split; assert it encodes to its id and thatvocabSizecounts it. Run./gradlew :skainet-io:skainet-io-core:jvmTest.
Acceptance
- Synthetic test: non-special added token encodes atomically;
vocabSizeincludes ids abovemodel.vocab - With the ModernBERT file (tokenizer/tokenizer.json) and merges loading (sibling lane),
" leading"encodes to[50275, 16378](reference:[' ', 'leading']) instead of[245, 4283, …], andvocabSize == 50368 -
CHANGELOG.mdnotes thevocabSizebehaviour change - Result reported back on #1321
Notes
The flags single_word, lstrip, rstrip, normalized exist on every entry. In the two Laya files they are all false except normalized: true on the non-special ModernBERT entries (and lstrip: true on one special token). Implement plain longest-match as the existing special-token code does; if a file you care about sets single_word or lstrip/rstrip, open a separate issue rather than growing this one. #912 asks for the same vocabSize fix on the SentencePiece side — closing that part here is fine, say so in the PR.
- 主要言語
- Kotlin
- スター
- 52
- フォーク
- 15
- 平均マージ
- 1日 8時間
- マージ済み PR(30日)
- 37
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
SKaiNET-developers/SKaiNET のほかの issue
-
coding good first issue platform size:xs skill:js sub-issue
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
SKaiNET-developers/SKaiNET#1232 ·
メンテナーはふだん 1 日以内に返信
-
skeep tracking
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
SKaiNET-developers/SKaiNET#1331 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
assessment size:s skill:review sub-issue
難易度 4/5 1〜2日 初心者へのやさしさ 18/100
SKaiNET-developers/SKaiNET#1330 ·
メンテナーはふだん 1 日以内に返信
-
documentation good first issue size:s skill:docs sub-issue
難易度 3/5 1〜2日 初心者へのやさしさ 78/100
SKaiNET-developers/SKaiNET#1329 ·
メンテナーはふだん 1 日以内に返信
-
coding good first issue size:s skill:kotlin-core sub-issue
難易度 3/5 半日 初心者へのやさしさ 75/100
SKaiNET-developers/SKaiNET#1328 ·
メンテナーはふだん 1 日以内に返信
SKaiNET-developers/SKaiNET の issue をすべて見る
似ている issue
-
documentation good first issue
難易度 1/5 1〜3時間 初心者へのやさしさ 85/100
djazairdev/wilayas#23 ·
メンテナーはふだん 1 日以内に返信
-
[BUG] Navigation drawer drops library-name suffixes without ellipsis (1.0.8, NVIDIA Shield)対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
damontecres/Wholphin#2069 ·
メンテナーはふだん 1 日以内に返信
-
Android (vision-camera-location): HybridLocationManager never quits its HandlerThread on disposeオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
margelo/react-native-vision-camera#4217 ·
メンテナーはふだん 4 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
saisaharsh3/Leftovers#13 · コメント 1 件 ·
-
難易度 1/5 1時間未満 初心者へのやさしさ 67/100
navikt/esyfo-narmesteleder#700 ·
メンテナーはふだん 1 日以内に返信