djmango commited on
Commit
edcb633
·
verified ·
1 Parent(s): f5120bd

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +16 -25
README.md CHANGED
@@ -6,39 +6,30 @@ tags:
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
- ![training curves](loss_curve.png)
24
 
25
- Original vs reconstruction through the latent (World map, 17 players):
26
-
27
- ![reconstruction](recon_world.png)
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-ai](https://github.com/djmango/openfront-ai)
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
  ```
 
6
  - games
7
  ---
8
 
9
+ # OpenFront spatial autoencoder
10
 
11
+ Frozen spatial observation encoder for [OpenFront.io](https://openfront.io)
12
+ RL agents: compresses tile ownership + terrain + fallout + static structures
13
+ into a 64-channel latent per 16x16 region (any map size). v3 numbers: 99.4%
14
+ tile accuracy, 87-99% border-tile accuracy, structure detection at
15
+ precision/recall 1.0 per class.
16
 
17
+ Full details, training code, results, and roadmap:
18
+ **[github.com/djmango/openfront-ai](https://github.com/djmango/openfront-ai)**
 
 
 
 
19
 
20
+ ![reconstruction](recon_v3_world.png)
21
 
22
+ Files: `ae_v3.pt` (current, `SpatialAE` in `model_v3.py`) and `ae.pt`
23
+ (v1 tile-only `TileAutoencoder` in `model.py`). Trained on
24
+ [djmango/openfront-snapshots](https://huggingface.co/datasets/djmango/openfront-snapshots).
 
 
 
 
 
 
25
 
26
  ```python
27
  import torch
28
+ from ae.model_v3 import SpatialAE
29
 
30
+ ckpt = torch.load("ae_v3.pt", map_location="cpu", weights_only=False)
31
+ model = SpatialAE(latent_c=ckpt["args"]["latent_c"])
32
  model.load_state_dict(ckpt["model_state_dict"])
33
  model.eval()
34
+ z = model.encode(owner_slots, terrain, static_planes) # (B, 64, H/16, W/16)
35
  ```