This is the chess variant NNUE training code for Fairy-Stockfish. See the documentation in the wiki for more details on the training process and join our discord to ask questions. This project is derived from the trainer for standard chess used for official Stockfish.
Requires a CUDA capable GPU. Note: you don't need to download the CUDA Toolkit
At least Python 3.9 needed.
python3 -m venv env
source env/bin/activate
pip install -r requirements.txt
PyTorch with CUDA 11.8 will be automatically installed, along with the matching CuPy version If your GPU is CUDA 12.8 capable you can use requirements-CUDA128.txt instead of requirements.txt
This requires a C++17 compiler and cmake.
Windows:
compile_data_loader.bat
Linux/Mac:
sh compile_data_loader.bat
source env/bin/activate
python train.py train_data.bin val_data.bin
python train.py --resume_from_checkpoint <path> ...
python train.py --gpus 1 ...
By default the trainer uses a factorized HalfKAv2 feature set (named "HalfKAv2^")
If you wish to change the feature set used then you can use the --features=NAME option. For the list of available features see --help
The default is:
python train.py ... --features="HalfKAv2^"
pip install tensorboard
tensorboard --logdir=logs
Then, go to http://localhost:6006/