【发布时间】:2019-01-06 16:16:36
【问题描述】:
我正在尝试为我的作业加载一个名为“tr_model.h5”的预训练模型,但出现以下错误:
Traceback (most recent call last):
File "Trigger_Project.py", line 84, in <module>
model = load_model(filename)
File "Trigger_Project.py", line 84, in <module>
model = load_model(filename)
File "/home/neeraj/anaconda3/lib/python3.6/site-packages/h5py/_hl/files.py", line 99, in make_fid
fid = h5f.open(name, flags, fapl=fapl)
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
文件“h5py/_objects.pyx”,第 55 行,在 h5py._objects.with_phil.wrapper 中
File "h5py/h5f.pyx", line 78, in h5py.h5f.open
OSError: Unable to open file (unable to open file: name = 'tr_model.h5', errno = 2, error message = 'No such file or directory', flags = 0, o_flags = 0)
我已确定该文件存在。我不知道为什么它显示操作系统错误。我正在使用 linux 18.04,并且所有必需的库都已升级。任何帮助深表感谢。
【问题讨论】:
-
会不会是相对路径的问题?
-
不,在同一目录下
-
是否有无法通过终端打开的问题?
-
你能添加一个
print(os.getcwd())并检查它是否是你假设的正确目录吗? -
是的,我确实检查过了,它报告的目录与我假设的目录相同。
标签: python-3.x hdf5