Skip to content

Commit

Permalink
Fix API and CI
Browse files Browse the repository at this point in the history
  • Loading branch information
WeberJulian committed Dec 11, 2023
1 parent e3c9dab commit 5cd750a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
16 changes: 16 additions & 0 deletions TTS/tts/layers/xtts/xtts_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ def __init__(self, speaker_file_path=None):
def name_to_id(self):
return self.speakers.keys()

@property
def num_speakers(self):
return len(self.name_to_id)

@property
def speaker_names(self):
return list(self.name_to_id.keys())


class LanguageManager():
def __init__(self, config):
Expand All @@ -16,3 +24,11 @@ def __init__(self, config):
@property
def name_to_id(self):
return self.langs

@property
def num_languages(self):
return len(self.name_to_id)

@property
def language_names(self):
return list(self.name_to_id)
6 changes: 5 additions & 1 deletion TTS/tts/models/xtts.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ def get_conditioning_latents(

return gpt_cond_latents, speaker_embedding

def synthesize(self, text, config, speaker_wav, language, speaker_id, **kwargs):
def synthesize(self, text, config, speaker_wav, language, speaker_id=None, **kwargs):
"""Synthesize speech with the given input text.
Args:
Expand Down Expand Up @@ -520,6 +520,8 @@ def inference(
):
language = language.split("-")[0] # remove the country code
length_scale = 1.0 / max(speed, 0.05)
gpt_cond_latent = gpt_cond_latent.to(self.device)
speaker_embedding = speaker_embedding.to(self.device)
if enable_text_splitting:
text = split_sentence(text, language, self.tokenizer.char_limits[language])
else:
Expand Down Expand Up @@ -628,6 +630,8 @@ def inference_stream(
):
language = language.split("-")[0] # remove the country code
length_scale = 1.0 / max(speed, 0.05)
gpt_cond_latent = gpt_cond_latent.to(self.device)
speaker_embedding = speaker_embedding.to(self.device)
if enable_text_splitting:
text = split_sentence(text, language, self.tokenizer.char_limits[language])
else:
Expand Down

0 comments on commit 5cd750a

Please sign in to comment.