-
Notifications
You must be signed in to change notification settings - Fork 6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[RLlib] - Fix APPO RLModule inference-only problems. (#45111)
- Loading branch information
1 parent
6ab48be
commit 45d5640
Showing
4 changed files
with
64 additions
and
22 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
""" | ||
This file holds framework-agnostic components for APPO's RLModules. | ||
""" | ||
|
||
import abc | ||
|
||
from ray.rllib.algorithms.ppo.ppo_rl_module import PPORLModule | ||
from ray.rllib.utils.annotations import ExperimentalAPI | ||
|
||
# TODO (simon): Write a light-weight version of this class for the `TFRLModule` | ||
|
||
|
||
@ExperimentalAPI | ||
class APPORLModule(PPORLModule, abc.ABC): | ||
def setup(self): | ||
super().setup() | ||
|
||
# If the module is not for inference only, set up the target networks. | ||
if not self.inference_only: | ||
catalog = self.config.get_catalog() | ||
# Old pi and old encoder are the "target networks" that are used for | ||
# the stabilization of the updates of the current pi and encoder. | ||
self.old_pi = catalog.build_pi_head(framework=self.framework) | ||
self.old_encoder = catalog.build_actor_critic_encoder( | ||
framework=self.framework | ||
) |
This file contains 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
This file contains 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
This file contains 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