You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The argument parsing mechanism assumes that arguments (CLI or in the yaml file) will be processed in always the same order, but Argparse offers no such guarantee.
parser.add_argument('--load-model', action=LoadFromCheckpoint, help='Restart training using a model checkpoint') # keep firstparser.add_argument('--conf', '-c', type=open, action=LoadFromFile, help='Configuration yaml file') # keep secondparser.add_argument('--num-epochs', default=300, type=int, help='number of epochs')
This assumes --load-model will always be handled before the rest, but it seems like the actual order is the one given in the CLI.
Argparse offers no way to change this behavior, so instead we could make these options store a string and then manually process them in the order we need, so something like:
parser.add_argument('--load-model', type=str, help='Restart training using a model checkpoint') # keep firstparser.add_argument('--conf', '-c', type=str, help='Configuration yaml file') # keep secondparser.add_argument('--num-epochs', default=300, type=int, help='number of epochs')
...
input_args=parser.parse_args()
args= {}
ifinput_args.load_model:
args=LoadFromCheckpoint(input_args.load_model)
delinput_args.load_modelifinput_args.conf:
args.update(LoadFromFile(input_args.conf))
delinput_args.conffork,vininput_args.dict():
args[k] =v
The text was updated successfully, but these errors were encountered:
The argument parsing mechanism assumes that arguments (CLI or in the yaml file) will be processed in always the same order, but Argparse offers no such guarantee.
This assumes --load-model will always be handled before the rest, but it seems like the actual order is the one given in the CLI.
Argparse offers no way to change this behavior, so instead we could make these options store a string and then manually process them in the order we need, so something like:
The text was updated successfully, but these errors were encountered: