Skip to content

[RLlib] Change scope of PPO tests to comply with currently supported set of spaces in RLModules for PPO - #32940

Merged
sven1977 merged 80 commits into
ray-project:masterfrom
ArturNiederfahrenhorst:maketestsgreen
Mar 24, 2023
Merged

sven1977 merged 80 commits into
ray-project:masterfrom
ArturNiederfahrenhorst:maketestsgreen

Conversation

@ArturNiederfahrenhorst

@ArturNiederfahrenhorst ArturNiederfahrenhorst commented Mar 1, 2023 •

Copy link
Copy Markdown
Contributor

Why are these changes needed?

This PR changes the scope of the PPO test_supported_spaces test.
As we not yet support all previously supported spaces, this PR makes it so that we skip the tests that we don't "want".

It also restructures the tests:

  • Test all observation spaces with a default action space "discrete"
  • Test all actions spaces with a default observations space "discrete"
    (whereas before all possible spaces on both sides where zipped to create test cases)
  • Separate more tested algos from each other to make up for the 2x runtime of the above change

kouroshHakha and others added 13 commits February 23, 2023 22:08
Signed-off-by: Kourosh Hakhamaneshi <[email protected]>
Signed-off-by: Kourosh Hakhamaneshi <[email protected]>
Signed-off-by: Kourosh Hakhamaneshi <[email protected]>
Signed-off-by: Kourosh Hakhamaneshi <[email protected]>
Signed-off-by: Artur Niederfahrenhorst <[email protected]>
Signed-off-by: Artur Niederfahrenhorst <[email protected]>
Signed-off-by: Artur Niederfahrenhorst <[email protected]>
Signed-off-by: Artur Niederfahrenhorst <[email protected]>
Signed-off-by: Artur Niederfahrenhorst <[email protected]>
Signed-off-by: Artur Niederfahrenhorst <[email protected]>
Signed-off-by: Artur Niederfahrenhorst <[email protected]>
Signed-off-by: Artur Niederfahrenhorst <[email protected]>
Signed-off-by: Artur Niederfahrenhorst <[email protected]>
Signed-off-by: Artur Niederfahrenhorst <[email protected]>
Signed-off-by: Artur Niederfahrenhorst <[email protected]>
Signed-off-by: Artur Niederfahrenhorst <[email protected]>
Signed-off-by: Artur Niederfahrenhorst <[email protected]>
Signed-off-by: Artur Niederfahrenhorst <[email protected]>
@kouroshHakha kouroshHakha changed the title [RLlib] Change scope of PPO tests to comply with corrently supported set of spaces in RLModules for PPO [RLlib] Change scope of PPO tests to comply with currently supported set of spaces in RLModules for PPO Mar 8, 2023

@kouroshHakha kouroshHakha left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

dude this is super hacky, and not approvable.
My suggestion (the general sketch):

LEARNER_ENABLED_OBS_SPACES = [...]
LEARNER_ENABLED_ACTION_SPACES = [...]
def _do_check(algo, config, a_name, o_name):
     config_copy = config.copy()
     config_copy.validate()
     if config_copy.enable_api:
              obs_space_list = LEARNER_ENABLED_OBS_SPACES
              act_space_list = LEARNER_ENABLED_ACTION_SPACES
     else: ...
     
     if o_name not in obs_space_list and in THE_OLD_OBS_LIST:
            warn(message)
            return
      if a_name not in act_space_list and in THE_OLD_ACTION_LIST:
            warn(message)
            return 

@ArturNiederfahrenhorst

Copy link
Copy Markdown
Contributor Author

@kouroshHakha I understand that it looks hacky. But the code you propose makes it so that hitting an unsupported action space OR and unsupported observations space simply skips the test. Thereby omitting tests that would have a supported space.

@ArturNiederfahrenhorst

Copy link
Copy Markdown
Contributor Author

This test works by zipping the spaces together. I don't think it is worth restructuring the rest of the test around your code.

@ArturNiederfahrenhorst

Copy link
Copy Markdown
Contributor Author

As per our offline discussion, we are restructuring the test itself.

Comment thread rllib/tests/test_supported_spaces.py Outdated
config["env"] = RandomEnv

def _do_check(alg, config, a_name, o_name):
if alg == "PPO":

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We decided to not have this algo == "PPO" specialization, right?
We should check for which obs / action space to choose based on whether the enable_rl_module_api is set or not.

Signed-off-by: Artur Niederfahrenhorst <[email protected]>
Signed-off-by: Artur Niederfahrenhorst <[email protected]>
Comment thread rllib/tests/test_supported_spaces.py Outdated
"discrete": Discrete(5), # TODO: (Artur) Support "multi_binary"
"discrete2": Discrete(5),
"discrete": Discrete(5),
"vector1d": Box(-1.0, 1.0, (5,), dtype=np.float32),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

rename: vector1d --> continuous

Signed-off-by: Artur Niederfahrenhorst <[email protected]>
Signed-off-by: Artur Niederfahrenhorst <[email protected]>
@sven1977
sven1977 merged commit b671bc0 into ray-project:master Mar 24, 2023
elliottower pushed a commit to elliottower/ray that referenced this pull request Apr 22, 2023
ProjectsByJackHe pushed a commit to ProjectsByJackHe/ray that referenced this pull request May 4, 2023
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.

3 participants