Remote Server
【免费下载链接】Auto-claude-code-research-in-sleepARIS ⚔️ (Auto-Research-In-Sleep) — Lightweight Markdown-only skills for autonomous ML research: cross-model review loops, idea discovery, and experiment automation. No framework, no lock-in — works with Claude Code, Codex, OpenClaw, or any LLM agent.项目地址: https://gitcode.com/gh_mirrors/au/Auto-claude-code-research-in-sleep
- gpu: remote
- SSH:
ssh my-gpu-server(key-based auth, no password) - GPU: 4x A100
- Conda env:
research(Python 3.10 + PyTorch) - Activate:
eval "$(/opt/conda/bin/conda shell.bash hook)" && conda activate research - Code directory:
/home/user/experiments/ - Use
screenfor background jobs:screen -dmS exp0 bash -c '...'
关键字段说明: - **SSH**:必须是基于密钥的免密登录,ARIS 会在无人工干预下反复发起 SSH 会话,密码登录会阻塞自动流程。先在本地验证:`ssh my-gpu-server "echo ok"`。 - **Activate**:环境激活命令必须是单行可执行的形式。ARIS 部署时会把它拼进 `screen` 后台会话,因此必须形如 `eval "$(conda shell.bash hook)" && conda activate research`,不要依赖交互式 shell 的登录脚本。 - **Code directory**:实验代码的远端落地目录,`run-experiment` 的代码同步步骤以此为目的地。 - **Use `screen`**:ARIS README 默认使用 `screen` 托管后台任务;若你偏好 `tmux`,也可写 `tmux new -d -s exp0 'bash -c "..."'`(见 [SETUP_GUIDE.md](https://link.gitcode.com/i/79bc8319cbe904554670cb38636919b9) 4.2 节)。两种方式 `run-experiment` 均可配合验证。 ### 部署链路(源码视角) [run-experiment](https://link.gitcode.com/i/0aac7b3a598f82fc5472f8f8853b7a64) 检测到 `gpu: remote` 后按以下步骤执行: 1. **环境检测**:读取 `CLAUDE.md` 获取 SSH 别名、conda env、代码目录。 2. **Pre-flight 检查**:先查 GPU 是否空闲(空闲判定为 `memory.used < 500 MiB`): ```bash ssh <server> nvidia-smi --query-gpu=index,memory.used,memory.total --format=csv,noheader同步代码:默认用
rsync只同步必要源码,排除数据、checkpoint 和大文件:rsync -avz --include='*.py' --exclude='*' <local_src>/ <server>:<remote_dst>/若
CLAUDE.md设置了code_sync: git,则改为本地git push+ 远端git pull。部署:为每个实验创建独立的 screen 会话并绑定 GPU:
ssh <server> "screen -dmS <exp_name> bash -c '\ eval \"\$(<conda_path>/conda shell.bash hook)\" && \ conda activate <env> && \ CUDA_VISIBLE_DEVICES=<gpu_id> python <script> <args> 2>&1 | tee <log_file>'"验证启动:
ssh <server> "screen -ls"确认会话存在。
Option B:本地 GPU(gpu: local)
如果本机就是 GPU 服务器(无需 SSH),在CLAUDE.md中添加:
## GPU Environment - gpu: local - This machine has direct GPU access (no SSH needed) - GPU: 4x A100 80GB - Experiment environment: `YOUR_CONDA_ENV` (Python 3.x + PyTorch) - Activate before any Python command: `The command to activate your experiment environment` (uv, conda, etc.) - Code directory: `/home/YOUR_USERNAME/YOUR_CODE_DIRECTORY/`源码中对应的执行路径(run-experiment)不再走 SSH 与 rsync:pre-flight 直接用本机nvidia-smi查询,Mac 环境则检查torch.backends.mps.is_available();部署命令直接在前台执行:
# Linux with CUDA CUDA_VISIBLE_DEVICES=<gpu_id> python <script> <args> 2>&1 | tee <log_file>长任务可通过run_in_background: true保持会话响应。注意本地模式同样遵循 "ALWAYS check GPU availability first" 的铁律——绝不盲目分配 GPU。
Option C:Vast.ai 按需租用 GPU(gpu: vast)
没有 GPU?ARIS 支持从 Vast.ai 按需租用。其核心工作方式是:分析训练任务(模型大小、数据集、预估时长)→ 在市场上搜索最便宜的合适 GPU → 按总成本(而非单纯 $/hr)排序 → 自动完成 租用 → 运行 → 收集结果 → 销毁。
最小配置
在CLAUDE.md中写入:
## Vast.ai - gpu: vast # rent on-demand GPU from vast.ai - auto_destroy: true # auto-destroy after experiment completes (default) - max_budget: 5.00 # optional: warn if estimated cost exceeds thisauto_destroy: true:实验结束后自动销毁实例(默认值)。设为false则保留实例以便 SSH 登录检查。max_budget: 5.00:可选。当 ARIS 的成本估算超过该值时警告并确认,不会硬性阻止租用。- 可选进阶字段(见 vast-gpu):
image: pytorch/pytorch:2.1.0-cuda12.1-cudnn8-devel可覆盖默认 Docker 镜像。
前置条件(5 步)
完整流程见 docs/integrations/VAST_GPU_GUIDE.md:
创建 Vast.ai 账户并绑定支付方式(信用卡或加密货币)。
安装
vastaiCLI(要求 Python ≥ 3.10;旧版本 Python 请用conda create/pyenv/uv venv建虚拟环境):pip install vastai设置 API Key(从 https://cloud.vast.ai/cli/ 获取):
vastai set api-key YOUR_API_KEY上传 SSH 公钥到 https://cloud.vast.ai/manage-keys/——这一步必须在租用任何实例之前完成,因为密钥在实例创建时就被固化;没有公钥时先生成:
ssh-keygen -t ed25519 -C "your_email@example.com" cat ~/.ssh/id_ed25519.pub # copy this to Vast.ai验证环境(测试搜索可用):
vastai search offers 'gpu_ram>=24 reliability>0.95' -o 'dph+' --limit 3
成本排序与选择
ARIS 分析任务(VRAM、训练时长、GPU 数量、磁盘、CUDA 版本)后,呈现按预估总成本排序的选项表:
| # | GPU | VRAM | $/hr | Est. Hours | Est. Total | Offer ID | |---|-----------|-------|-------|------------|------------|----------| | 1 | RTX 4090 | 24 GB | $0.28 | ~4h | ~$1.12 | 6995713 | ← best value | 2 | A100 SXM | 80 GB | $0.95 | ~2h | ~$1.90 | 7023456 | ← fastest选序号后 ARIS 自动完成后续全部工作。任务需求估算的规则(vast-gpu):模型参数 ×4 字节(fp32)或 ×2(fp16/bf16)加优化器状态与激活值估算最小 VRAM,经验值如 7B 模型 ≈ 16 GB(fp16)、13B ≈ 28 GB;预估时长加 30% 缓冲;默认磁盘 50 GB、CUDA 12.1。展示时必须给出总成本($/hr × 预估小时数),因为 "$0.90/hr 跑 2h($1.80)比 $0.30/hr 跑 8h($2.40)更便宜"。
实例状态文件
所有活跃的 Vast.ai 实例记录在项目根目录vast-instances.json,它是run-experiment与monitor-experiment连接实例的"唯一事实来源":
[ { "instance_id": 33799165, "offer_id": 25831376, "gpu_name": "RTX_3060", "num_gpus": 1, "dph": 0.0414, "ssh_url": "ssh://root@1.208.108.242:58955", "ssh_host": "1.208.108.242", "ssh_port": 58955, "created_at": "2026-03-29T21:12:00Z", "status": "running", "experiment": "exp01_baseline", "estimated_hours": 4.0, "estimated_cost": 0.17 } ]手动控制命令
在/run-experiment流程之外,可用专用技能/vast-gpu手动管理:
/vast-gpu # interactive — search, pick, rent /vast-gpu list # list your current rented instances /vast-gpu destroy <instance-id> # tear down manually【免费下载链接】Auto-claude-code-research-in-sleepARIS ⚔️ (Auto-Research-In-Sleep) — Lightweight Markdown-only skills for autonomous ML research: cross-model review loops, idea discovery, and experiment automation. No framework, no lock-in — works with Claude Code, Codex, OpenClaw, or any LLM agent.项目地址: https://gitcode.com/gh_mirrors/au/Auto-claude-code-research-in-sleep
创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考