[Lane 2 · kotlin-core] tokenizer.json parity — accept the array form of model.merges
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 88/100
Línea de trabajo
Abre skainet-io/skainet-io-core/src/commonMain/kotlin/sk/ainet/io/tokenizer/QwenByteLevelBpeTokenizer.kt alrededor de las líneas 243–255 y lee cómo se analizan las entradas de merge. Después, inspecciona skainet-io/skainet-io-core/src/commonTest/kotlin/sk/ainet/io/tokenizer/TokenizerFactoryDispatchTest.kt, especialmente la prueba existente de dispatch BPE de Tokenizer JSON. La tarea estará terminada cuando se carguen los merges en formato de array y se codifique la muestra como [3, 2], los arrays mal formados lancen una IllegalArgumentException clara y pasen las pruebas JVM.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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".
- Lenguaje dominante
- Kotlin
- Estrellas
- 52
- Forks
- 15
- Merge medio
- 1 d 15 h
- PR fusionados (30 d)
- 36
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de SKaiNET-developers/SKaiNET
-
coding good first issue platform size:xs skill:js sub-issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
SKaiNET-developers/SKaiNET#1232 ·
Los mantenedores suelen responder en 1 día
-
skeep tracking
Dificultad 5/5 Más de una semana Aptitud para principiantes 15/100
SKaiNET-developers/SKaiNET#1331 ·
Los mantenedores suelen responder en 1 día
-
assessment size:s skill:review sub-issue
Dificultad 4/5 1-2 días Aptitud para principiantes 18/100
SKaiNET-developers/SKaiNET#1330 ·
Los mantenedores suelen responder en 1 día
-
documentation good first issue size:s skill:docs sub-issue
Dificultad 3/5 1-2 días Aptitud para principiantes 78/100
SKaiNET-developers/SKaiNET#1329 ·
Los mantenedores suelen responder en 1 día
-
coding good first issue size:s skill:kotlin-core sub-issue
Dificultad 3/5 Medio día Aptitud para principiantes 75/100
SKaiNET-developers/SKaiNET#1328 ·
Los mantenedores suelen responder en 1 día
Todos los issues de SKaiNET-developers/SKaiNET
Issues similares
-
afk-ok area:data-quality importer size:S
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
enorm-labs/event-junkie#3166 ·
Los mantenedores suelen responder en 1 día
-
bugbane/qf good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
osservatorionessuno/bugbane#173 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
theopenconversationkit/tock#2113 ·
Los mantenedores suelen responder en 1 día
-
Bayern feature:Application ready web
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
digitalfabrik/entitlementcard#3176 ·
Los mantenedores suelen responder en 7 días