register submodule as package

Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
Vladimir Mandic
2026-08-10 12:06:33 +02:00
parent 699f1aaae7
commit e89062c04f
6 changed files with 24 additions and 27 deletions
+2 -2
View File
@@ -13,5 +13,5 @@
path = extensions-builtin/sdnext-kanvas
url = https://github.com/vladmandic/sdnext-kanvas
[submodule "extensions-builtin/sdnq"]
path = extensions-builtin/sdnq
url = https://github.com/Disty0/sdnq
path = extensions-builtin/sdnq
url = https://github.com/Disty0/sdnq
+9 -20
View File
@@ -550,27 +550,16 @@ def check_python(supported_minors=None, experimental_minors=None, reason=None):
ts('python', t_start)
# check sdnq version
def check_sdnq():
# register sdnq package from github submodule
def register_sdnq():
t_start = time.time()
if args.skip_all:
return
target_commit = "27a54aed657ec583620b76b42c65d907d13290ad"
pkg = package_spec('sdnq')
parts = pkg.version.split('.') if pkg is not None else []
minor = int(parts[1]) if len(parts) > 1 else -1
current = package_commit(pkg) if minor > -1 else ''
if (minor == -1) or ((current != target_commit) and (not args.experimental)):
if minor == -1:
log.info(f'Install: package="sdnq" commit={target_commit}')
else:
log.info(f'Update: package="sdnq" current={pkg.version} commit={current} target={target_commit}')
pip('uninstall --yes sdnq', ignore=True, quiet=True, uv=False)
if args.skip_git:
log.warning('Git: marked as not available but required for sdnq installation')
pip(f'install git+https://github.com/Disty0/sdnq@{target_commit}', ignore=False, quiet=True, uv=False)
global sdnq_commit # pylint: disable=global-statement
sdnq_commit = target_commit
fn = os.path.join('extensions-builtin', 'sdnq', 'src', 'sdnq', '__init__.py')
name = "sdnq"
spec = importlib.util.spec_from_file_location(name, fn)
module = importlib.util.module_from_spec(spec)
sys.modules[name] = module
spec.loader.exec_module(module) # this is where actual import happens
import sdnq # pylint: disable=unused-import # test import
ts('sdnq', t_start)
-1
View File
@@ -261,7 +261,6 @@ def main():
installer.install_gradio()
installer.check_torch()
installer.check_onnx()
installer.check_sdnq()
installer.check_transformers()
installer.check_diffusers()
installer.check_modified_files()
+1
View File
@@ -64,6 +64,7 @@ def temp_disable_extensions():
'multidiffusion-upscaler-for-automatic1111',
'a1111-sd-webui-lycoris',
'sd-webui-animatediff',
'sdnq',
]
disable_obsolete = [
'Lora',
+9 -2
View File
@@ -222,12 +222,19 @@ try:
import diffusers # pylint: disable=W0611,C0411
import diffusers.loaders.single_file # pylint: disable=W0611,C0411
diffusers.loaders.single_file.logging.tqdm = partial(tqdm, unit='C')
timer.startup.record("diffusers")
except Exception as e:
log.error(f'Loader: diffusers=={diffusers.__version__ if "diffusers" in sys.modules else None} {e}')
log.error('Please restart re-run the installer')
errors.display(e, 'diffusers')
sys.exit(1)
timer.startup.record("diffusers")
from installer import register_sdnq
register_sdnq()
import sdnq # pylint: disable=W0611,C0411
diffusers.utils.import_utils._sdnq_available = True # pylint: disable=protected-access
diffusers.utils.import_utils._sdnq_version = sdnq.__version__ # pylint: disable=protected-access
timer.startup.record("sdnq")
try:
import pillow_jxl # pylint: disable=W0611,C0411
@@ -236,7 +243,6 @@ except Exception:
from PIL import Image # pylint: disable=W0611,C0411
timer.startup.record("pillow")
import cv2 # pylint: disable=W0611,C0411
timer.startup.record("cv2")
@@ -265,6 +271,7 @@ def get_packages():
"torchvision": torchvision.__version__,
"diffusers": diffusers.__version__,
"transformers": transformers.__version__,
"sdnq": sdnq.__version__,
"tokenizers": tokenizers.__version__,
"accelerate": accelerate.__version__,
"hub": huggingface_hub.__version__,
+3 -2
View File
@@ -429,8 +429,9 @@ def print_stats():
if devices.triton_ok:
from modules.sd_models_compile import update_compile_times
update_compile_times()
if timer.dynamo.get_total() > 0.1:
log.debug(f'Processed: dynamo={timer.dynamo.dct(min_time=2.0, no_total=True)}')
dynamo_dct = timer.dynamo.dct(min_time=2.0, no_total=True)
if dynamo_dct:
log.debug(f'Processed: dynamo={dynamo_dct}')
def process_images_inner(p: StableDiffusionProcessing) -> Processed: