Repository navigation
Conversation
With skip_done_states=True, SACLoss and DiscreteSACLoss masked next states on the done key. Truncated transitions (done=True, terminated=False) were therefore skipped too: DiscreteSACLoss set their next value to 0, and SACLoss evaluated the target critic with a zero action and zero log-prob instead of a policy sample. The value estimator still bootstraps on ~terminated, so those transitions silently got a wrong target. Mask on the terminated key (falling back to done), as TQCLoss already does, so only terminal states are skipped.
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/rl/4756
Note: Links to docs will display an error until the docs builds have been completed.
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
SACLossandDiscreteSACLossnow decide which next states to skip with theterminatedkey (falling back todone), likeTQCLoss, so truncated steps are bootstrapped again whenskip_done_states=True. Also fixed the docstring.Motivation and Context
With the flag on, time-limit truncations were skipped like terminal states, so their targets were the bare reward (discrete) or used a zero action (continuous), silently.
Fixes #4755
Types of changes
Checklist
Tests: two new regression tests (fail on main, pass here).
test_discrete_sac_terminatingput NaN observations on rows that were done but not terminated, which assumed the old behaviour, so those rows are now marked terminated too. Fulltest/objectives/test_sac.pypasses (1690 passed, 495 skipped), ufmt and flake8 are clean.