ray-train
Agent skill fromOrchestra-Research/AI-Research-SKILLs
Distributed training orchestration across clusters. Scales PyTorch/TensorFlow/HuggingFace from laptop to 1000s of nodes. Built-in hyperparameter tuning with Ray Tune, fault tolerance, elastic scaling. Use when training massive models across multiple machines or running distributed hyperparameter sweeps.
How to install ray-train
install ray-train
# install the AI-Research-SKILLs pack with the skills CLI
npx skills add Orchestra-Research/AI-Research-SKILLs# or add only this skill to Claude Code: copy the folder
08-distributed-training/ray-train/
# into
~/.claude/skills/ray-train/ (all projects)
.claude/skills/ray-train/ (one project)
1# Ray Train - Distributed Training Orchestration23## Quick start45Ray Train scales machine learning training from single GPU to multi-node clusters with minimal code changes.67**Installation**:8```bash9pip install -U "ray[train]"10```1112**Basic PyTorch training** (single node):1314```python15import ray16from ray import train17from ray.train import ScalingConfig18from ray.train.torch import TorchTrainer19import torch20import torch.nn as nn2122# Define training function23def train_func(config):24 # Your normal PyTorch code25 model = nn.Linear(10, 1)26 optimizer = torch.optim.SGD(model.parameters(), lr=0.01)2728 # Prepare for distributed (Ray handles device placement)29 model = train.torch.prepare_model(model)3031 for epoch in range(10):32 # Your training loop33 output = model(torch.randn(32, 10))34 loss = output.sum()35 loss.backward()36 optimizer.step()37 optimizer.zero_grad()3839 # Report metrics (logged automatically)40 train.report({"loss": loss.item(), "epoch": epoch})4142# Run distributed training43trainer = TorchTrainer(44 train_func,45 scaling_config=ScalingConfig(46 num_workers=4, # 4 GPUs/workers47 use_gpu=True48 )49)5051result = trainer.fit()52print(f"Final loss: {result.metrics['loss']}")53```5455**That's it!** Ray handles:56- Distributed coordination57- GPU allocation58- Fault tolerance59- Checkpointing60- Metric aggregation6162## Common workflows6364### Workflow 1: Scale existing PyTorch code65…
Excerpt shown under the repository's MIT license.
