From 947dd7b2b38d1bca1c156f5f94513703822ffa62 Mon Sep 17 00:00:00 2001 From: vladmandic Date: Sun, 25 Jan 2026 09:49:36 +0100 Subject: [PATCH] support lora inside prompt selector Signed-off-by: vladmandic --- CHANGELOG.md | 4 +++- modules/lora/lora_load.py | 2 +- modules/styles.py | 15 ++++++++------- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 869b7d9f9..9722f6407 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,9 +2,10 @@ ## Todo +- upstream `torch/rocm` slowdown - update `rocm/windows` -## Update for 2026-01-24 +## Update for 2026-01-25 - **Features** - **caption** tab support for Booru tagger models, thanks @CalamitousFelicitousness @@ -32,6 +33,7 @@ - add video ui elem_ids, thanks @ryanmeador - use base steps as-is for non sd/sdxl models - ui css fixes for modernui + - support lora inside prompt selector ## Update for 2026-01-22 diff --git a/modules/lora/lora_load.py b/modules/lora/lora_load.py index 77695ee3f..a836b5323 100644 --- a/modules/lora/lora_load.py +++ b/modules/lora/lora_load.py @@ -269,7 +269,7 @@ def network_load(names, te_multipliers=None, unet_multipliers=None, dyn_dims=Non continue if net is None: failed_to_load_networks.append(name) - shared.log.error(f'Network load: type=LoRA name="{name}" detected={network_on_disk.sd_version if network_on_disk is not None else None} failed') + shared.log.error(f'Network load: type=LoRA name="{name}" detected={network_on_disk.sd_version if network_on_disk is not None else None} not found') continue if hasattr(sd_model, 'embedding_db'): sd_model.embedding_db.load_diffusers_embedding(None, net.bundle_embeddings) diff --git a/modules/styles.py b/modules/styles.py index d14e7bc4f..16bb0f9b5 100644 --- a/modules/styles.py +++ b/modules/styles.py @@ -54,7 +54,11 @@ def select_from_weighted_list(inner: str) -> str: unweighted = [] for p in parts: - if ':' in p and not p.startswith('(') and not p.endswith(')'): + is_list = (p.startswith('(') and p.endswith(')')) or \ + (p.startswith('[') and p.endswith(']')) or \ + (p.startswith('{') and p.endswith('}')) or \ + (p.startswith('<') and p.endswith('>')) + if (':' in p) and not is_list: name, wstr = p.split(':', 1) name = name.strip() try: @@ -69,8 +73,7 @@ def select_from_weighted_list(inner: str) -> str: W = sum(weighted.values()) U = len(unweighted) - if U == 0: - # Only weighted options + if U == 0: # only weighted options keys = list(weighted.keys()) if not keys: return '' @@ -79,10 +82,8 @@ def select_from_weighted_list(inner: str) -> str: if abs(W - 1.0) > 1e-12: for k in weighted: weighted[k] = weighted[k] / W - else: - # Mix of weighted and unweighted - if W >= 1.0: - # Weighted probabilities consume whole mass -> normalize them, unweighted get 0 + else: # mix of weighted and unweighted + if W >= 1.0: # weighted probabilities consume whole mass -> normalize them, unweighted get 0 for k in weighted: weighted[k] = weighted[k] / W else: