Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSError while loading sample weights #8

Closed
pniedzwiedzinski opened this issue Mar 29, 2019 · 6 comments
Closed

OSError while loading sample weights #8

pniedzwiedzinski opened this issue Mar 29, 2019 · 6 comments
Projects

Comments

@pniedzwiedzinski
Copy link
Contributor

While 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 🤔
@cesarandreslopez
Copy link

cesarandreslopez commented Mar 30, 2019

Same Error here. Checking on the filesizes after having done git clone, I realize that their size is only 133 bytes. I proceeded to download from the website and works fine. Odd corruption when doing git clone.

@cesarandreslopez
Copy link

@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."

@pniedzwiedzinski
Copy link
Contributor Author

@cesarandreslopez thanks, didn't notice that

@pniedzwiedzinski
Copy link
Contributor Author

Maybe this should be also mentioned in the installation section 🤔

@cfrancesco
Copy link
Collaborator

Thank you for the feedback. We will make the note more explicit.

@cfrancesco cfrancesco reopened this Mar 31, 2019
@cfrancesco cfrancesco added this to In progress in ISR Apr 1, 2019
cfrancesco added a commit that referenced this issue Apr 1, 2019
@cfrancesco cfrancesco moved this from In progress to Done in ISR Apr 1, 2019
@cfrancesco
Copy link
Collaborator

Now git lfs pull is mentioned in the installation section. Thanks to @pniedzwiedzinski

datitran pushed a commit that referenced this issue Sep 3, 2019
thekevinscott pushed a commit to thekevinscott/image-super-resolution that referenced this issue Oct 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
ISR
  
Done
Development

No branches or pull requests

3 participants