10 Commits

Author SHA1 Message Date
CalamitousFelicitousness 4c85a60c3e perf(lora): skip the discarded init when building lora modules
create_module built each up/down module with the default constructor,
which kaiming-initializes the parameter, then copied the stored weight
over the whole thing. The init is thrown away every time and costs about
four times the copy: 22.1ms per module against 2.5ms, or 5.8s against
0.7s over a 264-module lora, on every load.

skip_init constructs on meta and materializes uninitialized, so the copy
still fully defines the parameter. Dtype, device and values are
unchanged, including the fp32 upcast of bf16 files that the copy performs.
2026-08-10 02:42:05 +01: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
Disty0 034b0844fe register sdnq classes 2026-01-14 16:25:56 +03:00
Vladimir Mandic 8dae6d0c6d lint
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2025-07-29 09:24:23 -04:00
Vladimir Mandic db9e2127c1 fix lora with hidiffusion blocks
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2025-07-28 16:25:22 -04:00
Vladimir Mandic b34324eeb2 lora error logging
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2025-07-27 16:40:01 -04:00
Vladimir Mandic 8725cfc488 lora obey device
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2025-04-03 14:31:39 -04:00
Vladimir Mandic fc8a18df36 ruff updates
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2024-12-20 18:58:29 -05:00
Vladimir Mandic 1185950c4a yet another lora refactor
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2024-12-09 13:40:19 -05:00
AI-Casanova cb561fa486 Major lora refactor: works on my machine edition 2024-11-23 21:57:03 -06:00