Instructions to use tokimoa/apertus-v1.5-8b-mlx-8bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use tokimoa/apertus-v1.5-8b-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("tokimoa/apertus-v1.5-8b-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 tokimoa/apertus-v1.5-8b-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 "tokimoa/apertus-v1.5-8b-mlx-8bit"
Configure the model in Pi
# Install Pi: npm install -g @mariozechner/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "tokimoa/apertus-v1.5-8b-mlx-8bit" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent new
How to use tokimoa/apertus-v1.5-8b-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 "tokimoa/apertus-v1.5-8b-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 tokimoa/apertus-v1.5-8b-mlx-8bit
Run Hermes
hermes
- OpenClaw new
How to use tokimoa/apertus-v1.5-8b-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 "tokimoa/apertus-v1.5-8b-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 "tokimoa/apertus-v1.5-8b-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"
- MLX LM
How to use tokimoa/apertus-v1.5-8b-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 "tokimoa/apertus-v1.5-8b-mlx-8bit"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "tokimoa/apertus-v1.5-8b-mlx-8bit" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "tokimoa/apertus-v1.5-8b-mlx-8bit", "messages": [ {"role": "user", "content": "Hello"} ] }'
File size: 3,364 Bytes
68d44a5 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | ---
license: apache-2.0
language:
- ja
- en
- de
- fr
- it
base_model: swiss-ai/Apertus-v1.5-8B
library_name: mlx
pipeline_tag: text-generation
tags:
- mlx
- apertus
- multilingual
- quantized
---
# Apertus-v1.5-8B (MLX 8bit, text LM, verified)
スイスAIイニシアチブの [Apertus-v1.5-8B](https://huggingface.co/swiss-ai/Apertus-v1.5-8B)(Apache-2.0・多言語・xIELU活性/QK-norm/llama3型RoPEスケーリングの独自アーキテクチャ)から**テキストLM部分を抽出してMLX変換**したものです(8bit量子化・group size 64・実効8.5bpw)。品質と速度のバランスが良い**推奨版**です。
**このMLX版の価値**: 上流モデルはリリース版transformers/vLLMでは動かず、[swiss-ai専用フォーク](https://github.com/swiss-ai/transformers/tree/3797303dda74844e3d1f8977ff5518bb91f818b4)が必要ですが、この変換は**mlx-lm標準でそのまま動きます**(`pip install mlx-lm`のみ)。
**スコープ**: 元モデルは画像・音声入力対応のomniモデルですが、本repoは**テキスト専用**の抽出です(vision/audioトークナイザは含みません。埋め込みはテキスト出力語彙131,072行に切り詰め済み — テキスト対話のトークンIDはすべてこの範囲内であることを確認しています)。
## 使い方
```bash
pip install mlx-lm
python -m mlx_lm generate --model tokimoa/apertus-v1.5-8b-mlx-8bit --prompt "富士山の標高を教えてください。" --max-tokens 200 --temp 0.0
```
**Deliberation(思考モード)に注意**: chat templateに思考モードのフラグがあり、mlx-lm経由の既定では**有効**(`<|inner_prefix|>`で内部推論を出力してから回答)、Hugging Face transformersの既定では無効になります。無効にしたい場合は`apply_chat_template`に`enable_thinking=False`を渡してください。
## 変換品質の検証(tokimoa)
transformers公式実装(swiss-aiフォーク・**CPU** bf16)との突き合わせ検証:
- **同一入力でのprefillロジット比較: 日本語ビジネスプローブ5種すべてでtop-1トークン一致**(cos類似度0.9992〜0.9997・top-10重複9〜10/10 = 量子化劣化ほぼなし)
- bf16版は反復実行で出力完全一致(決定論的)
- 検証時の発見: 参照フォークは**MPS上では出力が破綻**します(縮退ループ)。参照はCPUで実行しました(変換品質とは無関係の上流問題)
## 実測速度(M4 Max 36GB)
- 生成: 約44 tok/s / ピークメモリ: 8.7GB(重み8.0GB)
## 変換情報
- 変換元: `swiss-ai/Apertus-v1.5-8B`(公式BF16、commit a411d83)からテキストLM抽出(`model.language_model.*`→`model.*`・lm_head保持・embed切り詰め)
- 変換: `mlx-lm 0.31.3` `convert -q --q-bits 8`(group size 64 affine、実効8.5bpw)
- 兄弟repo: [bf16](https://huggingface.co/tokimoa/apertus-v1.5-8b-mlx-bf16)(参照一致検証の基準)/ [4bit](https://huggingface.co/tokimoa/apertus-v1.5-8b-mlx-4bit)(4.3GB・約75 tok/s)
- 変換者: [tokimoa](https://tokimoa.jp)
## ライセンス
Apache-2.0(元モデルに準拠)。上流の[利用ポリシー(AUP)](https://github.com/swiss-ai/apertus-legal/blob/main/apertus_1.5/USAGE_POLICY.pdf)も参照してください。
|