【Spark-TTS安装部署】

发布于:2025-06-29 ⋅ 阅读:(20) ⋅ 点赞:(0)

Spark-TTS Installation (Windows Guide)

Download Spark-TTS

git clone https://github.com/SparkAudio/Spark-TTS.git

1. Install Conda (if you haven’t already)

2. Create a Conda Environment

conda create -n sparktts python=3.12 -y
conda activate sparktts

3. Install Dependencies

pip install -r requirements.txt

4. Install PyTorch (Auto-Detect CUDA or CPU)

pip install torch torchvision torchaudio --index-url https://pytorch.org/get-started/previous-versions/

# OR Manually install a specific CUDA version (if needed)
# pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu121
# pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118  # Older GPUs

我的autoDL安装的是pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 # Older GPUs

5. Download the Model

注意国内服务器需要配置hugginface镜像地址

临时配置脚本

export HF_ENDPOINT=https://hf-mirror.com

下载脚本

from huggingface_hub import snapshot_download
import os

# 需要配置huggingface镜像地址
# export HF_ENDPOINT=https://hf-mirror.com
# Set download path
model_dir = "pretrained_models/Spark-TTS-0.5B"

# Check if model already exists
if os.path.exists(model_dir) and len(os.listdir(model_dir)) > 0:
    print("Model files already exist. Skipping download.")
else:
    print("Downloading model files...")
    snapshot_download(
        repo_id="SparkAudio/Spark-TTS-0.5B",
        local_dir=model_dir,
        resume_download=True  # Resumes partial downloads
    )
    print("Download complete!")

可以断点续传的下载脚本

from huggingface_hub import snapshot_download
import os

# 需要配置huggingface镜像地址
# export HF_ENDPOINT=https://hf-mirror.com
# Set download path
model_dir = "pretrained_models/Spark-TTS-0.5B"

# Check if model already exists
print("Downloading model files...")
snapshot_download(
    repo_id="SparkAudio/Spark-TTS-0.5B",
    local_dir=model_dir,
    resume_download=True  # Resumes partial downloads
)
print("Download complete!")

网站公告

今日签到

点亮在社区的每一天
去签到