serve-model
БесплатноЗапускает вложенные скриптыНе проверенServe a model with MAX's `max serve` command: set up the environment (pixi or uv with the max-nightly conda channel / nightly wheel index), point the server…
от modular★ 215 звёзд на GitHubОб этом скилле
Serve a model with MAX
max serve launches an OpenAI-compatible HTTP server for a model. It handles
tokenization, batching, KV cache, and the whole serving stack. You point it at
a checkpoint and, if the model isn't built into MAX, at a custom architecture
package. This skill takes you from "no environment" to "server answering
requests," and helps you choose flags that fit the specific model instead of
guessing.
The guiding principle: start from the smallest command that could work, then add flags only when the model or the hardware forces you to. MAX auto-detects most things (dtype, sequence length, device defaults). Over-specifying flags is the most common way people turn a working serve into a broken one.
Use this skill when you want to run, launch, or host a model on MAX: bring
up an OpenAI-compatible endpoint, serve a built-in or a custom/ported
architecture, or debug a max serve startup failure.
Do not use this skill when the model isn't implemented in MAX yet (no
working arch.py, graph, and weights). That's a bring-up task: use
import-model to port the architecture, and debug-model if it serves but the
output is wrong. This skill runs an existing model; it doesn't author one.
References
| File | Read when |
|---|---|
| references/custom-arch.md | Serving a custom architecture: the arch.py-to-flags mapping, encoding and device, and serve-time gotchas |
| references/flags.md | Choosing any serve flag beyond --model, --devices, --quantization-encoding, and --max-length |
| references/troubleshooting.md | A max serve startup failure or a cryptic error |
Read the reference for what you're doing, not all of them upfront.
Fast path (custom architecture): do this first
If MAX is already installed and you have a working custom-arch package, this is
the whole job in four calls. Don't hand-read arch.py and config.json and
reason about flags yourself. The bundled inspector does exactly that and prints
a ready-to-run command plus the reasoning:
# 1. Get the recommended command + notes (reads arch.py + config.json for you).
python <skill>/scripts/suggest_serve_command.py \
--custom-architectures /abs/path/to/my_arch --model <hf-repo-or-path>
# 2. Launch it (add `pixi run` if in a pixi project). On a REMOTE box, wrap with
# `setsid ... </dev/null` so it survives the SSH session:
setsid <the suggested command> </dev/null > /tmp/max-serve.log 2>&1 &
# 3. Wait for readiness in ONE call (fails fast on a crash; ~10 min budget for
# a cold compile, advancing `Still compiling` heartbeats are normal):
timeout 600 bash -c 'until grep -qE "Server ready|Uvicorn running" /tmp/max-serve.log; do
grep -qiE "Traceback|CRASHED|Error building|cannot be found|not found in registry" /tmp/max-serve.log && { echo SERVE_FAILED; tail -30 /tmp/max-serve.log; exit 1; }
sleep 3; done' && echo SERVE_READY
# 4. Confirm with one request (model field must equal --served-model-name):
curl -s http://localhost:8000/v1/chat/completions -H "Content-Type: application/json" \
-d '{"model":"my_arch","messages":[{"role":"user","content":"The capital of France is"}],"max_completion_tokens":32}'
Read the inspector's # notes:. That's where the traps surface (a
default_encoding that disagrees with the checkpoint, a name colliding with a
built-in, GPU-only encodings, MoE). If the command works and the output is
coherent, you're done. Only drop into the detailed steps below when a note or a
failure tells you to. The rest of this doc is the "why" behind what the
inspector does and what to do when it isn't enough.
1. Make sure MAX is installed
The user needs a max binary from the nightly build. Check first, and don't
reinstall if it's already there (the max serve command works only if the
project includes the max[serve] or max-serve extra dependencies):
max serve --help # already in a MAX env?
pixi run max serve --help # or inside a pixi project
If the max serve command isn't available, set up an environment. pixi is
the default; the key detail is the conda channel
https://conda.modular.com/max-nightly/ plus conda-forge. If pixi isn't
already installed, install it using the latest instructions at
https://pixi.prefix.dev/latest/#installation, then:
# pixi (conda channels)
pixi init my-max-project \
-c https://conda.modular.com/max-nightly/ -c conda-forge && cd my-max-project
pixi add max-serve
If a `pixi.toml
Установить serve-model в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл serve-model?
Serve a model with MAX's `max serve` command: set up the environment (pixi or uv with the max-nightly conda channel / nightly wheel index), point the server at a Hugging Face repo or local checkpoint, target a custom architecture with `--custom-architectures`, and pick the right serve flags for the model. Use this whenever the user wants to run, launch, start, or host a model on MAX, bring up an OpenAI-compatible endpoint, serve a custom/ported architecture, debug a `max serve` startup failure, or figure out which serve flags (devices, quantization-encoding, max-length, task, trust-remote-code) a given model needs, even if they don't say "max serve" by name.
Как установить скилл serve-model?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл serve-model запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic