diff options
Diffstat (limited to 'dnn/torch/lpcnet/scripts/update_setups.py')
-rw-r--r-- | dnn/torch/lpcnet/scripts/update_setups.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/dnn/torch/lpcnet/scripts/update_setups.py b/dnn/torch/lpcnet/scripts/update_setups.py new file mode 100644 index 00000000..7f8261a0 --- /dev/null +++ b/dnn/torch/lpcnet/scripts/update_setups.py @@ -0,0 +1,28 @@ +""" script for updating setup files with new setup entries + + Use this script to update older outputs with newly introduced + parameters. (Saves us the trouble of backward compatibility) +""" + +import argparse + +import yaml + +parser = argparse.ArgumentParser() + +parser.add_argument('setup_file', type=str, help='setup to be updated') +parser.add_argument('--model', type=str, help='model update', default=None) + +args = parser.parse_args() + +# load setup +with open(args.setup_file, 'r') as f: + setup = yaml.load(f.read(), yaml.FullLoader) + +# update model entry +if type(args.model) != type(None): + setup['lpcnet']['model'] = args.model + +# dump result +with open(args.setup_file, 'w') as f: + yaml.dump(setup, f) |