From d35e33dfd698bd7152d6337a1f4e8efea599ffa4 Mon Sep 17 00:00:00 2001 From: spottenn Date: Sat, 10 Jun 2023 12:23:07 -0600 Subject: [PATCH] Fixed redact index error bug https://github.com/neonbjb/tortoise-tts/issues/362 --- tortoise/utils/wav2vec_alignment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tortoise/utils/wav2vec_alignment.py b/tortoise/utils/wav2vec_alignment.py index aeadb73..bbe3285 100644 --- a/tortoise/utils/wav2vec_alignment.py +++ b/tortoise/utils/wav2vec_alignment.py @@ -135,7 +135,7 @@ class Wav2VecAlignment: non_redacted_intervals = [] last_point = 0 for i in range(len(fully_split)): - if i % 2 == 0: + if i % 2 == 0 and fully_split[i] != "": # Check for empty string fixes index error end_interval = max(0, last_point + len(fully_split[i]) - 1) non_redacted_intervals.append((last_point, end_interval)) last_point += len(fully_split[i])