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

Convert obs_space.keys() to list before in check #275

Merged
merged 1 commit into from
Jun 30, 2023

Conversation

alex404
Copy link
Contributor

@alex404 alex404 commented Jun 30, 2023

I was having issues with a statement like this in my own codebase. obs_space.keys() returns a view object apparently, and needs to be converted to a list for this condition to ever be satisfied.

If you check the debug logs when running the battle env, you'll see:

[2023-06-30 12:12:14,201][2413634] Conv encoder output size: 512
[2023-06-30 12:12:14,201][2413634] Policy head output size: 512

After this change you get:

[2023-06-30 12:13:13,133][2415262] Conv encoder output size: 512
[2023-06-30 12:13:13,134][2415262] Policy head output size: 640

… nicely with `in`. Needs to be converted to a list for this condition to ever be satisfied.
Copy link
Owner

@alex-petrenko alex-petrenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow! Great catch!

So does this mean that measurements weren't actually added to the observations?

@alex-petrenko
Copy link
Owner

I think it got broken somewhere along the way. It might be that after one of the updates of Gym or Gymnasium this regressed. Anyway, thank you for finding this!!

@alex-petrenko alex-petrenko merged commit 7e1e695 into alex-petrenko:master Jun 30, 2023
@alex404
Copy link
Contributor Author

alex404 commented Jun 30, 2023

As far as I can tell yah, they weren't being added. ky in obs_space.keys() evaluates to False whatever the value of ky. This seems to be specific to the definition of Dict in gym/nasium. This seems really misleading, tbh. Maybe I'll raise an issue over on the gymnasium repo.

Edit: Yah exactly, it might have been changed in a gym/nasium update.

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

Successfully merging this pull request may close these issues.

2 participants