aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw-e-w <40751091+w-e-w@users.noreply.github.com>2023-09-08 09:46:34 +0900
committerw-e-w <40751091+w-e-w@users.noreply.github.com>2023-09-08 09:46:34 +0900
commite4726cccf960257e1b456db84a59f28cea019c8f (patch)
tree4005ad1623b084ee463777d7f2bb1697c14b8cd8
parentd39440bfb9d3b20338fc23a78e6655b1e2f7c1d5 (diff)
parsing string to path
-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 930d0bee..9b0923de 100644
--- a/modules/sd_models.py
+++ b/modules/sd_models.py
@@ -49,11 +49,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: