Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
550d97eb
Unverified
Commit
550d97eb
authored
Feb 20, 2025
by
Isotr0py
Committed by
GitHub
Feb 19, 2025
Browse files
[Misc] Avoid calling unnecessary `hf_list_repo_files` for local model path (#13348)
Signed-off-by:
isotr0py
<
2037008807@qq.com
>
parent
fbbe1fba
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
+10
-3
vllm/transformers_utils/config.py
vllm/transformers_utils/config.py
+10
-3
No files found.
vllm/transformers_utils/config.py
View file @
550d97eb
...
...
@@ -115,7 +115,14 @@ def list_repo_files(
token
:
Union
[
str
,
bool
,
None
]
=
None
,
)
->
list
[
str
]:
def
lookup_files
():
def
lookup_files
()
->
list
[
str
]:
# directly list files if model is local
if
(
local_path
:
=
Path
(
repo_id
)).
exists
():
return
[
str
(
file
.
relative_to
(
local_path
))
for
file
in
local_path
.
rglob
(
'*'
)
if
file
.
is_file
()
]
# if model is remote, use hf_hub api to list files
try
:
if
VLLM_USE_MODELSCOPE
:
from
vllm.transformers_utils.utils
import
(
...
...
@@ -154,8 +161,8 @@ def file_exists(
# In offline mode the result can be a false negative
def
file_or_path_exists
(
model
:
Union
[
str
,
Path
],
config_name
:
str
,
revision
:
Optional
[
str
])
->
bool
:
if
Path
(
model
).
exists
():
return
(
Path
(
model
)
/
config_name
).
is_file
()
if
(
local_path
:
=
Path
(
model
)
)
.
exists
():
return
(
local_path
/
config_name
).
is_file
()
# Offline mode support: Check if config file is cached already
cached_filepath
=
try_to_load_from_cache
(
repo_id
=
model
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment