I find strange issue as never before .Adding model.eval( ) makes predictions worst compared to without it . I have been doing all this earlier with no issue ,as it is way as well when u have batch norm in place .
I dont know what unknown mistake i could be making
Here is how i save the model
torch.save(learn2.model.state_dict(),‘model_eval.pth’ )
gpu = torch.device("cuda:0")
state_dict = torch.load('../work/model_eval.pth',map_location=gpu)
model=Model()
model.load_state_dict(state_dict )
model.eval()
p=model.cuda()(x.half())
here is model head
(head): Sequential(
(0): AdaptiveConcatPool2d(
(ap): AdaptiveAvgPool2d(output_size=1)
(mp): AdaptiveMaxPool2d(output_size=1)
)
(1): Flatten()
(2): Linear(in_features=4096, out_features=512, bias=True)
(3): Mish()
(4): BatchNorm1d(512, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)
(5): Dropout(p=0.5, inplace=False)
(6): Linear(in_features=512, out_features=1, bias=True)
)
)