fix an unlikely division by 0 error
This commit is contained in:
parent
6620acff8c
commit
308b51012a
@ -67,10 +67,13 @@ def progressapi(req: ProgressRequest):
|
|||||||
|
|
||||||
progress = 0
|
progress = 0
|
||||||
|
|
||||||
if shared.state.job_count > 0:
|
job_count, job_no = shared.state.job_count, shared.state.job_no
|
||||||
progress += shared.state.job_no / shared.state.job_count
|
sampling_steps, sampling_step = shared.state.sampling_steps, shared.state.sampling_step
|
||||||
if shared.state.sampling_steps > 0:
|
|
||||||
progress += 1 / shared.state.job_count * shared.state.sampling_step / shared.state.sampling_steps
|
if job_count > 0:
|
||||||
|
progress += job_no / job_count
|
||||||
|
if sampling_steps > 0:
|
||||||
|
progress += 1 / job_count * sampling_step / sampling_steps
|
||||||
|
|
||||||
progress = min(progress, 1)
|
progress = min(progress, 1)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user