Skip to content

feat: enhance model download instructions and script. #956

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,19 @@ sudo yum install sox sox-devel

**Model download**

We strongly recommend that you download our pretrained `CosyVoice2-0.5B` `CosyVoice-300M` `CosyVoice-300M-SFT` `CosyVoice-300M-Instruct` model and `CosyVoice-ttsfrd` resource.
We strongly recommend that you download our pretrained `CosyVoice2-0.5B` `CosyVoice-300M` `CosyVoice-300M-SFT` `CosyVoice-300M-Instruct` model and `CosyVoice-ttsfrd` resource using the script:

On Windows:
```bash
python .\tools\models_download.py
```

On Linux/Mac:
```bash
python ./tools/models_download.py
```

Alternatively, you can also download models manually:

``` python
# SDK模型下载
Expand Down
24 changes: 24 additions & 0 deletions tools/models_download.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Model download using SDK
from modelscope import snapshot_download
import os

# Get paths
CURRENT_DIR = os.path.dirname(os.path.abspath(__file__))
PARENT_DIR = os.path.dirname(CURRENT_DIR)

# Model name constants
MODEL_NAMES = {
"base": "CosyVoice2-0.5B",
"hz25": "CosyVoice-300M-25Hz",
"sft": "CosyVoice-300M-SFT",
"instruct": "CosyVoice-300M-Instruct",
"ttsfrd": "CosyVoice-ttsfrd"
}

# Model storage directory name
MODELS_DIR = "pretrained_models"

# Download all models
for model_key, model_name in MODEL_NAMES.items():
target_dir = os.path.join(PARENT_DIR, MODELS_DIR, model_name)
snapshot_download(f"iic/{model_name}", local_dir=target_dir)