Commit Graph

14482 Commits

Author SHA1 Message Date
Dity0 e1767aa72d remove sdnq.sdnext hijacks 2026-08-27 02:47:03 +03:00
Vladimir Mandic b14ce1032b update changelog
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-26 16:13:12 +02:00
Vladimir Mandic 4be7d3c761 Merge pull request #5052 from vladmandic/feat/attention-core
Feat/attention core
2026-08-26 15:59:39 +02:00
Vladimir Mandic 79a843474d Merge branch 'dev' into feat/attention-core 2026-08-26 15:59:28 +02:00
Vladimir Mandic 7a489d42f5 Merge pull request #5066 from vladmandic/lora-exact
merge lora-exact into dev
2026-08-26 15:59:00 +02:00
Vladimir Mandic 54624debd8 Merge pull request #5044 from vladmandic/feat/lora-sdnq-exact
feat(lora): exact lora application on sdnq-quantized models
2026-08-26 15:58:10 +02:00
Vladimir Mandic 4cdcbd5cdc Merge branch 'lora-exact' into feat/lora-sdnq-exact 2026-08-26 15:58:00 +02:00
Vladimir Mandic 609e9003f1 Merge pull request #5065 from vladmandic/dev
refresh branch
2026-08-26 15:57:16 +02:00
Vladimir Mandic d0cceefd0f Merge pull request #5064 from vladmandic/dev
refresh branch
2026-08-26 15:48:41 +02:00
Vladimir Mandic 213f0b8048 Merge branch 'master' into dev 2026-08-26 11:17:33 +02:00
Vladimir Mandic fca27159ef update changelog/todo
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-26 11:00:10 +02:00
Vladimir Mandic acb4e758d3 add heif/heic support
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-26 10:24:17 +02:00
Vladimir Mandic 0fde1f4dae Merge pull request #5061 from crashingalexsan/dev
Pin stable ROCM 7.14, rework multi arch installation
2026-08-26 10:12:25 +02:00
Alejandro Alberto Aguilar Morales 3edaed8e77 Pin stable ROCM 7.14, rework multi arch installation 2026-08-26 01:17:54 -06:00
Vladimir Mandic 6cdc3bba7e switch to pillow-heif
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-26 07:49:26 +02:00
Vladimir Mandic 144c00efdd Merge pull request #5060 from vladmandic/fix/queue-lock-exception-suppression
fix(queue): stop the queue lock from suppressing exceptions
2026-08-26 07:31:39 +02:00
CalamitousFelicitousness cb06447426 fix(video): report a cancelled generation as 499
process_images swallows the interrupt assertion, so a cancel reaches the shared
video core as an empty result and was raised as 'processing failed' with 500,
leaving clients unable to tell a cancel from a crash. Mirrors the LTX path,
which already returns 499.
2026-08-26 04:28:59 +01:00
CalamitousFelicitousness 78a49eab33 fix(queue): stop the queue lock from suppressing exceptions
Queue.__exit__ returned _queue_lock, and a truthy __exit__ return suppresses the
exception in flight, so every `with queue_lock:` block discarded exceptions and
resumed with locals from the aborted block unassigned. The bare threading.Lock it
replaced returned None.
2026-08-26 03:36:15 +01:00
CalamitousFelicitousness 3f80bb05b0 docs(ltx): correct the refine default comment and stale file references
The refine-default comment claimed Condition variants are excluded from two-stage
refine, but supports_two_stage_refine has no such carve-out and ltx_process builds
a second condition set so conditioning survives the upsample. Two file references
had also drifted: ltx_process.py:179 moved, and the offload hook keying now lives
in sd_offload_balanced. Name the symbols instead of the line numbers.
2026-08-25 23:21:21 +01:00
Dity0 99112c9be1 switch rocm nightlies to rocm 7.14 2026-08-25 12:34:55 +03:00
Vladimir Mandic 1946892b7f improve memory reporting, explicit interpolation and minimax tracking
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-25 09:11:46 +02:00
CalamitousFelicitousness 4ae6515163 feat(lora): quantized apply method setting
New lora_sdnq_apply radio (exact, requantize) in the lora settings.
requantize keeps the previous behavior: every quantized layer takes the
dequantize-add-requantize path, with factor attach and svd hosting gated
off. A settings-only flip re-applies loaded networks: the mechanism
rides a per-module apply stamp and the network-changed signature, and
the activate fallthrough strips factors a closed gate leaves attached.
Requantize chosen by the setting logs as info instead of the
reduced-fidelity warning.

- locale hint covers fidelity and memory tradeoffs of both methods
- suite: gate, legacy routing and flip-transition tests
2026-08-25 00:25:22 +01:00
CalamitousFelicitousness 8c377aeeee refactor(settings): dedicated lora settings tab
The lora block moves out of Networks into its own settings tab, with
header groups by what each option acts on: loading, prompt, application,
quantized models and metadata. Locale hints follow to the new section.
2026-08-25 00:25:22 +01:00
CalamitousFelicitousness 82a7e94450 feat(lora): activation-weighted hosting via per-checkpoint calibration
Plain svd truncation of hosted deltas is optimal in weight space but not
in output space: activations concentrate energy in a few input channels,
so scaling the delta by per-channel input RMS before the svd spends the
rank budget on output error instead. Statistics stream from the model's
own forwards on sub-8-bit SDNQ checkpoints and cache per checkpoint;
measured on real LoKR files this raises output-delta retention by ~0.05
at rank 256 and ~0.09 at rank 64, most on MLP down projections.

- modules/lora/lora_calib.py: capture hooks, per-checkpoint cache under
  data/sdnq-calib, statistics land on layers as sdnq_calib_rms; gated by
  lora_sdnq_host_calib, skipped when the model is compiled
- lora_sdnq.apply_hosted: weighted truncation when statistics exist,
  calib count in the load summary
- cli/sdnq-calibrate.py: complete calibration now against a live server
- cli/lora-quant-fidelity.py --calib: hosted rho scored in the
  activation-weighted norm
- test/test-sdnq-lora-factors.py: calibration category, 5 tests
2026-08-25 00:25:22 +01:00
CalamitousFelicitousness 37e33e4677 feat(cli): score hosted retention in the fidelity analyzer
Non-factorable modules on sub-8-bit formats report the hosted figure:
the seeded svd truncation at --host-rank realized through the bf16
materialize, mirroring the loader. The requantize figure stays in
requant_rho; --host-rank 0 restores the old scoring.
2026-08-25 00:25:22 +01:00
CalamitousFelicitousness 6c0dd0b15f feat(lora): host non-factorable adapters on the sdnq side-channel
Non-additive families (lokr, loha, oft, dora, full) merged into the
quantized weight and lost most of their delta on low-bit formats. On
sub-8-bit layers the set's calc_updown delta now rides the svd
side-channel as its top singular directions instead: factorable members
are subtracted out and appended exactly, so only the non-factorable
remainder is truncated. Truncation keeps the dominant part of the
effect and drops an orthogonal residual, where requantize keeps the
grid extrema and adds grid-shift noise of the delta's own magnitude;
on real lokr files retention rises from 0.04 to about 0.5 at the
default rank.

Hosted layers take no weight backup and unload bit-exactly. The svd
runs under a forked rng so generation seeds are unaffected. At 8 bits
and above requantize retains most of the delta and remains the path.
lora_sdnq_host_rank caps the hosted rank; 0 disables hosting.
2026-08-25 00:25:22 +01:00
CalamitousFelicitousness 9fa23b914e fix(cli): measure realized factor-path fidelity instead of asserting it
The analyzer scored factor-eligible modules applied_rho=1.0 by
construction. The side-channel stores the delta losslessly, but the
dequantizer materializes base + factors in the result dtype, so small
deltas round at the bf16 ulp of the base weight. Score the realized
delta through that rounding; sub-ulp loras now report the same floor an
unquantized bf16 model gives them instead of a false 1.0.

Also survive a broken file and keep completed work: per-lora failures
are recorded and skipped, the report json rewrites after every file,
and a complete flag marks a finished run.
2026-08-25 00:25:22 +01:00
CalamitousFelicitousness b5c58151be fix(lora): harden the sdnq factor path
- restore stashed svd factors onto the layer's current device; the
  stash tuple does not follow module device moves, so an offload
  between apply and remove left restored factors on a stale device
- recheck factor shapes for layers already in factor mode, so a
  malformed stacked network downgrades to the legacy path instead of
  raising in the concat
- clear the fallback log at activate entry so a raise mid-pass cannot
  leak stale entries into the next report
- pin both behaviors in the suite and state the compute-dtype fidelity
  floor in the module docstring
2026-08-25 00:25:22 +01:00
CalamitousFelicitousness 0b606b8b2a fix(cli): replicate the loader's requantize and survive non-matrix targets
Three defects surfaced by running the analyzer over a full local
collection against shipped checkpoints.

The requantize path hardcoded use_svd=False, but network_add_weights
requantizes with the layer's own svd setting and rank. On an svd
checkpoint the dequantized weight is not on the plain integer grid, so
requantizing without svd produced an error dominated by the discarded
correction and roughly orthogonal to the delta, which read back as a
retention near 1.0 on a grid where the delta is 0.005 of a step. Thread
use_svd, svd_rank and svd_steps through and reuse the returned factors.

Targets whose weight is not a matrix (norm and scale parameters, 205 of
them in one z-image extraction) reached the quantizer and the module stub,
both of which unpack two dimensions and raised. Skip and count them before
either. An all-zero delta (some full-rank extractions ship empty .diff)
divided by its own norm and reported nan; its retention is undefined
rather than erased, so it is excluded from the medians and counted.
2026-08-25 00:25:22 +01:00
CalamitousFelicitousness 329d69f5df fix(cli): match module paths the way the loader does
Kohya-style files carry an already-underscored base (lora_unet_layers_0_
mlp_gate_proj), which the loader resolves by comparing network_prefix +
path.replace('.', '_') against each module's stamped name, so both sides
are underscored and the file loads. The analyzer instead looked the base
up as a literal dotted module path, so every module of such a file was
reported unmatched: 76 files in a local collection, including 36 of 57
anima and 5 of 10 chroma.

Fall back to a stamped-name index when the direct lookup misses. Dotted
bases are unaffected.
2026-08-25 00:25:22 +01:00
CalamitousFelicitousness 6ea2c50d5d fix(cli): measure every adapter family in the fidelity analyzer
The analyzer only mapped plain-lora groups, so a file carrying no plain
lora (a pure lokr, for example) analyzed zero modules and fell through to
a 1.0 default: it reported perfect fidelity for exactly the files that
degrade most. Measured on the shipped krea 2 uint4 checkpoint, those
files land between 0.04 and 0.34.

Every targeted module is now rebuilt with the loader's own module class
and its delta read from the production calc_updown, so lokr, loha, oft,
full, ia3, glora, norm and the dora / dense-bias / diff_b variants are
measured as they apply; factor-path eligibility is decided by calling the
loader's own predicate. Modules carrying several families sum their
deltas the way the loader stacks them, and a family the tool cannot
rebuild is reported instead of counting as clean.

- report per-module applied fidelity (1.0 on the factor path, measured
  rho on the requantize path) as a median and an energy-weighted mean
- add --dtype bf16 to measure the unquantized reference rather than
  assert it
- drop the per-module empty_cache: it cost 16ms per module against 1ms
  of reuse, and the caching allocator already reuses the buffers
- keep shard handles open across modules
2026-08-25 00:25:22 +01:00
CalamitousFelicitousness 2fcd99a409 test(lora): cover sdnq config matrix in factor path suite
Checkpoints quantized without hadamard must attach factors unrotated;
checkpoints carrying their own svd correction must keep it under apply
and get the original factors back on remove. Both pinned in both svd
layouts.
2026-08-25 00:25:22 +01:00
CalamitousFelicitousness 9906afae08 feat(cli): lora quantization fidelity analyzer
Offline analyzer for a (model, lora) pair: maps lora modules onto the
transformer, measures per-module delta-to-step ratio and requantize
retention, and reports factor-path eligibility. Loads pre-quantized
sdnq repos or simulates quantization on bf16 repos; supports --json
and --fail-under for scripted checks.
2026-08-25 00:25:22 +01:00
CalamitousFelicitousness 9b37a1535c fix(lora): exact lora application on sdnq-quantized layers
Baking a lora into a quantized weight requantizes it, and on low-bit
formats round-to-nearest erases sub-step deltas (uint4 retains roughly
2/group_size of the signal). Plain lora deltas now ride the sdnq svd
side-channel: factors append to svd_up/svd_down with the down factor
hadamard-rotated, applied by the dequantizer at full precision in every
forward mode. Apply and remove are exact and take no weight backup.

- non-factorable families (dora, lokr, loha, oft, cp mid, dense bias)
  fall back to requantize with a per-pass summary warning
- native fuse now honors the quantized-model guard; fuse requantized in
  place on every network swap and accumulated drift
- layers that fell back on a mixed set restore from backup before
  re-entering the factor path; untargeted quantized layers are no
  longer flagged
- test/test-sdnq-lora-factors.py pins the erasure law, factor-path
  exactness, memory accounting and set transitions
2026-08-25 00:25:22 +01:00
CalamitousFelicitousness 10771bd123 Merge branch 'dev' into feat/attention-core
dev added sdnq_attention_quantize_fp32 to modules/attention.py, which this
branch replaced with the modules/attention package. The option moves to the
sdnq backend in two places: the options dict the prepared call captures, and
the options tuple that rebuilds the chain when a captured option changes.
Reading it in only the first place would leave a setting that takes effect on
the next model load and not before.

The new option gets a hint alongside the rest of the section.
2026-08-24 22:54:59 +01:00
CalamitousFelicitousness fcadb4fa9b docs(settings): hint the attention settings
Everything under Cross Attention, SDNQ Attention and Attention Dispatcher
shipped with no hint, which left the layering invisible: the SDP kernel boxes
are candidates torch chooses from per call rather than a selection, and the
Flash box is torch's own build of the kernel rather than the flash-attn package
that the Flash attention override installs.

- cover attention method, sdp kernels, sdp overrides and attention slicing
- give the dynamic attention rates their unit and the estimate they compare against
- cover the sdnq attention kernel settings, including the head dimension clamp
  that the hadamard group size resolves through
- cover the diffusers attention dispatcher and the backend names it takes
- record the constraints each override serves, leaving the throughput comparison
  to the workload rather than naming a winner
2026-08-24 21:59:58 +01:00
CalamitousFelicitousness 4d6f2b65c8 chore(settings): remove the bmm attention methods
Batch matrix-matrix and Dynamic Attention BMM applied a legacy Attention
processor to pipe.unet, which a diffusion transformer does not have, so
they served unet models alone and said nothing elsewhere. The choices, the
processor and its slice helper are removed, an unrecognized method now
warns rather than selecting nothing, and a stored value is rewritten to
Scaled-Dot-Product on load.
2026-08-24 19:59:41 +01:00
CalamitousFelicitousness 26d922371d fix(attention): honor the disabled choice for attention slicing
attention_slicing holds one of Default, Enabled or Disabled, so testing the
string for truth sent Disabled down the enable branch and left the disable
call unreachable, while the log line below it reported the choice rather
than the action taken.
2026-08-24 19:08:55 +01:00
Vladimir Mandic 5159e8b1a5 experimental minimax chunking
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-24 18:51:30 +02:00
Vladimir Mandic 1714657cf7 change minimax defaults
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-24 18:51:30 +02:00
Dity0 f6777b168d SDNQ Atten: add quantize_fp32 2026-08-24 19:34:54 +03:00
Vladimir Mandic 3c2236c4ed fix ideogram4
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-24 14:57:58 +02:00
Vladimir Mandic fb5584d3fe error handle vae decode
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-24 10:26:28 +02:00
Vladimir Mandic c40fc01015 Merge pull request #5057 from vladmandic/dev
refresh master
2026-08-24 09:14:19 +02:00
Vladimir Mandic 8eefb62173 Merge branch 'master' into dev 2026-08-24 09:14:02 +02:00
Vladimir Mandic c2ce67418c fix prompt enhance api
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-24 09:00:02 +02:00
Vladimir Mandic 0543fc185d update kernel autotune reporting
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-23 14:08:21 +02:00
Vladimir Mandic c81cfa1bb9 Merge pull request #5053 from vladmandic/dev
refresh master
2026-08-23 12:02:09 +02:00
Vladimir Mandic 9adccd6188 Merge branch 'master' into dev 2026-08-23 12:01:50 +02:00
Vladimir Mandic 991590d210 Merge branch 'dev' into feat/attention-core 2026-08-23 11:57:27 +02:00