From 9361cb795f2c770f3e033fb605cac4f1c16ac952 Mon Sep 17 00:00:00 2001 From: liuyhwangyh Date: Wed, 7 Feb 2024 01:57:15 +0800 Subject: [PATCH] modelscope: fix issue when model parameter is not a model id but path of the model. (#2489) --- vllm/config.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/vllm/config.py b/vllm/config.py index 1dfc0d63c8813..c35b6302b2cfa 100644 --- a/vllm/config.py +++ b/vllm/config.py @@ -93,9 +93,12 @@ def __init__( # download model from ModelScope hub, # lazy import so that modelscope is not required for normal use. from modelscope.hub.snapshot_download import snapshot_download # pylint: disable=C - model_path = snapshot_download(model_id=model, - cache_dir=download_dir, - revision=revision) + if not os.path.exists(model): + model_path = snapshot_download(model_id=model, + cache_dir=download_dir, + revision=revision) + else: + model_path = model self.model = model_path self.download_dir = model_path self.tokenizer = model_path