OSError while loading sample weights
See original GitHub issueWhile I was loading model with sample weights in Google Colab this exception occurred:
Using TensorFlow backend.
WARNING:tensorflow:From /usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Colocations handled automatically by placer.
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
<ipython-input-5-913aee289ebe> in <module>()
2
3 rdn = RDN(arch_params={'C':6, 'D':20, 'G':64, 'G0':64, 'x':2})
----> 4 rdn.model.load_weights('/content/image-super-resolution/weights/sample_weights/rdn-C6-D20-G64-G064-x2_div2k-e086.hdf5')
5
6 sr_img = rdn.model.predict(lr_img)[0]
/usr/local/lib/python3.6/dist-packages/keras/engine/network.py in load_weights(self, filepath, by_name, skip_mismatch, reshape)
1155 if h5py is None:
1156 raise ImportError('`load_weights` requires h5py.')
-> 1157 with h5py.File(filepath, mode='r') as f:
1158 if 'layer_names' not in f.attrs and 'model_weights' in f:
1159 f = f['model_weights']
/usr/local/lib/python3.6/dist-packages/h5py/_hl/files.py in __init__(self, name, mode, driver, libver, userblock_size, swmr, **kwds)
310 with phil:
311 fapl = make_fapl(driver, libver, **kwds)
--> 312 fid = make_fid(name, mode, userblock_size, fapl, swmr=swmr)
313
314 if swmr_support:
/usr/local/lib/python3.6/dist-packages/h5py/_hl/files.py in make_fid(name, mode, userblock_size, fapl, fcpl, swmr)
140 if swmr and swmr_support:
141 flags |= h5f.ACC_SWMR_READ
--> 142 fid = h5f.open(name, flags, fapl=fapl)
143 elif mode == 'r+':
144 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)
I found that this error might mean that the file is corrupted. Or maybe it's the fault of Google Colab 🤔
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Keras load weights: OSError: Unable to open file (Truncated file
When I try to load weights using keras ' model.load_weights I get OSError: Unable to open file (Truncated file: eof = 41091072) Here...
Read more >Error creating sample weights because dataset is too large
I've been creating weighted sampling for a CNN by loading in the data and iterating through each item's labels as follows:
Read more >OSError: Unable to load weights from pytorch checkpoint file
I fine-tuned the model with PyTorch. ... OSError: Unable to load weights from PyTorch checkpoint file at <my model path/pytorch_model.bin>.
Read more >Model saving & serialization APIs - Keras
Loads all layer weights, either from a TensorFlow or an HDF5 weight file. If by_name is False weights are loaded based on the...
Read more >huggingface load checkpoint - You.com | The search engine you ...
Everything worked well until the model loading step and it said: OSError: Unable to load weights from PyTorch checkpoint file at <my model ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@pniedzwiedzinski furthermore, from the documentation
“The samples use an upscaling factor of two. The weights used to produced these images are available under sample_weights (see Additional Information). They are stored on git lfs. If you want to download the weights you need to run git lfs pull after cloning the repository.”
Maybe this should be also mentioned in the installation section 🤔