thumbnail | widget | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Research done at Johns Hopkins University by Michael DeLeo
Contact: mdeleo2@jh.edu
BertHarmon is a BERT model trained for the task of Chess.
from transformers import pipeline
task = pipeline('fill-mask', model='BertHarmon')
task("rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1 White <MOVE_SEP> [MASK]")
The base string consists of the FEN_position followed by the player color and a move seperator. Finally with the [MASK] token. The mask token is the algebraic notation for a chess move to be taken givent the current board state in FEN Notation
Build Stockfish
cd stockfish_build
. ./build.sh
Then install the requirements for either a CPU machine or CUDA.
CPU Machine
pip install -r requirements.txt
CUDA Machine
pip install -r requirements-cuda.txt
All our training scripts utilize jupyter notebooks.
jupyter lab
Training requires CUDA 11.3
Reference the Train BERT NIM notebook
Reference the Train BERT Chess notebook
Using docker is optional, it can help to standardize your environment. The reqs here are not that complicated though.
docker-compose -- 1.27 docker -- 20.10.12
- Make sure docker and docker compose are installed.
- For a GPU enabled machine, install nvidia runtime
- LINUX:
sudo apt-get install nvidia-docker2 -y
- Windows: TODO
- LINUX:
CPU Machine
docker compose up --build
OR
GPU Machine
docker compose up --build -f docker-compose-gpu.yml
docker compose up -f docker-compose-remote.yml