Run HF CPU-training pilot to measure a fallback for GPU queues

This commit is contained in:
coyotte508 2026-09-30 20:53:01 +02:00
commit a12deca177
3 changed files with 34 additions and 5 deletions

View file

@ -2902,5 +2902,27 @@
},
"tests": "node --test ai/strong/test.cjs passed",
"scope": "Timing is one fixed 2p auction search; no general latency or strength claim. Existing jobs unchanged."
},
"multiplayer_cpu_training_pilot": {
"job_id": "6abd5a79fbc85ba68235c670",
"flavor": "cpu-performance",
"device": "cpu",
"torch_threads": 4,
"workers": 16,
"envs": 240,
"updates": 2,
"mixed_player_counts": true,
"source_bundle": {
"archive": "strong-source-v23.tgz",
"revision": "578c024e1cbbdfafa1df11763239ea81954e1e71",
"base_archive": "strong-source-v22.tgz",
"base_revision": "bcea005fb81ee05c662600b3238cba10d529abc5",
"only_replaced_file": "ai/strong/train.py",
"archive_sha256": "c6e89a74cb79334e38dca4036db148fd7146316374f2553a7c788851ee53816b"
},
"initial_checkpoint": "runs/multiplayer-distillation-v2-hard/best.pt",
"initial_revision": "ab34dd266010ded1c9a6c818c721e5505dd1ddeb",
"run": "multiplayer-refine-cpu-pilot-v1",
"purpose": "Measure whether HF CPU training is viable while GPU capacity is queued; all optimization remains on HF Jobs. Short pilot is not strength qualification."
}
}

View file

@ -13,6 +13,7 @@ hf jobs run --detach --flavor "${HF_FLAVOR:-h200}" --timeout 12h \
--env INIT_CHECKPOINT="$checkpoint" --env INIT_REVISION="$revision" --env ANCHOR_POLICY=initial \
--env ARCHITECTURE=multiplayer_ordered --env MIX_PLAYER_COUNTS=1 --env OPPONENT_MODE=mixed_search \
--env RUN_NAME="$run" --env TRAIN_SEED="${TRAIN_SEED:-623}" \
--env TRAIN_DEVICE="${TRAIN_DEVICE:-cuda}" --env TORCH_THREADS="${TORCH_THREADS:-2}" \
--env LR=.00005 --env ENTROPY=.005 --env ANCHOR=.03 \
--env UPDATES="${UPDATES:-80}" --env EVAL_EVERY=10 \
--env ENVS=240 --env WORKERS="${WORKERS:-16}" --env BATCH_SIZE=512 \
@ -23,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-v22.tgz\",repo_type=\"dataset\",revision=\"bcea005fb81ee05c662600b3238cba10d529abc5\");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-v23.tgz\",repo_type=\"dataset\",revision=\"578c024e1cbbdfafa1df11763239ea81954e1e71\");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

@ -31,9 +31,12 @@ seed = int(os.getenv("TRAIN_SEED", "101"))
random.seed(seed)
np.random.seed(seed)
torch.manual_seed(seed)
torch.set_num_threads(2)
device = "cuda"
assert torch.cuda.is_available(), "Training must run on a GPU HF Job"
torch.set_num_threads(int(os.getenv("TORCH_THREADS", "2")))
device = os.getenv("TRAIN_DEVICE", "cuda")
if device not in ["cuda", "cpu"]:
raise ValueError("TRAIN_DEVICE must be cuda or cpu")
if device == "cuda":
assert torch.cuda.is_available(), "CUDA training requires a GPU HF Job"
initial_checkpoint = os.getenv("INIT_CHECKPOINT")
initial_revision = os.getenv("INIT_REVISION")
checkpoint = None
@ -115,6 +118,7 @@ def save(name, export=False):
"strategic_only": strategic_only,
"update": update,
"mixed_player_counts": mix_player_counts,
"training_device": device,
"initial_checkpoint": initial_checkpoint,
"initial_revision": initial_revision,
"initial_feature_revision": checkpoint.get("feature_revision", "3.0")
@ -282,7 +286,9 @@ try:
"parameters": sum(p.numel() for p in net.parameters()),
"workers": workers,
"envs": nenv,
"gpu": torch.cuda.get_device_name(),
"device": device,
"torch_threads": torch.get_num_threads(),
"gpu": torch.cuda.get_device_name() if device == "cuda" else None,
}
),
flush=True,