Repository navigation
Studio video small host: price the encoder converted beside the cast misses, cast an oversized DiT from its source shards - #16700
Conversation
…he misses, stage a miss split across card and host
…urce shards, one tensor at a time
…(the accelerate split left meta tensors)
…ned component Its host share loads as meta tensors; when the source-shard cast fails the component is left to the normal pipeline load instead.
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4590f1b7a3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| continue | ||
| if stage_on_device(by_name[name], device, logger = logger, cancel_check = cancel_check): | ||
| done.append(name) | ||
| if plan.engaged and plan.skipped and not stage_disabled(): |
There was a problem hiding this comment.
Run the source-cast fallback when every miss is skipped
When the only cast candidate exceeds both the card capacity and the permitted host share, plan_stage() puts it in skipped but returns engaged=False because stage is empty. This condition consequently prevents the source-cast fallback from running in exactly the case it is meant to handle. For example, a single 20,000 MiB transformer with 3,000 MiB available host RAM and 14,600 MiB free VRAM never reaches save_from_source(), so the pipeline still attempts the oversized dense conversion. Allow eligible skipped components to use the fallback without requiring another component to have been staged.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 7fd0637: the source-cast pass now runs over the skipped components whenever the plan has any (not only when something else was staged), so a lone DiT too big for both the card and the host is cast from its shards (test_a_lone_dit_too_big_for_the_card_is_still_cast_from_its_shards, fails on the previous head).
| stage.append(name) | ||
| split[name] = card | ||
| left -= mib | ||
| continue |
There was a problem hiding this comment.
Exclude unsupported encoders before subtracting split candidates
For a Transformers encoder larger than the card, the planner now counts a split candidate as removed from host RAM and can stop before staging a smaller transformer. However, this branch calls save_from_source(), whose _source_names() unconditionally rejects Transformers components, so neither component gets cached. For the existing WAN sizes (12,748 MiB encoder and 2,709 MiB transformer), 16,000 MiB available RAM, a 3,000 MiB reserve, and 11,000 MiB free VRAM, the previous planner staged the transformer and brought the remaining conversion within budget; the new planner selects only the unsupported encoder and leaves the full 15,457 MiB conversion. Restrict source-only planning to supported components or replan after a source write fails.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in 7fd0637: plan_stage takes the set of components whose cast can be written from the source shards (diffusers ones), and only those can be split-planned. A Transformers encoder over the card is skipped instead, so the planner goes on to stage the DiT as before (test_a_transformers_encoder_over_the_card_is_not_split_planned, the WAN sizes from the review).
…t only source-castable ones A skipped component too big for the card and the host takes the source cast even when nothing else was staged, and a Transformers encoder (no source cast) is no longer split-planned, so the planner goes on to stage the DiT. [skip ci]
|
@codex review |
|
Codex Review: Didn't find any major issues. 🎉 Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Summary
HunyuanVideo-1.5 could not load on a 31 GB host with a 15 GB card (Kaggle T4): every load was OOM-killed or hit the container cap. The small-host planner (
video_small_host.py) priced only the cast-cache misses it converts, not the Qwen2.5-VL text encoder that the same load converts from bf16 to fp16 in host RAM beside them (13.5 GiB). The load needed about 32 GiB.Change
video_small_host.py:converted_others_mibprices the components the load converts in host RAM outside the cast cache (half-precision shards of a non-candidate loaded at the other half dtype), and the stage plan counts them.save_from_source), so the load maps the cached file instead of converting the whole component in host RAM. A component the plan would split between card and host takes the same route. If the source cast fails, the component is left to the normal pipeline load; there is no accelerate card / host split, whose host share comes back as meta tensors.diffusion_cast_cache.py:save_from_sourcewrites the cast entry from the source shards; the file is byte-identical to the normal write.video.py: passes the priced conversions to the planner.UNSLOTH_VIDEO_SMALL_HOST=0) still turns all of it off.Evidence
Kaggle T4 (31 GB host, one T4, CPUs 0-3), HunyuanVideo-1.5:
Tests
test_video_small_host.pyandtest_diffusion_cast_cache.py: 40 passed here, 11 fail on main.Not covered