From 4e183c61df791bbac594aabdf40875b502e84249 Mon Sep 17 00:00:00 2001 From: Enno Hermann Date: Wed, 20 Dec 2023 15:18:01 +0100 Subject: [PATCH 1/2] fix(api): handle missing attribute in is_multilingual --- TTS/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TTS/api.py b/TTS/api.py index f741f65fb7..abe9c56b25 100644 --- a/TTS/api.py +++ b/TTS/api.py @@ -97,7 +97,7 @@ def is_multi_lingual(self): isinstance(self.model_name, str) and "xtts" in self.model_name or self.config - and ("xtts" in self.config.model or len(self.config.languages) > 1) + and ("xtts" in self.config.model or "languages" in self.config and len(self.config.languages) > 1) ): return True if hasattr(self.synthesizer.tts_model, "language_manager") and self.synthesizer.tts_model.language_manager: From 017c84d005011157a3910236a16cf6e22d3e9f85 Mon Sep 17 00:00:00 2001 From: Enno Hermann Date: Wed, 6 Mar 2024 22:45:35 +0100 Subject: [PATCH 2/2] style: make style && make lint --- TTS/tts/datasets/dataset.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/TTS/tts/datasets/dataset.py b/TTS/tts/datasets/dataset.py index 19fb25bef8..d592894072 100644 --- a/TTS/tts/datasets/dataset.py +++ b/TTS/tts/datasets/dataset.py @@ -4,6 +4,7 @@ import random from typing import Dict, List, Union +import mutagen import numpy as np import torch import tqdm @@ -13,8 +14,6 @@ from TTS.utils.audio import AudioProcessor from TTS.utils.audio.numpy_transforms import compute_energy as calculate_energy -import mutagen - # to prevent too many open files error as suggested here # https://github.com/pytorch/pytorch/issues/11201#issuecomment-421146936 torch.multiprocessing.set_sharing_strategy("file_system") @@ -47,7 +46,9 @@ def string2filename(string): def get_audio_size(audiopath): extension = audiopath.rpartition(".")[-1].lower() if extension not in {"mp3", "wav", "flac"}: - raise RuntimeError(f"The audio format {extension} is not supported, please convert the audio files to mp3, flac, or wav format!") + raise RuntimeError( + f"The audio format {extension} is not supported, please convert the audio files to mp3, flac, or wav format!" + ) audio_info = mutagen.File(audiopath).info return int(audio_info.length * audio_info.sample_rate)