You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
model = Chain(Dense(10 => 5,relu),Dense(5 => 2),softmax)
79
79
80
-
julia>using BSON:@load
80
+
# load one model into another
81
+
model = loadmodel!(model, @load("mymodel.bson"))
82
+
```
81
83
82
-
julia>@load"mymodel.bson" weights
84
+
This ensures that the model loaded from `"mymodel.bson"` matches the structure of `model`. [`Flux.loadmodel!`](@ref) is also convenient for copying parameters between models in memory.
83
85
84
-
julia> Flux.loadparams!(model, weights)
86
+
```@docs
87
+
Flux.loadmodel!
88
+
Flux.isloadleaf
89
+
Flux.loadleaf!
85
90
```
86
91
87
-
The new `model` we created will now be identical to the one we saved parameters for.
88
-
89
92
## Checkpointing
90
93
91
94
In longer training runs it's a good idea to periodically save your model, so that you can resume if training is interrupted (for example, if there's a power cut). You can do this by saving the model in the [callback provided to `train!`](training/training.md).
0 commit comments