https://github.com/danny-1k/seqchess
https://github.com/danny-1k/seqchess
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/danny-1k/seqchess
- Owner: danny-1k
- Created: 2023-07-22T12:39:26.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-07-22T13:29:32.000Z (almost 2 years ago)
- Last Synced: 2024-12-29T07:36:29.711Z (5 months ago)
- Language: Python
- Size: 14.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
In this project, I test the idea of using sequence models to do next token prediction directly on the pgn representation of a game.
Can deep understanding of the game be achieved purely from this representation?
there are many ways the pgn could've been tokenized for sequence modelling (concise san notation etc)
but as I was too lazy, The vocabulary of this model contains a sufficiently large number of algebraic notation tokens (the vocab size was more than 100k tokens I belive).
This aspect can definitely be optimized in the future.A bidirectional GRU and a transformer were trained on this dataset (the GRU performed significantly better)
At test time, the top 100 tokens are sampled from a multinomial distribution weighted by the probabilities from the network.
The top legal move is then returned.One thing I found interesting was prompting the model to make a move that it learned to lead to a specific outcome. (by prompting with 1-0, 0-1, 1/2-1/2, *, etc the model's behaviour changes). I call this results injection.
## I just wann play
### Install dependencies
```
pip install -r requirements.txt
```### Play
```
python play.py --temp [temperature value. defaults to 0.2] --prompt [results injection prompt (e.g 1/2-1/2, 1-0, 0-1, *)]
```