Loading tensorflow models hdf5 in R

It looks like than loading pre-trained models in hdf5 format under R fails with the message:
The h5py Python package is required to save and load models

It seems that this depends on the underlying Python environment (usually r-reticulate). Is there anything we can do?

Thank you

Hi @marco_de_virgilis

We’re looking into this one for you to figure it out. You can do it properly by installing reticulate as well but there is another issue that has to be fixed from our end with the notebooks to submit something other than .RData files. :wrench:

Can you try submitting via the zip submission for now? The code would be identical and everything should work perfectly with it as long as you include reticulate inside your install.R file. You can then run reticulate::install_miniconda() and the package should do everything for you at the top of your model.R script.

Please let me know if you run into further issues.

Hi @alfarzan,

Thank you for your reply. I tried your approach and it still fails. This is the submission ID #115217.
Could you please look into it, please?

Thank you,
Marco

Hi Marco (@marco_de_virgilis)

Sorry I seem to have given you incorrect advice!

The issue :jigsaw:
The reason you are getting this error is because we only allow internet access (to a small set of websites) when we run your install.R script. Outside of that network access is disallowed for security reasons. Since to install keras and miniconda you need internet access, these actions need to happen inside of install.R.

The solution :ballot_box_with_check:

  1. In your install.R script at the very end can you add the following lines:
library("keras")
reticulate::install_miniconda()
install_keras()
  1. Can you remove the following lines from the model.R code:
reticulate::install_miniconda()
install_keras()

That should fix it. I’ve just made a submission with these changes using your code (with prices set to zero!) and it was successful :muscle: