if os.path.exists("tcn.npz"):
// Load checkpoint if file exists.
w = np.load("tcn.npz", allow_pickle=True)["w"]
print("Model reloaded.")
model.set_weights(w.tolist())
else:
// Save the checkpoint.
w = np.array(model.get_weights())
After Change
// get model as json string and save to file
model_as_json = model.to_json()
with open(r"model.json", "w") as json_file:
json_file.write(model_as_json)
// save weights to file (for this format, need h5py installed)
model.save_weights("weights.h5")