feat(minimax-h3): single-file pruned/int8-convrot transformer support (PR 6) - #61
Open
lstein wants to merge 1 commit into
Open
feat(minimax-h3): single-file pruned/int8-convrot transformer support (PR 6)#61lstein wants to merge 1 commit into
lstein wants to merge 1 commit into
Conversation
Loads MiniMax's single-file FL2VA transformer repacks (Comfy-Org layout): bf16 or Comfy int8_tensorwise(+convrot) quantized, full or AdaLN-pruned. The 19.5 GiB pruned-int8 file stays int8-resident in VRAM (fits a 45 GiB card outright, vs ~53% partial load for the 62 GiB bf16 folder transformer). - Int8ConvrotLinear: int8 weight + per-channel scale buffers, dequantized and derotated per forward. ConvRot is a grouped-256 regular-Hadamard rotation folded into the stored weights; H is symmetric orthonormal, so derotation is the same grouped matmul (semantics verified against Comfy-Org/comfy-quants + comfy-kitchen; reimplemented, not copied). - MiniMaxH3PrunedTransformer3DModel: 'adaln curves' variant - the timestep MLP and full-width AdaLN inputs are replaced by a [1025, 8] fp32 curve table (lerp lookup, SiLU-free fp32 AdaLN projections), matching ComfyUI's reference semantics. Vendored transformer file untouched. - State-dict converter: remote-code -> vendored diffusers key layout, incl. fused-qkv row splitting (scales split with their rows) and comfy_quant marker fan-out. Verified key-for-key + shape-for-shape against the real 19.5 GiB checkpoint header (dry run, no tensor data). - Probe: Main_Checkpoint_MiniMaxH3_Config fingerprints on the H3-unique audio+video patch projections; ref2va excluded by filename; pruned detected via adaln_t_table. Stripped identification fixture generated from the real file's header. - Loader: transformer-only (Wan-GGUF precedent); shape-inferred config; strict load after swapping quantized linears. - Node: minimax_h3_model_loader v1.1.0 gains an optional 'Transformer (single file)' override; folder main keeps serving encoders + VAEs. Default-workflow pins bumped to match. - UI: checkpoint-format H3 mains hidden from the main picker and offered in a MiniMax H3 advanced section combobox; params persist v5 -> v6 (minimaxH3TransformerModel), migration + fixtures updated; wired through buildMiniMaxH3Graph + metadata. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
lstein
requested review from
JPPhoto,
Pfannkuchensack and
blessedcoolant
as code owners
August 7, 2026 18:10
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.
Note
Port of lstein#145 to the InvokeAI-7 tree. Mechanical replay of the original commits onto v7
main(4a48a37967);openapi.json/schema.tsregenerated and verified drift-free at every level, and thedependencies.pyauto-merge verified by hand. All changes target the backend and the existingfrontend/webapp -webv2is untouched (H3 support in the new UI is future work). Review history and test notes live on the original PR.Summary
PR 6 of the MiniMax H3 stack (on top of lstein#144): load Comfy-Org single-file H3 transformers — including the pruned int8-convrot fl2va (19.5 GiB) — as a checkpoint-format main model that overrides the transformer while the diffusers folder keeps providing the text encoder, tokenizer/processor, and both VAEs.
Why: the bf16 folder transformer is 62 GiB — on a 48 GB card only ~53% stays resident and every denoise step streams ~30 GiB from RAM. The pruned int8 file is fully resident with room to spare, and has ~40% fewer FLOPs (the AdaLN branches are replaced by a precomputed rank-8 time-embedding curve).
Format support (semantics verified against Comfy-Org/comfy-quants, comfy-kitchen, and ComfyUI's model code — reimplemented, not copied)
<layer>.comfy_quantJSON markers. Weights stay int8 in VRAM (Int8ConvrotLinearbuffers); dequant happens per forward in the compute dtype (~620 MB transient at the largest layer).adaln_t_table[1025, 8] lerped at t∈[0,1] replaces the time embedder; rank-8 AdaLN projections, no silu, fp32 modulation. Implemented as a subclass of the vendored transformer (vendored file untouched). Timestep-domain equivalence with ComfyUI verified in review (t = 1−σ, keyframe pin 0.999, unique-t dedup).Wiring
Main_Checkpoint_MiniMaxH3_Config(fingerprint:audio_patch_proj.weight+video_patch_proj.weight+blocks.0.attn.qkv_proj.weight— checked for collisions against every other family's single-file fingerprint, both directions); identification fixture included.SubModelType.Transformer(Wan-GGUF precedent) and errors helpfully for anything else; shape-inferred config (verified key-for-key/shape-for-shape against the real 19.5 GiB header).minimax_h3_model_loaderv1.1.0: optionaltransformer_modelfield (checkpoint-format H3 mains); default workflows' pinned versions bumped.Known limitations (review-documented)
_version4; this stack claims v5 (PR 4) and v6 (this PR), and the flux2 branch also claims v5 — whichever lands second renumbers.max_cache_vram_gbbypasses working-memory reservations.Testing
vite buildOK. Schema regen committed (node field).minimax-h3 / checkpoint / fl2va, pruned), select it under Advanced → Transformer (single file), run t2v; expect ~31 GiB VRAM steady state and no per-step streaming.🤖 Generated with Claude Code