Skip to content

Conversation

@rfejgin
Copy link
Collaborator

@rfejgin rfejgin commented Dec 23, 2025

What does this PR do ?

Adds the Frechet Codec Distance metric and integrates it in MagpieTTS inference scripts. Also fixes some minor MagpieTTS inference bugs.

Collection: TTS

Changelog

The Frechet Distance (FD) is commonly used to evaluate generative models (e.g. Frechet Inception Distance, Frechet Audio Distance). In this PR we implements FD in the embedding space of a neural codec. This is a metric that measures how closely the distributions of real and generated codec frames match, at the single frame level.

Changes:

  • frechet_codec_distance.py: An implementation of FD in codec embedding space. Builds on TorchMetrics' FID implementation. We provide the audio codec as a custom feature extractor.
  • test_frechet_coec_distance.py: Unit test
  • Integration of the FCD in MagpieTTS inference scripts. If desired, FCD calculation can be disabled using the --disable_fcd command line argument to magpietts_inference.py
  • Inference bugfixes
    • fix a logging statement that was reporting errors due to incorrect formatting syntax
    • disable logging of thousands of messages during loading of the titanet_small speaker representation model. This was present in earlier versions of the inference scripts and appears to have been accidentally lost in recent refactorings
    • Fix an issue where filewise metrics were not being filtered to a spcified subset as intended

PR Type:

  • New Feature
  • Bugfix
  • Documentation

@github-actions github-actions bot added the TTS label Dec 23, 2025
@rfejgin rfejgin marked this pull request as ready for review December 23, 2025 06:58
@rfejgin rfejgin marked this pull request as draft December 23, 2025 07:11
Instead of taking a codec instance, accept a codec name: local path or HF/NGC name.

This simplifies the metric's integration in calling code.

Signed-off-by: Fejgin, Roy <[email protected]>
* address some CI linting issues
* include a file that was missed in last commit

Signed-off-by: Fejgin, Roy <[email protected]>
Signed-off-by: Fejgin, Roy <[email protected]>
@rfejgin rfejgin marked this pull request as ready for review December 23, 2025 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants