Skip to content

Commit 75ef4c4

Browse files
committed
added explicit train and eval mode
1 parent 17c79f9 commit 75ef4c4

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

lab2/solutions/PT_Part2_Debiasing_Solution.ipynb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,6 +567,9 @@
567567
"if hasattr(tqdm, \"_instances\"):\n",
568568
" tqdm._instances.clear() # clear if it exists\n",
569569
"\n",
570+
"# set the model to train mode\n",
571+
"standard_classifier.train()\n",
572+
"\n",
570573
"\n",
571574
"def standard_train_step(x, y):\n",
572575
" x = torch.from_numpy(x).float().to(device)\n",
@@ -635,6 +638,9 @@
635638
"source": [
636639
"### Evaluation of standard CNN ###\n",
637640
"\n",
641+
"# set the model to eval mode\n",
642+
"standard_classifier.eval()\n",
643+
"\n",
638644
"# TRAINING DATA\n",
639645
"# Evaluate on a subset of CelebA+Imagenet\n",
640646
"(batch_x, batch_y) = loader.get_batch(5000)\n",

0 commit comments

Comments
 (0)