Skip to content

AI media harness for planning, generating, and editing locally

TypeScript

Fix transformer loading memory failures

Bittic89d4a5cbe9e
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index 28e5206..cde774c 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -27,6 +27,7 @@ This alpha update adds SeedVR2 and Real-ESRGAN export upscaling, Long Shot and B
## Fixes and improvements
+- Fixed CUDA transformer-loading memory failures caused by pinning entire large checkpoints in system memory. Uploads now use bounded buffers, account for weight-conversion memory and retry allocation failures with more CPU offloading while preserving precision and output settings.
- Agent chat appends replies and retains earlier messages, corrections and errors throughout the conversation. Raw JSON and command payloads stay hidden; readable replies and summaries are shown.
- Backdrop prompts describe a flat, constant color field in every shot, limit reference guidance to subject appearance, and use neutral studio styling when no look is specified.
- Zoom uses SlopFab's native edge blend directly, avoiding a second feather or color correction when saving. Source transparency is retained.
diff --git a/docs/slopfab-compatibility.md b/docs/slopfab-compatibility.md
index f71f15a..ae244d7 100644
--- a/docs/slopfab-compatibility.md
+++ b/docs/slopfab-compatibility.md
@@ -1,5 +1,44 @@
# Slopfab compatibility
+## CUDA transformer loading memory recovery
+
+Large transformer checkpoints now upload through a bounded staging ring
+(two 32 MiB pinned buffers) instead of pinning the entire mapped file. Only
+checkpoints at most 64 MiB retain whole-mapping registration. On Windows,
+pinning a 20 GB checkpoint alongside the device arena reproduced an OOM at
+the conversion/upload boundary despite ample free VRAM. Bounded staging
+loaded the same checkpoint and completed repeated forward passes successfully.
+
+SlopFab 1.28.1 prepares the FP16 weight-conversion kernel before querying
+free VRAM, and reserves its upload scratch alongside activation headroom. This
+avoids budgeting weights against memory that CUDA's lazy kernel loading still
+needs. NVIDIA documents this allocation behavior in its
+[lazy loading guide](https://docs.nvidia.com/cuda/archive/13.1.0/cuda-programming-guide/04-special-topics/lazy-loading.html).
+
+If an automatic transformer load still receives `cudaErrorMemoryAllocation`,
+it synchronizes uploads, releases the partial model, clears the handled CUDA
+error and replans with a strictly smaller weight residency. The budget includes
+both transfer slots, so each retry actually reduces device memory. Retries are
+bounded by the block count and stop when the fixed weights and transfer slots
+cannot fit. Explicit offload counts and unrelated errors are not retried.
+Precision, references, resolution and sampling settings are preserved.
+
+The Windows and Linux bundles use SlopFab commit `513ba29` (1.28.1), built with
+`SLOPFAB_WITH_FFMPEG=OFF`. This fix changes no C API or worker protocol. Rebuild
+and restart Slopus and update LAN workers to load the replacement library.
+Regression coverage injects allocation failures to check cleanup, smaller
+residency, error propagation and exhaustion; CUDA tests compare resident and
+offloaded model output, including LoRAs and MotionCache.
+
+Validation: Windows transformer synthetic tests completed 254 checks without
+failures (11 deferred CPU-reference checks and one hardware skip). The real
+20 GB FP8 checkpoint completed 26 checks without failures; the optional full
+49-step run was skipped. Linux recovery, upload and offload comparisons passed,
+but its broader transformer suite reported a row-chunk numerical-tolerance
+failure in `transformer_row_chunks_match_full_rows` on CUDA 13.3. C API and
+embedded-tokenizer tests passed on both platforms. Slopus runtime integration
+tests passed with one ignored test.
+
## API 1.27: decode diagnostics
Successful native generations write an INFO-level `generation.video_decode`
diff --git a/lib/slopfab/libslopfab.so b/lib/slopfab/libslopfab.so
index 445e969..83acdb7 100644
--- a/lib/slopfab/libslopfab.so
+++ b/lib/slopfab/libslopfab.so
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:3e7668036ecf5fc4e1284c99a265d313c08da3019e9ad666dafc9a7c073090c4
-size 20373952
+oid sha256:c27c47ef8da6ecf6f61f15aa5c4ba2aa16656ad2995e17866b7340887d42879d
+size 20375072
diff --git a/lib/slopfab/slopfab.dll b/lib/slopfab/slopfab.dll
index f36ad1a..54b41a3 100644
--- a/lib/slopfab/slopfab.dll
+++ b/lib/slopfab/slopfab.dll
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:ee29c321482b241309ad86ba197abb6fe566e5926483ee9b4ad8a0abb852975d
-size 17654272
+oid sha256:75a2a0f7047e620fffdce493ee1a636673097284c8b5e6093b33c6a01816439d
+size 17656832