OpenGlyph-OCR-0

่ฏปๅคๆ–‡ๅญ—ๅญฆ่ฎบ่‘—้‡ŒๆŽ’ๅฐ็š„่กŒ๏ผšไธ€่กŒๅ›พ่ฟ›ๅŽป๏ผŒๆ–‡ๅญ—ๅ‡บๆฅใ€‚็”Ÿๅƒปๅญ—็…ง Unicode ๅ†™๏ผ›ๆฒกๆœ‰็ ไฝ็š„ๅญ—ๅฝขๅ†™ๆˆ <gw:ๅญ—ๅฝขๅ>๏ผŒๅญ—ๅฝขๅๅฐฑๆ˜ฏๅฎƒๅœจ GlyphWiki ไธŠ็š„ๅๅญ—ใ€‚

An OCR model for single lines of printed Chinese scholarly text that is dense with rare characters. It is Xiaomi-OCR-0 (0.8B) with LoRA, a retrained vision tail and 159,052 added output tokens: every CJK extension character and 78,060 GlyphWiki glyphs that have no code point, which it writes as <gw:NAME>. It loads with transformers (PyTorch) or with MLX. An English summary is at the end.

ๅฎƒ่ฏปไป€ไนˆ๏ผŒไธ่ฏปไป€ไนˆ

  • ่ฏป๏ผš่ฎบๆ–‡ใ€่‘—ไฝœ้‡ŒๆŽ’ๅฐๅ‡บๆฅ็š„ไธ€่กŒๆจชๆŽ’ๆ–‡ๅญ—๏ผˆๆญฃๆ–‡ใ€่„šๆณจ๏ผ‰๏ผŒๅŒ…ๆ‹ฌๅ…ถไธญ็š„ๆ‰ฉๅฑ•ๅŒบๆฑ‰ๅญ—ๅ’Œ้šถๅฎšๅญ—ใ€้€ ๅญ—ใ€‚
  • ไธ่ฏปๆ•ด้กต๏ผš่ฆๅ…ˆๆŠŠ้กต้ขๅˆ‡ๆˆ่กŒใ€‚ๆต‹้‡็”จ็š„่กŒๅ›พ้ซ˜็บฆ 100โ€“130 ๅƒ็ด ๏ผŒๅฎฝๅˆฐ 2,800 ๅƒ็ด ใ€‚
  • ไธ่ฏปๅŽŸๅง‹ๆๆ–™๏ผš็”ฒ้ชจใ€้‡‘ๆ–‡ใ€็ฎ€ๅธ›็š„็…ง็‰‡ๅ’Œๆ‹“็‰‡ไธๅœจๅฎƒ็š„่Œƒๅ›ด้‡Œ๏ผŒๅฎƒ่ฏป็š„ๆ˜ฏ่ฎบ่‘—้‡Œๅฐๅ‡บๆฅ็š„ๅญ—ใ€‚
  • ็ซ–ๆŽ’ใ€ๆ‰‹ๅ†™ๆฒกๆœ‰ๆต‹่ฟ‡ใ€‚

ๆ€Žไนˆ็”จ

ๆœ‰ไธค็ง่ฃ…ๆณ•๏ผš็”จ transformers๏ผˆPyTorch๏ผ‰๏ผŒๆˆ–่€…ๅœจ Apple ่Šฏ็‰‡็š„ Mac ไธŠ็”จ MLXใ€‚ไธค็ง่ฃ…ๆณ•็š„ๆƒ้‡็›ธๅŒใ€‚

็”จ transformers๏ผˆPyTorch๏ผ‰

pip install "transformers==5.18.0" torch torchvision pillow
import torch
from transformers import AutoModelForImageTextToText, AutoProcessor

repo = "OpenGlyph/OpenGlyph-OCR-0"
model = AutoModelForImageTextToText.from_pretrained(repo, trust_remote_code=True, dtype=torch.float32).eval()
processor = AutoProcessor.from_pretrained(repo, trust_remote_code=True)

out = model.read_line(processor, "line.png")
print(out["text"])                    # ่พ“ๅ‡บ็š„ๆ ทๅญ๏ผšๅ…ถๅญ—ไฝœ<gw:u2ff0-u79c0-u6208>
  • ่ฆ trust_remote_code=Trueใ€‚ ๆ–ฐๅขž็š„่ฎฐๅทๅœจ่พ“ๅ‡บๅฑ‚ๅ„ๆœ‰ไธ€ไธชๅ็ฝฎ๏ผŒtransformers ่‡ชๅธฆ็š„ Qwen3.5 ็ฑปๆฒกๆœ‰่ฟ™ไธ€้กน๏ผŒๆ‰€ไปฅไป“ๅบ“้‡Œๅธฆไธ€ไธชๅ‡ ๅ่กŒ็š„ๆจกๅž‹็ฑป๏ผˆmodeling_openglyph_ocr.py๏ผ‰๏ผ›้™ค่พ“ๅ‡บๅฑ‚ไน‹ๅค–็”จ็š„้ƒฝๆ˜ฏ่‡ชๅธฆ็š„ๅฎž็Žฐใ€‚
  • ๆŒ‰ float32 ๅŠ ่ฝฝใ€‚ ่ฎญ็ปƒๆ”นๅŠจ่ฟ‡็š„ๆƒ้‡ๆŒ‰ 32 ไฝๅญ˜ๆ”พ๏ผŒๅ…ถไฝ™ๆ˜ฏๅบ•ๆจกๅŽŸๆฅ็š„ 16 ไฝๆตฎ็‚น๏ผ›ๆŒ‰ float32 ๅŠ ่ฝฝ๏ผŒๆฏไธชๆƒ้‡้ƒฝๆ˜ฏ่ฎญ็ปƒๅ‡บๆฅ็š„ๅŽŸๅ€ผใ€‚ๆŒ‰ 16 ไฝๆตฎ็‚นๅŠ ่ฝฝไผšๆŠŠ่ฎญ็ปƒๅ‡บๆฅ็š„้ƒจๅˆ†่ˆๅ…ฅ๏ผŒ้‚ฃๆ ทๆฒกๆœ‰ๆต‹่ฟ‡ใ€‚
  • ่ฆ่ฃ… torchvisionใ€‚ ๅ›พๅƒๆ˜ฏ้ ๅฎƒ้ข„ๅค„็†็š„๏ผŒ่ฃ…ไบ†ๆ‰ๅ’Œๆต‹้‡ๆ—ถ้€ๅƒ็ด ็›ธๅŒใ€‚ไธ่ฃ…ๆ—ถ transformers ๆ”น็”จ PIL ็ผฉๆ”พๅ›พๅƒ๏ผŒๅƒ็ด ๅ€ผไผšๅทฎๅˆฐไธคไธช็ฐๅบฆ็บง๏ผŒ้‚ฃๆ ทๆฒกๆœ‰ๆต‹่ฟ‡ใ€‚
  • ไธ‹้ข็š„ๆˆ็ปฉๆ˜ฏ็”จ MLX ็‰ˆ้‡็š„ใ€‚ ไธค็ง่ฃ…ๆณ•ๆƒ้‡็›ธๅŒ๏ผŒ็ฎ—ๆœฏไธๅŒ๏ผšMLX ็‰ˆๆฏไธ€ๆญฅ้ƒฝๆŠŠไธญ้—ด็ป“ๆžœ่ˆๅ…ฅๅˆฐ 16 ไฝ๏ผŒPyTorch ็‰ˆๆŒ‰ 32 ไฝ็ฎ—ใ€‚ๅ‘ๅธƒไน‹ๅ‰๏ผŒ็”จ PyTorch ็‰ˆๆŠŠๆต‹่ฏ•้‡Œ็š„ 43 ่กŒ้‡่ฏปไบ†ไธ€้๏ผˆCPU๏ผŒfloat32๏ผ‰๏ผš39 ่กŒ่ฏปๅ‡บ็š„่ฎฐๅทไธŽ MLX ็‰ˆ้€ไธช็›ธๅŒ๏ผŒ4 ่กŒไธๅŒใ€‚่ฟ™ 4 ่กŒไธค็‰ˆ้ƒฝๆฒกๆœ‰่ฏปๅฏน๏ผŒๅชๆ˜ฏ้”™ๅค„ไธๅŒ๏ผ›ๆŒ‰็ฆป็ญ”ๆกˆๅทฎๅ‡ ไธชๅญ—็ฎ—๏ผŒPyTorch ็‰ˆๆ›ด่ฟ‘็š„ 1 ่กŒ๏ผŒMLX ็‰ˆๆ›ด่ฟ‘็š„ 1 ่กŒ๏ผŒไธ€ๆ ท่ฟœ็š„ 2 ่กŒ๏ผˆๅˆ่ฎกๅ„ๅทฎ 20 ๅญ—๏ผ‰ใ€‚ไธๅŒ็š„ 4 ่กŒ้‡Œ๏ผŒ3 ่กŒๅ‡บ่‡ชๆ‰ฉๅฑ•ๅŒบๅญ—็š„ไธ“้—จๆต‹่ฏ•๏ผˆ่ฏฅ้กนๅ…ฑ่ฏป 8 ่กŒ๏ผ‰๏ผŒ1 ่กŒๅ‡บ่‡ช่ฎบๆ–‡้‡Œๅซ้šพๅญ—็š„่กŒ๏ผˆ่ฏฅ้กนๅ…ฑ่ฏป 9 ่กŒ๏ผ‰ใ€‚ๅ„่กจ้‡Œ็š„ๆ•ฐๅญ—ๆœฌ่บซๆฒกๆœ‰็”จ PyTorch ็‰ˆ้‡ๆ–ฐ้‡่ฟ‡ใ€‚
  • ่ฏปๅพ—ๅฟซๆ…ขใ€‚ ๅœจๅŒไธ€ๅฐ Mac ็š„ CPU ไธŠ๏ผŒPyTorch ็‰ˆๆฏ่กŒ็บฆ 38 ็ง’๏ผŒๅŠ ่ฝฝ็บฆ 15 ็ง’๏ผŒๅ†…ๅญ˜ๆœ€ๅคšๅ ๅˆฐ็บฆ 8 GBใ€‚่ฟ™ไธช้€Ÿๅบฆๅๆ…ข๏ผšๅฝ“ๆ—ถๆœบๅ™จไธŠ่ฟ˜ๆœ‰ๅˆซ็š„่ฎก็ฎ—ๅœจ่ท‘๏ผŒ่€Œไธ”ๆฒกๆœ‰่ฃ… causal_conv1d ๅ’Œ flash-linear-attention๏ผŒtransformers ็”จ็š„ๆ˜ฏๅฎƒ่‡ชๅธฆ็š„ๆ…ข็š„ๅ‚่€ƒๅฎž็Žฐใ€‚GPU ไธŠๆฒกๆœ‰ๆต‹่ฟ‡ใ€‚

็”จ MLX๏ผˆApple ่Šฏ็‰‡๏ผ‰

base/ ้‡Œๆ˜ฏๆฒกๆœ‰ๆ”นๅŠจ็š„ๅบ•ๆจก๏ผŒ่ฎญ็ปƒๅ‡บๆฅ็š„้ƒจๅˆ†ๅฆๅญ˜๏ผŒ็”ฑไป“ๅบ“้‡Œ็š„ openglyph_ocr.py ๆ‹ผ่ตทๆฅใ€‚ๅชๅ– MLX ็”จๅพ—็€็š„ๆ–‡ไปถ๏ผš

hf download OpenGlyph/OpenGlyph-OCR-0 --local-dir OpenGlyph-OCR-0 \
  --include "base/*" --include "openglyph-ocr-0.safetensors" --include "tokens.json" \
  --include "openglyph_ocr.py" --include "requirements.txt"
cd OpenGlyph-OCR-0
pip install -r requirements.txt
python openglyph_ocr.py line.png
from openglyph_ocr import load, read_line, atoms

ocr = load()                          # ๆœฌๆ–‡ไปถๆ‰€ๅœจ็š„็›ฎๅฝ•
out = read_line(ocr, "line.png")
print(out["text"])                    # ่พ“ๅ‡บ็š„ๆ ทๅญ๏ผšๅ…ถๅญ—ไฝœ<gw:u2ff0-u79c0-u6208>
print(atoms(out["text"]))             # [('text', 'ๅ…ถ'), โ€ฆ, ('glyph', 'u2ff0-u79c0-u6208')]

็‰ˆๆœฌ่ฆ็…ง requirements.txt ่ฃ…๏ผˆmlx 0.32.3ใ€mlx-vlm 0.3.12ใ€transformers 5.18.0ใ€tokenizers 0.23.2๏ผ‰ใ€‚ๅบ•ๆจกๆ˜ฏ 16 ไฝๆตฎ็‚น๏ผŒๆขไบ†็‰ˆๆœฌ็ฎ—ๅ‡บๆฅ็š„ๆ•ฐไผšๆœ‰็ป†ๅพฎๅ‡บๅ…ฅ๏ผŒไธ‹้ข็š„ๆˆ็ปฉๅฐฑไธไธ€ๅฎšๅŽŸๆ ท้‡็Žฐใ€‚requirements.txt ้‡Œ็š„ torch ๅ’Œ torchvision ๅช็”จๆฅ้ข„ๅค„็†ๅ›พๅƒ๏ผŒ็†็”ฑๅŒไธŠใ€‚

่ฏปๅ‡บๆฅ็š„ๅญ—ๅฝขๅ

<gw:NAME> ้‡Œ็š„ NAME ๅฏไปฅ็›ดๆŽฅๅˆฐ https://glyphwiki.org/wiki/NAME ๆŸฅใ€‚ไปฅ u2ff0- ไน‹็ฑปๅผ€ๅคด็š„ๆ˜ฏๆŒ‰ IDS ๅ‘ฝๅ็š„ๅญ—ๅฝข๏ผˆu2ff0-u79c0-u6208 ๅณ โฟฐ็ง€ๆˆˆ๏ผ‰๏ผŒcdp-ใ€cdpo-ใ€cdpn- ๅผ€ๅคด็š„ๆ˜ฏไธญ็ ”้™ข CDP ๅญ—๏ผŒebag_ ๅผ€ๅคด็š„ๆ˜ฏ GlyphWiki ไธŠ ebag ๅ„็ณปๅˆ—็š„ๅญ—ๅฝขใ€‚

ๆˆ็ปฉ

ไปฅไธ‹้ƒฝๆ˜ฏ 2026 ๅนด 11 ๆœˆ็”จ่ฟ™ไธ€ๅฅ—ๆƒ้‡ใ€MLX ็‰ˆ้‡็š„ใ€‚โ€œๅŽŸ็‰ˆโ€ๆŒ‡ Xiaomi-OCR-0 ๅŽŸๆ ทใ€็”จๅฎƒ่‡ชๅทฑ็š„ๆ็คบ่ฏๅŽป่ฏปๅŒๆ ท็š„ๅ›พใ€‚

ๅ››็ฏ‡่ฎบๆ–‡็š„ 398 ่กŒๆ•ด่กŒ๏ผˆ่ฟ™ๅ››็ฏ‡ๆฒกๆœ‰ไธ€่กŒ่ฟ›่ฟ‡่ฎญ็ปƒ๏ผ›ๆฏ่กŒไธญไฝๆ•ฐ 36 ๅญ—๏ผ‰

ๅŽŸ็‰ˆ Xiaomi-OCR-0 OpenGlyph-OCR-0
ๆ•ด่กŒไธ€ๅญ—ไธๅทฎ 261 ่กŒ๏ผˆ65.6%๏ผ‰ 324 ่กŒ๏ผˆ81.4%๏ผ‰
ๅญ—้”™็އ 3.71% 0.90%
ๅซ้šพๅญ—็š„ 208 ่กŒ้‡Œๆ•ด่กŒๅฏน็š„ 104 148
ไธๅซ้šพๅญ—็š„ 190 ่กŒ้‡Œๆ•ด่กŒๅฏน็š„ 157 176

โ€œ้šพๅญ—โ€ๆŒ‡ๅŸบๆœฌๅŒบ้‡Œ่ขซๅˆ†่ฏๅ™จๆ‹†ๆˆไธคไธ‰ไธช่ฎฐๅท็š„ๅญ—๏ผŒๅ’Œๆ‰ฉๅฑ•ๅŒบ็š„ๅญ—ใ€‚

ๆŒ‰ๅญ—็š„็ง็ฑปๅˆ†๏ผˆๅŒๅ››็ฏ‡่ฎบๆ–‡้‡Œๅซ้šพๅญ—็š„ 313 ่กŒ๏ผ‰

ๅŽŸ็‰ˆ OpenGlyph-OCR-0
ๅธธ็”จๅญ— 1995 / 2002 1994 / 2002
ๅŸบๆœฌๅŒบ้‡Œๆ‹†ๆˆไธคไธช่ฎฐๅท็š„ๅญ— 294 / 350 315 / 350
ๆ‰ฉๅฑ•ๅŒบ็š„ๅญ— 0 / 33 11 / 33

ๆ‰ฉๅฑ•ๅŒบๅญ—็š„ไธ“้—จๆต‹่ฏ•๏ผˆ็จ‹ๅบๆŽ’็š„ๅฅๅญ๏ผŒๆฏๅฅๅตŒๅ‡ ไธชๆ‰ฉๅฑ•ๅŒบๅญ—๏ผ‰

ๅŽŸ็‰ˆ OpenGlyph-OCR-0
่ฎญ็ปƒๆฒก็”จ่ฟ‡็š„ๅญ—ไฝ“๏ผŒ849 ไธชๆ‰ฉๅฑ•ๅŒบๅญ— 0 396๏ผˆ46.6%๏ผ‰
่ฎญ็ปƒ็”จ่ฟ‡็š„ๅญ—ไฝ“๏ผŒ327 ไธช 0 201๏ผˆ61.5%๏ผ‰

GlyphWiki ๅญ—ๅฝข็š„ไธ“้—จๆต‹่ฏ•๏ผˆ็จ‹ๅบๆŽ’็š„ๅฅๅญ๏ผŒๆฏ็ป„ 1,000 ไธชๆฒกๆœ‰็ ไฝ็š„ๅญ—ๅฝข๏ผ›ๅŽŸ็‰ˆๆฒกๆœ‰่ฟ™ไบ›่ฎฐๅท๏ผŒๆ— ไปŽๅ†™ๅ‡บ๏ผ‰

ๅ†™ๅฏน
็ฌ”็”ปๅŠ ็ฒ—ใ€่ฎญ็ปƒๆฒก่ง่ฟ‡็š„ๅญ—ๆ ท 607 / 1000
่ฎญ็ปƒๆ—ถ็š„ๅญ—ๆ ท 619 / 1000

็ฌฌไธ€็ป„ๆฒกๅ†™ๅฏน็š„ 393 ไธช้‡Œ๏ผŒ280 ไธช่ขซ่ฏปๆˆไธ€ไธชๆœ‰็ ไฝ็š„ๅญ—๏ผŒ112 ไธช่ขซ่ฏปๆˆๅฆไธ€ไธชๅญ—ๅฝข๏ผŒ1 ไธชๆผๆމใ€‚

ไธ€ๆœฌไนฆ็š„ๅ››้กตๆ‰ซๆ๏ผˆ93 ่กŒ๏ผ‰

ๅŽŸ็‰ˆ OpenGlyph-OCR-0
ไธๅซๆ— ็ ไฝๅญ—ๅฝข็š„ 66 ่กŒ้‡Œๆ•ด่กŒๅฏน็š„ 36 42
ๅŒไธŠ๏ผŒไธ่ฎกๆ ‡็‚นใ€ๆ•ฐๅญ—ใ€่ฅฟๆ–‡็š„ๅ…จ่ง’ๅŠ่ง’ไน‹ๅˆซ 54 59
37 ๅค„ๆ— ็ ไฝ็š„ๅญ—ๅฝข้‡Œๅ†™ๅฏน็š„ 0 9

ๆฏ›็—…

  • ๆ‰ฉๅฑ•ๅŒบ็š„ๅญ—ไผš่ขซ่ฏปๆˆๅฝข่ฟ‘็š„ GlyphWiki ๅญ—ๅฝขใ€‚ ๅŠ ่ฟ›้‚ฃไธƒไธ‡ๅคšไธชๅญ—ๅฝขไน‹ๅ‰๏ผŒไธŠ้ขไธค้กนๆ‰ฉๅฑ•ๅŒบๆต‹่ฏ•ๆ˜ฏ 498 ๅ’Œ 241๏ผŒๅŠ ่ฟ›ไน‹ๅŽ้€€ๅˆฐ 396 ๅ’Œ 201๏ผ›่ฟ™ไธค็ป„ๆต‹่ฏ•้‡Œไธ€ๅ…ฑๅ‡ญ็ฉบๅ†™ๅ‡บ 190 ไธชๅญ—ๅฝข่ฎฐๅทใ€‚ๅœจ็œŸๅฎž่ฎบๆ–‡็š„ 398 ่กŒ้‡Œ๏ผŒๅ‡ญ็ฉบๅ†™ๅ‡บ็š„ๅญ—ๅฝข่ฎฐๅทๅชๆœ‰ 2 ๅค„ใ€‚
  • ๆฒกๆœ‰็ ไฝ็š„ๅญ—ๅฝขๅช่ฎคๅพ— GlyphWiki ๅทฒ็ปๆ”ถไบ†็š„ใ€‚ ไฝœ่€…่‡ชๅทฑๆ–ฐ้€ ใ€GlyphWiki ๆฒกๆœ‰็š„ๅญ—๏ผŒๅฎƒไผš่ฏปๆˆไธ€ไธชๅฝข่ฟ‘็š„ๅญ—ๆˆ–ๅญ—ๅฝขใ€‚
  • ๅญ—ๅฝข็š„ๆˆ็ปฉไธป่ฆๆฅ่‡ช็จ‹ๅบๆŽ’็š„ๅฅๅญใ€‚ ็œŸๅฎžๅฐๅˆทๅ“้‡Œ่ฟ™็ฑปๅญ—ๅฝขๅชๅœจ้‚ฃๅ››้กตๆ‰ซๆไธŠ้‡่ฟ‡ 37 ๅค„ใ€‚
  • ๅธธ็”จๅญ—ๅŸบๆœฌๆฒกๆœ‰ๅ˜ๅŒ–๏ผˆ็œŸๅฎž่กŒ้‡Œ 1995 ๅฏน 1994๏ผ‰๏ผŒๆ้ซ˜ๆฅ่‡ช้šพๅญ—ใ€‚
  • ่ฏปๅพ—ๅฟซๆ…ข๏ผˆMLX ็‰ˆ๏ผ‰๏ผšๅœจไธ€ๅฐ 24 GB ๅ†…ๅญ˜็š„ Apple ่Šฏ็‰‡ Mac ไธŠ๏ผŒๅ…จ้ƒจ 1,639 ่กŒๆต‹่ฏ•ๅ…ฑ็”จ 1,051 ็ง’๏ผŒๅนณๅ‡ๆฏ่กŒ็บฆ 0.6 ็ง’ใ€‚

ๅฎƒๆ˜ฏๆ€Žไนˆๆฅ็š„

  1. ๅบ•ๆจก Xiaomi-OCR-0๏ผˆ0.8B๏ผŒQwen3.5 ๆžถๆž„๏ผ‰ๅŽŸๆ ทไธๅŠจใ€‚

  2. ๅœจๆœ€ๅŽๅ…ญๅฑ‚่ฏญ่จ€ๅฑ‚็š„ๆฏไธช็บฟๆ€งๆ˜ ๅฐ„ไธŠๅŠ ็งฉไธบ 8 ็š„ LoRAใ€‚

  3. ่ง†่ง‰ๅก”็š„ๆœ€ๅŽๅ››ๅฑ‚ๅ’Œๅˆๅนถๅฑ‚้‡ๆ–ฐ่ฎญ็ปƒ่ฟ‡๏ผˆ32 ไฝๆตฎ็‚น๏ผ‰ใ€‚

  4. ๆ–ฐๅขž 159,052 ไธช่พ“ๅ‡บ่ฎฐๅท๏ผŒๅ„ๆœ‰่‡ชๅทฑ็š„่พ“ๅ‡บ่กŒๅ’Œๅ็ฝฎ๏ผš

    • 229 ไธช ebag_s ็›ฎๅฝ•ๅญ—ๅฝข๏ผ›
    • 80,992 ไธชๆ‰ฉๅฑ•ๅŒบๆฑ‰ๅญ—๏ผŒๅณๆ‰ฉๅฑ• A ่‡ณ J ๅŒบ้‡Œ Jigmo ๅญ—ไฝ“็”ปๅพ—ๅ‡บ็š„ๆฏไธ€ไธชๅญ—๏ผˆA 6,592ใ€B 42,720ใ€C 4,160ใ€D 222ใ€E 5,774ใ€F 7,473ใ€G 4,939ใ€H 4,192ใ€I 622ใ€J 4,298๏ผ‰๏ผ›
    • 77,831 ไธชๆฒกๆœ‰็ ไฝ็š„ GlyphWiki ๅญ—ๅฝข๏ผˆๆŒ‰ IDS ๅ‘ฝๅ็š„ 55,341 ไธช๏ผŒebag ๅ„็ณปๅˆ— 21,275 ไธช๏ผŒCDP 1,215 ไธช๏ผ‰ใ€‚

    ่ฟ™ไบ›่ฎฐๅท็š„่พ“ๅ…ฅ่กŒๆฒกๆœ‰่ฎญ็ปƒ๏ผŒๅ…จๆ˜ฏๅŒไธ€ไธชๅ‘้‡ใ€‚

่ฎญ็ปƒ็”จ็š„่กŒไธป่ฆๆ˜ฏไธค็ฑป๏ผš็”จๅๅ‡ ็งๅญ—ไฝ“ๅ’Œ GlyphWiki ๅญ—ๅฝขๆŽ’ๅ‡บๆฅ็š„ๅฅๅญ๏ผŒๅ ๅคงๅคšๆ•ฐ๏ผ›ไปŽ 26 ็ฏ‡ๅคๆ–‡ๅญ—ๅญฆ่ฎบๆ–‡็š„็”ตๅญ็‰ˆ้‡Œ่ฃๅ‡บ็š„็œŸๅฎž่กŒใ€‚ๆต‹่ฏ•็”จ็š„ๅ››็ฏ‡่ฎบๆ–‡ๅ’Œ้‚ฃๆœฌไนฆ้ƒฝไธๅœจ่ฎญ็ปƒๆๆ–™้‡Œใ€‚ๆœฌไป“ๅบ“ไธๅซไปปไฝ•่ฎญ็ปƒๆˆ–ๆต‹่ฏ•ๆ•ฐๆฎใ€‚

ไป“ๅบ“้‡Œๆœ‰ไป€ไนˆ

็ป™ transformers ็”จ็š„๏ผˆfrom_pretrained ๅชๅ–่ฟ™ไบ›๏ผ‰๏ผš

ๆ–‡ไปถ ๅ†…ๅฎน
model.safetensors ๆ•ดไธชๆจกๅž‹๏ผŒPyTorch ็š„ๆŽ’ๆณ•๏ผšๅบ•ๆจก็š„ๆƒ้‡ๅŽŸๆ ท็…งๆŠ„๏ผŒLoRA ๅนถ่ฟ›ไบ†ๅฎƒๆ‰€ๅœจ็š„ 46 ไธชๆƒ้‡๏ผŒ่ง†่ง‰ๆœซๅ››ๅฑ‚ไธŽๅˆๅนถๅฑ‚ใ€่พ“ๅ‡บๅฑ‚ๆŒ‰่ฎญ็ปƒๅ‡บๆฅ็š„ๅ€ผ๏ผŒ่ฟ™ๅ‡ ้ƒจๅˆ†ๆŒ‰ 32 ไฝๅญ˜ๆ”พ
config.jsonใ€generation_config.json ้…็ฝฎ
modeling_openglyph_ocr.pyใ€configuration_openglyph_ocr.py ่พ“ๅ‡บๅฑ‚ๅธฆๅ็ฝฎ็š„ๆจกๅž‹็ฑป
tokenizer.jsonใ€tokenizer_config.jsonใ€processor_config.jsonใ€chat_template.jinja ๅˆ†่ฏๅ™จ๏ผˆๅทฒๅซๆ–ฐๅขž็š„ 159,052 ไธช่ฎฐๅท๏ผ›ๅŒ่ฎญ็ปƒๆ—ถไธ€ๆ ท๏ผŒไธๅš Unicode ่ง„่ŒƒๅŒ–๏ผ‰ๅ’Œๅ›พๅƒๅค„็†็š„่ฎพ็ฝฎ

็ป™ MLX ็”จ็š„๏ผš

ๆ–‡ไปถ ๅ†…ๅฎน
base/ Xiaomi-OCR-0 ็š„ๅ…ญไธชๆ–‡ไปถ๏ผŒไธ€ๅญ—่Š‚ๆœชๆ”น
openglyph-ocr-0.safetensors ่ฎญ็ปƒๅ‡บๆฅ็š„ๅ…จ้ƒจ 148 ไธชๆ•ฐ็ป„๏ผš่ง†่ง‰ๆœซๅ››ๅฑ‚ไธŽๅˆๅนถๅฑ‚ 54 ไธช๏ผŒLoRA 92 ไธช๏ผŒๆ–ฐๅขž่ฎฐๅท็š„่พ“ๅ‡บ่กŒไธŽๅ็ฝฎ
tokens.json ๆ–ฐๅขž็š„ 159,052 ไธช่ฎฐๅท๏ผŒๆŒ‰็ผ–ๅทๆŽ’ๅˆ—๏ผˆไปŽ 248077 ่ตท๏ผ‰
openglyph_ocr.py ๆŠŠไปฅไธŠไธ‰ๆ ทๆ‹ผๆˆๆจกๅž‹ๅนถ่ฏปไธ€่กŒๅ›พ
requirements.txt ๆต‹้‡ๆ—ถๆ‰€็”จ็š„ๅ„ๅบ“็‰ˆๆœฌ

ๅฆๆœ‰ release.json๏ผŒ่ฎฐ็€ๆฏไธชๆ–‡ไปถ็š„ SHA-256 ๅ’Œๆฅๅކใ€‚

MLX ็‰ˆ้‡Œ่ฎญ็ปƒๅ‡บๆฅ็š„ๆ•ฐ็ป„ๆฒกๆœ‰ๅนถ่ฟ›ๅบ•ๆจก๏ผšๅบ•ๆจกๆ˜ฏ 16 ไฝๆตฎ็‚น๏ผŒๅนถ่ฟ›ๅŽป่ฆ่ˆๅ…ฅ๏ผŒ็ฎ—ๅ‡บๆฅ็š„ๅฐฑไธๆ˜ฏๆต‹้‡ๆ—ถ็š„้‚ฃไธชๆจกๅž‹ไบ†ใ€‚PyTorch ็‰ˆๆŠŠ LoRA ๅนถ่ฟ›ๅŽปไน‹ๅŽๆŒ‰ 32 ไฝๅญ˜ๆ”พ๏ผŒๆฒกๆœ‰่ˆๅ…ฅใ€‚

่ฎธๅฏไธŽๅ‡บๅค„

ๆœฌไป“ๅบ“ๆŒ‰ Apache-2.0 ๅ‘ๅธƒใ€‚base/ ๆ˜ฏ Xiaomi-OCR-0๏ผŒๅ…ถไฝœ่€…ไปฅ Apache-2.0 ๅ‘ๅธƒ๏ผŒๅฎƒๅˆๅปบ็ซ‹ๅœจ Qwen3.5-0.8B-Base ไน‹ไธŠ๏ผ›่ฟ™้‡ŒๅŽŸๆ ท่ฝฌๅ‘๏ผŒๆœชไฝœๆ”นๅŠจใ€‚ๅญ—ๅฝขๅๅ’Œ็”จๆฅๆŽ’ๅญ—็š„ๅญ—ๅฝขๆ•ฐๆฎๆฅ่‡ช GlyphWikiใ€‚ๆœฌๆจกๅž‹ไธๆ˜ฏๅฐ็ฑณๆˆ– Xiaomi-OCR-0 ไฝœ่€…็š„ไบงๅ“๏ผŒไนŸๆœช็ปไป–ไปฌ่ฎคๅฏใ€‚่ฏฆ่ง NOTICEใ€‚


English summary

What it is. Xiaomi-OCR-0 (0.8B, Qwen3.5 architecture, Apache-2.0), unchanged, plus: rank-8 LoRA on every linear map of the last six language layers; the last four vision blocks and the patch merger retrained; and 159,052 added output tokens, each with an output row and a bias of its own โ€” 229 catalog forms, all 80,992 characters of CJK Extensions A to J, and 77,831 GlyphWiki glyphs that have no code point. A glyph without a code point is written <gw:NAME>, NAME being its GlyphWiki name.

What it reads. One line of horizontal printed text cropped from a paper or a book (about 100 to 130 pixels high). It does not read whole pages, and it does not read photographs or rubbings of inscriptions: it reads what scholars print about them. Vertical text and handwriting were not measured.

How to run it. With transformers (PyTorch): AutoModelForImageTextToText.from_pretrained(repo, trust_remote_code=True, dtype=torch.float32) and AutoProcessor.from_pretrained(repo, trust_remote_code=True), then model.read_line(processor, "line.png"); see the code above. trust_remote_code is needed because the output layer has a bias for the added tokens, which the stock Qwen3.5 class lacks; everything else is the stock implementation. Load it in float32: the weights that training changed are stored in float32, and loading in 16-bit floats would round them, which was not measured. Install torchvision: with it the pictures are prepared exactly as they were when the figures were measured; without it transformers falls back to PIL and the pixel values differ by up to two grey levels, which was not measured. With MLX on Apple silicon: base/ holds the untouched base model and the trained arrays are kept apart (openglyph_ocr.py puts them together), because folding them into 16-bit base weights would round them; install the versions in requirements.txt (torch and torchvision are in it for the pictures, as above). The figures below were measured with the MLX form. The two forms hold the same weights but compute in different arithmetic (16-bit activations in MLX, float32 in PyTorch). Before release, 43 test lines were read again with the PyTorch form (CPU, float32): 39 came out with exactly the token ids of the MLX form and 4 did not. In those 4 neither reading is the answer; counted in characters away from the answer, the PyTorch reading is the nearer one in 1, the MLX reading in 1, and they are level in 2 (20 characters away in all for each). Of the 4 that differ, 3 are in the extension-character test (8 lines read there) and 1 is in the papers' lines with hard characters (9 lines read there). The figures themselves were not measured again with the PyTorch form. On the CPU of the same Mac a line took about 38 s (about 8 GB of memory at the most), with other work running on the machine and without causal_conv1d and flash-linear-attention (so with the slow reference kernels of transformers); no GPU was tried.

Measured (November 2026, with the MLX form; "base" is Xiaomi-OCR-0 as released, with its own prompt, on the same pictures):

base this model
398 whole lines from four papers that gave no training line: lines exactly right 261 324
the same lines: character error rate 3.71% 0.90%
extension characters in test sentences, a font not used in training 0 / 849 396 / 849
GlyphWiki glyphs in test sentences, strokes thickened beyond anything trained on โ€” 607 / 1000
four scanned book pages: 37 glyphs without a code point 0 9

Known defects. Extension characters are sometimes read as a look-alike GlyphWiki glyph: the two extension-character tests stood at 498 and 241 right before the glyph tokens were added and at 396 and 201 after. Only glyphs that GlyphWiki already holds can be written; a character an author composed anew is read as something that looks like it. The glyph figures come mostly from sentences set by a program. Everyday characters are neither better nor worse than in the base model.

Training lines. Mostly sentences set by a program in a dozen fonts and with GlyphWiki glyphs, and real lines cropped from the born-digital PDFs of 26 palaeography papers. The four test papers and the scanned book gave no training line. No training or test data is in this repository.

Licence. Apache-2.0. base/ is Xiaomi-OCR-0, redistributed unchanged under its Apache-2.0 licence. Not a product of Xiaomi or of the authors of Xiaomi-OCR-0, and not endorsed by them.

Downloads last month
89
Safetensors
Model size
1B params
Tensor type
BF16
ยท
F32
ยท
MLX
Hardware compatibility
Log In to add your hardware

Quantized

Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for OpenGlyph/OpenGlyph-OCR-0

Finetuned
(4)
this model