Commit Graph

9081 Commits

Author SHA1 Message Date
CalamitousFelicitousness 37f005a5d2 fix(offload): skip accelerator pre-moves of on-demand components
Tab runners pre-move the vae module to the gpu before generation,
which parks an on-demand component on the accelerator for the whole
denoise. Moves of a stamped module toward the accelerator now return
early; the entry bridge onloads it when its encode or decode runs.
2026-08-10 22:10:42 +01:00
CalamitousFelicitousness 0b3ec59988 fix(offload): report per-component stats under group offload
The per-component stats block printed only from the balanced offload
path, so group mode loads showed no component classes, sizes or
quantization. Group and modular applies now print the same block once
per loaded model, with sizes measured directly when no balanced hook
map exists.
2026-08-10 22:10:42 +01:00
CalamitousFelicitousness cb6e04d392 fix(offload): return on-demand components to rest after bulk moves
A pipeline-level move to the accelerator carries on-demand components
along with it, since modular pipelines skip only group-hooked modules;
the load path then left a resting vae on the gpu until its first use.
Bulk moves now re-evict stamped components, whose entry points onload
them when needed.
2026-08-10 22:10:42 +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 b84b782ba4 fix(lora): apply native networks in place under group offload
Group offload hooks report the onload device at module level while the
weights rest on cpu, so every native apply took the parameter
replacement branch in assign_weight and detached the written layers
from the hook's group bookkeeping. The activation and deactivation
walks now remove a component's group hooks before its first weight
write and reapply offload at the end of the pass: writes land in place
on the resting tensors and fresh groups snapshot the result.

- hooks come off lazily, only for components with a covered layer or a
  pending backup or factor-stash restore; repeat activations with an
  unchanged set leave the hooks untouched
- remove_group_offload_component follows wrapper components to the
  inner model that carries the hooks
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
Dity0 251945939b Add Lloyd-Max quantization with use_codebook 2026-08-10 22:51:32 +03:00
Vladimir Mandic ccb048a9af fix api-control
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-10 20:43:50 +02:00
Vladimir Mandic 6aa5b45b80 remove directml
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-10 13:43:45 +02:00
Dity0 2250d8052a remove sdnq_dequantize_compile option
- advanced users should use the env var SDNQ_USE_TORCH_COMPILE instead
2026-08-10 13:30:56 +03:00
Vladimir Mandic e89062c04f register submodule as package
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-10 12:06:33 +02:00
Vladimir Mandic 8b1f0d60b5 cleanup
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-10 11:13:28 +02:00
Dity0 712a13f1a0 Move SDNQ to upstream SDNQ repo 2026-08-10 12:13:10 +03: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
Dity0 a2ae48cceb Move triton logging hijacks to loader.py 2026-08-10 11:34:51 +03:00
CalamitousFelicitousness 156b76aa9c feat(sdnq): report triton kernel autotuning and compile time
Autotune sweeps and kernel compiles run inside the first forward pass at a
new shape and can take minutes with no indication in the log or UI. Add
listeners on the triton autotuning and compilation knobs plus a wrap of the
per-candidate benchmark: a sweep draws a console progress bar over its
candidates and mirrors the count in the live progress text, the completion
line records the kernel, shape, duration and compile share, and standalone
compiles over 1s are logged.

- fix timer_sdnq reading bench_time from the python wrapper functions
  instead of the autotuner kernel objects, which left the two matmul
  autotune timers permanently empty
- restore the pre-tuning progress text across chained sweeps, so an
  abandoned sweep cannot strand its own tuning label in the UI
2026-08-10 02:45:23 +01:00
CalamitousFelicitousness fbb447f419 fix(video): capture pipeline audio before batch script hooks
The audio waveform rides as an attribute on the decoded sample list, but
the batch script hooks rewrap samples into a plain list before the
capture ran, so joint audio-video models muxed silent files whenever a
script runner was attached. Capture the attribute before the hooks run.
2026-08-10 02:45:08 +01:00
CalamitousFelicitousness adf0385c52 fix(sampler): record and restore Default instead of the None sentinel
The keep-current-scheduler sentinel leaked into user-facing surfaces:
infotexts and filenames recorded Sampler: None, restoring such an
infotext pushed an invalid value into the dropdown, and the API
samplers list never offered Default at all.

- infotext always records the sampler, mapping a stray None to Default
- parse maps legacy Sampler: None infotexts to Default
- api samplers list leads with Default; the remaining excluded config
  keys are shared templates, not samplers
2026-08-10 02:44:56 +01:00
CalamitousFelicitousness 1fd39358c5 fix(sdnq): reset dynamo caches at model unload
Dynamo tracks a lifetime recompile counter per compiled function that
freed models leave climbing while their graphs and guards die, and the
compiled dequant runs fullgraph, so crossing the accumulated limit is a
hard FailOnRecompileLimitHit instead of an eager fallback; enough model
or quant switches in one process got there. unload_model_weights now
calls reset_compile_caches when the compiled dequant is active, dropping
the dead graphs and the counters in the same sweep as the unload gc.
Raised limits only move the wall; the reset removes it.

- scoped to the model unload branch: the reset is global and must only
  run when the graphs' owner is being discarded
- regression test trips the wall under a lowered limit and recovers
  through the same helper the unload path calls
2026-08-10 02:44:39 +01:00
CalamitousFelicitousness 8ac84c8468 refactor(lora): drop the underscore from the native dispatch registry
NATIVE_DISPATCH is the documented registration surface for per-arch
native loaders and is read cross-module by the fidelity analyzer, so
the private marker signaled the opposite of its role and enforced
nothing.
2026-08-10 02:44:12 +01:00
CalamitousFelicitousness 4e20c43f8c fix(sdnq): restore safe_open key iteration
safe_open exposes keys() but implements no __iter__, so the dict idiom applied
in d11a619a6 raises TypeError on every non-streamer load of a pre-quantized
checkpoint. The threaded method reaches the same loop, since load_threaded
delegates one file at a time.
2026-08-10 02:43:58 +01:00
CalamitousFelicitousness 76d76be4b7 fix(lora): promote per-network multipliers after the removal pass
Cached networks are shared objects, and network_load overwrote their
multipliers before network_deactivate ran, so fuse-mode removal recomputed
the subtraction delta with the new values: a strength edit froze at its
first applied value and a later removal left residue in the model weights.
network_load now stages the values on the net and network_activate promotes
them, so the removal pass always subtracts the delta that was applied.
Backup mode restores from stored tensors and was unaffected.
2026-08-10 02:43:58 +01:00
CalamitousFelicitousness bf0be3da69 fix(lora): keep applied and restored weights on their original storage
Backup-mode apply and restore installed fresh Parameters. Matmul kernel
selection is sensitive to operand placement, so the first load/remove cycle
shifted otherwise deterministic renders once per process even though every
weight restored byte-exact: bit-identical inputs entered the first post-cycle
unet forward and a different output left it. Copying into the existing
parameter keeps each touched module on its load-time allocation and drops the
per-layer transient of holding old and new weights side by side.

- assign_weight writes weight and bias installs in place when shape, dtype
  and device match; quantized fallback layers keep their rebuild path
- regression test pins storage stability across the activate walk
2026-08-10 02:43:23 +01:00
CalamitousFelicitousness 28bd5e8d74 fix(lora): materialize balanced-offload modules before touching weights
Under a pressed balanced offload, dispatched modules hold meta tensors
whose data lives in the accelerate offload map. The factor path raised
trying to move a meta svd tensor and aborted activation mid-pass; the
legacy requantize path silently skipped those layers. Both left the
model with a partially applied network.

Rebuild the offload state with apply_balanced_offload(force) at
activate and deactivate entry: modules come back real on cpu with
hooks intact and the execution device unchanged, so both paths see
usable tensors and the next forward re-onloads under the watermark.
2026-08-10 02:42:28 +01:00
CalamitousFelicitousness 5b694d3300 fix(lora): default dyn_dim to none when caller omits dyn_dims
network_load seeded net.dyn_dim with extra_networks_default_multiplier
when no dyn_dims list was passed, so a float multiplier landed where
consumers expect a rank and slice with it. The prompt path always builds
a per-network list of ints or None, which is why the crash never fired
from the UI; any direct network_load caller hits it in both
rebuild_conventional and the sdnq factor path.
2026-08-10 02:42:05 +01:00
CalamitousFelicitousness 4c85a60c3e perf(lora): skip the discarded init when building lora modules
create_module built each up/down module with the default constructor,
which kaiming-initializes the parameter, then copied the stored weight
over the whole thing. The init is thrown away every time and costs about
four times the copy: 22.1ms per module against 2.5ms, or 5.8s against
0.7s over a 264-module lora, on every load.

skip_init constructs on meta and materializes uninitialized, so the copy
still fully defines the parameter. Dtype, device and values are
unchanged, including the fp32 upcast of bf16 files that the copy performs.
2026-08-10 02:42:05 +01:00
Vladimir Mandic 562be970ae reorder env vars
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-10 00:43:15 +02:00
Vladimir Mandic ca955ba1c2 update handlers for all authenticated workflows
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-09 22:47:17 +02:00
Vladimir Mandic a882ce945b detailer.next
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-09 15:05:00 +02:00
Dity0 33416f6f82 Accept SDNQConfig in post load quant 2026-08-09 15:58:01 +03:00
Vladimir Mandic e10ec40e2c detailer enable vl models
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-08 16:24:00 +02:00
Vladimir Mandic 48cf0166f3 separate progress monitoring from live preview, live preview improvements, progress details
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-07 11:41:40 +02:00
Vladimir Mandic b092cf7318 unauthenticated path traversal in /thumbs
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-06 18:45:06 +02:00
Dity0 08b2729c22 AMD takes forever to compile with num_stages > 1 2026-08-06 15:20:14 +03:00
Vladimir Mandic 6e448de56c switch to internally managed uvicorn
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-06 13:24:48 +02:00
Vladimir Mandic 0efd18aed5 skip sdnq openvino on non-cpu devices
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-05 20:10:51 +02:00
Vladimir Mandic 7fdaefda0b aux prevent race condition
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-05 14:38:37 +02:00
Vladimir Mandic 84905f77da improve server monitor and profiling
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-05 12:19:07 +02:00
Vladimir Mandic a1df374773 add support for nunchaku-lite models and engine
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-04 15:31:05 +02:00
Dity0 9a7fa12218 SDNQ add minimum_allowed_channel_size 2026-08-04 15:46:38 +03:00
Vladimir Mandic a83795273e prompt enhance and caption use llm-context
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-04 14:21:53 +02:00
Vladimir Mandic 808a25749f update sefi model and add rl variant
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-04 12:40:55 +02:00
Dity0 beacd02487 cleanup 2026-08-04 13:09:07 +03:00
Dity0 c55a1f1e11 lazy init ov_core 2026-08-04 13:01:11 +03:00
Vladimir Mandic 55ba386941 torch reset dynamo cache on model reload
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-04 10:58:32 +02:00
Dity0 b76ec32ac0 cleanup 2026-08-04 11:18:54 +03:00
Dity0 89d2bef078 Add device checks on kernel_wrappers and support OpenVINO MM for CPU and Triton MM for GPU at the same time 2026-08-04 11:16:53 +03:00
Vladimir Mandic 514a68b1af add storage analyzer
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-02 11:22:12 +02:00
Vladimir Mandic 78f843f969 networks avoid slow yield
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-01 09:10:15 +02:00