facebookresearch/mbrl-lib

[Bug] Hopper-v2 crashing using MBPO

sufodsia opened this issue · 1 comments

Hi, I encountered a problem running Hopper-v2 with MBPO.

Steps to reproduce

run python -m mbrl.examples.main algorithm=mbpo overrides=mbpo_hopper device="cpu"

Observed Results

The code crashed, with the following error message:
File "/home/user/mbrl-lib/mbrl/env/termination_fns.py", line 19, in hopper *(next_obs[:, 1:] < 100).abs().all(-1)
RuntimeError: "abs_cpu" not implemented for 'Bool' Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.

I have tried to correct that bug by using np.abs() instead of .abs(), but then I met new error messages.
Thanks for considering my issue !

Thanks for reporting! Looks like a bug that comes from the original MBPO implementation, on which this is based. Looking at the gym code, the abs should be on the observation (not sure why the index is not the same).

I'm running training to see how it performs after this change, but the fix should be:

not_done = (
        torch.isfinite(next_obs).all(-1)
        * (next_obs[:, 1:].abs() < 100).all(-1)
        * (height > 0.7)
        * (angle.abs() < 0.2)
    )