hletrd commited on
Commit
7b4e6c8
·
verified ·
1 Parent(s): 5aaa157

Add model card, license, notice and chart

Browse files
Files changed (5) hide show
  1. .gitattributes +1 -0
  2. LICENSE +202 -0
  3. NOTICE +1 -0
  4. README.md +282 -0
  5. kl.png +3 -0
.gitattributes CHANGED
@@ -34,3 +34,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
  clairic-flash-Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
 
 
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
  clairic-flash-Q4_K_M.gguf filter=lfs diff=lfs merge=lfs -text
37
+ kl.png filter=lfs diff=lfs merge=lfs -text
LICENSE ADDED
@@ -0,0 +1,202 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2026 Alibaba Cloud
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
NOTICE ADDED
@@ -0,0 +1 @@
 
 
1
+ Clairic Flash GGUF quantizations. Source model: Cloudflare/clairic-flash, Copyright 2026 Cloudflare, Inc., Apache License 2.0 (LICENSE, Cloudflare's text unchanged); it is a fine-tune of Qwen/Qwen3.5-9B, Copyright the Qwen Team, Alibaba Group, Apache License 2.0. Modified by Xylolabs: quantization and conversion to GGUF (see README.md). Not affiliated with or endorsed by Cloudflare or Alibaba.
README.md ADDED
@@ -0,0 +1,282 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ license_link: LICENSE
4
+ base_model:
5
+ - Cloudflare/clairic-flash
6
+ base_model_relation: quantized
7
+ library_name: gguf
8
+ pipeline_tag: image-text-to-text
9
+ tags:
10
+ - gguf
11
+ - llama-cpp
12
+ - quantized
13
+ - clairic
14
+ - qwen3_5
15
+ - multimodal
16
+ - structured-output
17
+ - information-extraction
18
+ ---
19
+
20
+ <div align="center">
21
+
22
+ <img class="block dark:hidden mx-auto" src="https://raw.githubusercontent.com/XylolabsInc/tensix-bfp-gptq/main/assets/xylolabs-lockup.svg" alt="Xylolabs" width="256" height="40">
23
+ <img class="hidden dark:block mx-auto" src="https://raw.githubusercontent.com/XylolabsInc/tensix-bfp-gptq/main/assets/xylolabs-lockup-dark.svg" alt="Xylolabs" width="256" height="40">
24
+
25
+ <h1>Clairic Flash GGUF</h1>
26
+
27
+ [![Base model](https://img.shields.io/badge/base-Cloudflare%2Fclairic--flash-blue)](https://huggingface.co/Cloudflare/clairic-flash)
28
+ [![Formats](https://img.shields.io/badge/formats-Q8__0%20%2F%20Q6__K%20%2F%20Q5__K__M%20%2F%20Q4__K__M%20%2F%20Q4__K__S%20%2F%20IQ4__XS%20%2F%20Q3__K__M%20%2F%20IQ3__M%20%2F%20Q2__K-5B2C83)](#files)
29
+ [![License](https://img.shields.io/badge/license-Apache--2.0-green)](https://huggingface.co/Xylolabs/clairic-flash-GGUF/blob/main/LICENSE)
30
+ [![Code](https://img.shields.io/badge/code-llama.cpp-black)](https://github.com/ggml-org/llama.cpp)
31
+
32
+ </div>
33
+
34
+ GGUF quants of [Cloudflare/clairic-flash](https://huggingface.co/Cloudflare/clairic-flash) (9B, a fine-tune of [Qwen/Qwen3.5-9B](https://huggingface.co/Qwen/Qwen3.5-9B) for structured extraction) for llama.cpp, on CUDA, Metal or CPU. Stock llama.cpp runs it, with image input through the mmproj file.
35
+
36
+ - **Files:** Q8_0, Q6_K, Q5_K_M, Q4_K_M, Q4_K_S, IQ4_XS, Q3_K_M, IQ3_M and Q2_K (each one file with the tokenizer and chat template inside), the vision projector `mmproj-clairic-flash-BF16.gguf`, and the importance matrix.
37
+ - **Q4_K_M:** KL 0.0468 from the f32 reference, top-1 93.46 %.
38
+ - **Cloudflare's description:** [below](#cloudflares-original-model-description), unchanged.
39
+
40
+ ## Files
41
+
42
+ - `clairic-flash-<QUANT>.gguf` is one file per quant: the language model.
43
+ - `mmproj-clairic-flash-BF16.gguf` is the vision encoder, for image input.
44
+ - `clairic-flash.imatrix.gguf` is the importance matrix.
45
+
46
+ | Quant | Size | PPL | Mean KL vs f32 reference | Same top-1 vs f32 reference |
47
+ |---|---|---|---|---|
48
+ | Q8_0 | 9.53 GB | 6.0278 | 0.0072 | 97.94% |
49
+ | Q6_K | 7.37 GB | 6.0361 | 0.0132 | 96.93% |
50
+ | Q5_K_M | 6.50 GB | 5.9699 | 0.0203 | 95.97% |
51
+ | Q4_K_M | 5.69 GB | 5.9742 | 0.0468 | 93.46% |
52
+ | Q4_K_S | 5.37 GB | 5.9592 | 0.0507 | 93.12% |
53
+ | IQ4_XS | 5.27 GB | 6.2223 | 0.0562 | 92.60% |
54
+ | Q3_K_M | 4.69 GB | 5.7594 | 0.1635 | 87.62% |
55
+ | IQ3_M | 4.48 GB | 6.7828 | 0.1510 | 87.25% |
56
+ | Q2_K | 3.93 GB | 5.3667 | 0.3112 | 82.21% |
57
+
58
+ How we measured:
59
+
60
+ - **Reference:** the model in transformers with f32 compute on Cloudflare's BF16 weights (PPL 6.0590).
61
+ - **KL, top-1, PPL:** 12 chunks of 4,096 tokens, scoring positions 2,048 to 4,095 of each (24,564 tokens): 9 held-out chat-formatted chunks (English, Korean, code, math, JSON extraction from a schema, and Clairic's own field-extraction prompts) and 3 from wikitext-2.
62
+
63
+ ![Mean KL and same top-1 against the f32 reference by file size](kl.png)
64
+
65
+ ## The extraction head
66
+
67
+ Cloudflare's repository also has `clair_head.safetensors`, a small head that reads the model's hidden states and returns typed numbers, dates and spans with confidence scores, null probabilities, and estimate and forecast quantiles. It runs only in Cloudflare's PyTorch runtime (`clairic_model.py`, `systemone`) with the original weights, and it is not in these files. For typed extraction with scores, use [Cloudflare/clairic-flash](https://huggingface.co/Cloudflare/clairic-flash). These files hold the language model and the vision encoder: chat, generation, image input, and extraction answers written as JSON.
68
+
69
+ ## How to run
70
+
71
+ ```sh
72
+ llama-server -m clairic-flash-Q4_K_M.gguf --mmproj mmproj-clairic-flash-BF16.gguf \
73
+ --jinja -ngl 99 -c 32768 --chat-template-kwargs '{"enable_thinking":false}'
74
+ ```
75
+
76
+ Cloudflare's runtime runs the model with thinking off, as above. For JSON that follows a schema, pass the schema in the request (`response_format` with `json_schema` in llama-server, or `--json-schema` in llama-cli); llama.cpp turns it into a grammar.
77
+
78
+ Cloudflare's runtime asks for one field at a time, in one user message, and the model answers with one JSON value:
79
+
80
+ ```text
81
+ Extract the requested value from the supplied input, following the field instructions and scope. Return exactly one JSON scalar matching the field schema: quote and escape strings, write numbers without digit-group separators, and use null only when the value is unavailable and null is allowed. Zero is a present number. Preserve repeated source words and list entries. End immediately after the value.
82
+ Field: total
83
+ Schema: {"type":["number","null"]}
84
+ Instructions: The invoice total.
85
+
86
+ Document:
87
+ Invoice from Northwind Supply. Issued 2026-09-02. Items: Pens; Paper. Total: $1080.00.
88
+ ```
89
+
90
+ Every quant here answers `1080`, and `"Northwind Supply"` when the field is `vendor`.
91
+
92
+ ## How these were made
93
+
94
+ 1. Convert Cloudflare's BF16 checkpoint with llama.cpp's `convert_hf_to_gguf.py --no-mtp` (commit `e4b620af19f02960dea7a3a81de7c5805aa3a333`), and the vision encoder with `--mmproj` (BF16). The checkpoint's multi-token-prediction block is left out, as Cloudflare's config turns it off.
95
+ 2. Build the importance matrix with `llama-imatrix`: 600 chunks of 4,096 tokens of chat-formatted text rendered with the model's template, thinking off (databricks-dolly-15k in English, KoAlpaca-v1.1a in Korean, python_code_instructions_18k_alpaca for code, gsm8k for math, MasterControlAIML/JSON-Unstructured-Structured for schema-guided JSON, and paraloq/json_data_extraction as Clairic's field-extraction prompts), with `--process-output`.
96
+ 3. Make each quant with `llama-quantize --imatrix IM --tensor-type ssm_beta_alpha=f16 <bf16 gguf> <out> <QUANT>` (Q8_0 without the importance matrix): every weight matrix gets llama.cpp's own mix for that type; the Gated DeltaNet beta/alpha projection stays F16 (all but 0.035 % of its BF16 values are exact in F16, the largest difference 3e-8); norms, `ssm_a`, `ssm_dt` and the conv1d kernels stay F32.
97
+
98
+ The model: 8.95B parameters in the language model and 0.46B in the vision encoder; 32 layers (24 Gated DeltaNet linear-attention layers, 8 full-attention layers), 16 query and 4 KV heads of dimension 256, hidden size 4,096, context 262,144, vocabulary 248,320.
99
+
100
+ ## License and notices
101
+
102
+ - **License:** Apache-2.0, copied in `LICENSE` (Cloudflare's text).
103
+ - **What we changed:** we quantized the weights and converted them to GGUF.
104
+ - **Notices:** `NOTICE` names the source model and its copyright holders.
105
+ - Xylolabs is not affiliated with or endorsed by Cloudflare.
106
+
107
+ ## Cloudflare's original model description
108
+
109
+ This section is Cloudflare's model card, copied from [Cloudflare/clairic-flash](https://huggingface.co/Cloudflare/clairic-flash) (Apache-2.0).
110
+
111
+ - It describes Cloudflare's original model, not these files. Its usage code needs the original weights and Cloudflare's runtime; for the GGUF files, see "How to run" above.
112
+ - We changed only the heading levels (two deeper).
113
+
114
+ ### Clairic Flash
115
+
116
+ Clairic Flash is a 9B multimodal model that turns a state and a schema of typed fields
117
+ into structured answers. It supports text and image inputs, extraction, numerical
118
+ estimation, and forecasting. Each field has its own value and scoring information;
119
+ the response also reports input truncation and token usage.
120
+
121
+ See [Clairic](https://huggingface.co/Cloudflare/clairic) for the other model
122
+ in the Clairic family.
123
+
124
+ #### Model
125
+
126
+ - **Base model:** [Qwen3.5-9B](https://huggingface.co/Qwen/Qwen3.5-9B).
127
+ - **Inputs:** a text or JSON state, optional images, and a mapping of field names to specifications.
128
+ - **Outputs:** typed values, lists, nulls, estimates, and forecast paths.
129
+ - **Scoring:** extraction confidence and null probabilities, plus optional quantiles for estimates.
130
+ - **Runtime:** PyTorch and Transformers, with local Python request helpers.
131
+
132
+ #### Usage
133
+
134
+ Use Python 3.11 or later and install the packages listed in `requirements.txt`. Inference uses PyTorch and
135
+ Transformers; `xgrammar` supplies schema constraints through a Transformers logits
136
+ processor.
137
+
138
+ Download the repository, load the model and processor, and call `systemone` with a
139
+ System One: Extract request.
140
+
141
+ ```python
142
+ import sys
143
+
144
+ from huggingface_hub import snapshot_download
145
+
146
+ path = snapshot_download("Cloudflare/clairic-flash")
147
+ sys.path.insert(0, path)
148
+ from clairic_model import load_release_model, systemone
149
+
150
+ model, processor = load_release_model(path, device="cuda")
151
+
152
+ response = systemone(
153
+ model,
154
+ processor,
155
+ {
156
+ "state": (
157
+ "Invoice from Northwind Supply. Issued 2026-09-02. "
158
+ "Items: Pens; Paper. Total: $1080.00."
159
+ ),
160
+ "fields": {
161
+ "vendor": {"type": "text", "instructions": "The invoice vendor."},
162
+ "total": {"type": "number", "decimals": 2},
163
+ "issued": {"type": "date"},
164
+ "items": {
165
+ "type": "list",
166
+ "items": "text",
167
+ "instructions": "The purchased item names, in order.",
168
+ },
169
+ },
170
+ },
171
+ )
172
+ print(response["answers"])
173
+ ```
174
+
175
+ ##### Images
176
+
177
+ Pass PIL images alongside the state. Embedded base64 image inputs are also accepted.
178
+
179
+ ```python
180
+ from PIL import Image
181
+
182
+ response = systemone(
183
+ model,
184
+ processor,
185
+ {
186
+ "state": "Read the attached receipt.",
187
+ "images": [Image.open("receipt.png")],
188
+ "fields": {
189
+ "merchant": {"type": "text", "instructions": "The merchant name."},
190
+ "total": {"type": "number", "decimals": 2},
191
+ },
192
+ },
193
+ )
194
+ print(response["answers"])
195
+ ```
196
+
197
+ ##### Estimates and forecasts
198
+
199
+ Declare a range for estimated values. Forecasts also specify a horizon and interval.
200
+ Set `include_quantiles` to return the available quantiles.
201
+
202
+ ```python
203
+ response = systemone(
204
+ model,
205
+ processor,
206
+ {
207
+ "state": "Daily demand for the last seven days: 41, 45, 43, 47, 49, 46, 48.",
208
+ "fields": {
209
+ "next_day": {"type": "estimate", "min": 0, "max": 100},
210
+ "next_three_days": {
211
+ "type": "forecast",
212
+ "min": 0,
213
+ "max": 100,
214
+ "horizon": 3,
215
+ "interval": "day",
216
+ },
217
+ },
218
+ "options": {"include_quantiles": True},
219
+ },
220
+ )
221
+ print(response["answers"])
222
+ ```
223
+
224
+ #### Input format
225
+
226
+ | Field | Description |
227
+ |---|---|
228
+ | `model` | Optional `clairic-flash` or `@cf/cloudflare/clairic-flash` |
229
+ | `state` | Source text; the Python helper serializes JSON values to text |
230
+ | `images` | Optional PIL images or embedded base64 images |
231
+ | `documents` | Optional embedded PDF data URIs or `content_type` / `base64` objects |
232
+ | `fields` | Mapping of output field names to typed specifications |
233
+ | `reference_date` | Optional ISO date for relative date instructions |
234
+ | `options.include_quantiles` | Include available estimate and forecast quantiles |
235
+ | `options.return_state_text` | Include the retained source text in the response |
236
+
237
+ Field specifications support `text`, `number`, `date`, `time`, `datetime`, `duration`,
238
+ `boolean`, `enum`, `object`, `list`, `compute`, `estimate`, and `forecast`.
239
+ `instructions` describes what to return. Numeric fields can specify units and
240
+ rounding; lists declare their item schema; estimates and forecasts require bounds.
241
+ `nullable` defaults to true. `source_only: true` selects literal printed numbers,
242
+ dates, times, datetimes, or number/date lists. `knowledge: true` permits knowledge
243
+ answers for text, numbers, and supported list children. `compute` selects the typed
244
+ numeric head. Unsupported options and invalid combinations are rejected.
245
+
246
+ Embedded inputs are limited to 4 MiB each and 8 MiB combined. Images and rendered
247
+ PDF pages share a four-image/page limit. Image `rotation` accepts 0, 90, 180, or 270
248
+ clockwise degrees after EXIF orientation. Remote media URLs are not accepted.
249
+
250
+ #### Response
251
+
252
+ `systemone` returns a dictionary with `model`, `answers`, `truncated`, and `usage`.
253
+ Answers are keyed by the requested field names. Generated scalar extraction answers
254
+ retain `valid`, `complete`, full-sequence `confidence`, and independently scored `p_null`.
255
+ Uniquely matched text evidence includes character spans in `state`; image-only or
256
+ ambiguous evidence has null spans. Lists preserve item order and duplicates.
257
+ Estimates and forecasts include their typed values and, when requested, quantiles.
258
+
259
+ Scores are model probabilities and should be evaluated for the application's own
260
+ acceptance thresholds. Inspect `truncated` and any answer completeness indicators
261
+ before relying on a result.
262
+
263
+ Usage includes retries and supplemental work. The response model ID is `clairic-flash`.
264
+ The Python API raises validation or request errors for invalid inputs, a queue-full
265
+ error for simultaneous requests, and an inference error for failed generation.
266
+ Use `await model.predict_async(request)` in an async application; cancellation
267
+ drains owned work before admitting another request.
268
+
269
+ #### Files
270
+
271
+ | File | Purpose |
272
+ |---|---|
273
+ | `model*.safetensors`, `model.safetensors.index.json`, `config.json` | Model weights and configuration |
274
+ | `clair_head.safetensors`, `clair_head_config.json` | Typed output components |
275
+ | `clairic_model.py` and supporting Python modules | Transformers loading and request handling |
276
+ | Tokenizer and processor files | Text and image preprocessing |
277
+ | `requirements.txt` | Python dependencies |
278
+ | `LICENSE` | Apache-2.0 license |
279
+
280
+ #### License
281
+
282
+ Released under the Apache-2.0 license.
kl.png ADDED

Git LFS Details

  • SHA256: a5f9aea292023e14bd265f06223d0df904b33bff6c5f5b39304866f4dc537c31
  • Pointer size: 131 Bytes
  • Size of remote file: 125 kB