[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7FDB42BFSZRM2G9J32V8PNN":3,"skill-same:01M7FDB42BFSZRM2G9J32V8PNN":48},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":26,"commitSha":27,"skillDirectory":28,"forksCount":29,"repositoryHtmlUrl":30,"repositoryHomepageUrl":6,"ownerHtmlUrl":31,"ownerBlogUrl":6,"ownerDescription":32,"updatedAt":33,"install":34,"resources":47},"01M7FDB42BFSZRM2G9J32V8PNN","run-experiment",null,"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.","CZX-LBJ\u002Fdeepseek-science","CZX-LBJ","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F204594689?v=4","01M7FC59WQ9PFXT04MKGJDCFFT","czx","01M7FC59XB2GW0BKWN9JTDBQS7",1,"MIT","https:\u002F\u002Fgithub.com\u002FCZX-LBJ\u002Fdeepseek-science\u002Fblob\u002Fmain\u002Fpackages\u002Fskill\u002Fskill-science\u002Fassets\u002Fsources\u002Faris\u002Fskills\u002Frun-experiment\u002FSKILL.md",[],[],"2026-11-16 10:05:34",false,"---\nname: run-experiment\ndescription: 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.\nargument-hint: \"[experiment-description]\"\nallowed-tools: Bash(*), Read, Grep, Glob, Edit, Write, Skill(serverless-modal)\n---\n\n# Run Experiment\n\nDeploy and run ML experiment: $ARGUMENTS\n\n## Workflow\n\n### Step 1: Detect Environment\n\nRead the project's `CLAUDE.md` to determine the experiment environment:\n\n- **Local GPU** (`gpu: local`): Look for local CUDA\u002FMPS setup info\n- **Remote server** (`gpu: remote`): Look for SSH alias, conda env, code directory\n- **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.\n- **Modal** (`gpu: modal`): Serverless GPU via Modal. No SSH, no Docker, auto scale-to-zero. Delegate to `\u002Fserverless-modal`.\n\n**Modal detection:** If `CLAUDE.md` has `gpu: modal` or a `## Modal` section, the entire deployment is handled by `\u002Fserverless-modal`. Jump to **Step 4: Deploy (Modal)** — Steps 2-3 are not needed (Modal handles code sync and GPU allocation automatically).\n\n**Environment contract** (`..\u002Fshared-references\u002Fcompute-env-contract.md`): before\nbuilding or trusting any environment, read the provider's env ledger\n(`.aris\u002Fcompute\u002F\u003Cprovider>.md`) — an unchanged spec hash means warm-reuse, a\nchanged one means rebuild. New env → write the declarative spec first, render it\nfor this provider's shape, and never declare it ready on import-success alone:\nrun the seeded kernel witness, and after any rebuild\u002Fdoc edit run the\nagent-follows-doc pass (a fresh subagent executes the documented invocation\nverbatim and reports doc-vs-reality divergence).\n\n**Vast.ai detection priority:**\n1. If `CLAUDE.md` has `gpu: vast` or a `## Vast.ai` section:\n   - If `vast-instances.json` exists and has a running instance → use that instance\n   - If no running instance → call `\u002Fvast-gpu provision` which analyzes the task, presents cost-optimized GPU options, and rents the user's choice\n2. If no server info is found in `CLAUDE.md`, ask the user.\n\n### Step 2: Pre-flight Check\n\nCheck GPU availability on the target machine:\n\n**Remote (SSH):**\n```bash\nssh \u003Cserver> nvidia-smi --query-gpu=index,memory.used,memory.total --format=csv,noheader\n```\n\n**Remote (Vast.ai):**\n```bash\nssh -p \u003CPORT> root@\u003CHOST> nvidia-smi --query-gpu=index,memory.used,memory.total --format=csv,noheader\n```\n(Read `ssh_host` and `ssh_port` from `vast-instances.json`, or run `vastai ssh-url \u003CINSTANCE_ID>` which returns `ssh:\u002F\u002Froot@HOST:PORT`)\n\n**Local:**\n```bash\nnvidia-smi --query-gpu=index,memory.used,memory.total --format=csv,noheader\n# or for Mac MPS:\npython -c \"import torch; print('MPS available:', torch.backends.mps.is_available())\"\n```\n\nFree GPU = memory.used \u003C 500 MiB.\n\n### Step 3: Sync Code (Remote Only)\n\nCheck the project's `CLAUDE.md` for a `code_sync` setting. If not specified, default to `rsync`.\n\n#### Option A: rsync (default)\n\nOnly sync necessary files — NOT data, checkpoints, or large files:\n```bash\nrsync -avz --include='*.py' --exclude='*' \u003Clocal_src>\u002F \u003Cserver>:\u003Cremote_dst>\u002F\n```\n\n#### Option B: git (when `code_sync: git` is set in CLAUDE.md)\n\nPush local changes to remote repo, then pull on the server:\n```bash\n# 1. Push from local\ngit add -A && git commit -m \"sync: experiment deployment\" && git push\n\n# 2. Pull on server\nssh \u003Cserver> \"cd \u003Cremote_dst> && git pull\"\n```\n\nBenefits: version-tracked, multi-server sync with one push, no rsync include\u002Fexclude rules needed.\n\n#### Option C: Vast.ai instance\n\nSync code to the vast.ai instance (always rsync, code dir is `\u002Fworkspace\u002Fproject\u002F`):\n```bash\nrsync -avz -e \"ssh -p \u003CPORT>\" \\\n  --include='*.py' --include='*.yaml' --include='*.yml' --include='*.json' \\\n  --include='*.txt' --include='*.sh' --include='*\u002F' \\\n  --exclude='*.pt' --exclude='*.pth' --exclude='*.ckpt' \\\n  --exclude='__pycache__' --exclude='.git' --exclude='data\u002F' \\\n  --exclude='wandb\u002F' --exclude='outputs\u002F' \\\n  .\u002F root@\u003CHOST>:\u002Fworkspace\u002Fproject\u002F\n```\n\nInstall dependencies per the env contract (ordered phases — pins first, one\n`pip install` per phase; see `..\u002Fshared-references\u002Fcompute-env-contract.md`):\n```bash\nssh -p \u003CPORT> root@\u003CHOST> \"pip install -q torch==\u003Cpinned>\"       # phase 1: pins\nssh -p \u003CPORT> root@\u003CHOST> \"pip install -q \u003Cremaining packages>\"  # phase 2+\n```\nLegacy fallback — `requirements.txt` only, no env spec: install as one phase,\nand treat any version fight as the signal to convert to ordered phases:\n```bash\nscp -P \u003CPORT> requirements.txt root@\u003CHOST>:\u002Fworkspace\u002F\nssh -p \u003CPORT> root@\u003CHOST> \"pip install -q -r \u002Fworkspace\u002Frequirements.txt\"\n```\n\n### Step 3.5: W&B Integration (when `wandb: true` in CLAUDE.md)\n\n**Skip this step entirely if `wandb` is not set or is `false` in CLAUDE.md.**\n\nBefore deploying, ensure the experiment scripts have W&B logging:\n\n1. **Check if wandb is already in the script** — look for `import wandb` or `wandb.init`. If present, skip to Step 4.\n\n2. **If not present, add W&B logging** to the training script:\n   ```python\n   import wandb\n   wandb.init(project=WANDB_PROJECT, name=EXP_NAME, config={...hyperparams...})\n\n   # Inside training loop:\n   wandb.log({\"train\u002Floss\": loss, \"train\u002Flr\": lr, \"step\": step})\n\n   # After eval:\n   wandb.log({\"eval\u002Floss\": eval_loss, \"eval\u002Fppl\": ppl, \"eval\u002Faccuracy\": acc})\n\n   # At end:\n   wandb.finish()\n   ```\n\n3. **Metrics to log** (add whichever apply to the experiment):\n   - `train\u002Floss` — training loss per step\n   - `train\u002Flr` — learning rate\n   - `eval\u002Floss`, `eval\u002Fppl`, `eval\u002Faccuracy` — eval metrics per epoch\n   - `gpu\u002Fmemory_used` — GPU memory (via `torch.cuda.max_memory_allocated()`)\n   - `speed\u002Fsamples_per_sec` — throughput\n   - Any custom metrics the experiment already computes\n\n4. **Verify wandb login on the target machine:**\n   ```bash\n   ssh \u003Cserver> \"wandb status\"  # should show logged in\n   # If not logged in:\n   ssh \u003Cserver> \"wandb login \u003CWANDB_API_KEY>\"\n   ```\n\n> The W&B project name and API key come from `CLAUDE.md` (see example below). The experiment name is auto-generated from the script name + timestamp.\n\n### Step 4: Deploy\n\n#### Remote (via SSH + screen)\n\nFor each experiment, create a dedicated screen session with GPU binding:\n```bash\nssh \u003Cserver> \"screen -dmS \u003Cexp_name> bash -c '\\\n  eval \\\"\\$(\u003Cconda_path>\u002Fconda shell.bash hook)\\\" && \\\n  conda activate \u003Cenv> && \\\n  CUDA_VISIBLE_DEVICES=\u003Cgpu_id> python \u003Cscript> \u003Cargs> 2>&1 | tee \u003Clog_file>'\"\n```\n\n#### Vast.ai instance\n\nNo conda needed — the Docker image has the environment. Use `\u002Fworkspace\u002Fproject\u002F` as working dir:\n```bash\nssh -p \u003CPORT> root@\u003CHOST> \"screen -dmS \u003Cexp_name> bash -c '\\\n  cd \u002Fworkspace\u002Fproject && \\\n  CUDA_VISIBLE_DEVICES=\u003Cgpu_id> python \u003Cscript> \u003Cargs> 2>&1 | tee \u002Fworkspace\u002F\u003Clog_file>'\"\n```\n\nAfter launching, update the `experiment` field in `vast-instances.json` for this instance.\n\n#### Modal (serverless)\n\nWhen `gpu: modal` is detected, delegate to `\u002Fserverless-modal`:\n\n1. **Analyze task** — determine VRAM needs, choose GPU, estimate cost\n2. **Generate launcher** — create a `modal_launcher.py` that wraps the training script using `modal.Mount.from_local_dir` for code and `modal.Volume` for results\n3. **Run** — `modal run modal_launcher.py` (runs locally, GPU executes remotely)\n4. **Collect results** — results return via Volume or stdout, no manual download needed\n\nKey Modal settings from `CLAUDE.md`:\n- `modal_gpu`: GPU override (default: auto-select based on VRAM analysis)\n- `modal_timeout`: Max seconds (default: 21600 = 6 hours)\n- `modal_volume`: Named volume for persistent results\n\nNo SSH, no code sync, no screen sessions needed. Modal handles everything.\n\n#### Local\n\n```bash\n# Linux with CUDA\nCUDA_VISIBLE_DEVICES=\u003Cgpu_id> python \u003Cscript> \u003Cargs> 2>&1 | tee \u003Clog_file>\n\n# Mac with MPS (PyTorch uses MPS automatically)\npython \u003Cscript> \u003Cargs> 2>&1 | tee \u003Clog_file>\n```\n\nFor local long-running jobs, use `run_in_background: true` to keep the conversation responsive.\n\n### Step 5: Verify Launch\n\n**Remote (SSH):**\n```bash\nssh \u003Cserver> \"screen -ls\"\n```\n\n**Remote (Vast.ai):**\n```bash\nssh -p \u003CPORT> root@\u003CHOST> \"screen -ls\"\n```\n\n**Modal:**\n```bash\nmodal app list         # Check app is running\nmodal app logs \u003Capp>   # Stream logs\n```\n\n**Local:**\nCheck process is running and GPU is allocated.\n\n### Step 6: Feishu Notification (if configured)\n\nAfter deployment is verified, check `~\u002F.claude\u002Ffeishu.json`:\n- Send `experiment_done` notification: which experiments launched, which GPUs, estimated time\n- If config absent or mode `\"off\"`: skip entirely (no-op)\n\n### Step 7: Auto-Destroy Vast.ai Instance (when `gpu: vast` and `auto_destroy: true`)\n\n**Skip this step if not using vast.ai or `auto_destroy` is `false`.**\n\nAfter the experiment completes (detected via `\u002Fmonitor-experiment` or screen session ending):\n\n1. **Download results** from the instance:\n   ```bash\n   rsync -avz -e \"ssh -p \u003CPORT>\" root@\u003CHOST>:\u002Fworkspace\u002Fproject\u002Fresults\u002F .\u002Fresults\u002F\n   ```\n\n2. **Download logs**:\n   ```bash\n   scp -P \u003CPORT> root@\u003CHOST>:\u002Fworkspace\u002F*.log .\u002Flogs\u002F\n   ```\n\n3. **Destroy the instance** to stop billing:\n   ```bash\n   vastai destroy instance \u003CINSTANCE_ID>\n   ```\n\n4. **Update `vast-instances.json`** — mark status as `destroyed`.\n\n5. **Report cost**:\n   ```\n   Vast.ai instance \u003CID> auto-destroyed.\n   - Duration: ~X.X hours\n   - Estimated cost: ~$X.XX\n   - Results saved to: .\u002Fresults\u002F\n   ```\n\n> 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.\n\n## Key Rules\n\n- ALWAYS check GPU availability first — never blindly assign GPUs (except Modal, which manages allocation automatically)\n- Each experiment gets its own screen session + GPU (remote) or background process (local)\n- Use `tee` to save logs for later inspection\n- Run deployment commands with `run_in_background: true` to keep conversation responsive\n- Report back: which GPU, which screen\u002Fprocess, what command, estimated time\n- If multiple experiments, launch them in parallel on different GPUs\n- **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\n- **Modal cost awareness**: Always estimate and display cost before running. Modal auto-scales to zero — no idle billing, no manual cleanup\n\n## CLAUDE.md Example\n\nUsers should add their server info to their project's `CLAUDE.md`:\n\n```markdown\n## Remote Server\n- gpu: remote               # use pre-configured SSH server\n- SSH: `ssh my-gpu-server`\n- GPU: 4x A100 (80GB each)\n- Conda: `eval \"$(\u002Fopt\u002Fconda\u002Fbin\u002Fconda shell.bash hook)\" && conda activate research`\n- Code dir: `\u002Fhome\u002Fuser\u002Fexperiments\u002F`\n- code_sync: rsync          # default. Or set to \"git\" for git push\u002Fpull workflow\n- wandb: false              # set to \"true\" to auto-add W&B logging to experiment scripts\n- wandb_project: my-project # W&B project name (required if wandb: true)\n- wandb_entity: my-team     # W&B team\u002Fuser (optional, uses default if omitted)\n\n## Vast.ai\n- gpu: vast                  # rent on-demand GPU from vast.ai\n- auto_destroy: true         # auto-destroy after experiment completes (default: true)\n- max_budget: 5.00           # optional: max total $ to spend per experiment\n\n## Modal\n- gpu: modal                 # serverless GPU via Modal (no SSH, auto scale-to-zero)\n- modal_gpu: A100-80GB       # optional: override GPU selection (default: auto-select)\n- modal_timeout: 21600       # optional: max seconds (default: 6 hours)\n- modal_volume: my-results   # optional: named volume for results persistence\n\n## Local Environment\n- gpu: local                 # use local GPU\n- Mac MPS \u002F Linux CUDA\n- Conda env: `ml` (Python 3.10 + PyTorch)\n```\n\n> **Vast.ai setup**: Run `pip install vastai && vastai set api-key YOUR_KEY`. Upload your SSH public key at https:\u002F\u002Fcloud.vast.ai\u002Fmanage-keys\u002F. Set `gpu: vast` in your `CLAUDE.md` — `\u002Frun-experiment` will automatically rent an instance, run the experiment, and destroy it when done.\n\n> **Modal setup**: Run `pip install modal && modal setup`. Bind a payment method at https:\u002F\u002Fmodal.com\u002Fsettings (NEVER through CLI) to unlock the full $30\u002Fmonth free tier (without card: $5\u002Fmonth only). Set a workspace spending limit to prevent accidental charges. Set `gpu: modal` in your `CLAUDE.md` — ideal for users without a local GPU who need to debug code or run small-scale tests.\n\n> **W&B setup**: Run `wandb login` on your server once (or set `WANDB_API_KEY` env var). The skill reads project\u002Fentity from CLAUDE.md and adds `wandb.init()` + `wandb.log()` to your training scripts automatically. Dashboard: `https:\u002F\u002Fwandb.ai\u002F\u003Centity>\u002F\u003Cproject>`.\n","# Run Experiment\n\nDeploy and run ML experiment: $ARGUMENTS\n\n## Workflow\n\n### Step 1: Detect Environment\n\nRead the project's `CLAUDE.md` to determine the experiment environment:\n\n- **Local GPU** (`gpu: local`): Look for local CUDA\u002FMPS setup info\n- **Remote server** (`gpu: remote`): Look for SSH alias, conda env, code directory\n- **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.\n- **Modal** (`gpu: modal`): Serverless GPU via Modal. No SSH, no Docker, auto scale-to-zero. Delegate to `\u002Fserverless-modal`.\n\n**Modal detection:** If `CLAUDE.md` has `gpu: modal` or a `## Modal` section, the entire deployment is handled by `\u002Fserverless-modal`. Jump to **Step 4: Deploy (Modal)** — Steps 2-3 are not needed (Modal handles code sync and GPU allocation automatically).\n\n**Environment contract** (`..\u002Fshared-references\u002Fcompute-env-contract.md`): before\nbuilding or trusting any environment, read the provider's env ledger\n(`.aris\u002Fcompute\u002F\u003Cprovider>.md`) — an unchanged spec hash means warm-reuse, a\nchanged one means rebuild. New env → write the declarative spec first, render it\nfor this provider's shape, and never declare it ready on import-success alone:\nrun the seeded kernel witness, and after any rebuild\u002Fdoc edit run the\nagent-follows-doc pass (a fresh subagent executes the documented invocation\nverbatim and reports doc-vs-reality divergence).\n\n**Vast.ai detection priority:**\n1. If `CLAUDE.md` has `gpu: vast` or a `## Vast.ai` section:\n   - If `vast-instances.json` exists and has a running instance → use that instance\n   - If no running instance → call `\u002Fvast-gpu provision` which analyzes the task, presents cost-optimized GPU options, and rents the user's choice\n2. If no server info is found in `CLAUDE.md`, ask the user.\n\n### Step 2: Pre-flight Check\n\nCheck GPU availability on the target machine:\n\n**Remote (SSH):**\n```bash\nssh \u003Cserver> nvidia-smi --query-gpu=index,memory.used,memory.total --format=csv,noheader\n```\n\n**Remote (Vast.ai):**\n```bash\nssh -p \u003CPORT> root@\u003CHOST> nvidia-smi --query-gpu=index,memory.used,memory.total --format=csv,noheader\n```\n(Read `ssh_host` and `ssh_port` from `vast-instances.json`, or run `vastai ssh-url \u003CINSTANCE_ID>` which returns `ssh:\u002F\u002Froot@HOST:PORT`)\n\n**Local:**\n```bash\nnvidia-smi --query-gpu=index,memory.used,memory.total --format=csv,noheader\n# or for Mac MPS:\npython -c \"import torch; print('MPS available:', torch.backends.mps.is_available())\"\n```\n\nFree GPU = memory.used \u003C 500 MiB.\n\n### Step 3: Sync Code (Remote Only)\n\nCheck the project's `CLAUDE.md` for a `code_sync` setting. If not specified, default to `rsync`.\n\n#### Option A: rsync (default)\n\nOnly sync necessary files — NOT data, checkpoints, or large files:\n```bash\nrsync -avz --include='*.py' --exclude='*' \u003Clocal_src>\u002F \u003Cserver>:\u003Cremote_dst>\u002F\n```\n\n#### Option B: git (when `code_sync: git` is set in CLAUDE.md)\n\nPush local changes to remote repo, then pull on the server:\n```bash\n# 1. Push from local\ngit add -A && git commit -m \"sync: experiment deployment\" && git push\n\n# 2. Pull on server\nssh \u003Cserver> \"cd \u003Cremote_dst> && git pull\"\n```\n\nBenefits: version-tracked, multi-server sync with one push, no rsync include\u002Fexclude rules needed.\n\n#### Option C: Vast.ai instance\n\nSync code to the vast.ai instance (always rsync, code dir is `\u002Fworkspace\u002Fproject\u002F`):\n```bash\nrsync -avz -e \"ssh -p \u003CPORT>\" \\\n  --include='*.py' --include='*.yaml' --include='*.yml' --include='*.json' \\\n  --include='*.txt' --include='*.sh' --include='*\u002F' \\\n  --exclude='*.pt' --exclude='*.pth' --exclude='*.ckpt' \\\n  --exclude='__pycache__' --exclude='.git' --exclude='data\u002F' \\\n  --exclude='wandb\u002F' --exclude='outputs\u002F' \\\n  .\u002F root@\u003CHOST>:\u002Fworkspace\u002Fproject\u002F\n```\n\nInstall dependencies per the env contract (ordered phases — pins first, one\n`pip install` per phase; see `..\u002Fshared-references\u002Fcompute-env-contract.md`):\n```bash\nssh -p \u003CPORT> root@\u003CHOST> \"pip install -q torch==\u003Cpinned>\"       # phase 1: pins\nssh -p \u003CPORT> root@\u003CHOST> \"pip install -q \u003Cremaining packages>\"  # phase 2+\n```\nLegacy fallback — `requirements.txt` only, no env spec: install as one phase,\nand treat any version fight as the signal to convert to ordered phases:\n```bash\nscp -P \u003CPORT> requirements.txt root@\u003CHOST>:\u002Fworkspace\u002F\nssh -p \u003CPORT> root@\u003CHOST> \"pip install -q -r \u002Fworkspace\u002Frequirements.txt\"\n```\n\n### Step 3.5: W&B Integration (when `wandb: true` in CLAUDE.md)\n\n**Skip this step entirely if `wandb` is not set or is `false` in CLAUDE.md.**\n\nBefore deploying, ensure the experiment scripts have W&B logging:\n\n1. **Check if wandb is already in the script** — look for `import wandb` or `wandb.init`. If present, skip to Step 4.\n\n2. **If not present, add W&B logging** to the training script:\n   ```python\n   import wandb\n   wandb.init(project=WANDB_PROJECT, name=EXP_NAME, config={...hyperparams...})\n\n   # Inside training loop:\n   wandb.log({\"train\u002Floss\": loss, \"train\u002Flr\": lr, \"step\": step})\n\n   # After eval:\n   wandb.log({\"eval\u002Floss\": eval_loss, \"eval\u002Fppl\": ppl, \"eval\u002Faccuracy\": acc})\n\n   # At end:\n   wandb.finish()\n   ```\n\n3. **Metrics to log** (add whichever apply to the experiment):\n   - `train\u002Floss` — training loss per step\n   - `train\u002Flr` — learning rate\n   - `eval\u002Floss`, `eval\u002Fppl`, `eval\u002Faccuracy` — eval metrics per epoch\n   - `gpu\u002Fmemory_used` — GPU memory (via `torch.cuda.max_memory_allocated()`)\n   - `speed\u002Fsamples_per_sec` — throughput\n   - Any custom metrics the experiment already computes\n\n4. **Verify wandb login on the target machine:**\n   ```bash\n   ssh \u003Cserver> \"wandb status\"  # should show logged in\n   # If not logged in:\n   ssh \u003Cserver> \"wandb login \u003CWANDB_API_KEY>\"\n   ```\n\n> The W&B project name and API key come from `CLAUDE.md` (see example below). The experiment name is auto-generated from the script name + timestamp.\n\n### Step 4: Deploy\n\n#### Remote (via SSH + screen)\n\nFor each experiment, create a dedicated screen session with GPU binding:\n```bash\nssh \u003Cserver> \"screen -dmS \u003Cexp_name> bash -c '\\\n  eval \\\"\\$(\u003Cconda_path>\u002Fconda shell.bash hook)\\\" && \\\n  conda activate \u003Cenv> && \\\n  CUDA_VISIBLE_DEVICES=\u003Cgpu_id> python \u003Cscript> \u003Cargs> 2>&1 | tee \u003Clog_file>'\"\n```\n\n#### Vast.ai instance\n\nNo conda needed — the Docker image has the environment. Use `\u002Fworkspace\u002Fproject\u002F` as working dir:\n```bash\nssh -p \u003CPORT> root@\u003CHOST> \"screen -dmS \u003Cexp_name> bash -c '\\\n  cd \u002Fworkspace\u002Fproject && \\\n  CUDA_VISIBLE_DEVICES=\u003Cgpu_id> python \u003Cscript> \u003Cargs> 2>&1 | tee \u002Fworkspace\u002F\u003Clog_file>'\"\n```\n\nAfter launching, update the `experiment` field in `vast-instances.json` for this instance.\n\n#### Modal (serverless)\n\nWhen `gpu: modal` is detected, delegate to `\u002Fserverless-modal`:\n\n1. **Analyze task** — determine VRAM needs, choose GPU, estimate cost\n2. **Generate launcher** — create a `modal_launcher.py` that wraps the training script using `modal.Mount.from_local_dir` for code and `modal.Volume` for results\n3. **Run** — `modal run modal_launcher.py` (runs locally, GPU executes remotely)\n4. **Collect results** — results return via Volume or stdout, no manual download needed\n\nKey Modal settings from `CLAUDE.md`:\n- `modal_gpu`: GPU override (default: auto-select based on VRAM analysis)\n- `modal_timeout`: Max seconds (default: 21600 = 6 hours)\n- `modal_volume`: Named volume for persistent results\n\nNo SSH, no code sync, no screen sessions needed. Modal handles everything.\n\n#### Local\n\n```bash\n# Linux with CUDA\nCUDA_VISIBLE_DEVICES=\u003Cgpu_id> python \u003Cscript> \u003Cargs> 2>&1 | tee \u003Clog_file>\n\n# Mac with MPS (PyTorch uses MPS automatically)\npython \u003Cscript> \u003Cargs> 2>&1 | tee \u003Clog_file>\n```\n\nFor local long-running jobs, use `run_in_background: true` to keep the conversation responsive.\n\n### Step 5: Verify Launch\n\n**Remote (SSH):**\n```bash\nssh \u003Cserver> \"screen -ls\"\n```\n\n**Remote (Vast.ai):**\n```bash\nssh -p \u003CPORT> root@\u003CHOST> \"screen -ls\"\n```\n\n**Modal:**\n```bash\nmodal app list         # Check app is running\nmodal app logs \u003Capp>   # Stream logs\n```\n\n**Local:**\nCheck process is running and GPU is allocated.\n\n### Step 6: Feishu Notification (if configured)\n\nAfter deployment is verified, check `~\u002F.claude\u002Ffeishu.json`:\n- Send `experiment_done` notification: which experiments launched, which GPUs, estimated time\n- If config absent or mode `\"off\"`: skip entirely (no-op)\n\n### Step 7: Auto-Destroy Vast.ai Instance (when `gpu: vast` and `auto_destroy: true`)\n\n**Skip this step if not using vast.ai or `auto_destroy` is `false`.**\n\nAfter the experiment completes (detected via `\u002Fmonitor-experiment` or screen session ending):\n\n1. **Download results** from the instance:\n   ```bash\n   rsync -avz -e \"ssh -p \u003CPORT>\" root@\u003CHOST>:\u002Fworkspace\u002Fproject\u002Fresults\u002F .\u002Fresults\u002F\n   ```\n\n2. **Download logs**:\n   ```bash\n   scp -P \u003CPORT> root@\u003CHOST>:\u002Fworkspace\u002F*.log .\u002Flogs\u002F\n   ```\n\n3. **Destroy the instance** to stop billing:\n   ```bash\n   vastai destroy instance \u003CINSTANCE_ID>\n   ```\n\n4. **Update `vast-instances.json`** — mark status as `destroyed`.\n\n5. **Report cost**:\n   ```\n   Vast.ai instance \u003CID> auto-destroyed.\n   - Duration: ~X.X hours\n   - Estimated cost: ~$X.XX\n   - Results saved to: .\u002Fresults\u002F\n   ```\n\n> 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.\n\n## Key Rules\n\n- ALWAYS check GPU availability first — never blindly assign GPUs (except Modal, which manages allocation automatically)\n- Each experiment gets its own screen session + GPU (remote) or background process (local)\n- Use `tee` to save logs for later inspection\n- Run deployment commands with `run_in_background: true` to keep conversation responsive\n- Report back: which GPU, which screen\u002Fprocess, what command, estimated time\n- If multiple experiments, launch them in parallel on different GPUs\n- **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\n- **Modal cost awareness**: Always estimate and display cost before running. Modal auto-scales to zero — no idle billing, no manual cleanup\n\n## CLAUDE.md Example\n\nUsers should add their server info to their project's `CLAUDE.md`:\n\n```markdown\n## Remote Server\n- gpu: remote               # use pre-configured SSH server\n- SSH: `ssh my-gpu-server`\n- GPU: 4x A100 (80GB each)\n- Conda: `eval \"$(\u002Fopt\u002Fconda\u002Fbin\u002Fconda shell.bash hook)\" && conda activate research`\n- Code dir: `\u002Fhome\u002Fuser\u002Fexperiments\u002F`\n- code_sync: rsync          # default. Or set to \"git\" for git push\u002Fpull workflow\n- wandb: false              # set to \"true\" to auto-add W&B logging to experiment scripts\n- wandb_project: my-project # W&B project name (required if wandb: true)\n- wandb_entity: my-team     # W&B team\u002Fuser (optional, uses default if omitted)\n\n## Vast.ai\n- gpu: vast                  # rent on-demand GPU from vast.ai\n- auto_destroy: true         # auto-destroy after experiment completes (default: true)\n- max_budget: 5.00           # optional: max total $ to spend per experiment\n\n## Modal\n- gpu: modal                 # serverless GPU via Modal (no SSH, auto scale-to-zero)\n- modal_gpu: A100-80GB       # optional: override GPU selection (default: auto-select)\n- modal_timeout: 21600       # optional: max seconds (default: 6 hours)\n- modal_volume: my-results   # optional: named volume for results persistence\n\n## Local Environment\n- gpu: local                 # use local GPU\n- Mac MPS \u002F Linux CUDA\n- Conda env: `ml` (Python 3.10 + PyTorch)\n```\n\n> **Vast.ai setup**: Run `pip install vastai && vastai set api-key YOUR_KEY`. Upload your SSH public key at https:\u002F\u002Fcloud.vast.ai\u002Fmanage-keys\u002F. Set `gpu: vast` in your `CLAUDE.md` — `\u002Frun-experiment` will automatically rent an instance, run the experiment, and destroy it when done.\n\n> **Modal setup**: Run `pip install modal && modal setup`. Bind a payment method at https:\u002F\u002Fmodal.com\u002Fsettings (NEVER through CLI) to unlock the full $30\u002Fmonth free tier (without card: $5\u002Fmonth only). Set a workspace spending limit to prevent accidental charges. Set `gpu: modal` in your `CLAUDE.md` — ideal for users without a local GPU who need to debug code or run small-scale tests.\n\n> **W&B setup**: Run `wandb login` on your server once (or set `WANDB_API_KEY` env var). The skill reads project\u002Fentity from CLAUDE.md and adds `wandb.init()` + `wandb.log()` to your training scripts automatically. Dashboard: `https:\u002F\u002Fwandb.ai\u002F\u003Centity>\u002F\u003Cproject>`.\n",{"name":5,"description":7,"allowed-tools":24,"argument-hint":25},"Bash(*), Read, Grep, Glob, Edit, Write, Skill(serverless-modal)","[experiment-description]","main","18193d71ea3441d7c033dbf195b8a7c75ac96f75","packages\u002Fskill\u002Fskill-science\u002Fassets\u002Fsources\u002Faris\u002Fskills\u002Frun-experiment",0,"https:\u002F\u002Fgithub.com\u002FCZX-LBJ\u002Fdeepseek-science","https:\u002F\u002Fgithub.com\u002FCZX-LBJ","一个没事喜欢随便写点代码的小菜鸡\r\n","2026-10-22 09:48:04",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":46},[36,39,42],{"tool":37,"command":38},"npx","npx skills add CZX-LBJ\u002Fdeepseek-science --skill run-experiment",{"tool":40,"command":41},"bunx","bunx skills add CZX-LBJ\u002Fdeepseek-science --skill run-experiment",{"tool":43,"command":44},"pnpm","pnpm dlx skills add CZX-LBJ\u002Fdeepseek-science --skill run-experiment","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FCZX-LBJ\u002Fdeepseek-science\u002Fblob\u002Fmain\u002Fpackages\u002Fskill\u002Fskill-science\u002Fassets\u002Fsources\u002Faris\u002Fskills\u002Frun-experiment\u002FSKILL.md",true,[],[49,56,63,70,77,84],{"skillNo":50,"name":51,"nameZh":6,"description":52,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":53,"categories":54,"keywords":55,"publishedAt":19},"01M7FEEKSNMRMKW6JEK93PFDFY","bio-free-energy-calculations","Performs alchemical free-energy calculations including relative binding free energy (RBFE \u002F FEP+) and absolute binding free energy (ABFE) via OpenFE, FEP+, GROMACS, AMBER pmemd, and OpenMM with explicit lambda scheduling, soft-core potentials, MBAR\u002FBAR analysis, cycle-closure validation, and protocol-appropriate enhanced sampling. Compares ML alternatives (Boltz-2 affinity, DeepDock). Use when ranking analogs by binding affinity beyond docking accuracy, performing prospective lead optimization, or validating SAR predictions.","https:\u002F\u002Fgithub.com\u002FCZX-LBJ\u002Fdeepseek-science\u002Fblob\u002Fmain\u002Fpackages\u002Fskill\u002Fskill-science\u002Fassets\u002Fsources\u002Fbioskills\u002Fchemoinformatics\u002Ffree-energy-calculations\u002FSKILL.md",[],[],{"skillNo":57,"name":58,"nameZh":6,"description":59,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":60,"categories":61,"keywords":62,"publishedAt":19},"01M7FEE5CTE5QK55CEMXNNVWY9","bio-conformer-generation","Generates 3D conformer ensembles using RDKit ETKDGv3 with knowledge-enhanced distance geometry, MMFF94\u002FUFF force-field optimization, CREST + GFN2-xTB semi-empirical refinement, and macrocycle-aware torsion preferences. Provides explicit decision rules for single vs ensemble conformer use, RMSD pruning, energy windows, conformer count, and force-field choice. Use when preparing 3D ligands for docking, generating descriptor input for 3D QSAR, or sampling macrocycle\u002Fpeptide conformational ensembles.","https:\u002F\u002Fgithub.com\u002FCZX-LBJ\u002Fdeepseek-science\u002Fblob\u002Fmain\u002Fpackages\u002Fskill\u002Fskill-science\u002Fassets\u002Fsources\u002Fbioskills\u002Fchemoinformatics\u002Fconformer-generation\u002FSKILL.md",[],[],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":19},"01M7FEDNGFEMFWD1MSEDR5H7CY","bio-admet-prediction","Predicts ADMET properties using ADMETlab 3.0 (119 platform features, including 77 prediction models with modeled-endpoint uncertainty), ADMET-AI, DeepChem MolNet, and chemprop D-MPNN with explicit handling of OECD QSAR principles, applicability domain assessment, calibration, hERG\u002FCYP\u002FAMES endpoints, and PAINS \u002F Lipinski \u002F Ro5 \u002F Veber \u002F BBB druglikeness filters. Use when filtering compounds for drug-likeness, prioritizing leads by predicted safety, or building an in-house ADMET QSAR model.","https:\u002F\u002Fgithub.com\u002FCZX-LBJ\u002Fdeepseek-science\u002Fblob\u002Fmain\u002Fpackages\u002Fskill\u002Fskill-science\u002Fassets\u002Fsources\u002Fbioskills\u002Fchemoinformatics\u002Fadmet-prediction\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":19},"01M7FED69GFB54FRF7AV5066DN","writing-systems-papers","Paragraph-level structural blueprint for 10-12 page systems papers targeting OSDI, SOSP, ASPLOS, NSDI, and EuroSys. Provides page allocation, paragraph templates, and writing patterns. Use when user says \"写系统论文\", \"systems paper structure\", \"OSDI paper\", \"SOSP paper\", or wants fine-grained structural guidance for a systems conference submission.","https:\u002F\u002Fgithub.com\u002FCZX-LBJ\u002Fdeepseek-science\u002Fblob\u002Fmain\u002Fpackages\u002Fskill\u002Fskill-science\u002Fassets\u002Fsources\u002Faris\u002Fskills\u002Fwriting-systems-papers\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":19},"01M7FECVVDWZ0X0VEDTCE4B4DZ","wiki-enrich","Fill in the per-paper TODO sections of research-wiki\u002Fpapers\u002F\u003Cslug>.md pages that literature-ingest skills leave as bare scaffolds. Use when user says 'enrich wiki', 'fill paper TODOs', 'wiki body 補完', '把 paper 摘要寫進 wiki', 'research-wiki 自動填', or after a batch ingest that left papers\u002F as TODO scaffolds.","https:\u002F\u002Fgithub.com\u002FCZX-LBJ\u002Fdeepseek-science\u002Fblob\u002Fmain\u002Fpackages\u002Fskill\u002Fskill-science\u002Fassets\u002Fsources\u002Faris\u002Fskills\u002Fwiki-enrich\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":19},"01M7FECD4BCJ2MTSBDDSE3ZAJ5","web-debug-search","Search GitHub, Stack Exchange, Chinese technical communities, official documentation, and general developer web sources for software errors, compatibility problems, API usage questions, and real-world workarounds. Use for debugging and discovery only; results are not paper-citation evidence.","https:\u002F\u002Fgithub.com\u002FCZX-LBJ\u002Fdeepseek-science\u002Fblob\u002Fmain\u002Fpackages\u002Fskill\u002Fskill-science\u002Fassets\u002Fsources\u002Faris\u002Fskills\u002Fweb-debug-search\u002FSKILL.md",[],[]]