control number of threads, update doc

This commit is contained in:
robcaulk
2022-09-29 00:10:18 +02:00
parent 099137adac
commit 83343dc2f1
5 changed files with 13 additions and 6 deletions

View File

@@ -39,7 +39,9 @@ class BaseReinforcementLearningModel(IFreqaiModel):
def __init__(self, **kwargs):
super().__init__(config=kwargs['config'])
th.set_num_threads(self.freqai_info['rl_config'].get('thread_count', 4))
self.max_threads = max(self.freqai_info['rl_config'].get(
'cpu_count', 0), int(self.max_system_threads / 2))
th.set_num_threads(self.max_threads)
self.reward_params = self.freqai_info['rl_config']['model_reward_parameters']
self.train_env: Union[SubprocVecEnv, gym.Env] = None
self.eval_env: Union[SubprocVecEnv, gym.Env] = None