This repository has been archived by the owner on Jul 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
55 lines (49 loc) · 1.39 KB
/
main.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
#!/usr/bin/env python3
if __name__ == '__main__':
from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
parser = ArgumentParser(formatter_class=ArgumentDefaultsHelpFormatter)
arg = parser.add_argument
arg('--data_dir', default='data/sentihood/', help="Path to the dataset directory")
arg('-e', '--epochs', default=1, type=int, help="Training epochs")
arg(
'-b',
'--batch_size',
default=4,
type=int,
help="Batch size for training and evaluation",
)
arg(
'-bs',
'--balanced_sampler',
default=True,
type=bool,
help="Pick examples uniformly *between classes*",
)
arg(
'-lr',
'--learning_rate',
default=1e-4,
type=float,
help="Optimizer learning rate",
)
arg(
'-wd',
'--weight_decay',
default=0.01,
type=float,
help="Optimizer weight decay (L2)",
)
arg('--cpu', action='store_true', help="Force CPU even if CUDA is available")
arg(
'--debug',
action='store_true',
help="Debug options (truncate the datasets for faster debugging)",
)
args = parser.parse_args()
import torch
from sentihood import main
args.device = torch.device(
'cuda' if torch.cuda.is_available() and not args.cpu else 'cpu'
)
# main(**vars(args))
main(args)