From 01387085762bf9e75bc6f3a0a06b033e99174da0 Mon Sep 17 00:00:00 2001 From: Liangsheng Yin Date: Wed, 1 Apr 2026 13:16:14 -0700 Subject: [PATCH] [Misc] Add network timeout to eval dataset downloads (#21873) Co-authored-by: Claude Opus 4.6 (1M context) --- python/sglang/test/simple_eval_common.py | 2 +- python/sglang/test/simple_eval_gpqa.py | 5 ++++- python/sglang/test/simple_eval_math.py | 5 ++++- python/sglang/test/simple_eval_mmlu.py | 5 ++++- sgl-model-gateway/e2e_test/infra/simple_eval_common.py | 2 +- sgl-model-gateway/e2e_test/infra/simple_eval_mmlu.py | 5 ++++- 6 files changed, 18 insertions(+), 6 deletions(-) diff --git a/python/sglang/test/simple_eval_common.py b/python/sglang/test/simple_eval_common.py index e3b96ef81..c667098b7 100644 --- a/python/sglang/test/simple_eval_common.py +++ b/python/sglang/test/simple_eval_common.py @@ -519,7 +519,7 @@ def make_report_from_example_htmls(htmls: List[str]): def download_dataset(path, url): print(f"Downloading dataset {path} from {url}") try: - response = requests.get(url, stream=True, timeout=120) + response = requests.get(url, stream=True, timeout=30) response.raise_for_status() total_size = int(response.headers.get("content-length", 0)) diff --git a/python/sglang/test/simple_eval_gpqa.py b/python/sglang/test/simple_eval_gpqa.py index b39366ef5..3ad37a604 100644 --- a/python/sglang/test/simple_eval_gpqa.py +++ b/python/sglang/test/simple_eval_gpqa.py @@ -32,7 +32,10 @@ class GPQAEval(Eval): num_threads: int, n_repeats: int = 1, ): - df = pandas.read_csv(filename) + if "://" in filename: + df = pandas.read_csv(filename, storage_options={"timeout": 30}) + else: + df = pandas.read_csv(filename) examples = [row.to_dict() for _, row in df.iterrows()] rng = random.Random(0) if num_examples: diff --git a/python/sglang/test/simple_eval_math.py b/python/sglang/test/simple_eval_math.py index 37d4b120b..6cb5658bb 100644 --- a/python/sglang/test/simple_eval_math.py +++ b/python/sglang/test/simple_eval_math.py @@ -40,7 +40,10 @@ class MathEval(Eval): num_examples: Optional[int], num_threads: int, ): - df = pandas.read_csv(filename) + if "://" in filename: + df = pandas.read_csv(filename, storage_options={"timeout": 30}) + else: + df = pandas.read_csv(filename) examples = [row.to_dict() for _, row in df.iterrows()] if num_examples: examples = random.Random(0).sample(examples, num_examples) diff --git a/python/sglang/test/simple_eval_mmlu.py b/python/sglang/test/simple_eval_mmlu.py index a68dbb935..281da9e80 100644 --- a/python/sglang/test/simple_eval_mmlu.py +++ b/python/sglang/test/simple_eval_mmlu.py @@ -86,7 +86,10 @@ subject2category = { class MMLUEval(Eval): def __init__(self, filename: str, num_examples: Optional[int], num_threads: int): - df = pandas.read_csv(filename) + if "://" in filename: + df = pandas.read_csv(filename, storage_options={"timeout": 30}) + else: + df = pandas.read_csv(filename) examples = [row.to_dict() for _, row in df.iterrows()] if num_examples: examples = random.Random(0).sample(examples, num_examples) diff --git a/sgl-model-gateway/e2e_test/infra/simple_eval_common.py b/sgl-model-gateway/e2e_test/infra/simple_eval_common.py index 92e72937d..7be435817 100644 --- a/sgl-model-gateway/e2e_test/infra/simple_eval_common.py +++ b/sgl-model-gateway/e2e_test/infra/simple_eval_common.py @@ -457,7 +457,7 @@ def download_dataset(path: str, url: str) -> None: """Download a dataset from URL to path.""" logger.info("Downloading dataset from %s", url) try: - response = requests.get(url, stream=True) + response = requests.get(url, stream=True, timeout=30) response.raise_for_status() total_size = int(response.headers.get("content-length", 0)) diff --git a/sgl-model-gateway/e2e_test/infra/simple_eval_mmlu.py b/sgl-model-gateway/e2e_test/infra/simple_eval_mmlu.py index 1083e56ca..a83ed1d2e 100644 --- a/sgl-model-gateway/e2e_test/infra/simple_eval_mmlu.py +++ b/sgl-model-gateway/e2e_test/infra/simple_eval_mmlu.py @@ -93,7 +93,10 @@ class MMLUEval(Eval): """MMLU benchmark evaluation.""" def __init__(self, filename: str, num_examples: int | None, num_threads: int): - df = pandas.read_csv(filename) + if "://" in filename: + df = pandas.read_csv(filename, storage_options={"timeout": 30}) + else: + df = pandas.read_csv(filename) examples = [row.to_dict() for _, row in df.iterrows()] if num_examples: examples = random.Random(0).sample(examples, num_examples)