错误:Load_Weights从HDF5加载权重时需要H5PY
我在下面使用了两个命令,并收到了一条有关成功安装和重新启动内核
- Conda卸载H5PY
- PIP安装H5PY的
消息,但仍然在下面获取此错误:
Importerror Trackback(最近的最新电话) 〜\ appdata \ local \ temp/ipykernel_14156/3723649668.py in 1导入 TensorFlow作为TF 2模型= TF.Keras.Sequeential([[[ tf.keras.layers.dense(5,input_shape =(3,)), tf.keras.layers.softmax()])---> 3 model.load_weights('my_weights.h5')
〜\ anaconda3 \ lib \ site-packages \ keras \ Engine \ Engine \ triagn.py in load_weights(self,filepath,by_name,skip_mismatch,选项)2344 状态=无2345如果H5Py无: - > 2346提升Importerror(2347 “ load_weights从HDF5加载权重时需要H5PY。”)2348如果 不是self._is_graph_network而不是self.built:
Importerror:Load_Weights从加载权重时需要H5PY HDF5。
I used both commands below and received a message about being successful install and restarting the kernel
- conda uninstall h5py
- pip install h5py
But still, get this error below:
ImportError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_14156/3723649668.py in 1 import
tensorflow as tf 2 model = tf.keras.Sequential([
tf.keras.layers.Dense(5, input_shape=(3,)),
tf.keras.layers.Softmax()]) ----> 3
model.load_weights('my_weights.h5')~\Anaconda3\lib\site-packages\keras\engine\training.py in
load_weights(self, filepath, by_name, skip_mismatch, options) 2344
status = None 2345 if h5py is None: -> 2346 raise ImportError( 2347
'load_weights requires h5py when loading weights from HDF5.') 2348 if
not self._is_graph_network and not self.built:ImportError: load_weights requires h5py when loading weights from
HDF5.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论