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
ce77eb94
Unverified
Commit
ce77eb94
authored
Feb 17, 2025
by
r.4ntix
Committed by
GitHub
Feb 17, 2025
Browse files
[Bugfix] Fix VLLM_USE_MODELSCOPE issue (#13384)
parent
30513d1c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
7 deletions
+32
-7
vllm/transformers_utils/config.py
vllm/transformers_utils/config.py
+12
-6
vllm/transformers_utils/utils.py
vllm/transformers_utils/utils.py
+20
-1
No files found.
vllm/transformers_utils/config.py
View file @
ce77eb94
...
@@ -117,6 +117,12 @@ def list_repo_files(
...
@@ -117,6 +117,12 @@ def list_repo_files(
def
lookup_files
():
def
lookup_files
():
try
:
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
,
return
hf_list_repo_files
(
repo_id
,
revision
=
revision
,
revision
=
revision
,
repo_type
=
repo_type
,
repo_type
=
repo_type
,
...
@@ -382,17 +388,17 @@ def get_hf_file_to_dict(file_name: str,
...
@@ -382,17 +388,17 @@ def get_hf_file_to_dict(file_name: str,
@
cache
@
cache
def
get_pooling_config
(
model
:
str
,
revision
:
Optional
[
str
]
=
'main'
):
def
get_pooling_config
(
model
:
str
,
revision
:
Optional
[
str
]
=
'main'
):
"""
"""
This function gets the pooling and normalize
This function gets the pooling and normalize
config from the model - only applies to
config from the model - only applies to
sentence-transformers models.
sentence-transformers models.
Args:
Args:
model (str): The name of the Hugging Face model.
model (str): The name of the Hugging Face model.
revision (str, optional): The specific version
revision (str, optional): The specific version
of the model to use. Defaults to 'main'.
of the model to use. Defaults to 'main'.
Returns:
Returns:
dict: A dictionary containing the pooling
dict: A dictionary containing the pooling
type and whether normalization is used.
type and whether normalization is used.
"""
"""
...
@@ -499,7 +505,7 @@ def get_sentence_transformer_tokenizer_config(model: str,
...
@@ -499,7 +505,7 @@ def get_sentence_transformer_tokenizer_config(model: str,
revision
=
revision
,
revision
=
revision
,
token
=
HF_TOKEN
)
token
=
HF_TOKEN
)
except
Exception
as
e
:
except
Exception
as
e
:
logger
.
debug
(
"Error getting repo files"
,
e
)
logger
.
error
(
"Error getting repo files"
,
e
)
repo_files
=
[]
repo_files
=
[]
for
config_name
in
sentence_transformer_config_files
:
for
config_name
in
sentence_transformer_config_files
:
...
...
vllm/transformers_utils/utils.py
View file @
ce77eb94
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
from
os
import
PathLike
from
os
import
PathLike
from
pathlib
import
Path
from
pathlib
import
Path
from
typing
import
Union
from
typing
import
List
,
Optional
,
Union
def
is_s3
(
model_or_path
:
str
)
->
bool
:
def
is_s3
(
model_or_path
:
str
)
->
bool
:
...
@@ -20,3 +20,22 @@ def check_gguf_file(model: Union[str, PathLike]) -> bool:
...
@@ -20,3 +20,22 @@ def check_gguf_file(model: Union[str, PathLike]) -> bool:
with
open
(
model
,
"rb"
)
as
f
:
with
open
(
model
,
"rb"
)
as
f
:
header
=
f
.
read
(
4
)
header
=
f
.
read
(
4
)
return
header
==
b
"GGUF"
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
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