Repository navigation
Conversation
A post-policy module, composed as TensorDictSequential(actor, InterventionModule(intervener)) like EGreedyModule. The intervener runs on every exploration step and proposes an action plus a take-over flag. Where the flag is set the intervener's action is executed (optionally clipped to a spec); elsewhere the policy's action is used unchanged. The policy's action and the flag are saved so replay can route intervened steps. In deterministic mode the intervener is not called. Used by HIL-SERL (arXiv 2410.21845).
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/rl/4772
Note: Links to docs will display an error until the docs builds have been completed. ❌ 2 New Failures, 2 Unrelated FailuresAs of commit ff99be7 with merge base df1db3d ( NEW FAILURES - The following jobs have failed:
FLAKY - The following jobs failed but were likely due to flakiness present on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
4 of 6 tasks
…policy dtype Without this, removing the dtype cast passed every InterventionModule test.
…one flag per action The intervener's outputs were listed in out_keys but are not written in deterministic mode, so a strict select of the policy's outputs failed during evaluation. The take-over flag was also reshaped to the tensordict's batch size, which broke actions with extra leading dims such as one action per agent; it now follows the action's shape.
This was referenced Nov 28, 2026
… on the policy's device The flag's batch shape is now the action's shape without its event dimension only when the action has one, so a discrete action of shape [B] works in both exploration and evaluation. The take-over flag is moved to the policy action's device, the saved policy action is a copy in deterministic mode, and the docstring says which exploration types call the intervener.
theap06
marked this pull request as ready for review
November 29, 2026 09:13
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
Adds
InterventionModule, a post-policy module used asTensorDictSequential(actor, InterventionModule(intervener))likeEGreedyModule: where the intervener raises its flag its action is executed, and the policy's action and the flag are kept for replay. It works for continuous and scalar discrete actions, and it is skipped under deterministic, mode or mean exploration, so evaluation never includes help.Motivation and Context
Human-in-the-loop RL such as HIL-SERL (arXiv 2410.21845) stores the executed action and an intervention flag, and an env inverse transform cannot do this because it runs on a copy.
Stack (merge in this order; #4771, #4772, #4773 and #4799 are independent of each other and each is based on
main, #4774 needs all four):Types of changes
Checklist