# Flux cannot save a parameters

**URL:** https://discourse.julialang.org/t/flux-cannot-save-a-parameters/35642
**Category:** Machine Learning
**Tags:** flux, bson
**Created:** [March 6, 2020, 2:57pm UTC](https://discourse.julialang.org/t/flux-cannot-save-a-parameters/35642 "2020-03-06T14:57:27Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Owolf](https://avatars.discourse-cdn.com/v4/letter/o/bbce88/32.png) [@Owolf](https://discourse.julialang.org/u/Owolf)
#### Post date: [March 6, 2020, 2:57pm UTC](https://discourse.julialang.org/t/flux-cannot-save-a-parameters/35642/1 "2020-03-06T14:57:27Z")

</div>

Dear Julia community,

I am trying to save parameters for trained RNN with BSON. However it seems that in latest version of FLUX this is not possible, however [https://fluxml.ai](https://fluxml.ai) says something different.  
I create rnn as:  
rnn = Chain(LSTM(12, 128), LSTM(128, 10), Dense(10, 1, relu))

then, create a parameters:  
ps = params(rnn)

then trying to save parameters:  
@save “param.BSON” ps

Here I get an error:  
julia\> @save “param.BSON” ps  
ERROR: UndefRefError: access to undefined reference

Anybody has an idea how to get out of this?

Julia Version 1.2.0  
BSON v0.2.4  
Flux v0.10.0

---

<div class="post-metadata">

### Author: ![jeremiedb](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jeremiedb/32/29150_2.png) [@jeremiedb](https://discourse.julialang.org/u/jeremiedb)
#### Post date: [March 12, 2020, 4:57am UTC](https://discourse.julialang.org/t/flux-cannot-save-a-parameters/35642/2 "2020-03-12T04:57:42Z")

</div>

Have you try saving the result of `data.(ps)`? Though `data` is said to be deprecated, so It effectively seems like the docs needs an update!

---

<div class="post-metadata">

### Author: ![mkschleg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkschleg/32/8035_2.png) [@mkschleg](https://discourse.julialang.org/u/mkschleg)
#### Post date: [March 16, 2020, 3:56pm UTC](https://discourse.julialang.org/t/flux-cannot-save-a-parameters/35642/3 "2020-03-16T15:56:21Z")

</div>

Why not just save the model?

```julia
julia> @save "model.bson" rnn

```

---

<div class="post-metadata">

### Author: ![Owolf](https://avatars.discourse-cdn.com/v4/letter/o/bbce88/32.png) [@Owolf](https://discourse.julialang.org/u/Owolf)
#### Post date: [March 16, 2020, 4:35pm UTC](https://discourse.julialang.org/t/flux-cannot-save-a-parameters/35642/4 "2020-03-16T16:35:30Z")

</div>

This is exactly what I was looking for, thanks.
