Instructions to use lmstudio-community/Seed-OSS-36B-Instruct-MLX-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use lmstudio-community/Seed-OSS-36B-Instruct-MLX-4bit with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="lmstudio-community/Seed-OSS-36B-Instruct-MLX-4bit") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("lmstudio-community/Seed-OSS-36B-Instruct-MLX-4bit") model = AutoModelForCausalLM.from_pretrained("lmstudio-community/Seed-OSS-36B-Instruct-MLX-4bit", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - MLX
How to use lmstudio-community/Seed-OSS-36B-Instruct-MLX-4bit 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("lmstudio-community/Seed-OSS-36B-Instruct-MLX-4bit") 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
- vLLM
How to use lmstudio-community/Seed-OSS-36B-Instruct-MLX-4bit with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "lmstudio-community/Seed-OSS-36B-Instruct-MLX-4bit" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "lmstudio-community/Seed-OSS-36B-Instruct-MLX-4bit", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/lmstudio-community/Seed-OSS-36B-Instruct-MLX-4bit
- SGLang
How to use lmstudio-community/Seed-OSS-36B-Instruct-MLX-4bit with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "lmstudio-community/Seed-OSS-36B-Instruct-MLX-4bit" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "lmstudio-community/Seed-OSS-36B-Instruct-MLX-4bit", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "lmstudio-community/Seed-OSS-36B-Instruct-MLX-4bit" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "lmstudio-community/Seed-OSS-36B-Instruct-MLX-4bit", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Pi
How to use lmstudio-community/Seed-OSS-36B-Instruct-MLX-4bit with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "lmstudio-community/Seed-OSS-36B-Instruct-MLX-4bit"
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": "lmstudio-community/Seed-OSS-36B-Instruct-MLX-4bit" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use lmstudio-community/Seed-OSS-36B-Instruct-MLX-4bit with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "lmstudio-community/Seed-OSS-36B-Instruct-MLX-4bit"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "lmstudio-community/Seed-OSS-36B-Instruct-MLX-4bit" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "lmstudio-community/Seed-OSS-36B-Instruct-MLX-4bit", "messages": [ {"role": "user", "content": "Hello"} ] }' - Docker Model Runner
How to use lmstudio-community/Seed-OSS-36B-Instruct-MLX-4bit with Docker Model Runner:
docker model run hf.co/lmstudio-community/Seed-OSS-36B-Instruct-MLX-4bit
- Hermes Agent
How to use lmstudio-community/Seed-OSS-36B-Instruct-MLX-4bit 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 "lmstudio-community/Seed-OSS-36B-Instruct-MLX-4bit"
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 lmstudio-community/Seed-OSS-36B-Instruct-MLX-4bit
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use lmstudio-community/Seed-OSS-36B-Instruct-MLX-4bit with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "lmstudio-community/Seed-OSS-36B-Instruct-MLX-4bit"
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 "lmstudio-community/Seed-OSS-36B-Instruct-MLX-4bit" \ --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"
Update chat_template.jinja
Browse files- chat_template.jinja +9 -9
chat_template.jinja
CHANGED
|
@@ -23,18 +23,18 @@
|
|
| 23 |
{%- set ns.interval = budget_values_v05[i] -%}
|
| 24 |
{%- endif -%}
|
| 25 |
{%- endfor -%}
|
| 26 |
-
{#
|
| 27 |
{%- if ns.interval is none -%}
|
| 28 |
{%- set ns.interval = budget_values_v05[-1] -%}
|
| 29 |
{%- endif -%}
|
| 30 |
-
{# ----------
|
| 31 |
{%- if messages[0]["role"] == "system" %}
|
| 32 |
{%- set system_message = messages[0]["content"] %}
|
| 33 |
{%- set loop_messages = messages[1:] %}
|
| 34 |
{%- else %}
|
| 35 |
{%- set loop_messages = messages %}
|
| 36 |
{%- endif %}
|
| 37 |
-
{# ----------
|
| 38 |
{%- if not tools is defined or tools is none %}
|
| 39 |
{%- set tools = [] %}
|
| 40 |
{%- endif %}
|
|
@@ -46,7 +46,7 @@
|
|
| 46 |
{%- elif t == "array" -%}list
|
| 47 |
{%- else -%}Any{%- endif -%}
|
| 48 |
{%- endmacro -%}
|
| 49 |
-
{# ----------
|
| 50 |
{%- if system_message is defined %}
|
| 51 |
{{ bos_token + "system\n" + system_message }}
|
| 52 |
{%- else %}
|
|
@@ -100,7 +100,7 @@ def {{ item.function.name }}(
|
|
| 100 |
|
| 101 |
{{"工具调用请遵循如下格式:\n<seed:tool_call>\n<function=example_function_name>\n<parameter=example_parameter_1>value_1</parameter>\n<parameter=example_parameter_2>This is the value for the second parameter\nthat can span\nmultiple lines</parameter>\n</function>\n</seed:tool_call>\n"}}
|
| 102 |
{%- endif %}
|
| 103 |
-
{#
|
| 104 |
{%- if system_message is defined or tools is iterable and tools | length > 0 %}
|
| 105 |
{{ eos_token }}
|
| 106 |
{%- endif %}
|
|
@@ -116,7 +116,7 @@ def {{ item.function.name }}(
|
|
| 116 |
{{ eos_token }}
|
| 117 |
{%- endif %}
|
| 118 |
{%- endif %}
|
| 119 |
-
{# ----------
|
| 120 |
{%- for message in loop_messages %}
|
| 121 |
{%- if message.role == "assistant"
|
| 122 |
and message.tool_calls is defined
|
|
@@ -152,15 +152,15 @@ def {{ item.function.name }}(
|
|
| 152 |
{%- if message.content is defined and message.content is string and message.content | trim | length > 0 %}
|
| 153 |
{{ "\n" + message.content | trim + eos_token }}
|
| 154 |
{%- endif %}
|
| 155 |
-
{#
|
| 156 |
{%- else %}
|
| 157 |
{{ bos_token + message.role + "\n" + message.content + eos_token }}
|
| 158 |
{%- endif %}
|
| 159 |
{%- endfor %}
|
| 160 |
-
{# ----------
|
| 161 |
{%- if add_generation_prompt %}
|
| 162 |
{{ bos_token+"assistant\n" }}
|
| 163 |
{%- if thinking_budget == 0 %}
|
| 164 |
-
{{ think_begin_token+budget_begin_token }}
|
| 165 |
{%- endif %}
|
| 166 |
{%- endif %}
|
|
|
|
| 23 |
{%- set ns.interval = budget_values_v05[i] -%}
|
| 24 |
{%- endif -%}
|
| 25 |
{%- endfor -%}
|
| 26 |
+
{# Find the first gear that is greater than or equal to the thinking_budget. #}
|
| 27 |
{%- if ns.interval is none -%}
|
| 28 |
{%- set ns.interval = budget_values_v05[-1] -%}
|
| 29 |
{%- endif -%}
|
| 30 |
+
{# ---------- Preprocess the system message ---------- #}
|
| 31 |
{%- if messages[0]["role"] == "system" %}
|
| 32 |
{%- set system_message = messages[0]["content"] %}
|
| 33 |
{%- set loop_messages = messages[1:] %}
|
| 34 |
{%- else %}
|
| 35 |
{%- set loop_messages = messages %}
|
| 36 |
{%- endif %}
|
| 37 |
+
{# ---------- Ensure tools exist ---------- #}
|
| 38 |
{%- if not tools is defined or tools is none %}
|
| 39 |
{%- set tools = [] %}
|
| 40 |
{%- endif %}
|
|
|
|
| 46 |
{%- elif t == "array" -%}list
|
| 47 |
{%- else -%}Any{%- endif -%}
|
| 48 |
{%- endmacro -%}
|
| 49 |
+
{# ---------- Output the system block ---------- #}
|
| 50 |
{%- if system_message is defined %}
|
| 51 |
{{ bos_token + "system\n" + system_message }}
|
| 52 |
{%- else %}
|
|
|
|
| 100 |
|
| 101 |
{{"工具调用请遵循如下格式:\n<seed:tool_call>\n<function=example_function_name>\n<parameter=example_parameter_1>value_1</parameter>\n<parameter=example_parameter_2>This is the value for the second parameter\nthat can span\nmultiple lines</parameter>\n</function>\n</seed:tool_call>\n"}}
|
| 102 |
{%- endif %}
|
| 103 |
+
{# End the system block line #}
|
| 104 |
{%- if system_message is defined or tools is iterable and tools | length > 0 %}
|
| 105 |
{{ eos_token }}
|
| 106 |
{%- endif %}
|
|
|
|
| 116 |
{{ eos_token }}
|
| 117 |
{%- endif %}
|
| 118 |
{%- endif %}
|
| 119 |
+
{# ---------- List the historical messages one by one ---------- #}
|
| 120 |
{%- for message in loop_messages %}
|
| 121 |
{%- if message.role == "assistant"
|
| 122 |
and message.tool_calls is defined
|
|
|
|
| 152 |
{%- if message.content is defined and message.content is string and message.content | trim | length > 0 %}
|
| 153 |
{{ "\n" + message.content | trim + eos_token }}
|
| 154 |
{%- endif %}
|
| 155 |
+
{# Include the tool role #}
|
| 156 |
{%- else %}
|
| 157 |
{{ bos_token + message.role + "\n" + message.content + eos_token }}
|
| 158 |
{%- endif %}
|
| 159 |
{%- endfor %}
|
| 160 |
+
{# ---------- Control the model to start continuation ---------- #}
|
| 161 |
{%- if add_generation_prompt %}
|
| 162 |
{{ bos_token+"assistant\n" }}
|
| 163 |
{%- if thinking_budget == 0 %}
|
| 164 |
+
{{ think_begin_token + "\n" + budget_begin_token + "The current thinking budget is 0, so I will directly start answering the question." + budget_end_token + "\n" + think_end_token }}
|
| 165 |
{%- endif %}
|
| 166 |
{%- endif %}
|