When I try to load weights using keras
' model.load_weights
I get OSError: Unable to open file (Truncated file: eof = 41091072)
Here is the full error trace:
model.load_weights(get_file(fname, "E:/Work/Practical\ Deep\ Learning\ Course/my\ notebooks/lesson1/vgg16.h5", cache_subdir='models'))
141
142
C:\....\Anaconda3\envs\tensorflow\lib\site-packages\keras\engine\topology.py in load_weights(self, filepath, by_name)
2700 """
2701 import h5py
-> 2702 f = h5py.File(filepath, mode='r')
2703 if 'layer_names' not in f.attrs and 'model_weights' in f:
2704 f = f['model_weights']
C:\....\Anaconda3\envs\tensorflow\lib\site-packages\h5py\_hl\files.py in __init__(self, name, mode, driver, libver, userblock_size, swmr, **kwds)
269
270 fapl = make_fapl(driver, libver, **kwds)
--> 271 fid = make_fid(name, mode, userblock_size, fapl, swmr=swmr)
272
273 if swmr_support:
C:\....\Anaconda3\envs\tensorflow\lib\site-packages\h5py\_hl\files.py in make_fid(name, mode, userblock_size, fapl, fcpl, swmr)
99 if swmr and swmr_support:
100 flags |= h5f.ACC_SWMR_READ
--> 101 fid = h5f.open(name, flags, fapl=fapl)
102 elif mode == 'r+':
103 fid = h5f.open(name, h5f.ACC_RDWR, fapl=fapl)
h5py\_objects.pyx in h5py._objects.with_phil.wrapper (D:\Build\h5py\h5py-2.7.0\h5py\_objects.c:2853)()
h5py\_objects.pyx in h5py._objects.with_phil.wrapper (D:\Build\h5py\h5py-2.7.0\h5py\_objects.c:2811)()
h5py\h5f.pyx in h5py.h5f.open (D:\Build\h5py\h5py-2.7.0\h5py\h5f.c:2130)()
OSError: Unable to open file (Truncated file: eof = 41091072, sblock->base_addr = 0, stored_eoa = 553482496)
How can I handle this?
mine is windows 10. This solved my error- go to this path C:\Users\you_name\ .keras\models\vggface and delete the h5 file and rerun the code.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With