From 7acfaca05a13352a7d86d281db6ad64dfd9350e0 Mon Sep 17 00:00:00 2001 From: AUTOMATIC <16777216c@gmail.com> Date: Thu, 29 Sep 2022 00:59:44 +0300 Subject: update lists of models after merging them in checkpoints tab support saving as half --- modules/sd_models.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'modules/sd_models.py') diff --git a/modules/sd_models.py b/modules/sd_models.py index 9decc911..dd47dffb 100644 --- a/modules/sd_models.py +++ b/modules/sd_models.py @@ -23,6 +23,11 @@ except Exception: pass +def checkpoint_tiles(): + print(sorted([x.title for x in checkpoints_list.values()])) + return sorted([x.title for x in checkpoints_list.values()]) + + def list_models(): checkpoints_list.clear() @@ -39,13 +44,14 @@ def list_models(): if name.startswith("\\") or name.startswith("/"): name = name[1:] - return f'{name} [{h}]' + shortname = os.path.splitext(name.replace("/", "_").replace("\\", "_"))[0] + + return f'{name} [{h}]', shortname cmd_ckpt = shared.cmd_opts.ckpt if os.path.exists(cmd_ckpt): h = model_hash(cmd_ckpt) - title = modeltitle(cmd_ckpt, h) - model_name = title.rsplit(".",1)[0] # remove extension if present + title, model_name = modeltitle(cmd_ckpt, h) checkpoints_list[title] = CheckpointInfo(cmd_ckpt, title, h, model_name) elif cmd_ckpt is not None and cmd_ckpt != shared.default_sd_model_file: print(f"Checkpoint in --ckpt argument not found: {cmd_ckpt}", file=sys.stderr) @@ -53,8 +59,7 @@ def list_models(): if os.path.exists(model_dir): for filename in glob.glob(model_dir + '/**/*.ckpt', recursive=True): h = model_hash(filename) - title = modeltitle(filename, h) - model_name = title.rsplit(".",1)[0] # remove extension if present + title, model_name = modeltitle(filename, h) checkpoints_list[title] = CheckpointInfo(filename, title, h, model_name) -- cgit v1.2.3 From 29ce8a687df4143f4fd7f5e22de7fb4c6baa1392 Mon Sep 17 00:00:00 2001 From: AUTOMATIC <16777216c@gmail.com> Date: Thu, 29 Sep 2022 08:03:23 +0300 Subject: remove unneded debug print --- modules/sd_models.py | 1 - 1 file changed, 1 deletion(-) (limited to 'modules/sd_models.py') diff --git a/modules/sd_models.py b/modules/sd_models.py index dd47dffb..7a5edced 100644 --- a/modules/sd_models.py +++ b/modules/sd_models.py @@ -24,7 +24,6 @@ except Exception: def checkpoint_tiles(): - print(sorted([x.title for x in checkpoints_list.values()])) return sorted([x.title for x in checkpoints_list.values()]) -- cgit v1.2.3