parse.py
from argparse import ArgumentParser
def print_args(*args):
print(args)
if __name__ == '__main__':
parser = ArgumentParser()
parser.add_argument("--batch_size", type=int, default=64, help="input batch size for training (default: 64)")
parser.add_argument(
"--val_batch_size", type=int, default=1000, help="input batch size for validation (default: 1000)"
)
parser.add_argument("--epochs", type=int, default=10, help="number of epochs to train (default: 10)")
args = parser.parse_args()
print_args(args)
运行
python parse.py --batch_size=1 --val_batch_size=1 --epochs=1
网友评论