SaveModelCallback - Saved filed doesn't contain an optimizer state

Here is my learner:, cbs=[EarlyStoppingCallback(monitor='accuracy', min_delta=0.01, comp=np.greater, patience=5),
                                     SaveModelCallback(monitor="accuracy", comp=np.greater, fname="resnet18ce512-1")]

It prints out my best accuracy:

Better model found at epoch 10 with accuracy value: 0.8514589071273804.
No improvement since epoch 7: early stopping

Then, I try to load it after it completes:


But get this error:

/usr/local/lib/python3.6/dist-packages/fastai/ UserWarning: Saved filed doesn't contain an optimizer state.
  elif with_opt: warn("Saved filed doesn't contain an optimizer state.")
<fastai.learner.Learner at 0x7ff3f2bc6f98>

Iā€™m not sure why I cannot load this?

I believe I fixed it with:

SaveModelCallback(monitor="accuracy", with_opt=True, comp=np.greater, fname="resnet18ce512-1")]

I added with_opt=True ā€“ since I had Adam set as my optimizer.

1 Like