At a glance
| Upstream model | zai-org/GLM-OCR (Zhipu AI / Z.ai · 0.9B document OCR VLM) |
|---|---|
| Browser ONNX repo |
onnx-community/GLM-OCR-ONNX
(q4f16 = 658,140,808 B / 658.1 MB with shader-f16;
q4 = 742,376,698 B / 742.4 MB fallback; requires
use_external_data_format: true for the 3 .onnx_data sidecars)
|
| License | MIT |
| Task & architecture |
image-text-to-text · GlmOcrForConditionalGeneration (glm_ocr):
24-layer ViT vision encoder (1024→1536, patch 14, 2×2 spatial merge) +
16-layer GQA text decoder (1536 hidden, 16/8 heads, mRoPE [16,24,24],
vocab 59,392) · processor Glm46VProcessor
|
| Task prompt prefixes |
Text Recognition: (full page Markdown + inline/display math) ·
Formula Recognition: (display LaTeX) ·
Table Recognition: (HTML/Markdown structured tables)
|
| Runtime & backend |
WebGPU required (q4f16 / q4) · isolated local worker pin
(Transformers.js 4.3.2) inside models/glm-ocr/worker.js only. CPU WASM EP fails
GatherBlockQuantized(1) (ERROR_CODE: 9) on embed_tokens
and is disclosed honestly above.
|
1. Live Multimodal OCR Workbench & See Inside
Select a procedural 960×640 document plate below, drop any local PNG/JPEG/WebP scan here,
or paste from clipboard (Ctrl/⌘+V). Zero pixels or text ever leave your browser tab.
Initialise GLM-OCR above on WebGPU to stream structured Markdown, LaTeX, and tables locally.
Document Input Plate
Run GLM-OCR to render streamed headings, pure-DOM LaTeX math (zero CDN), and structured HTML tables here.
See Inside · 3-Session ONNX Runtime Graph & Token Telemetry
GlmOcrForConditionalGeneration splits inference across three WebGPU ONNX Runtime sessions
loaded with use_external_data_format: true. Live session keys and weight shares update on init.
Why GLM-OCR unlocks local document workflows
Classical OCR pipelines emit flat word boxes that lose fraction bars, superscripts, and multi-column
headers. At 658.1 MB (q4f16, MIT), GLM-OCR compresses an
end-to-end layout, equation, and table VLM into a single WebGPU-runnable browser tab:
- Zero-egress sensitive document digitization: convert lab receipts, financial tables, and engineering memos to Markdown/CSV without uploading a byte to third-party APIs.
- Prompt-steerable output grammar: swap between
Text Recognition:,Formula Recognition:, andTable Recognition:on the exact same cached weights. - Pure-DOM zero-CDN rendering: display LaTeX fractions, radicals, integrals, and semantic HTML tables directly with native DOM nodes and WCAG AA design-system tokens.
- Composable local search: feed extracted Markdown blocks straight into
bge-small-en-v1.5(34.7 MB CPU WASM) for offline semantic passage retrieval.
Use-case ladder
1. Basics · Region Crop & Task Prompt Explorer
Drag or arrow-nudge a live crop region across equations and tables, inspect Glm46VProcessor prompts, and verify warm-cache auto-init.
2. Practical · Multi-Page Digitization Queue
Batch-digitize multi-page procedural or uploaded documents with real Pause / Resume / Cancel controls and formula-safe .md/.csv/.json exports.
3. Wild · Prompt Ablation & Legibility Audit
Measure CER and token stability across rotated scans, faded contrast, dense notebook grids, and alternate task prefixes.
4. Multi-model · GLM-OCR → bge-small-en-v1.5 Search
Extract structured Markdown sections with GLM-OCR (658.1 MB WebGPU) and index/query them semantically with bge-small-en-v1.5 (34.7 MB CPU WASM).
How the API works
Load AutoProcessor and GlmOcrForConditionalGeneration from
onnx-community/GLM-OCR-ONNX inside an isolated Web Worker (Transformers.js 4.3.2) with
device: "webgpu", dtype: "q4f16" (or "q4"), and
use_external_data_format: true, then stream tokens via TextStreamer.