Text Generation
Transformers
Safetensors
llama
minicpm
compressed-tensors
vllm
quantized
nvfp4
fp4
w4a16
conversational
text-generation-inference
8-bit precision
Instructions to use axteam/MiniCPM5-2B-NVFP4A16 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use axteam/MiniCPM5-2B-NVFP4A16 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="axteam/MiniCPM5-2B-NVFP4A16") 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("axteam/MiniCPM5-2B-NVFP4A16") model = AutoModelForCausalLM.from_pretrained("axteam/MiniCPM5-2B-NVFP4A16", 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 axteam/MiniCPM5-2B-NVFP4A16 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "axteam/MiniCPM5-2B-NVFP4A16" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "axteam/MiniCPM5-2B-NVFP4A16", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/axteam/MiniCPM5-2B-NVFP4A16
- SGLang
How to use axteam/MiniCPM5-2B-NVFP4A16 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 "axteam/MiniCPM5-2B-NVFP4A16" \ --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": "axteam/MiniCPM5-2B-NVFP4A16", "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 "axteam/MiniCPM5-2B-NVFP4A16" \ --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": "axteam/MiniCPM5-2B-NVFP4A16", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use axteam/MiniCPM5-2B-NVFP4A16 with Docker Model Runner:
docker model run hf.co/axteam/MiniCPM5-2B-NVFP4A16
Card fixes 2026-11-01: verified corrections, requirements
Browse files
README.md
CHANGED
|
@@ -117,14 +117,46 @@ Quantized derivative of [`openbmb/MiniCPM5-2B`](https://huggingface.co/openbmb/M
|
|
| 117 |
|
| 118 |
---
|
| 119 |
## ํ๊ตญ์ด ์์ฝ
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
|
| 118 |
---
|
| 119 |
## ํ๊ตญ์ด ์์ฝ
|
| 120 |
+
|
| 121 |
+
**[`openbmb/MiniCPM5-2B`](https://huggingface.co/openbmb/MiniCPM5-2B)์ NVFP4A16 (W4A16) ์์ํ ๋น๋** ยท ์ ์ axteam
|
| 122 |
+
|
| 123 |
+
### ๊ฐ์
|
| 124 |
+
| ํญ๋ชฉ | ๋ด์ฉ |
|
| 125 |
+
|---|---|
|
| 126 |
+
| ์๋ณธ ๋ชจ๋ธ | [`openbmb/MiniCPM5-2B`](https://huggingface.co/openbmb/MiniCPM5-2B) |
|
| 127 |
+
| ์์ํ ๋ฐฉ์ | NVFP4A16 (W4A16, FP4 ๊ฐ์ค์น) |
|
| 128 |
+
| ์ ์ฅ ํ์ | compressed-tensors `nvfp4-pack-quantized` |
|
| 129 |
+
| ๋ชจ๋ธ ๊ตฌ์กฐ | Dense (Llama ๊ตฌ์กฐ) ยท ํ
์คํธ ์ ์ฉ |
|
| 130 |
+
| ์ฉ๋ | 2.2 GB |
|
| 131 |
+
| ๋ณด์ ๋ฐ์ดํฐ | ์ํ 256๊ฐ |
|
| 132 |
+
|
| 133 |
+
### ์์ํ ์์ธ
|
| 134 |
+
- **๊ฐ์ค์น**: FP4(E2M1), ๊ทธ๋ฃน ํฌ๊ธฐ 16 (FP8 E4M3 ์ค์ผ์ผ + ํ
์๋ณ FP32 global scale)
|
| 135 |
+
- **ํ์ฑํ**: BF16 (์์ํํ์ง ์์)
|
| 136 |
+
- **๋ฐฉ์**: PTQ(ํ์ต ํ ์์ํ, ์ฌํ์ต ์์) ยท AWQ ์ค๋ฌด๋ฉ ํ FP4 ๋ฐ์ฌ๋ฆผ โ ๋ณด์ ๋ฐ์ดํฐ๋ก ํ์ฑํ๊ฐ ํฐ ์ฑ๋์ ์ฐพ์ ์ค์ผ์ผ๋ก ๋ณดํธ
|
| 137 |
+
- **BF16 ์ ์ง** (์ ์ฒด ํ๋ผ๋ฏธํฐ์ ์ฝ 21%): ํ ํฐ ์๋ฒ ๋ฉยทLM ํค๋ยท๋ชจ๋ RMSNorm
|
| 138 |
+
- **์๋ณธ๊ณผ ๋์ผ**: ํ ํฌ๋์ด์ ยทchat templateยทgeneration config
|
| 139 |
+
|
| 140 |
+
### ํ์ง (์ค์ธก)
|
| 141 |
+
- **์๋ณธ ๋๋น ์ถฉ์ค๋**: PPL 1.8315 (์๋ณธ 1.5988, +14.6%) ยท ๋ค์ ํ ํฐ top-1 ์ผ์น์จ 85.0% (๊ฐ์ ๋ฐฉ๋ฒ์ผ๋ก ์ฐ ์๋ณธ 98.9%) โ ๋ด๋ถ ์์ดยทํ๊ตญ์ด ํผํฉ 100๋ฌธํญ, ์๋ณธ์ greedy ๋ต์ ๊ธฐ์ค์ผ๋ก ์ฑ์
|
| 142 |
+
- **๋ฒค์น๋งํฌ ํ๊ท **: ์๋ณธ 52.97 โ ์ด ๋น๋ 49.85 (ํ๋ณต๋ฅ 94.1%) โ MMLUยทGSM8KยทARC-ChallengeยทWinograndeยทKMMLUยทHAE-RAE, lm-evaluation-harness(vLLM), ๋ชจ๋ ํ์ ๊ฐ์ ์ค์
|
| 143 |
+
- โ ๏ธ **์ฃผ์**: ์ด ์ ๋ฐ๋์์ ํ์ง ์ ํ๊ฐ ๋๋ ทํจ โ ํ์ง์ด ์ค์ํ๋ฉด 8๋นํธ(FP8ยทAWQ-8bit) ๋น๋ ๊ถ์ฅ
|
| 144 |
+
|
| 145 |
+
### ์๊ตฌ์ฌํญ
|
| 146 |
+
- **์คํ ์์ง**: vLLM โ vLLM 0.32.0์์ ์ค์ธก
|
| 147 |
+
- **vLLM 0.32 ์ค์น ์กฐ๊ฑด**: Python 3.11~3.14, torch 2.13(CUDA 13.0 ๋น๋ โ CUDA 13 ์ง์ ๋๋ผ์ด๋ฒ ํ์), transformers 5.16.1 ์ด์ 5.20 ๋ฏธ๋ง, compressed-tensors 0.17.0 (vLLM ๊ณ ์ ๋ฒ์ ์ผ๋ก ์ด ์ฒดํฌํฌ์ธํธ ๋ก๋ ๊ฐ๋ฅ, ๋ณ๋๋ก ์ฌ๋ฆฌ์ง ๋ง ๊ฒ)
|
| 148 |
+
- **GPU**: NVIDIA Turing(sm75) ์ด์ โ ๊ฐ์ค์น ์ ์ฉ FP4๋ผ FP4 ํ
์์ฝ์ด ๋ถํ์. V100(sm70) ๋ฏธ์ง์
|
| 149 |
+
- **๋ฉ๋ชจ๋ฆฌ**: ๊ฐ์ค์น 2.2 GB + KV ์บ์(์ปจํ
์คํธ ๊ธธ์ด ร ๋์ ์์ฒญ ์์ ๋น๋ก) + ํ์ฑํยทCUDA graph ์ GB โ ํ ์ฅ์ ๋ค์ด๊ฐ์ง ์์ผ๋ฉด `--tensor-parallel-size N`
|
| 150 |
+
- **Transformers๋ก ์ง์ ์ฌ์ฉ**: transformers 4.56.0 ์ด์ + compressed-tensors 0.15.0 ์ด์ (4.56.0ยท4.56.2ยท4.57.6์์ FP8ยทAWQ-4bitยทNVFP4A16 ํ์ธ)
|
| 151 |
+
- **trust_remote_code**: ๋ถํ์
|
| 152 |
+
|
| 153 |
+
### ์ฌ์ฉ๋ฒ
|
| 154 |
+
- **์๋ฒ ์คํ**: `vllm serve axteam/MiniCPM5-2B-NVFP4A16 --max-model-len 32768` โ OpenAI ํธํ API (๊ธฐ๋ณธ ํฌํธ 8000)
|
| 155 |
+
- **Python**: `LLM(model="axteam/MiniCPM5-2B-NVFP4A16").chat(...)` โ ์ ์ฒด ์์๋ ์ Usage ์ฐธ๊ณ
|
| 156 |
+
- **๊ถ์ฅ ์ํ๋ง**: `temperature=1.0`, `top_p=0.95`
|
| 157 |
+
- **thinking ๋ชจ๋**: ๊ธฐ๋ณธ ์ผ์ง โ ๋๋ ค๋ฉด `chat_template_kwargs={"enable_thinking": False}`
|
| 158 |
+
- **KV ์บ์ ์ ๊ฐ(์ ํ)**: `--kv-cache-dtype fp8` โ ๊ธด ๋ฌธ๋งฅยท๋๋ ์์ฒญ์์ KV ๋ฉ๋ชจ๋ฆฌ ์ฝ ์ ๋ฐ, ๊ฐ์ค์น ์์ํ์ ๋ณ๊ฐ์ธ ์คํ ์ต์
|
| 159 |
+
|
| 160 |
+
### ๋ผ์ด์ ์ค
|
| 161 |
+
- **๋ผ์ด์ ์ค**: Apache-2.0 โ ์๋ณธ ๋ชจ๋ธ์ ๋ผ์ด์ ์ค๋ฅผ ๊ทธ๋๋ก ๋ฐ๋ฆ
|
| 162 |
+
- **๊ถ๋ฆฌ**: ์๋ณธ ๊ฐ์ค์นยทํ ํฌ๋์ด์ ์ ๊ถ๋ฆฌ๋ OpenBMB์ ์์ผ๋ฉฐ, ์ด ๋ฆฌํฌ๋ ์์ํ ํ์๋ฌผ
|