Week 5: callbacks=[ModelCheckpoint('saved_model', verbose=1)

I am running the lab “C1_W5_Lab_1_exploring-callbacks” in Jupyter Notebook at my Window PC.

I have a question about the ‘saved_model’ callback below .

callbacks=[ModelCheckpoint('saved_model', verbose=1)]

I got the following error message.

NotFoundError: Failed to create a NewWriteableFile: saved_model\variables\variables_temp_35e330c2d411427695dd630c8a033fdf/part-00000-of-00001.data-00000-of-00001.tempstate6789405947221926809 : The system cannot find the path specified.
; No such process [Op:SaveV2]

I have no clue what that means.
I would appreciate it if anyone can mentor on this issue.
Best regards

Hi @Michio_Suginoo!

The simplest thing to do if you just want to get this working is to click the link to open the lab and then click the “open in Colab” link to run it in Colab. It should work just fine there. Running in the provided environment is your safest way to avoid problems since the staff has tested in those environments. If you try running the Jupyter notebook in your own environment, you’re more on your own and may run into new, unexpected issues.

That said, if you want to run the Jupyter notebook on your PC, some suggestions for how to approach debugging the problem:

First, it’s always good to think through what’s supposed to be happening to give you an understanding of what the error message might be referring to. In this case, you know:

  • ModeCheckpoint is trying to save a copy of your model to saved_model
  • You got an error writing to a file in a sub-directory of saved_model
  • The pathname includes temp, so it’s probably a temporary file used to in the process of assembling a final file
  • You also know that ModelCheckpoint worked fine in an earlier cell, where you called ModelCheckpoint(‘weights.{epoch:02d}-{val_loss:.2f}.h5’, verbose=1).

Some things you can check given this knowledge:

  • Check the directory where the saved files were written. Do you notice any difference between the successful .h5 saves vs the plain ‘saved_model’ save?
  • What, if anything, was successfully saved for saved_model?
  • Google the documentation for ModelCheckpoint and see if you notice anything helpful about how the function should be used
  • Google the error you’re seeing to find out if anyone else has run across it, and see how they handled it.

For this example, I tried googling “ModelCheckpoint” “Failed to create a NewWriteableFile” and found this link that explains a problem specific to Windows as well as a workaround:

Check it out and give it a try.

1 Like