broadinstitute / ml4h

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PCLR SavedModel different to PCLR.h5, unable to load PCLR.h5

raymond53892 opened this issue · comments

What
PCLR SavedModel different to PCLR.h5 and model as described in the pre-print Appendix A
Unable to load PCLR.h5 - SavedModel file does not exist at: ./PCLR.h5/{saved_model.pbtxt|saved_model.pb}

Why
The PCLR models are different between the newer Keras saved model format and the older H5 format (older format has 2 additional Dense layers)

How
Please provide the older H5 model in the newer saved model format so it can be loaded
Alternatively, specify the versions of tensorflow, Keras and python used to save the .h5 model, so the same environment can be used to load the model

Hello - chiming in to say that I'm interested code to load the saved models, too. From what I can tell, the syntax to load "saved_model.pb" files accepts a directory, while loading the h5 file requires the file name.

Along those lines, I've tried both load_model('./PCLR.h5') and load_model('./PCLR_lead_I').

for both, I receive the error: "Read less bytes than requested". I think this might have to do with git LFS and the fact that I git cloned the repo, but I'm not sure.

Any tips would be much appreciated!

This sequence helped me load the model:

brew install git-lfs 
git lfs install
git lfs migrate import --everything

and after this, I was able to load the model with

from tensorflow.keras.models import load_model
model = load_model('PCLR.h5', compile=False)