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
Point repository references at PureTensorAI
Browse files
README.md
CHANGED
|
@@ -23,7 +23,7 @@ NVFP4 quantization of [openbmb/MiniCPM5-2B](https://huggingface.co/openbmb/MiniC
|
|
| 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 [
|
| 27 |
|
| 28 |
## What was done
|
| 29 |
|
|
@@ -79,7 +79,7 @@ The case for this checkpoint is throughput under heavy concurrency. Otherwise th
|
|
| 79 |
vLLM:
|
| 80 |
|
| 81 |
```bash
|
| 82 |
-
vllm serve
|
| 83 |
```
|
| 84 |
|
| 85 |
Transformers (requires `pip install compressed-tensors`; the 4-bit arithmetic is emulated, so this path is for checking, not speed):
|
|
@@ -88,7 +88,7 @@ Transformers (requires `pip install compressed-tensors`; the 4-bit arithmetic is
|
|
| 88 |
import torch
|
| 89 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 90 |
|
| 91 |
-
repo = "
|
| 92 |
tok = AutoTokenizer.from_pretrained(repo)
|
| 93 |
model = AutoModelForCausalLM.from_pretrained(repo, dtype=torch.bfloat16).to("cuda")
|
| 94 |
|
|
|
|
| 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 [PureTensorAI/MiniCPM5-2B-NVFP4A16](https://huggingface.co/PureTensorAI/MiniCPM5-2B-NVFP4A16).
|
| 27 |
|
| 28 |
## What was done
|
| 29 |
|
|
|
|
| 79 |
vLLM:
|
| 80 |
|
| 81 |
```bash
|
| 82 |
+
vllm serve PureTensorAI/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):
|
|
|
|
| 88 |
import torch
|
| 89 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 90 |
|
| 91 |
+
repo = "PureTensorAI/MiniCPM5-2B-NVFP4-QAD"
|
| 92 |
tok = AutoTokenizer.from_pretrained(repo)
|
| 93 |
model = AutoModelForCausalLM.from_pretrained(repo, dtype=torch.bfloat16).to("cuda")
|
| 94 |
|