merge: modules/modelloader.py

pull/4678/head
vladmandic 2026-03-12 14:16:51 +01:00
parent d3798cc6a4
commit b526d98cb0
1 changed files with 4 additions and 5 deletions

View File

@ -66,7 +66,6 @@ def download_diffusers_model(hub_id: str, cache_dir: str = None, download_config
if download_config is None:
download_config = {
"force_download": False,
"resume_download": True,
"cache_dir": shared.opts.diffusers_dir,
"load_connected_pipeline": True,
}
@ -181,9 +180,9 @@ def find_diffuser(name: str, full=False):
suffix = '/'.join(parts[2:]) # subfolder
if len(suffix) > 0:
suffix = '/' + suffix
models = list(hf_api.list_models(model_name=name, library=['diffusers'], full=True, limit=20, sort="downloads", direction=-1))
models = list(hf_api.list_models(model_name=name, filter="diffusers", full=True, limit=20, sort="downloads"))
if len(models) == 0:
models = list(hf_api.list_models(model_name=name, full=True, limit=20, sort="downloads", direction=-1)) # widen search
models = list(hf_api.list_models(model_name=name, full=True, limit=20, sort="downloads")) # widen search
models = [m for m in models if m.id.startswith(name)] # filter exact
log.debug(f'Search model: repo="{name}" {len(models) > 0}')
if len(models) > 0:
@ -260,8 +259,8 @@ def load_civitai(model: str, url: str):
return name # already downloaded
else:
log.debug(f'Reference download start: model="{name}"')
from modules.civitai.download_civitai import download_civit_model_thread
download_civit_model_thread(model_name=model, model_url=url, model_path='', model_type='safetensors', token=shared.opts.civitai_token)
from modules.civitai.download_civitai import download_civit_model
download_civit_model(model_url=url, model_name=model, model_path='', model_type='safetensors', token=shared.opts.civitai_token)
log.debug(f'Reference download complete: model="{name}"')
sd_models.list_models()
info = sd_models.get_closest_checkpoint_match(name)