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/debug_utils/test_log_parser.py | .py | import json
import unittest
from sglang.srt.debug_utils import log_parser
from sglang.test.test_utils import CustomTestCase
class TestLogParser(CustomTestCase):
def test_log_parser(self):
lines = """
(SGLangEngine pid=35555) [2025-10-31 03:45:20 TP0] Decode batch [51341], #running-req: 317, #token: 10942... | 29 | 2,506 |
sglang | test/manual/debug_utils/run_with_retry.py | .py | """
Simple wrapper to run a test file with retry logic.
Usage:
python3 -m sglang.test.ci.run_with_retry test_file.py [--max-attempts 2] [--retry-wait 60]
"""
import argparse
import sys
from sglang.test.ci.ci_utils import TestFile, run_unittest_files
def main():
parser = argparse.ArgumentParser(description=... | 54 | 1,364 |
sglang | test/manual/debug_utils/test_dump_metric.py | .py | """Unit tests for dump_metric() function."""
import json
import os
import tempfile
import unittest
from pathlib import Path
from sglang.test.test_utils import dump_metric
class TestDumpMetric(unittest.TestCase):
"""Test suite for dump_metric() function."""
_ENV_KEYS_TO_CLEAN = ["SGLANG_TEST_METRICS_OUTPUT"... | 133 | 4,734 |
sglang | test/manual/debug_utils/get_logits_ut.py | .py | import torch
import torch.nn as nn
class DummyModel(nn.Module):
def __init__(self, d_in=2048, n_heads=128, softmax_scale=0.5):
super().__init__()
self.weights_proj = nn.Linear(d_in, 1024)
self.n_heads = n_heads
self.softmax_scale = softmax_scale
def _get_logits_head_gate_orig(... | 58 | 1,822 |
sglang | test/manual/entrypoints/http_server/test_abort_request.py | .py | """
Integration test for abort_request functionality with a SGLang server.
Run with:
python -m unittest sglang.test.srt.entrypoints.http_server.test_abort_request -v
"""
import threading
import time
import unittest
import requests
from sglang.srt.utils import kill_process_tree
from sglang.test.test_utils import... | 206 | 6,932 |
sglang | test/manual/piecewise_cuda_graph/test_piecewise_cuda_graph_support_1_gpu_archived.py | .py | """Archived test classes split out of test/registered/piecewise_cuda_graph/test_piecewise_cuda_graph_support_1_gpu.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/piecewise_cuda_graph/test_pie... | 64 | 2,029 |
sglang | test/manual/nightly/test_vlms_piecewise_cuda_graph.py | .py | import argparse
import glob
import json
import os
import random
import sys
import unittest
from types import SimpleNamespace
from sglang.srt.utils import kill_process_tree
from sglang.test.kits.mmmu_vlm_kit import _run_lmms_eval_with_retry
from sglang.test.test_utils import (
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
... | 263 | 8,689 |
sglang | test/manual/nightly/test_deepseek_v31_perf.py | .py | import unittest
from sglang.test.nightly_utils import NightlyBenchmarkRunner
from sglang.test.test_utils import DEFAULT_URL_FOR_TEST, _parse_int_list_env
DEEPSEEK_V31_MODEL_PATH = "deepseek-ai/DeepSeek-V3.1"
RESULT_DIR = "performance_results_deepseek_v31"
class TestNightlyDeepseekV31Performance(unittest.TestCase):
... | 87 | 2,991 |
sglang | test/manual/nightly/test_deepseek_v32_perf.py | .py | import unittest
from sglang.test.nightly_utils import NightlyBenchmarkRunner
from sglang.test.test_utils import DEFAULT_URL_FOR_TEST, _parse_int_list_env
DEEPSEEK_V32_MODEL_PATH = "deepseek-ai/DeepSeek-V3.2"
RESULT_DIR = "performance_results_deepseek_v32"
class TestNightlyDeepseekV32Performance(unittest.TestCase):
... | 128 | 4,385 |
sglang | test/manual/nightly/test_vlms_vit_cuda_graph.py | .py | import argparse
import glob
import json
import os
import random
import sys
import unittest
from types import SimpleNamespace
from sglang.srt.utils import kill_process_tree
from sglang.test.kits.mmmu_vlm_kit import _run_lmms_eval_with_retry
from sglang.test.test_utils import (
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
... | 269 | 9,015 |
sglang | test/manual/nightly/test_vlms_vit_flashinfer_cudnn.py | .py | import argparse
import glob
import json
import os
import random
import sys
import unittest
from types import SimpleNamespace
from sglang.srt.utils import kill_process_tree
from sglang.test.kits.mmmu_vlm_kit import _run_lmms_eval_with_retry
from sglang.test.test_utils import (
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
... | 259 | 8,513 |
sglang | test/manual/chunked_prefill/test_e2e_pd_pp.py | .py | import unittest
from sglang.test.chunked_prefill_test_utils import ChunkedTestPDBase
class TestChunkedFeaturePDPP(ChunkedTestPDBase):
__test__ = True
gsm8k_threshold = 0.50
feature_args = [
"--tp-size",
"2",
"--pp-size",
"2",
"--disable-overlap-schedule",
]
... | 26 | 472 |
sglang | test/manual/chunked_prefill/test_e2e_dp_attention.py | .py | import unittest
from sglang.test.chunked_prefill_test_utils import ChunkedTestBase
from sglang.test.test_utils import DEFAULT_MLA_MODEL_NAME_FOR_TEST
class TestChunkedFeatureDPAttention(ChunkedTestBase):
__test__ = True
use_kv_canary = False
model = DEFAULT_MLA_MODEL_NAME_FOR_TEST
gsm8k_threshold = 0... | 24 | 522 |
sglang | test/manual/chunked_prefill/test_scripted_spec.py | .py | import unittest
from sglang.test.scripted_runtime.context import ScriptedContext
from sglang.test.scripted_runtime.test_case import ScriptedTestCase
from sglang.test.scripted_runtime_chunked_helpers import (
DEFAULT_CHUNK_SIZE,
VERY_LONG_PROMPT_LEN,
base_engine_kwargs,
run_until,
run_until_finished... | 68 | 2,150 |
sglang | test/manual/chunked_prefill/test_scripted_pp.py | .py | import unittest
from typing import Any, Dict
from sglang.test.scripted_runtime.context import ScriptedContext
from sglang.test.scripted_runtime.test_case import ScriptedTestCase
from sglang.test.scripted_runtime_chunked_helpers import (
DEFAULT_CHUNK_SIZE,
VERY_LONG_PROMPT_LEN,
base_engine_kwargs,
run_... | 247 | 9,559 |
sglang | test/manual/chunked_prefill/test_scripted_hybrid_swa.py | .py | import unittest
from sglang.test.scripted_runtime.context import ScriptedContext
from sglang.test.scripted_runtime.test_case import ScriptedTestCase
from sglang.test.scripted_runtime_chunked_helpers import (
DEFAULT_CHUNK_SIZE,
VERY_LONG_PROMPT_LEN,
base_engine_kwargs,
run_until,
run_until_finished... | 181 | 6,636 |
sglang | test/manual/chunked_prefill/test_scripted_abort.py | .py | import unittest
from sglang.srt.environ import envs
from sglang.test.scripted_runtime.context import ScriptedContext
from sglang.test.scripted_runtime.req_handle import ScriptedReqHandle
from sglang.test.scripted_runtime.test_case import ScriptedTestCase
from sglang.test.scripted_runtime_chunked_helpers import (
D... | 644 | 23,163 |
sglang | test/manual/chunked_prefill/test_e2e_hybrid_swa.py | .py | import unittest
from sglang.test.chunked_prefill_test_utils import (
LONG_PROMPT_NUM_SHOTS,
ChunkedTestBase,
)
class TestChunkedFeatureHybridSWA(ChunkedTestBase):
__test__ = True
model = "openai/gpt-oss-20b"
num_shots = LONG_PROMPT_NUM_SHOTS
gsm8k_threshold = 0.50
feature_args = [
... | 23 | 459 |
sglang | test/manual/chunked_prefill/test_scripted_multi_req.py | .py | import unittest
from sglang.test.scripted_runtime.context import ScriptedContext
from sglang.test.scripted_runtime.test_case import ScriptedTestCase
from sglang.test.scripted_runtime_chunked_helpers import (
BALLAST_MAX_NEW_TOKENS,
DEFAULT_CHUNK_SIZE,
DEFAULT_MAX_STEPS,
VERY_LONG_PROMPT_LEN,
base_e... | 538 | 20,877 |
sglang | test/manual/chunked_prefill/test_scripted_http_smoke.py | .py | import unittest
from sglang.test.scripted_runtime.context import ScriptedContext
from sglang.test.scripted_runtime.test_case import ScriptedTestCase
from sglang.test.scripted_runtime_chunked_helpers import (
DEFAULT_CHUNK_SIZE,
base_engine_kwargs,
run_until_finished,
)
class TestScriptedHttpSmoke(Scripte... | 50 | 1,627 |
sglang | test/manual/chunked_prefill/test_e2e_disagg.py | .py | import unittest
from sglang.test.chunked_prefill_test_utils import ChunkedTestPDBase
class TestChunkedFeatureDisagg(ChunkedTestPDBase):
__test__ = True
use_kv_canary = False
gsm8k_threshold = 0.50
if __name__ == "__main__":
unittest.main()
| 14 | 261 |
sglang | test/manual/chunked_prefill/test_scripted_sampling.py | .py | import unittest
from sglang.srt.managers.schedule_batch import FINISH_LENGTH, FINISH_MATCHED_TOKEN
from sglang.test.scripted_runtime.context import ScriptedContext
from sglang.test.scripted_runtime.test_case import ScriptedTestCase
from sglang.test.scripted_runtime_chunked_helpers import (
DEFAULT_CHUNK_SIZE,
... | 275 | 9,913 |
sglang | test/manual/chunked_prefill/test_scripted_priority.py | .py | import unittest
from sglang.test.scripted_runtime.context import ScriptedContext
from sglang.test.scripted_runtime.test_case import ScriptedTestCase
from sglang.test.scripted_runtime_chunked_helpers import (
BALLAST_MAX_NEW_TOKENS,
DEFAULT_CHUNK_SIZE,
VERY_LONG_PROMPT_LEN,
base_engine_kwargs,
run_u... | 310 | 11,247 |
sglang | test/manual/chunked_prefill/test_e2e_spec.py | .py | import unittest
from sglang.test.chunked_prefill_test_utils import ChunkedTestBase
class TestChunkedFeatureSpec(ChunkedTestBase):
__test__ = True
use_kv_canary = False
model = "Qwen/Qwen3-8B"
gsm8k_threshold = 0.50
feature_args = [
"--speculative-algorithm",
"EAGLE3",
"--s... | 29 | 642 |
sglang | test/manual/chunked_prefill/test_scripted_kv_pressure.py | .py | import unittest
from sglang.test.scripted_runtime.context import ScriptedContext
from sglang.test.scripted_runtime.test_case import ScriptedTestCase
from sglang.test.scripted_runtime_chunked_helpers import (
BALLAST_MAX_NEW_TOKENS,
DEFAULT_CHUNK_SIZE,
DEFAULT_MAX_STEPS,
SMALL_KV_POOL_BALLAST_MAX_NEW_TO... | 551 | 19,828 |
sglang | test/manual/chunked_prefill/test_e2e_pp.py | .py | import unittest
from sglang.test.chunked_prefill_test_utils import ChunkedTestBase
class TestChunkedFeaturePP(ChunkedTestBase):
__test__ = True
gsm8k_threshold = 0.50
feature_args = [
"--tp-size",
"2",
"--pp-size",
"2",
"--enable-dynamic-chunking",
]
if __nam... | 20 | 359 |
sglang | test/manual/chunked_prefill/test_scripted_radix.py | .py | import unittest
from sglang.test.scripted_runtime.context import ScriptedContext
from sglang.test.scripted_runtime.test_case import ScriptedTestCase
from sglang.test.scripted_runtime_chunked_helpers import (
DEFAULT_CHUNK_SIZE,
DEFAULT_MAX_STEPS,
VERY_LONG_PROMPT_LEN,
base_engine_kwargs,
run_until,... | 742 | 28,690 |
sglang | test/manual/chunked_prefill/test_e2e_lora_overlap.py | .py | import unittest
from sglang.test.chunked_prefill_test_utils import ChunkedTestBase
class TestChunkedFeatureLoRAOverlap(ChunkedTestBase):
__test__ = True
model = "meta-llama/Llama-3.2-1B-Instruct"
gsm8k_threshold = 0.20
feature_args = [
"--enable-lora",
"--enable-lora-overlap-loading",... | 27 | 656 |
sglang | test/manual/chunked_prefill/test_e2e_piecewise_cuda_graph.py | .py | import unittest
from sglang.test.chunked_prefill_test_utils import ChunkedTestBase
from sglang.test.test_utils import DEFAULT_SMALL_MODEL_NAME_FOR_TEST
class TestChunkedFeaturePiecewiseCudaGraph(ChunkedTestBase):
__test__ = True
use_kv_canary = False
model = DEFAULT_SMALL_MODEL_NAME_FOR_TEST
gsm8k_th... | 17 | 406 |
sglang | test/manual/chunked_prefill/test_e2e_page_size.py | .py | import unittest
from sglang.test.chunked_prefill_test_utils import ChunkedTestBase
from sglang.test.test_utils import DEFAULT_SMALL_MODEL_NAME_FOR_TEST
class TestChunkedFeaturePageSize(ChunkedTestBase):
__test__ = True
model = DEFAULT_SMALL_MODEL_NAME_FOR_TEST
gsm8k_threshold = 0.30
feature_args = [
... | 19 | 412 |
sglang | test/manual/chunked_prefill/test_scripted_page_size.py | .py | import unittest
from sglang.test.scripted_runtime.context import ScriptedContext
from sglang.test.scripted_runtime.test_case import ScriptedTestCase
from sglang.test.scripted_runtime_chunked_helpers import (
base_engine_kwargs,
run_until_finished,
)
class TestPageSize16ChunkSize16(ScriptedTestCase):
ENGI... | 107 | 3,749 |
sglang | test/manual/chunked_prefill/test_scripted_lora_overlap.py | .py | import unittest
from sglang.srt.lora.lora_registry import LoRARef
from sglang.test.scripted_runtime.context import ScriptedContext
from sglang.test.scripted_runtime.test_case import ScriptedTestCase
from sglang.test.scripted_runtime_chunked_helpers import (
DEFAULT_CHUNK_SIZE,
VERY_LONG_PROMPT_LEN,
base_en... | 192 | 6,866 |
sglang | test/manual/chunked_prefill/test_scripted_lora.py | .py | import unittest
from sglang.test.scripted_runtime.context import ScriptedContext
from sglang.test.scripted_runtime.test_case import ScriptedTestCase
from sglang.test.scripted_runtime_chunked_helpers import (
DEFAULT_CHUNK_SIZE,
VERY_LONG_PROMPT_LEN,
base_engine_kwargs,
run_until,
run_until_all_fini... | 241 | 8,083 |
sglang | test/manual/chunked_prefill/test_scripted_regression.py | .py | import unittest
from sglang.test.scripted_runtime.context import ScriptedContext
from sglang.test.scripted_runtime.test_case import ScriptedTestCase
from sglang.test.scripted_runtime_chunked_helpers import (
DEFAULT_CHUNK_SIZE,
DEFAULT_MAX_STEPS,
VERY_LONG_PROMPT_LEN,
base_engine_kwargs,
run_until,... | 525 | 20,244 |
sglang | test/manual/chunked_prefill/test_scripted_max_new_tokens.py | .py | import unittest
from typing import List
from sglang.test.scripted_runtime.context import ScriptedContext
from sglang.test.scripted_runtime.scheduler_hook import ScriptedBatchRecord
from sglang.test.scripted_runtime.test_case import ScriptedTestCase
from sglang.test.scripted_runtime_chunked_helpers import (
DEFAULT... | 168 | 6,391 |
sglang | test/manual/chunked_prefill/test_scripted_chunk_size.py | .py | import unittest
from sglang.test.scripted_runtime.context import ScriptedContext
from sglang.test.scripted_runtime.test_case import ScriptedTestCase
from sglang.test.scripted_runtime_chunked_helpers import (
DEFAULT_CHUNK_SIZE,
base_engine_kwargs,
run_until,
run_until_finished,
)
def _expected_chunks... | 362 | 12,998 |
sglang | test/manual/chunked_prefill/test_scripted_invariants.py | .py | import unittest
from sglang.test.scripted_runtime.context import ScriptedContext
from sglang.test.scripted_runtime.test_case import ScriptedTestCase
from sglang.test.scripted_runtime_chunked_helpers import (
DEFAULT_CHUNK_SIZE,
DEFAULT_MAX_STEPS,
VERY_LONG_PROMPT_LEN,
base_engine_kwargs,
run_until,... | 513 | 20,418 |
sglang | test/manual/chunked_prefill/test_e2e_priority.py | .py | import unittest
from sglang.test.chunked_prefill_test_utils import ChunkedTestBase
from sglang.test.test_utils import DEFAULT_SMALL_MODEL_NAME_FOR_TEST
class TestChunkedFeaturePriority(ChunkedTestBase):
__test__ = True
model = DEFAULT_SMALL_MODEL_NAME_FOR_TEST
gsm8k_threshold = 0.30
feature_args = [
... | 22 | 510 |
sglang | test/manual/chunked_prefill/test_scripted_special_case.py | .py | import unittest
from typing import Optional
from sglang.test.scripted_runtime.context import ScriptedContext
from sglang.test.scripted_runtime.test_case import ScriptedTestCase
from sglang.test.scripted_runtime_chunked_helpers import (
DEFAULT_CHUNK_SIZE,
DEFAULT_MAX_STEPS,
SMALL_KV_POOL_BALLAST_MAX_NEW_TO... | 1,255 | 48,105 |
sglang | test/manual/chunked_prefill/test_e2e_lora.py | .py | import unittest
from sglang.test.chunked_prefill_test_utils import ChunkedTestBase
class TestChunkedFeatureLoRA(ChunkedTestBase):
__test__ = True
model = "meta-llama/Llama-3.2-1B-Instruct"
gsm8k_threshold = 0.20
feature_args = [
"--enable-lora",
"--lora-paths",
"nicoboss/Llama... | 26 | 608 |
sglang | test/manual/chunked_prefill/test_scripted_lifecycle.py | .py | import unittest
from sglang.srt.managers.schedule_batch import FINISH_ABORT
from sglang.test.scripted_runtime.context import ScriptedContext
from sglang.test.scripted_runtime.test_case import ScriptedTestCase
from sglang.test.scripted_runtime_chunked_helpers import (
DEFAULT_CHUNK_SIZE,
DEFAULT_MAX_STEPS,
... | 441 | 16,448 |
sglang | test/manual/chunked_prefill/test_scripted_piecewise_cuda_graph.py | .py | import unittest
from sglang.test.scripted_runtime.context import ScriptedContext
from sglang.test.scripted_runtime.test_case import ScriptedTestCase
from sglang.test.scripted_runtime_chunked_helpers import (
DEFAULT_CHUNK_SIZE,
VERY_LONG_PROMPT_LEN,
base_engine_kwargs,
run_until,
run_until_finished... | 68 | 2,158 |
sglang | test/manual/chunked_prefill/test_e2e_radix.py | .py | import unittest
from sglang.test.chunked_prefill_test_utils import ChunkedTestBase
from sglang.test.test_utils import DEFAULT_SMALL_MODEL_NAME_FOR_TEST
class TestChunkedFeatureRadix(ChunkedTestBase):
__test__ = True
model = DEFAULT_SMALL_MODEL_NAME_FOR_TEST
gsm8k_threshold = 0.30
feature_args = [
... | 21 | 464 |
sglang | test/manual/distributed/test_dp_attention_archived.py | .py | """Archived test classes split out of test/registered/distributed/test_dp_attention.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/distributed/test_dp_attention_archived.py`.
"""
import unit... | 102 | 3,042 |
sglang | test/manual/distributed/test_dp_attention_large.py | .py | import unittest
from types import SimpleNamespace
import requests
from sglang.srt.utils import kill_process_tree
from sglang.test.kits.ebnf_constrained_kit import EBNFConstrainedMixin
from sglang.test.kits.json_constrained_kit import JSONConstrainedMixin
from sglang.test.kits.regex_constrained_kit import RegexConstra... | 202 | 6,186 |
sglang | test/manual/minimax_m3/test_npu_memory_pool.py | .py | import importlib.util
import sys
import types
from contextlib import nullcontext
from pathlib import Path
import torch
class _FakeMemorySaverAdapter:
def region(self, _memory_type):
return nullcontext()
class _FakeKVCache:
def __init__(
self,
size,
page_size,
dtype,
... | 177 | 4,850 |
sglang | test/manual/minimax_m3/test_npu_topk.py | .py | import importlib.util
import sys
import types
from pathlib import Path
from typing import NamedTuple
import torch
def _install_fake_modules():
for name in (
"sglang",
"sglang.srt",
"sglang.srt.eplb",
"sglang.srt.layers",
"sglang.srt.layers.moe",
"sglang.srt.state_c... | 194 | 6,841 |
sglang | test/manual/eval/validate_longbench_v2.py | .py | #!/usr/bin/env python3
"""
Validation script for LongBench-v2 implementation.
This script validates our implementation against official LongBench-v2 format and benchmarks.
"""
import json
import os
import tempfile
from typing import Any, Dict, List
from sglang.test.simple_eval_longbench_v2 import (
LongBenchV2Eva... | 338 | 11,635 |
sglang | test/manual/eval/validate_longbench_v2_standalone.py | .py | #!/usr/bin/env python3
"""
Standalone validation script for LongBench-v2 implementation.
Tests core functionality without requiring full SGLang dependencies.
"""
import json
import os
import re
import tempfile
from typing import Any, Dict, List, Optional
ANSWER_PATTERN_MULTICHOICE = r"(?i)(?:the\s+)?(?:correct\s+)?(?... | 307 | 10,909 |
sglang | test/manual/eval/test_eval_accuracy_large.py | .py | """
Usage:
python -m unittest test_eval_accuracy_large.TestEvalAccuracyLarge.test_mmlu
"""
import unittest
from sglang.srt.utils import kill_process_tree
from sglang.test.kits.eval_accuracy_kit import HumanEvalMixin, MGSMEnMixin, MMLUMixin
from sglang.test.test_utils import (
DEFAULT_MODEL_NAME_FOR_TEST,
DEFA... | 43 | 1,143 |
sglang | test/manual/eval/test_longbench_v2_eval.py | .py | """
Test cases for LongBench-v2 evaluation utility.
"""
import json
import os
import tempfile
from sglang.test.simple_eval_longbench_v2 import (
LongBenchV2Eval,
extract_longbench_v2_answer,
format_longbench_v2_question,
)
def test_format_longbench_v2_question():
"""Test the official LongBench-v2 qu... | 239 | 7,352 |
sglang | test/manual/kv_transfer/test_mooncake_transfer_engine_init.py | .py | #!/usr/bin/env python3
"""
Test script for validating Mooncake transfer-engine gating and initialization.
Tests the Mooncake-related branches in the current model-runner flow.
This test verifies:
1. MooncakeTransferEngine initialization conditions
2. Different server argument combinations that trigger mooncake TE
3. M... | 434 | 13,272 |
sglang | test/manual/kv_transfer/test_mooncake_transfer_engine.py | .py | #!/usr/bin/env python3
import argparse
try:
import mooncake
BENCH_TOOL_PATH = f"{mooncake.__path__[0]}/transfer_engine_bench"
print(f"Mooncake is installed. Bench tool path:\n{BENCH_TOOL_PATH}")
except ImportError:
BENCH_TOOL_PATH = None
print("Mooncake is not installed.")
exit(0)
def run_cm... | 65 | 1,955 |
sglang | test/manual/spec/test_spec_ngram_fa3.py | .py | """NGRAM speculative-decoding test, FA3 attention-backend variant.
Backend: `--attention-backend fa3`.
Not registered in any CI suite -- runnable manually only.
"""
import unittest
from sglang.test.kits.eval_accuracy_kit import GSM8KMixin
from sglang.test.server_fixtures.ngram_fixture import NgramServerBase
class ... | 19 | 462 |
sglang | test/manual/spec/eagle/test_eagle3_basic.py | .py | import unittest
from types import SimpleNamespace
import requests
from sglang.srt.utils import is_hip
from sglang.test.run_eval import run_eval
from sglang.test.server_fixtures.eagle_fixture import EagleServerBase
from sglang.test.test_utils import (
DEFAULT_DRAFT_MODEL_EAGLE3,
DEFAULT_TARGET_MODEL_EAGLE3,
)
... | 64 | 1,643 |
sglang | test/manual/hicache/test_disaggregation_hicache.py | .py | import os
import random
import tempfile
import unittest
from typing import Dict
import requests
from sglang.benchmark.utils import get_tokenizer
from sglang.test.server_fixtures.disaggregation_fixture import (
PDDisaggregationServerBase,
)
from sglang.test.test_utils import (
DEFAULT_MODEL_NAME_FOR_TEST,
... | 258 | 7,906 |
sglang | test/manual/hicache/test_pp_with_hicache.py | .py | """
Usage:
python3 -m unittest test_pp_with_hicache.TestPPWithHiCache.test_eval_accuracy
"""
import os
import subprocess
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.run_eval import run_... | 215 | 6,982 |
sglang | test/manual/dsv4/test_dsv4_flash_mtp_dp4.py | .py | """DSV4 Flash MTP test using EAGLE speculative algorithm.
DSV4 Flash MTP shares the EAGLE wire path: EAGLE algo + NextN head built
into the target model weights. No separate draft model is needed (sglang
auto-falls back `--speculative-draft-model-path` to the target model).
Test matrix mirrors test_eagle_infer_b.Test... | 176 | 5,727 |
sglang | test/manual/dsv4/test_h200_fp8_flash.py | .py | """H200 (FP8) x DeepSeek-V4-Flash.
Uses the FP8-repackaged repo (sgl-project/DeepSeek-V4-Flash-FP8) and
the SGLANG_DSV4_FP4_EXPERTS=0 env that the cookbook generator emits
for H200 FP8 cells. Covers Low-Latency, Balanced, Max-Throughput, CP.
"""
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname... | 121 | 2,902 |
sglang | test/manual/dsv4/test_gb300_pro.py | .py | """GB300 x DeepSeek-V4-Pro.
Single-node TP=4 path. Note that GB300 Pro CP bumps
mem-fraction-static to 0.88 (1.6T weights at TP=4 on 273 GB don't
fit at the default 0.78). Covers Low-Latency, Balanced,
Max-Throughput, Context-Parallel (CP).
"""
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(... | 127 | 3,050 |
sglang | test/manual/dsv4/test_h200_fp8_pro.py | .py | """H200 (FP8) x DeepSeek-V4-Pro.
The cookbook ships this cell as a multi-node (2 nodes, TP=16) launch
using the FP8-repackaged repo (sgl-project/DeepSeek-V4-Pro-FP8).
Each test class skips itself unless DSV4_NODE_RANK and
DSV4_DIST_INIT_ADDR are exported. Runtime expectation:
On every node:
DSV4_NODE_RANK... | 127 | 3,282 |
sglang | test/manual/dsv4/test_dsv4_pro_mtp.py | .py | """DSV4-Pro 1.6T MTP performance tests on B200 TP=8.
1. TestDSV4ProMTPSimulatedAcc — `SGLANG_SIMULATE_ACC_LEN=3` pins EAGLE accept
length so latency comparisons are apples-to-apples. Runs `bench_one_batch_server`
at bs=1 for isl=4096 and isl=900000 (osl=1024).
2. TestDSV4ProMTPHongloumeng — real EAGLE accept (n... | 279 | 9,580 |
sglang | test/manual/dsv4/test_b300_flash.py | .py | """B300 x DeepSeek-V4-Flash.
The cookbook generator aliases B300 to B200, so the launch flags
are identical to the B200(FP4) Flash cell. Kept as a separate file
because the hardware target (and therefore the runtime environment)
is different. Covers Low-Latency, Balanced, Max-Throughput, CP.
"""
import os
import sys
... | 111 | 2,720 |
sglang | test/manual/dsv4/test_dsv4_flash_sanity_tp8.py | .py | """DSV4-Flash 8-GPU server sanity (TP8, no spec decoding)."""
import unittest
from sglang.srt.utils import kill_process_tree
from sglang.test.kits.basic_decode_correctness_kit import BasicDecodeCorrectnessMixin
from sglang.test.test_utils import (
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
DEFAULT_URL_FOR_TEST,
C... | 54 | 1,342 |
sglang | test/manual/dsv4/test_fused_compress_attn_hip.py | .py | """Unit tests for the fused compressor attention Triton kernel on HIP.
Validates numerical parity between the fused single-kernel path (plan-driven
Triton) and the reference per-seq Python implementation.
Usage:
python -m pytest test/manual/dsv4/test_fused_compress_attn_hip.py -v
# or directly:
python tes... | 466 | 14,661 |
sglang | test/manual/dsv4/_common.py | .py | """Shared fixture for DeepSeek-V4 cookbook launch-command tests.
Each sibling ``test_<hardware>_<model_size>.py`` declares ONE
``hardware x model_size`` cell from the cookbook (e.g. B200 x Flash)
and contains one ``CustomTestCase`` subclass per recipe
(Low-Latency / Balanced / Max-Throughput / CP, where supported).
E... | 318 | 11,937 |
sglang | test/manual/dsv4/test_dsv4_flash_sanity_dp4.py | .py | """DSV4-Flash 4-GPU server sanity matrix (TP4 variants)."""
import unittest
from sglang.srt.utils import kill_process_tree
from sglang.test.kits.basic_decode_correctness_kit import BasicDecodeCorrectnessMixin
from sglang.test.test_utils import (
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
DEFAULT_URL_FOR_TEST,
Cus... | 161 | 4,132 |
sglang | test/manual/dsv4/test_wo_a_fp8_sm90.py | .py | """Manual correctness check for DeepSeek-V4 fp8 wo_a (deep_gemm.fp8_einsum path).
Mirrors models/deepseek_v4.py MQALayer wo_a: quantize the token-major attention
output [T, G, D] per-token-group(128) to fp8, then run the grouped matmul over the
group/head dim via deep_gemm.fp8_einsum("bhr,hdr->bhd") -> [T, G, R], and ... | 142 | 4,495 |
sglang | test/manual/dsv4/test_b300_pro.py | .py | """B300 x DeepSeek-V4-Pro.
The cookbook generator aliases B300 to B200, so the launch flags
are identical to the B200(FP4) Pro cell. Kept as a separate file
because the hardware target (and therefore the runtime environment)
is different. Covers Low-Latency, Balanced, Max-Throughput, CP.
"""
import os
import sys
impo... | 127 | 3,094 |
sglang | test/manual/dsv4/test_b200_pro.py | .py | """B200 (FP4) x DeepSeek-V4-Pro.
Covers the four cookbook recipes for this hardware x model_size cell:
Low-Latency, Balanced, Max-Throughput, Context-Parallel (CP).
"""
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from _common import DEEPEP_LARGE_SMS_CONFIG, DSV... | 125 | 2,970 |
sglang | test/manual/dsv4/test_b200_flash.py | .py | """B200 (FP4) x DeepSeek-V4-Flash.
Covers the four cookbook recipes for this hardware x model_size cell:
Low-Latency, Balanced, Max-Throughput, Context-Parallel (CP).
"""
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from _common import DEEPEP_LARGE_SMS_CONFIG, D... | 109 | 2,594 |
sglang | test/manual/dsv4/test_h200_fp4_pro.py | .py | """H200 (FP4 / Marlin) x DeepSeek-V4-Pro.
The cookbook disables Context-Parallel for the H200 FP4 (Marlin)
hardware, so this file only covers Low-Latency, Balanced, and
Max-Throughput.
"""
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from _common import DSV4ProA... | 78 | 1,665 |
sglang | test/manual/dsv4/test_gb300_flash.py | .py | """GB300 x DeepSeek-V4-Flash.
Single-node TP=4 path on the deepseek-ai MXFP4 repo. Covers
Low-Latency, Balanced, Max-Throughput, Context-Parallel (CP).
"""
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from _common import DEEPEP_LARGE_SMS_CONFIG, DSV4FlashAime25T... | 109 | 2,583 |
sglang | test/manual/dsv4/test_h200_fp4_flash.py | .py | """H200 (FP4 / Marlin) x DeepSeek-V4-Flash.
The cookbook disables Context-Parallel for the H200 FP4 (Marlin)
hardware, so this file only covers Low-Latency, Balanced, and
Max-Throughput.
"""
import os
import sys
import unittest
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
from _common import DSV4Fl... | 72 | 1,536 |
sglang | test/manual/dsv4/test_dsv4_pd_disagg_nixl.py | .py | """DSV4 Flash PD-disagg with NIXL backend. Both sides run dp-attention
+ deepep + EAGLE MTP so attn_tp_size and the V4 state pool layout are
fully symmetric: same SWA item_len under matching attn_tp, and same
DSA c4/c128 indexer ring buffer size under matching spec status. nixl
`send_state` is page-by-index and has no ... | 149 | 4,478 |
sglang | test/manual/dsv4/test_dsv4_swa_radix_retract.py | .py | """DSV4 stress test for SWA radix cache + tombstone + retract interaction.
Reproduces the assert in `swa_radix_cache.cache_unfinished_req`:
assert old_prefix_len <= len(new_indices)
Trip conditions (all required):
1. Fork-only SWA leaf early-release on (`SGLANG_OPT_SWA_RELEASE_LEAF_LOCK_AFTER_WINDOW=1`)
2. Mu... | 166 | 5,971 |
sglang | test/manual/dsv4/test_dsv4_flash_mtp_tp8.py | .py | """DSV4-Flash 285B MTP performance tests on H200 TP=8.
Manual test (8× H200, 285B FP8 weights). Not registered in CI.
"""
import os
import tempfile
import unittest
import requests
from sglang.bench_one_batch_server import BenchArgs as OneBatchBenchArgs
from sglang.bench_one_batch_server import run_benchmark as run_... | 123 | 3,699 |
sglang | test/manual/prefill_only/test_encoder_embedding_models.py | .py | import multiprocessing as mp
import random
import time
import unittest
import torch
from transformers import AutoConfig, AutoTokenizer
from sglang.test.runners import DEFAULT_PROMPTS, HFRunner, SRTRunner
from sglang.test.test_utils import CustomTestCase, get_similarities, is_in_ci
# Encoder embedding model tests (CU... | 166 | 5,969 |
sglang | test/manual/prefill_only/test_cross_encoder_models.py | .py | import multiprocessing as mp
import random
import unittest
import torch
from sglang.test.runners import TEST_RERANK_QUERY_DOCS, HFRunner, SRTRunner
from sglang.test.test_utils import CustomTestCase, is_in_ci
# Cross encoder model tests
MODELS = [
("cross-encoder/ms-marco-MiniLM-L6-v2", 1, 1e-2),
("BAAI/bge... | 94 | 2,659 |
sglang | test/manual/8-gpu-models/test_dsa_models_basic.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_TIMEOUT_FOR_SERVER_LAUNCH,
DEFAULT_URL_FOR_TEST,
CustomTestCase... | 260 | 7,658 |
sglang | test/manual/8-gpu-models/test_deepseek_v3_basic.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_TIMEOUT_FOR_SERVER_LAUNCH,
DEFAULT_URL_FOR_TEST,
CustomTestCase... | 83 | 2,387 |
sglang | test/manual/8-gpu-models/test_llama4.py | .py | """Moved out of test/registered/8-gpu-models/.
Originally registered with `register_cuda_ci(...)` on the nightly 8-gpu-h200 and
8-gpu-b200 suites. Moved here because nobody serves Llama 4 any more, and the CI
HF account has no access to meta-llama/Llama-4-Scout-17B-16E-Instruct either, so
it had been skipping for a wh... | 61 | 1,961 |
sglang | test/manual/piecewise_cudagraph/test_disaggregation_piecewise_cuda_graph.py | .py | import unittest
from types import SimpleNamespace
from sglang.test.run_eval import run_eval
from sglang.test.server_fixtures.disaggregation_fixture import (
PDDisaggregationServerBase,
)
from sglang.test.test_utils import (
DEFAULT_MODEL_NAME_FOR_TEST,
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
popen_launch_pd... | 89 | 2,563 |
sglang | test/manual/perf/test_bench_one_batch_1gpu.py | .py | import os
import re
import subprocess
import unittest
import numpy as np
from sglang.test.test_utils import (
DEFAULT_MODEL_NAME_FOR_TEST,
DEFAULT_SMALL_MODEL_NAME_FOR_TEST,
CustomTestCase,
is_in_ci,
kill_process_tree,
run_bench_one_batch,
write_github_step_summary,
)
class TestBenchOneB... | 95 | 2,845 |
sglang | test/manual/vlm/verify_single_image_gather.py | .py | #!/usr/bin/env python3
"""Verify the single-image broadcast fast path vs the pad-to-max all_gather:
bitwise equivalence + timing, on real NCCL over 8 ranks. Mirrors what
run_dp_sharded_mrope_vision_model does for a single image (one owner rank
holds the embedding, the rest are empty). torchrun --nproc_per_node=8."""
i... | 89 | 3,027 |
sglang | test/manual/vlm/verify_k25_equivalence.py | .py | """Prove the two GPU-only rewrites in the K2.5 port are equivalent to main.
1. normalize_and_patchify(scale/bias) == pad -> /255 -> (x-mean)*inv_std -> patchify
2. apply_fused_qk_complex_rope_inplace == the torch complex reference
"""
import torch
import torch.nn.functional as F
from sglang.kernels.ops.attention.vis... | 146 | 5,856 |
sglang | test/manual/vlm/test_mm_utils.py | .py | import unittest
from unittest.mock import Mock, patch
import torch
from sglang.srt.managers import mm_utils, schedule_batch
from sglang.srt.managers.schedule_batch import (
Modality,
MultimodalDataItem,
MultimodalInputs,
)
def _make_proxy_with_reconstruct_result(tensor: torch.Tensor):
proxy = mm_uti... | 103 | 3,880 |
sglang | test/manual/vlm/test_anthropic_vision.py | .py | """
Tests for Anthropic-compatible image input via the /v1/messages endpoint.
python3 anthorpic_api/test/manual/vlm/test_anthropic_vision.py
"""
import json
import unittest
import pybase64
import requests
from sglang.srt.utils import kill_process_tree
from sglang.test.test_utils import (
DEFAULT_SMALL_VLM_MODEL... | 434 | 15,306 |
sglang | test/manual/scheduler/test_no_overlap_scheduler.py | .py | """
Usage:
python3 -m unittest test_overlap_schedule.TestOverlapSchedule.test_radix_attention_chunked_prefill
python3 test_overlap_schedule.py
"""
import unittest
from sglang.test.test_utils import CustomTestCase, run_mmlu_test
class TestOverlapSchedule(CustomTestCase):
def test_no_radix_attention_chunked_prefi... | 36 | 1,017 |
sglang | test/manual/scheduler/test_no_chunked_prefill.py | .py | import unittest
from sglang.test.test_utils import (
DEFAULT_MODEL_NAME_FOR_TEST,
CustomTestCase,
run_bench_serving,
run_mmlu_test,
)
class TestNoChunkedPrefill(CustomTestCase):
def test_no_chunked_prefill(self):
run_mmlu_test(
disable_radix_cache=False, enable_mixed_chunk=Fa... | 31 | 753 |
sglang | test/manual/scheduler/test_scripted_pp_abort.py | .py | import unittest
from sglang.test.scripted_runtime.context import ScriptedContext
from sglang.test.scripted_runtime.req_handle import ScriptedReqHandle
from sglang.test.scripted_runtime.test_case import ScriptedTestCase
from sglang.test.scripted_runtime_chunked_helpers import (
DEFAULT_CHUNK_SIZE,
base_engine_k... | 95 | 2,985 |
sglang | test/manual/core/test_gpt_oss_1gpu.py | .py | import unittest
from sglang.test.gpt_oss_common import BaseTestGptOss
class TestGptOss1Gpu(BaseTestGptOss):
def test_mxfp4_20b(self):
self.run_test(
model_variant="20b",
quantization="mxfp4",
expected_score_of_reasoning_effort={
"low": 0.34,
... | 32 | 769 |
sglang | test/manual/core/test_dynamic_grad_mode.py | .py | import unittest
import torch
from sglang.srt.utils import DynamicGradMode
from sglang.test.test_utils import CustomTestCase
class TestDynamicGradMode(CustomTestCase):
def test_inference(self):
# Test inference_mode
DynamicGradMode.set_inference_mode(True)
@DynamicGradMode()
def ... | 59 | 1,638 |
sglang | test/manual/lang_frontend/test_bind_cache.py | .py | import unittest
import sglang as sgl
from sglang.test.test_utils import DEFAULT_MODEL_NAME_FOR_TEST, CustomTestCase
class TestBind(CustomTestCase):
backend = None
@classmethod
def setUpClass(cls):
cls.backend = sgl.Runtime(model_path=DEFAULT_MODEL_NAME_FOR_TEST)
sgl.set_default_backend(c... | 52 | 1,454 |
sglang | test/manual/lang_frontend/test_jump_forward.py | .py | import argparse
from enum import Enum
from pydantic import BaseModel, constr
import sglang as sgl
from sglang.srt.constrained.outlines_backend import build_regex_from_object
from sglang.test.test_utils import (
add_common_sglang_args_and_parse,
select_sglang_backend,
)
IP_REGEX = r"((25[0-5]|2[0-4]\d|[01]?\d... | 139 | 3,365 |
sglang | test/manual/lang_frontend/test_separate_reasoning_execution.py | .py | """
Tests for the execution of separate_reasoning functionality in sglang.
Usage:
python3 -m unittest test/lang/test_separate_reasoning_execution.py
"""
import threading
import unittest
from unittest.mock import MagicMock, patch
from sglang.lang.interpreter import StreamExecutor
from sglang.lang.ir import SglGen, Sg... | 194 | 7,315 |
sglang | test/manual/lang_frontend/test_choices.py | .py | import unittest
import numpy as np
from sglang.lang.choices import (
greedy_token_selection,
token_length_normalized,
unconditional_likelihood_normalized,
)
from sglang.test.test_utils import CustomTestCase
MOCK_CHOICES_INPUT_DATA = {
"choices": [
"organ", # ["organ"]
"organism", # ... | 92 | 3,000 |
sglang | test/manual/lang_frontend/test_separate_reasoning.py | .py | """
Tests for the separate_reasoning functionality in sglang.
Usage:
python3 -m unittest test/lang/test_separate_reasoning.py
"""
import unittest
from sglang import gen, separate_reasoning
from sglang.lang.ir import SglExprList, SglSeparateReasoning
from sglang.test.test_utils import CustomTestCase
class TestSepar... | 69 | 2,770 |
sglang | test/manual/lang_frontend/test_openai_backend.py | .py | import unittest
from sglang import OpenAI, set_default_backend
from sglang.test.test_programs import (
test_chat_completion_speculative,
test_completion_speculative,
test_decode_int,
test_decode_json,
test_expert_answer,
test_few_shot_qa,
test_image_qa,
test_mt_bench,
test_parallel_... | 93 | 2,464 |
sglang | test/manual/quant/test_deepseek_v3_fp4_4gpu_trtllm.py | .py | """DeepSeek-V3 FP4 4-GPU test, TRTLLM variant.
Backend: `--attention-backend trtllm_mla --moe-runner-backend flashinfer_trtllm`.
Not registered in any CI suite -- runnable manually only.
"""
import unittest
from types import SimpleNamespace
from sglang.srt.utils import kill_process_tree
from sglang.test.run_eval imp... | 94 | 2,643 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.