Skip to content

Commit

Permalink
Pavel/vision (#16)
Browse files Browse the repository at this point in the history
fix lr scheduler
  • Loading branch information
pavel-izmailov authored Dec 18, 2023
1 parent 6ce5200 commit 0a6d4ab
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 4 additions & 4 deletions vision/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ With the commands above we get the following results (note that the results may
| Model | Top-1 Accuracy |
|-------------------------|----------------|
| AlexNet | 56.6 |
| Dino ResNet50 | 63.7 |
| Dino ViT-B/8 | 74.9 |
| AlexNet → DINO ResNet50 | 60.7 |
| AlexNet → DINO ViT-B/8 | 64.2 |
| Dino ResNet50 | 64.5 |
| Dino ViT-B/8 | 74.0 |
| AlexNet → DINO ResNet50 | 61.9 |
| AlexNet → DINO ViT-B/8 | 66.6 |

You can add new custom models to the `models.py` and new datasets to `data.py`.
4 changes: 3 additions & 1 deletion vision/run_weak_strong.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ def train_logreg(
model = torch.nn.Linear(d, n_classes).cuda()
criterion = torch.nn.CrossEntropyLoss()
optimizer = torch.optim.Adam(model.parameters(), weight_decay=weight_decay, lr=lr)
schedule = torch.optim.lr_scheduler.CosineAnnealingLR(optimizer=optimizer, T_max=n_epochs)
n_batches = len(train_loader)
n_iter = n_batches * n_epochs
schedule = torch.optim.lr_scheduler.CosineAnnealingLR(optimizer=optimizer, T_max=n_iter)

results = {f"{key}_all": [] for key in eval_datasets.keys()}
for epoch in (pbar := tqdm.tqdm(range(n_epochs), desc="Epoch 0")):
Expand Down

0 comments on commit 0a6d4ab

Please sign in to comment.