Skip to content

Commit 6230ae3

Browse files
authored
Implement Prosody metrics for TTS evaluation (#16031)
* Support TTS speaker id format on SpeakerFilter class Signed-off-by: Edresson Casanova <edresson1@gmail.com> * Add prosody evaluation metrics Signed-off-by: Edresson Casanova <ecasanova@nvidia.com> * Clean up emotion encoder CLI Signed-off-by: Edresson Casanova <ecasanova@nvidia.com> * Simplify prosody metric defaults Signed-off-by: Edresson Casanova <ecasanova@nvidia.com> * Use default prosody emotion embedding Signed-off-by: Edresson Casanova <ecasanova@nvidia.com> * Remove emotion encoder CLI Signed-off-by: Edresson Casanova <ecasanova@nvidia.com> * Fix black formatting Signed-off-by: Edresson Casanova <ecasanova@nvidia.com> * Update speaker filter test expectation Signed-off-by: Edresson Casanova <ecasanova@nvidia.com> * Add generated-to-ground-truth audio CER metric Signed-off-by: Edresson Casanova <ecasanova@nvidia.com> * Add generated-to-ground-truth audio WER metric Signed-off-by: Edresson Casanova <ecasanova@nvidia.com> * Move prosody metric defaults into entrypoint Signed-off-by: Edresson Casanova <ecasanova@nvidia.com> --------- Signed-off-by: Edresson Casanova <edresson1@gmail.com> Signed-off-by: Edresson Casanova <ecasanova@nvidia.com>
1 parent e0a284b commit 6230ae3

9 files changed

Lines changed: 1738 additions & 4 deletions

File tree

examples/tts/magpietts_inference.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,13 @@ def run_inference_and_evaluation(
167167
# CSV headers
168168
csv_header = (
169169
"checkpoint_name,dataset,cer_filewise_avg,wer_filewise_avg,cer_cumulative,"
170-
"wer_cumulative,ssim_pred_gt_avg,ssim_pred_context_avg,ssim_gt_context_avg,"
170+
"wer_cumulative,cer_pred_gt_audio_filewise_avg,cer_pred_gt_audio_cumulative,"
171+
"wer_pred_gt_audio_filewise_avg,wer_pred_gt_audio_cumulative,"
172+
"ssim_pred_gt_avg,ssim_pred_context_avg,ssim_gt_context_avg,"
171173
"ssim_pred_gt_avg_alternate,ssim_pred_context_avg_alternate,"
172-
"ssim_gt_context_avg_alternate,cer_gt_audio_cumulative,wer_gt_audio_cumulative,"
174+
"ssim_gt_context_avg_alternate,esim_pred_gt_avg,ems_pred_gt_avg,"
175+
"pitch_distance_avg,intensity_distance_avg,speech_rate_distance_avg,"
176+
"cer_gt_audio_cumulative,wer_gt_audio_cumulative,"
173177
"utmosv2_avg,total_gen_audio_seconds,frechet_codec_distance,"
174178
"eou_cutoff_rate,eou_silence_rate,eou_noise_rate,eou_error_rate,"
175179
"katakana_cer_filewise_avg,katakana_cer_cumulative"
@@ -303,6 +307,8 @@ def run_inference_and_evaluation(
303307
with_utmosv2=eval_config.with_utmosv2,
304308
with_fcd=eval_config.with_fcd,
305309
codec_model_path=eval_config.codec_model_path,
310+
with_prosody_metrics=eval_config.with_prosody_metrics,
311+
prosody_model_size=eval_config.prosody_model_size,
306312
strip_text_annotations_for_metrics=eval_config.strip_text_annotations_for_metrics,
307313
device=eval_config.device,
308314
asr_batch_size=eval_config.asr_batch_size,
@@ -456,6 +462,8 @@ def main(argv=None):
456462
with_utmosv2=not args.disable_utmosv2,
457463
with_fcd=not args.disable_fcd,
458464
codec_model_path=args.codecmodel_path if not args.disable_fcd else None,
465+
with_prosody_metrics=args.with_prosody_metrics,
466+
prosody_model_size=args.prosody_model_size,
459467
strip_text_annotations_for_metrics=args.strip_text_annotations_for_metrics,
460468
asr_batch_size=args.asr_batch_size,
461469
eou_batch_size=args.eou_batch_size,

nemo/collections/common/data/lhotse/sampling.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,11 @@ def __call__(self, example) -> bool:
342342
else:
343343
speaker_id = getattr(supervision, field, None)
344344

345+
# Support the TTS speaker ID format:
346+
# | Language:en Dataset:<dataset_name> Speaker:<speaker_id> |
347+
if isinstance(speaker_id, str) and "Speaker:" in speaker_id:
348+
speaker_id = speaker_id.rsplit("Speaker:", maxsplit=1)[-1].split("|", maxsplit=1)[0].strip()
349+
345350
if speaker_id in excluded_speaker_ids:
346351
return False
347352
return True

0 commit comments

Comments
 (0)