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 release.json from OpenGlyph/OpenGlyph-OCR-0: direct link, hf CLI and curl.
- Browser
- Download file 8.45 kB
-
https://huggingface.co/OpenGlyph/OpenGlyph-OCR-0/resolve/main/release.json
- Command line
-
hf download hf://OpenGlyph/OpenGlyph-OCR-0/release.json
-
curl -L -o release.json https://huggingface.co/OpenGlyph/OpenGlyph-OCR-0/resolve/main/release.json
8.45 kB
| { | |
| "name": "OpenGlyph-OCR-0", | |
| "released": "2026-11-14", | |
| "what": "one model in two forms. At the root, the form transformers loads with from_pretrained: model.safetensors, a checkpoint in the layout of PyTorch, with its configuration, tokenizer and model class. Beside it, the form for MLX: Xiaomi-OCR-0 unchanged (base/), the arrays trained on top of it (openglyph-ocr-0.safetensors) and the tokens added (tokens.json), which openglyph_ocr.py builds the model from", | |
| "base": { | |
| "model": "SeerRay-Lab/Xiaomi-OCR-0", | |
| "obtained_from": "ModelScope official model mirror", | |
| "repository_revision": "c0af34f6", | |
| "changed": false, | |
| "on_the_hugging_face_hub": { | |
| "repository": "xiaomi-research/Xiaomi-OCR-0", | |
| "revision": "bbd8cf8d21f256b3644b44cb860f3a7cecb93c30", | |
| "the_six_files_of_base_are_the_same_by_sha256": true, | |
| "checked_on": "2026-11-14" | |
| } | |
| }, | |
| "trained_arrays": { | |
| "arrays": 148, | |
| "weights": 205304652, | |
| "vision_blocks_8_to_11_and_patch_merger": { | |
| "arrays": 54, | |
| "from_checkpoint": "step-0002048-final-1794217522541640000", | |
| "of_file_with_sha256": "5d61a67eba654bcc9cdceec17725de89704596f040262d6e746193d92720f7ae" | |
| }, | |
| "lora_and_output_rows": { | |
| "arrays": 94, | |
| "from_checkpoint": "step-0011500-balanced-best-1794344748876820000", | |
| "of_file_with_sha256": "1c20cfa0004215544c3c2c8d3e74e315d180b30b97976cd481ebf0415653e337" | |
| }, | |
| "held_bit_for_bit_as_the_checkpoints_hold_them": true | |
| }, | |
| "added_tokens": { | |
| "first_id": 248077, | |
| "catalog_forms": 229, | |
| "extension_characters": 80992, | |
| "glyphwiki_glyphs": 77831, | |
| "vocabulary": 407129 | |
| }, | |
| "lora": { | |
| "rank": 8, | |
| "alpha": 1.0, | |
| "language_layers": [ | |
| 18, | |
| 19, | |
| 20, | |
| 21, | |
| 22, | |
| 23 | |
| ] | |
| }, | |
| "transformers_form": { | |
| "file": "model.safetensors", | |
| "arrays": 490, | |
| "made_from": { | |
| "base/model.safetensors": "d4551e9f6127ac9e35cff7b4f7a72a90410e03e6c8676a36f0e2b7eaeb5d5348", | |
| "openglyph-ocr-0.safetensors": "69c7e631cb6bc85b4cd2451d1a28eedb4a0dd285ad836d31e88deefd82309f35" | |
| }, | |
| "copied_from_the_base_byte_for_byte": 387, | |
| "stored_as_32_bit_floats": { | |
| "weights_with_the_lora_arrays_folded_in": 46, | |
| "retrained_vision_arrays": 54, | |
| "output_layer": [ | |
| "lm_head.weight", | |
| "lm_head.bias" | |
| ] | |
| }, | |
| "input_embedding": "the base's rows for the ids below 248077, then one and the same row for every added token (16-bit floats, as the base's)", | |
| "output_layer": "lm_head.weight: the base's rows, then the trained row of every added token; lm_head.bias: nought, then the trained bias of every added token; not tied to the input embedding", | |
| "every_array_read_back_against_its_source": true, | |
| "load_in": "float32", | |
| "tokenizer": { | |
| "added_tokens": 159052, | |
| "first_id": 248077, | |
| "vocabulary_and_merges": "the base's", | |
| "model_keys_that_differ": [], | |
| "differs_from_tokenizer_json_of_the_base_in": [ | |
| "normalizer", | |
| "pre_tokenizer" | |
| ], | |
| "why": "it is the tokenizer of training, saved: transformers 5.18.0 builds the splitting of Qwen3.5 by itself (its pre_tokenizer), and training had the NFC normalisation switched off. tokenizer_config.json names the class TokenizersBackend so that this file is taken as it stands" | |
| } | |
| }, | |
| "read_with_the_model_before_release": { | |
| "mlx_form": { | |
| "how": "the folder's own loader read lines of five tests again; each had to give the token ids and the text of the measured reading", | |
| "read_from": "the folder as it is uploaded", | |
| "on": "2026-11-14", | |
| "lines": 100, | |
| "read_as_measured": 100, | |
| "by_test": { | |
| "full_lines": { | |
| "lines": 20, | |
| "read_as_measured": 20, | |
| "seconds_a_line": 1.12 | |
| }, | |
| "hard_real_test": { | |
| "lines": 20, | |
| "read_as_measured": 20, | |
| "seconds_a_line": 0.49 | |
| }, | |
| "gw_test": { | |
| "lines": 20, | |
| "read_as_measured": 20, | |
| "seconds_a_line": 0.62 | |
| }, | |
| "ext_test": { | |
| "lines": 20, | |
| "read_as_measured": 20, | |
| "seconds_a_line": 0.66 | |
| }, | |
| "page_p08": { | |
| "lines": 20, | |
| "read_as_measured": 20, | |
| "seconds_a_line": 1.13 | |
| } | |
| }, | |
| "seconds_to_load": 7.0, | |
| "peak_gb": 3.94 | |
| }, | |
| "transformers_form": { | |
| "how": "loaded with AutoModelForImageTextToText.from_pretrained(trust_remote_code=True, dtype=float32); lines of the same tests read with read_line and held against the measured readings, which were made with the MLX form", | |
| "read_from": "the folder as it is uploaded", | |
| "on": "2026-11-14", | |
| "device": "cpu", | |
| "torch": "2.8.0", | |
| "transformers": "5.18.0", | |
| "number_types": [ | |
| "torch.float32" | |
| ], | |
| "status": "stopped at its time limit; the lines read until then are counted", | |
| "lines": 43, | |
| "same_token_ids_as_measured": 39, | |
| "by_test": { | |
| "full_lines": { | |
| "lines": 9, | |
| "same_token_ids": 9 | |
| }, | |
| "hard_real_test": { | |
| "lines": 9, | |
| "same_token_ids": 8 | |
| }, | |
| "gw_test": { | |
| "lines": 9, | |
| "same_token_ids": 9 | |
| }, | |
| "ext_test": { | |
| "lines": 8, | |
| "same_token_ids": 5 | |
| }, | |
| "page_p08": { | |
| "lines": 8, | |
| "same_token_ids": 8 | |
| } | |
| }, | |
| "lines_that_differ": { | |
| "lines": 4, | |
| "the_measured_reading_is_the_answer": 0, | |
| "this_reading_is_the_answer": 0, | |
| "neither_is": 4, | |
| "both_are_through_other_tokens": 0 | |
| }, | |
| "seconds_a_line": 37.86, | |
| "seconds_to_load": 15.1 | |
| } | |
| }, | |
| "measured_with": { | |
| "python": "3.12.13", | |
| "platform": "macOS, Apple silicon", | |
| "mlx": "0.32.3", | |
| "mlx-vlm": "0.3.12", | |
| "mlx-lm": "0.32.0", | |
| "transformers": "5.18.0", | |
| "tokenizers": "0.23.2", | |
| "numpy": "2.5.3", | |
| "pillow": "12.3.0", | |
| "safetensors": "0.8.0", | |
| "torch": "2.8.0", | |
| "torchvision": "0.23.0" | |
| }, | |
| "files": { | |
| "LICENSE": { | |
| "sha256": "cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30", | |
| "bytes": 11358 | |
| }, | |
| "NOTICE": { | |
| "sha256": "d5b6636468e146160e7a28d6e6055e9f781cf25f7575cf215e86c094a4c8f501", | |
| "bytes": 2162 | |
| }, | |
| "README.md": { | |
| "sha256": "7fee5b471f1f3001a8fea621d8728c35dc2f37432dc31dbb7b1588bc0a8ba67d", | |
| "bytes": 15439 | |
| }, | |
| "base/chat_template.jinja": { | |
| "sha256": "273d8e0e683b885071fb17e08d71e5f2a5ddfb5309756181681de4f5a1822d80", | |
| "bytes": 7755 | |
| }, | |
| "base/config.json": { | |
| "sha256": "2eb95982069a24336fe66b3a0869ea5a711aba7566787d4a599654907ecc070c", | |
| "bytes": 2747 | |
| }, | |
| "base/model.safetensors": { | |
| "sha256": "d4551e9f6127ac9e35cff7b4f7a72a90410e03e6c8676a36f0e2b7eaeb5d5348", | |
| "bytes": 1746937856 | |
| }, | |
| "base/processor_config.json": { | |
| "sha256": "d89ef49ce9cd37fbf510158e13c1ef063d9286411c1ec9049932dbe0487143b1", | |
| "bytes": 1191 | |
| }, | |
| "base/tokenizer.json": { | |
| "sha256": "06b9509352d2af50381ab2247e083b80d32d5c0aba91c272ca9ff729b6a0e523", | |
| "bytes": 19989325 | |
| }, | |
| "base/tokenizer_config.json": { | |
| "sha256": "792fa3f0cb88b111e54ef3134c873531008c4df471d108da17903426e308aa7b", | |
| "bytes": 1165 | |
| }, | |
| "chat_template.jinja": { | |
| "sha256": "273d8e0e683b885071fb17e08d71e5f2a5ddfb5309756181681de4f5a1822d80", | |
| "bytes": 7755 | |
| }, | |
| "config.json": { | |
| "sha256": "ce369170e6b1c42923230356b3c1a87ae49f9c0dd0eba719f4271ee5b0b768f9", | |
| "bytes": 3083 | |
| }, | |
| "configuration_openglyph_ocr.py": { | |
| "sha256": "f11da637f204313f177a54e099987aef159d6eec1ce9334c6103f73284c02760", | |
| "bytes": 617 | |
| }, | |
| "generation_config.json": { | |
| "sha256": "c5a3c8614e67c379a09a10522d43bc0a6137bbbf6c32c31528415b9ea92e5b3e", | |
| "bytes": 102 | |
| }, | |
| "model.safetensors": { | |
| "sha256": "b158b9e6b8a6ca236aa648e6ee32d30185764e9a3954a00bb87f531363887b49", | |
| "bytes": 4068916884 | |
| }, | |
| "modeling_openglyph_ocr.py": { | |
| "sha256": "2e892ef75f6d85ce897500d17fd864fa685bd5842b517e03be4c00aaca95e707", | |
| "bytes": 4453 | |
| }, | |
| "openglyph-ocr-0.safetensors": { | |
| "sha256": "69c7e631cb6bc85b4cd2451d1a28eedb4a0dd285ad836d31e88deefd82309f35", | |
| "bytes": 821236272 | |
| }, | |
| "openglyph_ocr.py": { | |
| "sha256": "a597edd13bab6304cb37364456f4630c0e789247bce9dbf357f9029f2af8c768", | |
| "bytes": 13782 | |
| }, | |
| "processor_config.json": { | |
| "sha256": "bfbc24af59a3e73a9cd0653b8d4ae758dfaec4e3e6c15dfb1c6c8ee8d5683c85", | |
| "bytes": 1220 | |
| }, | |
| "requirements.txt": { | |
| "sha256": "8b649edd2bfb0dbe93ce8a4176143eb941cf820e6b570d06e151f63c19c5e85d", | |
| "bytes": 576 | |
| }, | |
| "tokenizer.json": { | |
| "sha256": "6b0afa98d4b6b1803326ffbbd0af210fbee81aeb9fee18ef83d6626f3ebd27a1", | |
| "bytes": 50448682 | |
| }, | |
| "tokenizer_config.json": { | |
| "sha256": "69dcb12d80d243f24e7808985b772b62625fdb8fd92644b59c1e679c6c1e81e8", | |
| "bytes": 1191 | |
| }, | |
| "tokens.json": { | |
| "sha256": "50165ec65b8a5a358b684cd84519ff6487eea3b8902cffac01843aebe3248368", | |
| "bytes": 2784718 | |
| } | |
| } | |
| } | |