[ci][test] exclude model download time in server start time (#7834)

This commit is contained in:
youkaichao 2024-08-24 01:03:27 -07:00 committed by GitHub
parent 7d9ffa2ae1
commit ea9fa160e3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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"