Skip phoneme cache pre-compute if the path exists

This commit is contained in:
Eren Gölge 2021-07-27 10:08:06 +02:00
parent 70a4c6f16c
commit d9e18e009b
1 changed files with 6 additions and 2 deletions

View File

@ -1,6 +1,6 @@
import os
from typing import Dict, List, Tuple from typing import Dict, List, Tuple
import numpy as np
import torch import torch
from coqpit import Coqpit from coqpit import Coqpit
from torch import nn from torch import nn
@ -184,7 +184,11 @@ class BaseTTS(BaseModel):
else None, 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. # precompute phonemes to have a better estimate of sequence lengths.
dataset.compute_input_seq(config.num_loader_workers) dataset.compute_input_seq(config.num_loader_workers)
dataset.sort_items() dataset.sort_items()