From 8f2553ed2dfb9a4456627959531cf82cb9afc847 Mon Sep 17 00:00:00 2001 From: andyluo7 Date: Sat, 26 Sep 2026 11:46:09 +0800 Subject: [PATCH] test: keep Hunyuan LoRA CPU path on native linear Signed-off-by: andyluo7 --- tests/diffusion/lora/test_lora_manager.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/diffusion/lora/test_lora_manager.py b/tests/diffusion/lora/test_lora_manager.py index 7b68b255809..3c91c40bf6e 100644 --- a/tests/diffusion/lora/test_lora_manager.py +++ b/tests/diffusion/lora/test_lora_manager.py @@ -1158,6 +1158,18 @@ def test_hunyuan_image3_peft_qkv_forward(tmp_path, monkeypatch, tp_size): from vllm.model_executor import parameter from vllm.model_executor.layers import linear + def cpu_unquantized_gemm(_layer, inputs, weight, bias=None): + return torch.nn.functional.linear(inputs, weight, bias) + + # This numerical contract intentionally runs on CPU. Accelerator builds + # select the unquantized GEMM from the process-wide platform, which would + # otherwise dispatch CPU tensors to the ROCm-only custom operator. + monkeypatch.setattr( + linear, + "dispatch_unquantized_gemm", + lambda *_args, **_kwargs: cpu_unquantized_gemm, + ) + adapter_dir = tmp_path / "adapter" adapter_dir.mkdir() rank = 2