optimize calculation of current_jobs
This commit is contained in:
parent
92425642da
commit
a7d4755859
@ -576,10 +576,12 @@ class Hyperopt:
|
||||
f_val = self.run_optimizer_parallel(parallel, asked, i)
|
||||
self.opt.tell(asked, [v['loss'] for v in f_val])
|
||||
self.fix_optimizer_models_list()
|
||||
if (i * jobs + jobs) > self.total_epochs:
|
||||
current_jobs = jobs - ((i * jobs + jobs) - self.total_epochs)
|
||||
else:
|
||||
current_jobs = jobs
|
||||
|
||||
# Correct the number of epochs to handled for the last
|
||||
# iteration (should not exceed self.total_epochs)
|
||||
n_rest = (i + 1) * jobs - self.total_epochs
|
||||
current_jobs = jobs - n_rest if n_rest > 0 else jobs
|
||||
|
||||
for j in range(current_jobs):
|
||||
# Use human-friendly indexes here (starting from 1)
|
||||
current = i * jobs + j + 1
|
||||
|
Loading…
Reference in New Issue
Block a user