Commit Graph

52 Commits

Author SHA1 Message Date
Vladimir Mandic 5159e8b1a5 experimental minimax chunking
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-24 18:51:30 +02:00
CalamitousFelicitousness 25b7961e4e fix(lora): refuse a network whose deltas do not fit the model
A delta that does not fit its target module cannot apply, and applying only
the layers that do fit leaves the model in a state nothing was trained for,
so try_load_chain drops the whole file when any family reports a mismatch.
Bias deltas were never checked against the target bias and could only surface
at apply time; a module with no bias stays a non-mismatch, since whole
architectures are built bias=False.

- check bias deltas against the module bias in the lora, norm and full loaders
- carry the mismatch count on the network so the chain can refuse the file
- record refused writes in the infotext so a partial apply is not read as clean
- point the krea2 full-diff test at a module that has a bias
2026-08-21 02:12:16 +01:00
Vladimir Mandic 76941efc7e strict typechecking
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-16 12:45:50 +02:00
CalamitousFelicitousness 1f549839dd fix(lora): disable diffusers-method loras on removal
Removing all loras never called set_adapters, so peft adapters stayed
active until model reload. Removal now uses disable_lora, which keeps
modules intact; unload_lora_weights would detach balanced offload hooks.
Load calls enable_lora after set_adapters since peft set_adapter does
not clear the disabled flag. Removal of fused diffusers loras remains
unhandled.
2026-07-08 03:06:47 +01:00
CalamitousFelicitousness 4554b9a277 fix(lora): apply te networks before encode and honor lora_apply_te
Network activation ran after prompt encoding, so text encoder lora
weights never affected embeds on the first generation and the stale
result was then served from the embed cache. The trailing unfiltered
activate in network_load also overrode the te exclude filter, so the
lora_apply_te setting was never honored.

- parse and activate networks in process_base before pipeline args are built
- activate_filtered gates text encoder components on per-request or global
  lora_apply_te; used by base, hires, detailer and faceid call sites
- network_load accepts activate=False for callers that run their own
  deactivate/activate sequence with include/exclude
- network_activate walks excluded components in restore-only mode so a
  filtered text encoder reverts to backup instead of keeping stale deltas
- loaded_loras cache is single-entry since per-filter entries go stale when
  the setting toggles
- prompt embed cache key includes the effective lora_apply_te value
2026-07-08 03:06:04 +01:00
Vladimir Mandic 98a7d17207 linting
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-07-03 22:05:33 +02:00
CalamitousFelicitousness 69506551a7 feat(lora): surface method-selection reason in load logs
get_method now returns (method, reason). The reason distinguishes
user opt-in (lora_force_diffusers), class-forced, hash-forced, and
arch-unsupported routes from the default native path; surfaced in
the info-level "Network load: type=LoRA load=<method>(<reason>)"
line so users can tell why a given load took a particular path.
2026-05-10 00:05:37 +01:00
Vladimir Mandic 4747ca2fc0 lora change detection improvements
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-05-09 09:38:54 +02:00
CalamitousFelicitousness f1d2888f10 fix(lora): case-insensitive stage detection for two-stage LoRA names 2026-04-09 09:11:51 +01:00
CalamitousFelicitousness 18568db41c Add native LoRA loading for Flux2/Klein models
Load Flux2/Klein LoRAs as native NetworkModuleLora objects, bypassing
diffusers PEFT. Handles kohya (lora_unet_), AI toolkit (diffusion_model.),
diffusers PEFT (transformer.), and bare BFL key formats with automatic
QKV splitting for double block fused attention weights.

Includes shape validation to reject architecture-mismatched LoRAs early.
Respects lora_force_diffusers setting to fall back to PEFT when needed.
2026-03-25 04:24:49 +00:00
awsr 92960de8d6 RUF013 updates 2026-03-24 04:27:30 -07:00
Vladimir Mandic 47543663f9 cleanup references to p.sd_model
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-02-19 20:48:42 +01:00
Vladimir Mandic e5c494f999 cleanup logger 2026-02-19 11:09:13 +01:00
Vladimir Mandic a3074baf8b unified logger 2026-02-19 09:46:42 +01:00
Vladimir Mandic bfe014f5da modernize typing 2026-02-19 09:15:37 +01:00
Vladimir Mandic a0f9447d04 add --remote cmd opt
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-02-07 10:17:32 +00:00
Vladimir Mandic e8ff09a2d2 fix lora unload and improve preview error handler
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-02-07 09:07:34 +00:00
vladmandic bfbe4af598 fix lora load
Signed-off-by: vladmandic <mandic00@live.com>
2026-01-21 08:45:45 +01:00
vladmandic 16293375dc lora native stack improvements
Signed-off-by: vladmandic <mandic00@live.com>
2026-01-18 10:06:03 +01:00
Vladimir Mandic c6593ac180 fix detailer with lora
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2025-11-09 09:14:26 -05:00
Vladimir Mandic ba270db6ad separate settings for lora fuse
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2025-11-08 11:08:06 -05:00
Vladimir Mandic ef2c42602c lora auto-detect low/high stage if not specified
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2025-10-24 11:11:12 -04:00
Vladimir Mandic c254835351 fix lora strength
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2025-09-26 10:14:02 -04:00
Vladimir Mandic d71d540a62 allow lora specifier to select model component. see changelog/wiki for docs on how to.
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2025-09-23 15:25:13 -04:00
Vladimir Mandic 175e9cbe29 cleanup/refactor state history
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2025-09-12 16:12:45 -04:00
Vladimir Mandic e8b5ea3847 major refactor: remove backend original
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2025-07-05 13:16:46 -04:00
Vladimir Mandic ff103bc849 fix LoRA change detection on pipeline type change
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2025-06-29 12:52:37 -04:00
Vladimir Mandic 8d6c7510c2 fix lora
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2025-04-18 07:34:12 -04:00
Vladimir Mandic eaf37055ba nunchaku lora support
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2025-04-17 11:45:37 -04:00
Vladimir Mandic 97df5869a4 update requirements
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2025-04-07 09:30:03 -04:00
Vladimir Mandic 8f95477ad2 add teacache for flux
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2025-04-05 12:58:00 -04:00
Vladimir Mandic 538b81021c add generate context menu get server status
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2025-04-05 12:58:00 -04:00
Vladimir Mandic 5c6c1465f4 fix style apply params
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2025-04-03 10:03:48 -04:00
Vladimir Mandic 6430f7006f add monitor cli option and finish lora refactor
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2025-04-01 13:39:47 -04:00
Vladimir Mandic b5031a5eba lora modularize code
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2025-04-01 13:39:47 -04:00
Vladimir Mandic 02f480bf32 add prompt enhance wiki
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2025-03-29 09:55:56 -04:00
Vladimir Mandic cd71fe51ff fix lora change with balanced offload
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2025-03-25 14:56:53 -04:00
Vladimir Mandic aa15ed1fa7 reapply offload after applying lora
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2025-03-25 14:09:34 -04:00
Vladimir Mandic d4a67dd946 lora logging
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2025-03-15 19:04:03 -04:00
Vladimir Mandic da6a1979ff cleanup lora overrides
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2025-01-28 18:47:48 -05:00
Vladimir Mandic 2090a334b0 hunyuanvideo lora support
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2025-01-07 12:49:09 -05:00
Vladimir Mandic 699ed3a444 update lora changed
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2024-12-31 15:52:00 -05:00
Vladimir Mandic 25e5411a0e again
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2024-12-29 15:42:29 -05:00
Vladimir Mandic 40472eefe5 typo
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2024-12-29 15:41:34 -05:00
Vladimir Mandic 910f5d0a73 lora direct on-demand apply/unapply
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2024-12-29 12:38:19 -05:00
Vladimir Mandic beea969fd3 update lora
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2024-12-10 12:34:27 -05:00
Vladimir Mandic 383d7052ac lora split te apply
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2024-12-09 15:23:22 -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
Vladimir Mandic 7e2034c4ff lora add fuse
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2024-12-02 10:51:41 -05:00
Vladimir Mandic 507636d0a1 lora-refactor
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2024-12-01 10:54:51 -05:00