Text Generation
Transformers
Safetensors
qwen3_5
image-text-to-text
axquant
cuda
nvfp4
clef
decision-model
conversational
8-bit precision
compressed-tensors
Instructions to use AutomatosX/AX-Clef-Flash-9B-CUDA-AXQ-NVFP4-W4A16 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use AutomatosX/AX-Clef-Flash-9B-CUDA-AXQ-NVFP4-W4A16 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="AutomatosX/AX-Clef-Flash-9B-CUDA-AXQ-NVFP4-W4A16") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("AutomatosX/AX-Clef-Flash-9B-CUDA-AXQ-NVFP4-W4A16") model = AutoModelForMultimodalLM.from_pretrained("AutomatosX/AX-Clef-Flash-9B-CUDA-AXQ-NVFP4-W4A16", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use AutomatosX/AX-Clef-Flash-9B-CUDA-AXQ-NVFP4-W4A16 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "AutomatosX/AX-Clef-Flash-9B-CUDA-AXQ-NVFP4-W4A16" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AutomatosX/AX-Clef-Flash-9B-CUDA-AXQ-NVFP4-W4A16", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/AutomatosX/AX-Clef-Flash-9B-CUDA-AXQ-NVFP4-W4A16
- SGLang
How to use AutomatosX/AX-Clef-Flash-9B-CUDA-AXQ-NVFP4-W4A16 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "AutomatosX/AX-Clef-Flash-9B-CUDA-AXQ-NVFP4-W4A16" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AutomatosX/AX-Clef-Flash-9B-CUDA-AXQ-NVFP4-W4A16", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "AutomatosX/AX-Clef-Flash-9B-CUDA-AXQ-NVFP4-W4A16" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "AutomatosX/AX-Clef-Flash-9B-CUDA-AXQ-NVFP4-W4A16", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use AutomatosX/AX-Clef-Flash-9B-CUDA-AXQ-NVFP4-W4A16 with Docker Model Runner:
docker model run hf.co/AutomatosX/AX-Clef-Flash-9B-CUDA-AXQ-NVFP4-W4A16
Publish AX-Clef-Flash-9B-CUDA-AXQ-NVFP4-W4A16
Browse files- .gitattributes +1 -0
- LICENSE +202 -0
- NOTICE +10 -0
- README.md +28 -0
- axquant_cuda_manifest.json +331 -0
- axquant_cuda_plan.json +0 -0
- chat_template.jinja +154 -0
- config.json +435 -0
- generation_config.json +6 -0
- joint_head.safetensors +3 -0
- joint_head_config.json +8 -0
- joint_schema_model.py +576 -0
- model-00001-of-00004.safetensors +3 -0
- model-00002-of-00004.safetensors +3 -0
- model-00003-of-00004.safetensors +3 -0
- model-00004-of-00004.safetensors +3 -0
- model.safetensors.index.json +0 -0
- processor_config.json +60 -0
- tokenizer.json +3 -0
- tokenizer_config.json +30 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip 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
|
|
|
|
|
|
| 33 |
*.zip 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 |
+
tokenizer.json 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,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
This directory is a quantized CUDA derivative of Cloudflare/clef-flash.
|
| 2 |
+
|
| 3 |
+
Changes from the upstream BF16 release:
|
| 4 |
+
- Eligible language attention and MLP weights were quantized to NVFP4 W4A16
|
| 5 |
+
by AXQuant (round-to-nearest, block 16, no AWQ).
|
| 6 |
+
- Vision, norms, token embeddings, and the LM head stay at source precision.
|
| 7 |
+
- joint_head.safetensors is the original BF16 joint schema head, copied unchanged.
|
| 8 |
+
- Activations are not quantized.
|
| 9 |
+
|
| 10 |
+
The upstream work is Apache-2.0. See LICENSE (Copyright 2026 Alibaba Cloud).
|
README.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: transformers
|
| 3 |
+
pipeline_tag: text-generation
|
| 4 |
+
base_model: Cloudflare/clef-flash
|
| 5 |
+
license: apache-2.0
|
| 6 |
+
tags:
|
| 7 |
+
- axquant
|
| 8 |
+
- cuda
|
| 9 |
+
- nvfp4
|
| 10 |
+
- clef
|
| 11 |
+
- decision-model
|
| 12 |
+
---
|
| 13 |
+
|
| 14 |
+
# AX-Clef-Flash-9B-CUDA-AXQ-NVFP4-W4A16
|
| 15 |
+
|
| 16 |
+
Native AXQuant RTN NVFP4 W4A16 development checkpoint. Eligible language attention and MLP matrices use E2M1 weights, E4M3FN block scales of 16, and an FP32 inverse global scale. Activations stay BF16. There is no AWQ and no activation quantization. The checkpoint uses the public compressed-tensors NVFP4 layout.
|
| 17 |
+
|
| 18 |
+
Source: [Cloudflare/clef-flash](https://huggingface.co/Cloudflare/clef-flash) at `8b2e5fd17c09fd49bc2880b805d5323ec7ff4ff3`. Serialization backend: `torch-cuda`.
|
| 19 |
+
|
| 20 |
+
## Decision model
|
| 21 |
+
|
| 22 |
+
Clef is not a chat model. A request is a state plus a schema of typed questions (`noul`, `choice`, `score`). One prefill returns a probability for every allowed option. `joint_head.safetensors` is the original BF16 joint schema head, copied unchanged, with `joint_schema_model.py` and `joint_head_config.json`. Text generation does not run that head.
|
| 23 |
+
|
| 24 |
+
## Precision
|
| 25 |
+
|
| 26 |
+
Vision, norms, token embeddings, and the LM head stay at source precision. The joint schema head is not part of the language index and is not quantized. This package is development evidence. It is not a Decision Index certificate and it does not claim parity with the upstream BF16 checkpoint.
|
| 27 |
+
|
| 28 |
+
The upstream license is Apache-2.0. See LICENSE and NOTICE.
|
axquant_cuda_manifest.json
ADDED
|
@@ -0,0 +1,331 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"activation_dtype": "bfloat16",
|
| 3 |
+
"activation_precision": 16,
|
| 4 |
+
"algorithm": "rtn",
|
| 5 |
+
"backend": "torch-cuda",
|
| 6 |
+
"block_size": 16,
|
| 7 |
+
"created_at": "2026-10-11T14:08:34.890599Z",
|
| 8 |
+
"files": [
|
| 9 |
+
{
|
| 10 |
+
"path": "axquant_cuda_plan.json",
|
| 11 |
+
"sha256": "ba43f6967d4824721560cafaa91a1e2382bd4bb9f8c66766b932c2f444b73d60",
|
| 12 |
+
"size_bytes": 291190
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"path": "chat_template.jinja",
|
| 16 |
+
"sha256": "a4aee8afcf2e0711942cf848899be66016f8d14a889ff9ede07bca099c28f715",
|
| 17 |
+
"size_bytes": 7756
|
| 18 |
+
},
|
| 19 |
+
{
|
| 20 |
+
"path": "config.json",
|
| 21 |
+
"sha256": "5744497726aff66abff582b01f49c9c3e7c230496fb6d7cd774771ba66784467",
|
| 22 |
+
"size_bytes": 18163
|
| 23 |
+
},
|
| 24 |
+
{
|
| 25 |
+
"path": "generation_config.json",
|
| 26 |
+
"sha256": "45707f8467bf4e54e112c6095a1b2d1f2d63651cf86816344cfff21f02dda0d4",
|
| 27 |
+
"size_bytes": 116
|
| 28 |
+
},
|
| 29 |
+
{
|
| 30 |
+
"path": "joint_schema_model.py",
|
| 31 |
+
"sha256": "0e304cf7c6500e8bb59bef7e2afd2c6373f82596dfb3b57d1aa93c175e2dc3a3",
|
| 32 |
+
"size_bytes": 23263
|
| 33 |
+
},
|
| 34 |
+
{
|
| 35 |
+
"path": "model-00001-of-00004.safetensors",
|
| 36 |
+
"sha256": "8a9e82690ae9d2d503328da4ae9713bec43edc89f8a0d7c3fc825c6193bc1ca3",
|
| 37 |
+
"size_bytes": 4314532064
|
| 38 |
+
},
|
| 39 |
+
{
|
| 40 |
+
"path": "model-00002-of-00004.safetensors",
|
| 41 |
+
"sha256": "3215e2c3fde949292cfec69c0218abecca996b37bbf04f1efde37f195a80a385",
|
| 42 |
+
"size_bytes": 1403355332
|
| 43 |
+
},
|
| 44 |
+
{
|
| 45 |
+
"path": "model-00003-of-00004.safetensors",
|
| 46 |
+
"sha256": "c4c8224c9a597fec9caa10e395b04297c24c03840a1390adf49465ed529d51b6",
|
| 47 |
+
"size_bytes": 1394148076
|
| 48 |
+
},
|
| 49 |
+
{
|
| 50 |
+
"path": "model-00004-of-00004.safetensors",
|
| 51 |
+
"sha256": "2025963e1aa8803af9e6940980e00e99c1c87b8e852354f909d001f311612e4a",
|
| 52 |
+
"size_bytes": 1762400256
|
| 53 |
+
},
|
| 54 |
+
{
|
| 55 |
+
"path": "model.safetensors.index.json",
|
| 56 |
+
"sha256": "e7d341d71fce5b962439350a5c5eb96bd176e4e742c5888a3c4f45e6d864040f",
|
| 57 |
+
"size_bytes": 124660
|
| 58 |
+
},
|
| 59 |
+
{
|
| 60 |
+
"path": "processor_config.json",
|
| 61 |
+
"sha256": "d89ef49ce9cd37fbf510158e13c1ef063d9286411c1ec9049932dbe0487143b1",
|
| 62 |
+
"size_bytes": 1191
|
| 63 |
+
},
|
| 64 |
+
{
|
| 65 |
+
"path": "tokenizer.json",
|
| 66 |
+
"sha256": "06b9509352d2af50381ab2247e083b80d32d5c0aba91c272ca9ff729b6a0e523",
|
| 67 |
+
"size_bytes": 19989325
|
| 68 |
+
},
|
| 69 |
+
{
|
| 70 |
+
"path": "tokenizer_config.json",
|
| 71 |
+
"sha256": "91a08f825d370d085d692e04cf117cdd7faad7bf18e996f1e6031b6dab03db72",
|
| 72 |
+
"size_bytes": 1075
|
| 73 |
+
}
|
| 74 |
+
],
|
| 75 |
+
"format": "nvfp4",
|
| 76 |
+
"plan_sha256": "c08625ebd3c66910d7e147ea1d8062781fd116f7a50941d17be6b5b002070068",
|
| 77 |
+
"quality_certified": false,
|
| 78 |
+
"quantized_tensors": [
|
| 79 |
+
"model.language_model.layers.0.linear_attn.in_proj_a.weight",
|
| 80 |
+
"model.language_model.layers.0.linear_attn.in_proj_b.weight",
|
| 81 |
+
"model.language_model.layers.0.linear_attn.in_proj_qkv.weight",
|
| 82 |
+
"model.language_model.layers.0.linear_attn.in_proj_z.weight",
|
| 83 |
+
"model.language_model.layers.0.linear_attn.out_proj.weight",
|
| 84 |
+
"model.language_model.layers.0.mlp.down_proj.weight",
|
| 85 |
+
"model.language_model.layers.0.mlp.gate_proj.weight",
|
| 86 |
+
"model.language_model.layers.0.mlp.up_proj.weight",
|
| 87 |
+
"model.language_model.layers.1.linear_attn.in_proj_a.weight",
|
| 88 |
+
"model.language_model.layers.1.linear_attn.in_proj_b.weight",
|
| 89 |
+
"model.language_model.layers.1.linear_attn.in_proj_qkv.weight",
|
| 90 |
+
"model.language_model.layers.1.linear_attn.in_proj_z.weight",
|
| 91 |
+
"model.language_model.layers.1.linear_attn.out_proj.weight",
|
| 92 |
+
"model.language_model.layers.1.mlp.down_proj.weight",
|
| 93 |
+
"model.language_model.layers.1.mlp.gate_proj.weight",
|
| 94 |
+
"model.language_model.layers.1.mlp.up_proj.weight",
|
| 95 |
+
"model.language_model.layers.10.linear_attn.in_proj_a.weight",
|
| 96 |
+
"model.language_model.layers.10.linear_attn.in_proj_b.weight",
|
| 97 |
+
"model.language_model.layers.10.linear_attn.in_proj_qkv.weight",
|
| 98 |
+
"model.language_model.layers.10.linear_attn.in_proj_z.weight",
|
| 99 |
+
"model.language_model.layers.10.linear_attn.out_proj.weight",
|
| 100 |
+
"model.language_model.layers.10.mlp.down_proj.weight",
|
| 101 |
+
"model.language_model.layers.10.mlp.gate_proj.weight",
|
| 102 |
+
"model.language_model.layers.10.mlp.up_proj.weight",
|
| 103 |
+
"model.language_model.layers.11.mlp.down_proj.weight",
|
| 104 |
+
"model.language_model.layers.11.mlp.gate_proj.weight",
|
| 105 |
+
"model.language_model.layers.11.mlp.up_proj.weight",
|
| 106 |
+
"model.language_model.layers.11.self_attn.k_proj.weight",
|
| 107 |
+
"model.language_model.layers.11.self_attn.o_proj.weight",
|
| 108 |
+
"model.language_model.layers.11.self_attn.q_proj.weight",
|
| 109 |
+
"model.language_model.layers.11.self_attn.v_proj.weight",
|
| 110 |
+
"model.language_model.layers.12.linear_attn.in_proj_a.weight",
|
| 111 |
+
"model.language_model.layers.12.linear_attn.in_proj_b.weight",
|
| 112 |
+
"model.language_model.layers.12.linear_attn.in_proj_qkv.weight",
|
| 113 |
+
"model.language_model.layers.12.linear_attn.in_proj_z.weight",
|
| 114 |
+
"model.language_model.layers.12.linear_attn.out_proj.weight",
|
| 115 |
+
"model.language_model.layers.12.mlp.down_proj.weight",
|
| 116 |
+
"model.language_model.layers.12.mlp.gate_proj.weight",
|
| 117 |
+
"model.language_model.layers.12.mlp.up_proj.weight",
|
| 118 |
+
"model.language_model.layers.13.linear_attn.in_proj_a.weight",
|
| 119 |
+
"model.language_model.layers.13.linear_attn.in_proj_b.weight",
|
| 120 |
+
"model.language_model.layers.13.linear_attn.in_proj_qkv.weight",
|
| 121 |
+
"model.language_model.layers.13.linear_attn.in_proj_z.weight",
|
| 122 |
+
"model.language_model.layers.13.linear_attn.out_proj.weight",
|
| 123 |
+
"model.language_model.layers.13.mlp.down_proj.weight",
|
| 124 |
+
"model.language_model.layers.13.mlp.gate_proj.weight",
|
| 125 |
+
"model.language_model.layers.13.mlp.up_proj.weight",
|
| 126 |
+
"model.language_model.layers.14.linear_attn.in_proj_a.weight",
|
| 127 |
+
"model.language_model.layers.14.linear_attn.in_proj_b.weight",
|
| 128 |
+
"model.language_model.layers.14.linear_attn.in_proj_qkv.weight",
|
| 129 |
+
"model.language_model.layers.14.linear_attn.in_proj_z.weight",
|
| 130 |
+
"model.language_model.layers.14.linear_attn.out_proj.weight",
|
| 131 |
+
"model.language_model.layers.14.mlp.down_proj.weight",
|
| 132 |
+
"model.language_model.layers.14.mlp.gate_proj.weight",
|
| 133 |
+
"model.language_model.layers.14.mlp.up_proj.weight",
|
| 134 |
+
"model.language_model.layers.15.mlp.down_proj.weight",
|
| 135 |
+
"model.language_model.layers.15.mlp.gate_proj.weight",
|
| 136 |
+
"model.language_model.layers.15.mlp.up_proj.weight",
|
| 137 |
+
"model.language_model.layers.15.self_attn.k_proj.weight",
|
| 138 |
+
"model.language_model.layers.15.self_attn.o_proj.weight",
|
| 139 |
+
"model.language_model.layers.15.self_attn.q_proj.weight",
|
| 140 |
+
"model.language_model.layers.15.self_attn.v_proj.weight",
|
| 141 |
+
"model.language_model.layers.16.linear_attn.in_proj_a.weight",
|
| 142 |
+
"model.language_model.layers.16.linear_attn.in_proj_b.weight",
|
| 143 |
+
"model.language_model.layers.16.linear_attn.in_proj_qkv.weight",
|
| 144 |
+
"model.language_model.layers.16.linear_attn.in_proj_z.weight",
|
| 145 |
+
"model.language_model.layers.16.linear_attn.out_proj.weight",
|
| 146 |
+
"model.language_model.layers.16.mlp.down_proj.weight",
|
| 147 |
+
"model.language_model.layers.16.mlp.gate_proj.weight",
|
| 148 |
+
"model.language_model.layers.16.mlp.up_proj.weight",
|
| 149 |
+
"model.language_model.layers.17.linear_attn.in_proj_a.weight",
|
| 150 |
+
"model.language_model.layers.17.linear_attn.in_proj_b.weight",
|
| 151 |
+
"model.language_model.layers.17.linear_attn.in_proj_qkv.weight",
|
| 152 |
+
"model.language_model.layers.17.linear_attn.in_proj_z.weight",
|
| 153 |
+
"model.language_model.layers.17.linear_attn.out_proj.weight",
|
| 154 |
+
"model.language_model.layers.17.mlp.down_proj.weight",
|
| 155 |
+
"model.language_model.layers.17.mlp.gate_proj.weight",
|
| 156 |
+
"model.language_model.layers.17.mlp.up_proj.weight",
|
| 157 |
+
"model.language_model.layers.18.linear_attn.in_proj_a.weight",
|
| 158 |
+
"model.language_model.layers.18.linear_attn.in_proj_b.weight",
|
| 159 |
+
"model.language_model.layers.18.linear_attn.in_proj_qkv.weight",
|
| 160 |
+
"model.language_model.layers.18.linear_attn.in_proj_z.weight",
|
| 161 |
+
"model.language_model.layers.18.linear_attn.out_proj.weight",
|
| 162 |
+
"model.language_model.layers.18.mlp.down_proj.weight",
|
| 163 |
+
"model.language_model.layers.18.mlp.gate_proj.weight",
|
| 164 |
+
"model.language_model.layers.18.mlp.up_proj.weight",
|
| 165 |
+
"model.language_model.layers.19.mlp.down_proj.weight",
|
| 166 |
+
"model.language_model.layers.19.mlp.gate_proj.weight",
|
| 167 |
+
"model.language_model.layers.19.mlp.up_proj.weight",
|
| 168 |
+
"model.language_model.layers.19.self_attn.k_proj.weight",
|
| 169 |
+
"model.language_model.layers.19.self_attn.o_proj.weight",
|
| 170 |
+
"model.language_model.layers.19.self_attn.q_proj.weight",
|
| 171 |
+
"model.language_model.layers.19.self_attn.v_proj.weight",
|
| 172 |
+
"model.language_model.layers.2.linear_attn.in_proj_a.weight",
|
| 173 |
+
"model.language_model.layers.2.linear_attn.in_proj_b.weight",
|
| 174 |
+
"model.language_model.layers.2.linear_attn.in_proj_qkv.weight",
|
| 175 |
+
"model.language_model.layers.2.linear_attn.in_proj_z.weight",
|
| 176 |
+
"model.language_model.layers.2.linear_attn.out_proj.weight",
|
| 177 |
+
"model.language_model.layers.2.mlp.down_proj.weight",
|
| 178 |
+
"model.language_model.layers.2.mlp.gate_proj.weight",
|
| 179 |
+
"model.language_model.layers.2.mlp.up_proj.weight",
|
| 180 |
+
"model.language_model.layers.20.linear_attn.in_proj_a.weight",
|
| 181 |
+
"model.language_model.layers.20.linear_attn.in_proj_b.weight",
|
| 182 |
+
"model.language_model.layers.20.linear_attn.in_proj_qkv.weight",
|
| 183 |
+
"model.language_model.layers.20.linear_attn.in_proj_z.weight",
|
| 184 |
+
"model.language_model.layers.20.linear_attn.out_proj.weight",
|
| 185 |
+
"model.language_model.layers.20.mlp.down_proj.weight",
|
| 186 |
+
"model.language_model.layers.20.mlp.gate_proj.weight",
|
| 187 |
+
"model.language_model.layers.20.mlp.up_proj.weight",
|
| 188 |
+
"model.language_model.layers.21.linear_attn.in_proj_a.weight",
|
| 189 |
+
"model.language_model.layers.21.linear_attn.in_proj_b.weight",
|
| 190 |
+
"model.language_model.layers.21.linear_attn.in_proj_qkv.weight",
|
| 191 |
+
"model.language_model.layers.21.linear_attn.in_proj_z.weight",
|
| 192 |
+
"model.language_model.layers.21.linear_attn.out_proj.weight",
|
| 193 |
+
"model.language_model.layers.21.mlp.down_proj.weight",
|
| 194 |
+
"model.language_model.layers.21.mlp.gate_proj.weight",
|
| 195 |
+
"model.language_model.layers.21.mlp.up_proj.weight",
|
| 196 |
+
"model.language_model.layers.22.linear_attn.in_proj_a.weight",
|
| 197 |
+
"model.language_model.layers.22.linear_attn.in_proj_b.weight",
|
| 198 |
+
"model.language_model.layers.22.linear_attn.in_proj_qkv.weight",
|
| 199 |
+
"model.language_model.layers.22.linear_attn.in_proj_z.weight",
|
| 200 |
+
"model.language_model.layers.22.linear_attn.out_proj.weight",
|
| 201 |
+
"model.language_model.layers.22.mlp.down_proj.weight",
|
| 202 |
+
"model.language_model.layers.22.mlp.gate_proj.weight",
|
| 203 |
+
"model.language_model.layers.22.mlp.up_proj.weight",
|
| 204 |
+
"model.language_model.layers.23.mlp.down_proj.weight",
|
| 205 |
+
"model.language_model.layers.23.mlp.gate_proj.weight",
|
| 206 |
+
"model.language_model.layers.23.mlp.up_proj.weight",
|
| 207 |
+
"model.language_model.layers.23.self_attn.k_proj.weight",
|
| 208 |
+
"model.language_model.layers.23.self_attn.o_proj.weight",
|
| 209 |
+
"model.language_model.layers.23.self_attn.q_proj.weight",
|
| 210 |
+
"model.language_model.layers.23.self_attn.v_proj.weight",
|
| 211 |
+
"model.language_model.layers.24.linear_attn.in_proj_a.weight",
|
| 212 |
+
"model.language_model.layers.24.linear_attn.in_proj_b.weight",
|
| 213 |
+
"model.language_model.layers.24.linear_attn.in_proj_qkv.weight",
|
| 214 |
+
"model.language_model.layers.24.linear_attn.in_proj_z.weight",
|
| 215 |
+
"model.language_model.layers.24.linear_attn.out_proj.weight",
|
| 216 |
+
"model.language_model.layers.24.mlp.down_proj.weight",
|
| 217 |
+
"model.language_model.layers.24.mlp.gate_proj.weight",
|
| 218 |
+
"model.language_model.layers.24.mlp.up_proj.weight",
|
| 219 |
+
"model.language_model.layers.25.linear_attn.in_proj_a.weight",
|
| 220 |
+
"model.language_model.layers.25.linear_attn.in_proj_b.weight",
|
| 221 |
+
"model.language_model.layers.25.linear_attn.in_proj_qkv.weight",
|
| 222 |
+
"model.language_model.layers.25.linear_attn.in_proj_z.weight",
|
| 223 |
+
"model.language_model.layers.25.linear_attn.out_proj.weight",
|
| 224 |
+
"model.language_model.layers.25.mlp.down_proj.weight",
|
| 225 |
+
"model.language_model.layers.25.mlp.gate_proj.weight",
|
| 226 |
+
"model.language_model.layers.25.mlp.up_proj.weight",
|
| 227 |
+
"model.language_model.layers.26.linear_attn.in_proj_a.weight",
|
| 228 |
+
"model.language_model.layers.26.linear_attn.in_proj_b.weight",
|
| 229 |
+
"model.language_model.layers.26.linear_attn.in_proj_qkv.weight",
|
| 230 |
+
"model.language_model.layers.26.linear_attn.in_proj_z.weight",
|
| 231 |
+
"model.language_model.layers.26.linear_attn.out_proj.weight",
|
| 232 |
+
"model.language_model.layers.26.mlp.down_proj.weight",
|
| 233 |
+
"model.language_model.layers.26.mlp.gate_proj.weight",
|
| 234 |
+
"model.language_model.layers.26.mlp.up_proj.weight",
|
| 235 |
+
"model.language_model.layers.27.mlp.down_proj.weight",
|
| 236 |
+
"model.language_model.layers.27.mlp.gate_proj.weight",
|
| 237 |
+
"model.language_model.layers.27.mlp.up_proj.weight",
|
| 238 |
+
"model.language_model.layers.27.self_attn.k_proj.weight",
|
| 239 |
+
"model.language_model.layers.27.self_attn.o_proj.weight",
|
| 240 |
+
"model.language_model.layers.27.self_attn.q_proj.weight",
|
| 241 |
+
"model.language_model.layers.27.self_attn.v_proj.weight",
|
| 242 |
+
"model.language_model.layers.28.linear_attn.in_proj_a.weight",
|
| 243 |
+
"model.language_model.layers.28.linear_attn.in_proj_b.weight",
|
| 244 |
+
"model.language_model.layers.28.linear_attn.in_proj_qkv.weight",
|
| 245 |
+
"model.language_model.layers.28.linear_attn.in_proj_z.weight",
|
| 246 |
+
"model.language_model.layers.28.linear_attn.out_proj.weight",
|
| 247 |
+
"model.language_model.layers.28.mlp.down_proj.weight",
|
| 248 |
+
"model.language_model.layers.28.mlp.gate_proj.weight",
|
| 249 |
+
"model.language_model.layers.28.mlp.up_proj.weight",
|
| 250 |
+
"model.language_model.layers.29.linear_attn.in_proj_a.weight",
|
| 251 |
+
"model.language_model.layers.29.linear_attn.in_proj_b.weight",
|
| 252 |
+
"model.language_model.layers.29.linear_attn.in_proj_qkv.weight",
|
| 253 |
+
"model.language_model.layers.29.linear_attn.in_proj_z.weight",
|
| 254 |
+
"model.language_model.layers.29.linear_attn.out_proj.weight",
|
| 255 |
+
"model.language_model.layers.29.mlp.down_proj.weight",
|
| 256 |
+
"model.language_model.layers.29.mlp.gate_proj.weight",
|
| 257 |
+
"model.language_model.layers.29.mlp.up_proj.weight",
|
| 258 |
+
"model.language_model.layers.3.mlp.down_proj.weight",
|
| 259 |
+
"model.language_model.layers.3.mlp.gate_proj.weight",
|
| 260 |
+
"model.language_model.layers.3.mlp.up_proj.weight",
|
| 261 |
+
"model.language_model.layers.3.self_attn.k_proj.weight",
|
| 262 |
+
"model.language_model.layers.3.self_attn.o_proj.weight",
|
| 263 |
+
"model.language_model.layers.3.self_attn.q_proj.weight",
|
| 264 |
+
"model.language_model.layers.3.self_attn.v_proj.weight",
|
| 265 |
+
"model.language_model.layers.30.linear_attn.in_proj_a.weight",
|
| 266 |
+
"model.language_model.layers.30.linear_attn.in_proj_b.weight",
|
| 267 |
+
"model.language_model.layers.30.linear_attn.in_proj_qkv.weight",
|
| 268 |
+
"model.language_model.layers.30.linear_attn.in_proj_z.weight",
|
| 269 |
+
"model.language_model.layers.30.linear_attn.out_proj.weight",
|
| 270 |
+
"model.language_model.layers.30.mlp.down_proj.weight",
|
| 271 |
+
"model.language_model.layers.30.mlp.gate_proj.weight",
|
| 272 |
+
"model.language_model.layers.30.mlp.up_proj.weight",
|
| 273 |
+
"model.language_model.layers.31.mlp.down_proj.weight",
|
| 274 |
+
"model.language_model.layers.31.mlp.gate_proj.weight",
|
| 275 |
+
"model.language_model.layers.31.mlp.up_proj.weight",
|
| 276 |
+
"model.language_model.layers.31.self_attn.k_proj.weight",
|
| 277 |
+
"model.language_model.layers.31.self_attn.o_proj.weight",
|
| 278 |
+
"model.language_model.layers.31.self_attn.q_proj.weight",
|
| 279 |
+
"model.language_model.layers.31.self_attn.v_proj.weight",
|
| 280 |
+
"model.language_model.layers.4.linear_attn.in_proj_a.weight",
|
| 281 |
+
"model.language_model.layers.4.linear_attn.in_proj_b.weight",
|
| 282 |
+
"model.language_model.layers.4.linear_attn.in_proj_qkv.weight",
|
| 283 |
+
"model.language_model.layers.4.linear_attn.in_proj_z.weight",
|
| 284 |
+
"model.language_model.layers.4.linear_attn.out_proj.weight",
|
| 285 |
+
"model.language_model.layers.4.mlp.down_proj.weight",
|
| 286 |
+
"model.language_model.layers.4.mlp.gate_proj.weight",
|
| 287 |
+
"model.language_model.layers.4.mlp.up_proj.weight",
|
| 288 |
+
"model.language_model.layers.5.linear_attn.in_proj_a.weight",
|
| 289 |
+
"model.language_model.layers.5.linear_attn.in_proj_b.weight",
|
| 290 |
+
"model.language_model.layers.5.linear_attn.in_proj_qkv.weight",
|
| 291 |
+
"model.language_model.layers.5.linear_attn.in_proj_z.weight",
|
| 292 |
+
"model.language_model.layers.5.linear_attn.out_proj.weight",
|
| 293 |
+
"model.language_model.layers.5.mlp.down_proj.weight",
|
| 294 |
+
"model.language_model.layers.5.mlp.gate_proj.weight",
|
| 295 |
+
"model.language_model.layers.5.mlp.up_proj.weight",
|
| 296 |
+
"model.language_model.layers.6.linear_attn.in_proj_a.weight",
|
| 297 |
+
"model.language_model.layers.6.linear_attn.in_proj_b.weight",
|
| 298 |
+
"model.language_model.layers.6.linear_attn.in_proj_qkv.weight",
|
| 299 |
+
"model.language_model.layers.6.linear_attn.in_proj_z.weight",
|
| 300 |
+
"model.language_model.layers.6.linear_attn.out_proj.weight",
|
| 301 |
+
"model.language_model.layers.6.mlp.down_proj.weight",
|
| 302 |
+
"model.language_model.layers.6.mlp.gate_proj.weight",
|
| 303 |
+
"model.language_model.layers.6.mlp.up_proj.weight",
|
| 304 |
+
"model.language_model.layers.7.mlp.down_proj.weight",
|
| 305 |
+
"model.language_model.layers.7.mlp.gate_proj.weight",
|
| 306 |
+
"model.language_model.layers.7.mlp.up_proj.weight",
|
| 307 |
+
"model.language_model.layers.7.self_attn.k_proj.weight",
|
| 308 |
+
"model.language_model.layers.7.self_attn.o_proj.weight",
|
| 309 |
+
"model.language_model.layers.7.self_attn.q_proj.weight",
|
| 310 |
+
"model.language_model.layers.7.self_attn.v_proj.weight",
|
| 311 |
+
"model.language_model.layers.8.linear_attn.in_proj_a.weight",
|
| 312 |
+
"model.language_model.layers.8.linear_attn.in_proj_b.weight",
|
| 313 |
+
"model.language_model.layers.8.linear_attn.in_proj_qkv.weight",
|
| 314 |
+
"model.language_model.layers.8.linear_attn.in_proj_z.weight",
|
| 315 |
+
"model.language_model.layers.8.linear_attn.out_proj.weight",
|
| 316 |
+
"model.language_model.layers.8.mlp.down_proj.weight",
|
| 317 |
+
"model.language_model.layers.8.mlp.gate_proj.weight",
|
| 318 |
+
"model.language_model.layers.8.mlp.up_proj.weight",
|
| 319 |
+
"model.language_model.layers.9.linear_attn.in_proj_a.weight",
|
| 320 |
+
"model.language_model.layers.9.linear_attn.in_proj_b.weight",
|
| 321 |
+
"model.language_model.layers.9.linear_attn.in_proj_qkv.weight",
|
| 322 |
+
"model.language_model.layers.9.linear_attn.in_proj_z.weight",
|
| 323 |
+
"model.language_model.layers.9.linear_attn.out_proj.weight",
|
| 324 |
+
"model.language_model.layers.9.mlp.down_proj.weight",
|
| 325 |
+
"model.language_model.layers.9.mlp.gate_proj.weight",
|
| 326 |
+
"model.language_model.layers.9.mlp.up_proj.weight"
|
| 327 |
+
],
|
| 328 |
+
"runtime_verified": false,
|
| 329 |
+
"schema_version": "axquant.cuda-pack.v1",
|
| 330 |
+
"status": "development"
|
| 331 |
+
}
|
axquant_cuda_plan.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{%- set image_count = namespace(value=0) %}
|
| 2 |
+
{%- set video_count = namespace(value=0) %}
|
| 3 |
+
{%- macro render_content(content, do_vision_count, is_system_content=false) %}
|
| 4 |
+
{%- if content is string %}
|
| 5 |
+
{{- content }}
|
| 6 |
+
{%- elif content is iterable and content is not mapping %}
|
| 7 |
+
{%- for item in content %}
|
| 8 |
+
{%- if 'image' in item or 'image_url' in item or item.type == 'image' %}
|
| 9 |
+
{%- if is_system_content %}
|
| 10 |
+
{{- raise_exception('System message cannot contain images.') }}
|
| 11 |
+
{%- endif %}
|
| 12 |
+
{%- if do_vision_count %}
|
| 13 |
+
{%- set image_count.value = image_count.value + 1 %}
|
| 14 |
+
{%- endif %}
|
| 15 |
+
{%- if add_vision_id %}
|
| 16 |
+
{{- 'Picture ' ~ image_count.value ~ ': ' }}
|
| 17 |
+
{%- endif %}
|
| 18 |
+
{{- '<|vision_start|><|image_pad|><|vision_end|>' }}
|
| 19 |
+
{%- elif 'video' in item or item.type == 'video' %}
|
| 20 |
+
{%- if is_system_content %}
|
| 21 |
+
{{- raise_exception('System message cannot contain videos.') }}
|
| 22 |
+
{%- endif %}
|
| 23 |
+
{%- if do_vision_count %}
|
| 24 |
+
{%- set video_count.value = video_count.value + 1 %}
|
| 25 |
+
{%- endif %}
|
| 26 |
+
{%- if add_vision_id %}
|
| 27 |
+
{{- 'Video ' ~ video_count.value ~ ': ' }}
|
| 28 |
+
{%- endif %}
|
| 29 |
+
{{- '<|vision_start|><|video_pad|><|vision_end|>' }}
|
| 30 |
+
{%- elif 'text' in item %}
|
| 31 |
+
{{- item.text }}
|
| 32 |
+
{%- else %}
|
| 33 |
+
{{- raise_exception('Unexpected item type in content.') }}
|
| 34 |
+
{%- endif %}
|
| 35 |
+
{%- endfor %}
|
| 36 |
+
{%- elif content is none or content is undefined %}
|
| 37 |
+
{{- '' }}
|
| 38 |
+
{%- else %}
|
| 39 |
+
{{- raise_exception('Unexpected content type.') }}
|
| 40 |
+
{%- endif %}
|
| 41 |
+
{%- endmacro %}
|
| 42 |
+
{%- if not messages %}
|
| 43 |
+
{{- raise_exception('No messages provided.') }}
|
| 44 |
+
{%- endif %}
|
| 45 |
+
{%- if tools and tools is iterable and tools is not mapping %}
|
| 46 |
+
{{- '<|im_start|>system\n' }}
|
| 47 |
+
{{- "# Tools\n\nYou have access to the following functions:\n\n<tools>" }}
|
| 48 |
+
{%- for tool in tools %}
|
| 49 |
+
{{- "\n" }}
|
| 50 |
+
{{- tool | tojson }}
|
| 51 |
+
{%- endfor %}
|
| 52 |
+
{{- "\n</tools>" }}
|
| 53 |
+
{{- '\n\nIf you choose to call a function ONLY reply in the following format with NO suffix:\n\n<tool_call>\n<function=example_function_name>\n<parameter=example_parameter_1>\nvalue_1\n</parameter>\n<parameter=example_parameter_2>\nThis is the value for the second parameter\nthat can span\nmultiple lines\n</parameter>\n</function>\n</tool_call>\n\n<IMPORTANT>\nReminder:\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\n- Required parameters MUST be specified\n- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after\n- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls\n</IMPORTANT>' }}
|
| 54 |
+
{%- if messages[0].role == 'system' %}
|
| 55 |
+
{%- set content = render_content(messages[0].content, false, true)|trim %}
|
| 56 |
+
{%- if content %}
|
| 57 |
+
{{- '\n\n' + content }}
|
| 58 |
+
{%- endif %}
|
| 59 |
+
{%- endif %}
|
| 60 |
+
{{- '<|im_end|>\n' }}
|
| 61 |
+
{%- else %}
|
| 62 |
+
{%- if messages[0].role == 'system' %}
|
| 63 |
+
{%- set content = render_content(messages[0].content, false, true)|trim %}
|
| 64 |
+
{{- '<|im_start|>system\n' + content + '<|im_end|>\n' }}
|
| 65 |
+
{%- endif %}
|
| 66 |
+
{%- endif %}
|
| 67 |
+
{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
|
| 68 |
+
{%- for message in messages[::-1] %}
|
| 69 |
+
{%- set index = (messages|length - 1) - loop.index0 %}
|
| 70 |
+
{%- if ns.multi_step_tool and message.role == "user" %}
|
| 71 |
+
{%- set content = render_content(message.content, false)|trim %}
|
| 72 |
+
{%- if not(content.startswith('<tool_response>') and content.endswith('</tool_response>')) %}
|
| 73 |
+
{%- set ns.multi_step_tool = false %}
|
| 74 |
+
{%- set ns.last_query_index = index %}
|
| 75 |
+
{%- endif %}
|
| 76 |
+
{%- endif %}
|
| 77 |
+
{%- endfor %}
|
| 78 |
+
{%- if ns.multi_step_tool %}
|
| 79 |
+
{{- raise_exception('No user query found in messages.') }}
|
| 80 |
+
{%- endif %}
|
| 81 |
+
{%- for message in messages %}
|
| 82 |
+
{%- set content = render_content(message.content, true)|trim %}
|
| 83 |
+
{%- if message.role == "system" %}
|
| 84 |
+
{%- if not loop.first %}
|
| 85 |
+
{{- raise_exception('System message must be at the beginning.') }}
|
| 86 |
+
{%- endif %}
|
| 87 |
+
{%- elif message.role == "user" %}
|
| 88 |
+
{{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
|
| 89 |
+
{%- elif message.role == "assistant" %}
|
| 90 |
+
{%- set reasoning_content = '' %}
|
| 91 |
+
{%- if message.reasoning_content is string %}
|
| 92 |
+
{%- set reasoning_content = message.reasoning_content %}
|
| 93 |
+
{%- else %}
|
| 94 |
+
{%- if '</think>' in content %}
|
| 95 |
+
{%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
|
| 96 |
+
{%- set content = content.split('</think>')[-1].lstrip('\n') %}
|
| 97 |
+
{%- endif %}
|
| 98 |
+
{%- endif %}
|
| 99 |
+
{%- set reasoning_content = reasoning_content|trim %}
|
| 100 |
+
{%- if loop.index0 > ns.last_query_index %}
|
| 101 |
+
{{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content + '\n</think>\n\n' + content }}
|
| 102 |
+
{%- else %}
|
| 103 |
+
{{- '<|im_start|>' + message.role + '\n' + content }}
|
| 104 |
+
{%- endif %}
|
| 105 |
+
{%- if message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}
|
| 106 |
+
{%- for tool_call in message.tool_calls %}
|
| 107 |
+
{%- if tool_call.function is defined %}
|
| 108 |
+
{%- set tool_call = tool_call.function %}
|
| 109 |
+
{%- endif %}
|
| 110 |
+
{%- if loop.first %}
|
| 111 |
+
{%- if content|trim %}
|
| 112 |
+
{{- '\n\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
|
| 113 |
+
{%- else %}
|
| 114 |
+
{{- '<tool_call>\n<function=' + tool_call.name + '>\n' }}
|
| 115 |
+
{%- endif %}
|
| 116 |
+
{%- else %}
|
| 117 |
+
{{- '\n<tool_call>\n<function=' + tool_call.name + '>\n' }}
|
| 118 |
+
{%- endif %}
|
| 119 |
+
{%- if tool_call.arguments is defined %}
|
| 120 |
+
{%- for args_name, args_value in tool_call.arguments|items %}
|
| 121 |
+
{{- '<parameter=' + args_name + '>\n' }}
|
| 122 |
+
{%- set args_value = args_value | tojson | safe if args_value is mapping or (args_value is sequence and args_value is not string) else args_value | string %}
|
| 123 |
+
{{- args_value }}
|
| 124 |
+
{{- '\n</parameter>\n' }}
|
| 125 |
+
{%- endfor %}
|
| 126 |
+
{%- endif %}
|
| 127 |
+
{{- '</function>\n</tool_call>' }}
|
| 128 |
+
{%- endfor %}
|
| 129 |
+
{%- endif %}
|
| 130 |
+
{{- '<|im_end|>\n' }}
|
| 131 |
+
{%- elif message.role == "tool" %}
|
| 132 |
+
{%- if loop.previtem and loop.previtem.role != "tool" %}
|
| 133 |
+
{{- '<|im_start|>user' }}
|
| 134 |
+
{%- endif %}
|
| 135 |
+
{{- '\n<tool_response>\n' }}
|
| 136 |
+
{{- content }}
|
| 137 |
+
{{- '\n</tool_response>' }}
|
| 138 |
+
{%- if not loop.last and loop.nextitem.role != "tool" %}
|
| 139 |
+
{{- '<|im_end|>\n' }}
|
| 140 |
+
{%- elif loop.last %}
|
| 141 |
+
{{- '<|im_end|>\n' }}
|
| 142 |
+
{%- endif %}
|
| 143 |
+
{%- else %}
|
| 144 |
+
{{- raise_exception('Unexpected message role.') }}
|
| 145 |
+
{%- endif %}
|
| 146 |
+
{%- endfor %}
|
| 147 |
+
{%- if add_generation_prompt %}
|
| 148 |
+
{{- '<|im_start|>assistant\n' }}
|
| 149 |
+
{%- if enable_thinking is defined and enable_thinking is false %}
|
| 150 |
+
{{- '<think>\n\n</think>\n\n' }}
|
| 151 |
+
{%- else %}
|
| 152 |
+
{{- '<think>\n' }}
|
| 153 |
+
{%- endif %}
|
| 154 |
+
{%- endif %}
|
config.json
ADDED
|
@@ -0,0 +1,435 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"Qwen3_5ForConditionalGeneration"
|
| 4 |
+
],
|
| 5 |
+
"dtype": "bfloat16",
|
| 6 |
+
"image_token_id": 248056,
|
| 7 |
+
"model_type": "qwen3_5",
|
| 8 |
+
"quantization_config": {
|
| 9 |
+
"config_groups": {
|
| 10 |
+
"nvfp4": {
|
| 11 |
+
"format": "nvfp4-pack-quantized",
|
| 12 |
+
"input_activations": null,
|
| 13 |
+
"output_activations": null,
|
| 14 |
+
"targets": [
|
| 15 |
+
"Linear"
|
| 16 |
+
],
|
| 17 |
+
"weights": {
|
| 18 |
+
"dynamic": false,
|
| 19 |
+
"group_size": 16,
|
| 20 |
+
"num_bits": 4,
|
| 21 |
+
"scale_dtype": "float8_e4m3fn",
|
| 22 |
+
"strategy": "tensor_group",
|
| 23 |
+
"symmetric": true,
|
| 24 |
+
"type": "float"
|
| 25 |
+
}
|
| 26 |
+
}
|
| 27 |
+
},
|
| 28 |
+
"format": "nvfp4-pack-quantized",
|
| 29 |
+
"ignore": [
|
| 30 |
+
"lm_head",
|
| 31 |
+
"model.language_model.embed_tokens",
|
| 32 |
+
"model.language_model.layers.0.input_layernorm",
|
| 33 |
+
"model.language_model.layers.0.linear_attn.conv1d",
|
| 34 |
+
"model.language_model.layers.0.linear_attn.norm",
|
| 35 |
+
"model.language_model.layers.0.post_attention_layernorm",
|
| 36 |
+
"model.language_model.layers.1.input_layernorm",
|
| 37 |
+
"model.language_model.layers.1.linear_attn.conv1d",
|
| 38 |
+
"model.language_model.layers.1.linear_attn.norm",
|
| 39 |
+
"model.language_model.layers.1.post_attention_layernorm",
|
| 40 |
+
"model.language_model.layers.10.input_layernorm",
|
| 41 |
+
"model.language_model.layers.10.linear_attn.conv1d",
|
| 42 |
+
"model.language_model.layers.10.linear_attn.norm",
|
| 43 |
+
"model.language_model.layers.10.post_attention_layernorm",
|
| 44 |
+
"model.language_model.layers.11.input_layernorm",
|
| 45 |
+
"model.language_model.layers.11.post_attention_layernorm",
|
| 46 |
+
"model.language_model.layers.11.self_attn.k_norm",
|
| 47 |
+
"model.language_model.layers.11.self_attn.q_norm",
|
| 48 |
+
"model.language_model.layers.12.input_layernorm",
|
| 49 |
+
"model.language_model.layers.12.linear_attn.conv1d",
|
| 50 |
+
"model.language_model.layers.12.linear_attn.norm",
|
| 51 |
+
"model.language_model.layers.12.post_attention_layernorm",
|
| 52 |
+
"model.language_model.layers.13.input_layernorm",
|
| 53 |
+
"model.language_model.layers.13.linear_attn.conv1d",
|
| 54 |
+
"model.language_model.layers.13.linear_attn.norm",
|
| 55 |
+
"model.language_model.layers.13.post_attention_layernorm",
|
| 56 |
+
"model.language_model.layers.14.input_layernorm",
|
| 57 |
+
"model.language_model.layers.14.linear_attn.conv1d",
|
| 58 |
+
"model.language_model.layers.14.linear_attn.norm",
|
| 59 |
+
"model.language_model.layers.14.post_attention_layernorm",
|
| 60 |
+
"model.language_model.layers.15.input_layernorm",
|
| 61 |
+
"model.language_model.layers.15.post_attention_layernorm",
|
| 62 |
+
"model.language_model.layers.15.self_attn.k_norm",
|
| 63 |
+
"model.language_model.layers.15.self_attn.q_norm",
|
| 64 |
+
"model.language_model.layers.16.input_layernorm",
|
| 65 |
+
"model.language_model.layers.16.linear_attn.conv1d",
|
| 66 |
+
"model.language_model.layers.16.linear_attn.norm",
|
| 67 |
+
"model.language_model.layers.16.post_attention_layernorm",
|
| 68 |
+
"model.language_model.layers.17.input_layernorm",
|
| 69 |
+
"model.language_model.layers.17.linear_attn.conv1d",
|
| 70 |
+
"model.language_model.layers.17.linear_attn.norm",
|
| 71 |
+
"model.language_model.layers.17.post_attention_layernorm",
|
| 72 |
+
"model.language_model.layers.18.input_layernorm",
|
| 73 |
+
"model.language_model.layers.18.linear_attn.conv1d",
|
| 74 |
+
"model.language_model.layers.18.linear_attn.norm",
|
| 75 |
+
"model.language_model.layers.18.post_attention_layernorm",
|
| 76 |
+
"model.language_model.layers.19.input_layernorm",
|
| 77 |
+
"model.language_model.layers.19.post_attention_layernorm",
|
| 78 |
+
"model.language_model.layers.19.self_attn.k_norm",
|
| 79 |
+
"model.language_model.layers.19.self_attn.q_norm",
|
| 80 |
+
"model.language_model.layers.2.input_layernorm",
|
| 81 |
+
"model.language_model.layers.2.linear_attn.conv1d",
|
| 82 |
+
"model.language_model.layers.2.linear_attn.norm",
|
| 83 |
+
"model.language_model.layers.2.post_attention_layernorm",
|
| 84 |
+
"model.language_model.layers.20.input_layernorm",
|
| 85 |
+
"model.language_model.layers.20.linear_attn.conv1d",
|
| 86 |
+
"model.language_model.layers.20.linear_attn.norm",
|
| 87 |
+
"model.language_model.layers.20.post_attention_layernorm",
|
| 88 |
+
"model.language_model.layers.21.input_layernorm",
|
| 89 |
+
"model.language_model.layers.21.linear_attn.conv1d",
|
| 90 |
+
"model.language_model.layers.21.linear_attn.norm",
|
| 91 |
+
"model.language_model.layers.21.post_attention_layernorm",
|
| 92 |
+
"model.language_model.layers.22.input_layernorm",
|
| 93 |
+
"model.language_model.layers.22.linear_attn.conv1d",
|
| 94 |
+
"model.language_model.layers.22.linear_attn.norm",
|
| 95 |
+
"model.language_model.layers.22.post_attention_layernorm",
|
| 96 |
+
"model.language_model.layers.23.input_layernorm",
|
| 97 |
+
"model.language_model.layers.23.post_attention_layernorm",
|
| 98 |
+
"model.language_model.layers.23.self_attn.k_norm",
|
| 99 |
+
"model.language_model.layers.23.self_attn.q_norm",
|
| 100 |
+
"model.language_model.layers.24.input_layernorm",
|
| 101 |
+
"model.language_model.layers.24.linear_attn.conv1d",
|
| 102 |
+
"model.language_model.layers.24.linear_attn.norm",
|
| 103 |
+
"model.language_model.layers.24.post_attention_layernorm",
|
| 104 |
+
"model.language_model.layers.25.input_layernorm",
|
| 105 |
+
"model.language_model.layers.25.linear_attn.conv1d",
|
| 106 |
+
"model.language_model.layers.25.linear_attn.norm",
|
| 107 |
+
"model.language_model.layers.25.post_attention_layernorm",
|
| 108 |
+
"model.language_model.layers.26.input_layernorm",
|
| 109 |
+
"model.language_model.layers.26.linear_attn.conv1d",
|
| 110 |
+
"model.language_model.layers.26.linear_attn.norm",
|
| 111 |
+
"model.language_model.layers.26.post_attention_layernorm",
|
| 112 |
+
"model.language_model.layers.27.input_layernorm",
|
| 113 |
+
"model.language_model.layers.27.post_attention_layernorm",
|
| 114 |
+
"model.language_model.layers.27.self_attn.k_norm",
|
| 115 |
+
"model.language_model.layers.27.self_attn.q_norm",
|
| 116 |
+
"model.language_model.layers.28.input_layernorm",
|
| 117 |
+
"model.language_model.layers.28.linear_attn.conv1d",
|
| 118 |
+
"model.language_model.layers.28.linear_attn.norm",
|
| 119 |
+
"model.language_model.layers.28.post_attention_layernorm",
|
| 120 |
+
"model.language_model.layers.29.input_layernorm",
|
| 121 |
+
"model.language_model.layers.29.linear_attn.conv1d",
|
| 122 |
+
"model.language_model.layers.29.linear_attn.norm",
|
| 123 |
+
"model.language_model.layers.29.post_attention_layernorm",
|
| 124 |
+
"model.language_model.layers.3.input_layernorm",
|
| 125 |
+
"model.language_model.layers.3.post_attention_layernorm",
|
| 126 |
+
"model.language_model.layers.3.self_attn.k_norm",
|
| 127 |
+
"model.language_model.layers.3.self_attn.q_norm",
|
| 128 |
+
"model.language_model.layers.30.input_layernorm",
|
| 129 |
+
"model.language_model.layers.30.linear_attn.conv1d",
|
| 130 |
+
"model.language_model.layers.30.linear_attn.norm",
|
| 131 |
+
"model.language_model.layers.30.post_attention_layernorm",
|
| 132 |
+
"model.language_model.layers.31.input_layernorm",
|
| 133 |
+
"model.language_model.layers.31.post_attention_layernorm",
|
| 134 |
+
"model.language_model.layers.31.self_attn.k_norm",
|
| 135 |
+
"model.language_model.layers.31.self_attn.q_norm",
|
| 136 |
+
"model.language_model.layers.4.input_layernorm",
|
| 137 |
+
"model.language_model.layers.4.linear_attn.conv1d",
|
| 138 |
+
"model.language_model.layers.4.linear_attn.norm",
|
| 139 |
+
"model.language_model.layers.4.post_attention_layernorm",
|
| 140 |
+
"model.language_model.layers.5.input_layernorm",
|
| 141 |
+
"model.language_model.layers.5.linear_attn.conv1d",
|
| 142 |
+
"model.language_model.layers.5.linear_attn.norm",
|
| 143 |
+
"model.language_model.layers.5.post_attention_layernorm",
|
| 144 |
+
"model.language_model.layers.6.input_layernorm",
|
| 145 |
+
"model.language_model.layers.6.linear_attn.conv1d",
|
| 146 |
+
"model.language_model.layers.6.linear_attn.norm",
|
| 147 |
+
"model.language_model.layers.6.post_attention_layernorm",
|
| 148 |
+
"model.language_model.layers.7.input_layernorm",
|
| 149 |
+
"model.language_model.layers.7.post_attention_layernorm",
|
| 150 |
+
"model.language_model.layers.7.self_attn.k_norm",
|
| 151 |
+
"model.language_model.layers.7.self_attn.q_norm",
|
| 152 |
+
"model.language_model.layers.8.input_layernorm",
|
| 153 |
+
"model.language_model.layers.8.linear_attn.conv1d",
|
| 154 |
+
"model.language_model.layers.8.linear_attn.norm",
|
| 155 |
+
"model.language_model.layers.8.post_attention_layernorm",
|
| 156 |
+
"model.language_model.layers.9.input_layernorm",
|
| 157 |
+
"model.language_model.layers.9.linear_attn.conv1d",
|
| 158 |
+
"model.language_model.layers.9.linear_attn.norm",
|
| 159 |
+
"model.language_model.layers.9.post_attention_layernorm",
|
| 160 |
+
"model.language_model.norm",
|
| 161 |
+
"model.visual.blocks.0.attn.proj",
|
| 162 |
+
"model.visual.blocks.0.attn.qkv",
|
| 163 |
+
"model.visual.blocks.0.mlp.linear_fc1",
|
| 164 |
+
"model.visual.blocks.0.mlp.linear_fc2",
|
| 165 |
+
"model.visual.blocks.0.norm1",
|
| 166 |
+
"model.visual.blocks.0.norm2",
|
| 167 |
+
"model.visual.blocks.1.attn.proj",
|
| 168 |
+
"model.visual.blocks.1.attn.qkv",
|
| 169 |
+
"model.visual.blocks.1.mlp.linear_fc1",
|
| 170 |
+
"model.visual.blocks.1.mlp.linear_fc2",
|
| 171 |
+
"model.visual.blocks.1.norm1",
|
| 172 |
+
"model.visual.blocks.1.norm2",
|
| 173 |
+
"model.visual.blocks.10.attn.proj",
|
| 174 |
+
"model.visual.blocks.10.attn.qkv",
|
| 175 |
+
"model.visual.blocks.10.mlp.linear_fc1",
|
| 176 |
+
"model.visual.blocks.10.mlp.linear_fc2",
|
| 177 |
+
"model.visual.blocks.10.norm1",
|
| 178 |
+
"model.visual.blocks.10.norm2",
|
| 179 |
+
"model.visual.blocks.11.attn.proj",
|
| 180 |
+
"model.visual.blocks.11.attn.qkv",
|
| 181 |
+
"model.visual.blocks.11.mlp.linear_fc1",
|
| 182 |
+
"model.visual.blocks.11.mlp.linear_fc2",
|
| 183 |
+
"model.visual.blocks.11.norm1",
|
| 184 |
+
"model.visual.blocks.11.norm2",
|
| 185 |
+
"model.visual.blocks.12.attn.proj",
|
| 186 |
+
"model.visual.blocks.12.attn.qkv",
|
| 187 |
+
"model.visual.blocks.12.mlp.linear_fc1",
|
| 188 |
+
"model.visual.blocks.12.mlp.linear_fc2",
|
| 189 |
+
"model.visual.blocks.12.norm1",
|
| 190 |
+
"model.visual.blocks.12.norm2",
|
| 191 |
+
"model.visual.blocks.13.attn.proj",
|
| 192 |
+
"model.visual.blocks.13.attn.qkv",
|
| 193 |
+
"model.visual.blocks.13.mlp.linear_fc1",
|
| 194 |
+
"model.visual.blocks.13.mlp.linear_fc2",
|
| 195 |
+
"model.visual.blocks.13.norm1",
|
| 196 |
+
"model.visual.blocks.13.norm2",
|
| 197 |
+
"model.visual.blocks.14.attn.proj",
|
| 198 |
+
"model.visual.blocks.14.attn.qkv",
|
| 199 |
+
"model.visual.blocks.14.mlp.linear_fc1",
|
| 200 |
+
"model.visual.blocks.14.mlp.linear_fc2",
|
| 201 |
+
"model.visual.blocks.14.norm1",
|
| 202 |
+
"model.visual.blocks.14.norm2",
|
| 203 |
+
"model.visual.blocks.15.attn.proj",
|
| 204 |
+
"model.visual.blocks.15.attn.qkv",
|
| 205 |
+
"model.visual.blocks.15.mlp.linear_fc1",
|
| 206 |
+
"model.visual.blocks.15.mlp.linear_fc2",
|
| 207 |
+
"model.visual.blocks.15.norm1",
|
| 208 |
+
"model.visual.blocks.15.norm2",
|
| 209 |
+
"model.visual.blocks.16.attn.proj",
|
| 210 |
+
"model.visual.blocks.16.attn.qkv",
|
| 211 |
+
"model.visual.blocks.16.mlp.linear_fc1",
|
| 212 |
+
"model.visual.blocks.16.mlp.linear_fc2",
|
| 213 |
+
"model.visual.blocks.16.norm1",
|
| 214 |
+
"model.visual.blocks.16.norm2",
|
| 215 |
+
"model.visual.blocks.17.attn.proj",
|
| 216 |
+
"model.visual.blocks.17.attn.qkv",
|
| 217 |
+
"model.visual.blocks.17.mlp.linear_fc1",
|
| 218 |
+
"model.visual.blocks.17.mlp.linear_fc2",
|
| 219 |
+
"model.visual.blocks.17.norm1",
|
| 220 |
+
"model.visual.blocks.17.norm2",
|
| 221 |
+
"model.visual.blocks.18.attn.proj",
|
| 222 |
+
"model.visual.blocks.18.attn.qkv",
|
| 223 |
+
"model.visual.blocks.18.mlp.linear_fc1",
|
| 224 |
+
"model.visual.blocks.18.mlp.linear_fc2",
|
| 225 |
+
"model.visual.blocks.18.norm1",
|
| 226 |
+
"model.visual.blocks.18.norm2",
|
| 227 |
+
"model.visual.blocks.19.attn.proj",
|
| 228 |
+
"model.visual.blocks.19.attn.qkv",
|
| 229 |
+
"model.visual.blocks.19.mlp.linear_fc1",
|
| 230 |
+
"model.visual.blocks.19.mlp.linear_fc2",
|
| 231 |
+
"model.visual.blocks.19.norm1",
|
| 232 |
+
"model.visual.blocks.19.norm2",
|
| 233 |
+
"model.visual.blocks.2.attn.proj",
|
| 234 |
+
"model.visual.blocks.2.attn.qkv",
|
| 235 |
+
"model.visual.blocks.2.mlp.linear_fc1",
|
| 236 |
+
"model.visual.blocks.2.mlp.linear_fc2",
|
| 237 |
+
"model.visual.blocks.2.norm1",
|
| 238 |
+
"model.visual.blocks.2.norm2",
|
| 239 |
+
"model.visual.blocks.20.attn.proj",
|
| 240 |
+
"model.visual.blocks.20.attn.qkv",
|
| 241 |
+
"model.visual.blocks.20.mlp.linear_fc1",
|
| 242 |
+
"model.visual.blocks.20.mlp.linear_fc2",
|
| 243 |
+
"model.visual.blocks.20.norm1",
|
| 244 |
+
"model.visual.blocks.20.norm2",
|
| 245 |
+
"model.visual.blocks.21.attn.proj",
|
| 246 |
+
"model.visual.blocks.21.attn.qkv",
|
| 247 |
+
"model.visual.blocks.21.mlp.linear_fc1",
|
| 248 |
+
"model.visual.blocks.21.mlp.linear_fc2",
|
| 249 |
+
"model.visual.blocks.21.norm1",
|
| 250 |
+
"model.visual.blocks.21.norm2",
|
| 251 |
+
"model.visual.blocks.22.attn.proj",
|
| 252 |
+
"model.visual.blocks.22.attn.qkv",
|
| 253 |
+
"model.visual.blocks.22.mlp.linear_fc1",
|
| 254 |
+
"model.visual.blocks.22.mlp.linear_fc2",
|
| 255 |
+
"model.visual.blocks.22.norm1",
|
| 256 |
+
"model.visual.blocks.22.norm2",
|
| 257 |
+
"model.visual.blocks.23.attn.proj",
|
| 258 |
+
"model.visual.blocks.23.attn.qkv",
|
| 259 |
+
"model.visual.blocks.23.mlp.linear_fc1",
|
| 260 |
+
"model.visual.blocks.23.mlp.linear_fc2",
|
| 261 |
+
"model.visual.blocks.23.norm1",
|
| 262 |
+
"model.visual.blocks.23.norm2",
|
| 263 |
+
"model.visual.blocks.24.attn.proj",
|
| 264 |
+
"model.visual.blocks.24.attn.qkv",
|
| 265 |
+
"model.visual.blocks.24.mlp.linear_fc1",
|
| 266 |
+
"model.visual.blocks.24.mlp.linear_fc2",
|
| 267 |
+
"model.visual.blocks.24.norm1",
|
| 268 |
+
"model.visual.blocks.24.norm2",
|
| 269 |
+
"model.visual.blocks.25.attn.proj",
|
| 270 |
+
"model.visual.blocks.25.attn.qkv",
|
| 271 |
+
"model.visual.blocks.25.mlp.linear_fc1",
|
| 272 |
+
"model.visual.blocks.25.mlp.linear_fc2",
|
| 273 |
+
"model.visual.blocks.25.norm1",
|
| 274 |
+
"model.visual.blocks.25.norm2",
|
| 275 |
+
"model.visual.blocks.26.attn.proj",
|
| 276 |
+
"model.visual.blocks.26.attn.qkv",
|
| 277 |
+
"model.visual.blocks.26.mlp.linear_fc1",
|
| 278 |
+
"model.visual.blocks.26.mlp.linear_fc2",
|
| 279 |
+
"model.visual.blocks.26.norm1",
|
| 280 |
+
"model.visual.blocks.26.norm2",
|
| 281 |
+
"model.visual.blocks.3.attn.proj",
|
| 282 |
+
"model.visual.blocks.3.attn.qkv",
|
| 283 |
+
"model.visual.blocks.3.mlp.linear_fc1",
|
| 284 |
+
"model.visual.blocks.3.mlp.linear_fc2",
|
| 285 |
+
"model.visual.blocks.3.norm1",
|
| 286 |
+
"model.visual.blocks.3.norm2",
|
| 287 |
+
"model.visual.blocks.4.attn.proj",
|
| 288 |
+
"model.visual.blocks.4.attn.qkv",
|
| 289 |
+
"model.visual.blocks.4.mlp.linear_fc1",
|
| 290 |
+
"model.visual.blocks.4.mlp.linear_fc2",
|
| 291 |
+
"model.visual.blocks.4.norm1",
|
| 292 |
+
"model.visual.blocks.4.norm2",
|
| 293 |
+
"model.visual.blocks.5.attn.proj",
|
| 294 |
+
"model.visual.blocks.5.attn.qkv",
|
| 295 |
+
"model.visual.blocks.5.mlp.linear_fc1",
|
| 296 |
+
"model.visual.blocks.5.mlp.linear_fc2",
|
| 297 |
+
"model.visual.blocks.5.norm1",
|
| 298 |
+
"model.visual.blocks.5.norm2",
|
| 299 |
+
"model.visual.blocks.6.attn.proj",
|
| 300 |
+
"model.visual.blocks.6.attn.qkv",
|
| 301 |
+
"model.visual.blocks.6.mlp.linear_fc1",
|
| 302 |
+
"model.visual.blocks.6.mlp.linear_fc2",
|
| 303 |
+
"model.visual.blocks.6.norm1",
|
| 304 |
+
"model.visual.blocks.6.norm2",
|
| 305 |
+
"model.visual.blocks.7.attn.proj",
|
| 306 |
+
"model.visual.blocks.7.attn.qkv",
|
| 307 |
+
"model.visual.blocks.7.mlp.linear_fc1",
|
| 308 |
+
"model.visual.blocks.7.mlp.linear_fc2",
|
| 309 |
+
"model.visual.blocks.7.norm1",
|
| 310 |
+
"model.visual.blocks.7.norm2",
|
| 311 |
+
"model.visual.blocks.8.attn.proj",
|
| 312 |
+
"model.visual.blocks.8.attn.qkv",
|
| 313 |
+
"model.visual.blocks.8.mlp.linear_fc1",
|
| 314 |
+
"model.visual.blocks.8.mlp.linear_fc2",
|
| 315 |
+
"model.visual.blocks.8.norm1",
|
| 316 |
+
"model.visual.blocks.8.norm2",
|
| 317 |
+
"model.visual.blocks.9.attn.proj",
|
| 318 |
+
"model.visual.blocks.9.attn.qkv",
|
| 319 |
+
"model.visual.blocks.9.mlp.linear_fc1",
|
| 320 |
+
"model.visual.blocks.9.mlp.linear_fc2",
|
| 321 |
+
"model.visual.blocks.9.norm1",
|
| 322 |
+
"model.visual.blocks.9.norm2",
|
| 323 |
+
"model.visual.merger.linear_fc1",
|
| 324 |
+
"model.visual.merger.linear_fc2",
|
| 325 |
+
"model.visual.merger.norm",
|
| 326 |
+
"model.visual.patch_embed.proj",
|
| 327 |
+
"model.visual.pos_embed",
|
| 328 |
+
"re:.*(?:vision|visual|sam_model|projector|view_sep|image_newline|audio).*"
|
| 329 |
+
],
|
| 330 |
+
"quant_method": "compressed-tensors",
|
| 331 |
+
"quantization_status": "compressed"
|
| 332 |
+
},
|
| 333 |
+
"text_config": {
|
| 334 |
+
"attention_bias": false,
|
| 335 |
+
"attention_dropout": 0.0,
|
| 336 |
+
"attn_output_gate": true,
|
| 337 |
+
"bos_token_id": null,
|
| 338 |
+
"dtype": "bfloat16",
|
| 339 |
+
"eos_token_id": 248044,
|
| 340 |
+
"full_attention_interval": 4,
|
| 341 |
+
"head_dim": 256,
|
| 342 |
+
"hidden_act": "silu",
|
| 343 |
+
"hidden_size": 4096,
|
| 344 |
+
"initializer_range": 0.02,
|
| 345 |
+
"intermediate_size": 12288,
|
| 346 |
+
"layer_types": [
|
| 347 |
+
"linear_attention",
|
| 348 |
+
"linear_attention",
|
| 349 |
+
"linear_attention",
|
| 350 |
+
"full_attention",
|
| 351 |
+
"linear_attention",
|
| 352 |
+
"linear_attention",
|
| 353 |
+
"linear_attention",
|
| 354 |
+
"full_attention",
|
| 355 |
+
"linear_attention",
|
| 356 |
+
"linear_attention",
|
| 357 |
+
"linear_attention",
|
| 358 |
+
"full_attention",
|
| 359 |
+
"linear_attention",
|
| 360 |
+
"linear_attention",
|
| 361 |
+
"linear_attention",
|
| 362 |
+
"full_attention",
|
| 363 |
+
"linear_attention",
|
| 364 |
+
"linear_attention",
|
| 365 |
+
"linear_attention",
|
| 366 |
+
"full_attention",
|
| 367 |
+
"linear_attention",
|
| 368 |
+
"linear_attention",
|
| 369 |
+
"linear_attention",
|
| 370 |
+
"full_attention",
|
| 371 |
+
"linear_attention",
|
| 372 |
+
"linear_attention",
|
| 373 |
+
"linear_attention",
|
| 374 |
+
"full_attention",
|
| 375 |
+
"linear_attention",
|
| 376 |
+
"linear_attention",
|
| 377 |
+
"linear_attention",
|
| 378 |
+
"full_attention"
|
| 379 |
+
],
|
| 380 |
+
"linear_conv_kernel_dim": 4,
|
| 381 |
+
"linear_key_head_dim": 128,
|
| 382 |
+
"linear_num_key_heads": 16,
|
| 383 |
+
"linear_num_value_heads": 32,
|
| 384 |
+
"linear_value_head_dim": 128,
|
| 385 |
+
"mamba_ssm_dtype": "float32",
|
| 386 |
+
"max_position_embeddings": 262144,
|
| 387 |
+
"mlp_only_layers": [],
|
| 388 |
+
"model_type": "qwen3_5_text",
|
| 389 |
+
"mtp_num_hidden_layers": 0,
|
| 390 |
+
"mtp_use_dedicated_embeddings": false,
|
| 391 |
+
"num_attention_heads": 16,
|
| 392 |
+
"num_hidden_layers": 32,
|
| 393 |
+
"num_key_value_heads": 4,
|
| 394 |
+
"pad_token_id": null,
|
| 395 |
+
"partial_rotary_factor": 0.25,
|
| 396 |
+
"rms_norm_eps": 1e-06,
|
| 397 |
+
"rope_parameters": {
|
| 398 |
+
"mrope_interleaved": true,
|
| 399 |
+
"mrope_section": [
|
| 400 |
+
11,
|
| 401 |
+
11,
|
| 402 |
+
10
|
| 403 |
+
],
|
| 404 |
+
"partial_rotary_factor": 0.25,
|
| 405 |
+
"rope_theta": 10000000,
|
| 406 |
+
"rope_type": "default"
|
| 407 |
+
},
|
| 408 |
+
"tie_word_embeddings": false,
|
| 409 |
+
"use_cache": true,
|
| 410 |
+
"vocab_size": 248320
|
| 411 |
+
},
|
| 412 |
+
"tie_word_embeddings": false,
|
| 413 |
+
"torch_dtype": "bfloat16",
|
| 414 |
+
"transformers_version": "5.10.2",
|
| 415 |
+
"video_token_id": 248057,
|
| 416 |
+
"vision_config": {
|
| 417 |
+
"deepstack_visual_indexes": [],
|
| 418 |
+
"depth": 27,
|
| 419 |
+
"dtype": "bfloat16",
|
| 420 |
+
"hidden_act": "gelu_pytorch_tanh",
|
| 421 |
+
"hidden_size": 1152,
|
| 422 |
+
"in_channels": 3,
|
| 423 |
+
"initializer_range": 0.02,
|
| 424 |
+
"intermediate_size": 4304,
|
| 425 |
+
"model_type": "qwen3_5_vision",
|
| 426 |
+
"num_heads": 16,
|
| 427 |
+
"num_position_embeddings": 2304,
|
| 428 |
+
"out_hidden_size": 4096,
|
| 429 |
+
"patch_size": 16,
|
| 430 |
+
"spatial_merge_size": 2,
|
| 431 |
+
"temporal_patch_size": 2
|
| 432 |
+
},
|
| 433 |
+
"vision_end_token_id": 248054,
|
| 434 |
+
"vision_start_token_id": 248053
|
| 435 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"eos_token_id": 248044,
|
| 4 |
+
"transformers_version": "5.10.2",
|
| 5 |
+
"use_cache": true
|
| 6 |
+
}
|
joint_head.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:19cdcec8c81dc9212be320fff47462ab342fbc1278be4368fb3da71241cf5ba0
|
| 3 |
+
size 243538016
|
joint_head_config.json
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"hidden_size": 4096,
|
| 3 |
+
"width": 1024,
|
| 4 |
+
"routing_layers": 2,
|
| 5 |
+
"layers": 4,
|
| 6 |
+
"heads": 16,
|
| 7 |
+
"feedforward": 4096
|
| 8 |
+
}
|
joint_schema_model.py
ADDED
|
@@ -0,0 +1,576 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Clef: a multimodal Qwen backbone with a joint schema head for typed decisions.
|
| 2 |
+
|
| 3 |
+
A record provides a ``state`` (any JSON value), optional ``images`` and ``videos``,
|
| 4 |
+
and ``questions``. Each question has a ``type`` (``noul``, ``choice``, or ``score``),
|
| 5 |
+
``instructions``, and, for ``choice`` and ``score``, ``criteria`` describing the
|
| 6 |
+
allowed options. The model returns one logit per allowed option for every question.
|
| 7 |
+
``systemone`` answers a Jev/SystemOne ``/v1/systemone`` request body with the same
|
| 8 |
+
response body.
|
| 9 |
+
"""
|
| 10 |
+
|
| 11 |
+
from __future__ import annotations
|
| 12 |
+
|
| 13 |
+
import json
|
| 14 |
+
import math
|
| 15 |
+
from dataclasses import dataclass
|
| 16 |
+
from dataclasses import field as dataclass_field
|
| 17 |
+
from pathlib import Path
|
| 18 |
+
from typing import Any
|
| 19 |
+
|
| 20 |
+
import torch
|
| 21 |
+
import torch.nn.functional as functional
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
SYSTEM_PROMPT = (
|
| 25 |
+
"Read the complete state and schema. Decide every field jointly. Each answer "
|
| 26 |
+
"must be exactly one of that field's allowed options."
|
| 27 |
+
)
|
| 28 |
+
IMAGE_PLACEHOLDER = "<|vision_start|><|image_pad|><|vision_end|>"
|
| 29 |
+
VIDEO_PLACEHOLDER = "<|vision_start|><|video_pad|><|vision_end|>"
|
| 30 |
+
MEDIA_BATCH_KEYS = ("pixel_values", "image_grid_thw", "pixel_values_videos", "video_grid_thw")
|
| 31 |
+
MEDIA_TOKEN_KEYS = ("mm_token_type_ids",)
|
| 32 |
+
QUESTION_TYPES = {"noul": 0, "choice": 1, "score": 2}
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
def render(value: Any) -> str:
|
| 36 |
+
if isinstance(value, str):
|
| 37 |
+
return value
|
| 38 |
+
return json.dumps(
|
| 39 |
+
value,
|
| 40 |
+
ensure_ascii=False,
|
| 41 |
+
separators=(",", ":"),
|
| 42 |
+
sort_keys=True,
|
| 43 |
+
)
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
def question_options(question: dict[str, Any]) -> list[tuple[str, Any]]:
|
| 47 |
+
question_type = str(question["type"])
|
| 48 |
+
if question_type == "noul":
|
| 49 |
+
criteria = {
|
| 50 |
+
"true": "The proposition is true or the answer is yes.",
|
| 51 |
+
"false": "The proposition is false or the answer is no.",
|
| 52 |
+
}
|
| 53 |
+
criteria.update(question.get("criteria") or {})
|
| 54 |
+
return [(key, criteria[key]) for key in ("true", "false")]
|
| 55 |
+
if question_type == "choice":
|
| 56 |
+
return sorted((str(key), value) for key, value in question["criteria"].items())
|
| 57 |
+
return [(str(index), value) for index, value in enumerate(question["criteria"])]
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
@dataclass(frozen=True)
|
| 61 |
+
class EncodedQuestion:
|
| 62 |
+
question_id: str
|
| 63 |
+
question_type: int
|
| 64 |
+
question_span: tuple[int, int]
|
| 65 |
+
option_spans: tuple[tuple[int, int], ...]
|
| 66 |
+
option_ids: tuple[str, ...]
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
@dataclass(frozen=True)
|
| 70 |
+
class EncodedRecord:
|
| 71 |
+
input_ids: tuple[int, ...]
|
| 72 |
+
questions: tuple[EncodedQuestion, ...]
|
| 73 |
+
record_id: str
|
| 74 |
+
media: dict[str, Any] | None = dataclass_field(default=None, compare=False, repr=False)
|
| 75 |
+
|
| 76 |
+
|
| 77 |
+
def _tokens(tokenizer: Any, text: str) -> list[int]:
|
| 78 |
+
return tokenizer(text, add_special_tokens=False).input_ids
|
| 79 |
+
|
| 80 |
+
|
| 81 |
+
def _encode_media(processor: Any, record: dict[str, Any]) -> tuple[list[int], dict[str, Any] | None]:
|
| 82 |
+
images = list(record.get("images") or [])
|
| 83 |
+
videos = list(record.get("videos") or [])
|
| 84 |
+
if not images and not videos:
|
| 85 |
+
return [], None
|
| 86 |
+
if processor is None:
|
| 87 |
+
raise ValueError("records with images or videos require a processor")
|
| 88 |
+
text = IMAGE_PLACEHOLDER * len(images) + VIDEO_PLACEHOLDER * len(videos) + "\n"
|
| 89 |
+
encoded = processor(
|
| 90 |
+
text=[text],
|
| 91 |
+
images=images or None,
|
| 92 |
+
videos=videos or None,
|
| 93 |
+
return_tensors="pt",
|
| 94 |
+
**(record.get("media_kwargs") or {}),
|
| 95 |
+
)
|
| 96 |
+
media = {key: encoded[key] for key in MEDIA_BATCH_KEYS if key in encoded}
|
| 97 |
+
for key in MEDIA_TOKEN_KEYS:
|
| 98 |
+
if key in encoded:
|
| 99 |
+
media[key] = encoded[key][0].tolist()
|
| 100 |
+
return encoded["input_ids"][0].tolist(), media
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
def encode_record(
|
| 104 |
+
tokenizer: Any,
|
| 105 |
+
record: dict[str, Any],
|
| 106 |
+
max_length: int = 16384,
|
| 107 |
+
max_state_tokens: int | None = None,
|
| 108 |
+
processor: Any | None = None,
|
| 109 |
+
) -> EncodedRecord:
|
| 110 |
+
schema_ids = _tokens(tokenizer, "\n\nSCHEMA FIELDS:\n")
|
| 111 |
+
questions: list[EncodedQuestion] = []
|
| 112 |
+
for question_index, (question_id, question) in enumerate(record["questions"].items()):
|
| 113 |
+
schema_ids.extend(
|
| 114 |
+
_tokens(
|
| 115 |
+
tokenizer,
|
| 116 |
+
f"\nFIELD {question_index + 1}\nID: {question_id}\nTYPE: {question['type']}\nINSTRUCTION: ",
|
| 117 |
+
)
|
| 118 |
+
)
|
| 119 |
+
question_start = len(schema_ids)
|
| 120 |
+
instructions = question.get("instructions")
|
| 121 |
+
if instructions is None or instructions == "":
|
| 122 |
+
instructions = str(question_id)
|
| 123 |
+
schema_ids.extend(_tokens(tokenizer, render(instructions)))
|
| 124 |
+
question_end = len(schema_ids)
|
| 125 |
+
schema_ids.extend(_tokens(tokenizer, "\nALLOWED OPTIONS:\n"))
|
| 126 |
+
|
| 127 |
+
option_spans: list[tuple[int, int]] = []
|
| 128 |
+
option_ids: list[str] = []
|
| 129 |
+
for option_index, (option_id, description) in enumerate(question_options(question)):
|
| 130 |
+
schema_ids.extend(_tokens(tokenizer, f"OPTION {option_index + 1}: "))
|
| 131 |
+
option_start = len(schema_ids)
|
| 132 |
+
semantics = {"option_id": option_id}
|
| 133 |
+
if description is not None:
|
| 134 |
+
semantics["description"] = description
|
| 135 |
+
schema_ids.extend(_tokens(tokenizer, render(semantics)))
|
| 136 |
+
option_spans.append((option_start, len(schema_ids)))
|
| 137 |
+
option_ids.append(option_id)
|
| 138 |
+
schema_ids.extend(_tokens(tokenizer, "\n"))
|
| 139 |
+
schema_ids.extend(_tokens(tokenizer, "END FIELD\n"))
|
| 140 |
+
questions.append(
|
| 141 |
+
EncodedQuestion(
|
| 142 |
+
question_id=str(question_id),
|
| 143 |
+
question_type=QUESTION_TYPES[str(question["type"])],
|
| 144 |
+
question_span=(question_start, question_end),
|
| 145 |
+
option_spans=tuple(option_spans),
|
| 146 |
+
option_ids=tuple(option_ids),
|
| 147 |
+
)
|
| 148 |
+
)
|
| 149 |
+
|
| 150 |
+
prefix_ids = _tokens(
|
| 151 |
+
tokenizer,
|
| 152 |
+
f"<|im_start|>system\n{SYSTEM_PROMPT}<|im_end|>\n<|im_start|>user\nSTATE:\n",
|
| 153 |
+
)
|
| 154 |
+
suffix_ids = _tokens(
|
| 155 |
+
tokenizer,
|
| 156 |
+
"\n<|im_end|>\n<|im_start|>assistant\n<think>\n\n</think>\n\nJOINT SCHEMA DECISIONS:",
|
| 157 |
+
)
|
| 158 |
+
media_ids, media = _encode_media(processor, record)
|
| 159 |
+
if media is not None:
|
| 160 |
+
media["token_offset"] = len(prefix_ids)
|
| 161 |
+
prefix_ids = prefix_ids + media_ids
|
| 162 |
+
state_ids = _tokens(tokenizer, render(record["state"]))
|
| 163 |
+
if max_state_tokens is not None:
|
| 164 |
+
state_ids = state_ids[:max_state_tokens]
|
| 165 |
+
fixed_length = len(prefix_ids) + len(schema_ids) + len(suffix_ids)
|
| 166 |
+
if fixed_length > max_length:
|
| 167 |
+
raise ValueError(
|
| 168 |
+
f"schema requires {fixed_length} tokens before state; maximum is {max_length}"
|
| 169 |
+
)
|
| 170 |
+
state_ids = state_ids[: max_length - fixed_length]
|
| 171 |
+
schema_offset = len(prefix_ids) + len(state_ids)
|
| 172 |
+
shifted_questions = tuple(
|
| 173 |
+
EncodedQuestion(
|
| 174 |
+
question_id=question.question_id,
|
| 175 |
+
question_type=question.question_type,
|
| 176 |
+
question_span=(
|
| 177 |
+
question.question_span[0] + schema_offset,
|
| 178 |
+
question.question_span[1] + schema_offset,
|
| 179 |
+
),
|
| 180 |
+
option_spans=tuple(
|
| 181 |
+
(start + schema_offset, end + schema_offset)
|
| 182 |
+
for start, end in question.option_spans
|
| 183 |
+
),
|
| 184 |
+
option_ids=question.option_ids,
|
| 185 |
+
)
|
| 186 |
+
for question in questions
|
| 187 |
+
)
|
| 188 |
+
input_ids = tuple(prefix_ids + state_ids + schema_ids + suffix_ids)
|
| 189 |
+
if not input_ids or not shifted_questions:
|
| 190 |
+
raise ValueError("record produced no model input or questions")
|
| 191 |
+
return EncodedRecord(
|
| 192 |
+
input_ids=input_ids,
|
| 193 |
+
questions=shifted_questions,
|
| 194 |
+
record_id=str(record.get("id", "unknown")),
|
| 195 |
+
media=media,
|
| 196 |
+
)
|
| 197 |
+
|
| 198 |
+
|
| 199 |
+
def collate_records(
|
| 200 |
+
records: list[EncodedRecord],
|
| 201 |
+
pad_token_id: int,
|
| 202 |
+
device: torch.device,
|
| 203 |
+
) -> dict[str, Any]:
|
| 204 |
+
maximum_length = max(len(record.input_ids) for record in records)
|
| 205 |
+
input_ids = torch.full(
|
| 206 |
+
(len(records), maximum_length),
|
| 207 |
+
pad_token_id,
|
| 208 |
+
dtype=torch.long,
|
| 209 |
+
device=device,
|
| 210 |
+
)
|
| 211 |
+
attention_mask = torch.zeros(
|
| 212 |
+
(len(records), maximum_length),
|
| 213 |
+
dtype=torch.long,
|
| 214 |
+
device=device,
|
| 215 |
+
)
|
| 216 |
+
for index, record in enumerate(records):
|
| 217 |
+
length = len(record.input_ids)
|
| 218 |
+
input_ids[index, :length] = torch.tensor(record.input_ids, device=device)
|
| 219 |
+
attention_mask[index, :length] = 1
|
| 220 |
+
media: dict[str, torch.Tensor] = {}
|
| 221 |
+
for key in MEDIA_BATCH_KEYS:
|
| 222 |
+
values = [record.media[key] for record in records if record.media and key in record.media]
|
| 223 |
+
if values:
|
| 224 |
+
media[key] = torch.cat(values, dim=0).to(device)
|
| 225 |
+
for key in MEDIA_TOKEN_KEYS:
|
| 226 |
+
if any(record.media and key in record.media for record in records):
|
| 227 |
+
token_values = torch.zeros((len(records), maximum_length), dtype=torch.long, device=device)
|
| 228 |
+
for index, record in enumerate(records):
|
| 229 |
+
if record.media and key in record.media:
|
| 230 |
+
offset = record.media["token_offset"]
|
| 231 |
+
values = torch.tensor(record.media[key], dtype=torch.long, device=device)
|
| 232 |
+
token_values[index, offset : offset + len(values)] = values
|
| 233 |
+
media[key] = token_values
|
| 234 |
+
return {
|
| 235 |
+
"input_ids": input_ids,
|
| 236 |
+
"attention_mask": attention_mask,
|
| 237 |
+
"records": records,
|
| 238 |
+
"media": media,
|
| 239 |
+
}
|
| 240 |
+
|
| 241 |
+
|
| 242 |
+
class EvidenceRoutingLayer(torch.nn.Module):
|
| 243 |
+
def __init__(
|
| 244 |
+
self,
|
| 245 |
+
width: int,
|
| 246 |
+
heads: int,
|
| 247 |
+
feedforward: int,
|
| 248 |
+
dropout: float = 0.0,
|
| 249 |
+
) -> None:
|
| 250 |
+
super().__init__()
|
| 251 |
+
self.query_norm = torch.nn.LayerNorm(width)
|
| 252 |
+
self.memory_norm = torch.nn.LayerNorm(width)
|
| 253 |
+
self.attention = torch.nn.MultiheadAttention(
|
| 254 |
+
width,
|
| 255 |
+
heads,
|
| 256 |
+
dropout=dropout,
|
| 257 |
+
batch_first=True,
|
| 258 |
+
)
|
| 259 |
+
self.attention_dropout = torch.nn.Dropout(dropout)
|
| 260 |
+
self.feedforward_norm = torch.nn.LayerNorm(width)
|
| 261 |
+
self.feedforward = torch.nn.Sequential(
|
| 262 |
+
torch.nn.Linear(width, feedforward),
|
| 263 |
+
torch.nn.GELU(),
|
| 264 |
+
torch.nn.Dropout(dropout),
|
| 265 |
+
torch.nn.Linear(feedforward, width),
|
| 266 |
+
torch.nn.Dropout(dropout),
|
| 267 |
+
)
|
| 268 |
+
|
| 269 |
+
def forward(self, queries: torch.Tensor, memory: torch.Tensor) -> torch.Tensor:
|
| 270 |
+
normalized_queries = self.query_norm(queries)
|
| 271 |
+
routed, _ = self.attention(
|
| 272 |
+
normalized_queries,
|
| 273 |
+
self.memory_norm(memory),
|
| 274 |
+
self.memory_norm(memory),
|
| 275 |
+
need_weights=False,
|
| 276 |
+
)
|
| 277 |
+
queries = queries + self.attention_dropout(routed)
|
| 278 |
+
return queries + self.feedforward(self.feedforward_norm(queries))
|
| 279 |
+
|
| 280 |
+
|
| 281 |
+
class JointSchemaHead(torch.nn.Module):
|
| 282 |
+
def __init__(
|
| 283 |
+
self,
|
| 284 |
+
hidden_size: int,
|
| 285 |
+
width: int,
|
| 286 |
+
routing_layers: int,
|
| 287 |
+
layers: int,
|
| 288 |
+
heads: int,
|
| 289 |
+
feedforward: int,
|
| 290 |
+
dropout: float = 0.0,
|
| 291 |
+
) -> None:
|
| 292 |
+
super().__init__()
|
| 293 |
+
self.hidden_norm = torch.nn.LayerNorm(hidden_size)
|
| 294 |
+
self.memory_projection = torch.nn.Linear(hidden_size, width, bias=False)
|
| 295 |
+
self.question_projection = torch.nn.Linear(hidden_size, width, bias=False)
|
| 296 |
+
self.option_question_projection = torch.nn.Linear(hidden_size, width, bias=False)
|
| 297 |
+
self.global_projection = torch.nn.Linear(hidden_size, width, bias=False)
|
| 298 |
+
self.option_context_projection = torch.nn.Linear(hidden_size, width, bias=False)
|
| 299 |
+
self.option_lexical_projection = torch.nn.Linear(hidden_size, width, bias=False)
|
| 300 |
+
self.type_embedding = torch.nn.Embedding(3, width)
|
| 301 |
+
self.evidence_layers = torch.nn.ModuleList(
|
| 302 |
+
[
|
| 303 |
+
EvidenceRoutingLayer(
|
| 304 |
+
width=width,
|
| 305 |
+
heads=heads,
|
| 306 |
+
feedforward=feedforward,
|
| 307 |
+
dropout=dropout,
|
| 308 |
+
)
|
| 309 |
+
for _ in range(routing_layers)
|
| 310 |
+
]
|
| 311 |
+
)
|
| 312 |
+
self.option_summary_norm = torch.nn.LayerNorm(width)
|
| 313 |
+
self.layers = torch.nn.ModuleList(
|
| 314 |
+
[
|
| 315 |
+
torch.nn.TransformerDecoderLayer(
|
| 316 |
+
d_model=width,
|
| 317 |
+
nhead=heads,
|
| 318 |
+
dim_feedforward=feedforward,
|
| 319 |
+
dropout=dropout,
|
| 320 |
+
activation="gelu",
|
| 321 |
+
batch_first=True,
|
| 322 |
+
norm_first=True,
|
| 323 |
+
)
|
| 324 |
+
for _ in range(layers)
|
| 325 |
+
]
|
| 326 |
+
)
|
| 327 |
+
self.field_norm = torch.nn.LayerNorm(width)
|
| 328 |
+
self.option_norm = torch.nn.LayerNorm(width)
|
| 329 |
+
self.residual_scorer = torch.nn.Sequential(
|
| 330 |
+
torch.nn.Linear(width * 4, width),
|
| 331 |
+
torch.nn.GELU(),
|
| 332 |
+
torch.nn.Dropout(dropout),
|
| 333 |
+
torch.nn.Linear(width, 1),
|
| 334 |
+
)
|
| 335 |
+
self.prior_logit_scale = torch.nn.Parameter(torch.zeros(()))
|
| 336 |
+
self.joint_logit_scale = torch.nn.Parameter(torch.zeros(()))
|
| 337 |
+
self.residual_gate = torch.nn.Parameter(torch.zeros(()))
|
| 338 |
+
|
| 339 |
+
@staticmethod
|
| 340 |
+
def _mean_span(values: torch.Tensor, span: tuple[int, int]) -> torch.Tensor:
|
| 341 |
+
start, end = span
|
| 342 |
+
return values[start:end].mean(dim=0)
|
| 343 |
+
|
| 344 |
+
def forward(
|
| 345 |
+
self,
|
| 346 |
+
hidden_states: torch.Tensor,
|
| 347 |
+
input_ids: torch.Tensor,
|
| 348 |
+
attention_mask: torch.Tensor,
|
| 349 |
+
records: list[EncodedRecord],
|
| 350 |
+
output_embedding_weight: torch.Tensor,
|
| 351 |
+
) -> list[list[torch.Tensor]]:
|
| 352 |
+
results: list[list[torch.Tensor]] = []
|
| 353 |
+
normalized_hidden = self.hidden_norm(hidden_states)
|
| 354 |
+
for batch_index, record in enumerate(records):
|
| 355 |
+
sequence_length = int(attention_mask[batch_index].sum().item())
|
| 356 |
+
sequence_hidden = normalized_hidden[batch_index, :sequence_length]
|
| 357 |
+
memory = self.memory_projection(sequence_hidden).unsqueeze(0)
|
| 358 |
+
global_vector = sequence_hidden[-1]
|
| 359 |
+
question_vectors = torch.stack(
|
| 360 |
+
[
|
| 361 |
+
self._mean_span(sequence_hidden, question.question_span)
|
| 362 |
+
for question in record.questions
|
| 363 |
+
]
|
| 364 |
+
)
|
| 365 |
+
type_ids = torch.tensor(
|
| 366 |
+
[question.question_type for question in record.questions],
|
| 367 |
+
device=hidden_states.device,
|
| 368 |
+
)
|
| 369 |
+
option_contexts: list[torch.Tensor] = []
|
| 370 |
+
lexical_options: list[torch.Tensor] = []
|
| 371 |
+
option_counts = []
|
| 372 |
+
for question in record.questions:
|
| 373 |
+
context_vectors = torch.stack(
|
| 374 |
+
[
|
| 375 |
+
self._mean_span(sequence_hidden, span)
|
| 376 |
+
for span in question.option_spans
|
| 377 |
+
]
|
| 378 |
+
)
|
| 379 |
+
lexical_vectors = []
|
| 380 |
+
for start, end in question.option_spans:
|
| 381 |
+
token_ids = input_ids[batch_index, start:end]
|
| 382 |
+
lexical_vectors.append(output_embedding_weight[token_ids].mean(dim=0))
|
| 383 |
+
lexical = torch.stack(lexical_vectors)
|
| 384 |
+
option_contexts.append(context_vectors)
|
| 385 |
+
lexical_options.append(lexical)
|
| 386 |
+
option_counts.append(len(question.option_spans))
|
| 387 |
+
|
| 388 |
+
option_queries = []
|
| 389 |
+
for question_index, (context_vectors, lexical) in enumerate(
|
| 390 |
+
zip(option_contexts, lexical_options)
|
| 391 |
+
):
|
| 392 |
+
option_queries.append(
|
| 393 |
+
self.option_context_projection(context_vectors)
|
| 394 |
+
+ self.option_lexical_projection(lexical)
|
| 395 |
+
+ self.option_question_projection(
|
| 396 |
+
question_vectors[question_index]
|
| 397 |
+
).unsqueeze(0)
|
| 398 |
+
)
|
| 399 |
+
routed_options = torch.cat(option_queries, dim=0).unsqueeze(0)
|
| 400 |
+
for layer in self.evidence_layers:
|
| 401 |
+
routed_options = layer(routed_options, memory)
|
| 402 |
+
routed_options = routed_options[0]
|
| 403 |
+
split_options = list(torch.split(routed_options, option_counts, dim=0))
|
| 404 |
+
|
| 405 |
+
base_fields = self.question_projection(question_vectors)
|
| 406 |
+
option_summaries = []
|
| 407 |
+
for field, options in zip(base_fields, split_options):
|
| 408 |
+
routing_weights = torch.softmax(
|
| 409 |
+
torch.matmul(options, field) / math.sqrt(options.shape[-1]),
|
| 410 |
+
dim=0,
|
| 411 |
+
)
|
| 412 |
+
option_summaries.append(
|
| 413 |
+
torch.sum(routing_weights.unsqueeze(-1) * options, dim=0)
|
| 414 |
+
)
|
| 415 |
+
fields = (
|
| 416 |
+
base_fields
|
| 417 |
+
+ self.option_summary_norm(torch.stack(option_summaries))
|
| 418 |
+
+ self.global_projection(global_vector).unsqueeze(0)
|
| 419 |
+
+ self.type_embedding(type_ids)
|
| 420 |
+
)
|
| 421 |
+
fields = fields.unsqueeze(0)
|
| 422 |
+
for layer in self.layers:
|
| 423 |
+
fields = layer(fields, memory)
|
| 424 |
+
fields = self.field_norm(fields[0])
|
| 425 |
+
|
| 426 |
+
record_logits: list[torch.Tensor] = []
|
| 427 |
+
for field, question, lexical, routed in zip(
|
| 428 |
+
fields,
|
| 429 |
+
record.questions,
|
| 430 |
+
lexical_options,
|
| 431 |
+
split_options,
|
| 432 |
+
):
|
| 433 |
+
anchor = functional.normalize(
|
| 434 |
+
question_vectors[len(record_logits)] + global_vector,
|
| 435 |
+
dim=-1,
|
| 436 |
+
)
|
| 437 |
+
lexical_anchor = functional.normalize(lexical, dim=-1)
|
| 438 |
+
prior_scale = self.prior_logit_scale.clamp(max=math.log(100.0)).exp()
|
| 439 |
+
prior = prior_scale * torch.matmul(lexical_anchor, anchor)
|
| 440 |
+
options = self.option_norm(routed)
|
| 441 |
+
repeated_field = field.unsqueeze(0).expand_as(options)
|
| 442 |
+
cosine = functional.cosine_similarity(repeated_field, options, dim=-1)
|
| 443 |
+
features = torch.cat(
|
| 444 |
+
[
|
| 445 |
+
repeated_field,
|
| 446 |
+
options,
|
| 447 |
+
repeated_field * options,
|
| 448 |
+
torch.abs(repeated_field - options),
|
| 449 |
+
],
|
| 450 |
+
dim=-1,
|
| 451 |
+
)
|
| 452 |
+
residual = self.residual_scorer(features).squeeze(-1)
|
| 453 |
+
joint_scale = self.joint_logit_scale.clamp(max=math.log(100.0)).exp()
|
| 454 |
+
joint = joint_scale * cosine + residual
|
| 455 |
+
record_logits.append(
|
| 456 |
+
prior + torch.sigmoid(self.residual_gate) * joint
|
| 457 |
+
)
|
| 458 |
+
results.append(record_logits)
|
| 459 |
+
return results
|
| 460 |
+
|
| 461 |
+
|
| 462 |
+
class ClefModel(torch.nn.Module):
|
| 463 |
+
def __init__(self, language_model: Any, head: JointSchemaHead) -> None:
|
| 464 |
+
super().__init__()
|
| 465 |
+
self.language_model = language_model
|
| 466 |
+
self.head = head
|
| 467 |
+
|
| 468 |
+
def forward(self, batch: dict[str, Any]) -> list[list[torch.Tensor]]:
|
| 469 |
+
base_model = (
|
| 470 |
+
self.language_model.get_base_model()
|
| 471 |
+
if hasattr(self.language_model, "get_base_model")
|
| 472 |
+
else self.language_model
|
| 473 |
+
)
|
| 474 |
+
media = batch.get("media") or {}
|
| 475 |
+
text_model = base_model.model
|
| 476 |
+
if not media and hasattr(text_model, "language_model"):
|
| 477 |
+
text_model = text_model.language_model
|
| 478 |
+
outputs = text_model(
|
| 479 |
+
input_ids=batch["input_ids"],
|
| 480 |
+
attention_mask=batch["attention_mask"],
|
| 481 |
+
use_cache=False,
|
| 482 |
+
return_dict=True,
|
| 483 |
+
**media,
|
| 484 |
+
)
|
| 485 |
+
return self.head(
|
| 486 |
+
outputs.last_hidden_state,
|
| 487 |
+
batch["input_ids"],
|
| 488 |
+
batch["attention_mask"],
|
| 489 |
+
batch["records"],
|
| 490 |
+
base_model.get_output_embeddings().weight,
|
| 491 |
+
)
|
| 492 |
+
|
| 493 |
+
|
| 494 |
+
def load_release_model(
|
| 495 |
+
model_path: str | Path,
|
| 496 |
+
device: str | torch.device = "cuda",
|
| 497 |
+
dtype: torch.dtype = torch.bfloat16,
|
| 498 |
+
**from_pretrained_kwargs: Any,
|
| 499 |
+
) -> tuple[ClefModel, Any]:
|
| 500 |
+
"""Load a Clef release (merged backbone, joint schema head, and processor)."""
|
| 501 |
+
from huggingface_hub import snapshot_download
|
| 502 |
+
from safetensors.torch import load_file
|
| 503 |
+
from transformers import AutoProcessor, Qwen3_5ForConditionalGeneration
|
| 504 |
+
|
| 505 |
+
path = Path(model_path)
|
| 506 |
+
if not path.is_dir():
|
| 507 |
+
path = Path(snapshot_download(str(model_path)))
|
| 508 |
+
backbone = Qwen3_5ForConditionalGeneration.from_pretrained(
|
| 509 |
+
path,
|
| 510 |
+
dtype=dtype,
|
| 511 |
+
device_map={"": str(device)},
|
| 512 |
+
**from_pretrained_kwargs,
|
| 513 |
+
)
|
| 514 |
+
backbone.config.use_cache = False
|
| 515 |
+
head_config = json.loads((path / "joint_head_config.json").read_text())
|
| 516 |
+
head = JointSchemaHead(**head_config)
|
| 517 |
+
head.load_state_dict(load_file(path / "joint_head.safetensors"), strict=True)
|
| 518 |
+
head = head.to(device=device, dtype=dtype)
|
| 519 |
+
processor = AutoProcessor.from_pretrained(path)
|
| 520 |
+
return ClefModel(backbone, head).eval(), processor
|
| 521 |
+
|
| 522 |
+
|
| 523 |
+
def systemone_answer(question: dict[str, Any], probabilities: dict[str, float]) -> dict[str, Any]:
|
| 524 |
+
"""Convert per-option probabilities for one question into a SystemOne answer."""
|
| 525 |
+
if question["type"] == "noul":
|
| 526 |
+
return {"type": "noul", "noul": round(probabilities["true"], 4)}
|
| 527 |
+
if question["type"] == "choice":
|
| 528 |
+
options = [str(option) for option in question["criteria"]]
|
| 529 |
+
choice = max(options, key=probabilities.__getitem__)
|
| 530 |
+
return {
|
| 531 |
+
"type": "choice",
|
| 532 |
+
"choice": choice,
|
| 533 |
+
"confidence": round(probabilities[choice], 4),
|
| 534 |
+
"probabilities": {option: round(probabilities[option], 4) for option in options},
|
| 535 |
+
}
|
| 536 |
+
levels = [str(index) for index in range(len(question["criteria"]))]
|
| 537 |
+
return {
|
| 538 |
+
"type": "score",
|
| 539 |
+
"score": round(sum(index * probabilities[level] for index, level in enumerate(levels)), 4),
|
| 540 |
+
"confidence": round(max(probabilities[level] for level in levels), 4),
|
| 541 |
+
"legend": dict(zip(levels, question["criteria"])),
|
| 542 |
+
"probabilities": {level: round(probabilities[level], 4) for level in levels},
|
| 543 |
+
}
|
| 544 |
+
|
| 545 |
+
|
| 546 |
+
@torch.inference_mode()
|
| 547 |
+
def systemone(model: ClefModel, processor: Any, request: dict[str, Any], max_length: int = 16384) -> dict[str, Any]:
|
| 548 |
+
"""Answer a Jev/SystemOne ``/v1/systemone`` request body with a SystemOne response body.
|
| 549 |
+
|
| 550 |
+
The request has ``model``, ``state``, and ``questions``, plus optional ``images`` and ``videos``.
|
| 551 |
+
"""
|
| 552 |
+
questions = request.get("questions")
|
| 553 |
+
if not isinstance(request.get("model"), str) or "state" not in request:
|
| 554 |
+
raise ValueError("model and state are required")
|
| 555 |
+
if not isinstance(questions, dict) or not questions:
|
| 556 |
+
raise ValueError("at least one question is required")
|
| 557 |
+
for question_id, question in questions.items():
|
| 558 |
+
if question.get("type") not in QUESTION_TYPES:
|
| 559 |
+
raise ValueError(f"{question_id}: type must be noul, choice, or score")
|
| 560 |
+
if question["type"] != "noul" and not question.get("criteria"):
|
| 561 |
+
raise ValueError(f"{question_id}: criteria must not be empty")
|
| 562 |
+
encoded = encode_record(processor.tokenizer, request, max_length=max_length, processor=processor)
|
| 563 |
+
device = next(model.parameters()).device
|
| 564 |
+
logits = model(collate_records([encoded], processor.tokenizer.pad_token_id, device))[0]
|
| 565 |
+
answers = {
|
| 566 |
+
question.question_id: systemone_answer(
|
| 567 |
+
questions[question.question_id],
|
| 568 |
+
dict(zip(question.option_ids, question_logits.float().softmax(-1).tolist())),
|
| 569 |
+
)
|
| 570 |
+
for question, question_logits in zip(encoded.questions, logits)
|
| 571 |
+
}
|
| 572 |
+
return {
|
| 573 |
+
"model": request["model"],
|
| 574 |
+
"answers": answers,
|
| 575 |
+
"usage": {"input_tokens": len(encoded.input_ids), "output_tokens": 0},
|
| 576 |
+
}
|
model-00001-of-00004.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8a9e82690ae9d2d503328da4ae9713bec43edc89f8a0d7c3fc825c6193bc1ca3
|
| 3 |
+
size 4314532064
|
model-00002-of-00004.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:3215e2c3fde949292cfec69c0218abecca996b37bbf04f1efde37f195a80a385
|
| 3 |
+
size 1403355332
|
model-00003-of-00004.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c4c8224c9a597fec9caa10e395b04297c24c03840a1390adf49465ed529d51b6
|
| 3 |
+
size 1394148076
|
model-00004-of-00004.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:2025963e1aa8803af9e6940980e00e99c1c87b8e852354f909d001f311612e4a
|
| 3 |
+
size 1762400256
|
model.safetensors.index.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
processor_config.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"image_processor": {
|
| 3 |
+
"do_convert_rgb": true,
|
| 4 |
+
"do_normalize": true,
|
| 5 |
+
"do_rescale": true,
|
| 6 |
+
"do_resize": true,
|
| 7 |
+
"image_mean": [
|
| 8 |
+
0.5,
|
| 9 |
+
0.5,
|
| 10 |
+
0.5
|
| 11 |
+
],
|
| 12 |
+
"image_processor_type": "Qwen2VLImageProcessor",
|
| 13 |
+
"image_std": [
|
| 14 |
+
0.5,
|
| 15 |
+
0.5,
|
| 16 |
+
0.5
|
| 17 |
+
],
|
| 18 |
+
"merge_size": 2,
|
| 19 |
+
"patch_size": 16,
|
| 20 |
+
"resample": 3,
|
| 21 |
+
"rescale_factor": 0.00392156862745098,
|
| 22 |
+
"size": {
|
| 23 |
+
"longest_edge": 16777216,
|
| 24 |
+
"shortest_edge": 65536
|
| 25 |
+
},
|
| 26 |
+
"temporal_patch_size": 2
|
| 27 |
+
},
|
| 28 |
+
"processor_class": "Qwen3VLProcessor",
|
| 29 |
+
"video_processor": {
|
| 30 |
+
"do_convert_rgb": true,
|
| 31 |
+
"do_normalize": true,
|
| 32 |
+
"do_rescale": true,
|
| 33 |
+
"do_resize": true,
|
| 34 |
+
"do_sample_frames": true,
|
| 35 |
+
"fps": 2,
|
| 36 |
+
"image_mean": [
|
| 37 |
+
0.5,
|
| 38 |
+
0.5,
|
| 39 |
+
0.5
|
| 40 |
+
],
|
| 41 |
+
"image_std": [
|
| 42 |
+
0.5,
|
| 43 |
+
0.5,
|
| 44 |
+
0.5
|
| 45 |
+
],
|
| 46 |
+
"max_frames": 768,
|
| 47 |
+
"merge_size": 2,
|
| 48 |
+
"min_frames": 4,
|
| 49 |
+
"patch_size": 16,
|
| 50 |
+
"resample": 3,
|
| 51 |
+
"rescale_factor": 0.00392156862745098,
|
| 52 |
+
"return_metadata": false,
|
| 53 |
+
"size": {
|
| 54 |
+
"longest_edge": 25165824,
|
| 55 |
+
"shortest_edge": 4096
|
| 56 |
+
},
|
| 57 |
+
"temporal_patch_size": 2,
|
| 58 |
+
"video_processor_type": "Qwen3VLVideoProcessor"
|
| 59 |
+
}
|
| 60 |
+
}
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:06b9509352d2af50381ab2247e083b80d32d5c0aba91c272ca9ff729b6a0e523
|
| 3 |
+
size 19989325
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": false,
|
| 3 |
+
"audio_bos_token": "<|audio_start|>",
|
| 4 |
+
"audio_eos_token": "<|audio_end|>",
|
| 5 |
+
"audio_token": "<|audio_pad|>",
|
| 6 |
+
"backend": "tokenizers",
|
| 7 |
+
"bos_token": null,
|
| 8 |
+
"clean_up_tokenization_spaces": false,
|
| 9 |
+
"eos_token": "<|im_end|>",
|
| 10 |
+
"errors": "replace",
|
| 11 |
+
"image_token": "<|image_pad|>",
|
| 12 |
+
"model_max_length": 262144,
|
| 13 |
+
"model_specific_special_tokens": {
|
| 14 |
+
"audio_bos_token": "<|audio_start|>",
|
| 15 |
+
"audio_eos_token": "<|audio_end|>",
|
| 16 |
+
"audio_token": "<|audio_pad|>",
|
| 17 |
+
"image_token": "<|image_pad|>",
|
| 18 |
+
"video_token": "<|video_pad|>",
|
| 19 |
+
"vision_bos_token": "<|vision_start|>",
|
| 20 |
+
"vision_eos_token": "<|vision_end|>"
|
| 21 |
+
},
|
| 22 |
+
"pad_token": "<|endoftext|>",
|
| 23 |
+
"pretokenize_regex": "(?i:'s|'t|'re|'ve|'m|'ll|'d)|[^\\r\\n\\p{L}\\p{N}]?[\\p{L}\\p{M}]+|\\p{N}| ?[^\\s\\p{L}\\p{M}\\p{N}]+[\\r\\n]*|\\s*[\\r\\n]+|\\s+(?!\\S)|\\s+",
|
| 24 |
+
"split_special_tokens": false,
|
| 25 |
+
"tokenizer_class": "Qwen2Tokenizer",
|
| 26 |
+
"unk_token": null,
|
| 27 |
+
"video_token": "<|video_pad|>",
|
| 28 |
+
"vision_bos_token": "<|vision_start|>",
|
| 29 |
+
"vision_eos_token": "<|vision_end|>"
|
| 30 |
+
}
|