change startup order and refresh ui

This commit is contained in:
Vladimir Mandic
2023-03-16 15:35:10 -04:00
parent cbce7f1c58
commit 27dca3c15b
18 changed files with 154 additions and 152 deletions
+3 -6
View File
@@ -302,15 +302,12 @@ def load_model_weights(model, checkpoint_info: CheckpointInfo, state_dict, timer
if depth_model:
model.depth_model = depth_model
timer.record("apply half")
devices.dtype = torch.float32 if shared.cmd_opts.no_half else torch.float16
devices.dtype_vae = torch.float32 if shared.cmd_opts.no_half or shared.cmd_opts.no_half_vae else torch.float16
devices.dtype_unet = model.model.diffusion_model.dtype
devices.unet_needs_upcast = shared.cmd_opts.upcast_sampling and devices.dtype == torch.float16 and devices.dtype_unet == torch.float16
model.first_stage_model.to(devices.dtype_vae)
timer.record("apply dtype to VAE")
# clean up cache if limit is reached
while len(checkpoints_loaded) > shared.opts.sd_checkpoint_cache:
@@ -327,7 +324,7 @@ def load_model_weights(model, checkpoint_info: CheckpointInfo, state_dict, timer
sd_vae.clear_loaded_vae()
vae_file, vae_source = sd_vae.resolve_vae(checkpoint_info.filename)
sd_vae.load_vae(model, vae_file, vae_source)
timer.record("load VAE")
timer.record("load vae")
def enable_midas_autodownload():
@@ -440,7 +437,7 @@ def load_model(checkpoint_info=None, already_loaded_state_dict=None, time_taken_
else:
sd_model.to(shared.device)
timer.record("move model to device")
timer.record("device move")
sd_hijack.model_hijack.hijack(sd_model)
@@ -512,7 +509,7 @@ def reload_model_weights(sd_model=None, info=None):
if not shared.cmd_opts.lowvram and not shared.cmd_opts.medvram:
sd_model.to(devices.device)
timer.record("move model to device")
timer.record("device move")
print(f"Weights loaded in {timer.summary()}.")
+1 -1
View File
@@ -1444,7 +1444,7 @@ def create_ui():
with gr.Column(scale=6):
settings_submit = gr.Button(value="Apply settings", variant='primary', elem_id="settings_submit")
with gr.Column():
restart_gradio = gr.Button(value='Reload UI', variant='primary', elem_id="settings_restart_gradio")
restart_gradio = gr.Button(value='Reload UI', variant='primary', elem_id="settings_restart_gradio", disabled=True)
result = gr.HTML(elem_id="settings_result")
+1 -1
View File
@@ -279,7 +279,7 @@ def create_ui():
with gr.TabItem("Installed"):
with gr.Row(elem_id="extensions_installed_top"):
apply = gr.Button(value="Apply and restart UI", variant="primary")
apply = gr.Button(value="Apply (restart required)", variant="primary")
check = gr.Button(value="Check for updates")
extensions_disabled_list = gr.Text(elem_id="extensions_disabled_list", visible=False).style(container=False)
extensions_update_list = gr.Text(elem_id="extensions_update_list", visible=False).style(container=False)