[Test] Refactor hard coded device string in test files under compile/quantization/models/model_executor folders (#38901)

Signed-off-by: Liao, Wei <wei.liao@intel.com>
This commit is contained in:
wliao2
2026-04-15 11:02:35 +08:00
committed by GitHub
parent f4b42df048
commit 3abf858443
24 changed files with 122 additions and 66 deletions
+8 -2
View File
@@ -10,6 +10,8 @@ from vllm.model_executor.models.utils import (
)
from vllm.platforms import current_platform
DEVICE_TYPE = current_platform.device_type
class ModuleWithBatchNorm(torch.nn.Module):
def __init__(self):
@@ -174,8 +176,12 @@ class raise_if_cuda_sync:
@pytest.mark.skipif(not current_platform.is_cuda(), reason="Skip if not cuda")
def test_merge_multimodal_embeddings_no_sync():
inputs_embeds = torch.zeros([5, 10], dtype=torch.bfloat16, device="cuda:0")
multimodal_embeddings = [torch.ones([3, 10], dtype=torch.bfloat16, device="cuda:0")]
inputs_embeds = torch.zeros(
[5, 10], dtype=torch.bfloat16, device=f"{DEVICE_TYPE}:0"
)
multimodal_embeddings = [
torch.ones([3, 10], dtype=torch.bfloat16, device=f"{DEVICE_TYPE}:0")
]
is_multimodal = torch.tensor([True, False, True, True, False], device="cpu")
with raise_if_cuda_sync():
_merge_multimodal_embeddings(