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

[BUG] AutoReset not enabled for MuJoCo envs #268

Closed
3 tasks done
dtch1997 opened this issue Aug 23, 2023 · 1 comment · Fixed by #269
Closed
3 tasks done

[BUG] AutoReset not enabled for MuJoCo envs #268

dtch1997 opened this issue Aug 23, 2023 · 1 comment · Fixed by #269
Assignees
Labels
bug Something isn't working

Comments

@dtch1997
Copy link
Contributor

Required prerequisites

What version of OmniSafe are you using?

0.5.1.dev11+g7432fc2

System information

3.10.12 (main, Jul 5 2023, 18:54:27) [GCC 11.2.0] linux
0.5.1.dev11+g7432fc2

Problem description

AutoReset not enabled for MuJoCo envs resulting in crash when learning agent.

Reproducible example code

The Python snippets:

Command lines:

python examples/train_policy --env-id Hopper-v4

Extra dependencies:


Steps to reproduce:

Traceback

Traceback (most recent call last):
  File "/home/daniel/Documents/github/rl_cbf/rl_cbf/safe_rl/train_policy.py", line 91, in <module>
    agent.learn()
  File "/home/daniel/Documents/github/rl_cbf/.venv/lib/python3.10/site-packages/omnisafe/algorithms/algo_wrapper.py", line 172, in learn
    ep_ret, ep_cost, ep_len = self.agent.learn()
  File "/home/daniel/Documents/github/rl_cbf/.venv/lib/python3.10/site-packages/omnisafe/algorithms/on_policy/base/policy_gradient.py", line 246, in learn
    self._env.rollout(
  File "/home/daniel/Documents/github/rl_cbf/.venv/lib/python3.10/site-packages/omnisafe/adapter/onpolicy_adapter.py", line 118, in rollout
    info['final_observation'][idx],
KeyError: 'final_observation'

Expected behavior

Training works with MuJoCo envs.

Additional context

No response

@dtch1997 dtch1997 added the bug Something isn't working label Aug 23, 2023
@Gaiejj
Copy link
Member

Gaiejj commented Aug 24, 2023

After careful reviewing of omnisafe/envs/mujoco_env.py file, I approve with your opinion and I think setting need_auto_reset_wrapper = True is critical to solve that problem. Thanks to your pull request in #269.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants