Skip to content

official-stockfish/nnue-pytorch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Setup

Software prerequisites

Python

If using easy_train.py then at least 3.7 is required.

Otherwise versions around 3.6 should also work, but updating is recommended.

Python 3.11 was also tested and works well.

A C++ compiler

If you're using easy_train.py then at least GCC 9.2 is required for compiling the data loader, Stockfish, and c-chess-cli. This a defensive version requirement as older versions were known to cause problems with Stockfish.

If you're not using easy_train.py then no automatic compilation will take place; use what you wish.

If you're on Windows the best way is to probably use MSYS2. It would also make it easy to install Make (next step).

Make

For compiling Stockfish and c-chess-cli. Not strictly necessary if you're not using easy_train.py, but recommended.

CMake

Necessary for compiling the data loader.

https://cmake.org/install/

Package dependencies

python -m venv trainer
pip install -r requirements.txt

PyTorch with CUDA 11.8 will be automatically installed, along with the matching CuPy version.

The data loader (if not using easy_train.py)

This requires a C++17 compiler and cmake.

Windows:

compile_data_loader.bat

Linux/Mac:

sh compile_data_loader.bat

Network training and management

Hard way: wiki

Easier way: wiki

Logging

TODO: Move to wiki. Add setup for easy_train.py

tensorboard --logdir=logs

Then, go to http://localhost:6006/

Automatically run matches to determine the best net generated by a (running) training

TODO: Move to wiki

python run_games.py --concurrency 16 --stockfish_exe ./stockfish.master --c_chess_exe ./c-chess-cli --ordo_exe ./ordo --book_file_name ./noob_3moves.epd run96

Automatically converts all .ckpt found under run96 to .nnue and runs games to find the best net. Games are played using c-chess-cli and nets are ranked using ordo. This script runs in a loop, and will monitor the directory for new checkpoints. Can be run in parallel with the training, if idle cores are available.

Thanks