Please refer to my ChessEngine repository to view an implementation of the neural network.
This repository provides the implementation of a neural network model designed to rank chess positions from winning to losing. It includes a decoder-only transformer and a tokenizer. The tokenizer processes chess positions in FEN notation, and the model predicts their winning probabilities.
- Data Source: Lichess Stockfish Data
- Preprocessing: Chess positions in FEN notation are evaluated in centipawns, which are then converted to winning percentages as described in the Lichess Accuracy page. The winning percentage is binned following the method used in the DeepMind Paper.
Note: This implementation is optimized for GPU. Running it on a CPU is not recommended.
-
Create a Virtual Environment and Install Prerequisites
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate` pip install -r requirements.txt
-
Download and Preprocess Data
python preprocess.py
-
Train the model
python train.py
After training the model and saving its weights, you need to integrate it into a chess engine. Refer to my ChessEngine repository for instructions on this integration.