[Bugfix] Scope MiniMax-H3 cuDNN SDPA state (#6710)

Signed-off-by: mglyn <1203789601@qq.com>
Co-authored-by: WeiQing Chen <40507679+david6666666@users.noreply.github.com>
This commit is contained in:
Mu GuanLinandWeiQing Chen authored and GitHub committed 2026-08-28 19:40:50 -07:00
1 parent 55a8bd6b80
commit 9558fd2ea8
2 files changed
+74 -8

No files matched your search

@@ -1464,15 +1464,19 @@ class MiniMaxH3Qwen3VLEncoder(nn.Module):
if next(self.parameters()).device.type != self.device_target.type:
raise RuntimeError("call load_to_device() before encode_ids()")
cudnn_sdp_enabled = torch.backends.cuda.cudnn_sdp_enabled()
torch.backends.cuda.enable_cudnn_sdp(True)
hidden = self._encode(
input_ids,
pixel_values=pixel_values,
image_grid_thw=image_grid_thw,
pixel_values_videos=pixel_values_videos,
video_grid_thw=video_grid_thw,
)
return hidden.cpu()
try:
hidden = self._encode(
input_ids,
pixel_values=pixel_values,
image_grid_thw=image_grid_thw,
pixel_values_videos=pixel_values_videos,
video_grid_thw=video_grid_thw,
)
return hidden.cpu()
finally:
torch.backends.cuda.enable_cudnn_sdp(cudnn_sdp_enabled)
def forward(
self,