jhudsl / text2speech

Text to Speech
http://jhudatascience.org/text2speech/
GNU General Public License v3.0
20 stars 2 forks source link

Download TTS models #15

Open howardbaik opened 1 year ago

howardbaik commented 1 year ago

RStudio crashes when attempting to use a new model. When tts is using a new model (that doesn't exist in /Users/howardbaek/Library/Application Support/tts), it needs to download the model to that folder:

Screenshot 2023-05-09 at 2 56 45 PM

I think this download process causes RStudio to crash for some reason.

The Python TTS API seems to deal with this by setting up (initializing) the model first before converting text to speech.

Task

howardbaik commented 1 year ago

Proposed Solution

Whenever you run the tts command, it checks whether the model_name & vocoder_name exists in the /Users/howardbaek/Library/Application Support/tts folder. If it does exist, it starts converting text-to-speech, and if it doesn't exist, then it downloads the model and vocoder to /Users/howardbaek/Library/Application Support/tts.

We need a function (for ex. check_model()) that peeks inside /Users/howardbaek/Library/Application Support/tts and see if model X (and vocoder Y) exist, and if it doesn't exist, then downloads the model from the Internet (using curl). The URL that contains these models are listed in this JSON file. I just need to parse this JSON and look for the github_rls_url field.

Parsing JSON:

library(jsonlite)

url <- "https://raw.githubusercontent.com/coqui-ai/TTS/dev/TTS/.models.json"
read_json(url)

Say I want to use tacotron2-DDC_ph. In Terminal,

# Download zip file containing model
curl -LO https://coqui.gateway.scarf.sh/v0.6.1_models/tts_models--en--ljspeech--tacotron2-DDC.zip
# Unzip
unzip tts_models--en--ljspeech--tacotron2-DDC

Then, move this folder into /Users/howardbaek/Library/Application Support/tts.

cansavvy commented 1 year ago

For now, it is not crashing, but let's keep an eye on this.