mirror of https://github.com/coqui-ai/TTS.git
Fix the Bug in Synthesizer
This commit is contained in:
parent
10dee54ac3
commit
34a92f1b1b
|
@ -47,7 +47,7 @@ wav_files = meta_data_train + meta_data_eval
|
|||
encoder_manager = EmbeddingManager(
|
||||
encoder_model_path=args.model_path,
|
||||
encoder_config_path=args.config_path,
|
||||
d_vectors_file_path=args.old_file,
|
||||
embedding_file_path=args.old_file,
|
||||
use_cuda=args.use_cuda,
|
||||
)
|
||||
|
||||
|
@ -89,6 +89,10 @@ for idx, wav_file in enumerate(tqdm(wav_files)):
|
|||
class_mapping[wav_file_name]["name"] = class_name
|
||||
class_mapping[wav_file_name]["embedding"] = embedd
|
||||
|
||||
if args.old_file:
|
||||
# merge the embeddings dict
|
||||
class_mapping = {**encoder_manager.embeddings, **class_mapping}
|
||||
|
||||
if class_mapping:
|
||||
# save class_mapping if target dataset is defined
|
||||
if ".json" not in args.output_path:
|
||||
|
|
|
@ -121,9 +121,21 @@ class Synthesizer(object):
|
|||
if use_cuda:
|
||||
self.tts_model.cuda()
|
||||
|
||||
if self.encoder_checkpoint and hasattr(self.tts_model, "speaker_manager"):
|
||||
if self.encoder_checkpoint and hasattr(self.tts_model, "speaker_manager") and self.tts_model.speaker_manager is not None:
|
||||
self.tts_model.speaker_manager.init_encoder(self.encoder_checkpoint, self.encoder_config)
|
||||
|
||||
if self.tts_emotions_file and hasattr(self.tts_model, "emotion_manager") and self.tts_model.emotion_manager is not None:
|
||||
if getattr(self.tts_config, "use_external_emotions_embeddings", False) or (getattr(self.tts_config, "model_args", None) and getattr(self.tts_config.model_args, "use_external_emotions_embeddings", False)):
|
||||
self.tts_model.emotion_manager.load_embeddings_from_file(self.tts_emotions_file)
|
||||
else:
|
||||
self.tts_model.emotion_manager.load_ids_from_file(self.tts_emotions_file)
|
||||
|
||||
if self.tts_speakers_file and hasattr(self.tts_model, "speaker_manager") and self.tts_model.speaker_manager is not None:
|
||||
if getattr(self.tts_config, "use_d_vector_file", False) or (getattr(self.tts_config, "model_args", None) and getattr(self.tts_config.model_args, "use_d_vector_file", False)):
|
||||
self.tts_model.speaker_manager.load_embeddings_from_file(self.tts_speakers_file)
|
||||
else:
|
||||
self.tts_model.speaker_manager.load_ids_from_file(self.tts_speakers_file)
|
||||
|
||||
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(
|
||||
|
|
Loading…
Reference in New Issue