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] APPO enhancements (new API stack) vol 02: Cleanup loss function, add GAE-lambda to vtrace, make rho-clip configurable. #48800

Merged
merged 2 commits into from
Nov 19, 2024

Conversation

sven1977
Copy link
Contributor

@sven1977 sven1977 commented Nov 19, 2024

APPO enhancements (new API stack) vol 02:

  • Cleanup loss function (cleaner , more consistent namings)
  • add GAE-lambda to vtrace
  • make rho-clip configurable

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 :(

Signed-off-by: sven1977 <svenmika1977@gmail.com>
Signed-off-by: sven1977 <svenmika1977@gmail.com>
@sven1977 sven1977 added rllib RLlib related issues rllib-algorithms An RLlib algorithm/Trainer is not learning. rllib-newstack labels Nov 19, 2024
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. Everything gets cleaned up now. This looks really good. Do we have already first training results?


# Target policy.
target_action_dist = action_dist_cls_train.from_logits(
module.forward_target(batch)[TARGET_ACTION_DIST_LOGITS_KEY]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we do this here, if we want ot use multiple learners? I remember for SAC and CQL we needed to run a single forward pass before the loss calculation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right, but it does seem to run fine in the CI (multi-GPU). 🤷‍♂️

# The discount factor that is used should be gamma except for timesteps where
# the episode is terminated. In that case, the discount factor should be 0.
# The discount factor that is used should be `gamma * lambda_`, except for
# termination timesteps, in which case the discount factor should be 0.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why not gamma^(t-1)?

@sven1977 sven1977 enabled auto-merge (squash) November 19, 2024 15:29
@github-actions github-actions bot added the go add ONLY when ready to merge, run all tests label Nov 19, 2024
@sven1977 sven1977 merged commit 4165b1a into ray-project:master Nov 19, 2024
6 checks passed
@sven1977 sven1977 deleted the appo_enhancements_02_fix_rho branch November 20, 2024 11:30
dentiny pushed a commit to dentiny/ray that referenced this pull request Dec 7, 2024
…on, add GAE-lambda to vtrace, make rho-clip configurable. (ray-project#48800)

Signed-off-by: hjiang <dentinyhao@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-algorithms An RLlib algorithm/Trainer is not learning. rllib-newstack
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants