From 5cecfc01375052698823fc401e31518fb32a981e Mon Sep 17 00:00:00 2001 From: Cyrus Leung Date: Sat, 15 Aug 2026 17:40:24 +0800 Subject: [PATCH] [Bugfix] Fix modelscope usage (#52431) Signed-off-by: DarkLight1337 --- vllm/envs.py | 3 +-- vllm/transformers_utils/utils.py | 5 ++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/vllm/envs.py b/vllm/envs.py index 07a22dc7c7..ed62659cfa 100755 --- a/vllm/envs.py +++ b/vllm/envs.py @@ -716,9 +716,8 @@ environment_variables: dict[str, Callable[[], Any]] = { "VLLM_RPC_BASE_PATH", tempfile.gettempdir() ), # If true, will load models from ModelScope instead of Hugging Face Hub. - # note that the value is true or false, not numbers "VLLM_USE_MODELSCOPE": lambda: ( - os.environ.get("VLLM_USE_MODELSCOPE", "False").lower() == "true" + os.environ.get("VLLM_USE_MODELSCOPE", "False").strip().lower() in ("1", "true") ), # If true, replace the Rust BPE backend that powers HF fast tokenizers # with the `fastokens` (https://github.com/crusoecloud/fastokens) shim. diff --git a/vllm/transformers_utils/utils.py b/vllm/transformers_utils/utils.py index cd215421a9..674f6a05bf 100644 --- a/vllm/transformers_utils/utils.py +++ b/vllm/transformers_utils/utils.py @@ -48,15 +48,14 @@ def modelscope_list_repo_files( api = HubApi() api.login(token) + # same as huggingface_hub.list_repo_files - files = [ + return [ file["Path"] for file in api.get_model_files( model_id=repo_id, revision=revision, recursive=True ) - if file["Type"] == "blob" ] - return files def _maybe_json_dict(path: str | PathLike) -> dict[str, str]: