Download tt_kernel_manifest.json from changh95/GLM-OCR: direct link, hf CLI and curl.
- Browser
- Download file 26 kB
-
https://huggingface.co/changh95/GLM-OCR/resolve/main/tt_kernel_manifest.json
- Command line
-
hf download hf://changh95/GLM-OCR/tt_kernel_manifest.json
-
curl -L -o tt_kernel_manifest.json https://huggingface.co/changh95/GLM-OCR/resolve/main/tt_kernel_manifest.json
26 kB
| { | |
| "schema_version": "5.1", | |
| "name": "glm-ocr", | |
| "tt_metal_version": "0.65.2.dev11169+g44d66500520", | |
| "arch": "blackhole", | |
| "device_count": 1, | |
| "producer": { | |
| "tt_kernel_version": "0.1.0", | |
| "created_at": "2026-12-01T04:23:05.744275+00:00", | |
| "hostname": "hchang-bh" | |
| }, | |
| "weights": { | |
| "repo_id": "zai-org/GLM-OCR", | |
| "revision": "2e85a62840ccac27daa451df36c736c4636b8628", | |
| "allow_patterns": [ | |
| "model.safetensors", | |
| "config.json", | |
| "generation_config.json", | |
| "tokenizer.json", | |
| "tokenizer_config.json", | |
| "preprocessor_config.json", | |
| "processor_config.json", | |
| "chat_template.jinja", | |
| "README.md" | |
| ], | |
| "ignore_patterns": null, | |
| "repo_type": "model" | |
| }, | |
| "auxiliary_weights": [], | |
| "mesh": null, | |
| "entrypoint": null, | |
| "resources": null, | |
| "capabilities": null, | |
| "env": {}, | |
| "bundled": null, | |
| "deps": null, | |
| "container": { | |
| "image": { | |
| "registry": "hf", | |
| "repository": "glm-ocr", | |
| "tag": "tt-model/glm-ocr:39a2313f0b22", | |
| "digest": "sha256:39a2313f0b2200f281b831411bc4c9f6ebaae3580eb79d5fc5e0d55ca804fe39" | |
| }, | |
| "kind": "tt-dit-server", | |
| "runtime": { | |
| "app": "tt_glmocr.server.app:app", | |
| "mesh_shape_env": "TT_MESH_SHAPE", | |
| "packages": [ | |
| "numpy>=1.24.4,<2", | |
| "safetensors==0.8.0", | |
| "huggingface_hub==1.16.1", | |
| "tokenizers==0.22.2", | |
| "pillow==12.3.0", | |
| "fastapi==0.142.2", | |
| "uvicorn==0.54.0" | |
| ], | |
| "lock": "requirements.lock" | |
| }, | |
| "serve": { | |
| "hardware": "p150", | |
| "mesh_device": "P150", | |
| "port": 20000, | |
| "max_model_len": null, | |
| "max_num_seqs": null, | |
| "block_size": null, | |
| "server_timeout": null, | |
| "capabilities": null, | |
| "additional_config": {}, | |
| "args": [], | |
| "env": { | |
| "TT_WEIGHTS_REVISION": "2e85a62840ccac27daa451df36c736c4636b8628", | |
| "TT_METAL_VISIBLE_DEVICES": "0", | |
| "TT_DEVICE_ID": "0", | |
| "HF_HUB_DISABLE_IMPLICIT_TOKEN": "1", | |
| "GLMOCR_BACKEND": "device", | |
| "GLMOCR_DISPATCH": "eth", | |
| "GLMOCR_ENGINE": "vis=ttnn,pre=ttnn,dec=mk", | |
| "GLMOCR_PRECISION": "", | |
| "GLMOCR_MAX_IMAGE_TOKENS": "6144", | |
| "GLMOCR_MAX_PROMPT_TOKENS": "1024", | |
| "GLMOCR_MAX_CONTEXT": "10240", | |
| "GLMOCR_MAX_NEW_TOKENS": "8192", | |
| "GLMOCR_DEFAULT_MAX_NEW_TOKENS": "4096", | |
| "GLMOCR_VISION_BUCKETS": "", | |
| "GLMOCR_PREFILL_BUCKETS": "", | |
| "GLMOCR_K_MAX": "64", | |
| "GLMOCR_LOOP_STEPS": "8", | |
| "GLMOCR_QUEUE_DEPTH": "8", | |
| "GLMOCR_QUEUE_TIMEOUT_S": "300", | |
| "GLMOCR_MAX_BODY_MB": "64", | |
| "GLMOCR_MAX_INPUT_MEGAPIXELS": "50", | |
| "GLMOCR_ALLOW_URLS": "0", | |
| "GLMOCR_URL_TIMEOUT_S": "15", | |
| "GLMOCR_TORCH_THREADS": "4", | |
| "GLMOCR_TRACE_REGION_MB": "512", | |
| "GLMOCR_CACHE_DIR": "/weight-cache" | |
| } | |
| }, | |
| "serve_profiles": [ | |
| { | |
| "hardware": null, | |
| "mesh_device": null, | |
| "port": null, | |
| "max_model_len": null, | |
| "max_num_seqs": null, | |
| "block_size": null, | |
| "server_timeout": null, | |
| "capabilities": null, | |
| "additional_config": {}, | |
| "args": [], | |
| "env": {}, | |
| "name": "default", | |
| "description": null | |
| } | |
| ], | |
| "default_profile": null, | |
| "code_dir": "code", | |
| "verify": [ | |
| "assert 'single_chip_arch_1cq_no_dispatch_s' in open('/opt/tt-metal/tt_metal/impl/dispatch/topology.cpp').read()", | |
| "assert 'dual_kernel_min_dram_dest_page_bytes' in open('/opt/tt-metal/ttnn/cpp/ttnn/operations/data_movement/reshape_view/device/reshape_rm_program_factory.cpp').read()", | |
| "from tt_glmocr.ttaw.device import eth_dispatch_patch_present as p; assert p(), 'the ETH patch is not visible'", | |
| "import sys, tt_glmocr.server.app as a; assert a.app and 'ttnn' not in sys.modules and 'torch' not in sys.modules, 'the server module must import without ttnn / torch'", | |
| "from tt_glmocr.server.app import parse_mesh_shape as p; assert p('1x1') == p('(1, 1)') == p('1,1') == (1, 1)", | |
| "from tt_glmocr.server.app import load_config; c = load_config({'GLMOCR_ENGINE': 'vis=ttnn,pre=ttnn,dec=ttnn', 'GLMOCR_DISPATCH': 'eth', 'TT_MODEL_WEIGHTS_REVISION': '2e85a62840ccac27daa451df36c736c4636b8628'}); assert (c.backend, c.dispatch, c.revision, c.max_image_tokens, c.kv_positions, c.vis_buckets[-1], c.pre_buckets[-1]) == ('device', 'eth', '2e85a62840ccac27daa451df36c736c4636b8628', 6144, 10240, 24576, 7296), c", | |
| "from tt_glmocr.server.app import load_config as L\nfor bad in ({'GLMOCR_BACKEND': 'gpu'}, {'GLMOCR_ENGINE': 'dec=gpu'}, {'GLMOCR_DISPATCH': 'pcie'}, {'GLMOCR_MAX_IMAGE_TOKENS': '7000'}, {'GLMOCR_MAX_CONTEXT': '4096'}, {'GLMOCR_VISION_BUCKETS': '1000'}, {'GLMOCR_K_MAX': '65'}, {'TT_MESH_SHAPE': '1x2'}):\n try:\n L(bad)\n except RuntimeError:\n continue\n raise AssertionError(bad)", | |
| "from tt_glmocr import config as C; assert (C.WEIGHTS_REPO, C.WEIGHTS_REVISION) == ('zai-org/GLM-OCR', '2e85a62840ccac27daa451df36c736c4636b8628')", | |
| "from tt_glmocr import config as C; from tt_glmocr.api import GlmOcr\nm = GlmOcr.from_config(C.resolve_config({'GLMOCR_BACKEND': 'fake'}))\nr = m.ocr('/opt/tt-metal/tt_glmocr/samples/line_en/sample.png'); assert r.finish_reason == 'stop' and r.text and r.image['image_tokens'] == 50, r\ns = m.ocr_stream('/opt/tt-metal/tt_glmocr/samples/table_sales/sample.png', task='table'); assert ''.join(s) == s.result.raw_text and s.result.text.startswith('<table>')\nr = m.ocr('/opt/tt-metal/tt_glmocr/samples/formula_quad/sample.png', task='extract', schema={'a': ''}, output_format='json'); assert r.json == {'a': 'fake'}, r", | |
| "import tokenizers, PIL, safetensors, huggingface_hub; assert (tokenizers.__version__, PIL.__version__, safetensors.__version__, huggingface_hub.__version__) == ('0.22.2', '12.3.0', '0.8.0', '1.16.1')", | |
| "from tt_glmocr.tt.model import GlmOcrDevice as D, EngineConfig as E; miss = [n for n in ('generate', 'capture', 'release', 'teacher_forced') if not callable(getattr(D, n, None))]; assert not miss, miss; from tt_glmocr import config as C; C.resolve_config({'GLMOCR_ENGINE': 'dec=mk'}).engine_config(); C.resolve_config({}).engine_config()", | |
| "from pathlib import Path; t = Path('/opt/tt-metal/tt_glmocr/tt'); assert all((t / f).is_file() for f in ('model.py', 'ttnn_vision.py', 'ttnn_decoder.py', 'mk_dec/engine.py', 'mk_dec/kernels/md_brisc.cpp', 'mk_dec/kernels/md_ncrisc.cpp', 'mk_dec/kernels/md_trisc.cpp', 'mk_dec/kernels/md_defs.hpp', 'mk_dec/kernels/md_dm.hpp', 'mk_dec/kernels/sampler.hpp'))", | |
| "import hashlib, json; from pathlib import Path\nfor n in ('line_en', 'table_sales', 'formula_quad'):\n d = Path('/opt/tt-metal/tt_glmocr/samples', n); m = json.loads((d / 'sample.json').read_text()); assert hashlib.sha256((d / m['file']).read_bytes()).hexdigest() == m['sha256'] and (d / 'PROVENANCE.md').is_file()", | |
| "from pathlib import Path; d = Path('/opt/tt-metal/tt_glmocr/licenses'); assert 'Apache License' in (d / 'LICENSE-APACHE-2.0.txt').read_text() and 'MIT License' in (d / 'LICENSE-MIT-GLM-OCR.txt').read_text() and 'GLM-OCR' in (d / 'NOTICE.md').read_text()", | |
| "from pathlib import Path; assert all(Path('/opt/tt-metal', p).is_file() for p in ('tt_glmocr/server/smoke_test.py', 'tt_glmocr/server/client.py', 'scripts/container_smoke.sh', 'PYTHON.md'))", | |
| "import numpy; assert int(numpy.__version__.split('.')[0]) < 2, numpy.__version__", | |
| "import torch; assert torch.__version__.startswith('2.11.0'), torch.__version__", | |
| "import ttnn; assert all(hasattr(ttnn, a) for a in ('DispatchCoreConfig', 'begin_trace_capture', 'end_trace_capture', 'execute_trace', 'release_trace', 'copy_host_to_device_tensor', 'fill_cache', 'argmax', 'embedding')) and all(hasattr(ttnn.experimental, a) for a in ('rotary_embedding_hf', 'paged_fused_update_cache', 'nlp_create_qkv_heads_decode')) and hasattr(ttnn.transformer, 'scaled_dot_product_attention_decode')" | |
| ], | |
| "built": { | |
| "image": "tt-model/glm-ocr:39a2313f0b22", | |
| "repo": "changh95/GLM-OCR", | |
| "tt_model_version": "0.1.0", | |
| "created_at": "2026-12-01T04:10:18+00:00", | |
| "tt_metal": { | |
| "sha": "44d66500520fda9f2c7060c0f6b41ec48f7ab37e", | |
| "describe": "v0.80.0-dev20261006-78-g44d6650052-dirty", | |
| "dirty": true, | |
| "scm_version": "0.65.2.dev11169+g44d66500520", | |
| "mode": "local", | |
| "remote": "https://github.com/tenstorrent/tt-metal.git", | |
| "branch": "main", | |
| "pushed": true | |
| }, | |
| "code_sha256": "569ad3c1032021b8576502249b53e3293a30c02f36b9ee90089e961e41384551", | |
| "image_digest": "sha256:39a2313f0b2200f281b831411bc4c9f6ebaae3580eb79d5fc5e0d55ca804fe39" | |
| }, | |
| "card": { | |
| "description": "GLM-OCR (0.9B parameters) reads documents: it returns the text of an image, tables as HTML, formulas as LaTeX, and fills a JSON schema with the information it finds (\"information extraction\"). It is a CogViT vision encoder (0.4B parameters, 24 transformer blocks over 14 x 14-pixel patches, 2 x 2 patches merged into one token) whose output enters a GLM-0.5B text decoder (16 layers, 3D rotary positions) as image tokens; the decoder writes the answer token by token. Images are resized with the official rule to at most 6144 image tokens (about 4.8 megapixels). The package includes the official image preprocessing, prompt template and stop tokens, the model card's task prompts and information-extraction prompt, and the Markdown clean-up of the official SDK. The vision encoder and the prefill run on the device as traced tt-nn graphs, one per size bucket, and the decoder writes every token as one launch of a decoder megakernel (bfp8 decoder weights, bf16 output head; on-device greedy decoding / sampling / repetition penalty and the stop rule); image decoding and resizing run on the host CPU.", | |
| "attribution": "Derived from Z.ai's [GLM-OCR](https://huggingface.co/zai-org/GLM-OCR) ([technical report](https://arxiv.org/abs/2603.10910)), with unmodified weights downloaded from the authors' repository. Official SDK: [zai-org/GLM-OCR](https://github.com/zai-org/GLM-OCR). This is a third-party port, not affiliated with or endorsed by Z.ai / Zhipu AI. See the original model card for training details.", | |
| "prerequisites": "- About 2.7 GB of free disk for the checkpoint (fetched once into the Hugging Face cache), plus the container image\n- Images as PNG, JPEG, WebP, BMP, TIFF or GIF (the first frame); PDF pages must be rendered to images first\n", | |
| "quickstart": "On the port `tt serve` reported:\n\n```bash\ncurl -sLO https://huggingface.co/changh95/GLM-OCR/resolve/main/code/tt_glmocr/samples/line_en/sample.png\ncurl -s localhost:20000/ocr -F file=@sample.png\n# {\"model\": \"glm-ocr\", \"text\": \"Invoice No. 2026-0417, due 15 December 2026.\", \"finish_reason\": \"stop\", ...} (the p150 output; identical to the float32 reference)\ncurl -s localhost:20000/ocr -F file=@sample.png -F task=extract -F format=json \\\n --form-string 'schema={\"invoice_number\": \"\", \"due_date\": \"\"}'\ncurl -sN localhost:20000/ocr -F file=@sample.png -F stream=true # SSE text deltas\n```\n", | |
| "architecture": null, | |
| "status": null, | |
| "intended_use": "Document OCR on one Tenstorrent p150, one request at a time: the text, tables and formulas of a page or a crop, and structured fields from forms, invoices or receipts with a JSON schema; for research, prototyping and offline processing.", | |
| "out_of_scope_use": null, | |
| "usage": "`POST /v1/chat/completions` is OpenAI-compatible: the image goes in an `image_url` part as a data URL (base64),\nthe task in a text part (`Text Recognition:` when empty); `stream`, `max_tokens`, `temperature`, `top_p`,\n`seed` and `stream_options.include_usage` work as in the OpenAI API, and the OpenAI Python client works against it:\n\n```python\nimport base64\nfrom openai import OpenAI\nclient = OpenAI(base_url=\"http://localhost:20000/v1\", api_key=\"unused\")\nimage = \"data:image/png;base64,\" + base64.b64encode(open(\"sample.png\", \"rb\").read()).decode()\nr = client.chat.completions.create(model=\"glm-ocr\", messages=[{\"role\": \"user\", \"content\": [\n {\"type\": \"image_url\", \"image_url\": {\"url\": image}}, {\"type\": \"text\", \"text\": \"Table Recognition:\"}]}])\nprint(r.choices[0].message.content)\n```\n\n`POST /ocr` is the native route: multipart (`file` + fields), JSON (`{\"image\": base64 or data URL, ...}`) or the\nraw image as the body (`Content-Type: image/png`, fields as query parameters):\n\n| request field | default | meaning |\n| --- | --- | --- |\n| `file` / `image` | required | the image (one per request) |\n| `task` | `text` | `text` (`Text Recognition:`), `table` (`Table Recognition:`, HTML output), `formula` (`Formula Recognition:`, LaTeX output), `extract` (with `schema`) |\n| `schema` | - | `extract`: a JSON object of the fields to fill, values `\"\"` (nested objects and lists allowed); sent after the model card's extraction preface |\n| `prompt` | the task's | a free prompt instead of the task's (up to `GLMOCR_MAX_PROMPT_TOKENS`; the model is trained on the card's prompts) |\n| `format` | `raw` | `raw` (the model's output), `markdown` (the SDK's clean-up: tables stay HTML, formulas a `$$` block), `json` (the output parsed: `json` field) |\n| `max_new_tokens` | 4096 | 1 .. `GLMOCR_MAX_NEW_TOKENS`; clipped to the KV capacity left after the prompt |\n| `temperature`, `top_k`, `top_p`, `repetition_penalty`, `seed` | 0, 0, 1, 1.0, random | 0 = greedy, the official decoding; `top_k` <= 64; `repetition_penalty` 1 .. 2 (the SDK uses 1.1) |\n| `max_pixels` / `max_image_tokens`, `min_pixels` | 9633792 / 6144, 12544 | the image budget in the official processor units (2 x height x width; 1568 per image token): smaller is faster, larger reads finer print |\n| `stream` | false | Server-Sent Events: `{\"type\": \"delta\", \"text\"}` as tokens are decoded, then `{\"type\": \"done\", ...}` |\n\n- The answer: `text` (in `format`), `raw_text`, `json` / `json_error`, `finish_reason` (`stop` | `length`),\n `usage` (`prompt_tokens`, `image_tokens`, `completion_tokens`), `image` (size before / after resizing, image\n tokens) and `timings` (preprocessing, vision, prefill, first token, decode tokens per second).\n- `GET /health` reports readiness, `GET /info` the weights and their commit, the device, the engines, the\n configuration, the limits, the buckets and the timings of the last request; `GET /v1/models` lists the model.\n- The chat route reads the last user message only (one image, its text parts); `temperature` defaults to 0, not\n OpenAI's 1; `n` other than 1, `stop`, `logprobs`, `tools`, presence / frequency penalties and JSON response\n formats are refused with 400. Image URLs (http / https) are fetched only when `GLMOCR_ALLOW_URLS=1`.\n- Errors: 400 with the reason, 413 body or image too large, 415 content type, 422 malformed body, 429 queue full\n (`Retry-After`), 503 while starting or after `GLMOCR_QUEUE_TIMEOUT_S`, 500 on a device failure.\n- A Python API with the same parameters (`tt_glmocr.api.GlmOcr`) is described in\n [`code/PYTHON.md`](code/PYTHON.md); it needs a tt-metal build with the patches in [`patches/`](patches/).\n\n### Configuration\n\nThe server builds its device programs for one configuration when it starts; change it with environment variables\nand start it again. `GET /info` reports it.\n\n| item | environment variable | values | default |\n| --- | --- | --- | --- |\n| largest image | `GLMOCR_MAX_IMAGE_TOKENS` | 256 .. 6144 image tokens (1568 pixels of `max_pixels` each) | 6144 |\n| longest prompt text | `GLMOCR_MAX_PROMPT_TOKENS` | 16 .. 4096 | 1024 |\n| KV capacity (prompt + output) | `GLMOCR_MAX_CONTEXT` | 1024 .. 32768 positions | 10240 |\n| largest / default `max_new_tokens` | `GLMOCR_MAX_NEW_TOKENS`, `GLMOCR_DEFAULT_MAX_NEW_TOKENS` | 16 .. 32768 | 8192, 4096 |\n| size buckets (one trace each) | `GLMOCR_VISION_BUCKETS` (patches, multiples of 256), `GLMOCR_PREFILL_BUCKETS` (rows, multiples of 128) | comma-separated | derived from the limits |\n| device engines | `GLMOCR_ENGINE` | `vis=ttnn,pre=ttnn,dec=mk` (decoder megakernel) or `dec=ttnn` (tt-nn decoder, 2.4x slower) | `vis=ttnn,pre=ttnn,dec=mk` |\n| weight formats | `GLMOCR_PRECISION` | `vis`, `attn`, `mlp`, `head` = `bf16` / `bfp8` (`vis`, `mlp` also `bfp4`); `vis_fid`, `pre_fid` = `HiFi4` / `HiFi2` / `LoFi`; `mk` (the decoder megakernel) = `bf16` / `bfp8` / `bfp8h8`; `vis_sdpa` = `approx` / `exact` (exponential of the vision attention for images above 512 image tokens, i.e. the vision buckets of 4096 patches and up: exact is 1.8x slower on pages) | `\"\"` = vision bf16 HiFi4 with `vis_sdpa=approx`, prefill attention bf16 / MLP bfp8, `mk=bfp8` (bf16 head) |\n| largest `top_k` | `GLMOCR_K_MAX` | 1 .. 64 | 64 |\n| decode steps per launch | `GLMOCR_LOOP_STEPS` | 1 .. 64 (streaming granularity) | 8 |\n| queue | `GLMOCR_QUEUE_DEPTH`, `GLMOCR_QUEUE_TIMEOUT_S` | waiting requests, seconds | 8, 300 |\n| uploads | `GLMOCR_MAX_BODY_MB`, `GLMOCR_MAX_INPUT_MEGAPIXELS`, `GLMOCR_ALLOW_URLS` | MB, megapixels, 0 / 1 | 64, 50, 0 |\n\n### Example output\n\nThree images rendered for this demo (a table with merged header cells, a formula, a simplified-Chinese notice),\neach sent to this package's container on a p150 as `POST /ocr` with the task shown and otherwise the defaults\n(greedy decoding). The right half of each image draws the answer as returned: the HTML table as a grid, the LaTeX\nas source and re-rendered with matplotlib, the text as is. [`media/demos.json`](media/demos.json) has the exact\nrequests, the whole answers with their timings, and the official float32 model's answers.\n\n\n\n\n\n\n\nThe table's answer (`text` of the response, `\"task\": \"table\"`), as returned:\n\n```html\n<table border=\"1\"><tr><td rowspan=\"2\">Station</td><td colspan=\"4\">Rainfall(mm)</td><td rowspan=\"2\">Total</td></tr><tr><td>Jan</td><td>Feb</td><td>Mar</td><td>Apr</td></tr><tr><td>Harbor</td><td>81.2</td><td>64.5</td><td>70.3</td><td>52.8</td><td>268.8</td></tr><tr><td>Hillside</td><td>95.0</td><td>77.4</td><td>88.1</td><td>60.2</td><td>320.7</td></tr><tr><td>Airport</td><td>58.6</td><td>49.9</td><td>55.0</td><td>41.3</td><td>204.8</td></tr><tr><td>Valley</td><td>72.4</td><td>61.0</td><td>66.7</td><td>47.5</td><td>247.6</td></tr></table>\n```\n\n| input | task | image tokens | output tokens | first token | decoding | whole request (server) | client round trip |\n| --- | --- | --- | --- | --- | --- | --- | --- |\n| table, 788 x 324 | `table` | 336 | 303 | 226 ms | 359 tokens/s | 1.07 s | 1.08 s |\n| formula, 820 x 160 | `formula` | 174 | 62 | 255 ms | 369 tokens/s | 0.42 s | 0.43 s |\n| Chinese notice, 1130 x 442 | `text` | 640 | 61 | 322 ms | 343 tokens/s | 0.50 s | 0.51 s |\n\nThe second request of each input on a warm server (the first gave the same answer); the server times are the\nanswer's `timings` (first token includes the vision encoder and the prefill), the round trip is on loopback. All\nthree answers are identical to the greedy answers of the official float32 model on the CPU (the same weights in\ntransformers 5.24.1), including the missing space in \"Rainfall(mm)\".\n", | |
| "performance": "Agreement with Z.ai's own float32 model on the CPU (transformers\n5.24.1 `GlmOcrForConditionalGeneration`, same weights and prompts, greedy) on synthetic test images (text lines,\na paragraph, an A4 page, a table, formulas, handwriting-style text, Chinese, Korean / Japanese / German, an\nextraction form) and a public-domain manuscript scan:\n\n| eval | this package | float32 CPU reference | images |\n| --- | --- | --- | --- |\n| Vision encoder output PCC | 0.9973 - 0.9999 on line / paragraph / table / formula; 0.9947 / 0.9968 on the two full pages (official bfloat16, emulated: 0.9961 - 0.9999; 0.9968 / 0.9991 on the pages: see the limitations) | 1 | 6 |\n| Next-token distribution, total-variation distance per step, mean (teacher-forced, every step) | 0.00001 - 0.0017, top-1 agreement 100 % (official bfloat16: 0.00001 - 0.0023) | 0 | 11 |\n| Outputs identical to the float32 outputs (greedy) | 11 / 11 (1,134 tokens) | \u2013 | 11 |\n| Character error rate vs the float32 outputs | 0.0 | 0 | 11 |\n\n| speed (batch 1, warm) | input | median | throughput |\n| --- | --- | --- | --- |\n| Vision encoder | 709 x 64 line (50 image tokens) / A4 page at 150 dpi (2772 tokens) / 6144 tokens | 18 ms / 615 ms / 1.73 s | \u2013 |\n| Time to first token | line / paragraph (288 tokens) / A4 page | 30 ms / 100 ms / 718 ms | \u2013 |\n| Decoder time per token | ~300 / ~1000 / ~3000 / ~6000 positions of context | 2.6 / 2.8 / 3.0 / 3.7 ms | 380 / 360 / 330 / 270 tokens/s |\n| Whole page (A4 at 150 dpi, 280 output tokens) | image in, text out | 1.59 s | 0.63 pages/s |\n| Served `POST /ocr`, client round trip | formula / line / table (273 tokens) | 138 ms / 156 ms / 949 ms | \u2013 |\n| Server start (`tt-model serve` until ready) | first start with empty caches (kernel compilation on a busy 8-core host) / restart | about 25 min / 1.5-2 min | \u2013 |\n", | |
| "limitations": "- Not for decisions that need exact text without a human check (legal, medical, financial or identity\n documents): OCR output can miss, misread or invent characters, on the CPU and the p150 alike.\n- No layout analysis: the official SDK's full-document parsing (PP-DocLayoutV3 layout detection, one recognition\n per region, Markdown assembly) is not included; an image is read as one region, so complex multi-column pages\n read best as crops of their regions.\n- One image per request, single-turn prompts, batch 1: requests are served one at a time in arrival order\n (`GLMOCR_QUEUE_DEPTH` may wait). No PDF input.\n- Images are resized to at most 6144 image tokens (about 4.8 megapixels; `max_pixels` lowers it): very small\n print on a large page loses resolution. Aspect ratios of 200 or more are refused.\n- The model is trained on the model card's prompts (text, table, formula, the extraction preface); other prompts\n are accepted but untested.\n- Sampling (`temperature` > 0) draws from at most the 64 most likely tokens (`GLMOCR_K_MAX`); greedy decoding,\n the official default, is exact; sampling and `repetition_penalty` run on the device too (about 340 tokens/s, replays with the same `seed` are identical).\n- One p150 only: device dispatch runs on the chip's Ethernet cores, so multi-chip meshes are not supported.\n- Vision accuracy gate: this package's vision gate asks the image embeddings to stay within 0.001 PCC of the\n official bfloat16 model. It is missed by up to 0.002 PCC on full pages (A4 at 150 dpi: 0.9947 vs the official\n bfloat16 model's 0.9968, emulated on the CPU; the 1863 manuscript page 0.9968 vs 0.9991, emulated; a held-out A4\n page 0.9969 vs 0.9987) and by 0.0007 on one small formula image (190 image tokens, exact exponential: 0.9934 vs\n 0.9951), with either attention setting. The decoded text still matched the float32 reference token for token on\n all of these. Images above 512 image tokens use an approximate exponential in the vision attention by default\n (1.8x faster vision on pages); `GLMOCR_PRECISION=vis_sdpa=exact` uses the exact one: page vision then takes about\n 1.0 s instead of 0.6 s for an A4 page at 150 dpi, for slightly higher embedding fidelity (the page misses shrink\n to 0.0001-0.0007; one test page then flips a near-tie at token 57).\n", | |
| "risks": null, | |
| "licensing": "- Weights (not redistributed here; `tt serve` downloads them from the authors' repository at this commit):\n [zai-org/GLM-OCR](https://huggingface.co/zai-org/GLM-OCR) `2e85a628`, MIT License (the model card). Notices:\n [`code/tt_glmocr/licenses/NOTICE.md`](code/tt_glmocr/licenses/NOTICE.md). The card's full pipeline also uses\n PP-DocLayoutV3 (Apache-2.0), which is not part of this package.\n- This package is a derivative work of GLM-OCR: the inference code is written anew (image preprocessing, prompt\n and 3D positions follow transformers' `glm46v` / `glm_ocr` code, Apache-2.0), the networks run on the device in\n tt-nn operations and a decoder megakernel, and the weights are loaded unmodified. The Markdown clean-up is\n adapted from the official SDK ([zai-org/GLM-OCR](https://github.com/zai-org/GLM-OCR), Apache-2.0). The decoder\n megakernel (`code/tt_glmocr/tt/mk_dec/`) is adapted from the same author's unpublished Qwen3-ASR and Qwen3-TTS\n Tenstorrent ports (their decode megakernels and on-device sampler, Apache-2.0); the tt-nn decoder follows\n patterns of tt-metal's demos (Tenstorrent, Apache-2.0). Related packages by the same author:\n [changh95/DepthPro2](https://huggingface.co/changh95/DepthPro2),\n [changh95/all-MiniLM-L6-v2](https://huggingface.co/changh95/all-MiniLM-L6-v2).\n- Port, server and scripts (`code/`) and the tt-metal patches in [`patches/`](patches/): Apache-2.0.\n- Samples: `code/tt_glmocr/samples/*/sample.png`, synthetic images made for this package (Apache-2.0);\n provenance in their `PROVENANCE.md`.\n- Demo images in `media/`: inputs rendered for this demo from text written for it, and this package's answers,\n CC0 1.0 (fonts: DejaVu, Bitstream Vera licence; Noto Sans CJK SC, SIL OFL 1.1); attributions in\n [`media/ATTRIBUTION.md`](media/ATTRIBUTION.md).\n", | |
| "related": null, | |
| "license": { | |
| "id": "apache-2.0", | |
| "name": null, | |
| "link": null | |
| }, | |
| "pipeline_tag": "image-to-text", | |
| "base_model": [ | |
| "zai-org/GLM-OCR" | |
| ] | |
| } | |
| } | |
| } | |