setup
Bootstrap the trainer block from a fresh clone to "/trainer:check passes": preflight tooling (uv, python3 + PyYAML), check out repos/ (LLaMA-Factory…
от 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 byscripts/install_env.shanddryrun.sh. If missing on PATH: install to a writable location. On shared hosts where~/.local/binis root-owned useUV_INSTALL_DIR="$HOME/.uv/bin" UV_UNMANAGED_INSTALL=1 sh -c 'curl -LsSf https://astral.sh/uv/install.sh | sh'and persistPATH="$HOME/.uv/bin:$PATH".- system
python3+ PyYAML — everyscripts/*.shreads config throughscripts/config_value.py(defaultCONFIG_PYTHON=python3), whichimport yaml.python3 -c 'import yaml'must succeed;pip install --user pyyamlif not. - network —
install_env.shpulls from the Tsinghua PyPI mirror and the PyTorch cu128 index, and buildsflash-attnfrom 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):
- 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 legoflow_trace_crafteris the LegoFlow-Trace-Crafter checkout. The submodule URL ishttps://github.com/LegoX/LegoFlow-Trace-Crafter.git(public).LLaMA-Factoryuses the public patched LegoX fork (https://github.com/LegoX/LLaMA-Factory.git) and needs no token.- Verify each checkout matches the pin:
git -C repos/<path> rev-parse HEADmust equalmeta_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 — perBLOCK_DEFINITION.md,repos/is pinned, read-only code;:setupconfigures 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 (
$PYnot executable) → run it:
Relay the final import block. Step 0b already confirmed a GPU is present on this host, sobash scripts/install_env.shcuda available: Falsehere 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):
If imports succeed, leave it. If they fail, tell the user the env is broken and ask before re-running"$PY" - <<'PY' import torch, legoflow_trace_crafter, llamafactory print("torch", torch.__version__, "cuda", torch.cuda.is_available()) PYinstall_env.sh(it wipes$SFT_UV).
The hardlink warning (`Fail
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
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), без исполняемых скриптов.
Похожие скиллы
docx
AnthropicUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
xlsx
AnthropicUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing…
pptx
AnthropicUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…