Text Generation
Transformers
Safetensors
MLX
English
qwen2
RLHF
Nexusflow
Athene
Chat Model
conversational
text-generation-inference
4-bit precision
Instructions to use mlx-community/Athene-V2-Chat-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use mlx-community/Athene-V2-Chat-4bit with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="mlx-community/Athene-V2-Chat-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("mlx-community/Athene-V2-Chat-4bit") model = AutoModelForCausalLM.from_pretrained("mlx-community/Athene-V2-Chat-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 mlx-community/Athene-V2-Chat-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("mlx-community/Athene-V2-Chat-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 mlx-community/Athene-V2-Chat-4bit with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "mlx-community/Athene-V2-Chat-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": "mlx-community/Athene-V2-Chat-4bit", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/mlx-community/Athene-V2-Chat-4bit
- SGLang
How to use mlx-community/Athene-V2-Chat-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 "mlx-community/Athene-V2-Chat-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": "mlx-community/Athene-V2-Chat-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 "mlx-community/Athene-V2-Chat-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": "mlx-community/Athene-V2-Chat-4bit", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Pi
How to use mlx-community/Athene-V2-Chat-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 "mlx-community/Athene-V2-Chat-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": "mlx-community/Athene-V2-Chat-4bit" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use mlx-community/Athene-V2-Chat-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 "mlx-community/Athene-V2-Chat-4bit"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "mlx-community/Athene-V2-Chat-4bit" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mlx-community/Athene-V2-Chat-4bit", "messages": [ {"role": "user", "content": "Hello"} ] }' - Docker Model Runner
How to use mlx-community/Athene-V2-Chat-4bit with Docker Model Runner:
docker model run hf.co/mlx-community/Athene-V2-Chat-4bit
- Hermes Agent
How to use mlx-community/Athene-V2-Chat-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 "mlx-community/Athene-V2-Chat-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 mlx-community/Athene-V2-Chat-4bit
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use mlx-community/Athene-V2-Chat-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 "mlx-community/Athene-V2-Chat-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 "mlx-community/Athene-V2-Chat-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"
Commit History
-
Upload folder using huggingface_hub (#1)
Verified signature- 9c8ef986a132f4cfa9f34e795399a2ae2253a33a00e17d8f9efd3bc4a82c0b04 (c39687d81649c68f0ce0db298d6931af1d8f5a6a) - 540947ffae5ca66186588dc17ea60293d97cf17092e34299c044a210e7e3e5cc (436f728ab252ac2258894da5fe35ab2119e2d6c9) - ae4ed8fe8116269c8eef42f2154cdf67274d323ef73f714f2c24ad6af6fd43ed (91985a6e34819f1af23052371624477178e8ef2a) - 6496f96f85100d40c59b34eddfa39b3271befcc53b0b386e92a9dfacd30a56e1 (757a7662448dbde2c13b34fd272626ee8dd989c0) - dcaff22e20543815776e4344c380df4cc664ff2309c6b4abbf4baf70b2b6b16f (ebf6134e323a77d2d90b7cbfc60fbf0a15c78069) - eeb30d89a4900b357cabef68047ac34f37e89a946e30c3ed1b98d7161c0242d4 (037468ff09defb11598eb6918f5c9193e17aa3f0) - 6cead9f35f7ac8c3fd25d1a4c793272c36fd3aed6152a57e02113dc5ee12750c (1eadcd636c38ed4a3c3b509e0af7f78ff23cf0ed) - 43961dac2e7e81ab3c84100b7a7510764d17e8ea50863f79d816298955d25c24 (f3f827439115c00b3fc687d62bb5f84391edcf02) - 1a5d126108da2bd2e6265c7db479d24130f91e669ef44a5eaac37fcb10f3e128 (1fdef3c6bdaad18e5512e67e48ac417702a7912e)a1dbe1a