gaetanserre / GAiA

GAiA is a UCI chess engine built with C++ 17, ONNX and Pytorch. It performs an in-depth analysis and uses a complex squeeze-and-excitation residual network to evaluate each chess board.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GAiA

GAiA is a UCI chess engine built with C++ 17, ONNX and PyTorch.

It performs an in-depth analysis and uses a complex squeeze-and-excitation residual network to evaluate each chess board.

GAiA uses Stockfish as a baseline.

It can perform an analysis in reasonable time between depth 10 and 14+ depending on the number of possible moves.

GAiA is not a complete chess program and requires a UCI-compatible graphical user interface (GUI) (e.g. XBoard with PolyGlot, Scid, Cute Chess, eboard, Arena, Sigma Chess, Shredder, Chess Partner or Fritz) in order to be used comfortably.

Detailed Description

I wrote an report about GAiA which describes in detail its creation process. You can read it here: Performing Regression on Complex Data using a Squeeze-and-Excitation Residual Neural Network, Chess as a Model System

Build from source

In order to build GAiA, you need CMake.

GAiA depends on ONNX which is an awesome library for inferring and even training neural networks. ONNX support many framework such as CUDA or TensorRT. You need to put the ONNX libraries file in Engine/lib. You can find these files here.

Then,

cd Engine/build
cmake ..
make

Usage

./GAiA

By default, GAiA is built using the CPU as the execution provider of ONNX because it was the most efficient on my machine. But you can easily change the EP to CUDA or TensorRT by changing the variable EP in the CMakeLists. The accepted values are CPU, CUDA and TENSORRT

Most used UCI commands:

  • position startpos [moves move_list]
  • position fen your_fen [moves move_list]
  • go depth n
  • go infinite: search until you enter stop
  • go movetime t: search for t milliseconds
  • go wtime t1 btime t2 [winc t3 binc t4]: Whites has t1 ms on clock Blacks has t2 ms on clock. Whites increment their time by t3 ms and Blacks increment their time by t4 ms
  • go nodes n search for n nodes (In fact, the number of nodes explored will be a bit greater than n)

Notebooks

All the notebooks and python files used to build GAiA's network are available in the SE-ResNet directory.

Notebooks order:

  1. encode.ipynb
  2. choose_hyperparameters.ipynb
  3. train_model.ipynb
  4. results.ipynb

Credits

License

GPL v3

About

GAiA is a UCI chess engine built with C++ 17, ONNX and Pytorch. It performs an in-depth analysis and uses a complex squeeze-and-excitation residual network to evaluate each chess board.

License:GNU General Public License v3.0


Languages

Language:C++ 54.4%Language:Jupyter Notebook 31.4%Language:TeX 10.6%Language:Python 2.9%Language:C 0.6%Language:CMake 0.1%