-
Notifications
You must be signed in to change notification settings - Fork 7.1k
[RLlib] [MultiAgentEnv Refactor #2] Change space types for BaseEnvs and MultiAgentEnvs
#21063
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
[RLlib] [MultiAgentEnv Refactor #2] Change space types for BaseEnvs and MultiAgentEnvs
#21063
Conversation
15869c0 to
5902365
Compare
5902365 to
321afc4
Compare
9ad419e to
0571a9c
Compare
0571a9c to
f96913e
Compare
f96913e to
ac2fc52
Compare
BaseEnvsBaseEnvs
BaseEnvsBaseEnvs and MultiAgentEnvs
rllib/env/multi_agent_env.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a pure software engineering thing, any reason we don't do this in init but here instead, in a utility function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Users will inherit from this class, however they may not necessarily call this function inside of their init functions. If I added this function to init, it may get called before the user has defined their observation/action spaces.
Although calling it here is messy, it allows for a nice external functionality, where if a user defines their spaces in the preferred format, they do not need to implement any of these sampling or checking methods on their own.
rllib/env/base_env.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incomplete docstring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yerp sorry.
rllib/env/multi_agent_env.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Users will inherit from this class, however they may not necessarily call this function inside of their init functions. If I added this function to init, it may get called before the user has defined their observation/action spaces.
Although calling it here is messy, it allows for a nice external functionality, where if a user defines their spaces in the preferred format, they do not need to implement any of these sampling or checking methods on their own.
rllib/env/base_env.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yerp sorry.
4c49eae to
d76a8f4
Compare
…ecking obs/actions
d76a8f4 to
b2a6033
Compare
Environment's spaces should always be of the format:
{agent_id_1: space_1, agent_id_2 : space_2}in the multi-agent case, andgym.Spacefor non-multi-agent vectorized environments.This differs from a change I made recently where my spaces mapped
{env_id : env.space}. I misunderstood that when a base environment has multiple sub environments, this can only mean that the environment has been vectorized, and not that multiple different types of environments have been initialized in theBaseEnv.Checks
scripts/format.shto lint the changes in this PR.