From ea9fa160e3b47e0b8aa273f3eb2be410bd1ccab5 Mon Sep 17 00:00:00 2001 From: youkaichao Date: Sat, 24 Aug 2024 01:03:27 -0700 Subject: [PATCH] [ci][test] exclude model download time in server start time (#7834) --- tests/utils.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/utils.py b/tests/utils.py index 3e0124fa..a37b7ee3 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -11,6 +11,7 @@ from typing import Any, Callable, Dict, List, Optional import openai import requests +from huggingface_hub import snapshot_download from transformers import AutoTokenizer from typing_extensions import ParamSpec @@ -64,6 +65,10 @@ class RemoteOpenAIServer: env_dict: Optional[Dict[str, str]] = None, auto_port: bool = True, max_wait_seconds: Optional[float] = None) -> None: + if not model.startswith("/"): + # download the model if it's not a local path + # to exclude the model download time from the server start time + model = snapshot_download(model) if auto_port: if "-p" in cli_args or "--port" in cli_args: raise ValueError("You have manually specified the port"