Last active
January 20, 2022 18:42
-
-
Save MCarlomagno/3caf4653ca092cbcf2c90bf8cfa7a7f3 to your computer and use it in GitHub Desktop.
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
class GymTask(Task): | |
# ... | |
def execute(self, *args: Any, **kwargs: Any) -> None: | |
if not self._proxy_env.is_rl_agent_trained and not self.is_rl_agent_training: | |
self._start_training() | |
if self._proxy_env.is_rl_agent_trained and self.is_rl_agent_training: | |
self._stop_training() | |
# ... | |
def _start_training(self) -> None: | |
self.is_rl_agent_training = True | |
self._fit(self._proxy_env, self.nb_steps) | |
def _stop_training(self) -> None: | |
if self.is_rl_agent_training: | |
self.is_rl_agent_training = False | |
self._proxy_env.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment