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; docs] Docs do-over (new API stack): RLModules vol 03; Actual rst rewrite and upgrade. #49387

Merged

Conversation

sven1977
Copy link
Contributor

@sven1977 sven1977 commented Dec 20, 2024

Docs do-over (new API stack): RLModules vol 03

  • Actual rst rewrite and upgrade.

Why are these changes needed?

Related issue number

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • 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 added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • 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 :(

…edo_rl_module_002

# Conflicts:
#	rllib/algorithms/appo/torch/appo_torch_rl_module.py
…_redo_rl_module_003_actual_docs

# Conflicts:
#	rllib/algorithms/appo/default_appo_rl_module.py
#	rllib/algorithms/appo/torch/default_appo_torch_rl_module.py
#	rllib/algorithms/bc/torch/default_bc_torch_rl_module.py
#	rllib/algorithms/dqn/default_dqn_rl_module.py
#	rllib/algorithms/ppo/default_ppo_rl_module.py
#	rllib/algorithms/ppo/torch/default_ppo_torch_rl_module.py
Co-authored-by: angelinalg <122562471+angelinalg@users.noreply.github.com>
Signed-off-by: Sven Mika <sven@anyscale.io>
"action_dist_inputs": ...
# RLlib:
# - Generates distribution from ACTION_DIST_INPUTS parameters.
# - Samples from the (stochastic) distribution.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
# - Samples from the (stochastic) distribution.
# - Samples from the stochastic distribution.

@sven1977 sven1977 enabled auto-merge (squash) December 27, 2024 11:48
@github-actions github-actions bot added the go add ONLY when ready to merge, run all tests label Dec 27, 2024
@github-actions github-actions bot disabled auto-merge December 27, 2024 12:53
Copy link
Collaborator

@simonsays1980 simonsays1980 left a comment

Choose a reason for hiding this comment

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

LGTM. Very nice changes!


RLlib turns on the new API stack by default for all RLlib algorithms. To deactivate it, use the `api_stack()` method
in your `AlgorithmConfig` object like so:
RLlib turns on the new API stack by default for all RLlib algorithms.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Didn't I change this already in here: #49304 ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, but I removed the "to deactivate it (<- the new API stack), ...". I think we shouldn't describe to users how to deactivate the new API stack on the migration guide site. It's too confusing. Basically, we are saying now: "It's already on, don't worry! But you can double-check your config by doing xyz ..."


.. testcode::
.. note::
To **deactivate** the new API stack and switch back to the old one, use the
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should leave here a comment for when we see the old stack being deprectaed and not supported anymore. I see way too many users on the discussion forums to go with the old stack, even when starting their journey. I always mention that the old stack will be deprecated soon, but without a date.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup! Let's change the "new stack" header everywhere describing that they should ONLY use the new stack from here on (unless they have very good reasons to still use the old one). ...

module_class=PPOTorchRLModule,
catalog_class=MARWILCatalog,
)
return RLModuleSpec(module_class=PPOTorchRLModule)
Copy link
Collaborator

Choose a reason for hiding this comment

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

DefaultPPOTorchRLModule?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great catch. These are covered, though, by backward compatible imports in the old py-files.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed


@classmethod
@override(Learner)
def rl_module_required_apis(cls) -> list[type]:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice!

@@ -1565,6 +1549,36 @@ def _make_module(self) -> MultiRLModule:

return module

def rl_module_is_compatible(self, module: RLModule) -> bool:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes, this is what we can use now where almost everything is defined by interfaces.

@@ -1,9 +1,7 @@
import torch
Copy link
Collaborator

Choose a reason for hiding this comment

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

No try_import_torch anymopre needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, but I think we can leave the bare-metal import torch everywhere that's not in the "common" import path (and thus doesn't break anything for non-torch users).

@sven1977 sven1977 enabled auto-merge (squash) December 27, 2024 14:58
@github-actions github-actions bot disabled auto-merge December 27, 2024 15:31
@sven1977 sven1977 enabled auto-merge (squash) December 27, 2024 15:31
@github-actions github-actions bot disabled auto-merge December 27, 2024 17:57
@sven1977 sven1977 enabled auto-merge (squash) December 27, 2024 17:59
@github-actions github-actions bot disabled auto-merge December 27, 2024 19:58
@sven1977 sven1977 enabled auto-merge (squash) December 27, 2024 22:43
@sven1977 sven1977 merged commit 9471b18 into ray-project:master Dec 27, 2024
6 checks passed
@sven1977 sven1977 deleted the docs_redo_rl_module_003_actual_docs branch December 27, 2024 22:44
srinathk10 pushed a commit that referenced this pull request Jan 3, 2025
anyadontfly pushed a commit to anyadontfly/ray that referenced this pull request Feb 13, 2025
…rst rewrite and upgrade. (ray-project#49387)

Signed-off-by: Puyuan Yao <williamyao034@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go add ONLY when ready to merge, run all tests rllib RLlib related issues rllib-docs-or-examples Issues related to RLlib documentation or rllib/examples rllib-models An issue related to RLlib (default or custom) Models. rllib-newstack rllib-oldstack-cleanup Issues related to cleaning up classes, utilities on the old API stack
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants