amitke commited on
Commit
5143bce
·
1 Parent(s): 457b70c
Files changed (1) hide show
  1. train.py +3 -3
train.py CHANGED
@@ -44,7 +44,7 @@ def to_tensor_loader(X, y, batch_size=32):
44
  return ds
45
 
46
  def train(symbol: str, seq_len: int = 60, epochs: int = 5, batch_size: int = 32,
47
- start: str = None, end: str = None, lr: float = 1e-3):
48
  device = torch.device("cpu")
49
 
50
  # --- data ---
@@ -75,8 +75,8 @@ def train(symbol: str, seq_len: int = 60, epochs: int = 5, batch_size: int = 32,
75
  # --- model ---
76
  model = StockLSTM(input_dim=1, hidden_dim=64, num_layers=2, dropout=0.2).to(device)
77
  criterion = nn.MSELoss()
78
- # optimizer = optim.Adam(model.parameters(), lr=lr)
79
- optimizer = optim.SGD(model.parameters(), lr=lr)
80
 
81
  # --- training ---
82
  model.train()
 
44
  return ds
45
 
46
  def train(symbol: str, seq_len: int = 60, epochs: int = 5, batch_size: int = 32,
47
+ start: str = None, end: str = None, lr: float = 1e-2):
48
  device = torch.device("cpu")
49
 
50
  # --- data ---
 
75
  # --- model ---
76
  model = StockLSTM(input_dim=1, hidden_dim=64, num_layers=2, dropout=0.2).to(device)
77
  criterion = nn.MSELoss()
78
+ optimizer = optim.AdamW(model.parameters(), lr=lr)
79
+ # optimizer = optim.SGD(model.parameters(), lr=lr)
80
 
81
  # --- training ---
82
  model.train()