Guard complete rollout batches before optimization

This commit is contained in:
coyotte508 2026-09-30 21:26:42 +02:00
commit 9bf47b1ccb
3 changed files with 14 additions and 1 deletions

View file

@ -3499,5 +3499,16 @@
"status": {
"stage": "RUNNING"
}
},
"async_training_batch_guard": {
"source_bundle": {
"archive": "strong-source-v26.tgz",
"revision": "80fcc719b64b13fe1592e206712b68f94ef19951",
"base_revision": "a8fa4ea6213c46f978dd3c25735296049df22571",
"only_replaced_file": "ai/strong/train.py",
"archive_sha256": "03348439ae91b3e3ccbc6061d885c4c443721cc2b2d6d7fad3fd57bb5b3c1e2f"
},
"invariant": "Before optimization, exactly ENVS terminal records with unique environment indices covering 0..ENVS-1.",
"telemetry": "Ready games are distinct from unfinished/in-flight games; engine timing is blocking-call wall time, not aggregate background CPU work."
}
}

View file

@ -24,7 +24,7 @@ python -m pip install --quiet --timeout 120 --retries 5 huggingface_hub==2.0.0 o
mkdir -p /workspace
python -c "import urllib.request,tarfile; urllib.request.urlretrieve(\"https://nodejs.org/dist/v24.14.0/node-v24.14.0-linux-x64.tar.xz\",\"/tmp/node.tar.xz\");tarfile.open(\"/tmp/node.tar.xz\").extractall(\"/opt\")"
export PATH=/opt/node-v24.14.0-linux-x64/bin:$PATH
python -c "from huggingface_hub import hf_hub_download;import tarfile;p=hf_hub_download(\"coyotte508/powergrid-ai-training-v1\",\"strong-source-v25.tgz\",repo_type=\"dataset\",revision=\"a8fa4ea6213c46f978dd3c25735296049df22571\");tarfile.open(p).extractall(\"/workspace\")"
python -c "from huggingface_hub import hf_hub_download;import tarfile;p=hf_hub_download(\"coyotte508/powergrid-ai-training-v1\",\"strong-source-v26.tgz\",repo_type=\"dataset\",revision=\"80fcc719b64b13fe1592e206712b68f94ef19951\");tarfile.open(p).extractall(\"/workspace\")"
cd /workspace
node --test ai/test.cjs ai/strong/test.cjs
python ai/strong/test_teacher_contract.py

View file

@ -428,6 +428,8 @@ try:
)
last_progress = time.perf_counter()
rollout_seconds = time.perf_counter() - start
if len(endings) != nenv or {e["env"] for e in endings} != set(range(nenv)):
raise RuntimeError("Every training environment must finish exactly once")
if not batch:
raise RuntimeError("No completed training episodes")
advantages = np.array([r["advantage"] for r in batch])