-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathutils_mpc.py
45 lines (36 loc) · 2.02 KB
/
utils_mpc.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
from itertools import groupby
import argparse
import numpy as np
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument("--device", '-d', type=int, default=6, help="GPU to use")
parser.add_argument("--lr", type=float, default=0.0005, help="Learning Rate")
parser.add_argument("--epochs", type=int, default=1000, help="Number of Epochs for training")
parser.add_argument("--batch_size", type=int, default=32, help="Batch Size")
parser.add_argument("--eval", type=int, default=5, help="evaluation step")
parser.add_argument("--es", type=int, default=30, help="Early Stopping Criteria")
parser.add_argument("--embedder", type=str, default="mpc", help="Early Stopping Criteria")
parser.add_argument("--input_dim", type=int, default=83, help="Early Stopping Criteria")
parser.add_argument("--hidden_dim", type=int, default=64, help="Early Stopping Criteria")
parser.add_argument("--output_dim", type=int, default=256, help="Early Stopping Criteria")
parser.add_argument("--weight_decay", type=float, default=0.0005, help = 'weight decay')
parser.add_argument("--seed", type=int, default=0, help = 'Random seed')
parser.add_argument("--num_sub", type=int, default=2, help = 'Random seed')
parser.add_argument("--split", type=str, default = 'year', help = 'Dataset Split Strategy')
parser.add_argument("--lb", type=str, default = 'one', help = 'LB Strategy')
parser.add_argument("--loss", type=str, default = 'adaptive', help = 'Loss Strategy')
parser.add_argument("--retrieval", type=str, default = 'ours', help = 'Retrieval')
return parser.parse_args()
def training_config(args):
train_config = dict()
for arg in vars(args):
train_config[arg] = getattr(args,arg)
return train_config
def train_mpc(train_config):
name = ''
dic = train_config
config = ["loss","lb", "split", "input_dim", "seed", "lr", "batch_size", "hidden_dim", "embedder"]
for key in config:
a = f'{key}'+f'({dic[key]})'+'_'
name += a
return name