diff --git a/TTS/tts/layers/tortoise/diffusion.py b/TTS/tts/layers/tortoise/diffusion.py index eb9e90df..cb350af7 100644 --- a/TTS/tts/layers/tortoise/diffusion.py +++ b/TTS/tts/layers/tortoise/diffusion.py @@ -1085,31 +1085,6 @@ class GaussianDiffusion: } -def get_named_beta_schedule(schedule_name, num_diffusion_timesteps): - """ - Get a pre-defined beta schedule for the given name. - - The beta schedule library consists of beta schedules which remain similar - in the limit of num_diffusion_timesteps. - Beta schedules may be added, but should not be removed or changed once - they are committed to maintain backwards compatibility. - """ - if schedule_name == "linear": - # Linear schedule from Ho et al, extended to work for any number of - # diffusion steps. - scale = 1000 / num_diffusion_timesteps - beta_start = scale * 0.0001 - beta_end = scale * 0.02 - return np.linspace(beta_start, beta_end, num_diffusion_timesteps, dtype=np.float64) - elif schedule_name == "cosine": - return betas_for_alpha_bar( - num_diffusion_timesteps, - lambda t: math.cos((t + 0.008) / 1.008 * math.pi / 2) ** 2, - ) - else: - raise NotImplementedError(f"unknown beta schedule: {schedule_name}") - - class SpacedDiffusion(GaussianDiffusion): """ A diffusion process which can skip steps in a base diffusion process. diff --git a/TTS/tts/layers/xtts/diffusion.py b/TTS/tts/layers/xtts/diffusion.py index a0b93add..37665bc6 100644 --- a/TTS/tts/layers/xtts/diffusion.py +++ b/TTS/tts/layers/xtts/diffusion.py @@ -1170,31 +1170,6 @@ class GaussianDiffusion: } -def get_named_beta_schedule(schedule_name, num_diffusion_timesteps): - """ - Get a pre-defined beta schedule for the given name. - - The beta schedule library consists of beta schedules which remain similar - in the limit of num_diffusion_timesteps. - Beta schedules may be added, but should not be removed or changed once - they are committed to maintain backwards compatibility. - """ - if schedule_name == "linear": - # Linear schedule from Ho et al, extended to work for any number of - # diffusion steps. - scale = 1000 / num_diffusion_timesteps - beta_start = scale * 0.0001 - beta_end = scale * 0.02 - return np.linspace(beta_start, beta_end, num_diffusion_timesteps, dtype=np.float64) - elif schedule_name == "cosine": - return betas_for_alpha_bar( - num_diffusion_timesteps, - lambda t: math.cos((t + 0.008) / 1.008 * math.pi / 2) ** 2, - ) - else: - raise NotImplementedError(f"unknown beta schedule: {schedule_name}") - - class SpacedDiffusion(GaussianDiffusion): """ A diffusion process which can skip steps in a base diffusion process. diff --git a/TTS/tts/layers/xtts/tokenizer.py b/TTS/tts/layers/xtts/tokenizer.py index 0fad8133..8dd81fac 100644 --- a/TTS/tts/layers/xtts/tokenizer.py +++ b/TTS/tts/layers/xtts/tokenizer.py @@ -171,17 +171,6 @@ def multilingual_cleaners(text, lang): return text -def english_cleaners(text): - """Pipeline for English text, including number and abbreviation expansion.""" - text = convert_to_ascii(text) - text = lowercase(text) - text = expand_numbers(text) - text = expand_abbreviations(text) - text = collapse_whitespace(text) - text = text.replace('"', "") - return text - - def remove_extraneous_punctuation(word): replacement_punctuation = {"{": "(", "}": ")", "[": "(", "]": ")", "`": "'", "—": "-", "—": "-", "`": "'", "ʼ": "'"} replace = re.compile( @@ -195,32 +184,6 @@ def remove_extraneous_punctuation(word): return word -def expand_numbers(text): - return normalize_numbers(text) - - -def lowercase(text): - return text.lower() - - -_whitespace_re = re.compile(r"\s+") - - -def collapse_whitespace(text): - return re.sub(_whitespace_re, " ", text) - - -def convert_to_ascii(text): - return unidecode(text) - - -def basic_cleaners(text): - """Basic pipeline that lowercases and collapses whitespace without transliteration.""" - text = lowercase(text) - text = collapse_whitespace(text) - return text - - def arabic_cleaners(text): text = lowercase(text) text = collapse_whitespace(text) diff --git a/TTS/tts/models/delightful_tts.py b/TTS/tts/models/delightful_tts.py index c0a00c66..b1cf886b 100644 --- a/TTS/tts/models/delightful_tts.py +++ b/TTS/tts/models/delightful_tts.py @@ -726,8 +726,8 @@ class DelightfulTTS(BaseTTSE2E): def pitch_std(self): return self.acoustic_model.pitch_std - @pitch_mean.setter - def pitch_std(self, value): # pylint: disable=function-redefined + @pitch_std.setter + def pitch_std(self, value): self.acoustic_model.pitch_std = value @property @@ -1518,10 +1518,6 @@ class DelightfulTTS(BaseTTSE2E): scheduler_G = get_scheduler(self.config.lr_scheduler_disc, self.config.lr_scheduler_disc_params, optimizer[1]) return [scheduler_D, scheduler_G] - def on_train_step_start(self, trainer): - """Schedule binary loss weight.""" - self.binary_loss_weight = min(trainer.epochs_done / self.config.binary_loss_warmup_epochs, 1.0) * 1.0 - def on_epoch_end(self, trainer): # pylint: disable=unused-argument # stop updating mean and var # TODO: do the same for F0 @@ -1578,6 +1574,7 @@ class DelightfulTTS(BaseTTSE2E): Args: trainer (Trainer): Trainer object. """ + self.binary_loss_weight = min(trainer.epochs_done / self.config.binary_loss_warmup_epochs, 1.0) * 1.0 self.train_disc = ( # pylint: disable=attribute-defined-outside-init trainer.total_steps_done >= self.config.steps_to_start_discriminator ) diff --git a/TTS/vc/modules/freevc/commons.py b/TTS/vc/modules/freevc/commons.py index 5684a88e..e799cc2a 100644 --- a/TTS/vc/modules/freevc/commons.py +++ b/TTS/vc/modules/freevc/commons.py @@ -116,12 +116,6 @@ def fused_add_tanh_sigmoid_multiply(input_a, input_b, n_channels): return acts -def convert_pad_shape(pad_shape): - l = pad_shape[::-1] - pad_shape = [item for sublist in l for item in sublist] - return pad_shape - - def shift_1d(x): x = F.pad(x, convert_pad_shape([[0, 0], [0, 0], [1, 0]]))[:, :, :-1] return x