Instructions to use unsloth/Seed-OSS-36B-Instruct with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use unsloth/Seed-OSS-36B-Instruct with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="unsloth/Seed-OSS-36B-Instruct") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("unsloth/Seed-OSS-36B-Instruct") model = AutoModelForCausalLM.from_pretrained("unsloth/Seed-OSS-36B-Instruct") 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]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps
- vLLM
How to use unsloth/Seed-OSS-36B-Instruct with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "unsloth/Seed-OSS-36B-Instruct" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "unsloth/Seed-OSS-36B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/unsloth/Seed-OSS-36B-Instruct
- SGLang
How to use unsloth/Seed-OSS-36B-Instruct 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 "unsloth/Seed-OSS-36B-Instruct" \ --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": "unsloth/Seed-OSS-36B-Instruct", "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 "unsloth/Seed-OSS-36B-Instruct" \ --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": "unsloth/Seed-OSS-36B-Instruct", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Unsloth Studio new
How to use unsloth/Seed-OSS-36B-Instruct with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for unsloth/Seed-OSS-36B-Instruct to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for unsloth/Seed-OSS-36B-Instruct to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for unsloth/Seed-OSS-36B-Instruct to start chatting
Load model with FastModel
pip install unsloth from unsloth import FastModel model, tokenizer = FastModel.from_pretrained( model_name="unsloth/Seed-OSS-36B-Instruct", max_seq_length=2048, ) - Docker Model Runner
How to use unsloth/Seed-OSS-36B-Instruct with Docker Model Runner:
docker model run hf.co/unsloth/Seed-OSS-36B-Instruct
| {# Unsloth Chat template fixes #} | |
| {# ----------‑‑‑ special token variables ‑‑‑---------- #} | |
| {%- set bos_token = '<seed:bos>' -%} | |
| {%- set eos_token = '<seed:eos>' -%} | |
| {%- set pad_token = '<seed:pad>' -%} | |
| {%- set toolcall_begin_token = '<seed:tool_call>' -%} | |
| {%- set toolcall_end_token = '</seed:tool_call>' -%} | |
| {%- set think_begin_token = '<seed:think>' -%} | |
| {%- set think_end_token = '</seed:think>' -%} | |
| {%- set budget_begin_token = '<seed:cot_budget_reflect>'-%} | |
| {%- set budget_end_token = '</seed:cot_budget_reflect>'-%} | |
| {# -------------- reflection-interval lookup -------------- #} | |
| {%- if not thinking_budget is defined %} | |
| {%- set thinking_budget = -1 -%} | |
| {%- endif -%} | |
| {%- set budget_reflections_v05 = { | |
| 0: 0, | |
| 512: 128, | |
| 1024: 256, | |
| 2048: 512, | |
| 4096: 512, | |
| 8192: 1024, | |
| 16384: 1024 | |
| } -%} | |
| {# 找到 “大于等于 thinking_budget” 的第一个档位 #} | |
| {%- set ns = namespace(interval = None) -%} | |
| {%- for k, v in budget_reflections_v05 | dictsort -%} | |
| {%- if ns.interval is none and thinking_budget <= k -%} | |
| {%- set ns.interval = v -%} | |
| {%- endif -%} | |
| {%- endfor -%} | |
| {# 若超过最大档位,则用最后一个档位的值 #} | |
| {%- if ns.interval is none -%} | |
| {%- set ns.interval = budget_reflections_v05[16384] -%} | |
| {%- endif -%} | |
| {# ---------- 预处理 system 消息 ---------- #} | |
| {%- if messages[0]["role"] == "system" %} | |
| {%- set system_message = messages[0]["content"] %} | |
| {%- set loop_messages = messages[1:] %} | |
| {%- else %} | |
| {%- set loop_messages = messages %} | |
| {%- endif %} | |
| {# ---------- 确保 tools 存在 ---------- #} | |
| {%- if not tools is defined or tools is none %} | |
| {%- set tools = [] %} | |
| {%- endif %} | |
| {# tools2doc.jinja #} | |
| {%- macro py_type(t) -%} | |
| {%- if t == "string" -%}str | |
| {%- elif t in ("number", "integer") -%}int | |
| {%- elif t == "boolean" -%}bool | |
| {%- elif t == "array" -%}list | |
| {%- else -%}Any{%- endif -%} | |
| {%- endmacro -%} | |
| {# ---------- 输出 system 块 ---------- #} | |
| {%- if system_message is defined %} | |
| {{ bos_token + "system\n" + system_message }} | |
| {%- else %} | |
| {%- if tools is iterable and tools | length > 0 %} | |
| {{ bos_token + "system\nYou are Doubao, a helpful AI assistant. You may call one or more functions to assist with the user query." }} | |
| {%- endif %} | |
| {%- endif %} | |
| {%- if use_json_tooldef is defined and use_json_tooldef %} | |
| {{"Tool List:\nYou are authorized to use the following tools (described in JSON Schema format). Before performing any task, you must decide how to call them based on the descriptions and parameters of these tools."}} | |
| {{ tools | tojson|string }} | |
| {%- else %} | |
| {%- for item in tools if item.type == "function" %} | |
| Function: | |
| def {{ item.function.name }}( | |
| {%- for name, spec in item.function.parameters.properties.items() %} | |
| {{- name }}: {{ py_type(spec.type) }}{% if not loop.last %},{% endif %} | |
| {%- endfor %}): | |
| """ | |
| {{ item.function.description | trim }} | |
| {# ---------- Args ---------- #} | |
| {%- if item.function.parameters.properties %} | |
| Args: | |
| {%- for name, spec in item.function.parameters.properties.items() %} | |
| - {{ name }} ({{ py_type(spec.type) }}) | |
| {%- if name in item.function.parameters.required %} [必填]{% else %} [选填]{% endif %}: | |
| {{- " " ~ (spec.description or "") }} | |
| {%- endfor %} | |
| {%- endif %} | |
| {# ---------- Returns ---------- #} | |
| {%- if item.function.returns is defined | |
| and item.function.returns.properties is defined | |
| and item.function.returns.properties %} | |
| Returns: | |
| {%- for name, spec in item.function.returns.properties.items() %} | |
| - {{ name }} ({{ py_type(spec.type) }}): | |
| {{- " " ~ (spec.description or "") }} | |
| {%- endfor %} | |
| {%- endif %} | |
| """ | |
| {%- endfor %} | |
| {%- endif %} | |
| {%- if tools is iterable and tools | length > 0 %} | |
| {{"工具调用请遵循如下格式:\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"}} | |
| {%- endif %} | |
| {# 结束 system 块行尾 #} | |
| {%- if system_message is defined or tools is iterable and tools | length > 0 %} | |
| {{ eos_token }} | |
| {%- endif %} | |
| {# ---------- Thinking Budget ---------- #} | |
| {%- if thinking_budget is defined %} | |
| {%- if thinking_budget == 0 %} | |
| {{ bos_token+"system" }} | |
| {{ "You are an intelligent assistant that can answer questions in one step without the need for reasoning and thinking, that is, your thinking budget is 0. Next, please skip the thinking process and directly start answering the user's questions." }} | |
| {{ eos_token }} | |
| {%- elif not thinking_budget == -1 %} | |
| {{ bos_token+"system" }} | |
| {{ "You are an intelligent assistant with reflective ability. In the process of thinking and reasoning, you need to strictly follow the thinking budget, which is "}}{{thinking_budget}}{{". That is, you need to complete your thinking within "}}{{thinking_budget}}{{" tokens and start answering the user's questions. You will reflect on your thinking process every "}}{{ns.interval}}{{" tokens, stating how many tokens have been used and how many are left."}} | |
| {{ eos_token }} | |
| {%- endif %} | |
| {%- endif %} | |
| {# ---------- 逐条写出历史消息 ---------- #} | |
| {%- for message in loop_messages %} | |
| {%- if message.role == "assistant" | |
| and message.tool_calls is defined | |
| and message.tool_calls is iterable | |
| and message.tool_calls | length > 0 %} | |
| {{ bos_token + message.role }} | |
| {%- if message.reasoning_content is defined and message.reasoning_content is string and message.reasoning_content | trim | length > 0 %} | |
| {{ "\n" + think_begin_token + message.reasoning_content | trim + think_end_token }} | |
| {%- endif %} | |
| {%- if message.content is defined and message.content is string and message.content | trim | length > 0 %} | |
| {{ "\n" + message.content | trim + "\n" }} | |
| {%- endif %} | |
| {%- for tool_call in message.tool_calls %} | |
| {%- if tool_call.function is defined %}{% set tool_call = tool_call.function %}{% endif %} | |
| {{ "\n" + toolcall_begin_token + "\n<function=" + tool_call.name + ">\n" }} | |
| {%- if tool_call.arguments is defined and tool_call.arguments is mapping %} | |
| {%- for arg_name, arg_value in tool_call.arguments | items %} | |
| {{ "<parameter=" + arg_name + ">" }} | |
| {%- set arg_value = arg_value if arg_value is string else arg_value | string %} | |
| {{ arg_value+"</parameter>\n" }} | |
| {%- endfor %} | |
| {%- endif %} | |
| {{ "</function>\n" + toolcall_end_token }} | |
| {%- endfor %} | |
| {{ eos_token }} | |
| {%- elif message.role in ["user", "system"] %} | |
| {{ bos_token + message.role + "\n" + message.content + eos_token }} | |
| {%- elif message.role == "assistant" %} | |
| {{ bos_token + message.role }} | |
| {%- if message.reasoning_content is defined and message.reasoning_content is string and message.reasoning_content | trim | length > 0 %} | |
| {{ "\n" + think_begin_token + message.reasoning_content | trim + think_end_token }} | |
| {%- endif %} | |
| {%- if message.content is defined and message.content is string and message.content | trim | length > 0 %} | |
| {{ "\n" + message.content | trim + eos_token }} | |
| {%- endif %} | |
| {# 包括 tool 角色,在这个逻辑 #} | |
| {%- else %} | |
| {{ bos_token + message.role + "\n" + message.content + eos_token }} | |
| {%- endif %} | |
| {%- endfor %} | |
| {# ---------- 控制模型开始续写 ---------- #} | |
| {%- if add_generation_prompt %} | |
| {{ bos_token+"assistant\n" }} | |
| {%- if thinking_budget == 0 %} | |
| {{ think_begin_token+budget_begin_token }} | |
| {%- endif %} | |
| {%- endif %} | |
| {# Copyright 2025-present Unsloth. Apache 2.0 License. #} |