Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
library_name: pytorch
|
| 4 |
+
tags:
|
| 5 |
+
- gomoku
|
| 6 |
+
- alphazero
|
| 7 |
+
- mcts
|
| 8 |
+
- board-game-ai
|
| 9 |
+
- pytorch
|
| 10 |
+
pipeline_tag: reinforcement-learning
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# GomokuZeroAI
|
| 14 |
+
|
| 15 |
+
GomokuZeroAI is an AlphaZero-style Gomoku checkpoint trained with self-play, a PyTorch policy-value network, and Monte Carlo Tree Search.
|
| 16 |
+
|
| 17 |
+
This repository hosts the model weights used by the companion project:
|
| 18 |
+
|
| 19 |
+
```text
|
| 20 |
+
https://github.com/maojh15/GomokuZeroAI
|
| 21 |
+
```
|
| 22 |
+
|
| 23 |
+
The current checkpoint is:
|
| 24 |
+
|
| 25 |
+
```text
|
| 26 |
+
iter_0150_15x15.pt
|
| 27 |
+
```
|
| 28 |
+
|
| 29 |
+
It is intended for local human-vs-AI play through the project's web UI.
|
| 30 |
+
|
| 31 |
+
## Quick Start
|
| 32 |
+
|
| 33 |
+
Clone the code repository:
|
| 34 |
+
|
| 35 |
+
```bash
|
| 36 |
+
git clone https://github.com/maojh15/GomokuZeroAI.git
|
| 37 |
+
cd GomokuZeroAI
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
+
Install dependencies:
|
| 41 |
+
|
| 42 |
+
```bash
|
| 43 |
+
pip install numpy torch pyyaml huggingface_hub
|
| 44 |
+
```
|
| 45 |
+
|
| 46 |
+
Download the checkpoint:
|
| 47 |
+
|
| 48 |
+
```bash
|
| 49 |
+
hf download maojh15/GomokuZeroAI iter_0150_15x15.pt --local-dir result_15x15/checkpoints
|
| 50 |
+
```
|
| 51 |
+
|
| 52 |
+
Start the local human-vs-AI server:
|
| 53 |
+
|
| 54 |
+
```bash
|
| 55 |
+
python play_human.py --host 127.0.0.1 --port 8765
|
| 56 |
+
```
|
| 57 |
+
|
| 58 |
+
Open the web UI:
|
| 59 |
+
|
| 60 |
+
```text
|
| 61 |
+
http://127.0.0.1:8765
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
Select `iter_0150_15x15.pt` in the checkpoint dropdown and click the new-game button to start playing.
|
| 65 |
+
|
| 66 |
+
## Model Details
|
| 67 |
+
|
| 68 |
+
- Game: Gomoku / Five in a Row
|
| 69 |
+
- Board size: 15x15
|
| 70 |
+
- Checkpoint: `iter_0150_15x15.pt`
|
| 71 |
+
- Training iteration: 150
|
| 72 |
+
- Framework: PyTorch
|
| 73 |
+
- Architecture: convolutional policy-value network
|
| 74 |
+
- Input channels: 2
|
| 75 |
+
- Network width: 128 channels
|
| 76 |
+
- Player encodings: `1` and `-1`
|
| 77 |
+
- MCTS backend used during training: C++ Torch Extension
|
| 78 |
+
- MCTS playouts during training: 2000
|
| 79 |
+
- Opening self-play temperature: 1.0 for the first 12 moves
|
| 80 |
+
- Evaluation temperature: 0.001 after the opening
|
| 81 |
+
|
| 82 |
+
The network predicts:
|
| 83 |
+
|
| 84 |
+
- a policy distribution over legal board moves
|
| 85 |
+
- a value estimate in `[0, 1]` from the current player's perspective
|
| 86 |
+
|
| 87 |
+
The local web UI can display both the raw network value and the MCTS root value.
|
| 88 |
+
|
| 89 |
+
## Intended Use
|
| 90 |
+
|
| 91 |
+
This checkpoint is meant for:
|
| 92 |
+
|
| 93 |
+
- playing Gomoku against the AI locally
|
| 94 |
+
- inspecting policy and visit overlays in the web UI
|
| 95 |
+
- comparing future GomokuZeroAI checkpoints
|
| 96 |
+
- experimenting with AlphaZero-style self-play training code
|
| 97 |
+
|
| 98 |
+
This is not a Transformers model and is not intended for use through the Hugging Face `pipeline()` API.
|
| 99 |
+
|
| 100 |
+
## Limitations
|
| 101 |
+
|
| 102 |
+
- The model was trained for 15x15 Gomoku only.
|
| 103 |
+
- It requires the GomokuZeroAI codebase to load and run correctly.
|
| 104 |
+
- Playing strength depends heavily on the MCTS playout setting used at inference time.
|
| 105 |
+
- Higher playouts usually improve move quality but increase latency.
|
| 106 |
+
- The checkpoint is an experimental game AI model, not a benchmarked tournament engine.
|
| 107 |
+
|
| 108 |
+
## Recommended Inference Settings
|
| 109 |
+
|
| 110 |
+
For interactive human-vs-AI play, start with:
|
| 111 |
+
|
| 112 |
+
- `MCTS playouts`: 2000
|
| 113 |
+
- `c_puct`: 5.0
|
| 114 |
+
- `candidate distance`: empty / all legal moves
|
| 115 |
+
- `mcts_tactical_shortcuts`: enabled for faster tactical responses in the web UI
|
| 116 |
+
|
| 117 |
+
If moves are too slow on your machine, reduce `MCTS playouts` to 400-1000.
|
| 118 |
+
|
| 119 |
+
## Files
|
| 120 |
+
|
| 121 |
+
```text
|
| 122 |
+
iter_0150_15x15.pt
|
| 123 |
+
```
|
| 124 |
+
|
| 125 |
+
This file contains the model weights and training configuration payload used by the GomokuZeroAI checkpoint loader.
|
| 126 |
+
|
| 127 |
+
## Citation
|
| 128 |
+
|
| 129 |
+
If you use this checkpoint or codebase in your own experiments, please reference the project repository:
|
| 130 |
+
|
| 131 |
+
```text
|
| 132 |
+
https://github.com/maojh15/GomokuZeroAI
|
| 133 |
+
```
|