From ae122e041806fc96e0fefd0a046cbbb8adc1d1d5 Mon Sep 17 00:00:00 2001 From: Simo Lin Date: Mon, 9 Mar 2026 11:37:50 -0700 Subject: [PATCH] fix(benchmarks): mount host HF cache into genai-bench container genai-bench runs inside an ephemeral Docker container (--rm) that has no access to the host's HuggingFace cache. Each invocation downloads the tokenizer fresh from HuggingFace, which intermittently hangs and causes benchmark timeouts (exit code -9). Mount the host's HF cache directory (~/.cache/huggingface) into the container so genai-bench reuses tokenizers already downloaded by the sglang workers that run on the host. Also revert the timeout_sec=480 workaround from test_pd_perf since the root cause is the HF download hang, not insufficient timeout. Signed-off-by: Simo Lin --- e2e_test/benchmarks/conftest.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/e2e_test/benchmarks/conftest.py b/e2e_test/benchmarks/conftest.py index 05f9504c58..71e01d5cd3 100644 --- a/e2e_test/benchmarks/conftest.py +++ b/e2e_test/benchmarks/conftest.py @@ -53,6 +53,13 @@ def _build_command( if local_model_path: cmd.extend(["-v", f"{local_model_path}:{local_model_path}"]) + # Mount host HF cache into container so genai-bench reuses tokenizers + # already downloaded by sglang workers instead of downloading from HF + # (HF downloads inside ephemeral containers hang intermittently). + hf_home = os.environ.get("HF_HOME", os.path.join(Path.home(), ".cache", "huggingface")) + if os.path.isdir(hf_home): + cmd.extend(["-v", f"{hf_home}:{hf_home}", "-e", f"HF_HOME={hf_home}"]) + # Pass through environment variables the container may need for var in ("HF_TOKEN", "HF_HOME"): if os.environ.get(var):