Upload 11 files
Browse files- .gitattributes +3 -0
- data/1.hdf5 +0 -0
- data/2.hdf5 +3 -0
- data/3.hdf5 +3 -0
- data/4.hdf5 +3 -0
- data/5.hdf5 +0 -0
- metadata/1.json +1 -0
- metadata/2.json +1 -0
- metadata/3.json +1 -0
- metadata/4.json +1 -0
- metadata/5.json +1 -0
- nle_hf_dataset.py +135 -0
.gitattributes
CHANGED
|
@@ -52,3 +52,6 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 52 |
*.jpg filter=lfs diff=lfs merge=lfs -text
|
| 53 |
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
| 54 |
*.webp filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
*.jpg filter=lfs diff=lfs merge=lfs -text
|
| 53 |
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
| 54 |
*.webp filter=lfs diff=lfs merge=lfs -text
|
| 55 |
+
data/2.hdf5 filter=lfs diff=lfs merge=lfs -text
|
| 56 |
+
data/3.hdf5 filter=lfs diff=lfs merge=lfs -text
|
| 57 |
+
data/4.hdf5 filter=lfs diff=lfs merge=lfs -text
|
data/1.hdf5
ADDED
|
Binary file (876 kB). View file
|
|
|
data/2.hdf5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:679b5f08f142c3e4137aab2f09ee104d19143b5d0ff3cbefd4f977e25ea52d7d
|
| 3 |
+
size 2259937
|
data/3.hdf5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5a7b43e789f6075bc1454f13fb6daf521397ef9623387b757c38dedceabeab44
|
| 3 |
+
size 1578608
|
data/4.hdf5
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d12a393f05a308190239abfcc0f69e38de96bbd33de52ba6fc0ea20fc4ee6cfd
|
| 3 |
+
size 6045200
|
data/5.hdf5
ADDED
|
Binary file (895 kB). View file
|
|
|
metadata/1.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"gameid": 1, "version": "3.6.6", "points": 1781, "deathdnum": 0, "deathlev": 1, "maxlvl": 1, "hp": 0, "maxhp": 56, "deaths": 1, "deathdate": 20220518, "birthdate": 20220518, "uid": 1185200751, "role": "Sam", "race": "Hum", "gender": "Mal", "align": "Law", "name": "Agent", "death": "killed by a hobbit while frozen by a monster's gaze", "conduct": "0xfc0", "turns": 9717, "achieve": "0x0", "realtime": 53, "starttime": 1652877482, "endtime": 1652877535, "gender0": "Mal", "align0": "Law", "flags": "0x4"}
|
metadata/2.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"gameid": 2, "version": "3.6.6", "points": 10000, "deathdnum": 2, "deathlev": 5, "maxlvl": 5, "hp": 0, "maxhp": 82, "deaths": 1, "deathdate": 20220518, "birthdate": 20220518, "uid": 1185200751, "role": "Cav", "race": "Dwa", "gender": "Mal", "align": "Law", "name": "Agent", "death": "poisoned by a rotted giant ant corpse", "conduct": "0xf80", "turns": 26577, "achieve": "0x0", "realtime": 147, "starttime": 1652877536, "endtime": 1652877683, "gender0": "Mal", "align0": "Law", "flags": "0x4"}
|
metadata/3.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"gameid": 3, "version": "3.6.6", "points": 4805, "deathdnum": 0, "deathlev": 1, "maxlvl": 1, "hp": 0, "maxhp": 55, "deaths": 1, "deathdate": 20220518, "birthdate": 20220518, "uid": 1185200751, "role": "Kni", "race": "Hum", "gender": "Mal", "align": "Law", "name": "Agent", "death": "killed by a giant rat while fainted from lack of food", "conduct": "0xf80", "turns": 20808, "achieve": "0x0", "realtime": 108, "starttime": 1652878150, "endtime": 1652878258, "gender0": "Mal", "align0": "Law", "flags": "0x4"}
|
metadata/4.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"gameid": 4, "version": "3.6.6", "points": 53678, "deathdnum": 2, "deathlev": 6, "maxlvl": 7, "hp": 0, "maxhp": 110, "deaths": 1, "deathdate": 20220518, "birthdate": 20220518, "uid": 1185200751, "role": "Bar", "race": "Orc", "gender": "Mal", "align": "Cha", "name": "Agent", "death": "killed by a leocrotta while fainted from lack of food", "conduct": "0xf80", "turns": 41646, "achieve": "0x0", "realtime": 301, "starttime": 1652878258, "endtime": 1652878559, "gender0": "Mal", "align0": "Cha", "flags": "0x4"}
|
metadata/5.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"gameid": 5, "version": "3.6.6", "points": 2055, "deathdnum": 0, "deathlev": 1, "maxlvl": 1, "hp": 0, "maxhp": 49, "deaths": 1, "deathdate": 20220518, "birthdate": 20220518, "uid": 1185200751, "role": "Cav", "race": "Gno", "gender": "Fem", "align": "Neu", "name": "Agent", "death": "killed by a gecko while fainted from lack of food", "conduct": "0xfc0", "turns": 15617, "achieve": "0x0", "realtime": 65, "starttime": 1652878559, "endtime": 1652878624, "gender0": "Fem", "align0": "Neu", "flags": "0x4"}
|
nle_hf_dataset.py
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
|
| 2 |
+
#
|
| 3 |
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
| 4 |
+
# you may not use this file except in compliance with the License.
|
| 5 |
+
# You may obtain a copy of the License at
|
| 6 |
+
#
|
| 7 |
+
# http://www.apache.org/licenses/LICENSE-2.0
|
| 8 |
+
#
|
| 9 |
+
# Unless required by applicable law or agreed to in writing, software
|
| 10 |
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
| 11 |
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
| 12 |
+
# See the License for the specific language governing permissions and
|
| 13 |
+
# limitations under the License.
|
| 14 |
+
|
| 15 |
+
""" Dungeons and Data: A Large-Scale NetHack Dataset. """
|
| 16 |
+
|
| 17 |
+
import h5py
|
| 18 |
+
import json
|
| 19 |
+
import os
|
| 20 |
+
import datasets
|
| 21 |
+
|
| 22 |
+
|
| 23 |
+
_CITATION = """\
|
| 24 |
+
@article{hambro2022dungeons,
|
| 25 |
+
title={Dungeons and Data: A Large-Scale NetHack Dataset},
|
| 26 |
+
author={Hambro, Eric and Raileanu, Roberta and Rothermel, Danielle and Mella, Vegard and Rockt{\"a}schel, Tim and K{\"u}ttler, Heinrich and Murray, Naila},
|
| 27 |
+
journal={arXiv preprint arXiv:2211.00539},
|
| 28 |
+
year={2022}
|
| 29 |
+
}
|
| 30 |
+
"""
|
| 31 |
+
|
| 32 |
+
_DESCRIPTION = """\
|
| 33 |
+
3 billion state-action-score transitions from 100,000 trajectories collected from the symbolic bot winner of the NetHack Challenge 2021.
|
| 34 |
+
"""
|
| 35 |
+
|
| 36 |
+
_HOMEPAGE = ""
|
| 37 |
+
|
| 38 |
+
_LICENSE = ""
|
| 39 |
+
|
| 40 |
+
_URLS = {
|
| 41 |
+
"data": "https://huggingface.co/datasets/Howuhh/nle_hf_dataset/tree/main/data",
|
| 42 |
+
"metadata": "https://huggingface.co/datasets/Howuhh/nle_hf_dataset/tree/main/metadata",
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
class NleHfDataset(datasets.GeneratorBasedBuilder):
|
| 46 |
+
"""Dungeons and Data: A Large-Scale NetHack Dataset."""
|
| 47 |
+
VERSION = datasets.Version("1.0.0")
|
| 48 |
+
|
| 49 |
+
BUILDER_CONFIGS = [
|
| 50 |
+
datasets.BuilderConfig(name="data", version=VERSION, description="Data for all episodes"),
|
| 51 |
+
datasets.BuilderConfig(name="metadata", version=VERSION, description="Metadata for all episodes"),
|
| 52 |
+
]
|
| 53 |
+
DEFAULT_CONFIG_NAME = "metadata" # It's not mandatory to have a default configuration. Just use one if it make sense.
|
| 54 |
+
|
| 55 |
+
def _info(self):
|
| 56 |
+
if self.config.name == "metadata":
|
| 57 |
+
features = datasets.Features(
|
| 58 |
+
{
|
| 59 |
+
"gameid": datasets.Value("int32"),
|
| 60 |
+
"version": datasets.Value("string"),
|
| 61 |
+
"points": datasets.Value("int32"),
|
| 62 |
+
"deathdnum": datasets.Value("int32"),
|
| 63 |
+
"deathlev": datasets.Value("int32"),
|
| 64 |
+
"maxlvl": datasets.Value("int32"),
|
| 65 |
+
"hp": datasets.Value("int32"),
|
| 66 |
+
"maxhp": datasets.Value("int32"),
|
| 67 |
+
"deaths": datasets.Value("int32"),
|
| 68 |
+
"deathdate": datasets.Value("int32"),
|
| 69 |
+
"birthdate": datasets.Value("int32"),
|
| 70 |
+
"uid": datasets.Value("int32"),
|
| 71 |
+
"role": datasets.Value("string"),
|
| 72 |
+
"race": datasets.Value("string"),
|
| 73 |
+
"gender": datasets.Value("string"),
|
| 74 |
+
"align": datasets.Value("string"),
|
| 75 |
+
"name": datasets.Value("string"),
|
| 76 |
+
"death": datasets.Value("string"),
|
| 77 |
+
"conduct": datasets.Value("string"),
|
| 78 |
+
"turns": datasets.Value("int32"),
|
| 79 |
+
"achieve": datasets.Value("string"),
|
| 80 |
+
"realtime": datasets.Value("int64"),
|
| 81 |
+
"starttime": datasets.Value("int64"),
|
| 82 |
+
"endtime": datasets.Value("int64"),
|
| 83 |
+
"gender0": datasets.Value("string"),
|
| 84 |
+
"align0": datasets.Value("string"),
|
| 85 |
+
"flags": datasets.Value("string")
|
| 86 |
+
}
|
| 87 |
+
)
|
| 88 |
+
else:
|
| 89 |
+
features = datasets.Features(
|
| 90 |
+
{
|
| 91 |
+
"tty_chars": datasets.Value("uint8"),
|
| 92 |
+
"tty_colors": datasets.Value("int8"),
|
| 93 |
+
"tty_cursor": datasets.Value("int16"),
|
| 94 |
+
"actions": datasets.Value("int16"),
|
| 95 |
+
"rewards": datasets.Value("int32"),
|
| 96 |
+
"dones": datasets.Value("bool"),
|
| 97 |
+
}
|
| 98 |
+
)
|
| 99 |
+
|
| 100 |
+
return datasets.DatasetInfo(
|
| 101 |
+
description=_DESCRIPTION,
|
| 102 |
+
features=features,
|
| 103 |
+
homepage=_HOMEPAGE,
|
| 104 |
+
license=_LICENSE,
|
| 105 |
+
citation=_CITATION,
|
| 106 |
+
)
|
| 107 |
+
|
| 108 |
+
def _split_generators(self, dl_manager):
|
| 109 |
+
urls = _URLS[self.config.name]
|
| 110 |
+
data_dir = dl_manager.download_and_extract(urls)
|
| 111 |
+
return [
|
| 112 |
+
datasets.SplitGenerator(
|
| 113 |
+
name=datasets.Split.TRAIN,
|
| 114 |
+
gen_kwargs={"filepath": data_dir, "split": "train"},
|
| 115 |
+
)
|
| 116 |
+
]
|
| 117 |
+
|
| 118 |
+
def _generate_examples(self, filepath, split):
|
| 119 |
+
if self.config.name == "metadata":
|
| 120 |
+
for i in range(1, 5):
|
| 121 |
+
with open(os.path.join(filepath, f"{i}.json"), encoding="utf-8") as f:
|
| 122 |
+
data = json.loads(f.read())
|
| 123 |
+
|
| 124 |
+
yield i, data
|
| 125 |
+
else:
|
| 126 |
+
for i in range(1, 5):
|
| 127 |
+
with h5py.File(os.path.join(filepath, f"{i}.hdf5"), "r") as f:
|
| 128 |
+
yield i, {
|
| 129 |
+
"tty_chars": f["tty_chars"][()],
|
| 130 |
+
"tty_colors": f["tty_colors"][()],
|
| 131 |
+
"tty_cursor": f["tty_cusor"][()],
|
| 132 |
+
"actions": f["actions"][()],
|
| 133 |
+
"rewards": f["rewards"][()],
|
| 134 |
+
"dones": f["dones"][()]
|
| 135 |
+
}
|