Hyperion is a MCTS-NN based chess engine built primarily in C++. The Engine is still in development with plans to add reinforcement learning soon!
There are two different and separate builds for this project:
- Python (Training)
- The Python code (using PyTorch) is strictly used for training to create the neural network models.
- To set up the Python environment, install the requirements by running:
pip install -e . - Navigate to the training directory and run:
python train.py
- C++ (Engine and Inference)
- The C++ code is the actual chess engine. It uses the neural network files trained by the Python component (saved in
data/completed_models) for its inferences during searches.
- The C++ code is the actual chess engine. It uses the neural network files trained by the Python component (saved in
- Nodes per second: 4.39454e+07 (43.9 Million NPS)
Because this engine uses a Neural Network, it requires LibTorch (the C++ API for PyTorch) to build.
- Download LibTorch from the PyTorch website.
- Linux: Make sure to select the cxx11 ABI version.
- Windows: Download the Release version. IMPORTANT: Do not use MinGW on Windows. You should instead use MSVC.
- Extract the downloaded folder somewhere on your computer. You will need the path to this folder for the build steps below.
CRITICAL: It is super important that you build the project in Release mode, not Debug! The Debug mode does not work with LibTorch and will cause errors.
-
Open a terminal in the
hyperiondirectory. -
Next, create and
cdinto the build directory:mkdir build cd build -
Configure the project with CMake, making sure to provide the path to your extracted LibTorch folder and specifying the Release build type:
cmake -DCMAKE_PREFIX_PATH="C:/absolute/path/to/your/libtorch" -DCMAKE_BUILD_TYPE=Release .. -
Still in the build directory, compile the engine (Release config is passed to cmake build for MSVC):
cmake --build . --config Release -
Run the executable:
.\bin\Release\HyperionEngine.exe
(Note: The exact path might be
.\bin\HyperionEngine.exeon non-MSVC builds, such as Linux.)
-
Open a terminal in the
hyperiondirectory. -
Next,
cdinto the build directory (hyperion/build/). -
Run CMake with optimization flags, the LibTorch path, and Release mode:
cmake -DCMAKE_PREFIX_PATH="C:/absolute/path/to/your/libtorch" -DHYPERION_ENABLE_BMI2=ON -DCMAKE_BUILD_TYPE=Release .. -
Still in the build directory, build using multiple cores for a faster compile time:
cmake --build . --config Release -j 8 -
Run the executable:
.\bin\Release\HyperionEngine.exe
- Chess Logic Library
- Basic Monte-Carlo Tree Search Implementation
- Initial Neural Network Creation (Supervised Learning)
- Initial Neural Network Implementation
- Neural Network Self-Play (Reinforcement Learning)
- Refinements/Advanced Features