hletrd commited on
Commit
d92cac3
·
verified ·
1 Parent(s): f942684

docs(card): 📝 cut disclaimers and the copied upstream description

Browse files
Files changed (1) hide show
  1. README.md +2 -176
README.md CHANGED
@@ -40,7 +40,7 @@ mlx_lm.chat --model Xylolabs/clairic-flash-MLX-8bit
40
 
41
  ## Accuracy
42
 
43
- Mean KL divergence from BF16 (lower is better) and top-1 agreement with BF16.
44
 
45
  | Quant | Size | WikiText-2 KL | top-1 | Chat KL | top-1 | Held-out KL | top-1 |
46
  |---|---:|---:|---:|---:|---:|---:|---:|
@@ -72,183 +72,9 @@ A file fits when its size plus the KV cache at that context (f16) plus 2 GB for
72
 
73
  ## License and notices
74
 
75
- These files are under the Apache License 2.0, copied in `LICENSE` (Cloudflare's text); the original model is Cloudflare's, itself built on Qwen/Qwen3.5-9B (Apache-2.0). We quantized the language-model weights to MLX 8-bit with mlx-lm and left out the vision tower, the scoring head and the Python runtime. The source revision and what was changed are in `ORIGINS.md` and `NOTICE`. Not affiliated with or endorsed by Cloudflare.
76
 
77
  ## Updates
78
 
79
  - 2026-11-22: Added a hardware recommendation table.
80
  - 2026-11-22: First release.
81
-
82
- ## Cloudflare's original model description
83
-
84
- Below is the model card of [Cloudflare/clairic-flash](https://huggingface.co/Cloudflare/clairic-flash) (Apache-2.0), without its metadata header and unchanged.
85
-
86
- # Clairic Flash
87
-
88
- Clairic Flash is a 9B multimodal model that turns a state and a schema of typed fields
89
- into structured answers. It supports text and image inputs, extraction, numerical
90
- estimation, and forecasting. Each field has its own value and scoring information;
91
- the response also reports input truncation and token usage.
92
-
93
- See [Clairic](https://huggingface.co/Cloudflare/clairic) for the other model
94
- in the Clairic family.
95
-
96
- ## Model
97
-
98
- - **Base model:** [Qwen3.5-9B](https://huggingface.co/Qwen/Qwen3.5-9B).
99
- - **Inputs:** a text or JSON state, optional images, and a mapping of field names to specifications.
100
- - **Outputs:** typed values, lists, nulls, estimates, and forecast paths.
101
- - **Scoring:** extraction confidence and null probabilities, plus optional quantiles for estimates.
102
- - **Runtime:** PyTorch and Transformers, with local Python request helpers.
103
-
104
- ## Usage
105
-
106
- Use Python 3.11 or later and install the packages listed in `requirements.txt`. Inference uses PyTorch and
107
- Transformers; `xgrammar` supplies schema constraints through a Transformers logits
108
- processor.
109
-
110
- Download the repository, load the model and processor, and call `systemone` with a
111
- System One: Extract request.
112
-
113
- ```python
114
- import sys
115
-
116
- from huggingface_hub import snapshot_download
117
-
118
- path = snapshot_download("Cloudflare/clairic-flash")
119
- sys.path.insert(0, path)
120
- from clairic_model import load_release_model, systemone
121
-
122
- model, processor = load_release_model(path, device="cuda")
123
-
124
- response = systemone(
125
- model,
126
- processor,
127
- {
128
- "state": (
129
- "Invoice from Northwind Supply. Issued 2026-09-02. "
130
- "Items: Pens; Paper. Total: $1080.00."
131
- ),
132
- "fields": {
133
- "vendor": {"type": "text", "instructions": "The invoice vendor."},
134
- "total": {"type": "number", "decimals": 2},
135
- "issued": {"type": "date"},
136
- "items": {
137
- "type": "list",
138
- "items": "text",
139
- "instructions": "The purchased item names, in order.",
140
- },
141
- },
142
- },
143
- )
144
- print(response["answers"])
145
- ```
146
-
147
- ### Images
148
-
149
- Pass PIL images alongside the state. Embedded base64 image inputs are also accepted.
150
-
151
- ```python
152
- from PIL import Image
153
-
154
- response = systemone(
155
- model,
156
- processor,
157
- {
158
- "state": "Read the attached receipt.",
159
- "images": [Image.open("receipt.png")],
160
- "fields": {
161
- "merchant": {"type": "text", "instructions": "The merchant name."},
162
- "total": {"type": "number", "decimals": 2},
163
- },
164
- },
165
- )
166
- print(response["answers"])
167
- ```
168
-
169
- ### Estimates and forecasts
170
-
171
- Declare a range for estimated values. Forecasts also specify a horizon and interval.
172
- Set `include_quantiles` to return the available quantiles.
173
-
174
- ```python
175
- response = systemone(
176
- model,
177
- processor,
178
- {
179
- "state": "Daily demand for the last seven days: 41, 45, 43, 47, 49, 46, 48.",
180
- "fields": {
181
- "next_day": {"type": "estimate", "min": 0, "max": 100},
182
- "next_three_days": {
183
- "type": "forecast",
184
- "min": 0,
185
- "max": 100,
186
- "horizon": 3,
187
- "interval": "day",
188
- },
189
- },
190
- "options": {"include_quantiles": True},
191
- },
192
- )
193
- print(response["answers"])
194
- ```
195
-
196
- ## Input format
197
-
198
- | Field | Description |
199
- |---|---|
200
- | `model` | Optional `clairic-flash` or `@cf/cloudflare/clairic-flash` |
201
- | `state` | Source text; the Python helper serializes JSON values to text |
202
- | `images` | Optional PIL images or embedded base64 images |
203
- | `documents` | Optional embedded PDF data URIs or `content_type` / `base64` objects |
204
- | `fields` | Mapping of output field names to typed specifications |
205
- | `reference_date` | Optional ISO date for relative date instructions |
206
- | `options.include_quantiles` | Include available estimate and forecast quantiles |
207
- | `options.return_state_text` | Include the retained source text in the response |
208
-
209
- Field specifications support `text`, `number`, `date`, `time`, `datetime`, `duration`,
210
- `boolean`, `enum`, `object`, `list`, `compute`, `estimate`, and `forecast`.
211
- `instructions` describes what to return. Numeric fields can specify units and
212
- rounding; lists declare their item schema; estimates and forecasts require bounds.
213
- `nullable` defaults to true. `source_only: true` selects literal printed numbers,
214
- dates, times, datetimes, or number/date lists. `knowledge: true` permits knowledge
215
- answers for text, numbers, and supported list children. `compute` selects the typed
216
- numeric head. Unsupported options and invalid combinations are rejected.
217
-
218
- Embedded inputs are limited to 4 MiB each and 8 MiB combined. Images and rendered
219
- PDF pages share a four-image/page limit. Image `rotation` accepts 0, 90, 180, or 270
220
- clockwise degrees after EXIF orientation. Remote media URLs are not accepted.
221
-
222
- ## Response
223
-
224
- `systemone` returns a dictionary with `model`, `answers`, `truncated`, and `usage`.
225
- Answers are keyed by the requested field names. Generated scalar extraction answers
226
- retain `valid`, `complete`, full-sequence `confidence`, and independently scored `p_null`.
227
- Uniquely matched text evidence includes character spans in `state`; image-only or
228
- ambiguous evidence has null spans. Lists preserve item order and duplicates.
229
- Estimates and forecasts include their typed values and, when requested, quantiles.
230
-
231
- Scores are model probabilities and should be evaluated for the application's own
232
- acceptance thresholds. Inspect `truncated` and any answer completeness indicators
233
- before relying on a result.
234
-
235
- Usage includes retries and supplemental work. The response model ID is `clairic-flash`.
236
- The Python API raises validation or request errors for invalid inputs, a queue-full
237
- error for simultaneous requests, and an inference error for failed generation.
238
- Use `await model.predict_async(request)` in an async application; cancellation
239
- drains owned work before admitting another request.
240
-
241
- ## Files
242
-
243
- | File | Purpose |
244
- |---|---|
245
- | `model*.safetensors`, `model.safetensors.index.json`, `config.json` | Model weights and configuration |
246
- | `clair_head.safetensors`, `clair_head_config.json` | Typed output components |
247
- | `clairic_model.py` and supporting Python modules | Transformers loading and request handling |
248
- | Tokenizer and processor files | Text and image preprocessing |
249
- | `requirements.txt` | Python dependencies |
250
- | `LICENSE` | Apache-2.0 license |
251
-
252
- ## License
253
-
254
- Released under the Apache-2.0 license.
 
40
 
41
  ## Accuracy
42
 
43
+ Against BF16.
44
 
45
  | Quant | Size | WikiText-2 KL | top-1 | Chat KL | top-1 | Held-out KL | top-1 |
46
  |---|---:|---:|---:|---:|---:|---:|---:|
 
72
 
73
  ## License and notices
74
 
75
+ Apache License 2.0, copied in `LICENSE`. We quantized the language-model weights to MLX 8-bit; the vision tower, scoring head and Python runtime are left out.
76
 
77
  ## Updates
78
 
79
  - 2026-11-22: Added a hardware recommendation table.
80
  - 2026-11-22: First release.