Learner doesn't predict the same thing after loading?

I just noticed that if I do this:

x,y = next(iter(dl))
py = to_np( learn.model( V(x) )

the predicted results py are not the same as what I got before doing the load. They are similar, but not identical. (See pics below)

Is this expected?

I’m guessing there might be some disconnect with the model state not being fully restored, and I’ll be looking into that, but wanted to check if I was missing something obvious.

(The full notebook can be seen at https://github.com/denised/tgs_salt, in case someone wants to look at it.)

You want to freeze the batch norm layers / set dropout in evaluation mode before predicting: learn.model.eval() should do the trick.

1 Like

Yup, that makes a ton of sense — thank you :slight_smile:

1 Like