aboutsummaryrefslogtreecommitdiff
path: root/modules/sd_models.py
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2023-09-30 10:02:28 +0300
committerGitHub <noreply@github.com>2023-09-30 10:02:28 +0300
commit951842d7858f94d5d49999f57f37df8e1991c4ae (patch)
treeacd5300efb62f53432c66473d2960e2d00d7a389 /modules/sd_models.py
parent591ad1dbc38aa7e160ab1c34226dc9269b35983c (diff)
parent63485b2c55d2e5d1d5fc64d3964120a7305a9aee (diff)
Merge pull request #13139 from AUTOMATIC1111/ckpt-dir-path-separator
fix `--ckpt-dir` path separator and option use `short name` for checkpoint dropdown
Diffstat (limited to 'modules/sd_models.py')
-rw-r--r--modules/sd_models.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/modules/sd_models.py b/modules/sd_models.py
index 5ef7aa13..7f8502f5 100644
--- a/modules/sd_models.py
+++ b/modules/sd_models.py
@@ -50,11 +50,12 @@ class CheckpointInfo:
def __init__(self, filename):
self.filename = filename
abspath = os.path.abspath(filename)
+ abs_ckpt_dir = os.path.abspath(shared.cmd_opts.ckpt_dir) if shared.cmd_opts.ckpt_dir is not None else None
self.is_safetensors = os.path.splitext(filename)[1].lower() == ".safetensors"
- if shared.cmd_opts.ckpt_dir is not None and abspath.startswith(shared.cmd_opts.ckpt_dir):
- name = abspath.replace(shared.cmd_opts.ckpt_dir, '')
+ if abs_ckpt_dir and abspath.startswith(abs_ckpt_dir):
+ name = abspath.replace(abs_ckpt_dir, '')
elif abspath.startswith(model_path):
name = abspath.replace(model_path, '')
else: