run-experiment
它能做什么
这个技能在你的项目所用的计算环境中启动训练和实验任务。适合希望在 GPU 上运行代码、又不想手动设置每个平台的研究人员。
适用场景
- ✓当你想在本地 GPU 或远程服务器上启动训练任务时。
- ✓当你需要在 Vast.ai 或 Modal 无服务器 GPU 上运行实验时。
- ✓当你希望只在检查环境之后才启动运行时。
技能链接
https://github.com/wanshuiyin/Auto-claude-code-research-in-sleep/blob/main/skills/run-experiment/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“请帮我在项目设置中定义的远程 GPU 服务器上启动我的训练实验。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会读取你的项目设置,找到合适的环境,例如服务器、Vast.ai 实例或 Modal 应用。然后它会启动任务,并在长时间运行之前检查环境是否可用。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
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 forvast-instances.jsonat project root — if a running instance exists, use it. Also checkCLAUDE.mdfor a## Vast.aisection. - Modal (
gpu: modal): Serverless GPU via Modal. No SSH, no Docker, auto scale-to-zero. Delegate to/serverless-modal.
Modal detection: If CLAUDE.md has gpu: modal or a ## Modal section, the entire deployment is handled by /serverless-modal. Jump to Step 4: Deploy (Modal) — Steps 2-3 are not needed (Modal handles code sync and GPU allocation automatically).
Environment contract (../shared-references/compute-env-contract.md): before
building or trusting any environment, read the provider's env ledger
(.aris/compute/<provider>.md) — an unchanged spec hash means warm-reuse, a
changed one means rebuild. New env → write the declarative spec first, render it
for this provider's shape, and never declare it ready on import-success alone:
run the seeded kernel witness, and after any rebuild/doc edit run the
agent-follows-doc pass (a fresh subagent executes the documented invocation
verbatim and reports doc-vs-reality divergence).
Vast.ai detection priority:
- If
CLAUDE.mdhasgpu: vastor a## Vast.aisection:- If
vast-instances.jsonexists and has a running instance → use that instance - If no running instance → call
/vast-gpu provisionwhich analyzes the task, presents cost-optimized GPU options, and rents the user's choice
- If
- If no server info is found in
CLAUDE.md, ask the user.
Step 2: Pre-flight Check
Check GPU availability on the target machine:
Remote (SSH):
ssh <server> nvidia-smi --query-gpu=index,memory.used,memory.total --format=csv,noheader
Remote (Vast.ai):
ssh -p <PORT> root@<HOST> nvidia-smi --query-gpu=index,memory.used,memory.total --format=csv,noheader
(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:
rsync -avz --include='*.py' --exclude='*' <local_src>/ <server>:<remote_dst>/
Option B: git (when code_sync: git is set in CLAUDE.md)
Push local changes to remote repo, then pull on the server:
# 1. Push from local
git add -A && git commit -m "sync: experiment deployment" && git push
# 2. Pull on server
ssh <server> "cd <remote_dst> && git pull"
Benefits: version-tracked, multi-server sync with one push, no rsync include/exclude rules needed.
Option C: Vast.ai instance
Sync code to the vast.ai instance (always rsync, code dir is /workspace/project/):
rsync -avz -e "ssh -p <PORT>" \
--include='*.py' --include='*.yaml' --include='*.yml' --include='*.json' \
--include='*.txt' --include='*.sh' --include='*/' \
--exclude='*.pt' --exclude='*.pth' --exclude='*.ckpt' \
--exclude='__pycache__' --exclude='.git' --exclude='data/' \
--exclude='wandb/' --exclude='outputs/' \
./ root@<HOST>:/workspace/project/
Install dependencies per the env contract (ordered phases — pins first, one
pip install per phase; see ../shared-references/compute-env-contract.md):
ssh -p <PORT> root@<HOST> "pip install -q torch==<pinned>" # phase 1: pins
ssh -p <PORT> root@<HOST> "pip install -q <remaining packages>" # phase 2+
Legacy fallback — requirements.txt only, no env spec: install as one phase,
and treat any version fight as the signal to convert to ordered phases:
scp -P <PORT> requirements.txt root@<HOST>:/workspace/
ssh -p <PORT> root@<HOST> "pip install -q -r /workspace/requirements.txt"
Step 3.5: W&B Integration (when wandb: true in CLAUDE.md)
**Skip this step entirely if wandb is not set o
常见问题
它怎么知道该使用哪块 GPU?
它会读取你项目笔记中的环境设置,例如 local、remote、Vast.ai 或 Modal。
它会先检查环境吗?
会。该技能说明,在信任长时间任务之前,应先检查环境记录并运行一个简单的测试。
Modal 怎么办?
Modal 任务会交给无服务器的 Modal 技能处理,该技能会自动完成部署。
详情
作者的原始描述
Deploy and run ML experiments on local, remote, Vast.ai, or Modal serverless GPU. Use when user says "run experiment", "deploy to server", "跑实验", or needs to launch training jobs.
热度
- GitHub 星标
- 18k
- 排名
- #10589
- 许可证
- MIT
- 更新时间
- 2026/11/2
评论
- …
同一仓库的更多技能
ablation-planner
18k帮你的智能体为论文规划消融实验,在主要结果看起来不错之后,选出审稿人很可能会要求的测试。
alphaxiv
18k让你的智能体借助 AlphaXiv 摘要快速阅读一篇研究论文,并以完整文本或 LaTeX 源文件作为备用,只需提供 arXiv 链接或编号。
analyze-results
18k帮你的智能体分析机器学习实验结果,将各次运行与基线进行比较,并把数字整理成清晰的发现和后续步骤。
arxiv
18k让你的智能体在 arXiv 上搜索学术论文、阅读论文详情,并把 PDF 保存到你的文库中,用于某个研究主题。