Commit Graph

271 Commits

Author SHA1 Message Date
Vladimir Mandic f1304b3ba0 Merge pull request #4762 from awsr/hashcache
Update hash cache
2026-04-15 09:42:35 +02:00
CalamitousFelicitousness 65e59e7224 feat(lora): z-image native lokr, loha and oft loaders
Add three adapter families to the z-image native loader and chain them
with the existing lora path through load_safetensors. Mixed-family
files (for example gta6_amateur_photography_zimagebase_v2.safetensors,
which carries lora and lokr groups in the same file) now load
completely instead of having one family silently dropped.

Shared helpers in pipelines/z_image/zimage_lora.py parse keys by
suffix list, rename legacy attention.out and attention.wo to
attention.to_out.0, and split fused attention.qkv into to_q/k/v. For
lora the split chunks the up weight along dim 0. For lokr the split
emits three NetworkModuleLokrChunk entries that share the tensors and
slice the kronecker product at apply time.

Fused attention.qkv for loha and oft is skipped with a warning. No
NetworkModuleHadaChunk exists, oft rotations are tied to out_features
and cannot be cleanly split across q/k/v, and no real z-image adapter
in that layout exists today.

load_safetensors for zimage chains try_load_lora, try_load_lokr,
try_load_loha and try_load_oft and merges their module dicts into a
single Network so mixed files load every module.
2026-04-14 21:48:19 +01:00
CalamitousFelicitousness c35adc4d0d feat(lora): native z-image lora loader
Add zimage to allow_native so lora_force_diffusers picks between
native and diffusers. Before this, zimage always took the diffusers
path regardless of the setting.

pipelines/z_image/zimage_lora.py reads the safetensors and writes
directly into network_layer_mapping, so Z-Image LoRAs no longer go
through the diffusers PEFT converter that raised KeyError on
state dicts with partial alpha keys.

Key formats handled: ai-toolkit, kohya lora_unet_, bare transformer.
and no-prefix. Pre-refactor fused attention.qkv is split into
to_q/k/v; attention.out and attention.wo are renamed to
attention.to_out.0. Alpha and dora_scale are preserved.
2026-04-14 21:13:23 +01:00
awsr 6aff795985 Improve extensibility 2026-04-14 02:59:19 -07:00
vladmandic 456d17fcd3 cleanup bnb references
Signed-off-by: vladmandic <mandic00@live.com>
2026-04-12 19:06:08 +02:00
vladmandic 91bba59c0d fix lint
Signed-off-by: vladmandic <mandic00@live.com>
2026-04-12 19:06:08 +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 ff247d8fd2 Merge branch 'dev' into RUF013 2026-03-24 07:12:51 -07:00
awsr 92960de8d6 RUF013 updates 2026-03-24 04:27:30 -07:00
vladmandic 57990fd8c0 add FireRed-Image-Edit-1.1
Signed-off-by: vladmandic <mandic00@live.com>
2026-03-23 06:41:46 +01:00
CalamitousFelicitousness 091f31d4bf add Flux2/Klein LoRA support
- detect f2 model type for LoRAs via metadata, architecture, and filename/folder
- preprocess bare BFL-format keys with diffusion_model prefix for Flux2LoraLoaderMixin
- handle LoKR format via native NetworkModuleLokr with on-the-fly kron(w1, w2)
- add NetworkModuleLokrChunk for fused QKV split into separate Q/K/V modules
- activate native modules loaded via diffusers path
- improve error message for Flux1/Flux2 architecture mismatch
2026-03-23 02:14:07 +00:00
vladmandic afe3786f5f add unet/dir to networks
Signed-off-by: vladmandic <mandic00@live.com>
2026-03-22 11:09:45 +01:00
Vladimir Mandic f86b0e69ef Merge pull request #4691 from awsr/errorlimiter-update
Update Errorlimiter to be thread-safe
2026-03-20 10:02:28 +01:00
vladmandic f83e9e7943 deregister rembg submodule
Signed-off-by: vladmandic <mandic00@live.com>
2026-03-20 08:14:01 +01:00
awsr d34896028d Make elimit kwarg optional 2026-03-19 04:41:37 -07:00
awsr 6e3c187b3f Rework to only use contextmanager system 2026-03-19 04:28:11 -07:00
vladmandic 121c51289b patch lora
Signed-off-by: vladmandic <mandic00@live.com>
2026-03-13 12:02:27 +01: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 f78f0eb4a5 refactor imports 2026-02-19 15:28:24 +01:00
Vladimir Mandic 216558185b update installer usage 2026-02-19 12:21:46 +01:00
Vladimir Mandic d65a2d1ebc ruff lint 2026-02-19 11:13:44 +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 947dd7b2b3 support lora inside prompt selector
Signed-off-by: vladmandic <mandic00@live.com>
2026-01-25 09:49:36 +01:00
awsr 09fdda05a4 Move to modules 2026-01-24 02:16:05 -08:00
awsr 82361e6633 Adjust names 2026-01-23 22:29:00 -08:00
awsr 58c3aecc00 Allow multiple identifiers for ErrorLimiter.notify
- Update identifiers.
- Also minor message formatting update.
2026-01-23 16:50:52 -08:00
awsr 3343d2e05f Update and rewrite to use contextlib 2026-01-23 04:56:27 -08:00
awsr 65d8c9e7f2 Implement limiting system for excessive errors 2026-01-22 03:37:52 -08: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
Disty0 034b0844fe register sdnq classes 2026-01-14 16:25:56 +03:00
vladmandic 4dbdee10e3 switch lora logic and improve ui networks filter
Signed-off-by: vladmandic <mandic00@live.com>
2026-01-14 10:31:21 +01:00
Vladimir Mandic e7809b11cd reapply offload hooks on diffusers lora load
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-01-13 10:07:30 +00:00
Disty0 259a38a2ed fix sdnq lora 2025-12-27 23:07:53 +03:00
vladmandic dde91321b9 genai exception handling and lint all
Signed-off-by: vladmandic <mandic00@live.com>
2025-12-22 20:29:50 +01:00
awsr dcb7164d30 Update readfile type safety 2025-12-17 16:43:54 -08:00
awsr 4816455a99 Don't try to read txt file as json 2025-12-17 13:18:48 -08:00
awsr c22ca8d76e Create and opt in to dict type safety from JSON
Opt in via the keyword-only argument `dict_only`
2025-12-17 13:18:13 -08:00
vladmandic 409ad8d2bd add longcat image and image-edit
Signed-off-by: vladmandic <mandic00@live.com>
2025-12-16 08:58:22 +01:00
vladmandic acca58f50c add kandinsky5
Signed-off-by: vladmandic <mandic00@live.com>
2025-12-09 09:47:22 +01:00
vladmandic 903d47f9e6 add zimage and f2 to lora overrides
Signed-off-by: vladmandic <mandic00@live.com>
2025-12-02 10:40:27 +01:00
Disty0 b6e9332cfe SDNQ de-couple matmul dtype and add fp16 matmul 2025-11-22 02:16:20 +03:00
Disty0 3fbfae5963 cleanup 2025-11-18 02:37:10 +03:00
Disty0 524e92eee2 SDNQ fix Loras 2025-11-18 01:47:35 +03:00
Vladimir Mandic ff772003e3 lora: restore pipeline type if reload/recompile needed
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2025-11-13 09:56:36 -05:00