Commit Graph

14038 Commits

Author SHA1 Message Date
CalamitousFelicitousness 387a349dfd fix(lora): scale the dora diff before the decompose norm
finalize_updown ran apply_weight_decompose on the unscaled delta and
multiplied the result by alpha/rank afterward. LyCORIS and ComfyUI both
bake alpha/rank into the diff before computing the row norms, so any
DoRA with alpha != rank renormalized against the wrong merged weight
(64% relative delta error for kohya-style alpha=1 rank=8; exact only
when alpha == rank, which full-matrix LoKR forces).

- scale updown by calc_scale() before apply_weight_decompose; apply
  only the multiplier afterward
- multiplier lerps the full merged delta (0 disables, 1 equals the
  trainer output); LyCORIS weight-mode ratio interpolation leaves the
  diff applied at multiplier 0 and is not used
- add a numeric regression test mirroring the LyCORIS forward reference
2026-07-14 08:06:45 +01:00
CalamitousFelicitousness ca729a01ca feat(lora): handle bias companion keys on fused-qkv targets
A diff_b bias delta on a fused BFL target passed through whole and
failed at apply with a shape mismatch. diff_b stores one value per
output feature, so it partitions with the fused rows exactly like the
up-weight; slice it with the chunk in the LoRA loader. The legacy
weight-shaped bias key (LyCORIS sparse-residual heritage) has no
defined partition on a fused target and no known emitter pairs it with
chunk-capable families, so the group is skipped with a warning in the
LoRA, LoKR and LoHA loaders.

- add slice_bias_delta beside slice_dora_scale; warn and skip
  non-per-output diff_b shapes
- cover sliced diff_b flowing out as ex_bias and the legacy-bias skip
  in the offline suite
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 1b3fd835c6 feat(lora): validate kron dims against the module at lokr load time
A LoKR group whose Kronecker product does not fit the resolved module
previously bound anyway and failed at apply time as a caught per-module
error, leaving the adapter partially applied with only an error log.
Reject the group at load with a warning instead, matching the LoRA
path's shapes_match gate.

- lokr_kron_shape derives (out, in_flat) from full, rank-decomposed or
  Tucker-rebuilt factors, folding conv kernel dims into in_flat
- lokr_shapes_match honors SDNQ original shapes and chunk partitions:
  equal chunks need total * out rows, row-range slices an exact range;
  the input dim is never chunked
- cover non-fused and fused rejection in the offline suite
2026-07-14 08:06:45 +01:00
CalamitousFelicitousness 4cac283561 feat(lora): slice per-output dora_scale on fused-qkv targets
LyCORIS wd=True saves a dora_scale companion for LoRA/LoHA/LoKR; on
fused BFL targets the chunk paths passed it through whole, so apply
failed with a shape mismatch and the module was dropped. Per-output
magnitudes (wd_on_out=True, the default) partition exactly with the
fused rows; per-input magnitudes couple the chunks through shared
column norms and have no exact split.

- slice per-output dora_scale rows with the chunk in the LoRA, LoKR
  and LoHA loaders
- skip per-input DoRA on fused targets with a specific warning
- cover sliced and skipped orientations in the offline suite
2026-07-14 08:06:45 +01:00
CalamitousFelicitousness 1587b9682d feat(lora): support the lycoris_ prefix in every native adapter arch
The lycoris_ save format is arch-independent: LyCORIS standalone wraps
the loaded diffusers model and emits the wrapped module path with dots
as underscores, so verbatim passthrough is correct for any arch. Only
flux2 handled it; zimage, chroma, ernie and krea2 reported such files
as not loaded.

- add lycoris_ to KNOWN_PREFIXES_DEFAULT and PASSTHROUGH_PREFIXES_DEFAULT
- drop flux2's per-arch prefix append and resolve_targets branch
- add lycoris_ to ANIMA_PREFIXES (anima replaces the default tuple);
  network_prefix_for already routes it to the transformer namespace
- cover the passthrough with a zimage loader test
2026-07-14 08:06:45 +01:00
CalamitousFelicitousness 0c5961f605 feat(lora): map flux2 non-block modules in the native adapter loader
BFL-format adapters targeting the embedders, timestep/guidance MLPs,
modulation layers and the final layer resolved to nothing and were
dropped as unmapped, for every adapter family on the f2 native path.

- add F2_EXTRA_MAP exact-match lookups in both target resolvers, with
  the kohya underscore form derived from the BFL path
- add guidance_in. to BARE_FLUX_PREFIXES; groups targeting the guidance
  embedder stay unmapped on models built without guidance_embeds
- extend the offline test mock with the non-block targets and cover all
  three key forms plus full-matrix LoKR with placeholder alpha
2026-07-14 08:06:45 +01:00
CalamitousFelicitousness 8b4d7b9519 fix(sdnq): end the benchmark cleanly when a faulted cuda context is detected
After the correctness section aborts on a sticky kernel fault, the
remaining sections cannot run; flush outputs and exit instead of
cascading into the next cuda call's traceback.
2026-07-14 08:06:45 +01:00
Disty0 49ee0dc647 set group_size_m to 8 on intel too 2026-07-14 02:16:33 +03:00
Disty0 72f8031838 SDNQ update matmul configs 2026-07-14 01:53:48 +03:00
Vladimir Mandic 65787cea89 update modernui
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-07-13 21:49:06 +02:00
Vladimir Mandic f8cfc408e9 strict subpaths
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-07-13 21:48:42 +02:00
Vladimir Mandic f829f2d776 fix infotext
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-07-13 20:58:33 +02:00
Vladimir Mandic 31da9cce6f gallery improve sort
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-07-13 20:35:05 +02:00
Vladimir Mandic fb71f63d77 fix gallery delete and save
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-07-13 19:08:59 +02:00
Disty0 d39bd45d04 check ipex and xpu on sdnq 2026-07-13 19:16:02 +03:00
Disty0 7779bf256d Don't hard-code for CUDA on SDNQ Atten benchmark 2026-07-13 18:51:06 +03:00
Disty0 173d9a05ba Do not try to probe FP8 MM on known to be unsupported GPUs on SDNQ Atten benchmark 2026-07-13 18:34:40 +03:00
Disty0 78482ef6ca Enable Triton MM for Intel 2026-07-13 18:24:14 +03:00
Disty0 32650c7e50 SDNQ add fused Triton kernels 2026-07-13 18:01:01 +03:00
Vladimir Mandic ea1d164de3 css updates
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-07-13 15:52:55 +02:00
Vladimir Mandic 56fabd4950 add joy-image-edit-plus
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-07-13 11:26:33 +02:00
Vladimir Mandic b7944a1be9 video model loader
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-07-13 11:26:33 +02:00
Disty0 dc7e3929cd SDNQ Atten skip TE 2026-07-13 04:49:55 +03:00
CalamitousFelicitousness f7f14fab02 fix(sdnq): survive sticky cuda faults in the benchmark and always flush outputs
A kernel fault (misaligned address, illegal memory access) is sticky:
every later cuda call in the process fails, so one faulting check killed
the whole run through the next reference computation and lost the --save
and --json outputs. Compute the correctness reference inside the
per-check handler, detect a dead context and abort the section with a
clear message, and flush partial outputs from a top-level handler on any
crash or interrupt.
2026-07-12 18:08:14 +01:00
CalamitousFelicitousness 779127c7ba fix(sdnq): separate capability and environment failures in the fp8 probe report
The fp8 attention probe can fail for reasons other than missing hardware
support (torch or triton compile issues); reporting those as 'not supported
on this gpu' is wrong on gpus where fp8 is native. Match the triton
pre-sm_89 signature and label anything else as an environment failure.
2026-07-12 17:58:51 +01:00
CalamitousFelicitousness 44146ee096 fix(sdnq): run benchmark correctness checks with swapped-in eager prep
Toggling torch._dynamo.config.disable to force eager input prep fails on
newer torch: a fullgraph-compiled function called inside a disable window
raises 'found no compiled frames', failing every check and poisoning the
first compiled call afterwards. Swap the module-global prep function for
its eager inner instead, matching the dequant section's mechanism.

- store per-check errors and exceptions in the json report, so remote
  reports carry the failure mode
2026-07-12 17:33:31 +01:00
Disty0 41659f9f95 Update Trtiton MM configs 2026-07-12 16:17:14 +03:00
Disty0 16c82c58af make fp8 skip check only valid for linux 2026-07-12 15:37:18 +03:00
Vladimir Mandic 03473c1316 add loaded-loras api endpoint
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-07-12 13:10:35 +02:00
Vladimir Mandic d31a99edb0 ui format gallery
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-07-12 10:38:46 +02:00
Vladimir Mandic 22e132e6f0 rebuild ts
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-07-12 09:06:15 +02:00
Vladimir Mandic 99a963271e Merge pull request #4993 from vladmandic/feat/secondary-unet-networks
feat(ui): load unet into secondary slot from networks panel
2026-07-12 09:02:12 +02:00
CalamitousFelicitousness 00d1b7cff6 feat(ui): load unet into secondary slot from networks panel
The refine toggle doubles as the slot selector on the UNet/DiT page:
with it active a card click sets sd_unet_secondary instead of sd_unet,
mirroring base/refiner selection on the model page.
2026-07-12 03:50:48 +01:00
CalamitousFelicitousness cf031b869c feat(sdnq): add weight dequant and combined block sections to the benchmark tool
Benchmark weight dequantization alongside attention: eager vs compiled
dequantization, measured standalone and through the full linear forward,
plus the quantized matmul forward, across int/uint 8-6-4-2 and the
pre-quantized float formats (float8_e4m3fn, float8_e4m3fn_sdnq,
float4_e2m1fn group 16) at krea 2 layer geometry, against a bf16 nn.Linear
baseline and a true-fp32 output reference. Each row carries measured
storage size and one-shot quantize time; an svd/hadamard variants table
measures rotation and low-rank costs on top of the base dtypes.

A combined block section measures complete configurations (weights dtype x
matmul path x attention) end to end through a dit-style transformer block,
with output error at depth one and four against an fp32 reference block,
because component speedups and errors do not compose multiplicatively.

- recommendations weigh error against speed: a faster option is rejected
  when it multiplies measured output error beyond 2x, and reason strings
  cite both numbers; notes include measured size/error and speed/error
  frontiers
- robustness: extreme-activation stress rows in the correctness matrix
  (pass on finite output), max-token-error columns beside norm error, and
  non-finite outputs labeled as verdicts; norm metrics alone hide
  token-level corruption on outlier-heavy inputs
- probe compiled weight dequant for e4m3 and e5m2 storage and report the
  fp8 compile gate status; on ampere e5m2 compiles while e4m3 does not
- new attention presets: sdxl-cross (cross-attention), qwen3-te (causal
  gqa text encoder), wan22-cfg (batched cfg video); cross-attention
  correctness check
- --sections, --dequant-dtypes, --dequant-variants and --block-configs
  selectors, --json structured results output
2026-07-12 03:44:54 +01:00
CalamitousFelicitousness ce84b2d183 perf(model): adopt fp8 weights through the uint8 codec when fp8 cannot compile
Triton cannot compile e4m3 loads before sm_89, so fp8 weights fall back
to eager dequant there. The uint8-backed float8_e4m3fn_sdnq codec decodes
identically now that subnormals are handled (the two NaN codes become
+/-480), and its compiled dequant runs about 6x faster than eager native
fp8. Pre-quantized fp8 layers are viewed as uint8 at adoption when
compiled dequant is enabled on such hardware; the eager gate remains the
safety net for every other fp8 path.
2026-07-12 03:44:54 +01:00
CalamitousFelicitousness 5e1a0719ab feat(model): detect header metadata and nvfp4 in the model probe
detect_quant now reads _quantization_metadata as the authoritative quant
source when present, and resolves marker-file formats from the marked
layers' stored weight dtypes instead of file-wide dtype voting, which
mislabeled fp8 files carrying extra uint8 tensors and had no nvfp4
mapping at all. Schema bump so cached probe entries refresh.
2026-07-12 03:44:54 +01:00
CalamitousFelicitousness 0997526394 feat(model): load nvfp4 comfy_quant checkpoints via sdnq
nvfp4 layers keep their packed 4-bit codes and land on SDNQ grouped
quantization as float4_e2m1fn: the nibble order is swapped once at load,
the e4m3 block scales are unswizzled from the cuBLAS tile layout, and
the fp32 global scale folds into them as per-group scales. Marker
orig_shape acts as a cross-check and alignment padding is sliced
against the model dimensions.

- reject nvfp4 markers with unknown group sizes or convrot flags
- accept uint8 storage in the krea2 real-file check
2026-07-12 03:44:54 +01:00
CalamitousFelicitousness f05a3ae3e9 fix(sdnq): skip compiled dequant for fp8 weights without hardware support
Triton has no e4m3 conversions before sm_89, so any compiled graph
touching fp8 storage weights fails with an InductorError on Ampere.
Select the eager dequant and re-quantize paths for e4m3 weights when
the hardware cannot compile them; other dtypes keep compiled dequant.
SDNQ_ALLOW_FP8_COMPILE overrides the detection.
2026-07-12 03:44:54 +01:00
CalamitousFelicitousness 6e63f351eb refactor(ui): drop quicksettings companion machinery for secondary unet
The secondary unet loads from the networks panel toggle or the settings
page; companion ordering and dynamic visibility pushes in ui_settings.py
are not worth their footprint for one setting.
2026-07-12 03:44:20 +01:00
CalamitousFelicitousness 3fe54d1045 chore: rename probe cache files to signatures.json and civitai.json 2026-07-12 03:44:19 +01:00
CalamitousFelicitousness 4785dedc32 fix(ui): set refiner option from networks panel refine toggle
The hidden change_refiner button passed key='sd_model_checkpoint', so
loading a card with the refine toggle active reloaded the base model
and never set sd_model_refiner.
2026-07-11 20:26:12 +01:00
CalamitousFelicitousness 8291365955 refactor(model): simplify probe cache handling
json_helpers does its own error handling and file locking, so the
try/except wrappers, threading locks and isfile checks were dead
weight; probe cache file paths are now defined in paths.py.
2026-07-11 20:26:12 +01:00
CalamitousFelicitousness c54c0535c0 fix(civitai): accept civitai.red urls in header peek
The .red mirror rewrites downloadUrl to its own host; normalize to
civitai.com so the ssrf guard, cache hash and fetch host agree.
2026-07-11 20:26:12 +01:00
CalamitousFelicitousness d005ac5aa1 feat(model): support comfy_quant header metadata containers
Newer quantized checkpoints record per-layer formats in the safetensors
header _quantization_metadata instead of marker tensors. The native loader
now reads the header map, re-keys it through the same prefix strip as the
tensors, and transcodes it into marker tensors so both container forms
share one detection path; header entries win over markers.

- drop optional input_scale sidecars for marked layers
- map full_precision_matrix_mult onto the sdnq per-layer matmul exclusion list
- log the detection source (markers, header, both)
2026-07-11 20:26:12 +01:00
Vladimir Mandic 9bb94dcfff update gitignore
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-07-11 21:08:22 +02:00
Disty0 ad400ba817 SDNQ handle subnormals in FP formats and cleanup Triton MM 2026-07-11 21:52:51 +03:00
CalamitousFelicitousness 8803537df8 chore: ignore model probe cache files 2026-07-11 06:45:30 +01:00
CalamitousFelicitousness 5d5ede5c47 feat(model): load convrot comfy_quant checkpoints via sdnq hadamard
ConvRot is the regular Hadamard rotation SDNQ implements: identical
construction, normalization, axis, and dequant order. Per-layer markers
map onto the dequantizer's use_hadamard and hadamard_group_size; group
sizes must be powers of 4 and divide in_features, else base-repo
fallback. Detection carries per-layer metadata since files mix plain
and rotated layers.
2026-07-11 06:40:08 +01:00
CalamitousFelicitousness 9f91726020 fix(ideogram4): resolve activation dtype for quantized transformers
transformer.dtype reports the storage dtype for fp8-quantized models
(fp8 params are floating, int8 params are not), so activations were
cast to fp8 and the forward crashed. Read the compute dtype from the
SDNQ dequantizer instead.
2026-07-11 06:40:07 +01:00