-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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] - Fix APPO RLModule inference-only problems. #45111
[RLlib] - Fix APPO RLModule inference-only problems. #45111
Conversation
Signed-off-by: Simon Zehnder <[email protected]>
…rence_only_state_dict_keys'. Modified 'PPOTorchRLModuel' to not register already keys from APPO. Signed-off-by: Simon Zehnder <[email protected]>
…instead. Signed-off-by: Simon Zehnder <[email protected]>
@@ -15,19 +16,7 @@ | |||
_, tf, _ = try_import_tf() | |||
|
|||
|
|||
class APPOTfRLModule(PPOTfRLModule, RLModuleWithTargetNetworksInterface): | |||
def setup(self): |
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.
Nice!
@@ -14,20 +15,9 @@ | |||
from ray.rllib.utils.nested_dict import NestedDict | |||
|
|||
|
|||
class APPOTorchRLModule(PPOTorchRLModule, RLModuleWithTargetNetworksInterface): | |||
@override(PPOTorchRLModule) |
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.
Nice!
@@ -42,8 +32,26 @@ def output_specs_train(self) -> List[str]: | |||
|
|||
@override(PPOTorchRLModule) | |||
def _forward_train(self, batch: NestedDict): | |||
if self.inference_only: |
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.
nit: Maybe we should move this error into the parent RLModule class' main method?
def forward_train(self, ...):
?
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.
LGTM! Just one nit/question about moving an error further up the inheritance chain to have all future sub-classes benefit from this logic.
Thanks @simonsays1980 ! :)
…les. Signed-off-by: Simon Zehnder <[email protected]>
…ent already does it. Signed-off-by: Simon Zehnder <[email protected]>
Why are these changes needed?
The APPO algorithm could not deal with
inference-only
, yet. This change does enableinference-only
modules for APPO. In addition to the_inference_only_state_dict_keys
from PPO, APPO needs to remove the target networks when in inference.For this to work properly a parent
RLModule
is needed that triggers the building of the_inference_only_state_dict_keys
. Due to inheritance from the PPO module polymorphism did not work out of the box b/c this parent was missing. This parent is added to APPO in this PR as well, namedAPPORLModule
.Related issue number
Checks
git commit -s
) in this PR.scripts/format.sh
to lint the changes in this PR.method in Tune, I've added it in
doc/source/tune/api/
under thecorresponding
.rst
file.