[diffusion] model: Properly validate device for Mistral 3 attention (#22690)

This commit is contained in:
Aleksi Vesanto
2026-04-16 00:29:23 -07:00
committed by GitHub
parent 1412e287bf
commit aaa682346e
@@ -41,6 +41,7 @@ from transformers.models.mistral.modeling_mistral import (
)
from sglang.multimodal_gen.runtime.loader.weight_utils import default_weight_loader
from sglang.multimodal_gen.runtime.platforms import current_platform
from sglang.multimodal_gen.runtime.utils.logging_utils import init_logger
logger = init_logger(__name__)
@@ -426,7 +427,9 @@ class Mistral3ForConditionalGeneration(nn.Module):
execution_tensor = input_ids if input_ids is not None else inputs_embeds
sdpa_context = (
sdpa_kernel(SDPBackend.CUDNN_ATTENTION)
if execution_tensor is not None and execution_tensor.device.type == "cuda"
if execution_tensor is not None
and execution_tensor.device.type == "cuda"
and current_platform.is_cuda()
else nullcontext()
)
with sdpa_context: