Command Palette

Search for a command to run...

Назад к скиллам
скилл № 67832

setup

Bootstrap the trainer block from a fresh clone to "/trainer:check passes": preflight tooling (uv, python3 + PyYAML), check out repos/ (LLaMA-Factory…

БесплатноБез исполняемых скриптов
LegoXот LegoX★ 45 звёзд на GitHub

Установить setup в Claude Code и Claude Desktop

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

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

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

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

/trainer:setup

Brings the trainer block from a fresh clone to "/trainer:check passes". The skill is idempotent: any step already satisfied is skipped. It never runs training or data conversion — that's /trainer:run.

Step 0 — Orient

Run only from inside the trainer block. Validate ./config.yaml exists and meta_info.name == 'trainer'; otherwise abort ("run from blocks/trainer/"). Read config.yaml and CLAUDE.md.

Resolve the env path once: SFT_UV = meta_info.environment.sft_uv (default artifacts/env/lf), PY = $SFT_UV/bin/python.

Step 0b — GPU precondition

Read meta_info.resources.ip first. null/local means training runs on this host — check GPU here. A real IP means the target is that remote host — SSH there before checking, not on this one (per BLOCK_DEFINITION.md's execution-location rule).

On the target host, compare nvidia-smi --list-gpus against infrastructure.n_gpus_per_node (same check dryrun.sh §11 runs later). If nvidia-smi is missing, or reports fewer GPUs than configured, stop: tell the user trainer cannot be set up successfully on this host — it needs a GPU node — and do not proceed to Step 1's env build. This gate exists so a missing GPU is caught before the multi-GB install_env.sh build, not after.

Step 1 — Tooling preflight

The build scripts and the inline config readers depend on these:

  • uv — required by scripts/install_env.sh and dryrun.sh. If missing on PATH: install to a writable location. On shared hosts where ~/.local/bin is root-owned use UV_INSTALL_DIR="$HOME/.uv/bin" UV_UNMANAGED_INSTALL=1 sh -c 'curl -LsSf https://astral.sh/uv/install.sh | sh' and persist PATH="$HOME/.uv/bin:$PATH".
  • system python3 + PyYAML — every scripts/*.sh reads config through scripts/config_value.py (default CONFIG_PYTHON=python3), which import yaml. python3 -c 'import yaml' must succeed; pip install --user pyyaml if not.
  • network — install_env.sh pulls from the Tsinghua PyPI mirror and the PyTorch cu128 index, and builds flash-attn from its source distribution. If the host is offline, stop here — don't half-build the env.

Step 2 — Repos at pinned commits

The two repos under repos/ are git submodules (declared in the repo root .gitmodules); a fresh clone leaves them empty. For each entry under meta_info.repositories (llama_factory → repos/LLaMA-Factory, legoflow_trace_crafter → repos/LegoFlow-Trace-Crafter):

  1. If repos/<path> is empty or missing, initialise the submodule from the repo root:
    git submodule update --init blocks/trainer/repos/LLaMA-Factory blocks/trainer/repos/LegoFlow-Trace-Crafter
    
  2. legoflow_trace_crafter is the LegoFlow-Trace-Crafter checkout. The submodule URL is https://github.com/LegoX/LegoFlow-Trace-Crafter.git (public). LLaMA-Factory uses the public patched LegoX fork (https://github.com/LegoX/LLaMA-Factory.git) and needs no token.
  3. Verify each checkout matches the pin: git -C repos/<path> rev-parse HEAD must equal meta_info.repositories. <name>.commit (6e23fa19… for LLaMA-Factory, 5e9575a6… for legoflow_trace_crafter / LegoFlow-Trace-Crafter). If a present worktree has drifted or has local edits, report it and ask — per BLOCK_DEFINITION.md, repos/ is pinned, read-only code; :setup configures and pins, it does not patch.

After this, dryrun.sh section 3 should show [OK] repos/LLaMA-Factory/ and [OK] repos/LegoFlow-Trace-Crafter is an installable src-layout package.

Step 3 — Build / verify the uv env

The canonical builder is scripts/install_env.sh. It removes and recreates $SFT_UV (it refuses any path outside artifacts/env/), then installs the full stack: torch 2.10.0 cu128 → editable legoflow-trace-crafter[llm] (from repos/LegoFlow-Trace-Crafter) and patched LLaMA-Factory → metrics/DeepSpeed/Liger requirements → source-built flash-attn → flash-linear-attention + tilelang → wandb. It ends by importing torch, legoflow_trace_crafter, llamafactory and printing cuda available: <bool>. Step 2 must be done first — it installs -e repos/LegoFlow-Trace-Crafter[llm], which fails on an empty submodule.

Decision:

  • Env missing ($PY not executable) → run it:
    bash scripts/install_env.sh
    
    Relay the final import block. Step 0b already confirmed a GPU is present on this host, so cuda available: False here is a real problem, not expected — surface it rather than waving it off.
  • Env present → verify before rebuilding (the rebuild is destructive and pulls several GB):
    "$PY" - <<'PY'
    import torch, legoflow_trace_crafter, llamafactory
    print("torch", torch.__version__, "cuda", torch.cuda.is_available())
    PY
    
    If imports succeed, leave it. If they fail, tell the user the env is broken and ask before re-running install_env.sh (it wipes $SFT_UV).

The hardlink warning (`Fail

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

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

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

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

FAQ

Что делает скилл setup?

Bootstrap the trainer block from a fresh clone to "/trainer:check passes": preflight tooling (uv, python3 + PyYAML), check out repos/ (LLaMA-Factory, legoflow_trace_crafter) at their pinned commits via git submodules, build the uv env at artifacts/env/lf through scripts/install_env.sh (torch 2.10 cu128 + editable repos + DeepSpeed/Liger + flash-attn + wandb), then fill in runtime_info.input (source fields, conversion.data_name, model path, training.output_dir, experiment.wandb_*), prompting only for unset or placeholder values and keeping the WandB key out of git. Idempotent; hands off to /trainer:check for the dryrun + preflight report. Triggers on phrases like "set up trainer", "bootstrap trainer", "install LLaMA-Factory", "prepare trainer before training", "wire up trainer config".

Как установить скилл setup?

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

Скилл setup запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

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

Сравнить setup с