[Lane 2 · kotlin-core] tokenizer.json parity — accept the array form of model.merges
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 88/100
調査の方向性
skainet-io/skainet-io-core/src/commonMain/kotlin/sk/ainet/io/tokenizer/QwenByteLevelBpeTokenizer.kt の243〜255行目付近を開き、マージエントリの解析方法を確認してください。次に skainet-io/skainet-io-core/src/commonTest/kotlin/sk/ainet/io/tokenizer/TokenizerFactoryDispatchTest.kt を調べ、特に既存のTokenizer JSON BPEディスパッチテストを確認してください。配列形式のマージを読み込んでサンプルを [3, 2] としてエンコードでき、不正な配列で明確な IllegalArgumentException がスローされ、JVMテストが通れば完了です。
索引モデルが issue の本文から書いたものです。
説明
Sub-issue of #1321 (HF tokenizer.json parity for BPE encoders).
Lane: 2 · Kotlin core
Skill needed: Kotlin and kotlinx.serialization.json basics. No tokenizer or tensor knowledge needed — the fix is a when branch.
Size: xs (under an hour including the test)
Blocked by: nothing
What to do
- Open QwenByteLevelBpeTokenizer.kt#L243-L255. Today each merge entry is read with
el.jsonPrimitive.contentand split on the first space. the Hugging FacetokenizersPython library (PyPI) writes merges as two-element arrays since its 0.20 release,[["Ġ", "Ġ"], ["a", "b"], …], sojsonPrimitivethrowsIllegalArgumentException: Element class kotlinx.serialization.json.JsonArray … is not a JsonPrimitiveand the whole tokenizer fails to load. - Add an
is JsonArraybranch: require exactly two elements and map them tofirst to second. Keep the string branch as is (older files and GGUF still use"a b"). Keep the existingis JsonObject -> error(...)branch. - In TokenizerFactoryDispatchTest.kt copy the test
tokenizer_json BPE dispatches to byte level BPEand change only"merges": ["a b"]to"merges": [["a", "b"]]. Expected ids for"ab<|end|>"are the same,[3, 2]. Add a second test asserting that a one-element or three-element array throws a clearIllegalArgumentException. - Run
./gradlew :skainet-io:skainet-io-core:jvmTest(fast) and, if you have the toolchain,:skainet-io:skainet-io-core:linuxX64Test. - Add a line under
[Unreleased]inCHANGELOG.mdand open a PR fromfeature/<issue-number>-tokenizer-json-array-mergesreferencing this issue.
Acceptance
- The synthetic array-form file in the new test loads and encodes to
[3, 2] - Both published Laya files (ModernBERT, mmBERT) load without rewriting their merges (ids are still wrong for other reasons — that is the sibling lanes' job, not this one's)
- Existing
jvmTestgreen - Result reported back on #1321
Notes
Reproduction with a 0.57.0 BOM project: feed the JSON below to sk.ainet.io.tokenizer.TokenizerFactory.fromTokenizerJson; it throws today and should return a tokenizer that encodes ab<|end|> to [3, 2].
{"version":"1.0","added_tokens":[{"id":2,"content":"<|end|>","special":true}],
"model":{"type":"BPE","vocab":{"a":0,"b":1,"<|end|>":2,"ab":3},"merges":[["a","b"]]}}
Why both forms matter: the string form is ambiguous when a token itself contains a space; the array form is what every tokenizers release since 0.20 writes (verified with 0.20.3 and the current 0.23.3), while the string form is still accepted on read. The GGUF path (fromGgufFields) is unaffected — GGUF always stores "a b".
- 主要言語
- 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
-
[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 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
nightscout/AndroidAPS#5280 ·
メンテナーはふだん 1 日以内に返信