I tried to transfer the pre-trained weight from another model to retrain a new one by the code in the tutorial as follows:
function loss(cord,θ)
chain2(cord,θ) .- phi(cord,res.u)
end
strategy = NeuralPDE.GridTraining(0.001)
prob_ = NeuralPDE.neural_adapter(loss, init_params = res.u.depvar, pde_system, strategy)
callback = function (p,l)
println("Current loss is: $l")
return false
end
res_ = Optimization.solve(prob_, BFGS();callback = callback, maxiters=100)
phi_ = NeuralPDE.get_phi(chain)
The chain and the system are the same structure just change the parameters.
I got the message below:
MethodError: no method matching neural_adapter(::typeof(loss), ::PDESystem, ::GridTraining{Float64}; init_params::ComponentArrays.ComponentVector{Float64, SubArray{Float64, 1, Vector{Float64}, Tuple{UnitRange{Int64}}, true}, Tuple{ComponentArrays.Axis{(u1 = ViewAxis(1:321, Axis(layer_1 = ViewAxis(1:32, Axis(weight = ViewAxis(1:16, ShapedAxis((16, 1), NamedTuple())), bias = ViewAxis(17:32, ShapedAxis((16, 1), NamedTuple())))), layer_2 = ViewAxis(33:304, Axis(weight = ViewAxis(1:256, ShapedAxis((16, 16), NamedTuple())), bias = ViewAxis(257:272, ShapedAxis((16, 1), NamedTuple())))), layer_3 = ViewAxis(305:321, Axis(weight = ViewAxis(1:16, ShapedAxis((1, 16), NamedTuple())), bias = ViewAxis(17:17, ShapedAxis((1, 1), NamedTuple())))))), u2 = ViewAxis(322:642, Axis(layer_1 = ViewAxis(1:32, Axis(weight = ViewAxis(1:16, ShapedAxis((16, 1), NamedTuple())), bias = ViewAxis(17:32, ShapedAxis((16, 1), NamedTuple())))), layer_2 = ViewAxis(33:304, Axis(weight = ViewAxis(1:256, ShapedAxis((16, 16), NamedTuple())), bias = ViewAxis(257:272, ShapedAxis((16, 1), NamedTuple())))), layer_3 = ViewAxis(305:321, Axis(weight = ViewAxis(1:16, ShapedAxis((1, 16), NamedTuple())), bias = ViewAxis(17:17, ShapedAxis((1, 1), NamedTuple())))))))}}})
Closest candidates are:
neural_adapter(::Any, ::Any, ::Any, ::Any) got unsupported keyword argument "init_params"
@ NeuralPDE C:\Users\htran\.julia\packages\NeuralPDE\PL790\src\neural_adapter.jl:120
neural_adapter(::Array, ::Any, ::Array, ::Any) got unsupported keyword argument "init_params"
@ NeuralPDE C:\Users\htran\.julia\packages\NeuralPDE\PL790\src\neural_adapter.jl:130
Stacktrace:
[1] top-level scope
@ In[79]:23
Please help me on how to fix it.
thank you all.