Unverified Commit ed70c70e authored by liuyhwangyh's avatar liuyhwangyh Committed by GitHub
Browse files

modelscope: fix issue when model parameter is not a model id but path of the model. (#2489)

parent f0d4e145
...@@ -93,9 +93,12 @@ class ModelConfig: ...@@ -93,9 +93,12 @@ class ModelConfig:
# download model from ModelScope hub, # download model from ModelScope hub,
# lazy import so that modelscope is not required for normal use. # lazy import so that modelscope is not required for normal use.
from modelscope.hub.snapshot_download import snapshot_download # pylint: disable=C from modelscope.hub.snapshot_download import snapshot_download # pylint: disable=C
if not os.path.exists(model):
model_path = snapshot_download(model_id=model, model_path = snapshot_download(model_id=model,
cache_dir=download_dir, cache_dir=download_dir,
revision=revision) revision=revision)
else:
model_path = model
self.model = model_path self.model = model_path
self.download_dir = model_path self.download_dir = model_path
self.tokenizer = model_path self.tokenizer = model_path
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment