- 自部署单独用支持:给添哥
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
"""
|
||||
模型下载脚本
|
||||
|
||||
"""
|
||||
from modelscope import snapshot_download
|
||||
|
||||
|
||||
def download(repo_id:str, local_dir:str):
|
||||
"""
|
||||
下载模型仓库或单个文件
|
||||
|
||||
|
||||
Args:
|
||||
repo_id (str): 用户名/仓库名,例如 'stabilityai/sdxl-turbo'
|
||||
local_dir (str or Path): 下载文件放置的本地目录路径
|
||||
|
||||
Returns:
|
||||
str: 下载文件的本地路径
|
||||
|
||||
Raises:
|
||||
ValueError: 当 repo_id 格式不正确时
|
||||
"""
|
||||
model_dir = snapshot_download(
|
||||
repo_id,
|
||||
repo_type='model',
|
||||
local_dir=f"{local_dir}/{repo_id}",
|
||||
)
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
download("OpenBMB/VoxCPM2", "./models")
|
||||
download("iic/SenseVoiceSmall", "./models")
|
||||
Reference in New Issue
Block a user