Repository navigation
feat(previews): decode Tiny AutoEncoder previews on the CPU - #10231
Open
Pfannkuchensack wants to merge 1 commit into
Open
Pfannkuchensack wants to merge 1 commit into
Pfannkuchensack wants to merge 1 commit into
Conversation
A TAE's cpu_only setting decodes its previews on the CPU in float32, capped at 512 px, so they also work when the generation model fills the VRAM. A CPU TAE is paced from its first frame, and pacing no longer counts the GPU step still queued on the latents' device.
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
Tiny AutoEncoder previews fall back to linear previews whenever the TAE does not fit in VRAM next to the running model. On small GPUs with partially loaded models (e.g. a 12 GB card running a quantized model at ~60% residency) TAE previews therefore never appear, even with plenty of system RAM.
Each TAE now has a Decode previews on CPU switch in the model manager (
cpu_only, the mechanism text encoders and VAEs already use). With it on, the TAE decodes on the CPU and needs no VRAM:Before / after on an RTX 4090 with
max_cache_vram_gb: 3(model only partly in VRAM), 1024×1024, 30 steps:Related Issues / Discussions
User question about running TAEs on the CPU/RAM when VRAM is too small for them next to the model.
QA Instructions
pytest tests/backend/tiny_autoencoder/ tests/app/util/test_tiny_autoencoder_previews.py tests/backend/model_manager/load/test_tiny_autoencoder_loader.py tests/backend/model_manager/configs/test_tiny_autoencoder_config.py tests/app/services/model_manager/test_model_record_changes.py tests/app/services/progress_previews/test_signal_progress.py: 255 passed (CPU).lint:tsc,format:checkandCpuOnlySetting.browser.test.tsxpass; webv2 production build passes.cpu_only: truevia the API); toggling drops the cached TAE.enable_partial_loading: true,max_cache_vram_gb: 3,tiny_autoencoder_previews: true): SDXL + TAESDXL and Anima + TAEW2.1, 1024², 30 steps, switch off/on interleaved, 3 images each after a warm-up. Off: the log reports the TAE does not fit and previews are linear. On: the log shows the TAE loaded onto the CPU (cpu_only) and previews are 512 px TAE frames. Timings in the table above.Review
Resolved: a CPU TAE's second frame went out unpaced because the first frame was never counted, which made up much of the overhead (Anima went from +11% to +9% after the fix); the working-memory helper now requires the decode device; the device comparison in pacing is normalized; a weakened video-cap test and a vacuous label assertion were fixed; pacing outcome tests were added for a CPU TAE with latents on another device and for the unchanged GPU first-frame rule; unsupported performance claims in the docs were replaced by measurements.
Remaining limits: a CPU decode runs synchronously between denoise steps, so the GPU waits for it (paced to a few percent of the denoise); with several GPUs it competes for CPU time with the other generation threads; its transient RAM (~0.3 GB TAESDXL at 512 px, ~1.2 GB for a TAEW2.1 two-frame window) is not counted by the model cache.
Compatibility / Rollout
New optional
cpu_onlyfield on Tiny AutoEncoder configs (defaultnull); existing records load unchanged.openapi.jsonandschema.tsregenerated.Checklist
What's Newcopy (if doing a release after this PR)🤖 Generated with Claude Code
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.