I trained a model earlier in Flux.jl and saved it by doing:
@save "mymodel.bson" model
Now I want to load that model back and use it again. How can I achieve this in Flux?
Similar to the @save
macro used above, there is also a built in @load
macro which comes from the BSON package. You can access it by doing using BSON: @load
and then quite simply do something like:
julia> using Flux
julia> using BSON: @load
julia> @load "mymodel.bson" model
julia> model
Chain(Dense(10, 5, NNlib.relu), Dense(5, 2), NNlib.softmax)
You can find out more about saving and loading models in the Flux.jl docs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With