mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2025-12-10 06:35:00 +08:00
[Bugfix] Fix VLLM_USE_MODELSCOPE issue (#13384)
This commit is contained in:
parent
30513d1cb6
commit
ce77eb9410
@ -117,6 +117,12 @@ def list_repo_files(
|
||||
|
||||
def lookup_files():
|
||||
try:
|
||||
if VLLM_USE_MODELSCOPE:
|
||||
from vllm.transformers_utils.utils import (
|
||||
modelscope_list_repo_files)
|
||||
return modelscope_list_repo_files(repo_id,
|
||||
revision=revision,
|
||||
token=token)
|
||||
return hf_list_repo_files(repo_id,
|
||||
revision=revision,
|
||||
repo_type=repo_type,
|
||||
@ -499,7 +505,7 @@ def get_sentence_transformer_tokenizer_config(model: str,
|
||||
revision=revision,
|
||||
token=HF_TOKEN)
|
||||
except Exception as e:
|
||||
logger.debug("Error getting repo files", e)
|
||||
logger.error("Error getting repo files", e)
|
||||
repo_files = []
|
||||
|
||||
for config_name in sentence_transformer_config_files:
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
|
||||
from os import PathLike
|
||||
from pathlib import Path
|
||||
from typing import Union
|
||||
from typing import List, Optional, Union
|
||||
|
||||
|
||||
def is_s3(model_or_path: str) -> bool:
|
||||
@ -20,3 +20,22 @@ def check_gguf_file(model: Union[str, PathLike]) -> bool:
|
||||
with open(model, "rb") as f:
|
||||
header = f.read(4)
|
||||
return header == b"GGUF"
|
||||
|
||||
|
||||
def modelscope_list_repo_files(
|
||||
repo_id: str,
|
||||
revision: Optional[str] = None,
|
||||
token: Union[str, bool, None] = None,
|
||||
) -> List[str]:
|
||||
"""List files in a modelscope repo."""
|
||||
from modelscope.hub.api import HubApi
|
||||
from modelscope.utils.hf_util import _try_login
|
||||
_try_login(token)
|
||||
api = HubApi()
|
||||
# same as huggingface_hub.list_repo_files
|
||||
files = [
|
||||
file['Path'] for file in api.get_model_files(
|
||||
model_id=repo_id, revision=revision, recursive=True)
|
||||
if file['Type'] == 'blob'
|
||||
]
|
||||
return files
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user