From 886704e35115ba4907d643c64c179b2ab476bf69 Mon Sep 17 00:00:00 2001 From: DominikDoom Date: Tue, 12 Dec 2023 13:46:51 +0100 Subject: [PATCH] Fix lora import in a1111 This makes the built-in list method work on the initial load there --- scripts/tag_autocomplete_helper.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/tag_autocomplete_helper.py b/scripts/tag_autocomplete_helper.py index c420075..1e0072d 100644 --- a/scripts/tag_autocomplete_helper.py +++ b/scripts/tag_autocomplete_helper.py @@ -246,20 +246,22 @@ def _get_lyco(): # Attempt to use the build-in Lora.networks Lora/LyCORIS models lists. try: - import importlib - lora_networks = importlib.import_module("extensions-builtin.Lora.networks") + import sys + from modules import extensions + sys.path.append(Path(extensions.extensions_builtin_dir).joinpath("Lora").as_posix()) + import lora # pyright: ignore [reportMissingImports] def _get_lora(): return [ Path(model.filename).absolute() - for model in lora_networks.available_networks.values() + for model in lora.available_loras.values() if Path(model.filename).absolute().is_relative_to(LORA_PATH) ] def _get_lyco(): return [ Path(model.filename).absolute() - for model in lora_networks.available_networks.values() + for model in lora.available_loras.values() if Path(model.filename).absolute().is_relative_to(LYCO_PATH) ]