fix relpath

Signed-off-by: vladmandic <mandic00@live.com>
This commit is contained in:
vladmandic
2026-04-08 11:00:32 +02:00
parent 44cb2f6f9c
commit 900acc9cc6
+6 -3
View File
@@ -47,9 +47,12 @@ def path_to_repo(checkpoint_info):
remove_prefix = ['Diffusers', 'huggingface', 'models--']
for opt in [shared.opts.ckpt_dir, shared.opts.diffusers_dir, shared.opts.hfcache_dir]:
remove_prefix.append(opt.replace('\\', '/'))
relative = os.path.relpath(opt, start=shared.opts.models_dir).replace('\\', '/')
if not relative.startswith('.'):
remove_prefix.append(relative)
try:
relative = os.path.relpath(opt, start=shared.opts.models_dir).replace('\\', '/')
if not relative.startswith('.'):
remove_prefix.append(relative)
except Exception:
pass
basename = os.path.basename(opt).replace('\\', '/')
if basename:
remove_prefix.append(basename)