Ejemplo n.º 1
0
template_file = os.path.join(dest_dir, 'max-model-training-config.yaml')
if not os.path.isfile(template_file):
    print('Error. Template configuration file "{}" was not found.'.format(
        template_file))
    sys.exit(1)

# ---------------------------------------
# Customize the configuration file in the destination directory
# ---------------------------------------

print('Customizing configuration file ...')

try:
    yaml = YAML(typ='rt')
    yaml.default_flow_style = False
    yaml.preserve_qotes = True

    # load and parse config file
    with open(template_file, 'r') as file:
        conf = yaml.load(file)

    if conf is None or not isinstance(conf, dict):
        print('Error. The configuration file appears to be invalid.')
        print(conf)
        sys.exit(1)

    # required; model name
    conf['name'] = capture_input('Model name',
                                 required=False,
                                 default=model_name.replace('-', ' '))