Commit Graph

364 Commits

Author SHA1 Message Date
CalamitousFelicitousness 2cf5a2f207 feat(sdnq): compare quantized matmul backends in a single run
The linear layers bind their scaled-mm function at import, so
SDNQ_USE_TRITON_MM freezes the backend per process and comparing triton
against the torch fallback meant two runs, carrying clock drift into the
delta. --mm-backends rebinds the function on the consuming modules
between benches, so both rows measure the same quantized layer under the
same clock state.

- swap targets are the four linear modules that from-import a scaled-mm
  function; every swap resets dynamo, since the layer forwards are
  compiled and the traced graph pins the previous function
- the torch row is captured from kernel_wrappers rather than
  reimplemented, so it is unavailable where triton is the device default
  (rerun with SDNQ_USE_TRITON_MM=0) and says so
- rounds alternate order and keep the fastest per row, so drift cancels
  instead of favouring whichever backend runs second
- flag output error when backends disagree past 1e-4: they are meant to
  be numerically equivalent
2026-07-14 08:06:45 +01:00
CalamitousFelicitousness 566c58e58c fix(sdnq): probe fp8 attention support without a dynamo disable window
probe_fp8 and the broken-compile bench path forced eager input prep by
toggling torch._dynamo.config.disable. torch 2.13+ raises 'found no
compiled frames' when a fullgraph-compiled function is called inside a
disable window, so the probe failed before reaching the attention kernel
and reported an environment error instead of the kernel's real verdict,
on fp8-capable gpus too. Swap the module-global prep function for its
eager inner instead, matching the correctness section.
2026-07-14 08:06:45 +01:00
CalamitousFelicitousness 37f1eb09f1 feat(sdnq): report the runtime stack in the benchmark and quiet the startup log
The environment panel and json now carry python, platform, backend and
the backend runtime versions (cuda/cudnn/driver, hip, ipex, openvino,
directml via devices.get_gpu_info), so shared reports identify the stack
without inferring it from the torch version string.

The webui bootstrap log is gated behind an fd-level suppression for the
import window: the bootstrap reconfigures its loggers during import and
onnxruntime warns from c++, so logger levels alone cannot silence it.
Import failures still print after the gate lifts.
2026-07-14 08:06:45 +01:00
CalamitousFelicitousness 8b4d7b9519 fix(sdnq): end the benchmark cleanly when a faulted cuda context is detected
After the correctness section aborts on a sticky kernel fault, the
remaining sections cannot run; flush outputs and exit instead of
cascading into the next cuda call's traceback.
2026-07-14 08:06:45 +01:00
Disty0 7779bf256d Don't hard-code for CUDA on SDNQ Atten benchmark 2026-07-13 18:51:06 +03:00
Disty0 173d9a05ba Do not try to probe FP8 MM on known to be unsupported GPUs on SDNQ Atten benchmark 2026-07-13 18:34:40 +03:00
CalamitousFelicitousness f7f14fab02 fix(sdnq): survive sticky cuda faults in the benchmark and always flush outputs
A kernel fault (misaligned address, illegal memory access) is sticky:
every later cuda call in the process fails, so one faulting check killed
the whole run through the next reference computation and lost the --save
and --json outputs. Compute the correctness reference inside the
per-check handler, detect a dead context and abort the section with a
clear message, and flush partial outputs from a top-level handler on any
crash or interrupt.
2026-07-12 18:08:14 +01:00
CalamitousFelicitousness 779127c7ba fix(sdnq): separate capability and environment failures in the fp8 probe report
The fp8 attention probe can fail for reasons other than missing hardware
support (torch or triton compile issues); reporting those as 'not supported
on this gpu' is wrong on gpus where fp8 is native. Match the triton
pre-sm_89 signature and label anything else as an environment failure.
2026-07-12 17:58:51 +01:00
CalamitousFelicitousness 44146ee096 fix(sdnq): run benchmark correctness checks with swapped-in eager prep
Toggling torch._dynamo.config.disable to force eager input prep fails on
newer torch: a fullgraph-compiled function called inside a disable window
raises 'found no compiled frames', failing every check and poisoning the
first compiled call afterwards. Swap the module-global prep function for
its eager inner instead, matching the dequant section's mechanism.

- store per-check errors and exceptions in the json report, so remote
  reports carry the failure mode
2026-07-12 17:33:31 +01:00
CalamitousFelicitousness cf031b869c feat(sdnq): add weight dequant and combined block sections to the benchmark tool
Benchmark weight dequantization alongside attention: eager vs compiled
dequantization, measured standalone and through the full linear forward,
plus the quantized matmul forward, across int/uint 8-6-4-2 and the
pre-quantized float formats (float8_e4m3fn, float8_e4m3fn_sdnq,
float4_e2m1fn group 16) at krea 2 layer geometry, against a bf16 nn.Linear
baseline and a true-fp32 output reference. Each row carries measured
storage size and one-shot quantize time; an svd/hadamard variants table
measures rotation and low-rank costs on top of the base dtypes.

A combined block section measures complete configurations (weights dtype x
matmul path x attention) end to end through a dit-style transformer block,
with output error at depth one and four against an fp32 reference block,
because component speedups and errors do not compose multiplicatively.

- recommendations weigh error against speed: a faster option is rejected
  when it multiplies measured output error beyond 2x, and reason strings
  cite both numbers; notes include measured size/error and speed/error
  frontiers
- robustness: extreme-activation stress rows in the correctness matrix
  (pass on finite output), max-token-error columns beside norm error, and
  non-finite outputs labeled as verdicts; norm metrics alone hide
  token-level corruption on outlier-heavy inputs
- probe compiled weight dequant for e4m3 and e5m2 storage and report the
  fp8 compile gate status; on ampere e5m2 compiles while e4m3 does not
- new attention presets: sdxl-cross (cross-attention), qwen3-te (causal
  gqa text encoder), wan22-cfg (batched cfg video); cross-attention
  correctness check
- --sections, --dequant-dtypes, --dequant-variants and --block-configs
  selectors, --json structured results output
2026-07-12 03:44:54 +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
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
Vladimir Mandic db26b77909 add boogu
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-07-04 15:26:36 +02:00
Vladimir Mandic 022d7ca481 update all reference models info
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-07-03 11:51:25 +02:00
QualiaRain fd5b2b7feb lint: fix RUF013 implicit Optional in cli/process.py Result.__init__
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-12 13:00:24 -04:00
QualiaRain 584f2b84c4 fix cli+api: data-uri decode guards, mutable default, caption/ffprobe/palette IndexError guards
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-12 13:00:23 -04:00
Vladimir Mandic 9c6d6907ea fix hfinfo
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-06-05 07:24:34 +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 c8d6fd5cf8 Revert "much stricter ruff linting"
This reverts commit 310dbf1574.
2026-05-11 08:13:57 +02:00
Vladimir Mandic 310dbf1574 much stricter ruff linting
Co-authored-by: Copilot <copilot@github.com>
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-05-11 07:15:37 +02:00
CalamitousFelicitousness e2c856459c feat(autocomplete): aliases, extra-networks, translations, baseline fixes
- tag aliases (optional 4-tuple) and translations (companion file)
- lora and wildcard triggers; embeddings fold into tag-mode results
- new GET /sdapi/v1/wildcards endpoint
- LRU cap, IME safety, multi-textarea safety, modifier-key pass-through
- manifest-retry and config-bridge hardening
- tags-fetch: alias/translation harvesters with authenticated rate limits
2026-04-24 21:55:27 +01:00
Vladimir Mandic b3f09aa417 Merge pull request #4707 from vladmandic/feat/tag-dictionaries
Feat/tag dictionaries
2026-04-13 11:57:48 +02:00
vladmandic f06eb21d52 add hf-info
Signed-off-by: vladmandic <mandic00@live.com>
2026-04-12 19:06:09 +02:00
Vladimir Mandic aa34db2c50 Merge branch 'dev' into feat/tag-dictionaries 2026-04-08 10:03:42 +02:00
awsr c003b0eb48 PIL Image.Image type fix 2026-04-06 01:06:19 -07:00
vladmandic e0f6766b8a update permissions
Signed-off-by: vladmandic <mandic00@live.com>
2026-03-27 19:17:37 +01:00
CalamitousFelicitousness 6a7a879c77 fix(autocomplete): address PR review feedback
- Remove remote manifest fetch from startup dropdown population;
  list only locally available tag files via files_cache.list_files()
- Rename CLI utilities to tags-fetch, tags-prune, tags-manifest
- Replace create/destroy mirror div with persistent offscreen mirror
  for caret position measurement
- Add ResizeObserver to reposition dropdown on textarea resize
- Add autocomplete-mirror classname to measurement div
2026-03-26 19:46:23 +00:00
CalamitousFelicitousness d4d5bce3b9 feat(autocomplete): add native tag autocomplete for prompt textareas 2026-03-26 00:47:14 +00:00
CalamitousFelicitousness 5312265d27 refactor(autocomplete): rename dicts to autocomplete, relocate to models/ 2026-03-26 00:47:14 +00:00
CalamitousFelicitousness a0a6a250e0 chore(dicts): minify all JSON files for consistency 2026-03-26 00:47:14 +00:00
CalamitousFelicitousness 838b972d11 chore(dicts): rename checkpoint to partial in fetch_dicts 2026-03-26 00:47:14 +00:00
CalamitousFelicitousness 36b2ed6bb7 feat(dicts): add curated dicts, pruning, and manifest generation
Add 4 curated vocabulary dicts (art, photography, quality, negative)
that ship bundled for out-of-the-box autocomplete. Add manifest.json
listing all dicts available on HuggingFace.

CLI tools:
- cli/prune_dicts.py: per-category pruning with configurable thresholds
- cli/gen_manifest.py: generate manifest from on-disk dict files
- cli/fetch_dicts.py: unified 14-category scheme, idol source, auto
  manifest regeneration after fetch

Fetch and prune auto-update manifest.json when one already exists.
2026-03-26 00:47:13 +00:00
CalamitousFelicitousness 0405689606 feat(dicts): add tag sources with separator support 2026-03-26 00:47:13 +00:00
CalamitousFelicitousness 9343768d78 feat(api): add tag dictionary API and settings for prompt autocomplete 2026-03-26 00:47:13 +00:00
awsr 8e10ec3fec RUF013 compatibility 2026-03-20 18:42:44 -07:00
CalamitousFelicitousness 9cf2ab08a0 feat(civitai): add url parsing to cli search tool
Extract model ID from civitai.com URLs pasted as the query argument,
matching the same behavior added to the main search module.
2026-03-20 04:33:51 +00:00
vladmandic 64e193b60b merge: cli/hf-search.py 2026-03-12 14:11:47 +01:00
awsr feffbe0851 Update subprocess.run usage 2026-03-05 20:06:09 -08:00
Vladimir Mandic 6fdd3a53cf reduce mandatory requirements
Signed-off-by: Vladimir Mandic <mandic00@live.com>
2026-02-18 17:53:08 +01:00
Vladimir Mandic 41f206dec9 Merge pull request #4637 from CalamitousFelicitousness/refactor/remove-face-restoration
Refactor/remove face restoration
2026-02-11 11:12:34 +01:00
vladmandic b4e5b563c6 update lint rules
Signed-off-by: vladmandic <mandic00@live.com>
2026-02-11 10:47:07 +01:00
CalamitousFelicitousness 80014fac7c fix(caption): address PR review feedback
- Remove superfluous SimpleNamespace import in cli/api-caption.py, use Map instead
- Drop _ prefix from internal helper functions in modules/api/caption.py
- Move DeepDanbooru model path to top-level models folder instead of nesting under CLIP
2026-02-11 02:50:06 +00:00
CalamitousFelicitousness 139e331d80 style(caption): fix lint warnings across caption module
- Rename shadowing import in waifudiffusion batch to avoid F823/E0606
- Fix import order in cli/api-caption.py (stdlib before third-party)
- Rename local variable shadowing function name in cli/api-caption.py
- Remove unnecessary global statement in devices.bypass_sdpa_hijacks
2026-02-11 02:50:06 +00:00
CalamitousFelicitousness e2cdbe47fa fix(caption): safetensors-only downloads, model load fixes, UI default, prefill tests
- Add use_safetensors=True to all 16 model from_pretrained calls to
  avoid downloading redundant .bin files alongside safetensors
- Add device property to JoyTag VisionModel so move_model can relocate
  it to CUDA (fixes 'ViT object has no attribute device')
- Fix Pix2Struct dtype mismatch by casting float inputs to model dtype
  while preserving integer tensor types
- Patch AutoConfig.register with exist_ok=True during Ovis loading to
  handle duplicate aimv2 registration on model reload
- Detect Qwen VL fine-tune architecture from config model_type instead
  of repo name, fixing ToriiGate and similar third-party fine-tunes
- Change UI default task from Short Caption to Normal Caption, and
  preserve it on model switch instead of resetting to Use Prompt
- Add dual-prefill testing across 5 VQA test methods using a shared
  _check_prefill helper
- Fix pre-existing ruff W605 in strip_think_xml_tags docstring
2026-02-11 02:48:11 +00:00
CalamitousFelicitousness bf7a72f12e fix(caption): remove dead min_length param, split Florence/PromptGen prompts, fix gaze detection
- Remove caption_openclip_min_length from settings, API models, endpoints, and UI
  (clip_interrogator library has no min_length support; parameter was never functional)
- Split vlm_prompts_florence into base Florence prompts and PromptGen-only prompts
  (GENERATE_TAGS, Analyze, Mixed Caption require MiaoshouAI PromptGen fine-tune)
- Add 'promptgen' category to /vqa/prompts API endpoint
- Fix gaze detection: move DETECT_GAZE check before generic 'detect ' prefix
  to prevent "Detect Gaze" matching as detect target="Gaze"
- Update test suite: remove min_length tests, fix min_flavors to use mode='best',
  add acceptance-only notes, fix thinking trace detection, improve bracket/OCR tests,
  split Florence/PromptGen test coverage
2026-02-11 02:48:11 +00:00
CalamitousFelicitousness 588222f2d1 test: update caption API tests
Update cli/test-caption-api.py:
- Update test structure for new caption API endpoints
- Fix Moondream gaze detection test prompt to use 'Detect Gaze'
  instead of 'Where is the person looking?' to match handler trigger
- Improve test result categorization and tracking
2026-02-11 02:48:11 +00:00