Skip to content

Commit

Permalink
fix tools/convert_state to pop out obs key in input demo files (this …
Browse files Browse the repository at this point in the history
…affects ManiSkill2 0.5+)
  • Loading branch information
xuanlinli17 committed Sep 4, 2023
1 parent 36126cb commit fafbcaf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tools/convert_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ def convert_state_representation(keys, args, worker_id, main_process_id):
cnt += 1
replay.to_hdf5(group, with_traj_index=False)
output_h5.close()
input_h5.close()
flush_print(f"Finish using {output_file}")


Expand Down Expand Up @@ -198,8 +199,11 @@ def main():
print(f"Trajectory generation for {args.env_name} with output path {args.output_name} has been completed!!")
return

with h5py.File(args.traj_name, "r") as h5_file:
with h5py.File(args.traj_name, "r+") as h5_file:
keys = sorted(h5_file.keys())
# remove empty "obs" key from the input h5 file
for key in keys:
_ = h5_file[key].pop('obs', None)
if args.max_num_traj < 0:
args.max_num_traj = len(keys)
args.max_num_traj = min(len(keys), args.max_num_traj)
Expand Down

0 comments on commit fafbcaf

Please sign in to comment.