cleanup/refactor state history

Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
Vladimir Mandic
2025-09-12 16:12:43 -04:00
parent a8b850adf4
commit 175e9cbe29
41 changed files with 172 additions and 171 deletions
+3 -3
View File
@@ -138,7 +138,7 @@ def initialize():
# make the program just exit at ctrl+c without waiting for anything
def sigint_handler(_sig, _frame):
log.trace(f'State history: uptime={round(time.time() - shared.state.server_start)} jobs={len(shared.state.job_history)} tasks={len(shared.state.task_history)} latents={shared.state.latent_history} images={shared.state.image_history}')
log.trace(f'State history: uptime={round(time.time() - shared.state.server_start)} jobs={shared.state.job_history} tasks={shared.state.task_history} latents={shared.state.latent_history} images={shared.state.image_history}')
log.info('Exiting')
try:
for f in glob.glob("*.lock"):
@@ -155,14 +155,14 @@ def load_model():
if not shared.opts.sd_checkpoint_autoload and shared.cmd_opts.ckpt is None:
log.info('Model: autoload=False')
else:
shared.state.begin('Load')
jobid = shared.state.begin('Load')
thread_model = Thread(target=lambda: shared.sd_model)
thread_model.start()
thread_refiner = Thread(target=lambda: shared.sd_refiner)
thread_refiner.start()
thread_model.join()
thread_refiner.join()
shared.state.end()
shared.state.end(jobid)
timer.startup.record("checkpoint")
shared.opts.onchange("sd_model_checkpoint", wrap_queued_call(lambda: modules.sd_models.reload_model_weights(op='model')), call=False)
shared.opts.onchange("sd_model_refiner", wrap_queued_call(lambda: modules.sd_models.reload_model_weights(op='refiner')), call=False)