# Slow Deployment of Flux Mode

**URL:** <https://discourse.julialang.org/t/slow-deployment-of-flux-mode/48945>\
**Category:** Performance\
**Tags:** question\
**Created:** [October 24, 2020, 4:21pm UTC](https://discourse.julialang.org/t/slow-deployment-of-flux-mode/48945 "2020-10-24T16:21:30Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![compleat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/compleat/32/8958_2.png) [@compleat](https://discourse.julialang.org/u/compleat)\
**Post date:** [October 24, 2020, 4:21pm UTC](https://discourse.julialang.org/t/slow-deployment-of-flux-mode/48945/1 "2020-10-24T16:21:30Z")

</div>

Hi. I have a trained Flux model which I wish to apply repeatedly using separate calls from an external program.

Since Julia1.5 (and corresponding Flux version) every time the function  
is called, the line

```julia
using Flux

```

requires about 15 seconds to ‘initialize the CUDA driver’.

I do not even wish to use CUDA, and anyway, this deployment would only require milliseconds to compute with CPU.

Is there a way to import Flux without this (painfully slow) overhead each time I want to deploy the model?

Thanks,

DavidE  
PS The time taken for this is variable… sometimes it take up to a minute to just get past ‘using Flux’.

---

<div class="post-metadata">

**Author:** ![DoktorMike](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/doktormike/32/2736_2.png) [@DoktorMike](https://discourse.julialang.org/u/DoktorMike)\
**Post date:** [October 24, 2020, 5:04pm UTC](https://discourse.julialang.org/t/slow-deployment-of-flux-mode/48945/2 "2020-10-24T17:04:13Z")

</div>

If you want to deploy your model I would start julia once and load your model and packages once and then call a process externally in an already running julia session. The easiest way to achieve this is to wrap your model in a rest API. Not sure that’s what you wanted but anyway that’s my two cents.

---

<div class="post-metadata">

**Author:** ![compleat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/compleat/32/8958_2.png) [@compleat](https://discourse.julialang.org/u/compleat)\
**Post date:** [October 24, 2020, 5:07pm UTC](https://discourse.julialang.org/t/slow-deployment-of-flux-mode/48945/3 "2020-10-24T17:07:42Z")

</div>

Thanks. That sounds helpful. How does a rest API work?  
Does that mean pushing to an idle Julia session somehow?  
[I see something about Web API’s, but I am not talking about that, but rather just executing from a unix shell]

---

<div class="post-metadata">

**Author:** ![Elrod](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/elrod/32/22461_2.png) [@Elrod](https://discourse.julialang.org/u/Elrod)\
**Post date:** [October 24, 2020, 5:18pm UTC](https://discourse.julialang.org/t/slow-deployment-of-flux-mode/48945/4 "2020-10-24T17:18:54Z")

</div>

What about [DaemonMode.jl](https://github.com/dmolina/DaemonMode.jl)?

---

<div class="post-metadata">

**Author:** ![compleat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/compleat/32/8958_2.png) [@compleat](https://discourse.julialang.org/u/compleat)\
**Post date:** [October 24, 2020, 5:22pm UTC](https://discourse.julialang.org/t/slow-deployment-of-flux-mode/48945/5 "2020-10-24T17:22:34Z")

</div>

Just what I wanted!

Thanks!

---

<div class="post-metadata">

**Author:** ![DoktorMike](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/doktormike/32/2736_2.png) [@DoktorMike](https://discourse.julialang.org/u/DoktorMike)\
**Post date:** [October 24, 2020, 5:29pm UTC](https://discourse.julialang.org/t/slow-deployment-of-flux-mode/48945/6 "2020-10-24T17:29:10Z")

</div>

Then you’re definitely better off with @Elrod suggestion. 👍🏻
