Unverified Commit adaf2c6d authored by Ning Xie's avatar Ning Xie Committed by GitHub
Browse files

[Bugfix] fix modelscope snapshot_download serialization (#21536)


Signed-off-by: default avatarAndy Xie <andy.xning@gmail.com>
parent 42343f1f
...@@ -69,10 +69,10 @@ class DefaultModelLoader(BaseModelLoader): ...@@ -69,10 +69,10 @@ class DefaultModelLoader(BaseModelLoader):
# pylint: disable=C. # pylint: disable=C.
from modelscope.hub.snapshot_download import snapshot_download from modelscope.hub.snapshot_download import snapshot_download
if not os.path.exists(model): # Use file lock to prevent multiple processes from
# Use file lock to prevent multiple processes from # downloading the same model weights at the same time.
# downloading the same model weights at the same time. with get_lock(model, self.load_config.download_dir):
with get_lock(model, self.load_config.download_dir): if not os.path.exists(model):
model_path = snapshot_download( model_path = snapshot_download(
model_id=model, model_id=model,
cache_dir=self.load_config.download_dir, cache_dir=self.load_config.download_dir,
...@@ -81,8 +81,8 @@ class DefaultModelLoader(BaseModelLoader): ...@@ -81,8 +81,8 @@ class DefaultModelLoader(BaseModelLoader):
revision=revision, revision=revision,
ignore_file_pattern=self.load_config.ignore_patterns, ignore_file_pattern=self.load_config.ignore_patterns,
) )
else: else:
model_path = model model_path = model
return model_path return model_path
return None return None
......
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