Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/file/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Machine learning 在Tensorflow 2.x中加载Tensorflow 1.x模型时出错_Machine Learning_Nlp_Data Science_Tensorflow2.0 - Fatal编程技术网

Machine learning 在Tensorflow 2.x中加载Tensorflow 1.x模型时出错

Machine learning 在Tensorflow 2.x中加载Tensorflow 1.x模型时出错,machine-learning,nlp,data-science,tensorflow2.0,Machine Learning,Nlp,Data Science,Tensorflow2.0,我正在将Tensorflow 1.x的保存模型加载到Tensorflow 2.x中,我遇到了问题 我正在使用这个代码 import os import tensorflow as tf from tensorflow import keras from tensorflow.python.keras.layers import Dense,Flatten from tensorflow.python.keras import Sequential from google.colab import

我正在将Tensorflow 1.x的保存模型加载到Tensorflow 2.x中,我遇到了问题

我正在使用这个代码

import os
import tensorflow as tf
from tensorflow import keras
from tensorflow.python.keras.layers import Dense,Flatten
from tensorflow.python.keras import Sequential
from google.colab import drive
drive.mount('/content/gdrive')
model_file_name = os.path.join("my_drive/AI_values/model", 'model.ckpt')# CHANGE MODEL NAME
model = tf.keras.models.load_model(model_file_name)
我犯了错误

OSError: Unable to open file (unable to open file: name = 'my_drive/AI_values/model/model.ckpt', 
errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)
它显示操作系统错误,这是权限,也显示无法打开文件,但我尝试了.ckpt和.h5格式,但不起作用

请帮助我,我正在分享我的模型谷歌驱动器链接

还有谷歌colab链接


您能否将
我的U盘
更换为
我的盘
(包括空格)

model\u file\u name=os.path.join(“我的驱动器/AI\u值/model”,“model.ckpt”)


然后重试?

我也无法加载您保存的模型文件,但我可以轻松加载自己的文件。我认为问题在于你拯救他们的方式。您是如何保存h5模型文件/检查点的?这是Tensorflow v1文件,在该文件中,模型已成功实现,但问题未加载到版本2Dataset链接中