Text Generation
MLX
Safetensors
English
Korean
Spanish
exaone4
lg-ai
exaone
exaone-4.0
open4bits
conversational
Instructions to use Open4bits/EXAONE-4.0-1.2B-mlx-fp16 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use Open4bits/EXAONE-4.0-1.2B-mlx-fp16 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("Open4bits/EXAONE-4.0-1.2B-mlx-fp16") 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 Open4bits/EXAONE-4.0-1.2B-mlx-fp16 with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "Open4bits/EXAONE-4.0-1.2B-mlx-fp16"
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "Open4bits/EXAONE-4.0-1.2B-mlx-fp16" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use Open4bits/EXAONE-4.0-1.2B-mlx-fp16 with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "Open4bits/EXAONE-4.0-1.2B-mlx-fp16"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "Open4bits/EXAONE-4.0-1.2B-mlx-fp16" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Open4bits/EXAONE-4.0-1.2B-mlx-fp16", "messages": [ {"role": "user", "content": "Hello"} ] }' - Hermes Agent
How to use Open4bits/EXAONE-4.0-1.2B-mlx-fp16 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 "Open4bits/EXAONE-4.0-1.2B-mlx-fp16"
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 Open4bits/EXAONE-4.0-1.2B-mlx-fp16
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use Open4bits/EXAONE-4.0-1.2B-mlx-fp16 with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "Open4bits/EXAONE-4.0-1.2B-mlx-fp16"
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 "Open4bits/EXAONE-4.0-1.2B-mlx-fp16" \ --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"
| {%- if not skip_think is defined %} | |
| {%- set skip_think = true %} | |
| {%- endif %} | |
| {%- set role_indicators = { | |
| 'user': '[|user|]\n', | |
| 'assistant': '[|assistant|]\n', | |
| 'system': '[|system|]\n', | |
| 'tool': '[|tool|]\n' | |
| } %} | |
| {%- set end_of_turn = '[|endofturn|]\n' %} | |
| {%- macro available_tools(tools) %} | |
| {{- "# Available Tools" }} | |
| {{- "\nYou can use none, one, or multiple of the following tools by calling them as functions to help with the user’s query." }} | |
| {{- "\nHere are the tools available to you in JSON format within <tool> and </tool> tags:\n" }} | |
| {%- for tool in tools %} | |
| {{- "<tool>" }} | |
| {{- tool | tojson(ensure_ascii=False) | safe }} | |
| {{- "</tool>\n" }} | |
| {%- endfor %} | |
| {{- "\nFor each function call you want to make, return a JSON object with function name and arguments within <tool_call> and </tool_call> tags, like:" }} | |
| {{- "\n<tool_call>{\"name\": function_1_name, \"arguments\": {argument_1_name: argument_1_value, argument_2_name: argument_2_value}}</tool_call>" }} | |
| {{- "\n<tool_call>{\"name\": function_2_name, \"arguments\": {...}}</tool_call>\n..." }} | |
| {{- "\nNote that if no argument name is specified for a tool, you can just print the argument value directly, without the argument name or JSON formatting." }} | |
| {%- endmacro %} | |
| {%- set ns = namespace(last_query_index = messages|length - 1) %} | |
| {%- for message in messages %} | |
| {%- if message.role == "user" and message.content is string %} | |
| {%- set ns.last_query_index = loop.index0 -%} | |
| {%- endif %} | |
| {%- endfor %} | |
| {%- for i in range(messages | length) %} | |
| {%- set msg = messages[i] %} | |
| {%- set role = msg.role %} | |
| {%- if role not in role_indicators %} | |
| {{- raise_exception('Unknown role: ' ~ role) }} | |
| {%- endif %} | |
| {%- if i == 0 %} | |
| {%- if role == 'system' %} | |
| {{- role_indicators['system'] }} | |
| {{- msg.content }} | |
| {%- if tools is defined and tools %} | |
| {{- "\n\n" }}{{- available_tools(tools) }} | |
| {%- endif %} | |
| {{- end_of_turn -}} | |
| {%- continue %} | |
| {%- elif tools is defined and tools %} | |
| {{- role_indicators['system'] }} | |
| {{- available_tools(tools) }} | |
| {{- end_of_turn -}} | |
| {%- endif %} | |
| {%- endif %} | |
| {%- if role == 'assistant' %} | |
| {{- role_indicators['assistant'] }} | |
| {%- if msg.content %} | |
| {%- if "</think>" in msg.content %} | |
| {%- set content = msg.content.split('</think>')[-1].strip() %} | |
| {%- set reasoning_content = msg.content.split('</think>')[0].strip() %} | |
| {%- if reasoning_content.startswith("<think>") %} | |
| {%- set reasoning_content = reasoning_content[9:].strip() %} | |
| {%- endif %} | |
| {%- else %} | |
| {%- set content = msg.content %} | |
| {%- endif %} | |
| {%- if msg.reasoning_content %} | |
| {%- set reasoning_content = msg.reasoning_content %} | |
| {%- endif %} | |
| {%- if (not skip_think and loop.last) and reasoning_content is defined %} | |
| {{- "<think>\n" }} | |
| {{- reasoning_content}} | |
| {{- "\n</think>\n\n" }} | |
| {%- else %} | |
| {{- "<think>\n\n</think>\n\n" }} | |
| {%- endif %} | |
| {{- content }} | |
| {%- endif %} | |
| {%- if msg.tool_calls %} | |
| {%- if msg.content %} | |
| {{- "\n" }} | |
| {%- else %} | |
| {{- "<think>\n\n</think>\n\n" }} | |
| {%- endif %} | |
| {%- for tool_call in msg.tool_calls %} | |
| {%- if tool_call.function is defined %} | |
| {%- set tool_call = tool_call.function %} | |
| {%- endif %} | |
| {%- if tool_call.arguments is defined %} | |
| {%- set arguments = tool_call.arguments %} | |
| {%- elif tool_call.parameters is defined %} | |
| {%- set arguments = tool_call.parameters %} | |
| {%- else %} | |
| {{- raise_exception('arguments or parameters are mandatory: ' ~ tool_call) }} | |
| {%- endif %} | |
| {{- "<tool_call>" }}{"name": "{{- tool_call.name }}", "arguments": {{ arguments | tojson(ensure_ascii=False) | safe }}}{{- "</tool_call>" }} | |
| {%- if not loop.last %} | |
| {{- "\n" }} | |
| {%- endif %} | |
| {%- endfor %} | |
| {%- endif %} | |
| {{- end_of_turn -}} | |
| {%- elif role == "tool" %} | |
| {%- if i == 0 or messages[i - 1].role != "tool" %} | |
| {{- role_indicators['tool'] }} | |
| {%- endif %} | |
| {%- if msg.content is defined %} | |
| {{- "<tool_result>" }}{"result": {{ msg.content | tojson(ensure_ascii=False) | safe }}}{{- "</tool_result>" }} | |
| {%- endif %} | |
| {%- if loop.last or messages[i + 1].role != "tool" %} | |
| {{- end_of_turn -}} | |
| {%- else %} | |
| {{- "\n" }} | |
| {%- endif %} | |
| {%- else %} | |
| {{- role_indicators[role] }} | |
| {{- msg.content }} | |
| {{- end_of_turn -}} | |
| {%- endif %} | |
| {% endfor %} | |
| {%- if add_generation_prompt %} | |
| {{- role_indicators['assistant'] }} | |
| {%- if enable_thinking is defined and enable_thinking is true %} | |
| {{- "<think>\n" }} | |
| {%- else %} | |
| {{- "<think>\n\n</think>\n\n" }} | |
| {%- endif %} | |
| {%- endif %} |