[Lane 2 · kotlin-core] tokenizer.json parity — accept the array form of model.merges
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 88/100
Direzione di ricerca
Apri skainet-io/skainet-io-core/src/commonMain/kotlin/sk/ainet/io/tokenizer/QwenByteLevelBpeTokenizer.kt intorno alle righe 243–255 e leggi come vengono analizzate le voci di merge. Poi esamina skainet-io/skainet-io-core/src/commonTest/kotlin/sk/ainet/io/tokenizer/TokenizerFactoryDispatchTest.kt, in particolare il test esistente di dispatch BPE del JSON del tokenizer. Il lavoro è completato quando i merge in formato array vengono caricati e il campione viene codificato come [3, 2], gli array malformati generano una IllegalArgumentException chiara e i test JVM passano.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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".
- Lingua principale
- Kotlin
- Stelle
- 52
- Fork
- 15
- Merge medio
- 1g 8h
- PR unite (30g)
- 37
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di SKaiNET-developers/SKaiNET
-
coding good first issue platform size:xs skill:js sub-issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
SKaiNET-developers/SKaiNET#1232 ·
I maintainer di solito rispondono entro 1 giorno
-
skeep tracking
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
SKaiNET-developers/SKaiNET#1331 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
assessment size:s skill:review sub-issue
Difficoltà 4/5 1-2 giorni Idoneità per principianti 18/100
SKaiNET-developers/SKaiNET#1330 ·
I maintainer di solito rispondono entro 1 giorno
-
documentation good first issue size:s skill:docs sub-issue
Difficoltà 3/5 1-2 giorni Idoneità per principianti 78/100
SKaiNET-developers/SKaiNET#1329 ·
I maintainer di solito rispondono entro 1 giorno
-
coding good first issue size:s skill:kotlin-core sub-issue
Difficoltà 3/5 Mezza giornata Idoneità per principianti 75/100
SKaiNET-developers/SKaiNET#1328 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di SKaiNET-developers/SKaiNET
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
world-federation-of-advertisers/cross-media-measurement#4653 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
kabirvashisht4-glitch/Vet#22 ·
-
documentation good first issue
Difficoltà 1/5 1-3 ore Idoneità per principianti 85/100
djazairdev/wilayas#23 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 85/100
lysine-dev/okhttp#9788 ·
I maintainer di solito rispondono entro 1 giorno