aboutsummaryrefslogtreecommitdiff
path: root/modules/paths.py
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2023-07-13 17:42:16 +0300
committerAUTOMATIC1111 <16777216c@gmail.com>2023-07-13 17:42:16 +0300
commitff73841c608f5f02e6352bb235d9dbf63d922990 (patch)
tree405246d8f4d0477087ad24c10582eae72741d70f /modules/paths.py
parente16ebc917dfc902f041963df0d4e99e8141cf82f (diff)
mute SDXL imports in the place there SDXL is imported for the first time instead of launch.py
Diffstat (limited to 'modules/paths.py')
-rw-r--r--modules/paths.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/modules/paths.py b/modules/paths.py
index c6f8904e..25052339 100644
--- a/modules/paths.py
+++ b/modules/paths.py
@@ -5,6 +5,21 @@ from modules.paths_internal import models_path, script_path, data_path, extensio
import modules.safe # noqa: F401
+def mute_sdxl_imports():
+ """create fake modules that SDXL wants to import but doesn't actually use for our purposes"""
+
+ class Dummy:
+ pass
+
+ module = Dummy()
+ module.LPIPS = None
+ sys.modules['taming.modules.losses.lpips'] = module
+
+ module = Dummy()
+ module.StableDataModuleFromConfig = None
+ sys.modules['sgm.data'] = module
+
+
# data_path = cmd_opts_pre.data
sys.path.insert(0, script_path)
@@ -18,6 +33,8 @@ for possible_sd_path in possible_sd_paths:
assert sd_path is not None, f"Couldn't find Stable Diffusion in any of: {possible_sd_paths}"
+mute_sdxl_imports()
+
path_dirs = [
(sd_path, 'ldm', 'Stable Diffusion', []),
(os.path.join(sd_path, '../generative-models'), 'sgm', 'Stable Diffusion XL', ["sgm"]),