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

Fix adapter tutorial r1.19.0 #6776

Merged
merged 2 commits into from
Jun 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions nemo/collections/tts/modules/submodules.py
Original file line number Diff line number Diff line change
Expand Up @@ -758,15 +758,11 @@ def forward(self, batch_size=None, speaker=None, reference_spec=None, reference_
embs = self.lookup_module(speaker)

# Get GST based speaker embedding
if self.gst_module is not None:
if reference_spec is None or reference_spec_lens is None:
raise ValueError(
"You should add `reference_audio` in sup_data_types or remove `speaker_encoder`in config."
)
out = self.gst_module(reference_spec, reference_spec_lens)
embs = out if embs is None else embs + out

elif self.gst_module is None and reference_spec is not None and reference_spec_lens is not None:
logging.warning("You may add `gst_module` in speaker_encoder to use reference_audio.")
if reference_spec is not None and reference_spec_lens is not None:
if self.gst_module is not None:
out = self.gst_module(reference_spec, reference_spec_lens)
embs = out if embs is None else embs + out
else:
logging.warning("You may add `gst_module` in speaker_encoder to use reference_audio.")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we relax the logging level to warning from errors? I was wondering if we should raise errors when the behavior is not expected.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We previously raise error when the model has gst_module and users don't provide reference_spec.
However, there is a scenario we pre-compute the speaker embeddings of gst_module, so the model still has gst_module but we don't provide reference_spec anymore.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. it is fine for me. @rlangman @redoctopus any thoughts?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine with me, though could you add a sentence in the warning telling users what it does by default instead?


return embs
Loading