Repository navigation
Unsloth Studio: give the memory planner the companion split on a pipeline image load - #11548
Conversation
…ge load A pipeline load handed plan_diffusion_memory None for companion_dense_mib and text_encoder_dense_mib. _sum_required propagates that None into group_floor and group_floor_streamed_te, and both group-tier checks are '... is not None and ...', so group offload was unreachable on a pipeline load regardless of the card. Every such load that did not fit resident went straight to whole-module offload, which pages every component per step and switches VAE tiling on. Derive the split from the same cache walk the GGUF/single-file branch already uses, so it comes from the same trees as model_dense_mib. A narrow base takes its companion share from the bf16 table that already raised model_dense_mib, and the companion term is clamped to the model total. Also split the final reason string so an unknown companion size says so instead of claiming the companions exceeded the budget, and log plan.estimates with diffusion.loaded so the verdict can be checked. Refs unslothai#11547
…, and pin the unknown-split reason
|
Verified this, attributed the test numbers you flagged, and pushed three commits to the branch. The planner bug is real, and reproduces exactlyDifferential at the planner, Qwen-Image-2.1 numbers, a simulated idle A100-SXM4-40GB (budget 36,104 MiB after the reserve). The only thing that varies is the companion split:
Then the same thing end to end against a real 31 GB Qwen-Image-2.1 snapshot on disk, through
The base arm reproduces the The 13 backend failures: not pre-existing, and not 13They do not reproduce here. Same file, same commit, base against head:
The single pre-existing one is The extra one is caused by this branch:
Pushed to the branch
Still not answeredNeither of us has run this on real A100 silicon. Everything above is the planner's decision and the sizes it derives, which is where the bug lives, but the end-to-end claim that generation is faster and the streaking clears is still unmeasured. The streaking point in particular I would not carry into the description as anything more than a hypothesis. |
|
You have reached your Codex usage limits for security reviews. Please try again later. |
…line image load (unslothai#11548) * Studio: give the memory planner the companion split on a pipeline image load A pipeline load handed plan_diffusion_memory None for companion_dense_mib and text_encoder_dense_mib. _sum_required propagates that None into group_floor and group_floor_streamed_te, and both group-tier checks are '... is not None and ...', so group offload was unreachable on a pipeline load regardless of the card. Every such load that did not fit resident went straight to whole-module offload, which pages every component per step and switches VAE tiling on. Derive the split from the same cache walk the GGUF/single-file branch already uses, so it comes from the same trees as model_dense_mib. A narrow base takes its companion share from the bf16 table that already raised model_dense_mib, and the companion term is clamped to the model total. Also split the final reason string so an unknown companion size says so instead of claiming the companions exceeded the budget, and log plan.estimates with diffusion.loaded so the verdict can be checked. Refs unslothai#11547 * Studio: update the pipeline-load planner test for the companion split, and pin the unknown-split reason * Studio: default a quantised Qwen-Image-2.1 to a 512 canvas --------- Co-authored-by: danielhanchen <[email protected]>
Fixes #11547.
A pipeline image load hands
plan_diffusion_memoryNoneforcompanion_dense_mibandtext_encoder_dense_mib(diffusion.py:6289on main)._sum_requiredpropagates thatNoneintogroup_floorandgroup_floor_streamed_te, and both group-tier checks are... is not None and ..., so group offload is unreachable on a pipeline load regardless of the card. Every such load that does not fit resident goes straight to whole-module offload, which pages every component per step and switches VAE tiling on with it.On a 40 GB A100 loading
Qwen/Qwen-Image-2.1the group floor is 28,264 MiB against roughly 36,400 MiB of budget. It fits, on the faster tier, and the planner never looks.Change
The pipeline branch derives the split from
_companion_cache_bytes/_text_encoder_cache_bytes, the same walk the GGUF and single-file branch already uses. That keeps the companion terms on the same trees asmodel_dense_mib, which this branch also reads from the cache, instead of introducing a second source of truth.Two edge cases:
model_dense_mibraised to the bf16 table total. The companions upcast with it, so their share comes from that same table rather than leaving an on-disk figure next to a bf16 total.The final reason string is split so an unknown companion size says so, instead of claiming the companions exceeded the budget: that sends anyone reading the log looking for a card that is too small.
plan.estimatesis added to thediffusion.loadedline, since today it reports the verdict with none of the numbers behind it.Verification: draft, nothing here is a hardware result yet
This is up as a draft specifically so it can be tested on the Colab A100 where the report came from. No row below is a claim about a real load.
tests/test_diffusion_memory.py4123f33ebatests/test_diffusion_backend.pyThe 13 backend failures are the open question. They may well be pre-existing, several are in download-plan and staging tests that look unrelated to the planner, but I have not run the same file on
070f292617without this patch to prove it, so treat the number as unattributed rather than unrelated.The machine this was written on has an AMD card, so there is no A100 here for a before/after. What exists is the log line from the reporting session showing
offload=model tiling=Truewithreasons=companions exceed budget, plus the arithmetic in #11547 from the checked-in family table.What settles it: load
Qwen/Qwen-Image-2.1in the Images page before and after this branch on a 40 GB card and comparediffusion.loaded. Before saysoffload=model tiling=True, after should sayoffload=group tiling=False, and generation should be faster. Tests to follow once that run exists.