voice / clone_repo.py
ikuner's picture
Create clone_repo.py
1ea50ba verified
raw
history blame contribute delete
610 Bytes
import os
import subprocess
# 安装 git-lfs
subprocess.run(["git", "lfs", "install"], check=True)
# 克隆仓库
repo_url = "https://huggingface.co/spaces/XzJosh/dingzhen-GPT-SoVITS"
subprocess.run(["git", "clone", repo_url], check=True)
# 如果想在没有大文件的情况下克隆,仅克隆它们的指针
# subprocess.run(["GIT_LFS_SKIP_SMUDGE=1", "git", "clone", repo_url], check=True)
# 复制内容到当前目录
repo_name = repo_url.split('/')[-1]
subprocess.run(["cp", "-r", f"./{repo_name}/.", "."], check=True)
# 删除克隆的目录
subprocess.run(["rm", "-rf", repo_name], check=True)