agentleFS
DshamirDshamir/slm-forge/skills/forge-train/SKILL.md

forge-train

Skill1 starsChanged 6 months agoMITView on GitHub

Generates a training config YAML from manifest.plan + plan.json training_overrides, uploads to the EC2 instance, launches train.py detached via setsid + nohup, captures PID, and starts a 30-second log-sync side process to S3. Returns immediately — never blocks. Strips the v2- prefix from FORGE_ID so v2-bridged runs find the right plan.json.

We split this skill into the rules it gives an agent

2 rules. About 0 are common, 0 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈0

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Write manifest.training_runtime.* and advance to MONITOR

    line 22
  2. Very specific:

    If training_runtime.pid is set AND alive on the instance, exits 0.

    line 37

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

forge-train

When this fires

Phase position: TRAIN — after forge-bootstrap, before forge-monitor. Spends GPU time — main training spend.

What it does

  1. Resolve plan.json (strip v2- prefix from FORGE_ID for v2-bridged runs)
  2. Layer hyperparams: defaults → plan.json training_overrides → FORGE_TRAIN_* env vars
  3. Generate the training config YAML (frameworks: unsloth or huggingface-trainer)
  4. Upload config + dataset references to /workspace/ on the instance via SSM
  5. Launch nohup setsid python train.py ... detached → capture PID
  6. Spawn a side process that aws s3 sync the log file every 30 s
  7. 30 s health probe — if PID is dead by now, fail fast (early crash)
  8. Write manifest.training_runtime.* and advance to MONITOR

Inputs

  • $1 = forge-id (or v2-<run-id>)
  • manifest.plan.{base_model, regime, target_params, framework}
  • manifest.artifacts.shaped_corpus_s3
  • plan.json.training_overrides (v2 bridge — max_steps, batch, lora_r, etc.)
  • FORGE_TRAIN_* env vars (highest precedence overrides)

Outputs

  • manifest.training_runtime.{pid, log_path_s3, config_yaml_s3, framework, started_at}
  • /workspace/logs/train.log (synced every 30 s)
  • manifest.state.current_phase = MONITOR

Idempotency

If training_runtime.pid is set AND alive on the instance, exits 0.

Failure modes

ExitReasonRecoverable?
0training launched + PID alive–
1config validation failed (non-recoverable: bad plan) OR PID died within 30 s health probe (often OOM — recoverable via batch-size shrink)mixed
64no forge-id providedno

External resources

  • AWS EC2 (SSM RunCommand for setsid launch + log-sync rsync)
  • AWS S3 (config + log uploads)
  • HuggingFace model cache (instance pulls base model on first step)

Cost class

spends GPU time — main training spend window opens here.

Depends on

  • forge-bootstrap (venv + deps installed)
  • forge-shape (shaped corpus in S3)

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.