forked from jaywonchung/BERT4Rec-VAE-Pytorch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
templates.py
162 lines (139 loc) · 5.42 KB
/
templates.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
def set_template(args):
if args.template is None:
return
elif args.template.startswith('train_bert'):
args.mode = 'train'
args.dataset_code = 'ml-' + input('Input 1 for ml-1m, 20 for ml-20m: ') + 'm'
args.min_rating = 0 if args.dataset_code == 'ml-1m' else 4
args.min_uc = 5
args.min_sc = 0
args.split = 'leave_one_out'
args.dataloader_code = 'bert'
batch = 128
args.train_batch_size = batch
args.val_batch_size = batch
args.test_batch_size = batch
args.train_negative_sampler_code = 'random'
args.train_negative_sample_size = 0
args.train_negative_sampling_seed = 0
args.test_negative_sampler_code = 'random'
args.test_negative_sample_size = 100
args.test_negative_sampling_seed = 98765
args.trainer_code = 'bert'
args.device = 'cuda'
args.num_gpu = 1
args.device_idx = '0'
args.optimizer = 'Adam'
args.lr = 0.001
args.enable_lr_schedule = True
args.decay_step = 25
args.gamma = 1.0
args.num_epochs = 100 if args.dataset_code == 'ml-1m' else 200
args.metric_ks = [1, 5, 10, 20, 50, 100]
args.best_metric = 'NDCG@10'
args.model_code = 'bert'
args.model_init_seed = 0
args.bert_dropout = 0.1
args.bert_hidden_units = 256
args.bert_mask_prob = 0.15
args.bert_max_len = 100
args.bert_num_blocks = 2
args.bert_num_heads = 4
elif args.template.startswith('train_dae'):
args.mode = 'train'
args.dataset_code = 'ml-' + input('Input 1 for ml-1m, 20 for ml-20m: ') + 'm'
args.min_rating = 0 if args.dataset_code == 'ml-1m' else 4
args.min_uc = 5
args.min_sc = 0
args.split = 'holdout'
args.dataset_split_seed = 98765
args.eval_set_size = 500 if args.dataset_code == 'ml-1m' else 10000
args.dataloader_code = 'ae'
batch = 128 if args.dataset_code == 'ml-1m' else 512
args.train_batch_size = batch
args.val_batch_size = batch
args.test_batch_size = batch
args.trainer_code = 'dae'
args.device = 'cuda'
args.num_gpu = 1
args.device_idx = '0'
args.optimizer = 'Adam'
args.lr = 1e-3
args.enable_lr_schedule = False
args.weight_decay = 0.00
args.num_epochs = 100 if args.dataset_code == 'ml-1m' else 200
args.metric_ks = [1, 5, 10, 20, 50, 100]
args.best_metric = 'NDCG@10'
args.model_code = 'dae'
args.model_init_seed = 0
args.dae_num_hidden = 2
args.dae_hidden_dim = 600
args.dae_latent_dim = 200
args.dae_dropout = 0.5
elif args.template.startswith('train_vae_search_beta'):
args.mode = 'train'
args.dataset_code = 'ml-' + input('Input 1 for ml-1m, 20 for ml-20m: ') + 'm'
args.min_rating = 0 if args.dataset_code == 'ml-1m' else 4
args.min_uc = 5
args.min_sc = 0
args.split = 'holdout'
args.dataset_split_seed = 98765
args.eval_set_size = 500 if args.dataset_code == 'ml-1m' else 10000
args.dataloader_code = 'ae'
batch = 128 if args.dataset_code == 'ml-1m' else 512
args.train_batch_size = batch
args.val_batch_size = batch
args.test_batch_size = batch
args.trainer_code = 'vae'
args.device = 'cuda'
args.num_gpu = 1
args.device_idx = '0'
args.optimizer = 'Adam'
args.lr = 1e-3
args.enable_lr_schedule = False
args.weight_decay = 0.01
args.num_epochs = 100 if args.dataset_code == 'ml-1m' else 200
args.metric_ks = [1, 5, 10, 20, 50, 100]
args.best_metric = 'NDCG@10'
args.total_anneal_steps = 3000 if args.dataset_code == 'ml-1m' else 20000
args.find_best_beta = True
args.model_code = 'vae'
args.model_init_seed = 0
args.vae_num_hidden = 2
args.vae_hidden_dim = 600
args.vae_latent_dim = 200
args.vae_dropout = 0.5
elif args.template.startswith('train_vae_give_beta'):
args.mode = 'train'
args.dataset_code = 'ml-' + input('Input 1 for ml-1m, 20 for ml-20m: ') + 'm'
args.min_rating = 0 if args.dataset_code == 'ml-1m' else 4
args.min_uc = 5
args.min_sc = 0
args.split = 'holdout'
args.dataset_split_seed = 98765
args.eval_set_size = 500 if args.dataset_code == 'ml-1m' else 10000
args.dataloader_code = 'ae'
batch = 128 if args.dataset_code == 'ml-1m' else 512
args.train_batch_size = batch
args.val_batch_size = batch
args.test_batch_size = batch
args.trainer_code = 'vae'
args.device = 'cuda'
args.num_gpu = 1
args.device_idx = '0'
args.optimizer = 'Adam'
args.lr = 1e-3
args.enable_lr_schedule = False
args.weight_decay = 0.01
args.num_epochs = 100 if args.dataset_code == 'ml-1m' else 200
args.metric_ks = [1, 5, 10, 20, 50, 100]
args.best_metric = 'NDCG@100'
args.find_best_beta = False
args.anneal_cap = 0.342
args.total_anneal_steps = 3000 if args.dataset_code == 'ml-1m' else 20000
args.model_code = 'vae'
args.model_init_seed = 0
args.vae_num_hidden = 2
args.vae_hidden_dim = 600
args.vae_latent_dim = 200
args.vae_dropout = 0.5