Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -11,45 +11,123 @@ viewer: false
|
|
| 11 |
# NeuralCraft World Model Data
|
| 12 |
|
| 13 |
Action-conditioned Minecraft gameplay for training an interactive world model.
|
| 14 |
-
5,548,016 frames in 126,085 contiguous runs across 303 shards.
|
| 15 |
|
| 16 |
Derived from [TESS-Computer/minecraft-vla-stage1](https://huggingface.co/datasets/TESS-Computer/minecraft-vla-stage1)
|
| 17 |
(OpenAI VPT contractor data), curated to gameplay only.
|
| 18 |
|
| 19 |
-
|
|
|
|
|
|
|
| 20 |
|
| 21 |
-
|
| 22 |
-
2. **GUI/menu removal** with a CLIP content classifier (P(gameplay) < 0.20 dropped): inventory,
|
| 23 |
-
crafting, chest, trading and pause screens, plus non-game content present in the source
|
| 24 |
-
screen recordings (browsers, streams).
|
| 25 |
-
3. **Re-segmented into contiguous runs of >= 16 frames** after filtering, since filtering creates
|
| 26 |
-
gaps and a world model needs contiguous windows.
|
| 27 |
-
4. **Ego-motion measured** from optical flow and appended to every action vector.
|
| 28 |
|
| 29 |
-
##
|
| 30 |
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
> frame sequences, not shuffled independent samples. The HF dataset viewer is disabled for this
|
| 34 |
-
> reason — load the tars directly.
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
-
|
| 43 |
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
|
| 55 |
-
|
|
|
|
| 11 |
# NeuralCraft World Model Data
|
| 12 |
|
| 13 |
Action-conditioned Minecraft gameplay for training an interactive world model.
|
| 14 |
+
**5,548,016 frames** in **126,085 contiguous runs** across 303 shards.
|
| 15 |
|
| 16 |
Derived from [TESS-Computer/minecraft-vla-stage1](https://huggingface.co/datasets/TESS-Computer/minecraft-vla-stage1)
|
| 17 |
(OpenAI VPT contractor data), curated to gameplay only.
|
| 18 |
|
| 19 |
+
- **Frames:** 256x144 RGB JPEG, 5 Hz (VPT native rate).
|
| 20 |
+
- **Run length:** min 16, median 29, max 1055 frames. All runs >= 16.
|
| 21 |
+
- **`metadata.jsonl`:** one line per run — `{run, shard, n_frames, speed_mean}`.
|
| 22 |
|
| 23 |
+
Usable windows by sequence length: **seq 16 -> 100% of frames**, seq 24 -> 85%, seq 32 -> 73%.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
+
## Why tar files (and why the dataset viewer is off)
|
| 26 |
|
| 27 |
+
The `.tar` files are **not a WebDataset**. Each tar holds ordered directories, one per contiguous
|
| 28 |
+
gameplay run:
|
|
|
|
|
|
|
| 29 |
|
| 30 |
+
```
|
| 31 |
+
<run>/frames/frame_000000.jpg
|
| 32 |
+
<run>/frames/frame_000001.jpg
|
| 33 |
+
...
|
| 34 |
+
<run>/actions.jsonl # one JSON line per frame, same order as the frames
|
| 35 |
+
```
|
| 36 |
|
| 37 |
+
Three reasons for this layout:
|
| 38 |
+
|
| 39 |
+
1. **A world model trains on contiguous sequences, not independent samples.** The unit of training
|
| 40 |
+
is a window of N consecutive frames plus the actions taken across them. WebDataset's flat
|
| 41 |
+
`key.jpg` / `key.json` pairing has no way to express "these frames are consecutive and ordered",
|
| 42 |
+
and the viewer would shuffle them — which is meaningless for video.
|
| 43 |
+
2. **File count.** Stored as loose files this would be millions of objects in one repo, which makes
|
| 44 |
+
listing, cloning and LFS painful. Tars keep it to a few hundred objects.
|
| 45 |
+
3. **Sequential reads.** Training reads neighbouring frames together; a tar keeps them adjacent
|
| 46 |
+
rather than scattered across a bucket.
|
| 47 |
+
|
| 48 |
+
Because the layout is deliberately not WebDataset, HF's auto-detection cannot parse it and the
|
| 49 |
+
dataset viewer is disabled (`viewer: false`). Load the tars directly with the snippets below.
|
| 50 |
+
|
| 51 |
+
## Loading
|
| 52 |
+
|
| 53 |
+
```python
|
| 54 |
+
import json, tarfile, glob, os
|
| 55 |
+
from huggingface_hub import hf_hub_download
|
| 56 |
+
|
| 57 |
+
REPO = "codelion/neuralcraft-world-data"
|
| 58 |
+
|
| 59 |
+
# the index: one line per run -> pick what you want without downloading everything
|
| 60 |
+
meta = [json.loads(l) for l in
|
| 61 |
+
open(hf_hub_download(REPO, "metadata.jsonl", repo_type="dataset")) if l.strip()]
|
| 62 |
+
print(len(meta), "runs")
|
| 63 |
+
|
| 64 |
+
# fetch and unpack one tar
|
| 65 |
+
tar = hf_hub_download(REPO, meta[0]["path"] if "path" in meta[0]
|
| 66 |
+
else f"data/{meta[0]['shard']}.tar", repo_type="dataset")
|
| 67 |
+
with tarfile.open(tar) as tf:
|
| 68 |
+
tf.extractall("work")
|
| 69 |
+
```
|
| 70 |
+
|
| 71 |
+
Each tar unpacks to MANY run directories (`s00123_r0007/`, ...) — iterate them.
|
| 72 |
+
|
| 73 |
+
## Building training sequences
|
| 74 |
|
| 75 |
+
Frames and action records are index-aligned, so a training window is just a slice:
|
| 76 |
|
| 77 |
+
```python
|
| 78 |
+
import numpy as np
|
| 79 |
+
from PIL import Image
|
| 80 |
+
|
| 81 |
+
def load_run(run_dir):
|
| 82 |
+
frames = sorted(glob.glob(os.path.join(run_dir, "frames", "*.jpg")))
|
| 83 |
+
recs = [json.loads(l) for l in open(os.path.join(run_dir, "actions.jsonl")) if l.strip()]
|
| 84 |
+
n = min(len(frames), len(recs)) # always slice to the shorter of the two
|
| 85 |
+
actions = np.array([r["actions"] for r in recs[:n]], np.float32) # [n, 13]
|
| 86 |
+
return frames[:n], actions
|
| 87 |
+
|
| 88 |
+
def windows(frames, actions, seq_len=16, stride=8):
|
| 89 |
+
"""contiguous (frames, actions) windows — the unit a world model trains on"""
|
| 90 |
+
for s in range(0, len(frames) - seq_len + 1, stride):
|
| 91 |
+
imgs = np.stack([np.asarray(Image.open(f).convert("RGB"), np.float32) / 255.0
|
| 92 |
+
for f in frames[s:s + seq_len]]) # [seq,H,W,3]
|
| 93 |
+
yield imgs, actions[s:s + seq_len] # [seq,13]
|
| 94 |
+
```
|
| 95 |
+
|
| 96 |
+
```python
|
| 97 |
+
# a shard holds many runs
|
| 98 |
+
for run in sorted(os.listdir("work")):
|
| 99 |
+
frames, actions = load_run(os.path.join("work", run))
|
| 100 |
+
for imgs, acts in windows(frames, actions, seq_len=16):
|
| 101 |
+
... # train
|
| 102 |
+
```
|
| 103 |
+
|
| 104 |
+
## Actions (13-dim)
|
| 105 |
+
|
| 106 |
+
| idx | field | type | notes |
|
| 107 |
+
|---|---|---|---|
|
| 108 |
+
| 0-8 | `W, S, A, D, jump, sneak, sprint, attack, use` | binary | key presses |
|
| 109 |
+
| 9-10 | `cam_dx, cam_dy` | float [-1,1] | mouse delta (VPT ground truth), signed-sqrt scaled |
|
| 110 |
+
| 11 | `speed` | float [-1,1] | measured forward expansion, negative when moving backwards |
|
| 111 |
+
| 12 | `turn_rate` | float [-1,1] | measured horizontal flow |
|
| 112 |
+
|
| 113 |
+
Indices 0-10 are the player's *intent*; 11-12 measure what the world actually did.
|
| 114 |
+
|
| 115 |
+
Normalisation: `speed /= 1.266`, `turn_rate /= 1.559` (p95 of |value|), then clipped.
|
| 116 |
+
|
| 117 |
+
**Caveat on `speed`:** the Minecraft camera rotates independently of travel direction (mouse look),
|
| 118 |
+
so radial expansion mixes translation with head-turning. It is a useful signal but not pure walking
|
| 119 |
+
speed — `cam_dx/dy` are stored separately so a model can disentangle the two.
|
| 120 |
+
|
| 121 |
+
|
| 122 |
+
## Curation
|
| 123 |
|
| 124 |
+
1. **Near-black frames dropped** (brightness < 32) — unlit caves/night carry little learnable signal.
|
| 125 |
+
2. **GUI/menu removal** with a CLIP content classifier (P(gameplay) < 0.20): inventory, crafting,
|
| 126 |
+
chest, trading and pause screens, plus non-game content in the source screen recordings.
|
| 127 |
+
A colour-based detector was tried first and failed — Minecraft's stone textures share the GUI
|
| 128 |
+
greys, so the filter has to be semantic.
|
| 129 |
+
3. **Re-segmented into contiguous runs of >= 16 frames** after filtering, because filtering creates
|
| 130 |
+
gaps and a world model needs unbroken windows.
|
| 131 |
+
4. **Ego-motion measured** per frame with optical flow and appended to the action vector.
|
| 132 |
|
| 133 |
+
15.1M source frames -> 5,548,016 curated (~63% removed).
|