Text Generation
Transformers
Safetensors
metis16
metis
post-trained
instruction-tuned
reasoning
mixture-of-experts
mamba
conversational
custom_code
Instructions to use Lernex/Metis-1.6-Praxis with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Lernex/Metis-1.6-Praxis with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Lernex/Metis-1.6-Praxis", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("Lernex/Metis-1.6-Praxis", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Lernex/Metis-1.6-Praxis with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Lernex/Metis-1.6-Praxis" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Lernex/Metis-1.6-Praxis", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Lernex/Metis-1.6-Praxis
- SGLang
How to use Lernex/Metis-1.6-Praxis 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 "Lernex/Metis-1.6-Praxis" \ --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": "Lernex/Metis-1.6-Praxis", "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 "Lernex/Metis-1.6-Praxis" \ --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": "Lernex/Metis-1.6-Praxis", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Lernex/Metis-1.6-Praxis with Docker Model Runner:
docker model run hf.co/Lernex/Metis-1.6-Praxis
The Lernex engine with its speeds, and direct-mode sampling in generation_config.json
Browse filesLernex quickstart with decode speeds against vLLM on an RTX 5070 Ti, the vLLM speeds remeasured on the same workload. llama.cpp's whole-context penalty window as 131072 (it rejects -1).
- README.md +46 -13
- generation_config.json +5 -1
README.md
CHANGED
|
@@ -270,8 +270,8 @@ at higher precision.
|
|
| 270 |
|
| 271 |
| You have | Use | With | Size |
|
| 272 |
|---|---|---|---|
|
| 273 |
-
| A GPU with 16 GB or more | This repository, BF16 | Transformers, vLLM, SGLang | 6.2 GB |
|
| 274 |
-
| A smaller GPU | [Metis-1.6-Praxis-FP8](https://huggingface.co/Lernex/Metis-1.6-Praxis-FP8) | vLLM, SGLang | 3.5 GB |
|
| 275 |
| A Mac with Apple silicon | [Metis-1.6-Praxis-MLX-4bit](https://huggingface.co/Lernex/Metis-1.6-Praxis-MLX-4bit) or [-8bit](https://huggingface.co/Lernex/Metis-1.6-Praxis-MLX-8bit) | mlx-lm | 2.0 / 3.2 GB |
|
| 276 |
| A laptop, a CPU, anything else | [Metis-1.6-Praxis-GGUF](https://huggingface.co/Lernex/Metis-1.6-Praxis-GGUF), Q4_K_M | llama.cpp | 2.0 GB |
|
| 277 |
|
|
@@ -300,13 +300,46 @@ with the request. The commands below pass the settings where an engine does not
|
|
| 300 |
and keywords on purpose, and the penalty works against them: it cost 12 points on HumanEval+.
|
| 301 |
- **Keep penalties off in direct mode.** Direct answers are short and rarely repeat, so a penalty
|
| 302 |
only costs accuracy.
|
| 303 |
-
- **In llama.cpp and Ollama, apply the penalty to the whole context** with `--repeat-last-n
|
| 304 |
-
`repeat_last_n
|
| 305 |
- **If your engine has no repetition penalty, use temperature 1.0** for thinking.
|
| 306 |
|
| 307 |
I chose these by sweeping 13 thinking and 8 direct settings over MATH-500, GPQA Diamond, HumanEval+
|
| 308 |
and IFEval, then comparing the finalists blind on 32 everyday conversations.
|
| 309 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 310 |
### Transformers
|
| 311 |
|
| 312 |
The Transformers implementation ships in this repository, so the model loads with
|
|
@@ -330,7 +363,7 @@ print(answer.strip())
|
|
| 330 |
```
|
| 331 |
|
| 332 |
This implementation is the reference: it computes exactly what the native model computes, but it is
|
| 333 |
-
not the fastest way to run it. For serving, use one of the engines below.
|
| 334 |
|
| 335 |
### vLLM
|
| 336 |
|
|
@@ -343,10 +376,10 @@ vllm serve Lernex/Metis-1.6-Praxis --trust-remote-code \
|
|
| 343 |
[`vllm-metis`](https://github.com/lernex/vllm-metis) registers the model, a reasoning parser and a
|
| 344 |
tool-call parser through vLLM's plugin system, so there is nothing to patch. You get the
|
| 345 |
OpenAI-compatible API with the thinking returned apart from the answer, tool calls parsed and typed
|
| 346 |
-
from your schema, prefix caching, chunked prefill and CUDA graphs. Praxis runs in BF16 on a 16 GB card: an RTX 5070 Ti decodes
|
| 347 |
-
and 1,
|
| 348 |
-
[Metis-1.6-Praxis-FP8](https://huggingface.co/Lernex/Metis-1.6-Praxis-FP8) (3.5 GB), which
|
| 349 |
-
|
| 350 |
|
| 351 |
```python
|
| 352 |
from openai import OpenAI
|
|
@@ -391,7 +424,7 @@ git fetch origin pull/31134/head:metis16 && git checkout metis16
|
|
| 391 |
cmake -B build # add -DGGML_CUDA=ON for NVIDIA; Metal is on by default on a Mac
|
| 392 |
cmake --build build --config Release -j
|
| 393 |
./build/bin/llama-server -hf Lernex/Metis-1.6-Praxis-GGUF:Q4_K_M --jinja -ngl 99 -c 32768 \
|
| 394 |
-
--temp 0.8 --top-p 0.95 --top-k 20 --repeat-penalty 1.05 --repeat-last-n
|
| 395 |
```
|
| 396 |
|
| 397 |
`--jinja` uses the chat template inside the file, and the server returns the thinking in
|
|
@@ -433,9 +466,9 @@ user message and keeps it within an ongoing tool loop, as the model was trained.
|
|
| 433 |
|
| 434 |
### Tool calling
|
| 435 |
|
| 436 |
-
Pass JSON-schema tools with `tools=`. The model writes each call after `<|tool_call|>`; the
|
| 437 |
-
SGLang and llama.cpp servers parse these into typed `tool_calls` for you. With Transformers,
|
| 438 |
-
with `skip_special_tokens=False` to find them:
|
| 439 |
|
| 440 |
```python
|
| 441 |
tools = [{
|
|
|
|
| 270 |
|
| 271 |
| You have | Use | With | Size |
|
| 272 |
|---|---|---|---|
|
| 273 |
+
| A GPU with 16 GB or more | This repository, BF16 | Lernex, Transformers, vLLM, SGLang | 6.2 GB |
|
| 274 |
+
| A smaller GPU | [Metis-1.6-Praxis-FP8](https://huggingface.co/Lernex/Metis-1.6-Praxis-FP8) | Lernex, vLLM, SGLang | 3.5 GB |
|
| 275 |
| A Mac with Apple silicon | [Metis-1.6-Praxis-MLX-4bit](https://huggingface.co/Lernex/Metis-1.6-Praxis-MLX-4bit) or [-8bit](https://huggingface.co/Lernex/Metis-1.6-Praxis-MLX-8bit) | mlx-lm | 2.0 / 3.2 GB |
|
| 276 |
| A laptop, a CPU, anything else | [Metis-1.6-Praxis-GGUF](https://huggingface.co/Lernex/Metis-1.6-Praxis-GGUF), Q4_K_M | llama.cpp | 2.0 GB |
|
| 277 |
|
|
|
|
| 300 |
and keywords on purpose, and the penalty works against them: it cost 12 points on HumanEval+.
|
| 301 |
- **Keep penalties off in direct mode.** Direct answers are short and rarely repeat, so a penalty
|
| 302 |
only costs accuracy.
|
| 303 |
+
- **In llama.cpp and Ollama, apply the penalty to the whole context** with `--repeat-last-n 131072` (or
|
| 304 |
+
`repeat_last_n 131072`). By default they look at the last 64 tokens only, and they reject `-1`.
|
| 305 |
- **If your engine has no repetition penalty, use temperature 1.0** for thinking.
|
| 306 |
|
| 307 |
I chose these by sweeping 13 thinking and 8 direct settings over MATH-500, GPQA Diamond, HumanEval+
|
| 308 |
and IFEval, then comparing the finalists blind on 32 everyday conversations.
|
| 309 |
|
| 310 |
+
### Lernex
|
| 311 |
+
|
| 312 |
+
[Lernex](https://github.com/lernex/lernex-engine) is the inference engine I wrote for Metis, from
|
| 313 |
+
scratch, and the fastest way to run Praxis.
|
| 314 |
+
|
| 315 |
+
```bash
|
| 316 |
+
git clone https://github.com/lernex/lernex-engine && cd lernex-engine
|
| 317 |
+
cmake -B build -DLX_ARCHS=all # NVIDIA from the RTX 30 series on; a Mac builds for Metal
|
| 318 |
+
cmake --build build -j
|
| 319 |
+
./build/lernex run praxis # downloads the model, then chats in the terminal
|
| 320 |
+
./build/lernex serve praxis # an OpenAI-compatible API on port 8080
|
| 321 |
+
```
|
| 322 |
+
|
| 323 |
+
It needs CMake 3.28 and, for NVIDIA, the CUDA 13 toolkit. With no NVIDIA GPU, add
|
| 324 |
+
`-DLX_BACKEND_CUDA=OFF` for the CPU build. Decode speed on an RTX 5070 Ti in tokens per second,
|
| 325 |
+
against vLLM on the same files, with 512 prompt tokens and 256 generated per stream:
|
| 326 |
+
|
| 327 |
+
| | Lernex | vLLM |
|
| 328 |
+
|---|---|---|
|
| 329 |
+
| BF16, one stream | **294.5** | 204.2 |
|
| 330 |
+
| BF16, 32 streams | **2,141** | 1,871 |
|
| 331 |
+
| FP8, one stream | **295.1** | 235.3 |
|
| 332 |
+
| FP8, 32 streams | **2,489** | 2,268 |
|
| 333 |
+
|
| 334 |
+
In BF16, Lernex decodes from a lossless compressed copy of the weights: it reads fewer bytes for
|
| 335 |
+
every token with nothing lost, which is why BF16 runs as fast as FP8 for one stream.
|
| 336 |
+
|
| 337 |
+
`lernex serve` speaks the same API as vLLM below: the thinking comes back as `reasoning_content`,
|
| 338 |
+
tool calls as typed `tool_calls`, and `"chat_template_kwargs": {"enable_thinking": false}` gives a
|
| 339 |
+
direct answer. Lernex reads the sampling settings above from the model and switches to the direct
|
| 340 |
+
column by itself, so you never pass them. Weights run in the format the file stores, never
|
| 341 |
+
quantized behind your back: `--weights int8` or `--weights fp8` picks a narrower one, and
|
| 342 |
+
`lernex doctor praxis` shows every format, what fits on your machine and the speed to expect.
|
| 343 |
### Transformers
|
| 344 |
|
| 345 |
The Transformers implementation ships in this repository, so the model loads with
|
|
|
|
| 363 |
```
|
| 364 |
|
| 365 |
This implementation is the reference: it computes exactly what the native model computes, but it is
|
| 366 |
+
not the fastest way to run it. For serving, use Lernex or one of the engines below.
|
| 367 |
|
| 368 |
### vLLM
|
| 369 |
|
|
|
|
| 376 |
[`vllm-metis`](https://github.com/lernex/vllm-metis) registers the model, a reasoning parser and a
|
| 377 |
tool-call parser through vLLM's plugin system, so there is nothing to patch. You get the
|
| 378 |
OpenAI-compatible API with the thinking returned apart from the answer, tool calls parsed and typed
|
| 379 |
+
from your schema, prefix caching, chunked prefill and CUDA graphs. Praxis runs in BF16 on a 16 GB card: an RTX 5070 Ti decodes 204 tokens/s for a single stream
|
| 380 |
+
and 1,871 tokens/s across 32. On a smaller card, serve
|
| 381 |
+
[Metis-1.6-Praxis-FP8](https://huggingface.co/Lernex/Metis-1.6-Praxis-FP8) (3.5 GB), which vLLM
|
| 382 |
+
also runs faster: 235 and 2,268 tokens/s.
|
| 383 |
|
| 384 |
```python
|
| 385 |
from openai import OpenAI
|
|
|
|
| 424 |
cmake -B build # add -DGGML_CUDA=ON for NVIDIA; Metal is on by default on a Mac
|
| 425 |
cmake --build build --config Release -j
|
| 426 |
./build/bin/llama-server -hf Lernex/Metis-1.6-Praxis-GGUF:Q4_K_M --jinja -ngl 99 -c 32768 \
|
| 427 |
+
--temp 0.8 --top-p 0.95 --top-k 20 --repeat-penalty 1.05 --repeat-last-n 131072
|
| 428 |
```
|
| 429 |
|
| 430 |
`--jinja` uses the chat template inside the file, and the server returns the thinking in
|
|
|
|
| 466 |
|
| 467 |
### Tool calling
|
| 468 |
|
| 469 |
+
Pass JSON-schema tools with `tools=`. The model writes each call after `<|tool_call|>`; the Lernex,
|
| 470 |
+
vLLM, SGLang and llama.cpp servers parse these into typed `tool_calls` for you. With Transformers,
|
| 471 |
+
decode with `skip_special_tokens=False` to find them:
|
| 472 |
|
| 473 |
```python
|
| 474 |
tools = [{
|
generation_config.json
CHANGED
|
@@ -9,5 +9,9 @@
|
|
| 9 |
"temperature": 0.8,
|
| 10 |
"top_p": 0.95,
|
| 11 |
"top_k": 20,
|
| 12 |
-
"repetition_penalty": 1.05
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
}
|
|
|
|
| 9 |
"temperature": 0.8,
|
| 10 |
"top_p": 0.95,
|
| 11 |
"top_k": 20,
|
| 12 |
+
"repetition_penalty": 1.05,
|
| 13 |
+
"direct": {
|
| 14 |
+
"temperature": 0.3,
|
| 15 |
+
"repetition_penalty": 1.0
|
| 16 |
+
}
|
| 17 |
}
|