我使用keras在TF 1.12的Google TPU上训练了CNN模型。尽管我无法通过保存整个模型来使用ModelCheckpoint,但我仅保存了权重。训练结束后,我尝试使用该模型。当我首先编译模型,然后尝试加载权重
model=create_model()
model.load_weights('/home/frank/Downloads/models_model.01-6.30.data-00000-of-00001')
我遇到以下错误。
~/.local/lib/python3.5/site-packages/h5py/_hl/files.py in make_fid(name, mode, userblock_size, fapl, fcpl, swmr)
168 if swmr and swmr_support:
169 flags |= h5f.ACC_SWMR_READ
--> 170 fid = h5f.open(name, flags, fapl=fapl)
171 elif mode == 'r+':
172 fid = h5f.open(name, h5f.ACC_RDWR, fapl=fapl)
h5py/_objects.pyx in h5py._objects.with_phil.wrapper()
h5py/_objects.pyx in h5py._objects.with_phil.wrapper()
h5py/h5f.pyx in h5py.h5f.open()
OSError: Unable to open file (file signature not found)
正如我之前提到的,我也无法保存整个模型。