Skip to content

NeuralFalconYT/Kokoro-TTS-Subtitle

Repository files navigation

Kokoro TTS V1.0 with Subtitle & SRT Dubbing

Open In Colab
HuggingFace Space Demo

Alternative ways to use Kokoro-TTS kokoro-onnx, Kokoro-FastAPI, kokoro

app

srt dub

Installation

Prerequisites

  • At least Python 3.10
  • Git
  • (Optional) Virtual Environment for dependency isolation

Steps to Install and Run

  1. Clone the Repository

    https://github.com/NeuralFalconYT/Kokoro-TTS-Subtitle.git
    cd Kokoro-TTS-Subtitle
  2. (Optional) Create and Activate a Virtual Environment

    • Windows:
      python -m venv myenv
      myenv\Scripts\activate
    • Mac/Linux:
      python3 -m venv myenv
      source myenv/bin/activate
  3. Install PyTorch

  • Forcefully install Torch with CUDA. If you did not, then requirements.txt will install the CPU version [It's happening with my system.]
    • Check CUDA Version (for GPU setup):

      nvcc --version

      Find your CUDA version example 11.8

    • Visit PyTorch Get Started and install the version compatible with your CUDA setup.:

      • For CUDA 11.8:
      pip install torch  --index-url https://download.pytorch.org/whl/cu118
      
      • For CUDA 12.1:
      pip install torch  --index-url https://download.pytorch.org/whl/cu121
      
      • For CUDA 12.4:
      pip install torch  --index-url https://download.pytorch.org/whl/cu124
      
  1. Install Dependencies
    • Windows/Mac/Linux:
      pip install -r requirements.txt

  1. Install eSpeak NG
  • For Windows:

    1. Download the eSpeak NG 1.50 release from the eSpeak NG GitHub Releases. [Or, You can try eSpeak NG latest Version]
    2. Locate and download the file named espeak-ng-X64.msi.
    3. Run the installer and follow the installation steps. Ensure that you install eSpeak NG in the default directory:
      C:\Program Files\eSpeak NG
      

      Note: This default path is required for the application to locate eSpeak NG properly.

  • For Linux:

    1. Open your terminal.
    2. Install eSpeak NG using the following command:
      sudo apt-get -qq -y install espeak-ng > /dev/null 2>&1

      Note: This command suppresses unnecessary output for a cleaner installation process.


  1. Run the Application
    If you used a virtual environment, make sure you enabled it.
    • Windows/Mac/Linux:
      python beta.py
    Or,
    python one_clicker.py
    
    Then, double-click on run_app.bat (Windows) to execute the script.

  1. Use Kokoko TTS Gradio app as an API in your other project:
    Check out scripts/api.py Code
Uninstallation Guide for Kokoro v1.0
If You Used a Virtual Environment:
  1. Simply delete the kokoro_v1 folder from your project directory.
If You Did Not Use a Virtual Environment:
  1. Inside the kokoro_v1 directory, run the following command to uninstall dependencies:
    pip uninstall -r requirements.txt
  2. Uninstall PyTorch:
    pip uninstall torch

To clear the HuggingFace cache models:

  • Navigate to C:\Users\<username>\.cache\huggingface\hub
  • Delete the contents of the hub folder. That's it! You've successfully removed everything.

🛠️ Fix for Japanese Audio Generation Error

If you encounter an error while generating Japanese audio, try the following steps:

  1. Uninstall existing unidic:

    pip uninstall unidic -y
  2. Reinstall unidic:

    pip install unidic
  3. Download the dictionary data:

    python -m unidic download

Note: This solution is likely to work, the same issue has been observed on both Colab and Hugging Face.

License

Kokoro model is licensed under the [Apache License 2.0]

Credits

Kokoro HuggingFace

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published