无法创建组(文件上没有写意图)

2024-09-19 23:36:13 发布

您现在位置:Python中文网/ 问答频道 /正文

每次我从HDF5文件加载回模型时都会遇到这个错误。下面是我的错误跟踪。在

Traceback (most recent call last):
  File "D:\Anaconda3New\datasets\train.py", line 63, in <module>
    model = load_model(args["model"])
  File "D:\Anaconda3New\lib\site-packages\keras\engine\saving.py", line 419, in
load_model
    model = _deserialize_model(f, custom_objects, compile)
  File "D:\Anaconda3New\lib\site-packages\keras\engine\saving.py", line 249, in
_deserialize_model
    layer_weights = model_weights_group[name]
  File "D:\Anaconda3New\lib\site-packages\keras\utils\io_utils.py", line 303, in
 __getitem__
    val = H5Dict(self.data.create_group(attr))
  File "C:\Users\dell\AppData\Roaming\Python\Python37\site-packages\h5py\_hl\gro
up.py", line 68, in create_group
    gid = h5g.create(self.id, name, lcpl=lcpl, gcpl=gcpl)
  File "h5py\_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
  File "h5py\_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
  File "h5py\h5g.pyx", line 161, in h5py.h5g.create
ValueError: Unable to create group (no write intent on file)

我已经读了下面的问题,但似乎这是一个不同的问题,我已经经历了现在。在

I can't read data back in using h5py. "unable to create group"

因为我只是从保存的HDF5文件(在cmd中按ctrl+c创建的)中加载我的体系结构和权重,如何为这个HDF5文件分配模式?在

有谁能帮我解决这个问题吗?在


Tags: 文件inpymodelobjectslibpackagescreate