I have a few arguments added to my argparse parser in my script as below:
parser = argparse.ArgumentParser()
parser.add_argument("--eval_model_dir", type=str, default='',
help="Model directory for evaluation.")
parser.add_argument("--evaluate_during_training", action='store_true',
help="Run evaluation during training at each save_steps.")
I am running the script from command line as below:
python test.py --eval_ dummy_value
Even when the argument passed from the command line, --eval_
, does not match the argument in the script, --eval_model_dir
, the value passed, dummy_value
, is assigned to --eval_model_dir
. If the command line argument is --eval
, I get an error message as following:
error: ambiguous option: --eval could match --evaluate_during_training, --eval_model_dir
.
Based on my reading of the Argparse official documentation, I did not find it mentioned that the command line arguments and the script arguments could be the closest match. Intuitively, I would think that an exact match would be needed. I have following questions:
From the official doc you linked: https://docs.python.org/3/library/argparse.html#argument-abbreviations-prefix-matching
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With