Step by Step Guide - fairy-stockfish/variant-nnue-pytorch GitHub Wiki
1. Check that your GPU supports CUDA
https://developer.nvidia.com/cuda-gpus
2. Install CUDA
https://developer.nvidia.com/cuda-downloads
3. Download training data generator
https://github.com/fairy-stockfish/variant-nnue-tools/releases
.exe
for Windows, others for Linux-largeboard
are for variants with boards >8x8- Depending on your CPU use
x86-64-bmi2
,x86-64-modern
, or `x86-64. In doubt use the latter.
If you aren't sure, use fairy-stockfish-tools-largeboard_x86-64.exe
.
4. Generate training data
5. Install git (optional)
6. Clone trainer
If you installed git, download the training code with
git clone https://github.com/fairy-stockfish/variant-nnue-pytorch.git
Otherwise you can download the code as a ZIP and extract it.
7. Install dependencies
https://github.com/fairy-stockfish/variant-nnue-pytorch#setup
Now you should be able to run python3 train.py -h
. If there are problems with the installed dependencies it might report errors here, so you need to address these before continuing.
8. Apply code changes
https://github.com/fairy-stockfish/variant-nnue-pytorch/wiki/NNUE-training#code-changes
9. Compile training data loader
compile_data_loader.bat
10. Convert existing network (optional)
train.py
11. Run https://github.com/fairy-stockfish/variant-nnue-pytorch/wiki/NNUE-training#training-example
12. Convert checkpoint to NNUE network
Now you finally generated your first own NNUE network.
13. Validate (optional)
If you are doing the training for the first time, you likely want to first validate if the generated NNUE file really works. For that, e.g., load it at https://fairy-stockfish-nnue-wasm.vercel.app/ under the nnue file
. If it reports an ERROR
please check again if your definition in variant.py
fits to the variant you wanted to train.
14. Test playing strength
Depending on the variant there are different options how to compare playing strength to the previous best NNUE network. One option that works for all variants is https://github.com/ianfab/variantfishtest.
15. Upload
If testing shows that your NNUE network performs well, please upload it at https://forms.gle/8Am9LTqXQJo43ps79 in order to share it with others. It will automatically be made available at https://drive.google.com/drive/folders/1m5PpiI3Kjzk_ow7F5RkwKnbO0Td-qb9J?usp=sharing then. The file name will be derived from the variant name and the value you added for the SHA256.