2024-08-03 23:09:21 -07:00
|
|
|
import argparse
|
|
|
|
|
import glob
|
|
|
|
|
|
|
|
|
|
from sglang.test.test_utils import run_unittest_files
|
|
|
|
|
|
|
|
|
|
suites = {
|
|
|
|
|
"minimal": [
|
2024-08-26 01:29:12 +08:00
|
|
|
"models/test_embedding_models.py",
|
2024-08-25 19:56:42 -07:00
|
|
|
"models/test_generation_models.py",
|
2024-09-30 10:06:08 -07:00
|
|
|
"models/test_lora.py",
|
2024-11-03 13:27:12 -08:00
|
|
|
"models/test_reward_models.py",
|
2024-08-26 01:29:12 +08:00
|
|
|
"sampling/penaltylib",
|
2024-11-28 02:22:15 -08:00
|
|
|
"test_abort.py",
|
2024-08-11 16:41:03 -07:00
|
|
|
"test_chunked_prefill.py",
|
2024-10-14 02:00:41 -07:00
|
|
|
"test_double_sparsity.py",
|
2024-08-11 16:41:03 -07:00
|
|
|
"test_embedding_openai_server.py",
|
2024-08-12 02:21:38 -07:00
|
|
|
"test_eval_accuracy_mini.py",
|
2024-11-30 23:53:34 -08:00
|
|
|
"test_get_weights_by_name.py",
|
2024-11-30 22:14:48 -08:00
|
|
|
"test_gguf.py",
|
2024-11-25 19:35:04 -05:00
|
|
|
"test_input_embeddings.py",
|
2024-09-15 06:36:06 -07:00
|
|
|
"test_json_constrained.py",
|
2024-10-24 21:23:09 -07:00
|
|
|
"test_large_max_new_tokens.py",
|
2024-11-09 15:43:20 -08:00
|
|
|
"test_metrics.py",
|
2024-11-25 04:58:16 -08:00
|
|
|
"test_no_chunked_prefill.py",
|
|
|
|
|
"test_no_overlap_scheduler.py",
|
2024-08-04 20:51:55 -07:00
|
|
|
"test_openai_server.py",
|
2024-09-15 06:36:06 -07:00
|
|
|
"test_pytorch_sampling_backend.py",
|
2024-10-31 14:51:51 -07:00
|
|
|
"test_radix_attention.py",
|
2024-10-13 20:32:37 -07:00
|
|
|
"test_retract_decode.py",
|
2024-09-15 06:36:06 -07:00
|
|
|
"test_server_args.py",
|
2024-11-25 16:38:43 -08:00
|
|
|
"test_session_control.py",
|
2024-08-11 16:41:03 -07:00
|
|
|
"test_skip_tokenizer_init.py",
|
2024-10-06 20:27:03 -07:00
|
|
|
"test_srt_engine.py",
|
2024-09-15 06:36:06 -07:00
|
|
|
"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",
|
2024-12-16 14:17:27 -08:00
|
|
|
# Temporarily disable this because it requires PyTorch >= 2.5
|
|
|
|
|
# "test_torch_native_attention_backend.py",
|
2024-09-15 06:36:06 -07:00
|
|
|
"test_torchao.py",
|
2024-10-28 01:54:38 +08:00
|
|
|
"test_triton_attention_kernels.py",
|
|
|
|
|
"test_triton_attention_backend.py",
|
2024-11-30 23:53:34 -08:00
|
|
|
"test_update_weights_from_disk.py",
|
2024-12-09 09:52:38 -08:00
|
|
|
"test_vision_chunked_prefill.py",
|
2024-08-26 01:29:12 +08:00
|
|
|
"test_vision_openai_server.py",
|
2024-11-27 00:03:29 -08:00
|
|
|
"test_session_control.py",
|
2024-08-03 23:09:21 -07:00
|
|
|
],
|
2024-08-08 04:21:08 -07:00
|
|
|
"sampling/penaltylib": glob.glob(
|
|
|
|
|
"sampling/penaltylib/**/test_*.py", recursive=True
|
|
|
|
|
),
|
2024-08-03 23:09:21 -07:00
|
|
|
}
|
|
|
|
|
|
2024-08-08 04:21:08 -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",
|
|
|
|
|
)
|
2024-08-25 21:54:02 -07:00
|
|
|
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]
|
|
|
|
|
|
2024-08-25 21:54:02 -07:00
|
|
|
files = files[args.range_begin : args.range_end]
|
|
|
|
|
|
2024-12-01 01:47:30 -08:00
|
|
|
print(f"{args=}")
|
2024-10-11 15:26:25 -07:00
|
|
|
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)
|