-
-
Notifications
You must be signed in to change notification settings - Fork 157
Troubleshooting MissingModels
If you encounter missing models, you can download them using the provided scripts. The scripts support both Python and Bash, and can download models for either CPU or GPU.
-
Navigate to the Script Directory:
- Open your terminal or command prompt.
- Navigate to the directory where the script is located. This is typically
Kokoro-FastAPI/docker/scripts
.
-
Run the Script:
- Use the following command to download the models:
python download_model.py --type [pth|onnx]
- Replace
[pth|onnx]
withpth
for PyTorch models oronnx
for ONNX models. - If you want to overwrite existing files, add the
--overwrite
flag:python download_model.py --type [pth|onnx] --overwrite
- Use the following command to download the models:
-
Default Models:
- If you don't provide any URLs, the script will download default models. These are:
- For PyTorch:
kokoro-v0_19.pth
andkokoro-v0_19-half.pth
- For ONNX:
kokoro-v0_19.onnx
andkokoro-v0_19_fp16.onnx
- For PyTorch:
- If you don't provide any URLs, the script will download default models. These are:
-
Custom Models:
- You can also provide custom URLs to download specific models. To use them, you will need to adjust the environment variable for the targeted model as well. See core/config.py:
python download_model.py --type [pth|onnx] [URL1] [URL2] ...
- You can also provide custom URLs to download specific models. To use them, you will need to adjust the environment variable for the targeted model as well. See core/config.py:
-
Navigate to the Script Directory:
- Open your terminal or command prompt.
- Navigate to the directory where the script is located. This is typically
Kokoro-FastAPI/docker/scripts
.
-
Run the Script:
- Use the following command to download the models:
./download_model.sh --type [pth|onnx]
- Replace
[pth|onnx]
withpth
for PyTorch models oronnx
for ONNX models.
- Use the following command to download the models:
-
Default Models:
- If you don't provide any URLs, the script will download default models. These are:
- For PyTorch:
kokoro-v0_19.pth
andkokoro-v0_19-half.pth
- For ONNX:
kokoro-v0_19.onnx
andkokoro-v0_19_fp16.onnx
- For PyTorch:
- If you don't provide any URLs, the script will download default models. These are:
-
Custom Models:
- You can also provide custom URLs to download specific models:
./download_model.sh --type [pth|onnx] [URL1] [URL2] ...
- You can also provide custom URLs to download specific models:
The scripts are designed to download model files from the specified URLs and save them to the api/src/models
directory within your project. They handle different model types (PyTorch and ONNX) and can download default models if no URLs are provided.
-
Python Script: This script uses the
requests
library to download files. It checks if the file already exists and skips the download if it does. It also handles errors gracefully. -
Bash Script: This script uses
curl
to download files. It checks if the file already exists and skips the download if it does. It also handles errors gracefully.
Both scripts are located in the Kokoro-FastAPI/docker/scripts
directory. You can run them from there or from any directory by providing the full path to the script.
See sidebar for pages