Inflect-Mini-v3 / run.py
owensong's picture
Release eight vocal-event tags across all six Mini voices
dc6dc7d verified
Raw History Blame Contribute Delete
1.38 kB
"""Run a verified Inflect Mini package without writing into its model folders."""
import sys
sys.dont_write_bytecode = True
import argparse
from pathlib import Path
import subprocess
from verify_release import verify
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('mode', choices=('speech', 'events'),
help='Ordinary speech or the optional six-voice event component')
args, forwarded = parser.parse_known_args()
root = Path(__file__).resolve().parent
verify(root)
if args.mode == 'speech':
if any(arg == '--model' or arg.startswith('--model=') for arg in forwarded):
parser.error('This download contains Mini; no --model flag is needed.')
command = [str(root / 'core/synthesize.py'), '--model', 'mini', *forwarded]
else:
protected = ('--core-root', '--core-manifest-sha256', '--component', '--component-sha256')
if any(arg == flag or arg.startswith(flag + '=') for arg in forwarded for flag in protected):
parser.error('Component paths are selected from this verified download.')
command = [str(root / 'extras/events/command.py'), '--events', *forwarded]
raise SystemExit(subprocess.run([sys.executable, '-B', *command], check=False).returncode)
if __name__ == '__main__':
main()