Text Generation
Transformers
Safetensors
English
lfm2_moe
wiuai
from-scratch
small-language-model
mixture-of-experts
Mixture of Experts
hybrid-architecture
short-convolution
attention
sparse-computation
coding
code-generation
instruction-following
tool-calling
reasoning
conversational
chat
Instructions to use WithinUsAI/WIUAI.Flash.MoE.Coder.Instruct.53m.a9m with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use WithinUsAI/WIUAI.Flash.MoE.Coder.Instruct.53m.a9m with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="WithinUsAI/WIUAI.Flash.MoE.Coder.Instruct.53m.a9m") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("WithinUsAI/WIUAI.Flash.MoE.Coder.Instruct.53m.a9m") model = AutoModelForCausalLM.from_pretrained("WithinUsAI/WIUAI.Flash.MoE.Coder.Instruct.53m.a9m", 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use WithinUsAI/WIUAI.Flash.MoE.Coder.Instruct.53m.a9m with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "WithinUsAI/WIUAI.Flash.MoE.Coder.Instruct.53m.a9m" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "WithinUsAI/WIUAI.Flash.MoE.Coder.Instruct.53m.a9m", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/WithinUsAI/WIUAI.Flash.MoE.Coder.Instruct.53m.a9m
- SGLang
How to use WithinUsAI/WIUAI.Flash.MoE.Coder.Instruct.53m.a9m 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 "WithinUsAI/WIUAI.Flash.MoE.Coder.Instruct.53m.a9m" \ --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": "WithinUsAI/WIUAI.Flash.MoE.Coder.Instruct.53m.a9m", "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 "WithinUsAI/WIUAI.Flash.MoE.Coder.Instruct.53m.a9m" \ --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": "WithinUsAI/WIUAI.Flash.MoE.Coder.Instruct.53m.a9m", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use WithinUsAI/WIUAI.Flash.MoE.Coder.Instruct.53m.a9m with Docker Model Runner:
docker model run hf.co/WithinUsAI/WIUAI.Flash.MoE.Coder.Instruct.53m.a9m
Download tokenizer_config.json from WithinUsAI/WIUAI.Flash.MoE.Coder.Instruct.53m.a9m: direct link, hf CLI and curl.
- Browser
- Download file 13.6 kB
-
https://huggingface.co/WithinUsAI/WIUAI.Flash.MoE.Coder.Instruct.53m.a9m/resolve/main/tokenizer_config.json
- Command line
-
hf download hf://WithinUsAI/WIUAI.Flash.MoE.Coder.Instruct.53m.a9m/tokenizer_config.json
-
curl -L -o tokenizer_config.json https://huggingface.co/WithinUsAI/WIUAI.Flash.MoE.Coder.Instruct.53m.a9m/resolve/main/tokenizer_config.json
13.6 kB
| { | |
| "tokenizer_class": "PreTrainedTokenizerFast", | |
| "model_max_length": 16384, | |
| "bos_token": null, | |
| "eos_token": "<|im_end|>", | |
| "pad_token": "<|endoftext|>", | |
| "unk_token": null, | |
| "add_bos_token": false, | |
| "add_eos_token": false, | |
| "clean_up_tokenization_spaces": false, | |
| "added_tokens_decoder": { | |
| "0": { | |
| "content": "<|endoftext|>", | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "1": { | |
| "content": "<|im_start|>", | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "2": { | |
| "content": "<|im_end|>", | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "3": { | |
| "content": "<think>", | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "single_word": false, | |
| "special": false | |
| }, | |
| "4": { | |
| "content": "</think>", | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "single_word": false, | |
| "special": false | |
| }, | |
| "5": { | |
| "content": "<tool_call>", | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "single_word": false, | |
| "special": false | |
| }, | |
| "6": { | |
| "content": "</tool_call>", | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "single_word": false, | |
| "special": false | |
| }, | |
| "7": { | |
| "content": "<tool_response>", | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "single_word": false, | |
| "special": false | |
| }, | |
| "8": { | |
| "content": "</tool_response>", | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "single_word": false, | |
| "special": false | |
| }, | |
| "9": { | |
| "content": "<|fim_prefix|>", | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "10": { | |
| "content": "<|fim_middle|>", | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "11": { | |
| "content": "<|fim_suffix|>", | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "12": { | |
| "content": "<|file_sep|>", | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "13": { | |
| "content": "<|repo_name|>", | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "14": { | |
| "content": "<|reserved_0|>", | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "15": { | |
| "content": "<|reserved_1|>", | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "16": { | |
| "content": "<|reserved_2|>", | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "17": { | |
| "content": "<|reserved_3|>", | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "18": { | |
| "content": "<|reserved_4|>", | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "19": { | |
| "content": "<|reserved_5|>", | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "20": { | |
| "content": "<|reserved_6|>", | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "21": { | |
| "content": "<|reserved_7|>", | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "22": { | |
| "content": "<|reserved_8|>", | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "23": { | |
| "content": "<|reserved_9|>", | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "24": { | |
| "content": "<|reserved_10|>", | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "25": { | |
| "content": "<|reserved_11|>", | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "26": { | |
| "content": "<|reserved_12|>", | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "27": { | |
| "content": "<|reserved_13|>", | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "28": { | |
| "content": "<|reserved_14|>", | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "29": { | |
| "content": "<|reserved_15|>", | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "30": { | |
| "content": "<|reserved_16|>", | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "single_word": false, | |
| "special": true | |
| }, | |
| "31": { | |
| "content": "<|reserved_17|>", | |
| "lstrip": false, | |
| "rstrip": false, | |
| "normalized": false, | |
| "single_word": false, | |
| "special": true | |
| } | |
| }, | |
| "chat_template": "{#- TinyBrainBot hybrid chat template (2026-11): Qwen3.8 structure (ChatML, XML tool calls, <tool_response>, hybrid <think>)\n plus reasoning_effort. enable_thinking=false -> empty think block; enable_thinking=true -> opens <think>; unset -> the\n model decides. reasoning_effort (low | medium | high) is stated in the system turn; \"none\" = no thinking. -#}\n{%- macro render_content(content) %}\n {%- if content is string %}\n {{- content }}\n {%- elif content is iterable and content is not mapping %}\n {%- for item in content %}\n {%- if 'text' in item %}\n {{- item.text }}\n {%- endif %}\n {%- endfor %}\n {%- elif content is none or content is undefined %}\n {{- '' }}\n {%- endif %}\n{%- endmacro %}\n{%- if not messages %}\n {{- raise_exception('No messages provided.') }}\n{%- endif %}\n{%- set effort = reasoning_effort if reasoning_effort is defined and reasoning_effort in ['none', 'low', 'medium', 'high'] else none %}\n{%- set effort_line = ('Reasoning effort: ' ~ effort) if effort and effort != 'none' else '' %}\n{%- set sys_content = render_content(messages[0].content)|trim if messages[0].role == 'system' else '' %}\n{%- if tools and tools is iterable and tools is not mapping %}\n {{- '<|im_start|>system\\n' }}\n {{- \"# Tools\\n\\nYou have access to the following functions:\\n\\n<tools>\" }}\n {%- for tool in tools %}\n {{- \"\\n\" }}\n {{- tool | tojson }}\n {%- endfor %}\n {{- \"\\n</tools>\" }}\n {{- '\\n\\nIf you choose to call a function ONLY reply in the following format with NO suffix:\\n\\n<tool_call>\\n<function=example_function_name>\\n<parameter=example_parameter_1>\\nvalue_1\\n</parameter>\\n<parameter=example_parameter_2>\\nThis is the value for the second parameter\\nthat can span\\nmultiple lines\\n</parameter>\\n</function>\\n</tool_call>\\n\\n<IMPORTANT>\\nReminder:\\n- Function calls MUST follow the specified format: an inner <function=...></function> block must be nested within <tool_call></tool_call> XML tags\\n- Required parameters MUST be specified\\n- You may provide optional reasoning for your function call in natural language BEFORE the function call, but NOT after\\n- If there is no function call available, answer the question like normal with your current knowledge and do not tell the user about function calls\\n</IMPORTANT>' }}\n {%- if sys_content %}\n {{- '\\n\\n' + sys_content }}\n {%- endif %}\n {%- if effort_line %}\n {{- '\\n\\n' + effort_line }}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n{%- elif sys_content or effort_line %}\n {{- '<|im_start|>system\\n' + sys_content }}\n {%- if effort_line %}\n {{- ('\\n\\n' if sys_content else '') + effort_line }}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n{%- endif %}\n{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}\n{%- for message in messages[::-1] %}\n {%- set index = (messages|length - 1) - loop.index0 %}\n {%- if ns.multi_step_tool and message.role == \"user\" %}\n {%- set content = render_content(message.content)|trim %}\n {%- if not(content.startswith('<tool_response>') and content.endswith('</tool_response>')) %}\n {%- set ns.multi_step_tool = false %}\n {%- set ns.last_query_index = index %}\n {%- endif %}\n {%- endif %}\n{%- endfor %}\n{%- for message in messages %}\n {%- set content = render_content(message.content)|trim %}\n {%- if message.role == \"system\" %}\n {%- if not loop.first %}\n {{- raise_exception('System message must be at the beginning.') }}\n {%- endif %}\n {%- elif message.role == \"user\" %}\n {{- '<|im_start|>' + message.role + '\\n' + content + '<|im_end|>' + '\\n' }}\n {%- elif message.role == \"assistant\" %}\n {%- set reasoning_content = '' %}\n {%- if message.reasoning_content is string %}\n {%- set reasoning_content = message.reasoning_content %}\n {%- else %}\n {%- if '</think>' in content %}\n {%- set reasoning_content = content.split('</think>')[0].rstrip('\\n').split('<think>')[-1].lstrip('\\n') %}\n {%- set content = content.split('</think>')[-1].lstrip('\\n') %}\n {%- endif %}\n {%- endif %}\n {%- set reasoning_content = reasoning_content|trim %}\n {%- if loop.index0 > ns.last_query_index %}\n {{- '<|im_start|>' + message.role + '\\n<think>\\n' + reasoning_content + '\\n</think>\\n\\n' + content }}\n {%- else %}\n {{- '<|im_start|>' + message.role + '\\n' + content }}\n {%- endif %}\n {%- if message.tool_calls and message.tool_calls is iterable and message.tool_calls is not mapping %}\n {%- for tool_call in message.tool_calls %}\n {%- if tool_call.function is defined %}\n {%- set tool_call = tool_call.function %}\n {%- endif %}\n {%- if loop.first %}\n {%- if content|trim %}\n {{- '\\n\\n<tool_call>\\n<function=' + tool_call.name + '>\\n' }}\n {%- else %}\n {{- '<tool_call>\\n<function=' + tool_call.name + '>\\n' }}\n {%- endif %}\n {%- else %}\n {{- '\\n<tool_call>\\n<function=' + tool_call.name + '>\\n' }}\n {%- endif %}\n {%- if tool_call.arguments is defined %}\n {%- for args_name, args_value in tool_call.arguments|items %}\n {{- '<parameter=' + args_name + '>\\n' }}\n {%- set args_value = args_value | tojson | safe if args_value is mapping or (args_value is sequence and args_value is not string) else args_value | string %}\n {{- args_value }}\n {{- '\\n</parameter>\\n' }}\n {%- endfor %}\n {%- endif %}\n {{- '</function>\\n</tool_call>' }}\n {%- endfor %}\n {%- endif %}\n {{- '<|im_end|>\\n' }}\n {%- elif message.role == \"tool\" %}\n {%- if loop.previtem and loop.previtem.role != \"tool\" %}\n {{- '<|im_start|>user' }}\n {%- endif %}\n {{- '\\n<tool_response>\\n' }}\n {{- content }}\n {{- '\\n</tool_response>' }}\n {%- if not loop.last and loop.nextitem.role != \"tool\" %}\n {{- '<|im_end|>\\n' }}\n {%- elif loop.last %}\n {{- '<|im_end|>\\n' }}\n {%- endif %}\n {%- else %}\n {{- raise_exception('Unexpected message role.') }}\n {%- endif %}\n{%- endfor %}\n{%- if add_generation_prompt %}\n {{- '<|im_start|>assistant\\n' }}\n {#- 2026-11-09: thinking is OFF by default (Qwen3.8-style). Turn it on with enable_thinking=true or reasoning_effort\n low/medium/high. \"Model decides\" (no think block forced) made the 53M think on every prompt and skip tools. #}\n {%- if (enable_thinking is defined and enable_thinking is true) or (effort and effort != 'none') %}\n {{- '<think>\\n' }}\n {%- else %}\n {{- '<think>\\n\\n</think>\\n\\n' }}\n {%- endif %}\n{%- endif %}\n" | |
| } |