jivankandel / PUResNet

Predicting protein-ligand binding sites using deep convolutional neural network
47 stars 14 forks source link

h5py.h5f.open OSError: Unable to open file (file signature not found) #8

Closed mainguyenanhvu closed 1 year ago

mainguyenanhvu commented 1 year ago

I tried to run PUResNet with my pdb file. Instead of using conda to install package, I used pip:

pip install scikit-image
pip install numpy
pip install scipy
pip install keras=2.1
pip install tensorflow=1.11

I run python predict.py -ftype pdb -m 0 -i ../../pdb_files/test.pdb -mpath whole_trained_model1.hdf -otype mol2 -o output -gpu 0 and faced the error:

WARNING:tensorflow:From /scratch/.conda/envs/puresnet/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py:1242: calling reduce_sum (from tensorflow.python.ops.math_ops) with keep_dims is deprecated and will be removed in a future version.
Instructions for updating:
keep_dims is deprecated, use keepdims instead
Traceback (most recent call last):
  File "predict.py", line 58, in <module>
    main()
  File "predict.py", line 42, in main
    model.load_weights('whole_trained_model1.hdf')
  File "/scratch/.conda/envs/puresnet/lib/python3.6/site-packages/keras/engine/topology.py", line 2616, in load_weights
    f = h5py.File(filepath, mode='r')
  File "/scratch/.conda/envs/puresnet/lib/python3.6/site-packages/h5py/_hl/files.py", line 427, in __init__
    swmr=swmr)
  File "/scratch/.conda/envs/puresnet/lib/python3.6/site-packages/h5py/_hl/files.py", line 190, in make_fid
    fid = h5f.open(name, flags, fapl=fapl)
  File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
  File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
  File "h5py/h5f.pyx", line 96, in h5py.h5f.open
OSError: Unable to open file (file signature not found)

Could you please send me a new model file to run it? I guest the cause is like that link

jivankandel commented 1 year ago

https://github.com/jivankandel/PUResNet/blob/main/whole_trained_model1.hdf, go to this link and click download, and move it into your working directory. Since this was uploaded with git lfs, git clone won't download the full file.

mainguyenanhvu commented 1 year ago

Thank you. Now, it returned a new error:

  File "/home/ubuntu/.conda/envs/puresnet/lib/python3.6/site-packages/keras/engine/topology.py", line 3089, in load_weights_from_hdf5_group
    original_keras_version = f.attrs['keras_version'].decode('utf8')
AttributeError: 'str' object has no attribute 'decode'

Please help me to solve it.

Besides, I think we should use sha to check .h5 file is correct or not.

jivankandel commented 1 year ago

It looks like the hdf5 version conflicts, maybe you have installed the latest version of it. I have uploaded environment.yml, you can use that to create conda environment.

mainguyenanhvu commented 1 year ago

Thank you a lot. It worked.

Please accept my pull request so that other people can use it easily.