# How to load with Julia a h5 file created from Keras in Python ? With Flux.jl or with another ML package?

**URL:** <https://discourse.julialang.org/t/how-to-load-with-julia-a-h5-file-created-from-keras-in-python-with-flux-jl-or-with-another-ml-package/41903>\
**Category:** General Usage\
**Tags:** flux\
**Created:** [June 23, 2020, 12:43am UTC](https://discourse.julialang.org/t/how-to-load-with-julia-a-h5-file-created-from-keras-in-python-with-flux-jl-or-with-another-ml-package/41903 "2020-06-23T00:43:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![steph\_de\_paris](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/steph_de_paris/32/7780_2.png) [@steph\_de\_paris](https://discourse.julialang.org/u/steph_de_paris)\
**Post date:** [June 23, 2020, 12:43am UTC](https://discourse.julialang.org/t/how-to-load-with-julia-a-h5-file-created-from-keras-in-python-with-flux-jl-or-with-another-ml-package/41903/1 "2020-06-23T00:43:41Z")

</div>

Hi,

Is there a simple way to load with Julia a h5 file created with Python3-Keras **without rebuilding this h5 model**?

More precisely, what should be the Julia version of this simple Python3 script :

```julia
# Python3 code of the load of a Python3-Keras h5 model :
import numpy as np
from keras.models import load_model
best_model = load_model('model.h5')
dim_1=24
dim_2=46
x=np.zeros((dim_1,dim_2))
simulation = best_model.predict(x)

```

Is there a way by using Flux.jl ? Or with another ML package such as onnx.jl ?

Thanks very much !

---

<div class="post-metadata">

**Author:** ![DrChainsaw](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/drchainsaw/32/8497_2.png) [@DrChainsaw](https://discourse.julialang.org/u/DrChainsaw)\
**Post date:** [June 23, 2020, 11:11am UTC](https://discourse.julialang.org/t/how-to-load-with-julia-a-h5-file-created-from-keras-in-python-with-flux-jl-or-with-another-ml-package/41903/2 "2020-06-23T11:11:39Z")

</div>

I think your best bet right now is to export the model to onnx in python unless you want to use Keras through pycall.

There are a few unmaintained packages for Keras h5 format and I think I have gotten one of them to work by just deving it and fixing all errors which popped up when trying to import.

If your model is simple enough it might be workable to just use hdf5.jl, explore the file and write a one off importer. Last time I checked the format was pretty straightforward.
