ModelCheckpoint in L-BFGS: no '.pt' file #850
Unanswered
ShengqiangSKR
asked this question in
Q&A
Replies: 2 comments 5 replies
-
L-BFGS will not save checkpoints during optimization. |
Beta Was this translation helpful? Give feedback.
2 replies
-
Dear @lululxvi Many Thanks |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I use ‘adam’ as my first optimizer, after 200000 epochs, restore the best model, then i change to 'L-BFGS-B', beacause nan was found during the L-BFGS-B training process, so i add a ModelCheckpoint into it. at the adam stage, the '.pt' file generated, but at the L-BFGS-B stage, no '.pt' file was found. MAYBE i did something wrong in my code, can anyone help? here is me code:
data = dde.data.TimePDE(
geomtime, pde_euler_1d,
[ic_rho, ic_p, ic_u, bc_u, bc_p_l, bc_p_r, bc_rho_l, bc_rho_r,],
num_domain=10000, num_boundary=1000, num_initial=1000)
net = dde.nn.FNN([2] + [80] * 7 + [3], "tanh", "Glorot normal")
model = dde.Model(data, net)
loss_weights = [1, 1, 1, 10, 10, 10, 1, 1, 1, 1, 1]
model.compile("adam", lr=1e-4, loss_weights=loss_weights)
checkpointer = dde.callbacks.ModelCheckpoint("model/model.ckpt", save_better_only=True, period=1000)
losshistory, train_state = model.train(epochs=3000, (callbacks=[checkpointer])
model.restore("./model/model" + ".ckpt-" + str(train_state.best_step) + '.pt', verbose=1)
model.compile("L-BFGS-B", loss_weights=loss_weights)
losshistory, train_state = model.train(callbacks=[checkpointer])
dde.saveplot(losshistory, train_state, issave = True, isplot = True)
Beta Was this translation helpful? Give feedback.
All reactions