train-tune
Use Ray Train and Ray Tune for distributed training, checkpointing, hyperparameter tuning, resources, and result analysis.
- License 许可
- Apache-2.0
- 最近更新
- 2026-09-03
- Stars
- ★ 351
- Forks
- 27
01 前言 Front Matter
- name
- train-tune
- license
- Apache 2.0
- metadata
- { "disco-role": "operating" }
- description
- Use Ray Train and Ray Tune for distributed training, checkpointing, hyperparameter tuning, resources, and result analysis.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档references/api-reference.md10.6 KB
- 参考文档references/troubleshooting.md8.7 KB
- 参考文档references/workflows.md11.3 KB
- 脚本scripts/tune_train_smoke.py7.5 KB
03 SKILL.md 正文
Ray Train And Tune
Use this sub-skill when the task mentions ray.train, ScalingConfig, RunConfig, CheckpointConfig, train.report, ray.tune.Tuner, TuneConfig, tune.report, search spaces, schedulers, with_resources, ResultGrid, max_concurrent_trials, or storage_path.
Fast Routing
- Use Ray Train when the main problem is distributed training orchestration: training workers, scaling configs, checkpoints, fault tolerance, persistent storage, and training callbacks.
- Use Ray Tune when the main problem is experiment execution or hyperparameter tuning: trainables, search spaces, schedulers/search algorithms, per-trial resources, concurrency, output folders, and best-result analysis.
- Use Train and Tune together by letting Tune launch trials and letting each trial create a Train trainer or training driver; cap
max_concurrent_trialsso inner Train workers can acquire resources. - Route Ray Data input pipeline construction to
../data-pipelines/SKILL.md, Ray Core placement/resource semantics to../core-runtime/SKILL.md, trained artifact serving to../serve-deployments/SKILL.md, and RLlibAlgorithmConfigwork to../rllib-workloads/SKILL.md.
Minimal Tune Pattern
from ray import tune
def objective(config):
score = (config["width"] - 3) ** 2
tune.report({"loss": score})
results = tune.Tuner(
tune.with_resources(objective, {"cpu": 1, "gpu": 0}),
param_space={"width": tune.grid_search([2, 3, 4])},
tune_config=tune.TuneConfig(metric="loss", mode="min"),
run_config=tune.RunConfig(name="small_sweep", storage_path="./ray_results"),
).fit()
print(results.get_best_result().config)
Read Next
- Read
references/api-reference.mdfor verified signatures and how Train/Tune objects relate. - Read
references/workflows.mdfor checkpoint/storage recipes, Tune sweeps, scheduler/resource examples, ResultGrid analysis, and Train+Tune integration. - Read
references/troubleshooting.mdfor missing extras, storage mistakes, metric/mode mismatches, resource deadlocks, GPU visibility, checkpoint/report misuse, and output locations. - Run
python scripts/tune_train_smoke.py --helpfor a safe helper. Add--run-tuneonly when starting a tiny local Ray Tune run is acceptable.
Installation Notes
- Prefer narrow extras:
ray[train]for Train workloads andray[tune]for Tune workloads. Add framework extras or packages only for the selected trainer/search algorithm. - Python support for this Ray family is
>=3.10. - Avoid recommending
ray[all]by default; it can install unnecessary dependencies for unrelated Ray libraries.
04 同仓库更多 Skills
passnet-triton-opt
Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.
passnet-solve
END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.
passnet-skill
PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.
passnet-pattern-fusion
Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.
passnet-orchestrate
Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.
passnet-feedback
Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).