diff --git a/extensions-builtin/Lora/networks.py b/extensions-builtin/Lora/networks.py index ae33e030d..effa20911 100644 --- a/extensions-builtin/Lora/networks.py +++ b/extensions-builtin/Lora/networks.py @@ -435,7 +435,6 @@ def network_MultiheadAttention_load_state_dict(self, *args, **kwargs): def list_available_networks(): - global available_networks, available_network_aliases, forbidden_network_aliases, available_network_hash_lookup available_networks.clear() available_network_aliases.clear() forbidden_network_aliases.clear() @@ -447,7 +446,7 @@ def list_available_networks(): directories.append(shared.cmd_opts.lora_dir) else: shared.log.warning('LoRA directory not found: path="{shared.cmd_opts.lora_dir}"') - if os.path.exists(shared.cmd_opts.lyco_dir): + if os.path.exists(shared.cmd_opts.lyco_dir) and shared.cmd_opts.lyco_dir != shared.cmd_opts.lora_dir: directories.append(shared.cmd_opts.lyco_dir) def add_network(filename): if os.path.isdir(filename): @@ -468,7 +467,7 @@ def list_available_networks(): with concurrent.futures.ThreadPoolExecutor(max_workers=shared.max_workers) as executor: for fn in files_cache.list_files(*directories, ext_filter=[".pt", ".ckpt", ".safetensors"]): executor.submit(add_network, fn) - print(f'Lora/LyCORIS Networks: networks={len(available_networks)} directories={directories}') + shared.log.info(f'LoRA networks: available={len(available_networks)} folders={len(forbidden_network_aliases)}') def infotext_pasted(infotext, params): # pylint: disable=W0613 diff --git a/modules/modelloader.py b/modules/modelloader.py index b8f4662a9..c9d5f0fc6 100644 --- a/modules/modelloader.py +++ b/modules/modelloader.py @@ -10,7 +10,7 @@ from modules import shared, errors from modules.upscaler import Upscaler, UpscalerLanczos, UpscalerNearest, UpscalerNone from modules.paths import script_path, models_path from modules.files_cache import list_files, unique_directories -from installer import print_dict + diffuser_repos = [] @@ -209,6 +209,9 @@ def download_diffusers_model(hub_id: str, cache_dir: str = None, download_config def load_diffusers_models(model_path: str, command_path: str = None, clear=True): + excluded_models = [ + 'PhotoMaker', 'inswapper_128', 'IP-Adapter' + ] t0 = time.time() places = [] places.append(model_path) @@ -232,6 +235,8 @@ def load_diffusers_models(model_path: str, command_path: str = None, clear=True) """ for folder in os.listdir(place): try: + if any([x in folder for x in excluded_models]): # noqa:C419 + continue if "--" not in folder: continue if folder.endswith("-prior"): diff --git a/modules/script_callbacks.py b/modules/script_callbacks.py index dd5fca68b..0d0809573 100644 --- a/modules/script_callbacks.py +++ b/modules/script_callbacks.py @@ -136,9 +136,12 @@ def timer(t0: float, script, callback: str): def print_timers(): + long_callbacks = [] for k, v in timers.items(): if v > 0.05: - errors.log.debug(f'Script: time={v:.2f} {k}') + long_callbacks.append(f'{k}={v:.2f}') + if len(long_callbacks) > 0: + errors.log.debug(f'Script callback init time: {" ".join(long_callbacks)}') def clear_callbacks(): diff --git a/modules/script_loading.py b/modules/script_loading.py index cfb0eb097..03c5fc5d9 100644 --- a/modules/script_loading.py +++ b/modules/script_loading.py @@ -18,7 +18,7 @@ def load_module(path): pr = cProfile.Profile() pr.enable() try: - if '/sd-extension-' in path: # safe extensions without stdout intercept + if '/sd-extension-' in path or '/Lora' in path: # safe extensions without stdout intercept module_spec.loader.exec_module(module) else: if debug: diff --git a/webui.py b/webui.py index efd0d6038..3221d9894 100644 --- a/webui.py +++ b/webui.py @@ -105,7 +105,7 @@ def initialize(): t_timer, t_total = modules.scripts.load_scripts() timer.startup.record("extensions") timer.startup.records["extensions"] = t_total # scripts can reset the time - log.info(f'Extensions time: {t_timer.summary()}') + log.info(f'Extensions init time: {t_timer.summary()}') modelloader.load_upscalers() timer.startup.record("upscalers")