Commit Graph

111 Commits

Author SHA1 Message Date
Vladimir Mandic b0649e0ec1 group offloading changes
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-14 15:59:51 +02:00
Vladimir Mandic 0ac89385a0 timers reporting
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-14 09:18:24 +02:00
Vladimir Mandic 181065f069 minimax image and reference
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-13 20:15:32 +02:00
Vladimir Mandic 3f69bee9dd refactor modular
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-12 14:24:09 +02:00
Vladimir Mandic e962970f53 cleanup move_model
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-11 23:42:07 +02:00
Vladimir Mandic f92ef90d3d update offloading codepaths for non-balanced
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-11 22:09:12 +02:00
CalamitousFelicitousness 5fdf01ff05 feat(video): stage labels for modular generation progress
Modular pipelines run every stage inside one pipeline call, leaving
the ui on a single inference label. Forward hooks on the text encoder,
transformer and vae decoders now surface the current stage through
shared state, and the interrupt check runs in every stage so encodes
and tiled decodes abort promptly.

- saving a model registers a job instead of appearing idle
- group offload logs each component before the pin step instead of
  only after completion
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 7cd9fbc321 fix(offload): budget pinned memory from available ram
The guard compared component size against half of total system memory and
silently dropped to unpinned streaming above that. Total is the wrong
quantity: a component that fits comfortably in free memory gets denied, and
unpinned leaf streaming is slow out of proportion to its size because every
per-leaf transfer pays staging cost.

Budget against memory free at apply time less a reserve, and cache the
verdict on the module since a granted pin lowers the same reading it derives
from. A denied pin now also drops streams and falls back to block_level,
since leaf plus stream is only the right shape when weights are pinned, and
logs the per-step transfer volume so the cost of the slow path is visible up
front.
2026-08-10 22:10:42 +01:00
CalamitousFelicitousness 5a66d9eabe fix(offload): reclaim model memory across switches
Model switches kept most of the previous model resident, and the next
load could stall in kernel reclaim while the freed memory was still held.

- strip group offload hooks in disable_offload so the meta move at unload
  actually frees component weights; hook removal resolves wrapper
  components that carry hooks on the inner model
- flush the torch pinned host cache in torch_gc so freed streaming
  buffers return to the OS instead of staying cached in-process
- skip the pipe-level accelerator move for group-managed pipes: the
  offload engine already placed every component, and the move only
  dragged on-demand components to the accelerator for the trailing
  eviction to undo
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 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
Vladimir Mandic 6aa5b45b80 remove directml
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-08-10 13:43:45 +02:00
Vladimir Mandic 9b805aed22 mage placeholder
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-07-24 15:15:51 +02:00
Disty0 2490023570 SDNQ skip quant if numel is less than 16384 and add nn.Embedding to no spilt modules on offload 2026-07-08 21:38:28 +03:00
Vladimir Mandic e3fed70829 fix hijack accelerate
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-06-29 15:26:25 +02:00
Vladimir Mandic 8a85178f93 logical-vs-physical param count
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-06-08 12:03:37 +02:00
Vladimir Mandic 1f24513507 optimize sdnq quant-on-load and add platform stats
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-06-07 11:43:46 +02:00
Vladimir Mandic 5e99dee3c2 full codespell coverage
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-06-04 12:36:10 +02:00
Vladimir Mandic 0fe34c47cf fix ipadapters and improve offloading
Co-authored-by: Copilot <copilot@github.com>
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-05-10 10:42:33 +02:00
Vladimir Mandic 02a403eba9 fix torch.compile
Co-authored-by: Copilot <copilot@github.com>
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-05-10 08:55:44 +02:00
awsr 3f830589d1 RUF013 updates and typing update 2026-03-24 05:19:51 -07:00
vladmandic f9abe07035 cleanup logging and update requirements
Signed-off-by: vladmandic <mandic00@live.com>
2026-03-13 13:02:41 +01:00
vladmandic d4e87c6ff3 cleanup offload
Signed-off-by: vladmandic <mandic00@live.com>
2026-03-13 12:38:57 +01:00
vladmandic ff4b5c33dc reduce use of python generators with ui
Signed-off-by: vladmandic <mandic00@live.com>
2026-03-01 18:17:42 +01:00
Vladimir Mandic 47543663f9 cleanup references to p.sd_model
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-02-19 20:48:42 +01:00
Vladimir Mandic d65a2d1ebc ruff lint 2026-02-19 11:13:44 +01:00
Vladimir Mandic e5c494f999 cleanup logger 2026-02-19 11:09:13 +01:00
Vladimir Mandic a3074baf8b unified logger 2026-02-19 09:46:42 +01:00
vladmandic bfbe4af598 fix lora load
Signed-off-by: vladmandic <mandic00@live.com>
2026-01-21 08:45:45 +01:00
Disty0 034b0844fe register sdnq classes 2026-01-14 16:25:56 +03:00
vladmandic 4dbdee10e3 switch lora logic and improve ui networks filter
Signed-off-by: vladmandic <mandic00@live.com>
2026-01-14 10:31:21 +01:00
vladmandic 899514c5b8 lint update
Signed-off-by: vladmandic <mandic00@live.com>
2026-01-08 08:51:35 +01:00
vladmandic 7fe09db97e cleanup offload calls
Signed-off-by: vladmandic <mandic00@live.com>
2026-01-08 08:35:25 +01:00
vladmandic a36cd157ec force move to device if offload=none
Signed-off-by: vladmandic <mandic00@live.com>
2026-01-08 08:18:41 +01:00
Ryan Meador c1c4d6e0ee prevent accelerate from recreating keys such as and so that the VAE decode will progress. resolves #4526 2026-01-07 22:19:11 -05:00
Disty0 f37fa88824 remove ModuleList and ModuleDict from no_split_module_classes 2025-12-25 14:30:37 +03:00
Vladimir Mandic 0b1e6d2d3c improve offloading
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2025-12-25 10:24:02 +00:00
Disty0 0d45e851fb disable compile on balanced offload hooks 2025-12-16 16:43:43 +03:00
vladmandic 409ad8d2bd add longcat image and image-edit
Signed-off-by: vladmandic <mandic00@live.com>
2025-12-16 08:58:22 +01:00
vladmandic ad6458aa7b add flux2
Signed-off-by: vladmandic <mandic00@live.com>
2025-11-26 15:47:17 +00:00
Disty0 8535efc14a Add WanTransformerBlock to no split 2025-11-02 18:33:44 +03:00
Vladimir Mandic 567b9e7014 add hunyuanimage3 loader
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2025-10-29 11:10:47 -04:00
Vladimir Mandic d9e8fb8e1e handle sparse controlnet
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2025-10-28 09:55:38 -04:00
Disty0 0861ce5d5d cleanup 2025-10-27 22:35:13 +03:00
Vladimir Mandic e4711bcb6c add hunyuanimage-2.1
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2025-10-24 10:29:58 -04:00
Vladimir Mandic 65e1d20e24 offline mode for controlnet/t2i/xs/lite/ipadapter/processors
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2025-10-23 09:40:53 -04:00