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

Some atttibute errors #4

Open
zichunxx opened this issue Oct 9, 2024 · 2 comments
Open

Some atttibute errors #4

zichunxx opened this issue Oct 9, 2024 · 2 comments

Comments

@zichunxx
Copy link

zichunxx commented Oct 9, 2024

Hi! @elicassion

I met some errors when running through the sanity check with robosuite_test.sh.

First, for the code snippet in active_gym, the mentioned lines should be replaced with

        self.init_fov_pos = env.unwrapped.activeview_camera_init_pos
        self.init_fov_quat = env.unwrapped.activeview_camera_init_quat

, otherwise attribute error will be triggered, like

AttributeError: 'RecordWrapper' object has no attribute 'activeview_camera_init_pos'

Second, there is no keyword final_observation when running to this line:

real_next_obs[idx] = infos["final_observation"][idx][selected_cam]

I'm not sure the above errors are triggered by unmatched gymnasium version. I found no specific version instruction in the .yaml file.

Besides, dmc_test.sh also can't run normally with some attribute errors.

Please remind me if I'm missing something.

Thanks for taking the time to check this issue.

@elicassion
Copy link
Owner

elicassion commented Oct 10, 2024

Hi @zichunxx

Thanks for catching the issue. I think the recent gymnasium change may cause both problems. I updated the requirement list for this repo e94308a and the active-gym repo elicassion/active-gym@ba914bb. gymnasium>=0.28.1,<1.0.0 should work.

  1. The attributes are directly introduced to env. I think the magic is done by the base wrapper and the decorator. My understanding is that the base wrapper also inherits gym.Env so it does not need unwrapped. The change in gymnasium's environment registration may affect this.

  2. final_observation is unfortunately removed from gymnasium 1.0, please refer to their change log or the paragraphs I copied from the log. gymnasium>=0.28 should work.

To increase the efficiency of vector environments, autoreset is a common feature that allows sub-environments to reset without requiring all sub-environments to finish before resetting them all. Previously in Gym and Gymnasium, auto-resetting was done on the same step as the environment episode ends, such that the final observation and info would be stored in the step's info, i.e., info["final_observation"] and info[“final_info”] and standard obs and info containing the sub-environment's reset observation and info. Thus, accurately sampling observations from a vector environment required the following code (note the need to extract the infos["next_obs"][j] if the sub-environment was terminated or truncated). Additionally, for on-policy algorithms that use rollout would require an additional forward pass to compute the correct next observation (this is often not done as an optimization assuming that environments only terminate, not truncate).

However, over time, the development team has recognized the inefficiency of this approach (primarily due to the extensive use of a Python dictionary) and the annoyance of having to extract the final observation to train agents correctly, for example. Therefore, in v1.0.0, we are modifying autoreset to align with specialized vector-only projects like EnvPool and SampleFactory where the sub-environment's doesn't reset until the next step.

Let me know if it still does not work. Happy to help.

@zichunxx
Copy link
Author

Thank you so much for your kind help!

Now, the sanity check can be finished successfully after downgrading the gymnasium version.

Besides, I found that the numpy version should also be declared to avoid minor errors. numpy 1.X fits this repo.

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

No branches or pull requests

2 participants