Keras.jl
Keras.jl copied to clipboard
Errors recompiling Keras on Julia 1.3.1
I see that the package is a bit stale and has not been upgraded to work on Julia 1, however I was able to install it seamlessly in Julia 1.3.1 by executing Pkg.add(Pkg.PackageSpec(url="https://github.com/ayush1999/Keras.jl", rev="master"))
. Executing using Keras
returned errors I wasn't able to fix. The full output is below. Any suggestion is greatly appreciated.
[ Info: Precompiling Keras [031d7243-eb6a-5793-a290-e3c72503329c]
WARNING: importing deprecated binding Compat.Libdl into Blosc.
WARNING: importing deprecated binding Compat.Libdl into Blosc.
WARNING: Method definition iterate(DataFlow.ObjectArraySet{T} where T, Any...) in module DataFlow at /home/adude/.julia/packages/Lazy/mAoZN/src/macros.jl:285 overwritten at /home/adude/.julia/packages/Lazy/mAoZN/src/macros.jl:285.
** incremental compilation may be fatally broken for this module **
ERROR: LoadError: LoadError: LoadError: syntax: "..." expression outside call
Stacktrace:
[1] top-level scope at /home/adude/.julia/packages/Keras/IoYuA/src/ops.jl:13
[2] include at ./boot.jl:328 [inlined]
[3] include_relative(::Module, ::String) at ./loading.jl:1105
[4] include at ./Base.jl:31 [inlined]
[5] include(::String) at /home/adude/.julia/packages/Keras/IoYuA/src/Keras.jl:1
[6] top-level scope at /home/adude/.julia/packages/Keras/IoYuA/src/graph.jl:2
[7] include at ./boot.jl:328 [inlined]
[8] include_relative(::Module, ::String) at ./loading.jl:1105
[9] include at ./Base.jl:31 [inlined]
[10] include(::String) at /home/adude/.julia/packages/Keras/IoYuA/src/Keras.jl:1
[11] top-level scope at /home/adude/.julia/packages/Keras/IoYuA/src/Keras.jl:4
[12] include at ./boot.jl:328 [inlined]
[13] include_relative(::Module, ::String) at ./loading.jl:1105
[14] include(::Module, ::String) at ./Base.jl:31
[15] top-level scope at none:2
[16] eval at ./boot.jl:330 [inlined]
[17] eval(::Expr) at ./client.jl:425
[18] top-level scope at ./none:3
in expression starting at /home/adude/.julia/packages/Keras/IoYuA/src/ops.jl:13
in expression starting at /home/adude/.julia/packages/Keras/IoYuA/src/graph.jl:2
in expression starting at /home/adude/.julia/packages/Keras/IoYuA/src/Keras.jl:4
ERROR: Failed to precompile Keras [031d7243-eb6a-5793-a290-e3c72503329c] to /home/adude/.julia/compiled/v1.3/Keras/RBgJ9_OVTEM.ji.
Stacktrace:
[1] error(::String) at ./error.jl:33
[2] compilecache(::Base.PkgId, ::String) at ./loading.jl:1283
[3] _require(::Base.PkgId) at ./loading.jl:1024
[4] require(::Base.PkgId) at ./loading.jl:922
[5] require(::Module, ::Symbol) at ./loading.jl:917
can confirm with julia 1.5.3.
I tried:
Pkg.add(url="https://github.com/ayush1999/Keras.jl")
resulting in:
ERROR: could not find project file in package at
https://github.com/ayush1999/Keras.jl
maybesubdir
needs to be specified
or with:
Pkg.add("Keras")
it was not found:
ERROR: The following package names could not be resolved:
- Keras (not found in project, manifest or registry)
The workaround is to clone the github normally (git clone https://github.com/ayush1999/Keras.jl
) and then starting a new Project.toml (this was only introduced after Julia 0.6, I think). Then you need to manually add all dependencies (] dev .
and ] add X
), just keep adding all the dependencies.
There are other issues: the Julia itself has changed significantly from 0.6, things like the ...
operator have changed. So I think that for any Julia > 0.6, this package is currently broken. I tried to fix some of the issues but it's quickly becoming too cumbersome.
Unfortunetly, because this package would really be useful. If I find anything, I'll comunicate.
Hey folks! I wrote this package three years ago and then I lost access to that github account (@ayush1999). If you think this package is useful, please let me know and I'll try to migrate it to my current account (@ayush-1506) and bump it to support new julia versions. Thanks!
I think it is definetly useful, I'd used it on ProtoSyn.jl if it worked on Julia 1.7. How hard do you think it would be?
I think apart from adding the usual manifest files (which should be the simpler bit), we'd also need to check if the Flux & Keras APIs have changed. This might be the more involved part.
Agreed. Some julia changes might also have broken this code.
FYI if code changes here are significant and you want something to work as soon as possible, there are other things you can try:
- ONNX.jl (currently under development and you might have to add a few new ops)
- https://github.com/invenia/Keras.jl : This is a Julia wrapper around Keras python API. Not sure if it is relevant for your work.
I was exploring the ONNX.jl, actually adding ops as you said (ahah). Run into some problems: https://github.com/FluxML/ONNX.jl/issues/61#issuecomment-1040501987
Perhaps you may help as well. I'm kind of a noob when it comes to these things. I also took a look at Keras.jl, but I may just end up going with the default way of using PyCall to run TensorFlow.