From 13cd076a7fe19938cdb9783adf48008da1c436c4 Mon Sep 17 00:00:00 2001 From: Dusty Hagstrom Date: Mon, 16 Oct 2023 02:55:45 -0700 Subject: [PATCH] Synthesizer skips over embeddings file if model only has one speaker (#2587) * It looks like the Neon model is special in that t does not have a speaker_name and it wants to get the only item available. This was blocking a valid model with one speaker and a d_vector_file from being executed to get the embedding. * Update synthesizer.py oh my how embarrassing --- TTS/utils/synthesizer.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/TTS/utils/synthesizer.py b/TTS/utils/synthesizer.py index 24a078f5..2e2e40e2 100644 --- a/TTS/utils/synthesizer.py +++ b/TTS/utils/synthesizer.py @@ -299,11 +299,7 @@ class Synthesizer(nn.Module): speaker_embedding = None speaker_id = None if self.tts_speakers_file or hasattr(self.tts_model.speaker_manager, "name_to_id"): - # handle Neon models with single speaker. - if len(self.tts_model.speaker_manager.name_to_id) == 1: - speaker_id = list(self.tts_model.speaker_manager.name_to_id.values())[0] - - elif speaker_name and isinstance(speaker_name, str): + if speaker_name and isinstance(speaker_name, str): if self.tts_config.use_d_vector_file: # get the average speaker embedding from the saved d_vectors. speaker_embedding = self.tts_model.speaker_manager.get_mean_embedding( @@ -313,7 +309,9 @@ class Synthesizer(nn.Module): else: # get speaker idx from the speaker name speaker_id = self.tts_model.speaker_manager.name_to_id[speaker_name] - + # handle Neon models with single speaker. + elif len(self.tts_model.speaker_manager.name_to_id) == 1: + speaker_id = list(self.tts_model.speaker_manager.name_to_id.values())[0] elif not speaker_name and not speaker_wav: raise ValueError( " [!] Looks like you are using a multi-speaker model. "