cleanup startup

This commit is contained in:
Vladimir Mandic
2024-01-17 12:15:07 -05:00
parent f10a478c82
commit 16eaeeb766
5 changed files with 14 additions and 7 deletions
+6 -1
View File
@@ -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"):
+4 -1
View File
@@ -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():
+1 -1
View File
@@ -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: