繁体   English   中英

ValueError:传递的保存路径不是有效的检查点:/content/gdrive/My Drive\model\20191003053122/variables/variables

[英]ValueError: The passed save_path is not a valid checkpoint: /content/gdrive/My Drive\model\20191003053122/variables/variables

跑代码

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()

并发生错误

ValueError: The passed save_path is not a valid checkpoint: /content/gdrive/My Drive\model\20191003053122/variables/variables

我不明白的是我之前设置了相同的路径( export_path = '/content/gdrive/My Drive' +'\\model\\'+time.strftime("%Y%m%d%H%M%S",time.localtime()) )但 Google Colab 仍然说检查点无效。 这是什么意思,出了什么问题? 我还多次更改了两条路径(例如用os.getcwd()+替换'/content/gdrive/My Drive' )以确保它们相互匹配但没有帮助。

我想知道是不是因为代码

with tf.Session(graph=tf.Graph()) as sess:
    tf.saved_model.loader.load(sess, ["myTag"], export_path)         
    graph = tf.get_default_graph()

已弃用-如果是这种情况,我应该改用什么等价物? 也许Keras 任何贡献表示赞赏。 谢谢

Google Colab 和 Google Drive 之间似乎存在访问问题

您能否退一步验证您的 Google 驱动器是否已正确安装以及您是否能够通过 Goole Colab 写入和读取文件。?

以下是要遵循的步骤:

  1. 导入和挂载 Google Drive

     from google.colab import drive drive.mount('/content/gdrive')
  2. 验证您是否能够列出驱动器中的文件或要写入的位置

    !ls "/content/gdrive/My Drive"
  3. 将文件写入 Google Drive,

    我使用了"w" ,以便在文件不存在时创建文件

    Python open() function 中的其他文件模式

    with open("/content/gdrive/My Drive/myFile.txt", "w") as file: file.write("Your text goes here")
  4. 再次读取文件以检查写入文件是否顺利!

     .cat "/content/gdrive/My Drive/myFile.txt"

我的 Google colab 工作代码片段的图像

您甚至可以在此处查看官方 Goolge Colab 笔记本的步骤

希望这可以帮助:)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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