Skip to content

Commit eaad08a

Browse files
committed
[CI] Patch modelscope list repo files to fix CI
Signed-off-by: MengqingCao <[email protected]>
1 parent 11f4971 commit eaad08a

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

vllm_ascend/patch/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@
1919
import vllm_ascend.patch.patch_minicpm # noqa
2020
import vllm_ascend.patch.patch_rejection_sampler # noqa
2121
import vllm_ascend.patch.patch_spec_decode_worker # noqa
22+
import vllm_ascend.patch.patch_transformers_utils # noqa
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#
2+
# Copyright (c) 2025 Huawei Technologies Co., Ltd. All Rights Reserved.
3+
# This file is a part of the vllm-ascend project.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing, software
12+
# distributed under the License is distributed on an "AS IS" BASIS,
13+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
# See the License for the specific language governing permissions and
15+
# limitations under the License.
16+
#
17+
18+
from typing import List, Optional, Union
19+
20+
import vllm
21+
22+
23+
def modelscope_list_repo_files_patch(
24+
repo_id: str,
25+
revision: Optional[str] = None,
26+
token: Union[str, bool, None] = None,
27+
) -> List[str]:
28+
"""List files in a modelscope repo."""
29+
from modelscope.hub.api import HubApi # type: ignore
30+
api = HubApi()
31+
api.login(token)
32+
# same as huggingface_hub.list_repo_files
33+
files = [
34+
file['Path'] for file in api.get_model_files(
35+
model_id=repo_id, revision=revision, recursive=True)
36+
if file['Type'] == 'blob'
37+
]
38+
return files
39+
40+
41+
# NOTE: this patch should only be included in v0.7.3. It has been fixed in
42+
# https://github.com/vllm-project/vllm/pull/13807
43+
vllm.transformers_utils.utils.modelscope_list_repo_files = \
44+
modelscope_list_repo_files_patch

0 commit comments

Comments
 (0)