-
-
Notifications
You must be signed in to change notification settings - Fork 613
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Some models saved under Flux v0.14 do not load on v0.15+ #2584
Comments
I don't recall any built-in layers which have a |
A possible cause is Functors v0.5 recursing into arbitrary custom structs? For built-in layers, Flux.state does typically save integers like padding, does not load them (since they are immutable), but does complain if they don't match: julia> st = Flux.state(Conv((2,), 1=>1, pad=1, stride=2))
(σ = (), weight = Float32[-0.8863135; -0.70230323;;;], bias = Float32[0.0], stride = (2,), pad = (1, 1), dilation = (1,), groups = 1)
julia> Flux.loadmodel!(Conv((2,), 1=>1, pad=0, stride=0), st)
Conv((2,), 1 => 1, stride=0) # 3 parameters
julia> Flux.loadmodel!(Conv((2,), 1=>1, pad=0, stride=0), st[propertynames(st)[1:end-1]])
ERROR: ArgumentError: Tried to load (:pad, :σ, :weight, :bias, :stride, :dilation) into (:pad, :σ, :weight, :bias, :groups, :stride, :dilation) but the structures do not match. One possible remedy might be to define a method of Lines 24 to 28 in 44695a0
|
Using
u = Flux.loadmodel!(empty_model, model_state)
leads to the following error
since in Flux v0.14
pad_size
is not stored extra (model_state2
) whereas in the new version it is (model_state
)Is there a workaround to upgrade old model states?
The text was updated successfully, but these errors were encountered: