unified logger

This commit is contained in:
Vladimir Mandic
2026-02-19 09:46:42 +01:00
parent bfe014f5da
commit a3074baf8b
315 changed files with 2507 additions and 2116 deletions
+5 -4
View File
@@ -8,6 +8,7 @@ import torch
import safetensors.torch
from modules import paths, shared, errors
from modules import logger
from modules.sd_checkpoint import CheckpointInfo # pylint: disable=unused-import
@@ -44,7 +45,7 @@ def path_to_repo(checkpoint_info):
repo_id = repo_id.split('models--')[-1]
repo_id = repo_id.replace('--', '/')
if repo_id.count('/') != 1:
shared.log.warning(f'Model: repo="{repo_id}" repository not recognized')
logger.log.warning(f'Model: repo="{repo_id}" repository not recognized')
if '+' in repo_id:
repo_id = repo_id.split('+')[0]
return repo_id
@@ -63,14 +64,14 @@ def convert_to_faketensors(tensor):
def read_state_dict(checkpoint_file, map_location=None, what:str='model'): # pylint: disable=unused-argument
if not os.path.isfile(checkpoint_file):
shared.log.error(f'Load dict: path="{checkpoint_file}" not a file')
logger.log.error(f'Load dict: path="{checkpoint_file}" not a file')
return None
try:
pl_sd = None
with progress.open(checkpoint_file, 'rb', description=f'[cyan]Load {what}: [yellow]{checkpoint_file}', auto_refresh=True, console=shared.console) as f:
with progress.open(checkpoint_file, 'rb', description=f'[cyan]Load {what}: [yellow]{checkpoint_file}', auto_refresh=True, console=logger.console) as f:
_, extension = os.path.splitext(checkpoint_file)
if extension.lower() == ".ckpt" and shared.opts.sd_disable_ckpt:
shared.log.warning(f"Checkpoint loading disabled: {checkpoint_file}")
logger.log.warning(f"Checkpoint loading disabled: {checkpoint_file}")
return None
if shared.opts.stream_load:
if extension.lower() == ".safetensors":