From 905a2e245990d820a293dd933cc71f0db637bc63 Mon Sep 17 00:00:00 2001 From: JunhaoQiu <56094690+qchiujunhao@users.noreply.github.com> Date: Tue, 2 Apr 2024 17:06:57 -0400 Subject: [PATCH] Auto generate a config from a dataset --- tools/ludwig_autogencofig.py | 25 +++++++++++++++++++++ tools/ludwig_autogencofig.xml | 41 +++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 tools/ludwig_autogencofig.py create mode 100644 tools/ludwig_autogencofig.xml diff --git a/tools/ludwig_autogencofig.py b/tools/ludwig_autogencofig.py new file mode 100644 index 0000000..8f9d7f7 --- /dev/null +++ b/tools/ludwig_autogencofig.py @@ -0,0 +1,25 @@ +import argparse + +import logging + +from ludwig import automl +from ludwig.utils import defaults + +logging.basicConfig(level=logging.DEBUG) +LOG = logging.getLogger(__name__) + +def main(): + parser = argparse.ArgumentParser(description='Render a Ludwig config') + parser.add_argument('--dataset', type=str, help='Path to the dataset file', required=True) + parser.add_argument('--output_feature', type=str, help='Name for the output feature', required=True) + parser.add_argument('--output', type=str, help='Path for the output file', required=True) + args = parser.parse_args() + + + args_init = ["--dataset", args.dataset, "--target", args.output_feature, "--output", args.output] + automl.cli_init_config(args_init) + args_render = ["--config", args.output, "--output", args.output] + defaults.cli_render_config(args_render) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/tools/ludwig_autogencofig.xml b/tools/ludwig_autogencofig.xml new file mode 100644 index 0000000..83da665 --- /dev/null +++ b/tools/ludwig_autogencofig.xml @@ -0,0 +1,41 @@ + + Auto-generate a config file from a dataset for Ludwig training. + + ludwig_macros.xml + + + + echo "@VERSION@" + + + + + + + + + + + + + + + + + + + + + + +