- Unified (block, lora) slot: SlotEntry carries co-located LoRA payload;
fold consumes slot.lora -> None (no external bookkeeping).
- Resident mode: LoRA loaded into RAM, co-located per-block during
streaming loop, pool freed after load (no change, already working).
- Lazy mode: new LoraBlockReader reads per-block LoRA on demand from
disk via offset plan (no RAM pool). Same RandomAccessBlockReader data
pipeline architecture.
- LoraBlockReader supports both Diffusers (lora_A/lora_B) and
Kohya (lora_down/lora_up) key formats + DoRA (diff/diff_b) + alpha.
- DiskPrefetcher _attach_block_lora uses LoraBlockReader instead of
model._lora_groups RAM dict, eliminating 1.5GB global LoRA pool
in lazy mode.
- _normalize_unet_key extracted as shared module-level function.
- LoraTensorEntry dataclass moved to utils/types.py.
- Updated all BlockSwapManager/DiskHome call sites with lora_reader
parameter threading.
Core
- Fix: p.data = d is a no-op on __torch_wrapper_subclass__ (QuantizedTensor).
Replace with SlotEntry + module._parameters[key] reassignment, bypassing
PyTorch's wrapper-subclass .data assignment interception.
- Fix: VAE decoder gray/NaN output caused by QuantizedTensor weight remaining
on CPU during fp8 Linear forward.
- Fix: CUDA OOM on Windows when pin_memory=True — reduce pin pool size to
prefetch_count (default 3) instead of W+prefetch (23); only use pin pool
for prefetch loads (non_blocking=True).
- Fix: black output with pin_memory=True — run H2D copies on the transfer
stream, sync before assign_to, so weights are fully written before forward.
- Fix: BlockSwap shutdown crash ("size 5120 vs 0") — offload_block copies
GPU→home directly from slot entries, not through freed block params.
- Fix: Model switch RAM/VRAM leak — clear_pools() drops all pool tensor
references; shutdown sets _blocks = [] and _home = None.
- Fix: update SlotEntry.empty_like to propagate pin_memory for QuantizedTensor
_qdata and _params.scale (was silently unpinned).
- Remove dead code: pinned_pool.py, block_ortho.py (unreferenced).
- Audit utils/ for dead imports (PinnedBlockPool) and stale comments.
Architecture
- SlotEntry: unified data type for ring-buffer slot pool, abstracts regular
Tensor and QuantizedTensor (fp8). copy_from() copies weight data; assign_to()
rewires module._parameters with a fresh GPU QuantizedTensor.
- Ring buffer (cursor % N) replaces free-list for GPU slot allocation.
- PinStage @dataclass: standalone pinned CPU staging ring, built lazily from
GPU entry metadata (safe device-independent construction).
- _detect_model_config(): merge duplicated ~80-line config detection in
load_bernini_model (was written twice for safetensors vs full-SD paths).
- BlockSwapConfig: unified config path. model.load() accepts BerniniBlockSwap
dataclass; model stores it as self._block_swap_config; pre_forward reads it
directly instead of via transformer_options.
Features
- loading_mode dropdown (Full / Streaming) in BerniniR_BlockSwapArgs node.
- Block swap node exposes pin_memory, loading_mode selections.
Context window
- Fix: compatibility with differential diffusion (color blocks, artifacts) —
correct mask accumulation and crossfade when edit_mask is active.