Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed bug related to yourtts speaker embeddings issue #2234

Merged
merged 12 commits into from
Jan 2, 2023
5 changes: 4 additions & 1 deletion TTS/tts/models/base_tts.py
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,10 @@ def on_init_start(self, trainer):
"""Save the speaker.pth and language_ids.json at the beginning of the training. Also update both paths."""
if self.speaker_manager is not None:
output_path = os.path.join(trainer.output_path, "speakers.pth")
self.speaker_manager.save_ids_to_file(output_path)
if trainer.config.use_d_vector_file and trainer.config.d_vector_file:
self.speaker_manager.save_embeddings_to_file(output_path)
else:
self.speaker_manager.save_ids_to_file(output_path)
Edresson marked this conversation as resolved.
Show resolved Hide resolved
trainer.config.speakers_file = output_path
# some models don't have `model_args` set
if hasattr(trainer.config, "model_args"):
Expand Down
2 changes: 1 addition & 1 deletion TTS/tts/utils/speakers.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def init_from_config(config: "Coqpit", samples: Union[List[List], List[Dict]] =
speaker_manager = SpeakerManager()
if get_from_config_or_model_args_with_default(config, "speakers_file", None):
speaker_manager = SpeakerManager(
d_vectors_file_path=get_from_config_or_model_args_with_default(config, "speaker_file", None)
d_vectors_file_path=get_from_config_or_model_args_with_default(config, "speakers_file", None)
Edresson marked this conversation as resolved.
Show resolved Hide resolved
)
if get_from_config_or_model_args_with_default(config, "d_vector_file", None):
speaker_manager = SpeakerManager(
Expand Down