import-model
БесплатноЗапускает вложенные скриптыНе проверенUse when importing a new model architecture into MAX from a Hugging Face model ID. Triggers on: "import a model into MAX", "add model to MAX", "bring up <HF…
от modular★ 215 звёзд на GitHubОб этом скилле
Import a model into MAX
Input: a Hugging Face model ID ($ARGUMENTS).
Copy references/template.md to track this port as you work through the phases. Its file references are paths from this skill's root, so they still resolve after you copy it elsewhere.
Porting a model to MAX means writing a ModuleV3 model that performs the same
computation as the model's modeling_<type>.py in Hugging Face
transformers. You then compile it with the released weights and verify that
the outputs match. ModuleV3 is MAX's model API. Layers are Module subclasses
from max.nn with a forward() over Tensor values. Ops come
from max.functional (imported as F). The pipeline builds the
module under F.lazy() and compiles it with compile(weights=...).
Single-GPU, tensor-parallel, and expert-parallel models all use ModuleV3.
Multi-GPU models shard through a DeviceMesh.
Before choosing a donor, read the module registration compatibility reference (published copy if this skill was installed alone). Prefer a registered ModuleV3 donor when its task and required features are supported. Document the compatibility gap when retaining a custom pipeline. The runtime's encoder and vision support is broader than this skill's decoder scaffolding; do not infer generator support from the runtime table. Draft/speculator registration has not been added.
The workflow phases are decide and plan, implement, and verify. Phase 1 is reading and planning. Phase 2 is the port: implement every divergent sublayer in the module. Phase 3 is verification, only after implementation is complete. Guards (preconditions that halt the workflow) gate the transitions between activities. They aren't steps of their own.
Anti-pattern: running scaffold.py, tweaking arch.py, and serving
while <slug>.py still implements the donor (llama3_modulev3, olmo3, …).
Logit verification fails on that port because <slug>.py still runs the
donor architecture. Don't run verification scripts until
implement-graph.md completion criteria pass.
Each phase links to references with the details. Read the reference for the activity you're on, not all of them upfront.
Environment: run every command through the pixi env that has MAX
installed (pixi run python …, pixi run max serve …). Run them from the
skill root where pixi.toml lives, and don't use bare python or max on
the shell PATH:
cd <path-to-skill>
pixi install
pixi run python scripts/inspect_hf.py <HF_MODEL_ID>
# Or: pixi run test-scripts # smoke-test all scripts (no GPU)
The default environment installs on Linux (x86-64 and ARM64) and on macOS
with Apple silicon, and needs no CUDA. Its PyTorch runs the HF reference
model on CPU, or on an Apple silicon GPU. On an NVIDIA host, pixi run -e cuda … runs the same commands with CUDA PyTorch, so the HF reference runs
on the GPU too.
Helper scripts live in this skill's scripts/ directory (copy or vendor
them into your repo). All helpers are also reachable through a unified
dispatcher with the same argument names and exit codes:
pixi run python scripts/import_model.py inspect <HF_MODEL_ID>
pixi run python scripts/import_model.py list-archs --donors
pixi run python scripts/import_model.py scaffold <HF_MODEL_ID> --start-from olmo3 --output-dir ./
pixi run python scripts/import_model.py list-archs --match LlamaForCausalLM
pixi run python scripts/import_model.py check-walls <HF_MODEL_ID>
pixi run python scripts/import_model.py list-keys <HF_MODEL_ID> --summary
pixi run python scripts/import_model.py gates <HF_MODEL_ID> --port-dir <port_dir>
pixi run python scripts/import_model.py compare <HF_MODEL_ID> --port 8000
Port layout:
<port_dir>: slug folder containingarch.pyandARCHITECTURESin__init__.py(usually<output_dir>/<slug>, with no trailing slash). Pass this path to both--custom-architecturesandrun_oss_gates.py --port-dir.
MAX resolves --custom-architectures <port_dir> by adding dirname(<port_dir>)
to sys.path and importing basename(<port_dir>) as the module. Passing the
parent directory imports the wrong module name (for example, custom-arch
where your slug belongs).
If you hit import or API errors while editing, copy the imports from the donor
arch under max/pipelines/architectures/<donor>/ in your installed MAX package.
See
pitfalls-config.md § Import and config API traps.
Phase 1: Decide and plan
Guard: is the architecture already registered in MAX? Before writing any code, check whether MAX already registers the architecture class in your model's
config.json::architectures[0]. Ifpixi run python scripts/list_native_archs.py --match <Class>ret
Установить import-model в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл import-model?
Use when importing a new model architecture into MAX from a Hugging Face model ID. Triggers on: "import a model into MAX", "add model to MAX", "bring up <HF model> in MAX". Workflow: inspect the Hugging Face config and modeling code, then scaffold from a similar ModuleV3 architecture. Implement each layer as a max.nn Module that matches HF, serve, then verify against the Hugging Face reference. When the server runs but output is wrong (gibberish, greedy mismatch, coherent-then-diverges), load debug-model for the divergence hunt.
Как установить скилл import-model?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл import-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