CI: use 'sglang serve' in CI tests (#18597)
Co-authored-by: Mick <mickjagger19@icloud.com> Co-authored-by: sglang-bot <sglangbot@gmail.com>
This commit is contained in:
co-authored by
Mick
sglang-bot
parent
776709efe8
commit
e6da514c2c
@@ -26,6 +26,33 @@ def _get_lock(model_name_or_path: str, cache_dir: Optional[str] = None):
|
||||
return lock
|
||||
|
||||
|
||||
def _hf_hub_download(
|
||||
repo_id: str,
|
||||
filename: str,
|
||||
local_dir: Optional[str] = None,
|
||||
**kwargs,
|
||||
) -> str:
|
||||
"""Unified hf_hub_download supporting both Hugging Face Hub and ModelScope."""
|
||||
if envs.SGLANG_USE_MODELSCOPE.get():
|
||||
from modelscope import model_file_download
|
||||
|
||||
return model_file_download(
|
||||
model_id=repo_id,
|
||||
file_path=filename,
|
||||
cache_dir=local_dir,
|
||||
**kwargs,
|
||||
)
|
||||
else:
|
||||
from huggingface_hub import hf_hub_download as _hf_hub_download_impl
|
||||
|
||||
return _hf_hub_download_impl(
|
||||
repo_id=repo_id,
|
||||
filename=filename,
|
||||
local_dir=local_dir,
|
||||
**kwargs,
|
||||
)
|
||||
|
||||
|
||||
# Copied and adapted from hf_diffusers_utils.py
|
||||
def _maybe_download_model(
|
||||
model_name_or_path: str, local_dir: str | None = None, download: bool = True
|
||||
@@ -44,8 +71,6 @@ def _maybe_download_model(
|
||||
Local directory path that contains the downloaded config file, or the original local directory.
|
||||
"""
|
||||
|
||||
from sglang.multimodal_gen.runtime.utils.hf_diffusers_utils import hf_hub_download
|
||||
|
||||
if os.path.exists(model_name_or_path):
|
||||
logger.debug("Model already exists locally")
|
||||
return model_name_or_path
|
||||
@@ -62,7 +87,7 @@ def _maybe_download_model(
|
||||
source_hub,
|
||||
model_name_or_path,
|
||||
)
|
||||
file_path = hf_hub_download(
|
||||
file_path = _hf_hub_download(
|
||||
repo_id=model_name_or_path,
|
||||
filename="model_index.json",
|
||||
local_dir=local_dir,
|
||||
@@ -79,7 +104,7 @@ def _maybe_download_model(
|
||||
source_hub,
|
||||
model_name_or_path,
|
||||
)
|
||||
file_path = hf_hub_download(
|
||||
file_path = _hf_hub_download(
|
||||
repo_id=model_name_or_path,
|
||||
filename="config.json",
|
||||
local_dir=local_dir,
|
||||
|
||||
Reference in New Issue
Block a user