Corrected logic for -j + and - argument

This commit is contained in:
Fredrik81 2020-03-02 21:02:32 +01:00
parent f08c7eedf1
commit 7713cfeb79

View File

@ -558,7 +558,8 @@ class Hyperopt:
cpus = cpu_count()
logger.info(f"Found {cpus} CPU cores. Let's make them scream!")
config_jobs = self.config.get('hyperopt_jobs', -1)
if self.total_epochs < cpus and (config_jobs > self.total_epochs or config_jobs < 0):
if (config_jobs < 0 and (cpus + config_jobs + 1) > self.total_epochs) \
or (config_jobs > 0 and config_jobs > self.total_epochs):
config_jobs = self.total_epochs
logger.info(f'Number of parallel jobs set as: {config_jobs}')