Skip to content

Commit e4726cc

Browse files
committed
parsing string to path
1 parent d39440b commit e4726cc

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

modules/sd_models.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,12 @@ class CheckpointInfo:
4949
def __init__(self, filename):
5050
self.filename = filename
5151
abspath = os.path.abspath(filename)
52+
abs_ckpt_dir = os.path.abspath(shared.cmd_opts.ckpt_dir) if shared.cmd_opts.ckpt_dir is not None else None
5253

5354
self.is_safetensors = os.path.splitext(filename)[1].lower() == ".safetensors"
5455

55-
if shared.cmd_opts.ckpt_dir is not None and abspath.startswith(shared.cmd_opts.ckpt_dir):
56-
name = abspath.replace(shared.cmd_opts.ckpt_dir, '')
56+
if abs_ckpt_dir and abspath.startswith(abs_ckpt_dir):
57+
name = abspath.replace(abs_ckpt_dir, '')
5758
elif abspath.startswith(model_path):
5859
name = abspath.replace(model_path, '')
5960
else:

0 commit comments

Comments
 (0)