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

Support for loading Keras models #79

Merged
merged 40 commits into from
Jun 9, 2022

Conversation

milancurcic
Copy link
Member

@milancurcic milancurcic commented Jun 6, 2022

This PR introduces support for reading simple Keras models from HDF5:

  • New network constructor that creates a network from an HDF5 file
  • Only input and dense layers are supported for now
  • Only loading for inference is supported from now; i.e. optimizer data is ignored
  • New example (mnist_from_keras) that demonstrates loading a pre-trained model and checking the accuracy of the output
  • Introduces dependency on HDF5, h5fortran, and json-fortran
  • More general download_and_unpack subroutine to download tar-balled data
  • Placed nf_io_* modules under src/nf/io.
  • Modernized CMake rules

TODO:

  • Add dependency rules to CMakeLists.txt (thanks @scivision)
  • Test with Intel Fortran

In support of #43.

@milancurcic
Copy link
Member Author

@scivision, say I have an Intel build of HDF5 in /opt/hdf5-intel, with library and module files in lib/ and include/ relative to that path.

How do I pass this information to CMake so that it finds it?

I tried

FC=ifort cmake .. -DSERIAL=1 -DCMAKE_LIBRARY_PATH=/opt/hdf5-intel

which doesn't seem to do it.

I'd like to add this instruction to the README for people who want to run with Intel.

@milancurcic
Copy link
Member Author

All good, I figured it out--it expects HDF5_ROOT to be set.

@milancurcic milancurcic merged commit 9954ccd into modern-fortran:main Jun 9, 2022
@milancurcic milancurcic deleted the hdf5-reader branch June 9, 2022 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants