Don't scan safetensors files in load_default_models() (#1155)

* Don't scan safetensors when loading them

* Don't scan safetensors files

* Update model_manager.py

---------

Co-authored-by: cmdr2 <shashank.shekhar.global@gmail.com>
This commit is contained in:
JeLuF 2023-04-14 13:41:35 +02:00 committed by GitHub
parent 03c8a0fca5
commit 4192f87d6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,12 +41,15 @@ def load_default_models(context: Context):
for model_type in MODELS_TO_LOAD_ON_START:
context.model_paths[model_type] = resolve_model_to_use(model_type=model_type)
try:
load_model(context, model_type)
load_model(
context,
model_type,
scan_model = context.model_paths[model_type] != None and not context.model_paths[model_type].endswith('.safetensors')
)
except Exception as e:
log.error(f"[red]Error while loading {model_type} model: {context.model_paths[model_type]}[/red]")
log.exception(e)
def unload_all(context: Context):
for model_type in KNOWN_MODEL_TYPES:
unload_model(context, model_type)