Deploy and run ML experiments on local or remote GPU servers. Use when user says "run experiment", "deploy to server", "跑实验", or needs to launch training jobs.
Installer avec Codex ou Claude Copiez ce prompt, collez-le dans Codex, Claude ou un autre assistant, puis laissez-le vérifier la page du skill et l'installer pour vous.
Une commande directe contourne le prompt de vérification. Examinez la source avant de l'exécuter.
Deploy and run ML experiments on local or remote GPU servers. Use when user says "run experiment", "deploy to server", "跑实验", or needs to launch training jobs.
argument-hint
[experiment-description]
allowed-tools
Bash(*), Read, Grep, Glob, Edit, Write, Agent
Run Experiment
Deploy and run ML experiment: $ARGUMENTS
Workflow
Step 1: Detect Environment
Read the project's CLAUDE.md to determine the experiment environment:
Local GPU (gpu: local): Look for local CUDA/MPS setup info
Remote server (gpu: remote): Look for SSH alias, conda env, code directory
Vast.ai (gpu: vast): Check for vast-instances.json at project root — if a running instance exists, use it. Also check CLAUDE.md for a ## Vast.ai section.
Vast.ai detection priority:
If CLAUDE.md has gpu: vast or a ## Vast.ai section:
If vast-instances.json exists and has a running instance → use that instance
If no running instance → call /vast-gpu provision which analyzes the task, presents cost-optimized GPU options, and rents the user's choice
If no server info is found in CLAUDE.md, ask the user.
(Read ssh_host and ssh_port from vast-instances.json, or run vastai ssh-url <INSTANCE_ID> which returns ssh://root@HOST:PORT)
Local:
nvidia-smi --query-gpu=index,memory.used,memory.total --format=csv,noheader
# or for Mac MPS:
python -c "import torch; print('MPS available:', torch.backends.mps.is_available())"
Free GPU = memory.used < 500 MiB.
Step 3: Sync Code (Remote Only)
Check the project's CLAUDE.md for a code_sync setting. If not specified, default to rsync.
Option A: rsync (default)
Only sync necessary files — NOT data, checkpoints, or large files:
After launching, update the experiment field in vast-instances.json for this instance.
Local
# Linux with CUDA
CUDA_VISIBLE_DEVICES=<gpu_id> python <script> <args> 2>&1 | tee <log_file>
# Mac with MPS (PyTorch uses MPS automatically)
python <script> <args> 2>&1 | tee <log_file>
For local long-running jobs, use run_in_background: true to keep the conversation responsive.
Step 5: Verify Launch
Remote (SSH):
ssh <server> "screen -ls"
Remote (Vast.ai):
ssh -p <PORT> root@<HOST> "screen -ls"
Local:
Check process is running and GPU is allocated.
Step 6: Feishu Notification (if configured)
After deployment is verified, check ~/.claude/feishu.json:
Send experiment_done notification: which experiments launched, which GPUs, estimated time
If config absent or mode "off": skip entirely (no-op)
This ensures users are never billed for idle instances. When auto_destroy: true (the default), the full lifecycle is automatic: rent → setup → run → collect → destroy.
Key Rules
ALWAYS check GPU availability first — never blindly assign GPUs
Each experiment gets its own screen session + GPU (remote) or background process (local)
Use tee to save logs for later inspection
Run deployment commands with run_in_background: true to keep conversation responsive
Report back: which GPU, which screen/process, what command, estimated time
If multiple experiments, launch them in parallel on different GPUs
Vast.ai cost awareness: When using gpu: vast, always report the running cost. If auto_destroy: true, destroy the instance as soon as all experiments on it complete
CLAUDE.md Example
Users should add their server info to their project's CLAUDE.md:
## Remote Server- gpu: remote # use pre-configured SSH server
- SSH: `ssh my-gpu-server`- GPU: 4x A100 (80GB each)
- Conda: `eval "$(/opt/conda/bin/conda shell.bash hook)" && conda activate research`- Code dir: `/home/user/experiments/`- code_sync: rsync # default. Or set to "git" for git push/pull workflow
- wandb: false # set to "true" to auto-add W&B logging to experiment scripts
- wandb_project: my-project # W&B project name (required if wandb: true)
- wandb_entity: my-team # W&B team/user (optional, uses default if omitted)
## Vast.ai
- gpu: vast # rent on-demand GPU from vast.ai
- auto_destroy: true # auto-destroy after experiment completes (default: true)
- max_budget: 5.00 # optional: max total $ to spend per experiment
## Local Environment
- gpu: local # use local GPU
- Mac MPS / Linux CUDA
- Conda env: `ml` (Python 3.10 + PyTorch)
Vast.ai setup: Run pip install vastai && vastai set api-key YOUR_KEY. Upload your SSH public key at https://cloud.vast.ai/manage-keys/. Set gpu: vast in your CLAUDE.md — /run-experiment will automatically rent an instance, run the experiment, and destroy it when done.
W&B setup: Run wandb login on your server once (or set WANDB_API_KEY env var). The skill reads project/entity from CLAUDE.md and adds wandb.init() + wandb.log() to your training scripts automatically. Dashboard: https://wandb.ai/<entity>/<project>.