Hi,
I am getting getting the following error when I try to evaluate my model after training:
In SegModel:  False                                                                                                                                                                                                ------Epoch 51 | Step 71 | Train Loss 0.1662866771221161 | Validation Loss 0.48616326600313187 -----------
model loaded
Traceback (most recent call last):
File “tester.py”, line 61, in                                                                                                                                                                                model.eval()                                                                                                                                                                                                     File “/data/sbanerjee/anaconda_env/SV/lib/python3.7/site-packages/torch/nn/modules/module.py”, line 1009, in eval                                                                                                    return self.train(False)
File “/data/sbanerjee/anaconda_env/SV/lib/python3.7/site-packages/torch/nn/modules/module.py”, line 998, in train                                                                                                    module.train(mode)
TypeError: ‘bool’ object is not callable
Here’s my code snippet:
model = SegModel(train=False)
if torch.cuda.device_count() > 1:
model = nn.DataParallel(model)
model.to(device)
load_path = ‘path/to/saved/model/model_best_0816.pth.tar’
checkpoint = torch.load(load_path)
epoch = checkpoint[‘epoch’]
train_step = checkpoint[‘train step’]
train_loss = checkpoint[‘train_loss’]
val_loss = checkpoint[‘val_loss’]
print ("------Epoch {} | Step {} | Train Loss {} | Validation Loss {} -----------".format(epoch, train_step, train_loss, val_loss))
model.load_state_dict(checkpoint[‘state_dict’])
print (“model loaded”)
model.eval()
Any help would be greatly appreciated