[Bugfix] Fix VLLM_USE_MODELSCOPE issue (#13384)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user