[kws] use **kvargs for optim to reduce code (#25)

This commit is contained in:
Binbin Zhang 2021-12-06 11:23:44 +08:00 committed by GitHub
parent 88444ab177
commit a5a54782cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -195,9 +195,7 @@ def main():
device = torch.device('cuda' if use_cuda else 'cpu')
model = model.to(device)
optimizer = optim.Adam(model.parameters(),
lr=configs['optim_conf']['lr'],
weight_decay=configs['optim_conf'].get('weight_decay', 0))
optimizer = optim.Adam(model.parameters(), **configs['optim_conf'])
scheduler = optim.lr_scheduler.ReduceLROnPlateau(
optimizer,
mode='min',