15 Commits

Author SHA1 Message Date
CalamitousFelicitousness b434eb0c1b refactor(lora): route every bare key through the resolver
The parser no longer takes reference-name prefixes to tell bare
reference keys from bare diffusers keys. Any bare key carries the
sentinel and the arch resolver renames what it knows and passes the rest
through. Flux2 keeps its list for file-format detection only.
2026-09-06 04:25:44 +01:00
CalamitousFelicitousness 783b66c3be refactor(lora): offer unknown bare keys to the resolver
A bare key that matches no known prefix is parsed with the
bare-diffusers sentinel and handed to the resolver instead of being
dropped at parse time. The per-arch lists of bare diffusers prefixes are
gone, and a path that names no live module counts as unmapped.
2026-09-06 04:25:44 +01:00
CalamitousFelicitousness b8cf912e4e feat(lora): run the full adapter family chain on every native arch
zimage, chroma, ernie and krea2 chained only lora/lokr/loha/oft while
flux2 and anima ran all eight families, so ia3/glora/norm/full files
(e.g. full-diff extractions with diff/diff_b keys) reported not loaded
on the short-chain arches. The generic family loaders are arch-agnostic;
wire the missing four into each chain.

- add ia3/glora/norm/full wrappers and chain entries to the four arch
  modules, with matching suffix/marker re-exports
- add a chain-level full-diff test per suite: zimage covers the legacy
  attention.out alias and the fused-qkv skip, chroma the proj rename,
  ernie the passthrough
2026-07-14 08:06:45 +01:00
CalamitousFelicitousness 3e4888d05f feat(lora): map chroma non-block and guidance approximator modules
BFL-format chroma adapters targeting the embedders, final projection or
the distilled guidance layer MLPs resolved verbatim and unmapped: the
embedder/final-layer names differ from diffusers outright, and the
approximator MLP leaves are in_layer/out_layer in BFL but linear_1/
linear_2 in the diffusers PixArt projection. Only in_proj, out_proj and
norms.N shared names and bound.

- add CHROMA_EXTRA_MAP (kohya form derived) and GUIDANCE_LEAF_MAP to
  both target resolvers
- route bare distilled_guidance_layer keys through the resolver instead
  of the diffusers passthrough so both leaf namings resolve; add
  img_in/txt_in/final_layer bare prefixes
- cover all key forms and end-to-end binding in the offline suite
2026-07-14 08:06:45 +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 cda4822ca0 fix(chroma): route through native_transformer to avoid SDNQ pre-mode crash
Loading a Chroma transformer override via UNET dropdown crashed at
inference with a shape mismatch in unpack_uint4: from_single_file does
not integrate quantization_config the way from_pretrained does, so the
dequantizer state was set up but the .weight tensor was never packed.

CHROMA_SPEC routes through native_transformer with the diffusers
Chroma converter, which loads bare and quantizes explicitly via
sdnq_quantize_model.
2026-05-31 00:24:33 +01:00
CalamitousFelicitousness 5b321d2071 refactor(lora): update importers for native_adapter rename
5 pipeline files + 2 test files. Mechanical substitution. 141/141
adapter tests pass.
2026-05-31 00:24:33 +01:00
CalamitousFelicitousness e45c23c031 refactor(chroma): migrate to generic native_loader
Replaces chroma's four family loaders with thin wrappers binding
native_loader's generics to chroma's prefix tuples and resolve_targets.

resolve_targets folds the Flux-to-diffusers rename table and the two
fused-weight splits into one path-resolution step:

- img_attn.qkv / txt_attn.qkv: ChunkSpec(idx, total=3) for equal Q/K/V
- single_blocks.linear1: ChunkSpec(start, end) for the unequal
  Q/K/V/proj_mlp partition

QKV_DIMS and LINEAR1_DIMS stay as module-level constants (tests patch
them for the scaled-down mock).

Behavior changes:

- LoKR on equal-chunk QKV now dispatches to NetworkModuleLokrChunk
  instead of NetworkModuleLokrSliceChunk (the slice variant was used
  pre-migration for both forms since chroma had no equal-chunk path).
- LoHA on fused img_attn.qkv now binds via NetworkModuleHadaChunk
  instead of being skipped; the shared HadaChunk added in the flux2 PR
  is general for equal-chunks dispatch.

parse_key returns (prefix_used, base, suffix) instead of the old
(flat_key, suffix); rename happens in resolve_targets. test_static_rename_table
replaced with test_resolve_targets_static_renames driving the same
remappings through the new interface.
2026-05-18 23:31:17 +01:00
CalamitousFelicitousness be46362e3e fix(chroma): prepend lora_transformer_ to LoKR slice_info keys
try_load_lokr renamed slice_info keys via static_rename but didn't add
the lora_transformer_ prefix that apply_static_rename adds to the groups
dict. slice_info.get(network_key) always returned None for fused targets,
so the loader fell back to NetworkModuleLokr instead of
NetworkModuleLokrSliceChunk on every fused-QKV / fused-linear1 adapter.

The full kron(w1, w2) was applied against split target modules, either
shape-mismatching at apply time or broadcasting wrong.

Caught by test_lokr_bfl_img_attn_qkv_slice_chunked. No real-world chroma
LoKR adapters on fused targets are known in the wild.
2026-05-18 23:19:24 +01:00
CalamitousFelicitousness cbaaf1c88c refactor(lora): move NetworkModuleLokrSliceChunk to network_lokr
Lifts the slice variant from chroma_lora into network_lokr so the generic
LoKR loader can dispatch to either NetworkModuleLokrChunk (equal chunks)
or NetworkModuleLokrSliceChunk (unequal ranges) based on ChunkSpec shape.

chroma_lora keeps the same slice path through an updated import.
2026-05-18 23:18:31 +01:00
CalamitousFelicitousness 92df94a227 feat(chroma): native loader for chroma lora
Add a per-model native LoRA path for Chroma that handles both PEFT-style
(diffusion_model.<dotted>.lora_A.weight, no alpha) and kohya-flat
(lora_unet_<flat> with .alpha) layouts, plus LoKR/LoHA/OFT/DoRA.

Resolves issue #4169 (ostris ai-toolkit Chroma LoRAs failed to load).

- new pipelines/chroma/chroma_lora.py with try_load_lora/lokr/loha/oft
- fused-QKV expansion: 3-way equal for img/txt qkv, 4-way unequal
  [3072, 3072, 3072, 12288] for single linear1 (Q+K+V+proj_mlp)
- NetworkModuleLokrSliceChunk for unequal-row LoKR slicing
- path rewrite from Flux-source to ChromaTransformer2DModel naming
- lora_load.py: dispatch chroma to the native loader and narrow the
  kohya-Flux convert gate to f1 only
2026-05-04 21:17:14 +01:00
Vladimir Mandic abddac23d9 add qwen-lightning
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2025-08-10 15:40:15 -04:00
Vladimir Mandic 353d73e042 add chroma-v50 and chroma-v50-annealed
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2025-08-08 10:15:00 -04:00
Vladimir Mandic f7e433bd07 lint
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2025-08-01 18:26:57 -04:00
Vladimir Mandic 5a9b72ec57 add quicksettings reset button
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2025-07-31 19:39:20 -04:00