Files
sglang/test/srt/run_suite.py

102 lines
3.0 KiB
Python
Raw Normal View History

2024-08-03 23:09:21 -07:00
import argparse
import glob
from sglang.test.test_utils import run_unittest_files
suites = {
"minimal": [
"models/test_embedding_models.py",
2024-08-25 19:56:42 -07:00
"models/test_generation_models.py",
"models/test_lora.py",
"models/test_reward_models.py",
"sampling/penaltylib",
2024-11-28 02:22:15 -08:00
"test_abort.py",
"test_chunked_prefill.py",
2024-10-14 02:00:41 -07:00
"test_double_sparsity.py",
"test_embedding_openai_server.py",
2024-08-12 02:21:38 -07:00
"test_eval_accuracy_mini.py",
"test_get_weights_by_name.py",
"test_gguf.py",
2024-11-25 19:35:04 -05:00
"test_input_embeddings.py",
"test_json_constrained.py",
"test_large_max_new_tokens.py",
2024-11-09 15:43:20 -08:00
"test_metrics.py",
"test_no_chunked_prefill.py",
"test_no_overlap_scheduler.py",
2024-08-04 20:51:55 -07:00
"test_openai_server.py",
"test_pytorch_sampling_backend.py",
"test_radix_attention.py",
"test_retract_decode.py",
"test_server_args.py",
2024-11-25 16:38:43 -08:00
"test_session_control.py",
"test_skip_tokenizer_init.py",
2024-10-06 20:27:03 -07:00
"test_srt_engine.py",
"test_srt_endpoint.py",
2024-08-03 23:09:21 -07:00
"test_torch_compile.py",
2024-11-14 01:30:24 -08:00
"test_torch_compile_moe.py",
# Temporarily disable this because it requires PyTorch >= 2.5
# "test_torch_native_attention_backend.py",
"test_torchao.py",
2024-10-28 01:54:38 +08:00
"test_triton_attention_kernels.py",
"test_triton_attention_backend.py",
"test_update_weights_from_disk.py",
"test_vision_chunked_prefill.py",
"test_vision_openai_server.py",
"test_session_control.py",
2024-08-03 23:09:21 -07:00
],
"sampling/penaltylib": glob.glob(
"sampling/penaltylib/**/test_*.py", recursive=True
),
2024-08-03 23:09:21 -07:00
}
for target_suite_name, target_tests in suites.items():
for suite_name, tests in suites.items():
if suite_name == target_suite_name:
continue
if target_suite_name in tests:
tests.remove(target_suite_name)
tests.extend(target_tests)
2024-08-03 23:09:21 -07:00
2024-08-25 19:56:42 -07:00
2024-08-03 23:09:21 -07:00
if __name__ == "__main__":
arg_parser = argparse.ArgumentParser()
arg_parser.add_argument(
"--timeout-per-file",
type=int,
2024-08-07 19:15:41 +08:00
default=2000,
2024-08-03 23:09:21 -07:00
help="The time limit for running one file in seconds.",
)
arg_parser.add_argument(
"--suite",
type=str,
default=list(suites.keys())[0],
choices=list(suites.keys()) + ["all"],
help="The suite to run",
)
arg_parser.add_argument(
"--range-begin",
type=int,
default=0,
help="The begin index of the range of the files to run.",
)
arg_parser.add_argument(
"--range-end",
type=int,
default=None,
help="The end index of the range of the files to run.",
)
2024-08-03 23:09:21 -07:00
args = arg_parser.parse_args()
if args.suite == "all":
files = glob.glob("**/test_*.py", recursive=True)
else:
files = suites[args.suite]
files = files[args.range_begin : args.range_end]
2024-12-01 01:47:30 -08:00
print(f"{args=}")
print("The running tests are ", files)
2024-08-03 23:09:21 -07:00
exit_code = run_unittest_files(files, args.timeout_per_file)
exit(exit_code)