Laguna-XS-2.1
Collection
MLX versions of Laguna-XS-2.1 • 6 items • Updated
How to use mlx-community/Laguna-XS-2.1-8bit 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("mlx-community/Laguna-XS-2.1-8bit")
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)How to use mlx-community/Laguna-XS-2.1-8bit with Pi:
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "mlx-community/Laguna-XS-2.1-8bit"
# Install Pi:
npm install -g @mariozechner/pi-coding-agent
# Add to ~/.pi/agent/models.json:
{
"providers": {
"mlx-lm": {
"baseUrl": "http://localhost:8080/v1",
"api": "openai-completions",
"apiKey": "none",
"models": [
{
"id": "mlx-community/Laguna-XS-2.1-8bit"
}
]
}
}
}# Start Pi in your project directory: pi
How to use mlx-community/Laguna-XS-2.1-8bit with Hermes Agent:
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "mlx-community/Laguna-XS-2.1-8bit"
# 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 mlx-community/Laguna-XS-2.1-8bit
hermes
How to use mlx-community/Laguna-XS-2.1-8bit with OpenClaw:
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "mlx-community/Laguna-XS-2.1-8bit"
# 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 "mlx-community/Laguna-XS-2.1-8bit" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
openclaw agent --local --agent main --message "Hello from Hugging Face"
How to use mlx-community/Laguna-XS-2.1-8bit with MLX LM:
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "mlx-community/Laguna-XS-2.1-8bit"
# Install MLX LM
uv tool install mlx-lm
# Start the server
mlx_lm.server --model "mlx-community/Laguna-XS-2.1-8bit"
# Calling the OpenAI-compatible server with curl
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "mlx-community/Laguna-XS-2.1-8bit",
"messages": [
{"role": "user", "content": "Hello"}
]
}'Converted from poolside/Laguna-XS-2.1 to MLX format, quantized to 8 bits (group size 64, 8.500 bpw effective).
laguna architecture yet — there's an open PR:
mlx-lm#1223.</think> tag at the start of responses, which
isn't that common. It won't affect anything tho.Measured with oMLX's benchmark harness on a Macbook Pro M5 Max 128GB 40 GPU (single request, 128 generated tokens):
| prompt | gen tok/s | prefill tok/s | TTFT ms | peak GB |
|---|---|---|---|---|
| 1k | 95.4 | 3554 | 288 | 33.7 |
| 4k | 94.7 | 3874 | 1058 | 34.3 |
| 8k | 91.3 | 3665 | 2235 | 34.4 |
| 16k | 86.1 | 3067 | 5342 | 34.7 |
| 32k | 76.7 | 2411 | 13589 | 35.4 |
| Variant | bpw | Disk | gen tok/s (1k → 32k) |
|---|---|---|---|
| bf16 | 16 | 62 GB | 70.6 → 58.7 |
| 8bit (this repo) | 8.500 | 33 GB | 95.4 → 76.7 |
| 6bit | 6.501 | 25 GB | 102.9 → 80.9 |
| 5bit | 5.502 | 21 GB | 115.9 → 87.7 |
| 4bit | 4.503 | 18 GB | 126.0 → 91.3 |
| 3bit | 3.503 | 14 GB | 137.2 → 98.8 |
uvx --from mlx-vlm mlx_vlm.generate --model mlx-community/Laguna-XS-2.1-8bit --prompt "..." --max-tokens 300
OpenMDW-1.1, inherited from the base model.
8-bit
Base model
poolside/Laguna-XS-2.1