[diffusion] model: Properly validate device for Mistral 3 attention (#22690)
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user