From e81f8d079c055c740171558f5b8ceb1cd4cfd6f7 Mon Sep 17 00:00:00 2001 From: Enno Hermann Date: Sun, 17 Nov 2024 00:29:49 +0100 Subject: [PATCH] fix: more helpful error message when formatter is not found --- TTS/tts/datasets/__init__.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/TTS/tts/datasets/__init__.py b/TTS/tts/datasets/__init__.py index f9f2cb2e..d1a37da4 100644 --- a/TTS/tts/datasets/__init__.py +++ b/TTS/tts/datasets/__init__.py @@ -166,6 +166,11 @@ def load_attention_mask_meta_data(metafile_path): def _get_formatter_by_name(name): """Returns the respective preprocessing function.""" thismodule = sys.modules[__name__] + if not hasattr(thismodule, name.lower()): + msg = ( + f"{name} formatter not found. If it is a custom formatter, pass the function to load_tts_samples() instead." + ) + raise ValueError(msg) return getattr(thismodule, name.lower())