Skip to content

Commit

Permalink
refine training
Browse files Browse the repository at this point in the history
  • Loading branch information
haoyu-he committed Nov 6, 2023
1 parent 05e31b5 commit a591af9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion config.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ class Config:

batch = 32
epoch = 5
lr = 3e-3
lr_lstm = 2e-3
lr_transformer = 2e-4

train_size = 0.8

Expand Down
2 changes: 1 addition & 1 deletion train.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@

criterion = torch.nn.CrossEntropyLoss().to(config.device)
parameters = list(encoder.parameters()) + list(emb_layer.parameters()) + list(decoder.parameters())
optimizer = torch.optim.Adam(params=parameters, lr=config.lr)
optimizer = torch.optim.Adam(params=parameters, lr=config.lr_lstm if args.model == 'lstm' else config.lr_transformer)

# training
print('---Training---')
Expand Down

0 comments on commit a591af9

Please sign in to comment.