-
Notifications
You must be signed in to change notification settings - Fork 360
For Developers
To help the project get stronger by running self-play training games on your own computer, see below for instructions. The project depends on users like you donating their CPU and GPU time to improve!
Download the code from https://github.com/NeymarL/ChineseChess-AlphaZero, e.g.
-
git clone -b distributed https://github.com/NeymarL/ChineseChess-AlphaZero.git
or - download zip
The project run in Python3.6.3+
, if you don't have Python3.6.3+
, see Anaconda.
If you already have Python3.6.3+
installed and it works well, just skip this section.
- Download and install anaconda (or miniconda) from https://conda.io/docs/user-guide/install/download.html
- Create a virtual environment for this project:
conda create -n alphazero python=3.6 anaconda
- Activate the environment:
source activate alphazero
Note: If you just want to use CPU to train, replace tensorflow-gpu
with tensorflow
in requirements.txt
.
Enter the root folder of the project and run
pip install -r requirements.txt
Before running self-play, there are some parameters that you can tune to fit you computer.
In file cchess_alphazero/configs/distribute.py
:
- line 35:
self.max_processes = 10
, this is the number of processes that run self-play worker, tune this to fit your number of CPU cores. - line 36:
self.search_threads = 20
, this is the number of search threads that each process use. Increase this parameter, playing will be faster but with weaker performance, you'd better tune this in range[10, 40]
.
Enter the root folder of the project and run:
python cchess_alphazero/run.py --type distribute --distributed self
If you want to specify which GPU to use, add --gpu [GPU]
option. About more options please refer here.
Note: It takes about 1 or 2 minutes to start self-play since it need download the latest weight from server.
Stop Self-Play
If you want to stop self-play, just input Ctrl+C
or close the terminal (console).
Run in Background (for Linux)
If you want to run in background, run:
nohup python cchess_alphazero/run.py --type distribute --distributed self >self-play.out 2>&1 &
The output will be redirected to self-play.out
.
When you want to stop self-play, find process ids in the head of self-play.out
and kill them each.
For live status, see http://alphazero.52coding.com.cn/