Add NVFP4 quantized checkpoint
Browse files- .gitattributes +1 -0
- README.md +23 -0
- chat_template.jinja +80 -0
- config.json +72 -0
- generation_config.json +7 -0
- model-00001-of-00002.safetensors +3 -0
- model-00002-of-00002.safetensors +3 -0
- model.safetensors.index.json +0 -0
- recipe.yaml +6 -0
- special_tokens_map.json +30 -0
- tokenizer.json +3 -0
- tokenizer_config.json +0 -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,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
datasets:
|
| 3 |
+
- HuggingFaceH4/ultrachat_200k
|
| 4 |
+
base_model:
|
| 5 |
+
- DarwinAnim8or/Trouper-12B
|
| 6 |
+
---
|
| 7 |
+
# Trouper-12B-nvfp4
|
| 8 |
+
|
| 9 |
+
**Format:** NVFP4 — weights & activations quantized to FP4 with dual scaling.
|
| 10 |
+
**Base model:** `DarwinAnim8or/Trouper-12B`
|
| 11 |
+
**How it was made:** One-shot calibration with LLM Compressor (NVFP4 recipe), long-seq calibration with HuggingFaceH4/ultrachat_200k.
|
| 12 |
+
|
| 13 |
+
> Notes: Keep `lm_head` in high precision; calibrate on long, domain-relevant sequences.
|
| 14 |
+
|
| 15 |
+
Check the original model card for information about this model.
|
| 16 |
+
|
| 17 |
+
# Running the model with VLLM in Docker
|
| 18 |
+
```sh
|
| 19 |
+
sudo docker run --runtime nvidia --gpus all -p 8000:8000 --ipc=host vllm/vllm-openai:nightly --model Firworks/Trouper-12B-nvfp4 --dtype auto --max-model-len 32768
|
| 20 |
+
```
|
| 21 |
+
This was tested on a B200 cloud instance.
|
| 22 |
+
|
| 23 |
+
If there are other models you're interested in seeing quantized to NVFP4 for use on the DGX Spark, or other modern Blackwell (or newer) cards let me know. I'm trying to make more NVFP4 models available to allow more people to try them out.
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{%- if messages[0]["role"] == "system" %}
|
| 2 |
+
{%- set system_message = messages[0]["content"] %}
|
| 3 |
+
{%- set loop_messages = messages[1:] %}
|
| 4 |
+
{{- system_message + eos_token}}
|
| 5 |
+
{%- else %}
|
| 6 |
+
{%- set loop_messages = messages %}
|
| 7 |
+
{%- endif %}
|
| 8 |
+
{%- if not tools is defined %}
|
| 9 |
+
{%- set tools = none %}
|
| 10 |
+
{%- endif %}
|
| 11 |
+
{%- set user_messages = loop_messages | selectattr("role", "equalto", "user") | list %}
|
| 12 |
+
|
| 13 |
+
{{- bos_token }}
|
| 14 |
+
{%- for message in loop_messages %}
|
| 15 |
+
{%- if message["role"] == "user" %}
|
| 16 |
+
{{- '<|start_header_id|>user<|end_header_id|>
|
| 17 |
+
|
| 18 |
+
' }}
|
| 19 |
+
{%- if tools is not none and (message == user_messages[-1]) %}
|
| 20 |
+
{{- "[AVAILABLE_TOOLS][" }}
|
| 21 |
+
{%- for tool in tools %}
|
| 22 |
+
{%- set tool = tool.function %}
|
| 23 |
+
{{- '{"type": "function", "function": {' }}
|
| 24 |
+
{%- for key, val in tool.items() if key != "return" %}
|
| 25 |
+
{%- if val is string %}
|
| 26 |
+
{{- '"' + key + '": "' + val + '"' }}
|
| 27 |
+
{%- else %}
|
| 28 |
+
{{- '"' + key + '": ' + val|tojson }}
|
| 29 |
+
{%- endif %}
|
| 30 |
+
{%- if not loop.last %}
|
| 31 |
+
{{- ", " }}
|
| 32 |
+
{%- endif %}
|
| 33 |
+
{%- endfor %}
|
| 34 |
+
{{- "}}" }}
|
| 35 |
+
{%- if not loop.last %}
|
| 36 |
+
{{- ", " }}
|
| 37 |
+
{%- else %}
|
| 38 |
+
{{- "]" }}
|
| 39 |
+
{%- endif %}
|
| 40 |
+
{%- endfor %}
|
| 41 |
+
{{- "[/AVAILABLE_TOOLS]" }}
|
| 42 |
+
{%- endif %}
|
| 43 |
+
{{- "[INST]" + message["content"] + "[/INST]" }}
|
| 44 |
+
{%- elif (message.tool_calls is defined and message.tool_calls is not none) %}
|
| 45 |
+
{{- '<|start_header_id|>assistant<|end_header_id|>
|
| 46 |
+
|
| 47 |
+
' }}
|
| 48 |
+
{{- "[TOOL_CALLS][" }}
|
| 49 |
+
{%- for tool_call in message.tool_calls %}
|
| 50 |
+
{%- set out = tool_call.function|tojson %}
|
| 51 |
+
{{- out[:-1] }}
|
| 52 |
+
{{- ', "id": "' + tool_call.id + '"}' }}
|
| 53 |
+
{%- if not loop.last %}
|
| 54 |
+
{{- ", " }}
|
| 55 |
+
{%- else %}
|
| 56 |
+
{{- "]" + eos_token }}
|
| 57 |
+
{%- endif %}
|
| 58 |
+
{%- endfor %}
|
| 59 |
+
{%- elif message["role"] == "assistant" %}
|
| 60 |
+
{{- '<|start_header_id|>assistant<|end_header_id|>
|
| 61 |
+
|
| 62 |
+
' }}
|
| 63 |
+
{{- message["content"] + eos_token}}
|
| 64 |
+
{%- elif message["role"] == "tool_results" or message["role"] == "tool" %}
|
| 65 |
+
{%- if message.content is defined and message.content.content is defined %}
|
| 66 |
+
{%- set content = message.content.content %}
|
| 67 |
+
{%- else %}
|
| 68 |
+
{%- set content = message.content %}
|
| 69 |
+
{%- endif %}
|
| 70 |
+
{{- '[TOOL_RESULTS]{"content": ' + content|string + ", " }}
|
| 71 |
+
{{- '"call_id": "' + message.tool_call_id + '"}[/TOOL_RESULTS]' }}
|
| 72 |
+
{%- else %}
|
| 73 |
+
{{- raise_exception("Only user and assistant roles are supported, with the exception of an initial optional system message!") }}
|
| 74 |
+
{%- endif %}
|
| 75 |
+
{%- endfor %}
|
| 76 |
+
{%- if add_generation_prompt %}
|
| 77 |
+
{{- '<|start_header_id|>assistant<|end_header_id|>
|
| 78 |
+
|
| 79 |
+
' }}
|
| 80 |
+
{%- endif %}
|
config.json
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"architectures": [
|
| 3 |
+
"MistralForCausalLM"
|
| 4 |
+
],
|
| 5 |
+
"attention_dropout": 0.0,
|
| 6 |
+
"bos_token_id": 1,
|
| 7 |
+
"dtype": "float16",
|
| 8 |
+
"eos_token_id": 2,
|
| 9 |
+
"head_dim": 128,
|
| 10 |
+
"hidden_act": "silu",
|
| 11 |
+
"hidden_size": 5120,
|
| 12 |
+
"initializer_range": 0.02,
|
| 13 |
+
"intermediate_size": 14336,
|
| 14 |
+
"max_position_embeddings": 131072,
|
| 15 |
+
"model_type": "mistral",
|
| 16 |
+
"num_attention_heads": 32,
|
| 17 |
+
"num_hidden_layers": 40,
|
| 18 |
+
"num_key_value_heads": 8,
|
| 19 |
+
"quantization_config": {
|
| 20 |
+
"config_groups": {
|
| 21 |
+
"group_0": {
|
| 22 |
+
"format": "nvfp4-pack-quantized",
|
| 23 |
+
"input_activations": {
|
| 24 |
+
"actorder": null,
|
| 25 |
+
"block_structure": null,
|
| 26 |
+
"dynamic": "local",
|
| 27 |
+
"group_size": 16,
|
| 28 |
+
"num_bits": 4,
|
| 29 |
+
"observer": "minmax",
|
| 30 |
+
"observer_kwargs": {},
|
| 31 |
+
"strategy": "tensor_group",
|
| 32 |
+
"symmetric": true,
|
| 33 |
+
"type": "float"
|
| 34 |
+
},
|
| 35 |
+
"output_activations": null,
|
| 36 |
+
"targets": [
|
| 37 |
+
"Linear"
|
| 38 |
+
],
|
| 39 |
+
"weights": {
|
| 40 |
+
"actorder": null,
|
| 41 |
+
"block_structure": null,
|
| 42 |
+
"dynamic": false,
|
| 43 |
+
"group_size": 16,
|
| 44 |
+
"num_bits": 4,
|
| 45 |
+
"observer": "minmax",
|
| 46 |
+
"observer_kwargs": {},
|
| 47 |
+
"strategy": "tensor_group",
|
| 48 |
+
"symmetric": true,
|
| 49 |
+
"type": "float"
|
| 50 |
+
}
|
| 51 |
+
}
|
| 52 |
+
},
|
| 53 |
+
"format": "nvfp4-pack-quantized",
|
| 54 |
+
"global_compression_ratio": null,
|
| 55 |
+
"ignore": [
|
| 56 |
+
"lm_head"
|
| 57 |
+
],
|
| 58 |
+
"kv_cache_scheme": null,
|
| 59 |
+
"quant_method": "compressed-tensors",
|
| 60 |
+
"quantization_status": "compressed",
|
| 61 |
+
"sparsity_config": {},
|
| 62 |
+
"transform_config": {},
|
| 63 |
+
"version": "0.12.2"
|
| 64 |
+
},
|
| 65 |
+
"rms_norm_eps": 1e-05,
|
| 66 |
+
"rope_theta": 1000000.0,
|
| 67 |
+
"sliding_window": null,
|
| 68 |
+
"tie_word_embeddings": false,
|
| 69 |
+
"transformers_version": "4.56.2",
|
| 70 |
+
"use_cache": true,
|
| 71 |
+
"vocab_size": 131072
|
| 72 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 1,
|
| 4 |
+
"do_sample": true,
|
| 5 |
+
"eos_token_id": 2,
|
| 6 |
+
"transformers_version": "4.56.2"
|
| 7 |
+
}
|
model-00001-of-00002.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:804f00b55fff468e03388927194db8e1f8052a85bea7fa802ba3557c3d5a4844
|
| 3 |
+
size 4981945544
|
model-00002-of-00002.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:4380631401a8765343cc009731bfa838bda335e9be80093e3189a485d4aae7a1
|
| 3 |
+
size 3837547976
|
model.safetensors.index.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
recipe.yaml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
default_stage:
|
| 2 |
+
default_modifiers:
|
| 3 |
+
QuantizationModifier:
|
| 4 |
+
targets: [Linear]
|
| 5 |
+
ignore: [lm_head]
|
| 6 |
+
scheme: NVFP4
|
special_tokens_map.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"bos_token": {
|
| 3 |
+
"content": "<s>",
|
| 4 |
+
"lstrip": false,
|
| 5 |
+
"normalized": false,
|
| 6 |
+
"rstrip": false,
|
| 7 |
+
"single_word": false
|
| 8 |
+
},
|
| 9 |
+
"eos_token": {
|
| 10 |
+
"content": "</s>",
|
| 11 |
+
"lstrip": false,
|
| 12 |
+
"normalized": false,
|
| 13 |
+
"rstrip": false,
|
| 14 |
+
"single_word": false
|
| 15 |
+
},
|
| 16 |
+
"pad_token": {
|
| 17 |
+
"content": "<pad>",
|
| 18 |
+
"lstrip": false,
|
| 19 |
+
"normalized": false,
|
| 20 |
+
"rstrip": false,
|
| 21 |
+
"single_word": false
|
| 22 |
+
},
|
| 23 |
+
"unk_token": {
|
| 24 |
+
"content": "<unk>",
|
| 25 |
+
"lstrip": false,
|
| 26 |
+
"normalized": false,
|
| 27 |
+
"rstrip": false,
|
| 28 |
+
"single_word": false
|
| 29 |
+
}
|
| 30 |
+
}
|
tokenizer.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:aee010d04b629199c4120804df3eb4da472dadbf00777388a2385e419b5071ab
|
| 3 |
+
size 17078391
|
tokenizer_config.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|