Repository navigation
feat(e2e): calibrate working memory and build shipped data from probe runs - #9899
Open
Pfannkuchensack wants to merge 47 commits into
Open
Pfannkuchensack wants to merge 47 commits into
Pfannkuchensack wants to merge 47 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
# 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.
…stworthy The session processor starts after every other service; windows of failed or canceled nodes, failed counter resets and locks racing a window are stored invalid. Keyed requests are identified by model, graph and batch data, are created once per run and admit all of their items or none; the reserved-origin 400 is declared.
…runs' into feat/working-memory-data
…to feat/family-e2e-calibration
…y-e2e-calibration
…y-e2e-calibration
Pfannkuchensack
marked this pull request as ready for review
October 21, 2026 00:45
Pfannkuchensack
requested review from
blessedcoolant,
joshistoast and
lstein
as code owners
October 21, 2026 00:45
…ration writes behind resets Stop joins the workers within a shared 30 s deadline and refuses a restart while one still runs; the cache counts locks apart from its records. A model reset raises a per-model epoch the runner reads at node start, keyed runs leave a tombstone on reset, retries keep their lineage before admission, and a recorded receipt replays without the model.
6 of 7 tasks
…in calibration runs Status reports a store it cannot write as unavailable, and a run is marked before its batch is enqueued so a repeat never enqueues it twice. A clean finish is recorded before the queue completes the item, a key conflict answers 409 before the model lookup, and run summaries list a retry's source.
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.