NeualPDE Model Save/Load


After training with NeuralPDE framework, how can we save the trained model for further operations?
in Flux framework, @save and @load functionas are available and we can save/load the model as a BSON file. But in specific to NeuralPDE, how can we do it?
Thank you

You can store arbitrary Julia objects with serialize/deserialize.

Yes thank you. But I can not understand which part of the NeuralPDE that i have to save/store…

Here is the inference part of the code:

ts = [infimum(d.domain):dx:supremum(d.domain) for d in domains][1];
initθ = discretization.init_params;
acum =  [0;accumulate(+, length.(initθ))];
sep = [acum[i]+1 : acum[i+1] for i in 1:length(acum)-1];
minimizers = [res.minimizer[s] for s in sep];
ups1 = [phi[1]([t], minimizers[1])[1] for t in ts];
ups2 = [phi[2]([t], minimizers[2])[1] for t in ts];
ups3 = [phi[3]([t], minimizers[3])[1] for t in ts];
ups4 = [phi[4]([t], minimizers[4])[1] for t in ts];

do i have to store all the objects : phi, minimizers, initθ ???

If you store just the final minimal parameters (res.minimizer, or res), then you have everything to recreate the solution.

1 Like

OK thank you. it worked.