Skip to content

feat(train): add preflight run guardrails and setup failure hints#343

Open
kaizen-38 wants to merge 1 commit intokarpathy:masterfrom
kaizen-38:feat/run-guardrails
Open

feat(train): add preflight run guardrails and setup failure hints#343
kaizen-38 wants to merge 1 commit intokarpathy:masterfrom
kaizen-38:feat/run-guardrails

Conversation

@kaizen-38
Copy link
Contributor

Summary

Add a small reproducibility/guardrail layer for training runs by introducing explicit preflight checks and clearer failure paths.

What changed

  • train.py
    • Move CUDA/kernel assumptions out of import-time and into startup preflight.
    • Add PRECHECK_FAIL output with structured reason/hint for setup failures.
    • Validate setup before training starts:
      • CUDA availability and visible device
      • tokenizer artifacts exist in cache
      • WINDOW_PATTERN validity
      • integer gradient accumulation (TOTAL_BATCH_SIZE % (DEVICE_BATCH_SIZE * MAX_SEQ_LEN) == 0)
    • Add clearer divergence failure (RuntimeError) for non-finite/exploding loss.
  • program.md
    • Teach experiment loop to treat PRECHECK_FAIL as setup issue (not experiment crash).
    • Instruct agent to stop and ask human for environment fix when preflight fails.

Why

This makes failures easier to diagnose, reduces noisy crash loops caused by setup issues, and improves reproducibility by validating key assumptions up front.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant