Skip to content
Fabian Fichter edited this page Apr 12, 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. The reason for that is that the training code is variant-agnostic and other than those minor adaptations has no knowledge of the rules of the variants. See the branches for specific variants in order to identify the typical required changes. The changes for minishogi are a good example. The training data generator also prints the recommended training code changes when setting a variant using the UCI_Variant.

#define FILES 8
#define RANKS 8
#define PIECE_TYPES 6
#define PIECE_COUNT 32
#define POCKETS false
#define KING_SQUARES FILES * RANKS
  • variant.py: Similar updates are required here, and in addition to that the initial guesses for piece values need to be defined. To get these 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.
  • See the FAQ for more info on supported variants and common pitfalls.
Clone this wiki locally