Using h5py.File(path,'r')
或(喀拉斯)model.load_weights(path)
on .h5
文件产生以下错误。我已经在 Colab 上训练模型几个月了,从来没有遇到过这个问题。从云端硬盘下载后,相同的文件在我的计算机上可以正常打开。一开始有一个笔记本打不开.h5
文件 - 所有其他文件都紧随其后。
什么错误以及如何排除故障?无法保存和加载模型导致 Colab 无法使用 - 感谢帮助。
UPDATE:
What started as inability to open
h5
files morphed into inability to import simple modules - which somehow restored ability to load
some of the
h5
files. I changed nothing in code. No clue where it's headed, but all errors display
Input/output error
NOTE: bytes_actually_read
= 18.4 艾字节, O(10^19)
UPDATE2:
It works again now, but due to no effort of my own - I still don't know what the problem was, or how to address it if it recurs.
UPDATE3:
Same error recurred - now affecting files sporadically; some are permitted to load half-way, some not at all, then those that loaded halfway don't load at all.
UPDATE4:4个月过去了,问题依然存在;这次我确保文件已关闭每一次开业以来,自创建以来
OSError: Unable to open file (file read failed: time = Fri Sep 6 04:24:56 2019,
filename = '../models/model_to_cont.h5', file descriptor = 76, errno = 5,
error message = 'Input/output error', buf = 0x7ffc08af5430, total read size = 8,
bytes this sub-read = 8, bytes actually read = 18446744073709551615, offset = 0)
----> 1 from utils_data_methods import print_key_configs
/usr/lib/python3.6/importlib/_bootstrap.py in _find_and_load(name, import_)
/usr/lib/python3.6/importlib/_bootstrap.py in _find_and_load_unlocked(name, import_)
/usr/lib/python3.6/importlib/_bootstrap.py in _load_unlocked(spec)
/usr/lib/python3.6/importlib/_bootstrap_external.py in exec_module(self, module)
/usr/lib/python3.6/importlib/_bootstrap_external.py in get_code(self, fullname)
/usr/lib/python3.6/importlib/_bootstrap_external.py in get_data(self, path)
OSError: [Errno 5] Input/output error
访问 hdf5 时key:
RuntimeError: Link iteration failed (file read failed: time = Fri Sep 6 14:10:45 2019,
filename = '../data/4256superbatch.h5', file descriptor = 76, errno = 5,
error message = 'Input/output error', buf = 0x5fad400, total read size = 512,
bytes this sub-read = 512, bytes actually read = 18446744073709551615, offset = 6692938977)