Ran the code
export_path= '/content/gdrive/My Drive'+ '\\model\\'+'20191003053122'
with tf.Session(graph=tf.Graph()) as sess:
tf.saved_model.loader.load(sess, ["myTag"], export_path)
graph = tf.get_default_graph()
and incurred error
ValueError: The passed save_path is not a valid checkpoint: /content/gdrive/My Drive\model\20191003053122/variables/variables
What I don't understand is that I have set the same path previously( export_path = '/content/gdrive/My Drive' +'\\model\\'+time.strftime("%Y%m%d%H%M%S",time.localtime())
) but Google Colab still says the checkpoint not valid. What does it mean and went wrong? I also changed both paths multiple times(like replacing '/content/gdrive/My Drive'
with os.getcwd()+
) to make sure they match each other but didn't help.
I am wondering if it's because the code
with tf.Session(graph=tf.Graph()) as sess:
tf.saved_model.loader.load(sess, ["myTag"], export_path)
graph = tf.get_default_graph()
is deprecated- if that's the case, what equivalent should I use instead? Maybe Keras
? Any contribution is appreciated. Thanks
It looks like there is an access issue between Google Colab and Google drive
Can you take a step back and verify whether your Google drive is mounted properly and you are able to write and read files via Goole Colab.?
Here are the steps to be followed:
Import and mount Google Drive
from google.colab import drive drive.mount('/content/gdrive')
Verify you are able to list the files in your drive or the location you want to write into
!ls "/content/gdrive/My Drive"
Write the file in Google Drive,
I have used "w"
so that it creates the file if it doesn't exist
Other file modes in Python open()
function
with open("/content/gdrive/My Drive/myFile.txt", "w") as file: file.write("Your text goes here")
Read the file again to check if the writing file went well!
.cat "/content/gdrive/My Drive/myFile.txt"
Image of my Google colab working code snippet
You can even check the official Goolge Colab notebook with steps here
Hope this helps:)
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.