# \[ANN\] Flux v0.10

**URL:** <https://discourse.julialang.org/t/ann-flux-v0-10/31660>\
**Category:** Machine Learning\
**Created:** [November 29, 2019, 2:31pm UTC](https://discourse.julialang.org/t/ann-flux-v0-10/31660 "2019-11-29T14:31:45Z")\
**Posts on this page:** 17\
**Page:** 2

<div class="post-metadata">

**Author:** ![Gunter\_Faes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunter_faes/32/12580_2.png) [@Gunter\_Faes](https://discourse.julialang.org/u/Gunter_Faes)\
**Post date:** [December 1, 2019, 4:39pm UTC](https://discourse.julialang.org/t/ann-flux-v0-10/31660/22 "2019-12-01T16:39:17Z")

</div>

Flux is already a helpful package, thanks for that!

I am currently playing with a Flux script that uses Flux 0.8.3 and everything is running to my satisfaction. Now the current Flux version is 0.10 and uses Zygote under Julia 1.3. This is a clear concept change, but o.k…

To test the effects, I loaded the above script and tried to execute it. I get the following error message:

```julia
ERROR: LoadError: Can't differentiate = expression
Stacktrace:
 [1] error(::String) at .\error.jl:33
 [2] loss at C:\Users\guent\documents\Julia Projekte\Nano Transfer\Flux_Rotwein.jl:83 [inlined]
 [3] (::typeof(∂(loss)))(::Float32) at C:\Users\guent\.julia\packages\Zygote\8dVxG\src\compiler\interface2.jl:0
 [4] (::Zygote.var"#153#154"{typeof(∂(loss)),Tuple{Tuple{Nothing,Nothing}}})(::Float32) at C:\Users\guent\.julia\packages\Zygote\8dVxG\src\lib\lib.jl:142....

```

The model is called in the script …

```julia
Flux.train!(loss, params(Modell), Epochen_Iterator, Optimierer)

```

… and it’s clear, I have to _adapt_ the script! **Just what?** Is that described somewhere? Because the Flux documentation doesn’t seem to be adapted yet:

 ![Flux_Doc](https://global.discourse-cdn.com/julialang/original/3X/4/6/4646c72f814e115899d1c55c4ba0ea3cbb4df4c9.gif)

If I’m wrong here, has the documentary been adjusted? I think in the documentary I’ll find examples of how models under “Zgote” need to be adapted, right?

I am glad about every hint, thank you!

---

<div class="post-metadata">

**Author:** ![Anton\_Bakuteyev](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/anton_bakuteyev/32/9774_2.png) [@Anton\_Bakuteyev](https://discourse.julialang.org/u/Anton_Bakuteyev)\
**Post date:** [December 5, 2019, 8:50am UTC](https://discourse.julialang.org/t/ann-flux-v0-10/31660/23 "2019-12-05T08:50:43Z")

</div>

Awful update, it just broke my code. It even doesn’t work on it’s own example [https://raw.githubusercontent.com/FluxML/model-zoo/master/vision/mnist/conv.jl](https://raw.githubusercontent.com/FluxML/model-zoo/master/vision/mnist/conv.jl)

It says "Can’t differentiate foreigncall expression in expression starting at … ". How can I rely on Flux now?

---

<div class="post-metadata">

**Author:** ![MikeInnes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mikeinnes/32/3656_2.png) [@MikeInnes](https://discourse.julialang.org/u/MikeInnes)\
**Post date:** [December 5, 2019, 9:51am UTC](https://discourse.julialang.org/t/ann-flux-v0-10/31660/24 "2019-12-05T09:51:25Z")

</div>

Are you setting a global variable within your model? If so, no problem, we can add support for this in Zygote. I’m sure we can fix something so that your model works here.

---

<div class="post-metadata">

**Author:** ![MikeInnes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mikeinnes/32/3656_2.png) [@MikeInnes](https://discourse.julialang.org/u/MikeInnes)\
**Post date:** [December 5, 2019, 9:55am UTC](https://discourse.julialang.org/t/ann-flux-v0-10/31660/25 "2019-12-05T09:55:01Z")

</div>

As mentioned above, this update is meant to be broadly but not 100% compatible, and if it breaks your code you can (a) tell us and (b) roll back temporarily to make sure you don’t lose work.

We’re aware of the model zoo issues and have updates incoming. If something else is breaking we can help you figure out if it’s a Zygote issue or just something that needs tweaking in your code.

---

<div class="post-metadata">

**Author:** ![Gunter\_Faes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunter_faes/32/12580_2.png) [@Gunter\_Faes](https://discourse.julialang.org/u/Gunter_Faes)\
**Post date:** [December 5, 2019, 10:06am UTC](https://discourse.julialang.org/t/ann-flux-v0-10/31660/26 "2019-12-05T10:06:51Z")

</div>

Thank you for your answer! I can’t work on the model at the moment, but I know for sure that I haven’t set a global variable. I use tracked variables as required under 0.8.3. Using Zygote is certainly the right way to avoid duplicate work. It would be ideal, of course, if the Flux user didn’t even notice! 😉

---

<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:** [December 5, 2019, 6:32pm UTC](https://discourse.julialang.org/t/ann-flux-v0-10/31660/27 "2019-12-05T18:32:53Z")

</div>

To be fair pytorch and tensorflow and many other frameworks break things all the time. I would suggest you version control your software and setup properly with fixed version numbers on every piece of software you use. This is the only way you can be sure to experience no breakage. Docker is super useful in this respect. 👍🏻

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [December 5, 2019, 6:38pm UTC](https://discourse.julialang.org/t/ann-flux-v0-10/31660/28 "2019-12-05T18:38:33Z")

</div>

And to be fair, this is a bump of a major version, i.e. it’s a release that says it will break code.

---

<div class="post-metadata">

**Author:** ![ExpandingMan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/expandingman/32/866_2.png) [@ExpandingMan](https://discourse.julialang.org/u/ExpandingMan)\
**Post date:** [December 5, 2019, 6:49pm UTC](https://discourse.julialang.org/t/ann-flux-v0-10/31660/29 "2019-12-05T18:49:38Z")

</div>

Are there any performance benchmarks now that Zygote is the back-end?

I hadn’t been following it all that closely, but I know that performance has been a major concern with Flux in the past. I had assumed there wouldn’t be a serious focus on performance until Zygote was ready.

---

<div class="post-metadata">

**Author:** ![Phil\_Tomson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/phil_tomson/32/3575_2.png) [@Phil\_Tomson](https://discourse.julialang.org/u/Phil_Tomson)\
**Post date:** [December 5, 2019, 8:47pm UTC](https://discourse.julialang.org/t/ann-flux-v0-10/31660/30 "2019-12-05T20:47:14Z")

</div>

Does Metalhead work with Flux v0.10?

I’ve got:

> (v1.3) pkg\> status  
> Status `~/.julia/environments/v1.3/Project.toml`  
> [3a865a2d] CuArrays v1.5.0  
> [7a1cc6ca] FFTW v1.1.0  
> [587475ba] Flux v0.10.0  
> [7869d1d1] IRTools v0.3.0  
> [6a3955dd] ImageFiltering v0.6.6  
> [916415d5] Images v0.19.0  
> [e88e6eb3] Zygote v0.4.1  
> [700de1a5] ZygoteRules v0.2.0

And when I try:

> (v1.3) pkg\> add Metalhead  
> Resolving package versions…  
> ERROR: Unsatisfiable requirements detected for package Flux [587475ba]:  
> Flux [587475ba] log:  
> ├─possible versions are: [0.4.1, 0.5.0-0.5.4, 0.6.0-0.6.10, 0.7.0-0.7.3, 0.8.0-0.8.3, 0.9.0, 0.10.0] or uninstalled  
> ├─restricted to versions 0.10.0 by an explicit requirement, leaving only versions 0.10.0  
> └─restricted by compatibility requirements with Metalhead [dbeba491] to versions: [0.8.0-0.8.3, 0.9.0] — no versions left  
> └─Metalhead [dbeba491] log:  
> ├─possible versions are: [0.3.0, 0.4.0] or uninstalled  
> ├─restricted to versions \* by an explicit requirement, leaving only versions [0.3.0, 0.4.0]  
> └─restricted by compatibility requirements with Images [916415d5] to versions: 0.4.0 or uninstalled, leaving only versions: 0.4.0  
> └─Images [916415d5] log:  
> ├─possible versions are: [0.17.3, 0.18.0, 0.19.0] or uninstalled  
> └─restricted to versions 0.19.0 by an explicit requirement, leaving only versions 0.19.0

---

<div class="post-metadata">

**Author:** ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)\
**Post date:** [December 5, 2019, 9:34pm UTC](https://discourse.julialang.org/t/ann-flux-v0-10/31660/31 "2019-12-05T21:34:32Z")

</div>

I don’t know if Metalhead would work, but it was blocked from installing with this update recently::

[https://github.com/FluxML/Metalhead.jl/commit/4807e346ee7195d3f459c34165efca8416db2278#diff-910a7b3ca0075d545dcec45cb7335ca9](https://github.com/FluxML/Metalhead.jl/commit/4807e346ee7195d3f459c34165efca8416db2278#diff-910a7b3ca0075d545dcec45cb7335ca9)

It’s simple to make a PR in the GitHub interface, but I would want to check first, if it would work locally. Is there a simple way to check out overriding the package manager? I couldn’t find how in the docs, no matter how I tried, including what I thought applies:

pkg\> develop Metalhead

---

<div class="post-metadata">

**Author:** ![Gunter\_Faes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunter_faes/32/12580_2.png) [@Gunter\_Faes](https://discourse.julialang.org/u/Gunter_Faes)\
**Post date:** [December 13, 2019, 3:03pm UTC](https://discourse.julialang.org/t/ann-flux-v0-10/31660/32 "2019-12-13T15:03:48Z")

</div>

> [@MikeInnes](#):
>
> Are you setting a global variable within your model? If so, no problem, we can add support for this in Zygote. I’m sure we can fix something so that your model works here.

Sorry for my late reply! I looked at the Flux Docu 0.10, but couldn’t find a clue about “global variables”! I also can’t see what I have to do differently…!  
Can you give me a hint?

---

<div class="post-metadata">

**Author:** ![dhairyagandhi96](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dhairyagandhi96/32/7589_2.png) [@dhairyagandhi96](https://discourse.julialang.org/u/dhairyagandhi96)\
**Post date:** [December 13, 2019, 3:14pm UTC](https://discourse.julialang.org/t/ann-flux-v0-10/31660/33 "2019-12-13T15:14:43Z")

</div>

It’s a tad obscured but this page [here](https://fluxml.ai/Flux.jl/stable/performance/) links to the Julia performance tips where avoiding global state is described.

---

<div class="post-metadata">

**Author:** ![Gunter\_Faes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunter_faes/32/12580_2.png) [@Gunter\_Faes](https://discourse.julialang.org/u/Gunter_Faes)\
**Post date:** [December 14, 2019, 5:06pm UTC](https://discourse.julialang.org/t/ann-flux-v0-10/31660/34 "2019-12-14T17:06:23Z")

</div>

Thank you for your answer! I have looked at the site intensively, but unfortunately - also no latent - hint found. Maybe I don’t understand the described concept either.

It is not about performance optimization, but about an abort of the function call. Under Flux 0.8.3 everything still runs to my satisfaction and as written, I can’t see what I have to do differently.

In view of the fact that I understand the documentation correctly, I don’t see any changes for my dense model (similar to the Model Zoo’s [iris](https://github.com/FluxML/model-zoo/blob/master/other/iris/iris.jl) example). If a “global” variable is expected, I would expect the same in the docu. Or for example in the iris model.

I _still_ get the error message described at the beginning!

---

<div class="post-metadata">

**Author:** ![Gunter\_Faes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gunter_faes/32/12580_2.png) [@Gunter\_Faes](https://discourse.julialang.org/u/Gunter_Faes)\
**Post date:** [December 22, 2019, 11:57am UTC](https://discourse.julialang.org/t/ann-flux-v0-10/31660/35 "2019-12-22T11:57:07Z")

</div>

@MikeInnes, is there anything new on the subject? As written, I looked at the Iris example of the Model Zoo, but couldn’t find any clue. Am I overseeing anything?

---

<div class="post-metadata">

**Author:** ![bienpierre](https://avatars.discourse-cdn.com/v4/letter/b/8c91f0/32.png) [@bienpierre](https://discourse.julialang.org/u/bienpierre)\
**Post date:** [February 4, 2020, 9:29am UTC](https://discourse.julialang.org/t/ann-flux-v0-10/31660/36 "2020-02-04T09:29:01Z")

</div>

Hello,  
Thanks the Flux community for the great job about v0.10.  
I have a question:  
I programed with Flux.jl v0.9: weight = data.(params(model)) to remove tracking. With the v0.10 it’s still work, however a warning appears with REPL:

```julia
Warning: `data(x)` is deprecated, use `x` instead.

```

What can I do ?

Regards

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [February 4, 2020, 2:43pm UTC](https://discourse.julialang.org/t/ann-flux-v0-10/31660/37 "2020-02-04T14:43:06Z")

</div>

Just delete all `data` function calls. It’s not needed anymore.

---

<div class="post-metadata">

**Author:** ![GdMacmillan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gdmacmillan/32/8839_2.png) [@GdMacmillan](https://discourse.julialang.org/u/GdMacmillan)\
**Post date:** [February 4, 2020, 7:57pm UTC](https://discourse.julialang.org/t/ann-flux-v0-10/31660/38 "2020-02-04T19:57:14Z")

</div>

Just thought I’d post a quick note here. I did some testing on Colab with FluxML and actually got what I think was a reasonably notable workflow going. Not bad for v0.10. I posted it in a tutorial here: [https://github.com/GdMacmillan/ml\_flux\_tutorial/blob/master/ML\_Flux\_Tutorial.ipynb](https://github.com/GdMacmillan/ml_flux_tutorial/blob/master/ML_Flux_Tutorial.ipynb)

[Previous page](https://discourse.julialang.org/t/ann-flux-v0-10/31660.md?page=1)
