tc-mb commited on
Commit
a1380a6
·
verified ·
1 Parent(s): 1e6c0d2

remove readme

Browse files
Files changed (1) hide show
  1. README.md +0 -133
README.md DELETED
@@ -1,133 +0,0 @@
1
- ---
2
- license: apache-2.0
3
- pipeline_tag: image-text-to-text
4
- tags:
5
- - minicpm-ocr
6
- - ocr
7
- - document-parsing
8
- - multimodal
9
- - vision-language
10
- ---
11
-
12
- # MiniCPM-OCR 1.0
13
-
14
- **MiniCPM-OCR 1.0** is a compact end-to-end document OCR model. It reads a page (or a cropped
15
- document element) and returns its text in reading order, with dedicated output modes for tables
16
- and display formulas, so a layout model + MiniCPM-OCR 1.0 is enough to rebuild a page as Markdown.
17
-
18
- - **1.3B parameters (778M language + 522M vision), bf16, 2.6 GB** — a single 2.6 GB checkpoint that
19
- fits comfortably on one consumer GPU.
20
- - **4x visual-token compression.** Visual tokens are compressed early inside the vision encoder
21
- (insertion at layer 6, in the spirit of [LLaVA-UHD v4](https://github.com/THUMAI-Lab/LLaVA-UHD-v4)),
22
- and the projector emits 4x-compressed tokens. This release ships **4x only**, which is also the
23
- configuration used for the GGUF build.
24
- - **Element-level prompts.** The same checkpoint handles plain text, tables and formulas; the task is
25
- selected by the prompt (`Text Recognition:` / `Table Recognition:` / `Formula Recognition:`), so it
26
- slots directly behind any document layout model.
27
- - **Slicing for large pages.** `scale_resolution = 448`, `patch_size = 14`, up to 9 slices per page,
28
- with the 4x compression keeping the prompt budget low on dense A4/letter pages.
29
- - **Hybrid text backbone.** 24 layers built from 18 linear-attention and 6 full-attention layers
30
- (interval 4), 262144-token context, tied embeddings, no MTP head.
31
-
32
- > **Transformers support:** `model_type` is `minicpm_ocr` and is **not** part of any released
33
- > `transformers` version yet (checked up to 5.20.2), and this repository intentionally ships **no
34
- > modeling code / no `auto_map`**. `AutoModelForImageTextToText` / `AutoProcessor` will therefore not
35
- > load this checkpoint. Use one of the runtimes below.
36
-
37
- ## Model architecture
38
-
39
- | Component | Value |
40
- |---|---|
41
- | Total parameters | 1.30B (bfloat16) |
42
- | Language model | Qwen3.5-style hybrid stack, 24 layers (18 linear + 6 full attention), hidden 1024, 8 heads / 2 KV heads, head_dim 256, partial rotary 25% |
43
- | Context length | 262144 |
44
- | Vocabulary | 248100 (tied embeddings) |
45
- | Vision encoder | SigLIP-style ViT, 27 layers, hidden 1152, patch 14, attention 16 heads, early compression at layer 6 |
46
- | Visual tokens | 4x downsample (`projector scale_factor = 2`) |
47
- | Preprocessing | `scale_resolution = 448`, `max_slice_nums = 9`, slice mode on, mean/std 0.5 |
48
- | Special tokens | `image_token_id = 248056`, `video_token_id = 248057`, `bos = 248045`, `eos = 248046` |
49
-
50
- ## Supported runtimes
51
-
52
- | Runtime | Status for this release |
53
- |---|---|
54
- | **llama.cpp / GGUF** | Supported — see [MiniCPM-OCR-1.0-gguf](https://huggingface.co/openbmb/MiniCPM-OCR-1.0-gguf) (4x mmproj). Requires a llama.cpp build that includes MiniCPM-OCR 1.0 support (`projector_type = minicpm_ocr`). |
55
- | **SGLang** | Supported — requires SGLang with MiniCPM-OCR 1.0 support. |
56
- | **vLLM** | Support is being upstreamed; **not** part of this release. |
57
- | **Transformers** | Not supported yet (see note above). |
58
-
59
- ## Quick start
60
-
61
- ### SGLang
62
-
63
- ```bash
64
- python -m sglang.launch_server \
65
- --model-path openbmb/MiniCPM-OCR-1.0 \
66
- --host 127.0.0.1 --port 30000 \
67
- --mem-fraction-static 0.45
68
- ```
69
-
70
- ```python
71
- from openai import OpenAI
72
-
73
- client = OpenAI(base_url="http://127.0.0.1:30000/v1", api_key="EMPTY")
74
- resp = client.chat.completions.create(
75
- model="openbmb/MiniCPM-OCR-1.0",
76
- messages=[{
77
- "role": "user",
78
- "content": [
79
- {"type": "image_url", "image_url": {"url": "data:image/png;base64,<BASE64_PAGE>"}},
80
- {"type": "text", "text": "Text Recognition:"},
81
- ],
82
- }],
83
- max_tokens=8192,
84
- temperature=0.0,
85
- extra_body={"chat_template_kwargs": {"enable_thinking": False}},
86
- )
87
- print(resp.choices[0].message.content)
88
- ```
89
-
90
- ### llama.cpp
91
-
92
- ```bash
93
- llama-mtmd-cli \
94
- -m ggml-model-f16.gguf \
95
- --mmproj mmproj-model-f16-4x.gguf \
96
- --image page.png \
97
- -p "Text Recognition:" \
98
- --jinja -ngl 99 -c 8192 --temp 0
99
- ```
100
-
101
- Note that the GGUF file already hard-disables thinking inside its embedded chat template — no extra
102
- flag is needed, and `--reasoning on` cannot re-enable it. See the GGUF repository for details.
103
-
104
- ## Prompts
105
-
106
- The checkpoint is driven by a task prefix, and the prefix must match the element being cropped:
107
-
108
- | Element | Prompt | Output |
109
- |---|---|---|
110
- | Text block / paragraph / title / page | `Text Recognition:` | plain text |
111
- | Table | `Table Recognition:` | HTML |
112
- | Display formula | `Formula Recognition:` | LaTeX |
113
- | Inline formula | `Text Recognition:` | LaTeX |
114
-
115
- A typical page pipeline runs a layout model (e.g. PP-DocLayout) first, crops each element, dispatches
116
- the prompt above by element type, then concatenates the results in reading order into Markdown.
117
-
118
- ## Evaluation
119
-
120
- End-to-end OmniDocBench v1.6 numbers for this release are **being finalized** and will be published
121
- here. No numbers are reported yet on purpose — please do not cite any third-party reproduction as
122
- this checkpoint's result.
123
-
124
- ## Model weights
125
-
126
- | Repository | Contents |
127
- |---|---|
128
- | `openbmb/MiniCPM-OCR-1.0` (this repo) | bf16 weights, tokenizer, chat template, preprocessor configs |
129
- | [`openbmb/MiniCPM-OCR-1.0-gguf`](https://huggingface.co/openbmb/MiniCPM-OCR-1.0-gguf) | F16 GGUF + 4x mmproj for llama.cpp |
130
-
131
- ## License
132
-
133
- Apache-2.0.