133 Commits

Author SHA1 Message Date
Vladimir Mandic 62bedf8834 update attention handlers and settings
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-29 13:05:20 +02:00
Vladimir Mandic da856522a8 Merge branch 'dev' into feat/lora-sdnq-stack 2026-08-29 09:46:42 +02:00
CalamitousFelicitousness 455a6d0e8f feat(lora): default the select-mode ramp to 0
At 1.5 the ramp hands nearly every layer to the style network mid-generation,
which on few-step models overwrites the forming subject before identity sets.
Alpha 0 freezes the schedule into a static per-layer split: the subject keeps
its layers for the whole generation and style keeps the layers where it is
more salient. Nonzero values remain the scheduled handover toward the second
network.

- locale hints describe both regimes; the mode hint no longer implies the
  shift is always on
2026-08-28 13:09:26 +01:00
CalamitousFelicitousness f156026150 feat(lora): balance estlora layer scores by network magnitude
EST-LoRA scores each layer by squared Frobenius energy, so a magnitude gap
between the two networks enters squared and the louder network wins nearly
every layer, starving the quieter one. The style side is now scaled by the
total-energy ratio (mirroring klora's gamma), making selection scale-invariant
so a network cannot take layers on magnitude alone. On the krea2 subject+style
pair this lifts the style network from 18% to 65% of the layer-step budget.

- lora_stack: accumulate per-mode energy totals, apply the balance in the est ramp
- test: content-louder est pair now hands over mid-schedule where raw scoring never would
- locale: note the est magnitude balance, and that a select mode gives each layer
  to one network so both can be under-applied, while dense modes blend more fully
2026-08-28 13:09:26 +01:00
CalamitousFelicitousness 55c3eb1325 refactor(lora): remove the lora_apply_te setting
Text encoder networks now apply unconditionally in the native path.

- remove the option, the per-request parameter and the control threading
- collapse activate_filtered into plain activate at all call sites
- drop the toggle from the prompt embed cache key
- register the retired key so existing configs load without warnings
2026-08-28 13:09:26 +01:00
CalamitousFelicitousness c42adcf680 docs(i18n): rework lora hosting and stack mode hints
Restructure the seven hints to the settings pattern: lead definition,
tradeoff, scope, special values and stated default, with value and
cross-setting markup. Mode bullets and special values match loader
behavior: sub-8-bit hosting gate, rank 0 fallback, ramp 0 freezing
the balance.
2026-08-28 13:09:26 +01:00
CalamitousFelicitousness 2396185393 feat(lora): dense stack modes for multi-network sets
Add lora_stack_mode with ties, dare_ties, dare_linear and
magnitude_prune combination of per-network deltas when several loaded
networks target one layer; sum stays the default and the exact factor
path. Combined deltas ride the existing tail: hosted svd on sub-8-bit
SDNQ, requantize at int8 and above, direct add elsewhere. Text-encoder
layers and single-network sets keep plain summation. DARE masks draw
from per-layer sha256 seeds so re-applies and cache entries stay
deterministic; the stack settings join the activation and factor-cache
signatures so settings changes re-apply without a reload.
2026-08-28 13:09:00 +01:00
CalamitousFelicitousness 0fa987e350 docs(settings): record the head sharing finding in the sparse hints
Per-head selection is what breaks head-consistency sensitive models, measured on Anima across fourteen arms: the only clean sparse selections are the ones every head shares. The head sharing hint names itself as the first resort for banded output, and the exclusion hint carries why Cosmos stays listed.
2026-08-28 12:40:23 +01:00
CalamitousFelicitousness 0b56e36a2a feat(attention): exclude known bad models from sparse attention
sparse_attention_exclude is a comma separated denylist matched case insensitively against the architecture, the pipeline class and the denoiser class, so one entry works whichever name is to hand. It resolves once per model rather than per call and declines with a log line. Seeded with CosmosTransformer3DModel, the transformer Anima runs, which returns banded noise at every budget tested against a sound dense baseline; listing the class rather than the architecture covers the other models built on it, none of which have been checked.
2026-08-28 12:40:23 +01:00
CalamitousFelicitousness 8138424bbe docs(settings): cross-reference sparse attention from the sdp hints
The SDP overrides and SDNQ Attention hints describe the block mask capability
without naming what consumes it, so the two backends that can drive sparse
attention now say so where the reader is choosing between them.
2026-08-28 12:40:23 +01:00
CalamitousFelicitousness f0531e1c88 docs(settings): expand the sparse attention hints
Each hint now carries its default, the tradeoff in both directions, and the
setting it depends on. The two schedule settings do nothing unless both are
above zero, which nothing said before. The sequence floor is given in
resolution as well as tokens, since the setting is read in pixels.
2026-08-28 12:40:23 +01:00
CalamitousFelicitousness 97b5112cf8 refactor(settings): make the sparse sequence floor a plain value
The option defaulted to 0 and a property turned that into 8192, which hid
the real default behind a sentinel and left no way to sparsify every
sequence. The default is now 8192 in the settings registry, 0 means no
floor, and the slider tops out at 32768 rather than a length nothing
reaches. A negative value is left unclaimed for a derived floor.
2026-08-28 12:40:23 +01:00
CalamitousFelicitousness 7bc11ff470 docs(settings): name the sparse attention sequence floor
The hint deferred to an unnamed built in threshold where every comparable
hint in the file gives the value. It is a single static constant.
2026-08-28 12:40:23 +01:00
CalamitousFelicitousness b2de8f53c4 feat(attention): sdnq backend consumes the block selection
The sdnq Triton kernel gains a block mask input (on the submodule's feat/block-mask branch; the pointer here is unchanged), so the backend advertises the block_mask cap and passes the router's selection as block_mask plus its block sizes. Prepare probes the installed kernel's signature and narrows the cap when the input is missing, warning when sparse attention is on, so an older submodule stays dense instead of failing. PlanEntry carries the narrowed caps, and the router, the sparse stage and the report read those rather than the declaration.

- benchmark: int8-sparse100/50/30/15 and int8-radial30 rows feed the same producer as the flex rows into the quantized kernel, skipped on builds without block_mask; a --configs filter selects attention rows the way --block-configs selects block rows; sparse rows of either backend are held out of the settings advice
- test/test-attention-sdnq-sparse.py: the kernel contract against the token-expanded mask, the nesting filter, the public entry on the quantized paths, the backward against the same selection and against fp32 autograd, and the flex consumer on one selection, pinned to one tile per run with a --tiles sweep
- locale: the sparse attention hint names both capable backends
2026-08-28 12:40:22 +01:00
CalamitousFelicitousness d75abce642 feat(attention): sparse attention settings and router stage
Sparse attention is a stage over the chain rather than a member of it:
one switch, and the router hands the selection to whichever active
backend advertises that it consumes a block mask, currently flex. A
backend declares that through a capability set, so the quantized kernel
joins later without touching the router.

The stage gates on the component role, self attention, a minimum
sequence length defaulting to the measured 8192 token crossover, and the
absence of a token mask or causal flag, which flex cannot combine with a
block only mask. Budgets follow a precomputed per step schedule with at
most two distinct values. Enabling the feature with no capable backend
in the chain warns and leaves attention dense rather than doing nothing
quietly.

The modular pre-forward hook now receives kwargs and publishes whatever
token layout the pipeline passes by name, so a packed sequence gets its
conditioning pinned without any model specific code. Without a layout
the whole sequence is sparsified and that is logged once per length.
2026-08-28 12:40:22 +01:00
CalamitousFelicitousness a2daf9027c feat(lora): disk cache for hosted svd factors
Hosting a non-factorable set costs one truncated svd per layer on every
fresh apply. The factors are deterministic in the checkpoint, the loaded
set, the host rank and the calibration statistics, so they persist under
data/lora-factor-cache keyed by that identity and replay bit-identically
on later applies. lora_sdnq_host_cache sets the disk budget in GB
(0 disables), least-recently-used entries are evicted past it. With the
cost paid once per configuration, svd subspace iterations rise from 2 to
4: about two thirds of the captured-energy gap to an exact decomposition
for +45% one-time compute; an exact svd measures 200-400x slower at
these shapes and is not viable.

- modules/lora/lora_factor_cache.py: signature, store, flush, eviction
- lora_sdnq.apply_hosted: fetch before computing, store after, hits in
  the load summary
- cli/lora-quant-fidelity.py: matching niter for the hosted mirror
- test/test-sdnq-lora-factors.py: factor-cache category, 3 tests
2026-08-26 23:47:44 +01:00
Vladimir Mandic 79a843474d Merge branch 'dev' into feat/attention-core 2026-08-26 15:59:28 +02:00
Vladimir Mandic d0cceefd0f Merge pull request #5064 from vladmandic/dev
refresh branch
2026-08-26 15:48:41 +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
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 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 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
Vladimir Mandic 3d7c138a83 lint
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-19 19:02:39 +02:00
Vladimir Mandic c66342e2e6 fallback unpack-latents, log client auth, update login page
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-19 18:03:39 +02:00
Vladimir Mandic 9f650367cb multiple cleanups
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-17 09:35:07 +02:00
Vladimir Mandic 7172fd3eb2 api auth for ws and api validate allowed paths
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-16 18:57:26 +02:00
Vladimir Mandic f30e6baa67 codespell
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-16 12:45:50 +02:00
Vladimir Mandic 84eda5b9cf Merge branch 'dev' into fix/group-offload-roles 2026-08-16 09:06:01 +02:00
Vladimir Mandic a6a6fb2aaa add minimax interpolation, video shift, audio shift
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-15 18:35:17 +02:00
Vladimir Mandic 87824ad0a3 update video codecs
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-15 14:23:18 +02:00
CalamitousFelicitousness 09eeff30c7 refactor(settings): reorganize the offload settings by mode
The offload section interleaved shared and mode-specific options. The
page now reads top down: general options, an Offload Overrides section
holding the exclusions shared by balanced and group offload, then one
tuning section per mode. Use torch streams becomes Prefetch with streams
and Record torch streams becomes Overlap stream transfers, the section
headers carry hints, and the hints reflect live behavior, including
dropping the model-reload badge from options that apply on change.
2026-08-14 23:59:55 +01:00
CalamitousFelicitousness 5814d5c4b3 feat(ltx): add the ltx-2.5 model family
2.5 reuses the LTX-2 pipeline classes, so it is described through the
capability table: Gemma 4 text encoder, cross-timestep conditioning, and the
upsampler and stage 2 LoRA that now ship inside the model repo. The repo
carries the distilled scheduler config, so Dev rows restore the terminal
shift, and the Dev transformer sits in transformer_full.

Distilled rows stop forcing dynamic shifting on, which remapped their sigma
schedule. Auto duration hands the clip length to the duration head.
2026-08-14 03:39:01 +01:00
Vladimir Mandic ad6f3d3e11 minimax ui
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-13 15:33:47 +02:00
Vladimir Mandic 1ca694aa26 Merge pull request #5017 from vladmandic/feat/minimax-h3
Feat/minimax h3
2026-08-11 13:34:36 +02:00
Vladimir Mandic ed6eb2ea0a Merge pull request #5016 from vladmandic/feat/offload-engine
feat(offload): per-component group offload engine and memory observability
2026-08-11 11:26:56 +02:00
Vladimir Mandic 431774e6e2 fix progress in legacy tabs
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-11 10:41:34 +02:00
CalamitousFelicitousness ca9495cbe2 fix(ui): show the reported stage in generation progress
The progress response carries a stage label in textinfo, but the
button and hint composed their text from the job name alone, so
staged pipelines sat on a bare inference label. The stage now takes
precedence in the button label and appears next to the job in the
performance hint.
2026-08-10 22:11:57 +01:00
CalamitousFelicitousness c9e1398c71 feat(video): add minimax h3 joint video and audio model
First natively modular model: the pipeline is driven directly through
ModularPipeline, with components fetched per workflow (fl2va covers
text and first/last-frame conditioning).

- per-generation overrides snap the canvas to /32, align frames to
  the 17n+5 grid and duration window, and keep the bespoke scheduler
  pair
- group offload for modular pipelines applied per component in
  sd_offload; re-application is a guarded no-op
- audio checkbox pops the audio decode block so decode and muxing are
  skipped
- frames=1 renders a single still image: the duration floor lifts per
  instance and sub-floor latents pad at the vae decoder
- progress and interrupt handling via a transformer forward pre-hook
- vae scale factor override, tuple-safe patch size
2026-08-10 22:11:57 +01:00
CalamitousFelicitousness abfb5ac3ed feat(offload): on-demand vae under group offload
Vae-class components never take group hooks, so group mode kept them
resident on the gpu; a MiniMax-class video vae holds about 10GB that
way while running only seconds per generation. Components above 1GB
now rest in system memory: the apply_forward_hook bridge on encode and
decode fires an on-demand hook that moves the whole module to the
device, so tiled calls find every weight already loaded, and the
processing seams return it to cpu once outputs are materialized. Small
vaes stay resident since the transfer would cost more than it frees.

- placement is decided per component by measured size and requires the
  entry bridge; components without it stay resident
- move_model no longer forces on-demand vaes to the gpu for
  non-txt2img tasks, and full_vae_encode onloads before binding the
  input, which otherwise lands on the resting device
- mode switches clear the stamp and hook in both directions
2026-08-10 22:10:42 +01:00
CalamitousFelicitousness 46c30a00f2 feat(offload): per-component group offload engine
Group offload is applied per component through one engine shared by
regular and modular pipelines. Each component carries a config
signature: re-application with unchanged settings is a no-op instead
of raising before the first forward or silently keeping a stale
config, and changed settings remove the hooks and reapply. Switching
offload modes cleans up the previous mode's hooks in both directions.

- text encoders always offload at leaf level without streams, so
  their weights are never held in pinned host memory
- the vae never takes group hooks and stays resident: the hooks are
  forward-scoped, while pipelines enter through encode/decode and
  tiled calls re-enter per tile
- new pin offload memory option: disabled pins one group at a time
  instead of holding the whole module in non-pageable memory, and
  modules larger than half of system memory degrade automatically
- record stream is clamped to stream mode; the standalone
  combination is rejected upstream
2026-08-10 22:10:42 +01:00
CalamitousFelicitousness 248c5c6b7b feat(offload): match balanced offload lists by component name
Entries in the always and never lists are matched against the pipeline
component name (text_encoder, vae) as well as the model class name, so
one entry covers every architecture instead of needing a new class name
per model. Class entries keep working unchanged.

Never is still tested first, so a class entry there exempts a single
model from a component entry in the always list.
2026-08-10 22:10:42 +01:00
Vladimir Mandic 8b1f0d60b5 cleanup
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-10 11:13:28 +02:00
Vladimir Mandic 40fb45a546 improve handling of hf auth
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-10 10:55:25 +02:00
Vladimir Mandic de4b4b2c62 Merge pull request #5013 from awsr/gallery-fix
Remove incorrect gallery cleanup check
2026-08-10 08:47:12 +02:00
awsr d20ee5f26b Partial revert "Remove incorrect gallery cleanup check"
This partially reverts commit 8a66206023.
2026-08-09 16:09:25 -07:00
awsr 788d05db6c Revert "Rerun UI compile"
This reverts commit 6bc43ef20c.
2026-08-09 16:07:48 -07:00