[Lane 2 · kotlin-core] tokenizer.json parity — accept the array form of model.merges
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 88/100
Hướng nghiên cứu
Mở skainet-io/skainet-io-core/src/commonMain/kotlin/sk/ainet/io/tokenizer/QwenByteLevelBpeTokenizer.kt ở khoảng dòng 243–255 và đọc cách các mục merge được phân tích. Sau đó kiểm tra skainet-io/skainet-io-core/src/commonTest/kotlin/sk/ainet/io/tokenizer/TokenizerFactoryDispatchTest.kt, đặc biệt là bài kiểm tra dispatch BPE Tokenizer JSON hiện có. Hoàn tất khi các merge dạng mảng được tải và mã hóa mẫu thành [3, 2], các mảng không hợp lệ gây ra IllegalArgumentException rõ ràng, và các bài kiểm tra JVM đều đạt.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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".
- Ngôn ngữ chính
- Kotlin
- Star
- 52
- Fork
- 15
- Merge trung bình
- 1 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 37
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của SKaiNET-developers/SKaiNET
-
coding good first issue platform size:xs skill:js sub-issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
SKaiNET-developers/SKaiNET#1232 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
compute-backend dsl/api enhancement size:m skill:kotlin-core skill:numerics
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 18/100
SKaiNET-developers/SKaiNET#1343 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
compute-backend dsl/api enhancement size:m skill:kotlin-core skill:numerics
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 12/100
SKaiNET-developers/SKaiNET#1342 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
skeep tracking
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
SKaiNET-developers/SKaiNET#1331 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
assessment size:s skill:review sub-issue
Độ khó 4/5 1-2 ngày Mức phù hợp với người mới 18/100
SKaiNET-developers/SKaiNET#1330 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của SKaiNET-developers/SKaiNET
Issue tương tự
-
afk-ok area:data-quality importer size:S
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
enorm-labs/event-junkie#3301 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
MDM: interfaceName cannot be set through managed configurationsCó thể đã có người làm @JulienUsson đã nhận hôm nay. Đang mởbug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 82/100
bk138/droidVNC-NG#404 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
rustyrazorblade/easy-db-lab#1017 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
openclaw/openclaw#172218 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày