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/registered/debug_utils/comparator/test_per_token_visualizer.py | .py | """Layer 2: PNG generation tests for per-token heatmap visualizer.
Requires matplotlib — uses pytest.importorskip to gracefully skip if absent.
"""
import sys
from pathlib import Path
import pytest
import torch
from sglang.srt.debug_utils.comparator.output_types import ComparisonTensorRecord
from sglang.srt.debug_u... | 158 | 5,151 |
sglang | test/registered/debug_utils/comparator/test_dp_utils.py | .py | import sys
import pytest
import torch
from sglang.srt.debug_utils.comparator.dims_spec import ParallelAxis
from sglang.srt.debug_utils.comparator.dp_utils import (
_extract_dp_info,
_group_has_data,
filter_to_non_empty_dp_rank,
)
from sglang.srt.debug_utils.dump_loader import ValueWithMeta
from sglang.tes... | 351 | 11,658 |
sglang | test/registered/debug_utils/comparator/test_meta_overrider.py | .py | """Tests for meta_overrider — unit tests."""
from __future__ import annotations
import sys
import textwrap
from pathlib import Path
import pytest
from sglang.srt.debug_utils.comparator.meta_overrider import (
MetaOverrider,
MetaOverrideRule,
_load_yaml_rules,
_parse_cli_override_arg,
)
from sglang.t... | 299 | 10,661 |
sglang | test/registered/debug_utils/comparator/test_model_validation.py | .py | import json
import sys
import pytest
from pydantic import ValidationError
from sglang.srt.debug_utils.comparator.aligner.entrypoint.traced_types import (
TracedAlignerPlan,
TracedSidePlan,
TracedStepPlan,
TracedSubPlan,
)
from sglang.srt.debug_utils.comparator.aligner.entrypoint.types import (
Ali... | 471 | 15,834 |
sglang | test/registered/debug_utils/comparator/test_threshold_dsl.py | .py | import sys
import pytest
from sglang.srt.debug_utils.comparator.threshold_dsl import (
DiffThresholdRule,
evaluate_predicate,
parse_diff_threshold_rules,
parse_predicate,
resolve_predicate,
)
from sglang.test.ci.ci_register import register_cpu_ci
register_cpu_ci(est_time=10, suite="base-a-test-cp... | 222 | 8,167 |
sglang | test/registered/debug_utils/comparator/test_preset.py | .py | import pytest
from sglang.srt.debug_utils.comparator.preset import PRESETS, expand_preset
from sglang.test.ci.ci_register import register_cpu_ci
register_cpu_ci(est_time=5, suite="base-a-test-cpu", nightly=True)
register_cpu_ci(est_time=1, suite="base-c-test-cpu")
class TestExpandPreset:
"""Test preset expansio... | 52 | 1,775 |
sglang | test/registered/debug_utils/comparator/test_log_sink.py | .py | import json
import sys
import pytest
from sglang.srt.debug_utils.comparator.log_sink import LogSink
from sglang.srt.debug_utils.comparator.output_types import (
ErrorLog,
InfoLog,
)
from sglang.srt.debug_utils.comparator.report_sink import report_sink
from sglang.test.ci.ci_register import register_cpu_ci
re... | 119 | 3,519 |
sglang | test/registered/debug_utils/comparator/test_visualizer.py | .py | import sys
from pathlib import Path
import pytest
import torch
from sglang.srt.debug_utils.comparator.visualizer.preprocessing import (
_preprocess_tensor,
_reshape_to_balanced_aspect,
)
from sglang.test.ci.ci_register import register_cpu_ci
register_cpu_ci(est_time=30, suite="base-a-test-cpu", nightly=True)... | 97 | 3,098 |
sglang | test/registered/debug_utils/comparator/test_output_types.py | .py | import sys
from io import StringIO
from pathlib import Path
_TEST_ROOT: Path = Path(__file__).resolve().parents[3]
if str(_TEST_ROOT) not in sys.path:
sys.path.insert(0, str(_TEST_ROOT))
import pytest
from registered.debug_utils.comparator.testing_helpers import (
assert_rich_tags_balanced,
)
from registered.... | 777 | 29,315 |
sglang | test/registered/debug_utils/comparator/test_utils.py | .py | import sys
from pathlib import Path
import pytest
import torch
from sglang.srt.debug_utils.comparator.output_types import SummaryRecord
from sglang.srt.debug_utils.comparator.utils import (
Pair,
argmax_coord,
auto_descend_dir,
calc_per_token_rel_diff,
calc_rel_diff,
compute_exit_code,
com... | 486 | 16,373 |
sglang | test/registered/debug_utils/comparator/test_bundle_matcher.py | .py | import sys
from typing import Any
import polars as pl
import pytest
from sglang.srt.debug_utils.comparator.bundle_matcher import (
TensorBundleInfo,
TensorFileInfo,
_rows_to_tensor_infos,
match_bundles,
)
from sglang.srt.debug_utils.comparator.utils import Pair
from sglang.test.ci.ci_register import r... | 342 | 11,722 |
sglang | test/registered/debug_utils/comparator/test_manually_verify.py | .py | """Visual comparison figure tests — CI sanity check + human verification.
This file serves two purposes:
1. CI sanity check: ensures generate_comparison_figure() runs without errors
across various tensor scenarios (registered via register_cpu_ci).
2. Human verification: all generated PNGs are copied to /tmp/compara... | 294 | 10,166 |
sglang | test/registered/debug_utils/comparator/conftest.py | .py | import sys
import warnings
from pathlib import Path
warnings.filterwarnings(
"ignore", message="builtin type Swig.*", category=DeprecationWarning
)
# Add the test root to sys.path so `registered.debug_utils.comparator.testing_helpers`
# can be imported by test modules.
_TEST_ROOT: Path = Path(__file__).resolve().... | 41 | 1,081 |
sglang | test/registered/debug_utils/comparator/aligner/test_axis_aligner.py | .py | import sys
from typing import Optional
import pytest
import torch
from sglang.srt.debug_utils.comparator.aligner.axis_aligner import (
AxisAlignerPlan,
compute_axis_aligner_plan,
execute_axis_aligner_plan,
)
from sglang.srt.debug_utils.comparator.dims_spec import (
apply_dim_names,
without_dim_nam... | 556 | 21,009 |
sglang | test/registered/debug_utils/comparator/aligner/unsharder/test_executor.py | .py | import sys
import pytest
import torch
from sglang.srt.debug_utils.comparator.aligner.unsharder.executor import (
UnsharderResult,
_apply_unshard,
_verify_replicated_group,
execute_unsharder_plan,
)
from sglang.srt.debug_utils.comparator.aligner.unsharder.planner import (
compute_unsharder_plan,
)
... | 1,098 | 43,576 |
sglang | test/registered/debug_utils/comparator/aligner/unsharder/test_parallel_info.py | .py | import sys
import pytest
from sglang.srt.debug_utils.comparator.aligner.unsharder.parallel_info import (
normalize_parallel_info,
)
from sglang.srt.debug_utils.comparator.aligner.unsharder.types import AxisInfo
from sglang.srt.debug_utils.comparator.dims_spec import ParallelAxis
from sglang.test.ci.ci_register im... | 101 | 3,319 |
sglang | test/registered/debug_utils/comparator/aligner/unsharder/test_planner.py | .py | import sys
import pytest
from sglang.srt.debug_utils.comparator.aligner.unsharder.planner import (
_compute_dependent_axes,
_is_dependent_axis,
_is_jointly_determined,
_validate_explicit_replicated,
_validate_replicated_axes_orthogonal,
compute_unsharder_plan,
)
from sglang.srt.debug_utils.com... | 2,068 | 89,109 |
sglang | test/registered/debug_utils/comparator/aligner/reorderer/test_executor.py | .py | import sys
import pytest
import torch
from sglang.srt.debug_utils.comparator.aligner.reorderer.executor import (
_reorder_zigzag_to_natural,
_reorder_zigzag_to_natural_thd,
execute_reorderer_plan,
)
from sglang.srt.debug_utils.comparator.aligner.reorderer.types import (
ReordererPlan,
ZigzagToNatu... | 293 | 11,055 |
sglang | test/registered/debug_utils/comparator/aligner/reorderer/test_planner.py | .py | import sys
import pytest
import torch
from sglang.srt.debug_utils.comparator.aligner.reorderer.executor import (
execute_reorderer_plan,
)
from sglang.srt.debug_utils.comparator.aligner.reorderer.planner import (
compute_reorderer_plans,
)
from sglang.srt.debug_utils.comparator.aligner.reorderer.types import ... | 260 | 10,434 |
sglang | test/registered/debug_utils/comparator/aligner/entrypoint/test_executor.py | .py | import sys
import pytest
import torch
from sglang.srt.debug_utils.comparator.aligner.entrypoint.executor import (
AlignerResult,
StepPlansResult,
SubPlansResult,
_execute_step_plans,
execute_aligner_plan,
execute_sub_plan,
execute_sub_plans,
)
from sglang.srt.debug_utils.comparator.aligner... | 335 | 11,298 |
sglang | test/registered/debug_utils/comparator/aligner/entrypoint/test_planner.py | .py | import sys
from typing import Any, Optional
import pytest
from sglang.srt.debug_utils.comparator.aligner.entrypoint.planner import (
_compute_per_step_plans,
compute_aligner_plan,
compute_per_step_sub_plans,
)
from sglang.srt.debug_utils.comparator.aligner.entrypoint.types import (
AlignerPerStepPlan,... | 337 | 11,848 |
sglang | test/registered/debug_utils/comparator/aligner/token_aligner/test_executor.py | .py | from __future__ import annotations
import sys
import pytest
import torch
from sglang.srt.debug_utils.comparator.aligner.token_aligner.smart.executor import (
execute_token_aligner,
)
from sglang.srt.debug_utils.comparator.aligner.token_aligner.smart.planner import (
compute_token_aligner_plan,
)
from sglang.... | 460 | 16,667 |
sglang | test/registered/debug_utils/comparator/aligner/token_aligner/test_thd_seq_lens_loader.py | .py | import sys
from pathlib import Path
from unittest.mock import patch
import polars as pl
import pytest
import torch
from sglang.srt.debug_utils.comparator.aligner.token_aligner.concat_steps.thd_seq_lens_loader import (
load_thd_seq_lens_only,
)
from sglang.srt.debug_utils.comparator.aligner.token_aligner.smart.aux... | 173 | 5,512 |
sglang | test/registered/debug_utils/comparator/aligner/token_aligner/test_aux_plugins.py | .py | import sys
import pytest
import torch
from sglang.srt.debug_utils.comparator.aligner.token_aligner.smart.aux_plugins import (
_infer_positions,
_MegatronPlugin,
_SGLangPlugin,
)
from sglang.srt.debug_utils.comparator.aligner.token_aligner.smart.types import (
PositionalSeqId,
SGLangSeqId,
Toke... | 249 | 8,720 |
sglang | test/registered/debug_utils/comparator/aligner/token_aligner/test_planner.py | .py | import sys
import pytest
from sglang.srt.debug_utils.comparator.aligner.token_aligner.smart.planner import (
_match_sequences,
compute_token_aligner_plan,
)
from sglang.srt.debug_utils.comparator.aligner.token_aligner.smart.seq_info_builder import (
build_seqs_info,
)
from sglang.srt.debug_utils.comparato... | 576 | 20,274 |
sglang | test/registered/debug_utils/comparator/aligner/token_aligner/test_concat_steps.py | .py | import sys
import pytest
import torch
from sglang.srt.debug_utils.comparator.aligner.token_aligner.concat_steps import (
execute_token_aligner_concat_steps,
)
from sglang.srt.debug_utils.comparator.dims_spec import apply_dim_names
from sglang.srt.debug_utils.comparator.utils import Pair
from sglang.test.ci.ci_reg... | 87 | 3,487 |
sglang | test/registered/debug_utils/comparator/aligner/token_aligner/test_aux_loader.py | .py | import sys
from pathlib import Path
import polars as pl
import pytest
import torch
from sglang.srt.debug_utils.comparator.aligner.token_aligner.smart.aux_loader import (
_detect_plugin,
_ensure_dims_in_metas,
_load_and_align_aux_tensor,
_load_non_tensor_aux,
)
from sglang.srt.debug_utils.comparator.al... | 389 | 12,548 |
sglang | test/registered/debug_utils/comparator/tensor_comparator/test_formatter.py | .py | import sys
from pathlib import Path
_TEST_ROOT: Path = Path(__file__).resolve().parents[4]
if str(_TEST_ROOT) not in sys.path:
sys.path.insert(0, str(_TEST_ROOT))
import pytest
from registered.debug_utils.comparator.testing_helpers import (
assert_rich_tags_balanced,
)
from registered.debug_utils.comparator.t... | 1,132 | 49,626 |
sglang | test/registered/debug_utils/comparator/tensor_comparator/test_comparator.py | .py | import sys
import pytest
import torch
from sglang.srt.debug_utils.comparator.tensor_comparator.comparator import (
QUANTILE_NUMEL_THRESHOLD,
SAMPLE_DIFF_THRESHOLD,
FailureDisplayBudget,
_compute_tensor_stats,
compare_tensor_pair,
compute_diff,
compute_tensor_info,
)
from sglang.srt.debug_u... | 679 | 27,951 |
sglang | test/registered/debug_utils/comparator/tensor_comparator/test_types.py | .py | import json
import sys
import pytest
from sglang.srt.debug_utils.comparator.output_types import (
ComparisonSkipRecord,
ComparisonTensorRecord,
ConfigRecord,
ErrorLog,
InfoLog,
LogRecord,
ReplicatedCheckResult,
SummaryRecord,
parse_record_json,
)
from sglang.srt.debug_utils.compara... | 260 | 8,410 |
sglang | test/registered/debug_utils/comparator/dims_spec/test_dims_parser.py | .py | import sys
import pytest
from sglang.srt.debug_utils.comparator.dims_spec import (
SQUEEZE_DIM_NAME,
DimSpec,
DimsSpec,
Ordering,
ParallelAxis,
ParallelModifier,
_SingletonDimUtil,
parse_dims,
resolve_dim_names,
)
from sglang.test.ci.ci_register import register_cpu_ci
register_cpu... | 296 | 10,420 |
sglang | test/registered/debug_utils/comparator/dims_spec/test_dim_parser.py | .py | import sys
import pytest
from sglang.srt.debug_utils.comparator.dims_spec import (
DimSpec,
Ordering,
ParallelAxis,
ParallelModifier,
Reduction,
parse_dim,
)
from sglang.test.ci.ci_register import register_cpu_ci
register_cpu_ci(est_time=5, suite="base-a-test-cpu", nightly=True)
register_cpu_... | 153 | 5,469 |
sglang | test/registered/debug_utils/comparator/dims_spec/test_tensor_naming.py | .py | import sys
import pytest
import torch
from sglang.srt.debug_utils.comparator.dims_spec import (
DimSpec,
apply_dim_names,
find_dim_index,
get_dim_names,
parse_dims,
resolve_dim_by_name,
without_dim_names,
)
from sglang.test.ci.ci_register import register_cpu_ci
register_cpu_ci(est_time=5,... | 99 | 3,432 |
sglang | test/registered/debug_utils/comparator/dims_spec/test_types.py | .py | import sys
import pytest
from sglang.srt.debug_utils.comparator.dims_spec import (
BATCH_DIM_NAME,
SEQ_DIM_NAME,
TOKEN_DIM_NAME,
)
from sglang.test.ci.ci_register import register_cpu_ci
register_cpu_ci(est_time=5, suite="base-a-test-cpu", nightly=True)
register_cpu_ci(est_time=1, suite="base-c-test-cpu")... | 29 | 652 |
sglang | test/registered/musa/test_llm_server_smoke_musa.py | .py | import os
import unittest
import requests
import torch
from sglang.test.ci.ci_register import register_musa_ci
from sglang.test.server_fixtures.default_fixture import DefaultServerBase
register_musa_ci(est_time=1200, suite="nightly-musa-1-gpu", nightly=True)
_REQUEST_TIMEOUT = 60
@unittest.skipIf(
not (hasat... | 112 | 3,498 |
sglang | test/registered/pp/test_pp_parallel_compat.py | .py | import unittest
from types import SimpleNamespace
from sglang.test.ci.ci_register import register_cuda_ci
from sglang.test.run_eval import run_eval
from sglang.test.test_utils import (
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
DEFAULT_URL_FOR_TEST,
CustomTestCase,
kill_process_tree,
popen_launch_server,
)... | 112 | 2,986 |
sglang | test/registered/pp/test_pp_single_node_extra.py | .py | """
Usage:
python3 -m unittest test_pp_single_node_extra.TestQwenVLPPAccuracy.test_gsm8k
python3 -m unittest test_pp_single_node_extra.TestQwenPPAccuracy.test_pp_consistency
python3 -m unittest test_pp_single_node_extra.TestQwenPPTieWeightsAccuracy.test_pp_consistency
python3 -m unittest test_pp_single_node_extra.TestQ... | 356 | 11,231 |
sglang | test/registered/pp/test_pp_single_node.py | .py | """
Usage:
python3 -m unittest test_pp_single_node.TestPPAccuracy.test_gsm8k
python3 -m unittest test_pp_single_node.TestDPAttentionDP2PP2.test_gsm8k
python3 -m unittest test_pp_single_node.TestGemma4PPAccuracy.test_gsm8k
python3 -m unittest test_pp_single_node.TestGemma4PPAccuracy.test_mmmu
python3 -m unittest test_pp... | 357 | 11,459 |
sglang | test/registered/dcp/test_tokenspeed_mla_dcp_metadata.py | .py | import unittest
from types import SimpleNamespace
from unittest.mock import patch
import torch
from sglang.srt.layers.attention import tokenspeed_mla_backend as backend_module
from sglang.srt.layers.attention.tokenspeed_mla_backend import TokenspeedMLABackend
from sglang.srt.layers.attention.trtllm_mla_backend import... | 88 | 3,237 |
sglang | test/registered/dcp/test_dcp_layout_unit.py | .py | """CPU unit test for the decode-context-parallel (DCP) per-rank KV-length math.
Pins ``get_dcp_lens`` (the single, superset implementation in
``layers/dcp/layout.py``) to a brute-force owner-count reference, and proves
it is bit-identical to the legacy in-place formula that
``update_local_kv_lens_for_dcp`` used before... | 414 | 17,059 |
sglang | test/registered/dcp/test_kimi_linear_dcp4.py | .py | """Four-Blackwell acceptance coverage for Kimi Linear TokenSpeed MLA DCP.
The captured-shape and eager-shape requests deliberately straddle
``--cuda-graph-max-bs-decode``. This guards both the regular CUDA graph
decode path and the full-capacity eager DCP LSE scratch-buffer path.
"""
import unittest
import requests... | 142 | 4,631 |
sglang | test/registered/dcp/test_reduce_scatter_along_dim.py | .py | """
Correctness test for ``GroupCoordinator.reduce_scatter_along_dim``.
The test compares the ``reduce_scatter_along_dim`` output against PyTorch's
native ``dist.reduce_scatter_tensor`` for various tensor shapes, dims, and
dtypes, exercising both positive and negative dim indexing.
Usage:
python -m pytest test_re... | 232 | 7,006 |
sglang | test/registered/dcp/test_dsv31_dcp8_gsm8k.py | .py | """
DCP (Decode Context Parallelism) correctness tests for DeepSeek-V3.1.
Test classes:
TestDSV31DCP8TP8GSM8K — CI gate: DCP=8 + TP=8 GSM8K accuracy + decode sanity
TestDSV31DCP8LogprobParity — (manual) DCP=8 vs non-DCP logprob equivalence
TestDSV31DCP4TP8GSM8K — (manual) DCP=4 + TP=8... | 422 | 16,188 |
sglang | test/registered/dcp/test_kimi_linear_dcp_dspark4.py | .py | """Four-Blackwell Kimi Linear TokenSpeed DCP + DSpark static acceptance test."""
import json
import socket
import tempfile
import time
import unittest
from pathlib import Path
from types import SimpleNamespace
from urllib.parse import urlparse
import requests
import torch
from sglang.srt.utils import kill_process_tr... | 226 | 7,477 |
sglang | test/registered/dcp/test_qwen3p5_triton_dcp.py | .py | import os
import unittest
from types import SimpleNamespace
import torch
from sglang.srt.utils import kill_process_tree
from sglang.test.ci.ci_register import register_amd_ci, register_cuda_ci
from sglang.test.run_eval import run_eval
from sglang.test.test_utils import (
DEFAULT_URL_FOR_TEST,
CustomTestCase,
... | 97 | 2,619 |
sglang | test/registered/scripted_runtime/test_scripted_runtime_core.py | .py | import unittest
from sglang.srt.managers.schedule_batch import FINISH_ABORT
from sglang.test.ci.ci_register import register_amd_ci, register_cuda_ci
from sglang.test.scripted_runtime.context import ScriptedContext
from sglang.test.scripted_runtime.http_server import ScriptedHttpServer
from sglang.test.scripted_runtime... | 804 | 30,852 |
sglang | test/registered/chunked_prefill/test_scripted_core_1gpu.py | .py | import unittest
from sglang.test.ci.ci_register import register_amd_ci, register_cuda_ci
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 (
LIFECYCLE_STAGES,
advance_to_l... | 190 | 7,292 |
sglang | test/registered/chunked_prefill/test_mm_chunked_embedding_unit.py | .py | """Unit tests for per-item DataEmbeddingFunc results in the chunked mm path.
A DataEmbeddingFunc may return either one combined [tokens, hidden] tensor or
one tensor per item (see mm_schedule.DataEmbeddingFunc). These tests assert the
two forms produce bitwise-identical chunked-prefill embeddings, and that the
per-ite... | 192 | 6,159 |
sglang | test/registered/chunked_prefill/test_scripted_swa_1gpu.py | .py | import unittest
from sglang.test.ci.ci_register import register_cuda_ci
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
register_cuda_ci(est_time=400, stage=... | 108 | 3,257 |
sglang | test/registered/chunked_prefill/test_scripted_core_4gpu.py | .py | import unittest
from sglang.test.ci.ci_register import register_cuda_ci
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_MAX_STEPS,
SMALL_MODEL,
base_engine... | 99 | 3,713 |
sglang | test/registered/rl/test_lora_load_from_tensor.py | .py | import json
import os
import unittest
import torch
from huggingface_hub import snapshot_download
from safetensors.torch import load_file
import sglang as sgl
from sglang.test.ci.ci_register import register_amd_ci, register_cuda_ci
from sglang.test.test_utils import CustomTestCase
register_cuda_ci(est_time=102, stage... | 373 | 13,690 |
sglang | test/registered/rl/test_update_weights_from_distributed.py | .py | from sglang.test.ci.ci_register import register_amd_ci, register_cuda_ci
"""Test distributed weight updates.
This test suite simulates a distributed training environment to ensure
correct weight synchronization. On rank 0, the instruct model represents
pre-training weights, and the base model represents post-training... | 854 | 27,134 |
sglang | test/registered/rl/test_fp32_lm_head.py | .py | import unittest
from types import SimpleNamespace
from unittest.mock import patch
import torch
import torch.nn as nn
import torch.nn.functional as F
from sglang.srt.layers.logits_processor import LogitsProcessor
from sglang.srt.runtime_context import get_context
from sglang.srt.utils import get_device
from sglang.tes... | 179 | 5,965 |
sglang | test/registered/rl/test_patch_torch.py | .py | import os
import traceback
import unittest
from typing import List
import torch
import torch.multiprocessing as mp
from sglang.srt.utils.patch_torch import monkey_patch_torch_reductions
from sglang.test.ci.ci_register import register_amd_ci, register_cuda_ci
register_cuda_ci(est_time=15, stage="base-b", runner_confi... | 108 | 3,447 |
sglang | test/registered/rl/test_return_routed_experts.py | .py | import asyncio
import json
import logging
import unittest
from typing import List
import aiohttp
import numpy as np
import requests
import torch
from torch.nn.utils.rnn import pad_sequence
from sglang.benchmark.utils import download_and_cache_hf_file
from sglang.srt.state_capturer.routed_experts import (
extract_... | 544 | 19,963 |
sglang | test/registered/rl/test_weight_checker_e2e.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... | 230 | 9,466 |
sglang | test/registered/rl/test_update_weights_from_disk.py | .py | import json
import random
import time
import unittest
from concurrent.futures import ThreadPoolExecutor, as_completed
import requests
import sglang as sgl
from sglang.srt.utils import kill_process_tree
from sglang.test.ci.ci_register import register_amd_ci, register_cuda_ci
from sglang.test.test_utils import (
DE... | 448 | 17,347 |
sglang | test/registered/rl/test_multi_instance_release_memory_occupation.py | .py | import gc
import multiprocessing
import os
import traceback
import unittest
from multiprocessing import Process
from typing import Iterable, Tuple
import torch
import torch.distributed as dist
from torch.distributed.device_mesh import init_device_mesh
from transformers import AutoModelForCausalLM
from sglang.srt.entr... | 275 | 9,705 |
sglang | test/registered/rl/test_update_weights_from_disk_blackwell.py | .py | from sglang.test.ci.ci_register import register_cuda_ci
register_cuda_ci(est_time=320, stage="extra-b", runner_config="4-gpu-b200")
import time
import unittest
import requests
from sglang.srt.constants import (
GPU_MEMORY_TYPE_CUDA_GRAPH,
GPU_MEMORY_TYPE_KV_CACHE,
GPU_MEMORY_TYPE_WEIGHTS,
)
from sglang.... | 274 | 9,494 |
sglang | test/registered/rl/test_pause_generation_tensor_consistency.py | .py | """
Unit test for the pause_generation.
"""
import unittest
import torch
from sglang.test.ci.ci_register import register_cpu_ci
from sglang.test.test_utils import CustomTestCase
register_cpu_ci(est_time=7, suite="base-a-test-cpu")
register_cpu_ci(est_time=7, suite="base-c-test-cpu")
# ----------------------------... | 214 | 8,249 |
sglang | test/registered/rl/test_return_indexer_topk.py | .py | import asyncio
import logging
import unittest
import aiohttp
import numpy as np
from sglang.srt.state_capturer.indexer_topk import (
extract_indexer_topk_from_meta_info,
)
from sglang.srt.utils import kill_process_tree
from sglang.test.ci.ci_register import register_cuda_ci
from sglang.test.test_utils import (
... | 152 | 5,393 |
sglang | test/registered/rl/test_release_memory_occupation.py | .py | """Test memory release and resume operations for SGLang engine in hybrid RL training.
This test suite evaluates the SGLang engine's memory management capabilities, focusing
on releasing and resuming memory occupation for KV cache and model weights. It simulates
an RL workflow where the SGLang engine acts as a rollout ... | 478 | 18,077 |
sglang | test/registered/rl/test_update_weights_from_tensor.py | .py | from sglang.test.ci.ci_register import register_amd_ci, register_cuda_ci
register_cuda_ci(est_time=147, stage="extra-a", runner_config="1-gpu-small")
register_amd_ci(est_time=195, suite="stage-b-test-1-gpu-small-amd")
import gc
import json
import random
import time
import unittest
from concurrent.futures import Threa... | 293 | 10,334 |
sglang | test/registered/eval/test_text_models_gsm8k_eval.py | .py | import json
import unittest
import warnings
from types import SimpleNamespace
from sglang.srt.utils import kill_process_tree
from sglang.test.ci.ci_register import register_cuda_ci
from sglang.test.run_eval import run_eval
from sglang.test.test_utils import (
DEFAULT_MODEL_NAME_FOR_NIGHTLY_EVAL_FP8_TP1,
DEFAUL... | 140 | 5,653 |
sglang | test/registered/eval/test_vlms_mmmu_eval.py | .py | import json
import unittest
import warnings
from types import SimpleNamespace
from sglang.srt.utils import kill_process_tree
from sglang.test.ci.ci_register import register_cuda_ci
from sglang.test.run_eval import run_eval
from sglang.test.test_utils import (
DEFAULT_URL_FOR_TEST,
ModelLaunchSettings,
chec... | 143 | 5,508 |
sglang | test/registered/spec/test_spec_standalone_extra.py | .py | import unittest
from sglang.srt.utils import is_hip
from sglang.test.ci.ci_register import register_amd_ci, register_cuda_ci
from sglang.test.server_fixtures.standalone_fixture import StandaloneServerBase
from sglang.test.test_utils import CustomTestCase
# Non-V2 standalone speculative decoding tests (FA3, Triton, Fl... | 45 | 1,680 |
sglang | test/registered/spec/test_spec_ngram.py | .py | import unittest
from sglang.test.ci.ci_register import register_cuda_ci
from sglang.test.kits.eval_accuracy_kit import GSM8KMixin
from sglang.test.kits.json_constrained_kit import JSONConstrainedMixin
from sglang.test.kits.regex_constrained_kit import RegexConstrainedMixin
from sglang.test.kits.spec_server_kits import... | 31 | 1,071 |
sglang | test/registered/spec/test_gemma4_mtp_26b_a4b_extra.py | .py | import unittest
from types import SimpleNamespace
from typing import Optional
import requests
from sglang.srt.utils import kill_process_tree
from sglang.test.ci.ci_register import register_cuda_ci
from sglang.test.run_eval import run_eval
from sglang.test.test_utils import (
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
... | 187 | 5,780 |
sglang | test/registered/spec/test_constrained_decoding_spec_reasoning.py | .py | import json
import unittest
import openai
from sglang.srt.utils import kill_process_tree
from sglang.test.ci.ci_register import register_cuda_ci
from sglang.test.test_utils import (
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
DEFAULT_URL_FOR_TEST,
CustomTestCase,
popen_launch_server,
)
# Constrained decoding ... | 105 | 3,370 |
sglang | test/registered/spec/test_frozen_kv_mtp.py | .py | import unittest
from types import SimpleNamespace
from typing import Optional
import requests
from sglang.srt.utils import kill_process_tree
from sglang.test.ci.ci_register import register_amd_ci, register_cuda_ci
from sglang.test.run_eval import run_eval
from sglang.test.test_utils import (
DEFAULT_TIMEOUT_FOR_S... | 158 | 4,662 |
sglang | test/registered/spec/test_gemma4_mtp_31b_extra.py | .py | import unittest
from types import SimpleNamespace
from typing import Optional
import requests
from sglang.srt.utils import kill_process_tree
from sglang.test.ci.ci_register import register_cuda_ci
from sglang.test.run_eval import run_eval
from sglang.test.test_utils import (
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
... | 174 | 5,179 |
sglang | test/registered/spec/test_spec_standalone.py | .py | import unittest
from sglang.test.ci.ci_register import register_cuda_ci
from sglang.test.kits.json_constrained_kit import JSONConstrainedMixin
from sglang.test.kits.regex_constrained_kit import RegexConstrainedMixin
from sglang.test.server_fixtures.standalone_fixture import StandaloneServerBase
from sglang.test.test_u... | 38 | 1,454 |
sglang | test/registered/spec/test_spec_ngram_extra.py | .py | import unittest
import requests
from sglang.test.ci.ci_register import register_cuda_ci
from sglang.test.kits.eval_accuracy_kit import GSM8KMixin
from sglang.test.server_fixtures.ngram_fixture import NgramServerBase
# Extra: Triton + Flashinfer NGRAM backends + non-overlap (sync V2) variant.
# Sibling per-commit fil... | 100 | 3,815 |
sglang | test/registered/spec/test_gemma4_dflash_31b_extra.py | .py | import unittest
from types import SimpleNamespace
from typing import Optional
import requests
from sglang.srt.utils import kill_process_tree
from sglang.test.ci.ci_register import register_cuda_ci
from sglang.test.run_eval import run_eval
from sglang.test.test_utils import (
DEFAULT_TIMEOUT_FOR_SERVER_LAUNCH,
... | 178 | 5,442 |
sglang | test/registered/spec/eagle/test_spec_eagle_topk_page.py | .py | """EAGLE3 tree drafting (topk > 1) at page_size > 1, flashinfer (fa3 is
Hopper-only).
page_size=4 with 32 draft tokens spreads the draft window over several pages --
the layout the unit fixture refuses to build (tree draft is pinned to
page_size=1 there, see speculative_draft_runner.py). The window-inside-one-page
reg... | 42 | 1,421 |
sglang | test/registered/spec/eagle/test_spec_eagle_fa3.py | .py | """fa3 attention backend -- Hopper-only (FlashAttention-3 is sm_90).
fa3 is the real H200 default for MHA spec at topk=1, so this also covers the
"what an H200 user actually runs" path. Requires the large (Hopper) runner.
"""
import unittest
from sglang.srt.environ import envs
from sglang.test.ci.ci_register import ... | 57 | 1,705 |
sglang | test/registered/spec/eagle/test_deepseek_v3_fp4_mtp_small.py | .py | import unittest
from types import SimpleNamespace
import requests
from sglang.srt.utils import kill_process_tree
from sglang.test.ci.ci_register import register_cuda_ci
from sglang.test.run_eval import run_eval
from sglang.test.send_one import BenchArgs, send_one_prompt
from sglang.test.test_utils import (
DEFAUL... | 118 | 3,471 |
sglang | test/registered/spec/eagle/test_eagle_reject_sampling.py | .py | import unittest
from types import SimpleNamespace
import requests
from sglang.srt.environ import envs
from sglang.srt.utils import kill_process_tree
from sglang.test.ci.ci_register import register_cuda_ci
from sglang.test.run_eval import run_eval
from sglang.test.test_utils import (
DEFAULT_URL_FOR_TEST,
Cust... | 92 | 2,567 |
sglang | test/registered/spec/eagle/test_adaptive_speculative.py | .py | import json
import os
import tempfile
import unittest
from types import SimpleNamespace
import requests
from sglang.srt.utils import kill_process_tree
from sglang.test.ci.ci_register import register_amd_ci, register_cuda_ci
from sglang.test.run_eval import run_eval
from sglang.test.test_utils import (
DEFAULT_DRA... | 317 | 11,579 |
sglang | test/registered/spec/eagle/test_spec_eagle_page.py | .py | """EAGLE3 chain drafting (topk=1) at page_size > 1, flashinfer.
topk=1 takes its own fast path in the draft worker, so this cell is not
covered by the tree variants in test_spec_eagle_topk_page.py.
"""
import unittest
from sglang.srt.environ import envs
from sglang.test.ci.ci_register import register_cuda_ci
from sg... | 38 | 965 |
sglang | test/registered/spec/eagle/test_eagle_constrained_decoding.py | .py | import unittest
from sglang.srt.utils import kill_process_tree
from sglang.test.ci.ci_register import register_amd_ci, register_cuda_ci
from sglang.test.kits.json_constrained_kit import JSONConstrainedMixin
from sglang.test.kits.regex_constrained_kit import RegexConstrainedMixin
from sglang.test.test_utils import (
... | 83 | 2,532 |
sglang | test/registered/spec/eagle/test_eagle_dp_attention.py | .py | import unittest
from types import SimpleNamespace
import requests
from sglang.srt.environ import envs
from sglang.test.ci.ci_register import register_amd_ci, register_cuda_ci
from sglang.test.run_eval import run_eval
from sglang.test.send_one import BenchArgs, send_one_prompt
from sglang.test.test_utils import (
... | 145 | 4,989 |
sglang | test/registered/spec/eagle/test_spec_eagle_parity.py | .py | """Lossless output parity: spec-decode greedy output == a non-spec reference.
The reference is a separate non-spec server, launched and torn down BEFORE the
spec server (sequential -- one model resident at a time; see SpecParityKit).
"""
import unittest
from sglang.srt.environ import envs
from sglang.srt.utils impor... | 54 | 1,884 |
sglang | test/registered/spec/eagle/test_spec_eagle_stress.py | .py | """Perf + stress: throughput and retract-under-pressure.
These need memory headroom / measure load behaviour, so they run on the large
(Hopper) runner. The scheduler timeout paths carry no spec-specific state, so
they live in unit/managers/test_scheduler_timeouts.py plus the cheap e2e in
scheduler/test_scheduler_contr... | 58 | 1,890 |
sglang | test/registered/spec/eagle/test_spec_eagle_topk.py | .py | """topk > 1 tree drafting at page_size=1 (EAGLE3 topk16 + EAGLE/Llama-2 topk8).
flashinfer is pinned because this runs on the cheap (5090) runner, where fa3
(Hopper-only) isn't available -- functional sanity only, no perf/stress.
(topk > 1 on fa3 is covered on the Hopper runner in test_spec_eagle_fa3.py.)
"""
import ... | 98 | 3,139 |
sglang | test/registered/spec/eagle/test_spec_eagle.py | .py | """EAGLE3 spec-decoding core: overlap x no-overlap matrix at the standard
config (topk=1, page_size=1); only ``disable_overlap`` differs. Both run the
same EAGLEWorkerV2 -- the scheduler just drives it synchronously when overlap
is off.
flashinfer is pinned (the 5090 default) so a default-selection change can't
silentl... | 53 | 1,342 |
sglang | test/registered/spec/eagle/test_spec_eagle_triton.py | .py | """triton attention backend, EAGLE3 chain drafting.
triton runs everywhere, so this stays on the cheap (5090) runner. triton tree
verify is covered by attention/unittests/dense/test_triton.py, and the tree
accept-path compaction e2e lives in test_spec_eagle_topk.py.
"""
import unittest
from sglang.srt.environ import... | 42 | 1,156 |
sglang | test/registered/spec/dspark/test_ragged_verify_backend_capability.py | .py | """Backend opt-in flags for the ragged-verify graphs.
Runs in the GPU suite because importing the backend modules pulls GPU-only
wheels (sgl_kernel) at module scope, which fail to import on CPU runners.
"""
import unittest
from sglang.test.ci.ci_register import register_cuda_ci
from sglang.test.test_utils import Cus... | 44 | 1,591 |
sglang | test/registered/spec/dspark/test_dspark_block_accept_estimator.py | .py | import json
import math
import tempfile
import unittest
from pathlib import Path
import torch
from sglang.srt.speculative.dspark_components.dspark_block_accept_estimator import (
BlockAcceptEstimateRecorder,
)
from sglang.test.ci.ci_register import register_cpu_ci
from sglang.test.test_utils import CustomTestCase... | 580 | 22,404 |
sglang | test/registered/spec/dspark/test_dspark_sps_table.py | .py | import tempfile
import unittest
from pathlib import Path
from sglang.srt.speculative.dspark_components.dspark_sps import (
SpsAdditiveCostTable,
SpsCostTable,
build_uninitialized_sps_table,
is_uninitialized_sps_table,
load_sps_table_from_path,
profile_sps_table,
)
from sglang.test.ci.ci_registe... | 208 | 7,657 |
sglang | test/registered/spec/dspark/test_dspark_info_dumper.py | .py | import unittest
import torch
from sglang.srt.environ import envs
from sglang.srt.managers.io_struct import (
GetInternalStateReqOutput,
PickleWrapper,
msgpack_decode,
msgpack_encode,
)
from sglang.srt.speculative.dspark_components.dspark_observability import (
DecodeStepObservation,
DsparkInfo... | 440 | 17,411 |
sglang | test/registered/spec/dspark/test_dspark_kernel_parity.py | .py | """Seeded triton-vs-torch parity sweep for the DSpark kernels.
Guards against toolchain drift (triton/torch upgrades) silently diverging
the triton implementations from their torch references. Every method calls
the production kernel pair directly via `Cls.torch(...)` / `Cls.triton(...)`
(no env-var dispatch) on a sma... | 565 | 21,541 |
sglang | test/registered/spec/dspark/test_dspark_confidence_metrics.py | .py | import unittest
import torch
from sglang.srt.environ import envs
from sglang.srt.speculative.dspark_components.dspark_observability import (
ConfidenceMetricsProbe,
PerPositionConfidenceMetrics,
)
from sglang.test.ci.ci_register import register_cpu_ci
from sglang.test.test_utils import CustomTestCase
registe... | 160 | 6,108 |
sglang | test/registered/spec/dspark/test_dspark_sps_profiler.py | .py | import unittest
from sglang.benchmark.dspark_sps_profiler import (
LoadInfo,
ServerContext,
SpsRow,
build_request_count_sweep,
build_table_from_summaries,
count_aligned_steps,
postprocess_round,
resolve_cuda_graph_max_bs,
round_summary_dict,
validate_sweep_against_server,
)
from... | 279 | 10,003 |
sglang | test/registered/spec/dspark/test_dspark_dp_tier.py | .py | import random
import unittest
from types import SimpleNamespace
from unittest.mock import patch
import torch
from sglang.srt.speculative.dspark_components.dspark_draft import DraftBlockProposer
from sglang.srt.speculative.dspark_components.dspark_planner import (
dp_global_verify_tier_num_tokens,
local_verify... | 139 | 5,177 |
sglang | test/registered/spec/dspark/test_dspark_draft_path_default.py | .py | import unittest
from types import SimpleNamespace
from sglang.srt.arg_groups.speculative_hook import (
_handle_dspark,
_target_checkpoint_bundles_dspark_draft,
)
from sglang.srt.environ import envs
from sglang.srt.server_args import ServerArgs
from sglang.test.ci.ci_register import register_cpu_ci
from sglang.... | 119 | 4,543 |
sglang | test/registered/spec/dspark/test_dspark_stacked_ctx_kv_parity.py | .py | """Parity: dspark stacked ctx-KV write vs the per-layer loop.
Accuracy tests cannot catch a broken ctx-KV write (spec decoding stays correct
regardless of draft KV; only accept length drops), so compare the two paths
directly and check the fallbacks return None.
"""
import types
import unittest
import torch
from sg... | 178 | 6,676 |
sglang | test/registered/spec/dspark/test_ragged_verify.py | .py | import unittest
import torch
from sglang.srt.speculative.ragged_verify import (
RaggedVerifyLayout,
build_ragged_target_verify_geometry,
)
from sglang.test.ci.ci_register import register_cpu_ci
from sglang.test.test_utils import CustomTestCase
register_cpu_ci(est_time=10, suite="base-a-test-cpu")
_DEVICE = ... | 133 | 5,577 |
sglang | test/registered/spec/dspark/test_dspark_sts.py | .py | import tempfile
import unittest
from pathlib import Path
import torch
from sglang.benchmark.dspark_sts_fit import (
default_temperature_grid,
expected_calibration_error,
fit_sts_temperatures,
)
from sglang.srt.models.dspark import DSparkConfidenceHead
from sglang.srt.speculative.dspark_components.dspark_s... | 143 | 5,933 |
sglang | test/registered/spec/dspark/test_dspark_scheduler.py | .py | import functools
import types
import unittest
import torch
from sglang.kernels.ops.speculative.dspark.dspark_schedule import (
schedule_verify_lens_topk_from_survival,
)
from sglang.srt.speculative.dspark_components.dspark_planner import (
DSparkScheduleConfig,
HostConfidenceBudgetPlanner,
VerifyBudge... | 559 | 21,505 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.