ray-train_skill
- TeX
5.2k
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill orchestra-research/ai-research-skills --skill ray-train- SKILL.md10.4 KB
Overview
This skill orchestrates distributed model training across clusters using Ray Train. It scales PyTorch, TensorFlow, and HuggingFace workloads from a laptop up to thousands of nodes and includes built-in hyperparameter tuning, fault tolerance, and elastic scaling. Use it to run large-scale training or distributed hyperparameter sweeps with minimal code changes.
How this skill works
Ray Train wraps your existing training function and manages cluster coordination, GPU/CPU allocation, checkpointing, metric aggregation, and worker lifecycle. You provide a train function (PyTorch/TF/HuggingFace) and a ScalingConfig; Ray launches workers, prepares models and data loaders for distributed execution, and reports metrics and checkpoints back to the trainer. It integrates with Ray Tune for distributed hyperparameter search and supports automatic resume and worker restart on failures.
When to use it
- Training models across multiple machines (multi-node clusters).
- Running large distributed hyperparameter sweeps at scale.
- Needing fault tolerance and automatic checkpoint resume.
- Elastic workloads that may add or remove nodes during training.
- Migrating single-GPU code to many GPUs with minimal changes.
Best practices
- Keep your core training loop unchanged and call train.torch.prepare_model/prepare_data_loader for portability.
- Use checkpoints frequently for long runs and enable resume logic to recover from failures.
- Profile data loading separately; increase dataloader num_workers or use faster storage if IO-bound.
- Start with smaller num_workers locally, then scale to multi-node to validate correctness first.
- Use Ray Tune with sensible search spaces and early-stopping schedulers (e.g., ASHA) to reduce cost.
Example use cases
- Scale a PyTorch training loop from 1 GPU to 32+ GPUs across multiple nodes with the same code.
- Run distributed HuggingFace Transformer fine-tuning across 16 GPUs using TransformersTrainer.
- Execute a 20-trial hyperparameter search with Ray Tune and ASHAScheduler to find optimal lr and batch size.
- Resume a long pretraining job automatically after node failures using Checkpoint and auto-restart.
- Deploy multi-node training on Kubernetes, SLURM, or cloud VMs with Ray autoscaling.
FAQ
Save regular checkpoints via train.report with a Checkpoint and in your train function check train.get_checkpoint() to restore model and optimizer state before continuing.
When should I prefer Ray Train over alternatives?
Choose Ray Train when you need easy multi-node orchestration, integrated large-scale hyperparameter tuning, fault tolerance, or elastic scaling. For single-node multi-GPU or simpler APIs, consider Accelerate or PyTorch Lightning.