Skip to content
Fabian Fichter edited this page Mar 18, 2022 · 32 revisions

Since the variant NNUE training code is based on https://github.com/glinscott/nnue-pytorch, you can also have a look at its documentation, e.g., its wiki, for additional information. However, keep in mind that official Stockfish already switched to different architectures, so architecture related information might not apply here, since Fairy-Stockfish still uses a HalfKAv2 based NNUE architecture. Furthermore Fairy-Stockfish uses a generalized bin training data format (with 512 instead of 256 bit) incompatible with the official Stockfish trainer.

Training data generation

There is training data generation code based on different engines

NNUE training

In order to run NNUE training for specific variants, the code requires minor adjustments to specify board size, piece types, etc. See the branches for specific variants in order to identify the typical required changes. The changes for minishogi are a typical example.

#define FILES 8
#define RANKS 8
#define PIECE_TYPES 6
#define PIECE_COUNT 32
#define POCKETS false
  • variant.py: Similar updates are required here. For obtaining piece values, simply set the variant in the training data generator, then it will print piece values that can be copy&pasted.

Limitations

  • Both the training data generation tool as well as this repository only support the bin format and no binpack or plain formats.
  • Many of the helper scripts/functionality in the training data generation and this repository are not maintained and likely broken. The essential functionality of generating bin training data and using it for NNUE training of HalfKAv2 networks is working though.
  • Currently the training data format only supports up to 15 piece types. This could easily be extended, but so far there was no need to, and it would double the size of the training data.
Clone this wiki locally