Sync code and test CI; rename some env vars (#11686)

This commit is contained in:
Lianmin Zheng
2025-10-15 18:37:03 -07:00
committed by GitHub
parent 729b7edf72
commit cd7e1bd591
17 changed files with 66 additions and 34 deletions

View File

@@ -3,6 +3,8 @@ Run one test prompt.
Usage:
python3 -m sglang.test.send_one
python3 -m sglang.test.send_one --profile --profile-steps 5
python3 -m sglang.test.send_one --profile --profile-by-stage
"""
import argparse
@@ -11,6 +13,8 @@ import json
import requests
from sglang.profiler import run_profile
@dataclasses.dataclass
class BenchArgs:
@@ -29,6 +33,9 @@ class BenchArgs:
image: bool = False
many_images: bool = False
stream: bool = False
profile: bool = False
profile_steps: int = 3
profile_by_stage: bool = False
@staticmethod
def add_cli_args(parser: argparse.ArgumentParser):
@@ -51,6 +58,11 @@ class BenchArgs:
parser.add_argument("--image", action="store_true")
parser.add_argument("--many-images", action="store_true")
parser.add_argument("--stream", action="store_true")
parser.add_argument("--profile", action="store_true")
parser.add_argument(
"--profile-steps", type=int, default=BenchArgs.profile_steps
)
parser.add_argument("--profile-by-stage", action="store_true")
@classmethod
def from_cli_args(cls, args: argparse.Namespace):
@@ -59,6 +71,8 @@ class BenchArgs:
def send_one_prompt(args):
base_url = f"http://{args.host}:{args.port}"
if args.image:
args.prompt = (
"Human: Describe this image in a very short sentence.\n\nAssistant:"
@@ -108,8 +122,20 @@ def send_one_prompt(args):
"stream": args.stream,
}
# Run profiler if requested
if args.profile:
print(f"Running profiler with {args.profile_steps} steps...")
run_profile(
base_url,
args.profile_steps,
["CPU", "GPU"],
None,
None,
args.profile_by_stage,
)
response = requests.post(
f"http://{args.host}:{args.port}/generate",
f"{base_url}/generate",
json=json_data,
stream=args.stream,
)

View File

@@ -126,7 +126,7 @@ def is_in_ci():
def is_in_amd_ci():
"""Return whether it is in an AMD CI runner."""
return get_bool_env_var("SGLANG_AMD_CI")
return get_bool_env_var("SGLANG_IS_IN_CI_AMD")
def _use_cached_default_models(model_repo: str):