Unverified Commit 04913430 authored by yrk111222's avatar yrk111222 Committed by GitHub
Browse files

Feature/modelscope model download (#8083)


Co-authored-by: default avatarronnie_zheng <zl19940307@163.com>
parent 0ad098b4
...@@ -418,6 +418,26 @@ if __name__ == "__main__": ...@@ -418,6 +418,26 @@ if __name__ == "__main__":
ServerArgs.add_cli_args(parser) ServerArgs.add_cli_args(parser)
BenchArgs.add_cli_args(parser) BenchArgs.add_cli_args(parser)
args = parser.parse_args() args = parser.parse_args()
# handling ModelScope model downloads
if os.getenv("SGLANG_USE_MODELSCOPE", "false").lower() in ("true", "1"):
if os.path.exists(args.model_path):
print(f"Using local model path: {args.model_path}")
else:
try:
from modelscope import snapshot_download
print(f"Using ModelScope to download model: {args.model_path}")
# download the model and replace args.model_path
args.model_path = snapshot_download(
args.model_path,
)
print(f"Model downloaded to: {args.model_path}")
except Exception as e:
print(f"ModelScope download failed: {str(e)}")
raise e
server_args = ServerArgs.from_cli_args(args) server_args = ServerArgs.from_cli_args(args)
bench_args = BenchArgs.from_cli_args(args) bench_args = BenchArgs.from_cli_args(args)
......
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