Repository navigation
Studio: run MiniMax-H3's Qwen3-VL conditioner from the hosted INT8 checkpoint - #8283
Conversation
…eckpoint The H3 Diffusers path runs every component under ComponentsManager auto CPU offload, so its VRAM floor is the largest single resident component rather than their sum. Seeding the 20 GB pre-quantized denoiser therefore moved that floor by nothing: the 66.7 GB Qwen3-VL conditioner was already the larger of the two and simply took over as the maximum. text_encoder_quant was accepted on this path and then silently ignored. Wire it through to the hosted ConvRot INT8 conditioner in Comfy-Org/MiniMax-H3, the repo the Diffusers path already pulls its VAEs from. The artifact is seeded before load_components, in the same place and for the same reason as the denoiser: a runtime cast has to materialise the dense encoder first, so its peak is the bfloat16 size we are trying to avoid, and it would also have to download the 62 GB dense component the checkpoint replaces. Measured at 960x544x124, 124 frames, 8 steps, cfg 1.0, seed 11, with the int8 denoiser pinned, torch.cuda.max_memory_allocated: bfloat16 conditioner 94.62 GB 48.2 s int8 conditioner 55.20 GB 27.4 s Same seed, visually identical output. Against the released 64-layer bfloat16 encoder the conditioning it produces differs by 0.4% relative error over three prompts, cosine similarity 1.0000. The hosted encoder carries 50 of the released 64 decoder layers and no lm_head, which is lossless rather than approximate: MiniMax-H3 conditions on hidden_states[50] and never calls the language-model head. Comparing tensor names against the base repo's own shard index, the artifact drops exactly decoder layers 50-63, the final norm and lm_head, and nothing else. output_hidden_states puts the post-norm state last, so a stack truncated to exactly 50 layers would return a normalized hidden_states[50]; the loader builds a 51st pass-through slot so the read lands on the raw state instead, for no weights and no compute. Also rebuild the memory preflight from the components a load actually holds instead of a flat constant. That surfaced a second bug: a pinned pre-quantized denoiser is out of the offload rotation, so it is resident alongside whatever is running and the floor is additive, not a max. The shipped 68.5 GB under-states the pinned bfloat16-conditioner case by 26 GB against the 94.62 GB measured above. The no-argument call still returns 68.5, so nothing that does not pass a size changes. Declined requests report as fallbacks with a reason rather than being erased, and a missing, unreadable or mismatched artifact falls back to the released encoder. Default behaviour with no text_encoder_quant is unchanged.
…ts config read Three fixes from review: - The hosted ConvRot INT8 conditioner is cut from MiniMaxAI/MiniMax-H3, but the resolver engaged it for any modular-workflow pick. A derivative selected by detection or family_override can keep the Qwen3-VL architecture and carry different conditioner weights, and the strict load cannot tell the difference, so it would have silently conditioned on someone else's encoder. Gate on te_base_equivalent, the same test the pre-cast encoder path uses, and route the loader through the one resolver so the plan, the estimate, the pre-fetch and the load all agree. - AutoConfig.from_pretrained ignored the live cache root, so the component config resolved against huggingface_hub's import-time default. Pass cache_dir like every other loader call here, and prefer the already-staged snapshot, whose text_encoder/config.json the scoped pre-download deliberately keeps. - The conditioner artifact comes from a third repo, so register it in the in-flight asset set. Without it the delete-cached guard would let it go while the fetch, or the base pull that no longer carries a dense encoder, is running.
|
Round triaged. All three items were real; all three are fixed in d1cb3ff, and each one has a regression test that fails on 24bb196.
Why the base gate is the right shape rather than a stricter one: I checked the transformers plumbing rather than assuming it: Tests,
The +4 passes are the new tests. The 78 pre-existing lines are this sandbox's Separately, the two Still open and unchanged from the description: nvfp4 is not wired, there is no UI select for |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d1cb3ff76f
ℹ️ 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".
| h3_te_skipped = self._fetch_h3_te_quant( | ||
| h3_te_scheme, kwargs.get("hf_token"), cancel_event = cancel_event | ||
| ) |
There was a problem hiding this comment.
Validate the quant artifact before omitting dense weights
When the downloaded or cached safetensors file exists but is corrupt or has incompatible metadata/keys, _fetch_h3_te_quant still returns ("text_encoder",), so this call stages a base snapshot without the dense encoder. The strict validation only happens later in load_h3_quantized_text_encoder, which catches the error and returns None; on an offline host, load_components then cannot obtain the omitted dense weights and the promised fallback is unusable. Even with the newly pinned config read, the fresh evidence is that the fetch path checks only download success while all artifact validation remains after the dense-shard skip; validate before returning the skip or retain a usable dense fallback.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not taking this one. It is the deliberate, documented contract of this fetch, and it is the same contract _fetch_te_prequant has carried since it merged: only a file already on disk earns the dense skip, and validation is the loader's job. _fetch_h3_te_quant's own docstring already states the consequence you are describing and why it is the right failure.
On the substance: a corrupt artifact costs a slower load, not a broken one. load_h3_quantized_text_encoder returns None, the seed is skipped, and load_components pulls the dense encoder from the modular index's own repo id inline, which is exactly the download the skip was avoiding. The offline escalation needs a corrupt cached artifact AND no cached dense encoder at the same time, and a host in that state had no dense encoder to fall back to before this PR either, because the only way to have one cached is a previous load that fetched it.
Diverging from _fetch_te_prequant on this one path would also be worse than either doing it in both or neither: the fetch's idea of "valid" would be a partial copy of the loader's, and the two disagreeing is a new failure mode rather than a fixed one.
If this becomes a real problem the right change is to both fetches at once, not to this one, and the trigger would be evidence of an artifact that lands intact and then fails to load, which is not something I have seen.
The VRAM floor was rebuilt from the engaged components; the host floor next to it was still the released bfloat16 pair, so the configuration these hosted components exist for was refused. An 80 GB device running the int8 conditioner and the int8 denoiser clears the VRAM check at 55 GB and was then told it needed 150 GB of system RAM for 47.5 GB of weights. estimate_h3_diffusers_host_ram_gb now takes the same resident sizes, and the offload tier's floor is their sum plus a headroom derived from the shipped constant, so the released pair still asks for exactly 150.0 and only a load holding smaller components asks for less. The tier above 132 GB VRAM is unchanged: there is no measurement here to justify moving it, and component size is not what stands between a load and a generation on such a device.
|
Second round on this PR, two items.
The host-RAM one is a genuine inconsistency this PR created. I rebuilt the VRAM floor from the engaged components and left the host floor beside it on the released bfloat16 pair, so an 80 GB device holding the int8 conditioner and the int8 denoiser clears the VRAM check at 55 GB and is then refused for wanting 150 GB of system RAM to hold 47.5 GB of weights. That is the configuration these components exist for. It never surfaced in my numbers because the measured runs were on a 180 GB host.
Two things I would rather state than let a reader infer. The 5.9 headroom is derived from the shipped 150.0 minus the released component sum, not newly measured, which is what makes the default byte-identical. And the tier above 132 GB VRAM is untouched, because there is no measurement here that would justify moving it. The artifact-validation item I declined, with the reasoning on the thread. Short version: only a file already on disk earning the dense skip, with validation left to the loader, is the contract Tests,
The +5 are the new tests. |
|
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". |
…ase name The base gate compares repo ids through te_base_equivalent, which treats a matching final path segment as the same model. A derivative stored in a directory named MiniMax-H3, or a same-named repo, therefore passed it and could still have its conditioner replaced. The pipeline's modular index answers the actual question: it records the repo each component would be loaded from, so a derivative that retrained its conditioner names itself there, while one that reuses the released conditioner still points at MiniMaxAI/MiniMax-H3, and quantizing exactly those weights is what the hosted artifact is. Read off the spec diffusers has already parsed, so it costs nothing and cannot disagree with the load. Unanswerable is a refusal. The plan-side resolver keeps the name comparison: it runs before anything is staged and is contractually network-free, and its worst case is now staging an artifact the seed declines, which costs a download rather than the wrong weights.
|
Third round, one item, and it deserved a better answer than a defence of the tolerance I shipped. 3745377313 is right that a repo-id comparison cannot settle model identity: There is a third answer that is better than either. The pipeline's own A derivative that retrained its conditioner ships it under its own id and says so there. One that reuses the released conditioner still points at Landed in cc36870:
Unanswerable is a refusal, not a pass: a pipeline whose conditioner source cannot be read keeps its own encoder. The plan-side resolver keeps the name comparison deliberately, because it runs before anything is staged and a raise there costs the whole download plan; its worst case is now staging an artifact the seed declines, which costs a download rather than the wrong weights. Checked against the installed diffusers rather than from memory: Tests, |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! 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". |
The test asserted the AutoConfig call shape, but the loader imports accelerate and safetensors first and is best-effort, so on a runner that has torch and not those it returned None from the import line, never reached the call, and failed on the assertions with a KeyError. Stub them alongside transformers so the test means the same thing on any host.
The index gate reused te_base_equivalent, which falls through to _same_base_model and accepts a matching final path segment. That is the tolerance the gate exists to remove: a derivative whose index names someone/MiniMax-H3 as its conditioner source is a different repo with different weights and passed anyway. _h3_te_canonical folds a known mirror onto the id it copies, then compares trimmed and lowercased, and nothing else. A pipeline re-saved locally names local paths in its index and is now refused, which costs the optimisation rather than correctness. The plan-side comparison keeps the tolerant helper: it is a staging hint, and the seed is what decides.
|
Fourth round, one item, and it is a fair hit on the fix I shipped last round. 3745599801: I built a gate whose whole purpose was to stop a same-named derivative, and then compared its result with Fixed in 3fd785f. The index comparison goes through
I deliberately did not honour the One consequence worth stating rather than leaving to be discovered: a pipeline re-saved locally names local paths in its index and is now refused. That costs the optimisation and not correctness, which is the right way round for this gate. The plan-side comparison keeps the tolerant helper on purpose, because it decides whether staging the artifact is worth it, not whether to substitute weights. Test Tests, The |
… verify before dropping shards Three from review: - assert_video_precision_available rewrote an H3 int8 request to fp8 (H3 has no keep-bf16 schedule) and then refused it for want of fp8 tensor cores, so a CPU load this path serves came back as a 409. The hosted conditioner uses neither torchao nor those tensor cores, so it is exempt from that gate; whether the artifact suits the base is decided at the seed, which is not a host-level impossibility. - An explicit encoder precision that engaged nothing committed a dense pipeline, where the conventional path raises. It now raises the same refusal, before load_components so it costs nothing, covering all three ways it can end up dense, with precision_fallback_allowed as the escape hatch. - The staging skip compared repo names, so a derivative had its dense encoder dropped and then the seed declined, leaving a 62 GB inline pull. The decision that commits reads the base's own modular index first, so the snapshot and the seed agree.
The verified staging resolver now reads the base's modular index, which the suite blocks, so the test that is about the in-flight delete guard failed on the network rather than on what it asserts.
|
Fifth round, three items, all three real and all three fixed in e82d88a.
The gating one explains why the other two were reachable at all and I did not see them: on a CUDA host Failing closed is the policy the same file already applies to the conventional path a few hundred lines down, and I had written a modular path that records a reason and renders anyway. It now covers all three ways this ends up dense, because the caller cannot tell them apart from the result:
It keys on the engaged scheme rather than the resolver, so it sits after the load attempt, and it still raises before The third is the trade-off I explicitly accepted last round, and it was the wrong pair to choose between. Reading Tests, |
|
@codex review |
1 similar comment
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 80bc89a38f
ℹ️ 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".
| if getattr(fam, "modular_workflow", None) and h3_te_quant_scheme(te_mode) is not None: | ||
| return |
There was a problem hiding this comment.
Restrict the hosted-encoder exemption to pipeline loads
When MiniMax-H3 is loaded through its native GGUF path with text_encoder_quant="int8" (especially on CPU or a host without generic FP8 support), this return now lets the explicit request pass, but _run_load_h3_native discards it through **_ and instead selects its Q2/Q4 encoder solely from the denoiser filename. The load therefore succeeds at an unrelated encoder precision despite the strict explicit-precision contract; require model_kind == "pipeline" for this exemption or reject the option for native loads.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, and it is my own exemption reaching further than it should. I wrote it to say "this request does not go through the mechanism that gate reasons about", but returning before the whole encoder block also covered the native GGUF path, which discards text_encoder_quant through **_ and picks its Q2/Q4 encoder off the denoiser filename. So the explicit request came out answered at an unrelated precision, one commit after I argued that exact outcome is the thing the fail-closed contract exists to stop.
Fixed in c88ff33ba: the exemption requires model_kind == "pipeline". The hosted conditioner is a Diffusers-path artifact, so that is not a narrowing for convenience, it is the actual scope. A native load asking for int8 is judged by the generic gate again, and refused, which is right until the native path either honours the option or rejects it explicitly.
| # And H3's quantized conditioner, which replaces the base repo's dense text_encoder/. | ||
| h3_te_repo, h3_te_files = self._h3_te_quant_hub_files( | ||
| self._h3_te_quant_scheme(fam, text_encoder_quant, base), api | ||
| ) |
There was a problem hiding this comment.
Verify the conditioner source before pruning the download plan
For a remote derivative whose repo tail is also MiniMax-H3 (for example someone/MiniMax-H3), _h3_te_quant_scheme accepts the base through the tolerant tail-name comparison, so this plan adds the hosted INT8 artifact and removes the derivative's dense encoder shards. The actual load uses _h3_te_quant_scheme_verified, reads the derivative's modular index, rejects the substitution, and downloads those roughly 62 GB of dense shards instead; consequently the advertised plan and disk preflight substantially undercount the load and stage 27 GB that will not be used. Apply the same index-source verification before setting h3_te_repo and pruning the plan.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, and it shows my justification last round was wrong on its own terms. I said the plan's worst case was a byte estimate that is high. It is wrong in both directions at once: 27 GB added and staged that the load will decline, and 62 GB of dense shards removed that the load will then need.
Fixed in c88ff33ba: download_plan uses _h3_te_quant_scheme_verified too. That is in keeping rather than a new cost, because that function is already nothing but model_info calls inside a try, so a few-KB index read is the cheapest request it makes. The purity constraint belongs to _h3_te_quant_scheme itself, which the plan still calls through, not to the plan.
Both the entry and the exclusion now key on the same verified answer, so the advertised total and the disk preflight describe the load that will actually run.
| parent_path, _, leaf = target.rpartition(".") | ||
| parent = encoder.get_submodule(parent_path) | ||
| existing = getattr(parent, leaf) | ||
| slice_ = handle.get_slice(prefix + ".weight") | ||
| out_features, in_features = slice_.get_shape() | ||
| if (existing.out_features, existing.in_features) != (out_features, in_features): |
There was a problem hiding this comment.
Validate that every expected projection remains quantized
If the hosted artifact is re-uploaded with any formerly quantized projection stored as an ordinary dense floating-point weight and its scale/metadata removed, that prefix disappears from quantized, so the original nn.Linear remains and the dense key still passes the later strict=True load. A sufficiently broad format change can therefore be accepted and recorded as engaged INT8 while the resident encoder approaches the 51 GB dense size rather than the budgeted 27.2 GB, making the generation memory preflight unsafe. Validate the expected quantized-prefix set or projection count independently of the scale keys before accepting the artifact.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, and it is a real gap in the safety argument I have been making for this loader. I have been leaning on strict=True throughout, and it proves the artifact and the skeleton name the same 902 tensors; it says nothing about whether they are quantized. A projection re-uploaded as a plain dense weight with its scale and metadata removed simply drops out of the prefix set, keeps its original bfloat16 Linear, and loads cleanly. The load is then recorded as engaged int8, and the VRAM preflight sizes the floor from the ENGAGED scheme, so it clears a generation against a budget the encoder no longer meets.
Fixed in c88ff33ba, structurally rather than against a count: after the swap, no ordinary nn.Linear may survive anywhere in the decoder stack. That stays true if the layer count or the projection set ever changes, which a hardcoded 350 would not. The vision tower keeps its own dense Linears and is deliberately out of scope, as are the embedding table and the norms. Int8ConvRotLinear is an nn.Module and not an nn.Linear subclass, so it cannot be mistaken for one, and the test pins that too.
Failure mode is the same as every other refusal here: the loader returns None and the caller loads the released bfloat16 encoder, recorded as a fallback rather than as engaged.
…se a part-dense artifact Three from review: - The precision exemption applied to any H3 int8 request, including the native GGUF path, which discards text_encoder_quant and picks its Q2/Q4 encoder off the denoiser filename. An explicit request was therefore answered at an unrelated precision, which is what the fail-closed contract exists to stop. It is a pipeline-load exemption now. - download_plan still used the name comparison, so a derivative had 27 GB staged that the load then declined and 62 GB of dense shards left out of the total. The plan uses the verified resolver, which is in keeping: that function is already nothing but model_info calls. - strict=True proves the artifact and the skeleton name the same tensors, not that they are quantized. A projection re-uploaded dense drops out of the swap and loads cleanly, and the load would be recorded as engaged int8 while the resident encoder crept back toward 51 GB, under a preflight that sizes the floor from the engaged scheme. No ordinary Linear may survive in the decoder stack; the vision tower keeps its own.
|
Sixth round, three items, all three real and all three caused by my own previous fixes. Fixed in fb1fc43.
The first is the exemption I added last round reaching past its own justification. I wrote it to mean "this request does not go through the mechanism that gate reasons about", then returned before the whole encoder block, which also covered the native GGUF path. That path discards The second shows my justification last round was wrong on its own terms. I said the plan's worst case was a byte estimate that is high; it is wrong in both directions at once, 27 GB added and staged that the load declines and 62 GB of dense shards removed that the load then needs. The plan is already nothing but The third is a real gap in the safety argument I have been making for this loader throughout.
Checked structurally rather than against a count of 350, so it stays true if the layer count or the projection set ever changes. The vision tower keeps its own dense Linears and is deliberately out of scope, and Tests, |
|
@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". |
|
Codex came back clean on fb1fc43, so this is where the review stands. Seven rounds, sixteen items: fifteen taken with a fix and a regression test, one declined with the reasoning on its thread.
Half of the later items were consequences of my own earlier fixes, which is the honest shape of it: the identity question in particular took three passes to answer properly, ending at the pipeline's own modular index rather than at any comparison of repo names. The one declined item is on 3745321755: validating the artifact inside the fetch rather than at load. That is the contract Every round: Remaining red is Unchanged from the description, and still worth a reader knowing: nvfp4 is not wired, there is no UI select for |
…8293) * Studio: run MiniMax-H3's INT8 denoiser from the ConvRot checkpoint The hosted INT8 denoiser quantizes both sides of every GEMM to 8 bits, so its error is set by whichever side has the heaviest outliers, and a DiT's activations are outlier-heavy by construction. ConvRot spreads that magnitude across a block-Hadamard group: the weight is rotated offline, the activation is rotated online, and because the normalized Hadamard is symmetric and orthogonal the two cancel exactly in float. Nothing about the model changes; the quantizer just sees a flatter distribution on both sides. The conditioner already runs this rotation (#8283). This is the denoiser half. The recipe lives in the prequant checkpoint's own metadata, beside adaln_form / curve_dim / curve_grid: a kind, a group size, and the exact list of rotated FQNs. The list is recorded rather than recomputed on purpose. The two halves of the identity live in different places, and if they ever disagree about which Linears are rotated, the mismatched ones produce finite, plausible-looking, completely wrong pixels with nothing to raise and nothing to notice. A rule for "which Linears" can drift with a code change; a list cannot. Everything fails closed against that one failure mode: - rotated artifacts carry a v2 format tag, so a Studio predating this code refuses them outright instead of running them unrotated, and the tag and the declared rotation are checked as a biconditional in both directions; - the online half is installed in the prequant loader itself, not in a family hook, so no route can load a rotated checkpoint without it; - the loader raises on an FQN it cannot find, a target that is not a Linear, an in_features the group does not divide, or a kind it does not implement, and validates every target before swapping any, so a partial install is impossible. A raise becomes a refused checkpoint and a dense fallback. The artifact ships under its own filename with the plain one still behind it as the fallback, so an already-installed Studio keeps resolving the checkpoint it understands rather than refusing the v2 tag and falling back to the 66.3 GB dense download. build_convrot_hadamard and rotate_convrot_activation move out of video_minimax_h3_te into the shared module and are re-exported from their old home. The conditioner's rotation and the denoiser's have to agree with the same comfy-kitchen definition down to the normalizer, and two copies of a matrix nobody re-derives at review time is how they would stop agreeing. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Refuse a ConvRot build that rotates nothing, and publish the rotated artifact under the name the loader asks for Two ways the builder could spend GPU-hours and tens of gigabytes on a file nothing can ever use: - A group that divides no quantized input axis leaves the rotatable set empty, and the build still stamped the v2 tag with an empty fqn list. rotation_metadata_error refuses exactly that at load time, so the artifact was unloadable by construction. Refused up front instead. - --upload-repo published every build as the legacy transformer_<scheme>.pt. The loader asks for the family's declared prequant_filenames name first and the derived <Model>-<SCHEME>.pt second, so a rotated artifact at the legacy name is either never resolved or resolved as the fallback by a build too old to honour the rotation, which refuses the v2 tag and drops to the dense download. A rotated build now goes to the declared name, refuses when the family declares none, and --upload-filename is the escape hatch. Plain builds keep the legacy name. The destination is resolved before the dense load so an unpublishable build fails in a second. * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
The problem
The MiniMax-H3 Diffusers path runs every component under
ComponentsManager.enable_auto_cpu_offload, so its VRAM floor is the largest single resident component, not their sum. That is why seeding the 20 GB pre-quantized denoiser movedH3_DIFFUSERS_VRAM_BASE_GBby exactly nothing: the 66.7 GB Qwen3-VL conditioner was already the larger of the two and simply took over as the maximum.text_encoder_quantwas accepted on this path and then silently ignored._load_h3_modular_pipelinedid not take the argument at all, and the resolved record hardcoded(None, "off", "released bfloat16 components").What this does
Wires
text_encoder_quant=int8through to the hosted ConvRot INT8 conditioner inComfy-Org/MiniMax-H3, the repo the Diffusers path already pulls its VAEs from, so this adds no new component dependency.The artifact is seeded before
load_components, in the same place and for the same reason as the denoiser. Quantizing at load time would defeat the point twice over: a runtime cast has to materialise the dense encoder first, so its peak is the bfloat16 size we are trying to avoid, and on this workflow it would also have to download the 62 GB dense component the checkpoint replaces.Measured before and after
960x544, 124 frames, 8 steps, cfg 1.0, seed 11, int8 denoiser pinned, one B200,
torch.cuda.max_memory_allocated:The 39.4 GB drop is the conditioner delta to within 0.2 GB. Same seed, same prompt, visually identical output: same composition, same subject position frame for frame.
Is the 50-layer truncation lossless
Yes, and provably rather than empirically.
MiniMax-H3 conditions the transformer on
hidden_states[50]of its Qwen3-VL conditioner and never calls the language-model head:diffusers/modular_pipelines/minimax_h3/modular_pipeline.py,MiniMaxH3ModularPipeline.text_encoder_layerreturns50: "MiniMax-H3 readshidden_states[50], not the final one: the last layer is post-norm and is not the conditioning the released weights were trained against."diffusers/modular_pipelines/minimax_h3/encoders.py,get_qwen3vl_prompt_embedscallstext_encoder.model(..., output_hidden_states=True)and returnsoutputs.hidden_states[text_encoder_layer]. Its own comment: "MiniMax-H3 readshidden_states[50]and never uses the language-model head."Decoder layers 51-64 and
lm_headtherefore cannot influence the conditioning by construction. Comparing the hosted file's 902 tensor names againstMiniMaxAI/MiniMax-H3's owntext_encoder/model.safetensors.index.jsonconfirms the artifact drops exactly that set: every hosted name maps 1:1 onto a released one, and the only released names left over are decoder layers 50-63 (0-based),model.language_model.norm.weightandlm_head.weight.Verified end to end as well. Against the released 64-layer bfloat16 encoder on the same tokens, the hosted INT8 conditioner's
hidden_states[50]differs by 0.4% relative error over three prompts (0.9% on a single-token prompt), cosine similarity 1.0000.There is one mechanical catch, and it is why the loader builds 51 layers rather than 50.
output_hidden_statesyields[embeddings, layer_0_out, ..., layer_{N-1}_out]where the last entry is post-norm, so a stack truncated to exactly 50 layers returns a normalizedhidden_states[50], which is not the conditioning the released weights were trained against. Diffusers refuses that case outright. The loader adds a 51st pass-through slot so the read lands on the raw state, for no weights and no compute, and keepslen(layers) == config.num_hidden_layersso the diffusers guard passes on a true statement.The memory preflight
estimate_h3_diffusers_vram_gbnow rebuilds the floor from the components a load actually holds, keyed on the ENGAGED schemes rather than the request.That surfaced a second bug. A pinned pre-quantized denoiser is taken out of the offload rotation, so it stays resident alongside whatever is running and the floor becomes additive rather than a max. The shipped flat 68.5 GB under-states the pinned bfloat16-conditioner case by 26 GB against the 94.62 GB measured above, which is the direction that lets a doomed generation start. The new model is calibrated against both measured runs and covers each on the conservative side.
The no-argument call still returns exactly 68.5, so nothing that does not pass a size changes.
Honesty and fallbacks
"no hosted quantized fp8 conditioner for minimax-h3; loaded the released bfloat16 encoder instead"), never erased into a bare "off" that looks like the caller never asked._VideoLoadState.text_encoder_quantrecords the ENGAGED scheme, so a dense fallback cannot claim a quant the resident encoder does not have, and the preflight cannot under-state the floor by 39 GB.strict=Trueon the state dict load is the safety argument: it proves the artifact and the skeleton describe the same 902 tensors.text_encoder/shards; the component configs are kept because the loader meta-inits from them.nvfp4(14.61 GiB) is deliberately not wired: it is an AWQ layout with two levels of scale and needs its own numerical verification. The table is the one place to add it.Default behaviour with no
text_encoder_quantis unchanged.Tests
studio/backend/tests/test_video_h3_te_quant.py, 20 tests beside the denoiser prequant ones: the resolver, the name mapping, the ConvRot arithmetic (including the control that dequantizing without the rotation is noise, not a small error), the read layer pinned against the installed diffusers constant, the memory floor against both measured runs, the download-plan hooks and the resolved record.Full backend suite against the same merge base, line sets compared: baseline 3 failed / 15 errors, this branch 2 failed / 15 errors, a strict subset (one flaky
test_orphan_cleanup_kills_under_real_rootpassed here). All are pre-existing environment failures.hub/tests429 passed on both.