From 393c19bbcfb670ec4ddc56695665fb1570480394 Mon Sep 17 00:00:00 2001 From: Kohaku-Blueleaf <59680068+KohakuBlueleaf@users.noreply.github.com> Date: Tue, 6 Feb 2024 11:17:15 +0800 Subject: [PATCH] Remove Lycoris back compact (#41) Forge use totally different mechanism to handle lora/lycoris models I think it is good to remove the back compact things so "lyco" alias can be used by legacy lycoris extensions. (some other extension may rely on it) --- extensions-builtin/Lora/networks.py | 1 - extensions-builtin/Lora/preload.py | 1 - extensions-builtin/Lora/scripts/lora_script.py | 1 - extensions-builtin/Lora/ui_extra_networks_lora.py | 2 +- 4 files changed, 1 insertion(+), 4 deletions(-) diff --git a/extensions-builtin/Lora/networks.py b/extensions-builtin/Lora/networks.py index 45f71f03..05823b54 100644 --- a/extensions-builtin/Lora/networks.py +++ b/extensions-builtin/Lora/networks.py @@ -134,7 +134,6 @@ def list_available_networks(): os.makedirs(shared.cmd_opts.lora_dir, exist_ok=True) candidates = list(shared.walk_files(shared.cmd_opts.lora_dir, allowed_extensions=[".pt", ".ckpt", ".safetensors"])) - candidates += list(shared.walk_files(shared.cmd_opts.lyco_dir_backcompat, allowed_extensions=[".pt", ".ckpt", ".safetensors"])) for filename in candidates: if os.path.isdir(filename): continue diff --git a/extensions-builtin/Lora/preload.py b/extensions-builtin/Lora/preload.py index 50961be3..863dc5c0 100644 --- a/extensions-builtin/Lora/preload.py +++ b/extensions-builtin/Lora/preload.py @@ -4,4 +4,3 @@ from modules import paths def preload(parser): parser.add_argument("--lora-dir", type=str, help="Path to directory with Lora networks.", default=os.path.join(paths.models_path, 'Lora')) - parser.add_argument("--lyco-dir-backcompat", type=str, help="Path to directory with LyCORIS networks (for backawards compatibility; can also use --lyco-dir).", default=os.path.join(paths.models_path, 'LyCORIS')) diff --git a/extensions-builtin/Lora/scripts/lora_script.py b/extensions-builtin/Lora/scripts/lora_script.py index 1518f7e5..daf87062 100644 --- a/extensions-builtin/Lora/scripts/lora_script.py +++ b/extensions-builtin/Lora/scripts/lora_script.py @@ -21,7 +21,6 @@ def before_ui(): networks.extra_network_lora = extra_networks_lora.ExtraNetworkLora() extra_networks.register_extra_network(networks.extra_network_lora) - extra_networks.register_extra_network_alias(networks.extra_network_lora, "lyco") networks.originals = lora_patches.LoraPatches() diff --git a/extensions-builtin/Lora/ui_extra_networks_lora.py b/extensions-builtin/Lora/ui_extra_networks_lora.py index 66d15dd0..28f82ea4 100644 --- a/extensions-builtin/Lora/ui_extra_networks_lora.py +++ b/extensions-builtin/Lora/ui_extra_networks_lora.py @@ -84,7 +84,7 @@ class ExtraNetworksPageLora(ui_extra_networks.ExtraNetworksPage): yield item def allowed_directories_for_previews(self): - return [shared.cmd_opts.lora_dir, shared.cmd_opts.lyco_dir_backcompat] + return [shared.cmd_opts.lora_dir] def create_user_metadata_editor(self, ui, tabname): return LoraUserMetadataEditor(ui, tabname, self)