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

[RLlib] Faster remote worker space inference (don't infer if not required). #18805

Merged

Conversation

sven1977
Copy link
Contributor

@sven1977 sven1977 commented Sep 22, 2021

If an env is not constructed on the local worker (which is the default behavior), observation- and action spaces must be inferred from one of the remote workers. This causes the Trainer construction to take a considerable longer time (a few seconds) than w/o this step (ray.get).
This PR avoids this remote worker space lookup in case:

  • we do have an env on the local worker (create_env_on_driver=True).
  • observation AND action spaces are given manually via the config's "observation_space" and "action_space" keys.

Why are these changes needed?

Related issue number

Checks

  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

@sven1977
Copy link
Contributor Author

@RuofanKong ^^

@sven1977 sven1977 added the tests-ok The tagger certifies test failures are unrelated and assumes personal liability. label Sep 22, 2021
Copy link
Member

@avnishn avnishn left a comment

Choose a reason for hiding this comment

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

LGTM

Is there a small test that you want to add here first potentially? @sven1977

@sven1977
Copy link
Contributor Author

Good point! I'll add this to test_trainer.py.

@sven1977
Copy link
Contributor Author

Test case added.

@sven1977 sven1977 merged commit a2a077b into ray-project:master Sep 23, 2021
@sven1977 sven1977 deleted the faster_remote_worker_space_inference branch June 2, 2023 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests-ok The tagger certifies test failures are unrelated and assumes personal liability.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants