Skip to content

Commit

Permalink
Synthesizer skips over embeddings file if model only has one speaker (#…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
Dusty Hagstrom authored Oct 16, 2023
1 parent e4b8d71 commit 13cd076
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions TTS/utils/synthesizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,11 +299,7 @@ def tts(
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(
Expand All @@ -313,7 +309,9 @@ def tts(
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. "
Expand Down

0 comments on commit 13cd076

Please sign in to comment.