From 195386cdb0766d6594af0d9944bc52d1927dd40b Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Tue, 17 Oct 2023 10:41:36 -0400 Subject: [PATCH] allow windows cross-mount folders --- modules/sd_models.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/modules/sd_models.py b/modules/sd_models.py index f7819105c..6aad35ea0 100644 --- a/modules/sd_models.py +++ b/modules/sd_models.py @@ -51,13 +51,20 @@ class CheckpointInfo: self.filename = filename self.type = '' filename = os.path.abspath(filename) - if filename.startswith(script_path): - filename = os.path.relpath(filename, script_path) + relname = filename + if relname.startswith(script_path): + try: + relname = os.path.relpath(filename, script_path) + except: + pass try: relname = os.path.relpath(filename, model_path) + except: + pass + try: relname = os.path.relpath(filename, shared.cmd_opts.ckpt_dir) except: - relname = filename + pass relname, ext = os.path.splitext(relname) ext = ext.lower()[1:] @@ -256,7 +263,7 @@ def select_checkpoint(op='model'): shared.log.info(f'Select: {op}="{checkpoint_info.title if checkpoint_info is not None else None}"') return checkpoint_info if len(checkpoints_list) == 0 and not shared.cmd_opts.no_download: - shared.log.error("Cannot run without a checkpoint") + shared.log.error("Cannot generate without a checkpoint") shared.log.error("Use --ckpt to force using existing checkpoint") return None checkpoint_info = next(iter(checkpoints_list.values()))