Upload README.md with huggingface_hub
Browse files9 unmodified lines101112131415161 unmodified line1819202122232425269 unmodified lines# Multi-Drive World Model DataAction-conditioned driving gameplay from multiple racing games, grouped by visual theme, for training a multi-game world model. 1,073,248 frames across 155 clips. Commercial-game clips (realistic, arcade) are filtered to gameplay only (menus, results, loading, and non-game screens removed via a CLIP content classifier + motion).| theme | source games | clips | frames ||---|---|---|---|1 unmodified line| realistic | forza-horizon, need-for-speed | 27 | 340,722 || arcade | asphalt-9 | 10 | 142,966 |## Format- **Frames:** 384×216 RGB JPEG.- **Actions:** one per frame, 5-dim binary multi-hot `[accelerate, brake, left, right, drift]`.- **Layout:** each `data/<theme>/<clip>.tar` unpacks to `<clip>/frames/frame_*.jpg` and `<clip>/actions.jsonl` (one JSON line per frame: `{frame_file, actions, theme, game}`).- **`metadata.jsonl`:** clip index, one line per clip: `{clip, theme, game, n_frames, path}`.9 unmodified lines10111213141516171 unmodified line1920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211229 unmodified lines# Multi-Drive World Model DataAction-conditioned driving gameplay from multiple racing games, grouped by visual **theme**, fortraining a single multi-game world model. 1,073,248 frames across 155 clips.| theme | source games | clips | frames ||---|---|---|---|1 unmodified line| realistic | forza-horizon, need-for-speed | 27 | 340,722 || arcade | asphalt-9 | 10 | 142,966 |- **Frames:** 384x216 RGB JPEG.- **`metadata.jsonl`:** one line per clip — `{clip, theme, game, n_frames, path}`.## Why tar files (and why the dataset viewer is off)The `.tar` files are **not a WebDataset**. Each tar holds ordered directories, one per contiguousgameplay run:```<run>/frames/frame_000000.jpg<run>/frames/frame_000001.jpg...<run>/actions.jsonl # one JSON line per frame, same order as the frames```Three reasons for this layout:1. **A world model trains on contiguous sequences, not independent samples.** The unit of trainingis a window of N consecutive frames plus the actions taken across them. WebDataset's flat`key.jpg` / `key.json` pairing has no way to express "these frames are consecutive and ordered",and the viewer would shuffle them — which is meaningless for video.2. **File count.** Stored as loose files this would be millions of objects in one repo, which makeslisting, cloning and LFS painful. Tars keep it to a few hundred objects.3. **Sequential reads.** Training reads neighbouring frames together; a tar keeps them adjacentrather than scattered across a bucket.Because the layout is deliberately not WebDataset, HF's auto-detection cannot parse it and thedataset viewer is disabled (`viewer: false`). Load the tars directly with the snippets below.## Loading```pythonimport json, tarfile, glob, osfrom huggingface_hub import hf_hub_downloadREPO = "codelion/multi-drive-model-data"# the index: one line per run -> pick what you want without downloading everythingmeta = [json.loads(l) for l inopen(hf_hub_download(REPO, "metadata.jsonl", repo_type="dataset")) if l.strip()]print(len(meta), "runs")# fetch and unpack one tartar = hf_hub_download(REPO, meta[0]["path"] if "path" in meta[0]else f"data/{meta[0]['shard']}.tar", repo_type="dataset")with tarfile.open(tar) as tf:tf.extractall("work")```Each tar unpacks to a single `<clip>/` directory.## Building training sequencesFrames and action records are index-aligned, so a training window is just a slice:```pythonimport numpy as npfrom PIL import Imagedef load_run(run_dir):frames = sorted(glob.glob(os.path.join(run_dir, "frames", "*.jpg")))recs = [json.loads(l) for l in open(os.path.join(run_dir, "actions.jsonl")) if l.strip()]n = min(len(frames), len(recs)) # always slice to the shorter of the twoactions = np.array([r["actions"] for r in recs[:n]], np.float32) # [n, 7]return frames[:n], actionsdef windows(frames, actions, seq_len=16, stride=8):"""contiguous (frames, actions) windows — the unit a world model trains on"""for s in range(0, len(frames) - seq_len + 1, stride):imgs = np.stack([np.asarray(Image.open(f).convert("RGB"), np.float32) / 255.0for f in frames[s:s + seq_len]]) # [seq,H,W,3]yield imgs, actions[s:s + seq_len] # [seq,7]```Themes are the conditioning label used by the model (game names stay in the metadata).## Actions (7-dim)| idx | field | type | notes ||---|---|---|---|| 0-4 | `accel, brake, left, right, drift` | binary | key presses = the player's *intent* || 5 | `speed` | float [-1,1] | measured forward expansion, **negative when reversing** || 6 | `turn_rate` | float [-1,1] | measured horizontal flow |Indices 0-4 are what the player pressed; 5-6 measure what the world actually did (optical flow).Both are included deliberately: key presses alone are a weak conditioning signal here, because`accel` is held in 73-88% of frames — a near-constant bit carries almost no information, and amodel trained on it alone ignores the throttle entirely.Normalisation: `speed /= 1.266`, `turn_rate /= 1.559` (p95 of |value|), then clipped to [-1,1].Note `turn_rate` is a *measurement*, so it lags the key press by ~6 frames (~0.4 s) — the car'svisual response to steering, not the input event.## Curation1. Gameplay-only filtering of commercial-game screen recordings: a CLIP content classifier removesmenus, car-select, results/reward screens, loading, and non-game content (browsers, streams)present in the source captures; near-static frames are dropped by a motion floor. ~45% of theraw recordings were not gameplay.2. Ego-motion measured per frame with optical flow and appended to the action vector.
README.md+102-6