From 0e05fe8cf4fddb0ddef72c9c3f98d71bab1cbb15 Mon Sep 17 00:00:00 2001 From: YanbingJiang Date: Thu, 26 Jun 2025 12:25:50 +0800 Subject: [PATCH] Update seed in CPU UTs to avoid flaky failure with single test (#7544) --- test/srt/cpu/test_activation.py | 2 +- test/srt/cpu/test_decode.py | 2 +- test/srt/cpu/test_extend.py | 2 +- test/srt/cpu/test_gemm.py | 2 +- test/srt/cpu/test_mla.py | 2 +- test/srt/cpu/test_moe.py | 2 +- test/srt/cpu/test_norm.py | 2 +- test/srt/cpu/test_qkv_proj_with_rope.py | 2 +- test/srt/cpu/test_rope.py | 2 +- test/srt/cpu/test_shared_expert.py | 2 +- test/srt/cpu/test_topk.py | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/test/srt/cpu/test_activation.py b/test/srt/cpu/test_activation.py index f6bce4f0b..23af99940 100644 --- a/test/srt/cpu/test_activation.py +++ b/test/srt/cpu/test_activation.py @@ -8,7 +8,7 @@ from utils import SiluAndMul, precision from sglang.test.test_utils import CustomTestCase -torch.manual_seed(0) +torch.manual_seed(1234) class TestActivation(CustomTestCase): diff --git a/test/srt/cpu/test_decode.py b/test/srt/cpu/test_decode.py index 9f88da378..94160b9db 100644 --- a/test/srt/cpu/test_decode.py +++ b/test/srt/cpu/test_decode.py @@ -6,7 +6,7 @@ from torch.nn.functional import scaled_dot_product_attention from sglang.test.test_utils import CustomTestCase -torch.manual_seed(0) +torch.manual_seed(1234) class TestDecodeAttention(CustomTestCase): diff --git a/test/srt/cpu/test_extend.py b/test/srt/cpu/test_extend.py index 57dfad2f7..6b8429aa5 100644 --- a/test/srt/cpu/test_extend.py +++ b/test/srt/cpu/test_extend.py @@ -6,7 +6,7 @@ from torch.nn.functional import scaled_dot_product_attention from sglang.test.test_utils import CustomTestCase -torch.manual_seed(0) +torch.manual_seed(1234) class TestExtendAttention(CustomTestCase): diff --git a/test/srt/cpu/test_gemm.py b/test/srt/cpu/test_gemm.py index ebadad7a0..a9fe5066a 100644 --- a/test/srt/cpu/test_gemm.py +++ b/test/srt/cpu/test_gemm.py @@ -14,7 +14,7 @@ from utils import ( from sglang.test.test_utils import CustomTestCase -torch.manual_seed(0) +torch.manual_seed(1234) class Mod(nn.Module): diff --git a/test/srt/cpu/test_mla.py b/test/srt/cpu/test_mla.py index 620d04273..1f0718d7a 100644 --- a/test/srt/cpu/test_mla.py +++ b/test/srt/cpu/test_mla.py @@ -8,7 +8,7 @@ from utils import precision from sglang.test.test_utils import CustomTestCase -torch.manual_seed(0) +torch.manual_seed(1234) class TestMLA(CustomTestCase): diff --git a/test/srt/cpu/test_moe.py b/test/srt/cpu/test_moe.py index 17b534bac..442a5857c 100644 --- a/test/srt/cpu/test_moe.py +++ b/test/srt/cpu/test_moe.py @@ -8,7 +8,7 @@ import torch kernel = torch.ops.sgl_kernel -torch.manual_seed(0) +torch.manual_seed(1234) from utils import ( BLOCK_K, diff --git a/test/srt/cpu/test_norm.py b/test/srt/cpu/test_norm.py index 008973468..75bacb198 100644 --- a/test/srt/cpu/test_norm.py +++ b/test/srt/cpu/test_norm.py @@ -8,7 +8,7 @@ from utils import make_non_contiguous, precision from sglang.test.test_utils import CustomTestCase -torch.manual_seed(0) +torch.manual_seed(1234) class TestNorm(CustomTestCase): diff --git a/test/srt/cpu/test_qkv_proj_with_rope.py b/test/srt/cpu/test_qkv_proj_with_rope.py index 4496bb8ed..dc90cc559 100644 --- a/test/srt/cpu/test_qkv_proj_with_rope.py +++ b/test/srt/cpu/test_qkv_proj_with_rope.py @@ -15,7 +15,7 @@ from sglang.test.test_utils import CustomTestCase convert_weight_packed = torch.ops.sgl_kernel.convert_weight_packed qkv_proj_with_rope = torch.ops.sgl_kernel.qkv_proj_with_rope qkv_proj_with_rope_fused_weight = torch.ops.sgl_kernel.qkv_proj_with_rope_fused_weight -torch.manual_seed(0) +torch.manual_seed(1234) # constants kv_lora_rank = 512 qk_head_dim = 192 diff --git a/test/srt/cpu/test_rope.py b/test/srt/cpu/test_rope.py index 76e80d5a5..38481e5e3 100644 --- a/test/srt/cpu/test_rope.py +++ b/test/srt/cpu/test_rope.py @@ -10,7 +10,7 @@ from sglang.srt.layers.rotary_embedding import ( ) from sglang.test.test_utils import CustomTestCase -torch.manual_seed(0) +torch.manual_seed(1234) class TestROPE(CustomTestCase): diff --git a/test/srt/cpu/test_shared_expert.py b/test/srt/cpu/test_shared_expert.py index 654aa55e1..17818aebb 100644 --- a/test/srt/cpu/test_shared_expert.py +++ b/test/srt/cpu/test_shared_expert.py @@ -22,7 +22,7 @@ from utils import ( from sglang.test.test_utils import CustomTestCase -torch.manual_seed(0) +torch.manual_seed(1234) class TestSharedExpert(CustomTestCase): diff --git a/test/srt/cpu/test_topk.py b/test/srt/cpu/test_topk.py index cf81d0ecb..0e0aeef2c 100644 --- a/test/srt/cpu/test_topk.py +++ b/test/srt/cpu/test_topk.py @@ -13,7 +13,7 @@ from sglang.srt.layers.moe.topk import grouped_topk_gpu as native_grouped_topk from sglang.srt.models.llama4 import Llama4MoE from sglang.test.test_utils import CustomTestCase -torch.manual_seed(0) +torch.manual_seed(1234) # This is used by the Deepseek-V2 model