Text Generation
MLX
Safetensors
laguna
oq
quantized
Mixture of Experts
conversational
custom_code
3-bit
Instructions to use mlx-community/Laguna-S-2.1-oQ3e with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use mlx-community/Laguna-S-2.1-oQ3e 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-S-2.1-oQ3e") 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 mlx-community/Laguna-S-2.1-oQ3e with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "mlx-community/Laguna-S-2.1-oQ3e"
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": "mlx-community/Laguna-S-2.1-oQ3e" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use mlx-community/Laguna-S-2.1-oQ3e with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "mlx-community/Laguna-S-2.1-oQ3e"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "mlx-community/Laguna-S-2.1-oQ3e" # 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-S-2.1-oQ3e", "messages": [ {"role": "user", "content": "Hello"} ] }' - Hermes Agent
How to use mlx-community/Laguna-S-2.1-oQ3e 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 "mlx-community/Laguna-S-2.1-oQ3e"
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 mlx-community/Laguna-S-2.1-oQ3e
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use mlx-community/Laguna-S-2.1-oQ3e with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "mlx-community/Laguna-S-2.1-oQ3e"
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 "mlx-community/Laguna-S-2.1-oQ3e" \ --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"
Gabriel Francisco dos Santos Silva commited on
Refresh metadata from base HEAD e80da38: chat template preserve-reasoning, </assistant> token 24 special, drop max_new_tokens cap
Browse files- chat_template.jinja +3 -2
- generation_config.json +2 -4
- tokenizer.json +1 -1
- tokenizer_config.json +1 -1
chat_template.jinja
CHANGED
|
@@ -1,8 +1,9 @@
|
|
| 1 |
{#- Iteration on laguna_glm_thinking_v8/chat_template.jinja -#}
|
| 2 |
{#- No formatting instructions -#}
|
| 3 |
{{- "〈|EOS|〉" -}}
|
| 4 |
-
{%- set enable_thinking = enable_thinking | default(
|
| 5 |
{%- set add_generation_prompt = add_generation_prompt | default(false) -%}
|
|
|
|
| 6 |
|
| 7 |
{#- ───── header (system message) ───── -#}
|
| 8 |
{#- A caller-supplied system message with empty content opts out of the default below, producing no <system> block — used to train without a system message. -#}
|
|
@@ -51,7 +52,7 @@
|
|
| 51 |
{%- set reasoning_content = message.reasoning_content -%}
|
| 52 |
{%- endif -%}
|
| 53 |
{#- Display reasoning content for all messages if enable_thinking -#}
|
| 54 |
-
{%- if enable_thinking -%}
|
| 55 |
{{- '<think>' + reasoning_content + '</think>' -}}
|
| 56 |
{%- else -%}
|
| 57 |
{{- '</think>' -}}
|
|
|
|
| 1 |
{#- Iteration on laguna_glm_thinking_v8/chat_template.jinja -#}
|
| 2 |
{#- No formatting instructions -#}
|
| 3 |
{{- "〈|EOS|〉" -}}
|
| 4 |
+
{%- set enable_thinking = enable_thinking | default(true) -%}
|
| 5 |
{%- set add_generation_prompt = add_generation_prompt | default(false) -%}
|
| 6 |
+
{%- set preserve_thinking = preserve_thinking | default(false) -%}
|
| 7 |
|
| 8 |
{#- ───── header (system message) ───── -#}
|
| 9 |
{#- A caller-supplied system message with empty content opts out of the default below, producing no <system> block — used to train without a system message. -#}
|
|
|
|
| 52 |
{%- set reasoning_content = message.reasoning_content -%}
|
| 53 |
{%- endif -%}
|
| 54 |
{#- Display reasoning content for all messages if enable_thinking -#}
|
| 55 |
+
{%- if enable_thinking or preserve_thinking -%}
|
| 56 |
{{- '<think>' + reasoning_content + '</think>' -}}
|
| 57 |
{%- else -%}
|
| 58 |
{{- '</think>' -}}
|
generation_config.json
CHANGED
|
@@ -5,7 +5,6 @@
|
|
| 5 |
2,
|
| 6 |
24
|
| 7 |
],
|
| 8 |
-
"max_new_tokens": 32768,
|
| 9 |
"pad_token_id": 9,
|
| 10 |
"temperature": 1.0,
|
| 11 |
"top_p": 1.0,
|
|
@@ -21,6 +20,5 @@
|
|
| 21 |
"source": "huggingface",
|
| 22 |
"model": "poolside/Laguna-S-2.1-DFlash",
|
| 23 |
"num_speculative_tokens": 15
|
| 24 |
-
}
|
| 25 |
-
|
| 26 |
-
}
|
|
|
|
| 5 |
2,
|
| 6 |
24
|
| 7 |
],
|
|
|
|
| 8 |
"pad_token_id": 9,
|
| 9 |
"temperature": 1.0,
|
| 10 |
"top_p": 1.0,
|
|
|
|
| 20 |
"source": "huggingface",
|
| 21 |
"model": "poolside/Laguna-S-2.1-DFlash",
|
| 22 |
"num_speculative_tokens": 15
|
| 23 |
+
}
|
| 24 |
+
}
|
|
|
tokenizer.json
CHANGED
|
@@ -226,7 +226,7 @@
|
|
| 226 |
"lstrip": false,
|
| 227 |
"rstrip": false,
|
| 228 |
"normalized": false,
|
| 229 |
-
"special":
|
| 230 |
},
|
| 231 |
{
|
| 232 |
"id": 25,
|
|
|
|
| 226 |
"lstrip": false,
|
| 227 |
"rstrip": false,
|
| 228 |
"normalized": false,
|
| 229 |
+
"special": true
|
| 230 |
},
|
| 231 |
{
|
| 232 |
"id": 25,
|
tokenizer_config.json
CHANGED
|
@@ -542,7 +542,7 @@
|
|
| 542 |
"lstrip": false,
|
| 543 |
"rstrip": false,
|
| 544 |
"normalized": false,
|
| 545 |
-
"special":
|
| 546 |
},
|
| 547 |
"25": {
|
| 548 |
"content": "<tool_call>",
|
|
|
|
| 542 |
"lstrip": false,
|
| 543 |
"rstrip": false,
|
| 544 |
"normalized": false,
|
| 545 |
+
"special": true
|
| 546 |
},
|
| 547 |
"25": {
|
| 548 |
"content": "<tool_call>",
|