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
I am interested in Keras Api using the Subclass style for building the model. I clone example and run example MNIST CNN (Keras Subclass).
I use save_weights function but get errors as below.
Could you give any idea to save the model or weights? Thank you very much.
Snip of code:
{
x_test = x_test["::100"];
y_test = y_test["::100"];
var pred = conv_net.Apply(x_test);
accuracy_test = (float)accuracy(pred, y_test);
print($"Test Accuracy: {accuracy_test}");
}
conv_net.save_weights("subclass_mnist_model"); // I added this
return accuracy_test > 0.90;
Error throw:
Choose one example to run, hit [Enter] to run all: 15
2021-09-08 오전 8:12:50 Starting MNIST CNN (Keras Subclass)
The file C:\Users\Quan\AppData\Local\Temp\mnist.npz already exists
2021-09-08 17:12:51.202274: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
step: 10, loss: 1.7204771, accuracy: 0.83
step: 20, loss: 1.5916963, accuracy: 0.898
step: 30, loss: 1.5561028, accuracy: 0.932
step: 40, loss: 1.5472074, accuracy: 0.944
step: 50, loss: 1.5292175, accuracy: 0.963
step: 60, loss: 1.507012, accuracy: 0.978
step: 70, loss: 1.5141329, accuracy: 0.968
step: 80, loss: 1.4908792, accuracy: 0.989
step: 90, loss: 1.4994849, accuracy: 0.978
Test Accuracy: 0.96
HDF5-DIAG: Error detected in HDF5 (1.10.5) thread 37204:
#000: C:\projects\hdf-pinvoke-1-10\CMake-hdf5-1.10.5\hdf5-1.10.5\src\H5L.c line 790 in H5Lexists(): not a location
major: Invalid arguments to routine
minor: Inappropriate type
#001: C:\projects\hdf-pinvoke-1-10\CMake-hdf5-1.10.5\hdf5-1.10.5\src\H5Gloc.c line 246 in H5G_loc(): invalid object ID major: Invalid arguments to routine
minor: Bad value
HDF5-DIAG: Error detected in HDF5 (1.10.5) thread 37204:
#000: C:\projects\hdf-pinvoke-1-10\CMake-hdf5-1.10.5\hdf5-1.10.5\src\H5D.c line 119 in H5Dcreate2(): not a location ID major: Invalid arguments to routine
minor: Inappropriate type
#001: C:\projects\hdf-pinvoke-1-10\CMake-hdf5-1.10.5\hdf5-1.10.5\src\H5Gloc.c line 246 in H5G_loc(): invalid object ID major: Invalid arguments to routine
minor: Bad value
HDF5CSharp.DataTypes.Hdf5Exception: Unable to create dataset for kernel:0
at HDF5CSharp.Hdf5Utils.GetId(Int64 parentId, String name, Int64 dataType, Int64 spaceId, Hdf5ElementType type)
at HDF5CSharp.Hdf5Utils.GetDatasetId(Int64 parentId, String name, Int64 dataType, Int64 spaceId)
at HDF5CSharp.Hdf5.WriteDatasetFromArray[T](Int64 groupId, String name, Array dset)
at Tensorflow.Keras.Saving.hdf5_format.WriteDataset(Int64 f, String name, Tensor data)
at Tensorflow.Keras.Saving.hdf5_format.save_weights_to_hdf5_group(Int64 f, List`1 layers)
at Tensorflow.Keras.Engine.Model.save_weights(String filepath, Boolean overwrite, String save_format, Object options) at TensorFlowNET.Examples.DigitRecognitionCnnKeras.Run() in E:\Tensorflow.Net\Keras.NetExample\src\TensorFlowNET.Examples\ImageProcessing\MnistCnnKerasSubclass.cs:line 97
at TensorFlowNET.Examples.Program.RunExamples(String key, IExample[] examples) in E:\Tensorflow.Net\Keras.NetExample\src\TensorFlowNET.Examples\Program.cs:line 89
2021-09-08 오전 8:13:20 Completed MNIST CNN (Keras Subclass) ++
Example: MNIST CNN (Keras Subclass) is Failed!
TensorFlow Binary v2.6.0
TensorFlow.NET v0.60.2.0
TensorFlow.Keras v0.6.2.0
1 of 27 example(s) are completed.
Press [Enter] to continue...
The text was updated successfully, but these errors were encountered:
Hi,
I am interested in Keras Api using the Subclass style for building the model. I clone example and run example MNIST CNN (Keras Subclass).
I use
save_weights
function but get errors as below.Could you give any idea to save the model or weights? Thank you very much.
The text was updated successfully, but these errors were encountered: