Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Andrewzh112/codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrewzh112 committed Dec 2, 2020
2 parents 072e193 + 4cb3459 commit 0ac2d0d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions simsiam/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def cosine_loss(p, z):

optimizer = torch.optim.SGD(model.parameters(), lr=args.lr,
momentum=args.momentum, weight_decay=args.wd)
scheduler = torch.optim.lr_scheduler.CosineAnnealingLR(optimizer, args.epochs // 40)
scheduler = torch.optim.lr_scheduler.CosineAnnealingLR(optimizer, int(args.epochs * 0.005))

pbar = tqdm(range(args.epochs))
for epoch in pbar:
Expand Down Expand Up @@ -137,7 +137,8 @@ def cosine_loss(p, z):
tqdm.write(
f'Epoch {epoch + 1}/{args.epochs}, \
Train Loss: {sum(train_losses) / len(train_losses):.3f}, \
Top Acc @ 1: {top1acc:.3f}'
Top Acc @ 1: {top1acc:.3f}, \
Learning Rate: {scheduler.get_last_lr()}'
)
torch.save(model.state_dict(), args.check_point)
scheduler.step()

0 comments on commit 0ac2d0d

Please sign in to comment.