Skip to content

Commit

Permalink
some polish, removed tester file
Browse files Browse the repository at this point in the history
  • Loading branch information
balisujohn committed Aug 1, 2023
1 parent 4c0f466 commit 2c9c0ab
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 275 deletions.
10 changes: 4 additions & 6 deletions minari/dataset/minari_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,18 +144,16 @@ def __init__(
total_steps = self._data.total_steps
else:
total_steps = sum(
self._data.apply(
lambda episode: episode["total_timesteps"],
episode_indices=episode_indices,
self._data.apply(
lambda episode: episode["total_timesteps"],
episode_indices=episode_indices,
)
)
)

self._episode_indices = episode_indices

assert self._episode_indices is not None



self.spec = MinariDatasetSpec(
env_spec=self._data.env_spec,
total_episodes=self._episode_indices.size,
Expand Down
9 changes: 2 additions & 7 deletions minari/dataset/minari_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,9 @@ def update_from_collector_env(
file.attrs.modify(
"total_episodes", last_episode_id + new_data_total_episodes
)
file.attrs.modify(
"total_steps", self._total_steps
)
file.attrs.modify("total_steps", self._total_steps)
self._total_episodes = int(file.attrs["total_episodes"].item())


def update_from_buffer(self, buffer: List[dict], data_path: str):
additional_steps = 0
with h5py.File(data_path, "a", track_order=True) as file:
Expand Down Expand Up @@ -254,9 +251,7 @@ def update_from_buffer(self, buffer: List[dict], data_path: str):
self._total_episodes = last_episode_id + len(buffer)

file.attrs.modify("total_episodes", self._total_episodes)
file.attrs.modify(
"total_steps", self._total_steps
)
file.attrs.modify("total_steps", self._total_steps)

self._total_episodes = int(file.attrs["total_episodes"].item())

Expand Down
262 changes: 0 additions & 262 deletions tester.py

This file was deleted.

0 comments on commit 2c9c0ab

Please sign in to comment.