Commit Graph

13988 Commits

Author SHA1 Message Date
CalamitousFelicitousness 8c884c1e02 feat(model): secondary unet override slot and ideogram4 native loading
One UNET override cannot serve dual-transformer arches: ideogram4
conditional/unconditional and wan combined-stage experts need separate
files, and previously a single override landed on both experts.

- sd_unet_secondary option with per-slot tracking, consumed-state sync,
  arch-change reset, and incompatible-override fallback
- dropdown renders beside the primary, follows it into quicksettings,
  and is visible only for dual-transformer model types
- ideogram4 native single-file spec with a quant-aware fused-qkv
  converter; such converters run before comfy_quant detection via
  TransformerSpec.converter_handles_quant
- quicksettings render in configured order (sort keyed on the option
  object and always fell back to alphabetical)
- post-load dtype warning skips quantized transformers
2026-07-11 06:40:07 +01:00
CalamitousFelicitousness 3831e4563f feat(model): variant-specific fp8 precision tokens
fp8_e4m3fn and fp8_e5m2 differ in kernel support, so a bare fp8 token
is not enough to know whether a file runs on a given architecture;
scaled_fp8 derives its token from the detected format.
2026-07-11 06:40:07 +01:00
CalamitousFelicitousness c72e68e888 feat(model): read exact comfy_quant format from local marker tensors
Local probes read the marker tensor bytes for the true format string
(nvfp4, mxfp8, int8_tensorwise) instead of inferring from weight
dtypes; remote ranged peeks stay dtype-inferred. precision_token maps
quant format or dominant dtype to the short filename token.
2026-07-11 06:40:07 +01:00
CalamitousFelicitousness 055388aa70 feat(civitai): attach model probe analysis to header peeks
peek-header now returns the full probe (architecture fingerprint,
dtypes, quant scheme) alongside the metadata block, and caches the
response persistently by civitai file id; file content per id is
immutable, so cached probes skip the ranged fetch entirely.
2026-07-11 06:40:07 +01:00
CalamitousFelicitousness e5800b005e feat(model): add header-only model probe with arch fingerprints
Analyzes safetensors/gguf headers without reading weights: curated
tensor-name fingerprints for common families, container kind detection
(model/lora/vae/text-encoder), element-weighted precision over core
tensors, comfy_quant/scaled-fp8/gguf quant detection, lora base
resolution via trainer metadata with shape arbitration, and full
__metadata__ passthrough. Results cached by mtime in
data/model_probe.json.

- analyze_header is pure and shared by remote ranged peeks and local
  file reads
- fingerprints verified against the local library and live civitai
  headers; unmatched families report unknown rather than guessing
2026-07-11 06:40:07 +01:00
CalamitousFelicitousness e0ed573d66 feat(civitai): add ranged safetensors header peek endpoint
The API carries no field distinguishing dual-transformer expert files;
conversion tools embed it in the header __metadata__. peek-header
range-fetches the JSON header and returns the metadata block without
downloading the file. Restricted to civitai.com urls.
2026-07-11 06:40:07 +01:00
Vladimir Mandic a8cc6b1c7e update submodules
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-07-10 19:21:56 +02:00
Disty0 736012d5af SDNQ Atten use FMA on PV 2026-07-10 14:27:53 +03:00
Vladimir Mandic 8ce3313f9a improve log viewer
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-07-10 13:14:27 +02:00
Vladimir Mandic 73ee1945a3 update todo/changelog
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-07-10 10:15:30 +02:00
CalamitousFelicitousness cbe3c148e0 fix(model): skip redundant model reload after unet override load
load_transformer consumes the sd_unet dropdown selection during a full
model load but never marked it as loaded, so the queued sd_unet
onchange callback always forced a second full reload. Sync
sd_unet.loaded_unet once the override is successfully consumed; the
incompatible-override fallback keeps its reset to Default.
2026-07-10 02:39:24 +01:00
CalamitousFelicitousness 2a7d4b4037 feat(model): extend comfy_quant loading to float8_e4m3fn
Parameterize the pre-quantized comfy_quant path by format so fp8
tensorwise checkpoints load alongside int8; both map onto SDNQ's
symmetric dequant for the matching weights dtype. Containers are
mislabeled in the wild, so the stored weight dtype is validated
against the marker, mixed-format files are rejected, and markers
carrying a convrot rotation flag fall back to the base repo since
they may require runtime inverse rotation.
2026-07-10 02:27:24 +01:00
CalamitousFelicitousness d087c3e687 feat(civitai): route text encoder files to te_dir
Versions bundle companion files typed by the file, not the model;
'Text Encoder' had no TYPE_MAP entry so companions landed in the
checkpoint folder where the loader never scans.
2026-07-10 02:17:33 +01:00
CalamitousFelicitousness 24683dc608 feat(civitai): parse gguf quantType in file metadata
GGUF variants are distinguished by quantType, not fp; the model
endpoint carries it in file metadata.
2026-07-10 02:09:14 +01:00
CalamitousFelicitousness 68c1ea8e78 feat(model): load comfyui comfy_quant int8 checkpoints via sdnq
Detect comfy_quant markers in native single-file transformer loads and
adopt the pre-quantized tensors as SDNQ int8 layers instead of rejecting
them. ComfyUI int8_tensorwise is a strict subset of SDNQ symmetric int8,
so weights and scales are taken bit-exact with no dequantize-requantize
round trip; quantized matmul and scale-dtype settings apply as usual.

- detect_comfy_quant/remap_comfy_quant helpers plus a prequantized
  builder in native_transformer; file markers dictate the layer set
- unsupported formats and wrong-arch markers fall back to the base repo
- offline unit tests and an opt-in real-file krea2 test
2026-07-10 01:54:27 +01:00
CalamitousFelicitousness e615b6e22b feat(civitai): sweep abandoned download partials at startup
Interrupted downloads leave url-hash .tmp resume files that nothing
cleans up; the queue that knows about them is in-memory only.

- iter_type_roots lists every folder downloads resolve into
- partials older than 7 days by mtime are deleted when the download
  manager starts; active partials always have a fresh mtime
2026-07-10 01:54:27 +01:00
CalamitousFelicitousness ef6030b871 feat(civitai): expose file variant metadata and scan results
Multi-variant versions serve one canonical filename per file; the
precision, size class, format, and scan status that distinguish them
were dropped at the model layer.

- CivitFile gains metadata (format, size, fp), pickle and virus scan
  results, and scannedAt
2026-07-10 01:54:27 +01:00
Disty0 7578d9b6bc remove dynamic from sdnq atten 2026-07-10 03:22:14 +03:00
CalamitousFelicitousness 9b18aad1c1 feat(civitai): record search filters in history entries
History entries stored only the query or tag term, so restoring a
search dropped every filter, and filter-only browsing was never
recorded at all.

- SearchHistory.add takes an optional params dict stored on the entry
- get_search records non-default filters: type, sort, period, base
  models, nsfw, username, favorites
- filter-only searches are recorded as 'filter' entries labeled with
  the filter values
2026-07-10 00:50:01 +01:00
CalamitousFelicitousness 9f9a350e53 fix(civitai): restart download when server ignores range request
A 200 reply to a resumed download carries the full file, not the
remainder; appending it to the partial produced a corrupt file that
passed the size check and only failed at hash verification. Truncate
the temp file and restart from byte 0 when a Range request comes back
as 200 instead of 206.
2026-07-10 00:05:37 +01:00
CalamitousFelicitousness a274f57aab fix(civitai): tolerate null availability, expose early access fields
The /model-versions endpoint now serializes availability as null, which
failed str validation and turned every version lookup into a 404. Coerce
null to the default like the creator username validator already does.

Pass through earlyAccessEndsAt and earlyAccessConfig so clients can see
that a download requires a Buzz purchase before requesting the file.
2026-07-09 23:49:37 +01:00
CalamitousFelicitousness d2937166d3 fix(sdnq): sync benchmark prep mirror with kernel helpers
upstream replaced math.log2/triton.next_power_of_2 with sdnq utils in
the attention prep; mirror the same hadamard sizing in make_prep_fn.
2026-07-09 17:42:49 +01:00
CalamitousFelicitousness 75a245cbeb fix(sdnq): disable tf32 for the benchmark fp32 reference
sdnext enables tf32 globally; a math-backend dispatch fallback (gqa,
some mask shapes) degrades the fp32 reference to tf32 precision,
measured 4.2e-4 vs 5.0e-7 relative to fp64. the default mem-efficient
backend is unaffected.
2026-07-09 17:39:59 +01:00
CalamitousFelicitousness ad25416cf2 feat(sdnq): derive benchmark recommendations from measured webui state
Recommendations must hold on any gpu, so every verdict now comes from
measuring the configuration the advice points to.

- run benchmarks in the webui's configured dtype, --dtype overrides
- bench the prep mode matching the environment: compiled, verified
  dynamic=false workaround, or eager; label each with the webui change
  the numbers correspond to
- add a prep column for the q/k/v quantization cost outside the
  kernel; eager prep measured 1.9 ms vs 0.2 ms fused at sdxl,
  inverting the quantized matmul verdict
- compare Use Quantized MatMul against the unquantized sdnq row so
  quantization pays for its own prep
- star the lowest-error config within 5% of the fastest sdnq time;
  the same rule drives the worth-enabling verdict vs torch sdpa
- drop the (auto, default) suffix; document the settings mapping and
  star rule in the notes
- wrap correctness and shape tables in panels to separate sections
2026-07-09 17:39:59 +01:00
CalamitousFelicitousness 95234dd3c3 feat(sdnq): measure fp8 attention configs in the benchmark
The pv matmul recommendation trusted the float8 hardware probe alone,
so gpus where fp8 pv compiles but runs slower than unquantized pv got
a recommendation that degrades generation speed and error. Measured on
an rtx 2000 ada, fp8 pv lands at x0.93 of the sdpa baseline while int8
qk alone reaches x1.26.

- add fp8 pv and fp8 qk bench configs, gated on the eager float8
  probe so unsupported gpus keep clean tables
- include fp8 pv in the video presets since the pv stage matters most
  at long sequence lengths
- recommend a quantized pv type only when the fastest measured pv
  variant beats plain int8 qk by at least 5%, otherwise recommend auto
  and name the variants that measured no gain
- cite the measured fp8 qk ratio in the matmul type reason instead of
  the static compile claim
2026-07-09 17:39:59 +01:00
CalamitousFelicitousness af0b76f550 fix(sdnq): correct triton and fp8 detection in attention benchmark
The environment panel reported triton as missing and float8 as
unsupported on ada gpus. The triton lookup used the distribution name,
which varies by platform (triton-windows on windows), and the fp8 probe
ran through the torch.compile input prep, so a broken compile toolchain
read as a hardware limitation with the actual error discarded.

- read the module version for the triton line instead of the
  distribution name
- probe float8 with eager input prep so the result reflects gpu
  capability; show the failure reason when genuinely unsupported
- probe the compiled input prep separately and cold, before any eager
  kernel run: inductor lowers part of the dynamic-shape prep to a cpu
  helper kernel, so a missing host c++ compiler fails every sdnq
  attention call at generation, and a prior eager run in the same
  process masks the cold-start failure the webui hits
- on failure, verify the SDNQ_COMPILE_KWARGS dynamic:false workaround
  live and report it in the environment panel and recommendation notes
- benchmark with eager input prep when the compiled path is broken so
  kernel numbers still fill in
- replace the unicode star marker with ascii: rich's legacy windows
  renderer crashes with a cp1252 UnicodeEncodeError on piped output
2026-07-09 17:39:59 +01:00
Disty0 c35201de30 cleanup triton mm 2026-07-09 16:21:47 +03:00
Disty0 8cc5faa877 remove math import 2026-07-09 14:14:50 +03:00
Disty0 3641d12274 Inductor breaks down with math.log 2026-07-09 14:06:02 +03:00
Vladimir Mandic f4348bcb69 server info handle multi-gpu
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-07-09 11:18:04 +02:00
CalamitousFelicitousness b2e4221fd0 feat(model): add anima 1.0 aesthetic and turbo reference models
Add the official Anima 1.0 Aesthetic and Turbo releases in diffusers
format. The previous turbo entry pointed at an unofficial build (base
with a fused community turbo lora); the official distilled checkpoint
replaces it.

- reference-base.json: add anima 1.0 aesthetic
- reference-distilled.json: point anima 1.0 turbo at the official v1.0
- add reference previews, remove the replaced turbo preview
2026-07-09 02:42:18 +01:00
CalamitousFelicitousness bb04eada64 fix(anima): resolve text encoder through shared map
allow_shared=False predates the Qwen-3 0.5B entries in shared_te_map, so
every Anima repo downloaded its own copy of the text encoder. Remove it
so all variants share the canonical Anima-1.0-Base text encoder.
2026-07-09 02:42:18 +01:00
CalamitousFelicitousness 169f033fb3 feat(sdnq): add attention benchmark cli tool
Benchmark and validate sdnq attention on the local gpu: correctness
checks for mask, causal, gqa and padding code paths, float8 support
probe, per-shape speed and error comparison against torch sdpa and
sageattention, and measured recommendations for the settings section.

Tables fill in live with per-config compile/warmup/timing progress,
current settings are compared against recommended values, and --save
writes a plain-text transcript of the results. --config-timeout turns
stuck compiles into failed rows; sd15 skips its hadamard configs since
compiling hadamard with a non pow2 head dim currently hangs inductor.

- shape presets follow real model geometries: sd15, sdxl, anima,
  flux2 klein, wan22 a14b, ltx 2.3, plus a masked joint-attention case
- runs the shipped kernel from modules/sdnq/kernels/triton_atten.py
  directly, with stock sdpa restored for baselines and references
2026-07-09 02:42:18 +01:00
CalamitousFelicitousness 4c289e8c9d fix(model): load transformer from all-in-one checkpoints in native loader
All-in-one exports bundle the text encoder and VAE alongside the
transformer under LDM-style family prefixes (cond_stage_model.,
first_stage_model., text_encoders., vae.). The native loader treated
those keys as a mixed-prefix error and rejected the file. Drop known
companion families before prefix detection and log what was skipped;
keys matching neither a transformer prefix nor a known family still
raise. TE and VAE keep coming from the base repo or their own overrides.
2026-07-09 00:35:00 +01:00
Disty0 3476125374 fix hadamard on sdnq atten with sd 1.5 2026-07-09 01:03:26 +03:00
Disty0 f8623d7879 Update SDNQConfig docstring 2026-07-08 21:49:28 +03: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
Disty0 87684e1a21 SDNQ fix hadamard with non pow2 shapes and add 16bit types to quant list 2026-07-08 19:29:57 +03:00
Vladimir Mandic b257f49c31 Merge branch 'master' into dev 2026-07-08 14:54:32 +02:00
Vladimir Mandic bcd597cd8a improve ui models
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-07-08 14:50:29 +02:00
CalamitousFelicitousness 56dc1b5a39 fix(models): prefetch configs skipped by hf hub downloads on windows
diffusers pipeline downloads build subfolder config.json allow-patterns
with os.path.join, and huggingface_hub>=1.22 matches patterns with
fnmatchcase which does not normalize path separators
(huggingface/huggingface_hub#4435). On windows the resulting backslash
patterns match nothing, so per-component config.json files are never
downloaded and the incomplete snapshot still passes the diffusers
cache-completeness check, failing every subsequent load with
"no file named config.json".

Prefetch component configs with forward-slash patterns before pipeline
load. This covers all model families and also repairs snapshots already
broken by the bug on the next load attempt. No-op on linux, in offline
mode, and for local folder or single-file models.
2026-07-08 12:18:11 +01:00
Vladimir Mandic 70c503f58e fix non-english git and add faster stat
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-07-08 11:14:40 +02:00
Vladimir Mandic 3158468dc4 add server restart api endpoint
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-07-08 10:09:36 +02:00
Vladimir Mandic cfd31599b4 fix lint
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-07-08 09:50:26 +02:00
Vladimir Mandic 9a2c76ade3 Merge pull request #4987 from vladmandic/fix/lora-te-fixes
Fix/lora te fixes
2026-07-08 09:48:06 +02:00
CalamitousFelicitousness 1f549839dd fix(lora): disable diffusers-method loras on removal
Removing all loras never called set_adapters, so peft adapters stayed
active until model reload. Removal now uses disable_lora, which keeps
modules intact; unload_lora_weights would detach balanced offload hooks.
Load calls enable_lora after set_adapters since peft set_adapter does
not clear the disabled flag. Removal of fused diffusers loras remains
unhandled.
2026-07-08 03:06:47 +01:00
CalamitousFelicitousness 2605764f43 fix(lora): honor te multiplier for text encoder keys
NetworkModule.multiplier matched text encoders via 'transformer' in the
key prefix, which fits dit keys but never lora_te keys, so text encoder
modules followed unet_multiplier[0] and the te= tag strength was ignored.
2026-07-08 03:06:14 +01:00
CalamitousFelicitousness 4554b9a277 fix(lora): apply te networks before encode and honor lora_apply_te
Network activation ran after prompt encoding, so text encoder lora
weights never affected embeds on the first generation and the stale
result was then served from the embed cache. The trailing unfiltered
activate in network_load also overrode the te exclude filter, so the
lora_apply_te setting was never honored.

- parse and activate networks in process_base before pipeline args are built
- activate_filtered gates text encoder components on per-request or global
  lora_apply_te; used by base, hires, detailer and faceid call sites
- network_load accepts activate=False for callers that run their own
  deactivate/activate sequence with include/exclude
- network_activate walks excluded components in restore-only mode so a
  filtered text encoder reverts to backup instead of keeping stale deltas
- loaded_loras cache is single-entry since per-filter entries go stale when
  the setting toggles
- prompt embed cache key includes the effective lora_apply_te value
2026-07-08 03:06:04 +01:00
CalamitousFelicitousness 917dd3a109 fix(lora): handle flattened clip text model in kohya te keys
transformers >=5.6 removed the text_model wrapper from CLIPTextModel, so
kohya te keys no longer matched the network layer mapping and text encoder
weights were silently skipped. KeyConvert retries te keys with the
text_model segment dropped; lora extraction keeps writing canonical kohya
naming for flattened encoders.
2026-07-08 03:05:30 +01:00
Vladimir Mandic c3f9865fcc Merge pull request #4986 from 0xDELUXA/fix-hipblaslt-detect
rocm: detect hipBLASLt lazy library in per-arch subfolder and zlib form
2026-07-08 00:47:54 +02:00