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)
|
f_val = self.run_optimizer_parallel(parallel, asked, i)
|
||||||
self.opt.tell(asked, [v['loss'] for v in f_val])
|
self.opt.tell(asked, [v['loss'] for v in f_val])
|
||||||
self.fix_optimizer_models_list()
|
self.fix_optimizer_models_list()
|
||||||
if (i * jobs + jobs) > self.total_epochs:
|
|
||||||
current_jobs = jobs - ((i * jobs + jobs) - self.total_epochs)
|
# Correct the number of epochs to handled for the last
|
||||||
else:
|
# iteration (should not exceed self.total_epochs)
|
||||||
current_jobs = jobs
|
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):
|
for j in range(current_jobs):
|
||||||
# Use human-friendly indexes here (starting from 1)
|
# Use human-friendly indexes here (starting from 1)
|
||||||
current = i * jobs + j + 1
|
current = i * jobs + j + 1
|
||||||
|
Loading…
Reference in New Issue
Block a user