TFLite Model Maker OS Error

Code: model = image_classifier.create(train_data, validation_data=validation_data, epochs= 10, learning_rate= 0.001, model_spec=model_spec.get(‘mobilenet_v2’))

OSError: SavedModel file does not exist at: C:\Users\Hagen\AppData\Local\Temp\tfhub_modules\145bb06ec3b59b08fb564ab752bd5aa222bfb50a{saved_model.pbtxt|saved_model.pb}

I hope you can help me

Are the files present on that folder?

During the create method, model maker will use TensorFlow Hub to download the base model (in your case mobilenet_v2) to do transfer learning. Apparently, it thinks the model is there but it can find when loading.

you can also try this code snippet to see if this works fine on your machine:

import tensorflow as tf
import tensorflow_hub as hub
model = hub.load("")

this is basically what Model Maker is doing when you get that error.

Thank you for the reply, I tried the code and it didn’t work. I also got the same error.

model = hub.load("")

OSError: SavedModel file does not exist at: C:\Users\Hagen\AppData\Local\Temp\tfhub_modules\87f7b0d2504a48175f521bcaed174acabc93672c{saved_model.pbtxt|saved_model.pb}

But are the files present on that folder?
does the folder exists?

this looks like some kind of permission issue to write the file on that directory.

There are assets and variables folder under the ‘87f7b0d2504a48175f521bcaed174acabc93672c’.
However there’s no saved_model.pbtxt or saved_model.pb.

The code was working the other day. I remember that I imported tensorboard 'cause I want to try if I can use tensorboard in tflite-model-maker. Since the tensorboard code did not work I removed few lines of codes related to tensorboard then the OSError appeared.

Should I reinstall?

I don’t know, that’s weird.

Try deleting the folder (87f7b…) and try again.

Another option is defining a place to save the TFHub models that is not a temp folder, just to see if the permissions work fine. Something like:

import os
os.environ["TFHUB_CACHE_DIR"] = "some_dir"

Hi, thank you for the reply.
The above code fixed my error without deleting the (87f7b…) folder.

Thank you very much!

1 Like