From ec2de5c88d1012b6d8ddd5bf84b1d8e1aeeb9748 Mon Sep 17 00:00:00 2001 From: Edresson Date: Thu, 30 Jul 2020 22:27:26 -0300 Subject: [PATCH] added integrity test for GST dictionary in synthesis --- mozilla_voice_tts/bin/synthesize.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mozilla_voice_tts/bin/synthesize.py b/mozilla_voice_tts/bin/synthesize.py index 8fa27bf0..7d68aef3 100644 --- a/mozilla_voice_tts/bin/synthesize.py +++ b/mozilla_voice_tts/bin/synthesize.py @@ -158,6 +158,8 @@ if __name__ == "__main__": # check if gst_style string is a dict, if is dict convert else use string try: gst_style = json.loads(args.gst_style) + if max(map(int, gst_style.keys())) >= C.gst['gst_style_tokens']: + raise RuntimeError("The highest value of the gst_style dictionary key must be less than the number of GST Tokens, \n Highest dictionary key value: {} \n Number of GST tokens: {}".format(max(map(int, gst_style.keys())), C.gst['gst_style_tokens'])) except ValueError: gst_style = args.gst_style