A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 15, 11:00 UTC
[Misc] Improve modelscope import error (#17983)
Signed-off-by: Jee Jee Li <pandaleefree@gmail.com>
Jee Jee Li committed
May 12, 2025 at 18:46 UTC
7ea6cb28b260c4b8aeeaf103a47efc7fd5f97982
1 file changed
+16
-12
vllm/transformers_utils/__init__.py
+16
-12
@@ -3,17 +3,21 @@
3
from vllm.envs import VLLM_USE_MODELSCOPE
4
5
if VLLM_USE_MODELSCOPE:
6
- # Patch here, before each import happens
7
- import modelscope
8
- from packaging import version
6
+ try:
7
+ # Patch here, before each import happens
8
+ import modelscope
9
+ from packaging import version
10
10
- # patch_hub begins from modelscope>=1.18.1
11
- if version.parse(modelscope.__version__) <= version.parse('1.18.0'):
12
- raise ImportError(
13
- 'Using vLLM with ModelScope needs modelscope>=1.18.1, please '
14
- 'install by `pip install modelscope -U`')
15
-
16
- from modelscope.utils.hf_util import patch_hub
11
+ # patch_hub begins from modelscope>=1.18.1
12
+ if version.parse(modelscope.__version__) <= version.parse('1.18.0'):
13
+ raise ImportError(
14
+ 'Using vLLM with ModelScope needs modelscope>=1.18.1, please '
15
+ 'install by `pip install modelscope -U`')
16
+ from modelscope.utils.hf_util import patch_hub
17
18
- # Patch hub to download models from modelscope to speed up.
19
- patch_hub()
18
+ # Patch hub to download models from modelscope to speed up.
19
+ patch_hub()
20
+ except ImportError as err:
21
+ raise ImportError(
22
+ "Please install modelscope>=1.18.1 via "
23
+ "`pip install modelscope>=1.18.1` to use ModelScope.") from err