Dataset Viewer
The dataset viewer is not available because its heuristics could not detect any supported data files. You can try uploading some data files, or configuring the data files location manually.
The High-Level Rocket League Replay Dataset, parsed into rlgym-tools ReplayFrame objects, and serialized into numpy arrays.
To stream or download this dataset, you can use this code as reference. Note that finding all the remote files can take some time.
import os
import glob
import numpy as np
from concurrent.futures import ThreadPoolExecutor
from huggingface_hub import DatasetCard, HfFileSystem, snapshot_download
from rlgym_tools.rocket_league.misc.serialize import deserialize_replay_frame
REPO_ID = "Rolv-Arild/hlrlrd-parsed"
CONFIG_NAME = "default" # or "smol" for a smaller subset
SPLIT = "train" # or "test", "validation", None
def get_file_patterns(config_name, split, local_dir=None):
"""Parses the README.md YAML to find target file patterns."""
readme_path = os.path.join(local_dir, "README.md") if local_dir else REPO_ID
# Load the dataset card (works for both remote repo ID and local path)
card = DatasetCard.load(readme_path)
configs = card.data.get("configs", [])
patterns = []
for config in configs:
if config.get("config_name") == config_name:
for data_file in config.get("data_files", []):
# If split is passed as None, it will download all splits for the config
if split is None or data_file.get("split") == split:
p = data_file.get("path")
if isinstance(p, str):
patterns.append(p)
elif isinstance(p, list):
patterns.extend(p)
break
return patterns
def fetch_npz(path):
"""Helper to fetch and load a single .npz file remotely."""
fs = HfFileSystem()
with fs.open(path, "rb") as f:
with np.load(f) as data:
return data[data.files[0]]
def stream_remote(config_name, split, max_workers=4):
"""Streams arrays directly over the network with multithreaded pre-fetching."""
fs = HfFileSystem()
patterns = get_file_patterns(config_name, split)
paths = []
for pattern in patterns:
paths.extend(fs.glob(f"datasets/{REPO_ID}/{pattern}"))
# Use ThreadPoolExecutor to pre-fetch and load the next files in the background
with ThreadPoolExecutor(max_workers=max_workers) as executor:
for array in executor.map(fetch_npz, paths):
yield array
def stream_local(local_dir, config_name, split):
"""Yields arrays from a locally downloaded dataset."""
patterns = get_file_patterns(config_name, split, local_dir)
for pattern in patterns:
full_pattern = os.path.join(local_dir, pattern)
for path in glob.glob(full_pattern, recursive=True):
with np.load(path) as data:
yield data[data.files[0]]
def iter_frames(np_stream):
"""Deserializes raw numpy arrays into Rocket League frames."""
for array in np_stream:
for vec in array:
yield deserialize_replay_frame(vec)
# ==========================================
# Execution Examples
# ==========================================
# --- 1. Stream Remote ---
print(f"Streaming remote frames for {CONFIG_NAME} - {SPLIT}...")
remote_stream = stream_remote(CONFIG_NAME, SPLIT)
for frame in iter_frames(remote_stream):
print("Successfully streamed a remote frame!")
break
# --- 2. Download and Stream Local ---
# Optional: Enable the faster Rust download engine (Requires: pip install hf_transfer)
os.environ["HF_HUB_ENABLE_HF_TRANSFER"] = "1"
patterns_to_download = get_file_patterns(CONFIG_NAME, split=None) # download all splits
local_dir = snapshot_download(
repo_id=REPO_ID,
repo_type="dataset",
allow_patterns=["README.md"] + patterns_to_download,
local_dir="./hlrlrd_local"
)
print(f"Streaming local frames from {local_dir}...")
local_stream = stream_local(local_dir, CONFIG_NAME, SPLIT)
for frame in iter_frames(local_stream):
print("Successfully streamed a local frame!")
break
- Downloads last month
- 37,843