Repository navigation
Studio: fix MiniMax-H3-Image downloads, explicit FP8/INT8 and 16 MP sizes - #17563
Conversation
Codex Review Summary: ✅ CompletedThis 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. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: add7be8d19
ℹ️ 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".
| "text_encoder": ( | ||
| H3_IMAGE_TEXT_ENCODER_REPO, | ||
| lambda name: name.startswith("text_encoder/"), |
There was a problem hiding this comment.
Resolve the planned encoder source from the image model index
For an H3-image Hub repo whose model_index.json points text_encoder at a different repository, selecting bf16 (text_encoder_quant="none") stages the hardcoded default encoder here. However, load_minimax_h3_image_pipeline honors the repository declared in that index and now ignores the image snapshot's bundled encoder. Completing this plan therefore leaves the required encoder uncached: a cache-only load fails, while an online load downloads another encoder after staging the unused default. Resolve the encoder repository from the same index before planning its files.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
No published MiniMax-H3-Image repo names a different encoder repo: MiniMaxAI/MiniMax-H3-Image and the third-party copies that ship a model_index.json all point text_encoder at MiniMaxAI/MiniMax-H3, which is H3_IMAGE_TEXT_ENCODER_REPO. The case is hypothetical, so the plan keeps the constant.
| return (root / native / "config.json").is_file() or not ( | ||
| root / converted / "config.json" | ||
| ).is_file() |
There was a problem hiding this comment.
Fall back to converted weights when native folders are config-only
For a local converted checkpoint that retains transformer/config.json but has pruned the native weights, this predicate selects the incomplete native directory even when transformer_diffusers/ contains complete weights. Previously the loader selected the converted copy whenever its config existed; it now reaches native_shard_map on the config-only directory and raises FileNotFoundError. The same selection issue affects the VAE. Check for usable native weights, rather than just a config, before preferring native over an available converted checkpoint.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
No real input reaches this. A Hub load fetches transformer/* and vae/* before _native_layout runs, so the native folder is complete there. The released repo carries full native weights. A local folder only reaches this state if someone deletes the native shards and keeps their config by hand.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: add7be8d19
ℹ️ 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".
| self._h3_image_planned_dit_scheme( | ||
| fam, | ||
| load_kwargs.get("transformer_quant"), | ||
| load_kwargs.get("gpu_ordinal"), | ||
| plan_failures, |
There was a problem hiding this comment.
Resolve cached H3 DiTs from the same roots as the plan
After Studio's cache directory changes in a running process, the hosted INT8/FP8 DiT can remain only in the import-time Hugging Face cache. This branch now lets the plan omit the dense DiT, while add_missing_entry() also omits the hosted download because its probes search both cache roots. However, H3's hosted_prequant_available(..., local_files_only=True) checks only the live cache_dir, so a cache-only load rejects that cached DiT and falls back to bf16 shards the plan no longer stages. If those shards are absent, loading fails despite staging completing successfully. Make the H3 availability check use the same two-root lookup, or stage the artifact into the live root, before narrowing the plan.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
This needs four things at once: a cache-folder change inside a running process, a hosted DiT left only in the old folder, a load that is not user-initiated (the only cache-only load), and no released shards. A user-initiated load is online, finds the hosted file through _hub_file_exists, and loads it. The single-root probe in hosted_prequant_available is the same as on main and is not touched by this PR.
|
Codex Review: Didn't find any major issues. What shall we delve into next? 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". |
|
Codex Review: Didn't find any major issues. Hooray! 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". |
|
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". |
[skip ci]
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fdea2abb3c
ℹ️ 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".
| reclaimable_host_gb = pipeline_host_mib( | ||
| getattr(getattr(self, "_state", None), "pipe", None) |
There was a problem hiding this comment.
Credit chat and video RAM in the H3 download plan
For an auto H3 pick on an 80-GB-or-larger GPU while a chat/video model holds host RAM, crediting only self._state.pipe can select INT8 even though handoff will free enough RAM for bf16—for example, 20 GB free during planning and 64 GB after eviction. The default /images/load handoff evicts that other owner before H3 starts, and load_minimax_h3_image_pipeline() re-resolves auto against the larger host budget and selects bf16. Since the new plan omitted the dense shards, an online UI load then downloads another ~66 GB inline while leaving the staged INT8 DiT unused; a cache-only load fails instead. Include the RAM of all residents the handoff will evict, or preserve the planned scheme through loading.
Useful? React with 👍 / 👎.
…thai#17579) ## Summary `studio/backend/vendor/` holds three vendored packages whose files are pinned by sha256 in their manifests (`diffusers_minimax_h3_image_manifest.json`, `laya_manifest.json`, `truststore_manifest.json`). `.gitattributes` keeps `*.py` at LF, but the manifests also pin the license files (`LICENSE.diffusers`, `LICENSE.laya`, `truststore/LICENSE`). A Windows clone with `core.autocrlf=true` rewrites those to CRLF, so their digests stop matching, and `test_vendored_files_match_the_manifest` fails on the windows-latest runner (seen on the unslothai#17563 staging run: 1 failed, 900 passed). This adds `studio/backend/vendor/** -text`, the same rule the repo already uses for `assets/docs_ui/**` and `requirements/engines/**`. Checked-in bytes are unchanged, so Linux and macOS checkouts are identical before and after. ## Evidence A clone with `core.autocrlf=true` (what the Windows runners use), every manifest entry hashed: | Arm | Result | |---|---| | main `20686a0d92` | 3 mismatches: `LICENSE.diffusers`, `LICENSE.laya`, `truststore/LICENSE` | | this branch | all entries match | The simulated CRLF hash of `LICENSE.diffusers` on main (`e28423074ef7...`) is the exact digest the real windows-latest runner reported when this test failed on the unslothai#17563 staging run; on this branch the file hashes to the manifest's `f9e2070c2475...`. ## Not covered - Existing Windows clones keep their CRLF copies until those files are checked out again.
Fixes four problems with MiniMax-H3-Image (#17453):
Downloads
The image repo bundles a bf16 text encoder (66.7 GB) and a second, converted copy of the DiT and VAE. The H3 loader reads none of them. The download plan staged all of them anyway, along with the bf16 DiT, even on cards where the load then uses the hosted INT8 DiT. The loader then found the bundled encoder in the cache and used it instead of the 27 GB INT8 one. With 64 GB of RAM, the load needs 78 GB and fails.
Now the plan stages what the loader will open, using the loader's own rules:
processor,tokenizer,transformerandvae, in the native layout. The converted layout gives bit-identical images, so the loader no longer fetches it.The loader uses a
text_encoder/folder only for a local-folder load, which also fixes caches that already hold the bundled encoder. If the plan cannot list the encoder or settle the DiT scheme, it setsplan_failedrather than reporting the model as fully downloaded.Auto on 48 GB cards
Auto picked the bf16 DiT whenever it fit the card by itself (40.3 GB plus working memory). It did not count the encoder. On a 48 GB card the loader then kept the DiT in system RAM and swapped it in, which needs about 74 GB of RAM, so the load failed with 70 GB available. Auto now takes bf16 only when it stays on the card beside the encoder, and INT8 otherwise. Cards of 80 GB and up still get bf16. A 48 GB card with enough RAM used to run bf16 from system RAM; it now runs INT8 on the card, which is faster.
Explicit FP8 and INT8
The load route checked explicit precision against the generic torchao path, which refuses any model that cannot run torch.compile. H3 never compiles and quantizes in its own loader, so FP8 and INT8 always got a 409. H3 now skips that check. It refuses only what it cannot run: other schemes, FP8 below SM 8.9, and any scheme without torchao. Before, its own resolver would quietly fall back to auto, INT8 or bf16 in those cases.
16 MP sizes
The generate request capped each side at 2752, so H3's 16 MP sizes (up to 6272) got a 422 before H3's own size check ran. The presets and the chat image tool copied the same cap. All three now use one
MAX_REQUEST_SIDE(6272, the largest side of any family). Each family still enforces its own limit.Not changed
Auto still prefers bf16, as #17453 chose for quality, and falls back to INT8. So on FP8-capable cards the picker row "MiniMax-H3-Image (Fast FP8)" never loads FP8 by default. Changing auto or the label is a separate decision.
Testing
Tested live on a B200 against main, and on an RTX 6000 Ada (48 GB, about 70 GB of RAM). On the B200, smaller cards were emulated by holding the rest of the VRAM, with a 64 GB RAM budget.
New tests cover the plan, the cached bundled encoder, the auto choice on 48 GB cards, the precision check,
plan_failedand the size limit. The plan, cached-encoder and precision-check tests fail on main. The diffusion and H3 backend suites pass, except three tests that also fail on main or pass when run alone.Colab verification (base vs head)
Real Studio routes (download plan, load, generate) on an empty HF cache per tree, then
DiffusionBackendloads from exactly the files the plan listed. Base is the merge base5d5c1381b0, head is49eaddbeae(later commits change comments only).less than or equal to 2752)One render per cell, no repeats. Not run here: the 48 GB card rule, a 4096 render, Windows / macOS / AMD.