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 9, 19:30 UTC
[Bugfix] ModelScope is supported when downloading LORA models. (#32844)
Signed-off-by: AuYang <459461160@qq.com>
Xu Jinyang committed
Jan 23, 2026 at 00:33 UTC
fc37187a51474b42c0b80cd672d3bdaacb0c026d
1 file changed
+21
-6
vllm/lora/utils.py
+21
-6
@@ -9,6 +9,7 @@ from huggingface_hub.utils import HfHubHTTPError, HFValidationError
9
from torch import nn
10
from transformers import PretrainedConfig
11
12
+from vllm import envs
13
from vllm.config.lora import LoRAConfig
14
from vllm.logger import init_logger
15
@@ -235,13 +236,27 @@ def get_adapter_absolute_path(lora_path: str) -> str:
236
if os.path.exists(lora_path):
237
return os.path.abspath(lora_path)
238
238
- # If the path does not exist locally, assume it's a Hugging Face repo.
239
+ # If the path does not exist locally.
240
+ if envs.VLLM_USE_MODELSCOPE:
241
+ # If using ModelScope, we assume the path is a ModelScope repo.
242
+ from modelscope.hub.snapshot_download import InvalidParameter, snapshot_download
243
+ from requests import HTTPError
244
+
245
+ download_fn = lambda: snapshot_download(model_id=lora_path)
246
+ download_exceptions = (HTTPError, InvalidParameter)
247
+ error_log = "Error downloading the ModelScope model"
248
+ else:
249
+ # Otherwise, we assume the path is a Hugging Face Hub repo.
250
+ download_fn = lambda: huggingface_hub.snapshot_download(repo_id=lora_path)
251
+ download_exceptions = (HfHubHTTPError, HFValidationError)
252
+ error_log = "Error downloading the HuggingFace model"
253
+
254
try:
240
- local_snapshot_path = huggingface_hub.snapshot_download(repo_id=lora_path)
241
- except (HfHubHTTPError, HFValidationError):
242
- # Handle errors that may occur during the download
243
- # Return original path instead of throwing error here
244
- logger.exception("Error downloading the HuggingFace model")
255
+ local_snapshot_path = download_fn()
256
+ except download_exceptions:
257
+ # Handle errors that may occur during the download.
258
+ # Return original path instead of throwing error here.
259
+ logger.exception(error_log)
260
return lora_path
261
262
return local_snapshot_path