Add Cosmos-Reason2-2B-NVFP4: NVFP4 quantized with llm-compressor (BF16 vision + DeepStack preserved)
Browse files- .gitattributes +1 -0
- README.md +170 -0
- chat_template.jinja +120 -0
- config.json +220 -0
- generation_config.json +14 -0
- model.safetensors +3 -0
- processor_config.json +60 -0
- recipe.yaml +7 -0
- tokenizer.json +3 -0
- tokenizer_config.json +31 -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
|
README.md
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
license_name: nvidia-open-model-license
|
| 4 |
+
license_link: https://www.nvidia.com/en-us/agreements/enterprise-software/nvidia-open-model-license
|
| 5 |
+
library_name: transformers
|
| 6 |
+
pipeline_tag: image-text-to-text
|
| 7 |
+
base_model: nvidia/Cosmos-Reason2-2B
|
| 8 |
+
tags:
|
| 9 |
+
- nvfp4
|
| 10 |
+
- quantized
|
| 11 |
+
- compressed-tensors
|
| 12 |
+
- blackwell
|
| 13 |
+
- physical-ai
|
| 14 |
+
- embodied-reasoning
|
| 15 |
+
- cosmos
|
| 16 |
+
- nvidia
|
| 17 |
+
- vllm
|
| 18 |
+
quantized_by: vrfai
|
| 19 |
+
extra_gated_prompt: >-
|
| 20 |
+
By downloading this model, you agree to the
|
| 21 |
+
[NVIDIA Open Model License Agreement](https://www.nvidia.com/en-us/agreements/enterprise-software/nvidia-open-model-license).
|
| 22 |
+
---
|
| 23 |
+
|
| 24 |
+
# Cosmos-Reason2-2B-NVFP4
|
| 25 |
+
|
| 26 |
+
NVFP4 quantized version of [nvidia/Cosmos-Reason2-2B](https://huggingface.co/nvidia/Cosmos-Reason2-2B) by [vrfai](https://huggingface.co/vrfai) using [llm-compressor](https://github.com/vllm-project/llm-compressor).
|
| 27 |
+
|
| 28 |
+
> **License:** This model inherits the [NVIDIA Open Model License](https://www.nvidia.com/en-us/agreements/enterprise-software/nvidia-open-model-license) from the base model. Commercial use and derivative models are permitted under its terms.
|
| 29 |
+
|
| 30 |
+
## NVFP4 Quantization Details
|
| 31 |
+
|
| 32 |
+
| | |
|
| 33 |
+
|---|---|
|
| 34 |
+
| **Base model** | [nvidia/Cosmos-Reason2-2B](https://huggingface.co/nvidia/Cosmos-Reason2-2B) |
|
| 35 |
+
| **Quantization** | NVFP4 — weights FP4, activations FP4 (dynamic local), scales FP8 |
|
| 36 |
+
| **Format** | `compressed-tensors` (native vLLM support) |
|
| 37 |
+
| **Tool** | [vllm-project/llm-compressor](https://github.com/vllm-project/llm-compressor) |
|
| 38 |
+
| **Model size** | 4.6 GB → **2.7 GB** (~41% reduction) |
|
| 39 |
+
| **Requires** | NVIDIA Blackwell GPU (SM 120+), vLLM ≥ 0.19 |
|
| 40 |
+
|
| 41 |
+
### What's Quantized / What's Not
|
| 42 |
+
|
| 43 |
+
Unlike hybrid-attention models (e.g. Qwen3.6), Cosmos-Reason2-2B uses a standard transformer backbone — all language model linear layers are quantized. Only the visual components and output head are preserved in BF16:
|
| 44 |
+
|
| 45 |
+
| Component | Precision | Reason |
|
| 46 |
+
|---|---|---|
|
| 47 |
+
| All LLM layers — FFN + attention projections (28 layers) | **NVFP4** | Standard transformer, stable under 4-bit |
|
| 48 |
+
| Vision encoder — all 24 blocks + merger | **BF16** | Preserved for visual perception quality |
|
| 49 |
+
| DeepStack merger list (3×) | **BF16** | Multi-scale visual fusion, sensitive to precision |
|
| 50 |
+
| `lm_head` | **BF16** | Output logits preserved for generation stability |
|
| 51 |
+
|
| 52 |
+
### Quantization Config (llm-compressor)
|
| 53 |
+
|
| 54 |
+
```yaml
|
| 55 |
+
# recipe.yaml
|
| 56 |
+
QuantizationModifier:
|
| 57 |
+
targets: [Linear]
|
| 58 |
+
scheme: NVFP4
|
| 59 |
+
ignore:
|
| 60 |
+
- lm_head
|
| 61 |
+
# Vision encoder — 24 blocks (attn + mlp) + merger
|
| 62 |
+
- re:model\.visual\.blocks\.\d+\..*
|
| 63 |
+
- model.visual.merger.linear_fc1
|
| 64 |
+
- model.visual.merger.linear_fc2
|
| 65 |
+
# DeepStack multi-scale merger
|
| 66 |
+
- re:model\.visual\.deepstack_merger_list\.\d+\..*
|
| 67 |
+
```
|
| 68 |
+
|
| 69 |
+
---
|
| 70 |
+
|
| 71 |
+
## Quick Start (vLLM)
|
| 72 |
+
|
| 73 |
+
```bash
|
| 74 |
+
vllm serve vrfai/Cosmos-Reason2-2B-NVFP4 \
|
| 75 |
+
--max-model-len 8192
|
| 76 |
+
```
|
| 77 |
+
|
| 78 |
+
The model fits comfortably on a single RTX 5090 (32 GB). No `--tensor-parallel-size` needed.
|
| 79 |
+
|
| 80 |
+
### Python (Transformers)
|
| 81 |
+
|
| 82 |
+
```python
|
| 83 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 84 |
+
|
| 85 |
+
model_name = "vrfai/Cosmos-Reason2-2B-NVFP4"
|
| 86 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
|
| 87 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 88 |
+
model_name,
|
| 89 |
+
torch_dtype="auto",
|
| 90 |
+
device_map="auto",
|
| 91 |
+
trust_remote_code=True,
|
| 92 |
+
)
|
| 93 |
+
```
|
| 94 |
+
|
| 95 |
+
### OpenAI-compatible API
|
| 96 |
+
|
| 97 |
+
```python
|
| 98 |
+
from openai import OpenAI
|
| 99 |
+
|
| 100 |
+
client = OpenAI(base_url="http://localhost:8000/v1", api_key="EMPTY")
|
| 101 |
+
response = client.chat.completions.create(
|
| 102 |
+
model="vrfai/Cosmos-Reason2-2B-NVFP4",
|
| 103 |
+
messages=[
|
| 104 |
+
{
|
| 105 |
+
"role": "user",
|
| 106 |
+
"content": [
|
| 107 |
+
{"type": "image_url", "image_url": {"url": "https://..."}},
|
| 108 |
+
{"type": "text", "text": "Describe the physical interaction in this scene."}
|
| 109 |
+
]
|
| 110 |
+
}
|
| 111 |
+
],
|
| 112 |
+
temperature=0.7,
|
| 113 |
+
max_tokens=512,
|
| 114 |
+
)
|
| 115 |
+
print(response.choices[0].message.content)
|
| 116 |
+
```
|
| 117 |
+
|
| 118 |
+
---
|
| 119 |
+
|
| 120 |
+
## Tested Environment
|
| 121 |
+
|
| 122 |
+
| Component | Version |
|
| 123 |
+
|-----------|---------|
|
| 124 |
+
| vLLM | 0.19.1 |
|
| 125 |
+
| Transformers | 5.6.0 |
|
| 126 |
+
| PyTorch | 2.10.0+cu128 |
|
| 127 |
+
| CUDA | 12.8 (nvcc 12.8.61) |
|
| 128 |
+
| llm-compressor | compressed-tensors 0.14.0.1 |
|
| 129 |
+
| GPU | 1× NVIDIA RTX 5090 |
|
| 130 |
+
|
| 131 |
+
---
|
| 132 |
+
|
| 133 |
+
## Model Overview
|
| 134 |
+
|
| 135 |
+
Cosmos-Reason2-2B is a vision-language model developed by NVIDIA for **Physical AI reasoning** — understanding physical common sense and embodied interactions from video and image inputs. It is designed for use as a planner or reasoning backbone in robotics and Vision-Language-Action (VLA) pipelines.
|
| 136 |
+
|
| 137 |
+
| | |
|
| 138 |
+
|---|---|
|
| 139 |
+
| **Architecture** | `Qwen3VLForConditionalGeneration` |
|
| 140 |
+
| **Parameters** | ~2B |
|
| 141 |
+
| **Hidden size** | 2048 |
|
| 142 |
+
| **Layers** | 28 (standard GQA transformer) |
|
| 143 |
+
| **Attention heads** | 16 Q / 8 KV |
|
| 144 |
+
| **Vision encoder depth** | 24 blocks (DeepStack-enhanced) |
|
| 145 |
+
| **Context length** | 262,144 tokens |
|
| 146 |
+
| **Input modalities** | Text, image, video |
|
| 147 |
+
|
| 148 |
+
### Quality Benchmarks
|
| 149 |
+
|
| 150 |
+
For benchmark results see the [Physical AI Bench Leaderboard](https://huggingface.co/spaces/shi-labs/physical-ai-bench-leaderboard) and the [base model card](https://huggingface.co/nvidia/Cosmos-Reason2-2B).
|
| 151 |
+
|
| 152 |
+
---
|
| 153 |
+
|
| 154 |
+
## Ethical Considerations & Safety
|
| 155 |
+
|
| 156 |
+
> This section is reproduced from the [base model card](https://huggingface.co/nvidia/Cosmos-Reason2-2B) and applies equally to this quantized derivative.
|
| 157 |
+
|
| 158 |
+
This model is intended for **Physical AI developers** working on embodied reasoning tasks. Users are responsible for model inputs and outputs, including implementing appropriate guardrails prior to deployment.
|
| 159 |
+
|
| 160 |
+
**Safety note:** Because this model is designed for robot planning and can serve as a VLA backbone, its outputs may directly influence physical actuation. Planning errors or misinterpretations carry inherent life-safety risks, including physical collisions or unsafe object manipulation.
|
| 161 |
+
|
| 162 |
+
Please report security vulnerabilities or NVIDIA AI concerns [here](https://www.nvidia.com/en-us/support/submit-security-vulnerability/).
|
| 163 |
+
|
| 164 |
+
---
|
| 165 |
+
|
| 166 |
+
## Credits
|
| 167 |
+
|
| 168 |
+
- **Original model:** [NVIDIA](https://huggingface.co/nvidia) — [Cosmos-Reason2-2B](https://huggingface.co/nvidia/Cosmos-Reason2-2B)
|
| 169 |
+
- **NVFP4 quantization:** [vrfai](https://huggingface.co/vrfai)
|
| 170 |
+
- **Quantization framework:** [vllm-project/llm-compressor](https://github.com/vllm-project/llm-compressor)
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{%- if tools %}
|
| 2 |
+
{{- '<|im_start|>system\n' }}
|
| 3 |
+
{%- if messages[0].role == 'system' %}
|
| 4 |
+
{%- if messages[0].content is string %}
|
| 5 |
+
{{- messages[0].content }}
|
| 6 |
+
{%- else %}
|
| 7 |
+
{%- for content in messages[0].content %}
|
| 8 |
+
{%- if 'text' in content %}
|
| 9 |
+
{{- content.text }}
|
| 10 |
+
{%- endif %}
|
| 11 |
+
{%- endfor %}
|
| 12 |
+
{%- endif %}
|
| 13 |
+
{{- '\n\n' }}
|
| 14 |
+
{%- endif %}
|
| 15 |
+
{{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
|
| 16 |
+
{%- for tool in tools %}
|
| 17 |
+
{{- "\n" }}
|
| 18 |
+
{{- tool | tojson }}
|
| 19 |
+
{%- endfor %}
|
| 20 |
+
{{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
|
| 21 |
+
{%- else %}
|
| 22 |
+
{%- if messages[0].role == 'system' %}
|
| 23 |
+
{{- '<|im_start|>system\n' }}
|
| 24 |
+
{%- if messages[0].content is string %}
|
| 25 |
+
{{- messages[0].content }}
|
| 26 |
+
{%- else %}
|
| 27 |
+
{%- for content in messages[0].content %}
|
| 28 |
+
{%- if 'text' in content %}
|
| 29 |
+
{{- content.text }}
|
| 30 |
+
{%- endif %}
|
| 31 |
+
{%- endfor %}
|
| 32 |
+
{%- endif %}
|
| 33 |
+
{{- '<|im_end|>\n' }}
|
| 34 |
+
{%- endif %}
|
| 35 |
+
{%- endif %}
|
| 36 |
+
{%- set image_count = namespace(value=0) %}
|
| 37 |
+
{%- set video_count = namespace(value=0) %}
|
| 38 |
+
{%- for message in messages %}
|
| 39 |
+
{%- if message.role == "user" %}
|
| 40 |
+
{{- '<|im_start|>' + message.role + '\n' }}
|
| 41 |
+
{%- if message.content is string %}
|
| 42 |
+
{{- message.content }}
|
| 43 |
+
{%- else %}
|
| 44 |
+
{%- for content in message.content %}
|
| 45 |
+
{%- if content.type == 'image' or 'image' in content or 'image_url' in content %}
|
| 46 |
+
{%- set image_count.value = image_count.value + 1 %}
|
| 47 |
+
{%- if add_vision_id %}Picture {{ image_count.value }}: {% endif -%}
|
| 48 |
+
<|vision_start|><|image_pad|><|vision_end|>
|
| 49 |
+
{%- elif content.type == 'video' or 'video' in content %}
|
| 50 |
+
{%- set video_count.value = video_count.value + 1 %}
|
| 51 |
+
{%- if add_vision_id %}Video {{ video_count.value }}: {% endif -%}
|
| 52 |
+
<|vision_start|><|video_pad|><|vision_end|>
|
| 53 |
+
{%- elif 'text' in content %}
|
| 54 |
+
{{- content.text }}
|
| 55 |
+
{%- endif %}
|
| 56 |
+
{%- endfor %}
|
| 57 |
+
{%- endif %}
|
| 58 |
+
{{- '<|im_end|>\n' }}
|
| 59 |
+
{%- elif message.role == "assistant" %}
|
| 60 |
+
{{- '<|im_start|>' + message.role + '\n' }}
|
| 61 |
+
{%- if message.content is string %}
|
| 62 |
+
{{- message.content }}
|
| 63 |
+
{%- else %}
|
| 64 |
+
{%- for content_item in message.content %}
|
| 65 |
+
{%- if 'text' in content_item %}
|
| 66 |
+
{{- content_item.text }}
|
| 67 |
+
{%- endif %}
|
| 68 |
+
{%- endfor %}
|
| 69 |
+
{%- endif %}
|
| 70 |
+
{%- if message.tool_calls %}
|
| 71 |
+
{%- for tool_call in message.tool_calls %}
|
| 72 |
+
{%- if (loop.first and message.content) or (not loop.first) %}
|
| 73 |
+
{{- '\n' }}
|
| 74 |
+
{%- endif %}
|
| 75 |
+
{%- if tool_call.function %}
|
| 76 |
+
{%- set tool_call = tool_call.function %}
|
| 77 |
+
{%- endif %}
|
| 78 |
+
{{- '<tool_call>\n{"name": "' }}
|
| 79 |
+
{{- tool_call.name }}
|
| 80 |
+
{{- '", "arguments": ' }}
|
| 81 |
+
{%- if tool_call.arguments is string %}
|
| 82 |
+
{{- tool_call.arguments }}
|
| 83 |
+
{%- else %}
|
| 84 |
+
{{- tool_call.arguments | tojson }}
|
| 85 |
+
{%- endif %}
|
| 86 |
+
{{- '}\n</tool_call>' }}
|
| 87 |
+
{%- endfor %}
|
| 88 |
+
{%- endif %}
|
| 89 |
+
{{- '<|im_end|>\n' }}
|
| 90 |
+
{%- elif message.role == "tool" %}
|
| 91 |
+
{%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
|
| 92 |
+
{{- '<|im_start|>user' }}
|
| 93 |
+
{%- endif %}
|
| 94 |
+
{{- '\n<tool_response>\n' }}
|
| 95 |
+
{%- if message.content is string %}
|
| 96 |
+
{{- message.content }}
|
| 97 |
+
{%- else %}
|
| 98 |
+
{%- for content in message.content %}
|
| 99 |
+
{%- if content.type == 'image' or 'image' in content or 'image_url' in content %}
|
| 100 |
+
{%- set image_count.value = image_count.value + 1 %}
|
| 101 |
+
{%- if add_vision_id %}Picture {{ image_count.value }}: {% endif -%}
|
| 102 |
+
<|vision_start|><|image_pad|><|vision_end|>
|
| 103 |
+
{%- elif content.type == 'video' or 'video' in content %}
|
| 104 |
+
{%- set video_count.value = video_count.value + 1 %}
|
| 105 |
+
{%- if add_vision_id %}Video {{ video_count.value }}: {% endif -%}
|
| 106 |
+
<|vision_start|><|video_pad|><|vision_end|>
|
| 107 |
+
{%- elif 'text' in content %}
|
| 108 |
+
{{- content.text }}
|
| 109 |
+
{%- endif %}
|
| 110 |
+
{%- endfor %}
|
| 111 |
+
{%- endif %}
|
| 112 |
+
{{- '\n</tool_response>' }}
|
| 113 |
+
{%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
|
| 114 |
+
{{- '<|im_end|>\n' }}
|
| 115 |
+
{%- endif %}
|
| 116 |
+
{%- endif %}
|
| 117 |
+
{%- endfor %}
|
| 118 |
+
{%- if add_generation_prompt %}
|
| 119 |
+
{{- '<|im_start|>assistant\n' }}
|
| 120 |
+
{%- endif %}
|
config.json
ADDED
|
@@ -0,0 +1,220 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"Qwen3VLForConditionalGeneration"
|
| 4 |
+
],
|
| 5 |
+
"dtype": "bfloat16",
|
| 6 |
+
"image_token_id": 151655,
|
| 7 |
+
"model_type": "qwen3_vl",
|
| 8 |
+
"quantization_config": {
|
| 9 |
+
"config_groups": {
|
| 10 |
+
"group_0": {
|
| 11 |
+
"format": "nvfp4-pack-quantized",
|
| 12 |
+
"input_activations": {
|
| 13 |
+
"actorder": null,
|
| 14 |
+
"block_structure": null,
|
| 15 |
+
"dynamic": "local",
|
| 16 |
+
"group_size": 16,
|
| 17 |
+
"num_bits": 4,
|
| 18 |
+
"observer": "static_minmax",
|
| 19 |
+
"observer_kwargs": {},
|
| 20 |
+
"scale_dtype": "torch.float8_e4m3fn",
|
| 21 |
+
"strategy": "tensor_group",
|
| 22 |
+
"symmetric": true,
|
| 23 |
+
"type": "float",
|
| 24 |
+
"zp_dtype": null
|
| 25 |
+
},
|
| 26 |
+
"output_activations": null,
|
| 27 |
+
"targets": [
|
| 28 |
+
"Linear"
|
| 29 |
+
],
|
| 30 |
+
"weights": {
|
| 31 |
+
"actorder": null,
|
| 32 |
+
"block_structure": null,
|
| 33 |
+
"dynamic": false,
|
| 34 |
+
"group_size": 16,
|
| 35 |
+
"num_bits": 4,
|
| 36 |
+
"observer": "memoryless_minmax",
|
| 37 |
+
"observer_kwargs": {},
|
| 38 |
+
"scale_dtype": "torch.float8_e4m3fn",
|
| 39 |
+
"strategy": "tensor_group",
|
| 40 |
+
"symmetric": true,
|
| 41 |
+
"type": "float",
|
| 42 |
+
"zp_dtype": null
|
| 43 |
+
}
|
| 44 |
+
}
|
| 45 |
+
},
|
| 46 |
+
"format": "nvfp4-pack-quantized",
|
| 47 |
+
"global_compression_ratio": null,
|
| 48 |
+
"ignore": [
|
| 49 |
+
"model.visual.blocks.0.attn.qkv",
|
| 50 |
+
"model.visual.blocks.0.attn.proj",
|
| 51 |
+
"model.visual.blocks.0.mlp.linear_fc1",
|
| 52 |
+
"model.visual.blocks.0.mlp.linear_fc2",
|
| 53 |
+
"model.visual.blocks.1.attn.qkv",
|
| 54 |
+
"model.visual.blocks.1.attn.proj",
|
| 55 |
+
"model.visual.blocks.1.mlp.linear_fc1",
|
| 56 |
+
"model.visual.blocks.1.mlp.linear_fc2",
|
| 57 |
+
"model.visual.blocks.2.attn.qkv",
|
| 58 |
+
"model.visual.blocks.2.attn.proj",
|
| 59 |
+
"model.visual.blocks.2.mlp.linear_fc1",
|
| 60 |
+
"model.visual.blocks.2.mlp.linear_fc2",
|
| 61 |
+
"model.visual.blocks.3.attn.qkv",
|
| 62 |
+
"model.visual.blocks.3.attn.proj",
|
| 63 |
+
"model.visual.blocks.3.mlp.linear_fc1",
|
| 64 |
+
"model.visual.blocks.3.mlp.linear_fc2",
|
| 65 |
+
"model.visual.blocks.4.attn.qkv",
|
| 66 |
+
"model.visual.blocks.4.attn.proj",
|
| 67 |
+
"model.visual.blocks.4.mlp.linear_fc1",
|
| 68 |
+
"model.visual.blocks.4.mlp.linear_fc2",
|
| 69 |
+
"model.visual.blocks.5.attn.qkv",
|
| 70 |
+
"model.visual.blocks.5.attn.proj",
|
| 71 |
+
"model.visual.blocks.5.mlp.linear_fc1",
|
| 72 |
+
"model.visual.blocks.5.mlp.linear_fc2",
|
| 73 |
+
"model.visual.blocks.6.attn.qkv",
|
| 74 |
+
"model.visual.blocks.6.attn.proj",
|
| 75 |
+
"model.visual.blocks.6.mlp.linear_fc1",
|
| 76 |
+
"model.visual.blocks.6.mlp.linear_fc2",
|
| 77 |
+
"model.visual.blocks.7.attn.qkv",
|
| 78 |
+
"model.visual.blocks.7.attn.proj",
|
| 79 |
+
"model.visual.blocks.7.mlp.linear_fc1",
|
| 80 |
+
"model.visual.blocks.7.mlp.linear_fc2",
|
| 81 |
+
"model.visual.blocks.8.attn.qkv",
|
| 82 |
+
"model.visual.blocks.8.attn.proj",
|
| 83 |
+
"model.visual.blocks.8.mlp.linear_fc1",
|
| 84 |
+
"model.visual.blocks.8.mlp.linear_fc2",
|
| 85 |
+
"model.visual.blocks.9.attn.qkv",
|
| 86 |
+
"model.visual.blocks.9.attn.proj",
|
| 87 |
+
"model.visual.blocks.9.mlp.linear_fc1",
|
| 88 |
+
"model.visual.blocks.9.mlp.linear_fc2",
|
| 89 |
+
"model.visual.blocks.10.attn.qkv",
|
| 90 |
+
"model.visual.blocks.10.attn.proj",
|
| 91 |
+
"model.visual.blocks.10.mlp.linear_fc1",
|
| 92 |
+
"model.visual.blocks.10.mlp.linear_fc2",
|
| 93 |
+
"model.visual.blocks.11.attn.qkv",
|
| 94 |
+
"model.visual.blocks.11.attn.proj",
|
| 95 |
+
"model.visual.blocks.11.mlp.linear_fc1",
|
| 96 |
+
"model.visual.blocks.11.mlp.linear_fc2",
|
| 97 |
+
"model.visual.blocks.12.attn.qkv",
|
| 98 |
+
"model.visual.blocks.12.attn.proj",
|
| 99 |
+
"model.visual.blocks.12.mlp.linear_fc1",
|
| 100 |
+
"model.visual.blocks.12.mlp.linear_fc2",
|
| 101 |
+
"model.visual.blocks.13.attn.qkv",
|
| 102 |
+
"model.visual.blocks.13.attn.proj",
|
| 103 |
+
"model.visual.blocks.13.mlp.linear_fc1",
|
| 104 |
+
"model.visual.blocks.13.mlp.linear_fc2",
|
| 105 |
+
"model.visual.blocks.14.attn.qkv",
|
| 106 |
+
"model.visual.blocks.14.attn.proj",
|
| 107 |
+
"model.visual.blocks.14.mlp.linear_fc1",
|
| 108 |
+
"model.visual.blocks.14.mlp.linear_fc2",
|
| 109 |
+
"model.visual.blocks.15.attn.qkv",
|
| 110 |
+
"model.visual.blocks.15.attn.proj",
|
| 111 |
+
"model.visual.blocks.15.mlp.linear_fc1",
|
| 112 |
+
"model.visual.blocks.15.mlp.linear_fc2",
|
| 113 |
+
"model.visual.blocks.16.attn.qkv",
|
| 114 |
+
"model.visual.blocks.16.attn.proj",
|
| 115 |
+
"model.visual.blocks.16.mlp.linear_fc1",
|
| 116 |
+
"model.visual.blocks.16.mlp.linear_fc2",
|
| 117 |
+
"model.visual.blocks.17.attn.qkv",
|
| 118 |
+
"model.visual.blocks.17.attn.proj",
|
| 119 |
+
"model.visual.blocks.17.mlp.linear_fc1",
|
| 120 |
+
"model.visual.blocks.17.mlp.linear_fc2",
|
| 121 |
+
"model.visual.blocks.18.attn.qkv",
|
| 122 |
+
"model.visual.blocks.18.attn.proj",
|
| 123 |
+
"model.visual.blocks.18.mlp.linear_fc1",
|
| 124 |
+
"model.visual.blocks.18.mlp.linear_fc2",
|
| 125 |
+
"model.visual.blocks.19.attn.qkv",
|
| 126 |
+
"model.visual.blocks.19.attn.proj",
|
| 127 |
+
"model.visual.blocks.19.mlp.linear_fc1",
|
| 128 |
+
"model.visual.blocks.19.mlp.linear_fc2",
|
| 129 |
+
"model.visual.blocks.20.attn.qkv",
|
| 130 |
+
"model.visual.blocks.20.attn.proj",
|
| 131 |
+
"model.visual.blocks.20.mlp.linear_fc1",
|
| 132 |
+
"model.visual.blocks.20.mlp.linear_fc2",
|
| 133 |
+
"model.visual.blocks.21.attn.qkv",
|
| 134 |
+
"model.visual.blocks.21.attn.proj",
|
| 135 |
+
"model.visual.blocks.21.mlp.linear_fc1",
|
| 136 |
+
"model.visual.blocks.21.mlp.linear_fc2",
|
| 137 |
+
"model.visual.blocks.22.attn.qkv",
|
| 138 |
+
"model.visual.blocks.22.attn.proj",
|
| 139 |
+
"model.visual.blocks.22.mlp.linear_fc1",
|
| 140 |
+
"model.visual.blocks.22.mlp.linear_fc2",
|
| 141 |
+
"model.visual.blocks.23.attn.qkv",
|
| 142 |
+
"model.visual.blocks.23.attn.proj",
|
| 143 |
+
"model.visual.blocks.23.mlp.linear_fc1",
|
| 144 |
+
"model.visual.blocks.23.mlp.linear_fc2",
|
| 145 |
+
"model.visual.merger.linear_fc1",
|
| 146 |
+
"model.visual.merger.linear_fc2",
|
| 147 |
+
"model.visual.deepstack_merger_list.0.linear_fc1",
|
| 148 |
+
"model.visual.deepstack_merger_list.0.linear_fc2",
|
| 149 |
+
"model.visual.deepstack_merger_list.1.linear_fc1",
|
| 150 |
+
"model.visual.deepstack_merger_list.1.linear_fc2",
|
| 151 |
+
"model.visual.deepstack_merger_list.2.linear_fc1",
|
| 152 |
+
"model.visual.deepstack_merger_list.2.linear_fc2",
|
| 153 |
+
"lm_head"
|
| 154 |
+
],
|
| 155 |
+
"kv_cache_scheme": null,
|
| 156 |
+
"quant_method": "compressed-tensors",
|
| 157 |
+
"quantization_status": "compressed",
|
| 158 |
+
"sparsity_config": {},
|
| 159 |
+
"transform_config": {},
|
| 160 |
+
"version": "0.14.0.1"
|
| 161 |
+
},
|
| 162 |
+
"text_config": {
|
| 163 |
+
"attention_bias": false,
|
| 164 |
+
"attention_dropout": 0.0,
|
| 165 |
+
"bos_token_id": 151643,
|
| 166 |
+
"dtype": "bfloat16",
|
| 167 |
+
"eos_token_id": 151645,
|
| 168 |
+
"head_dim": 128,
|
| 169 |
+
"hidden_act": "silu",
|
| 170 |
+
"hidden_size": 2048,
|
| 171 |
+
"initializer_range": 0.02,
|
| 172 |
+
"intermediate_size": 6144,
|
| 173 |
+
"max_position_embeddings": 262144,
|
| 174 |
+
"model_type": "qwen3_vl_text",
|
| 175 |
+
"num_attention_heads": 16,
|
| 176 |
+
"num_hidden_layers": 28,
|
| 177 |
+
"num_key_value_heads": 8,
|
| 178 |
+
"pad_token_id": null,
|
| 179 |
+
"rms_norm_eps": 1e-06,
|
| 180 |
+
"rope_parameters": {
|
| 181 |
+
"mrope_interleaved": true,
|
| 182 |
+
"mrope_section": [
|
| 183 |
+
24,
|
| 184 |
+
20,
|
| 185 |
+
20
|
| 186 |
+
],
|
| 187 |
+
"rope_theta": 5000000,
|
| 188 |
+
"rope_type": "default"
|
| 189 |
+
},
|
| 190 |
+
"tie_word_embeddings": true,
|
| 191 |
+
"use_cache": true,
|
| 192 |
+
"vocab_size": 151936
|
| 193 |
+
},
|
| 194 |
+
"tie_word_embeddings": true,
|
| 195 |
+
"transformers_version": "5.6.0",
|
| 196 |
+
"video_token_id": 151656,
|
| 197 |
+
"vision_config": {
|
| 198 |
+
"deepstack_visual_indexes": [
|
| 199 |
+
5,
|
| 200 |
+
11,
|
| 201 |
+
17
|
| 202 |
+
],
|
| 203 |
+
"depth": 24,
|
| 204 |
+
"dtype": "bfloat16",
|
| 205 |
+
"hidden_act": "gelu_pytorch_tanh",
|
| 206 |
+
"hidden_size": 1024,
|
| 207 |
+
"in_channels": 3,
|
| 208 |
+
"initializer_range": 0.02,
|
| 209 |
+
"intermediate_size": 4096,
|
| 210 |
+
"model_type": "qwen3_vl_vision",
|
| 211 |
+
"num_heads": 16,
|
| 212 |
+
"num_position_embeddings": 2304,
|
| 213 |
+
"out_hidden_size": 2048,
|
| 214 |
+
"patch_size": 16,
|
| 215 |
+
"spatial_merge_size": 2,
|
| 216 |
+
"temporal_patch_size": 2
|
| 217 |
+
},
|
| 218 |
+
"vision_end_token_id": 151653,
|
| 219 |
+
"vision_start_token_id": 151652
|
| 220 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token_id": 151643,
|
| 3 |
+
"do_sample": true,
|
| 4 |
+
"eos_token_id": [
|
| 5 |
+
151645,
|
| 6 |
+
151643
|
| 7 |
+
],
|
| 8 |
+
"pad_token_id": 151643,
|
| 9 |
+
"repetition_penalty": 1.0,
|
| 10 |
+
"temperature": 0.7,
|
| 11 |
+
"top_k": 20,
|
| 12 |
+
"top_p": 0.8,
|
| 13 |
+
"transformers_version": "5.6.0"
|
| 14 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:65788967b4a03730bcc378b82db823792f39651882a17cf7ac95863c626fde5e
|
| 3 |
+
size 2851698808
|
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 |
+
}
|
recipe.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
default_stage:
|
| 2 |
+
default_modifiers:
|
| 3 |
+
QuantizationModifier:
|
| 4 |
+
targets: [Linear]
|
| 5 |
+
ignore: ['re:.*visual.*', 're:.*lm_head']
|
| 6 |
+
scheme: NVFP4
|
| 7 |
+
bypass_divisibility_checks: false
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:e946ac23b6a68f7a2abbe7b3c22190673c6d3d159b85305268db51b2729ac68a
|
| 3 |
+
size 11422749
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": false,
|
| 3 |
+
"backend": "tokenizers",
|
| 4 |
+
"bos_token": null,
|
| 5 |
+
"clean_up_tokenization_spaces": false,
|
| 6 |
+
"eos_token": "<|im_end|>",
|
| 7 |
+
"errors": "replace",
|
| 8 |
+
"extra_special_tokens": [
|
| 9 |
+
"<|im_start|>",
|
| 10 |
+
"<|im_end|>",
|
| 11 |
+
"<|object_ref_start|>",
|
| 12 |
+
"<|object_ref_end|>",
|
| 13 |
+
"<|box_start|>",
|
| 14 |
+
"<|box_end|>",
|
| 15 |
+
"<|quad_start|>",
|
| 16 |
+
"<|quad_end|>",
|
| 17 |
+
"<|vision_start|>",
|
| 18 |
+
"<|vision_end|>",
|
| 19 |
+
"<|vision_pad|>",
|
| 20 |
+
"<|image_pad|>",
|
| 21 |
+
"<|video_pad|>"
|
| 22 |
+
],
|
| 23 |
+
"is_local": true,
|
| 24 |
+
"local_files_only": false,
|
| 25 |
+
"model_max_length": 262144,
|
| 26 |
+
"pad_token": "<|endoftext|>",
|
| 27 |
+
"processor_class": "Qwen3VLProcessor",
|
| 28 |
+
"split_special_tokens": false,
|
| 29 |
+
"tokenizer_class": "Qwen2Tokenizer",
|
| 30 |
+
"unk_token": null
|
| 31 |
+
}
|