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
4efff036
Unverified
Commit
4efff036
authored
Jun 07, 2024
by
liuyhwangyh
Committed by
GitHub
Jun 06, 2024
Browse files
Bugfix: fix broken of download models from modelscope (#5233)
Co-authored-by:
mulin.lyh
<
mulin.lyh@taobao.com
>
parent
89c92078
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
2 deletions
+32
-2
tests/test_regression.py
tests/test_regression.py
+21
-0
vllm/config.py
vllm/config.py
+5
-1
vllm/transformers_utils/config.py
vllm/transformers_utils/config.py
+6
-1
No files found.
tests/test_regression.py
View file @
4efff036
...
...
@@ -53,6 +53,27 @@ def test_gc():
assert
allocated
<
50
*
1024
*
1024
def
test_model_from_modelscope
(
monkeypatch
):
# model: https://modelscope.cn/models/qwen/Qwen1.5-0.5B-Chat/summary
MODELSCOPE_MODEL_NAME
=
"qwen/Qwen1.5-0.5B-Chat"
monkeypatch
.
setenv
(
"VLLM_USE_MODELSCOPE"
,
"True"
)
try
:
llm
=
LLM
(
model
=
MODELSCOPE_MODEL_NAME
)
prompts
=
[
"Hello, my name is"
,
"The president of the United States is"
,
"The capital of France is"
,
"The future of AI is"
,
]
sampling_params
=
SamplingParams
(
temperature
=
0.8
,
top_p
=
0.95
)
outputs
=
llm
.
generate
(
prompts
,
sampling_params
)
assert
len
(
outputs
)
==
4
finally
:
monkeypatch
.
delenv
(
"VLLM_USE_MODELSCOPE"
,
raising
=
False
)
if
__name__
==
"__main__"
:
import
pytest
pytest
.
main
([
__file__
])
vllm/config.py
View file @
4efff036
...
...
@@ -113,6 +113,10 @@ class ModelConfig:
self
.
revision
=
revision
self
.
code_revision
=
code_revision
self
.
rope_scaling
=
rope_scaling
# The tokenizer version is consistent with the model version by default.
if
tokenizer_revision
is
None
:
self
.
tokenizer_revision
=
revision
else
:
self
.
tokenizer_revision
=
tokenizer_revision
self
.
quantization
=
quantization
self
.
quantization_param_path
=
quantization_param_path
...
...
vllm/transformers_utils/config.py
View file @
4efff036
from
typing
import
Dict
,
Optional
from
transformers
import
AutoConfig
,
PretrainedConfig
from
transformers
import
PretrainedConfig
from
vllm.envs
import
VLLM_USE_MODELSCOPE
from
vllm.logger
import
init_logger
from
vllm.transformers_utils.configs
import
(
ChatGLMConfig
,
DbrxConfig
,
JAISConfig
,
MPTConfig
,
RWConfig
)
...
...
@@ -24,6 +25,10 @@ def get_config(model: str,
code_revision
:
Optional
[
str
]
=
None
,
rope_scaling
:
Optional
[
dict
]
=
None
)
->
PretrainedConfig
:
try
:
if
VLLM_USE_MODELSCOPE
:
from
modelscope
import
AutoConfig
else
:
from
transformers
import
AutoConfig
config
=
AutoConfig
.
from_pretrained
(
model
,
trust_remote_code
=
trust_remote_code
,
...
...
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