Text Generation
MLX
Safetensors
Hebrew
English
qwen3
mathematics
education
hebrew
reasoning
math
tutoring
conversational
4-bit precision
Instructions to use msotomaior/math with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use msotomaior/math 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("msotomaior/math") 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 msotomaior/math with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "msotomaior/math"
Configure the model in Pi
# 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": "msotomaior/math" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use msotomaior/math 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 "msotomaior/math"
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 msotomaior/math
Run Hermes
hermes
- OpenClaw new
How to use msotomaior/math with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "msotomaior/math"
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 "msotomaior/math" \ --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"
- MLX LM
How to use msotomaior/math with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "msotomaior/math"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "msotomaior/math" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "msotomaior/math", "messages": [ {"role": "user", "content": "Hello"} ] }'
Update chat_template.jinja
Browse files- chat_template.jinja +23 -81
chat_template.jinja
CHANGED
|
@@ -1,86 +1,28 @@
|
|
| 1 |
-
{
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
{%- else %}
|
| 13 |
-
{%- if messages[0].role == 'system' %}
|
| 14 |
-
{{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
|
| 15 |
-
{%- endif %}
|
| 16 |
{%- endif %}
|
| 17 |
-
|
| 18 |
-
{%- for message in messages[::-1] %}
|
| 19 |
-
{%- set index = (messages|length - 1) - loop.index0 %}
|
| 20 |
-
{%- if ns.multi_step_tool and message.role == "user" and message.content is string and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}
|
| 21 |
-
{%- set ns.multi_step_tool = false %}
|
| 22 |
-
{%- set ns.last_query_index = index %}
|
| 23 |
-
{%- endif %}
|
| 24 |
-
{%- endfor %}
|
| 25 |
{%- for message in messages %}
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
{%- if message.reasoning_content is string %}
|
| 36 |
-
{%- set reasoning_content = message.reasoning_content %}
|
| 37 |
-
{%- else %}
|
| 38 |
-
{%- if '</think>' in content %}
|
| 39 |
-
{%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
|
| 40 |
-
{%- set content = content.split('</think>')[-1].lstrip('\n') %}
|
| 41 |
-
{%- endif %}
|
| 42 |
-
{%- endif %}
|
| 43 |
-
{%- if loop.index0 > ns.last_query_index %}
|
| 44 |
-
{%- if loop.last or (not loop.last and reasoning_content) %}
|
| 45 |
-
{{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
|
| 46 |
-
{%- else %}
|
| 47 |
-
{{- '<|im_start|>' + message.role + '\n' + content }}
|
| 48 |
-
{%- endif %}
|
| 49 |
-
{%- else %}
|
| 50 |
-
{{- '<|im_start|>' + message.role + '\n' + content }}
|
| 51 |
-
{%- endif %}
|
| 52 |
-
{%- if message.tool_calls %}
|
| 53 |
-
{%- for tool_call in message.tool_calls %}
|
| 54 |
-
{%- if (loop.first and content) or (not loop.first) %}
|
| 55 |
-
{{- '\n' }}
|
| 56 |
-
{%- endif %}
|
| 57 |
-
{%- if tool_call.function %}
|
| 58 |
-
{%- set tool_call = tool_call.function %}
|
| 59 |
-
{%- endif %}
|
| 60 |
-
{{- '<tool_call>\n{"name": "' }}
|
| 61 |
-
{{- tool_call.name }}
|
| 62 |
-
{{- '", "arguments": ' }}
|
| 63 |
-
{%- if tool_call.arguments is string %}
|
| 64 |
-
{{- tool_call.arguments }}
|
| 65 |
-
{%- else %}
|
| 66 |
-
{{- tool_call.arguments | tojson }}
|
| 67 |
-
{%- endif %}
|
| 68 |
-
{{- '}\n</tool_call>' }}
|
| 69 |
-
{%- endfor %}
|
| 70 |
-
{%- endif %}
|
| 71 |
-
{{- '<|im_end|>\n' }}
|
| 72 |
-
{%- elif message.role == "tool" %}
|
| 73 |
-
{%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
|
| 74 |
-
{{- '<|im_start|>user' }}
|
| 75 |
-
{%- endif %}
|
| 76 |
-
{{- '\n<tool_response>\n' }}
|
| 77 |
-
{{- content }}
|
| 78 |
-
{{- '\n</tool_response>' }}
|
| 79 |
-
{%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
|
| 80 |
-
{{- '<|im_end|>\n' }}
|
| 81 |
-
{%- endif %}
|
| 82 |
-
{%- endif %}
|
| 83 |
{%- endfor %}
|
|
|
|
| 84 |
{%- if add_generation_prompt %}
|
| 85 |
-
|
| 86 |
{%- endif %}
|
|
|
|
| 1 |
+
{# ============================================
|
| 2 |
+
Simple ChatML template (NO <think>, NO tools)
|
| 3 |
+
- Compatible with many LLaMA-style chat models
|
| 4 |
+
- Prevents "THINKING/ANSWER" scaffolding by not
|
| 5 |
+
prompting for reasoning channels.
|
| 6 |
+
============================================ #}
|
| 7 |
+
|
| 8 |
+
{%- if messages[0].role == 'system' %}
|
| 9 |
+
{{- '<|im_start|>system\n' -}}
|
| 10 |
+
{{- messages[0].content -}}
|
| 11 |
+
{{- '<|im_end|>\n' -}}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
{%- endif %}
|
| 13 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
{%- for message in messages %}
|
| 15 |
+
{%- if message.role == 'system' and loop.first %}
|
| 16 |
+
{# already emitted above #}
|
| 17 |
+
{%- else %}
|
| 18 |
+
{{- '<|im_start|>' + message.role + '\n' -}}
|
| 19 |
+
{%- if message.content is string -%}
|
| 20 |
+
{{- message.content -}}
|
| 21 |
+
{%- endif -%}
|
| 22 |
+
{{- '<|im_end|>\n' -}}
|
| 23 |
+
{%- endif %}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
{%- endfor %}
|
| 25 |
+
|
| 26 |
{%- if add_generation_prompt %}
|
| 27 |
+
{{- '<|im_start|>assistant\n' -}}
|
| 28 |
{%- endif %}
|