coqui-ai / TTS

🐸💬 - a deep learning toolkit for Text-to-Speech, battle-tested in research and production
http://coqui.ai
Mozilla Public License 2.0
35.48k stars 4.33k forks source link

[Bug] `tts_models/en/vctk/sc-glow-tts` fails to find `speakers.json` file #608

Closed owahltinez closed 3 years ago

owahltinez commented 3 years ago

Describe the bug tts_models/en/vctk/sc-glow-tts fails to find speakers.json file.

To Reproduce

$ tts --model_name tts_models/en/vctk/sc-glow-tts --text "test" --out_path tmp.wav
 > tts_models/en/vctk/sc-glow-tts is already downloaded.
 > vocoder_models/en/vctk/hifigan_v2 is already downloaded.
 > Using model: glow_tts
Traceback (most recent call last):
  File "/usr/local/bin/tts", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.8/dist-packages/TTS/bin/synthesize.py", line 226, in main
    synthesizer = Synthesizer(
  File "/usr/local/lib/python3.8/dist-packages/TTS/utils/synthesizer.py", line 73, in __init__
    self._load_tts(tts_checkpoint, tts_config_path, use_cuda)
  File "/usr/local/lib/python3.8/dist-packages/TTS/utils/synthesizer.py", line 135, in _load_tts
    self.tts_model = setup_tts_model(config=self.tts_config)
  File "/usr/local/lib/python3.8/dist-packages/TTS/tts/models/__init__.py", line 27, in setup_model
    model = MyModel(config)
  File "/usr/local/lib/python3.8/dist-packages/TTS/tts/models/glow_tts.py", line 57, in __init__
    self.init_multispeaker(config)
  File "/usr/local/lib/python3.8/dist-packages/TTS/tts/models/glow_tts.py", line 106, in init_multispeaker
    self.speaker_manager = get_speaker_manager(config, data=data)
  File "/usr/local/lib/python3.8/dist-packages/TTS/tts/utils/speakers.py", line 354, in get_speaker_manager
    speaker_manager.set_d_vectors_from_file(c.d_vector_file)
  File "/usr/local/lib/python3.8/dist-packages/TTS/tts/utils/speakers.py", line 161, in set_d_vectors_from_file
    self.d_vectors = self._load_json(file_path)
  File "/usr/local/lib/python3.8/dist-packages/TTS/tts/utils/speakers.py", line 85, in _load_json
    with open(json_file_path) as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/erogol/.local/share/tts/tts_models--en--vctk--sc-glow-tts/speakers.json'

The problem appears to be on line 143 of the config.json within the model ZIP file:

"d_vector_file": "/home/erogol/.local/share/tts/tts_models--en--vctk--sc-glow-tts/speakers.json"

If I change that line in ~/.local/share/tts/tts_models--en--vctk--sc-glow-tts/config.json to my own local path, then it works. I haven't been able to figure out how to make a relative path work.

Environment (please complete the following information): Using the following Dockerfile:

FROM ubuntu:focal
ENV DEBIAN_FRONTEND=noninteractive 
RUN apt update && \
    apt install -y ca-certificates && update-ca-certificates && \
    apt install -y espeak-ng git libsndfile1 python3 python3-pip
RUN python3 -m pip install git+git://github.com/coqui-ai/TTS.git@v0.1.0
owahltinez commented 3 years ago

This issue remains in 1.1.2, can we reopen it?

erogol commented 3 years ago

it works on my end and on the CI tests. Try removing the downloaded model and run again.

owahltinez commented 3 years ago

I see, it was a stale model indeed. Related to this, I opened #630 to make it easier to manage model downloads.