Closed MarkSelden closed 2 years ago
I believe this error is caused by the preprocess function in mbrl/env/pets_cartpole CartPoleEnv.preprocess_fn.
This is the function's return value
return np.concatenate( [ np.sin(state[..., 1:2]), np.cos(state[..., 1:2]), state[..., :1], state[..., 2:], ], axis=-1, )
the state argument for this function is of length 4, meaning this returns an array or tensor of length 5. I believe it is required that a preprocessing function does not change the observation's dimensions.
Hi @MarkSelden. To use the cartpole env preprocess function you also need to set dynamics_model.in_size=6
(which overrides the default input size computation). The following command works for me
python -m mbrl.examples.main algorithm=pets overrides=pets_cartpole_paper_version dynamics_model.in_size=6
I'll add a comment about this in the config file and also in the preprocess function.
Let me know if you keep having problems.
Hi @MarkSelden, did this work for you? Let me know if I can close this issue now.
@luisenp Thank you for the response! Feel free to close this out. Your help is very appreciated.
Steps to reproduce
Observed Results
What happened?
File "/Users/MarkSelden/Work/Research/mbrl-lib/mbrl/util/math.py line 123, in update_stats assert data.ndim == 2 and data.shape[1] == self.mean.shape[1] AssertionError
Expected Results
Relevant Code