Python Tensorflow load_weights()在Google Colab中工作,但在本地失败

Python Tensorflow load_weights()在Google Colab中工作,但在本地失败,python,tensorflow,keras,google-colaboratory,tensorflow2.0,Python,Tensorflow,Keras,Google Colaboratory,Tensorflow2.0,我正在从事Tensorflow 2.0项目,遇到了一个有趣的错误。我的项目在GoogleColab中运行时没有错误。但是,当我在本地运行代码时,会出现以下错误: 错误:tensorflow:无法匹配检查点的文件后跟相应检查点的文件路径 调用model.load\u weights(tf.train.latest\u checkpoint(CKPT\u DIR))时会发生此错误。以下是回溯(在我的Windows计算机上): 另一个不同之处是,GoogleColab笔记本设置为使用GPU,而我的本地

我正在从事Tensorflow 2.0项目,遇到了一个有趣的错误。我的项目在GoogleColab中运行时没有错误。但是,当我在本地运行代码时,会出现以下错误:

错误:tensorflow:无法匹配检查点的文件
后跟相应检查点的文件路径

调用
model.load\u weights(tf.train.latest\u checkpoint(CKPT\u DIR))
时会发生此错误。以下是回溯(在我的Windows计算机上):

另一个不同之处是,GoogleColab笔记本设置为使用GPU,而我的本地机器则不是。该模型在GoogleColab上进行了训练,并下载了检查点文件


有人知道为什么这段代码在Google Colab上运行而不是在本地运行吗?

您确定在这两台机器上使用的是相同版本的Tensorflow吗?我想你的机器可能在运行Tensorflow 1。x@aminrd我刚刚打印了(tf.\uuuuu version\uuuuuuu)以确认它们确实在运行2.0.0。您确定在这两台机器上使用的Tensorflow版本相同吗?我想你的机器可能在运行Tensorflow 1。x@aminrd我刚刚做了
打印(tf.\uuuuu version\uuuuuuu)
来确认,他们确实在运行2.0.0
Traceback (most recent call last):
  File ".\shakespeare_lstm.py", line 159, in <module>
    run_model(SEED)
  File ".\shakespeare_lstm.py", line 147, in run_model
    model.load_weights(tf.train.latest_checkpoint(CKPT_DIR))
  File "E:\Github Repos\ShakespeareLSTM\venv\lib\site-packages\tensorflow_core\python\keras\engine\training.py", line 181, in load_weights
    return super(Model, self).load_weights(filepath, by_name)
  File "E:\Github Repos\ShakespeareLSTM\venv\lib\site-packages\tensorflow_core\python\keras\engine\network.py", line 1139, in load_weights
    if _is_hdf5_filepath(filepath):
  File "E:\Github Repos\ShakespeareLSTM\venv\lib\site-packages\tensorflow_core\python\keras\engine\network.py", line 1449, in _is_hdf5_filepath
    return (filepath.endswith('.h5') or filepath.endswith('.keras') or
AttributeError: 'NoneType' object has no attribute 'endswith'
from google.colab import drive
drive.mount('/content/drive')