clean RL tests to avoid dir pollution and increase speed

This commit is contained in:
robcaulk
2022-10-08 12:10:38 +02:00
parent 3e258e000e
commit 8d7adfabe9
6 changed files with 43 additions and 53 deletions

View File

@@ -63,6 +63,7 @@ class BaseReinforcementLearningModel(IFreqaiModel):
self.MODELCLASS = getattr(mod, self.model_type)
self.policy_type = self.freqai_info['rl_config']['policy_type']
self.unset_outlier_removal()
self.net_arch = self.rl_config.get('net_arch', [128, 128])
def unset_outlier_removal(self):
"""
@@ -287,6 +288,17 @@ class BaseReinforcementLearningModel(IFreqaiModel):
return model
def _on_stop(self):
"""
Hook called on bot shutdown. Close SubprocVecEnv subprocesses for clean shutdown.
"""
if self.train_env:
self.train_env.close()
if self.eval_env:
self.eval_env.close()
# Nested class which can be overridden by user to customize further
class MyRLEnv(Base5ActionRLEnv):
"""