-
Notifications
You must be signed in to change notification settings - Fork 328
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
[BugFix] Fix Compose input spec transform #2463
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/rl/2463
Note: Links to docs will display an error until the docs builds have been completed. ❌ 16 New Failures, 6 Unrelated FailuresAs of commit 12dd746 with merge base 97ccbb7 (): NEW FAILURES - The following jobs have failed:
BROKEN TRUNK - The following jobs failed but were present on the merge base:👉 Rebase onto the `viable/strict` branch to avoid these failures
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
The issue is broken because of a bug in tensordict lib - let me fix this and re-run the tests |
I see I forgot to run the linter on the test 🙈 I'll do that asap. |
just did |
|
||
# Final check to ensure clean sampling from the action_spec | ||
action = env.rand_action() | ||
assert "action_2" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This assert is always true because the string is not empty. Instead, do you want to check if this key is present in the tensordict?
assert "action_2" in action
Description
This PR fixes what I think is a bug in the
transform_input_spec
method of theCompose
transform.Motivation and Context
The original code goes backward through the list of transforms:
while I believe this should go forward to propagate the input spec of the underlying env.
I noticed this issue after trying to compose two inverse transformations:
DiscretiseAction
andRenameTransform
-- which broke with a "key" error. I also tried to chain someRenameTransform
s that rename the action key. I added this last examples to the tests.Rq. I have seen that chaining >2
RenameTransform
still yields some error, but this seems to be on theRenameTransform
side, notCompose
. I'll open an issue for this.Types of changes
What types of changes does your code introduce? Remove all that do not apply:
Checklist
Go over all the following points, and put an
x
in all the boxes that apply.If you are unsure about any of these, don't hesitate to ask. We are here to help!