keras: File "h5py/h5f.pyx", line 78, in h5py.h5f.open (/tmp/pip-nCYoKW-build/h5py/h5f.c:2117) IOError: Unable to open file (Truncated file: eof = 21463040, sblock->base_addr = 0, stored_eoa = 58889256)
hello, sorry to bother you.
I want to use VGG16, but when I run the command model = VGG16(weights='imagenet', include_top=False)>>> from keras.applications.vgg16 import VGG16
, it shows error:
>>> model = VGG16(weights='imagenet', include_top=False)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/ztgong/local/anaconda2/lib/python2.7/site-packages/keras/applications/vgg16.py", line 169, in VGG16
model.load_weights(weights_path)
File "/home/ztgong/local/anaconda2/lib/python2.7/site-packages/keras/engine/topology.py", line 2494, in load_weights
f = h5py.File(filepath, mode='r')
File "/home/ztgong/local/anaconda2/lib/python2.7/site-packages/h5py/_hl/files.py", line 271, in __init__
fid = make_fid(name, mode, userblock_size, fapl, swmr=swmr)
File "/home/ztgong/local/anaconda2/lib/python2.7/site-packages/h5py/_hl/files.py", line 101, in make_fid
fid = h5f.open(name, flags, fapl=fapl)
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper (/tmp/pip-nCYoKW-build/h5py/_objects.c:2840)
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper (/tmp/pip-nCYoKW-build/h5py/_objects.c:2798)
File "h5py/h5f.pyx", line 78, in h5py.h5f.open (/tmp/pip-nCYoKW-build/h5py/h5f.c:2117)
IOError: Unable to open file (Truncated file: eof = 21463040, sblock->base_addr = 0, stored_eoa = 58889256)
how to solve this problem? thank you in advance!
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 1
- Comments: 25
I ran into this problem because I had accidentally terminated the download of the keras model data file before it was done, making it unreadable by h5py. I went into
.keras/models/
and deleted the data file so that keras would re-download it.in ubuntu 16.04, there is NO
model
folder under.keras
there is only one file inside.keras
which iskeras.json
!!!I just solved my problem on Windows 10: Go to this directory: C:\Users\YOURNAME.keras\models Find the file vgg16_weights_tf_dim_ordering_tf_kernels.h5 file. So just delete it then Rerun the python code again. It just works fine with me đ
Hello, I could not find the /models/ folder under ~/.keras. There is only a /datasets/ folder. I am using keras with Tensorflow backend. Anyone could help?
@kli017 finally I fix this problem .keras/models usually in ~/.keras/models see this code
@toodlesliyy If youâre on a Mac, try using the âGo to folderâ from the âGoâ menu in finder and just copy paste â~/.keras/modelsâ and see if that works. Itâs typically a hidden folder at the root of your computer, where folders like âDocumentsâ or âDownloadsâ live.
This issue seems to still be causing some confusion, so I created this repo to try to help reproduce and debug the error.
Iâm confused by the comments that say there isnât any model folder (at least on Ubuntu 16.04, which is what Iâm currently using), because when I run the code to create a VGG16 model in Keras, it creates
~/.keras/models
. I would suggest trying out the steps in the repository I linked and see how that goes, so we can at least be on the same page for further debugging.@adamheins my god. you are right! thank you very much!