Skip to content

fix: LoRA engine-cache correctness + per-engine VAE opt-level#19

Open
forkni wants to merge 6 commits into
SDTD_031_devfrom
feat/lora-engine-cache-fixes
Open

fix: LoRA engine-cache correctness + per-engine VAE opt-level#19
forkni wants to merge 6 commits into
SDTD_031_devfrom
feat/lora-engine-cache-fixes

Conversation

@forkni

@forkni forkni commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator

Changes

  • bcfe207 test: add LoRA sanity script for headless baseline vs LoRA comparison
  • 5c8e22e perf: add per-engine VAE builder optimization level (default 3)
  • 4a6d2e5 fix: route LoRA loading through offline-fallback helper (G4)
  • 41cd5c2 fix: skip zero-scale LoRAs from fusion and engine cache signature
  • 566bcee fix: scope LoRA engine-cache suffix to UNet to avoid redundant VAE rebuilds
  • 4cb6a46 fix: drop failed LoRAs from engine cache signature to prevent mislabeled engines

Branch

feat/lora-engine-cache-fixes -> SDTD_031_dev

forkni added 6 commits June 12, 2026 21:58
…led engines

On load_lora_weights failure the entry was silently dropped from the merge
list but the original lora_dict remained, so get_engine_path() still built
a cache path with the failed LoRA's signature — producing a no-LoRA engine
permanently labelled as a LoRA engine (G1 cache-poisoning bug).

Changes:
- Track only successfully loaded adapters in _loaded_adapter_names dict
- After merge, reassign lora_dict to only the fused entries (or None if all
  failed) so engine paths always reflect actual UNet weight content
- Replace warn-and-continue on fuse_lora failure with RuntimeError: partial
  fusion leaves UNet weights ambiguous; a TRT engine built from that state
  is never correct and must not be silently cached
Runs two StreamDiffusionWrapper passes (acceleration=none, same seed) and
saves baseline.png, lora.png, and a side-by-side comparison PNG.

Purpose: verify a LoRA loads on sdxl-turbo and is visibly effective at
2 denoising steps before paying the fp8 TRT engine build cost.

Default: nerijs/pixel-art-xl @ 1.0 (SDXL, strong style at 2 steps)
Usage:
  venv/Scripts/python scripts/test_lora_sanity.py
  venv/Scripts/python scripts/test_lora_sanity.py --lora not/a-real-lora
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant