-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathconfig.py
More file actions
27 lines (23 loc) · 847 Bytes
/
Copy pathconfig.py
File metadata and controls
27 lines (23 loc) · 847 Bytes
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
import torch
import os
from tensorboardX import SummaryWriter
class Config():
'''
Config class
'''
def __init__(self):
self.dataset_root = './data/mall_dataset'
self.device = torch.device('cuda') if torch.cuda.is_available() else torch.device('cpu')
self.lr = 1e-5 # learning rate
self.batch_size = 1 # batch size
self.epochs = 2000 # epochs
self.checkpoints = './checkpoints' # checkpoints dir
self.writer = SummaryWriter() # tensorboard writer
self.__mkdir(self.checkpoints)
def __mkdir(self, path):
'''
create directory while not exist
'''
if not os.path.exists(path):
os.makedirs(path)
print('create dir: ',path)