From 35c7de694b0fe74a89389d5b7b0b78e5fe274024 Mon Sep 17 00:00:00 2001 From: vue1999 Date: Fri, 1 Nov 2024 22:23:56 +0000 Subject: [PATCH] Adding formatter_class to argparser --- mace/cli/active_learning_md.py | 4 +++- mace/cli/create_lammps_model.py | 4 +++- mace/cli/eval_configs.py | 4 +++- mace/cli/fine_tuning_select.py | 4 +++- mace/cli/plot_train.py | 5 ++++- mace/tools/arg_parser.py | 9 +++++++-- 6 files changed, 23 insertions(+), 7 deletions(-) diff --git a/mace/cli/active_learning_md.py b/mace/cli/active_learning_md.py index a26be698..9cf4f4a8 100644 --- a/mace/cli/active_learning_md.py +++ b/mace/cli/active_learning_md.py @@ -14,7 +14,9 @@ def parse_args() -> argparse.Namespace: - parser = argparse.ArgumentParser() + parser = argparse.ArgumentParser( + formatter_class=argparse.ArgumentDefaultsHelpFormatter, + ) parser.add_argument("--config", help="path to XYZ configurations", required=True) parser.add_argument( "--config_index", help="index of configuration", type=int, default=-1 diff --git a/mace/cli/create_lammps_model.py b/mace/cli/create_lammps_model.py index 1917ab8e..507a2cd0 100644 --- a/mace/cli/create_lammps_model.py +++ b/mace/cli/create_lammps_model.py @@ -7,7 +7,9 @@ def parse_args(): - parser = argparse.ArgumentParser() + parser = argparse.ArgumentParser( + formatter_class=argparse.ArgumentDefaultsHelpFormatter, + ) parser.add_argument( "model_path", type=str, diff --git a/mace/cli/eval_configs.py b/mace/cli/eval_configs.py index b5700bc4..7ea94012 100644 --- a/mace/cli/eval_configs.py +++ b/mace/cli/eval_configs.py @@ -16,7 +16,9 @@ def parse_args() -> argparse.Namespace: - parser = argparse.ArgumentParser() + parser = argparse.ArgumentParser( + formatter_class=argparse.ArgumentDefaultsHelpFormatter, + ) parser.add_argument("--configs", help="path to XYZ configurations", required=True) parser.add_argument("--model", help="path to model", required=True) parser.add_argument("--output", help="output path", required=True) diff --git a/mace/cli/fine_tuning_select.py b/mace/cli/fine_tuning_select.py index 2fa5f644..94baf0dd 100644 --- a/mace/cli/fine_tuning_select.py +++ b/mace/cli/fine_tuning_select.py @@ -20,7 +20,9 @@ def parse_args() -> argparse.Namespace: - parser = argparse.ArgumentParser() + parser = argparse.ArgumentParser( + formatter_class=argparse.ArgumentDefaultsHelpFormatter, + ) parser.add_argument( "--configs_pt", help="path to XYZ configurations for the pretraining", diff --git a/mace/cli/plot_train.py b/mace/cli/plot_train.py index c249d76a..a1c424df 100644 --- a/mace/cli/plot_train.py +++ b/mace/cli/plot_train.py @@ -60,7 +60,10 @@ def parse_training_results(path: str) -> List[dict]: def parse_args() -> argparse.Namespace: - parser = argparse.ArgumentParser(description="Plot mace training statistics") + parser = argparse.ArgumentParser( + description="Plot mace training statistics", + formatter_class=argparse.ArgumentDefaultsHelpFormatter, + ) parser.add_argument( "--path", help="path to results file or directory", required=True ) diff --git a/mace/tools/arg_parser.py b/mace/tools/arg_parser.py index 11a6d2f3..fddb3b72 100644 --- a/mace/tools/arg_parser.py +++ b/mace/tools/arg_parser.py @@ -15,6 +15,7 @@ def build_default_arg_parser() -> argparse.ArgumentParser: parser = configargparse.ArgumentParser( config_file_parser_class=configargparse.YAMLConfigFileParser, + formatter_class=argparse.ArgumentDefaultsHelpFormatter, ) parser.add( "--config", @@ -23,7 +24,9 @@ def build_default_arg_parser() -> argparse.ArgumentParser: help="config file to agregate options", ) except ImportError: - parser = argparse.ArgumentParser() + parser = argparse.ArgumentParser( + formatter_class=argparse.ArgumentDefaultsHelpFormatter, + ) # Name and seed parser.add_argument("--name", help="experiment name", required=True) @@ -700,7 +703,9 @@ def build_default_arg_parser() -> argparse.ArgumentParser: def build_preprocess_arg_parser() -> argparse.ArgumentParser: - parser = argparse.ArgumentParser() + parser = argparse.ArgumentParser( + formatter_class=argparse.ArgumentDefaultsHelpFormatter, + ) parser.add_argument( "--train_file", help="Training set h5 file",