diff options
author | w-e-w <40751091+w-e-w@users.noreply.github.com> | 2023-09-08 00:46:34 +0000 |
---|---|---|
committer | w-e-w <40751091+w-e-w@users.noreply.github.com> | 2023-09-08 00:46:34 +0000 |
commit | e4726cccf960257e1b456db84a59f28cea019c8f (patch) | |
tree | 4005ad1623b084ee463777d7f2bb1697c14b8cd8 | |
parent | d39440bfb9d3b20338fc23a78e6655b1e2f7c1d5 (diff) | |
download | stable-diffusion-webui-gfx803-e4726cccf960257e1b456db84a59f28cea019c8f.tar.gz stable-diffusion-webui-gfx803-e4726cccf960257e1b456db84a59f28cea019c8f.tar.bz2 stable-diffusion-webui-gfx803-e4726cccf960257e1b456db84a59f28cea019c8f.zip |
parsing string to path
-rw-r--r-- | modules/sd_models.py | 5 |
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:
|