From d9e18e009b118f7b086544db3bbf3df8a79dcb9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eren=20G=C3=B6lge?= Date: Tue, 27 Jul 2021 10:08:06 +0200 Subject: [PATCH] Skip phoneme cache pre-compute if the path exists --- TTS/tts/models/base_tts.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/TTS/tts/models/base_tts.py b/TTS/tts/models/base_tts.py index b36ed106..11f4b7cc 100644 --- a/TTS/tts/models/base_tts.py +++ b/TTS/tts/models/base_tts.py @@ -1,6 +1,6 @@ +import os from typing import Dict, List, Tuple -import numpy as np import torch from coqpit import Coqpit from torch import nn @@ -184,7 +184,11 @@ class BaseTTS(BaseModel): else None, ) - if config.use_phonemes and config.compute_input_seq_cache: + if ( + config.use_phonemes + and config.compute_input_seq_cache + and not os.path.exists(dataset.phoneme_cache_path) + ): # precompute phonemes to have a better estimate of sequence lengths. dataset.compute_input_seq(config.num_loader_workers) dataset.sort_items()