Instructions to use spicyneuron/Nex-N2-Pro-MLX-5.3bit-vision with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use spicyneuron/Nex-N2-Pro-MLX-5.3bit-vision 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("spicyneuron/Nex-N2-Pro-MLX-5.3bit-vision") 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 spicyneuron/Nex-N2-Pro-MLX-5.3bit-vision with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "spicyneuron/Nex-N2-Pro-MLX-5.3bit-vision"
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": "spicyneuron/Nex-N2-Pro-MLX-5.3bit-vision" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use spicyneuron/Nex-N2-Pro-MLX-5.3bit-vision with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "spicyneuron/Nex-N2-Pro-MLX-5.3bit-vision"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "spicyneuron/Nex-N2-Pro-MLX-5.3bit-vision" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "spicyneuron/Nex-N2-Pro-MLX-5.3bit-vision", "messages": [ {"role": "user", "content": "Hello"} ] }' - Hermes Agent
How to use spicyneuron/Nex-N2-Pro-MLX-5.3bit-vision 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 "spicyneuron/Nex-N2-Pro-MLX-5.3bit-vision"
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 spicyneuron/Nex-N2-Pro-MLX-5.3bit-vision
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use spicyneuron/Nex-N2-Pro-MLX-5.3bit-vision with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "spicyneuron/Nex-N2-Pro-MLX-5.3bit-vision"
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 "spicyneuron/Nex-N2-Pro-MLX-5.3bit-vision" \ --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"
Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
pipeline_tag: text-generation
|
| 4 |
+
library_name: mlx
|
| 5 |
+
tags:
|
| 6 |
+
- mlx
|
| 7 |
+
base_model: nex-agi/Nex-N2-Pro
|
| 8 |
+
---
|
| 9 |
+
|
| 10 |
+
> [!NOTE]
|
| 11 |
+
> Uploading... 🐌
|
| 12 |
+
|
| 13 |
+
[Nex-N2-Pro](https://huggingface.co/nex-agi/Nex-N2-Pro) optimized for MLX.
|
| 14 |
+
|
| 15 |
+
- A mixed-precision quant that balances speed, memory, and accuracy.
|
| 16 |
+
- 4-bit baseline with important layers at higher precision.
|
| 17 |
+
- Supports image input and requires a vision-capable MLX server.
|
| 18 |
+
|
| 19 |
+
# Usage
|
| 20 |
+
|
| 21 |
+
```sh
|
| 22 |
+
# Start server at http://localhost:8080/v1/chat/completions
|
| 23 |
+
uvx --from mlx-vlm mlx_vlm.server \
|
| 24 |
+
--host 127.0.0.1 \
|
| 25 |
+
--port 8080 \
|
| 26 |
+
--model spicyneuron/Nex-N2-Pro-MLX-5.3bit-vision
|
| 27 |
+
```
|
| 28 |
+
|
| 29 |
+
# Benchmarks
|
| 30 |
+
|
| 31 |
+
Tested on a Mac Studio M3 Ultra.
|
| 32 |
+
|
| 33 |
+
metric | this model
|
| 34 |
+
--- | ---
|
| 35 |
+
bpw | 5.349
|
| 36 |
+
base memory | 246.796
|
| 37 |
+
peak memory (1024/512) | 267.043
|
| 38 |
+
prompt tok/s (1024) | 475.490 ± 0.195
|
| 39 |
+
gen tok/s (512) | 30.802 ± 0.154
|
| 40 |
+
kl mean\* | 0.012 ± 0.001
|
| 41 |
+
kl p95\* | 0.029 ± 0.001
|
| 42 |
+
perplexity | 3.677 ± 0.023
|
| 43 |
+
ifbench_strict | 0.470 ± 0.050
|
| 44 |
+
ifbench_loose | 0.520 ± 0.050
|
| 45 |
+
arc_challenge | 0.696 ± 0.021
|
| 46 |
+
hellaswag | 0.922 ± 0.012
|
| 47 |
+
|
| 48 |
+
\*KL was measured against a stronger local reference using a cached baseline.
|
| 49 |
+
|
| 50 |
+
# Methodology
|
| 51 |
+
|
| 52 |
+
Quantized with a [mlx-vlm fork](https://github.com/spicyneuron/mlx-vlm/tree/override).
|
| 53 |
+
MLX quantization options differ than llama.cpp, but the principles are the same:
|
| 54 |
+
|
| 55 |
+
- Sensitive layers like MoE routing, attention, and output embeddings get higher precision
|
| 56 |
+
- More tolerant layers like MoE experts get lower precision
|
| 57 |
+
|
| 58 |
+
Related tooling:
|
| 59 |
+
|
| 60 |
+
- [Benchmark VLMs with `mlx_lm`](https://github.com/ml-explore/mlx-lm/pull/1033)
|
| 61 |
+
- [`mlx_lm.kld` command](https://github.com/ml-explore/mlx-lm/pull/1146)
|