Skip to content

Commit d499e49

Browse files
committed
put models in eval mode
1 parent ed8475a commit d499e49

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

cifar100_dcgan_grayscale/dcgan_cifar100_pretrained_load.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
},
2323
{
2424
"cell_type": "code",
25-
"execution_count": 3,
25+
"execution_count": 2,
2626
"metadata": {},
2727
"outputs": [],
2828
"source": [
@@ -31,8 +31,8 @@
3131
"# load the models\n",
3232
"from dcgan import Discriminator, Generator\n",
3333
"\n",
34-
"D = Discriminator(ngpu=1)\n",
35-
"G = Generator(ngpu=1)\n",
34+
"D = Discriminator(ngpu=1).eval()\n",
35+
"G = Generator(ngpu=1).eval()\n",
3636
"\n",
3737
"# load weights\n",
3838
"D.load_state_dict(torch.load('weights/netD_epoch_299.pth'))\n",
@@ -142,7 +142,7 @@
142142
"name": "python",
143143
"nbconvert_exporter": "python",
144144
"pygments_lexer": "ipython3",
145-
"version": "3.5.4"
145+
"version": "3.7.0"
146146
}
147147
},
148148
"nbformat": 4,

cifar10_dcgan/dcgan_cifar10_pretrained_load.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
"# load the models\n",
3232
"from dcgan import Discriminator, Generator\n",
3333
"\n",
34-
"D = Discriminator(ngpu=1)\n",
35-
"G = Generator(ngpu=1)\n",
34+
"D = Discriminator(ngpu=1).eval()\n",
35+
"G = Generator(ngpu=1).eval()\n",
3636
"\n",
3737
"# load weights\n",
3838
"D.load_state_dict(torch.load('weights/netD_epoch_199.pth'))\n",
@@ -166,7 +166,7 @@
166166
"name": "python",
167167
"nbconvert_exporter": "python",
168168
"pygments_lexer": "ipython3",
169-
"version": "3.5.4"
169+
"version": "3.7.0"
170170
}
171171
},
172172
"nbformat": 4,

classifiers/cifar/cifar_pretrained_load.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"outputs": [],
3131
"source": [
3232
"device = 'cuda' if torch.cuda.is_available() else 'cpu'\n",
33-
"net = model.cifar10(128, pretrained='log/cifar10/best-135.pth') \n",
33+
"net = model.cifar10(128, pretrained='log/cifar10/best-135.pth').eval() \n",
3434
"net = net.to(device)"
3535
]
3636
}

classifiers/mnist/lenet_pretrained_load.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"outputs": [],
3131
"source": [
3232
"device = 'cuda' if torch.cuda.is_available() else 'cpu'\n",
33-
"net = LeNet5()\n",
33+
"net = LeNet5().eval()\n",
3434
"net.load_state_dict(torch.load('weights/lenet_epoch=12_test_acc=0.991.pth'))\n",
3535
"net = net.to(device)"
3636
]

mnist_dcgan/dcgan_mnist_pretrained_load.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
"# load the models\n",
3232
"from dcgan import Discriminator, Generator\n",
3333
"\n",
34-
"D = Discriminator(ngpu=1)\n",
35-
"G = Generator(ngpu=1)\n",
34+
"D = Discriminator(ngpu=1).eval()\n",
35+
"G = Generator(ngpu=1).eval()\n",
3636
"\n",
3737
"# load weights\n",
3838
"D.load_state_dict(torch.load('weights/netD_epoch_99.pth'))\n",
@@ -134,7 +134,7 @@
134134
"name": "python",
135135
"nbconvert_exporter": "python",
136136
"pygments_lexer": "ipython3",
137-
"version": "3.5.4"
137+
"version": "3.7.0"
138138
}
139139
},
140140
"nbformat": 4,

0 commit comments

Comments
 (0)