Search code examples
python-3.xnlptensorflow2.0

How to load Tensorflow 1.x saved model in TensorFlow 2.x?


I have run code of TensorFlow 1.x.It works fine.Now I have generated checkpoint of that code.They also work fine.Now I want to run these check point in my TensorFlow 2.x file

OSError Traceback (most recent call last) in () 1 ----> 2 loaded = tf.saved_model.load("/content/model/") 3 4 5

1 frames /usr/local/lib/python3.6/dist-packages/tensorflow/python/saved_model/loader_impl.py in parse_saved_model(export_dir) 81 (export_dir, 82 constants.SAVED_MODEL_FILENAME_PBTXT, ---> 83 constants.SAVED_MODEL_FILENAME_PB)) 84 85

OSError: SavedModel file does not exist at: /content/model//{saved_model.pbtxt|saved_model.pb}

This is error Code loaded = tf.saved_model.load("/content/model/")

Share your view how can we solve this error

This is my file hierarchy,how I uploaded files on colab."model" folder is containing ckpt files of machine learning model in tensorflow 1


Solution

  • I don't think this can be done. Tensorflow 2 is largely backwards incompatible with Tensorflow 1.