-
Notifications
You must be signed in to change notification settings - Fork 307
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
[BUG] Inconsistent behavior in RenameTransform #2441
Comments
I've created a PR with fixes for the issues described here: #2442 |
Discussion continues in #2442 (comment) |
The visualization really helps ! 🙏 what is extracted from the documentation or should it be added? |
Yeah let's add it! Should it go in the generic transform doc or in the doc string of rename? |
A lot of transformations are using the |
Describe the bug
I think that there are a couple of bugs in the
RenameTransform
implementation. Let's through them go one-by-one:in_keys
. Keys specified inin_keys_inv
don't lead to a change in the specs.full_action_spec
is modified in the transform, but not theaction_spec
._inv
keys is different to the documented behavior.To Reproduce
Using this simple snippet as a basis. The goal is to map all inputs and outputs of an environment to another key.
At first, the transformation seems to have worked:
Specs are only modified if the key is in
in_keys
. Keys specified inin_keys_inv
don't lead to a change in the specs.But looking at the specs we see that the input spec was not modified:
Only the
full_action_spec
is modified in the transform, but not theaction_spec
.By adding the
action
key toin_keys
(and("stuff", "action")
to theout_keys
), thefull_action_spec
is correctly transformed, but not theaction_spec
:However, doing this (adding the
action
key toin_keys
) will cause the environment to crash whenstep
is called, as theaction
does not exist in the outputs:The behavior of the
_inv
keys is different to the documented behavior.The documentation states:
Thus, our transform should be:
However, this is not the case:
By inverting the
in_keys_inv
andout_keys_inv
, we get it to run:Expected behavior
The following snippet should run without errors (I think this covers the bugs described above):
System info
Ubuntu 22.04
Python 3.10.14
torch 2.4.1
torchrl 0.5.0
Checklist
The text was updated successfully, but these errors were encountered: