Keras.NET does not save and load sequential models #238
Unanswered
senatorbard
asked this question in
Q&A
Replies: 1 comment
-
Hi, I'm not familiar with Keras.NET but I developed the model saving/loading of Tensorflow.NET (which also supports keras APIs). Maybe using Tensorflow.NET is an alternative though it is far from a best solution. Have you submitted an issue to Keras.NET? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello,
I'm in desperate need of your help. When I use Keras.NET, I cannot save sequential models. To be clear, I'm asking about Keras.NET, not keras (that most people use on python). There are no answers anywhere on the internet.
I use the following code, which is displayed on the Keras.NET examples:
//Save model and weights
string json = model.ToJson();
File.WriteAllText("model.json", json);
model.SaveWeight("model.h5");
//Load model and weight
var loaded_model = Sequential.ModelFromJson(File.ReadAllText("model.json"));
loaded_model.LoadWeight("model.h5");
Additionally, I've also tried:
Keras.Models.Sequential.LoadModel(FilePath)
Model.Save(FilePath)
When I try to load the model, c# tells me that I cannot cast type basemodel to type sequential. It seems that the model is saved as a basemodel. But I cannot reload the model because it cannot be cast as a sequential model.
Please help me!
Beta Was this translation helpful? Give feedback.
All reactions