You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Flux.train! goes through the first iteration resulting in 1 call to the callback function after which the process seems to get stuck. We've used htop to verify that the Julia process stops using any CPU at all after a few minutes into this step.
We're are currently using Flux.train! for a NeuralODE problem, the code for which is attached below:
# =====================================# Defining the parameters of the system# =====================================
Linear=0.0001*rand(nX,nX);
Quadratic=0.001*rand(nX,nX,nX);
BMat=0.01*rand(nX,nU);
# packing up the coefficients into parameters vector
pLin=Linear[:];
len_pL=length(pLin);
pQuad=Quadratic[:];
len_pQ=length(pQuad);
pB=BMat[:];
len_pB=length(pB);
p=[pLin;pQuad;pB];
# RHS of the systemfunctionSyst_RHS!(dX,X,p,t)
# Dismantling the parameters of the neural network
LTerm=reshape(p[1:len_pL],nX,nX);
QTerm=reshape(p[len_pL+1:len_pQ+len_pL],nX,nX,nX);
BTerm=reshape(p[len_pL+len_pQ+1:end],nX,nU);
U=zeros(nU)
if t<=TCtrlOn
U=UVec;
else
U.=0.0;
endfor iState=1:1:nX
dX[iState]=dot(LTerm[iState,:],X)+X'*(transpose(QTerm[iState,:,:])*X);
dX[iState]=dX[iState]+dot(BTerm[iState,:],U); # Adding the controlendend# ==================# Setup ODE problem# ==================
X0=XDat[1,:]; #init conditionsprintln("size X0 is", size(X0))
TSpan=(0.0,TFin);
prob_nn =ODEProblem(Syst_RHS!, X0, TSpan, p);
println("Solving with untrained params...")
sol =Array(solve(prob_nn, Tsit5(),saveat=TVec))
# ================# Training set up# ================# Forward pass functionfunctionpredict_adjoint() # Trainable layerArray(solve(prob_nn, Tsit5(), saveat=TVec, reltol=1e-4))
end# Loss functionfunctionloss_adjoint()
prediction =predict_adjoint()
loss =sum((prediction - XDat').^2); # L2 normreturn loss
end# Defining learning parameters
opt=ADAM(0.1);
params=Flux.params(p)
losshistory = []
cb =function () #callback function to observe trainingpush!(losshistory,loss_adjoint());
display(loss_adjoint());
end# Display the ODE with the initial parameter values.cb()
@info"Start training"
Flux.train!(loss_adjoint, params, Iterators.repeated((), 100), opt, cb = cb)
@info"Finished Training"
The text was updated successfully, but these errors were encountered:
Flux.train! goes through the first iteration resulting in 1 call to the callback function after which the process seems to get stuck. We've used htop to verify that the Julia process stops using any CPU at all after a few minutes into this step.
We're are currently using Flux.train! for a NeuralODE problem, the code for which is attached below:
The text was updated successfully, but these errors were encountered: