Instructions to use lee-loo/MiniCPM5-2B-MLX-bf16 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use lee-loo/MiniCPM5-2B-MLX-bf16 with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("lee-loo/MiniCPM5-2B-MLX-bf16") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Pi
How to use lee-loo/MiniCPM5-2B-MLX-bf16 with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "lee-loo/MiniCPM5-2B-MLX-bf16"
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "lee-loo/MiniCPM5-2B-MLX-bf16" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use lee-loo/MiniCPM5-2B-MLX-bf16 with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "lee-loo/MiniCPM5-2B-MLX-bf16"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "lee-loo/MiniCPM5-2B-MLX-bf16" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "lee-loo/MiniCPM5-2B-MLX-bf16", "messages": [ {"role": "user", "content": "Hello"} ] }' - Hermes Agent
How to use lee-loo/MiniCPM5-2B-MLX-bf16 with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "lee-loo/MiniCPM5-2B-MLX-bf16"
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default lee-loo/MiniCPM5-2B-MLX-bf16
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use lee-loo/MiniCPM5-2B-MLX-bf16 with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "lee-loo/MiniCPM5-2B-MLX-bf16"
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "lee-loo/MiniCPM5-2B-MLX-bf16" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
MiniCPM5-2B MLX BF16
BF16 MLX conversion of openbmb/MiniCPM5-2B.
This conversion preserves BF16 precision and performs no quantization.
Why?
At the time the official MLX version was only 4 bit quant.
Conversion
Converted from the official OpenBMB checkpoint using mlx-lm 0.31.3:
mlx_lm.convert \
--hf-path openbmb/MiniCPM5-2B \
--mlx-path MiniCPM5-2B-MLX-bf16 \
--dtype bfloat16
Precision verification
All tensors in the converted safetensors files were verified as BF16:
Counter({'mlx.core.bfloat16': 381})
Tested hardware
Apple M4 Max with 128 GB unified memory.
Observed with mlx_lm.generate:
- Peak memory: approximately 5.1 GB
- Decode: approximately 96 tokens/sec
- Prefill: approximately 2300 tokens/sec on a short test
- MLX-LM: 0.31.3
Performance varies with prompt length, generation settings, and hardware.
Usage
mlx_lm.generate \
--model MiniCPM5-2B-MLX-bf16 \
--prompt "explain in two sentences quantum physics" \
--max-tokens 512
MiniCPM5-2B supports thinking/reasoning output. For interactive or low-latency workloads, generation settings should be chosen according to the intended use case.
Original model
Architecture, training details, benchmarks, limitations, license information, and citation are available from the original model:
openbmb/MiniCPM5-2B
https://huggingface.co/openbmb/MiniCPM5-2B
Conversion provenance
OpenBMB official MiniCPM5-2B BF16 weights => mlx-lm 0.31.3 => MLX BF16 weights no quantization
- Downloads last month
- 15
Quantized
Model tree for lee-loo/MiniCPM5-2B-MLX-bf16
Base model
openbmb/MiniCPM5-2B