Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: mit
|
| 3 |
+
tags:
|
| 4 |
+
- reinforcement-learning
|
| 5 |
+
- autoencoder
|
| 6 |
+
- games
|
| 7 |
+
---
|
| 8 |
+
|
| 9 |
+
# OpenFront tile-state autoencoder
|
| 10 |
+
|
| 11 |
+
Fully-convolutional autoencoder over [OpenFront.io](https://openfront.io)
|
| 12 |
+
tile-ownership state, intended as a frozen spatial observation encoder for RL
|
| 13 |
+
agents. 64x compression: 16x16 spatial downsampling into 64 latent channels
|
| 14 |
+
per region, works on any map size.
|
| 15 |
+
|
| 16 |
+
- Input: per-tile owner slot (static per-game slot assignment, 8-dim learned
|
| 17 |
+
embedding) + terrain channels (land, magnitude, fallout)
|
| 18 |
+
- Loss: border-weighted cross-entropy reconstruction of owner slots
|
| 19 |
+
- Trained on [djmango/openfront-snapshots](https://huggingface.co/datasets/djmango/openfront-snapshots)
|
| 20 |
+
(250 games, 10 maps, random 256x256 crops): 30k steps, batch 16, ~40 min on
|
| 21 |
+
an RTX 3070. 1.0M params.
|
| 22 |
+
|
| 23 |
+

|
| 24 |
+
|
| 25 |
+
Original vs reconstruction through the latent (World map, 17 players):
|
| 26 |
+
|
| 27 |
+

|
| 28 |
+
|
| 29 |
+
Border-tile accuracy (the honest metric; overall accuracy is inflated by
|
| 30 |
+
water): 98.7% on a 2-player endgame, 91.4% on World with 17 players, 90.1% on
|
| 31 |
+
Africa with 27 players.
|
| 32 |
+
|
| 33 |
+
Training code and usage: [djmango/openfront-ae](https://github.com/djmango/openfront-ae)
|
| 34 |
+
|
| 35 |
+
```python
|
| 36 |
+
import torch
|
| 37 |
+
from ae.model import TileAutoencoder
|
| 38 |
+
|
| 39 |
+
ckpt = torch.load("ae.pt", map_location="cpu", weights_only=False)
|
| 40 |
+
model = TileAutoencoder(latent_c=ckpt["args"]["latent_c"])
|
| 41 |
+
model.load_state_dict(ckpt["model_state_dict"])
|
| 42 |
+
model.eval()
|
| 43 |
+
z = model.encode(owner_slots, terrain) # (B, 64, H/16, W/16)
|
| 44 |
+
```
|