Giter Club home page Giter Club logo

Comments (3)

sushreebarsa avatar sushreebarsa commented on April 27, 2024

@nilesh-sengupta Please use the appropriate loading function based on the saving format. For example, tf.keras.models.load_model for HDF5 and tf.saved_model.load for SavedModel.
Thank you!

from tensorflow.

nilesh-sengupta avatar nilesh-sengupta commented on April 27, 2024

@sushreebarsa The model is in .keras format, it is saved using model.save('model_name.keras'), loading it using tf.saved_model.load gives the following exception:
Traceback (most recent call last):
File "/usr/local/bin/mldnn/dnn_1.6/predictor.py", line 26, in
model = tf.saved_model.load('deep_neural_network.keras')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/miniconda3/envs/model_training/lib/python3.11/site-packages/tensorflow/python/saved_model/load.py", line 912, in load
result = load_partial(export_dir, None, tags, options)["root"]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/miniconda3/envs/model_training/lib/python3.11/site-packages/tensorflow/python/saved_model/load.py", line 1016, in load_partial
loader_impl.parse_saved_model_with_debug_info(export_dir))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/miniconda3/envs/model_training/lib/python3.11/site-packages/tensorflow/python/saved_model/loader_impl.py", line 59, in parse_saved_model_with_debug_info
saved_model = parse_saved_model(export_dir)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/miniconda3/envs/model_training/lib/python3.11/site-packages/tensorflow/python/saved_model/loader_impl.py", line 119, in parse_saved_model
raise IOError(
OSError: SavedModel file does not exist at: deep_neural_network.keras/{saved_model.pbtxt|saved_model.pb}

The previous error is encountered while using tf.keras.models.load_model

from tensorflow.

sushreebarsa avatar sushreebarsa commented on April 27, 2024

@nilesh-sengupta
Could you try to re-save your Keras model as a SavedModel:

tf.saved_model.save(model, 'path/to/save/model')  # Use a distinct path to avoid overwriting

Since your model is in the .keras format, please use tf.keras.models.load_model to load it:

model = tf.saved_model.load('path/to/save/model')


This function is specifically designed to handle models saved in the Keras format.
Thank you!

from tensorflow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.