TTS: [Bug] Unable to download models

Describe the bug

When I run the example the model is unable to download.

when I try to manually download the model from

https://coqui.gateway.scarf.sh/v0.10.1_models/tts_models--multilingual--multi-dataset--your_tts.zip 

I get redirected to

https://huggingface.co/erogol/v0.10.1_models/resolve/main/tts_models--multilingual--multi-dataset--your_tts.zip

which says β€œRepository not found”

To Reproduce

Run the basic example for python

code:

from TTS.api import TTS

# Running a multi-speaker and multi-lingual model

# List available 🐸TTS models and choose the first one
model_name = TTS.list_models()[0]
# Init TTS
tts = TTS(model_name)

# Run TTS

# ❗ Since this model is multi-speaker and multi-lingual, we must set the target speaker and the language
# Text to speech with a numpy output
wav = tts.tts("This is a test! This is also a test!!", speaker=tts.speakers[0], language=tts.languages[0])

output:

zipfile.BadZipFile: File is not a zip file

### Expected behavior

Being able to download the pretrained models

### Logs

```shell
> Downloading model to /home/mb/.local/share/tts/tts_models--multilingual--multi-dataset--your_tts
  0%|                                                                                                                                         | 0.00/29.0 [00:00<?, ?iB/s] > Error: Bad zip file - https://coqui.gateway.scarf.sh/v0.10.1_models/tts_models--multilingual--multi-dataset--your_tts.zip
Traceback (most recent call last):
  File "/home/mb/Documents/ai/TTS/TTS/utils/manage.py", line 434, in _download_zip_file
    with zipfile.ZipFile(temp_zip_name) as z:
  File "/usr/lib/python3.10/zipfile.py", line 1267, in __init__
    self._RealGetContents()
  File "/usr/lib/python3.10/zipfile.py", line 1334, in _RealGetContents
    raise BadZipFile("File is not a zip file")
zipfile.BadZipFile: File is not a zip file

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/mb/Documents/ai/tts/main.py", line 8, in <module>
    tts = TTS(model_name)
  File "/home/mb/Documents/ai/TTS/TTS/api.py", line 289, in __init__
    self.load_tts_model_by_name(model_name, gpu)
  File "/home/mb/Documents/ai/TTS/TTS/api.py", line 385, in load_tts_model_by_name
    model_path, config_path, vocoder_path, vocoder_config_path, model_dir = self.download_model_by_name(
  File "/home/mb/Documents/ai/TTS/TTS/api.py", line 348, in download_model_by_name
    model_path, config_path, model_item = self.manager.download_model(model_name)
  File "/home/mb/Documents/ai/TTS/TTS/utils/manage.py", line 303, in download_model
    self._download_zip_file(model_item["github_rls_url"], output_path, self.progress_bar)
  File "/home/mb/Documents/ai/TTS/TTS/utils/manage.py", line 439, in _download_zip_file
    raise zipfile.BadZipFile  # pylint: disable=raise-missing-from
zipfile.BadZipFile
100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 29.0/29.0 [00:00<00:00, 185iB/s]

Environment

{
    "CUDA": {
        "GPU": [],
        "available": false,
        "version": "11.7"
    },
    "Packages": {
        "PyTorch_debug": false,
        "PyTorch_version": "2.0.1+cu117",
        "TTS": "0.14.3",
        "numpy": "1.23.5"
    },
    "System": {
        "OS": "Linux",
        "architecture": [
            "64bit",
            "ELF"
        ],
        "processor": "x86_64",
        "python": "3.10.6",
        "version": "#202303130630~1685473338~22.04~995127e SMP PREEMPT_DYNAMIC Tue M"
    }
}

Additional context

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 19 (1 by maintainers)

Most upvoted comments

Same error

Here is my workaround for the docker usage. Seems their proxy urls in .model.json are broken.

If you’ve attempted to download any broken model links you probably need to clear them from /root/.local/share/tts/

Replace the proxy url’s with github release links:

cp /root/TTS/.models.json /root/TTS/.models.json.bak
sed -i 's|https://coqui.gateway.scarf.sh|https://github.com/coqui-ai/TTS/releases/download|g' /root/TTS/.models.json
tts-server --model_name tts_models/en/vctk/vits
> Downloading model to /root/.local/share/tts/tts_models--en--vctk--vits
 > Model's license - apache 2.0
 > Check https://choosealicense.com/licenses/apache-2.0/ for more info.
 > Using model: vits
 > Setting up Audio Processor...
 | > sample_rate:22050
 | > resample:False
 | > num_mels:80
 | > log_func:np.log10
 | > min_level_db:0
 | > frame_shift_ms:None
 | > frame_length_ms:None
 | > ref_level_db:None
 | > fft_size:1024
 | > power:None
 | > preemphasis:0.0
 | > griffin_lim_iters:None
 | > signal_norm:None
 | > symmetric_norm:None
 | > mel_fmin:0
 | > mel_fmax:None
 | > pitch_fmin:None
 | > pitch_fmax:None
 | > spec_gain:20.0
 | > stft_pad_mode:reflect
 | > max_norm:1.0
 | > clip_norm:True
 | > do_trim_silence:False
 | > trim_db:60
 | > do_sound_norm:False
 | > do_amp_to_db_linear:True
 | > do_amp_to_db_mel:True
 | > do_rms_norm:False
 | > db_level:None
 | > stats_path:None
 | > base:10
 | > hop_length:256
 | > win_length:1024
 > initialization of speaker-embedding layers.
 * Serving Flask app 'TTS.server.server'
 * Debug mode: off
INFO:werkzeug:WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on all addresses (::)
 * Running on http://[::1]:5002
 * Running on http://[::1]:5002
INFO:werkzeug:Press CTRL+C to quit

Curious of the need to retarget these model downloads away from github.

Sorry, guys, we had a problem with our proxy. Now all is good.

in the TTS/models.json file in the repo the model links work fine (you can download them). but even if i download them manually i can’t get it to work. anyone try this ?

If you manually download the zip you need to unpack it to the ~/.local/share/tts/{model name} directory or you could try the automatic download again.

Since the link for the model download is back I got it to work again by simply deleting the directory containing the corrupted zip files. In my case: rm -rf ~/.local/share/tts/tts_models--en--ljspeech--tacotron2-DDC

in the TTS/models.json file in the repo the model links work fine (you can download them). but even if i download them manually i can’t get it to work. anyone try this ?