chessard / README.md
danielgmonroe's picture
Upload README.md with huggingface_hub
fa4e6ac verified
|
Raw History Blame Contribute Delete
1.94 kB
---
license: gpl-3.0
tags:
- chess
- uci
---
# chessard
Weights for **chessard**, a network that predicts the move a human of a given rating would play.
It is built on a Leela Chess Zero BT4 transformer body with a Stockfish-aware policy head. The
engine and inference code are at [github.com/daniel-monroe/chessard](https://github.com/daniel-monroe/chessard);
this repo holds only weights.
| File | What | Elo (default) |
|---|---|---|
| `chessard.pt` | base model (float16, ~400 MB) | 2000–2900 (trained on 2000+ games) |
| `loras/carlsen.pt` | LoRA adapter: Magnus Carlsen | 2840 |
| `loras/nakamura.pt` | LoRA adapter: Hikaru Nakamura | 2810 |
| `loras/sadler.pt` | LoRA adapter: Matthew Sadler | 2692 |
| `loras/janik.pt` | LoRA adapter: Igor Janik | 2504 |
| `loras/kaufman.pt` | LoRA adapter: Larry Kaufman | 2188 |
`loras/players.json` maps each adapter to the player's name and rating; the engine plays a
player at that rating unless told otherwise. The adapters are rank-1 LoRA finetunes (float16, ~450 KB each) on that player's games. They only
work on top of `chessard.pt`.
## Use
The engine's `setup.sh` downloads these automatically. To do it by hand, download the whole repo
into one folder, then point the engine at it:
```bash
hf download danielgmonroe/chessard --local-dir ~/chessard-weights
./uci.py --weights-dir ~/chessard-weights --player carlsen # plays at 2840
```
Instead of `--weights-dir` you can set `CHESSARD_DIR=~/chessard-weights` once. Every program that
reads it will then share the same copy.
## Format
- `chessard.pt`: `{"model_state_dict": {...}, "global_step": int}`.
- `loras/<player>.pt`: `{"adapter_state_dict": {...}, "lora_rank", "lora_alpha", "lora_targets", ...}`.
To load one, load the base model, wrap each targeted `nn.Linear` (named by the
`*.lora_A` / `*.lora_B` keys) as `y = Wx + b + (alpha/rank) * B(Ax)`, then load the adapter
state dict with `strict=False`.