Text Generation
Transformers
Safetensors
English
Chinese
llama
minicpm
minicpm5
fp8
compressed-tensors
quantization
vllm
blackwell
code
on-device
conversational
text-generation-inference
Instructions to use Ttimms/MiniCPM5-2B-FP8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Ttimms/MiniCPM5-2B-FP8 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Ttimms/MiniCPM5-2B-FP8") 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("Ttimms/MiniCPM5-2B-FP8") model = AutoModelForCausalLM.from_pretrained("Ttimms/MiniCPM5-2B-FP8", 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 Ttimms/MiniCPM5-2B-FP8 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Ttimms/MiniCPM5-2B-FP8" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Ttimms/MiniCPM5-2B-FP8", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Ttimms/MiniCPM5-2B-FP8
- SGLang
How to use Ttimms/MiniCPM5-2B-FP8 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 "Ttimms/MiniCPM5-2B-FP8" \ --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": "Ttimms/MiniCPM5-2B-FP8", "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 "Ttimms/MiniCPM5-2B-FP8" \ --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": "Ttimms/MiniCPM5-2B-FP8", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Ttimms/MiniCPM5-2B-FP8 with Docker Model Runner:
docker model run hf.co/Ttimms/MiniCPM5-2B-FP8
File size: 3,455 Bytes
a626636 8ccc63f a626636 8ccc63f a626636 8ccc63f a626636 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | ---
license: apache-2.0
base_model:
- openbmb/MiniCPM5-2B
base_model_relation: quantized
pipeline_tag: text-generation
library_name: transformers
tags:
- minicpm
- minicpm5
- llama
- fp8
- compressed-tensors
- quantization
- vllm
- blackwell
- code
- on-device
language:
- en
- zh
quantized_by: Ttimms
---
# MiniCPM5-2B β FP8 (compressed-tensors)
**FP8-dynamic quantization of [`openbmb/MiniCPM5-2B`](https://huggingface.co/openbmb/MiniCPM5-2B)**,
weights and activations in `float8_e4m3` (per-channel weights, per-token dynamic
activations), `lm_head` and embeddings kept in bf16. Produced with
[llm-compressor](https://github.com/vllm-project/llm-compressor) 0.13.
- **2.84 GiB** on disk (bf16 base is 4.68 GiB β **39 % smaller**)
- Serves on **vLLM** (`compressed-tensors`), native FP8 tensor-core path on Ada / Blackwell
- **Near-lossless** on coding benchmarks β see the eval below
This is the recommended quant for MiniCPM5-2B when you want maximum quality
retention. If you need to fit closer to 2 GB, see the
[NVFP4 W4A16 build](https://huggingface.co/Ttimms/MiniCPM5-2B-NVFP4)
(smaller, ~2.4 pp HumanEval / ~4.8 pp MBPP cost).
## Evaluation
`lm-evaluation-harness`, vLLM 0.26 backend, greedy decoding, **median of 3 draws**
with the range (the harness is non-deterministic run-to-run even at greedy β a
single draw is not a reproducible score). All arms measured in one session against
the released checkpoint. HumanEval-instruct `pass@1`/`create_test` (n = 164);
MBPP base 3-shot (n = 500).
| build | HumanEval-inst | MBPP (3-shot) | size | Ξ HE / MBPP |
|---|---:|---:|---:|---:|
| bf16 base | 86.59 % (85.98β86.59) | 50.60 % (50.40β51.00) | 4.68 GiB | β |
| **FP8-dynamic (this)** | **84.76 %** (84.15β85.37) | **48.80 %** (48.80β49.00) | **2.84 GiB** | **β1.8 / β1.8 pp** |
| NVFP4-W4A16 GPTQ | 84.15 % (81.71β84.15) | 45.80 % (45.60β46.40) | 2.03 GiB | β2.4 / β4.8 pp |
| NVFP4-W4A16 RTN | 79.88 % (77.44β79.88) | 41.20 % (41.20β41.80) | 2.03 GiB | β6.7 / β9.4 pp |
| mixed (MLP-NVFP4 + attn-FP8) | 84.15 % (82.93β85.98) | 46.60 % (46.00β46.80) | 2.20 GiB | β2.4 / β4.0 pp |
Both FP8 deltas sit inside the eval's own run-to-run spread β FP8 is effectively
lossless here. NVFP4 costs real accuracy on a 2.5 B dense model (little redundancy
to absorb 4-bit weights); pick it only if the extra ~0.8 GiB matters for your KV
budget.
Full comparison, serving notes, and a fine-tune experiment that regressed the
base's coding (so these quants target the released checkpoint):
**<https://github.com/t-timms/minicpm5-2b-quants>**
## Usage
```bash
vllm serve Ttimms/MiniCPM5-2B-FP8 --max-model-len 32768 --kv-cache-dtype fp8
```
```python
from vllm import LLM, SamplingParams
llm = LLM("Ttimms/MiniCPM5-2B-FP8", trust_remote_code=True)
print(llm.chat([{"role": "user", "content": "Write a Python LRU cache."}],
SamplingParams(temperature=0.6, max_tokens=512))[0].outputs[0].text)
```
On WSL, set `VLLM_USE_V2_MODEL_RUNNER=0` (the V2 runner needs UVA, which WSL
disables).
## Method & provenance
- Quantizer: `llm-compressor` 0.13, `QuantizationModifier(scheme="FP8_DYNAMIC")`,
ignore `lm_head` + `embed_tokens`. No calibration data required (dynamic activations).
- Base: `openbmb/MiniCPM5-2B` (`LlamaForCausalLM`, 2.5 B, Apache-2.0).
- Built and evaluated on an RTX 5070 Ti (Blackwell, SM120), vLLM 0.26.
## License
Apache-2.0, inherited from `openbmb/MiniCPM5-2B`.
|