So, I am training a neural network model using Flux package in Julia. During training, each iteration that acquires an improvement in the model, the latter is saved in my computer.
For this, I use the line:
if acc_te[epoch_i] >= best_acc
@info(" -> New best accuracy! Saving model out to mymodel.bson")
@save "mymodel.bson" m
best_acc = acc_te[epoch_i];
last_improvement = epoch_i;
end
Which I assume is pretty standard (I extracted it from model-Zoo).
At the end of the training, it is fair to assume that the saved model "mymodel.bson" is the best I got. So far so good!. Now, the problem:
Next morning, I open a terminal and this is what happens (every time is the same):
julia>using Flux;
julia>using BSON: @save
julia>using BSON: @load
julia> @load "mymodel.bson" model
ERROR: KeyError: key :model not found
Stacktrace:
[1] getindex(::Dict{Symbol,Any}, ::Symbol) at ./dict.jl:477
[2] top-level scope at /home/gbrunini/.julia/packages/BSON/XAts7/src/BSON.jl:53
julia>
julia> #maybe try another name
julia> @load "mymodel.bson" someothername
ERROR: KeyError: key :someothername not found
Stacktrace:
[1] getindex(::Dict{Symbol,Any}, ::Symbol) at ./dict.jl:477
[2] top-level scope at /home/gbrunini/.julia/packages/BSON/XAts7/src/BSON.jl:53
julia> #maybe try another name
.....same error...
julia> #maybe try another name
.... same error....
julia> #maybe try another name
.... same error....
julia> #maybe try another name
julia>@load "mymodel.bson" m # eureca! this name works!
Why is this happening? Are there some forbidden names? Sometimes it works with other names, but I always have to try at least 5-6 different names until I find someone that works! t's getting annoying
What am I doing wrong?
Thanks in advance and stay safe!