@@ -190,10 +190,10 @@ def __init__(
190
190
self .phoneme_probability = getattr (self .text_tokenizer , "phoneme_probability" , None )
191
191
else :
192
192
if text_tokenizer_pad_id is None :
193
- raise ValueError (f "text_tokenizer_pad_id must be specified if text_tokenizer is not BaseTokenizer" )
193
+ raise ValueError ("text_tokenizer_pad_id must be specified if text_tokenizer is not BaseTokenizer" )
194
194
195
195
if tokens is None :
196
- raise ValueError (f "tokens must be specified if text_tokenizer is not BaseTokenizer" )
196
+ raise ValueError ("tokens must be specified if text_tokenizer is not BaseTokenizer" )
197
197
198
198
self .text_tokenizer_pad_id = text_tokenizer_pad_id
199
199
self .cache_text = True if self .phoneme_probability is None else False
@@ -496,7 +496,7 @@ def add_reference_audio(self, **kwargs):
496
496
speaker_to_index_map [d ["speaker_id" ]].add (i )
497
497
# Random sample a reference audio from the same speaker
498
498
self .get_reference_for_sample = lambda sample : self .data [
499
- random .sample (speaker_to_index_map [sample ["speaker_id" ]], 1 )[ 0 ]
499
+ random .choice (speaker_to_index_map [tuple ( sample ["speaker_id" ])])
500
500
]
501
501
elif reference_audio_type == "ground-truth" :
502
502
# Use ground truth audio as reference audio
@@ -679,7 +679,7 @@ def __getitem__(self, index):
679
679
sample_pitch_mean = pitch_stats ["pitch_mean" ]
680
680
sample_pitch_std = pitch_stats ["pitch_std" ]
681
681
else :
682
- raise ValueError (f "Missing statistics for pitch normalization." )
682
+ raise ValueError ("Missing statistics for pitch normalization." )
683
683
684
684
pitch -= sample_pitch_mean
685
685
pitch [pitch == - sample_pitch_mean ] = 0.0 # Zero out values that were previously zero
0 commit comments