-
Notifications
You must be signed in to change notification settings - Fork 5
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
Loading saved model fails due to missing 'slice' function #2
Comments
Hm, I've seen this before, it's some kind of pickle issue in Keras, it has also been reported (keras-team/keras-contrib#488) and you could try the fix described there (keras-team/keras-contrib#488 (comment)), however I'm not sure if this is the only issue. Have you tried enabling the alternative loading code at https://github.com/IanSaucy/bbz-segment/blob/39be9165e5bb3866655a354cd1620c6b564c2469/05_prediction/src/predict.py#L143 ? For my production setting for running inference, I use TensorFlow 2.1.2 with Keras 2.3.1 and haven't seen any problems, but I understand that you want to train and that needs TensorFlow 1 indeed. DL libraries are quite a mess right now. EDIT Just rechecked that these models were trained on TensorFlow 1.15.2 with Keras 2.3.1 so we should get this to work. My best guess right now is the alternative loading code linked above. |
Thanks for getting back to me! I had seen those two issues but the libraries on both of the systems I tested didn't seem to reflect the code talked about in those two issues. I did try enabling the alternative loader which solved the
Most of the solutions online don't really apply to this use case either. So I'm a bit stumped again. I did double check that I'm using those specific versions of Keras and TensorFlow. The only other thing I'm going to try is re-downloading the model just in case something got corrupted. On the point of using the alternate loader, wouldn't changing the activation function from Thanks so much for taking the time to help troubleshoot this with me. It's a breath of fresh air to have such high quality code from a scientific paper.
|
I think I figured it out! I was playing around with Origami and noticed that model loading worked fine there so I did some cross comparison. Basically it came down to using keras directly here is how it looks now. I'm currently running some test images through the model right now(which take a bit since I don't have access to a GPU locally). Thanks so much for your help, if you want me to open a PR to fix this issue let me know. I'd also be happy to throw in an updated |
This is great! Having an PR for this would be really nice. |
Sorry for the bit of a delay but I've gone ahead and created PR that should resolve this issue. With a few fresh cups of coffee I noticed that issues I had where only due to conflict of package versions. Pinning packages as is done in #4 seems to resolve the issue. Also, a new bug in tensorflows dependencies caused an issue and thus was pinned as well in the PR. Here is an overview of that issue. Thanks for all you help, I'll leave future discussions to the PR! |
Hey!
I am trying to load the pre-trained model provided via DropBox to adapt it a bit but it fails to load. Initially it was an issue with the custom activation function but I fixed that by passing it as a
custom_object
toload_model
inpredit.py
, see here for how I went about it.But now I am running into a new problem, I get the following error(emphasis on the last line):
Which I can't seem to track down why it is happening. I presume it's stemming from something it is attempting to load for the pre-trained model in the HDF5 files. It seems that it's trying to find the
slice
function but is unable to find that function, but I'm not even able to track down where the function call is originating from! I tried updating thebase_dir
in therun.json
file in the model directorymodels\v3\sep\1\run.json
but this still does not fix the issue.I am using the following:
Any help would be super appreciated!
The text was updated successfully, but these errors were encountered: