Skip to content

Commit 6eed542

Browse files
authored
Merge pull request #1660 from yt605155624/fix_pre
[TTS]fix preprocess bug, test=tts
2 parents 2b7ca6f + a8f5990 commit 6eed542

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

paddlespeech/t2s/exps/fastspeech2/preprocess.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ def process_sentence(config: Dict[str, Any],
8686
logmel = mel_extractor.get_log_mel_fbank(wav)
8787
# change duration according to mel_length
8888
compare_duration_and_mel_length(sentences, utt_id, logmel)
89+
# utt_id may be popped in compare_duration_and_mel_length
90+
if utt_id not in sentences:
91+
return None
8992
phones = sentences[utt_id][0]
9093
durations = sentences[utt_id][1]
9194
num_frames = logmel.shape[0]

paddlespeech/t2s/exps/speedyspeech/preprocess.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,9 @@ def process_sentence(config: Dict[str, Any],
7979
logmel = mel_extractor.get_log_mel_fbank(wav)
8080
# change duration according to mel_length
8181
compare_duration_and_mel_length(sentences, utt_id, logmel)
82+
# utt_id may be popped in compare_duration_and_mel_length
83+
if utt_id not in sentences:
84+
return None
8285
labels = sentences[utt_id][0]
8386
# extract phone and duration
8487
phones = []

paddlespeech/t2s/exps/tacotron2/preprocess.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ def process_sentence(config: Dict[str, Any],
8282
logmel = mel_extractor.get_log_mel_fbank(wav)
8383
# change duration according to mel_length
8484
compare_duration_and_mel_length(sentences, utt_id, logmel)
85+
# utt_id may be popped in compare_duration_and_mel_length
86+
if utt_id not in sentences:
87+
return None
8588
phones = sentences[utt_id][0]
8689
durations = sentences[utt_id][1]
8790
num_frames = logmel.shape[0]

0 commit comments

Comments
 (0)