Skip to content

Commit

Permalink
Fix split optional requirement (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
KeplerC committed May 1, 2024
1 parent 00bbb7f commit 1c6e2f8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 19 deletions.
40 changes: 22 additions & 18 deletions examples/basic/hello_world.py
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
import fog_x

# create a new dataset
# 🦊 Dataset Creation
# from distributed dataset storage
dataset = fog_x.Dataset(
name="test_rtx",
path="/tmp/rtx",
)

# create a new episode / trajectory
trajectory = dataset.new_episode()
trajectory.add(feature="hello", value=1.0)
trajectory.add(feature="world", value=2.0)
trajectory.close()
name="demo_ds",
path="~/test_dataset", # can be AWS S3, Google Bucket!
)

# iterate through the dataset
for episode in dataset.read_by(
pandas_metadata=dataset.get_metadata_as_pandas_df()
):
print(episode)
# 🦊 Data collection:
# create a new trajectory
episode = dataset.new_episode()
# collect step data for the episode
episode.add(feature = "arm_view", value = "image1.jpg")
# Automatically time-aligns and saves the trajectory
episode.close()

# export the dataset as standard rt-x format
dataset.export(
"/tmp/rtx_export", format="rtx", obs_keys=["hello"], act_keys=["world"]
# 🦊 Data Loading:
# load from existing RT-X/Open-X datasets
dataset.load_rtx_episodes(
name="berkeley_autolab_ur5",
additional_metadata={"collector": "User 2"}
)

# 🦊 Data Management and Analytics:
# Compute and memory efficient filter, map, aggregate, groupby
episode_info = dataset.get_episode_info()
desired_episodes = episode_info.filter(episode_info["collector"] == "User 2")
2 changes: 1 addition & 1 deletion fog_x/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ def export_rtx(
def load_rtx_episodes(
self,
name: str,
split: Optional[str] = None,
split: str = "all",
additional_metadata: Optional[Dict[str, Any]] = dict(),
):
"""
Expand Down

0 comments on commit 1c6e2f8

Please sign in to comment.