Skip to content
Skillpedia
Machine learning18k Β· #10615

run-experiment

What it does

This Codex version of the run experiment skill launches training jobs on the compute setup your project uses. It is for researchers who want to run code on a GPU from Codex.

When to use it

  • βœ“When you want to start a training job on a local GPU or remote server.
  • βœ“When you need to run an experiment on Vast.ai or Modal.
  • βœ“When you want an environment checked before a long run starts.

Skill link

https://github.com/wanshuiyin/Auto-claude-code-research-in-sleep/blob/main/skills/skills-codex/run-experiment/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/wanshuiyin/Auto-claude-code-research-in-sleep/blob/main/skills/skills-codex/run-experiment/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute β†’

Example of what to ask your AI

β€œI need my training experiment launched on the remote GPU server described in my project notes.”

5 new skills a week. 1 minute to read.

How it works

The agent reads the project notes to find the environment, checks the GPU, and starts the job. For a new environment, it writes a spec and runs a simple check before trusting the setup.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Run Experiment

Deploy and run ML experiment: $ARGUMENTS

Workflow

Step 1: Detect Environment

Read the project's AGENTS.md to determine the experiment environment:

  • Local GPU: Look for local CUDA/MPS setup info
  • Remote server: Look for SSH alias, conda env, code directory
  • Vast.ai instance: Look for gpu: vast, vast_instance, SSH host/port, remote path, and optional auto_destroy
  • Modal serverless: Look for gpu: modal, app/function name, image/dependency setup, and secrets

If no server info is found in AGENTS.md, ask the user.

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).

Step 2: Pre-flight Check

Check GPU availability on the target machine:

Remote:

ssh <server> nvidia-smi --query-gpu=index,memory.used,memory.total --format=csv,noheader

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 AGENTS.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 AGENTS.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

If gpu: vast is configured, treat the Vast.ai machine as a remote server with an explicit lifecycle:

  1. Verify the instance is running and reachable.
  2. Sync code to the configured remote path.
  3. Confirm data/checkpoints are already mounted or intentionally copied.
  4. Record the instance id in the launch summary for later cleanup.

Do not silently ignore a requested Vast.ai route. If Vast.ai CLI credentials or instance metadata are missing, stop and ask the user to configure them.

Step 3.5: W&B Integration (when wandb: true in AGENTS.md)

Skip this step entirely if wandb is not set or is false in AGENTS.md.

Before deploying, ensure the experiment scripts have W&B logging:

  1. Check if wandb is already in the script β€” look for import wandb or wandb.init. If present, skip to Step 4.

  2. If not present, add W&B logging to the training script:

    import wandb
    wandb.init(project=WANDB_PROJECT, name=EXP_NAME, config={...hyperparams...})
    
    # Inside training loop:
    wandb.log({"train/loss": loss, "train/lr": lr, "step": step})
    
    # After eval:
    wandb.log({"eval/loss": eval_loss, "eval/ppl": ppl, "eval/accuracy": acc})
    
    # At end:
    wandb.finish()
    
  3. Metrics to log (add whichever apply to the experiment):

    • train/loss β€” training loss per step
    • train/lr β€” learning rate
    • eval/loss, eval/ppl, eval/accuracy β€” eval metrics per epoch
    • gpu/memory_used β€” GPU memory (via torch.cuda.max_memory_allocated())
    • speed/samples_per_sec β€” throughput
    • Any custom metrics the experiment already computes
  4. Verify wandb login on the target machine:

    ssh <server> "wandb status"  # should show logged in
    # If not logged in:
    ssh <server> "wandb login <WANDB_API_KEY>"
    

The W&B project name and API key come from AGENTS.md (see example below). The experiment name is auto-generated from the script name + timestamp.

Step 4: Deploy

Remote (via SSH + screen)

For each experiment, create a dedicated screen session with GPU binding:

ssh <server> "screen -dmS <exp_name> bash -c '\
  eval \"\$(<conda_path>/co
FAQ

Where does it find the server details?

It reads the project's AGENTS.md file, and asks you if no server information is there.

Does it check the GPU first?

Yes. It runs a pre-flight check on GPU availability before starting.

What about Modal?

Modal is handled through its serverless app and dependency setup, as the skill describes.

Details

Original description by the author

Deploy and run ML experiments on local or remote GPU servers. Use when user says \"run experiment\", \"deploy to server\", \"\u8dd1\u5b9e\u9a8c\", or needs to launch training jobs.

repo: wanshuiyin/Auto-claude-code-research-in-sleep

Popularity

GitHub stars
18k
Ranking position
#10615
License
MIT
Updated
11/2/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills