jxu124 commited on
Commit
3ef7f59
1 Parent(s): 9dbcc08

Update OpenX-Embodiment.py

Browse files
Files changed (1) hide show
  1. OpenX-Embodiment.py +8 -8
OpenX-Embodiment.py CHANGED
@@ -1,4 +1,4 @@
1
-
2
  from typing import Optional, List
3
  from dataclasses import dataclass
4
  from io import BytesIO
@@ -31,7 +31,7 @@ def load_webdataset(filepath):
31
  return wds.WebDataset(filepath).decode().map(decode_image)
32
 
33
 
34
- _RTX_DATASETS = {
35
  'fractal20220817_data': 78,
36
  'kuka': 448,
37
  'bridge': 49,
@@ -88,25 +88,25 @@ _RTX_DATASETS = {
88
  'berkeley_gnm_cory_hall': 1,
89
  'berkeley_gnm_sac_son': 3
90
  }
91
- _RTX_DATASETS_URLS = {k: [f"{k}/{k}_{i:05d}.tar" for i in range(v)] for k, v in _RTX_DATASETS.items()}
92
 
93
 
94
  @dataclass
95
- class RTXConfig(datasets.BuilderConfig):
96
  features: Optional[datasets.Features] = None
97
 
98
 
99
- class RTXDataset(datasets.GeneratorBasedBuilder):
100
  VERSION = datasets.Version("1.0.0")
101
- BUILDER_CONFIG_CLASS = RTXConfig
102
- BUILDER_CONFIGS = [RTXConfig(name=dn) for dn in _RTX_DATASETS.keys()]
103
  DEFAULT_CONFIG_NAME = "fractal20220817_data"
104
 
105
  def _info(self):
106
  return datasets.DatasetInfo(features=self.config.features)
107
 
108
  def _split_generators(self, dl_manager: datasets.DownloadManager):
109
- files = dl_manager.download(_RTX_DATASETS_URLS[self.info.config_name])
110
  if self.info.features is None:
111
  for d in load_webdataset(files[0]):
112
  self.info.features = datasets.Dataset.from_list([d]).features
 
1
+ ## huggingface datasets: jxu124/OpenX-Embodiment
2
  from typing import Optional, List
3
  from dataclasses import dataclass
4
  from io import BytesIO
 
31
  return wds.WebDataset(filepath).decode().map(decode_image)
32
 
33
 
34
+ _OPENX_DATASETS = {
35
  'fractal20220817_data': 78,
36
  'kuka': 448,
37
  'bridge': 49,
 
88
  'berkeley_gnm_cory_hall': 1,
89
  'berkeley_gnm_sac_son': 3
90
  }
91
+ _OPENX_DATASETS_URLS = {k: [f"{k}/{k}_{i:05d}.tar" for i in range(v)] for k, v in _OPENX_DATASETS.items()}
92
 
93
 
94
  @dataclass
95
+ class OpenXConfig(datasets.BuilderConfig):
96
  features: Optional[datasets.Features] = None
97
 
98
 
99
+ class OpenXDataset(datasets.GeneratorBasedBuilder):
100
  VERSION = datasets.Version("1.0.0")
101
+ BUILDER_CONFIG_CLASS = OpenXConfig
102
+ BUILDER_CONFIGS = [OpenXConfig(name=dn) for dn in _OPENX_DATASETS.keys()]
103
  DEFAULT_CONFIG_NAME = "fractal20220817_data"
104
 
105
  def _info(self):
106
  return datasets.DatasetInfo(features=self.config.features)
107
 
108
  def _split_generators(self, dl_manager: datasets.DownloadManager):
109
+ files = dl_manager.download(_OPENX_DATASETS_URLS[self.info.config_name])
110
  if self.info.features is None:
111
  for d in load_webdataset(files[0]):
112
  self.info.features = datasets.Dataset.from_list([d]).features