From d3e3948787e0cdbbcddfb2bf47a790c611a0c19c Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Mon, 29 Jun 2026 09:19:29 +0200 Subject: [PATCH] update lens and bria Signed-off-by: Vladimir Mandic --- CHANGELOG.md | 9 +++++---- data/previews.json | 6 +++++- data/reference-base.json | 18 +++++++++--------- data/reference-distilled.json | 2 +- modules/attention.py | 36 +++++++++++++++++++---------------- modules/loader.py | 2 +- pipelines/model_lens.py | 3 +++ 7 files changed, 44 insertions(+), 32 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c2f13cc2f..3831f2fc1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,20 +1,21 @@ # Change Log for SD.Next -## Update for 2026-06-26 +## Update for 2026-06-29 -### Highlights for 2026-06-26 +### Highlights for 2026-06-29 Service-pack update with several fixes and quality-of-life improvements -Plus new **Krea 2** model and **SDNQ** improvements: now with NPU support and its own native attention kernels! +Plus new **Krea 2** model and **SDNQ** improvements: now with *NPU* support and its own native *attention* kernels! [Home](https://vladmandic.github.io/sdnext/) | [ChangeLog](https://github.com/vladmandic/automatic/blob/master/CHANGELOG.md) | [Docs](https://vladmandic.github.io/sdnext-docs/) | [Discord](https://discord.com/invite/sd-next-federal-batch-inspectors-1101998836328697867) | [Sponsor](https://github.com/sponsors/vladmandic) -### Details for 2026-06-26 +### Details for 2026-06-29 - **Models** - [Krea 2](https://www.krea.ai/blog/krea-2-image-model) in *base* and *turbo* (distilled) variants both *base* and *turbo* are available in both full *bf16* and *sdnq* pre-quantized variants K2 is a 12.9B single-stream flow-matching DiT and using a Qwen3-VL-4B text encoder + - **Microsoft Lens** got unpublished, but we still got a mirror - **Features** - **SDNQ-Attention** modelled after *sage-attention*, but modified to support AMD and Intel GPUs in addition to nVidia diff --git a/data/previews.json b/data/previews.json index 5fed557c7..846aa42c5 100644 --- a/data/previews.json +++ b/data/previews.json @@ -31,5 +31,9 @@ "vladmandic--Anima-1.0-Base-sdnq-svd-dynamic-uint4": "vladmandic--Anima-1.0-Base.jpg", "vladmandic--Anima-1.0-Turbo-sdnq-svd-dynamic-uint4": "vladmandic--Anima-1.0-Turbo.jpg", "vladmandic--Krea-2-Turbo-sdnq-hadamard-uint4": "CalamitousFelicitousness--Krea-2-Turbo-Diffusers.jpg", - "vladmandic--Krea-2-Base-sdnq-hadamard-uint4": "CalamitousFelicitousness--Krea-2-Base-Diffusers.jpg" + "vladmandic--Krea-2-Base-sdnq-hadamard-uint4": "CalamitousFelicitousness--Krea-2-Base-Diffusers.jpg", + "Jinstudio--Lens": "microsoft--Lens.jpg", + "Jinstudio--Lens-Base": "microsoft--Lens-Base.jpg", + "Jinstudio--Lens-Turbo": "microsoft--Lens-Turbo.jpg", + "SahilCarterr--BRIA-3.2": "briaai--BRIA-3.2.jpg" } diff --git a/data/reference-base.json b/data/reference-base.json index 2e22dddf1..52c61500d 100644 --- a/data/reference-base.json +++ b/data/reference-base.json @@ -35,14 +35,14 @@ "date": "2023 July" }, "Microsoft Lens": { - "path": "microsoft/Lens", + "path": "Jinstudio/Lens", "preview": "microsoft--Lens.jpg", "desc": "Microsoft Lens is a text-to-image DiT model using GPT-OSS chat-style prompt encoding and Flux2 VAE decoding.", "size": 30.53, "date": "2026 May" }, "Microsoft Lens Base": { - "path": "microsoft/Lens-Base", + "path": "Jinstudio/Lens-Base", "preview": "microsoft--Lens-Base.jpg", "desc": "Microsoft Lens-Base is the base variant of Lens for text-to-image generation with GPT-OSS prompt features.", "size": 30.53, @@ -730,13 +730,6 @@ "size": 25.56, "date": "2024 October" }, - "Bria 3.2": { - "path": "briaai/BRIA-3.2", - "desc": "Bria 3.2 is the next-generation commercial-ready text-to-image model. With just 4 billion parameters, it provides exceptional aesthetics and text rendering, evaluated to provide on par results to leading open-source models, and outperforming other licensed models.", - "preview": "briaai--BRIA-3.2.jpg", - "size": 18.66, - "date": "2025 June" - }, "Meissonic": { "path": "MeissonFlow/Meissonic", "desc": "Meissonic is a non-autoregressive mask image modeling text-to-image synthesis model that can generate high-resolution images. It is designed to run on consumer graphics cards.", @@ -833,6 +826,13 @@ "size": 24.13, "date": "2025 December" }, + "Bria 3.2": { + "path": "SahilCarterr/BRIA-3.2", + "desc": "Bria 3.2 is the next-generation commercial-ready text-to-image model. With just 4 billion parameters, it provides exceptional aesthetics and text rendering, evaluated to provide on par results to leading open-source models, and outperforming other licensed models.", + "preview": "briaai--BRIA-3.2.jpg", + "size": 18.66, + "date": "2025 June" + }, "StepFun Step1X-Edit v1.1": { "path": "stepfun-ai/Step1X-Edit-v1p1-diffusers", "preview": "stepfun-ai--Step1X-Edit-v1p1-diffusers.jpg", diff --git a/data/reference-distilled.json b/data/reference-distilled.json index e678149a6..1953caf50 100644 --- a/data/reference-distilled.json +++ b/data/reference-distilled.json @@ -33,7 +33,7 @@ "size": 38.78 }, "Microsoft Lens Turbo": { - "path": "microsoft/Lens-Turbo", + "path": "Jinstudio/Lens-Turbo", "preview": "microsoft--Lens-Turbo.jpg", "desc": "Microsoft Lens-Turbo is the distilled Lens variant optimized for faster text-to-image generation with fewer steps.", "size": 30.53, diff --git a/modules/attention.py b/modules/attention.py index 6343723a9..252860df1 100644 --- a/modules/attention.py +++ b/modules/attention.py @@ -307,8 +307,26 @@ def get_hf_api_hijack(user_agent = None): # pylint: disable=unused-argument return HfApi(library_name="kernels", user_agent="donottrack") -def set_attention_dispatcher(pipe): +def hijack_kernels(): global orig_get_kernel # pylint: disable=global-statement + try: + install('kernels==0.14.1') + import kernels + import kernels.utils + log.debug(f'Attention dispatcher: kernels={kernels.__version__}') + if orig_get_kernel is None: + orig_get_kernel = kernels.get_kernel + kernels.get_kernel = get_kernel_hijack + kernels.utils._get_hf_api = get_hf_api_hijack # pylint: disable=protected-access + from diffusers.utils import import_utils + import_utils._kernels_available = True # pylint: disable=protected-access + import_utils._kernels_version = kernels.__version__ # pylint: disable=protected-access + except Exception as e: + log.error(f'Attention dispatcher kernels: {e}') + return + + +def set_attention_dispatcher(pipe): from modules import shared attn = shared.opts.hf_attention.strip().lower() if pipe is None or not hasattr(pipe, 'transformer') or not hasattr(pipe.transformer, 'set_attention_backend'): @@ -320,21 +338,7 @@ def set_attention_dispatcher(pipe): # https://huggingface.co/docs/diffusers/optimization/attention_backends#available-backends if 'hub' in attn: - try: - install('kernels==0.14.1') - import kernels - import kernels.utils - log.debug(f'Attention dispatcher: kernels={kernels.__version__}') - if orig_get_kernel is None: - orig_get_kernel = kernels.get_kernel - kernels.get_kernel = get_kernel_hijack - kernels.utils._get_hf_api = get_hf_api_hijack # pylint: disable=protected-access - from diffusers.utils import import_utils - import_utils._kernels_available = True # pylint: disable=protected-access - import_utils._kernels_version = kernels.__version__ # pylint: disable=protected-access - except Exception as e: - log.error(f'Attention dispatcher kernels: {e}') - return + hijack_kernels() prev = a._AttentionBackendRegistry.get_active_backend() # pylint: disable=protected-access if attn in backends: diff --git a/modules/loader.py b/modules/loader.py index a84b5ddf9..175dab5cf 100644 --- a/modules/loader.py +++ b/modules/loader.py @@ -211,7 +211,7 @@ try: 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') + errors.display(e, 'diffusers') sys.exit(1) try: diff --git a/pipelines/model_lens.py b/pipelines/model_lens.py index 596fbb95e..bf2eca4ce 100644 --- a/pipelines/model_lens.py +++ b/pipelines/model_lens.py @@ -12,6 +12,9 @@ def load_lens(checkpoint_info, diffusers_load_config=None): sd_models.hf_auth_check(checkpoint_info) from pipelines import lens + from modules.attention import hijack_kernels + hijack_kernels() + load_args, _quant_args = model_quant.get_dit_args(diffusers_load_config, allow_quant=False) log.debug(f'Load model: type=Lens repo="{repo_id}" config={diffusers_load_config} offload={shared.opts.diffusers_offload_mode} dtype={devices.dtype} reasoner={shared.opts.model_lens_enable_pe} args={load_args}')