start-run

GitHub

指导启动 RL/SFT/推理训练任务,涵盖入口点选择、TOML配置加载、CLI参数覆盖及运行目录管理。支持单节点与SLURM模式,包含断点续训和干跑功能。

skills/training/start-run/SKILL.md PrimeIntellect-ai/prime-rl

Trigger Scenarios

启动RL或SFT训练任务 配置训练参数与入口点 处理运行目录与断点续训

Install

npx skills add PrimeIntellect-ai/prime-rl --skill start-run -g -y
More Options

Non-standard path

npx skills add https://github.com/PrimeIntellect-ai/prime-rl/tree/main/skills/training/start-run -g -y

Use without installing

npx skills use PrimeIntellect-ai/prime-rl@start-run

指定 Agent (Claude Code)

npx skills add PrimeIntellect-ai/prime-rl --skill start-run -a claude-code -g -y

安装 repo 全部 skill

npx skills add PrimeIntellect-ai/prime-rl --all -g -y

预览 repo 内 skill

npx skills add PrimeIntellect-ai/prime-rl --list

SKILL.md

Frontmatter
{
    "name": "start-run",
    "description": "How to launch prime-rl training runs — the `rl`, `sft`, and `inference` entrypoints, their config classes, and single-node\/SLURM\/dry-run modes. Use when starting a run or picking the right entrypoint."
}

Start a run

All entrypoints run via uv run <command> and accept TOML configs via @ path/to.toml plus CLI overrides.

Run directories

output_dir (default outputs) groups related runs; each run writes all its artifacts (logs, configs, checkpoints, weights, rollouts) to its own run directory <output_dir>/<run_name>. run.name auto-generates as <envs>--<model>--<short-id> (SFT: <dataset>--<model>--<short-id>), so every launch gets a fresh, readable run directory; run.dir overrides the directory leaf when it should differ from the name. Pass --run.name <name> to make the run directory predictable — required to resume the run later (--resume, or --resume.step N, reuses the named run directory; without [ckpt] it loads but saves no new checkpoints). Launching into a run directory that already contains artifacts fails unless resuming or --clean is set (which wipes only that run directory).

Config system at a glance

pydantic-config — Pydantic-based TOML + CLI loader. Highlights (see the configs skill for full mechanics):

  • Config files via @ path (TOML / YAML / JSON); CLI args layer on top, deep-merged with class defaults.
  • Nested groups via dotted CLI paths — kebab-case on the CLI, snake_case in TOML.
  • Bool toggles: bare --flag enables, --no-flag disables (nested too).
  • Lists: space-separated or JSON literal. Dicts: JSON literal, deep-merged with file values.
  • Optional sub-configs (WandbMonitorConfig | None): bare --monitors.wandb enables defaults; --monitors.wandb @ wandb.toml enables from a file; --no-monitors.wandb disables.
  • Discriminated unions are switched by the type tag (e.g. --optimizer.type muon).
  • Validation aliases let renamed fields keep working; legacy keys can be remapped in a model_validator(mode="before").
  • Auto-generated --help panels from Field(description=...) or PEP 224 docstrings.
  • Friendly errors: required-field boxes, validator errors point at the offending flag, unknown flags get a "did you mean" hint.
  • State-only optimizer offload remains enabled by default with model.optim_cpu_offload = true.
  • For gradients, FP32 masters, optimizer state, and optimizer-in-backward CPU execution, set model.optim_cpu_offload = false and model.full_offload = true. This mode uses the native CPU optimizer kernel, only supports AdamW and SignSGD (SignSGD is stateless and halves the host RAM footprint), and disables gradient clipping. Use a [model.full_offload] table only to select the Torch debugging backend or disable NUMA binding.

rl — RL training

Launches inference server, orchestrator, and trainer as subprocesses.

uv run rl @ examples/basic/reverse-text/rl.toml
uv run rl @ examples/basic/reverse-text/rl.toml --dry-run                                # write scripts, don't run
  • Config: RLConfig (packages/prime-rl-configs/src/prime_rl/configs/rl.py)
  • Entrypoint: src/prime_rl/entrypoints/rl.py
  • SLURM: single- and multi-node
  • Environment packages: before launching a config with a non-core verifier env id, verify the package imports under uv run (for example uv run python -c "import importlib.util; print(importlib.util.find_spec('r2e_gym'))"). If a local env exists under deps/prime-envs/environments/ or deps/verifiers/environments/ but does not import, install the env workspace members with uv sync --all-packages (all) or uv sync --package prime-rl --package <env> (one) — they're auto-discovered, no pyproject.toml edit needed.

sft — SFT training

Launches torchrun internally — never call torchrun directly.

uv run sft @ examples/basic/reverse-text/sft.toml
uv run sft @ examples/basic/reverse-text/sft.toml --slurm
uv run sft @ examples/basic/reverse-text/sft.toml --dry-run
  • Config: SFTConfig (packages/prime-rl-configs/src/prime_rl/configs/sft.py)
  • Entrypoint: src/prime_rl/entrypoints/sft.py
  • SLURM: single- and multi-node

inference — vLLM server

OpenAI-compatible API plus prime-rl custom endpoints (/update_weights, /load_lora_adapter, /init_broadcaster). Always use this entrypoint — never vllm serve directly. It starts a vllm-router on server.port (default 8000, the client-facing URL) fronting the engine on backend_port (default 8100); admin endpoints must target the engine port directly.

uv run inference --vllm.model Qwen/Qwen3-0.6B
uv run inference --vllm.model Qwen/Qwen3-0.6B --vllm.enforce-eager

Smoke checks:

curl http://<host>:<port>/health
curl http://<host>:<port>/v1/models
curl http://localhost:8000/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{"model": "Qwen/Qwen3-0.6B", "messages": [{"role": "user", "content": "Hi"}], "max_tokens": 50}'
  • Config: InferenceConfig (packages/prime-rl-configs/src/prime_rl/configs/inference.py)
  • Entrypoint: src/prime_rl/entrypoints/inference.py
  • SLURM: single-node, multi-node, and disaggregated deployments

Summary

Command Purpose Typical use
rl Full RL pipeline Production RL training
sft Supervised fine-tuning SFT and hard-distill
inference vLLM server Standalone serving / debugging

Key paths

  • src/prime_rl/entrypoints/rl, sft, inference (+ trainer, orchestrator for direct launches)
  • packages/prime-rl-configs/src/prime_rl/configs/ — all config classes
  • configs/debug/ — minimal debug configs
  • examples/ — full example configs (e.g. reverse-text/)

Version History

  • bfb0fe3 Current 2026-08-20 05:54

    新增SignSGD优化器在CPU全卸载模式下的支持,优化了每层优化器步骤的CUDA流重叠以节省显存,并更新了相关文档。

  • 3b22dd9 2026-07-25 11:27

Same Skill Collection

skills/configs/SKILL.md
skills/install/SKILL.md
skills/release/SKILL.md
skills/training/monitor-run/SKILL.md
skills/training/SKILL.md

Metadata

Files
0
Version
bfb0fe3
Hash
82fac252
Indexed
2026-07-25 11:27

Главная - Вики-сайт
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-21 04:49
浙ICP备14020137号-1 $Гость$