def get_net_parameters(opt): net = DD() net.model = opt.model net.nL = opt.num_layers net.nH = opt.num_heads net.hSize = opt.hidden_dim net.edpt = opt.embedding_dropout net.adpt = opt.attention_dropout net.rdpt = opt.residual_dropout net.odpt = opt.output_dropout net.pt = opt.pretrain net.afn = opt.activation # how to intialize parameters # format is gauss+{}+{}.format(mean, std) # n = the default initialization pytorch net.init = opt.init return net
def get_parameters(opt, exp_type="model"): params = DD() params.net = DD() params.mle = 0 params.dataset = opt.dataset params.net = get_net_parameters(opt) params.train = get_training_parameters(opt) params.model = params.net.model params.exp = opt.exp params.data = get_data_parameters(opt, params.exp, params.dataset) params.eval = get_eval_parameters(opt, params.data.get("categories", None)) meta = DD() params.trainer = opt.trainer meta.iterations = int(opt.iterations) meta.cycle = opt.cycle params.cycle = opt.cycle params.iters = int(opt.iterations) global toy toy = opt.toy global do_gen do_gen = opt.do_gen global save save = opt.save global test_save test_save = opt.test_save global save_strategy save_strategy = opt.save_strategy print(params) return params, meta