-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
37 lines (29 loc) · 973 Bytes
/
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
import torch
import torchvision
from dataprocessing import UniqueNoisyDNASequences
from DataLoader import prepareDataLoader
from model import Autoencoder
from train import trainf, testf
import matplotlib.pyplot as plt
def get_device():
if torch.cuda.is_available():
device = 'cuda:0'
else:
device = 'cpu'
return device
if __name__=='__main__':
epoch = 100
lra = 1e-3
path = '../../../data/DeepIntegrate_Data_HOH_2019.txt'
device = get_device()
DNAListX, DNAListY = UniqueNoisyDNASequences(path)
trainDL, testDL = prepareDataLoader(DNAListX, DNAListY)
criterion = nn.MSELoss()
optimizer = optim.Adam(net.parameters(), lr=lra)
net = Autoencoder()
train_loss = train(device, net, trainDL, epoch, criterion, optimizer)
test_loss = testf(device, net, testDL, epoch, criterion)
# plt.plot(train_loss)
# plt.title('Train Loss')
# plt.xlabel('Epochs')
# plt.ylabel('Loss')