From a800fe59cfd195000e40dd6ef2565431300827ed Mon Sep 17 00:00:00 2001 From: CalamitousFelicitousness Date: Tue, 15 Sep 2026 03:52:04 +0100 Subject: [PATCH] fix(lora): accept lowercase lora_a and lora_b factor names TaoLive adapters save the factors as lora_a and lora_b without the .weight suffix, which no suffix table knew, so the file bound nothing. --- modules/lora/native_adapter.py | 5 ++++- test/test-minimax-native-adapters.py | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/lora/native_adapter.py b/modules/lora/native_adapter.py index 42810913f..10582447b 100644 --- a/modules/lora/native_adapter.py +++ b/modules/lora/native_adapter.py @@ -94,6 +94,8 @@ SUFFIX_NORMALIZE = { "lora_B.weight": "lora_up.weight", # bare parameter names, saved by wrappers that hold the factors as nn.Parameter (alibaba-pai PDD files) "lora_down": "lora_down.weight", + "lora_a": "lora_down.weight", + "lora_b": "lora_up.weight", "lora_up": "lora_up.weight", } @@ -107,6 +109,7 @@ LORA_SUFFIXES = ( ".lora_down.weight", ".lora_up.weight", ".lora_mid.weight", ".lora_A.weight", ".lora_B.weight", ".lora_down", ".lora_up", + ".lora_a", ".lora_b", # lowercase peft factor names without .weight (TaoLive adapters) # diff_b: bias delta some saves pair with the weight LoRA, applied as ex_bias. # magnitude / lora_magnitude_vector: DoRA row norms (ai-toolkit / PEFT key # names); converted onto the dora_scale path by try_load_lora. @@ -158,7 +161,7 @@ FULL_SUFFIXES = ( # on accidental overlaps with other families. LORA_MARKERS = ( - ".lora_down", ".lora_up", # bare and .weight forms alike + ".lora_down", ".lora_up", ".lora_a", ".lora_b", # bare and .weight forms alike ".lora_A.weight", ".lora_B.weight", # PEFT named-adapter saves embed the slot name as ``.lora_A..weight``; # the trailing-dot forms catch every variant. diff --git a/test/test-minimax-native-adapters.py b/test/test-minimax-native-adapters.py index 81e293fa5..094946fab 100644 --- a/test/test-minimax-native-adapters.py +++ b/test/test-minimax-native-adapters.py @@ -390,6 +390,7 @@ def oracle_mapping(state_dict, network_alpha=None): """ if any(k.startswith(REFERENCE_PREFIXES) for k in state_dict): sd = {k.replace('base_model.model.dit.', 'diffusion_model.', 1) if k.startswith('base_model.model.dit.') else k: v for k, v in state_dict.items()} + sd = {k[:-len('.lora_a')] + ('.lora_A.weight' if k.endswith('.lora_a') else '.lora_B.weight') if k.endswith(('.lora_a', '.lora_b')) else k: v for k, v in sd.items()} # lowercase peft names the converter does not read converted = convert_diffusers(sd) out = {} for key, value in converted.items():