Text Generation
Transformers
Safetensors
English
Korean
Motif
feature-extraction
motif
motif-3
mixture-of-experts
Mixture of Experts
multilingual
conversational
custom_code
Eval Results
Instructions to use Motif-Technologies/Motif-3 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Motif-Technologies/Motif-3 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Motif-Technologies/Motif-3", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("Motif-Technologies/Motif-3", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Motif-Technologies/Motif-3 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Motif-Technologies/Motif-3" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Motif-Technologies/Motif-3", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Motif-Technologies/Motif-3
- SGLang
How to use Motif-Technologies/Motif-3 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 "Motif-Technologies/Motif-3" \ --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": "Motif-Technologies/Motif-3", "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 "Motif-Technologies/Motif-3" \ --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": "Motif-Technologies/Motif-3", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Motif-Technologies/Motif-3 with Docker Model Runner:
docker model run hf.co/Motif-Technologies/Motif-3
Download chat_template.jinja from Motif-Technologies/Motif-3: direct link, hf CLI and curl.
- Browser
- Download file 6.79 kB
-
https://huggingface.co/Motif-Technologies/Motif-3/resolve/main/chat_template.jinja
- Command line
-
hf download hf://Motif-Technologies/Motif-3/chat_template.jinja
-
curl -L -o chat_template.jinja https://huggingface.co/Motif-Technologies/Motif-3/resolve/main/chat_template.jinja
6.79 kB
| {%- macro visible_text(content) -%} | |
| {%- if content is string -%} | |
| {{- content -}} | |
| {%- elif content is iterable and content is not mapping -%} | |
| {%- for item in content -%} | |
| {%- if item is mapping and item.type == 'text' -%} | |
| {{- item.text -}} | |
| {%- elif item is string -%} | |
| {{- item -}} | |
| {%- endif -%} | |
| {%- endfor -%} | |
| {%- else -%} | |
| {{- content -}} | |
| {%- endif -%} | |
| {%- endmacro -%} | |
| {{- '<|beginoftext|>' -}} | |
| {%- set ns = namespace(has_system=false, last_user_index=-1, last_assistant_index=-1) -%} | |
| {%- if messages | length > 0 and messages[0].role == 'system' -%} | |
| {%- set ns.has_system = true -%} | |
| {%- endif -%} | |
| {%- for m in messages -%} | |
| {%- if m.role == 'user' -%} | |
| {%- set ns.last_user_index = loop.index0 -%} | |
| {%- elif m.role == 'assistant' -%} | |
| {%- set ns.last_assistant_index = loop.index0 -%} | |
| {%- endif -%} | |
| {%- endfor -%} | |
| {#- ── System / Tools block ── -#} | |
| {%- if tools is iterable and tools | length > 0 -%} | |
| {{- '<|startofturn|><|system|>' -}} | |
| {{- '# Tools\n\nYou may call one or more functions to assist with the user query.\n\n' -}} | |
| {{- 'You are provided with function signatures within <tools></tools> XML tags:\n\n<tools>' -}} | |
| {%- for tool in tools -%} | |
| {%- if tool.function is defined -%} | |
| {%- set tool = tool.function -%} | |
| {%- endif -%} | |
| {{- '\n' ~ (tool | tojson) -}} | |
| {%- endfor -%} | |
| {{- '\n</tools>' -}} | |
| {{- '\n\nFor each function call, output in JSON within <tool_call> tags:\n' -}} | |
| {%- for tool in tools -%} | |
| {%- if tool.function is defined -%} | |
| {%- set tool = tool.function -%} | |
| {%- endif -%} | |
| {%- set _props = tool.parameters.properties if (tool.parameters is defined and tool.parameters.properties is defined) else {} -%} | |
| {{- '\n<tool_call>{"name": "' ~ tool.name ~ '", "arguments": {' -}} | |
| {%- set _keys = _props | list -%} | |
| {%- for k in _keys -%} | |
| {{- '"' ~ k ~ '": <' ~ k ~ '>' -}} | |
| {%- if not loop.last -%}{{- ', ' -}}{%- endif -%} | |
| {%- endfor -%} | |
| {{- '}}</tool_call>' -}} | |
| {%- endfor -%} | |
| {%- if ns.has_system -%} | |
| {{- '\n\n' ~ visible_text(messages[0].content) -}} | |
| {%- endif -%} | |
| {{- '<|endofturn|>' -}} | |
| {%- elif ns.has_system -%} | |
| {{- '<|startofturn|><|system|>' ~ visible_text(messages[0].content) ~ '<|endofturn|>' -}} | |
| {%- endif -%} | |
| {#- ── Conversation turns ── -#} | |
| {%- for m in messages -%} | |
| {#- [Fix 1] continue 대신 if/elif 체인으로 첫 system 스킵 -#} | |
| {%- if loop.index0 == 0 and m.role == 'system' -%} | |
| {#- already rendered above, skip -#} | |
| {#- [Fix 2] 중간에 나오는 system 메시지도 처리 -#} | |
| {%- elif m.role == 'system' -%} | |
| {{- '<|startofturn|><|system|>' ~ visible_text(m.content) ~ '<|endofturn|>' -}} | |
| {%- elif m.role == 'user' -%} | |
| {{- '<|startofturn|><|user|>' -}} | |
| {%- if m.references is defined and m.references -%} | |
| {{- '<|reference|>' ~ m.references ~ '\n' -}} | |
| {%- endif -%} | |
| {{- visible_text(m.content) -}} | |
| {{- '<|endofturn|>' -}} | |
| {%- elif m.role == 'assistant' -%} | |
| {{- '<|startofturn|><|assistant|>' -}} | |
| {#- [순서 정책] think → plan → content → tool_calls -#} | |
| {#- Reasoning block -#} | |
| {%- set _content = visible_text(m.content) -%} | |
| {%- set _reasoning = '' -%} | |
| {%- if m.reasoning_content is string -%} | |
| {%- set _reasoning = m.reasoning_content -%} | |
| {%- elif '</think>' in _content -%} | |
| {%- set _reasoning = _content.split('</think>')[0].split('<think>')[-1].strip() -%} | |
| {%- set _content = _content.split('</think>', 1)[-1].lstrip('\n') -%} | |
| {%- endif -%} | |
| {%- set _has_tools = (tools is defined and tools is iterable and tools | length > 0) -%} | |
| {%- set _emit_think = _reasoning and (_has_tools or loop.index0 == ns.last_assistant_index) -%} | |
| {%- if _emit_think -%} | |
| {{- '<think>' ~ _reasoning.strip() ~ '</think>' -}} | |
| {%- endif -%} | |
| {#- Text content -#} | |
| {%- if _content.strip() -%} | |
| {{- _content.strip() -}} | |
| {%- endif -%} | |
| {#- Tool calls — IDs are rendered for intermediate assistant turns | |
| (context for call↔response correlation) but omitted for the last | |
| assistant turn (prediction target — model should not learn to | |
| generate IDs). After multi-turn data expansion, intermediate turns | |
| become GRAY context and the last turn is GREEN. -#} | |
| {%- if m.tool_calls is defined and m.tool_calls -%} | |
| {%- set _is_last_assistant = (loop.index0 == ns.last_assistant_index) and not add_generation_prompt -%} | |
| {%- for tc in m.tool_calls -%} | |
| {%- set _tc_id = tc.id if (tc.id is defined and not _is_last_assistant) else none -%} | |
| {%- if tc.function is defined -%} | |
| {%- set tc = tc.function -%} | |
| {%- endif -%} | |
| {%- set _id_suffix = ', "id": ' ~ (_tc_id | tojson) if _tc_id is not none else '' -%} | |
| {%- if tc.arguments is not defined or not tc.arguments or tc.arguments == "" -%} | |
| {{- '\n<tool_call>' ~ '{"name": "' ~ tc.name ~ '", "arguments": ' ~ null ~ _id_suffix ~ '}' ~ '</tool_call>' -}} | |
| {%- elif tc.arguments is string -%} | |
| {{- '\n<tool_call>' ~ '{"name": "' ~ tc.name ~ '", "arguments": ' ~ tc.arguments ~ _id_suffix ~ '}' ~ '</tool_call>' -}} | |
| {%- else -%} | |
| {{- '\n<tool_call>' ~ '{"name": "' ~ tc.name ~ '", "arguments": ' ~ (tc.arguments | tojson) ~ _id_suffix ~ '}' ~ '</tool_call>' -}} | |
| {%- endif -%} | |
| {%- endfor -%} | |
| {%- endif -%} | |
| {{- '<|endofturn|>' -}} | |
| {%- elif m.role == 'tool' -%} | |
| {#- [Fix 3] loop.previtem/nextitem으로 인덱스 오버플로 제거 -#} | |
| {%- if loop.first or loop.previtem.role != 'tool' -%} | |
| {{- '<|startofturn|><|tool|>' -}} | |
| {%- endif -%} | |
| {{- '<tool_response>' ~ ({"tool_call_id": m.tool_call_id, "content": m.content} | tojson) ~ '</tool_response>' -}} | |
| {%- if loop.last or loop.nextitem.role != 'tool' -%} | |
| {{- '<|endofturn|>' -}} | |
| {%- endif -%} | |
| {%- endif -%} | |
| {%- endfor -%} | |
| {#- ── Generation prompt ── -#} | |
| {%- if add_generation_prompt -%} | |
| {{- '<|startofturn|><|assistant|>' -}} | |
| {%- if enable_thinking is defined and not enable_thinking -%} | |
| {{- '<think></think>' -}} | |
| {%- else -%} | |
| {{- '<think>' -}} | |
| {%- endif -%} | |
| {%- else -%} | |
| {{- '<|endoftext|>' -}} | |
| {%- endif -%} |