Reputation: 75
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
Upvotes: 3
Views: 4589
Reputation: 759
I am late to respond to this question. But I think my answer may help others who are looking for running TensorFlow Version-1 scripts on TensorFlow Version-2. Use the below commands instead of import tensorflow as tf
New Commands:
import tensorflow.compat.v1 as tf
tf.compat.v1.disable_v2_behavior()
Upvotes: 1
Reputation: 15
I am not sure if it would work in this case but sometimes adding tf.compat.v1.[desired command]
can make it work while using tensorflow 2.
E.g. tf.compat.v1.saved_model.load
In your case it may be worth trying:
loaded=tf.compat.v1.saved_model.load("/content/model/")
Upvotes: 1
Reputation: 34
I don't think this can be done. Tensorflow 2 is largely backwards incompatible with Tensorflow 1.
Upvotes: 1