diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/esrgan_model.py | 2 | ||||
-rw-r--r-- | modules/modelloader.py | 7 | ||||
-rw-r--r-- | modules/realesrgan_model.py | 2 | ||||
-rw-r--r-- | modules/ui_extensions.py | 4 | ||||
-rw-r--r-- | modules/upscaler.py | 1 |
5 files changed, 11 insertions, 5 deletions
diff --git a/modules/esrgan_model.py b/modules/esrgan_model.py index a009eb42..2fced999 100644 --- a/modules/esrgan_model.py +++ b/modules/esrgan_model.py @@ -154,7 +154,7 @@ class UpscalerESRGAN(Upscaler): if "http" in path:
filename = load_file_from_url(
url=self.model_url,
- model_dir=self.model_path,
+ model_dir=self.model_download_path,
file_name=f"{self.model_name}.pth",
progress=True,
)
diff --git a/modules/modelloader.py b/modules/modelloader.py index 2a479bcb..be23071a 100644 --- a/modules/modelloader.py +++ b/modules/modelloader.py @@ -47,7 +47,7 @@ def load_models(model_path: str, model_url: str = None, command_path: str = None if model_url is not None and len(output) == 0: if download_name is not None: from basicsr.utils.download_util import load_file_from_url - dl = load_file_from_url(model_url, model_path, True, download_name) + dl = load_file_from_url(model_url, places[0], True, download_name) output.append(dl) else: output.append(model_url) @@ -144,7 +144,10 @@ def load_upscalers(): for cls in reversed(used_classes.values()): name = cls.__name__ cmd_name = f"{name.lower().replace('upscaler', '')}_models_path" - scaler = cls(commandline_options.get(cmd_name, None)) + commandline_model_path = commandline_options.get(cmd_name, None) + scaler = cls(commandline_model_path) + scaler.user_path = commandline_model_path + scaler.model_download_path = commandline_model_path or scaler.model_path datas += scaler.scalers shared.sd_upscalers = sorted( diff --git a/modules/realesrgan_model.py b/modules/realesrgan_model.py index c24d8dbb..99983678 100644 --- a/modules/realesrgan_model.py +++ b/modules/realesrgan_model.py @@ -73,7 +73,7 @@ class UpscalerRealESRGAN(Upscaler): return None
if info.local_data_path.startswith("http"):
- info.local_data_path = load_file_from_url(url=info.data_path, model_dir=self.model_path, progress=True)
+ info.local_data_path = load_file_from_url(url=info.data_path, model_dir=self.model_download_path, progress=True)
return info
except Exception as e:
diff --git a/modules/ui_extensions.py b/modules/ui_extensions.py index 4ba3bdd7..ef18f438 100644 --- a/modules/ui_extensions.py +++ b/modules/ui_extensions.py @@ -125,7 +125,9 @@ def make_commit_link(commit_hash, remote, text=None): if text is None:
text = commit_hash[:8]
if remote.startswith("https://github.com/"):
- href = os.path.join(remote, "commit", commit_hash)
+ if remote.endswith(".git"):
+ remote = remote[:-4]
+ href = remote + "/commit/" + commit_hash
return f'<a href="{href}" target="_blank">{text}</a>'
else:
return text
diff --git a/modules/upscaler.py b/modules/upscaler.py index 8acb6e96..7b1046d6 100644 --- a/modules/upscaler.py +++ b/modules/upscaler.py @@ -34,6 +34,7 @@ class Upscaler: self.half = not modules.shared.cmd_opts.no_half self.pre_pad = 0 self.mod_scale = None + self.model_download_path = None if self.model_path is None and self.name: self.model_path = os.path.join(shared.models_path, self.name) |