Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

modal-training

БесплатноЗапускает вложенные скриптыНе проверен

Train or fine-tune models on Modal cloud GPUs (LoRA SFT, full SFT, data prep, eval) with strict leave-no-trace lifecycle. Use when an experiment needs GPU…

ChicagoHAIот ChicagoHAI★ 164 звезды на GitHub

Об этом скилле

modal-training

Cloud GPU training via Modal, wired into NeuriCo's reproducibility and cleanup model.

When to use

Use this skill when your experiment needs to:

  • Fine-tune a model (LoRA SFT, full SFT, DPO) on >7B parameters
  • Train on a GPU larger than the local Docker container provides
  • Prepare a large dataset that benefits from cloud bandwidth (HF Hub via hf-transfer)
  • Run an eval pass that requires GPU inference

Do not use this skill if:

  • The experiment runs comfortably on CPU or local GPU
  • You're just calling an existing API (use the model's native HTTP client instead)
  • You only need inference against an already-deployed endpoint (use modal-vllm instead)

Contract (read first)

Three rules govern every Modal-backed experiment under NeuriCo:

  1. Ephemeral compute, persistent workspace. All Modal-side state lives inside a per-experiment environment named neurico-<EXP_ID>. At pipeline end, that environment is destroyed and everything inside it goes with it. Your reproducibility data must therefore be in the workspace before teardown.

  2. Pull before teardown. lifecycle.pull_all() must succeed before lifecycle.teardown() runs. The skill enforces this — teardown() is gated on a successful pull. The default pull set covers the trained adapter, training logs, run config, and metadata. See references/lifecycle.md for what's pulled and what's skipped.

  3. Use the scaffolder. Do not hand-write Modal volume or environment names. Run scripts/new_modal_app.py to generate a parameterized template — the scaffolder injects the experiment ID and environment name correctly so the lifecycle hooks find them.

Prerequisites

One-time setup on your HOST machine (not inside the container)

modal token new      # opens browser, authenticates, writes ~/.modal.toml

That's it. Inside the neurico Docker container, ~/.modal.toml is mounted read-only from your host (the same pattern used for Claude / Codex / Gemini credentials), so the container's modal CLI is authenticated automatically on every run. You do not run modal token new inside the container — it would prompt for a browser that doesn't exist there.

If you have not yet run modal token new on your host, the doctor will tell you what to do; runs that don't use Modal are unaffected.

Optional: Hugging Face token (only for gated models)

If your experiment uses gated HF models (e.g. Llama-3 70B) or private repos, add one line to neurico/.env:

HF_TOKEN=hf_xxx

The lifecycle reads this at experiment start and mints a per-experiment huggingface-secret into the per-experiment Modal environment, which is destroyed at teardown. Public models (Qwen2.5, Llama 3.2 1B/3B, Phi-3, Gemma-2, public HF datasets) need nothing — pass --no-hf-secret to the scaffolder to drop the HF entry.

Additional secrets (W&B, OpenAI judge, S3, etc.)

The scaffolder accepts repeated --secret NAME=ENV_VAR[,ENV_VAR2] flags to provision additional secrets into the per-experiment env:

python new_modal_app.py lora-train --exp-id "$EXP_ID" \
    --secret wandb-secret=WANDB_API_KEY \
    --secret openai-secret=OPENAI_API_KEY \
    --out src/modal_train.py

The lifecycle reads each listed local env var (WANDB_API_KEY, OPENAI_API_KEY) and mints the matching Modal secret into neurico-<EXP_ID> at register time; the container picks them up as env vars at function dispatch. All minted secrets cascade-delete with the env at teardown.

If the required local env vars are not set, the doctor surfaces the specific list before any Modal spend.

Verify

python .claude/skills/modal-training/scripts/check_modal_setup.py
# add --probe for an end-to-end create/delete env round-trip
# add --json for machine-readable output
# add --no-require-hf-secret if your experiments use only public models

The doctor verifies CLI version, auth (whether via mounted ~/.modal.toml or MODAL_TOKEN_ID/SECRET env vars), environments quota, required secrets, and workspace disk space for pulled artifacts.

CI / autonomous runs (no host login)

When there is no interactive host user (GitHub Actions, cron, autonomous agents), skip the host login and pass the token in as env vars instead:

docker run \
  -e MODAL_TOKEN_ID=ak-... \
  -e MODAL_TOKEN_SECRET=as-... \
  ghcr.io/chicagohai/neurico:latest ...

The CLI picks these up automatically. Source them once from a modal token info on any machine you already authenticated.

Quickstart

1. Generate a training script

python .claude/skills/modal-training/scripts/new_modal_app.py lora-train \
    --exp-id "$(basename $(pwd))" \
    --base-model "Qwen/Qwen2.5-7B-Instruct" \
    --dataset /data/train.jsonl \
    --out src/modal_train.py

Available kinds: lora-train, data-prep, eval.

2. Run it

modal run --env=neurico-<EXP_ID> src/modal_train.py 2>&1 | tee logs/modal_train_$(date +%Y%m%d_%H%M%S).log

The generat

Полный SKILL.md на GitHub

Установить modal-training в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

references/cost_guide.mdreferences/lifecycle.mdreferences/modal_basics.mdreferences/training_recipes.mdscripts/_doctor_checks.pyscripts/check_modal_setup.pyscripts/lifecycle.pyscripts/modal_sweep.pyscripts/new_modal_app.pyscripts/templates/modal_data_prep.py.tmplscripts/templates/modal_eval.py.tmplscripts/templates/modal_lora_train.py.tmpl

FAQ

Что делает скилл modal-training?

Train or fine-tune models on Modal cloud GPUs (LoRA SFT, full SFT, data prep, eval) with strict leave-no-trace lifecycle. Use when an experiment needs GPU training, fine-tuning, or model evaluation that exceeds local Docker capacity.

Как установить скилл modal-training?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл modal-training запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить modal-training с