-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathopts.py
73 lines (71 loc) · 4.16 KB
/
opts.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import argparse
def parse_opt():
parser = argparse.ArgumentParser()
parser.add_argument('--data_path', default='./data/',
help='path to datasets')
parser.add_argument('--data_name', default='precomp',
help='{coco,f30k}_precomp')
parser.add_argument('--vocab_path', default='./vocab/',
help='Path to saved vocabulary json files.')
parser.add_argument('--margin', default=0.2, type=float,
help='Rank loss margin.')
parser.add_argument('--num_epochs', default=30, type=int,
help='Number of training epochs.')
parser.add_argument('--batch_size', default=128, type=int,
help='Size of a training mini-batch.')
parser.add_argument('--word_dim', default=300, type=int,
help='Dimensionality of the word embedding.')
parser.add_argument('--embed_size', default=1024, type=int,
help='Dimensionality of the joint embedding.')
parser.add_argument('--grad_clip', default=2., type=float,
help='Gradient clipping threshold.')
parser.add_argument('--num_layers', default=1, type=int,
help='Number of GRU layers.')
parser.add_argument('--learning_rate', default=.0002, type=float,
help='Initial learning rate.')
parser.add_argument('--lr_update', default=15, type=int,
help='Number of epochs to update the learning rate.')
parser.add_argument('--workers', default=10, type=int,
help='Number of data loader workers.')
parser.add_argument('--log_step', default=10, type=int,
help='Number of steps to print and record the log.')
parser.add_argument('--val_step', default=500, type=int,
help='Number of steps to run validation.')
parser.add_argument('--logger_name', default='./runs/runX/log',
help='Path to save Tensorboard log.')
parser.add_argument('--model_name', default='./runs/runX/checkpoint',
help='Path to save the model.')
parser.add_argument('--resume', default='', type=str, metavar='PATH',
help='path to latest checkpoint (default: none)')
parser.add_argument('--max_violation', action='store_true',
help='Use max instead of sum in the rank loss.')
parser.add_argument('--img_dim', default=2048, type=int,
help='Dimensionality of the image embedding.')
parser.add_argument('--no_imgnorm', action='store_true',
help='Do not normalize the image embeddings.')
parser.add_argument('--no_txtnorm', action='store_true',
help='Do not normalize the text embeddings.')
parser.add_argument('--raw_feature_norm', default="clipped_l2norm",
help='clipped_l2norm|l2norm|clipped_l1norm|l1norm|no_norm|softmax')
parser.add_argument('--agg_func', default="LogSumExp",
help='LogSumExp|Mean|Max|Sum')
parser.add_argument('--cross_attn', default="t2i",
help='t2i|i2t')
parser.add_argument('--precomp_enc_type', default="basic",
help='basic|weight_norm')
parser.add_argument('--bi_gru', action='store_true',
help='Use bidirectional GRU.')
parser.add_argument('--lambda_lse', default=6., type=float,
help='LogSumExp temp.')
parser.add_argument('--lambda_softmax', default=9., type=float,
help='Attention softmax temperature.')
parser.add_argument('--pos_emb', action='store_true',
help="useing pos embedding")
parser.add_argument('--gpuid', default=0, type=str,
help='gpuid')
parser.add_argument('--model_mode', default="gate", type=str,
help='gate[_*], test, vsesc')
parser.add_argument('--mse_lambda', default=1, type=float,
help='mse_lambda')
args = parser.parse_args()
return args