juliaflux.jl

How to load pre-trained models without having to load Flux.jl?


I have a pre-trained neural network which I want to use it without having to load Flux.jl because it takes some seconds to load flux.jl. Should I write the model again without having to load Flux.jl? Is it faster or not?

I don't have a GPU.

I want to use the model as an application, so I don't want to load whole of Flux.jl.


Solution

  • You have a few options. Recent versions of Julia support precompilation, so loading a package that has been precompiled should take very little time (this answer the question of @Christoph-Rackwitz too).

    If this is still an issue, you can use instead of the simple julia executable a compiled bundle "julia+packages that you need" (or julia executable + a sysimage of the fully compiled packages) that you can make with PackageCompiler.jl

    Finally, if all you want is a predict function and the model is simple enought, you can manually recode the model using standard arrays and use the saved weigths as part of the arrays you multiply your data to.