forked from mhpi/hydroDL
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtrain-lstm.py
More file actions
26 lines (23 loc) · 733 Bytes
/
train-lstm.py
File metadata and controls
26 lines (23 loc) · 733 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
from hydroDL import pathSMAP
from hydroDL.master import default, wrapMaster, train
import os
import torch
cDir = os.path.dirname(os.path.abspath(__file__))
# define training options
optData = default.update(
default.optDataSMAP,
rootDB=os.path.join(cDir, 'data'),
subset='CONUSv4f1',
tRange=[20150401, 20160401])
if torch.cuda.is_available():
optModel = default.optLstm
else:
optModel = default.update(
default.optLstm,
name='hydroDL.model.rnn.CpuLstmModel')
optLoss = default.optLossRMSE
optTrain = default.update(default.optTrainSMAP, nEpoch=100)
out = os.path.join(cDir, 'output', 'CONUSv4f1')
masterDict = wrapMaster(out, optData, optModel, optLoss, optTrain)
# train
train(masterDict)