Text Generation
Transformers
Safetensors
llama
nvfp4
4-bit precision
w4a4
compressed-tensors
llm-compressor
gptq
distillation
qad
quantized
vllm
conversational
text-generation-inference
8-bit precision
Instructions to use PureTensorAI/MiniCPM5-2B-NVFP4-QAD with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use PureTensorAI/MiniCPM5-2B-NVFP4-QAD with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="PureTensorAI/MiniCPM5-2B-NVFP4-QAD") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("PureTensorAI/MiniCPM5-2B-NVFP4-QAD") model = AutoModelForCausalLM.from_pretrained("PureTensorAI/MiniCPM5-2B-NVFP4-QAD", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.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(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use PureTensorAI/MiniCPM5-2B-NVFP4-QAD with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "PureTensorAI/MiniCPM5-2B-NVFP4-QAD" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "PureTensorAI/MiniCPM5-2B-NVFP4-QAD", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/PureTensorAI/MiniCPM5-2B-NVFP4-QAD
- SGLang
How to use PureTensorAI/MiniCPM5-2B-NVFP4-QAD 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 "PureTensorAI/MiniCPM5-2B-NVFP4-QAD" \ --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": "PureTensorAI/MiniCPM5-2B-NVFP4-QAD", "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 "PureTensorAI/MiniCPM5-2B-NVFP4-QAD" \ --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": "PureTensorAI/MiniCPM5-2B-NVFP4-QAD", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use PureTensorAI/MiniCPM5-2B-NVFP4-QAD with Docker Model Runner:
docker model run hf.co/PureTensorAI/MiniCPM5-2B-NVFP4-QAD
NVFP4 W4A4 (GPTQ + short distillation) quantization of openbmb/MiniCPM5-2B
Browse files- README.md +110 -0
- chat_template.jinja +112 -0
- config.json +74 -0
- generation_config.json +13 -0
- model.safetensors +3 -0
- recipe.yaml +12 -0
- tokenizer.json +0 -0
- tokenizer_config.json +17 -0
README.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
base_model: openbmb/MiniCPM5-2B
|
| 4 |
+
base_model_relation: quantized
|
| 5 |
+
library_name: transformers
|
| 6 |
+
pipeline_tag: text-generation
|
| 7 |
+
tags:
|
| 8 |
+
- nvfp4
|
| 9 |
+
- 4-bit
|
| 10 |
+
- w4a4
|
| 11 |
+
- compressed-tensors
|
| 12 |
+
- llm-compressor
|
| 13 |
+
- gptq
|
| 14 |
+
- distillation
|
| 15 |
+
- qad
|
| 16 |
+
- quantized
|
| 17 |
+
- vllm
|
| 18 |
+
---
|
| 19 |
+
|
| 20 |
+
# MiniCPM5-2B NVFP4 (W4A4, GPTQ + short distillation)
|
| 21 |
+
|
| 22 |
+
NVFP4 quantization of [openbmb/MiniCPM5-2B](https://huggingface.co/openbmb/MiniCPM5-2B), made by PureTensor from the official BF16 weights. Weights and activations are both 4-bit (W4A4), so vLLM runs it on its native FP4 kernel. The file is 2.18 GB against 5.03 GB for BF16.
|
| 23 |
+
|
| 24 |
+
This is a test release. It is not affiliated with or endorsed by OpenBMB.
|
| 25 |
+
|
| 26 |
+
**Read this first:** full 4-bit costs this model real quality. This checkpoint is 3.1 points below BF16 on MMLU and 7.3 below on GSM8K when served. A short quantization-aware distillation recovered about half of what plain 4-bit quantization lost. If quality matters more than throughput under load, use the weights-only sibling [puretensor/MiniCPM5-2B-NVFP4A16](https://huggingface.co/puretensor/MiniCPM5-2B-NVFP4A16).
|
| 27 |
+
|
| 28 |
+
## What was done
|
| 29 |
+
|
| 30 |
+
| | |
|
| 31 |
+
|---|---|
|
| 32 |
+
| Source | `openbmb/MiniCPM5-2B`, BF16 |
|
| 33 |
+
| Format | compressed-tensors `nvfp4-pack-quantized`, scheme `NVFP4`: 4-bit E2M1 weights and input activations, FP8 E4M3 scales per group of 16 |
|
| 34 |
+
| Quantized | every `Linear` layer in the 42 transformer blocks |
|
| 35 |
+
| Kept in BF16 | token embeddings, output head, all norms |
|
| 36 |
+
| Step 1 | GPTQ (`dampening_frac` 0.01, `actorder` static), first 512 samples of `mlabonne/open-perfectblend`, up to 2,048 tokens each |
|
| 37 |
+
| Step 2 | Quantization-aware distillation: the BF16 model is the teacher, the loss is KL divergence on next-token distributions, only the quantized weights train, scales stay fixed, gradients pass straight through the 4-bit rounding |
|
| 38 |
+
| Distillation budget | 1,451 steps, 1.69M tokens, AdamW, learning rate 5e-6 with warm-up and cosine decay |
|
| 39 |
+
| Distillation data | chat-formatted `mlabonne/open-perfectblend` from row 20,000 on, with the math sources (MetaMathQA, Orca-Math) left out so GSM8K stays a fair test |
|
| 40 |
+
| Tools | llm-compressor 0.15.0, compressed-tensors 0.20.1, transformers 5.21.0, torch 2.14.1 |
|
| 41 |
+
|
| 42 |
+
After training, the weights are snapped to the 4-bit grid, saved, and reloaded. Every number below was measured on the reloaded file.
|
| 43 |
+
|
| 44 |
+
## Measured quality
|
| 45 |
+
|
| 46 |
+
One harness, BF16 as reference.
|
| 47 |
+
|
| 48 |
+
| | BF16 | 4-bit, no distillation | This checkpoint |
|
| 49 |
+
|---|---:|---:|---:|
|
| 50 |
+
| MMLU, accuracy (14,042 questions, offline) | 57.29 | 51.03 | **54.17** |
|
| 51 |
+
| GSM8K, exact match (1,319 problems, offline) | 72.48 | 59.89 | **66.03** |
|
| 52 |
+
| GSM8K served by vLLM on its native FP4 kernel | 72.10 | 58.15 | **64.82** |
|
| 53 |
+
| Mean KL divergence from BF16, WikiText-2 (131,072 tokens) | 0 | 0.164 | **0.154** |
|
| 54 |
+
| Mean KL divergence from BF16, chat (224,534 tokens) | 0 | 0.201 | **0.164** |
|
| 55 |
+
| Same top token as BF16, WikiText-2 / chat | 100% | 80.1% / 83.1% | 80.7% / 84.0% |
|
| 56 |
+
|
| 57 |
+
- Distillation against no distillation, paired McNemar test on per-question correctness: MMLU p = 1e-14, GSM8K p = 2e-5. Both gains are significant.
|
| 58 |
+
- This checkpoint against BF16: still significantly worse on both (MMLU p = 2e-16, GSM8K p = 6e-7).
|
| 59 |
+
- MMLU and GSM8K: default `mmlu` and `gsm8k` configurations of lm-evaluation-harness 0.4.13, no chat template, GSM8K flexible-extract. "Offline" means Transformers with the 4-bit arithmetic emulated. Emulation is optimistic for 4-bit activations: the served GSM8K score is about 1 to 3 points lower in our tests, so trust the served row. MMLU was not measured on the served model.
|
| 60 |
+
- KL divergence: full next-token distribution, teacher-forced, windows of 1,024 tokens. The chat set comes from the same dataset family as part of the distillation data, so the WikiText row is the cleaner one.
|
| 61 |
+
|
| 62 |
+
### Against the weights-only sibling
|
| 63 |
+
|
| 64 |
+
Served with vLLM 0.34.0 on one NVIDIA Blackwell workstation GPU (compute capability 12.0), fixed 256-token greedy generations.
|
| 65 |
+
|
| 66 |
+
| | BF16 | Weights-only sibling | This checkpoint |
|
| 67 |
+
|---|---:|---:|---:|
|
| 68 |
+
| vLLM kernel | | weight-only FP4 (Marlin) | native FP4 (FlashInfer CUTLASS) |
|
| 69 |
+
| MMLU (offline) | 57.29 | 54.60 | 54.17 |
|
| 70 |
+
| GSM8K (served) | 72.10 | 68.23 | 64.82 |
|
| 71 |
+
| Throughput, single stream | 1.00x | 1.40x | 1.36x |
|
| 72 |
+
| Throughput, 8 concurrent | 1.00x | 1.53x | 1.55x |
|
| 73 |
+
| Throughput, 32 concurrent | 1.00x | 1.28x | 1.50x |
|
| 74 |
+
|
| 75 |
+
The case for this checkpoint is throughput under heavy concurrency. Otherwise the sibling is the better trade.
|
| 76 |
+
|
| 77 |
+
## Usage
|
| 78 |
+
|
| 79 |
+
vLLM:
|
| 80 |
+
|
| 81 |
+
```bash
|
| 82 |
+
vllm serve puretensor/MiniCPM5-2B-NVFP4-QAD
|
| 83 |
+
```
|
| 84 |
+
|
| 85 |
+
Transformers (requires `pip install compressed-tensors`; the 4-bit arithmetic is emulated, so this path is for checking, not speed):
|
| 86 |
+
|
| 87 |
+
```python
|
| 88 |
+
import torch
|
| 89 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 90 |
+
|
| 91 |
+
repo = "puretensor/MiniCPM5-2B-NVFP4-QAD"
|
| 92 |
+
tok = AutoTokenizer.from_pretrained(repo)
|
| 93 |
+
model = AutoModelForCausalLM.from_pretrained(repo, dtype=torch.bfloat16).to("cuda")
|
| 94 |
+
|
| 95 |
+
msgs = [{"role": "user", "content": "Summarise the water cycle in two sentences."}]
|
| 96 |
+
ids = tok.apply_chat_template(msgs, add_generation_prompt=True, return_tensors="pt", return_dict=True).to("cuda")
|
| 97 |
+
out = model.generate(**ids, max_new_tokens=256)
|
| 98 |
+
print(tok.decode(out[0, ids["input_ids"].shape[1]:], skip_special_tokens=True))
|
| 99 |
+
```
|
| 100 |
+
|
| 101 |
+
## Limitations
|
| 102 |
+
|
| 103 |
+
- Quality is below BF16 and below the weights-only sibling, as measured above.
|
| 104 |
+
- The distillation was short: about 20 minutes on one GPU. A longer run would likely recover more; we have not done it yet.
|
| 105 |
+
- One training run, one calibration draw, no repeated seeds. English-language benchmarks only. No safety, multilingual, or long-context evaluation was run on the quantized model.
|
| 106 |
+
- Throughput ratios are from one GPU and one workload and will differ elsewhere.
|
| 107 |
+
|
| 108 |
+
## License
|
| 109 |
+
|
| 110 |
+
Apache-2.0, as the base model. Changes from the base release: the `Linear` weights are quantized to NVFP4 after GPTQ and a short distillation, activation quantization parameters are added, and `config.json` gains a `quantization_config` block.
|
chat_template.jinja
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{{- bos_token }}{%- if tools %}
|
| 2 |
+
{%- set tool_definitions %}
|
| 3 |
+
{{- "# Tools\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
|
| 4 |
+
{%- for tool in tools %}
|
| 5 |
+
{{- "\n" }}
|
| 6 |
+
{{- tool | tojson(ensure_ascii=False) }}
|
| 7 |
+
{%- endfor %}
|
| 8 |
+
{{- '\n</tools>\n\nTool usage guidelines:\n- You may call zero or more functions. If no function calls are needed, just answer normally and do not include any <function ... </function>.\n- When calling a function, return an XML object within <function ... </function> using:\n<function name="function-name"><param name="param-name">param-value</param></function>\n- param-value may be multi-line. If it contains <, & or newline characters, wrap it in a CDATA block: <param name="param-name"><![CDATA[...multi-line value...]]></param>' }}
|
| 9 |
+
{%- endset %}
|
| 10 |
+
|
| 11 |
+
{{- '<|im_start|>system\n' }}
|
| 12 |
+
{%- if messages[0].role == 'system' %}
|
| 13 |
+
{%- if '<tool_def_sep>' in messages[0].content %}
|
| 14 |
+
{{- messages[0].content.replace('<tool_def_sep>', tool_definitions) }}
|
| 15 |
+
{%- else %}
|
| 16 |
+
{{- messages[0].content + '\n\n' + tool_definitions }}
|
| 17 |
+
{%- endif %}
|
| 18 |
+
{%- else %}
|
| 19 |
+
{{- tool_definitions.lstrip() }}
|
| 20 |
+
{%- endif %}
|
| 21 |
+
{{- '<|im_end|>\n' }}
|
| 22 |
+
{%- else %}
|
| 23 |
+
{%- if messages[0].role == 'system' %}
|
| 24 |
+
{{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
|
| 25 |
+
{%- endif %}
|
| 26 |
+
{%- endif %}
|
| 27 |
+
{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
|
| 28 |
+
{%- for message in messages[::-1] %}
|
| 29 |
+
{%- set index = (messages|length - 1) - loop.index0 %}
|
| 30 |
+
{%- if ns.multi_step_tool and message.role == "user" and message.content is string and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}
|
| 31 |
+
{%- set ns.multi_step_tool = false %}
|
| 32 |
+
{%- set ns.last_query_index = index %}
|
| 33 |
+
{%- endif %}
|
| 34 |
+
{%- endfor %}
|
| 35 |
+
{%- for message in messages %}
|
| 36 |
+
{%- if message.content is string %}
|
| 37 |
+
{%- set content = message.content %}
|
| 38 |
+
{%- else %}
|
| 39 |
+
{%- set content = '' %}
|
| 40 |
+
{%- endif %}
|
| 41 |
+
{%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
|
| 42 |
+
{{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
|
| 43 |
+
{%- elif message.role == "assistant" %}
|
| 44 |
+
{%- set reasoning_content = '' %}
|
| 45 |
+
{%- if message.reasoning_content is string %}
|
| 46 |
+
{%- set reasoning_content = message.reasoning_content %}
|
| 47 |
+
{%- else %}
|
| 48 |
+
{%- if '</think>' in content %}
|
| 49 |
+
{%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
|
| 50 |
+
{%- set content = content.split('</think>')[-1].lstrip('\n') %}
|
| 51 |
+
{%- endif %}
|
| 52 |
+
{%- endif %}
|
| 53 |
+
|
| 54 |
+
{%- if reasoning_content %}
|
| 55 |
+
{{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
|
| 56 |
+
{%- elif '<think>' not in content and '</think>' not in content %}
|
| 57 |
+
{{- '<|im_start|>' + message.role + '\n<think>\n\n</think>\n\n' + content.lstrip('\n') }}
|
| 58 |
+
{%- else %}
|
| 59 |
+
{{- '<|im_start|>' + message.role + '\n' + content }}
|
| 60 |
+
{%- endif %}
|
| 61 |
+
|
| 62 |
+
{%- if message.tool_calls %}
|
| 63 |
+
{%- for tool_call in message.tool_calls %}
|
| 64 |
+
{%- if (loop.first and content) or (not loop.first) %}
|
| 65 |
+
{{- '\n' }}
|
| 66 |
+
{%- endif %}
|
| 67 |
+
{%- if tool_call.function %}
|
| 68 |
+
{%- set tool_call = tool_call.function %}
|
| 69 |
+
{%- endif %}
|
| 70 |
+
{{- '<function name="' ~ tool_call.name ~ '">' }}
|
| 71 |
+
{%- if tool_call.arguments %}
|
| 72 |
+
{%- set args_dict = tool_call.arguments %}
|
| 73 |
+
{%- for param_name, param_value in args_dict.items() %}
|
| 74 |
+
{{- '<param name="' ~ param_name ~ '">' }}
|
| 75 |
+
{%- if param_value is string and ('<' in param_value or '&' in param_value or '\n' in param_value) %}
|
| 76 |
+
{{- '<![CDATA[' + param_value + ']]>' }}
|
| 77 |
+
{%- else %}
|
| 78 |
+
{{- param_value }}
|
| 79 |
+
{%- endif %}
|
| 80 |
+
{{- '</param>' }}
|
| 81 |
+
{%- endfor %}
|
| 82 |
+
{%- endif %}
|
| 83 |
+
{{- '</function>' }}
|
| 84 |
+
{%- endfor %}
|
| 85 |
+
{%- endif %}
|
| 86 |
+
{{- '<|im_end|>\n' }}
|
| 87 |
+
{%- elif message.role == "tool" %}
|
| 88 |
+
{%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
|
| 89 |
+
{{- '<|im_start|>user' }}
|
| 90 |
+
{%- endif %}
|
| 91 |
+
{{- '\n<tool_response>\n' }}
|
| 92 |
+
{%- if message.content is string %}
|
| 93 |
+
{{- content }}
|
| 94 |
+
{%- else %}
|
| 95 |
+
{{- message.content | tojson(ensure_ascii=False) }}
|
| 96 |
+
{%- endif %}
|
| 97 |
+
{{- '\n</tool_response>' }}
|
| 98 |
+
{%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
|
| 99 |
+
{{- '<|im_end|>\n' }}
|
| 100 |
+
{%- endif %}
|
| 101 |
+
{%- endif %}
|
| 102 |
+
{%- endfor %}
|
| 103 |
+
{%- if add_generation_prompt %}
|
| 104 |
+
{{- '<|im_start|>assistant\n' }}
|
| 105 |
+
{%- if enable_thinking is defined %}
|
| 106 |
+
{%- if enable_thinking is false %}
|
| 107 |
+
{{- '<think>\n\n</think>\n\n' }}
|
| 108 |
+
{%- elif enable_thinking is true %}
|
| 109 |
+
{{- '<think>\n' }}
|
| 110 |
+
{%- endif %}
|
| 111 |
+
{%- endif %}
|
| 112 |
+
{%- endif %}
|
config.json
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_name_or_path": "openbmb/MiniCPM5-2B",
|
| 3 |
+
"architectures": [
|
| 4 |
+
"LlamaForCausalLM"
|
| 5 |
+
],
|
| 6 |
+
"bos_token_id": 0,
|
| 7 |
+
"eos_token_id": [
|
| 8 |
+
1,
|
| 9 |
+
130073
|
| 10 |
+
],
|
| 11 |
+
"head_dim": 128,
|
| 12 |
+
"hidden_act": "silu",
|
| 13 |
+
"hidden_size": 2048,
|
| 14 |
+
"initializer_range": 0.02,
|
| 15 |
+
"intermediate_size": 6144,
|
| 16 |
+
"max_position_embeddings": 131072,
|
| 17 |
+
"model_type": "llama",
|
| 18 |
+
"num_attention_heads": 16,
|
| 19 |
+
"num_hidden_layers": 42,
|
| 20 |
+
"num_key_value_heads": 2,
|
| 21 |
+
"pad_token_id": 1,
|
| 22 |
+
"quantization_config": {
|
| 23 |
+
"config_groups": {
|
| 24 |
+
"group_0": {
|
| 25 |
+
"format": "nvfp4-pack-quantized",
|
| 26 |
+
"input_activations": {
|
| 27 |
+
"dynamic": "local",
|
| 28 |
+
"group_size": 16,
|
| 29 |
+
"num_bits": 4,
|
| 30 |
+
"observer": "static_minmax",
|
| 31 |
+
"scale_dtype": "torch.float8_e4m3fn",
|
| 32 |
+
"strategy": "tensor_group",
|
| 33 |
+
"symmetric": true,
|
| 34 |
+
"type": "float"
|
| 35 |
+
},
|
| 36 |
+
"output_activations": null,
|
| 37 |
+
"targets": [
|
| 38 |
+
"Linear"
|
| 39 |
+
],
|
| 40 |
+
"weights": {
|
| 41 |
+
"actorder": "static",
|
| 42 |
+
"dynamic": false,
|
| 43 |
+
"group_size": 16,
|
| 44 |
+
"num_bits": 4,
|
| 45 |
+
"observer": "memoryless_minmax",
|
| 46 |
+
"scale_dtype": "torch.float8_e4m3fn",
|
| 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 |
+
"moe_sparsity_config": null,
|
| 60 |
+
"quant_method": "compressed-tensors",
|
| 61 |
+
"quantization_status": "compressed",
|
| 62 |
+
"sparsity_config": {},
|
| 63 |
+
"transform_config": {},
|
| 64 |
+
"version": "0.20.1"
|
| 65 |
+
},
|
| 66 |
+
"rms_norm_eps": 1e-06,
|
| 67 |
+
"rope_scaling": null,
|
| 68 |
+
"rope_theta": 5000000,
|
| 69 |
+
"tie_word_embeddings": false,
|
| 70 |
+
"torch_dtype": "bfloat16",
|
| 71 |
+
"transformers_version": "5.6.2",
|
| 72 |
+
"use_cache": true,
|
| 73 |
+
"vocab_size": 130560
|
| 74 |
+
}
|
generation_config.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_from_model_config": true,
|
| 3 |
+
"bos_token_id": 0,
|
| 4 |
+
"do_sample": true,
|
| 5 |
+
"eos_token_id": [
|
| 6 |
+
1,
|
| 7 |
+
130073
|
| 8 |
+
],
|
| 9 |
+
"pad_token_id": 1,
|
| 10 |
+
"temperature": 1.0,
|
| 11 |
+
"top_p": 0.95,
|
| 12 |
+
"transformers_version": "5.21.0"
|
| 13 |
+
}
|
model.safetensors
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:77d359a9a710a74fddcd9c34a7f69c207b22a91b7518d4a7b00f36aa4b7b8254
|
| 3 |
+
size 2184817248
|
recipe.yaml
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
default_stage:
|
| 2 |
+
default_modifiers:
|
| 3 |
+
GPTQModifier:
|
| 4 |
+
targets: [Linear]
|
| 5 |
+
ignore: [lm_head]
|
| 6 |
+
scheme: NVFP4
|
| 7 |
+
bypass_divisibility_checks: false
|
| 8 |
+
requires_calibration_data: true
|
| 9 |
+
block_size: 128
|
| 10 |
+
dampening_frac: 0.01
|
| 11 |
+
actorder: static
|
| 12 |
+
batched_quantization: auto
|
tokenizer.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
tokenizer_config.json
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"add_prefix_space": null,
|
| 3 |
+
"backend": "tokenizers",
|
| 4 |
+
"bos_token": "<s>",
|
| 5 |
+
"clean_up_tokenization_spaces": false,
|
| 6 |
+
"eos_token": "</s>",
|
| 7 |
+
"is_local": true,
|
| 8 |
+
"legacy": true,
|
| 9 |
+
"local_files_only": false,
|
| 10 |
+
"model_max_length": 131072,
|
| 11 |
+
"pad_token": "</s>",
|
| 12 |
+
"sp_model_kwargs": {},
|
| 13 |
+
"spaces_between_special_tokens": false,
|
| 14 |
+
"tokenizer_class": "TokenizersBackend",
|
| 15 |
+
"unk_token": "<unk>",
|
| 16 |
+
"use_default_system_prompt": false
|
| 17 |
+
}
|