Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pavel/vision #16

Merged
merged 5 commits into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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