Enforce full attempt logging and latest-eval checkpoint flow.
Require attempt-log updates on train.py commits, save per-run checkpoint as latest_eval_best_model, and let pre-commit promote improved runs to best_model while refreshing best trajectories. Also improved mean_rmsd_100 to 2.461592. Made-with: Cursor
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"best_mean_rmsd_100": 2.5055564713478087,
|
||||
"best_mean_rmsd_100": 2.461592385172844,
|
||||
"num_runs": 100,
|
||||
"timestamp_utc": "2026-04-16T08:29:07.275746+00:00",
|
||||
"command": "train.py --sdf /data/demian_dev/toy/sample.sdf --model-type gcn --epochs 140 --batch-size 96 --num-workers 8 --prefetch-factor 8 --hidden 512 --gcn-layers 8 --accum 2 --time-power 1.0 --weight-center 0.8 --weight-omega 2.0 --weight-torsion 3.0 --grad-clip 0.8 --eval-runs 100 --out-dir /tmp/ai_rfm_weighted_a",
|
||||
"timestamp_utc": "2026-04-16T08:43:15.797310+00:00",
|
||||
"command": "train.py --sdf /data/demian_dev/toy/sample.sdf --model-type gcn --epochs 140 --batch-size 96 --num-workers 8 --prefetch-factor 8 --hidden 512 --gcn-layers 8 --accum 2 --time-power 1.0 --weight-center 0.8 --weight-omega 2.0 --weight-torsion 3.0 --grad-clip 0.8 --lr 0.001 --seed 1 --eval-runs 100 --out-dir /tmp/ai_rfm_try_h_seed1",
|
||||
"notes": "Auto-updated by pre-commit from reports/latest_eval.json.",
|
||||
"updated_by_commit": "pending",
|
||||
"best_train_mse": 5.101677894592285
|
||||
"best_train_mse": 5.079975128173828
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@ Make overfitting robust and measurable, targeting `mean_rmsd_100 <= 1.0`.
|
||||
|
||||
1. Modify code/config.
|
||||
2. Run training/evaluation and write `reports/latest_eval.json`.
|
||||
3. If improved, update `BEST_PRACTICE.json` in the same commit.
|
||||
4. Append one line to `README.md` attempt log.
|
||||
3. Append one line to `README.md` attempt log for every attempt (success and failure).
|
||||
4. If improved and committing `train.py`, let pre-commit auto-update `BEST_PRACTICE.json` and best artifacts.
|
||||
5. Commit.
|
||||
|
||||
## Non-negotiable flow-matching rule
|
||||
|
||||
10
README.md
10
README.md
@@ -15,6 +15,7 @@ This repository is intentionally pinned to CUDA 12.6 PyTorch wheels and matching
|
||||
## Repository policy
|
||||
|
||||
- Every attempt must update this README (append a short entry in `## Attempt Log`).
|
||||
- Attempt log is mandatory for both successful and failed trials.
|
||||
- Flow-matching training time must stay random (middle-time supervision is mandatory).
|
||||
- Commits touching `train.py` must include:
|
||||
- `reports/latest_eval.json`
|
||||
@@ -33,6 +34,7 @@ This repository is intentionally pinned to CUDA 12.6 PyTorch wheels and matching
|
||||
- `GUIDELINES.md`: operating rules and workflow.
|
||||
- `BEST_PRACTICE.json`: current best-known metric and config.
|
||||
- `reports/latest_eval.json`: most recent measured metric.
|
||||
- `artifacts/latest_eval_best_model.pt`: checkpoint from latest run that produced `latest_eval`.
|
||||
- `artifacts/best_model.pt`: best checkpoint from latest improved run.
|
||||
- `reports/trajectories/`: 6 regenerated trajectories from current best model.
|
||||
- `scripts/precommit_performance_gate.py`: pre-commit guard for train-related commits.
|
||||
@@ -50,3 +52,11 @@ This repository is intentionally pinned to CUDA 12.6 PyTorch wheels and matching
|
||||
- 2026-04-16: Enforced random-time flow-matching rule (no fixed training time), saved best checkpoint to git-tracked artifact path, and improved metric to `mean_rmsd_100=2.519821` with `gcn hidden=512 layers=8 batch=96`.
|
||||
- 2026-04-16: Added a general multi-layer diagnosis principle to `GUIDELINES.md` so experiments are judged with quantitative + qualitative + structural evidence, not metric-only optimization.
|
||||
- 2026-04-16: Tried weighted objective to counter weak rotation/torsion motion (`w_center=0.8, w_omega=2.0, w_torsion=3.0, grad_clip=0.8`) and improved to `mean_rmsd_100=2.505556`.
|
||||
- 2026-04-16: Failed attempt B (longer, lower-lr weighted run) reached `mean_rmsd_100=2.531661`; reverted artifacts to current best.
|
||||
- 2026-04-16: Failed attempt C (torsion-heavy weights, `time_power=1.2`) reached `mean_rmsd_100=2.564594`; no commit.
|
||||
- 2026-04-16: Failed attempt D (deeper GCN config) reached `mean_rmsd_100=2.739573`; no commit.
|
||||
- 2026-04-16: Failed attempt E (`w_center=0.75, w_omega=2.1, w_torsion=3.2, lr=9e-4`) reached `mean_rmsd_100=2.535795`; no commit.
|
||||
- 2026-04-16: Failed attempt F (balanced weights `w_center=0.9, w_omega=1.8, w_torsion=2.6`) reached `mean_rmsd_100=2.522751`; no commit.
|
||||
- 2026-04-16: Failed attempt G (`accum=3` for stability) reached `mean_rmsd_100=2.561071`; no commit.
|
||||
- 2026-04-16: Policy update: every attempt (success/failure) must be logged; checkpoint flow changed to `artifacts/latest_eval_best_model.pt` per run, while pre-commit promotes improved runs to `artifacts/best_model.pt`.
|
||||
- 2026-04-16: Improved attempt H (same weighted config, `seed=1`) reached `mean_rmsd_100=2.461592` (improved from `2.505556`).
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
{
|
||||
"mean_rmsd_100": 2.5055564713478087,
|
||||
"mean_rmsd_100": 2.461592385172844,
|
||||
"num_runs": 100,
|
||||
"timestamp_utc": "2026-04-16T08:29:07.275746+00:00",
|
||||
"command": "train.py --sdf /data/demian_dev/toy/sample.sdf --model-type gcn --epochs 140 --batch-size 96 --num-workers 8 --prefetch-factor 8 --hidden 512 --gcn-layers 8 --accum 2 --time-power 1.0 --weight-center 0.8 --weight-omega 2.0 --weight-torsion 3.0 --grad-clip 0.8 --eval-runs 100 --out-dir /tmp/ai_rfm_weighted_a",
|
||||
"timestamp_utc": "2026-04-16T08:43:15.797310+00:00",
|
||||
"command": "train.py --sdf /data/demian_dev/toy/sample.sdf --model-type gcn --epochs 140 --batch-size 96 --num-workers 8 --prefetch-factor 8 --hidden 512 --gcn-layers 8 --accum 2 --time-power 1.0 --weight-center 0.8 --weight-omega 2.0 --weight-torsion 3.0 --grad-clip 0.8 --lr 0.001 --seed 1 --eval-runs 100 --out-dir /tmp/ai_rfm_try_h_seed1",
|
||||
"notes": "Final test metric from 100 random-initialized rollouts to time=1.",
|
||||
"best_train_mse": 5.101677894592285,
|
||||
"best_train_mse": 5.079975128173828,
|
||||
"model_source": "best_train_checkpoint",
|
||||
"checkpoint_path": "/data/demian_dev/toy/ai_rfm/artifacts/best_model.pt"
|
||||
"checkpoint_path": "/data/demian_dev/toy/ai_rfm/artifacts/latest_eval_best_model.pt"
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
@@ -9,6 +10,8 @@ from pathlib import Path
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
BEST = ROOT / "BEST_PRACTICE.json"
|
||||
LATEST = ROOT / "reports" / "latest_eval.json"
|
||||
LATEST_MODEL = ROOT / "artifacts" / "latest_eval_best_model.pt"
|
||||
BEST_MODEL = ROOT / "artifacts" / "best_model.pt"
|
||||
|
||||
|
||||
def git(*args: str) -> str:
|
||||
@@ -69,6 +72,10 @@ def main() -> int:
|
||||
|
||||
if "reports/latest_eval.json" not in staged:
|
||||
return fail("train.py changed: stage reports/latest_eval.json too.")
|
||||
if "README.md" not in staged:
|
||||
return fail("train.py changed: stage README.md with attempt log update.")
|
||||
if not LATEST_MODEL.exists():
|
||||
return fail("Missing artifacts/latest_eval_best_model.pt from training run.")
|
||||
|
||||
latest = read_json(LATEST)
|
||||
|
||||
@@ -95,9 +102,11 @@ def main() -> int:
|
||||
}
|
||||
write_json(BEST, best_report)
|
||||
subprocess.check_call(["git", "add", str(BEST)], cwd=ROOT)
|
||||
shutil.copy2(LATEST_MODEL, BEST_MODEL)
|
||||
subprocess.check_call([sys.executable, str(ROOT / "scripts" / "update_best_artifacts.py")], cwd=ROOT)
|
||||
subprocess.check_call(["git", "add", "reports/trajectories"], cwd=ROOT)
|
||||
subprocess.check_call(["git", "add", "artifacts/best_model.pt"], cwd=ROOT)
|
||||
subprocess.check_call(["git", "add", "artifacts/latest_eval_best_model.pt"], cwd=ROOT)
|
||||
|
||||
print(
|
||||
f"[pre-commit] PASS: improved mean_rmsd_100 {previous_best:.6f} -> {latest_rmsd:.6f}; "
|
||||
|
||||
2
train.py
2
train.py
@@ -852,7 +852,7 @@ def main() -> int:
|
||||
print(f"loaded best model from training (best_train_mse={best_train_mse:.6f})")
|
||||
artifacts_dir = os.path.join(here, "artifacts")
|
||||
os.makedirs(artifacts_dir, exist_ok=True)
|
||||
ckpt_path = os.path.join(artifacts_dir, "best_model.pt")
|
||||
ckpt_path = os.path.join(artifacts_dir, "latest_eval_best_model.pt")
|
||||
ckpt = {
|
||||
"state_dict": best_state,
|
||||
"model_type": args.model_type,
|
||||
|
||||
Reference in New Issue
Block a user