-
Notifications
You must be signed in to change notification settings - Fork 535
Ability to save a trained model #932
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
keras: is this what you want ? |
I think like that it will give me a FileNotFound exception in HDF5CSharp.dll. |
. |
I get. I can't solve this problem. |
Tensorflow.Keras.Engine.Model save method isn't working. It calls ModelSaver which seems to be only half implemented, ending in a _build_meta_graph empty function. Is there an alternative working method to save a Keras model to HDF5? |
I saw an example that uses another approach, by defining |
Thank you for your answer. |
@Oceania2018 so there is no way to load anything into an untrained model? i like the work u did here, but that's quite depressing. Greetings Fire |
There is a approach you can load the saved model the |
I absolutely agree. It makes it pointless to continue use of this library, if you cannot save a trained model. And yes, it is possible to load a saved model, but that's not the focus point of this issue. |
We agree that the ability to save model is significant and I'm now working on it. Once I finish it, I'll tell you about it. :) |
The model saving of pb format has been partially finished and merged. #976 It supports saving trained model with keras and the model can be directly loaded with tensorflow python. For the usage please refer to example of alexnet saving, which is approximately same with tensorflow python API. Welcome to have a try with this feature and share the BUGs and lacked features with us! I'll continue to complete this feature and add the model loading of pb format. For details of this feature please refer to #976 (comment). The main incomplete parts are checkpoint and RNN. |
The model loading of SavedModel format in keras is also supported now. Here is an example to load Alexnet. Support for loading more complex models such as Bert is under development now by @Oceania2018 . |
Still cant save model if using SciSharp.TensorFlow.Redist-Windows-GPU. Getting NotImplementedException at Tensorflow.CheckPointMultiDeviceSaver.save method. TensorFlow.NET\src\TensorFlowNET.Core\Checkpoint\functional_saver.cs, ln 383 |
Hi, could you please provide a minimal example to reproduce this exception. The model saving is not complete and still in rapid development. I'd like to work on your problem first :) |
When will the save be fixed? What is the point of this project if you cant save a model? |
Sorry for late response.. Code is here:
|
@individ2016 Could you please provide the version you used? I trued the code above and it works under both v0.100.2 and v0.100.4. |
Have you tried it with a GPU? Notice this code:
|
@Bender209 Yes, the code to specify the device is risky and will be fixed later. What's the problem you met when saving the model? I'll help to fix it. |
TensorFlow.NET v0.100.4 Yep, its on GPU. When i'm using CPU its all ok. Thats why now i train model, save weights, then switch to CPU, create model, load weights, then i can save full model)) |
It appears we are both trying to save a model with GPU. We both are getting the same exception. I think the cause is that it is pointing to the CPU device = _tf.device("CPU"); // may be risky. Is this the case? To me it seems likely. |
I've reappeared the error and am working on it. It's more than just changing the behavior of |
Thank you I am looking forward to it. |
It's faster than I expected. I've submitted a PR that resolves the error when saving model with GPU #1023. It will be merged after the review from @Oceania2018. Also, you are welcomed to fetch the branch and review if this PR resolves the problem well. Since model saving and loading is a big feature of tensorflow, it's still not complete and is in rapid development. Please don't hesitate to tell us the if you met some problems when using it. Thank you for reporting us this BUG. :) |
Thank you for telling us it. I guess #1023 can resolve your problem. 😊 |
Thank you I am now able to save models. |
Closing since TensorFlow.NET could save a trained model already, please reopen if you still have question, thanks! |
Is there an example of how to save a trained model, I have spent a significant amount of time trying to figure it out, but I am unsuccessful.
The text was updated successfully, but these errors were encountered: