mirror of https://github.com/coqui-ai/TTS.git
Print urls when BadZipError
This commit is contained in:
parent
254c110ec1
commit
8fd1ee1926
|
@ -165,7 +165,7 @@ class ModelManager(object):
|
|||
self._update_path("speakers_file", output_speaker_ids_file_path, config_path)
|
||||
self._update_path("model_args.speakers_file", output_speaker_ids_file_path, config_path)
|
||||
|
||||
# update the speaker_encoder file path in the model config.json to the current path
|
||||
# update the speaker_encoder file path in the model config.json to the current path
|
||||
self._update_path("speaker_encoder_model_path", speaker_encoder_model_path, config_path)
|
||||
self._update_path("model_args.speaker_encoder_model_path", speaker_encoder_model_path, config_path)
|
||||
self._update_path("speaker_encoder_config_path", speaker_encoder_config_path, config_path)
|
||||
|
@ -197,8 +197,12 @@ class ModelManager(object):
|
|||
# download the file
|
||||
r = requests.get(file_url)
|
||||
# extract the file
|
||||
with zipfile.ZipFile(io.BytesIO(r.content)) as z:
|
||||
z.extractall(output_folder)
|
||||
try:
|
||||
with zipfile.ZipFile(io.BytesIO(r.content)) as z:
|
||||
z.extractall(output_folder)
|
||||
except zipfile.BadZipFile:
|
||||
print(f" > Error: Bad zip file - {file_url}")
|
||||
raise zipfile.BadZipFile
|
||||
# move the files to the outer path
|
||||
for file_path in z.namelist()[1:]:
|
||||
src_path = os.path.join(output_folder, file_path)
|
||||
|
|
|
@ -5,7 +5,7 @@ import numpy as np
|
|||
import pysbd
|
||||
import torch
|
||||
|
||||
from TTS.config import check_config_and_model_args, load_config, get_from_config_or_model_args_with_default
|
||||
from TTS.config import check_config_and_model_args, get_from_config_or_model_args_with_default, load_config
|
||||
from TTS.tts.models import setup_model as setup_tts_model
|
||||
from TTS.tts.utils.languages import LanguageManager
|
||||
from TTS.tts.utils.speakers import SpeakerManager
|
||||
|
@ -134,7 +134,9 @@ class Synthesizer(object):
|
|||
|
||||
def _set_speaker_encoder_paths_from_tts_config(self):
|
||||
"""Set the encoder paths from the tts model config for models with speaker encoders."""
|
||||
if hasattr(self.tts_config, "model_args") and hasattr(self.tts_config.model_args, "speaker_encoder_config_path"):
|
||||
if hasattr(self.tts_config, "model_args") and hasattr(
|
||||
self.tts_config.model_args, "speaker_encoder_config_path"
|
||||
):
|
||||
self.encoder_checkpoint = self.tts_config.model_args.speaker_encoder_model_path
|
||||
self.encoder_config = self.tts_config.model_args.speaker_encoder_config_path
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
import glob
|
||||
import os
|
||||
import shutil
|
||||
from TTS.tts.utils.languages import LanguageManager
|
||||
|
||||
from tests import get_tests_output_path, run_cli
|
||||
from TTS.tts.utils.languages import LanguageManager
|
||||
from TTS.tts.utils.speakers import SpeakerManager
|
||||
from TTS.utils.generic_utils import get_user_data_dir
|
||||
from TTS.utils.manage import ModelManager
|
||||
|
|
Loading…
Reference in New Issue