mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2026-05-03 02:44:30 +08:00
[Misc] Improve modelscope import error (#17983)
Signed-off-by: Jee Jee Li <pandaleefree@gmail.com>
This commit is contained in:
parent
9fbf2bfbd5
commit
7ea6cb28b2
@ -3,17 +3,21 @@
|
|||||||
from vllm.envs import VLLM_USE_MODELSCOPE
|
from vllm.envs import VLLM_USE_MODELSCOPE
|
||||||
|
|
||||||
if VLLM_USE_MODELSCOPE:
|
if VLLM_USE_MODELSCOPE:
|
||||||
# Patch here, before each import happens
|
try:
|
||||||
import modelscope
|
# Patch here, before each import happens
|
||||||
from packaging import version
|
import modelscope
|
||||||
|
from packaging import version
|
||||||
|
|
||||||
# patch_hub begins from modelscope>=1.18.1
|
# patch_hub begins from modelscope>=1.18.1
|
||||||
if version.parse(modelscope.__version__) <= version.parse('1.18.0'):
|
if version.parse(modelscope.__version__) <= version.parse('1.18.0'):
|
||||||
|
raise ImportError(
|
||||||
|
'Using vLLM with ModelScope needs modelscope>=1.18.1, please '
|
||||||
|
'install by `pip install modelscope -U`')
|
||||||
|
from modelscope.utils.hf_util import patch_hub
|
||||||
|
|
||||||
|
# Patch hub to download models from modelscope to speed up.
|
||||||
|
patch_hub()
|
||||||
|
except ImportError as err:
|
||||||
raise ImportError(
|
raise ImportError(
|
||||||
'Using vLLM with ModelScope needs modelscope>=1.18.1, please '
|
"Please install modelscope>=1.18.1 via "
|
||||||
'install by `pip install modelscope -U`')
|
"`pip install modelscope>=1.18.1` to use ModelScope.") from err
|
||||||
|
|
||||||
from modelscope.utils.hf_util import patch_hub
|
|
||||||
|
|
||||||
# Patch hub to download models from modelscope to speed up.
|
|
||||||
patch_hub()
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user