Repository navigation
feat(e2e): calibrate working memory and build shipped data from probe runs - #9899
Draft
Pfannkuchensack wants to merge 30 commits into
Draft
Pfannkuchensack wants to merge 30 commits into
Pfannkuchensack wants to merge 30 commits into
Conversation
Runs each installed model family through a launched scratch server and compares PSNR, time and driver-level VRAM against accepted references. Graphs come from the frontend builders via an offline graph export; the generate submission plan is shared with the workbench.
VAE estimators return a WorkingMemoryEstimate built from fitted and analytic terms; model_on_device accepts it as working_memory=. The AutoencoderKL coefficients and their measured points move to backend/working_memory/data, checked by a data test; reservations are unchanged.
A probe records each estimated model_on_device window's device-level demand inside a calibration scope; results go to a per-device-class store under databases/working_memory. Admin endpoints start, inspect, reset and export runs; the reserved queue origin is refused for ordinary enqueues.
VAE estimators price a measured slope and base per conv backend, allocator and dtype instead of scaling one bf16 constant by element size; CogView4 gets its own lines. SD/SDXL nodes and their estimate share one run-dtype rule; on ROCm Windows an SDXL fp32 1024² decode reserves 6.2 instead of 14.6 GB and the UNet stays resident.
A lower second reading at a measured size no longer tilts a fitted line, and points that include cast weight growth no longer fit one; two shipped lines move by under 1 %.
…n fact Environment ids now include windows, linux or other, so calibrations from different operating systems are kept apart; the OS build string moves to soft fact os_build.
… runs start --calibrate submits each case through the calibration endpoint and saves the store export per server lifetime; scripts/working_memory/build_shipped.py turns exports into probe points and refits. Probe points bound estimates from below only, and the builder refuses data that the shared bound rule rejects.
# Conflicts: # docs/src/content/docs/development/Architecture/model-manager.mdx
# Conflicts: # invokeai/backend/util/vae_working_memory.py # tests/app/invocations/test_flux2_working_memory.py
# Conflicts: # invokeai/backend/util/vae_working_memory.py
Main added useNsfwChecker and useWatermark to the generation project settings; exported calibration and E2E graphs run without both, as the defaults do.
This was referenced Oct 18, 2026
# Conflicts: # docs/src/content/docs/development/Architecture/model-manager.mdx # invokeai/backend/model_manager/load/load_base.py
# Conflicts: # docs/src/content/docs/development/Architecture/model-manager.mdx # invokeai/backend/util/vae_working_memory.py # invokeai/backend/working_memory/coefficients.py # invokeai/backend/working_memory/data/vae.json # invokeai/backend/working_memory/platform.py # scripts/calibrate_flux2_working_memory.py # tests/app/invocations/test_flux2_working_memory.py # tests/app/invocations/test_vae_working_memory_backend.py # tests/app/invocations/test_z_image_tiled_decode.py # tests/backend/util/test_rocm_sdpa_head_dim_guard.py # tests/backend/working_memory/test_shipped_coefficients.py
6 of 7 tasks
# Conflicts: # invokeai/app/services/invocation_services.py
6 of 7 tasks
… tests CPU wheels on macOS and Windows have no CUDA allocator binding, so the fixture that scripts a CUDA build scripts its backend too.
…s a CUDA environment The refused-environment test scripted the CUDA build but asked the CPU wheel's missing allocator binding.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Shipped working-memory coefficients can now come from probe runs through the API, without one-off calibration scripts.
start --calibratein the family E2E toolPOST /api/v2/models/i/{key}/working_memory/calibrateinstead ofenqueue_batch.calibration/. After a crash orstopit copies the store file instead.scripts/working_memory/build_shipped.pyprobe_demandpoints. It takes valid, fit-eligible windows, keeps the largest per card, estimator, platform and features, and keeps the larger value when it meets an existing point.platform_for_environment, which shares its rules withplatform_for.--writerefuses any result that the shared bound rule rejects. A raise driven by a fragmentation-flagged point needs--accept-fragmentation.max_ratio) stays with those points, because a cold first run after a server start is the worst case.invokeai/backend/working_memory/bounds.pyis used by both the data test and the builder.Related Issues / Discussions
Builds on #9894, #9897 and #9898.
QA Instructions
tests/family_e2e, package data, invocations, the calibration service/runner/router) pass: 3438 passed, 8 skipped, 5 xfailed. Each new or changed file also passes alone.enqueue_batch;cudaMallocAsync) and an RX 9060 XT (ROCm, Windows). Both completed and exported their stores.k_decode_fp325988 → 7661 B/px), which would push fresh-process points over 1.3×. The shipped data is unchanged.Review
Resolved findings
--writecould write data that failed the data test. The upper-bound check only looked at new points, and every new point is a probe point. Now one shared bound rule runs over all points after a refit.resumecould not get past.oshard fact moved into feat(working-memory): measure working memory in admin calibration runs #9897, so the environment-id scheme ships once.stop, and the probe-wiring regression.Remaining limits
GET /api/v2/models/working_memory/export.fingerprint.os_familyandplatform._host_osrepeat the samesys.platformmapping; a test catches drift between them.Compatibility / Rollout
probe_demandholds lower bounds only.MeasuredPointgainsholds_upper_bound; amax_ratioon a probe point is rejected.Checklist
What's Newcopy (if doing a release after this PR)Need help on this PR? Tag
@codesmith-botwith what you need.