repo stringclasses 454
values | file_path stringlengths 5 201 | extension stringclasses 1
value | content stringlengths 8 509k | num_lines int64 3 16.9k | size_bytes int64 8 511k |
|---|---|---|---|---|---|
sglang | test/manual/quant/test_nvfp4_gemm_archived.py | .py | """Archived test classes split out of test/registered/quant/test_nvfp4_gemm.py.
Originally registered with `register_cuda_ci(...)`. Moved here as part of
the per-commit pruning effort to keep the code reachable manually.
Run with `python3 test/manual/quant/test_nvfp4_gemm_archived.py`.
"""
import unittest
from types ... | 75 | 2,080 |
sglang | test/manual/quant/test_deepseek_v32_fp4_4gpu.py | .py | import unittest
from types import SimpleNamespace
from sglang.srt.utils import kill_process_tree
from sglang.test.run_eval import run_eval
from sglang.test.send_one import BenchArgs, send_one_prompt
from sglang.test.test_utils import (
DEFAULT_URL_FOR_TEST,
CustomTestCase,
is_in_ci,
popen_launch_server... | 160 | 4,659 |
sglang | test/manual/quant/test_compressed_tensors_fp8_block_ue8m0.py | .py | """Regression test for the Blackwell DeepGEMM UE8M0 weight-scale bug in the
compressed-tensors block-FP8 scheme (sgl-project/sglang#28662).
On Blackwell (SM100) block-wise FP8 dispatches to DeepGEMM, which quantizes
activations to UE8M0 scales and expects the weight scales to be UE8M0-packed
as well. If ``CompressedTe... | 109 | 4,257 |
sglang | test/manual/quant/test_block_fp8_deep_gemm_blackwell.py | .py | import itertools
import unittest
from typing import List, Tuple
import torch
from deep_gemm import fp8_gemm_nt
from sglang.test.test_utils import CustomTestCase
_is_cuda = torch.cuda.is_available() and torch.version.cuda
# Modify form DeepGEMM Blackwell
def ceil_div(x: int, y: int) -> int:
return (x + y - 1) /... | 257 | 8,352 |
sglang | test/manual/quant/test_quantization.py | .py | import json
import unittest
import warnings
from types import SimpleNamespace
from sglang.srt.utils import kill_process_tree
from sglang.test.run_eval import run_eval
from sglang.test.test_utils import (
DEFAULT_MODEL_NAME_FOR_NIGHTLY_EVAL_QUANT_TP1,
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
DEFAULT_URL_FOR_TEST,... | 142 | 4,725 |
sglang | test/manual/quant/test_fp8_kvcache.py | .py | import os
import unittest
from types import SimpleNamespace
from sglang.srt.utils import kill_process_tree
from sglang.test.run_eval import run_eval
from sglang.test.test_utils import (
DEFAULT_MODEL_NAME_FOR_TEST,
DEFAULT_SMALL_MODEL_NAME_FOR_TEST_QWEN,
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
DEFAULT_URL_F... | 115 | 3,032 |
sglang | test/manual/quant/test_custom_ops.py | .py | # SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
# Adapted from https://github.com/vllm-project/vllm/blob/8ca7a71df787ad711ad3ac70a5bd2eb2bb398938/tests/quantization/test_fp8.py
import sys
import pytest
import torch
from sglang.kernels.ops.quantization.fp8_ke... | 153 | 5,839 |
sglang | test/manual/quant/test_awq_archived.py | .py | """Archived test classes split out of test/registered/quant/test_awq.py.
Originally registered with `register_cuda_ci(...)`. Moved here as part of
the per-commit pruning effort to keep the code reachable manually.
Run with `python3 test/manual/quant/test_awq_archived.py`.
"""
import unittest
from types import SimpleN... | 58 | 1,640 |
sglang | test/manual/quant/test_cutlass_w4a8_moe.py | .py | # SPDX-License-Identifier: Apache-2.0
from typing import Optional
import pytest
import torch
from sglang.srt.layers.moe.cutlass_w4a8_moe import cutlass_w4a8_moe
from sglang.srt.layers.moe.topk import TopKConfig, select_experts
def pack_int4_values_to_int8(int4_values_interleaved: torch.Tensor) -> torch.Tensor:
... | 286 | 8,924 |
sglang | test/manual/quant/test_autoround.py | .py | """
Usage:
python3 -m unittest test_autoround.TestAutoRound.test_mmlu
"""
import unittest
from types import SimpleNamespace
from sglang.srt.utils import kill_process_tree
from sglang.test.run_eval import run_eval
from sglang.test.test_utils import (
DEFAULT_AUTOROUND_MODEL_NAME_FOR_TEST,
DEFAULT_TIMEOUT_FOR_S... | 63 | 1,909 |
sglang | test/manual/quant/test_block_fp8.py | .py | import itertools
import unittest
from functools import lru_cache
import torch
from sglang.kernels.ops.quantization.fp8_kernel import (
per_tensor_quant_mla_fp8,
per_token_group_quant_fp8,
per_token_group_quant_mla_deep_gemm_masked_fp8,
static_quant_fp8,
w8a8_block_fp8_matmul,
)
from sglang.srt.lay... | 775 | 25,671 |
sglang | test/manual/quant/test_eval_fp8_accuracy.py | .py | import unittest
from types import SimpleNamespace
from sglang.srt.utils import is_hip, kill_process_tree
from sglang.test.run_eval import run_eval
from sglang.test.test_utils import (
DEFAULT_MODEL_NAME_FOR_ACCURACY_TEST_FP8,
DEFAULT_MODEL_NAME_FOR_DYNAMIC_QUANT_ACCURACY_TEST_FP8,
DEFAULT_MODEL_NAME_FOR_TE... | 115 | 3,558 |
sglang | test/manual/quant/test_cutlass_moe.py | .py | import argparse
import torch
import triton # Added import
import triton.testing # Added import
from transformers import AutoConfig
from sglang.srt.layers.moe.cutlass_moe import cutlass_fused_experts_fp8
from sglang.srt.layers.moe.moe_runner.base import MoeRunnerConfig
from sglang.srt.layers.moe.moe_runner.triton_ut... | 307 | 10,386 |
sglang | test/manual/quant/test_cutlass_w16a16_moe.py | .py | # SPDX-License-Identifier: Apache-2.0
import pytest
import torch
from flashinfer.fused_moe import cutlass_fused_moe as flashinfer_cutlass_fused_moe
from sglang.srt.layers.activation import SiluAndMul
from sglang.srt.layers.moe.topk import TopKConfig, select_experts
from sglang.srt.server_args import ServerArgs, set_gl... | 119 | 3,615 |
sglang | test/manual/kernels/test_hisparse_prefetch.py | .py | """Extended tests for the HiSparse shared-index (plan-then-IO) prefetch.
Local-only (not registered to CI): these cover the CUDA-graph capture/replay
pattern, the DSv4 page-padded layout, and the SGLANG_DEBUG_HISPARSE_SKIP_IO
probe, each of which JIT-compiles extra kernel instantiations. The cheap
plan-replay correctn... | 395 | 13,225 |
sglang | test/manual/kernels/bench_fused_op_dispatch.py | .py | """Hot-path dispatch overhead microbenchmark for the unified ``BaseFusedOp``.
Compares per-call overhead of:
1. a plain bound-method call (theoretical floor),
2. a minimal reproduction of the former ``MultiPlatformOp`` hot path
(``nn.Module.__call__`` -> ``self._forward_method(*args)``),
3. the unified ``BaseFused... | 82 | 2,061 |
sglang | test/manual/openai_server/function_call/test_tool_choice.py | .py | """
Test script for tool_choice functionality in SGLang
Tests: required, auto, and specific function choices in both streaming and non-streaming modes
# To run the tests, use the following command:
#
# python3 -m unittest openai_server.function_call.test_tool_choice
"""
import json
import unittest
import openai
fro... | 895 | 35,701 |
sglang | test/manual/openai_server/features/test_continuous_usage_stats.py | .py | import asyncio
import unittest
import openai
from sglang.srt.utils import kill_process_tree
from sglang.test.test_utils import (
DEFAULT_SMALL_MODEL_NAME_FOR_TEST,
DEFAULT_URL_FOR_TEST,
CustomTestCase,
popen_launch_server,
)
class TestContinuousUsageStats(CustomTestCase):
@classmethod
def se... | 106 | 3,417 |
sglang | test/manual/openai_server/features/test_cache_report.py | .py | import unittest
import openai
import requests
from sglang.srt.utils import kill_process_tree
from sglang.test.test_utils import (
DEFAULT_SMALL_MODEL_NAME_FOR_TEST,
DEFAULT_URL_FOR_TEST,
CustomTestCase,
popen_launch_server,
)
class TestCacheReport(CustomTestCase):
@classmethod
def setUpClass... | 295 | 12,012 |
sglang | test/manual/openai_server/features/test_structural_tag.py | .py | """
python3 -m unittest test.srt.openai_server.features.test_structural_tag
"""
import json
import unittest
from typing import Any
import openai
from sglang.srt.utils import kill_process_tree
from sglang.test.test_utils import (
DEFAULT_SMALL_MODEL_NAME_FOR_TEST,
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
DEFAUL... | 127 | 3,564 |
sglang | test/manual/mla/test_mla.py | .py | import unittest
from sglang.srt.utils import kill_process_tree
from sglang.test.kits.eval_accuracy_kit import MGSMEnMixin
from sglang.test.test_utils import (
DEFAULT_MLA_MODEL_NAME_FOR_TEST,
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
DEFAULT_URL_FOR_TEST,
CustomTestCase,
popen_launch_server,
)
# MLA att... | 43 | 1,114 |
sglang | test/manual/mla/test_mla_flashinfer_archived.py | .py | """Archived test classes split out of test/registered/mla/test_mla_flashinfer.py.
Originally registered with `register_cuda_ci(...)`. Moved here as part of
the per-commit pruning effort to keep the code reachable manually.
Run with `python3 test/manual/mla/test_mla_flashinfer_archived.py`.
"""
import unittest
from ty... | 69 | 1,945 |
sglang | test/manual/mla/test_mla_int8_deepseek_v3_archived.py | .py | """Archived test classes split out of test/registered/mla/test_mla_int8_deepseek_v3.py.
Originally registered with `register_cuda_ci(...)`. Moved here as part of
the per-commit pruning effort to keep the code reachable manually.
Run with `python3 test/manual/mla/test_mla_int8_deepseek_v3_archived.py`.
"""
import unit... | 114 | 3,310 |
sglang | test/manual/mla/test_flashmla_archived.py | .py | """Archived test classes split out of test/registered/mla/test_flashmla.py.
Originally registered with `register_cuda_ci(...)`. Moved here as part of
the per-commit pruning effort to keep the code reachable manually.
Run with `python3 test/manual/mla/test_flashmla_archived.py`.
"""
"""
Usage:
python3 test/registered/... | 74 | 2,070 |
sglang | test/manual/mla/test_mla_deepseek_v3.py | .py | import os
import unittest
from types import SimpleNamespace
import requests
from sglang.srt.utils import is_cuda, is_hip, kill_process_tree
from sglang.test.run_eval import run_eval
from sglang.test.test_utils import (
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
DEFAULT_URL_FOR_TEST,
CustomTestCase,
is_in_ci,
... | 205 | 5,887 |
sglang | test/manual/ascend/test_mindspore_models.py | .py | """
Usage:
python3 -m unittest test_mindspore_models.TestMindSporeQwen3.test_gsm8k
"""
import unittest
from types import SimpleNamespace
from sglang.srt.utils import kill_process_tree
from sglang.test.few_shot_gsm8k import run_eval
from sglang.test.test_utils import (
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
DEFAUL... | 65 | 1,639 |
sglang | test/manual/ascend/test_ascend_w8a8_quantization.py | .py | """
Usage:
python3 -m unittest test_ascend_w8a8_quantization.TestAscendW8A8.test_gsm8k
"""
import os
import time
import unittest
from types import SimpleNamespace
from urllib.parse import urlparse
import requests
from sglang.srt.utils import kill_process_tree
from sglang.test.few_shot_gsm8k import run_eval
from sgla... | 103 | 2,833 |
sglang | test/manual/ascend/test_ascend_vocab_mask.py | .py | import math
import pytest
import torch
from sglang.srt.constrained import xgrammar_backend as xb
def _pack_mask(allowed_ids, vocab_size, batch_size=1):
nwords = math.ceil(vocab_size / 32)
m = torch.zeros((batch_size, nwords), dtype=torch.int32)
for b in range(batch_size):
for tid in allowed_ids[... | 82 | 2,385 |
sglang | test/manual/ascend/test_ascend_deepseek_mtp.py | .py | import unittest
from types import SimpleNamespace
from urllib.parse import urlparse
from sglang.srt.environ import envs
from sglang.srt.utils import kill_process_tree
from sglang.test.few_shot_gsm8k import run_eval as run_eval_few_shot_gsm8k
from sglang.test.test_utils import (
DEFAULT_URL_FOR_TEST,
CustomTest... | 94 | 2,696 |
sglang | test/manual/ascend/vlm_models/test_npu_gemma_4_31b.py | .py | import unittest
from sglang.test.ascend.test_ascend_utils import GEMMA_4_31B_WEIGHTS_PATH
from sglang.test.ascend.vlm_utils import TestVLMModels
class TestGemma431B(TestVLMModels):
"""Testcase: Verify that the inference accuracy of the google/gemma-4-31B-it model on the MMMU dataset is no less than 0.50.
[T... | 23 | 574 |
sglang | test/manual/ascend/vlm_models/test_npu_gemma_4_26b_a4b_it.py | .py | import unittest
from sglang.test.ascend.test_ascend_utils import GEMMA_4_26B_A4B_IT_WEIGHTS_PATH
from sglang.test.ascend.vlm_utils import TestVLMModels
class TestGemma426BA4BIt(TestVLMModels):
"""Testcase: Verify that the inference accuracy of the google/gemma-4-26B-A4B-it model on the MMMU dataset is no less th... | 23 | 601 |
sglang | test/manual/ascend/vlm_models/test_npu_gemma_4_e2b.py | .py | import unittest
from sglang.test.ascend.test_ascend_utils import GEMMA_4_E2B_WEIGHTS_PATH
from sglang.test.ascend.vlm_utils import TestVLMModels
class TestGemma4E2B(TestVLMModels):
"""Testcase: Verify that the inference accuracy of the google/gemma-4-E2B-it model on the MMMU dataset is no less than 0.15.
[T... | 23 | 574 |
sglang | test/manual/ascend/vlm_models/test_npu_gemma_4_e4b.py | .py | import unittest
from sglang.test.ascend.test_ascend_utils import GEMMA_4_E4B_WEIGHTS_PATH
from sglang.test.ascend.vlm_utils import TestVLMModels
class TestGemma4E4B(TestVLMModels):
"""Testcase: Verify that the inference accuracy of the google/gemma-4-E4B-it model on the MMMU dataset is no less than 0.30.
[T... | 23 | 574 |
sglang | test/manual/ascend/llm_models/test_npu_gemma_4_e4b_llm.py | .py | import unittest
from sglang.test.ascend.gsm8k_ascend_mixin import GSM8KAscendMixin
from sglang.test.ascend.test_ascend_utils import GEMMA_4_E4B_WEIGHTS_PATH
from sglang.test.test_utils import CustomTestCase
class TestGemma4E4B(GSM8KAscendMixin, CustomTestCase):
"""Testcase: Verify that the inference accuracy of ... | 31 | 796 |
sglang | test/manual/ascend/llm_models/test_npu_gemma_4_26b_a4b_it_llm.py | .py | import unittest
from sglang.test.ascend.gsm8k_ascend_mixin import GSM8KAscendMixin
from sglang.test.ascend.test_ascend_utils import GEMMA_4_26B_A4B_IT_WEIGHTS_PATH
from sglang.test.test_utils import CustomTestCase
class TestGemma426BA4BIt(GSM8KAscendMixin, CustomTestCase):
"""Testcase: Verify that the inference ... | 31 | 823 |
sglang | test/manual/ascend/llm_models/test_npu_mimo_v2_5_w8a8.py | .py | import unittest
from sglang.test.ascend.gsm8k_ascend_mixin import GSM8KAscendMixin
from sglang.test.ascend.test_ascend_utils import MIMO_V2_5_W8A8_WEIGHTS_PATH
from sglang.test.test_utils import CustomTestCase
class TestMiMoV25W8A8GraphWithMTP(GSM8KAscendMixin, CustomTestCase):
"""Testcase: Verify the inference ... | 50 | 1,387 |
sglang | test/manual/ascend/llm_models/test_npu_mimo_v2_flash.py | .py | import unittest
from sglang.test.ascend.gsm8k_ascend_mixin import GSM8KAscendMixin
from sglang.test.ascend.test_ascend_utils import MIMO_V2_FLASH_WEIGHTS_PATH
from sglang.test.test_utils import CustomTestCase
class TestMiMoV2FlashGraphWithMTP(GSM8KAscendMixin, CustomTestCase):
"""Testcase: Verify the inference a... | 40 | 1,099 |
sglang | test/manual/ascend/llm_models/test_npu_gemma_4_31b_llm.py | .py | import unittest
from sglang.test.ascend.gsm8k_ascend_mixin import GSM8KAscendMixin
from sglang.test.ascend.test_ascend_utils import GEMMA_4_31B_WEIGHTS_PATH
from sglang.test.test_utils import CustomTestCase
class TestGemma431B(GSM8KAscendMixin, CustomTestCase):
"""Testcase: Verify that the inference accuracy of ... | 31 | 796 |
sglang | test/manual/ascend/llm_models/test_npu_gemma_4_e2b_llm.py | .py | import unittest
from sglang.test.ascend.gsm8k_ascend_mixin import GSM8KAscendMixin
from sglang.test.ascend.test_ascend_utils import GEMMA_4_E2B_WEIGHTS_PATH
from sglang.test.test_utils import CustomTestCase
class TestGemma4E2B(GSM8KAscendMixin, CustomTestCase):
"""Testcase: Verify that the inference accuracy of ... | 31 | 796 |
sglang | test/manual/models/test_falcon_h1_models.py | .py | from types import SimpleNamespace
from sglang.srt.utils import kill_process_tree
from sglang.test.run_eval import run_eval
from sglang.test.test_utils import (
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
DEFAULT_URL_FOR_TEST,
CustomTestCase,
popen_launch_server,
)
class TestFalconH1(CustomTestCase):
@clas... | 147 | 3,984 |
sglang | test/manual/models/test_gme_qwen_models.py | .py | # Copyright 2023-2024 SGLang Team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 86 | 3,422 |
sglang | test/manual/models/test_qwen_models.py | .py | # Qwen model tests
import unittest
from types import SimpleNamespace
from sglang.srt.utils import kill_process_tree
from sglang.test.run_eval import run_eval
from sglang.test.test_utils import (
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
DEFAULT_URL_FOR_TEST,
CustomTestCase,
popen_launch_server,
)
class Tes... | 80 | 2,042 |
sglang | test/manual/models/test_clip_models.py | .py | # Copyright 2023-2024 SGLang Team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 79 | 2,896 |
sglang | test/manual/models/test_qwen3_asr.py | .py | """
Test Qwen3-ASR model support in SGLang.
Tests /v1/audio/transcriptions (HTTP) and /v1/realtime (OpenAI Realtime
transcription WebSocket).
Usage:
python test/manual/models/test_qwen3_asr.py
"""
import asyncio
import base64
import io
import json
import os
import re
import unittest
import numpy as np
import re... | 663 | 26,530 |
sglang | test/manual/models/test_mistral_large3_basic.py | .py | import os
import unittest
from types import SimpleNamespace
from sglang.srt.utils import kill_process_tree
from sglang.test.run_eval import run_eval
from sglang.test.send_one import BenchArgs, send_one_prompt
from sglang.test.test_utils import (
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
DEFAULT_URL_FOR_TEST,
Cust... | 89 | 2,630 |
sglang | test/manual/models/test_unsloth_models.py | .py | import unittest
from types import SimpleNamespace
from sglang.srt.utils import kill_process_tree
from sglang.test.run_eval import run_eval
from sglang.test.test_utils import (
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
DEFAULT_URL_FOR_TEST,
CustomTestCase,
popen_launch_server,
)
class TestUnslothPhi4(CustomT... | 214 | 5,796 |
sglang | test/manual/models/test_nvidia_nemotron_nano_v2.py | .py | import unittest
from sglang.srt.utils import is_blackwell
from sglang.test.kits.eval_accuracy_kit import GSM8KMixin
from sglang.test.kits.kl_divergence_kit import KLDivergenceMixin
from sglang.test.kits.prefix_cache_branching_kit import PrefixCacheBranchingMixin
from sglang.test.server_fixtures.default_fixture import ... | 110 | 3,183 |
sglang | test/manual/models/test_nvidia_nemotron_3_nano_archived.py | .py | """Archived test classes split out of test/registered/models_e2e/test_nvidia_nemotron_3_nano.py.
Originally registered with `register_cuda_ci(...)`. Moved here as part of
the per-commit pruning effort to keep the code reachable manually.
Run with `python3 test/manual/models/test_nvidia_nemotron_3_nano_archived.py`.
""... | 70 | 2,250 |
sglang | test/manual/models/test_grok_models.py | .py | import unittest
from types import SimpleNamespace
from sglang.srt.utils import kill_process_tree
from sglang.test.run_eval import run_eval
from sglang.test.test_utils import (
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
DEFAULT_URL_FOR_TEST,
CustomTestCase,
popen_launch_server,
)
class TestGrok(CustomTestCase... | 54 | 1,428 |
sglang | test/manual/models/test_kimi_k2_models.py | .py | import unittest
from types import SimpleNamespace
import requests
from sglang.srt.utils import kill_process_tree
from sglang.test.run_eval import run_eval
from sglang.test.test_utils import (
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
DEFAULT_URL_FOR_TEST,
CustomTestCase,
is_in_ci,
popen_launch_server,
... | 71 | 1,823 |
sglang | test/manual/models/test_nvidia_nemotron_nano_v2_vl.py | .py | import unittest
from sglang.test.kits.eval_accuracy_kit import GSM8KMixin
from sglang.test.kits.mmmu_vlm_kit import MMMUMixin
from sglang.test.server_fixtures.default_fixture import DefaultServerBase
from sglang.test.server_fixtures.mmmu_fixture import MMMUServerBase
# NVIDIA Nemotron Nano V2 VL model tests (CUDA onl... | 31 | 1,035 |
sglang | test/manual/models/test_granite_moe_hybrid.py | .py | import unittest
from sglang.test.kits.eval_accuracy_kit import GSM8KMixin
from sglang.test.kits.kl_divergence_kit import KLDivergenceMixin
from sglang.test.kits.prefix_cache_branching_kit import PrefixCacheBranchingMixin
from sglang.test.server_fixtures.default_fixture import DefaultServerBase
GRANITE_MOE_HYBRID_MODE... | 34 | 949 |
sglang | test/manual/models/test_mtp_models.py | .py | import unittest
from types import SimpleNamespace
from sglang.srt.utils import kill_process_tree
from sglang.test.run_eval import run_eval
from sglang.test.test_utils import (
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
DEFAULT_URL_FOR_TEST,
CustomTestCase,
popen_launch_server,
)
class TestMiMoMTP(CustomTestC... | 59 | 1,557 |
sglang | test/manual/models/test_llama4_models.py | .py | import unittest
from types import SimpleNamespace
from sglang.srt.utils import kill_process_tree
from sglang.test.run_eval import run_eval
from sglang.test.test_utils import (
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
DEFAULT_URL_FOR_TEST,
CustomTestCase,
popen_launch_server,
)
MODELS = [
SimpleNamespace... | 73 | 2,264 |
sglang | test/manual/lora/test_torch_backend.py | .py | import unittest
import torch
from sglang.srt.lora.backend.torch_backend import TorchNativeLoRABackend
from sglang.srt.model_executor.forward_batch_info import ForwardBatch, ForwardMode
from sglang.test.lora_utils import reference_sgmv_expand, reference_sgmv_shrink
from sglang.test.test_utils import CustomTestCase
c... | 247 | 7,475 |
sglang | test/manual/lora/test_lora_backend.py | .py | # Copyright 2023-2024 SGLang Team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 76 | 2,425 |
sglang | test/manual/lora/test_lora_ops.py | .py | import random
import unittest
import torch
from sglang.srt.lora.torch_ops.graph_lora_ops import (
sgemm_lora_a_embedding_graph_fwd,
sgemm_lora_a_graph_fwd,
sgemm_lora_b_graph_fwd,
)
from sglang.srt.lora.torch_ops.lora_ops import (
sgemm_lora_a_embedding_fwd,
sgemm_lora_a_fwd,
sgemm_lora_b_fwd,... | 511 | 16,324 |
sglang | test/manual/lora/test_lora_cuda_graph.py | .py | # Copyright 2023-2024 SGLang Team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 108 | 4,292 |
sglang | test/manual/lora/test_lora_spec_decoding.py | .py | # Copyright 2023-2025 SGLang Team
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | 53 | 1,642 |
sglang | test/manual/lora/test_lora_llama4.py | .py | import unittest
from types import SimpleNamespace
from sglang.srt.utils import kill_process_tree
from sglang.test.test_utils import (
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
DEFAULT_URL_FOR_TEST,
CustomTestCase,
is_in_ci,
popen_launch_server,
)
MODELS = [
SimpleNamespace(
model="meta-llama/... | 64 | 1,966 |
sglang | test/manual/lora/test_lora_tuning_config.py | .py | """Unit tests for LoRA CSGMV tuning config loading."""
import json
import os
import tempfile
import unittest
from unittest.mock import patch
from sglang.kernels.ops.gemm.lora_tuning_config import (
DEFAULT_EXPAND_CONFIG,
DEFAULT_SHRINK_CONFIG,
get_lora_config_file_name,
get_lora_configs,
get_lora_... | 119 | 4,365 |
sglang | test/manual/attention/test_prefix_chunk_info.py | .py | import unittest
import torch
from sglang.srt.mem_cache.memory_pool import MLATokenToKVPool
from sglang.srt.model_executor.forward_batch_info import ForwardBatch, ForwardMode
from sglang.srt.utils.common import get_device
from sglang.test.test_utils import CustomTestCase
TEST_CASES = [
# Sequence with same prefix... | 239 | 8,179 |
sglang | test/manual/attention/test_local_attn.py | .py | import os
import unittest
from types import SimpleNamespace
import requests
from sglang.srt.utils import get_device_sm, kill_process_tree
from sglang.test.run_eval import run_eval
from sglang.test.test_utils import (
DEFAULT_MODEL_NAME_FOR_TEST_LOCAL_ATTENTION,
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
DEFAULT_U... | 75 | 1,975 |
sglang | test/manual/attention/test_flashattn_backend.py | .py | import unittest
import torch
from sglang.srt.configs.model_config import AttentionArch
from sglang.srt.layers.attention.flashattention_backend import (
FlashAttentionBackend,
draft_decode_set_expand_metadata,
)
from sglang.srt.layers.attention.torch_native_backend import TorchNativeAttnBackend
from sglang.srt... | 589 | 23,295 |
sglang | test/manual/attention/test_flashattn_mla_backend.py | .py | import unittest
import torch
from sglang.srt.configs.model_config import AttentionArch
from sglang.srt.layers.attention.flashattention_backend import FlashAttentionBackend
from sglang.srt.layers.attention.torch_native_backend import TorchNativeAttnBackend
from sglang.srt.layers.radix_attention import RadixAttention
f... | 330 | 12,503 |
sglang | test/manual/attention/test_fa3.py | .py | import unittest
from types import SimpleNamespace
import requests
from sglang.srt.environ import envs
from sglang.srt.utils import get_device_sm, kill_process_tree
from sglang.test.run_eval import run_eval
from sglang.test.test_utils import (
DEFAULT_DRAFT_MODEL_EAGLE3,
DEFAULT_MODEL_NAME_FOR_TEST,
DEFAUL... | 264 | 8,584 |
sglang | test/manual/attention/test_trtllm_mla_backend.py | .py | import math
import unittest
from types import SimpleNamespace
import numpy as np
import torch
from sglang.srt.runtime_context import get_parallel, get_server_args
_parallel_override = get_parallel().override(attn_tp_size=1)
_parallel_override.__enter__()
from sglang.kernels.ops.attention.utils import get_num_page_p... | 1,438 | 54,979 |
sglang | test/manual/ep/test_moriep_combine_dtype.py | .py | """Lightweight (no-GPU) wiring guards for the MoRI blockwise-FP4 combine dtype.
Protects the sglang-side plumbing that exposes ``SGLANG_MORI_COMBINE_DTYPE=fp4`` and maps it to
MoRI's ``fp4_blockwise`` combine. The end-to-end kernel behaviour is covered by the GPU/eval tests.
"""
import unittest
from sglang.srt.layer... | 29 | 1,098 |
sglang | test/manual/ep/test_moe_deepep.py | .py | import json
import unittest
from types import SimpleNamespace
from sglang.srt.environ import envs
from sglang.srt.utils import kill_process_tree
from sglang.test.run_eval import run_eval
from sglang.test.test_utils import (
DEFAULT_MLA_MODEL_NAME_FOR_TEST,
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
DEFAULT_URL_FOR... | 117 | 3,622 |
sglang | test/manual/ep/test_deepep_internode.py | .py | # Copy from deepseek-ai/DeepEP/tests/test_internode.py
import os
import time
# noinspection PyUnresolvedReferences
import deep_ep
# Test compatibility with low latency functions
import test_deepep_low_latency
import torch
import torch.distributed as dist
from sglang.test.test_deepep_utils import (
bench,
ca... | 446 | 18,430 |
sglang | test/manual/ep/test_deepep_low_latency.py | .py | # Copy from deepseek-ai/DeepEP/tests/test_low_latency.py
import random
from functools import partial
import deep_ep
import torch
import torch.distributed as dist
from sglang.test.test_deepep_utils import (
bench,
bench_kineto,
calc_diff,
hash_tensor,
init_dist,
per_token_cast_back,
)
def te... | 326 | 11,887 |
sglang | test/manual/ep/test_mooncake_expert_backup.py | .py | import time
import unittest
from types import SimpleNamespace
import requests
from sglang.srt.utils import kill_process_tree
from sglang.test.run_eval import run_eval
from sglang.test.server_fixtures.disaggregation_fixture import get_rdma_devices_args
from sglang.test.test_utils import (
DEFAULT_MODEL_NAME_FOR_TE... | 144 | 5,020 |
sglang | test/manual/ep/test_eplb.py | .py | import os
import tempfile
import time
import unittest
from pathlib import Path
from types import SimpleNamespace
import sglang as sgl
from sglang.srt.environ import envs
from sglang.srt.utils import kill_process_tree
from sglang.test.run_eval import run_eval
from sglang.test.test_utils import (
DEFAULT_MLA_MODEL_N... | 183 | 6,196 |
sglang | test/manual/ep/test_elastic_scale.py | .py | """Manual tests for elastic EP scale-up.
Test classes:
TestElasticScaleUp4To6 primary + joiner scale-up (6 GPUs)
TestElasticScaleUp4To5To6 two consecutive single-rank scale-ups
TestElasticScaleUp4To8 full primary + joiner scale-up (8 GPUs)
Run (8-GPU full scale-up):
... | 482 | 14,974 |
sglang | test/manual/ep/test_pplx_small.py | .py | import unittest
from types import SimpleNamespace
from sglang.srt.utils import kill_process_tree
from sglang.test.run_eval import run_eval
from sglang.test.test_utils import (
DEFAULT_MODEL_NAME_FOR_TEST_MLA,
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
DEFAULT_URL_FOR_TEST,
CustomTestCase,
popen_launch_serv... | 146 | 4,576 |
sglang | test/manual/ep/test_elastic_recover.py | .py | """Manual single-host Elastic EP recovery test.
Run:
CUDA_VISIBLE_DEVICES=0,1,2,3,4,5,6,7 python -m pytest \
test/manual/ep/test_elastic_recover.py -v -s
"""
import os
import shlex
import subprocess
import time
import unittest
from pathlib import Path
import requests
from sglang.srt.utils import kill_p... | 256 | 8,462 |
sglang | test/manual/ep/test_nixl_ep.py | .py | import os
import subprocess
import time
import unittest
from types import SimpleNamespace
import requests
from sglang.srt.utils import kill_process_tree
from sglang.test.run_eval import run_eval
from sglang.test.server_fixtures.disaggregation_fixture import get_rdma_devices_args
from sglang.test.test_utils import (
... | 141 | 3,516 |
sglang | test/manual/ep/test_deepep_intranode.py | .py | # Copy from deepseek-ai/DeepEP/tests/test_intranode.py
import time
# noinspection PyUnresolvedReferences
import deep_ep
# Test compatibility with low latency functions
import test_deepep_low_latency
import torch
import torch.distributed as dist
from sglang.test.test_deepep_utils import (
bench,
calc_diff,
... | 379 | 15,541 |
sglang | test/manual/ep/test_eplb_mori.py | .py | import os
import unittest
from types import SimpleNamespace
from sglang.srt.server_args import ZMQ_TCP_PORT_DELTA
from sglang.srt.utils import kill_process_tree
from sglang.srt.utils.network import is_port_available
from sglang.test.few_shot_gsm8k import run_eval as run_eval_few_shot_gsm8k
from sglang.test.test_utils ... | 243 | 6,236 |
sglang | test/manual/ep/test_flashinfer_dispatcher.py | .py | import unittest
import torch
from sglang.srt.distributed import init_distributed_environment
from sglang.srt.distributed.parallel_state import (
get_tp_group,
initialize_model_parallel,
)
from sglang.srt.layers.dp_attention import set_dp_buffer_len
from sglang.srt.layers.moe.token_dispatcher.flashinfer import... | 323 | 11,829 |
sglang | test/manual/ep/test_moe_deepep_eval_accuracy_large.py | .py | """
Usage:
python -m unittest test_moe_deepep_eval_accuracy_large.TestMoEDeepEPEvalAccuracyLarge.test_mmlu
"""
import unittest
from types import SimpleNamespace
from sglang.srt.utils import kill_process_tree
from sglang.test.run_eval import run_eval
from sglang.test.test_utils import (
DEFAULT_DEEPEP_MODEL_NAME_F... | 76 | 1,992 |
sglang | test/manual/4-gpu-models/test_qwen3_next_models_mtp_archived.py | .py | """Archived test classes split out of test/registered/4-gpu-models/test_qwen3_next_models_mtp.py.
Originally registered with `register_cuda_ci(...)`. Moved here as part of
the per-commit pruning effort to keep the code reachable manually.
Run with `python3 test/manual/4-gpu-models/test_qwen3_next_models_mtp_archived.p... | 45 | 1,289 |
sglang | test/manual/4-gpu-models/test_qwen35_models_archived.py | .py | """Archived test classes split out of test/registered/4-gpu-models/test_qwen35_models.py.
Originally registered with `register_cuda_ci(...)`. Moved here as part of
the per-commit pruning effort to keep the code reachable manually.
Run with `python3 test/manual/4-gpu-models/test_qwen35_models_archived.py`.
"""
import ... | 169 | 5,291 |
sglang | test/manual/4-gpu-models/test_qwen3_next_models.py | .py | import unittest
from sglang.test.kits.eval_accuracy_kit import GSM8KMixin
from sglang.test.kits.kl_divergence_kit import KLDivergenceMixin
from sglang.test.kits.prefix_cache_branching_kit import PrefixCacheBranchingMixin
from sglang.test.server_fixtures.default_fixture import DefaultServerBase
QWEN3_NEXT_MODEL = "Qwe... | 63 | 1,564 |
sglang | test/manual/4-gpu-models/test_qwen35_fp4_triton.py | .py | import unittest
from sglang.test.accuracy_test_runner import AccuracyTestParams
# This eval harness applies the chat_template, which is critical for qwen3.5
# to get good accuracy on gsm8k
from sglang.test.run_combined_tests import run_combined_tests
from sglang.test.test_utils import (
CustomTestCase,
ModelL... | 69 | 1,917 |
sglang | test/manual/kv_canary/test_self_e2e_baseline_dsv4.py | .py | from __future__ import annotations
import unittest
from test.registered.kv_canary.test_self_e2e_baseline import _BaselineBase
from sglang.test.kv_canary.consts import (
DSV4_POOL_SERVER_ARGS,
DSV4_POOL_SERVER_ENV,
)
class TestBaselineDsv4(_BaselineBase):
__test__ = True
model_mode = "dsv4"
extr... | 22 | 444 |
sglang | test/registered/stress/test_stress_glm_4_6.py | .py | """Stress test for GLM-4.6 model."""
import os
import unittest
from sglang.test.ci.ci_register import register_cuda_ci
from sglang.test.ci.ci_stress_utils import StressTestRunner
from sglang.test.test_utils import DEFAULT_URL_FOR_TEST
MODEL_PATH = "zai-org/GLM-4.6"
RANDOM_INPUT_LEN = 4096
RANDOM_OUTPUT_LEN = 512
OUT... | 52 | 1,543 |
sglang | test/registered/stress/test_stress_qwen3_235b.py | .py | """Stress test for Qwen3-235B model."""
import os
import unittest
from sglang.test.ci.ci_register import register_cuda_ci
from sglang.test.ci.ci_stress_utils import StressTestRunner
from sglang.test.test_utils import DEFAULT_URL_FOR_TEST
MODEL_PATH = "Qwen/Qwen3-235B-A22B-Instruct-2507"
RANDOM_INPUT_LEN = 4096
RANDO... | 52 | 1,578 |
sglang | test/registered/stress/test_stress_deepseek_v3.py | .py | """Stress test for DeepSeek-V3 model."""
import os
import unittest
from sglang.test.ci.ci_register import register_cuda_ci
from sglang.test.ci.ci_stress_utils import StressTestRunner
from sglang.test.test_utils import DEFAULT_URL_FOR_TEST
MODEL_PATH = "deepseek-ai/DeepSeek-V3"
RANDOM_INPUT_LEN = 16384
RANDOM_OUTPUT_... | 52 | 1,574 |
sglang | test/registered/stress/test_stress_kimi_k2.py | .py | """Stress test for Kimi-K2-Thinking model."""
import os
import unittest
from sglang.test.ci.ci_register import register_cuda_ci
from sglang.test.ci.ci_stress_utils import StressTestRunner
from sglang.test.test_utils import DEFAULT_URL_FOR_TEST
MODEL_PATH = "moonshotai/Kimi-K2-Thinking"
RANDOM_INPUT_LEN = 4096
RANDOM... | 60 | 1,799 |
sglang | test/registered/mem_cache/test_post_capture_kv_sizing.py | .py | """E2E guard for SGLANG_ENABLE_POST_CAPTURE_KV_SIZING.
Post-capture KV sizing reserves the KV pool as CUDA VMM virtual memory, captures
CUDA graphs, then sizes and physically backs the pool from measured free memory.
This test launches a server with the feature enabled and asserts that:
1. the post-capture sizing pa... | 101 | 3,316 |
sglang | test/registered/mem_cache/test_int8_checkpoint_store.py | .py | """Tests for Int8CheckpointStore (int8-compressed cached linear-attn states).
CPU tests cover the codec error bound, store/load round-trip, and the active-pool
copy-on-write helpers. The CUDA test reproduces the validated decode-output error
(int8 checkpoint loaded once then decoded continues bf16) ~ 0.5%, far below t... | 186 | 6,970 |
sglang | test/registered/gb300/test_qwen35_fp8.py | .py | import unittest
from sglang.test.accuracy_test_runner import AccuracyTestParams
from sglang.test.ci.ci_register import register_cuda_ci
from sglang.test.performance_test_runner import PerformanceTestParams
from sglang.test.run_combined_tests import run_combined_tests
from sglang.test.test_utils import ModelLaunchSetti... | 99 | 3,078 |
sglang | test/registered/gb300/test_deepseek_v4_pro_fp4.py | .py | import unittest
from sglang.test.accuracy_test_runner import AccuracyTestParams
from sglang.test.ci.ci_register import register_cuda_ci
from sglang.test.performance_test_runner import PerformanceTestParams
from sglang.test.run_combined_tests import run_combined_tests
from sglang.test.test_utils import ModelLaunchSetti... | 151 | 4,003 |
sglang | test/registered/gb300/test_kimi_k25_nvfp4.py | .py | import unittest
from sglang.test.accuracy_test_runner import AccuracyTestParams
from sglang.test.ci.ci_register import register_cuda_ci
from sglang.test.performance_test_runner import PerformanceTestParams
from sglang.test.run_combined_tests import run_combined_tests
from sglang.test.test_utils import ModelLaunchSetti... | 101 | 3,236 |
sglang | test/registered/gb300/test_glm52_nvfp4.py | .py | import unittest
from sglang.test.accuracy_test_runner import AccuracyTestParams
from sglang.test.ci.ci_register import register_cuda_ci
from sglang.test.performance_test_runner import PerformanceTestParams
from sglang.test.run_combined_tests import run_combined_tests
from sglang.test.test_utils import ModelLaunchSetti... | 71 | 2,014 |
sglang | test/registered/disaggregation/test_disaggregation_nixl.py | .py | import json
import os
import unittest
import uuid
from types import SimpleNamespace
import requests
from sglang.srt.environ import envs
from sglang.test.ci.ci_register import register_cuda_ci
from sglang.test.run_eval import run_eval
from sglang.test.server_fixtures.disaggregation_fixture import (
PDDisaggregatio... | 348 | 11,893 |
sglang | test/registered/disaggregation/test_disaggregation_xpu.py | .py | """
Disaggregation integration test for the NIXL transfer backend on Intel XPU.
Launches a prefill server, a decode server, and a load-balancer using the
NIXL KV-transfer backend, then verifies that basic text completion works
end-to-end. This exercises the np.uint64 pointer-arithmetic fix in
python/sglang/srt/disagg... | 94 | 3,277 |
sglang | test/registered/disaggregation/test_disaggregation_dp_attention.py | .py | import unittest
from types import SimpleNamespace
from sglang.benchmark.serving import run_benchmark
from sglang.srt.environ import envs
from sglang.test.ci.ci_register import register_cuda_ci
from sglang.test.run_eval import run_eval
from sglang.test.server_fixtures.disaggregation_fixture import (
PDDisaggregatio... | 135 | 4,132 |
sglang | test/registered/disaggregation/test_disaggregation_optimistic_prefill.py | .py | import time
import unittest
import uuid
from concurrent.futures import ThreadPoolExecutor, as_completed
from types import SimpleNamespace
import requests
from prometheus_client.parser import text_string_to_metric_families
from sglang.srt.disaggregation.prefill import should_force_retry
from sglang.srt.environ import ... | 207 | 7,216 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.