Closed John-Boik closed 2 months ago
I mentioned in my main post that the neural SDE tutorial example does not run as given. Here are the errors I get when I run the code.
The first is UndefVarError: ActivationFunction not defined
, which occurs when defining the drift neural network. That can be fixed simply by using x -> x.^3
instead.
The next is ComponentArray not defined
which occurs at p1 = Lux.ComponentArray(p1)
. That can be fixed by using p1 = ComponentArrays.ComponentArray(p1)
.
The next is:
MethodError: no method matching (::DiffEqFlux.NeuralDSDE{…})(::Vector{…}, ::Vector{…}, ::@NamedTuple{…}, ::@NamedTuple{})
Closest candidates are:
(::DiffEqFlux.NeuralDSDE)(::Any, ::Any, ::Any)
@ DiffEqFlux ~/.julia/packages/DiffEqFlux/TglmB/src/neural_de.jl:95
which occurs at prediction0, st1, st2 = neuralsde(u0,p,st1,st2)
.
This can be fixed by calling Lux.setup on neuralsde, as I mention in my main post:
p, st = Lux.setup(rng, neuralsde)
prediction0, st = neuralsde(u0,p,st)
Okay yeah, I'd first say that the v6 tutorials are more than 2 years old and won't necessarily be a good guide for v7 usage. There's a major version between them because there are breaking differences, some of which you see and highlighted here. I'd highly recommend just using the updated version and tutorial.
Note: I have deleted my original post and replaced it with the note here. My post concerned the tutorial Neural Stochastic Differential Equations. But I realize now that it is outdated, and the new tutorial to follow is Neural Stochastic Differential Equations With Method of Moments.
When I tried to run the new tutorial, I received the same error as before, the first few lines of which are:
However, the error was apparently caused a package that is used in the tutorial, or an extra one that I imported, but which has been updated and fixed in the last few days. In my original example, and in running the new tutorial, I imported those used in the new tutorial, and also the following:
I'm not sure which package caused the problem, but when I generated a new project today and imported only the packages used in the new tutorial (and also Lux and Zygote), the error disappeared. If someone else receives the same error as above, it is likely due an outdated package or some package conflict.