fix importlib.machinery issue on github's autotests #yolo

This commit is contained in:
AUTOMATIC1111 2023-07-13 00:12:25 +03:00
parent 5cf623c58e
commit a04c955121

View File

@ -227,13 +227,14 @@ def run_extensions_installers(settings_file):
def mute_sdxl_imports(): def mute_sdxl_imports():
"""create fake modules that SDXL wants to import but doesn't actually use for our purposes""" """create fake modules that SDXL wants to import but doesn't actually use for our purposes"""
import importlib class Dummy:
pass
module = importlib.util.module_from_spec(importlib.machinery.ModuleSpec('taming.modules.losses.lpips', None)) module = Dummy()
module.LPIPS = None module.LPIPS = None
sys.modules['taming.modules.losses.lpips'] = module sys.modules['taming.modules.losses.lpips'] = module
module = importlib.util.module_from_spec(importlib.machinery.ModuleSpec('sgm.data', None)) module = Dummy()
module.StableDataModuleFromConfig = None module.StableDataModuleFromConfig = None
sys.modules['sgm.data'] = module sys.modules['sgm.data'] = module