Skip to content

Restore Modal training entrypoint (CPU image + game-aware wandb)#12

Merged
cweill merged 1 commit into
mainfrom
fix/restore-modal-training
May 26, 2026
Merged

Restore Modal training entrypoint (CPU image + game-aware wandb)#12
cweill merged 1 commit into
mainfrom
fix/restore-modal-training

Conversation

@cweill

@cweill cweill commented May 26, 2026

Copy link
Copy Markdown
Contributor

Summary

modal_app.py and tests/test_modal_app.py are empty (0 bytes) in main — PR #7 ("Slim Modal image to CPU torch + game-aware wandb project") deleted both (375 + 348 lines) instead of editing them. modal run modal_app.py is broken, and #7's titled improvements never shipped. This restores the matched pair from before #7 and applies that intent for real.

Motivation

  • Broken main: Modal training is unrunnable (empty entrypoint). The nbi C4 robustness study had to restore a /tmp copy to run at all.
  • Lost improvements from Slim Modal image to CPU torch + game-aware wandb project #7: runs logged to a hardcoded WANDB_PROJECT = "alphazero-tictactoe", which is why the Connect Four robustness runs landed in a tic-tac-toe project.
  • Undetected because CI has no Modal coverage (tracked separately as alphago-geq).

Changes

  • Restore modal_app.py + tests/test_modal_app.py from 833d1fd~1 (last known-good pair).
  • CPU-only torch image via extra_index_url=https://download.pytorch.org/whl/cpu — sequential MCTS gets no GPU benefit and CPU wheels are far smaller/cheaper.
  • Game-aware wandb project alphazero-<game> via _wandb_project_for_game, replacing the hardcoded tic-tac-toe project. Added a regression test.
  • Generic Modal app name alphazero (it trains any game).

Testing

  • pytest tests/test_modal_app.py → 7 passed.
  • Real-modal import check: app alphazero, image constructs with the CPU index, project resolves to alphazero-connectfour.
  • End-to-end Modal smoke run passed (1 iteration tic-tac-toe, exit 0): the CPU image built and trained on Modal, logging to project alphazero-tictactoe. wandb run: https://wandb.ai/cweill-self/alphazero-tictactoe/runs/1p4aa843

Review focus

  • The CPU-torch image approach (extra_index_url) vs. pinning +cpu wheels.
  • Whether the generic app name alphazero is preferred over per-game app names.

Fixes alphago-67y. Related: alphago-0oz (wire batched MCTS into training self-play), alphago-geq (Modal CI smoke test).

…roject

PR #7 deleted modal_app.py (375 lines) and tests/test_modal_app.py (348
lines) entirely instead of editing them, breaking `modal run modal_app.py`
and silently dropping #7's titled improvements. Restore the matched pair
from before #7 and apply that intent:

- CPU-only torch image via extra_index_url (sequential MCTS gets no GPU
  benefit; CPU wheels are far smaller/cheaper than the default CUDA build)
- game-aware wandb project (`alphazero-<game>`) instead of hardcoded
  `alphazero-tictactoe`, with a regression test
- generic Modal app name `alphazero`

alphago-67y
@cweill cweill merged commit cc26c90 into main May 26, 2026
2 checks passed
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