Don't save model_path if initial load fails

Fixes #882

If the load of the model fails during the initialization, an attempt to render an
image using the same model fails because ED doesn't notice that the model has to
be loaded. This PR ensures that the model is being reloaded if the initial load
fails. If the second load attempt fails as well, the user will get a more helpful
error message than 'model not loaded yet'.
This commit is contained in:
JeLuF 2023-04-16 21:59:29 +02:00
parent 4192f87d6b
commit 1ba3a139d9

View File

@ -49,6 +49,7 @@ def load_default_models(context: Context):
except Exception as e: except Exception as e:
log.error(f"[red]Error while loading {model_type} model: {context.model_paths[model_type]}[/red]") log.error(f"[red]Error while loading {model_type} model: {context.model_paths[model_type]}[/red]")
log.exception(e) log.exception(e)
del context.model_paths[model_type]
def unload_all(context: Context): def unload_all(context: Context):
for model_type in KNOWN_MODEL_TYPES: for model_type in KNOWN_MODEL_TYPES: