Views
No views yet
best.pt) and this card. Everything
needed to use them — play against the agent, watch self-play, or reproduce the
handicap study — lives in the GitHub repository above.| Architecture | Residual conv trunk + policy & value heads (AlphaGo Zero, scaled down) |
| Parameters | 314,466 |
| Input | (4, 5, 5) planes: own stones, opponent stones, ko point, color-to-move (side-to-move relative) |
| Trunk | 4 residual blocks, 64 channels, BatchNorm + ReLU |
| Policy head | 1×1 conv (2 ch) → linear → logits over 5*5 + 1 = 26 actions (incl. PASS) |
| Value head | 1×1 conv (8 ch) → linear → ReLU → linear → tanh ∈ [−1, 1] |
| Board | 5×5, komi 3.5, simple ko, area scoring |
| Training | 100 iterations of self-play → train → arena, batched MCTS on a single RTX 5060 Ti |
| Framework | PyTorch (CUDA 12.8 wheels for Blackwell sm_120) |
1# 1. Get the code
2git clone https://github.com/nitishpandey04/alphago
3cd alphago
4uv sync # PyTorch (cu128), numpy, matplotlib, tensorboard
5
6# 2. Get these weights
7hf download nitishpandey04/alphago-zero-5x5 best.pt --local-dir checkpoints
8
9# 3a. Play against it (you are Black; enter moves like C3, B5, or 'pass')
10uv run python -m scripts.play_human --checkpoint checkpoints/best.pt
11
12# 3b. Watch it play itself
13uv run python -m scripts.watch_game --black checkpoints/best.pt --white checkpoints/best.pt
14
15# 3c. Handicap one side from the SAME weights (fewer sims = weaker search)
16uv run python -m scripts.watch_game --black-sims 32 --white-sims 64 | tail -11import torch
2from go_agent.model import PolicyValueNet
3from go_agent.game import Board
4from go_agent.encoding import encode
5
6net = PolicyValueNet(board_size=5, in_channels=4, num_res_blocks=4,
7 channels=64, value_channels=8, hidden_size=64)
8net.load_state_dict(torch.load("checkpoints/best.pt", map_location="cpu"))
9net.eval()
10
11board = Board(5) # empty 5×5, Black to move
12x = torch.from_numpy(encode(board)[None]) # (1, 4, 5, 5)
13policy_logits, value = net(x) # logits over 26 actions, value ∈ [−1, 1]go_agent/mcts.py and the scripts
in the repo (the raw policy alone is much weaker than policy + search).handicap_study.py are in the
GitHub README.