Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

is loaded model does not need eval?

Tags:

pytorch

tryint to use the test after I load the model

net = net.load_state_dict(torch.load(PATH))
net.eval()

but this spit the error

net.eval() AttributeError: '_IncompatibleKeys' object has no attribute 'eval'

1 Answers

here you don't need to assign net.load_state_dict to net

net = net.load_state_dict(torch.load(PATH))

just used

net.load_state_dict(torch.load(PATH))
net.eval()

more see Recommended approach for saving a model

like image 176
Dishin H Goyani Avatar answered Feb 23 '26 07:02

Dishin H Goyani