diff --git a/CHANGELOG.md b/CHANGELOG.md index fa13aeacb..bd26c93d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,8 @@ # Change Log for SD.Next -## Update for 2025-07-18 +## Update for 2025-07-20 -### Highlights for 2025-07-18 +### Highlights for 2025-07-20 Feature highlights include: - **ModernUI** layout redesign which should make it more user friendly and easier to navigate @@ -26,7 +26,7 @@ Although upgrades and existing installations are tested and should work fine! [ReadMe](https://github.com/vladmandic/automatic/blob/master/README.md) | [ChangeLog](https://github.com/vladmandic/automatic/blob/master/CHANGELOG.md) | [Docs](https://vladmandic.github.io/sdnext-docs/) | [WiKi](https://github.com/vladmandic/automatic/wiki) | [Discord](https://discord.com/invite/sd-next-federal-batch-inspectors-1101998836328697867) -### Details for 2025-07-18 +### Details for 2025-07-20 - **License** - SD.Next [license](https://github.com/vladmandic/sdnext/blob/dev/LICENSE.txt) switched from **aGPL-v3.0** to **Apache-v2.0** @@ -85,6 +85,7 @@ Although upgrades and existing installations are tested and should work fine! enable in *settings -> compute settings -> sdp options* *note*: SD.Next will use either SageAttention v1/v2/v2++, depending which one is installed until authors provide pre-build wheels for v2++, you need to install it manually or SD.Next will auto-install v1 + - support for `torch.compile` for LLM: captioning/prompt-enhannce - support for `torch.compile` with repeated-blocks reduces time-to-compile 5x without loss of performance! enable in *settings -> model compile -> repeated* diff --git a/TODO.md b/TODO.md index 9a760a8cc..0fddce9e6 100644 --- a/TODO.md +++ b/TODO.md @@ -8,7 +8,6 @@ Main ToDo list can be found at [GitHub projects](https://github.com/users/vladma - [Modular pipelines and guiders](https://github.com/huggingface/diffusers/issues/11915) - Refactor: Sampler options -- Refactor: [torch.compile](https://pytorch.org/blog/torch-compile-and-diffusers-a-hands-on-guide-to-peak-performance/) - Feature: Diffusers [group offloading](https://github.com/vladmandic/sdnext/issues/4049) - Feature: Common repo for `T5` and `CLiP` - Feature: LoRA add OMI format support for SD35/FLUX.1 diff --git a/modules/interrogate/vqa.py b/modules/interrogate/vqa.py index f75342703..0457af7ea 100644 --- a/modules/interrogate/vqa.py +++ b/modules/interrogate/vqa.py @@ -7,7 +7,7 @@ import torch import transformers import transformers.dynamic_module_utils from PIL import Image -from modules import shared, devices, errors, sd_models, model_quant +from modules import shared, devices, errors, model_quant, sd_models, sd_models_compile processor = None @@ -129,6 +129,8 @@ def qwen(question: str, image: Image.Image, repo: str = None, system_prompt: str **quant_args, ) processor = transformers.AutoProcessor.from_pretrained(repo, cache_dir=shared.opts.hfcache_dir) + if 'LLM' in shared.opts.cuda_compile: + model = compile_torch(model) loaded = repo devices.torch_gc() sd_models.move_model(model, devices.device) @@ -177,6 +179,8 @@ def gemma(question: str, image: Image.Image, repo: str = None, system_prompt: st cache_dir=shared.opts.hfcache_dir, **quant_args, ) + if 'LLM' in shared.opts.cuda_compile: + model = compile_torch(model) processor = transformers.AutoProcessor.from_pretrained(repo, cache_dir=shared.opts.hfcache_dir) loaded = repo devices.torch_gc() @@ -302,6 +306,8 @@ def smol(question: str, image: Image.Image, repo: str = None, system_prompt: str **quant_args, ) processor = transformers.AutoProcessor.from_pretrained(repo, cache_dir=shared.opts.hfcache_dir) + if 'LLM' in shared.opts.cuda_compile: + model = compile_torch(model) loaded = repo devices.torch_gc() sd_models.move_model(model, devices.device) diff --git a/modules/sd_models_compile.py b/modules/sd_models_compile.py index a396b8390..498df59c6 100644 --- a/modules/sd_models_compile.py +++ b/modules/sd_models_compile.py @@ -213,8 +213,11 @@ def compile_torch(sd_model): setup_logging() # compile messes with logging so reset is needed if 'precompile' in shared.opts.cuda_compile_options: - shared.log.debug("Model compile: task=torch precompile") - sd_model("dummy prompt") + try: + shared.log.debug("Model compile: task=torch precompile") + sd_model("dummy prompt") + except Exception: + pass t1 = time.time() shared.log.info(f"Model compile: task=torch time={t1-t0:.2f}") except Exception as e: diff --git a/modules/shared.py b/modules/shared.py index c0e01399e..32b8b180a 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -419,7 +419,7 @@ options_templates.update(options_section(('advanced', "Pipeline Modifiers"), { options_templates.update(options_section(('compile', "Model Compile"), { "cuda_compile_sep": OptionInfo("