Instructions to use OpenGlyph/OpenGlyph-OCR-0 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use OpenGlyph/OpenGlyph-OCR-0 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="OpenGlyph/OpenGlyph-OCR-0", trust_remote_code=True) messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("OpenGlyph/OpenGlyph-OCR-0", trust_remote_code=True, device_map="auto") - MLX
How to use OpenGlyph/OpenGlyph-OCR-0 with MLX:
# Make sure mlx-vlm is installed # pip install --upgrade mlx-vlm from mlx_vlm import load, generate from mlx_vlm.prompt_utils import apply_chat_template from mlx_vlm.utils import load_config # Load the model model, processor = load("OpenGlyph/OpenGlyph-OCR-0") config = load_config("OpenGlyph/OpenGlyph-OCR-0") # Prepare input image = ["http://images.cocodataset.org/val2017/000000039769.jpg"] prompt = "Describe this image." # Apply chat template formatted_prompt = apply_chat_template( processor, config, prompt, num_images=1 ) # Generate output output = generate(model, processor, formatted_prompt, image) print(output) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- vLLM
How to use OpenGlyph/OpenGlyph-OCR-0 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "OpenGlyph/OpenGlyph-OCR-0" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenGlyph/OpenGlyph-OCR-0", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/OpenGlyph/OpenGlyph-OCR-0
- SGLang
How to use OpenGlyph/OpenGlyph-OCR-0 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "OpenGlyph/OpenGlyph-OCR-0" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenGlyph/OpenGlyph-OCR-0", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "OpenGlyph/OpenGlyph-OCR-0" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "OpenGlyph/OpenGlyph-OCR-0", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Pi
How to use OpenGlyph/OpenGlyph-OCR-0 with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "OpenGlyph/OpenGlyph-OCR-0"
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "OpenGlyph/OpenGlyph-OCR-0" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Docker Model Runner
How to use OpenGlyph/OpenGlyph-OCR-0 with Docker Model Runner:
docker model run hf.co/OpenGlyph/OpenGlyph-OCR-0
- Hermes Agent
How to use OpenGlyph/OpenGlyph-OCR-0 with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "OpenGlyph/OpenGlyph-OCR-0"
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default OpenGlyph/OpenGlyph-OCR-0
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use OpenGlyph/OpenGlyph-OCR-0 with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "OpenGlyph/OpenGlyph-OCR-0"
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "OpenGlyph/OpenGlyph-OCR-0" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
# pip install -U transformers accelerate
# Load model directly
from transformers import AutoModel
model = AutoModel.from_pretrained("OpenGlyph/OpenGlyph-OCR-0", trust_remote_code=True, device_map="auto")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 ็งใ
ๅฎๆฏๆไนๆฅ็
ๅบๆจก Xiaomi-OCR-0๏ผ0.8B๏ผQwen3.5 ๆถๆ๏ผๅๆ ทไธๅจใ
ๅจๆๅๅ ญๅฑ่ฏญ่จๅฑ็ๆฏไธช็บฟๆงๆ ๅฐไธๅ ็งฉไธบ 8 ็ LoRAใ
่ง่งๅก็ๆๅๅๅฑๅๅๅนถๅฑ้ๆฐ่ฎญ็ป่ฟ๏ผ32 ไฝๆตฎ็น๏ผใ
ๆฐๅข 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
Quantized
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="OpenGlyph/OpenGlyph-OCR-0", trust_remote_code=True) messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)