Text Generation
MLX
Safetensors
English
Chinese
hy_v4
quantized
hy4
Mixture of Experts
conversational
8-bit precision
Instructions to use Xylolabs/Hy4-MLX-8bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use Xylolabs/Hy4-MLX-8bit 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("Xylolabs/Hy4-MLX-8bit") 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 Xylolabs/Hy4-MLX-8bit with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "Xylolabs/Hy4-MLX-8bit"
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": "Xylolabs/Hy4-MLX-8bit" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use Xylolabs/Hy4-MLX-8bit with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "Xylolabs/Hy4-MLX-8bit"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "Xylolabs/Hy4-MLX-8bit" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8080/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Xylolabs/Hy4-MLX-8bit", "messages": [ {"role": "user", "content": "Hello"} ] }' - Hermes Agent
How to use Xylolabs/Hy4-MLX-8bit 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 "Xylolabs/Hy4-MLX-8bit"
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 Xylolabs/Hy4-MLX-8bit
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use Xylolabs/Hy4-MLX-8bit with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "Xylolabs/Hy4-MLX-8bit"
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 "Xylolabs/Hy4-MLX-8bit" \ --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"
Card: simplify accuracy table and add provider curves
Browse files- .gitattributes +2 -0
- README.md +14 -0
- accuracy-by-size-dark.png +0 -0
- accuracy-by-size.csv +3 -0
- accuracy-by-size.png +0 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
accuracy-by-size.png filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
accuracy-by-size-dark.png filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -60,6 +60,20 @@ mlx_lm.chat --model Xylolabs/Hy4-MLX-8bit --trust-remote-code
|
|
| 60 |
mlx_lm.server --model Xylolabs/Hy4-MLX-8bit --trust-remote-code
|
| 61 |
```
|
| 62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
## License and notices
|
| 64 |
|
| 65 |
These files are under the Tencent Hy License, Version 1.0, copied in `LICENSE`, including its extra terms for large Model-as-a-Service operators. We quantized the weights and converted them to MLX with `convert_hy4.py`. `hy_v4.py` is the model code; it contains code ported from Hugging Face Transformers (Apache-2.0, `LICENSE.transformers`) and from `mlx-lm` (MIT, notice in `ORIGINS.md`). `NOTICE` names the source model and its copyright holder. Xylolabs is not affiliated with or endorsed by Tencent.
|
|
|
|
| 60 |
mlx_lm.server --model Xylolabs/Hy4-MLX-8bit --trust-remote-code
|
| 61 |
```
|
| 62 |
|
| 63 |
+
## Accuracy
|
| 64 |
+
|
| 65 |
+
Mean KL divergence from BF16 (lower is better) and top-1 agreement with BF16.
|
| 66 |
+
|
| 67 |
+
| Quant | Size | WikiText-2 KL | top-1 | Chat KL | top-1 | Held-out KL | top-1 |
|
| 68 |
+
|---|---:|---:|---:|---:|---:|---:|---:|
|
| 69 |
+
| **MLX 4-bit** | 447.58 GB | **0.128577** | **90.588%** | | | | |
|
| 70 |
+
| **MLX 8-bit** | 819.63 GB | | | | | | |
|
| 71 |
+
|
| 72 |
+
<picture>
|
| 73 |
+
<source media="(prefers-color-scheme: dark)" srcset="accuracy-by-size-dark.png">
|
| 74 |
+
<img src="accuracy-by-size.png" alt="Mean KL and top-1 by file size">
|
| 75 |
+
</picture>
|
| 76 |
+
|
| 77 |
## License and notices
|
| 78 |
|
| 79 |
These files are under the Tencent Hy License, Version 1.0, copied in `LICENSE`, including its extra terms for large Model-as-a-Service operators. We quantized the weights and converted them to MLX with `convert_hy4.py`. `hy_v4.py` is the model code; it contains code ported from Hugging Face Transformers (Apache-2.0, `LICENSE.transformers`) and from `mlx-lm` (MIT, notice in `ORIGINS.md`). `NOTICE` names the source model and its copyright holder. Xylolabs is not affiliated with or endorsed by Tencent.
|
accuracy-by-size-dark.png
ADDED
|
accuracy-by-size.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
provider,quant,bytes,kl,top1,text,context,chunk_indices,chunk_count,scored_positions,scored_predictions,reference,reference_revision,software,batch,measurement_scope,source,size_source,measurement_note
|
| 2 |
+
Xylolabs,MLX 4-bit,447576537740,0.128577,90.588,WikiText-2 raw test,512,0,1,256-510,255,tencent/Hy4 BF16 GGUF with native FP8 Engram,c10c0de5b6f850703fb0a90e65d1c32b558b9167,MLX 0.32.4; mlx-lm 0.32.2; bf16 activations; fp32 LM head,1,single valid chunk; full corrected aggregates pending,https://huggingface.co/Xylolabs/Hy4-MLX-4bit/blob/ad51910f4652b0511bd02b413e50523b20dc4314/README.md,pinned live Hub listing,existing published measurement
|
| 3 |
+
Xylolabs,MLX 8-bit,819628080300,,,WikiText-2 raw test,512,0,1,256-510,255,tencent/Hy4 BF16 GGUF with native FP8 Engram,c10c0de5b6f850703fb0a90e65d1c32b558b9167,MLX 0.32.4; mlx-lm 0.32.2; bf16 activations; fp32 LM head,1,single valid chunk; full corrected aggregates pending,https://huggingface.co/Xylolabs/Hy4-MLX-4bit/blob/ad51910f4652b0511bd02b413e50523b20dc4314/README.md,pinned live Hub listing,pending
|
accuracy-by-size.png
ADDED
|