mirror of https://github.com/coqui-ai/TTS.git
Add an assert for the upsampling trick (#1538)
This commit is contained in:
parent
6048959e24
commit
6e460b7e42
|
@ -1629,10 +1629,17 @@ class Vits(BaseTTS):
|
||||||
from TTS.utils.audio import AudioProcessor
|
from TTS.utils.audio import AudioProcessor
|
||||||
|
|
||||||
upsample_rate = torch.prod(torch.as_tensor(config.model_args.upsample_rates_decoder)).item()
|
upsample_rate = torch.prod(torch.as_tensor(config.model_args.upsample_rates_decoder)).item()
|
||||||
|
|
||||||
if not config.model_args.encoder_sample_rate:
|
if not config.model_args.encoder_sample_rate:
|
||||||
assert (
|
assert (
|
||||||
upsample_rate == config.audio.hop_length
|
upsample_rate == config.audio.hop_length
|
||||||
), f" [!] Product of upsample rates must be equal to the hop length - {upsample_rate} vs {config.audio.hop_length}"
|
), f" [!] Product of upsample rates must be equal to the hop length - {upsample_rate} vs {config.audio.hop_length}"
|
||||||
|
else:
|
||||||
|
encoder_to_vocoder_upsampling_factor = config.audio.sample_rate / config.model_args.encoder_sample_rate
|
||||||
|
effective_hop_length = config.audio.hop_length * encoder_to_vocoder_upsampling_factor
|
||||||
|
assert (
|
||||||
|
upsample_rate == effective_hop_length
|
||||||
|
), f" [!] Product of upsample rates must be equal to the hop length - {upsample_rate} vs {effective_hop_length}"
|
||||||
|
|
||||||
ap = AudioProcessor.init_from_config(config, verbose=verbose)
|
ap = AudioProcessor.init_from_config(config, verbose=verbose)
|
||||||
tokenizer, new_config = TTSTokenizer.init_from_config(config)
|
tokenizer, new_config = TTSTokenizer.init_from_config(config)
|
||||||
|
|
Loading…
Reference in New Issue