예제 #1
0
    def add_arguments(parser):
        parser = LossParams.add_arguments(parser)

        parser.add_argument(
            "--optimizer",
            default="Adam",
            choices=optimizer.OPTIMIZER_NAMES,
            help="optimizer to train the network",
        )
        parser.add_argument(
            "--val_epoch_freq",
            type=int,
            default=1,
            help="validation epoch frequency.",
        )
        parser.add_argument("--learning_rate", type=float, default=0,
            help="Learning rate for the training. If <= 0 it will be set"
            " automatically to the default for the specified model adapter.")
        parser.add_argument("--batch_size", type=int, default=4)
        parser.add_argument("--num_epochs", type=int, default=20)

        parser.add_argument("--log_dir", help="folder to log tensorboard summary")

        parser.add_argument('--display_freq', type=int, default=100,
            help='frequency of showing training results on screen')
        parser.add_argument('--print_freq', type=int, default=1,
            help='frequency of showing training results on console')
        parser.add_argument('--save_epoch_freq', type=int, default=1,
            help='frequency of saving checkpoints at the end of epochs')

        return parser
예제 #2
0
def make_tag(params):
    return (
        LossParams.make_str(params)
        + f"_LR{params.learning_rate}"
        + f"_BS{params.batch_size}"
        + f"_O{params.optimizer.lower()}"
    )