简体   繁体   中英

a pickled file exists but nothing in it OSError: SavedModel file does not exist at: {saved_model.pbtxt|saved_model.pb}

I'm working on ActionAI( https://github.com/smellslikeml/ActionAI ) which is a python library that classifies human actions. I got this error running iva.py , the final script.

Traceback (most recent call last):
  File "iva.py", line 256, in <module>
    secondary_model = tf.keras.models.load_model('models/classifier.sav')
  File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/keras/saving/save.py", line 149, in load_model
    loader_impl.parse_saved_model(filepath)
  File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/saved_model/loader_impl.py", line 83, in parse_saved_model
    constants.SAVED_MODEL_FILENAME_PB))
OSError: SavedModel file does not exist at: models/classifier.sav/{saved_model.pbtxt|saved_model.pb}

In models directory, classifier.sav is existing but empty. I think pickle.dump(model, open(config.classifier_model, 'wb'), protocol=2) in train.py doesn't work properly. I've tried changing the filename extension to pkl , h5 , and pb but didn't work. sudo apt install python3-h5py this command also changed nothing.

pickle.dump() should take open() as a second argument, ie:

import pickle

filename = 'your_pickle_filename.pkl'
pickle.dump(model, open(filename, 'wb'))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM