Skip to content

Commit

Permalink
working changes
Browse files Browse the repository at this point in the history
  • Loading branch information
atharva-tendle committed May 24, 2021
1 parent 64090b9 commit c5a8fed
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
14 changes: 7 additions & 7 deletions configs.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"epochs": 150,
"exp_name": "ResNet-101-ImageNet",
"epochs": 25,
"exp_name": "ResNet50-CIFAR100",
"seed_list": [
420
],
"model_name": "resnet101",
"dataset": "ImageNet",
"model_name": "Resnet50",
"dataset": "cifar-100",
"lr": 0.001,
"batch_size": 512,
"batch_size": 128,
"target_val_acc": 94.0,
"save_path": "./",
"tolerance": 5,
"arr_save_path": "/home/shared/results/",
"arr_save_path": "/content/",
"num_workers": 4,
"data_path": "/home/shared/imagenet"
"data_path": "./"
}
2 changes: 1 addition & 1 deletion multi_train.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

def multi_train(configs_path="./configs.json"):

configs_path = "/home/shared/Layer-Wise-Learning-Trends-PyTorch/configs.json"
# configs_path = "/home/shared/Layer-Wise-Learning-Trends-PyTorch/configs.json"
print(f"Configs Path: {configs_path}")
configs = SimpleNamespace(**json.load(open(configs_path)))
print(configs)
Expand Down
3 changes: 1 addition & 2 deletions train.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,7 @@ def training(epochs, loaders, model, optimizer, criterion, prev_list,
test_acc_arr.append(test_acc)

print(
f"Epoch: {epoch} \tTrain Loss: {train_loss} \tTrain Top-1: {epoch_train_t1} \tTrain Top-5: {epoch_train_t5}%
\tTest Loss: {test_loss} \tTest Top-1: {epoch_test_t1} \tTest Top-5: {epoch_test_t5}%")
f"Epoch: {epoch} \tTrain Loss: {train_loss} \tTrain Top-1: {epoch_train_t1} \tTrain Top-5: {epoch_train_t5}% \tTest Loss: {test_loss} \tTest Top-1: {epoch_test_t1} \tTest Top-5: {epoch_test_t5}%")

# early stopping
# accumulate consecutive counters
Expand Down
4 changes: 2 additions & 2 deletions utils/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ def accuracy(output, target, topk=(1,)):

_, pred = output.topk(maxk, 1, True, True)
pred = pred.t()
correct = pred.eq(target.view(1, -1).expand_as(pred))
correct = pred.eq(target.reshape(1, -1).expand_as(pred))

res = []
for k in topk:
correct_k = correct[:k].view(-1).float().sum(0, keepdim=True)
correct_k = correct[:k].reshape(-1).float().sum(0, keepdim=True)
accuracy = correct_k.mul_(100.0 / batch_size)
res.append(accuracy)
return res
Expand Down

0 comments on commit c5a8fed

Please sign in to comment.