diff --git a/TODO.md b/TODO.md index fbd1e442b..d031e8960 100644 --- a/TODO.md +++ b/TODO.md @@ -7,9 +7,7 @@ - Chat-based interface, @vladmandic - Control tab verify overrides handling, @vladmandic - Reimplement `llama` remover for Kanvas, @vladmandic -- Implement [pruna](https://github.com/PrunaAI/pruna), @vladmandic - Change params to default, @vladmandic -- Use `caption` to analyze image consistency/quality, @vladmandic - Detailer postprocessing, @CalamitousFelicitousness - Cloud providers, @CalamitousFelicitousness @@ -32,6 +30,7 @@ ### OnHold +- Implement [pruna](https://github.com/PrunaAI/pruna), @vladmandic, pending support for transformers 5.5 - LoRA add OMI format support for SD35/FLUX.1, on-hold - Remote Text-Encoder support, sidelined for the moment - Multi-user support @@ -88,6 +87,7 @@ TODO: Investigate which models are diffusers-compatible and prioritize! ### Other/Unsorted +- [GPEN Face Restoration](https://github.com/yangxy/GPEN) - [ByteDance DreamO](https://github.com/bytedance/DreamO) - Unified image customization framework combining face identity preservation, virtual try-on, style transfer, etc. - Created: 2025-05 | Updated: 2025-08 | Stars: 1,700 diff --git a/modules/sd_models_compile.py b/modules/sd_models_compile.py index 411b2f912..911923dd4 100644 --- a/modules/sd_models_compile.py +++ b/modules/sd_models_compile.py @@ -4,7 +4,7 @@ import logging import torch from modules import shared, errors, devices, sd_models, sd_models_utils from modules.logger import log -from installer import setup_logging +from installer import setup_logging, install debug = os.environ.get('SD_COMPILE_DEBUG', None) is not None debug_log = log.trace if debug else lambda *args, **kwargs: None @@ -86,6 +86,18 @@ def optimize_openvino(sd_model, clear_cache=True): return sd_model +def compile_pruna(sd_model): + # TODO + # install('pruna') # TODO pruna: enable when it supports transformers==5.5 + """ + from pruna import smash, SmashConfig + smash_config = SmashConfig(["deepcache", "stable_fast"]) + smashed_model = smash(model=sd_model, smash_config=smash_config) + return smashed_model + """ + return sd_model + + def compile_onediff(sd_model): try: from onediff.infer_compiler import oneflow_compile @@ -285,6 +297,7 @@ def compile_diffusers(sd_model, apply_to_components=True, op="Model"): if shared.opts.cuda_compile_backend == 'none': log.warning(f'{op} compile enabled but no backend specified') return sd_model + t0 = time.time() log.info(f"{op} compile: pipeline={sd_model.__class__.__name__} backend={shared.opts.cuda_compile_backend} options={shared.opts.cuda_compile_options}") if shared.opts.cuda_compile_backend == 'onediff': sd_model = compile_onediff(sd_model) @@ -292,9 +305,13 @@ def compile_diffusers(sd_model, apply_to_components=True, op="Model"): sd_model = compile_stablefast(sd_model) elif shared.opts.cuda_compile_backend == 'deep-cache': sd_model = compile_deepcache(sd_model) + elif shared.opts.cuda_compile_backend == 'pruna': + sd_model = compile_pruna(sd_model) else: check_deepcache(False) sd_model = compile_torch(sd_model, apply_to_components=apply_to_components, op=op) + t1 = time.time() + log.debug(f"{op} compile: time={t1-t0:.2f}") return sd_model diff --git a/modules/ui_definitions.py b/modules/ui_definitions.py index 86607bdf5..26ea78b82 100644 --- a/modules/ui_definitions.py +++ b/modules/ui_definitions.py @@ -371,7 +371,7 @@ def create_settings(cmd_opts): options_templates.update(options_section(('compile', "Model Compile"), { "cuda_compile_sep": OptionInfo("

Model Compile

", "", gr.HTML), "cuda_compile": OptionInfo([] if not cmd_opts.use_openvino else ["Model", "VAE", "Upscaler", "Control"], "Compile Model", gr.CheckboxGroup, {"choices": ["Model", "TE", "VAE", "LLM", "Control", "Upscaler"]}), - "cuda_compile_backend": OptionInfo("inductor" if not cmd_opts.use_openvino else "openvino_fx", "Model compile backend", gr.Radio, {"choices": ['none', 'inductor', 'cudagraphs', 'aot_ts_nvfuser', 'hidet', 'migraphx', 'ipex', 'onediff', 'stable-fast', 'deep-cache', 'olive-ai', 'openvino', 'openvino_fx']}), + "cuda_compile_backend": OptionInfo("inductor" if not cmd_opts.use_openvino else "openvino_fx", "Model compile backend", gr.Radio, {"choices": ['none', 'inductor', 'cudagraphs', 'aot_ts_nvfuser', 'hidet', 'migraphx', 'ipex', 'onediff', 'stable-fast', 'deep-cache', 'olive-ai', 'openvino', 'openvino_fx', 'pruna']}), "cuda_compile_mode": OptionInfo("default", "Model compile mode", gr.Radio, {"choices": ['default', 'reduce-overhead', 'max-autotune', 'max-autotune-no-cudagraphs']}), "cuda_compile_options": OptionInfo(["repeated", "dynamic", "components"] if not cmd_opts.use_openvino else [], "Model compile options", gr.CheckboxGroup, {"choices": ["components", "precompile", "repeated", "fullgraph", "dynamic", "verbose"]}), "deep_cache_interval": OptionInfo(3, "DeepCache cache interval", gr.Slider, {"minimum": 1, "maximum": 10, "step": 1}),