fix: reduce MiniMax-H3 VRAM spikes and redundant token refinemen - #1900
Open
assouan wants to merge 2 commits into
Open
fix: reduce MiniMax-H3 VRAM spikes and redundant token refinemen#1900assouan wants to merge 2 commits into
assouan wants to merge 2 commits into
Conversation
Run condition projection and both token-refiner blocks once per conditioning context, then reuse the refined output across denoising steps. Keep entries distinct by condition and active weight adapter. Split each refiner block into its own streaming segment and clear the sampling-scoped cache when sampling finishes.
Split condition projection and token refiners into sequential streamed segments while folding the persistent copy into the final refiner segment. Tie cached refined contexts to the source tensor identity, storage, shape, and active weight adapter.
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.
Summary
This fixes two MiniMax-H3 issues that made sampling slower and could cause a VRAM spike with
--stream-layers.Before this PR:
--stream-layersand can use much more VRAM than expected.After this PR:
This removes repeated work from every step while restoring the low-VRAM behavior expected from layer streaming.
Related Issue / Discussion
N/A
Additional Information
Tested with MiniMax-H3 Q4 using:
--stream-layers--max-vram cuda1=0.1The runtime log confirms this order, with every segment marked as
STREAMED:The token refiners ran once for the whole sampling run, while transformer block 0 ran once per step. CPU and CUDA builds passed, and the generated output remained unchanged.
Checklist