Commit Graph

6 Commits

Author SHA1 Message Date
Vladimir Mandic 22d01c7e6e lora load cache state_dict
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-07-01 18:43:48 +02:00
CalamitousFelicitousness d95ea9e238 fix(lora): support embedding-target LoRA and companion bias deltas
Route nn.Embedding targets (and the SDNQEmbedding / ScaledWordEmbedding subclasses) through the linear LoRA path: the weight delta is up@down over the [vocab, dim] table, same shape and merge as a Linear.

Apply a companion bias delta (diff_b) as ex_bias on the same module rather than dropping it; collect diff_b into the LoRA group so it rides the existing module instead of a separate Full module that would collide on the network key.
2026-06-23 20:40:42 +01:00
CalamitousFelicitousness 1be0867d1e refactor(lora): centralize universal passthrough prefixes in the shared resolver
transformer., bare-diffusers, and lora_transformer_ bases are already in
network-key form for every arch, yet each per-arch resolve_targets repeated the
same passthrough branch for them. Move that into a shared
PASSTHROUGH_PREFIXES_DEFAULT set consulted by resolve_group_targets, leaving each
arch's resolve_targets to only the prefixes it actually rewrites (kohya / BFL).
lycoris_ stays in flux2, the one arch that recognizes it.

Pure refactor: the same keys resolve to the same modules.
2026-06-14 18:22:41 +01:00
CalamitousFelicitousness 31c07dbaf9 fix(lora): load OneTrainer diffusers-format LoRAs via lora_transformer_ prefix
OneTrainer saves LoRAs against the diffusers layout, keying each module as
'lora_transformer_' + the underscore-flattened module path with QKV pre-split.
That is sdnext's own network_layer_mapping namespace, but the native loader did
not list it as a known prefix, so parse_key dropped every key and the network
loaded zero modules ("not loaded").

Add lora_transformer_ to KNOWN_PREFIXES_DEFAULT and resolve it in a shared
resolve_group_targets helper that passes the base through unchanged, with no
rename or chunking. Routing every family loader through the helper gives all
diffusers arches (chroma, flux2, zimage, ernie) OneTrainer support without
per-arch wiring.

Fixes #4877
2026-06-14 18:22:41 +01:00
CalamitousFelicitousness 55db15c213 docs: cleanup 2026-05-31 00:24:33 +01:00
CalamitousFelicitousness 7cd6b6be79 refactor(lora): rename native_loader to native_adapter
Frees the name for pipelines/native_transformer. Module covers the full
LyCORIS adapter family (LoRA/LoKR/LoHA/OFT/IA3/GLoRA/Norm/Full), not
just LoRA.
2026-05-31 00:24:33 +01:00