Text Generation
Transformers
Safetensors
MLX
English
llama
Llama-3.1
instruct
finetune
reasoning
hybrid-mode
chatml
function calling
tool use
json mode
structured outputs
atropos
dataforge
long context
roleplaying
chat
mlx-my-repo
conversational
text-generation-inference
4-bit precision
Instructions to use Wwayu/Hermes-4-70B-mlx-4Bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Wwayu/Hermes-4-70B-mlx-4Bit with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Wwayu/Hermes-4-70B-mlx-4Bit") 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("Wwayu/Hermes-4-70B-mlx-4Bit") model = AutoModelForCausalLM.from_pretrained("Wwayu/Hermes-4-70B-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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - MLX
How to use Wwayu/Hermes-4-70B-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("Wwayu/Hermes-4-70B-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 Wwayu/Hermes-4-70B-mlx-4Bit with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Wwayu/Hermes-4-70B-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": "Wwayu/Hermes-4-70B-mlx-4Bit", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Wwayu/Hermes-4-70B-mlx-4Bit
- SGLang
How to use Wwayu/Hermes-4-70B-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 "Wwayu/Hermes-4-70B-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": "Wwayu/Hermes-4-70B-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 "Wwayu/Hermes-4-70B-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": "Wwayu/Hermes-4-70B-mlx-4Bit", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Pi
How to use Wwayu/Hermes-4-70B-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 "Wwayu/Hermes-4-70B-mlx-4Bit"
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": "Wwayu/Hermes-4-70B-mlx-4Bit" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use Wwayu/Hermes-4-70B-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 "Wwayu/Hermes-4-70B-mlx-4Bit"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "Wwayu/Hermes-4-70B-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": "Wwayu/Hermes-4-70B-mlx-4Bit", "messages": [ {"role": "user", "content": "Hello"} ] }' - Docker Model Runner
How to use Wwayu/Hermes-4-70B-mlx-4Bit with Docker Model Runner:
docker model run hf.co/Wwayu/Hermes-4-70B-mlx-4Bit
- Hermes Agent
How to use Wwayu/Hermes-4-70B-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 "Wwayu/Hermes-4-70B-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 Wwayu/Hermes-4-70B-mlx-4Bit
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use Wwayu/Hermes-4-70B-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 "Wwayu/Hermes-4-70B-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 "Wwayu/Hermes-4-70B-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"
Download chat_template.jinja from Wwayu/Hermes-4-70B-mlx-4Bit: direct link, hf CLI and curl.
- Browser
- Download file 4.12 kB
-
https://huggingface.co/Wwayu/Hermes-4-70B-mlx-4Bit/resolve/main/chat_template.jinja
- Command line
-
hf download hf://Wwayu/Hermes-4-70B-mlx-4Bit/chat_template.jinja
-
curl -L -o chat_template.jinja https://huggingface.co/Wwayu/Hermes-4-70B-mlx-4Bit/resolve/main/chat_template.jinja
4.12 kB
| {%- set thinking_prompt = 'You are a deep thinking AI, you may use extremely long chains of thought to deeply consider the problem and deliberate with yourself via systematic reasoning processes to help come to a correct solution prior to answering. You should enclose your thoughts and internal monologue inside <think> </think> tags, and then provide your solution or response to the problem.' %} | |
| {%- set standard_prompt = 'You are Hermes, created by Nous Research.' %} | |
| {%- if not thinking is defined %}{% set thinking = false %}{% endif %} | |
| {%- if not keep_cots is defined %}{% set keep_cots = false %}{% endif %} | |
| {%- if thinking %}{%- set system_prompt = thinking_prompt %}{%- else %}{%- set system_prompt = standard_prompt %}{%- endif %} | |
| {%- if tools %} | |
| {{- bos_token + '<|start_header_id|>system<|end_header_id|>\n' }} | |
| {%- if messages[0]['role'] == 'system' %} | |
| {{- messages[0]['content'] }} | |
| {%- else %} | |
| {{- system_prompt }} | |
| {%- endif %} | |
| {{- "\n\n# Tools\n\nYou are a function calling AI model. You may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }} | |
| {%- for tool in tools %} | |
| {{- "\n" }} | |
| {{- tool | tojson }} | |
| {%- endfor %} | |
| {{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": \"<function-name>\", \"arguments\": <args-json-object>}\n</tool_call><|eot_id|>" }} | |
| {%- else %} | |
| {%- if messages[0]['role'] == 'system' %} | |
| {{- bos_token + '<|start_header_id|>system<|end_header_id|>\n\n' + messages[0]['content'] + '<|eot_id|>' }} | |
| {%- else %} | |
| {{- bos_token + '<|start_header_id|>system<|end_header_id|>\n\n' + system_prompt + '<|eot_id|>' }} | |
| {%- endif %} | |
| {%- endif %} | |
| {%- for message in messages %} | |
| {%- if (message.role == "user") or (message.role == "system" and not loop.first) %} | |
| {{- '<|start_header_id|>' + message.role + '<|end_header_id|>\n\n' + message.content + '<|eot_id|>' }} | |
| {%- elif (message.role == "assistant" and not message.tool_calls) %} | |
| {{- '<|start_header_id|>' + message.role + '<|end_header_id|>\n' }} | |
| {%- if message.content %} | |
| {%- set content = message['content'] -%} | |
| {%- if thinking %} | |
| {%- if not keep_cots %} | |
| {%- set content = '<think> </think>' + content.split('</think>', 1)[1] -%} | |
| {%- endif %} | |
| {%- endif %} | |
| {{- '\n' + content + '<|eot_id|>' }} | |
| {%- endif %} | |
| {%- elif message.role == "assistant" %} | |
| {{- '<|start_header_id|>' + message.role + '<|end_header_id|>\n' }} | |
| {%- if message.content %} | |
| {%- set content = message['content'] -%} | |
| {%- if thinking %} | |
| {%- if not keep_cots %} | |
| {%- set content = '<think> </think>' + content.split('</think>', 1)[1] -%} | |
| {%- endif %} | |
| {%- endif %} | |
| {{- '\n' + content }} | |
| {%- endif %} | |
| {%- for tool_call in message.tool_calls %} | |
| {%- if tool_call.function is defined %} | |
| {%- set tool_call = tool_call.function %} | |
| {%- endif %} | |
| {{- '\n<tool_call>\n{"name": "' }} | |
| {{- tool_call.name }} | |
| {{- '", "arguments": ' }} | |
| {{- tool_call.arguments | tojson }} | |
| {{- '}\n</tool_call>' }} | |
| {%- endfor %} | |
| {{- '<|eot_id|>' }} | |
| {%- elif message.role == "tool" %} | |
| {%- if (loop.index0 == 0) or (messages[loop.index0 - 1].role != "tool") %} | |
| {{- '<|start_header_id|>user<|end_header_id|>\n' }} | |
| {%- endif %} | |
| {{- '\n<tool_response>\n' }} | |
| {{- message.content }} | |
| {{- '\n</tool_response>' }} | |
| {%- if loop.last or (messages[loop.index0 + 1].role != "tool") %} | |
| {{- '<|eot_id|>' }} | |
| {%- endif %} | |
| {%- endif %} | |
| {%- endfor %} | |
| {%- if add_generation_prompt %} | |
| {{- '<|start_header_id|>assistant<|end_header_id|>\n\n' }} | |
| {%- endif %} | |