File size: 5,255 Bytes
2a40f16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
---
pretty_name: Minecraft VPT Tokenized Latents
language:
- en
task_categories:
- reinforcement-learning
tags:
- minecraft
- latent-representations
- offline-reinforcement-learning
- arrayrecord
- vpt
- world-model
size_categories:
- n<1M
---

# Minecraft VPT Tokenized Latents

Pre-tokenized latent episodes and aligned VPT-style actions derived from the
Minecraft VPT MP4 ArrayRecord dataset. The files are msgpack-encoded
ArrayRecord shards intended for dynamics and world-model training in
`dreamer4-jax-private`.

## Download

```bash
pip install -U huggingface_hub
hf download reactor-team/minecraft-vpt-tokenized \
  --repo-type dataset \
  --local-dir /path/to/tokenized_data_500M
```

The expected layout is:

```text
/path/to/tokenized_data_500M/
  shard-00000.array_record
  shard-00001.array_record
  ...
  metadata/latent_stats.npz  # when included in the source data
```

Do not use `datasets.load_dataset()` for this repository: these are ArrayRecord
shards rather than Parquet files or a standard Hugging Face dataset builder.

## Record format

Each ArrayRecord entry is a msgpack dictionary:

```python
{
    "latents": latent_array,    # (T, n_latents, d_bottleneck)
    "actions": actions_dict,    # action arrays aligned with T
    "source": "optional-id-or-path",
}
```

NumPy arrays are encoded recursively as dictionaries containing `_type`,
`data`, `shape`, and `dtype` fields.

## Reading records directly

```bash
pip install array-record msgpack numpy
```

```python
import msgpack
import numpy as np
from array_record.python.array_record_module import ArrayRecordReader


def decode(value):
    if isinstance(value, dict):
        if value.get("_type") == "ndarray":
            return np.frombuffer(
                value["data"], dtype=value["dtype"]
            ).reshape(tuple(value["shape"]))
        return {key: decode(item) for key, item in value.items()}
    return value


reader = ArrayRecordReader(
    "/path/to/tokenized_data_500M/shard-00000.array_record"
)
packed = msgpack.unpackb(reader.read(0), raw=False)
record = {key: decode(value) for key, value in packed.items()}

print(record["latents"].shape)
print({key: value.shape for key, value in record["actions"].items()})
```

The same decoding logic is available as `deserialize_msgpack_record` in
`dreamer/data/serialization.py`.

## Using with dreamer4-jax-private

Set the dataset path and actual local shard count in
`configs/dataset/minecraft_vpt_latent.yaml`:

```yaml
name: minecraft_vpt_latent
data_type: latent
array_record_path: /path/to/tokenized_data_500M
index_max: 89
```

The example `index_max: 89` loads `shard-00000.array_record` through
`shard-00088.array_record`. Change it if the repository contains a different
number of shards or if you downloaded only a contiguous subset.

The Dreamer loader uses `grain.sources.ArrayRecordDataSource`, deserializes the
msgpack records, normalizes latents, slices temporal sequences, and batches the
latents with their aligned actions.

For the tokenizer checkpoint used to produce this dataset, the example Dreamer
configuration uses a bottleneck width of 16 and the following statistics:

```yaml
C: 16
latent_mean: [-0.0127555020, -0.0442529507, 0.0824803188, 0.0427149609,
  0.0089577036, -0.0018820130, -0.0128933704, -0.0824453905,
  0.0111762192, -0.0944086686, -0.0582579300, -0.0497550331,
  -0.0025538108, 0.0423149280, -0.0691476464, 0.0755984560]
latent_std: [0.0848616436, 0.0906647444, 0.1006800979, 0.0940773115,
  0.1937398762, 0.0892994478, 0.0907244012, 0.1050340906,
  0.1614910215, 0.1081596166, 0.1500685960, 0.1263765246,
  0.0923914909, 0.1015426889, 0.1079730168, 0.1093038395]
```

Use the statistics shipped in `metadata/latent_stats.npz` when available, and
ensure they match the tokenizer checkpoint and the latent channel width.

```python
import numpy as np

stats = np.load("/path/to/tokenized_data_500M/metadata/latent_stats.npz")
print("latent_mean:", stats["mean"].tolist())
print("latent_std:", stats["std"].tolist())
print("num_samples:", int(stats["num_samples"]))
print("num_videos:", int(stats["num_videos"]))
```

## Important constraints

- Preserve contiguous `shard-NNNNN.array_record` filenames.
- `index_max` is a shard count, not an episode count.
- Every selected record must contain at least `long_T` timesteps.
- Dynamics training requires `long_T % short_T == 0` when short sequences are
  packed into long training examples.
- The global batch size must be divisible by `jax.process_count()`.
- Actions and latents must remain temporally aligned.
- `latent_mean`, `latent_std`, `C`, and the tokenizer checkpoint must agree.

Count locally available shards with:

```bash
find /path/to/tokenized_data_500M -maxdepth 1 \
  -name 'shard-*.array_record' | sort | wc -l
```

## Intended use

This dataset is intended for research on latent dynamics modeling,
action-conditioned world models, long-context sequence modeling, and Minecraft
behavior prediction. It is not a drop-in replacement for raw video when pixel
reconstruction is required; decoding requires the matching tokenizer model.

Users are responsible for validating the data, its provenance, and whether
their intended use complies with applicable licenses, platform terms, and
policies.