Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make a proper test for trajectory replay tool #129

Open
StoneT2000 opened this issue Aug 4, 2023 · 5 comments
Open

Make a proper test for trajectory replay tool #129

StoneT2000 opened this issue Aug 4, 2023 · 5 comments
Labels

Comments

@StoneT2000
Copy link
Member

Currently we just run the replay tool for coverage purposes. Should add tests to check the actual contents of the saved trajectories/videos.

@zhuoqun-chen
Copy link

@StoneT2000 Agree! Also, is there a way to save successful trajectories produced during policy evaluation so they may be used for imitation learning?

@StoneT2000
Copy link
Member Author

I recommend using the RecordEpisodeWrapper from the maniskill2 package which will automatically save trajectories you run through the env following the maniskill2 format

@StoneT2000
Copy link
Member Author

mani_skill2/utils/wrappers/record.py
this one

@zhuoqun-chen
Copy link

@StoneT2000 Hi Stone! I tried this one, but it seems that the saved xxx.h5 is not readable by using:

import h5py

f = h5py.File("path_to_trajectory_file/xxx.h5", "r")

the corresponding error messages are:

Traceback (most recent call last):
  File "/home/zqchen/phd/gsl/logs/save_traj_only/videos/read_data.py", line 3, in <module>
    f = h5py.File("/home/zqchen/phd/gsl/logs/save_traj_only/videos/20231228_152428.h5", "r")
  File "/home/zqchen/miniconda3/envs/gsl/lib/python3.8/site-packages/h5py/_hl/files.py", line 562, in __init__
    fid = make_fid(name, mode, userblock_size, fapl, fcpl, swmr=swmr)
  File "/home/zqchen/miniconda3/envs/gsl/lib/python3.8/site-packages/h5py/_hl/files.py", line 235, in make_fid
    fid = h5f.open(name, flags, fapl=fapl)
  File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
  File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
  File "h5py/h5f.pyx", line 102, in h5py.h5f.open
OSError: Unable to synchronously open file (bad object header version number)

A potential reason is that I keyboard interrupted the training (without rendering window) so evaluation environment's close method is not called so self._h5_file.close() is not called?

@StoneT2000
Copy link
Member Author

That is also possible, can you try closing it first before using it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants