Image-Text-to-Text
Transformers
Safetensors
MLX
Chinese
openglyph_ocr
feature-extraction
ocr
rare-characters
glyphwiki
palaeography
conversational
custom_code
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"
OpenGlyph-OCR-0: the model in two forms (transformers and MLX), model card, licence
853865d verified Download NOTICE from OpenGlyph/OpenGlyph-OCR-0: direct link, hf CLI and curl.
- Browser
- Download file 2.16 kB
-
https://huggingface.co/OpenGlyph/OpenGlyph-OCR-0/resolve/main/NOTICE
- Command line
-
hf download hf://OpenGlyph/OpenGlyph-OCR-0/NOTICE
-
curl -L -o NOTICE https://huggingface.co/OpenGlyph/OpenGlyph-OCR-0/resolve/main/NOTICE
2.16 kB
| OpenGlyph-OCR-0 | |
| This repository contains, in base/, the model Xiaomi-OCR-0 | |
| (https://huggingface.co/xiaomi-research/Xiaomi-OCR-0), released by its authors under the | |
| Apache License, Version 2.0, and itself built on Qwen3.5-0.8B-Base. The files in base/ | |
| are redistributed unchanged; their SHA-256 hashes are listed in release.json. | |
| model.safetensors is a derivative of that model: its weights with the changes named | |
| below applied. config.json, generation_config.json, tokenizer.json, | |
| tokenizer_config.json, processor_config.json and chat_template.jinja are the files of | |
| Xiaomi-OCR-0 with what those changes need entered (the added tokens, the larger | |
| vocabulary, the output layer of this model); chat_template.jinja is unchanged. | |
| The other files -- openglyph-ocr-0.safetensors (the arrays trained on top of that | |
| model), tokens.json, openglyph_ocr.py, modeling_openglyph_ocr.py, | |
| configuration_openglyph_ocr.py, requirements.txt, release.json and README.md -- are the | |
| work of the OpenGlyph project. That work, and the changes it made in the derived | |
| files, are licensed under the Apache License, Version 2.0 (see LICENSE). | |
| Changes made to Xiaomi-OCR-0: | |
| - LoRA arrays are added to every linear map of the last six language layers; | |
| - the last four vision blocks and the patch merger are replaced by retrained ones; | |
| - 159,052 tokens are added to the tokenizer and to the output of the model, each with | |
| an output row and a bias, so that the output layer is no longer tied to the input | |
| embedding. | |
| In base/ none of this is applied: openglyph_ocr.py applies it when it builds the model. | |
| In model.safetensors it is applied: the LoRA arrays are folded into the 46 weights they | |
| belong to, and those weights, the retrained vision arrays and the output layer are | |
| stored as 32-bit floats; the input embedding has one row more for every added token | |
| (the first of them take the place of 243 unused rows at its end); every other array is | |
| copied from Xiaomi-OCR-0 unchanged. | |
| Glyph names of the form <gw:NAME> are names of glyphs in GlyphWiki (https://glyphwiki.org). | |
| This is not a product of Xiaomi or of the authors of Xiaomi-OCR-0, and is not endorsed | |
| by them. | |