Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion models/minimax_h3/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from tqdm import tqdm

from mmgp import offload
from shared.attention import attention_config_shared_state
from shared.utils.loras_mutipliers import update_loras_slists
from shared.utils.text_encoder_cache import TextEncoderCache
from shared.utils.frame_scheduler import floor_frame_count, normalize_frame_count, normalize_overlap
Expand Down Expand Up @@ -290,6 +291,7 @@ def __init__(self, transformer, text_encoder, video_vae, audio_vae, latent_upsca
self.text_encoder_cache = TextEncoderCache()
self._shared_offloadobj = None
self._private_offloadobj = None
self._attention_split_logged = False
self._interrupt = False

def set_offload_handoff(self, shared_offloadobj, private_offloadobj):
Expand Down Expand Up @@ -371,7 +373,14 @@ def _prompt_cache_key(self, prompt, presentation):

def _encode_prompt(self, prompt, presentation):
def encode_fn(prompts):
return [self.text_encoder.encode(prompts[0], presentation, self.device, self.dtype)]
# Qwen3-VL's Sage kernel is not supported on Turing, while H3 can still
# use the selected backend after this context restores it.
if not self._attention_split_logged:
transformer_attention = offload.shared_state.get("_attention", "auto")
print(f"[MiniMax H3] Qwen attention=SDPA; transformer attention={transformer_attention}")
self._attention_split_logged = True
with attention_config_shared_state("sdpa"):
return [self.text_encoder.encode(prompts[0], presentation, self.device, self.dtype)]

cache_key = self._prompt_cache_key(prompt, presentation)
return self.text_encoder_cache.encode(encode_fn, prompt, device=self.device, cache_keys=cache_key)[0]
Expand Down
Loading